• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_get_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_get_object函数的典型用法代码示例。如果您正苦于以下问题:PHP user_get_object函数的具体用法?PHP user_get_object怎么用?PHP user_get_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了user_get_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: register_valid

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;
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:28,代码来源:user_changepw.php


示例2: register_valid

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;
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:35,代码来源:change_pw.php


示例3: continue_session

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());
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:9,代码来源:user.php


示例4: sysCreateUser

 /**
  * 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;
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:16,代码来源:System.class.php


示例5: User_nforge

 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);
         }
     }
 }
开发者ID:ahastudio,项目名称:moniwiki,代码行数:52,代码来源:nforge.php


示例6: sysCreateUser

 /**
  * 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;
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:21,代码来源:UNIX.class.php


示例7: GforgeMWAuth

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();
        }
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:18,代码来源:GForge.php


示例8: performAction

/**
 * 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>";
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:26,代码来源:userlist.php


示例9: sysCreateUser

 /**
  * 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;
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:47,代码来源:pgsql.class.php


示例10: activate_group

 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);
     }
 }
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:36,代码来源:approve-pending.php


示例11: user_getname

/**
 * 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';
        }
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:30,代码来源:User.class.php


示例12: create

 /**
  *	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;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:48,代码来源:ArtifactMessage.class.php


示例13: exit

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) {
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:daily_task_email.php


示例14: getStringFromRequest

    // 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>';
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:unsubscribe.php


示例15: sendAttachNotice

 /**
  *	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;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:41,代码来源:ForumMessage.class.php


示例16: session_set

/**
 *	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();
        }
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:40,代码来源:session.php


示例17: addMessage

 /**
  *  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;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:42,代码来源:Artifact.class.php


示例18: getStringFromRequest

    // 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);
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:lostlogin.php


示例19: sf_ldap_group_remove_user

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;
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:29,代码来源:ldap.php


示例20: CallHook

 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'))) . '&nbsp;' . _('Parent project') . ': <a href="' . $GLOBALS['sys_urlprefix'] . '/projects/' . $row['unix_group_name'] . '/">' . $row['group_name'] . '</a><br/>';
             $cpt_project++;
         }
         if ($cpt_project != 0) {
//.........这里部分代码省略.........
开发者ID:neymanna,项目名称:fusionforge,代码行数:101,代码来源:projects_hierarchyPlugin.class.php



注:本文中的user_get_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_get_preference函数代码示例发布时间:2022-05-23
下一篇:
PHP user_get_name函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap