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


PHP get_UserCache函数代码示例

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


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

示例1: get_link_owner

/**
 * Get a link owner object from link_type and object ID
 * 
 * @param string link type ( item, comment, ... )
 * @param integer the corresponding object ID
 */
function get_link_owner($link_type, $object_ID)
{
    switch ($link_type) {
        case 'item':
            // create LinkItem object
            $ItemCache =& get_ItemCache();
            $Item = $ItemCache->get_by_ID($object_ID, false);
            $LinkOwner = new LinkItem($Item);
            break;
        case 'comment':
            // create LinkComment object
            $CommentCache =& get_CommentCache();
            $Comment = $CommentCache->get_by_ID($object_ID, false);
            $LinkOwner = new LinkComment($Comment);
            break;
        case 'user':
            // create LinkUser object
            $UserCache =& get_UserCache();
            $User = $UserCache->get_by_ID($object_ID, false);
            $LinkOwner = new LinkUser($User);
            break;
        default:
            $LinkOwner = NULL;
    }
    return $LinkOwner;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:32,代码来源:_link.funcs.php

示例2: user_avatar

 function user_avatar($user_ID)
 {
     global $Blog;
     $UserCache =& get_UserCache();
     $User =& $UserCache->get_by_ID($user_ID);
     return $User->get_identity_link(array('link_text' => 'only_avatar', 'thumb_size' => $Blog->get_setting('image_size_user_list')));
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:7,代码来源:_user_list_short.view.php

示例3: emlog_to

function emlog_to($emlog_ID, $emlog_to, $emlog_user_ID)
{
    $deleted_user_note = '';
    if (!empty($emlog_user_ID)) {
        // Get user
        $UserCache =& get_UserCache();
        if ($User = $UserCache->get_by_ID($emlog_user_ID, false)) {
            $to = $User->get_identity_link();
        } else {
            // could not find user, probably it was deleted
            $deleted_user_note = '( ' . T_('Deleted user') . ' )';
        }
    }
    if (empty($to)) {
        // User is not defined
        global $admin_url;
        $to = '<a href="' . $admin_url . '?ctrl=email&amp;tab=sent&amp;emlog_ID=' . $emlog_ID . '">' . htmlspecialchars($emlog_to) . $deleted_user_note . '</a>';
    }
    return $to;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:20,代码来源:_email_sent.view.php

示例4: display

 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     global $DB, $Settings, $UserSettings, $localtimenow;
     if (!$this->get_param('allow_anonymous') && !is_logged_in()) {
         // display only for logged in users
         return;
     }
     // load online Users
     $UserCache =& get_UserCache();
     $online_threshold = $localtimenow - 2 * $Settings->get('timeout_online');
     $UserCache->load_where('user_lastseen_ts > ' . $DB->quote(date2mysql($online_threshold) . ' AND user_status <> ' . $DB->quote('closed')));
     $this->init_display($params);
     // START DISPLAY:
     echo $this->disp_params['block_start'];
     // Display title if requested
     $this->disp_title();
     echo $this->disp_params['block_body_start'];
     $r = '';
     while (($iterator_User =& $UserCache->get_next()) != NULL) {
         // Iterate through UserCache
         $user_lastseen_ts = mysql2timestamp($iterator_User->get('lastseen_ts'));
         if ($user_lastseen_ts > $online_threshold && $UserSettings->get('show_online', $iterator_User->ID) && !$iterator_User->check_status('is_closed')) {
             if (empty($r)) {
                 // first user
                 $r .= $params['list_start'];
             }
             $r .= $params['item_start'];
             $r .= $iterator_User->get_identity_link(array('login_mask' => '$login$'));
             $r .= $params['item_end'];
         }
     }
     if (!empty($r)) {
         $r .= $params['list_end'];
         echo $r;
     }
     echo $this->disp_params['block_body_end'];
     echo $this->disp_params['block_end'];
     return true;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:44,代码来源:_online_users.widget.php

示例5: td_task_cell

/**
 * Get title of the item/task cell by field type
 *
 * @param string Type of the field: 'priority', 'status', 'assigned'
 * @param object Item
 * @param integer Priority
 * @return string
 */
function td_task_cell($type, $Item)
{
    global $current_User;
    switch ($type) {
        case 'priority':
            $value = $Item->priority;
            $title = item_priority_title($Item->priority);
            break;
        case 'status':
            $value = $Item->pst_ID;
            $title = $Item->get('t_extra_status');
            if (empty($title)) {
                $title = T_('No status');
            }
            break;
        case 'assigned':
            $value = $Item->assigned_user_ID;
            if (empty($value)) {
                $title = T_('No user');
            } else {
                $UserCache =& get_UserCache();
                $User =& $UserCache->get_by_ID($Item->assigned_user_ID);
                $title = $User->get_colored_login(array('mask' => '$avatar$ $login$'));
            }
            break;
        default:
            $value = 0;
            $title = '';
    }
    if ($current_User->check_perm('item_post!CURSTATUS', 'edit', false, $Item)) {
        // Current user can edit this item
        return '<a href="#" rel="' . $value . '">' . $title . '</a>';
    } else {
        // No perms to edit item, Display only a title
        return $title;
    }
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:45,代码来源:_item_list_track.view.php

示例6: user_login

 function user_login($user_ID, $link = true)
 {
     $UserCache =& get_UserCache();
     $User =& $UserCache->get_by_ID($user_ID, false, false);
     if ($User) {
         if ($link) {
             $login_text = get_user_identity_link($User->login, $User->ID, 'user', 'login');
             if ($User->check_status('is_closed')) {
                 // add (closed account) note to corresponding contacts!
                 $login_text .= '<span class="note">(' . T_('closed account') . ')</span>';
             }
             return $login_text;
         }
         return $User->login;
     }
     return '';
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:17,代码来源:_contact_list.view.php

示例7: init

 /**
  * Get an array of registered users and guests.
  *
  * @return array containing number of registered users and guests ('registered' and 'guests')
  */
 function init()
 {
     if ($this->_initialized) {
         return true;
     }
     global $DB, $UserSettings, $localtimenow;
     $this->_count_guests = 0;
     $this->_registered_Users = array();
     $timeout_YMD = date('Y-m-d H:i:s', $localtimenow - $this->_timeout_online_user);
     $UserCache =& get_UserCache();
     // We get all sessions that have been seen in $timeout_YMD and that have a session key.
     // NOTE: we do not use DISTINCT here, because guest users are all "NULL".
     $online_user_ids = $DB->get_col("\n\t\t\tSELECT SQL_NO_CACHE sess_user_ID\n\t\t\t  FROM T_sessions\n\t\t\t WHERE sess_lastseen_ts > '" . $timeout_YMD . "'\n\t\t\t   AND sess_key IS NOT NULL\n\t\t\t GROUP BY sess_ID", 0, 'Sessions: get list of relevant users.');
     $registered_online_user_ids = array_diff($online_user_ids, array(NULL));
     // load all online users into the cache because we need information ( login, avatar ) about them
     $UserCache->load_list($registered_online_user_ids);
     foreach ($online_user_ids as $user_ID) {
         if (!empty($user_ID) && ($User =& $UserCache->get_by_ID($user_ID, false))) {
             if ($UserSettings->get('show_online', $User->ID)) {
                 // Assign by ID so that each user is only counted once (he could use multiple user agents at the same time):
                 $this->_registered_Users[$user_ID] =& $User;
             } else {
                 // Count this user as guest when he doesn't want to be visible:
                 $this->_count_guests++;
             }
         } else {
             $this->_count_guests++;
         }
     }
     $this->_initialized = true;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:36,代码来源:_whosonline.plugin.php

示例8: get_UserCache

/**
 * Get current_User for an XML-RPC request - Includes login (password) check.
 *
 * @param xmlrpcmsg XML-RPC Message
 * @param integer idx of login param in XML-RPC Message
 * @param integer idx of pass param in XML-RPC Message
 * @return User or NULL
 */
function &xmlrpcs_login($m, $login_param, $pass_param)
{
    global $xmlrpcs_errcode, $xmlrpcs_errmsg, $xmlrpcerruser;
    $username = $m->getParam($login_param);
    $username = $username->scalarval();
    $password = $m->getParam($pass_param);
    $password = $password->scalarval();
    /**
     * @var UserCache
     */
    $UserCache =& get_UserCache();
    $current_User =& $UserCache->get_by_login($username);
    if (empty($current_User) || !$current_User->check_password($password, false)) {
        // User not found or password doesn't match
        $xmlrpcs_errcode = $xmlrpcerruser + 1;
        $xmlrpcs_errmsg = 'Wrong username/password combination: ' . $username . ' / ' . starify($password);
        $r = NULL;
        return $r;
    }
    // This may be needed globally for status permissions in ItemList2, etc..
    $GLOBALS['current_User'] =& $current_User;
    // Check here ability to use APIs
    $group = $current_User->get_Group();
    if (!$group->check_perm('perm_api', 'always')) {
        // Permission denied
        $xmlrpcs_errcode = $xmlrpcerruser + 1;
        $xmlrpcs_errmsg = 'User has no permission to use this API: ' . $username . ' / ' . starify($password);
        $r = NULL;
        return $r;
    }
    logIO('Login OK - User: ' . $current_User->ID . ' - ' . $current_User->login);
    return $current_User;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:41,代码来源:_xmlrpcs.funcs.php

示例9: get_filter_titles

 /**
  * Generate a title for the current list, depending on its filtering params
  *
  * @todo cleanup some displays
  * @todo implement HMS part of YMDHMS
  *
  * @return array List of titles to display, which are escaped for HTML display
  *               (dh> only checked this for 'authors'/?authors=, where the output was not escaped)
  */
 function get_filter_titles($ignore = array(), $params = array())
 {
     global $month;
     $params = array_merge(array('category_text' => T_('Category') . ': ', 'categories_text' => T_('Categories') . ': ', 'tags_text' => T_('Tags') . ': '), $params);
     if (empty($this->filters)) {
         // Filters have no been set before, we'll use the default filterset:
         // echo ' setting default filterset ';
         $this->set_filters($this->default_filters);
     }
     $title_array = array();
     if ($this->single_post) {
         // We have requested a specific post:
         // Should be in first position
         $Item =& $this->get_by_idx(0);
         if (is_null($Item)) {
             $title_array[] = T_('Invalid request');
         } else {
             $title_array[] = $Item->get_titletag();
         }
         return $title_array;
     }
     // CATEGORIES:
     if (!empty($this->filters['cat_array'])) {
         // We have requested specific categories...
         $cat_names = array();
         $ChapterCache =& get_ChapterCache();
         foreach ($this->filters['cat_array'] as $cat_ID) {
             if (($my_Chapter =& $ChapterCache->get_by_ID($cat_ID, false)) !== false) {
                 // It is almost never meaningful to die over an invalid cat when generating title
                 $cat_names[] = $my_Chapter->name;
             }
         }
         if ($this->filters['cat_modifier'] == '*') {
             $cat_names_string = implode(' + ', $cat_names);
         } else {
             $cat_names_string = implode(', ', $cat_names);
         }
         if (!empty($cat_names_string)) {
             if ($this->filters['cat_modifier'] == '-') {
                 $cat_names_string = T_('All but ') . ' ' . $cat_names_string;
                 $title_array['cats'] = $params['categories_text'] . $cat_names_string;
             } else {
                 if (count($this->filters['cat_array']) > 1) {
                     $title_array['cats'] = $params['categories_text'] . $cat_names_string;
                 } else {
                     $title_array['cats'] = $params['category_text'] . $cat_names_string;
                 }
             }
         }
     }
     // ARCHIVE TIMESLOT:
     if (!empty($this->filters['ymdhms'])) {
         // We have asked for a specific timeframe:
         $my_year = substr($this->filters['ymdhms'], 0, 4);
         if (strlen($this->filters['ymdhms']) > 4) {
             // We have requested a month too:
             $my_month = T_($month[substr($this->filters['ymdhms'], 4, 2)]);
         } else {
             $my_month = '';
         }
         // Requested a day?
         $my_day = substr($this->filters['ymdhms'], 6, 2);
         $arch = T_('Archives for') . ': ' . $my_month . ' ' . $my_year;
         if (!empty($my_day)) {
             // We also want to display a day
             $arch .= ', ' . $my_day;
         }
         if (!empty($this->filters['week']) || $this->filters['week'] === 0) {
             // We also want to display a week number
             $arch .= ', ' . T_('week') . ' ' . $this->filters['week'];
         }
         $title_array['ymdhms'] = $arch;
     }
     // KEYWORDS:
     if (!empty($this->filters['keywords'])) {
         $title_array['keywords'] = T_('Keyword(s)') . ': ' . $this->filters['keywords'];
     }
     // TAGS:
     if (!empty($this->filters['tags'])) {
         $title_array[] = $params['tags_text'] . $this->filters['tags'];
     }
     // AUTHORS:
     if (!empty($this->filters['authors']) || !empty($this->filters['authors_login'])) {
         $authors = trim($this->filters['authors'] . ',' . get_users_IDs_by_logins($this->filters['authors_login']), ',');
         $authors = preg_split('~\\s*,\\s*~', $authors, -1, PREG_SPLIT_NO_EMPTY);
         $author_names = array();
         if ($authors) {
             $UserCache =& get_UserCache();
             foreach ($authors as $author_ID) {
                 if ($tmp_User = $UserCache->get_by_ID($author_ID, false, false)) {
                     $author_names[] = $tmp_User->get_identity_link(array('link_text' => 'login'));
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_itemlistlight.class.php

示例10: get_param

 /**
  * Skip to previous/next User
  *
  * @param integer the currently selected user ID ( Note: it must be set only if we would like to skip some users from the list )
  * @param string prev | next  (relative to the current sort order)
  */
 function &get_prevnext_User($direction = 'next', $selected_user_ID = NULL)
 {
     $users_list = $this->filters['users'];
     if (count($users_list) < 2) {
         // Short users list
         $r = NULL;
         return $r;
     }
     // ID of selected user
     if ($selected_user_ID === NULL) {
         // get currently selected user ID from param
         $selected_user_ID = get_param('user_ID');
     }
     $user_key = array_search($selected_user_ID, $users_list);
     if (is_int($user_key)) {
         // Selected user is located in the list
         $prevnext_key = $direction == 'next' ? $user_key + 1 : $user_key - 1;
         if (isset($users_list[$prevnext_key])) {
             // Prev/next user is located in the list
             $prevnext_ID = $users_list[$prevnext_key];
         }
     }
     if (empty($prevnext_ID)) {
         // No prev/next user
         $r = NULL;
         return $r;
     }
     $UserCache =& get_UserCache();
     $User =& $UserCache->get_by_ID($prevnext_ID, false, false);
     return $User;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:37,代码来源:_userlist.class.php

示例11: items_edited_results_block

/**
 * Display the edited items results table
 *
 * @param array Params
 */
function items_edited_results_block($params = array())
{
    // Make sure we are not missing any param:
    $params = array_merge(array('edited_User' => NULL, 'results_param_prefix' => 'actv_postedit_', 'results_title' => T_('Posts edited by the user'), 'results_no_text' => T_('User has not edited any posts')), $params);
    if (!is_logged_in()) {
        // Only logged in users can access to this function
        return;
    }
    global $current_User;
    if (!$current_User->check_perm('users', 'edit')) {
        // Check minimum permission:
        return;
    }
    $edited_User = $params['edited_User'];
    if (!$edited_User) {
        // No defined User, probably the function is calling from AJAX request
        $user_ID = param('user_ID', 'integer', 0);
        if (empty($user_ID)) {
            // Bad request, Exit here
            return;
        }
        $UserCache =& get_UserCache();
        if (($edited_User =& $UserCache->get_by_ID($user_ID, false)) === false) {
            // Bad request, Exit here
            return;
        }
    }
    global $DB;
    param('user_tab', 'string', '', true);
    param('user_ID', 'integer', 0, true);
    $edited_versions_SQL = new SQL();
    $edited_versions_SQL->SELECT('DISTINCT( iver_itm_ID )');
    $edited_versions_SQL->FROM('T_items__version');
    $edited_versions_SQL->WHERE('iver_edit_user_ID = ' . $DB->quote($edited_User->ID));
    $SQL = new SQL();
    $SQL->SELECT('*');
    $SQL->FROM('T_items__item ');
    $SQL->WHERE('( ( post_lastedit_user_ID = ' . $DB->quote($edited_User->ID) . ' ) OR ( post_ID IN ( ' . $edited_versions_SQL->get() . ' ) ) )');
    $SQL->WHERE_and('post_creator_user_ID != ' . $DB->quote($edited_User->ID));
    // Create result set:
    $edited_items_Results = new Results($SQL->get(), $params['results_param_prefix'], 'D');
    $edited_items_Results->Cache =& get_ItemCache();
    $edited_items_Results->title = $params['results_title'];
    $edited_items_Results->no_results_text = $params['results_no_text'];
    // Get a count of the post which current user can delete
    $deleted_posts_edited_count = count($edited_User->get_deleted_posts('edited'));
    if ($edited_items_Results->total_rows > 0 && $deleted_posts_edited_count > 0) {
        // Display actino icon to delete all records if at least one record exists & current user can delete at least one item created by user
        $edited_items_Results->global_icon(sprintf(T_('Delete all post edited by %s'), $edited_User->login), 'delete', '?ctrl=user&amp;user_tab=activity&amp;action=delete_all_posts_edited&amp;user_ID=' . $edited_User->ID . '&amp;' . url_crumb('user'), ' ' . T_('Delete all'), 3, 4);
    }
    // Initialize Results object
    items_results($edited_items_Results, array('field_prefix' => 'post_', 'display_ord' => false, 'display_history' => false));
    if (is_ajax_content()) {
        // init results param by template name
        if (!isset($params['skin_type']) || !isset($params['skin_name'])) {
            debug_die('Invalid ajax results request!');
        }
        $edited_items_Results->init_params_by_skin($params['skin_type'], $params['skin_name']);
    }
    $display_params = array('before' => '<div class="results" style="margin-top:25px" id="edited_posts_result">');
    $edited_items_Results->display($display_params);
    if (!is_ajax_content()) {
        // Create this hidden div to get a function name for AJAX request
        echo '<div id="' . $params['results_param_prefix'] . 'ajax_callback" style="display:none">' . __FUNCTION__ . '</div>';
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:71,代码来源:_item.funcs.php

示例12: get_UserCache

 /**
  * Resolve user ID of owner
  *
  * @return User
  */
 function &get_owner_User()
 {
     if (!isset($this->owner_User)) {
         $UserCache =& get_UserCache();
         $this->owner_User =& $UserCache->get_by_ID($this->owner_user_ID);
     }
     return $this->owner_User;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:13,代码来源:_blog.class.php

示例13: newsletter_send

/**
 * Send newsletter emails
 */
function newsletter_send()
{
    global $DB, $Session;
    load_class('users/model/_userlist.class.php', 'UserList');
    // Initialize users list from session cache in order to get users IDs for newsletter
    $UserList = new UserList('admin');
    $UserList->memorize = false;
    $UserList->load_from_Request();
    $users_IDs = $UserList->filters['users'];
    // Get all active users which accept newsletter email
    $SQL = get_newsletter_users_sql($users_IDs);
    $users = $DB->get_col($SQL->get());
    echo sprintf(T_('Newsletter is sending for %s users...'), count($users)) . '<br /><br />';
    evo_flush();
    $email_newsletter_params = array('message' => $Session->get('newsletter_message'));
    foreach ($users as $user_ID) {
        $UserCache =& get_UserCache();
        $User = $UserCache->get_by_ID($user_ID);
        echo sprintf(T_('Email is sending for %s (%s)...'), $User->get_identity_link(), $User->get('email')) . ' ';
        // Send a newsletter in user's locale
        locale_temp_switch($User->get('locale'));
        $email_result = send_mail_to_User($user_ID, $Session->get('newsletter_title'), 'newsletter', $email_newsletter_params);
        locale_restore_previous();
        if ($email_result) {
            // Success sending
            echo T_('OK');
        } else {
            // Failed sending
            echo '<span class="red">' . T_('Failed') . '</span>';
        }
        echo '<br />';
        evo_flush();
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:37,代码来源:_newsletter.funcs.php

示例14: can_moderate_user

 /**
  * Check if user has a permission to moderate the user
  *
  * @param integer User ID
  * @return boolean TRUE on success
  */
 function can_moderate_user($user_ID, $assert = false)
 {
     if ($this->ID == $user_ID) {
         // User can edit own profile
         return true;
     }
     if ($this->check_perm('users', 'edit')) {
         // User can edit all users
         return true;
     }
     if ($this->check_perm('users', 'moderate', $assert)) {
         // User can moderate other user but we should to compare levels of users groups
         $UserCache =& get_UserCache();
         if ($target_User = $UserCache->get_by_ID($user_ID, false, false)) {
             if ($target_User->get_Group()->get('level') < $this->get_Group()->get('level')) {
                 // User can moderate only users with level lower than own level
                 return true;
             }
         }
     }
     if ($assert) {
         // We can't let this go on!
         debug_die(sprintf(T_('User #%s has no permission to edit user #%s!'), $this->ID, $user_ID));
     }
     return false;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:32,代码来源:_user.class.php

示例15: pbm_validate_user_password

function pbm_validate_user_password($user_login, $user_pass)
{
    $UserCache =& get_UserCache();
    $User =& $UserCache->get_by_login($user_login);
    if (!$User) {
        return false;
    }
    // First check unhashed password
    if (!$User->check_password($user_pass, false)) {
        if (preg_match('~^[a-f0-9]{32}$~i', $user_pass)) {
            // This is a hashed password, see if it's valid
            // We check it here because some crazy user may use a real 32-chars password!
            if ($User->check_password($user_pass, true)) {
                // Valid password
                return $User;
            }
        }
        return false;
    }
    return $User;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:21,代码来源:_post_by_mail.funcs.php


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