本文整理汇总了PHP中make_index_url函数的典型用法代码示例。如果您正苦于以下问题:PHP make_index_url函数的具体用法?PHP make_index_url怎么用?PHP make_index_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_index_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: language_controler_flags
function language_controler_flags()
{
global $user, $template, $conf, $page;
$available_lang = get_languages();
if (isset($conf['no_flag_languages'])) {
$available_lang = array_diff_key($available_lang, array_flip($conf['no_flag_languages']));
}
$url_starting = get_query_string_diff(array('lang'));
if (isset($page['section']) and $page['section'] == 'additional_page' and isset($page['additional_page'])) {
$base_url = make_index_url(array('section' => 'page')) . '/' . (isset($page['additional_page']['permalink']) ? $page['additional_page']['permalink'] : $page['additional_page']['id']);
} else {
$base_url = duplicate_index_url();
}
foreach ($available_lang as $code => $displayname) {
$qlc = array('url' => add_url_params($base_url, array('lang' => $code)), 'alt' => ucwords($displayname), 'title' => substr($displayname, 0, -4), 'code' => $code);
$lsw['flags'][$code] = $qlc;
if ($code == $user['language']) {
$lsw['Active'] = $qlc;
}
}
$safe_themes = array('clear', 'dark', 'elegant', 'Sylvia', 'simple-grey', 'simple-black', 'simple-white', 'kardon', 'luciano', 'montblancxl');
// stripped (2.6)
$template->assign(array('lang_switch' => $lsw, 'LANGUAGE_SWITCH_PATH' => LANGUAGE_SWITCH_PATH, 'LANGUAGE_SWITCH_LOAD_STYLE' => !in_array($user['theme'], $safe_themes)));
$template->set_filename('language_flags', dirname(__FILE__) . '/flags.tpl');
$template->concat('PLUGIN_INDEX_ACTIONS', $template->parse('language_flags', true));
$template->clear_assign('lang_switch');
}
示例2: 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');
}
}
}
}
示例3: 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');
$current_tag_group = null;
$nb_tags = count($tags);
$current_column = 1;
$current_tag_idx = 0;
$tag_group = array('tags' => array());
foreach ($tags as $tag) {
// if the tag belongs to no group, we don't show it on the "tag by
// group" display mode
if (strpos($tag['name'], ':') === false) {
continue;
} else {
list($tag['group'], $tag['name']) = explode(':', $tag['name'], 2);
$tag['group'] = preg_replace('/^[^=]*=/', '', $tag['group']);
}
if ($current_tag_idx == 0) {
$current_tag_group = $tag['group'];
$tag_group['TITLE'] = $tag['group'];
}
// new group?
if ($tag['group'] !== $current_tag_group) {
if ($current_column < $conf['tag_letters_column_number'] and $current_tag_idx > $current_column * $nb_tags / $conf['tag_letters_column_number']) {
$tag_group['CHANGE_COLUMN'] = true;
$current_column++;
}
$tag_group['TITLE'] = $current_tag_group;
$template->append('tag_groups', $tag_group);
$current_tag_group = $tag['group'];
$tag_group = array('tags' => array());
}
array_push($tag_group['tags'], array_merge($tag, array('URL' => make_index_url(array('tags' => array($tag))))));
$current_tag_idx++;
}
// flush last group
if (count($tag_group['tags']) > 0) {
unset($tag_group['CHANGE_COLUMN']);
$tag_group['TITLE'] = $current_tag_group;
$template->append('tag_groups', $tag_group);
}
}
}
示例4: osm_render_category
function osm_render_category()
{
global $template, $page, $conf, $filter;
include_once dirname(__FILE__) . '/include/functions.php';
include_once dirname(__FILE__) . '/include/functions_map.php';
osm_load_language();
load_language('plugin.lang', OSM_PATH);
// TF, 20160102: pass config as parameter
$js_data = osm_get_items($conf, $page);
if ($js_data != array()) {
$local_conf = array();
$local_conf['contextmenu'] = 'false';
$local_conf['control'] = true;
$local_conf['img_popup'] = false;
$local_conf['popup'] = 1;
$local_conf['center_lat'] = 0;
$local_conf['center_lng'] = 0;
$local_conf['zoom'] = 2;
$local_conf['auto_center'] = 1;
// TF, 20160102: pass config as parameter
$local_conf['paths'] = osm_get_gps($conf, $page);
$height = isset($conf['osm_conf']['category_description']['height']) ? $conf['osm_conf']['category_description']['height'] : '200';
$width = isset($conf['osm_conf']['category_description']['width']) ? $conf['osm_conf']['category_description']['width'] : 'auto';
$js = osm_get_js($conf, $local_conf, $js_data);
$template->set_filename('map', dirname(__FILE__) . '/template/osm-category.tpl');
$template->assign(array('CONTENT_ENCODING' => get_pwg_charset(), 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'HOME' => make_index_url(), 'HOME_PREV' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_absolute_root_url(), 'HOME_NAME' => l10n("Home"), 'HOME_PREV_NAME' => l10n("Previous"), 'OSMJS' => $js, 'HEIGHT' => $height, 'WIDTH' => $width));
$osm_content = $template->parse('map', true);
//$osm_content = '<div id="osmmap"><div class="map_title">'.l10n('EDIT_MAP').'</div>' . $osm_content . '</div>';
$index = isset($conf['osm_conf']['category_description']['index']) ? $conf['osm_conf']['category_description']['index'] : 0;
// 0 - PLUGIN_INDEX_CONTENT_BEGIN
// 1 - PLUGIN_INDEX_CONTENT_COMMENT
// 2 - PLUGIN_INDEX_CONTENT_END
if ($index <= 1) {
// From index category comment at L300
if ($page['start'] == 0 and !isset($page['chronology_field'])) {
if (empty($page['comment'])) {
$page['comment'] = $osm_content;
} else {
if ($index == 0) {
$page['comment'] = '<div>' . $osm_content . $page['comment'] . '</div>';
} else {
$page['comment'] = '<div>' . $page['comment'] . $osm_content . '</div>';
}
}
}
} else {
$osm_content = '<div id="osmmap">' . $osm_content . '</div>';
$template->concat('PLUGIN_INDEX_CONTENT_END', "\n" . $osm_content);
}
}
}
示例5: check_status
// +-----------------------------------------------------------------------+
check_status(ACCESS_GUEST);
if (empty($_GET['q'])) {
redirect(make_index_url());
}
$search = array();
$search['q'] = $_GET['q'];
$query = '
SElECT id FROM ' . SEARCH_TABLE . '
WHERE rules = \'' . addslashes(serialize($search)) . '\'
;';
$search_id = array_from_query($query, 'id');
if (!empty($search_id)) {
$search_id = $search_id[0];
$query = '
UPDATE ' . SEARCH_TABLE . '
SET last_seen=NOW()
WHERE id=' . $search_id;
pwg_query($query);
} else {
$query = '
INSERT INTO ' . SEARCH_TABLE . '
(rules, last_seen)
VALUES
(\'' . addslashes(serialize($search)) . '\', NOW() )
;';
pwg_query($query);
$search_id = pwg_db_insert_id(SEARCH_TABLE);
}
redirect(make_index_url(array('section' => 'search', 'search' => $search_id)));
示例6: ws_categories_getList
/**
* API method
* Returns a list of categories
* @param mixed[] $params
* @option int cat_id (optional)
* @option bool recursive
* @option bool public
* @option bool tree_output
* @option bool fullname
*/
function ws_categories_getList($params, &$service)
{
global $user, $conf;
$where = array('1=1');
$join_type = 'INNER';
$join_user = $user['id'];
if (!$params['recursive']) {
if ($params['cat_id'] > 0) {
$where[] = '(
id_uppercat = ' . (int) $params['cat_id'] . '
OR id=' . (int) $params['cat_id'] . '
)';
} else {
$where[] = 'id_uppercat IS NULL';
}
} else {
if ($params['cat_id'] > 0) {
$where[] = 'uppercats ' . DB_REGEX_OPERATOR . ' \'(^|,)' . (int) $params['cat_id'] . '(,|$)\'';
}
}
if ($params['public']) {
$where[] = 'status = "public"';
$where[] = 'visible = "true"';
$join_user = $conf['guest_id'];
} else {
if (is_admin()) {
// in this very specific case, we don't want to hide empty
// categories. Function calculate_permissions will only return
// categories that are either locked or private and not permitted
//
// calculate_permissions does not consider empty categories as forbidden
$forbidden_categories = calculate_permissions($user['id'], $user['status']);
$where[] = 'id NOT IN (' . $forbidden_categories . ')';
$join_type = 'LEFT';
}
}
$query = '
SELECT
id, name, comment, permalink,
uppercats, global_rank, id_uppercat,
nb_images, count_images AS total_nb_images,
representative_picture_id, user_representative_picture_id, count_images, count_categories,
date_last, max_date_last, count_categories AS nb_categories
FROM ' . CATEGORIES_TABLE . '
' . $join_type . ' JOIN ' . USER_CACHE_CATEGORIES_TABLE . '
ON id=cat_id AND user_id=' . $join_user . '
WHERE ' . implode("\n AND ", $where) . '
;';
$result = pwg_query($query);
// management of the album thumbnail -- starts here
$image_ids = array();
$categories = array();
$user_representative_updates_for = array();
// management of the album thumbnail -- stops here
$cats = array();
while ($row = pwg_db_fetch_assoc($result)) {
$row['url'] = make_index_url(array('category' => $row));
foreach (array('id', 'nb_images', 'total_nb_images', 'nb_categories') as $key) {
$row[$key] = (int) $row[$key];
}
if ($params['fullname']) {
$row['name'] = strip_tags(get_cat_display_name_cache($row['uppercats'], null));
} else {
$row['name'] = strip_tags(trigger_change('render_category_name', $row['name'], 'ws_categories_getList'));
}
$row['comment'] = strip_tags(trigger_change('render_category_description', $row['comment'], 'ws_categories_getList'));
// management of the album thumbnail -- starts here
//
// on branch 2.3, the algorithm is duplicated from
// include/category_cats, but we should use a common code for Piwigo 2.4
//
// warning : if the API method is called with $params['public'], the
// album thumbnail may be not accurate. The thumbnail can be viewed by
// the connected user, but maybe not by the guest. Changing the
// filtering method would be too complicated for now. We will simply
// avoid to persist the user_representative_picture_id in the database
// if $params['public']
if (!empty($row['user_representative_picture_id'])) {
$image_id = $row['user_representative_picture_id'];
} else {
if (!empty($row['representative_picture_id'])) {
// if a representative picture is set, it has priority
$image_id = $row['representative_picture_id'];
} else {
if ($conf['allow_random_representative']) {
// searching a random representant among elements in sub-categories
$image_id = get_random_image_in_category($row);
} else {
// searching a random representant among representant of sub-categories
if ($row['count_categories'] > 0 and $row['count_images'] > 0) {
//.........这里部分代码省略.........
示例7: ws_tags_getImages
/**
* API method
* Returns a list of images for tags
* @param mixed[] $params
* @option int[] tag_id (optional)
* @option string[] tag_url_name (optional)
* @option string[] tag_name (optional)
* @option bool tag_mode_and
* @option int per_page
* @option int page
* @option string order
*/
function ws_tags_getImages($params, &$service)
{
// first build all the tag_ids we are interested in
$tags = find_tags($params['tag_id'], $params['tag_url_name'], $params['tag_name']);
$tags_by_id = array();
foreach ($tags as $tag) {
$tags['id'] = (int) $tag['id'];
$tags_by_id[$tag['id']] = $tag;
}
unset($tags);
$tag_ids = array_keys($tags_by_id);
$where_clauses = ws_std_image_sql_filter($params);
if (!empty($where_clauses)) {
$where_clauses = implode(' AND ', $where_clauses);
}
$order_by = ws_std_image_sql_order($params, 'i.');
if (!empty($order_by)) {
$order_by = 'ORDER BY ' . $order_by;
}
$image_ids = get_image_ids_for_tags($tag_ids, $params['tag_mode_and'] ? 'AND' : 'OR', $where_clauses, $order_by);
$count_set = count($image_ids);
$image_ids = array_slice($image_ids, $params['per_page'] * $params['page'], $params['per_page']);
$image_tag_map = array();
// build list of image ids with associated tags per image
if (!empty($image_ids) and !$params['tag_mode_and']) {
$query = '
SELECT image_id, GROUP_CONCAT(tag_id) AS tag_ids
FROM ' . IMAGE_TAG_TABLE . '
WHERE tag_id IN (' . implode(',', $tag_ids) . ')
AND image_id IN (' . implode(',', $image_ids) . ')
GROUP BY image_id
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
$row['image_id'] = (int) $row['image_id'];
$image_tag_map[$row['image_id']] = explode(',', $row['tag_ids']);
}
}
$images = array();
if (!empty($image_ids)) {
$rank_of = array_flip($image_ids);
$query = '
SELECT *
FROM ' . IMAGES_TABLE . '
WHERE id IN (' . implode(',', $image_ids) . ')
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
$image = array();
$image['rank'] = $rank_of[$row['id']];
foreach (array('id', 'width', 'height', 'hit') as $k) {
if (isset($row[$k])) {
$image[$k] = (int) $row[$k];
}
}
foreach (array('file', 'name', 'comment', 'date_creation', 'date_available') as $k) {
$image[$k] = $row[$k];
}
$image = array_merge($image, ws_std_get_urls($row));
$image_tag_ids = $params['tag_mode_and'] ? $tag_ids : $image_tag_map[$image['id']];
$image_tags = array();
foreach ($image_tag_ids as $tag_id) {
$url = make_index_url(array('section' => 'tags', 'tags' => array($tags_by_id[$tag_id])));
$page_url = make_picture_url(array('section' => 'tags', 'tags' => array($tags_by_id[$tag_id]), 'image_id' => $row['id'], 'image_file' => $row['file']));
$image_tags[] = array('id' => (int) $tag_id, 'url' => $url, 'page_url' => $page_url);
}
$image['tags'] = new PwgNamedArray($image_tags, 'tag', ws_std_get_tag_xml_attributes());
$images[] = $image;
}
usort($images, 'rank_compare');
unset($rank_of);
}
return array('paging' => new PwgNamedStruct(array('page' => $params['page'], 'per_page' => $params['per_page'], 'count' => count($images), 'total_count' => $count_set)), 'images' => new PwgNamedArray($images, 'image', ws_std_get_image_xml_attributes()));
}
示例8: redirect
// 1. if a category is available in the URL, use it
// 2. else use the first reachable linked category
// 3. redirect to gallery root
if (isset($_GET['cat_id']) and !empty($_GET['cat_id'])) {
redirect(make_index_url(array('category' => get_cat_info($_GET['cat_id']))));
}
$query = '
SELECT category_id
FROM ' . IMAGE_CATEGORY_TABLE . '
WHERE image_id = ' . $_GET['image_id'] . '
;';
$authorizeds = array_diff(array_from_query($query, 'category_id'), explode(',', calculate_permissions($user['id'], $user['status'])));
foreach ($authorizeds as $category_id) {
redirect(make_index_url(array('category' => get_cat_info($category_id))));
}
redirect(make_index_url());
}
// +-----------------------------------------------------------------------+
// | synchronize metadata |
// +-----------------------------------------------------------------------+
if (isset($_GET['sync_metadata'])) {
sync_metadata(array(intval($_GET['image_id'])));
$page['infos'][] = l10n('Metadata synchronized from file');
}
//--------------------------------------------------------- update informations
if (isset($_POST['submit'])) {
$data = array();
$data['id'] = $_GET['image_id'];
$data['name'] = $_POST['name'];
$data['author'] = $_POST['author'];
$data['level'] = $_POST['level'];
示例9: unset
unset($letter['CHANGE_COLUMN']);
$letter['TITLE'] = $current_letter;
$template->append('letters', $letter);
}
} else {
// +-----------------------------------------------------------------------+
// | tag cloud construction |
// +-----------------------------------------------------------------------+
// we want only the first most represented tags, so we sort them by counter
// and take the first tags
usort($tags, 'counter_compare');
$tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']);
// depending on its counter and the other tags counter, each tag has a level
$tags = add_level_to_tags($tags);
// we want tags diplayed in alphabetic order
usort($tags, 'tag_alpha_compare');
// display sorted tags
foreach ($tags as $tag) {
$template->append('tags', array_merge($tag, array('URL' => make_index_url(array('tags' => array($tag))))));
}
}
// include menubar
$themeconf = $template->get_template_vars('themeconf');
if (!isset($themeconf['hide_menu_on']) or !in_array('theTagsPage', $themeconf['hide_menu_on'])) {
include PHPWG_ROOT_PATH . 'include/menubar.inc.php';
}
include PHPWG_ROOT_PATH . 'include/page_header.php';
trigger_notify('loc_end_tags');
flush_page_messages();
$template->pparse('tags');
include PHPWG_ROOT_PATH . 'include/page_tail.php';
示例10: admintools_save_picture
/**
* Save picture form
* @trigger loc_begin_picture
*/
function admintools_save_picture()
{
global $page, $conf, $MultiView, $user, $picture;
if (!isset($_GET['delete']) and !isset($_POST['action']) and @$_POST['action'] != 'quick_edit') {
return;
}
$query = 'SELECT added_by FROM ' . IMAGES_TABLE . ' WHERE id = ' . $page['image_id'] . ';';
list($added_by) = pwg_db_fetch_row(pwg_query($query));
if (!$MultiView->is_admin() and $user['id'] != $added_by) {
return;
}
if (isset($_GET['delete']) and get_pwg_token() == @$_GET['pwg_token']) {
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
delete_elements(array($page['image_id']), true);
invalidate_user_cache();
if (isset($page['rank_of'][$page['image_id']])) {
redirect(duplicate_index_url(array('start' => floor($page['rank_of'][$page['image_id']] / $page['nb_image_page']) * $page['nb_image_page'])));
} else {
redirect(make_index_url());
}
}
if ($_POST['action'] == 'quick_edit') {
include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
$data = array('name' => $_POST['name'], 'author' => $_POST['author']);
if ($MultiView->is_admin()) {
$data['level'] = $_POST['level'];
}
if ($conf['allow_html_descriptions']) {
$data['comment'] = @$_POST['comment'];
} else {
$data['comment'] = strip_tags(@$_POST['comment']);
}
if (!empty($_POST['date_creation']) and strtotime($_POST['date_creation']) !== false) {
$data['date_creation'] = $_POST['date_creation'] . ' ' . $_POST['date_creation_time'];
}
single_update(IMAGES_TABLE, $data, array('id' => $page['image_id']));
$tag_ids = array();
if (!empty($_POST['tags'])) {
$tag_ids = get_tag_ids($_POST['tags']);
}
set_tags($tag_ids, $page['image_id']);
}
}
示例11: 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';
}
//.........这里部分代码省略.........
示例12: get_html_description_recent_post_date
/**
* Returns html description about recently published elements grouped by post date.
* @todo clean up HTML output, currently messy and invalid !
*
* @param array $date_detail returned value of get_recent_post_dates()
* @return string
*/
function get_html_description_recent_post_date($date_detail, $auth_key = null)
{
global $conf;
$add_url_params = array();
if (isset($auth_key)) {
$add_url_params['auth'] = $auth_key;
}
$description = '<ul>';
$description .= '<li>' . l10n_dec('%d new photo', '%d new photos', $date_detail['nb_elements']) . ' (' . '<a href="' . add_url_params(make_index_url(array('section' => 'recent_pics')), $add_url_params) . '">' . l10n('Recent photos') . '</a>' . ')' . '</li><br>';
foreach ($date_detail['elements'] as $element) {
$tn_src = DerivativeImage::thumb_url($element);
$description .= '<a href="' . add_url_params(make_picture_url(array('image_id' => $element['id'], 'image_file' => $element['file'])), $add_url_params) . '"><img src="' . $tn_src . '"></a>';
}
$description .= '...<br>';
$description .= '<li>' . l10n_dec('%d album updated', '%d albums updated', $date_detail['nb_cats']) . '</li>';
$description .= '<ul>';
foreach ($date_detail['categories'] as $cat) {
$description .= '<li>' . get_cat_display_name_cache($cat['uppercats'], '', false, null, $auth_key) . ' (' . l10n_dec('%d new photo', '%d new photos', $cat['img_count']) . ')' . '</li>';
}
$description .= '</ul>';
$description .= '</ul>';
return $description;
}
示例13: get_gallery_home_url
/**
* Returns the 'home page' of this gallery
*/
function get_gallery_home_url()
{
global $conf;
if (!empty($conf['gallery_url'])) {
if (url_is_remote($conf['gallery_url']) or $conf['gallery_url'][0] == '/') {
return $conf['gallery_url'];
}
return get_root_url() . $conf['gallery_url'];
} else {
return make_index_url();
}
}
示例14: add_url_params
if (is_admin() and !empty($page['items'])) {
$template->assign('U_CADDIE', add_url_params(duplicate_index_url(), array('caddie' => 1)));
}
if ($page['section'] == 'search' and $page['start'] == 0 and !isset($page['chronology_field']) and isset($page['qsearch_details'])) {
$cats = array_merge((array) @$page['qsearch_details']['matching_cats_no_images'], (array) @$page['qsearch_details']['matching_cats']);
if (count($cats)) {
usort($cats, 'name_compare');
$hints = array();
foreach ($cats as $cat) {
$hints[] = get_cat_display_name(array($cat), '');
}
$template->assign('category_search_results', $hints);
}
$tags = (array) @$page['qsearch_details']['matching_tags'];
foreach ($tags as $tag) {
$tag['URL'] = make_index_url(array('tags' => array($tag)));
$template->append('tag_search_results', $tag);
}
if (empty($page['items'])) {
$template->append('no_search_results', htmlspecialchars($page['qsearch_details']['q']));
} elseif (!empty($page['qsearch_details']['unmatched_terms'])) {
$template->assign('no_search_results', array_map('htmlspecialchars', $page['qsearch_details']['unmatched_terms']));
}
}
// image order
if ($conf['index_sort_order_input'] and count($page['items']) > 0 and $page['section'] != 'most_visited' and $page['section'] != 'best_rated') {
$preferred_image_orders = get_category_preferred_image_orders();
$order_idx = pwg_get_session_var('image_order', 0);
// get first order field and direction
$first_order = substr($conf['order_by'], 9);
if (($pos = strpos($first_order, ',')) !== false) {
示例15: COUNT
SELECT tag_id, COUNT(image_id) AS counter
FROM ' . IMAGE_TAG_TABLE . '
GROUP BY tag_id';
$tag_counters = simple_hash_from_query($query, 'tag_id', 'counter');
// all tags
$query = '
SELECT *
FROM ' . TAGS_TABLE . '
;';
$result = pwg_query($query);
$all_tags = array();
while ($tag = pwg_db_fetch_assoc($result)) {
$raw_name = $tag['name'];
$tag['name'] = trigger_change('render_tag_name', $raw_name, $tag);
$tag['counter'] = intval(@$tag_counters[$tag['id']]);
$tag['U_VIEW'] = make_index_url(array('tags' => array($tag)));
$tag['U_EDIT'] = 'admin.php?page=batch_manager&filter=tag-' . $tag['id'];
$alt_names = trigger_change('get_tag_alt_names', array(), $raw_name);
$alt_names = array_diff(array_unique($alt_names), array($tag['name']));
if (count($alt_names)) {
$tag['alt_names'] = implode(', ', $alt_names);
}
$all_tags[] = $tag;
}
usort($all_tags, 'tag_alpha_compare');
$template->assign(array('all_tags' => $all_tags));
if ((isset($_POST['edit']) or isset($_POST['duplicate']) or isset($_POST['merge'])) and isset($_POST['tags'])) {
$list_name = 'EDIT_TAGS_LIST';
if (isset($_POST['duplicate'])) {
$list_name = 'DUPLIC_TAGS_LIST';
} elseif (isset($_POST['merge'])) {