当前位置: 首页>>代码示例>>PHP>>正文


PHP user_get_object函数代码示例

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


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


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