* IMPORTANT! That db result must contain all fields
* from groups table or you will have problems
*
- * @param int $group_id Required
- * @param int|bool $res Result set handle ("SELECT * FROM groups WHERE group_id=xx")
- * @return Group|bool A group object or false on failure
+ * @param int $group_id Required
+ * @param int|bool $res Result set handle ("SELECT * FROM groups WHERE group_id=xx")
+ * @return Group|bool A group object or false on failure
*/
function &group_get_object($group_id, $res = false) {
//create a common set of group objects
foreach ($id_arr as $id) {
//
- // See if this ID already has been fetched in the cache
+ // See if this ID already has been fetched in the cache
//
if (!isset($GROUP_OBJ["_".$id."_"])) {
$fetch[] = $id;
/**
* get_public_active_projects_asc() - Get a list of rows for public active projects (initially in trove/full_list)
*
- * @param int Opional Maximum number of rows to limit query length
+ * @param int $max_query_limit Optional Maximum number of rows to limit query length
+ * @return array List of public active projects
*/
function get_public_active_projects_asc($max_query_limit = -1) {
/**
* Group - Group object constructor - use group_get_object() to instantiate.
*
- * @param int|bool $id Required - Id of the group you want to instantiate.
- * @param int|bool $res Database result from select query OR associative array of all columns.
- * @return bool Success or not
+ * @param int|bool $id Required - Id of the group you want to instantiate.
+ * @param int|bool $res Database result from select query OR associative array of all columns.
*/
function __construct($id = false, $res = false) {
$this->Error();
if (!$id) {
//setting up an empty object
//probably going to call create()
- return true;
+ return;
}
if (!$res) {
if (!$this->fetchData($id)) {
- return false;
+ return;
}
} else {
//
//function in class we extended
$this->setError(_('Group Not Found'));
$this->data_array=array();
- return false;
+ return;
} else {
//set up an associative array for use by other functions
$this->data_array = db_fetch_array_by_row($res, 0);
}
}
}
- return true;
+
}
/**
* fetchData - May need to refresh database fields if an update occurred.
*
- * @param int $group_id The group_id.
- * @return boolean success or not
+ * @param int $group_id The group_id.
+ * @return boolean success or not
*/
function fetchData($group_id) {
$res = db_query_params ('SELECT * FROM groups WHERE group_id=$1',
* This method should be called on empty Group object.
* It will add an entry for a pending group/project (status 'P')
*
- * @param object The User object.
- * @param string The full name of the user.
- * @param string The Unix name of the user.
- * @param string The new group description.
- * @param string The purpose of the group.
- * @param boolean Whether to send an email or not
- * @param int The id of the project this new project is based on
+ * @param object $user The User object.
+ * @param string $group_name The full name of the user.
+ * @param string $unix_name The Unix name of the user.
+ * @param string $description The new group description.
+ * @param string $purpose The purpose of the group.
+ * @param string $unix_box
+ * @param string $scm_box
+ * @param bool $is_public
+ * @param bool $send_mail Whether to send an email or not
+ * @param int $built_from_template The id of the project this new project is based on
* @return boolean success or not
*/
function create(&$user, $group_name, $unix_name, $description, $purpose, $unix_box = 'shell1',
- $scm_box = 'cvs1', $is_public = 1, $send_mail = true, $built_from_template = 0) {
+ $scm_box = 'cvs1', $is_public = true, $send_mail = true, $built_from_template = 0) {
// $user is ignored - anyone can create pending group
global $SYS;
if ($this->getID()!=0) {
- $this->setError(_('Group object already exists'));
+ $this->setError(_('Group object already exists.'));
return false;
} elseif (!$this->validateGroupName($group_name)) {
return false;
$this->setError(_('Invalid Unix Name.'));
return false;
} elseif (!$SYS->sysUseUnixName($unix_name)) {
- $this->setError(_('Unix name already taken'));
+ $this->setError(_('Unix name already taken.'));
return false;
} elseif (db_numrows(db_query_params('SELECT group_id FROM groups WHERE unix_group_name=$1',
array($unix_name))) > 0) {
- $this->setError(_('Unix name already taken'));
+ $this->setError(_('Unix name already taken.'));
return false;
} elseif (strlen($purpose)<10) {
- $this->setError(_('Please describe your Registration Purpose in a more comprehensive manner'));
+ $this->setError(_('Please describe your Registration Project Purpose and Summarization in a more comprehensive manner.'));
return false;
} elseif (strlen($purpose)>1500) {
- $this->setError(_('The Registration Purpose text is too long. Please make it smaller than 1500 bytes.'));
+ $this->setError(_('The Registration Project Purpose and Summarization text is too long. Please make it smaller than 1500 characters.'));
return false;
} elseif (strlen($description)<10) {
$this->setError(_('Describe in a more comprehensive manner your project.'));
built_from_template
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)',
- array(htmlspecialchars ($group_name),
+ array(htmlspecialchars($group_name),
$unix_name,
htmlspecialchars($description),
$homepage,
*
* This function require site admin privilege.
*
- * @param object User requesting operation (for access control).
- * @param int Group type (1-project, 2-foundry).
- * @param string Machine on which group's home directory located.
- * @param string Domain which serves group's WWW.
- * @return status.
+ * @param object $user User requesting operation (for access control).
+ * @param int $type_id Group type (1-project, 2-foundry).
+ * @param string $unix_box Machine on which group's home directory located.
+ * @param string $http_domain Domain which serves group's WWW.
+ * @return bool status.
* @access public
*/
function updateAdmin(&$user, $type_id, $unix_box, $http_domain) {
*
* Unlike updateAdmin(), this function accessible to project admin.
*
- * @param object User requesting operation (for access control).
- * @param boolean Whether group is publicly accessible (0/1).
- * @param string Project's license (string ident).
- * @param int Group type (1-project, 2-foundry).
- * @param string Machine on which group's home directory located.
- * @param string Domain which serves group's WWW.
- * @return int status.
- * @access public
+ * @param object $user User requesting operation (for access control).
+ * @param string $group_name
+ * @param string $homepage
+ * @param string $short_description
+ * @param bool $use_mail
+ * @param bool $use_survey
+ * @param bool $use_forum
+ * @param bool $use_pm
+ * @param bool $use_pm_depend_box
+ * @param bool $use_scm
+ * @param bool $use_news
+ * @param bool $use_docman
+ * @param string $new_doc_address
+ * @param bool $send_all_docs
+ * @param int $logo_image_id
+ * @param bool $use_ftp
+ * @param bool $use_tracker
+ * @param bool $use_frs
+ * @param bool $use_stats
+ * @param $tags
+ * @param bool $use_activity
+ * @param bool $is_public group is publicly accessible
+ * @return int status.
+ * @access public
*/
function update(&$user, $group_name, $homepage, $short_description, $use_mail, $use_survey, $use_forum,
$use_pm, $use_pm_depend_box, $use_scm, $use_news, $use_docman,
* I: Incomplete
* D: Deleted
*
- * @param object User requesting operation (for access control).
- * @param string Status value.
+ * @param object $user User requesting operation (for access control).
+ * @param string $status Status value.
* @return boolean success.
* @access public
*/
/**
* setAsTemplate - Set the template status of a project
*
- * @param boolean is_template.
+ * @param boolean $booleanparam is_template.
* @return bool
*/
function setAsTemplate($booleanparam) {
/**
* setSCMBox - the hostname of the scm box where this project is located.
*
- * @param string The name of the new SCM_BOX
+ * @param string $scm_box The name of the new SCM_BOX
* @return bool
*/
function setSCMBox($scm_box) {
return $this->data_array['register_purpose'];
}
-
/**
* getAdmins() - Get array of Admin user objects.
*
if ($res) {
$this->data_array['enable_pserver'] = $booleanparam;
db_commit();
+ return true;
} else {
db_rollback();
return false;
/**
* setUseSCM - Set the SCM usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseSCM($booleanparam) {
/**
* setUseMail - Set the mailing-list usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseMail($booleanparam) {
/**
* setUseForum - Set the forum usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseForum($booleanparam) {
/**
* setUseFRS - Set the FRS usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseFRS($booleanparam) {
/**
* setUseTracker - Set the tracker usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseTracker ($booleanparam) {
/**
* setUseDocman - Set the docman usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUseDocman($booleanparam) {
/**
* setUsePM - Set the PM usage
*
- * @param boolean enabled/disabled
+ * @param boolean $booleanparam enabled/disabled
* @return bool
*/
function setUsePM($booleanparam) {
* added for Codendi compatibility
* usesServices - returns true if the group uses a particular plugin or feature
*
- * @param string name of the plugin
+ * @param string $feature name of the plugin
* @return boolean whether plugin is being used or not
*/
function usesService($feature) {
/**
* setPluginUse - enables/disables plugins for the group
*
- * @param string name of the plugin
- * @param boolean the new state
+ * @param string $pluginname name of the plugin
+ * @param boolean $val the new state
* @return string database result
*/
function setPluginUse($pluginname, $val=true) {
return $this->data_array['send_all_docs'];
}
-
/**
* getHomePage - The URL for this project's home page.
*
/**
* setTags - Set tags of this project.
*
+ * @param string $tags
* @return string database result.
*/
function setTags($tags) {
return permission_get_object($this);
}
-
function delete($sure, $really_sure, $really_really_sure) {
if (!$sure || !$really_sure || !$really_really_sure) {
$this->setMissingParamsError(_('Please tick all checkboxes.'));
//
// Delete reporting
//
- $res = db_query_params('DELETE FROM rep_group_act_monthly WHERE group_id=$1',
+ db_query_params('DELETE FROM rep_group_act_monthly WHERE group_id=$1',
array($this->getID()));
//echo 'rep_group_act_monthly'.db_error();
- $res = db_query_params('DELETE FROM rep_group_act_weekly WHERE group_id=$1',
+ db_query_params('DELETE FROM rep_group_act_weekly WHERE group_id=$1',
array($this->getID()));
//echo 'rep_group_act_weekly'.db_error();
- $res = db_query_params('DELETE FROM rep_group_act_daily WHERE group_id=$1',
+ db_query_params('DELETE FROM rep_group_act_daily WHERE group_id=$1',
array($this->getID()));
//echo 'rep_group_act_daily'.db_error();
unset($this->data_array);
/**
* addUser - controls adding a user to a group.
*
- * @param string Unix name of the user to add OR integer user_id.
- * @param int The role_id this user should have.
+ * @param string $user_identifier Unix name of the user to add OR integer user_id.
+ * @param int $role_id The role_id this user should have.
* @return boolean success.
* @access public
*/
- function addUser($user_identifier,$role_id) {
+ function addUser($user_identifier, $role_id) {
global $SYS;
/*
Admins can add users to groups
//
// user doesn't exist
//
- $this->setError(_('Error: User does not exist'));
+ $this->setError(_('That user does not exist.'));
db_rollback();
return false;
}
*
* Users can remove themselves.
*
- * @param int The ID of the user to remove.
+ * @param int $user_id The ID of the user to remove.
* @return boolean success.
*/
function removeUser($user_id) {
}
}
if ($found_role == NULL) {
- $this->setError(sprintf(_('ERROR: User not removed: %s')));
+ $this->setError(sprintf(_('Error: User not removed: %s')));
db_rollback();
return false;
}
/**
* updateUser - controls updating a user's role in this group.
*
- * @param int The ID of the user.
- * @param int The role_id to set this user to.
+ * @param int $user_id The ID of the user.
+ * @param int $role_id The role_id to set this user to.
* @return boolean success.
*/
- function updateUser($user_id,$role_id) {
+ function updateUser($user_id, $role_id) {
if (!forge_check_perm ('project_admin', $this->getID())) {
$this->setPermissionDeniedError();
}
}
if ($found_role == NULL) {
- $this->setError(sprintf(_('ERROR: User not removed: %s')));
+ $this->setError(sprintf(_('Error: User not removed: %s')));
db_rollback();
return false;
}
/**
* addHistory - Makes an audit trail entry for this project.
*
- * @param string The name of the field.
- * @param string The Old Value for this $field_name.
- * @return database result handle.
+ * @param string $field_name The name of the field.
+ * @param string $old_value The Old Value for this $field_name.
+ * @return resource database result handle.
* @access public
*/
function addHistory($field_name, $old_value) {
}
/**
- * getMembers - returns array of User objects for this project
+ * getMembers - returns array of User objects for this project
*
- * @return array of User objects for this group.
+ * @return array of User objects for this group.
*/
function getMembers() {
return $this->getUsers (true);
}
/**
- * replaceTemplateStrings - fill-in some blanks with project name
+ * replaceTemplateStrings - fill-in some blanks with project name
*
- * @param string Template string
- * @return string String after replacements
+ * @param string $string Template string
+ * @return string String after replacements
*/
function replaceTemplateStrings($string) {
$string = str_replace ('UNIXNAME', $this->getUnixName(), $string);
}
/**
- * approve - Approve pending project.
+ * approve - Approve pending project.
*
- * @param User $user The User object who is doing the updating.
- * @return bool
- * @access public
+ * @param object $user The User object who is doing the updating.
+ * @return bool
+ * @access public
*/
function approve(&$user) {
global $gfcommon,$gfwww;
return true;
}
-
-
/**
* sendApprovalEmail - Send new project email.
*
util_make_url ('/project/admin/?group_id='.$this->getID()),
forge_get_config ('forge_name'));
- util_send_message($admin->getEmail(), sprintf(_('%1$s Project Approved'), forge_get_config ('forge_name')), $message);
+ util_send_message($admin->getEmail(), sprintf(_('%s Project Approved'), forge_get_config ('forge_name')), $message);
setup_gettext_from_context();
}
* This function sends out a rejection message to a user who
* registered a project.
*
- * @param int The id of the response to use.
- * @param string The rejection message.
- * @return boolean completion status.
+ * @param int $response_id The id of the response to use.
+ * @param string $message The rejection message.
+ * @return bool completion status.
* @access public
*/
function sendRejectionEmail($response_id, $message="zxcv") {
foreach ($submitters as $admin) {
setup_gettext_for_user($admin);
- $response=sprintf(_('Your project registration for %3$s has been denied.
-
-Project Full Name: %1$s
-Project Unix Name: %2$s
-
-Reasons for negative decision:
-
-'), $this->getPublicName(), $this->getUnixName(), forge_get_config('forge_name'));
+ $response = sprintf(_('Your project registration for %s has been denied.'), forge_get_config('forge_name')) . "\n\n"
+ . _('Project Full Name')._(': '). $this->getPublicName() . "\n"
+ . _('Project Unix Name')._(': '). $this->getUnixName() . "\n\n"
+ . _('Reasons for negative decision')._(': ') . "\n\n";
// Check to see if they want to send a custom rejection response
if ($response_id == 0) {
$admin_email = $admin->getEmail();
setup_gettext_for_user ($admin);
- $message = sprintf(_('New %1$s Project Submitted
-
-Project Full Name: %2$s
-Submitted Description: %3$s
-'),
- forge_get_config ('forge_name'),
- htmlspecialchars_decode($this->getPublicName()),
- htmlspecialchars_decode($this->getRegistrationPurpose()));
+ $message = sprintf(_('New %s Project Submitted'), forge_get_config ('forge_name')) . "\n\n"
+ . _('Project Full Name')._(': ').htmlspecialchars_decode($this->getPublicName()) . "\n"
+ . _('Submitted Description')._(': ').htmlspecialchars_decode($this->getRegistrationPurpose()) . "\n";
foreach ($submitters as $submitter) {
- $message .= sprintf(_('Submitter: %1$s (%2$s)
-'),
- $submitter->getRealName(),
- $submitter->getUnixName());
+ $message .= _('Submitter')._(': ').$submitter->getRealName().' ('.$submitter->getUnixName().')' . "\n\n";
}
- $message .= sprintf (_('
-Please visit the following URL to approve or reject this project:
-%1$s'),
- util_make_url ('/admin/approve-pending.php'));
- util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), forge_get_config ('forge_name')), $message);
+ $message .= "\n"
+ . _('Please visit the following URL to approve or reject this project')._(': '). "\n"
+ . util_make_url('/admin/approve-pending.php');
+ util_send_message($admin_email, sprintf(_('New %s Project Submitted'), forge_get_config('forge_name')), $message);
setup_gettext_from_context();
}
$email = $submitter->getEmail();
setup_gettext_for_user ($submitter);
- $message = sprintf(_('New %1$s Project Submitted
-
-Project Full Name: %2$s
-Submitted Description: %3$s
+ $message = sprintf(_('New %s Project Submitted'), forge_get_config ('forge_name')) . "\n\n"
+ . _('Project Full Name')._(': ') . $this->getPublicName() . "\n"
+ . _('Submitted Description')._(': ') . util_unconvert_htmlspecialchars($this->getRegistrationPurpose()) . "\n\n"
+ . sprintf(_('The %s admin team will now examine your project submission. You will be notified of their decision.'),
+ forge_get_config ('web_host'));
-The %1$s admin team will now examine your project submission. You will be notified of their decision.'), forge_get_config ('forge_name'), $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), forge_get_config('web_host'));
-
- util_send_message($email, sprintf(_('New %1$s Project Submitted'), forge_get_config ('forge_name')), $message);
+ util_send_message($email, sprintf(_('New %s Project Submitted'), forge_get_config ('forge_name')), $message);
setup_gettext_from_context();
return true;
if (strlen($group_name)<3) {
$this->setError(_('Group name is too short'));
return false;
- } elseif (strlen(htmlspecialchars($group_name))>50) {
+ } elseif (strlen(htmlspecialchars($group_name))>40) {
$this->setError(_('Group name is too long'));
return false;
} elseif (group_get_object_by_publicname($group_name)) {
return true;
}
-
/**
* getRolesId - Get Ids of the roles of the group.
*
* setUnixStatus - Sets status of activation of unix account.
*
* @param string $status The unix status.
- * N no_unix_account
- * A active
- * S suspended
- * D deleted
+ * N no_unix_account
+ * A active
+ * S suspended
+ * D deleted
*
* @return boolean success.
*/
/**
* getUsers - Get the users of a group
*
+ * @param bool $onlylocal
* @return array of user's objects.
*/
function getUsers($onlylocal = true) {
/**
* group_getname() - get the group name
*
- * @param int The group ID
- * @return string
+ * @param int $group_id The group ID
+ * @return string
* @deprecated
*
*/
/**
* group_getunixname() - get the unixname for a group
*
- * @param int The group ID
- * @return string
+ * @param int $group_id The group ID
+ * @return string
* @deprecated
*
*/
/**
* group_get_result() - Get the group object result ID.
*
- * @param int The group ID
- * @return int
+ * @param int $group_id The group ID
+ * @return int
* @deprecated
*
*/