require_once('common/mail/MailingListFactory.class.php');
require_once('common/survey/SurveyFactory.class.php');
require_once('common/survey/SurveyQuestionFactory.class.php');
-require_once('www/include/BaseLanguage.class.php');
+require_once('common/include/gettext.php');
//the license_id of "Other/proprietary" license
define('GROUP_LICENSE_OTHER',126);
} else {
if (db_numrows($res) < 1) {
//function in class we extended
- $this->setError('Group Not Found');
+ $this->setError(_('Group Not Found'));
$this->data_array=array();
return false;
} else {
//set up an associative array for use by other functions
db_reset_result($res);
- $this->data_array =& db_fetch_array($res);
+ $this->data_array = db_fetch_array($res);
}
}
}
$perm =& $this->getPermission(session_get_user());
if (!$perm || !is_object($perm) || !$perm->isMember()) {
- // cannot use $Language as it is not created yet
- $this->setError('Permission denied', ERROR__PERMISSION_DENIED_ERROR);
+ $this->setError(_('Permission denied'), ERROR__PERMISSION_DENIED_ERROR);
return false;
}
}
function fetchData($group_id) {
$res = db_query("SELECT * FROM groups WHERE group_id='$group_id'");
if (!$res || db_numrows($res) < 1) {
- $this->setError('fetchData():: '.db_error());
+ $this->setError(sprintf(_('fetchData():: %s'),db_error()));
return false;
}
$this->data_array =& db_fetch_array($res);
* @param string The purpose of the group.
*/
function create(&$user, $full_name, $unix_name, $description, $license, $license_other, $purpose, $unix_box='shell1', $scm_box='cvs1') {
- global $Language;
-
// $user is ignored - anyone can create pending group
if ($this->getID()!=0) {
- $this->setError("Group::create: Group object already exists");
+ $this->setError(_('Group::create: Group object already exists'));
return false;
} else if (strlen($full_name)<3) {
$this->setError(_('Invalid full name'));
return false;
} else if (!account_groupnamevalid($unix_name)) {
- $this->setError(_('Invalid unix name'));
+ $this->setError(_('Invalid Unix name'));
return false;
} else if (db_numrows(db_query("SELECT group_id FROM groups WHERE unix_group_name='$unix_name'")) > 0) {
$this->setError(_('Unix name already taken'));
$this->setError(_('Your project description is too long. Please make it smaller than 256 bytes.'));
return false;
} else if (!$license) {
- $this->setError(_('You do not have chosen a license'));
+ $this->setError(_('You have not chosen a license'));
return false;
} else if ($license!=GROUP_LICENSE_OTHER && $license_other) {
$this->setError(_('Conflicting licenses choice'));
");
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: Could not create group: '.db_error());
+ $this->setError(sprintf(_('ERROR: Could not create group: %s'),db_error()));
db_rollback();
return false;
}
$id = db_insertid($res, 'groups', 'group_id');
if (!$id) {
- $this->setError('ERROR: Could not get group id: '.db_error());
+ $this->setError(sprintf(_('ERROR: Could not get group id: %s'),db_error()));
db_rollback();
return false;
}
$res=db_query($sql);
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: Could not add admin to newly created group: '.db_error());
+ $this->setError(sprintf(_('ERROR: Could not add admin to newly created group: %s'),db_error()));
db_rollback();
return false;
}
* @access public.
*/
function updateAdmin(&$user, $is_public, $license, $type_id, $unix_box, $http_domain) {
- global $Language;
-
$perm =& $this->getPermission($user);
if (!$perm || !is_object($perm)) {
");
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: DB: Could not change group properties: '.db_error());
+ $this->setError(_('ERROR: DB: Could not change group properties: %s'),db_error());
db_rollback();
return false;
}
$new_doc_address,$send_all_docs,$logo_image_id,
$enable_pserver,$enable_anonscm,
$use_ftp,$use_tracker,$use_frs,$use_stats) {
- global $Language;
$perm =& $this->getPermission($user);
// Validate some values
if (!$group_name) {
- $this->setError('Invalid Group Name');
+ $this->setError(_('Invalid Group Name'));
return false;
}
if ($new_doc_address) {
$invalid_mails = validate_emails($new_doc_address);
if (count($invalid_mails) > 0) {
- $this->setError('New Doc Address(es) Appeared Invalid: '.implode(',',$invalid_mails));
+ $this->setError(sprintf (ngettext('New Doc Address Appeared Invalid: %s', 'New Doc Addresses Appeared Invalid: %s', count($invalid_mails)),implode(',',$invalid_mails)));
return false;
}
}
if (!$use_pm) {
$use_pm=0;
}
- if (!$use_pm_depend) {
- $use_pm_depend=0;
+ if (!$use_pm_depend_box) {
+ $use_pm_depend_box=0;
}
if (!$use_scm) {
$use_scm=0;
if (!$use_docman) {
$use_docman=0;
}
- if (!$send_all_tasks) {
- $send_all_tasks=0;
- }
if (!$use_ftp) {
$use_ftp=0;
}
}
if (strlen($short_description)>255) {
- $this->setError('Error updating project information: Maximum length for Project Description is 255 chars.');
+ $this->setError(_('Error updating project information: Maximum length for Project Description is 255 chars.'));
return false;
}
$res = db_query($sql);
if (!$res) {
- $this->setError('Error updating project information: '.db_error());
+ $this->setError(sprintf(_('Error updating project information: %s'), db_error()));
db_rollback();
return false;
}
* @access public.
*/
function setStatus(&$user, $status) {
- global $Language,$SYS;
+ global $SYS;
$perm =& $this->getPermission($user);
if (!$perm || !is_object($perm)) {
// Check that status transition is valid
if ($this->getStatus() != $status
&& !$allowed_status_changes[$this->getStatus().$status]) {
- $this->setError('Invalid Status Change');
+ $this->setError(_('Invalid Status Change'));
return false;
}
WHERE group_id='". $this->getID()."'");
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: DB: Could not change group status: '.db_error());
+ $this->setError(sprintf(_('ERROR: DB: Could not change group status: %s'),db_error()));
db_rollback();
return false;
}
// Log the audit trail
if ($status != $this->getStatus()) {
- $this->addHistory('status', $this->getStatus());
+ $this->addHistory('Status', $this->getStatus());
}
$this->data_array['status'] = $status;
* @param string The name of the new SCM_BOX
*/
function setSCMBox($scm_box) {
- global $Language;
-
if ($scm_box) {
db_begin();
$sql = "UPDATE groups SET scm_box = '$scm_box' WHERE group_id = ".$this->getID();
return true;
} else {
db_rollback();
- $this->setError('Couldn\'t insert SCM_BOX to database');
+ $this->setError(_("Couldn't insert SCM_BOX to database"));
return false;
}
} else {
- $this->setError(_('SCM Box can\'t be empty'));
+ $this->setError(_("SCM Box can't be empty"));
return false;
}
}
}
function delete($sure,$really_sure,$really_really_sure) {
- global $Language;
-
if (!$sure || !$really_sure || !$really_really_sure) {
$this->setMissingParamsError();
return false;
$this->getID() == 1 ||
$this->getID() == $GLOBALS['sys_stats_group'] ||
$this->getID() == $GLOBALS['sys_peer_rating_group']) {
- $this->setError('Cannot Delete System Group');
+ $this->setError(_('Cannot Delete System Group'));
return false;
}
$perm =& $this->getPermission( session_get_user() );
$members =& $this->getMembers();
for ($i=0; $i<count($members); $i++) {
$this->removeUser($members[$i]->getID());
-//echo 'RemoveMembers'.db_error();
}
//
// Delete Trackers
$at_arr =& $atf->getArtifactTypes();
for ($i=0; $i<count($at_arr); $i++) {
if (!is_object($at_arr[$i])) {
- echo "Not Object: ArtifactType: ".$i;
+ printf (_("Not Object: ArtifactType: %d"),$i);
continue;
}
$at_arr[$i]->delete(1,1);
-//echo 'ArtifactTypeFactory'.db_error();
}
//
// Delete Forums
$f_arr =& $ff->getForums();
for ($i=0; $i<count($f_arr); $i++) {
if (!is_object($f_arr[$i])) {
- echo "Not Object: Forum: ".$i;
+ printf (_("Not Object: Forum: %d"),$i);
continue;
}
$f_arr[$i]->delete(1,1);
$pg_arr =& $pgf->getProjectGroups();
for ($i=0; $i<count($pg_arr); $i++) {
if (!is_object($pg_arr[$i])) {
- echo "Not Object: ProjectGroup: ".$i;
+ printf (_("Not Object: ProjectGroup: %d"),$i);
continue;
}
$pg_arr[$i]->delete(1,1);
for ($i=0; $i<db_numrows($res); $i++) {
$Forum = new Forum($news_group,db_result($res,$i,'forum_id'));
if (!$Forum->delete(1,1)) {
- echo "Could Not Delete News Forum: ".$Forum->getID();
+ printf (_("Could Not Delete News Forum: %d"),$Forum->getID());
}
}
$res=db_query("DELETE FROM news_bytes WHERE group_id='".$this->getID()."'");
$s_arr =& $sf->getSurveys();
for ($i=0; $i<count($s_arr); $i++) {
if (!is_object($s_arr[$i])) {
- echo "Not Object: Survey: ".$i;
+ printf (_("Not Object: Survey: %d"),$i);
continue;
}
$s_arr[$i]->delete();
$sq_arr =& $sqf->getSurveyQuestions();
for ($i=0; $i<count($sq_arr); $i++) {
if (!is_object($sq_arr[$i])) {
- echo "Not Object: SurveyQuestion: ".$i;
+ printf (_("Not Object: SurveyQuestion: %d"),$i);
continue;
}
$sq_arr[$i]->delete();
$ml_arr =& $mlf->getMailingLists();
for ($i=0; $i<count($ml_arr); $i++) {
if (!is_object($ml_arr[$i])) {
- echo "Not Object: MailingList: ".$i;
+ printf (_("Not Object: MailingList: %d"),$i);
continue;
}
if (!$ml_arr[$i]->delete(1,1)) {
- $this->setError(_('Could not delete properly the mailing list'));
+ $this->setError(_('Could not properly delete the mailing list'));
}
//echo 'MailingListFactory'.db_error();
}
* @access public.
*/
function addUser($user_unix_name,$role_id) {
- global $Language,$SYS;
+ global $SYS;
/*
Admins can add users to groups
*/
// make sure user is active
//
if (db_result($res_newuser,0,'status') != 'A') {
- $this->setError('User is not active. Only active users can be added.');
+ $this->setError(_('User is not active. Only active users can be added.'));
db_rollback();
return false;
}
//verify the insert worked
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: Could Not Add User To Group: '.db_error());
- db_rollback();
- return false;
- }
- //
- // Add to all forums
- //
- $sql="INSERT INTO forum_perm (group_forum_id,user_id,perm_level)
- SELECT group_forum_id,$user_id,1
- FROM forum_group_list
- WHERE group_id='".$this->getID()."'";
- $res=db_query($sql);
- if (!$res) {
- $this->setError('Adding to forums: '.db_error());
+ $this->setError(sprintf(_('ERROR: Could Not Add User To Group: %s'),db_error()));
db_rollback();
return false;
}
- //
- // Add to all subprojects
- //
- $sql="INSERT INTO project_perm (group_project_id,user_id,perm_level)
- SELECT group_project_id,$user_id,2
- FROM project_group_list
- WHERE group_id='".$this->getID()."'";
- $res=db_query($sql);
- if (!$res) {
- $this->setError('Adding to subprojects: '.db_error());
- db_rollback();
- return false;
- }
- //
- // Add to all trackers
- //
- $sql="INSERT INTO artifact_perm (group_artifact_id,user_id,perm_level)
- SELECT group_artifact_id,$user_id,2
- FROM artifact_group_list
- WHERE group_id='".$this->getID()."'";
- $res=db_query($sql);
- if (!$res) {
- $this->setError('Adding to subprojects: '.db_error());
- db_rollback();
- return false;
- }
-
//
// check and create if group doesn't exists
//
//
$role = new Role($this,$role_id);
if (!$role || !is_object($role)) {
- $this->setError('Error Getting Role Object');
+ $this->setError(_('Error Getting Role Object'));
db_rollback();
return false;
} elseif ($role->isError()) {
$user->fetchData($user->getID());
$role = new Role($this,$role_id);
if (!$role || !is_object($role)) {
- $this->setError('Error Getting Role Object');
+ $this->setError(_('Error Getting Role Object'));
db_rollback();
return false;
} elseif ($role->isError()) {
//
// user doesn't exist
//
- $this->setError('ERROR: User does not exist');
+ $this->setError(_('ERROR: User does not exist'));
db_rollback();
return false;
}
* @return boolean success.
*/
function removeUser($user_id) {
- global $Language,$SYS,$sys_database_type;
+ global $SYS,$sys_database_type;
if ($user_id==user_getid()) {
//users can remove themselves
WHERE group_id='".$this->getID()."'
AND user_id='$user_id'");
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('ERROR: DB: User not removed.'.db_error());
+ $this->setError(sprintf(_('ERROR: User not removed: %s'),db_error()));
db_rollback();
return false;
} else {
- //
- // remove them from artifact types
- //
- $res=db_query("DELETE FROM artifact_perm
- WHERE group_artifact_id
- IN (SELECT group_artifact_id
- FROM artifact_group_list
- WHERE group_id='".$this->getID()."')
- AND user_id='$user_id'");
- if (!$res) {
- $this->setError('ERROR: DB: artifact_perm.'.db_error());
- db_rollback();
- return false;
- }
- //
- // remove them from subprojects
- //
- $res=db_query("DELETE FROM project_perm
- WHERE group_project_id
- IN (SELECT group_project_id
- FROM project_group_list
- WHERE group_id='".$this->getID()."')
- AND user_id='$user_id'");
- if (!$res) {
- $this->setError('ERROR: DB: project_perm.'.db_error());
- db_rollback();
- return false;
- }
- //
- // remove them from forums
- //
- $res=db_query("DELETE FROM forum_perm
- WHERE group_forum_id
- IN (SELECT group_forum_id
- FROM forum_group_list
- WHERE group_id='".$this->getID()."')
- AND user_id='$user_id'");
- if (!$res) {
- $this->setError('ERROR: DB: forum_perm.'.db_error());
- db_rollback();
- return false;
- }
-
//
// reassign open artifacts to id=100
//
WHERE group_id='".$this->getID()."')
AND status_id='1' AND assigned_to='$user_id'");
if (!$res) {
- $this->setError('ERROR: DB: artifact.'.db_error());
+ $this->setError(sprintf(_('ERROR: DB: artifact: %s'),db_error()));
db_rollback();
return false;
}
AND assigned_to_id='100'");
}
if (!$res) {
- $this->setError('ERROR: DB: project_assigned_to 1 - '.db_error());
+ $this->setError(sprintf(_('ERROR: DB: project_assigned_to %d: %s'),1,db_error()));
db_rollback();
return false;
}
AND pt.status_id='1' AND pgl.group_id='".$this->getID()."')
AND assigned_to_id='$user_id'");
if (!$res) {
- $this->setError('ERROR: DB: project_assigned_to 2 - '.db_error());
+ $this->setError(sprintf(_('ERROR: DB: project_assigned_to %d: %s'),2,db_error()));
db_rollback();
return false;
}
return false;
}
//audit trail
- $this->addHistory('removed user',$user_id);
+ $this->addHistory('Removed User',$user_id);
}
db_commit();
return true;
* @return boolean success.
*/
function updateUser($user_id,$role_id) {
- global $Language,$SYS;
+ global $SYS;
$perm =& $this->getPermission( session_get_user() );
if (!$perm || !is_object($perm) || !$perm->isAdmin()) {
$role = new Role($this,$role_id);
if (!$role || !is_object($role)) {
- $this->setError('Could Not Get Role');
+ $this->setError(_('Could Not Get Role'));
return false;
} elseif ($role->isError()) {
- $this->setError('Role: '.$role->getErrorMessage());
+ $this->setError(sprintf(_('Role: %s'),$role->getErrorMessage()));
return false;
}
//echo "<h3>Group::updateUser role->setUser($user_id)</h3>";
if (!$role->setUser($user_id)) {
- $this->setError('Role: '.$role->getErrorMessage());
+ $this->setError(sprintf(_('Role: %s'),$role->getErrorMessage()));
return false;
}
- $this->addHistory('updated user',$user_id);
+ $this->addHistory('Updated User',$user_id);
return true;
}
$roleId = db_result($member_res,$i,'role_id');
if (!$member || !is_object($member)) {
- $this->setError('Error getting member object');
+ $this->setError(_('Error getting member object'));
return false;
} else if ($member->isError()) {
- $this->setError('Error getting member object: '.$member->getErrorMessage());
+ $this->setError(sprintf(_('Error getting member object: %s'),$member->getErrorMessage()));
return false;
}
function approve(&$user) {
if ($this->getStatus()=='A') {
- $this->setError("Group already active");
+ $this->setError(_("Group already active"));
return false;
}
//
$ats = new ArtifactTypes($this);
if (!$ats || !is_object($ats)) {
- $this->setError('Error creating ArtifactTypes object');
+ $this->setError(_('Error creating ArtifactTypes object'));
db_rollback();
return false;
} else if ($ats->isError()) {
- $this->setError('ATS1 '.$ats->getErrorMessage());
+ $this->setError(sprintf (_('ATS%d: %s'), 1, $ats->getErrorMessage()));
db_rollback();
return false;
}
if (!$ats->createTrackers()) {
- $this->setError('ATS2 '.$ats->getErrorMessage());
+ $this->setError(sprintf (_('ATS%d: %s'), 2, $ats->getErrorMessage()));
db_rollback();
return false;
}
//
$f = new Forum($this);
if (!$f->create('Open-Discussion','General Discussion',1,'',1,0)) {
- $this->setError('F1 '.$f->getErrorMessage());
+ $this->setError(sprintf (_('F%d: %s'), 1, $f->getErrorMessage()));
db_rollback();
return false;
}
$f = new Forum($this);
if (!$f->create('Help','Get Public Help',1,'',1,0)) {
- $this->setError('F2 '.$f->getErrorMessage());
+ $this->setError(sprintf (_('F%d: %s'), 2, $f->getErrorMessage()));
db_rollback();
return false;
}
$f = new Forum($this);
if (!$f->create('Developers','Project Developer Discussion',0,'',1,0)) {
- $this->setError('F3 '.$f->getErrorMessage());
+ $this->setError(sprintf (_('F%d: %s'), 3, $f->getErrorMessage()));
db_rollback();
return false;
}
//
$dg = new DocumentGroup($this);
if (!$dg->create('Uncategorized Submissions')) {
- $this->setError('DG1 '.$dg->getErrorMessage());
+ $this->setError(sprintf(_('DG: %s'),$dg->getErrorMessage()));
db_rollback();
return false;
}
//
$frs = new FRSPackage($this);
if (!$frs->create($this->getUnixName())) {
- $this->setError('FRSP '.$frs->getErrorMessage());
+ $this->setError(sprintf(_('FRSP: %s'),$frs->getErrorMessage()));
db_rollback();
return false;
}
//
$pg = new ProjectGroup($this);
if (!$pg->create('To Do','Things We Have To Do',1)) {
- $this->setError('PG1 '.$pg->getErrorMessage());
+ $this->setError(sprintf(_('PG%d: %s'),1,$pg->getErrorMessage()));
db_rollback();
return false;
}
$pg = new ProjectGroup($this);
if (!$pg->create('Next Release','Items For Our Next Release',1)) {
- $this->setError('PG2 '.$pg->getErrorMessage());
+ $this->setError(sprintf(_('PG%d: %s'),2,$pg->getErrorMessage()));
db_rollback();
return false;
}
for ($c=0; $c<count($todo); $c++) {
$role = new Role($this);
if (!$role->createDefault($todo[$c])) {
- $this->setError('R'.$c.' '.$role->getErrorMessage());
+ $this->setError(sprintf(_('R%d: %s'),$c,$role->getErrorMessage()));
db_rollback();
return false;
}
if (db_numrows($admin_group) > 0) {
$idadmin_group = db_result($admin_group,0,'user_id');
}
- if (!$mlist->create('commits','cvs commits',1,$idadmin_group)) {
- $this->setError('MailingList: '.$mlist->getErrorMessage());
+ if (!$mlist->create('commits','Commits',1,$idadmin_group)) {
+ $this->setError(sprintf(_('ML: %s'),$mlist->getErrorMessage()));
db_rollback();
return false;
}
db_commit();
$this->sendApprovalEmail();
- $this->addHistory('approved', 'x');
+ $this->addHistory('Approved', 'x');
//plugin webcal
- //change assistant for webcal
+ //change assistant for webcal
- $params[0] = $idadmin_group ;
- $params[1] = $this->getID();
- plugin_hook('change_cal_permission_default',$params);
+ $params[0] = $idadmin_group ;
+ $params[1] = $this->getID();
+ plugin_hook('change_cal_permission_default',$params);
return true;
}
*/
function sendApprovalEmail() {
$res_admins = db_query("
- SELECT users.user_name,users.email,users.language
+ SELECT users.user_name,users.email,users.language,users.user_id
FROM users,user_group
WHERE users.user_id=user_group.user_id
AND user_group.group_id='".$this->getID()."'
");
if (db_numrows($res_admins) < 1) {
- $this->setError("Group does not have any administrators.");
+ $this->setError(_("Group does not have any administrators."));
return false;
}
// send one email per admin
while ($row_admins = db_fetch_array($res_admins)) {
- $l = new BaseLanguage () ;
- $l->loadLanguageID($row_admins['language']);
+ $admin =& user_get_object($row_admins['user_id']);
+ setup_gettext_for_user ($admin) ;
// $2 $2 $3 $4 $5 $6
$message=stripcslashes(sprintf(_('Your project registration for %7$s has been approved.
-- the %7$s crew'), $this->getPublicName(), $this->getUnixName(), $GLOBALS['sys_default_domain'], $GLOBALS['sys_shell_host'], $GLOBALS['sys_scm_host'], $this->getID(), $GLOBALS['sys_name']));
util_send_message($row_admins['email'], sprintf(_('%1$s Project Approved'), $GLOBALS['sys_name']), $message);
+
+ setup_gettext_from_browser () ;
}
return true;
*/
function sendRejectionEmail($response_id, $message="zxcv") {
$res_admins = db_query("
- SELECT u.email, u.language
+ SELECT u.email, u.language, u.user_id
FROM users u, user_group ug
WHERE ug.group_id='".$this->getID()."'
AND u.user_id=ug.user_id;
");
if (db_numrows($res_admins) < 1) {
- $this->setError("Group does not have any administrators.");
+ $this->setError(_("Group does not have any administrators."));
return false;
}
while ($row_admins = db_fetch_array($res_admins)) {
- $l = new BaseLanguage () ;
- $l->loadLanguageID($row_admins['language']);
+ $admin =& user_get_object($row_admins['user_id']);
+ setup_gettext_for_user ($admin) ;
$response=stripcslashes(sprintf(_('Your project registration for %3$s has been denied.
}
util_send_message($row_admins['email'], sprintf(_('%1$s Project Denied'), $GLOBALS['sys_name']), $response);
+ setup_gettext_from_browser () ;
}
return true;
* @access public.
*/
function sendNewProjectNotificationEmail() {
+ // Get the user who wants to register the project
+ $res = db_query("SELECT u.user_id
+ FROM users u, user_group ug
+ WHERE ug.group_id='".$this->getID()."' AND u.user_id=ug.user_id;");
- $res = db_query("SELECT users.email, users.language
+ if (db_numrows($res) < 1) {
+ $this->setError(_("Could not find user who has submitted the project."));
+ return false;
+ }
+
+ $submitter =& user_get_object(db_result($res,0,'user_id'));
+
+
+ $res = db_query("SELECT users.email, users.language, users.user_id
FROM users,user_group
WHERE group_id=1
AND user_group.admin_flags='A'
AND users.user_id=user_group.user_id;");
if (db_numrows($res) < 1) {
- $this->setError("There is no administrator to send the mail.");
+ $this->setError(_("There is no administrator to send the mail."));
return false;
- } else {
- for ($i=0; $i<db_numrows($res) ; $i++) {
- $admin_email = db_result($res,$i,'email') ;
- $l = new BaseLanguage () ;
- $l->loadLanguageID(db_result($res,$i,'language'));
-
- $message=stripcslashes(sprintf(_('New %1$s Project Submitted
+ }
+
+ for ($i=0; $i<db_numrows($res) ; $i++) {
+ $admin_email = db_result($res,$i,'email') ;
+ $admin =& user_get_object(db_result($res,$i,'user_id'));
+ setup_gettext_for_user ($admin) ;
+
+ $message=stripcslashes(sprintf(_('New %1$s Project Submitted
Project Full Name: %2$s
Submitted Description: %3$s
License: %4$s
+Submitter: %6$s (%7$s)
Please visit the following URL to approve or reject this project:
-http://%5$s/admin/approve-pending.php'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $this->getLicenseName(), $GLOBALS['sys_default_domain']));
- util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
- }
+http://%5$s/admin/approve-pending.php'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $this->getLicenseName(), $GLOBALS['sys_default_domain'], $submitter->getRealName(), $submitter->getUnixName()));
+ util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
+ setup_gettext_from_browser () ;
}
- // Get the email of the user who wants to register the project
- $res = db_query("SELECT u.email, u.language
- FROM users u, user_group ug
- WHERE ug.group_id='".$this->getID()."' AND u.user_id=ug.user_id;");
- if (db_numrows($res) < 1) {
- $this->setError("Cound not find user who has submitted the project.");
- return false;
- } else {
- for ($i=0; $i<db_numrows($res) ; $i++) {
- $email = db_result($res, $i, 'email');
- $l = new BaseLanguage () ;
- $l->loadLanguageID(db_result($res,$i,'language'));
+ $email = $submitter->getEmail() ;
+ setup_gettext_for_user ($submitter) ;
- $message=stripcslashes(sprintf(_('New %1$s Project Submitted
+ $message=stripcslashes(sprintf(_('New %1$s Project Submitted
Project Full Name: %2$s
Submitted Description: %3$s
The %1$s admin team will now examine your project submission. You will be notified of their decision.'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $this->getLicenseName(), $GLOBALS['sys_default_domain']));
- util_send_message($email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
- }
- }
+ util_send_message($email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
+ setup_gettext_from_browser () ;
-
- return true;
+ return true;
}
}
* @return boolean success.
*/
function setUnixStatus($status) {
- global $Language,$SYS;
+ global $SYS;
db_begin();
$res=db_query("
UPDATE groups
");
if (!$res) {
- $this->setError('ERROR - Could Not Update Group Unix Status: '.db_error());
+ $this->setError(sprintf(_('ERROR - Could Not Update Group Unix Status: %s'),db_error()));
db_rollback();
return false;
} else {