function register_valid() { global $form_user; if (!$GLOBALS["Update"]) { return 0; } // check against old pw db_query("SELECT user_pw FROM users WHERE user_id={$form_user}"); if (!$GLOBALS['form_pw']) { $GLOBALS['register_error'] = "You must supply a password."; return 0; } if ($GLOBALS['form_pw'] != $GLOBALS['form_pw2']) { $GLOBALS['register_error'] = "Passwords do not match."; return 0; } if (!account_pwvalid($GLOBALS['form_pw'])) { return 0; } // if we got this far, it must be good //$user=user_get_object(user_getid()); $user = user_get_object($form_user); if (!$user->setPasswd($GLOBALS['form_pw'])) { $GLOBALS['register_error'] = $user->getErrorMessage(); return 0; } return 1; }
function register_valid() { if (!$GLOBALS["Update"]) { return 0; } // check against old pw $res = db_query("SELECT user_pw, status FROM users WHERE user_id=" . user_getid()); $row_pw = db_fetch_array($res); if ($row_pw[user_pw] != md5($GLOBALS[form_oldpw])) { $GLOBALS[register_error] = "Old password is incorrect."; return 0; } if ($row_pw[status] != 'A') { $GLOBALS[register_error] = "Account must be active to change password."; return 0; } if (!$GLOBALS[form_pw]) { $GLOBALS[register_error] = "You must supply a password."; return 0; } if ($GLOBALS[form_pw] != $GLOBALS[form_pw2]) { $GLOBALS[register_error] = "Passwords do not match."; return 0; } if (!account_pwvalid($GLOBALS[form_pw])) { return 0; } // if we got this far, it must be good $user =& user_get_object(user_getid()); if (!$user->setPasswd($GLOBALS['form_pw'])) { $GLOBALS['register_error'] = $user->getErrorMessage(); return 0; } return 1; }
function &userGetGroups($session_ser, $user_id) { continue_session($session_ser); $user =& user_get_object($user_id); if (!$user) { return new soap_fault('3003', 'user', 'Could Not Get Users Groups', 'Could Not Get Users Groups'); } return groups_to_soap($user->getGroups()); }
/** * sysCreateUser() - Create a user * * @param int The user ID of the user to create * @returns The return status * */ function sysCreateUser($user_id) { $user =& user_get_object($user_id); if (!$user) { return false; } else { return true; } }
function User_nforge($id = '') { if ($id) { $this->setID($id); $u =& user_get_object_by_name($id); } else { $u =& user_get_object(user_getid()); if ($u and is_object($u) and !$u->isError()) { global $DBInfo; $id = $u->getUnixName(); } if (!empty($id)) { $this->setID($id); $udb = new UserDB($DBInfo); $tmp = $udb->getUser($id); // get timezone and make timezone offset $tz_offset = date('Z'); $update = 0; if ($tz_offset != $tmp->info['tz_offset']) { $update = 1; } if (!empty($DBInfo->use_homepage_url) and empty($tmp->info['home']) or $update or empty($tmp->info['nick']) or $tmp->info['nick'] != $u->data_array['realname']) { // register user $tmp->info['tz_offset'] = $tz_offset; $tmp->info['nick'] = $u->data_array['realname']; if (!empty($DBInfo->use_homepage_url)) { $tmp->info['home'] = util_make_url_u($u->getID(), true); } $udb->saveUser($tmp); } } else { $id = 'Anonymous'; $this->setID('Anonymous'); } } $this->css = isset($_COOKIE['MONI_CSS']) ? $_COOKIE['MONI_CSS'] : ''; $this->theme = isset($_COOKIE['MONI_THEME']) ? $_COOKIE['MONI_THEME'] : ''; $this->bookmark = isset($_COOKIE['MONI_BOOKMARK']) ? $_COOKIE['MONI_BOOKMARK'] : ''; $this->trail = isset($_COOKIE['MONI_TRAIL']) ? _stripslashes($_COOKIE['MONI_TRAIL']) : ''; $this->tz_offset = isset($_COOKIE['MONI_TZ']) ? _stripslashes($_COOKIE['MONI_TZ']) : ''; $this->nick = isset($_COOKIE['MONI_NICK']) ? _stripslashes($_COOKIE['MONI_NICK']) : ''; if ($this->tz_offset == '') { $this->tz_offset = date('Z'); } if (!empty($id) and $id != 'Anonymous') { global $DBInfo; $udb = new UserDB($DBInfo); if (!$udb->_exists($id)) { $dummy = $udb->saveUser($this); } } }
/** * sysCreateUser() - Create a user * * @param int The user ID of the user to create * @returns The return status * */ function sysCreateUser($user_id) { $user =& user_get_object($user_id); if (!$user) { return false; } else { $res = db_query("UPDATE users SET\n\t\t\tunix_uid=user_id+" . $this->UID_ADD . ",\n\t\t\tunix_gid=user_id+" . $this->UID_ADD . ",\n\t\t\tunix_status='A'\n\t\t\tWHERE user_id={$user_id}"); if (!$res) { $this->setError('ERROR - Could Not Update User UID/GID: ' . db_error()); return false; } return true; } }
function GforgeMWAuth(&$param = 'default') { $s = session_check_session_cookie(getStringFromCookie('session_ser')); if ($s) { $u = user_get_object($s); // print "Logged in as ".$u->getUnixName()." (according to gforge) "; $mwu = User::newFromId(User::idFromName(ucfirst($u->getUnixName()))); $mwu->loadFromDatabase(); $mwu->SetupSession(); $mwu->SetCookies(); } else { // print "Not logged in (according to gforge) "; $mwu = User::loadFromSession(); if ($mwu->isLoggedIn()) { $mwu->logout(); } } }
/** * performAction() - Updates the indicated user status * * @param string $newStatus - the new user status * @param string $statusString - the status string to display * @param string $user_id - the user id to act upon */ function performAction($newStatus, $statusString, $user_id) { $u =& user_get_object($user_id); if (!$u || !is_object($u)) { exit_error('Error', 'Could Not Get User'); } elseif ($u->isError()) { exit_error('Error', $u->getErrorMessage()); } if ($newStatus == "D") { if (!$u->delete(true)) { exit_error('Error', $u->getErrorMessage()); } } else { if (!$u->setStatus($newStatus)) { exit_error('Error', $u->getErrorMessage()); } } echo "<h2>" . sprintf(_('User updated to %1$s status'), $statusString) . "</h2>"; }
/** * sysCreateUser() - Create a user * * @param int The user ID of the user to create * @returns The return status * */ function sysCreateUser($user_id) { $user =& user_get_object($user_id); if (!$user) { return false; } else { $res = db_query("UPDATE users SET\n\t\t\tunix_uid=user_id+" . $this->UID_ADD . ",\n\t\t\tunix_gid=user_id+" . $this->UID_ADD . ",\n\t\t\tunix_status='A'\n\t\t\tWHERE user_id={$user_id}"); if (!$res) { $this->setError('ERROR - Could Not Update User UID/GID: ' . db_error()); return false; } else { $query = "DELETE FROM nss_usergroups WHERE user_id={$user_id}"; $res1 = db_query($query); if (!$res1) { $this->setError('ERROR - Could Not Delete Group Member(s): ' . db_error()); return false; } // This is group used for user, not a real project $query = "DELETE FROM nss_groups WHERE name IN\n\t\t\t\t\t(SELECT user_name FROM users WHERE user_id={$user_id})"; $res2 = db_query($query); if (!$res2) { $this->setError('ERROR - Could Not Delete Group GID: ' . db_error()); return false; } $query = "INSERT INTO nss_groups\n\t\t\t\t\t(user_id, group_id,name, gid)\n\t\t\t\t\tSELECT user_id, 0, user_name, unix_gid\n\t\t\t\t\tFROM users WHERE user_id={$user_id}"; $res3 = db_query($query); if (!$res3) { $this->setError('ERROR - Could Not Update Group GID: ' . db_error()); return false; } $query = "INSERT INTO nss_usergroups (\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tusers.unix_uid AS uid,\n\t\t\t\t\t\tgroups.group_id + " . $this->GID_ADD . " AS gid,\n\t\t\t\t\t\tusers.user_id AS user_id,\n\t\t\t\t\t\tgroups.group_id AS group_id,\n\t\t\t\t\t\tusers.user_name AS user_name,\n\t\t\t\t\t\tgroups.unix_group_name AS unix_group_name\n\t\t\t\t\tFROM users,groups,user_group\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tusers.user_id=user_group.user_id\n\t\t\t\t\tAND\n\t\t\t\t\t\tgroups.group_id=user_group.group_id\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.user_id={$user_id}\n\t\t\t\t\tAND\n\t\t\t\t\t\tgroups.status = 'A'\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.unix_status='A'\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.status = 'A'\n\t\t\t\t\tUNION\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tusers.unix_uid AS uid,\n\t\t\t\t\t\tgroups.group_id + " . $this->SCM_UID_ADD . " AS gid,\n\t\t\t\t\t\tusers.user_id AS user_id,\n\t\t\t\t\t\tgroups.group_id AS group_id,\n\t\t\t\t\t\tusers.user_name AS user_name,\n\t\t\t\t\t\t'scm_' || groups.unix_group_name AS unix_group_name\n\t\t\t\t\tFROM users,groups,user_group\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tusers.user_id=user_group.user_id\n\t\t\t\t\tAND\n\t\t\t\t\t\tgroups.group_id=user_group.group_id\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.user_id={$user_id}\n\t\t\t\t\tAND\n\t\t\t\t\t\tgroups.status = 'A'\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.unix_status='A'\n\t\t\t\t\tAND\n\t\t\t\t\t\tusers.status = 'A'\n\t\t\t\t\tAND\n\t\t\t\t\t\tuser_group.cvs_flags > 0)\n\t\t\t\t"; $res4 = db_query($query); if (!$res4) { $this->setError('ERROR - Could Not Update Group Member(s): ' . db_error()); return false; } } return true; } }
function activate_group($group_id) { global $feedback; //echo("activate_group($group_id)<br>"); if (sf_ldap_create_group($group_id, 0)) { db_query("UPDATE groups " . "SET status='A' " . "WHERE group_id={$group_id}"); /* Make founding admin be an active member of the project */ $admin_res = db_query("SELECT * " . "FROM users,user_group " . "WHERE user_group.group_id={$group_id} " . "AND user_group.admin_flags='A' " . "AND users.user_id=user_group.user_id "); if (db_numrows($admin_res) > 0) { $group =& group_get_object($group_id); // // user_get_object should really have a valid user_id passed in // or you are defeating the purpose of the object pooling // $admin =& user_get_object(db_result($admin_res, 0, 'user_id'), $admin_res); if ($group->addUser($admin->getUnixName())) { /* Now send the project approval emails */ group_add_history('approved', 'x', $group_id); send_new_project_email($group_id); usleep(250000); // TODO: This is dirty. If sendmail required pause, let send_new... handle it } else { $feedback = $group->getErrorMessage(); } } else { echo db_error(); } } else { /* There was error creating LDAP entry */ group_add_history('ldap:', sf_ldap_get_error_msg(), $group_id); } }
/** * user_getname() - DEPRECATED; DO NOT USE! * * @param int The User ID * @deprecated * */ function user_getname($user_id = false) { // use current user if one is not passed in if (!$user_id) { if (session_loggedin()) { $user =& user_get_object(user_getid()); if ($user) { return $user->getUnixName(); } else { return 'Error getting user'; } } else { return 'No User Id'; } } else { $user =& user_get_object($user_id); if ($user) { return $user->getUnixName(); } else { return 'Invalid User'; } } }
/** * create - create a new item in the database. * * @param string Body. * @param string email of submitter (obsolete?). * @return id on success / false on failure. */ function create($body, $by = false) { if (!$body) { $this->setMissingParamsError(); return false; } if (session_loggedin()) { $user_id = user_getid(); $user =& user_get_object($user_id); if (!$user || !is_object($user)) { $this->setError('ERROR - Logged In User Bug Could Not Get User Object'); return false; } $body = _('Logged In: YES') . " \nuser_id={$user_id}\n\n" . $body; // we'll store this email even though it will likely never be used - // since we have their correct user_id, we can join the USERS table to get email $by = $user->getEmail(); } else { $body = _('Logged In: NO') . " \n\n" . $body; $user_id = 100; if (!$by || !validate_email($by)) { $this->setMissingParamsError(); return false; } } $sql = "insert into artifact_message (artifact_id,submitted_by,from_email,adddate,body) \n\t\t\tVALUES ('" . $this->Artifact->getID() . "','{$user_id}','{$by}','" . time() . "','" . htmlspecialchars($body) . "')"; $res = db_query($sql); if (!$res) { $this->setError(db_error()); return false; } else { $id = db_insertid($res, 'artifact_message', 'id'); } // // Now set up our internal data structures // if (!$this->fetchData($id)) { return false; } return $id; }
if (db_numrows($res) == 0) { exit(0); } $id = db_result($res, 0, 0); session_set_new($id); // Get user id's from users who have open tasks $res = db_query("SELECT DISTINCT u.user_id, u.realname, u.email FROM users u, project_assigned_to pat, project_task_vw ptv \n\t\tWHERE u.user_id > 100 AND u.user_id=pat.assigned_to_id AND pat.project_task_id=ptv.project_task_id \n\t\tAND ptv.status_id=1 ORDER BY u.user_id;"); $now = time(); $today = date("n/j/y"); // for every user retrieved, get its open tasks and send an email for ($i = 0; $i < db_numrows($res); $i++) { $user_id = db_result($res, $i, 'user_id'); $realname = db_result($res, $i, 'realname'); $email = db_result($res, $i, 'email'); // get an object of the User with the current user_id $user_object =& user_get_object($user_id); if (!$user_object || !is_object($user_object)) { $err .= "Could not get User object with ID: {$user_id}\n"; } else { $projectTasksForUser = new ProjectTasksForUser($user_object); if (!$projectTasksForUser || !is_object($projectTasksForUser)) { $err .= "Could not get ProjectTasksForUser object for user with ID: {$user_id}\n"; continue; } // get the tasks the user should work on, today $userTasks =& $projectTasksForUser->getTasksForToday(); $last_group = 0; $last_projectgroup = 0; // start composing the email $subject = 'Tasks for ' . $realname . ' for ' . $today; if (count($userTasks) > 0) {
// XXX ogi: What's $ch? $confirm_hash = getStringFromRequest('ch'); } if (!$confirm_hash) { exit_missing_param(); } $confirm_hash = html_clean_hash_string($confirm_hash); $res_user = db_query("SELECT * FROM users WHERE confirm_hash='{$confirm_hash}'"); if (db_numrows($res_user) > 1) { exit_error("Error", "This confirm hash exists more than once."); } if (db_numrows($res_user) < 1) { exit_error("Error", "Invalid confirmation hash."); } $row_user = db_fetch_array($res_user); $user =& user_get_object($row_user['user_id'], $res_user); if (!$u || !is_object($u)) { exit_error('Error', 'Could Not Get User'); } elseif ($u->isError()) { exit_error('Error', $u->getErrorMessage()); } $all = getStringFromRequest('all'); $user->unsubscribeFromMailings($all); site_header(array('title' => _("Unsubscription Complete"))); echo '<h2>' . _('Unsubscription Complete') . '</h2><p>'; if ($all) { $what = sprintf(_('You have been unsubscribed from all %1$s mailings and notifications. In case you will want to re-activate your subscriptions in the future, login and visit your Account Maintenance page.'), $GLOBALS['sys_name']); } else { $what = sprintf(_('You have been unsubscribed from %1$s site mailings. In case you will want to re-activate your subscriptions in the future, login and visit your Account Maintenance page.'), $GLOBALS['sys_name']); } echo '</p>';
/** * sendAttachNotice - contains the logic to send out email attachement followups when a message is posted. * * @param int attach_id - The id of the file that has been attached * * @return boolean success. */ function sendAttachNotice($attach_id) { if ($attach_id) { $ids =& $this->Forum->getMonitoringIDs(); // // See if there is anyone to send messages to // if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) { return true; } $body = "\nRead and respond to this message at: " . "\n" . util_make_url('/forum/message.php?msg_id=' . $this->getID()) . "\nBy: " . $this->getPosterRealName() . "\n\n"; $body .= "A file has been uploaded to this message, you can download it at: " . "\n" . util_make_url('/forum/attachment.php?attachid=' . $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n"; $body .= "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this forum." . "\nTo stop monitoring this forum, login to " . $GLOBALS['sys_name'] . " and visit: " . "\n" . util_make_url('/forum/monitor.php?forum_id=' . $this->Forum->getID() . '&group_id=' . $this->Forum->Group->getID() . '&stop=1'); $extra_headers = "Return-Path: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n"; $extra_headers .= "Errors-To: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n"; $extra_headers .= "Sender: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n"; $extra_headers .= "Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n"; $extra_headers .= "Precedence: Bulk\n" . "List-Id: " . $this->Forum->getName() . " <forum" . $this->Forum->getId() . "@" . $GLOBALS['sys_default_domain'] . ">\n" . "List-Help: " . util_make_url('/forum/forum.php?id=' . $this->Forum->getId()) . "\n" . "Message-Id: <forumpost" . $this->getId() . "@" . $GLOBALS['sys_default_domain'] . ">"; $parentid = $this->getParentId(); if (!empty($parentid)) { $extra_headers .= "\nIn-Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n" . "References: <forumpost" . $this->getParentId() . "@" . $GLOBALS['sys_default_domain'] . ">"; } $subject = "[" . $this->Forum->getUnixName() . "][" . $this->getID() . "] " . util_unconvert_htmlspecialchars($this->getSubject()); if (count($ids) != 0) { $sql = "SELECT email FROM users WHERE status='A' AND user_id IN ('" . implode($ids, '\',\'') . "')"; $bccres = db_query($sql); } ($BCC =& implode(util_result_column_to_array($bccres), ',')) . ',' . $this->Forum->getSendAllPostsTo(); $User = user_get_object($this->getPosterID()); util_send_message('', $subject, $body, "noreply@" . $GLOBALS['sys_default_domain'], $BCC, 'Forum', $extra_headers); return true; } return false; }
/** * session_set() - Re-initialize session for the logged in user * * This function checks that the user is logged in and if so, initialize * internal session environment. * * @return none */ function session_set() { global $G_SESSION; global $session_ser, $session_key; // assume bad session_hash and session. If all checks work, then allow // otherwise make new session $id_is_good = false; // If user says he's logged in (by presenting cookie), check that if ($session_ser) { $user_id = session_check_session_cookie($session_ser); if ($user_id) { $result = session_getdata($user_id); if (db_numrows($result) > 0) { $id_is_good = true; } } } // else (hash does not exist) or (session hash is bad) if ($id_is_good) { $G_SESSION = user_get_object($user_id, $result); if ($G_SESSION) { $G_SESSION->setLoggedIn(true); } } else { $G_SESSION = false; // if there was bad session cookie, kill it and the user cookie // if ($session_ser) { session_logout(); } } }
/** * addMessage - attach a text message to this Artifact. * * @param string The message being attached. * @param string Email address of message creator. * @param bool Whether to email out a followup. * @access private. * @return boolean success. */ function addMessage($body, $by = false, $send_followup = false) { if (!$body) { $this->setMissingParamsError(); return false; } if (session_loggedin()) { $user_id = user_getid(); $user =& user_get_object($user_id); if (!$user || !is_object($user)) { $this->setError('ERROR - Logged In User Bug Could Not Get User Object'); return false; } // we'll store this email even though it will likely never be used - // since we have their correct user_id, we can join the USERS table to get email $by = $user->getEmail(); } elseif (!$this->ArtifactType->allowsAnon()) { $this->setError(_('Artifact: This ArtifactType Does Not Allow Anonymous Submissions. Please Login.')); return false; } else { $user_id = 100; if (!$by || !validate_email($by)) { $this->setMissingParamsError(); return false; } } $sql = "insert into artifact_message (artifact_id,submitted_by,from_email,adddate,body) " . "VALUES ('" . $this->getID() . "','{$user_id}','{$by}','" . time() . "','" . htmlspecialchars($body) . "')"; $res = db_query($sql); if ($send_followup) { $this->mailFollowup(2, false); } return $res; }
// XXX ogi: What's $ch? $confirm_hash = getStringFromRequest('ch'); } if (!$confirm_hash) { exit_missing_param(); } // Remove noise from hash produced by buggy mail clients $confirm_hash = html_clean_hash_string($confirm_hash); $res_user = db_query("SELECT * FROM users WHERE confirm_hash='{$confirm_hash}'"); if (db_numrows($res_user) > 1) { exit_error(_('ERROR'), _('This confirm hash exists more than once.')); } if (db_numrows($res_user) < 1) { exit_error(_('ERROR'), _('Invalid confirmation hash')); } $u =& user_get_object(db_result($res_user, 0, 'user_id'), $res_user); if (!$u || !is_object($u)) { exit_error('Error', 'Could Not Get User'); } elseif ($u->isError()) { exit_error('Error', $u->getErrorMessage()); } if (getStringFromRequest("submit")) { if (strlen($passwd) < 6) { exit_error(_('ERROR'), _('You must supply valid password (at least 6 chars).')); } if ($passwd != $passwd2) { exit_error(_('ERROR'), _('New passwords do not match.')); } if ($u->setPasswd($passwd)) { // Invalidate confirm hash $u->setNewEmailAndHash('', 0);
function sf_ldap_group_remove_user($group_id, $user_id, $cvs_only = 0) { global $sys_ldap_base_dn; global $sys_use_ldap; if (!$sys_use_ldap) { return true; } $group =& group_get_object($group_id); $user =& user_get_object($user_id); if (!sf_ldap_connect()) { return false; } $dn = 'cn=' . $group->getUnixName() . ',ou=Group,' . $sys_ldap_base_dn; $cvs_dn = 'cn=' . $group->getUnixName() . ',ou=cvsGroup,' . $sys_ldap_base_dn; $entry['memberUid'] = $user->getUnixName(); $ret_val = true; if (!sf_ldap_mod_del($cvs_dn, $entry) && !sf_ldap_does_not_exist()) { sf_ldap_set_error_msg("ERROR: cannot remove member from LDAP CVS group entry '" . $group->getUnixName() . "': " . sf_ldap_error() . "(" . sf_ldap_errno() . ")" . "<br>"); $ret_val = false; } if ($cvs_only) { return $ret_val; } if (!sf_ldap_mod_del($dn, $entry) && !sf_ldap_does_not_exist()) { sf_ldap_set_error_msg("ERROR: cannot remove member from LDAP group entry '" . $group->getUnixName() . "': " . sf_ldap_error() . "(" . sf_ldap_errno() . ")" . "<br>"); $ret_val = false; } return $ret_val; }
function CallHook($hookname, $params) { global $use_projects_hierarchyplugin, $G_SESSION, $HTML; if ($hookname == "usermenu") { $text = $this->text; // this is what shows in the tab if ($G_SESSION->usesPlugin("projects_hierarchy")) { $param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we're calling is the user one echo ' | ' . $HTML->PrintSubMenu(array($text), array('/plugins/projects_hierarchy/index.php' . $param)); } } elseif ($hookname == "groupmenu") { $group_id = $params['group']; $project =& group_get_object($group_id); if (!$project || !is_object($project)) { return; } if ($project->isError()) { return; } if (!$project->isProject()) { return; } if ($project->usesPlugin($this->name)) { $params['TITLES'][] = $this->text; $params['DIRS'][] = '/plugins/projects_hierarchy/index.php?type=group&id=' . $group_id . "&pluginname=" . $this->name; // we indicate the part we're calling is the project one } else { //$params['TITLES'][]=$this->text." is [Off]"; } $params['toptab'] == $this->name ? $params['selected'] = count($params['TITLES']) - 1 : ''; } elseif ($hookname == "groupisactivecheckbox") { //Check if the group is active } elseif ($hookname == "groupisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page $group_id = $params['group']; $group =& group_get_object($group_id); $use_projects_hierarchyplugin = getStringFromRequest('use_projects_hierarchyplugin'); if ($use_projects_hierarchyplugin == 1) { $group->setPluginUse($this->name); } else { $group->setPluginUse($this->name, false); } } elseif ($hookname == "userisactivecheckbox") { //check if user is active // this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin } elseif ($hookname == "userisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the user account manteinance page $user = $params['user']; $use_projects_hierarchyplugin = getStringFromRequest('use_projects_hierarchyplugin'); if ($use_projects_hierarchyplugin == 1) { $user->setPluginUse($this->name); } else { $user->setPluginUse($this->name, false); } echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_projects_hierarchyplugin" value="1" '; // CHECKED OR UNCHECKED? if ($user->usesPlugin($this->name)) { echo "CHECKED"; } echo "> Use " . $this->text . " Plugin"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "user_personal_links") { // this displays the link in the user's profile page to it's personal projects_hierarchy (if you want other sto access it, youll have to change the permissions in the index.php $userid = $params['user_id']; $user = user_get_object($userid); $text = $params['text']; //check if the user has the plugin activated if ($user->usesPlugin($this->name)) { echo ' <p>'; echo util_make_link("/plugins/projects_hierarchy/index.php?id={$userid}&type=user&pluginname=" . $this->name, _('View Personal projects_hierarchy')); echo '</p>'; } } elseif ($hookname == "project_admin_plugins") { // this displays the link in the project admin options page to it's projects_hierarchy administration $group_id = $params['group_id']; $group =& group_get_object($group_id); if ($group->usesPlugin($this->name)) { echo util_make_link("/plugins/projects_hierarchy/index.php?id=" . $group->getID() . '&type=admin&pluginname=' . $this->name, _('View the projects_hierarchy Administration')); echo '<br />'; } } elseif ($hookname == "tree") { header('Location: ../plugins/projects_hierarchy/softwaremap.php'); } elseif ($hookname == "project_home_link") { // ############################## Display link $group_id = $params; echo $HTML->boxTop(_('Linked projects')); $cpt_project = 0; // father request $query = "SELECT DISTINCT group_id,unix_group_name,group_name FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type ='shar' AND plugin_projects_hierarchy.activated='t' AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=" . $group_id; $res = db_query($query); echo db_error(); while ($row = db_fetch_array($res)) { echo html_image('ic/forum20g.png', '20', '20', array('alt' => _('Link'))) . ' ' . _('Parent project') . ': <a href="' . $GLOBALS['sys_urlprefix'] . '/projects/' . $row['unix_group_name'] . '/">' . $row['group_name'] . '</a><br/>'; $cpt_project++; } if ($cpt_project != 0) { print '<hr size="1" />'; } $cpt_temp = $cpt_project; // sons request $query = "SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type ='shar' AND plugin_projects_hierarchy.activated='t' AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=" . $group_id; $res = db_query($query); echo db_error(); while ($row = db_fetch_array($res)) { echo html_image('ic/forum20g.png', '20', '20', array('alt' => _('Link'))) . ' ' . _('Child project') . ' : <a href="' . $GLOBALS['sys_urlprefix'] . '/projects/' . $row['unix_group_name'] . '/">' . $row['group_name'] . '</a> : ' . $row['com'] . '<br/>'; $cpt_project++; } if ($cpt_project != $cpt_temp) { print '<hr size="1" />'; } $cpt_temp = $cpt_project; // links if project is father $query = "SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type ='navi' AND plugin_projects_hierarchy.activated='t' AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=" . $group_id; $res = db_query($query); echo db_error(); while ($row = db_fetch_array($res)) { echo html_image('ic/forum20g.png', '20', '20', array('alt' => _('Link'))) . ' ' . _('Links') . " : <a href=\"" . $GLOBALS['sys_urlprefix'] . "/projects/" . $row['unix_group_name'] . "/\">" . $row['group_name'] . "</a> : " . $row['com'] . "<br/>"; $cpt_project++; } // links if project is son $query = "SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type ='navi' AND plugin_projects_hierarchy.activated='t' AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=" . $group_id; $res = db_query($query); echo db_error(); while ($row = db_fetch_array($res)) { echo html_image('ic/forum20g.png', '20', '20', array('alt' => _('Link'))) . ' ' . _('Links') . " : <a href=\"" . $GLOBALS['sys_urlprefix'] . "/projects/" . $row['unix_group_name'] . "/\">" . $row['group_name'] . "</a><br/>"; $cpt_project++; } if ($cpt_project != $cpt_temp) { print '<hr size="1" />'; } if ($cpt_project == 0) { echo _('No linked project avalaible'); print '<hr size="1" />'; } echo $HTML->boxBottom(); } elseif ($hookname == "admin_project_link") { //modif pour hierarchie par Fabien le 10/10/06 //add files add_son.php, del_father.php,del_son.php,wait_son.php and hierarchy_utils.php global $gfplugins; require_once $gfplugins . 'projects_hierarchy/www/hierarchy_utils.php'; //include('../../plugins/projects_hierarchy/hierarchy_utils.php'); $group_id = $params; echo $HTML->boxMiddle(_('Modify the hierarchy')); echo '<form action="../../plugins/projects_hierarchy/add_son.php?group_id=' . $group_id . '" method="POST" name="formson">'; //include('hierarchy_utils.php'); //select box of sons echo '<table><tr>'; echo '<td>' . _('Select a project :') . '</td><td>' . son_box($group_id, 'sub_project_id', '0') . '</td><td> </td>'; echo '</tr><tr>'; echo '<td>' . _('Commentary :') . '</td><td> <input type="text" size="25" value="" name="com"></td>'; //echo type_son_box(); echo '<td><input type="submit" name="son" value="' . _('Add son project') . '"></td></tr></table></form>'; echo '<br/>'; echo '<form action="../../plugins/projects_hierarchy/add_link.php?group_id=' . $group_id . '" method="POST" name="formlink">'; //include('hierarchy_utils.php'); //select box of sons echo '<table><tr>'; echo '<td>' . _('Select a project :') . '</td><td>' . link_box($group_id, 'sub_project_id', '0') . '</td><td> </td>'; echo '</tr><tr>'; echo '<td>' . _('Commentary :') . '</td><td><input type="text" size="25" value="" name="com"></td>'; echo '<td><input type="submit" name="son" value="' . _('Add a link') . '"></td></tr></table></form>'; echo '<br/>'; //select all the sons of the current project $sql_son = "SELECT group_id,group_name,unix_group_name,sub_project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE " . "\t(\tgroups.group_id = plugin_projects_hierarchy.sub_project_id " . "AND plugin_projects_hierarchy.project_id = " . $group_id . ")"; $res_son = db_query($sql_son) or die(db_error()); if (!$res_son || db_numrows($res_son) < 1) { $cpt_son = 0; } else { //display of sons $cpt_son = 1; echo _('Link list'); echo '<table>'; $i = 0; while ($row_son = db_fetch_array($res_son)) { $i++; echo '<tr>'; echo '<td>'; //link to the project echo "<a href=\"../../projects/" . $row_son['unix_group_name'] . "/\">" . $row_son['group_name'] . "</a>"; echo '</td>'; echo '<td>'; if ($row_son['link_type'] == 'navi') { echo _('Navigation link'); } else { echo _('Share link'); } echo '</td>'; echo '<td>'; if ($row_son['activated'] == 'f') { echo _('Waiting'); } else { print "<b>" . _('Authorize') . "</b>"; } echo '</td>'; echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to delete this link ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/del_son.php?group_id=" . $group_id . "&sub_group_id=" . $row_son['sub_project_id'] . "\"}'}>" . _('Delete') . "</a></td>"; echo "<tr><td colspan='4'>" . _('Commentary :') . " <i>" . $row_son['com'] . "</i>"; echo '</td></tr>'; } } //select navigation link by father $sql_son = "SELECT group_id,group_name,unix_group_name,project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE " . " (\tgroups.group_id = plugin_projects_hierarchy.project_id " . "AND plugin_projects_hierarchy.sub_project_id = " . $group_id . " AND plugin_projects_hierarchy.link_type = 'navi') "; $res_son = db_query($sql_son) or die(db_error()); if (!$res_son || db_numrows($res_son) < 1) { if ($cpt_son == 1) { echo '</table>'; } } else { //display of sons if ($cpt_son != 1) { echo _('Link list'); echo '<table>'; } $i = 0; while ($row_son = db_fetch_array($res_son)) { $i++; echo '<tr>'; echo '<td>'; //link to the project echo "<a href=\"../../projects/" . $row_son['unix_group_name'] . "/\">" . $row_son['group_name'] . "</a>"; echo '</td>'; echo '<td>'; if ($row_son[link_type] == 'navi') { echo _('Navigation link'); } else { echo _('Share link'); } echo '</td>'; echo '<td>'; if ($row_son[activated] == 'f') { //echo _('Waiting'); echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to authorize this project ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=" . $group_id . "&group_id=" . $row_son['project_id'] . "\"}'}>" . _('Authorize') . "</a></td>"; } else { print "<b>" . _('Authorize') . "</b>"; } echo '</td>'; echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to delete this link ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?group_id=" . $row_son['project_id'] . "&sub_group_id=" . $group_id . "\"}'}>" . _('Delete') . "</a></td>"; echo "<tr><td colspan='4'>" . _('Commentary of father :') . " <i>" . $row_son['com'] . "</i></td>"; echo '</tr>'; } echo '</table>'; } //research allowing father $sql_father = "SELECT group_id,group_name,unix_group_name,project_id,com FROM groups,plugin_projects_hierarchy WHERE " . "\t\tgroups.group_id = plugin_projects_hierarchy.project_id " . "AND plugin_projects_hierarchy.sub_project_id = " . $group_id . "" . "\t\tAND plugin_projects_hierarchy.activated = true AND plugin_projects_hierarchy.link_type = 'shar'"; //print $sql_wait; $res_father = db_query($sql_father) or die(db_error()); if (!$res_father || db_numrows($res_father) < 1) { } else { //display of the father of the current project echo '<table><tr><td colspan=\\"2\\">'; echo _('Project\'s parent'); echo '</td></tr>'; while ($row_father = db_fetch_array($res_father)) { echo '<tr>'; echo '<td>'; echo "<a href=\"../../projects/" . $row_father['unix_group_name'] . "/\">" . $row_father['group_name'] . "</a>"; echo '</td><td>'; echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to delete this link ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=" . $group_id . "&group_id=" . $row_father['group_id'] . "\"}'}>" . _('Delete') . "</a></td>"; echo '</td></tr>'; } echo '</table>'; } //research waiting fathers $sql_wait = "SELECT group_id,group_name,unix_group_name,project_id,link_type,com FROM groups,plugin_projects_hierarchy WHERE " . "\t\tgroups.group_id = plugin_projects_hierarchy.project_id " . "AND plugin_projects_hierarchy.sub_project_id = " . $group_id . "" . "\t\tAND plugin_projects_hierarchy.activated = false AND plugin_projects_hierarchy.link_type = 'shar'"; //print $sql_wait; $res_wait = db_query($sql_wait) or die(db_error()); if (!$res_wait || db_numrows($res_wait) < 1) { } else { //display of waiting fathers echo '<table><tr><td colspan=\\"2\\">'; echo _('Father waiting for validation'); echo '</td></tr>'; while ($row_wait = db_fetch_array($res_wait)) { echo '<tr>'; echo '<td>'; echo "<a href=\"../../projects/" . $row_wait['unix_group_name'] . "/\">" . $row_wait['group_name'] . "</a>"; echo '</td>'; echo '<td>'; echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to authorize this project ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=" . $group_id . "&group_id=" . $row_wait['group_id'] . "\"}'}>" . _('Do you really want to authorize this project ?') . "</a></td>"; echo '</td><td>'; echo "<td><a href='#' onclick='if(confirm(\"" . _('Do you really want to delete this link ?') . "\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=" . $group_id . "&group_id=" . $row_wait['group_id'] . "\"}'}>" . _('Delete') . "</a></td>"; echo "</td><tr><td colspan='3'>" . _('Commentary of father :') . " <i>" . $row_wait['com'] . "</i>"; echo '</td></tr>'; } echo '</table>'; } } elseif ($hookname == "delete_link") { $sql = "DELETE FROM plugin_projects_hierarchy WHERE project_id = " . $params . " OR sub_project_id = " . $params . " "; $res_son = db_query($sql); } }
//check if the group has the MediaWiki plugin active exit_error("Error", "First activate the {$pluginname} plugin through the Project's Admin Interface"); } $userperm = $group->getPermission($user); //we´ll check if the user belongs to the group (optional) if (!$userperm->IsMember()) { // exit_error("Access Denied", "You are not a member of this project"); } // other perms checks here... mediawiki_Project_Header(array('title' => $pluginname . ' Project Plugin!', 'pagename' => "{$pluginname}", 'sectionvals' => array(group_getname($id)))); // DO THE STUFF FOR THE PROJECT PART HERE // echo "We are in the Project MediaWiki plugin <br>"; // echo "Greetings from planet " . $world; // $world comes from the config file in /etc echo '<iframe src="' . util_make_url('/mediawiki/index.php?title=' . $group->getUnixName()) . '" frameborder="no" width=100% height=700></iframe>'; } elseif ($type == 'user') { $realuser = user_get_object($id); // if (!$realuser || !$realuser->usesPlugin($pluginname)) { exit_error("Error", "First activate the User's {$pluginname} plugin through Account Manteinance Page"); } if (!$user || $user->getID() != $id) { // if someone else tried to access the private MediaWiki part of this user exit_error("Access Denied", "You cannot access other user's personal {$pluginname}"); } mediawiki_User_Header(array('title' => 'My ' . $pluginname, 'pagename' => "{$pluginname}", 'sectionvals' => array($realuser->getUnixName()))); // DO THE STUFF FOR THE USER PART HERE echo "We are in the User MediaWiki plugin <br>"; echo "Greetings from planet " . $world; // $world comes from the config file in /etc } elseif ($type == 'admin') { $group = group_get_object($id);
// // $Id: lostlogin.php,v 1.2 2003/11/13 11:29:21 helix Exp $ require "pre.php"; require "account.php"; // ###### function register_valid() // ###### checks for valid register from form post $res_lostuser = db_query("SELECT * FROM users WHERE confirm_hash='{$confirm_hash}'"); if (db_numrows($res_lostuser) > 1) { exit_error("Error", "This confirm hash exists more than once."); } if (db_numrows($res_lostuser) < 1) { exit_error("Error", "Invalid confirmation hash."); } $row_lostuser = db_fetch_array($res_lostuser); if ($Update && $form_pw && !strcmp($form_pw, $form_pw2)) { $user = user_get_object($row_lostuser['user_id']); if ($user->setPasswd($form_pw)) { session_redirect("/"); } $feedback = $user->getErrorMessage(); } $HTML->header(array('title' => "Lost Password Login")); ?> <p><b>Lost Password Login</b> <P>Welcome, <?php print $row_lostuser['user_name']; ?> . You may now change your password. <FORM action="lostlogin.php">
<?php /* * EIRC plugin * * Christian Bayle <*****@*****.**> */ require_once $gfwww . 'include/pre.php'; if (!$user_id) { exit_error('Error', 'No User Id Provided'); } $user = user_get_object($user_id); if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) { exit_error("Invalid User", "That user does not exist."); } else { $user_name = $user->getRealName(); $unix_name = $user->getUnixName(); $result = db_query("SELECT groups.unix_group_name " . "FROM groups,user_group " . "WHERE groups.group_id=user_group.group_id " . "AND user_group.user_id={$user_id}" . "AND groups.status='A'"); $rows = db_numrows($result); $channels = ""; if (!$result || $rows < 1) { $channels = "#eirc,"; } else { for ($i = 0; $i < $rows; $i++) { $channels = $channels . '#' . db_result($result, $i, 'unix_group_name') . ','; } } if ($group_id) { $group =& group_get_object($group_id); $channels = $channels . '#' . $group->getUnixName() . ','; }
function CallHook($hookname, $params) { global $use_mantisplugin, $G_SESSION, $HTML; if ($hookname == "usermenu") { $text = $this->text; // this is what shows in the tab if ($G_SESSION->usesPlugin("mantis")) { $param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we´re calling is the user one echo ' | ' . $HTML->PrintSubMenu(array($text), array('/plugins/mantis/index.php' . $param)); } } elseif ($hookname == "groupmenu") { $group_id = $params['group']; $project =& group_get_object($group_id); if (!$project || !is_object($project)) { return; } if ($project->isError()) { return; } if (!$project->isProject()) { return; } if ($project->usesPlugin($this->name)) { $params['TITLES'][] = $this->text; $params['DIRS'][] = '/plugins/mantis/index.php?type=group&id=' . $group_id . "&pluginname=" . $this->name; // we indicate the part we´re calling is the project one } else { $params['TITLES'][] = $this->text . " is [Off]"; $params['DIRS'][] = ''; } $params['toptab'] == $this->name ? $params['selected'] = count($params['TITLES']) - 1 : ''; } elseif ($hookname == "groupisactivecheckbox") { //Check if the group is active // this code creates the checkbox in the project edit public info page to activate/deactivate the plugin $group_id = $params['group']; $group =& group_get_object($group_id); echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_mantisplugin" value="1" '; // CHECKED OR UNCHECKED? if ($group->usesPlugin($this->name)) { echo "CHECKED"; } echo "><br/>"; echo "</td>"; echo "<td>"; echo "<strong>Use " . $this->text . " Plugin</strong>"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "groupisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page $group_id = $params['group']; $group =& group_get_object($group_id); $use_mantisplugin = getStringFromRequest('use_mantisplugin'); if ($use_mantisplugin == 1) { $group->setPluginUse($this->name); } else { $group->setPluginUse($this->name, false); } } elseif ($hookname == "userisactivecheckbox") { //check if user is active // this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin $user = $params['user']; echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_mantisplugin" value="1" '; // CHECKED OR UNCHECKED? if ($user->usesPlugin($this->name)) { echo "CHECKED"; } echo "> Use " . $this->text . " Plugin"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "userisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the user account manteinance page $user = $params['user']; $use_mantisplugin = getStringFromRequest('use_mantisplugin'); if ($use_mantisplugin == 1) { $user->setPluginUse($this->name); } else { $user->setPluginUse($this->name, false); } echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_mantisplugin" value="1" '; // CHECKED OR UNCHECKED? if ($user->usesPlugin($this->name)) { echo "CHECKED"; } echo "> Use " . $this->text . " Plugin"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "user_personal_links") { // this displays the link in the user´s profile page to it´s personal Mantis (if you want other sto access it, youll have to change the permissions in the index.php $userid = $params['user_id']; $user = user_get_object($userid); $text = $params['text']; //check if the user has the plugin activated if ($user->usesPlugin($this->name)) { echo ' <p> <a href="' . $GLOBALS['sys_urlprefix'] . '/plugins/mantis/index.php?id=' . $userid . '&type=user&pluginname=' . $this->name . '">' . _('View Mantis') . '</a></p>'; } } elseif ($hookname == "project_admin_plugins") { // this displays the link in the project admin options page to it´s Mantis administration $group_id = $params['group_id']; $group =& group_get_object($group_id); if ($group->usesPlugin($this->name)) { echo '<a href="' . $GLOBALS['sys_urlprefix'] . '/plugins/mantis/index.php?id=' . $group->getID() . '&type=admin&pluginname=' . $this->name . '">' . _('Mantis admin') . '</a><br />'; } } elseif ($hookname == "blahblahblah") { // ... } }
<!-- </td></tr> </td> <td width="50%"> </td>--> <?php // // Pending requests // echo $HTML->boxMiddle(_('Pending Requests')); $reqs =& get_group_join_requests($group); if (count($reqs) < 1) { echo _('No Pending Requests'); } else { for ($i = 0; $i < count($reqs); $i++) { $user =& user_get_object($reqs[$i]->getUserId()); if (!$user || !is_object($user)) { echo "Invalid User"; } ?> <form action="<?php echo getStringFromServer('PHP_SELF') . '?group_id=' . $group_id; ?> " method="post"> <input type="hidden" name="submit" value="y" /> <input type="hidden" name="form_userid" value="<?php echo $user->getId(); ?> " /> <tr><td><input type="hidden" name="form_unix_name" value="<?php echo $user->getUnixName();
function CallHook($hookname, $params) { global $use_quota_managementplugin, $G_SESSION, $HTML; if ($hookname == "usermenu") { $text = $this->text; // this is what shows in the tab if ($G_SESSION->usesPlugin("quota_management")) { $param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we´re calling is the user one echo ' | ' . $HTML->PrintSubMenu(array($text), array('/plugins/quota_management/index.php' . $param)); } } elseif ($hookname == "groupmenu") { $group_id = $params['group']; $project =& group_get_object($group_id); if (!$project || !is_object($project)) { return; } if ($project->isError()) { return; } if (!$project->isProject()) { return; } if ($project->usesPlugin($this->name)) { $params['TITLES'][] = $this->text; $params['DIRS'][] = '/plugins/quota_management/index.php?type=group&id=' . $group_id . "&pluginname=" . $this->name; // we indicate the part we´re calling is the project one } else { // $params['TITLES'][]=$this->text." is [Off]"; } $params['toptab'] == $this->name ? $params['selected'] = count($params['TITLES']) - 1 : ''; } elseif ($hookname == "groupisactivecheckbox") { //Check if the group is active } elseif ($hookname == "groupisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page $group_id = $params['group']; $group =& group_get_object($group_id); $use_quota_managementplugin = getStringFromRequest('use_quota_managementplugin'); if ($use_quota_managementplugin == 1) { $group->setPluginUse($this->name); } else { $group->setPluginUse($this->name, false); } } elseif ($hookname == "userisactivecheckbox") { //check if user is active // this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin $user = $params['user']; echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_quota_managementplugin" value="1" '; // CHECKED OR UNCHECKED? if ($user->usesPlugin($this->name)) { echo "CHECKED"; } echo "> Use " . $this->text . " Plugin"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "userisactivecheckboxpost") { // this code actually activates/deactivates the plugin after the form was submitted in the user account manteinance page $user = $params['user']; $use_quota_managementplugin = getStringFromRequest('use_quota_managementplugin'); if ($use_quota_managementplugin == 1) { $user->setPluginUse($this->name); } else { $user->setPluginUse($this->name, false); } echo "<tr>"; echo "<td>"; echo ' <input type="CHECKBOX" name="use_quota_managementplugin" value="1" '; // CHECKED OR UNCHECKED? if ($user->usesPlugin($this->name)) { echo "CHECKED"; } echo "> Use " . $this->text . " Plugin"; echo "</td>"; echo "</tr>"; } elseif ($hookname == "user_personal_links") { // this displays the link in the user´s profile page to it´s personal quota_management (if you want other sto access it, youll have to change the permissions in the index.php $userid = $params['user_id']; $user = user_get_object($userid); $text = $params['text']; //check if the user has the plugin activated if ($user->usesPlugin($this->name)) { echo ' <p>'; echo util_make_link("/plugins/quota_management/index.php?id={$userid}&type=user&pluginname=" . $this->name, _('View Personal quota_management')); echo '</p>'; } } elseif ($hookname == "project_admin_plugins") { // this displays the link in the project admin options page to it´s quota_management administration $group_id = $params['group_id']; $group =& group_get_object($group_id); if ($group->usesPlugin($this->name)) { echo util_make_link('/plugins/quota_management/index.php?id=' . $group->getID() . '&type=admin&pluginname=' . $this->name, _('View the quota_management Administration')); echo '<br />'; } } elseif ($hookname == "blahblahblah") { // ... } elseif ($hookname == "site_admin_option_hook") { // www/admin/index.php line 167 // ... ?> <li><?php echo util_make_link("/plugins/quota_management/quota.php", _('Ressources usage and quota')); ?> </li> <?php } elseif ($hookname == "quota_label_project_admin") { // www/project/admin/project_admin_utils.php line 80 $labels[] = _('Quota'); } elseif ($hookname == "quota_link_project_admin") { // www/project/admin/project_admin_utils.php line 99 $group_id = $params['group']; $links[] = '/plugins/quota_management/quota.php?group_id=' . $group_id; } }
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once '../env.inc.php'; require_once $gfwww . 'include/pre.php'; session_require(array('isloggedin' => 1)); if (getStringFromRequest('submit')) { if (!form_key_is_valid(getStringFromRequest('form_key'))) { exit_form_double_submit(); } $newemail = getStringFromRequest('newemail'); if (!validate_email($newemail)) { form_release_key(getStringFromRequest('form_key')); exit_error(_('Error'), _('Invalid email address.')); } $confirm_hash = substr(md5($session_hash . time()), 0, 16); $u =& user_get_object(user_getid()); if (!$u || !is_object($u)) { form_release_key(getStringFromRequest('form_key')); exit_error('Error', 'Could Not Get User'); } elseif ($u->isError()) { form_release_key(getStringFromRequest('form_key')); exit_error('Error', $u->getErrorMessage()); } if (!$u->setNewEmailAndHash($newemail, $confirm_hash)) { form_release_key(getStringFromRequest('form_key')); exit_error('Could Not Complete Operation', $u->getErrorMessage()); } $message = stripcslashes(sprintf(_('You have requested a change of email address on %1$s. Please visit the following URL to complete the email change: %2$s
/** * getListAdmin - get the user who is the admin of this mailing list * * @return User The admin user */ function getListAdmin() { return user_get_object($this->dataArray['list_admin']); }
<br /> </p> <?php // ########################## OTHER INFO print "<p><strong>" . _('Other Information') . "</strong></p>"; print "<p>" . _('Unix Group Name:') . " " . $row_grp['unix_group_name'] . "</p>"; print "<p>" . _('Submitted Description:') . "</p><blockquote>" . $row_grp['register_purpose'] . "</blockquote>"; if ($row_grp['license'] == "other") { print "<p>" . _('License Other:') . "</p><blockquote>" . $row_grp['license_other'] . "</blockquote>"; } if (isset($row_grp['status_comment'])) { print "<p>" . _('Pending reason:') . "</p><span class=\"important\">" . $row_grp['status_comment'] . "</span>"; } $res = db_query("SELECT u.user_id\n\t\t\t FROM users u, user_group ug\n\t\t\t WHERE ug.group_id='" . $row_grp['group_id'] . "' AND u.user_id=ug.user_id;"); if (db_numrows($res) >= 1) { $submitter =& user_get_object(db_result($res, 0, 'user_id')); echo '<p>' . sprintf(_('Submitted by %1$s (%2$s)'), $submitter->getRealName(), $submitter->getUnixName()) . '</p>'; } echo "<p> </p><hr /><p> </p>"; } //list of group_id's of pending projects $arr = util_result_column_to_array($res_grp, 0); $group_list = implode($arr, ','); echo ' <div align="center"> <form action="' . getStringFromServer('PHP_SELF') . '" method="post"> <input type="hidden" name="action" value="activate" /> <input type="hidden" name="list_of_groups" value="' . $group_list . '" /> <input type="submit" name="submit" value="' . _('Approve All On This Page') . '" /> </form></div> ';
global $G_SESSION; if (user_isloggedin() || $sf_user_hash) { /* * If user has valid "remember-me" hash, instantiate not-logged in * session for one. */ if (!user_isloggedin()) { list($user_id, $hash) = explode('_', $sf_user_hash); $sql = "SELECT * \n\t\t\tFROM users \n\t\t\tWHERE user_id='" . $user_id . "' AND user_pw LIKE '" . $hash . "%'"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows != 1) { exit_not_logged_in(); } $user_id = db_result($result, 0, 'user_id'); $G_SESSION = user_get_object($user_id, $result); } echo site_user_header(array('title' => 'My Personal Page')); ?> <H2>Personal Page for: <?php print $G_SESSION->getUnixName(); ?> </H2> <P> Your personal page contains lists of bugs and tasks that you are assigned, plus a list of groups that you are a member of. <P> <TABLE width="100%" border="0"> <TR><TD VALIGN="TOP" WIDTH="50%"> <?php