本文整理汇总了PHP中Auth::getUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::getUserID方法的具体用法?PHP Auth::getUserID怎么用?PHP Auth::getUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::getUserID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Modifies an Issue's Reporter.
*
* @param integer $issue_id The id of the issue.
* @param string $fullname The id of the user.
* @param boolean $add_history If this should be logged.
* @return int
*/
public static function update($issue_id, $email, $add_history = true)
{
$email = strtolower(Mail_Helper::getEmailAddress($email));
$usr_id = User::getUserIDByEmail($email, true);
// If no valid user found reset to system account
if (!$usr_id) {
$usr_id = APP_SYSTEM_USER_ID;
}
$sql = 'UPDATE
{{%issue}}
SET
iss_usr_id = ?
WHERE
iss_id = ?';
try {
DB_Helper::getInstance()->query($sql, array($usr_id, $issue_id));
} catch (DbException $e) {
return -1;
}
if ($add_history) {
// TRANSLATORS: %1: email, %2: full name
$current_usr_id = Auth::getUserID();
History::add($issue_id, $current_usr_id, 'issue_updated', 'Reporter was changed to {email} by {user}', array('email' => $email, 'user' => User::getFullName($current_usr_id)));
}
// Add new user to notification list
if ($usr_id > 0) {
Notification::subscribeEmail($usr_id, $issue_id, $email, Notification::getDefaultActions());
}
return 1;
}
示例2: getDisplayData
/**
* Returns an array of titles, options and current values for the specified
* display location and issue.
*
* @param integer $issue_id The ID of the issue
* @param string $location The name of the location to display fields
* @return array An array of data.
*/
public static function getDisplayData($issue_id, $location)
{
$prj_id = Issue::getProjectID($issue_id);
$available_fields = self::getAvailableFields();
$fields = self::getFieldsToDisplay($issue_id, $location);
$data = array();
foreach ($fields as $field_name => $field_options) {
$data[$field_name] = array('title' => $available_fields[$field_name], 'options' => self::getOptions($field_name, $issue_id), 'value' => self::getValue($issue_id, $field_name));
if ($field_name == 'custom') {
$data[$field_name]['custom'] = Custom_Field::getListByIssue($prj_id, $issue_id, Auth::getUserID(), $field_options);
}
}
return $data;
}
示例3: purchaseAction
/**
* カートの中を確認
* route --> /item/purchase
*/
public function purchaseAction()
{
$this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")");
$customerID = Auth::getUserID();
$params = $this->getPostList();
if (count($params) == 0) {
$this->_log->debug("パラメータがPOSTされていません.");
$mapper = new Item();
$cartContent = $mapper->showCartContent($customerID);
$this->_log->debug("カートの中身:" . print_r($cartContent, true));
$this->setViewSearchlist($cartContent);
return;
}
return;
}
示例4: remove
/**
* Method used to remove a specific list of checkins
*
* @param int[] $items list to remove
* @return integer 1 if the update worked, -1 otherwise
*/
public static function remove($items)
{
$itemlist = DB_Helper::buildList($items);
$stmt = "SELECT\n isc_iss_id\n FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})";
$issue_id = DB_Helper::getInstance()->getOne($stmt, $items);
$stmt = "DELETE FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})";
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return -1;
}
// need to mark this issue as updated
Issue::markAsUpdated($issue_id);
$usr_id = Auth::getUserID();
History::add($issue_id, $usr_id, 'scm_checkin_removed', 'SCM Checkins removed by {user}', array('user' => User::getFullName($usr_id)));
return 1;
}
示例5: __construct
public function __construct()
{
$this->usr_id = Auth::getUserID();
if (!Access::canAccessReports($this->usr_id)) {
throw new LogicException('Invalid role');
}
$this->prj_id = Auth::getCurrentProject();
$this->activity_types = !empty($_REQUEST['activity_types']) ? (array) $_REQUEST['activity_types'] : array();
$this->report_type = isset($_REQUEST['report_type']) ? (string) $_REQUEST['report_type'] : null;
$this->unit = $this->getParam('unit', array('hour', 'day'));
$this->amount = isset($_REQUEST['amount']) ? $_REQUEST['amount'] : null;
$this->developer = isset($_REQUEST['developer']) ? $_REQUEST['developer'] : null;
$this->start_date = $this->parseDate(isset($_POST['start']) ? $_POST['start'] : null);
$this->end_date = $this->parseDate(isset($_POST['end']) ? $_POST['end'] : null);
$this->sort_order = $this->getParam('sort_order', array('ASC', 'DESC'));
if (CRM::hasCustomerIntegration($this->prj_id)) {
$this->crm = CRM::getInstance($this->prj_id);
}
}
示例6: evaluateAction
/**
* 人物を評価する
* route --> /customer/evaluate
*/
public function evaluateAction()
{
$this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")");
$customerID = Auth::getUserID();
// 配達者or依頼者
$params = $this->getPostList();
$mapper = new Customer();
/* 評価画面をセット */
if (!array_key_exists('rate', $params)) {
$this->_log->debug("評価画面をセット.");
$indata = $mapper->selectRequestInfo($params['requestID']);
$indata['customerID'] = $customerID;
$indata['requestID'] = $params['requestID'];
$this->setViewIndata($indata);
$this->_log->debug("リクエスト情報" . print_r($indata, true));
return;
}
/* 相手を評価 */
$mapper->evaluatePerson($customerID, $params);
$this->redirect('/item');
return;
}
示例7: elseif
$tpl->assign('delete_filter_result', $res);
} elseif ($cat == 'remove_support_email') {
$res = Support::removeAssociation();
$tpl->assign('remove_association_result', $res);
} elseif ($cat == 'delete_attachment') {
$res = Attachment::remove($id);
$tpl->assign('remove_attachment_result', $res);
} elseif ($cat == 'delete_file') {
$res = Attachment::removeIndividualFile($id);
$tpl->assign('remove_file_result', $res);
} elseif ($cat == 'remove_checkin') {
$res = SCM::remove($items);
$tpl->assign('remove_checkin_result', $res);
} elseif ($cat == 'unassign') {
$res = Issue::deleteUserAssociation($iss_id, $usr_id);
Workflow::handleAssignmentChange($prj_id, $iss_id, Auth::getUserID(), Issue::getDetails($iss_id), Issue::getAssignedUserIDs($iss_id));
$tpl->assign('unassign_result', $res);
} elseif ($cat == 'remove_email') {
$res = Support::removeEmails();
$tpl->assign('remove_email_result', $res);
} elseif ($cat == 'clear_duplicate') {
$res = Issue::clearDuplicateStatus($iss_id);
$tpl->assign('clear_duplicate_result', $res);
} elseif ($cat == 'delete_phone') {
$res = Phone_Support::remove($id);
$tpl->assign('delete_phone_result', $res);
} elseif ($cat == 'new_status') {
$res = Issue::setStatus($iss_id, $status_id, true);
if ($res == 1) {
History::add($iss_id, $usr_id, 'status_changed', "Issue manually set to status '{status}' by {user}", array('status' => Status::getStatusTitle($status_id), 'user' => User::getFullName($usr_id)));
}
示例8: removePartnerFromIssue
public static function removePartnerFromIssue($iss_id, $par_code)
{
$params = array($iss_id, $par_code);
$sql = 'DELETE FROM
{{%issue_partner}}
WHERE
ipa_iss_id = ? AND
ipa_par_code = ?';
try {
DB_Helper::getInstance()->query($sql, $params);
} catch (DbException $e) {
return false;
}
$backend = self::getBackend($par_code);
$backend->issueRemoved($iss_id);
$usr_id = Auth::getUserID();
History::add($iss_id, $usr_id, 'partner_removed', "Partner '{partner}' removed from issue by {user}", array('partner' => $backend->getName(), 'user' => User::getFullName($usr_id)));
return true;
}
示例9: Template_Helper
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/custom_fields.tpl.html');
Auth::checkAuthentication();
if (!Access::canAccessReports(Auth::getUserID())) {
echo 'Invalid role';
exit;
}
$prj_id = Auth::getCurrentProject();
// get list of fields and convert info useful arrays
$fields = Custom_Field::getListByProject($prj_id, '');
$custom_fields = array();
$options = array();
if (is_array($fields) && count($fields) > 0) {
foreach ($fields as $field) {
$custom_fields[$field['fld_id']] = $field['fld_title'];
$options[$field['fld_id']] = Custom_Field::getOptions($field['fld_id']);
}
} else {
echo ev_gettext('No custom fields for this project');
示例10: getListByIssue
/**
* Method used to get the list of custom fields and custom field
* values associated with a given issue ID. If usr_id is false method
* defaults to current user.
*
* @param integer $prj_id The project ID
* @param integer $iss_id The issue ID
* @param integer $usr_id The ID of the user who is going to be viewing this list.
* @param mixed $form_type The name of the form this is for or if this is an array the ids of the fields to return
* @return array The list of custom fields
*/
public static function getListByIssue($prj_id, $iss_id, $usr_id = null, $form_type = false)
{
if (!$usr_id) {
$usr_id = Auth::getUserID();
}
$usr_role = User::getRoleByUser($usr_id, $prj_id);
if (empty($usr_role)) {
$usr_role = 0;
}
$stmt = 'SELECT
fld_id,
fld_title,
fld_type,
fld_report_form_required,
fld_anonymous_form_required,
fld_close_form_required,
' . self::getDBValueFieldSQL() . ' as value,
icf_value,
icf_value_date,
icf_value_integer,
fld_min_role,
fld_description
FROM
(
{{%custom_field}},
{{%project_custom_field}}
)
LEFT JOIN
{{%issue_custom_field}}
ON
pcf_fld_id=icf_fld_id AND
icf_iss_id=?
WHERE
pcf_fld_id=fld_id AND
pcf_prj_id=? AND
fld_min_role <= ?';
$params = array($iss_id, $prj_id, $usr_role);
if ($form_type != false) {
if (is_array($form_type)) {
$stmt .= ' AND fld_id IN(' . DB_Helper::buildList($form_type) . ')';
$params = array_merge($params, $form_type);
} else {
$fld_name = 'fld_' . Misc::escapeString($form_type);
$stmt .= " AND {$fld_name}=1";
}
}
$stmt .= '
ORDER BY
fld_rank ASC';
try {
$res = DB_Helper::getInstance()->getAll($stmt, $params);
} catch (DbException $e) {
return array();
}
if (count($res) == 0) {
return array();
}
$fields = array();
foreach ($res as &$row) {
if ($row['fld_type'] == 'combo') {
$row['selected_cfo_id'] = $row['value'];
$row['original_value'] = $row['value'];
$row['value'] = self::getOptionValue($row['fld_id'], $row['value']);
$row['field_options'] = self::getOptions($row['fld_id'], false, $iss_id);
// add the select option to the list of values if it isn't on the list (useful for fields with active and non-active items)
if (!empty($row['original_value']) && !isset($row['field_options'][$row['original_value']])) {
$row['field_options'][$row['original_value']] = self::getOptionValue($row['fld_id'], $row['original_value']);
}
$fields[] = $row;
} elseif ($row['fld_type'] == 'multiple' || $row['fld_type'] == 'checkbox') {
// check whether this field is already in the array
$found = 0;
foreach ($fields as $y => $field) {
if ($field['fld_id'] == $row['fld_id']) {
$found = 1;
$found_index = $y;
}
}
$original_value = $row['value'];
if (!$found) {
$row['selected_cfo_id'] = array($row['value']);
$row['value'] = self::getOptionValue($row['fld_id'], $row['value']);
$row['field_options'] = self::getOptions($row['fld_id']);
$fields[] = $row;
$found_index = count($fields) - 1;
} else {
$fields[$found_index]['value'] .= ', ' . self::getOptionValue($row['fld_id'], $row['value']);
$fields[$found_index]['selected_cfo_id'][] = $row['value'];
}
//.........这里部分代码省略.........
示例11: dirname
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('view_note.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$note_id = $_GET['id'];
$note = Note::getDetails($note_id);
if ($note == '') {
$tpl->assign('note', '');
$tpl->displayTemplate();
exit;
} else {
$note['message'] = $note['not_note'];
$issue_id = Note::getIssueID($note_id);
$usr_id = Auth::getUserID();
}
if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Access::canViewInternalNotes($issue_id, Auth::getUserID())) {
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
$note = Note::getDetails($_GET['id']);
$note['message'] = $note['not_note'];
$issue_id = Note::getIssueID($_GET['id']);
$tpl->assign(array('note' => $note, 'issue_id' => $issue_id, 'extra_title' => 'Note #' . Note::getNoteSequenceNumber($issue_id, $note_id) . ': ' . $note['not_title'], 'recipients' => Mail_Queue::getMessageRecipients('notes', $note_id)));
if (!empty($issue_id)) {
$sides = Note::getSideLinks($issue_id, $_GET['id']);
$tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
$tpl->displayTemplate();
示例12: addExtraRecipientsToNotificationList
public function addExtraRecipientsToNotificationList($prj_id, $email, $is_auto_created = false)
{
if (empty($email['to']) && !empty($email['sup_to'])) {
$email['to'] = $email['sup_to'];
}
if (empty($email['cc']) && !empty($email['sup_cc'])) {
$email['cc'] = $email['sup_cc'];
}
$project_details = Project::getDetails($prj_id);
$addresses_not_too_add = explode(',', strtolower($project_details['prj_mail_aliases']));
array_push($addresses_not_too_add, $project_details['prj_outgoing_sender_email']);
$addresses = array();
$to_addresses = Mail_Helper::getEmailAddresses(@$email['to']);
if (count($to_addresses)) {
$addresses = $to_addresses;
}
$cc_addresses = Mail_Helper::getEmailAddresses(@$email['cc']);
if (count($cc_addresses)) {
$addresses = array_merge($addresses, $cc_addresses);
}
$subscribers = Notification::getSubscribedEmails($email['issue_id']);
foreach ($addresses as $address) {
$address = strtolower($address);
if (!in_array($address, $subscribers) && !in_array($address, $addresses_not_too_add)) {
Notification::subscribeEmail(Auth::getUserID(), $email['issue_id'], $address, Notification::getDefaultActions($email['issue_id'], $address, 'add_extra_recipients'));
if ($is_auto_created) {
Notification::notifyAutoCreatedIssue($prj_id, $email['issue_id'], $email['from'], $email['date'], $email['subject'], $address);
}
}
}
}
示例13: 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');
//.........这里部分代码省略.........
示例14: getPreferredTimezone
/**
* Method used to get the timezone preferred by the user.
*
* @param integer $usr_id The user ID
* @return string The timezone preferred by the user
*/
public static function getPreferredTimezone($usr_id = null)
{
if (!$usr_id) {
$usr_id = Auth::getUserID();
}
if (!$usr_id) {
return self::getDefaultTimezone();
}
$prefs = Prefs::get($usr_id);
if (!empty($prefs['timezone'])) {
return $prefs['timezone'];
}
return self::getDefaultTimezone();
}
示例15: dirname
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('emails.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
if (!Access::canAccessAssociateEmails(Auth::getUserID())) {
$tpl->assign('no_access', 1);
$tpl->displayTemplate();
exit;
}
$pagerRow = Support::getParam('pagerRow');
if (empty($pagerRow)) {
$pagerRow = 0;
}
$rows = Support::getParam('rows');
if (empty($rows)) {
$rows = APP_DEFAULT_PAGER_SIZE;
}
$options = Support::saveSearchParams();
$tpl->assign('options', $options);
$tpl->assign('sorting', Support::getSortingInfo($options));
$list = Support::getEmailListing($options, $pagerRow, $rows);
$tpl->assign('list', $list['list']);
$tpl->assign('list_info', $list['info']);
$tpl->assign('issues', Issue::getColList());
$tpl->assign('accounts', Email_Account::getAssocList(Auth::getCurrentProject()));
$prefs = Prefs::get(Auth::getUserID());
$tpl->assign('refresh_rate', $prefs['email_refresh_rate'] * 60);
$tpl->assign('refresh_page', 'emails.php');
$tpl->displayTemplate();