本文整理汇总了PHP中User::getDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getDetails方法的具体用法?PHP User::getDetails怎么用?PHP User::getDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User::getDetails方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginCallback
public function loginCallback()
{
$attributes = phpCAS::getAttributes();
$this->updateLocalUserFromBackend($attributes);
$usr_id = User::getUserIDByEmail($attributes['mail'], true);
$user = User::getDetails($usr_id);
Auth::createLoginCookie(APP_COOKIE, $user['usr_email'], true);
}
示例2: verifyPassword
/**
* Checks whether the provided password match against the email
* address provided.
*
* @param string $login The email address to check for
* @param string $password The password of the user to check for
* @return boolean
*/
public function verifyPassword($login, $password)
{
$usr_id = User::getUserIDByEmail($login, true);
$user = User::getDetails($usr_id);
if ($user['usr_password'] == Auth::hashPassword($password)) {
self::resetFailedLogins($usr_id);
return true;
} else {
self::incrementFailedLogins($usr_id);
return false;
}
}
示例3: setAuthCookie
/**
* Method used to set auth cookie in user's browser.
*
* @param int|string $user User Id or User email.
* @param boolean $permanent Set to false to make session cookie (Expires when browser is closed)
*/
public static function setAuthCookie($user, $permanent = true)
{
if (!$user) {
throw new LogicException('Need usr_id or email');
}
if (is_numeric($user)) {
$user_details = User::getDetails($user);
$email = $user_details['usr_email'];
} else {
$email = $user;
}
$cookie = self::generateAuthCookie($email, $permanent);
Auth::setCookie(APP_COOKIE, $cookie, $permanent ? APP_COOKIE_EXPIRE : null);
$_COOKIE[APP_COOKIE] = $cookie;
}
示例4: verifyPassword
/**
* Checks whether the provided password match against the email
* address provided.
*
* @param string $login The email address to check for
* @param string $password The password of the user to check for
* @return boolean
*/
public function verifyPassword($login, $password)
{
$usr_id = User::getUserIDByEmail($login, true);
$user = User::getDetails($usr_id);
$hash = $user['usr_password'];
if (!AuthPassword::verify($password, $hash)) {
self::incrementFailedLogins($usr_id);
return false;
}
self::resetFailedLogins($usr_id);
// check if hash needs rehashing,
// old md5 or more secure default
if (AuthPassword::needs_rehash($hash)) {
self::updatePassword($usr_id, $password);
}
return true;
}
示例5: checkUserDetails
/**
* Collects details of a user from the database system
* Returns a Null array if user doesn't exist;
*/
public function checkUserDetails($username, $password)
{
// Set the state and tell plugins.
$this->setState('CHECKING_USER_DETAILS');
$this->notifyObservers();
//Include the User Library
include "lib/User.php";
//Setup user class
$user = new User();
//Encrypt the password
$password = $user->encryptPass($password);
$data = $user->getDetails($username);
//If the user doesn't exist return false, incorrect details
if (empty($data)) {
//Return false
return false;
} else {
if ($password == $data[1]) {
//The details are correct
return true;
}
}
}
示例6: Template_API
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.forgot_password.php 1.8 03/12/12 19:09:43-00:00 jpradomaia $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.mail.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("forgot_password.tpl.html");
if (@$HTTP_POST_VARS["cat"] == "reset_password") {
if (empty($HTTP_POST_VARS["email"])) {
$tpl->assign("result", 4);
}
$usr_id = User::getUserIDByEmail($HTTP_POST_VARS["email"]);
if (empty($usr_id)) {
$tpl->assign("result", 5);
} else {
$info = User::getDetails($usr_id);
if (!User::isActiveStatus($info["usr_status"])) {
$tpl->assign("result", 3);
} else {
User::sendPasswordConfirmationEmail($usr_id);
$tpl->assign("result", 1);
}
}
}
$tpl->displayTemplate();
示例7: array
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
$res = User::insertFromPost();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the user was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new user.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = User::updateFromPost();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the user was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the user information.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'change_status') {
User::changeStatus($_POST['items'], $_POST['status']);
}
$project_roles = array();
$project_list = Project::getAll();
if (@$_GET['cat'] == 'edit') {
$info = User::getDetails($_GET['id']);
$tpl->assign('info', $info);
}
foreach ($project_list as $prj_id => $prj_title) {
$excluded_roles = array('Customer');
if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID('Customer')) {
if (count($excluded_roles) == 1) {
$excluded_roles = false;
} else {
$excluded_roles = array('administrator');
}
if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID('administrator')) {
$excluded_roles = false;
}
}
$project_roles[$prj_id] = $user_roles = array(0 => 'No Access') + User::getRoles($excluded_roles);
示例8: createFakeCookie
/**
* Creates a fake cookie so processes not run from a browser can access current user and project
*
* @param integer $usr_id The ID of the user.
* @param bool|int $prj_id The ID of the project.
*/
public static function createFakeCookie($usr_id, $prj_id = false)
{
$user_details = User::getDetails($usr_id);
$time = time();
$cookie = array('email' => $user_details['usr_email'], 'login_time' => $time, 'hash' => md5(self::privateKey() . $time . $user_details['usr_email']));
$_COOKIE[APP_COOKIE] = base64_encode(serialize($cookie));
if ($prj_id) {
$cookie = array('prj_id' => $prj_id, 'remember' => false);
}
$_COOKIE[APP_PROJECT_COOKIE] = base64_encode(serialize($cookie));
}
示例9: buildWhereClause
/**
* Method used to get the list of issues to be displayed in the grid layout.
*
* @param array $options The search parameters
* @return string The where clause
*/
public static function buildWhereClause($options)
{
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$role_id = User::getRoleByUser($usr_id, $prj_id);
$usr_details = User::getDetails($usr_id);
$stmt = ' AND iss_usr_id = usr_id';
if ($role_id == User::getRoleID('Customer')) {
$crm = CRM::getInstance($prj_id);
$contact = $crm->getContact($usr_details['usr_customer_contact_id']);
$stmt .= " AND iss_customer_contract_id IN('" . implode("','", $contact->getContractIDS()) . "')";
$stmt .= " AND iss_customer_id ='" . Auth::getCurrentCustomerID() . "'";
} elseif ($role_id == User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
$stmt .= " AND (\n iss_usr_id = {$usr_id} OR\n iur_usr_id = {$usr_id}\n )";
}
if (!empty($usr_details['usr_par_code'])) {
// restrict partners
$stmt .= " AND ipa_par_code = '" . Misc::escapeString($usr_details['usr_par_code']) . "'";
}
if (!empty($options['users'])) {
$stmt .= " AND (\n";
if (stristr($options['users'], 'grp') !== false) {
$chunks = explode(':', $options['users']);
$stmt .= 'iss_grp_id = ' . Misc::escapeInteger($chunks[1]);
} else {
if ($options['users'] == '-1') {
$stmt .= 'isu_usr_id IS NULL';
} elseif ($options['users'] == '-2') {
$stmt .= 'isu_usr_id IS NULL OR isu_usr_id=' . $usr_id;
} elseif ($options['users'] == '-3') {
$stmt .= 'isu_usr_id = ' . $usr_id . ' OR iss_grp_id = ' . User::getGroupID($usr_id);
} elseif ($options['users'] == '-4') {
$stmt .= 'isu_usr_id IS NULL OR isu_usr_id = ' . $usr_id . ' OR iss_grp_id = ' . User::getGroupID($usr_id);
} else {
$stmt .= 'isu_usr_id =' . Misc::escapeInteger($options['users']);
}
}
$stmt .= ')';
}
if (!empty($options['reporter'])) {
$stmt .= ' AND iss_usr_id = ' . Misc::escapeInteger($options['reporter']);
}
if (!empty($options['show_authorized_issues'])) {
$stmt .= " AND (iur_usr_id={$usr_id})";
}
if (!empty($options['show_notification_list_issues'])) {
$stmt .= " AND (sub_usr_id={$usr_id})";
}
if (!empty($options['keywords'])) {
$stmt .= " AND (\n";
if ($options['search_type'] == 'all_text' && APP_ENABLE_FULLTEXT) {
$stmt .= 'iss_id IN(' . implode(', ', self::getFullTextIssues($options)) . ')';
} elseif ($options['search_type'] == 'customer' && CRM::hasCustomerIntegration($prj_id)) {
// check if the user is trying to search by customer name / email
$crm = CRM::getInstance($prj_id);
$customer_ids = $crm->getCustomerIDsByString($options['keywords'], true);
if (count($customer_ids) > 0) {
$stmt .= ' iss_customer_id IN (' . implode(', ', $customer_ids) . ')';
} else {
// no results, kill query
$stmt .= ' iss_customer_id = -1';
}
} else {
$stmt .= '(' . Misc::prepareBooleanSearch('iss_summary', $options['keywords']);
$stmt .= ' OR ' . Misc::prepareBooleanSearch('iss_description', $options['keywords']) . ')';
}
$stmt .= "\n) ";
}
if (!empty($options['customer_id'])) {
$stmt .= " AND iss_customer_id='" . Misc::escapeString($options['customer_id']) . "'";
}
if (!empty($options['priority'])) {
$stmt .= ' AND iss_pri_id=' . Misc::escapeInteger($options['priority']);
}
if (!empty($options['status'])) {
$stmt .= ' AND iss_sta_id=' . Misc::escapeInteger($options['status']);
}
if (!empty($options['category'])) {
if (!is_array($options['category'])) {
$options['category'] = array($options['category']);
}
$stmt .= ' AND iss_prc_id IN(' . implode(', ', Misc::escapeInteger($options['category'])) . ')';
}
if (!empty($options['hide_closed'])) {
$stmt .= ' AND sta_is_closed=0';
}
if (!empty($options['release'])) {
$stmt .= ' AND iss_pre_id = ' . Misc::escapeInteger($options['release']);
}
if (!empty($options['product'])) {
$stmt .= ' AND ipv_pro_id = ' . Misc::escapeInteger($options['product']);
}
// now for the date fields
$date_fields = array('created_date', 'updated_date', 'last_response_date', 'first_response_date', 'closed_date');
//.........这里部分代码省略.........
示例10: sendPasswordConfirmationEmail
/**
* Method used to send a confirmation email to the user that is associated
* to the email address.
*
* @access public
* @param string $usr_id The user ID
* @return void
*/
function sendPasswordConfirmationEmail($usr_id)
{
$info = User::getDetails($usr_id);
// send confirmation email to user
$hash = md5($info["usr_full_name"] . md5($info["usr_email"]) . $GLOBALS["private_key"]);
$msg = "Hello,\n\n";
$msg .= "We just received a request to create a new random password for your account in our issue tracking system. ";
$msg .= "For security reasons we need you to confirm this request so we can finish the password creation process.\n\n";
$msg .= "If this is not a real request from you, or if you don't need a new password anymore, ";
$msg .= "please disregard this email.\n\n";
$msg .= "However, if you would like to confirm this request, please do so by visiting the URL below:\n\n";
$msg .= APP_BASE_URL . "confirm.php?cat=password&email=" . $info["usr_email"] . "&hash=" . $hash . "\n\n";
$setup = Setup::load();
$mail = new Mail_API();
// need to make this message MIME based
$mail->setTextBody($msg);
$mail->send($setup["smtp"]["from"], $info["usr_email"], APP_SHORT_NAME . ": New Password - Confirmation Required");
}
示例11: ev_gettext
Misc::setMessage(ev_gettext('Note: Project automatically switched to "%1$s" from "%2$s".', Auth::getCurrentProjectName(), Project::getName($iss_prj_id)));
}
$tpl->assign('issue', $details);
$tpl->assign('extra_title', ev_gettext('Update Issue #%1$s', $issue_id));
// in the case of a customer user, also need to check if that customer has access to this issue
if ($role_id == User::getRoleID('customer') && (empty($details) || User::getCustomerID($usr_id) != $details['iss_customer_id']) || !Issue::canAccess($issue_id, $usr_id) || !($role_id > User::getRoleID('Reporter')) || !Issue::canUpdate($issue_id, $usr_id)) {
$tpl->setTemplate('base_full.tpl.html');
Misc::setMessage(ev_gettext('Sorry, you do not have the required privileges to update this issue.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (Issue_Lock::acquire($issue_id, $usr_id)) {
$issue_lock = false;
} else {
$issue_lock = Issue_Lock::getInfo($issue_id);
$issue_lock['locker'] = User::getDetails($issue_lock['usr_id']);
$issue_lock['expires_formatted_time'] = Date_Helper::getFormattedDate($issue_lock['expires']);
}
$tpl->assign('issue_lock', $issue_lock);
$new_prj_id = Issue::getProjectID($issue_id);
$cancel_update = isset($_POST['cancel']);
if ($cancel_update) {
// be sure not to unlock somebody else's lock
if (!$issue_lock) {
Issue_Lock::release($issue_id);
Misc::setMessage(ev_gettext('Cancelled Issue #%1$s update.', $issue_id), Misc::MSG_INFO);
}
Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
exit;
} elseif (@$_POST['cat'] == 'update') {
if ($issue_lock) {
示例12: isset
// special handling when someone tries to 'reply' to an issue
if ($cat == 'reply') {
$details = Issue::getReplyDetails($_GET['issue_id']);
if ($details != '') {
$header = Misc::formatReplyPreamble($details['created_date_ts'], $details['reporter']);
$details['seb_body'] = $header . Misc::formatReply($details['description']);
$details['sup_from'] = Mail_Helper::getFormattedName($details['reporter'], $details['reporter_email']);
$tpl->assign(array('email' => $details, 'parent_email_id' => 0, 'extra_title' => 'Issue #' . $_GET['issue_id'] . ': Reply'));
}
}
if (!empty($issue_id)) {
// list the available statuses
$tpl->assign('statuses', Status::getAssocStatusList($prj_id, false));
$tpl->assign('current_issue_status', Issue::getStatusID($issue_id));
// set if the current user is allowed to send emails on this issue or not
$sender_details = User::getDetails($usr_id);
$tpl->assign('can_send_email', Support::isAllowedToEmail($issue_id, $sender_details['usr_email']));
$tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails'));
}
if (!empty($_GET['ema_id']) || !empty($_POST['ema_id'])) {
$ema_id = isset($_GET['ema_id']) ? (int) $_GET['ema_id'] : (isset($_POST['ema_id']) ? (int) $_POST['ema_id'] : null);
$tpl->assign('ema_id', $ema_id);
}
$user_prefs = Prefs::get($usr_id);
// list of users to display in the lookup field in the To: and Cc: fields
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'assoc_users' => $t, 'assoc_emails' => array_keys($t), 'canned_responses' => Email_Response::getAssocList($prj_id), 'js_canned_responses' => Email_Response::getAssocListBodies($prj_id), 'current_user_prefs' => $user_prefs, 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true)));
// don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs.
if (@(!empty($draft['emd_body'])) && $user_prefs['auto_append_email_sig'] == 1 && strpos($draft['emd_body'], $user_prefs['email_signature']) !== false) {
$tpl->assign('body_has_sig_already', 1);
}
示例13: getUserDetails
/**
* Collects User details through available library
*/
public function getUserDetails()
{
$this->setState('GETTING_USER_DETAIL');
//Get the username request
$username = $this->getActiveRequest();
//Include the User Library
include_once "core/lib/User.php";
//Setup user class
$u = new User();
//Get the user data
$data = $u->getDetails($username);
//Convert Data into View required strings [showEditForm($user, $fullname, $email, $level1, $level2)]
$form = array();
//Set Name
$form[0] = $username;
//Set Full Name
$form[1] = $data[0];
//Set Email
$form[2] = $data[3];
//Set Option 1 (Allows for case of external change eg. more than just administrator and editor - possibly a hacked 'contributor' mode.)
$form[3] = $data[2];
//If Administrator
if ($data[2] == "administrator") {
//Show Administrator as first option
$form[4] = "editor";
} else {
//Show Administrator as first option
$form[4] = "administrator";
}
//Return form data
return $form;
}
示例14: notifyAccountDetails
/**
* Method used to send the account details of an user.
*
* @access public
* @param integer $usr_id The user ID
* @return void
*/
function notifyAccountDetails($usr_id)
{
$info = User::getDetails($usr_id);
$info["projects"] = Project::getAssocList($usr_id, true, true);
// open text template
$tpl = new Template_API();
$tpl->setTemplate('notifications/account_details.tpl.text');
$tpl->bulkAssign(array("app_title" => Misc::getToolCaption(), "user" => $info));
$text_message = $tpl->getTemplateContents();
// send email (use PEAR's classes)
$mail = new Mail_API();
$mail->setTextBody($text_message);
$setup = $mail->getSMTPSettings();
$mail->send($setup["from"], $mail->getFormattedName($info["usr_full_name"], $info["usr_email"]), APP_SHORT_NAME . ": Your User Account Details");
}
示例15: notifyAccountDetails
/**
* Method used to send the account details of an user.
*
* @param integer $usr_id The user ID
* @return void
*/
public function notifyAccountDetails($usr_id)
{
$info = User::getDetails($usr_id);
$info['projects'] = Project::getAssocList($usr_id, true, true);
// open text template
$tpl = new Template_Helper();
$tpl->setTemplate('notifications/account_details.tpl.text');
$tpl->assign(array('app_title' => Misc::getToolCaption(), 'user' => $info));
Language::set(User::getLang($usr_id));
$text_message = $tpl->getTemplateContents();
// send email (use PEAR's classes)
$mail = new Mail_Helper();
$mail->setTextBody($text_message);
$setup = $mail->getSMTPSettings();
$to = $mail->getFormattedName($info['usr_full_name'], $info['usr_email']);
// TRANSLATORS: %s = APP_SHORT_NAME
$subject = ev_gettext('%s: Your User Account Details', APP_SHORT_NAME);
$mail->send($setup['from'], $to, $subject);
Language::restore();
}