本文整理汇总了PHP中ps_url_wrapper函数的典型用法代码示例。如果您正苦于以下问题:PHP ps_url_wrapper函数的具体用法?PHP ps_url_wrapper怎么用?PHP ps_url_wrapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ps_url_wrapper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_sortheader
function smarty_function_sortheader($args, &$smarty)
{
global $cms;
static $baseurl = "";
static $prefix = "";
static $sort = "";
static $sortvar = "sort";
static $order = "";
static $ordervar = "order";
static $anchor = "";
static $active_class = "active";
static $th_class = "";
static $th_attrib = "";
$orig = $args;
$args += array('reset' => 0, 'baseurl' => $baseurl, 'anchor' => $anchor, 'sort' => $sort, 'sortvar' => $sortvar, 'prefix' => $prefix, 'order' => $order, 'ordervar' => $ordervar, 'th_class' => $th_class, 'th_attrib' => $th_attrib, 'label' => '', 'title' => null, 'active' => false);
if ($args['reset']) {
if (!empty($args['sortvar'])) {
$sortvar = $args['sortvar'];
}
if (!empty($args['ordervar'])) {
$ordervar = $args['ordervar'];
}
$sort = $args['sort'];
$order = $args['order'];
$prefix = $args['prefix'];
$anchor = $args['anchor'];
$baseurl = $args['baseurl'];
return '';
}
$altorder = $args['order'] == 'desc' ? 'asc' : 'desc';
$neworder = $args['sort'] == $sort ? $altorder : $args['order'];
$label = $args['label'];
$image = "";
// mark this header as active if specified or if the order has changed
if (($args['active'] or $neworder == $altorder) and $orig['sort']) {
$args['th_class'] = trim($args['th_class'] . " " . $active_class);
// $image = sprintf(" <img src='%s' />", catfile($cms->theme->url(), sprintf("img/sort_arrow_%s.gif", $args['order'])));
}
$url = array();
$url['_base'] = $args['baseurl'] ? $args['baseurl'] : null;
$url['_anchor'] = $args['anchor'];
if ($order and $neworder) {
$url[$args['prefix'] . $args['ordervar']] = $neworder;
}
if ($sort and $args['sort']) {
$url[$args['prefix'] . $args['sortvar']] = $args['sort'];
}
// if ($url['sort'] or $url['order']) {
return sprintf("<th%s%s><p><a href='%s'><span class='%s'>%s%s</span></a></p></th>", $args['th_class'] ? " class='" . $args['th_class'] . "'" : "", $args['th_attrib'] ? " " . $args['th_attrib'] : "", ps_url_wrapper($url), $args['order'], $label, $image);
/*
} else {
return sprintf("<th%s%s><p><span class='%s'>%s%s</span></p></th>",
$args['th_class'] ? " class='" . $args['th_class'] . "'" : "",
$args['th_attrib'] ? " " . $args['th_attrib'] : "",
$args['order'], $label, $image
);
}
*/
}
示例2: array
if (!in_array($order, array('asc', 'desc'))) {
$order = 'asc';
}
$sort = 'eventname';
$_order = array('start' => $start, 'limit' => $limit, 'order' => $order, 'sort' => $sort);
$where = '';
if ($filter) {
$f = $ps->db->escape($filter, false);
$where = "WHERE (gametype LIKE '%{$f}' OR modtype LIKE '%{$f}%' OR eventname LIKE '%{$f}%') ";
}
$list = $ps->db->fetch_rows(1, "SELECT * FROM {$ps->t_config_plrbonuses} {$where}" . $ps->getsortorder($_order));
$total = $ps->db->count($ps->t_config_plrbonuses, '*', $where ? substr($where, 6) : null);
// remove 'WHERE' from str
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit, 'filter' => $filter)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Bonuses', ps_url_wrapper(array('_base' => 'bonuses.php')));
// massage the bonus list a bit so we don't have to do it in the smarty template
$bonuses = array();
foreach ($list as $b) {
foreach (array('enactor', 'enactor_team', 'victim', 'victim_team') as $e) {
if ($b[$e]) {
$b[$e . '_color'] = $b[$e] > 0 ? '#00cc00' : '#cc0000';
} else {
$b[$e . '_color'] = '#000000';
}
}
$bonuses[] = $b;
}
// assign variables to the theme
$cms->theme->assign(array('bonuses' => $bonuses, 'pager' => $pager));
// display the output
示例3: array
$message = $cms->message('success', array(
'message_title' => $cms->trans("Update Successfull"),
'message' => $cms->trans("Log Source has been updated"))
));
*/
}
} else {
// fill in defaults
if (!$test) {
if ($id) {
$form->input($clantag);
}
}
}
$cms->crumb('Manage', ps_url_wrapper('manage.php'));
$cms->crumb('Clan Tags', ps_url_wrapper('clantags.php'));
$cms->crumb('Edit');
// save a new form key in the users session cookie
// this will also be put into a 'hidden' field in the form
if ($ps->conf['main']['security']['csrf_protection']) {
$cms->session->key($form->key());
}
$cms->theme->assign(array('errors' => $form->errors(), 'clantag' => $clantag, 'form' => $form->values(), 'form_key' => $ps->conf['main']['security']['csrf_protection'] ? $cms->session->key() : ''));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/forms.css');
//$cms->theme->add_js('js/jquery.interface.js');
$cms->theme->add_js('js/clantags.js');
$cms->theme->add_js('js/forms.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
function val_regex($var, $value, &$form)
示例4: define
* PsychoStats is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PsychoStats 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 PsychoStats. If not, see <http://www.gnu.org/licenses/>.
*
* Version: $Id: manage.php 389 2008-04-18 15:04:10Z lifo $
*/
define("PSYCHOSTATS_PAGE", true);
define("PSYCHOSTATS_ADMIN_PAGE", true);
include "../includes/common.php";
include "./common.php";
// for now, redirect to the logsources
gotopage('logsources.php');
$cms->crumb('Manage', ps_url_wrapper($_SERVER['REQUEST_URI']));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php')));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
//$cms->theme->add_js('js/jquery.interface.js');
//$cms->theme->add_js('js/forms.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例5: array
// weapons
// re-arrange the weapons list so the uniqueid of each weapon is a key.
// weapon uniqueid's should never have any weird characters so this should be safe.
$ary = array();
foreach ($player['weapons'] as $w) {
$ary[$w['uniqueid']] = $w;
}
print_xml($ary);
}
$rolepager = "";
if ($ps->use_roles) {
$rolepager = pagination(array('baseurl' => ps_url_wrapper(array('id' => $id, 'rlimit' => $rlimit, 'rsort' => $rsort, 'rorder' => $rorder)), 'total' => $player['totalroles'], 'start' => $rstart, 'startvar' => 'rstart', 'perpage' => $rlimit, 'urltail' => 'roles', 'separator' => ' ', 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous"), 'pergroup' => 5));
}
$victimpager = pagination(array('baseurl' => ps_url_wrapper(array('id' => $id, 'vlimit' => $vlimit, 'vsort' => $vsort, 'vorder' => $vorder)), 'total' => $player['totalvictims'], 'start' => $vstart, 'startvar' => 'vstart', 'perpage' => $vlimit, 'urltail' => 'victims', 'separator' => ' ', 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous"), 'pergroup' => 5));
$mappager = pagination(array('baseurl' => ps_url_wrapper(array('id' => $id, 'mlimit' => $mlimit, 'msort' => $msort, 'morder' => $morder)), 'total' => $player['totalmaps'], 'start' => $mstart, 'startvar' => 'mstart', 'perpage' => $mlimit, 'urltail' => 'maps', 'separator' => ' ', 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
$sessionpager = pagination(array('baseurl' => ps_url_wrapper(array('id' => $id, 'slimit' => $slimit, 'ssort' => $ssort, 'sorder' => $sorder)), 'total' => $player['totalsessions'], 'start' => $sstart, 'startvar' => 'sstart', 'perpage' => $slimit, 'urltail' => 'sessions', 'separator' => ' ', 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
// build a dynamic table that plugins can use to add custom columns of data
$wtable = $cms->new_table($player['weapons']);
$wtable->if_no_data($cms->trans("No Weapons Found"));
$wtable->attr('class', 'ps-table ps-weapon-table');
$wtable->sort_baseurl(array('id' => $id, '_anchor' => 'weapons'));
$wtable->start_and_sort($wstart, $wsort, $worder, 'w');
$wtable->columns(array('uniqueid' => array('label' => $cms->trans("Weapon"), 'callback' => 'ps_table_weapon_link'), 'kills' => array('label' => $cms->trans("Kills"), 'modifier' => 'commify'), 'deaths' => array('label' => $cms->trans("Deaths"), 'modifier' => 'commify'), 'headshotkills' => array('label' => $cms->trans("HS"), 'modifier' => 'commify', 'tooltip' => $cms->trans("Headshot Kills")), 'headshotkillspct' => array('label' => $cms->trans("HS%"), 'modifier' => '%s%%', 'tooltip' => $cms->trans("Headshot Kills Percentage")), 'accuracy' => array('label' => $cms->trans("Acc"), 'modifier' => '%s%%', 'tooltip' => $cms->trans("Accuracy")), 'shotsperkill' => array('label' => $cms->trans("S:K"), 'tooltip' => $cms->trans("Shots Per Kill")), 'damage' => array('label' => $cms->trans("Dmg"), 'callback' => 'dmg', 'tooltip' => $cms->trans("Damage"))));
$wtable->column_attr('uniqueid', 'class', 'first');
$ps->player_weapons_table_mod($wtable);
$cms->filter('player_weapon_table_object', $wtable);
// build player session table
$stable = $cms->new_table($player['sessions']);
$stable->if_no_data($cms->trans("No Sessions Found"));
$stable->attr('class', 'ps-table ps-session-table');
$stable->sort_baseurl(array('id' => $id, '_anchor' => 'sessions'));
示例6: array
}
if (!in_array($sort, array('name', 'skill', 'username', 'allowrank'))) {
$sort = 'name';
}
$_order = array('start' => $start, 'limit' => $limit, 'order' => $order, 'sort' => $sort, 'filter' => $filter, 'allowall' => (bool) $all);
// delete selected players
if (is_array($del) and count($del)) {
$total_deleted = 0;
foreach ($del as $id) {
if (is_numeric($id)) {
if ($ps->delete_player($id)) {
$total_deleted++;
}
}
}
$message = $cms->message('success', array('message_title' => $cms->trans("Players Deleted!"), 'message' => $cms->trans("%d players were deleted successfully", $total_deleted)));
}
$players = $ps->get_basic_player_list($_order);
$total = $ps->get_total_players($_order);
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit, 'filter' => $filter, 'all' => $all ? 1 : 0)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Players', ps_url_wrapper(array('_base' => $PHP_SELF)));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php'), 'players' => $players, 'pager' => $pager));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_js('js/players.js');
$cms->theme->add_js('js/message.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例7: substr
$f = $ps->db->escape($filter, false);
$where = "WHERE (gametype LIKE '%{$f}' OR modtype LIKE '%{$f}%' OR eventname LIKE '%{$f}%') ";
}
$list = $ps->db->fetch_rows(1, "SELECT * FROM {$ps->t_config_events} {$where}" . $ps->getsortorder($_order));
$total = $ps->db->count($ps->t_config_events, '*', $where ? substr($where, 6) : null);
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit, 'filter' => $filter)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
// massage the array a bit so we don't have to do the logic in the theme template
$events = array();
$first = $list ? $list[0]['id'] : array();
$last = $list ? $list[count($list) - 1]['id'] : array();
foreach ($list as $ev) {
if ($ev['id'] == $first) {
$ev['down'] = 1;
} elseif ($ev['id'] == $last) {
$ev['up'] = 1;
} else {
$ev['down'] = 1;
$ev['up'] = 1;
}
$events[] = $ev;
}
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Events', ps_url_wrapper(array('_base' => 'events.php')));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php'), 'events' => $events, 'pager' => $pager));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_js('js/events.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例8: ps_url_wrapper
// fill in defaults
if (!$test) {
if ($id) {
$form->input($log);
if (empty($log['password'])) {
$form->input['blank'] = 1;
}
} else {
// new logsources should default to being enabled
$form->input['enabled'] = 1;
$form->input['defaultmap'] = 'unknown';
}
}
}
$cms->crumb('Manage', ps_url_wrapper('manage.php'));
$cms->crumb('Log Sources', ps_url_wrapper('logsources.php'));
$cms->crumb('Edit');
// save a new form key in the users session cookie
// this will also be put into a 'hidden' field in the form
if ($ps->conf['main']['security']['csrf_protection']) {
$cms->session->key($form->key());
}
$cms->theme->assign(array('protocols' => $protocols, 'errors' => $form->errors(), 'log' => $log, 'form' => $form->values(), 'form_key' => $ps->conf['main']['security']['csrf_protection'] ? $cms->session->key() : ''));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/forms.css');
//$cms->theme->add_js('js/jquery.interface.js');
$cms->theme->add_js('js/forms.js');
$cms->theme->add_js('js/logsources.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
function val_type($var, $value, &$form)
示例9: catfile
// ignore dot and hidden files
if (!preg_match("/{$match}/", $file)) {
continue;
}
// ignore files not matching the search_ext
$full = catfile($dir, $file);
$icons[] = array('filename' => $file, 'fullfile' => $full, 'size' => @filesize($full), 'is_writable' => is_writable($full) || is_writable(dirname($full)), 'basename' => basename($file), 'path' => $dir);
}
closedir($dh);
}
}
if (!is_writable($dir)) {
$msg_not_writable = $cms->message('not_writable', array('message_title' => $cms->trans("Permissions Error!"), 'message' => $cms->trans("The icons directory is not writable.") . ' ' . $cms->trans("You can not upload any new icons until the permissions are corrected.")));
}
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Icon Avatars', ps_url_wrapper(array('_base' => 'icons.php')));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php'), 'icons' => $icons, 'message' => $message, 'icons_url' => $ps->conf['theme']['icons_url'], 'form' => $form ? $form->values() : array(), 'errors' => $form ? $form->errors() : array()));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_css('css/icons.css');
//$cms->theme->add_js('js/jquery.interface.js');
$cms->theme->add_js('js/icons.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
function validate_img($file)
{
global $form, $cms, $ps;
$c = $ps->conf['theme']['icons'];
$ext = $ps->conf['theme']['images']['search_ext'];
示例10: gotopage
// auto-redirect to the exact player matched in the search
// if a single player was found.
if ($search and $results['abs_total'] == 1 and is_numeric($results['results'])) {
gotopage(ps_url_wrapper(array('_amp' => '&', '_base' => 'player.php', 'id' => $results['results'])));
}
// fetch stats, etc...
$players = $ps->get_player_list(array('results' => $results, 'sort' => $sort, 'order' => $order, 'start' => $start, 'limit' => $limit, 'joinclaninfo' => false));
$baseurl = array('sort' => $sort, 'order' => $order, 'limit' => $limit);
if ($search) {
$baseurl['search'] = $search;
} else {
if ($q != '') {
$baseurl['q'] = $q;
}
}
$pager = pagination(array('baseurl' => ps_url_wrapper($baseurl), 'total' => $total['ranked'], 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
// build a dynamic table that plugins can use to add custom columns of data
$table = $cms->new_table($players);
$table->if_no_data($cms->trans("No Players Found"));
$table->attr('class', 'ps-table ps-player-table');
$table->sort_baseurl($search ? array('search' => $search) : array('q' => $q));
$table->start_and_sort($start, $sort, $order);
$table->columns(array('rank' => array('label' => $cms->trans("Rank"), 'callback' => 'dash_if_empty'), 'prevrank' => array('nolabel' => true, 'callback' => 'rankchange'), 'name' => array('label' => $cms->trans("Player"), 'callback' => 'ps_table_plr_link'), 'kills' => array('label' => $cms->trans("Kills"), 'modifier' => 'commify'), 'deaths' => array('label' => $cms->trans("Deaths"), 'modifier' => 'commify'), 'killsperdeath' => array('label' => $cms->trans("K:D"), 'tooltip' => $cms->trans("Kills Per Death")), 'headshotkills' => array('label' => $cms->trans("HS"), 'modifier' => 'commify', 'tooltip' => $cms->trans("Headshot Kills")), 'headshotkillspct' => array('label' => $cms->trans("HS%"), 'modifier' => '%s%%', 'tooltip' => $cms->trans("Headshot Kills Percentage")), 'onlinetime' => array('label' => $cms->trans("Online"), 'modifier' => 'compacttime'), 'activity' => array('label' => $cms->trans("Activity"), 'modifier' => 'activity_bar'), 'skill' => array('label' => $cms->trans("Skill"), 'callback' => 'plr_skill')));
$table->column_attr('name', 'class', 'left');
$table->column_attr('skill', 'class', 'right');
//$table->column_attr('rank', 'class', 'left');
$table->header_attr('rank', 'colspan', '2');
$ps->index_table_mod($table);
$cms->filter('players_table_object', $table);
// assign variables to the theme
$cms->theme->assign(array('q' => $q, 'search' => $search, 'results' => $results, 'search_blurb' => $cms->trans('Search criteria "<em>%s</em>" matched %d ranked players out of %d total', ps_escape_html($q), $total['ranked'], $total['absolute']), 'players' => $players, 'players_table' => $table->render(), 'total' => $total, 'pager' => $pager, 'language_list' => $cms->theme->get_language_list(), 'theme_list' => $cms->theme->get_theme_list(), 'language' => $cms->theme->language));
示例11: pagination
function pagination($args = array())
{
$args += array('baseurl' => '', 'total' => 0, 'perpage' => 100, 'start' => 0, 'startvar' => 'start', 'pergroup' => 3, 'force_prev_next' => false, 'urltail' => '', 'prefix' => '', 'next' => 'Next', 'prev' => 'Previous', 'separator' => ', ', 'middle_separator' => ' ... ');
$total = ceil($args['total'] / $args['perpage']);
// calculate total pages needed for dataset
$current = floor($args['start'] / $args['perpage']) + 1;
// what page we're currently on
if ($total <= 1) {
return "";
}
// There's no pages to output, so we output nothing
if ($args['pergroup'] < 3) {
$args['pergroup'] = 3;
}
// pergroup can not be lower than 3
if ($args['pergroup'] % 2 == 0) {
$args['pergroup']++;
}
// pergroup is EVEN, so we add 1 to make it ODD
$maxlinks = $args['pergroup'] * 3 + 1;
$halfrange = floor($args['pergroup'] / 2);
$minrange = $current - $halfrange;
// gives us our current min/max ranges based on $current page
$maxrange = $current + $halfrange;
$output = "";
if ($total > $maxlinks) {
// create first group of links ...
$list = array();
for ($i = 1; $i <= $args['pergroup']; $i++) {
if ($i == $current) {
$list[] = "<span class='pager-current'>{$i}</span>";
} else {
$list[] = sprintf("<a href='%s' class='pager-goto'>%d</a>", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => ($i - 1) * $args['perpage'], '_anchor' => $args['urltail'])), $i);
}
}
$output .= implode($args['separator'], $list);
// create middle group of links ...
if ($maxrange > $args['pergroup']) {
$output .= $minrange > $args['pergroup'] + 1 ? $args['middle_separator'] : $args['separator'];
$min = $minrange > $args['pergroup'] + 1 ? $minrange : $args['pergroup'] + 1;
$max = $maxrange < $total - $args['pergroup'] ? $maxrange : $total - $args['pergroup'];
$list = array();
for ($i = $min; $i <= $max; $i++) {
if ($i == $current) {
$list[] = "<span class='pager-current'>{$i}</span>";
} else {
$list[] = sprintf("<a href='%s' class='pager-goto'>%d</a>", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => ($i - 1) * $args['perpage'], '_anchor' => $args['urltail'])), $i);
}
}
$output .= implode($args['separator'], $list);
$output .= $maxrange < $total - $args['pergroup'] ? $args['middle_separator'] : $args['separator'];
} else {
$output .= $args['middle_separator'];
}
// create last group of links ...
$list = array();
for ($i = $total - $args['pergroup'] + 1; $i <= $total; $i++) {
if ($i == $current) {
$list[] = "<span class='pager-current'>{$i}</span>";
} else {
$list[] = sprintf("<a href='%s' class='pager-goto'>%d</a>", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => ($i - 1) * $args['perpage'], '_anchor' => $args['urltail'])), $i);
}
}
$output .= implode($args['separator'], $list);
} else {
$list = array();
for ($i = 1; $i <= $total; $i++) {
if ($i == $current) {
$list[] = "<span class='pager-current'>{$i}</span>";
} else {
$list[] = sprintf("<a href='%s' class='pager-goto'>%d</a>", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => ($i - 1) * $args['perpage'], '_anchor' => $args['urltail'])), $i);
}
}
$output .= implode($args['separator'], $list);
}
// create 'Prev/Next' links
if ($args['force_prev_next'] and $total or $current > 1) {
if ($current > 1) {
$output = sprintf("<a href='%s' class='pager-prev'>%s</a> ", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => ($current - 2) * $args['perpage'], '_anchor' => $args['urltail'])), $args['prev']) . $output;
} else {
$output = "<span class='pager-prev'>" . $args['prev'] . "</span> " . $output;
}
}
if ($args['force_prev_next'] and $total or $current < $total) {
if ($current < $total) {
$output .= sprintf(" <a href='%s' class='pager-next'>%s</a> ", ps_url_wrapper(array('_base' => $args['baseurl'], $args['startvar'] => $current * $args['perpage'], '_anchor' => $args['urltail'])), $args['next']);
} else {
$output .= " <span class='pager-next'>" . $args['next'] . "</span>";
}
}
if ($args['prefix'] != '' and !empty($output)) {
$output = $args['prefix'] . $output;
}
return "<span class='pager'>{$output}</span>";
}
示例12: pagination
exit;
}
}
$list = $ps->db->fetch_rows(1, "SELECT * FROM {$ps->t_config_servers} " . $ps->getsortorder($_order));
$total = $ps->db->count($ps->t_config_servers);
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
// massage the array a bit so we don't have to do the logic in the theme template
$servers = array();
$first = $list ? $list[0]['id'] : array();
$last = $list ? $list[count($list) - 1]['id'] : array();
foreach ($list as $log) {
if ($log['id'] == $first) {
$log['down'] = 1;
} elseif ($log['id'] == $last) {
$log['up'] = 1;
} else {
$log['down'] = 1;
$log['up'] = 1;
}
$servers[] = $log;
}
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Servers', ps_url_wrapper(array('_base' => 'servers.php')));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php'), 'servers' => $servers, 'pager' => $pager));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_js('js/servers.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例13: unset
unset($submit);
}
$list = $ps->db->fetch_rows(1, "SELECT * FROM {$ps->t_config_clantags} " . $ps->getsortorder($_order));
$total = $ps->db->count($ps->t_config_clantags);
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
// massage the tags array a bit so we don't have to do the logic in the theme template
$tags = array();
$first = $list ? $list[0]['id'] : array();
$last = $list ? $list[count($list) - 1]['id'] : array();
foreach ($list as $tag) {
if ($tag['id'] == $first) {
$tag['down'] = 1;
} elseif ($tag['id'] == $last) {
$tag['up'] = 1;
} else {
$tag['down'] = 1;
$tag['up'] = 1;
}
$tags[] = $tag;
}
$cms->crumb('Manage', ps_url_wrapper(array('_base' => 'manage.php')));
$cms->crumb('Clan Tags', ps_url_wrapper(array('_base' => 'clantags.php')));
// assign variables to the theme
$cms->theme->assign(array('page' => basename(__FILE__, '.php'), 'clantags' => $tags, 'pager' => $pager));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/2column.css');
$cms->theme->add_css('css/forms.css');
//$cms->theme->add_js('js/jquery.interface.js');
$cms->theme->add_js('js/forms.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例14: array
$res = 'failure';
$msg = $cms->trans("Error writting to database: %s", $ps->db->errstr);
}
}
}
if ($msg) {
$message = $cms->message($res, array('message_title' => $title, 'message' => $msg));
}
}
// load the themes
$list = $ps->db->fetch_rows(1, "SELECT * FROM {$ps->t_config_themes} " . $ps->getsortorder($_order));
$total = $ps->db->count($ps->t_config_themes);
$themes = array();
foreach ($list as $t) {
if ($t['parent']) {
$themes[$t['parent']]['children'][] = $t;
} else {
$themes[$t['name']] = $t;
$themes[$t['name']]['children'] = array();
}
}
$pager = pagination(array('baseurl' => ps_url_wrapper(array('sort' => $sort, 'order' => $order, 'limit' => $limit)), 'total' => $total, 'start' => $start, 'perpage' => $limit, 'pergroup' => 5, 'separator' => ' ', 'force_prev_next' => true, 'next' => $cms->trans("Next"), 'prev' => $cms->trans("Previous")));
$cms->crumb("Themes", ps_url_wrapper());
// assign variables to the theme
$cms->theme->assign(array('url' => $url, 'allow' => $allow, 'newtheme' => $newtheme->theme_xml(), 'theme_dirs' => $newtheme->theme_dirs(), 'themes' => $themes, 'total_themes' => $total, 'submit' => $submit, 'confirm' => $confirm, 'page' => basename(__FILE__, '.php')));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/forms.css');
$cms->theme->add_js('js/themes.js');
$cms->theme->add_js('js/message.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');
示例15: previouspage
$input['weaponid'] = $ps->db->next_id($ps->t_weapon, 'weaponid');
$ok = $ps->db->insert($ps->t_weapon, $input);
}
if (!$ok) {
$form->error('fatal', "Error updating database: " . $ps->db->errstr);
} else {
previouspage(ps_url_wrapper('weapons.php'));
}
}
} else {
// fill in defaults
if ($id) {
$form->input($weapon);
}
}
$cms->crumb('Manage', ps_url_wrapper('manage.php'));
$cms->crumb('Weapons', ps_url_wrapper('weapons.php'));
$cms->crumb('Edit');
// save a new form key in the users session cookie
// this will also be put into a 'hidden' field in the form
if ($ps->conf['main']['security']['csrf_protection']) {
$cms->session->key($form->key());
}
$cms->theme->assign(array('errors' => $form->errors(), 'weapon' => $weapon, 'form' => $form->values(), 'form_key' => $ps->conf['main']['security']['csrf_protection'] ? $cms->session->key() : ''));
// display the output
$basename = basename(__FILE__, '.php');
$cms->theme->add_css('css/forms.css');
//$cms->theme->add_js('js/jquery.interface.js');
$cms->theme->add_js('js/weapons.js');
$cms->theme->add_js('js/forms.js');
$cms->full_page($basename, $basename, $basename . '_header', $basename . '_footer', '');