本文整理汇总了PHP中cot_import_pagenav函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_import_pagenav函数的具体用法?PHP cot_import_pagenav怎么用?PHP cot_import_pagenav使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_import_pagenav函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Список писем в очереди на отправку
* @return string
* @throws Exception
*/
public function indexAction()
{
global $admintitle, $adminpath, $Ls;
$admintitle = cot::$L['subscribe_queue'];
$adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'n' => 'queue')), $admintitle);
$sort = cot_import('s', 'G', 'ALP');
// order field name
$way = cot_import('w', 'G', 'ALP', 4);
// order way (asc, desc)
$maxrowsperpage = cot::$cfg['maxrowsperpage'];
if ($maxrowsperpage < 1) {
$maxrowsperpage = 1;
}
list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
//page number for pages list
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.queue.list.first') as $pl) {
include $pl;
}
/* ===== */
$sort = empty($sort) ? 'id' : $sort;
$way = empty($way) || !in_array($way, array('asc', 'desc')) ? 'asc' : $way;
$urlParams = array('m' => 'subscribe', 'n' => 'queue');
if ($sort != 'id') {
$urlParams['s'] = $sort;
}
if ($way != 'asc') {
$urlParams['w'] = $way;
}
$where = array();
// Фильтры
$allowedFilters = array('sid', 'to_name', 'to_email');
$f = cot_import('f', 'G', 'ARR');
$filterForm = array('hidden' => '');
if (!empty($f)) {
foreach ($f as $key => $val) {
if (!in_array($key, $allowedFilters)) {
unset($f[$key]);
}
}
if (!empty($f['sid'])) {
$where['sid'] = array('subscribe', $f['sid']);
$urlParams['f[sid]'] = $f['sid'];
}
if (!empty($f['to_name'])) {
$where['to_name'] = array('to_name', '*' . $f['to_name'] . '*');
$urlParams['f[to_name]'] = $f['to_name'];
}
if (!empty($f['to_email'])) {
$where['to_email'] = array('to_email', '*' . $f['to_email'] . '*');
$urlParams['f[to_email]'] = $f['to_email'];
}
}
if (isset(cot::$cfg['plugin']['urleditor']) && cot::$cfg['plugin']['urleditor']['preset'] != 'handy') {
$filterForm['hidden'] .= cot_inputbox('hidden', 'm', 'subscribe');
}
$filterForm['hidden'] .= cot_inputbox('hidden', 'n', 'queue');
$condition = array();
foreach ($where as $key => $val) {
$condition[] = $val;
}
$order = array(array($sort, $way));
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.queue.list.query') as $pl) {
include $pl;
}
/* ===== */
$totallines = subscribe_model_Queue::count($condition);
$items = null;
if ($totallines > 0) {
$items = subscribe_model_Queue::find($condition, $maxrowsperpage, $d, $order);
}
// Если передан номер страницы превышающий максимальный
if (empty($items) && $totallines > 0 && $pg > 1) {
$totalpages = ceil($totallines / $maxrowsperpage);
$args = $urlParams;
if ($totalpages > 1) {
if (cot::$cfg['easypagenav']) {
$args['d'] = $totalpages;
} else {
$args['d'] = ($totalpages - 1) * $maxrowsperpage;
}
}
cot_redirect(cot_url('admin', $args, '', true));
}
//$addNewUrl = cot_url('admin', array('m'=>'subscribe','a' => 'edit'));
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.queue.list.main') as $pl) {
include $pl;
}
/* ===== */
$pagenav = cot_pagenav('admin', $urlParams, $d, $totallines, $maxrowsperpage, 'd', '', true);
if (empty($pagenav['current'])) {
$pagenav['current'] = 1;
}
//.........这里部分代码省略.........
示例2: defined
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'trashcan');
cot_block($usr['isadmin']);
require_once cot_incfile('users', 'module');
cot_module_active('page') && (require_once cot_incfile('page', 'module'));
cot_module_active('forums') && (require_once cot_incfile('forums', 'module'));
$cfg['comments'] && (require_once cot_incfile('comments', 'plug'));
require_once cot_incfile('trashcan', 'plug');
require_once cot_langfile('trashcan', 'plug');
$adminhelp = $L['adm_help_trashcan'];
$adminsubtitle = $L['Trashcan'];
$id = cot_import('id', 'G', 'INT');
$maxperpage = $cfg['maxrowsperpage'] && is_numeric($cfg['maxrowsperpage']) && $cfg['maxrowsperpage'] > 0 ? $cfg['maxrowsperpage'] : 15;
list($pg, $d, $durl) = cot_import_pagenav('d', $maxperpage);
$info = $a == 'info' ? 1 : 0;
/* === Hook === */
foreach (cot_getextplugins('trashcan.admin.first') as $pl) {
include $pl;
}
/* ===== */
if ($a == 'wipe') {
cot_check_xg();
/* === Hook === */
foreach (cot_getextplugins('trashcan.admin.wipe') as $pl) {
include $pl;
}
/* ===== */
cot_trash_delete($id);
cot_message('adm_trashcan_deleted');
示例3: cot_incfile
$ajax = true;
}
if (empty($id) && $usr['id'] > 0) {
$id = $usr['id'];
}
if ($urr['user_id'] != $id) {
$sql = $db->query("SELECT user_id FROM {$db_users} WHERE user_id='{$id}' LIMIT 1");
if ($sql->rowCount() == 0) {
$disable = true;
} else {
$urr['user_id'] = $id;
}
}
if ($cot_modules['forums'] && !$disable) {
require_once cot_incfile('forums', 'module');
list($pnf, $df, $df_url) = cot_import_pagenav('df', $cfg['plugin']['userlatestposts']['countonpage']);
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_forum_posts} p, {$db_forum_topics} t\tWHERE fp_posterid='" . $urr['user_id'] . "' AND p.fp_topicid=t.ft_id")->fetchColumn();
if ($cfg['plugin']['userlatestposts']['ajax']) {
$upf_ajax_begin = "<div id='reloadf'>";
$upf_ajax_end = "</div>";
}
$pagenav = cot_pagenav('users', 'm=details&id=' . $urr['user_id'], $df, $totalitems, $cfg['plugin']['userlatestposts']['countonpage'], 'df', '', $cfg['plugin']['userlatestposts']['ajax'], "reloadf", 'plug', "r=userlatestposts&id=" . $urr['user_id']);
$sqluserlatestposts = $db->query("SELECT p.fp_id, p.fp_topicid, p.fp_updated, t.ft_title, t.ft_id, t.ft_cat\n\t\t FROM {$db_forum_posts} p, {$db_forum_topics} t\n\t\t WHERE fp_posterid='" . $urr['user_id'] . "'\n\t\t AND p.fp_topicid=t.ft_id\n\t\t GROUP BY t.ft_id\n\t\t ORDER BY fp_updated DESC\n\t\t LIMIT {$df}, " . $cfg['plugin']['userlatestposts']['countonpage']);
if ($sqluserlatestposts->rowCount() == 0) {
$user_posts->parse("USERLATESTPOSTS.NONE");
} else {
$ii = 0;
while ($row = $sqluserlatestposts->fetch()) {
if (cot_auth('forums', $row['ft_cat'], 'R')) {
$ii++;
$build_forum = cot_breadcrumbs(cot_forums_buildpath($row['ft_cat'], false), false);
示例4: defined
*/
/**
* market module
*
* @package market
* @version 2.5.2
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('market', 'module');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('market', 'any', 'RWA');
$tab = cot_import('tab', 'G', 'ALP');
$category = $tab == 'market' ? cot_import('cat', 'G', 'TXT') : '';
list($pg, $d, $durl) = cot_import_pagenav('dmarket', $cfg['market']['cat___default']['maxrowsperpage']);
//маркет вкладка
$t1 = new XTemplate(cot_tplfile(array('market', 'userdetails'), 'module'));
$t1->assign(array("ADDPRD_URL" => cot_url('market', 'm=add'), "PRD_ADDPRD_URL" => cot_url('market', 'm=add'), "ADDPRD_SHOWBUTTON" => $usr['auth_write'] ? true : false, "RPD_ADDPRD_SHOWBUTTON" => $usr['auth_write'] ? true : false));
$where = array();
$order = array();
if ($usr['id'] == 0 || $usr['id'] != $urr['user_id'] && !$usr['isadmin']) {
$where['state'] = "item_state=0";
}
if ($category) {
$where['cat'] = 'item_cat=' . $db->quote($category);
}
$where['owner'] = "item_userid=" . $urr['user_id'];
$order['date'] = "item_date DESC";
$wherecount = $where;
if ($wherecount['cat']) {
示例5: defined
<?php
/**
* projects module
*
* @package projects
* @version 2.5.2
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL.');
$userid = cot_import('userid', 'G', 'INT');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin'], $usr['auth_offers']) = cot_auth('projects', $item['item_cat'], 'RWA1');
if ($cfg['projects']['offersperpage'] > 0) {
list($pn, $d, $d_url) = cot_import_pagenav('d', $cfg['projects']['offersperpage']);
}
/* @var $db CotDB */
/* @var $cache Cache */
/* @var $t Xtemplate */
if ($a == 'addoffer') {
cot_shield_protect();
$sql = $db->query("SELECT * FROM {$db_projects_offers} WHERE offer_pid=" . $id . " AND offer_userid=" . $usr['id'] . "");
cot_block($usr['auth_offers'] && $sql->fetchColumn() == 0 && $usr['id'] != $item['item_userid']);
/* === Hook === */
foreach (cot_getextplugins('projects.offers.add.first') as $pl) {
include $pl;
}
/* ===== */
$roffer['offer_cost_min'] = (int) cot_import('costmin', 'P', 'NUM');
$roffer['offer_cost_max'] = (int) cot_import('costmax', 'P', 'NUM');
示例6: defined
*/
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
if (cot_module_active('page')) {
require_once cot_incfile('page', 'module');
}
if (cot_module_active('forums')) {
require_once cot_incfile('forums', 'module');
}
require_once cot_incfile('search', 'plug');
require_once cot_incfile('forms');
$sq = cot_import('sq', 'R', 'TXT');
$sq = $db->prep($sq);
$hl = urlencode(mb_strtoupper($sq));
$tab = cot_import('tab', 'R', 'ALP');
$cfg_maxitems = is_numeric($cfg['plugin']['search']['maxitems']) ? abs(floor($cfg['plugin']['search']['maxitems'])) : 50;
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg_maxitems);
$totalitems = array();
$pag_catauth = array();
$frm_catauth = array();
$rs = $_REQUEST['rs'];
$rs['pagtitle'] = cot_import($rs['pagtitle'], 'D', 'INT');
$rs['pagdesc'] = cot_import($rs['pagdesc'], 'D', 'INT');
$rs['pagtext'] = cot_import($rs['pagtext'], 'D', 'INT');
$rs['pagfile'] = cot_import($rs['pagfile'], 'D', 'INT');
$rs['pagsort'] = cot_import($rs['pagsort'], 'D', 'ALP');
$rs['pagsort'] = empty($rs['pagsort']) ? 'date' : $rs['pagsort'];
$rs['pagsort2'] = cot_import($rs['pagsort2'], 'D', 'ALP') == 'DESC' ? 'DESC' : 'ASC';
$rs['pagsub'] = cot_import($rs['pagsub'], 'D', 'ARR');
$rs['pagsubcat'] = cot_import($rs['pagsubcat'], 'D', 'BOL') ? 1 : 0;
$rs['frmtitle'] = cot_import($rs['frmtitle'], 'D', 'INT');
$rs['frmtext'] = cot_import($rs['frmtext'], 'D', 'INT');
示例7: cot_page_enum
/**
* Generates page list widget
* @param mixed $categories Custom parent categories code
* @param integer $count Number of items to show. 0 - all items
* @param string $template Path for template file
* @param string $order Sorting order (SQL)
* @param string $condition Custom selection filter (SQL)
* @param mixed $active_only Custom parent category code
* @param boolean $use_subcat Include subcategories TRUE/FALSE
* @param boolean $exclude_current Exclude the current page from the rowset for pages.
* @param string $blacklist Category black list, semicolon separated
* @param string $pagination Pagination symbol
* @param integer $cache_ttl Cache lifetime in seconds, 0 disables cache
* @return string Parsed HTML
*/
function cot_page_enum($categories = '', $count = 0, $template = '', $order = '', $condition = '', $active_only = true, $use_subcat = true, $exclude_current = false, $blacklist = '', $pagination = '', $cache_ttl = null)
{
global $db, $db_pages, $db_users, $structure, $cfg, $sys, $lang, $cache;
// Compile lists
if (!is_array($blacklist)) {
$blacklist = str_replace(' ', '', $blacklist);
$blacklist = !empty($blacklist) ? explode(',', $blacklist) : array();
}
// Get the cats
if (!empty($categories)) {
if (!is_array($categories)) {
$categories = str_replace(' ', '', $categories);
$categories = explode(',', $categories);
}
$categories = array_unique($categories);
if ($use_subcat) {
$total_categogies = array();
foreach ($categories as $cat) {
$cats = cot_structure_children('page', $cat, $use_subcat);
$total_categogies = array_merge($total_categogies, $cats);
}
$categories = array_unique($total_categogies);
}
$categories = count($blacklist) > 0 ? array_diff($categories, $blacklist) : $categories;
$where['cat'] = "page_cat IN ('" . implode("','", $cats) . "')";
} elseif (count($blacklist)) {
$where['cat_black'] = "page_cat NOT IN ('" . implode("','", $blacklist) . "')";
}
$where['condition'] = $condition;
if ($exclude_current && defined('COT_PAGES') && !defined('COT_LIST')) {
global $id;
$where['page_id'] = "page_id != {$id}";
}
if ($active_only) {
$where['state'] = "page_state=0";
$where['date'] = "page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']})";
}
// Get pagination number if necessary
if (!empty($pagination)) {
list($pg, $d, $durl) = cot_import_pagenav($pagination, $count);
} else {
$d = 0;
}
// Display the items
$mskin = file_exists($template) ? $template : cot_tplfile(array('page', 'enum', $template), 'module');
/* === Hook === */
foreach (cot_getextplugins('page.enum.query') as $pl) {
include $pl;
}
/* ===== */
if (cot_plugin_active('comments')) {
global $db_com;
require_once cot_incfile('comments', 'plug');
$cns_join_columns .= ", (SELECT COUNT(*) FROM `{$db_com}` WHERE com_area = 'page' AND com_code = p.page_id) AS com_count";
}
$sql_order = empty($order) ? 'ORDER BY page_date DESC' : "ORDER BY {$order}";
$sql_limit = $count > 0 ? "LIMIT {$d}, {$count}" : '';
$where = array_filter($where);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$sql_total = "SELECT COUNT(*) FROM {$db_pages} AS p {$cns_join_tables} {$where}";
$sql_query = "SELECT p.*, u.* {$cns_join_columns} FROM {$db_pages} AS p LEFT JOIN {$db_users} AS u ON p.page_ownerid = u.user_id\n\t\t\t{$cns_join_tables} {$where} {$sql_order} {$sql_limit}";
$t = new XTemplate($mskin);
isset($md5hash) || ($md5hash = 'page_enum_' . md5(str_replace($sys['now'], '_time_', $mskin . $lang . $sql_query)));
if ($cache && (int) $cache_ttl > 0) {
$page_query_html = $cache->disk->get($md5hash, 'page', (int) $cache_ttl);
if (!empty($page_query_html)) {
return $page_query_html;
}
}
$totalitems = $db->query($sql_total)->fetchColumn();
$sql = $db->query($sql_query);
$sql_rowset = $sql->fetchAll();
$jj = 0;
foreach ($sql_rowset as $pag) {
$jj++;
$t->assign(cot_generate_pagetags($pag, 'PAGE_ROW_'));
$t->assign(array('PAGE_ROW_NUM' => $jj, 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_RAW' => $pag));
$t->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
/* === Hook === */
foreach (cot_getextplugins('page.enum.loop') as $pl) {
include $pl;
}
/* ===== */
if (cot_plugin_active('comments')) {
$rowe_urlp = empty($pag['page_alias']) ? array('c' => $pag['page_cat'], 'id' => $pag['page_id']) : array('c' => $pag['page_cat'], 'al' => $pag['page_alias']);
//.........这里部分代码省略.........
示例8: cot_import
$opt = cot_import('opt', 'G', 'ALP');
// display option
$f = cot_import('f', 'G', 'INT');
// folder id
$c1 = cot_import('c1', 'G', 'ALP');
// form name
$c2 = cot_import('c2', 'G', 'ALP');
// input name
$parser = cot_import('parser', 'G', 'ALP');
// custom parser
$userid = cot_import('userid', 'G', 'INT');
// User ID or 0
$gd_supported = array('jpg', 'jpeg', 'png', 'gif');
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['pfs']['maxpfsperpage']);
// Page number files
list($pgf, $df) = cot_import_pagenav('df', $cfg['pfs']['maxpfsperpage']);
// page number folders
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('pfs', 'a');
cot_block($usr['auth_read']);
$sys['parser'] = empty($parser) ? $cfg['parser'] : $parser;
$pn_c1 = empty($c1) ? '' : '&c1=' . $c1;
$pn_c2 = empty($c2) ? '' : '&c2=' . $c2;
if (!$usr['isadmin'] || $userid === null) {
$userid = $usr['id'];
} else {
$more = 'userid=' . $userid;
}
$files_count = 0;
$folders_count = 0;
$standalone = FALSE;
$uid = $userid > 0 ? $userid : $usr['id'];
示例9: defined
* [BEGIN_COT_EXT]
* Hooks=index.tags
* [END_COT_EXT]
*/
/**
* projects module
*
* @package projects
* @version 2.5.2
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('projects', 'module');
list($pn, $p, $d_url) = cot_import_pagenav('p', $cfg['projects']['indexlimit']);
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', 'any', 'RWA');
$t_pr = new XTemplate(cot_tplfile('projects.index', 'module'));
if (is_array($projects_types)) {
foreach ($projects_types as $i => $pr_type) {
$t_pr->assign(array('PTYPE_ROW_ID' => $i, 'PTYPE_ROW_TITLE' => $pr_type, 'PTYPE_ROW_URL' => cot_url('projects', 'type=' . $i)));
$t_pr->parse("SEARCH.PTYPES.PTYPES_ROWS");
}
}
$t_pr->assign(array('PTYPE_ALL_URL' => cot_url('projects', ''), 'REALIZED_URL' => cot_url('projects', 'realized=1'), "FORPRO_URL" => cot_url('projects', 'forpro=1')));
$t_pr->parse("SEARCH.PTYPES");
$t_pr->assign(array('SEARCH_ACTION_URL' => cot_url('projects', '', '', true), 'SEARCH_SQ' => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_projects_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['projects_mostrelevant'], $L['projects_costasc'], $L['projects_costdesc']), false)));
foreach ($cot_extrafields[$db_projects] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, '');
$exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
示例10: indexAction
/**
* основная статистика кликов и показов
*/
public function indexAction()
{
global $admintitle, $adminpath, $structure;
$admintitle = cot::$L['brs_tracks'];
$adminpath[] = array(cot_url('admin', array('m' => 'brs', 'n' => 'track')), cot::$L['brs_tracks']);
$sortFields = array('b.title' => cot::$L['Title'], 'b.category' => cot::$L['Category'], 'b.client' => cot::$L['brs_client'], 't.type' => cot::$L['Type'], 't.track_count' => cot::$L['Count'], 't.date' => cot::$L['Date']);
$sort = cot_import('s', 'G', 'TXT');
// order field name
$way = cot_import('w', 'G', 'ALP', 4);
// order way (asc, desc)
$f = cot_import('f', 'G', 'ARR');
// filters
$f['date_from'] = cot_import_date('f_df', true, false, 'G');
$f['date_to'] = cot_import_date('f_dt', true, false, 'G');
$maxrowsperpage = cot::$cfg['maxrowsperpage'];
if ($maxrowsperpage < 1) {
$maxrowsperpage = 1;
}
list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
//page number for banners list
$sort = empty($sort) ? 't.date' : $sort;
$way = empty($way) || !in_array($way, array('asc', 'desc')) ? 'desc' : $way;
$urlParams = array('m' => 'brs', 'n' => 'track');
if ($sort != 't.date') {
$urlParams['s'] = $sort;
}
if ($way != 'desc') {
$urlParams['w'] = $way;
}
$where = array();
$params = array();
if (!empty($f)) {
foreach ($f as $key => $val) {
$val = trim(cot_import($val, 'D', 'TXT'));
if (empty($val) && $val !== '0') {
continue;
}
if (in_array($key, array('b.title'))) {
$kkey = str_replace('.', '_', $key);
$params[$kkey] = "%{$val}%";
$where['filter'][] = "{$key} LIKE :{$kkey}";
$urlParams["f[{$key}]"] = $val;
} elseif ($key == 'date_from') {
if ($f[$key] == 0) {
continue;
}
$where['filter'][] = "t.date >= '" . date('Y-m-d H:i:s', $f[$key]) . "'";
$urlParams["f_df[year]"] = cot_date('Y', $f[$key]);
$urlParams["f_df[month]"] = cot_date('m', $f[$key]);
$urlParams["f_df[day]"] = cot_date('d', $f[$key]);
} elseif ($key == 'date_to') {
if ($f[$key] == 0) {
continue;
}
$where['filter'][] = "t.date <= '" . date('Y-m-d H:i:s', $f[$key]) . "'";
$urlParams["f_dt[year]"] = cot_date('Y', $f[$key]);
$urlParams["f_dt[month]"] = cot_date('m', $f[$key]);
$urlParams["f_dt[day]"] = cot_date('d', $f[$key]);
} else {
$kkey = str_replace('.', '_', $key);
$params[$kkey] = $val;
$where['filter'][] = "{$key} = :{$kkey}";
$urlParams["f[{$key}]"] = $val;
}
}
empty($where['filter']) || ($where['filter'] = implode(' AND ', $where['filter']));
} else {
$f = array();
}
$orderby = "{$sort} {$way}";
$where = array_filter($where);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$sql = "SELECT `t`.`date`, `t`.`type` , `t`.`track_count`, `t`.`banner`, b.title, b.category, cl.title as client_title,\n cl.id as client_id\n FROM " . cot::$db->banner_tracks . " AS t\n LEFT JOIN " . cot::$db->banners . " AS b ON b.id=t.banner\n LEFT JOIN " . cot::$db->banner_clients . " AS cl ON cl.id=b.client\n {$where} ORDER BY {$orderby} LIMIT {$d}, {$maxrowsperpage}";
$sqlCount = "SELECT COUNT(*)\n FROM " . cot::$db->banner_tracks . " AS t\n LEFT JOIN " . cot::$db->banners . " AS b ON b.id=t.banner\n LEFT JOIN " . cot::$db->banner_clients . " AS cl ON cl.id=b.client\n {$where}";
$totallines = cot::$db->query($sqlCount, $params)->fetchColumn();
$sqllist = cot::$db->query($sql, $params);
// Без Ajax, а то дата пропадает (UI datetime)
$pagenav = cot_pagenav('admin', $urlParams, $d, $totallines, $maxrowsperpage);
$track_types = array(1 => cot::$L['brs_impressions'], 2 => cot::$L['brs_clicks']);
$items = $sqllist->fetchAll();
if ($items) {
foreach ($items as $key => $itemRow) {
$items[$key]['categoryTitle'] = '';
if (!empty($itemRow['category']) && !empty($structure['brs'][$itemRow['category']])) {
$items[$key]['categoryTitle'] = $structure['brs'][$itemRow['category']]['title'];
}
$items[$key]['track_typeTitle'] = $track_types[$itemRow['type']];
}
}
$clients = brs_model_Client::keyValPairs();
if (!$clients) {
$clients = array();
}
$filterForm = array('hidden' => cot_inputbox('hidden', 'n', 'track'), 'title' => array('element' => cot_inputbox('text', 'f[b.title]', $f['b.title']), 'label' => brs_model_Banner::fieldLabel('title')), 'category' => array('element' => brs_selectbox_structure('brs', $f['b.category'], 'f[b.category]', '', false, false, true), 'label' => brs_model_Banner::fieldLabel('category')), 'client' => array('element' => cot_selectbox($f['b.client'], 'f[b.client]', array_keys($clients), array_values($clients)), 'label' => brs_model_Banner::fieldLabel('client')), 'type' => array('element' => cot_selectbox($f['t.type'], 'f[t.type]', array_keys($track_types), array_values($track_types)), 'label' => cot::$L['Type']), 'date_from' => array('element' => cot_selectbox_date($f['date_from'], 'short', 'f_df'), 'label' => cot::$L['brs_from']), 'date_to' => array('element' => cot_selectbox_date($f['date_to'], 'short', 'f_dt'), 'label' => cot::$L['brs_to']), 'sort' => array('element' => cot_selectbox($sort, 's', array_keys($sortFields), array_values($sortFields), false), 'label' => cot::$L['adm_sort']), 'way' => array('element' => cot_selectbox($way, 'w', array('asc', 'desc'), array(cot::$L['Ascending'], cot::$L['Descending']), false)));
if (isset(cot::$cfg['plugin']['urleditor']) && cot::$cfg['plugin']['urleditor']['preset'] != 'handy') {
$filterForm['hidden'] .= cot_inputbox('hidden', 'm', 'brs');
}
//.........这里部分代码省略.........
示例11: defined
<?php
/**
* Users list
*
* @package Users
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') or die('Wrong URL');
$id = cot_import('id', 'G', 'INT');
$s = cot_import('s', 'G', 'ALP', 16);
$w = cot_import('w', 'G', 'ALP', 4);
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['users']['maxusersperpage']);
$f = cot_import('f', 'G', 'ALP', 16);
$g = cot_import('g', 'G', 'INT');
$gm = cot_import('gm', 'G', 'INT');
$y = cot_import('y', 'P', 'TXT', 16);
$sq = cot_import('sq', 'G', 'TXT', 16);
unset($localskin, $grpms);
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('users', 'a');
cot_block($usr['auth_read']);
require_once cot_langfile('users', 'module');
require_once cot_langfile('countries', 'core');
$users_sort_tags = array('id' => array('USERS_TOP_USERID', &$L['Userid']), 'name' => array('USERS_TOP_NAME', &$L['Username']), 'maingrp' => array('USERS_TOP_MAINGRP', &$L['Maingroup']), 'country' => array('USERS_TOP_COUNTRY', &$L['Country']), 'occupation' => array('USERS_TOP_OCCUPATION', &$L['Occupation']), 'location' => array('USERS_TOP_LOCATION', &$L['Location']), 'timezone' => array('USERS_TOP_TIMEZONE', &$L['Timezone']), 'birthdate' => array('USERS_TOP_BIRTHDATE', &$L['Birthdate']), 'gender' => array('USERS_TOP_GENDER', &$L['Gender']), 'regdate' => array('USERS_TOP_REGDATE', &$L['Registered']), 'lastlog' => array('USERS_TOP_LASTLOGGED', &$L['Lastlogged']), 'logcount' => array('USERS_TOP_LOGCOUNT', &$L['Count']), 'postcount' => array('USERS_TOP_POSTCOUNT', &$L['Posts']), 'grplevel' => array('USERS_TOP_GRPLEVEL', &$L['Level']), 'grpname' => array('USERS_TOP_GRPTITLE', &$L['Maingroup']));
$users_sort_blacklist = array('email', 'lastip', 'password', 'sid', 'sidtime', 'lostpass', 'auth', 'token');
$users_sort_whitelist = array('id', 'name', 'maingrp', 'country', 'timezone', 'birthdate', 'gender', 'lang', 'regdate');
/* === Hook === */
foreach (cot_getextplugins('users.first') as $pl) {
include $pl;
}
示例12: karma_error
$sql_injection = $db->query("UPDATE {$db_users} SET user_karma=user_karma + " . $value . " WHERE user_id={$recipient}");
$popup_body .= karma_error('karma_ms_ok', $L['karma_changed_ok'], $cfg['plugin']['karma']['close_win']);
break;
case 'moderate':
if (!cot_auth('plug', 'karma', 'A')) {
cot_diefatal($L['low_level']);
}
$karma_userid = $db->query("SELECT u.user_id,k.karma_value FROM cot_karma k LEFT JOIN {$db_users} u ON (u.user_id = k.karma_recipient) WHERE k.karma_id = {$fp} LIMIT 1 ")->fetch();
$db->query("DELETE FROM cot_karma WHERE karma_id = {$fp} LIMIT 1");
$db->query("UPDATE {$db_users} SET user_karma = user_karma -{$karma_userid['karma_value']} WHERE user_id = {$karma_userid['user_id']}");
$ku = cot_import('ku', 'G', 'INT');
$popup_body .= karma_error('karma_ms_ok', $L['karma_del_ok'], true);
break;
case 'show':
default:
list($pg, $kn) = cot_import_pagenav('kn', $cfg['plugin']['karma']['karma_maxpage']);
$tmp = $db->query("SELECT COUNT(*),SUM(karma_value) AS karma FROM cot_karma WHERE karma_recipient = {$fp}")->fetch();
$total_p = $tmp['COUNT(*)'];
if (cot_plugin_active('comments')) {
$sql = $db->query("SELECT u.*, k.*,c.com_code,c.com_id FROM cot_karma k LEFT JOIN {$db_users} u ON (u.user_id=k.karma_rater) LEFT JOIN {$db_com} c ON (c.com_id=k.karma_fp) WHERE k.karma_recipient = {$fp} ORDER BY k.karma_id DESC LIMIT {$kn}, " . $cfg['plugin']['karma']['karma_maxpage'] . "");
} else {
$sql = $db->query("SELECT u.*, k.* FROM cot_karma k LEFT JOIN {$db_users} u ON (u.user_id=k.karma_rater) WHERE k.karma_recipient = {$fp} ORDER BY k.karma_id DESC LIMIT {$kn}, " . $cfg['plugin']['karma']['karma_maxpage'] . "");
}
$sql1 = $db->query("SELECT * FROM {$db_users} WHERE user_id = {$fp} LIMIT 1");
$thiss = $sql1->fetch();
$karmaarr = explode(":", $thiss['user_karma_auth']);
$kr->assign(array("KARMA_NAME_USER" => $thiss['user_name'], "KARMA_USER_VALUE" => number_format($tmp['karma'], '1', '.', ' '), "KARMA_USER_KARMA_FULL" => number_format($thiss['user_karma'], '1', '.', ' '), "KARMA_USERS" => cot_declension($total_p, $L['userkarma']), "KARMA_ADMIN" => cot_auth('plug', 'karma', 'A') ? true : "", "KARMA_AUTH_VALUE" => number_format($karmaarr[1], '1', '.', ' '), "KARMA_AUTH_COUNT" => $karmaarr[2] ? cot_declension($karmaarr[2], $L['user_auth_dec']) : ''));
if ($cfg['plugin']['karma']['karma_profile']) {
$kr->assign(cot_generate_usertags($thiss, "KARMA_USER_PROFILE_"));
}
if ($total_p == 0 && $thiss['user_karma_auth'] == 0) {
示例13: indexAction
/**
* Список рассылок
*/
public function indexAction()
{
$maxrowsperpage = cot::$cfg['maxrowsperpage'];
if ($maxrowsperpage < 1) {
$maxrowsperpage = 1;
}
list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
//page number for pages list
$sort = 'title';
$way = 'asc';
/* === Hook === */
foreach (cot_getextplugins('subscribe.list.first') as $pl) {
include $pl;
}
/* ===== */
$urlParams = array();
$canonicalUrlParams = array();
if ($durl > 1) {
$canonicalUrlParams['d'] = $durl;
}
$where = array();
cot::$out['subtitle'] = $title = cot::$L['subscribe_subscribes'];
// Building the canonical URL
cot::$out['canonical_uri'] = cot_url('subscribe', $canonicalUrlParams);
$condition = array(array('active', 1), array('periodical', 1));
$order = array(array('active', 'desc'), array($sort, $way));
$userSubscribesCondition = array();
if (cot::$usr['id'] > 0) {
$userSubscribesCondition[] = array('active', 1);
$userSubscribesCondition[] = array('user', cot::$usr['id']);
if (!empty(cot::$usr['profile']['user_email'])) {
//$userSubscribesCondition[] = array('email', cot::$usr['profile']['user_email'], '=', 'OR');
$userSubscribesCondition = array(array('SQL', 'active=1 AND (user=' . cot::$usr['id'] . ' OR email=' . cot::$db->quote(cot::$usr['profile']['user_email']) . ')'));
}
}
/* === Hook === */
foreach (cot_getextplugins('subscribe.list.query') as $pl) {
include $pl;
}
/* ===== */
$totallines = subscribe_model_Subscribe::count($condition);
$items = null;
if ($totallines > 0) {
$items = subscribe_model_Subscribe::find($condition, $maxrowsperpage, $d, $order);
}
// Подписки пользователя
$userSubscribes = null;
$userSubscribesIds = array();
if (!empty($items)) {
if (cot::$usr['id'] > 0) {
$userSubscribes = subscribe_model_Subscriber::find($userSubscribesCondition, 0, 0, array(array('active', 'desc')));
if (!empty($userSubscribes)) {
foreach ($userSubscribes as $usRow) {
$userSubscribesIds[] = $usRow->rawValue('subscribe');
}
}
}
}
/* === Hook === */
foreach (cot_getextplugins('subscribe.list.main') as $pl) {
include $pl;
}
/* ===== */
if (cot::$usr['id'] > 0) {
Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/subscribe/js/subscriber.js');
}
$crumbs = array(cot::$L['subscribe_subscribes']);
$pagenav = cot_pagenav('subscribe', $urlParams, $d, $totallines, $maxrowsperpage);
if (empty($pagenav['current'])) {
$pagenav['current'] = 1;
}
$breadcrumbs = '';
if (!empty($crumbs)) {
$breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
}
$template = array('subscribe', 'list');
// $pageUrlParams = $urlParams;
// if($durl > 1) $pageUrlParams['d'] = $durl;
$view = new View();
$view->breadcrumbs = $breadcrumbs;
$view->page_title = htmlspecialchars($title);
$view->items = $items;
$view->userSubscribes = $userSubscribes;
$view->userSubscribesIds = $userSubscribesIds;
$view->totalitems = $totallines;
$view->pagenav = $pagenav;
$view->urlParams = $urlParams;
// $view->pageUrlParams = $pageUrlParams;
/* === Hook === */
foreach (cot_getextplugins('subscribe.list.view') as $pl) {
include $pl;
}
/* ===== */
return $view->render($template);
}
示例14: cot_import
$qs = cot_import('t', 'G', 'TXT');
if (empty($qs)) {
$qs = cot_import('t', 'P', 'TXT');
}
$qs = str_replace('-', ' ', $qs);
$tl = cot_import('tl', 'G', 'BOL');
if ($tl && file_exists(cot_langfile('translit', 'core'))) {
include_once cot_langfile('translit', 'core');
$qs = strtr($qs, $cot_translitb);
}
// Results per page
$maxperpage = $cfg['maxrowsperpage'] && is_numeric($cfg['maxrowsperpage']) && $cfg['maxrowsperpage'] > 0 ? $cfg['maxrowsperpage'] : 15;
list(, $d) = cot_import_pagenav('d', $maxperpage);
// Tags displayed per page in standalone cloud
$perpage = $cfg['plugin']['tags']['perpage'];
list(, $dt) = cot_import_pagenav('dt', $perpage);
// Array to register areas with tag functions provided
$tag_areas = array();
if (cot_module_active('page')) {
require_once cot_incfile('page', 'module');
$tag_areas[] = 'pages';
}
if (cot_module_active('forums')) {
require_once cot_incfile('forums', 'module');
$tag_areas[] = 'forums';
}
// Sorting order
$o = cot_import('order', 'P', 'ALP');
if (empty($o)) {
$o = mb_strtolower($cfg['plugin']['tags']['sort']);
}
示例15: define
define('COT_LIST', TRUE);
$env['location'] = 'list';
$s = cot_import('s', 'G', 'ALP');
// order field name without 'page_'
$w = cot_import('w', 'G', 'ALP', 4);
// order way (asc, desc)
$c = cot_import('c', 'G', 'TXT');
// cat code
$o = cot_import('ord', 'G', 'ARR');
// filter field names without 'page_'
$p = cot_import('p', 'G', 'ARR');
// filter values
$maxrowsperpage = $cfg['page']['cat_' . $c]['maxrowsperpage'] ? $cfg['page']['cat_' . $c]['maxrowsperpage'] : $cfg['page']['cat___default']['maxrowsperpage'];
list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
//page number for pages list
list($pgc, $dc, $dcurl) = cot_import_pagenav('dc', $cfg['page']['maxlistsperpage']);
// page number for cats list
if ($c == 'all' || $c == 'system') {
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('admin', 'a');
cot_block($usr['isadmin']);
} elseif ($c == 'unvalidated' || $c == 'saved_drafts') {
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('page', 'any');
cot_block($usr['auth_write']);
} elseif (!isset($structure['page'][$c])) {
cot_die_message(404, TRUE);
} else {
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('page', $c);
cot_block($usr['auth_read']);
}
/* === Hook === */
foreach (cot_getextplugins('page.list.first') as $pl) {