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


PHP is_a_guest函数代码示例

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


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

示例1: PP_Init

/**
 * Triggered on loc_begin_index
 * 
 * Perform user logout after registration if account locked and redirection to profile page is password renewal is set
 */
function PP_Init()
{
    global $conf, $user;
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    $conf_PP = unserialize($conf['PasswordPolicy']);
    // Perfoming redirection for locked accounts
    // -----------------------------------------
    if (!is_a_guest() and $user['username'] != "16" and $user['username'] != "18") {
        // Perform user logout if user account is locked
        if (isset($conf_PP['LOGFAILBLOCK']) and $conf_PP['LOGFAILBLOCK'] == 'true' and PP_UsrBlock_Verif($user['username']) and !is_admin() and !is_webmaster()) {
            invalidate_user_cache();
            logout_user();
            if ($conf['guest_access']) {
                redirect(make_index_url() . '?PP_msg=locked', 0);
            } else {
                redirect(get_root_url() . 'identification.php?PP_msg=locked', 0);
            }
        }
    }
    // Performing redirection to profile page for password reset
    // ---------------------------------------------------------
    if (isset($conf_PP['PWDRESET']) and $conf_PP['PWDRESET'] == 'true') {
        $query = '
SELECT user_id, status
FROM ' . USER_INFOS_TABLE . '
WHERE user_id = ' . $user['id'] . '
;';
        $data = pwg_db_fetch_assoc(pwg_query($query));
        if ($data['status'] != "webmaster" and $data['status'] != "generic") {
            if (PP_check_pwdreset($user['id'])) {
                redirect(PHPWG_ROOT_PATH . 'profile.php');
            }
        }
    }
}
开发者ID:Eric-Piwigo,项目名称:Password_Policy,代码行数:40,代码来源:functions.inc.php

示例2: gb_index

function gb_index()
{
    global $template, $page, $conf;
    if (isset($page['section']) and $page['section'] == 'guestbook') {
        if (is_a_guest() && !$conf['guestbook']['guest_can_view']) {
            access_denied();
        }
        include GUESTBOOK_PATH . '/include/guestbook.inc.php';
    }
}
开发者ID:plegall,项目名称:Piwigo-Guest-Book,代码行数:10,代码来源:events.inc.php

示例3: UAM_Init

/**
 * Triggered on loc_begin_index
 * 
 * Initiating GhostTracker - Perform user logout after registration if not validated
 */
function UAM_Init()
{
    global $conf, $user;
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    $conf_UAM = unserialize($conf['UserAdvManager']);
    // Admins, Guests and Adult_Content users are not tracked for Ghost Tracker or Users Tracker
    // -----------------------------------------------------------------------------------------
    if (!is_admin() and !is_a_guest() and $user['username'] != "16" and $user['username'] != "18") {
        if (isset($conf_UAM['GHOSTRACKER']) and $conf_UAM['GHOSTRACKER'] == 'true' or isset($conf_UAM['ADDLASTVISIT']) and $conf_UAM['ADDLASTVISIT'] == 'true') {
            $userid = get_userid($user['username']);
            // Looking for existing entry in last visit table
            // ----------------------------------------------
            $query = '
SELECT *
FROM ' . USER_LASTVISIT_TABLE . '
WHERE user_id = ' . $userid . '
;';
            $count = pwg_db_num_rows(pwg_query($query));
            if ($count == 0) {
                // If not, data are inserted in table
                // ----------------------------------
                $query = '
INSERT INTO ' . USER_LASTVISIT_TABLE . ' (user_id, lastvisit, reminder)
VALUES (' . $userid . ', now(), "false")
;';
                pwg_query($query);
            } else {
                if ($count > 0) {
                    // If yes, data are updated in table
                    // ---------------------------------
                    $query = '
UPDATE ' . USER_LASTVISIT_TABLE . '
SET lastvisit = now(), reminder = "false"
WHERE user_id = ' . $userid . '
LIMIT 1
;';
                    pwg_query($query);
                }
            }
        }
        // Perform user logout after registration if not validated
        if (isset($conf_UAM['CONFIRM_MAIL']) and ($conf_UAM['CONFIRM_MAIL'] == 'true' or $conf_UAM['CONFIRM_MAIL'] == 'local') and (isset($conf_UAM['REJECTCONNECT']) and $conf_UAM['REJECTCONNECT'] == 'true') and !UAM_UsrReg_Verif($user['id']) and !is_admin() and !is_webmaster()) {
            invalidate_user_cache();
            logout_user();
            if ($conf['guest_access']) {
                redirect(make_index_url() . '?UAM_msg=rejected', 0);
            } else {
                redirect(get_root_url() . 'identification.php?UAM_msg=rejected', 0);
            }
        }
    }
}
开发者ID:Eric-Piwigo,项目名称:UserAdvManager,代码行数:57,代码来源:functions.inc.php

示例4: CM_CheckComment

/**
 * Check comment rules set in plugin before accepting it
 *
 * @param : comment action, comment
 * 
 * @return : comment action
 * 
 */
function CM_CheckComment($comment_action, $comm)
{
    global $page, $conf, $user, $template;
    load_language('plugin.lang', CM_PATH);
    $conf_CM = unserialize($conf['CommentsManager']);
    if ($conf['comments_forall']) {
        // Does not allow empty author name on comments for all
        if (isset($conf_CM['CM_No_Comment_Anonymous']) and $conf_CM['CM_No_Comment_Anonymous'] == 'true' and $comm['author'] == 'guest') {
            $comment_action = 'reject';
            array_push($page['errors'], l10n('CM_Not_Allowed_Author'));
        }
        if (isset($conf_CM['CM_GROUPVALID2']) and $conf_CM['CM_GROUPVALID2'] == 'true' and !is_a_guest() and $conf['comments_validation']) {
            if (CM_CheckValidGroup($comm['author']) or is_admin()) {
                $comment_action = 'validate';
                // Comment is validated if author is not in the validated group
            } else {
                $comment_action = 'moderate';
                // Comment needs moderation if author is not in the validated group
            }
        }
    }
    // Rules on comments NOT for all
    if (!$conf['comments_forall'] and !is_admin()) {
        if (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'false') and !CM_CheckAuthor($comm['author'])) {
            $comment_action = 'reject';
            // Comment rejected if author is not in the allowed group
            array_push($page['errors'], l10n('CM_Not_Allowed_Author'));
        } elseif (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'false' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) {
            if (CM_CheckValidGroup($comm['author']) and $conf['comments_validation']) {
                $comment_action = 'validate';
                // Comment is validated if author is not in the validated group
            } else {
                $comment_action = 'moderate';
                // Comment needs moderation if author is not in the validated group
            }
        } elseif (isset($conf_CM['CM_GROUPCOMM']) and $conf_CM['CM_GROUPCOMM'] == 'true' and (isset($conf_CM['CM_GROUPVALID1']) and $conf_CM['CM_GROUPVALID1'] == 'true') and $conf['comments_validation']) {
            if (!CM_CheckAuthor($comm['author'])) {
                $comment_action = 'reject';
                // Comment rejected if author is not in the allowed group
                array_push($page['errors'], l10n('CM_Not_Allowed_Author'));
            } elseif (CM_CheckValidGroup($comm['author']) and $conf['comments_validation']) {
                $comment_action = 'validate';
                // Comment is validated if author is not in the validated group
            } else {
                $comment_action = 'moderate';
            }
            // Comment needs moderation if author is not in the validated group
        }
    }
    return $comment_action;
}
开发者ID:Eric-Piwigo,项目名称:Comments_Access_Manager,代码行数:59,代码来源:functions.inc.php

示例5: language_controler_switch

function language_controler_switch()
{
    global $user;
    $same = $user['language'];
    if (isset($_GET['lang'])) {
        include_once PHPWG_ROOT_PATH . 'admin/include/languages.class.php';
        $languages = new languages();
        if (!in_array($_GET['lang'], array_keys($languages->fs_languages))) {
            $_GET['lang'] = PHPWG_DEFAULT_LANGUAGE;
        }
        if (!empty($_GET['lang']) and file_exists(PHPWG_ROOT_PATH . 'language/' . $_GET['lang'] . '/common.lang.php')) {
            if (is_a_guest() or is_generic()) {
                pwg_set_session_var('lang_switch', $_GET['lang']);
            } else {
                $query = '
UPDATE ' . USER_INFOS_TABLE . '
  SET language = \'' . $_GET['lang'] . '\'
  WHERE user_id = ' . $user['id'] . '
;';
                pwg_query($query);
            }
            $user['language'] = $_GET['lang'];
        }
    } elseif (is_a_guest() or is_generic()) {
        $user['language'] = pwg_get_session_var('lang_switch', $user['language']);
    }
    // Reload language only if it isn't the same one
    if ($same !== $user['language']) {
        load_language('common.lang', '', array('language' => $user['language']));
        load_language('lang', PHPWG_ROOT_PATH . PWG_LOCAL_DIR, array('language' => $user['language'], 'no_fallback' => true, 'local' => true));
        if (defined('IN_ADMIN') and IN_ADMIN) {
            // Never currently
            load_language('admin.lang', '', array('language' => $user['language']));
        }
    }
}
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:36,代码来源:language_switch.inc.php

示例6: user_comment_check

/**
 * Does basic check on comment and returns action to perform.
 * This method is called by a trigger_change()
 *
 * @param string $action before check
 * @param array $comment
 * @return string validate, moderate, reject
 */
function user_comment_check($action, $comment)
{
    global $conf, $user;
    if ($action == 'reject') {
        return $action;
    }
    $my_action = $conf['comment_spam_reject'] ? 'reject' : 'moderate';
    if ($action == $my_action) {
        return $action;
    }
    // we do here only BASIC spam check (plugins can do more)
    if (!is_a_guest()) {
        return $action;
    }
    $link_count = preg_match_all('/https?:\\/\\//', $comment['content'], $matches);
    if (strpos($comment['author'], 'http://') !== false) {
        $link_count++;
    }
    if ($link_count > $conf['comment_spam_max_links']) {
        $_POST['cr'][] = 'links';
        return $my_action;
    }
    return $action;
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:32,代码来源:functions_comment.inc.php

示例7: ws_session_getStatus

/**
 * API method
 * Returns info about the current user
 * @param mixed[] $params
 */
function ws_session_getStatus($params, &$service)
{
    global $user, $conf;
    $res['username'] = is_a_guest() ? 'guest' : stripslashes($user['username']);
    foreach (array('status', 'theme', 'language') as $k) {
        $res[$k] = $user[$k];
    }
    $res['pwg_token'] = get_pwg_token();
    $res['charset'] = get_pwg_charset();
    list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    $res['current_datetime'] = $dbnow;
    $res['version'] = PHPWG_VERSION;
    if (is_admin()) {
        $res['upload_file_types'] = implode(',', array_unique(array_map('strtolower', $conf['upload_form_all_types'] ? $conf['file_ext'] : $conf['picture_ext'])));
        $res['upload_form_chunk_size'] = $conf['upload_form_chunk_size'];
    }
    return $res;
}
开发者ID:donseba,项目名称:Piwigo,代码行数:23,代码来源:pwg.php

示例8: define

define('PHPWG_URL', 'http://' . PHPWG_DOMAIN);
if (isset($conf['alternative_pem_url']) and $conf['alternative_pem_url'] != '') {
    define('PEM_URL', $conf['alternative_pem_url']);
} else {
    define('PEM_URL', 'http://' . PHPWG_DOMAIN . '/ext');
}
// language files
load_language('common.lang');
if (is_admin() || (defined('IN_ADMIN') and IN_ADMIN)) {
    load_language('admin.lang');
}
trigger_notify('loading_lang');
load_language('lang', PHPWG_ROOT_PATH . PWG_LOCAL_DIR, array('no_fallback' => true, 'local' => true));
// only now we can set the localized username of the guest user (and not in
// include/user.inc.php)
if (is_a_guest()) {
    $user['username'] = l10n('guest');
}
// template instance
if (defined('IN_ADMIN') and IN_ADMIN) {
    // Admin template
    $template = new Template(PHPWG_ROOT_PATH . 'admin/themes', $conf['admin_theme']);
} else {
    // Classic template
    $theme = $user['theme'];
    if (script_basename() != 'ws' and mobile_theme()) {
        $theme = $conf['mobile_theme'];
    }
    $template = new Template(PHPWG_ROOT_PATH . 'themes', $theme);
}
if (!isset($conf['no_photo_yet'])) {
开发者ID:squidjam,项目名称:Piwigo,代码行数:31,代码来源:common.inc.php

示例9: pwg_log

/**
 * log the visit into history table
 *
 * @param int $image_id
 * @param string $image_type
 * @return bool
 */
function pwg_log($image_id = null, $image_type = null)
{
    global $conf, $user, $page;
    $do_log = $conf['log'];
    if (is_admin()) {
        $do_log = $conf['history_admin'];
    }
    if (is_a_guest()) {
        $do_log = $conf['history_guest'];
    }
    $do_log = trigger_change('pwg_log_allowed', $do_log, $image_id, $image_type);
    if (!$do_log) {
        return false;
    }
    $tags_string = null;
    if ('tags' == @$page['section']) {
        $tags_string = implode(',', $page['tag_ids']);
    }
    $query = '
INSERT INTO ' . HISTORY_TABLE . '
  (
    date,
    time,
    user_id,
    IP,
    section,
    category_id,
    image_id,
    image_type,
    tag_ids
  )
  VALUES
  (
    CURRENT_DATE,
    CURRENT_TIME,
    ' . $user['id'] . ',
    \'' . $_SERVER['REMOTE_ADDR'] . '\',
    ' . (isset($page['section']) ? "'" . $page['section'] . "'" : 'NULL') . ',
    ' . (isset($page['category']['id']) ? $page['category']['id'] : 'NULL') . ',
    ' . (isset($image_id) ? $image_id : 'NULL') . ',
    ' . (isset($image_type) ? "'" . $image_type . "'" : 'NULL') . ',
    ' . (isset($tags_string) ? "'" . $tags_string . "'" : 'NULL') . '
  )
;';
    pwg_query($query);
    return true;
}
开发者ID:squidjam,项目名称:Piwigo,代码行数:54,代码来源:functions.inc.php

示例10: get_ephemeral_key

                $tpl_comment['IN_EDIT'] = true;
                $tpl_comment['KEY'] = get_ephemeral_key(2);
                $tpl_comment['CONTENT'] = $row['content'];
                $tpl_comment['PWG_TOKEN'] = get_pwg_token();
                $tpl_comment['U_CANCEL'] = $url_self;
            }
        }
        if (is_admin()) {
            if ($row['validated'] != 'true') {
                $tpl_comment['U_VALIDATE'] = add_url_params($url_self, array('action' => 'validate_comment', 'comment_to_validate' => $row['id'], 'pwg_token' => get_pwg_token()));
            }
        }
        $template->append('comments', $tpl_comment);
    }
}
$show_add_comment_form = !is_a_guest() || $conf['guestbook']['guest_can_add'];
if (isset($edit_comment)) {
    $show_add_comment_form = false;
}
if ($show_add_comment_form) {
    foreach (array('content', 'author', 'website', 'email') as $el) {
        ${$el} = '';
        if ('reject' === @$comment_action and !empty($comm[$el])) {
            ${$el} = htmlspecialchars(stripslashes($comm[$el]));
        }
    }
    if (is_classic_user()) {
        $author = $user['username'];
        $email = $user['email'];
    }
    if (empty($conf['comments_email_mandatory'])) {
开发者ID:plegall,项目名称:Piwigo-Guest-Book,代码行数:31,代码来源:guestbook.inc.php

示例11: trigger_notify

// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
$template->set_filenames(array('tail' => 'footer.tpl'));
trigger_notify('loc_begin_page_tail');
$template->assign(array('VERSION' => $conf['show_version'] ? PHPWG_VERSION : '', 'PHPWG_URL' => defined('PHPWG_URL') ? PHPWG_URL : ''));
//--------------------------------------------------------------------- contact
if (!is_a_guest()) {
    $template->assign('CONTACT_MAIL', get_webmaster_mail_address());
}
//------------------------------------------------------------- generation time
$debug_vars = array();
if ($conf['show_queries']) {
    $debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug));
}
if ($conf['show_gt']) {
    if (!isset($page['count_queries'])) {
        $page['count_queries'] = 0;
        $page['queries_time'] = 0;
    }
    $time = get_elapsed_time($t2, get_moment());
    $debug_vars = array_merge($debug_vars, array('TIME' => $time, 'NB_QUERIES' => $page['count_queries'], 'SQL_TIME' => number_format($page['queries_time'], 3, '.', ' ') . ' s'));
}
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:page_tail.php

示例12: access_denied

/**
 * Exits the current script (or redirect to login page if not logged).
 */
function access_denied()
{
    global $user;
    $login_url = get_root_url() . 'identification.php?redirect=' . urlencode(urlencode($_SERVER['REQUEST_URI']));
    set_status_header(401);
    if (isset($user) and !is_a_guest()) {
        echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
        echo '<div style="text-align:center;">' . l10n('You are not authorized to access the requested page') . '<br>';
        echo '<a href="' . get_root_url() . 'identification.php">' . l10n('Identification') . '</a>&nbsp;';
        echo '<a href="' . make_index_url() . '">' . l10n('Home') . '</a></div>';
        echo str_repeat(' ', 512);
        //IE6 doesn't error output if below a size
        exit;
    } else {
        redirect_html($login_url);
    }
}
开发者ID:mathieumd,项目名称:Piwigo,代码行数:20,代码来源:functions_html.inc.php

示例13: check_password_reset_key

/**
 *  checks the activation key: does it match the expected pattern? is it
 *  linked to a user? is this user allowed to reset his password?
 *
 * @return mixed (user_id if OK, false otherwise)
 */
function check_password_reset_key($reset_key)
{
    global $page, $conf;
    list($key, $email) = explode('-', $reset_key, 2);
    if (!preg_match('/^[a-z0-9]{20}$/i', $key)) {
        $page['errors'][] = l10n('Invalid key');
        return false;
    }
    $user_ids = array();
    $query = '
SELECT
  ' . $conf['user_fields']['id'] . ' AS id
  FROM ' . USERS_TABLE . '
  WHERE ' . $conf['user_fields']['email'] . ' = \'' . pwg_db_real_escape_string($email) . '\'
;';
    $user_ids = query2array($query, null, 'id');
    if (count($user_ids) == 0) {
        $page['errors'][] = l10n('Invalid username or email');
        return false;
    }
    $user_id = null;
    $query = '
SELECT
    user_id,
    status,
    activation_key,
    activation_key_expire,
    NOW() AS dbnow
  FROM ' . USER_INFOS_TABLE . '
  WHERE user_id IN (' . implode(',', $user_ids) . ')
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        if (pwg_password_verify($key, $row['activation_key'])) {
            if (strtotime($row['dbnow']) > strtotime($row['activation_key_expire'])) {
                // key has expired
                $page['errors'][] = l10n('Invalid key');
                return false;
            }
            if (is_a_guest($row['status']) or is_generic($row['status'])) {
                $page['errors'][] = l10n('Password reset is not allowed for this user');
                return false;
            }
            $user_id = $row['user_id'];
        }
    }
    if (empty($user_id)) {
        $page['errors'][] = l10n('Invalid key');
        return false;
    }
    return $user_id;
}
开发者ID:squidjam,项目名称:Piwigo,代码行数:58,代码来源:password.php

示例14: can_manage_comment

/**
 * Returns if current user can edit/delete/validate a comment.
 *
 * @param string $action edit/delete/validate
 * @param int $comment_author_id
 * @return bool
 */
function can_manage_comment($action, $comment_author_id)
{
    global $user, $conf;
    if (is_a_guest()) {
        return false;
    }
    if (!in_array($action, array('delete', 'edit', 'validate'))) {
        return false;
    }
    if (is_admin()) {
        return true;
    }
    if ('edit' == $action and $conf['user_can_edit_comment']) {
        if ($comment_author_id == $user['id']) {
            return true;
        }
    }
    if ('delete' == $action and $conf['user_can_delete_comment']) {
        if ($comment_author_id == $user['id']) {
            return true;
        }
    }
    return false;
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:functions_user.inc.php

示例15: initialize_menu

/**
 * Setups each block the main menubar.
 */
function initialize_menu()
{
    global $page, $conf, $user, $template, $filter;
    $menu = new BlockManager("menubar");
    $menu->load_registered_blocks();
    $menu->prepare_display();
    if (@$page['section'] == 'search' and isset($page['qsearch_details'])) {
        $template->assign('QUERY_SEARCH', htmlspecialchars($page['qsearch_details']['q']));
    }
    //--------------------------------------------------------------- external links
    if ($block = $menu->get_block('mbLinks') and !empty($conf['links'])) {
        $block->data = array();
        foreach ($conf['links'] as $url => $url_data) {
            if (!is_array($url_data)) {
                $url_data = array('label' => $url_data);
            }
            if (!isset($url_data['eval_visible']) or eval($url_data['eval_visible'])) {
                $tpl_var = array('URL' => $url, 'LABEL' => $url_data['label']);
                if (!isset($url_data['new_window']) or $url_data['new_window']) {
                    $tpl_var['new_window'] = array('NAME' => isset($url_data['nw_name']) ? $url_data['nw_name'] : '', 'FEATURES' => isset($url_data['nw_features']) ? $url_data['nw_features'] : '');
                }
                $block->data[] = $tpl_var;
            }
        }
        if (!empty($block->data)) {
            $block->template = 'menubar_links.tpl';
        }
    }
    //-------------------------------------------------------------- categories
    $block = $menu->get_block('mbCategories');
    //------------------------------------------------------------------------ filter
    if ($conf['menubar_filter_icon'] and !empty($conf['filter_pages']) and get_filter_page_value('used')) {
        if ($filter['enabled']) {
            $template->assign('U_STOP_FILTER', add_url_params(make_index_url(array()), array('filter' => 'stop')));
        } else {
            $template->assign('U_START_FILTER', add_url_params(make_index_url(array()), array('filter' => 'start-recent-' . $user['recent_period'])));
        }
    }
    if ($block != null) {
        $block->data = array('NB_PICTURE' => $user['nb_total_images'], 'MENU_CATEGORIES' => get_categories_menu(), 'U_CATEGORIES' => make_index_url(array('section' => 'categories')));
        $block->template = 'menubar_categories.tpl';
    }
    //------------------------------------------------------------------------ tags
    $block = $menu->get_block('mbTags');
    if ($block != null and !empty($page['items']) and 'picture' != script_basename()) {
        if ('tags' == @$page['section']) {
            $tags = get_common_tags($page['items'], $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
            $tags = add_level_to_tags($tags);
            foreach ($tags as $tag) {
                $block->data[] = array_merge($tag, array('U_ADD' => make_index_url(array('tags' => array_merge($page['tags'], array($tag)))), 'URL' => make_index_url(array('tags' => array($tag)))));
            }
        } else {
            $selection = array_slice($page['items'], $page['start'], $page['nb_image_page']);
            $tags = add_level_to_tags(get_common_tags($selection, $conf['content_tag_cloud_items_number']));
            foreach ($tags as $tag) {
                $block->data[] = array_merge($tag, array('URL' => make_index_url(array('tags' => array($tag)))));
            }
        }
        if (!empty($block->data)) {
            $block->template = 'menubar_tags.tpl';
        }
    }
    //----------------------------------------------------------- special categories
    if (($block = $menu->get_block('mbSpecials')) != null) {
        if (!is_a_guest()) {
            // favorites
            $block->data['favorites'] = array('URL' => make_index_url(array('section' => 'favorites')), 'TITLE' => l10n('display your favorites photos'), 'NAME' => l10n('Your favorites'));
        }
        $block->data['most_visited'] = array('URL' => make_index_url(array('section' => 'most_visited')), 'TITLE' => l10n('display most visited photos'), 'NAME' => l10n('Most visited'));
        if ($conf['rate']) {
            $block->data['best_rated'] = array('URL' => make_index_url(array('section' => 'best_rated')), 'TITLE' => l10n('display best rated photos'), 'NAME' => l10n('Best rated'));
        }
        $block->data['recent_pics'] = array('URL' => make_index_url(array('section' => 'recent_pics')), 'TITLE' => l10n('display most recent photos'), 'NAME' => l10n('Recent photos'));
        $block->data['recent_cats'] = array('URL' => make_index_url(array('section' => 'recent_cats')), 'TITLE' => l10n('display recently updated albums'), 'NAME' => l10n('Recent albums'));
        $block->data['random'] = array('URL' => get_root_url() . 'random.php', 'TITLE' => l10n('display a set of random photos'), 'NAME' => l10n('Random photos'), 'REL' => 'rel="nofollow"');
        $block->data['calendar'] = array('URL' => make_index_url(array('chronology_field' => $conf['calendar_datefield'] == 'date_available' ? 'posted' : 'created', 'chronology_style' => 'monthly', 'chronology_view' => 'calendar')), 'TITLE' => l10n('display each day with photos, month per month'), 'NAME' => l10n('Calendar'), 'REL' => 'rel="nofollow"');
        $block->template = 'menubar_specials.tpl';
    }
    //---------------------------------------------------------------------- summary
    if (($block = $menu->get_block('mbMenu')) != null) {
        // quick search block will be displayed only if data['qsearch'] is set
        // to "yes"
        $block->data['qsearch'] = true;
        // tags link
        $block->data['tags'] = array('TITLE' => l10n('display available tags'), 'NAME' => l10n('Tags'), 'URL' => get_root_url() . 'tags.php', 'COUNTER' => get_nb_available_tags());
        // search link
        $block->data['search'] = array('TITLE' => l10n('search'), 'NAME' => l10n('Search'), 'URL' => get_root_url() . 'search.php', 'REL' => 'rel="search"');
        if ($conf['activate_comments']) {
            // comments link
            $block->data['comments'] = array('TITLE' => l10n('display last user comments'), 'NAME' => l10n('Comments'), 'URL' => get_root_url() . 'comments.php', 'COUNTER' => get_nb_available_comments());
        }
        // about link
        $block->data['about'] = array('TITLE' => l10n('About Piwigo'), 'NAME' => l10n('About'), 'URL' => get_root_url() . 'about.php');
        // notification
        $block->data['rss'] = array('TITLE' => l10n('RSS feed'), 'NAME' => l10n('Notification'), 'URL' => get_root_url() . 'notification.php', 'REL' => 'rel="nofollow"');
        $block->template = 'menubar_menu.tpl';
    }
//.........这里部分代码省略.........
开发者ID:donseba,项目名称:Piwigo,代码行数:101,代码来源:menubar.inc.php


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