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

PHP get_UserCache函数代码示例

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

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



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


示例16: FileRoot

 /**
  * Constructor
  *
  * Will fail if non existent User or Blog is requested.
  * But specific access permissions on (threfore existence of) this User or Blog should have been tested before anyway.
  *
  * @param string Root type: 'user', 'group' or 'collection'
  * @param integer ID of the user, the group or the collection the file belongs to...
  * @param boolean Create the directory, if it does not exist yet?
  */
 function FileRoot($root_type, $root_in_type_ID, $create = true)
 {
     /**
      * @var User
      */
     global $current_User;
     global $Messages;
     global $Settings, $Debuglog;
     global $Blog;
     // Store type:
     $this->type = $root_type;
     // Store ID in type:
     $this->in_type_ID = $root_in_type_ID;
     // Generate unique ID:
     $this->ID = FileRoot::gen_ID($root_type, $root_in_type_ID);
     switch ($root_type) {
         case 'user':
             $UserCache =& get_UserCache();
             if (!($User =& $UserCache->get_by_ID($root_in_type_ID, false, false))) {
                 // User not found
                 return false;
             }
             $this->name = $User->get('login');
             //.' ('. /* TRANS: short for "user" */ T_('u').')';
             $this->ads_path = $User->get_media_dir($create);
             $this->ads_url = $User->get_media_url();
             return;
         case 'collection':
             $BlogCache =& get_BlogCache();
             if (!($Blog =& $BlogCache->get_by_ID($root_in_type_ID, false, false))) {
                 // Blog not found
                 return false;
             }
             $this->name = $Blog->get('shortname');
             //.' ('. /* TRANS: short for "blog" */ T_('b').')';
             $this->ads_path = $Blog->get_media_dir($create);
             $this->ads_url = $Blog->get_media_url();
             return;
         case 'shared':
             // fp> TODO: handle multiple shared directories
             global $media_path, $media_url;
             $rds_shared_subdir = 'shared/global/';
             $ads_shared_dir = $media_path . $rds_shared_subdir;
             if (!$Settings->get('fm_enable_roots_shared')) {
                 // Shared dir is disabled:
                 $Debuglog->add('Attempt to access shared dir, but this feature is globally disabled', 'files');
             } elseif (!mkdir_r($ads_shared_dir)) {
                 // Only display error on an admin page:
                 if (is_admin_page()) {
                     $Messages->add(sprintf(T_('The directory &laquo;%s&raquo; could not be created.'), $rds_shared_subdir) . get_manual_link('directory_creation_error'), 'error');
                 }
             } else {
                 $this->name = T_('Shared');
                 $this->ads_path = $ads_shared_dir;
                 if (isset($Blog)) {
                     // (for now) Let's make shared files appear as being part of the currently displayed blog:
                     $this->ads_url = $Blog->get_local_media_url() . 'shared/global/';
                 } else {
                     $this->ads_url = $media_url . 'shared/global/';
                 }
             }
             return;
         case 'skins':
             // fp> some stuff here should go out of here... but I don't know where to put it yet. I'll see after the Skin refactoring.
             if (!$Settings->get('fm_enable_roots_skins')) {
                 // Skins root is disabled:
                 $Debuglog->add('Attempt to access skins dir, but this feature is globally disabled', 'files');
             } elseif (empty($current_User) || !$current_User->check_perm('templates')) {
                 // No perm to access templates:
                 $Debuglog->add('Attempt to access skins dir, but no permission', 'files');
             } else {
                 global $skins_path, $skins_url;
                 $this->name = T_('Skins');
                 $this->ads_path = $skins_path;
                 if (isset($Blog)) {
                     // (for now) Let's make skin files appear as being part of the currently displayed blog:
                     $this->ads_url = $Blog->get_local_skins_url();
                 } else {
                     $this->ads_url = $skins_url;
                 }
             }
             return;
     }
     debug_die("Invalid root type");
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:95,代码来源:_fileroot.class.php


示例17: handle_htsrv_action


//.........这里部分代码省略.........
                         $unsaved_message_params['message'] = $edited_Message->text;
                         $unsaved_message_params['thrdtype'] = param('thrdtype', 'string', 'individual');
                         // alternative: discussion
                         $unsaved_message_params['thrd_recipients'] = $thrd_recipients;
                         $unsaved_message_params['thrd_recipients_array'] = $thrd_recipients_array;
                         save_message_params_to_session($unsaved_message_params);
                     }
                     break;
                 case 'delete':
                     // delete thread
                     // Check permission:
                     $current_User->check_perm('perm_messaging', 'delete', true);
                     $confirmed = param('confirmed', 'integer', 0);
                     if ($confirmed) {
                         $msg = sprintf(T_('Thread &laquo;%s&raquo; deleted.'), $edited_Thread->dget('title'));
                         $edited_Thread->dbdelete(true);
                         unset($edited_Thread);
                         forget_param('thrd_ID');
                         $Messages->add($msg, 'success');
                     } else {
                         $delete_url = $samedomain_htsrv_url . 'action.php?mname=messaging&thrd_ID=' . $edited_Thread->ID . '&action=delete&confirmed=1&redirect_to=' . $redirect_to . '&' . url_crumb('messaging_threads');
                         $ok_button = '<span class="linkbutton"><a href="' . $delete_url . '">' . T_('I am sure!') . '!</a></span>';
                         $cancel_button = '<span class="linkbutton"><a href="' . $redirect_to . '">CANCEL</a></span>';
                         $msg = sprintf(T_('You are about to delete all messages in the conversation &laquo;%s&raquo;.'), $edited_Thread->dget('title'));
                         $msg .= '<br />' . T_('This CANNOT be undone!') . '<br />' . T_('Are you sure?') . '<br /><br />' . $ok_button . "\t" . $cancel_button;
                         $Messages->add($msg, 'error');
                     }
                     break;
                 case 'leave':
                     // user wants to leave the thread
                     leave_thread($edited_Thread->ID, $current_User->ID, false);
                     $Messages->add(sprintf(T_('You have successfuly left the &laquo;%s&raquo; conversation!'), $edited_Thread->get('title')), 'success');
                     break;
                 case 'close':
                     // close the thread
                 // close the thread
                 case 'close_and_block':
                     // close the thread and block contact
                     leave_thread($edited_Thread->ID, $current_User->ID, true);
                     // user has closed this conversation because there was only one other user involved
                     $Messages->add(sprintf(T_('You have successfuly closed the &laquo;%s&raquo; conversation!'), $edited_Thread->get('title')), 'success');
                     if ($action == 'close_and_block') {
                         // user also wants to block contact with the other user involved in this thread
                         $block_user_ID = param('block_ID', 'integer', true);
                         $UserCache =& get_UserCache();
                         $blocked_User = $UserCache->get_by_ID($block_user_ID);
                         set_contact_blocked($block_user_ID, true);
                         $Messages->add(sprintf(T_('&laquo;%s&raquo; was blocked.'), $blocked_User->get('login')), 'success');
                     }
                     break;
             }
             break;
             // break from threads action switch
             // contacts action
         // break from threads action switch
         // contacts action
         case 'contacts':
             $user_ID = param('user_ID', 'string', true);
             if ($action != 'block' && $action != 'unblock') {
                 // only block or unblock is valid
                 debug_die("Invalid action param");
             }
             set_contact_blocked($user_ID, $action == 'block' ? 1 : 0);
             $redirect_to = str_replace('&amp;', '&', $redirect_to);
             break;
             // messages action
         // messages action
         case 'messages':
             if ($action == 'create') {
                 // create new message
                 create_new_message($thrd_ID);
             } elseif ($action == 'delete') {
                 // Check permission:
                 $current_User->check_perm('perm_messaging', 'delete', true);
                 $msg_ID = param('msg_ID', 'integer', true);
                 $MessageCache =& get_MessageCache();
                 if (($edited_Message =& $MessageCache->get_by_ID($msg_ID, false)) === false) {
                     $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Message')), 'error');
                     break;
                 }
                 $confirmed = param('confirmed', 'integer', 0);
                 if ($confirmed) {
                     // delete message
                     $edited_Message->dbdelete();
                     unset($edited_Message);
                     $Messages->add(T_('Message deleted.'), 'success');
                 } else {
                     $delete_url = $samedomain_htsrv_url . 'action.php?mname=messaging&disp=messages&thrd_ID=' . $thrd_ID . '&msg_ID=' . $msg_ID . '&action=delete&confirmed=1';
                     $delete_url = url_add_param($delete_url, 'redirect_to=' . rawurlencode($redirect_to), '&') . '&' . url_crumb('messaging_messages');
                     $ok_button = '<span class="linkbutton"><a href="' . $delete_url . '">' . T_('I am sure!') . '!</a></span>';
                     $cancel_button = '<span class="linkbutton"><a href="' . $redirect_to . '">CANCEL</a></span>';
                     $msg = T_('You are about to delete this message. ') . '<br /> ' . T_('This CANNOT be undone!') . '<br />' . T_('Are you sure?') . '<br /><br />' . $ok_button . $cancel_button;
                     $Messages->add($msg, 'error');
                 }
             }
             break;
     }
     header_redirect($redirect_to);
     // Will save $Messages into Session
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_messaging.init.php


示例18: AlternateAuthentication

 /**
  * Automagically login every user as "demouser" who is not logged in and does not
  * try to currently.
  *
  * To enable/test it, change the "if-0" check below to "if( 1 )".
  *
  * @see Plugin::AlternateAuthentication()
  */
 function AlternateAuthentication()
 {
     if (0) {
         global $Session, $Messages;
         $UserCache =& get_UserCache();
         if ($demo_User =& $UserCache->get_by_login('demouser')) {
             // demouser exists:
             $Session->set_User($demo_User);
             $Messages->add('Logged in as demouser.', 'success');
             return true;
         }
     }
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:21,代码来源:_test.plugin.php


示例19: get_request_title


//.........这里部分代码省略.........
            }
            break;
        case 'register':
            // We are requesting the registration form:
            $r[] = $params['register_text'];
            break;
        case 'activateinfo':
            // We are requesting the activate info form:
            $r[] = $params['account_activation'];
            break;
        case 'lostpassword':
            // We are requesting the lost password form:
            $r[] = $params['lostpassword_text'];
            break;
        case 'single':
        case 'page':
            // We are displaying a single message:
            if ($preview) {
                // We are requesting a post preview:
                $r[] = T_('PREVIEW');
            } elseif ($params['title_' . $disp . '_disp'] && isset($MainList)) {
                $r = array_merge($r, $MainList->get_filter_titles(array('visibility', 'hide_future'), $params));
            }
            if ($params['title_' . $disp . '_before'] != '#') {
                $before = $params['title_' . $disp . '_before'];
            }
            if ($params['title_' . $disp . '_after'] != '#') {
                $after = $params['title_' . $disp . '_after'];
            }
            break;
        case 'user':
            // We are requesting the user page:
            $user_ID = param('user_ID', 'integer', 0);
            $UserCache =& get_UserCache();
            $User =& $UserCache->get_by_ID($user_ID, false, false);
            $user_login = $User ? $User->get('login') : '';
            $r[] = sprintf($params['user_text'], $user_login);
            break;
        case 'users':
            $r[] = $params['users_text'];
            break;
        case 'closeaccount':
            $r[] = $params['closeaccount_text'];
            break;
        case 'edit':
            $action = param_action();
            // Edit post by switching into 'In skin' mode from Back-office
            $p = param('p', 'integer', 0);
            // Edit post from Front-office
            $cp = param('cp', 'integer', 0);
            // Copy post from Front-office
            if ($action == 'edit_switchtab' || $p > 0) {
                // Edit post
                $title = $params['edit_text_update'];
            } else {
                if ($cp > 0) {
                    // Copy post
                    $title = $params['edit_text_copy'];
                } else {
                    // Create post
                    $title = $params['edit_text_create'];
                }
            }
            if ($params['auto_pilot'] != 'seo_title') {
                // Add advanced edit and close icon
                global $edited_Item;
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:67,代码来源:_template.funcs.php


示例20: get_UserCache

该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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