[Fusionforge-commits] r10551 - in trunk/src: common/include www www/account www/developer www/include www/people www/project/admin www/survey/include
Franck VILLAUME
nerville at libremir.placard.fr.eu.org
Sun Sep 19 18:28:30 CEST 2010
Author: nerville
Date: 2010-09-19 18:28:29 +0200 (Sun, 19 Sep 2010)
New Revision: 10551
Modified:
trunk/src/common/include/User.class.php
trunk/src/www/account/register.php
trunk/src/www/developer/diary.php
trunk/src/www/developer/index.php
trunk/src/www/developer/rate.php
trunk/src/www/include/filechecks.php
trunk/src/www/people/editjob.php
trunk/src/www/people/editprofile.php
trunk/src/www/people/index.php
trunk/src/www/people/people_utils.php
trunk/src/www/people/skills_utils.php
trunk/src/www/people/viewprofile.php
trunk/src/www/project/admin/project_admin_utils.php
trunk/src/www/survey/include/SurveyHTML.class.php
trunk/src/www/tarballs.php
Log:
exit functions migration + various minor fix
Modified: trunk/src/common/include/User.class.php
===================================================================
--- trunk/src/common/include/User.class.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/common/include/User.class.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -368,7 +368,7 @@
$ccode,
$theme_id)) ;
if (!$result) {
- $this->setError(_('Insert Failed') . db_error());
+ $this->setError(_('Insert Failed: ') . db_error());
db_rollback();
return false;
} else {
@@ -616,7 +616,7 @@
$res = db_query_params ('SELECT * FROM users WHERE user_id=$1',
array ($user_id)) ;
if (!$res || db_numrows($res) < 1) {
- $this->setError('GFUser::fetchData()::'.db_error());
+ $this->setError('GFUser::fetchData():: '.db_error());
return false;
}
$this->data_array = db_fetch_array($res);
Modified: trunk/src/www/account/register.php
===================================================================
--- trunk/src/www/account/register.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/account/register.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -68,7 +68,7 @@
logic that used to be coded in this page
*/
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
- exit_form_double_submit();
+ exit_form_double_submit('my');
}
if ($GLOBALS['sys_require_accept_conditions'] && ! $accept_conditions) {
Modified: trunk/src/www/developer/diary.php
===================================================================
--- trunk/src/www/developer/diary.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/developer/diary.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,23 +1,24 @@
<?php
/**
- * GForge Developer's Diary Page
+ * Developer's Diary Page
*
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume
*
- * This file is part of GForge.
+ * This file is part of FusionForge.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -30,8 +31,10 @@
$diary_id = getStringFromRequest('diary_id');
$user_obj=user_get_object($diary_user);
- if (!$user_obj || $user_obj->isError()) {
- exit_error('ERROR','User could not be found: '.$user_obj->getErrorMessage());
+ if (!$user_obj) {
+ exit_error(_('User could not be found.'),'home');
+ } else if ($user_obj->isError()) {
+ exit_error($user_obj->getErrorMessage(),'home');
}
echo $HTML->header(array('title'=>_('My Diary And Notes')));
@@ -57,20 +60,20 @@
}
echo $HTML->boxTop(_('Existing Diary And Note Entries'));
- echo '<table cellspacing="2" cellpadding="0" width="100%" border="0">
-';
+ echo '<table cellspacing="2" cellpadding="0" width="100%" border="0">';
/*
-
List all diary entries
-
*/
$result = db_query_params ('SELECT * FROM user_diary WHERE user_id=$1 AND is_public=1 ORDER BY id DESC',
array ($diary_user));
$rows=db_numrows($result);
if (!$result || $rows < 1) {
- echo '
- <tr><td><strong>'._('This User Has No Diary Entries').'</strong></td></tr>';
- echo db_error();
+ if (db_error()) {
+ exit_error(db_error(),'home');
+ } else {
+ echo '
+ <tr><td><strong>'._('This User Has No Diary Entries').'</strong></td></tr>';
+ }
} else {
echo '
<tr>
@@ -86,16 +89,13 @@
echo '
<tr><td colspan="2" class="tablecontent"> </td></tr>';
}
+
echo "</table>\n";
-
echo $HTML->boxBottom();
-
echo $HTML->footer(array());
} else {
-
- exit_error(_('Error'),_('No User Selected'));
-
+ exit_error(_('No User Selected'),'home');
}
?>
Modified: trunk/src/www/developer/index.php
===================================================================
--- trunk/src/www/developer/index.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/developer/index.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,32 +1,29 @@
<?php
/**
- * GForge Developer's Page
+ * Developer's Page
*
- * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 1999-2001 (c) VA Linux Systems, dtype
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org
*
- * This file is part of GForge.
+ * This file is part of FusionForge.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/*
- Developer Info Page
- Written by dtype Oct 1999
-*/
-
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
@@ -38,16 +35,21 @@
if (isset ($sys_noforcetype) && $sys_noforcetype) {
if (!$user_id) {
- exit_error(_('Missing User Argument'),_('A user must be specified for this page.'));
+ exit_missing_param('',array(_('A user must be specified for this page.')),'home');
} else {
$user =& user_get_object($user_id);
- if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
- exit_error(_('That user does not exist.'),_('Invalid User'));
+ if (!$user || !is_object($user)) {
+ exit_error(_('Invalid User'),'home');
+ } else if ( $user->isError()) {
+ exit_error($user->isError(),'home');
+ } else if ( !$user->isActive()) {
+ exit_error(_('User not active'),'home');
}
+
include $gfwww.'include/user_home.php';
}
} else {
- header("Location: ".util_make_url ('/users/'.user_getname($user_id).'/'));
+ session_redirect('/users/'.user_getname($user_id).'/');
}
?>
Modified: trunk/src/www/developer/rate.php
===================================================================
--- trunk/src/www/developer/rate.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/developer/rate.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,23 +1,24 @@
<?php
/**
- * GForge rate user page
+ * FusionForge rate user page
*
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume
*
- * This file is part of GForge.
+ * This file is part of FusionForge.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -26,17 +27,12 @@
require_once $gfwww.'include/vote_function.php';
if (!session_loggedin()) {
-
exit_not_logged_in();
-
} else {
$me =& session_get_user();
if (!$me->usesRatings()) {
- exit_error(
- _('Ratings turned off'),
- _('You chose not to participate in the peer rating system')
- );
+ exit_error(_('Ratings turned off. You chose not to participate in the peer rating system'),'my');
}
$rated_user = getStringFromRequest('rated_user');
@@ -54,40 +50,39 @@
} else {
//ratings can only be between +3 and -3
if ($rating > 3 || $rating < -3) {
- $feedback .= _('Invalid rate value');
+ $warning_msg .= _('Invalid rate value');
} else {
if ($rating) {
// get rid of 0.1 thing
$rating = (int)$rating;
//user did answer this question, so insert into db
- $res=db_query_params ('SELECT * FROM user_ratings
-WHERE rated_by=$1 AND user_id=$2 AND rate_field=$3',
- array($ruser,
- $rated_user,
- $i)) ;
+ $res=db_query_params ('SELECT * FROM user_ratings WHERE rated_by=$1 AND user_id=$2 AND rate_field=$3',
+ array($ruser,
+ $rated_user,
+ $i)) ;
if ($res && db_numrows($res) > 0) {
- $res=db_query_params ('DELETE FROM user_ratings
-WHERE rated_by=$1 AND user_id=$2 AND rate_field=$3',
- array($ruser,
- $rated_user,
- $i)) ;
+ $res=db_query_params ('DELETE FROM user_ratings WHERE rated_by=$1 AND user_id=$2 AND rate_field=$3',
+ array($ruser,
+ $rated_user,
+ $i)) ;
}
- $res=db_query_params ('INSERT INTO user_ratings (rated_by,user_id,rate_field,rating)
-VALUES ($1,$2,$3,$4)',
- array($ruser,
- $rated_user,
- $i,
- $rating)) ;
+ $res=db_query_params ('INSERT INTO user_ratings (rated_by,user_id,rate_field,rating) VALUES ($1,$2,$3,$4)',
+ array($ruser,
+ $rated_user,
+ $i,
+ $rating)) ;
- echo db_error();
+ if(db_error()) {
+ exit_error(db_error(),'my');
+ }
}
}
}
}
} else {
- exit_error(_('Error'),_('You can\'t rate yourself'));
+ exit_error(_('You can\'t rate yourself'),'my');
}
echo $HTML->header(array('title'=>_('User Ratings Page')));
@@ -98,7 +93,6 @@
<p> </p>';
echo $HTML->footer(array());
-
}
?>
Modified: trunk/src/www/include/filechecks.php
===================================================================
--- trunk/src/www/include/filechecks.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/include/filechecks.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -2,10 +2,25 @@
/**
* File checking functions
*
- * SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@@ -45,7 +60,7 @@
for ($i=0;$i<count($output);$i++) {
$exitout .= "<br />" . $output[$i] . "\n";
}
- exit_error("Failed tar/gz integrity check.","Output follows: <p>$exitout</p>");
+ exit_error(sprintf(_('Failed tar/gz integrity check. Output follows: <p>$s</p>'),$exitout),'');
}
}
@@ -60,7 +75,7 @@
for ($i=0;$i<count($output);$i++) {
$exitout .= "<br />" . $output[$i] . "\n";
}
- exit_error("Failed gzip integrity check.","Output follows: <p>$exitout</p>");
+ exit_error(sprintf(_('Failed gzip integrity check. Output follows: <p>$s</p>'),$exitout),'');
}
}
@@ -153,15 +168,15 @@
}
if (!$filetype) {
- exit_error ("Unknown file type","This file does not have a system-recognized filename type.");
+ exit_error (_('This file does not have a system-recognized filename type.'),'');
}
if (!$filename) {
- exit_error ("File does not exist","You must supply a filename.");
+ exit_error (_('File does not exist. You must supply a filename.'),'');
}
if (!file_exists("$GLOBALS[FTPINCOMING_DIR]/$filename")) {
- exit_error ("File does not exist","File $filename is not in incoming FTP directory.");
+ exit_error (sprintf(_('File does not exist. File %s is not in incoming FTP directory.'),$filename),'');
}
return $filetype;
}
Modified: trunk/src/www/people/editjob.php
===================================================================
--- trunk/src/www/people/editjob.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/editjob.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,25 +1,26 @@
<?php
/**
- * GForge Help Wanted
+ * Help Wanted
*
* Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
- * This file is part of GForge.
+ * This file is part of FusionForge.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -28,7 +29,7 @@
require_once $gfwww.'people/people_utils.php';
if (!forge_get_config('use_people')) {
- exit_disabled();
+ exit_disabled('home');
}
$group_id = getIntFromRequest('group_id');
@@ -48,17 +49,16 @@
create a new job
*/
if (!$title || !$description || $category_id==100) {
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Title'),_('Description'),_('Category')),'home');
}
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
- exit_form_double_submit();
+ exit_form_double_submit('home');
}
$result=db_query_params("INSERT INTO people_job (group_id,created_by,title,description,post_date,status_id,category_id)
VALUES ($1, $2, $3, $4, $5, $6, $7)",
array($group_id, user_getid(), htmlspecialchars($title), htmlspecialchars($description), time(), '1',$category_id));
if (!$result || db_affected_rows($result) < 1) {
- $feedback .= _('JOB insert FAILED');
- echo db_error();
+ $error_msg .= sprintf(_('JOB insert FAILED: %s'),db_error());
form_release_key(getStringFromRequest("form_key"));
} else {
$job_id=db_insertid($result,'people_job','job_id');
@@ -71,14 +71,13 @@
*/
if (!$title || !$description || $category_id==100 || $status_id==100 || !$job_id) {
//required info
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Title'),_('Description'),_('Category'),_('Status'),_('Job')),'home');
}
$result=db_query_params("UPDATE people_job SET title=$1,description=$2,status_id=$3,category_id=$4 WHERE job_id=$5 AND group_id=$6",
array(htmlspecialchars($title), htmlspecialchars($description), $status_id, $category_id, $job_id, $group_id));
if (!$result || db_affected_rows($result) < 1) {
- $feedback = _('JOB update FAILED');
- echo db_error();
+ $error_msg = sprintf(_('JOB update FAILED : %s'),db_error());
} else {
$feedback = _('JOB updated successfully');
}
@@ -89,14 +88,14 @@
*/
if ($skill_id == "xyxy" || $skill_level_id==100 || $skill_year_id==100 || !$job_id) {
//required info
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Skill'),_('Skill Level'),_('Skill Year'),_('Job')),'home');
}
if (people_verify_job_group($job_id,$group_id)) {
people_add_to_job_inventory($job_id,$skill_id,$skill_level_id,$skill_year_id);
$feedback .= _('JOB updated successfully');
} else {
- $feedback .= _('JOB update failed - wrong project_id');
+ $error_msg .= _('JOB update failed - wrong project_id');
}
} else if (getStringFromRequest('update_job_inventory')) {
@@ -105,20 +104,19 @@
*/
if ($skill_level_id==100 || $skill_year_id==100 || !$job_id || !$job_inventory_id) {
//required info
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Skill Level'),_('Skill Year'),_('Job'),_('Job Inventory')),'home');
}
if (people_verify_job_group($job_id,$group_id)) {
$result=db_query_params("UPDATE people_job_inventory SET skill_level_id=$1,skill_year_id=$2 WHERE job_id=$3 AND job_inventory_id=$4",
array($skill_level_id, $skill_year_id, $job_id, $job_inventory_id));
if (!$result || db_affected_rows($result) < 1) {
- $feedback .= _('JOB skill update FAILED');
- echo db_error();
+ $error_msg .= sprintf(_('JOB skill update FAILED : %s'), db_error());
} else {
$feedback .= _('JOB skill updated successfully');
}
} else {
- $feedback .= _('JOB skill update failed - wrong project_id');
+ $error_msg .= _('JOB skill update failed - wrong project_id');
}
} else if (getStringFromRequest('delete_from_job_inventory')) {
@@ -127,19 +125,18 @@
*/
if (!$job_id) {
//required info
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Job')),'home');
}
if (people_verify_job_group($job_id,$group_id)) {
$result = db_query_params("DELETE FROM people_job_inventory WHERE job_id=$1 AND job_inventory_id=$2", array($job_id, $job_inventory_id));
if (!$result || db_affected_rows($result) < 1) {
- $feedback .= _('JOB skill delete FAILED');
- echo db_error();
+ $error_msg .= sprintf(_('JOB skill delete FAILED : %s'),db_error());
} else {
$feedback .= _('JOB skill deleted successfully');
}
} else {
- $feedback .= _('JOB skill delete failed - wrong project_id');
+ $error_msg .= _('JOB skill delete failed - wrong project_id');
}
}
@@ -152,8 +149,7 @@
//for security, include group_id
$result=db_query_params("SELECT * FROM people_job WHERE job_id=$1 AND group_id=$2", array($job_id, $group_id));
if (!$result || db_numrows($result) < 1) {
- echo db_error();
- $feedback .= _('POSTING fetch FAILED');
+ $error_msg .= sprintf(_('POSTING fetch FAILED: %s'),db_error());
echo '<h2>'._('No such posting for this project').'</h2>';
} else {
@@ -192,7 +188,7 @@
if (!$group_id) {
exit_no_group();
} else {
- exit_permission_denied();
+ exit_permission_denied('home');
}
}
Modified: trunk/src/www/people/editprofile.php
===================================================================
--- trunk/src/www/people/editprofile.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/editprofile.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,11 +1,27 @@
<?php
/**
- *
* Skills input/update page.
*
- * Portions Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002 (c) Silicon and Software Systems (S3)
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2002 (c) Silicon and Software Systems (S3)
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('../env.inc.php');
@@ -14,12 +30,14 @@
require_once $gfwww.'people/skills_utils.php';
if (!forge_get_config('use_people')) {
- exit_disabled();
+ exit_disabled('home');
}
$group_id = getIntFromRequest('group_id');
$job_id = getStringFromRequest('job_id');
$feedback = '';
+$warning = '';
+$error_msg = '';
if (session_loggedin()) {
@@ -30,22 +48,21 @@
update the job's description, status, etc
*/
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
- exit_form_double_submit();
+ exit_form_double_submit('my');
}
$result=db_query_params('UPDATE users SET people_view_skills=$1
-WHERE user_id=$2', array($people_view_skills, $user_getid()));
+WHERE user_id=$2', array($people_view_skills, user_getid()));
if (!$result || db_affected_rows($result) < 1) {
form_release_key(getStringFromRequest("form_key"));
- $feedback .= _('User update FAILED');
- echo db_error();
+ $error_msg .= sprintf(_('User update FAILED: %s'),db_error());
} else {
$feedback .= _('User updated successfully');
}
} else if (getStringFromRequest('AddSkill')) {
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
- exit_form_double_submit();
+ exit_form_double_submit('my');
}
$type = getStringFromRequest('type');
@@ -73,7 +90,7 @@
AND start=$4
AND finish=$5
AND keywords=$6",
- array($user_getid(), $type, $title, $start, $finish, $keywords));
+ array(user_getid(), $type, $title, $start, $finish, $keywords));
if (db_numrows($result) >= 1) {
$feedback .= ''; /* don't tell them anything! */
@@ -83,16 +100,15 @@
if (!$result || db_affected_rows($result) < 1) {
form_release_key(getStringFromRequest("form_key"));
- echo db_error();
- $feedback .= _('Failed to add the skill');
- echo '<h2>'._('Failed to add the skill').'<h2>';
+ $error_msg .= sprintf(_('Failed to add the skill %s'),db_error());
+ echo '<h2>'._('Failed to add the skill').'</h2>';
} else {
$feedback = _('Skill added successfully');
}
}
} else {
form_release_key(getStringFromRequest("form_key"));
- exit_error(_('error - missing info'),_('Fill in all required fields'));
+ exit_missing_param('',array(_('Type'),_('Title'),_('Start Month'),_('Start Year'),_('End Month'),_('End Year'),_('Keywords')),'my');
}
}
if (getStringFromRequest('MultiEdit')) {
@@ -105,9 +121,12 @@
$keywords = getStringFromRequest('keywords');
$skill_edit = getStringFromRequest('skill_edit');
- $numItems = count($skill_edit);
+ $numItems = 0;
+ if (is_array($skill_edit)) {
+ $numItems = count($skill_edit);
+ }
if($numItems == 0) {
- $feedback .= _('No skills selected to edit.');
+ $warning .= _('No skills selected to edit.');
} else {
if (getStringFromRequest('confirmMultiEdit')) {
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
@@ -124,8 +143,7 @@
array($type[$i], $title[$i], $startY[$i].$startM[$i], $endY[$i].$endM[$i], $keywords[$i], $skill_edit[$i]));
if (!$result || db_affected_rows($result) < 1) {
- echo db_error();
- $feedback = _('Failed to update skills');
+ $error_msg = sprintf(_('Failed to update skills: %s'),db_error());
break;
} else {
$feedback = ngettext ('Skill updated', 'Skills updated', db_affected_rows($result));
@@ -134,7 +152,7 @@
} else /* not confirmed multiedit */ {
people_header(array('title'=>_('Skills edit')));
- echo '<span class="important">'._('Edit Skills').'</span>';
+ echo '<h2>'._('Edit Skills').'</h2>';
echo _('Change the required fields, and press "Done" at the bottom of the page');
echo '<form action="'.getStringFromServer('PHP_SELF').'" method="post">';
echo '<input type="hidden" name="form_key" value="'.form_generate_key().'">';
@@ -148,20 +166,20 @@
}
}
} else if (getStringFromRequest('cancelMultiEdit')) {
- $feedback = _('Cancelled skills update');
+ $warning = _('Cancelled skills update');
}
if (getStringFromRequest('MultiDelete')) {
$unfiltered_skill_delete_array = getArrayFromRequest('skill_delete');
$skill_delete = array() ;
- foreach ($unfiltered_skill_delete AS $usd) {
+ foreach ($unfiltered_skill_delete_array AS $usd) {
if (is_numeric ($usd)) {
$skill_delete[] = $usd;
}
- }
+ }
$numItems = count($skill_delete);
if($numItems == 0) {
- $feedback .= _('No skills selected to delete.');
+ $warning .= _('No skills selected to delete.');
} else {
if(getStringFromRequest('confirmMultiDelete')) {
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
@@ -170,9 +188,8 @@
$result = db_query_params ('DELETE FROM skills_data where skills_data_id = ANY ($1)',
array (db_int_array_to_any_clause ($skill_delete)));
if (!$result || db_affected_rows($result) < 1) {
- echo db_error();
- $feedback .= _('Failed to delete any skills');
- echo '<h2>'._('Failed to delete any skills').'<h2>';
+ $error_msg .= sprintf(_('Failed to delete any skills: %s'),db_error());
+ echo '<h2>'._('Failed to delete any skills').'</h2>';
} else {
$feedback = ngettext ('Skill deleted successfully', 'Skills deleted successfully', db_affected_rows($result));
}
@@ -181,7 +198,7 @@
array (db_int_array_to_any_clause ($skill_delete)));
$rows = db_numrows($result);
if (!$result || $rows < 1) {
- echo db_error();
+ exit_error(db_error(),'my');
} else {
people_header(array('title'=>_('Confirm skill delete')));
@@ -210,24 +227,31 @@
}
} elseif (getStringFromRequest('MultiDeleteCancel')) {
- $feedback .= _('Skill deletion cancelled');
+ $warning .= _('Skill deletion cancelled');
}
people_header(array('title'=>_('Edit Your Profile')));
- html_feedback_top($feedback);
+ if (!empty($error_msg)) {
+ html_error_top($error_msg);
+ }
+ if (!empty($warning)) {
+ html_warning_top($warning);
+ }
+ if (!empty($feedback)) {
+ html_feedback_top($feedback);
+ }
//for security, include group_id
$result = db_query_params("SELECT * FROM users WHERE user_id=$1", array(user_getid()));
if (!$result || db_numrows($result) < 1) {
- echo db_error();
- $feedback .= _('User fetch FAILED');
- echo '<h2>'._('No Such User').'<h2>';
+ $error_msg .= sprintf(_('User fetch FAILED: %s'),db_error());
+ echo '<h2>'._('No Such User').'</h2>';
} else {
echo '
- <h2>'._('Edit Public Permissions').'<h2>
+ <h2>'._('Edit Public Permissions').'</h2>
<form action="'.getStringFromServer('PHP_SELF').'" method="post">
'._('The following option determines if others can see your skills. If they can\'t, you can still enter your skills.').'
<p>
@@ -246,7 +270,7 @@
if (!$skills || db_numrows($skills) < 1) {
echo db_error();
$feedback .= _('No skill types in database (skills_data_types table)');
- echo '<h2>'._('No skill types in database - inform system administrator').'<h2>';
+ echo '<h2>'._('No skill types in database - inform system administrator').'</h2>';
}
$yearArray = array();
Modified: trunk/src/www/people/index.php
===================================================================
--- trunk/src/www/people/index.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/index.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -29,7 +29,7 @@
require_once $gfwww.'project/admin/project_admin_utils.php';
if (!forge_get_config('use_people')) {
- exit_disabled();
+ exit_disabled('home');
}
$group_id = getIntFromRequest('group_id');
Modified: trunk/src/www/people/people_utils.php
===================================================================
--- trunk/src/www/people/people_utils.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/people_utils.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,47 +1,51 @@
<?php
/**
- * GForge Help Wanted
+ * Help Wanted
*
* Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://gforge.org/
+ * Copyright 2002-2004 (c) GForge Team
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
- * This file is part of GForge.
+ * This file is part of FusionForge.
*
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function people_header($params) {
global $group_id,$job_id,$HTML;
+ var_dump($_SERVER);
if ($group_id) {
$params['toptab']='people';
$params['group']=$group_id;
echo site_project_header($params);
+ } else if (strstr($_SERVER['HTTP_REFERER'],'account')){
+ $params['toptab']='my';
+ echo site_user_header($params);
} else {
echo $HTML->header($params);
}
if ($group_id && $job_id) {
- echo ' | '.util_make_link ('/people/editjob.php?group_id='. $group_id .'&job_id='. $job_id,_('Edit Job'));
+ echo util_make_link ('/people/editjob.php?group_id='. $group_id .'&job_id='. $job_id,_('Edit Job'));
}
}
function people_footer($params) {
- global $feedback, $HTML;
- html_feedback_bottom($feedback);
+ global $HTML;
$HTML->footer($params);
}
@@ -96,13 +100,12 @@
$result = db_query_params("INSERT INTO people_skill_inventory (user_id,skill_id,skill_level_id,skill_year_id)
VALUES ($1, $2, $3, $4)", array(user_getid() ,$skill_id, $skill_level_id, $skill_year_id));
if (!$result || db_affected_rows($result) < 1) {
- $feedback .= _('ERROR inserting into skill inventory');
- echo db_error();
+ $error_msg .= sprintf(_('ERROR inserting into skill inventory: %s'),db_error());
} else {
$feedback .= _('Added to skill inventory');
}
} else {
- $feedback .= _('ERROR - skill already in your inventory');
+ $error_msg .= _('ERROR - skill already in your inventory');
}
}
} else {
@@ -299,9 +302,12 @@
$rows=db_numrows($result);
if (!$result || $rows < 1) {
- echo '
+ if (db_error()) {
+ exit_error(db_error(),'admin');
+ } else {
+ echo '
<tr><td colspan="4"><h2>'._('No Skill Inventory Set Up').'</h2></td></tr>';
- echo db_error();
+ }
} else {
for ($i=0; $i < $rows; $i++) {
echo '
@@ -320,7 +326,7 @@
}
//add a new skill
- $i++; //for row coloring
+ (isset($i)) ? $i++ : $i = 0; //for row coloring
echo '
<tr><td colspan="4"><h3>'._('Add a new skill').'</h3></td></tr>
@@ -407,7 +413,7 @@
$rows=db_numrows($result);
if (!isset($i)){$i=1;}
if ($rows < 1) {
- $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td class="error" colspan="4">'._('None Found'). db_error() .'</td></tr>';
+ $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td class="warning" colspan="4">'._('None Found'). db_error() .'</td></tr>';
} else {
for ($i=0; $i < $rows; $i++) {
$return .= '
Modified: trunk/src/www/people/skills_utils.php
===================================================================
--- trunk/src/www/people/skills_utils.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/skills_utils.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -94,7 +94,7 @@
}
}
-function handle_multi_edit($skill_ids) {
+function handle_multi_edit($skill_ids = array()) {
global $HTML;
$result = db_query_params ('SELECT * FROM skills_data WHERE skills_data_id = ANY ($1)',
array (db_int_array_to_any_clause ($skill_ids)));
Modified: trunk/src/www/people/viewprofile.php
===================================================================
--- trunk/src/www/people/viewprofile.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/people/viewprofile.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,11 +1,27 @@
<?php
/**
- *
* Skills viewer page.
*
- * Portions Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002 (c) Silicon and Software Systems (S3)
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2002 (c) Silicon and Software Systems (S3)
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('../env.inc.php');
@@ -14,7 +30,7 @@
require_once $gfwww.'people/skills_utils.php';
if (!forge_get_config('use_people')) {
- exit_disabled();
+ exit_disabled('home');
}
$group_id = getIntFromRequest('group_id');
@@ -62,7 +78,7 @@
/*
Not logged in or insufficient privileges
*/
- exit_error('Error','user_id not found.');
+ exit_error(_('User_id not found.'),'home');
}
?>
Modified: trunk/src/www/project/admin/project_admin_utils.php
===================================================================
--- trunk/src/www/project/admin/project_admin_utils.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/project/admin/project_admin_utils.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -163,7 +163,7 @@
<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
if (is_numeric(db_result($result, $i, 'old_value'))) {
- if (ereg("user|User", $field)) {
+ if (preg_match("/[Uu]ser/i", $field)) {
echo user_getname(db_result($result, $i, 'old_value'));
} else {
echo db_result($result, $i, 'old_value');
@@ -210,7 +210,7 @@
// if we reached 20, then the namespace is depleted - eject eject
if ($curr_num == 20) {
- exit_error("Namespace Failure","Failed to find namespace for database");
+ exit_error(_('Failed to find namespace for database'),'home');
}
}
Modified: trunk/src/www/survey/include/SurveyHTML.class.php
===================================================================
--- trunk/src/www/survey/include/SurveyHTML.class.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/survey/include/SurveyHTML.class.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -39,7 +39,7 @@
return true;
}
- /**
+ /**
* Show survey header
*/
function header($params) {
@@ -468,7 +468,7 @@
$ret="";
if ($s->isUserVote(user_getid())) {
- $ret.= '<div class="error">'. _('Warning - you are about to vote a second time on this survey.').'</div>';
+ $ret.= '<div class="warning">'. _('Warning - you are about to vote a second time on this survey.').'</div>';
}
$ret.= '<form action="/survey/survey_resp.php" method="post">'.
'<input type="hidden" name="group_id" value="'.$group_id.'" />'.
Modified: trunk/src/www/tarballs.php
===================================================================
--- trunk/src/www/tarballs.php 2010-09-19 13:10:18 UTC (rev 10550)
+++ trunk/src/www/tarballs.php 2010-09-19 16:28:29 UTC (rev 10551)
@@ -1,11 +1,28 @@
<?php
/**
- * GForge SCM Tarballs download page
+ * SCM Tarballs download page
*
- * Portions Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2003-2004 (c) GForge
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2003-2004 (c) GForge
+ * Copyright 2010 (c) Franck Villaume
+ * http://fusionforge.org/
*
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
$no_gz_buffer=true;
@@ -20,16 +37,14 @@
}
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
- exit_error(_('Error'),
- _('Error creating group'));
+ exit_error(_('Error creating group'),'home');
} else if ($group->isError()) {
- exit_error(_('Error'),
- $group->getErrorMessage());
+ exit_error($group->getErrorMessage(),'home');
}
// Tarball downloads require the same permissions as SCM read access
if (!forge_check_perm ('scm', $group->getID(), 'read')) {
- exit_permission_denied();
+ exit_permission_denied('home');
}
$group_name=$group->getUnixName();
More information about the Fusionforge-commits
mailing list