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


PHP script_basename函数代码示例

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


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

示例1: oauth_init

/**
 * plugin initialization
 */
function oauth_init()
{
    global $conf, $page, $hybridauth_conf, $template;
    load_language('plugin.lang', OAUTH_PATH);
    $conf['oauth'] = safe_unserialize($conf['oauth']);
    // check config
    if (defined('IN_ADMIN')) {
        if (empty($hybridauth_conf) and strpos(@$_GET['page'], 'plugin-oAuth') === false) {
            $page['warnings'][] = '<a href="' . OAUTH_ADMIN . '">' . l10n('Social Connect: You need to configure the credentials') . '</a>';
        }
        if (!function_exists('curl_init')) {
            $page['warnings'][] = l10n('Social Connect: PHP Curl extension is needed');
        }
    }
    // in case of registration aborded
    if (script_basename() == 'index' and ($oauth_id = pwg_get_session_var('oauth_new_user')) !== null) {
        pwg_unset_session_var('oauth_new_user');
        if ($oauth_id[0] == 'Persona') {
            oauth_assign_template_vars(get_gallery_home_url());
            $template->block_footer_script(null, 'navigator.id.logout();');
        } else {
            require_once OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php';
            try {
                $hybridauth = new Hybrid_Auth($hybridauth_conf);
                $adapter = $hybridauth->getAdapter($oauth_id[0]);
                $adapter->logout();
            } catch (Exception $e) {
            }
        }
    }
}
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:34,代码来源:main.inc.php

示例2: on_end_section_init

 static function on_end_section_init()
 {
     global $page;
     $page['nb_image_page'] *= pwg_get_session_var('rvts_mult', 1);
     if (count($page['items']) < $page['nb_image_page'] + 3) {
         if (!@$page['start'] || script_basename() == 'picture') {
             $page['nb_image_page'] = max($page['nb_image_page'], count($page['items']));
         }
     }
     add_event_handler('loc_begin_index', array('RVTS', 'on_index_begin'), EVENT_HANDLER_PRIORITY_NEUTRAL + 10);
 }
开发者ID:kappuccino,项目名称:piwigo-tscroller,代码行数:11,代码来源:main.inc.php

示例3: validate_mail_address

/**
 * Checks if an email is well formed and not already in use.
 *
 * @param int $user_id
 * @param string $mail_address
 * @return string|void error message or nothing
 */
function validate_mail_address($user_id, $mail_address)
{
    global $conf;
    if (empty($mail_address) and !($conf['obligatory_user_mail_address'] and in_array(script_basename(), array('register', 'profile')))) {
        return '';
    }
    if (!email_check_format($mail_address)) {
        return l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
    }
    if (defined("PHPWG_INSTALLED") and !empty($mail_address)) {
        $query = '
SELECT count(*)
FROM ' . USERS_TABLE . '
WHERE upper(' . $conf['user_fields']['email'] . ') = upper(\'' . $mail_address . '\')
' . (is_numeric($user_id) ? 'AND ' . $conf['user_fields']['id'] . ' != \'' . $user_id . '\'' : '') . '
;';
        list($count) = pwg_db_fetch_row(pwg_query($query));
        if ($count != 0) {
            return l10n('this email address is already in use');
        }
    }
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:29,代码来源:functions_user.inc.php

示例4: elseif

    $page['meta_robots']['noindex'] = 1;
} elseif ('search' == $page['section']) {
    $page['meta_robots']['nofollow'] = 1;
}
if ($filter['enabled']) {
    $page['meta_robots']['noindex'] = 1;
}
// see if we need a redirect because of a permalink
if ('categories' == $page['section'] and isset($page['category'])) {
    $need_redirect = false;
    if (empty($page['category']['permalink'])) {
        if ($conf['category_url_style'] == 'id-name' and @$page['hit_by']['cat_url_name'] !== str2url($page['category']['name'])) {
            $need_redirect = true;
        }
    } else {
        if ($page['category']['permalink'] !== @$page['hit_by']['cat_permalink']) {
            $need_redirect = true;
        }
    }
    if ($need_redirect) {
        $redirect_url = script_basename() == 'picture' ? duplicate_picture_url() : duplicate_index_url();
        if (!headers_sent()) {
            // this is a permanent redirection
            set_status_header(301);
            redirect_http($redirect_url);
        }
        redirect($redirect_url);
    }
    unset($need_redirect, $page['hit_by']);
}
trigger_notify('loc_end_section_init');
开发者ID:squidjam,项目名称:Piwigo,代码行数:31,代码来源:section_init.inc.php

示例5: die

// | the Free Software Foundation                                          |
// |                                                                       |
// | 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.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
$script = script_basename();
if ($script != 'install' and $script != 'upgrade' or version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '>=')) {
    die('Nothing to do here...');
}
function initPHP5()
{
    include PHPWG_ROOT_PATH . 'install/hosting.php';
    $htaccess = PHPWG_ROOT_PATH . '.htaccess';
    if (file_exists($htaccess) and (!is_readable($htaccess) or !is_writable($htaccess)) or !($my_hostname = @gethostbyaddr($_SERVER['SERVER_ADDR']))) {
        return false;
    }
    foreach ($hosting as $hostname => $rule) {
        if (preg_match('!' . preg_quote($hostname) . '$!', $my_hostname)) {
            if (false !== ($fh = @fopen($htaccess, "ab"))) {
                fwrite($fh, "\n" . $rule);
                fclose($fh);
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:php5_apache_configuration.php

示例6: Template

    // 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'])) {
    include PHPWG_ROOT_PATH . 'include/no_photo_yet.inc.php';
}
if (isset($user['internal_status']['guest_must_be_guest']) and $user['internal_status']['guest_must_be_guest'] === true) {
    $header_msgs[] = l10n('Bad status for user "guest", using default status. Please notify the webmaster.');
}
if ($conf['gallery_locked']) {
    $header_msgs[] = l10n('The gallery is locked for maintenance. Please, come back later.');
    if (script_basename() != 'identification' and !is_admin()) {
        set_status_header(503, 'Service Unavailable');
        @header('Retry-After: 900');
        header('Content-Type: text/html; charset=' . get_pwg_charset());
        echo '<a href="' . get_absolute_root_url(false) . 'identification.php">' . l10n('The gallery is locked for maintenance. Please, come back later.') . '</a>';
        echo str_repeat(' ', 512);
        //IE6 doesn't error output if below a size
        exit;
    }
}
if ($conf['check_upgrade_feed']) {
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php';
    if (check_upgrade_feed()) {
        $header_msgs[] = 'Some database upgrades are missing, ' . '<a href="' . get_absolute_root_url(false) . 'upgrade_feed.php">upgrade now</a>';
    }
}
开发者ID:squidjam,项目名称:Piwigo,代码行数:31,代码来源:common.inc.php

示例7: die

*/
// Chech whether we are indeed included by Piwigo.
if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
// Define the path to our plugin.
define('OSM_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
global $conf;
// Prepare configuration
$conf['osm_conf'] = unserialize($conf['osm_conf']);
// GPX support
include_once dirname(__FILE__) . '/gpx.inc.php';
// Plugin on picture page
if (script_basename() == 'picture') {
    include_once dirname(__FILE__) . '/picture.inc.php';
} elseif (script_basename() == 'index') {
    include_once dirname(__FILE__) . '/category.inc.php';
    include_once dirname(__FILE__) . '/menu.inc.php';
}
// Do we have to show a link on the left menu
if ($conf['osm_conf']['left_menu']['enabled']) {
    // Hook to add link on the left menu
    add_event_handler('blockmanager_apply', 'osm_blockmanager_apply');
}
// Hook to add worldmap link on the album/category thumbnails
add_event_handler('loc_begin_index_category_thumbnails', 'osm_index_cat_thumbs_displayed');
// Hook to add worldmap link on the index thumbnails page
add_event_handler('loc_end_index', 'osm_end_index');
function osm_index_cat_thumbs_displayed()
{
    global $page;
开发者ID:lcorbasson,项目名称:piwigo-openstreetmap,代码行数:31,代码来源:main.inc.php

示例8: get_filter_page_value

/**
 * Return $conf['filter_pages'] value for the current page
 *
 * @param string $value_name
 * @return mixed
 */
function get_filter_page_value($value_name)
{
    global $conf;
    $page_name = script_basename();
    if (isset($conf['filter_pages'][$page_name][$value_name])) {
        return $conf['filter_pages'][$page_name][$value_name];
    } elseif (isset($conf['filter_pages']['default'][$value_name])) {
        return $conf['filter_pages']['default'][$value_name];
    } else {
        return null;
    }
}
开发者ID:squidjam,项目名称:Piwigo,代码行数:18,代码来源:functions.inc.php

示例9: initialize_calendar

/**
 * Initialize _$page_ and _$template_ vars for calendar view.
 */
function initialize_calendar()
{
    global $page, $conf, $user, $template, $persistent_cache, $filter;
    //------------------ initialize the condition on items to take into account ---
    $inner_sql = ' FROM ' . IMAGES_TABLE;
    if ($page['section'] == 'categories') {
        // we will regenerate the items by including subcats elements
        $page['items'] = array();
        $inner_sql .= '
INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' ON id = image_id';
        if (isset($page['category'])) {
            $sub_ids = array_diff(get_subcat_ids(array($page['category']['id'])), explode(',', $user['forbidden_categories']));
            if (empty($sub_ids)) {
                return;
                // nothing to do
            }
            $inner_sql .= '
WHERE category_id IN (' . implode(',', $sub_ids) . ')';
            $inner_sql .= '
    ' . get_sql_condition_FandF(array('visible_images' => 'id'), 'AND', false);
        } else {
            $inner_sql .= '
    ' . get_sql_condition_FandF(array('forbidden_categories' => 'category_id', 'visible_categories' => 'category_id', 'visible_images' => 'id'), 'WHERE', true);
        }
    } else {
        if (empty($page['items'])) {
            return;
            // nothing to do
        }
        $inner_sql .= '
WHERE id IN (' . implode(',', $page['items']) . ')';
    }
    //-------------------------------------- initialize the calendar parameters ---
    pwg_debug('start initialize_calendar');
    $fields = array('created' => array('label' => l10n('Creation date')), 'posted' => array('label' => l10n('Post date')));
    $styles = array('monthly' => array('include' => 'calendar_monthly.class.php', 'view_calendar' => true, 'classname' => 'CalendarMonthly'), 'weekly' => array('include' => 'calendar_weekly.class.php', 'view_calendar' => false, 'classname' => 'CalendarWeekly'));
    $views = array(CAL_VIEW_LIST, CAL_VIEW_CALENDAR);
    // Retrieve calendar field
    isset($fields[$page['chronology_field']]) or fatal_error('bad chronology field');
    // Retrieve style
    if (!isset($styles[$page['chronology_style']])) {
        $page['chronology_style'] = 'monthly';
    }
    $cal_style = $page['chronology_style'];
    $classname = $styles[$cal_style]['classname'];
    include PHPWG_ROOT_PATH . 'include/' . $styles[$cal_style]['include'];
    $calendar = new $classname();
    // Retrieve view
    if (!isset($page['chronology_view']) or !in_array($page['chronology_view'], $views)) {
        $page['chronology_view'] = CAL_VIEW_LIST;
    }
    if (CAL_VIEW_CALENDAR == $page['chronology_view'] and !$styles[$cal_style]['view_calendar']) {
        $page['chronology_view'] = CAL_VIEW_LIST;
    }
    // perform a sanity check on $requested
    if (!isset($page['chronology_date'])) {
        $page['chronology_date'] = array();
    }
    while (count($page['chronology_date']) > 3) {
        array_pop($page['chronology_date']);
    }
    $any_count = 0;
    for ($i = 0; $i < count($page['chronology_date']); $i++) {
        if ($page['chronology_date'][$i] == 'any') {
            if ($page['chronology_view'] == CAL_VIEW_CALENDAR) {
                // we dont allow any in calendar view
                while ($i < count($page['chronology_date'])) {
                    array_pop($page['chronology_date']);
                }
                break;
            }
            $any_count++;
        } elseif ($page['chronology_date'][$i] == '') {
            while ($i < count($page['chronology_date'])) {
                array_pop($page['chronology_date']);
            }
        } else {
            $page['chronology_date'][$i] = (int) $page['chronology_date'][$i];
        }
    }
    if ($any_count == 3) {
        array_pop($page['chronology_date']);
    }
    $calendar->initialize($inner_sql);
    //echo ('<pre>'. var_export($calendar, true) . '</pre>');
    $must_show_list = true;
    // true until calendar generates its own display
    if (script_basename() != 'picture') {
        if ($calendar->generate_category_content()) {
            $page['items'] = array();
            $must_show_list = false;
        }
        $page['comment'] = '';
        $template->assign('FILE_CHRONOLOGY_VIEW', 'month_calendar.tpl');
        foreach ($styles as $style => $style_data) {
            foreach ($views as $view) {
                if ($style_data['view_calendar'] or $view != CAL_VIEW_CALENDAR) {
//.........这里部分代码省略.........
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:101,代码来源:functions_calendar.inc.php

示例10: admintools_add_public_controller

/**
 * Add main toolbar to current page
 * @trigger loc_after_page_header
 */
function admintools_add_public_controller()
{
    global $MultiView, $conf, $template, $page, $user, $picture;
    if (script_basename() == 'picture' and empty($picture['current'])) {
        return;
    }
    $url_root = get_root_url();
    $tpl_vars = array();
    if ($MultiView->is_admin()) {
        // full options for admin
        $tpl_vars['U_SITE_ADMIN'] = $url_root . 'admin.php?page=';
        $tpl_vars['MULTIVIEW'] = $MultiView->get_data();
        $tpl_vars['USER'] = $MultiView->get_user();
        $tpl_vars['CURRENT_USERNAME'] = $user['id'] == $conf['guest_id'] ? l10n('guest') : $user['username'];
        $tpl_vars['DELETE_CACHE'] = isset($conf['multiview_invalidate_cache']);
        if (($admin_lang = $MultiView->get_user_language()) !== false) {
            include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php';
            switch_lang_to($admin_lang);
        }
    } else {
        if ($conf['AdminTools']['public_quick_edit'] and script_basename() == 'picture' and $picture['current']['added_by'] == $user['id']) {
            // only "edit" button for photo owner
        } else {
            return;
        }
    }
    $tpl_vars['POSITION'] = $conf['AdminTools']['closed_position'];
    $tpl_vars['DEFAULT_OPEN'] = $conf['AdminTools']['default_open'];
    $tpl_vars['U_SELF'] = $MultiView->get_clean_url(true);
    // photo page
    if (script_basename() == 'picture') {
        $url_self = duplicate_picture_url();
        $tpl_vars['IS_PICTURE'] = true;
        // admin can add to caddie and set representattive
        if ($MultiView->is_admin()) {
            $template->clear_assign(array('U_SET_AS_REPRESENTATIVE', 'U_PHOTO_ADMIN', 'U_CADDIE'));
            $template->set_prefilter('picture', 'admintools_remove_privacy');
            $tpl_vars['U_CADDIE'] = add_url_params($url_self, array('action' => 'add_to_caddie'));
            $query = '
SELECT element_id FROM ' . CADDIE_TABLE . '
  WHERE element_id = ' . $page['image_id'] . '
;';
            $tpl_vars['IS_IN_CADDIE'] = pwg_db_num_rows(pwg_query($query)) > 0;
            if (isset($page['category'])) {
                $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
                $tpl_vars['U_SET_REPRESENTATIVE'] = add_url_params($url_self, array('action' => 'set_as_representative'));
                $tpl_vars['IS_REPRESENTATIVE'] = $page['category']['representative_picture_id'] == $page['image_id'];
            }
            $tpl_vars['U_ADMIN_EDIT'] = $url_root . 'admin.php?page=photo-' . $page['image_id'] . (isset($page['category']) ? '&amp;cat_id=' . $page['category']['id'] : '');
        }
        $tpl_vars['U_DELETE'] = add_url_params($url_self, array('delete' => '', 'pwg_token' => get_pwg_token()));
        // gets tags (full available list is loaded in ajax)
        include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
        $query = '
SELECT id, name
  FROM ' . IMAGE_TAG_TABLE . ' AS it
    JOIN ' . TAGS_TABLE . ' AS t ON t.id = it.tag_id
  WHERE image_id = ' . $page['image_id'] . '
;';
        $tag_selection = get_taglist($query);
        $tpl_vars['QUICK_EDIT'] = array('img' => $picture['current']['derivatives']['square']->get_url(), 'name' => $picture['current']['name'], 'comment' => $picture['current']['comment'], 'author' => $picture['current']['author'], 'level' => $picture['current']['level'], 'date_creation' => substr($picture['current']['date_creation'], 0, 10), 'date_creation_time' => substr($picture['current']['date_creation'], 11, 5), 'tag_selection' => $tag_selection);
    } else {
        if ($MultiView->is_admin() and @$page['section'] == 'categories' and isset($page['category'])) {
            $url_self = duplicate_index_url();
            $tpl_vars['IS_CATEGORY'] = true;
            $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
            $template->clear_assign(array('U_EDIT', 'U_CADDIE'));
            $tpl_vars['U_ADMIN_EDIT'] = $url_root . 'admin.php?page=album-' . $page['category']['id'];
            if (!empty($page['items'])) {
                $tpl_vars['U_CADDIE'] = add_url_params($url_self, array('caddie' => 1));
            }
            $tpl_vars['QUICK_EDIT'] = array('img' => null, 'name' => $page['category']['name'], 'comment' => $page['category']['comment']);
            if (!empty($page['category']['representative_picture_id'])) {
                $query = '
SELECT * FROM ' . IMAGES_TABLE . '
  WHERE id = ' . $page['category']['representative_picture_id'] . '
;';
                $image_infos = pwg_db_fetch_assoc(pwg_query($query));
                $tpl_vars['QUICK_EDIT']['img'] = DerivativeImage::get_one(IMG_SQUARE, $image_infos)->get_url();
            }
        }
    }
    $template->assign(array('ADMINTOOLS_PATH' => './plugins/' . ADMINTOOLS_ID . '/', 'ato' => $tpl_vars));
    $template->set_filename('ato_public_controller', realpath(ADMINTOOLS_PATH . 'template/public_controller.tpl'));
    $template->parse('ato_public_controller');
    if ($MultiView->is_admin() && @$admin_lang !== false) {
        switch_lang_back();
    }
}
开发者ID:HassenLin,项目名称:piwigo_utf8filename,代码行数:93,代码来源:events.inc.php

示例11: UAM_InitPage

/**
 * Triggered on init
 * 
 * Check for forbidden email domains in admin's users management panel
 */
function UAM_InitPage()
{
    load_language('plugin.lang', UAM_PATH);
    global $conf, $template, $page, $lang, $errors;
    $conf_UAM = unserialize($conf['UserAdvManager']);
    // Admin user management
    // ---------------------
    if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') {
        if (isset($_POST['submit_add'])) {
            // Email without forbidden domains
            // -------------------------------
            if (isset($conf_UAM['MAILEXCLUSION']) and $conf_UAM['MAILEXCLUSION'] == 'true' and !empty($_POST['email']) and ValidateEmailProvider($_POST['email'])) {
                $template->append('errors', l10n('UAM_reg_err_login5') . "'" . $conf_UAM['MAILEXCLUSION_LIST'] . "'");
                unset($_POST['submit_add']);
            }
        }
    }
    if (isset($_GET['UAM_msg'])) {
        UAM_DisplayMsg();
    } elseif (isset($_GET['key']) and isset($_GET['userid'])) {
        UAM_ConfirmMail();
    }
}
开发者ID:Eric-Piwigo,项目名称:UserAdvManager,代码行数:28,代码来源:functions.inc.php

示例12: COUNT

// | the Free Software Foundation                                          |
// |                                                                       |
// | 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.                                                                  |
// +-----------------------------------------------------------------------+
// The "No Photo Yet" feature: if you have no photo yet in your gallery, the
// gallery displays only a big box to show you the way for adding your first
// photos
if (!(defined('IN_ADMIN') and IN_ADMIN) and script_basename() != 'identification' and script_basename() != 'ws' and script_basename() != 'popuphelp' and !isset($_SESSION['no_photo_yet'])) {
    $query = '
SELECT
    COUNT(*)
  FROM ' . IMAGES_TABLE . '
;';
    list($nb_photos) = pwg_db_fetch_row(pwg_query($query));
    if (0 == $nb_photos) {
        // make sure we don't use the mobile theme, which is not compatible with
        // the "no photo yet" feature
        $template = new Template(PHPWG_ROOT_PATH . 'themes', $user['theme']);
        if (isset($_GET['no_photo_yet'])) {
            if ('browse' == $_GET['no_photo_yet']) {
                $_SESSION['no_photo_yet'] = 'browse';
                redirect(make_index_url());
                exit;
开发者ID:squidjam,项目名称:Piwigo,代码行数:31,代码来源:no_photo_yet.inc.php

示例13: PhpBB_Adduser

    // Exclusion of Adult_Content users
    if ($register_user['username'] != "16" and $register_user['username'] != "18") {
        include_once REGPHPBB_PATH . 'include/functions.inc.php';
        // Warning : PhpBB uses md5 hash like Piwigo, but not like PhpBB !
        PhpBB_Adduser($register_user['id'], $register_user['username'], md5($_POST['password']), $register_user['email']);
    }
}
/* user deletion */
add_event_handler('delete_user', 'Register_PhpBB_Deluser');
function Register_PhpBB_Deluser($user_id)
{
    include_once REGPHPBB_PATH . 'include/functions.inc.php';
    PhpBB_Deluser(PhpBB_Searchuser($user_id), true);
}
/* Profile management */
if (script_basename() == 'profile') {
    add_event_handler('loc_begin_profile', 'Register_PhpBB_InitPage', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    function Register_PhpBB_InitPage()
    {
        global $conf, $user;
        include_once REGPHPBB_PATH . 'include/functions.inc.php';
        if (isset($_POST['validate']) and !is_admin()) {
            if (!empty($_POST['use_new_pwd'])) {
                $query = '
SELECT ' . $conf['user_fields']['username'] . ' AS username
FROM ' . USERS_TABLE . '
WHERE ' . $conf['user_fields']['id'] . ' = \'' . $user['id'] . '\'
;';
                list($username) = pwg_db_fetch_row(pwg_query($query));
                PhpBB_Updateuser($user['id'], stripslashes($username), md5($_POST['use_new_pwd']), $_POST['mail_address']);
            }
开发者ID:Eric-Piwigo,项目名称:Register_PhpBB,代码行数:31,代码来源:main.inc.php

示例14: 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

示例15: elseif

            $render_tag_names = false;
        }
    } elseif ('groups' == $conf['tags_default_display_mode']) {
        $render_tag_names = false;
    }
    $page['tg_display'] = !$render_tag_names;
}
if ($render_tag_names) {
    add_event_handler('render_tag_name', 'tg_clean_tag_name');
}
function tg_clean_tag_name($tag_name)
{
    return preg_replace('/^[^:]*:/', '', $tag_name);
}
// file_get_contents('tags.tpl')
if (script_basename() == 'tags') {
    add_event_handler('loc_begin_page_header', 'tg_groups_display');
}
function tg_groups_display()
{
    global $conf, $template, $user, $tags, $page;
    load_language('plugin.lang', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
    load_language('lang', PHPWG_ROOT_PATH . PWG_LOCAL_DIR, array('no_fallback' => true, 'local' => true));
    $template->set_prefilter('tags', 'tg_add_display_link_prefilter');
    $template->assign('U_TAG_GROUPS', get_root_url() . 'tags.php?display_mode=groups');
    if ($page['tg_display']) {
        // echo __FILE__.'::'.__LINE__.' display_mode=groups<br>';
        $template->set_prefilter('tags', 'tg_groups_display_prefilter');
        $template->assign('display_mode', 'groups');
        // we want tags diplayed in alphabetic order
        usort($tags, 'tag_alpha_compare');
开发者ID:lcorbasson,项目名称:piwigo-tag_groups,代码行数:31,代码来源:main.inc.php


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