Exemplo n.º 1
0
 /**
  * Форма подписки на рассылку
  * @param $id
  * @param string $tpl
  *
  * @return string HTML code
  */
 public static function form($id, $tpl = 'subscribe.widget.form')
 {
     $subscribe = subscribe_model_Subscribe::getById($id);
     if ($subscribe) {
         Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/subscribe/js/subscriber.js');
     }
     $view = new View();
     $view->subscribe = $subscribe;
     if (empty($tpl)) {
         $tpl = array('subscribe', 'widget', 'form');
         if (!empty($subscribe) && !empty($subscribe->alias)) {
             $tpl[] = $subscribe->alias;
         }
     }
     return $view->render($tpl, 'module');
 }
Exemplo n.º 2
0
    $sqlfilter .= " AND pm_tostate = 0";
    $title[] = $L['pm_unread'];
} elseif ($filter == 'starred') {
    $sqlfilter .= $f == 'sentbox' ? " AND pm_fromstate = 2" : " AND pm_tostate = 2";
    $title[] = $L['pm_starred'];
}
/* === Hook === */
foreach (cot_getextplugins('pm.list.main') as $pl) {
    include $pl;
}
/* ===== */
/* === Title === */
$title_params = array('PM' => $L['Private_Messages'], 'COUNT' => $totalcount, 'BOX' => $subtitle);
$out['subtitle'] = cot_title('{BOX} ({COUNT}) - {PM}', $title_params);
$out['head'] .= $R['code_noindex'];
Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/pm/js/pm.js');
/* === Title === */
$totallines = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE {$sqlfilter}")->fetchColumn();
$elem = $f == 'sentbox' ? 'pm_touserid' : 'pm_fromuserid';
$pm_sql = $db->query("SELECT p.*, u.* FROM {$db_pm} AS p\n\t\tLEFT JOIN {$db_users} AS u\n\t\tON u.user_id = p.{$elem}\n\t\tWHERE {$sqlfilter}\n\t\tORDER BY pm_date DESC LIMIT  {$d}," . $cfg['pm']['maxpmperpage']);
$pagenav = cot_pagenav('pm', 'f=' . $f . '&filter=' . $filter, $d, $totallines, $cfg['pm']['maxpmperpage'], 'd', '', $cfg['pm']['turnajax']);
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate(cot_tplfile(array('pm', 'list', $pmalttpl)));
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('pm.list.loop');
/* ===== */
foreach ($pm_sql->fetchAll() as $row) {
    $jj++;
    $row['pm_icon_readstatus'] = $row['pm_tostate'] == '0' ? cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon_new'], array('title' => $L['pm_unread'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon'], array('title' => $L['pm_read'], 'class' => 'ajax'));
    $pm_data = cot_parse($row['pm_text'], $cfg['pm']['markup']);
Exemplo n.º 3
0
 /**
  * A shortcut for plain output of a link to a CSS/JS file in the header of the page
  *
  * @param string $path Stylesheet *.css or script *.js path/url
  * @param string $type
  * @param int $order
  * @return bool
  *
  * @throws Exception
  */
 public static function linkFile($path, $type = '', $order = 50)
 {
     // header.php executed. Try add file to footer
     if (static::$headerComplete) {
         return Resources::linkFileFooter($path, $type, $order);
     }
     $tmp = explode('?', $path);
     $fileName = $tmp[0];
     if (in_array($fileName, static::$addedFiles)) {
         return false;
     }
     if (mb_strpos($fileName, '@') === 0) {
         $fileName = static::$alias[$fileName];
     } elseif (mb_strpos($fileName, 'http://') === false && mb_strpos($fileName, 'https://') === false && mb_strpos($fileName, '//') !== 0) {
         if (!file_exists($fileName)) {
             throw new Exception('Resource file «' . $fileName . '» not exists');
         }
     }
     if (empty($type)) {
         $type = preg_match('#\\.(js|css)$#i', $fileName, $m) ? strtolower($m[1]) : 'js';
     }
     static::$addedFiles[] = $tmp[0];
     static::$headerRc[$type][$order][] = $path;
     foreach (static::additionalFiles($tmp[0]) as $file) {
         static::linkFile($file, '', $order);
     }
 }
Exemplo n.º 4
0
/**
 * A shortcut to append a JavaScript or CSS file to {FOOTER_JS} tag
 *
 * @global array $out Output snippets
 * @param string $path JavaScript or CSS file path
 *
 * @deprecated Will be removed in v.1.0. Resources::linkFileFooter() instead
 */
function cot_rc_link_footer($path)
{
    Resources::linkFileFooter($path);
}
Exemplo n.º 5
0
if ($f_miniput['f_choose'] == 'fthumbs') {
    $fclass = 'fancybox-thumbs';
    $fgroup = 'thumb';
}
$fa_conf = '$(document).ready(function() {$("a[href]").filter(function() {return /\\.(jpg|jpeg|png|gif)$/i.test(this.href);}).attr({"class":"' . $fclass . '","data-fancybox-group":"' . $fgroup . '"})});';
if ($f_miniput['f_scale']) {
    if (empty($f_miniput['f_scalelspx'])) {
        $scale_param[] = !empty($f_miniput['f_scalewpx']) ? 'w:"' . $f_miniput['f_scalewpx'] . 'px"' : '';
        $scale_param[] = !empty($f_miniput['f_scalehpx']) ? 'h:"' . $f_miniput['f_scalehpx'] . 'px"' : '';
        $scale_param = implode(', ', $scale_param);
    } else {
        $scale_param = 'ls:"' . $f_miniput['f_scalelspx'] . 'px"';
    }
    $fa_conf .= '$(document).ready(function(){jQuery(document).ready(function($){$("a[data-fancybox-group] img").jScale({' . $scale_param . '})})});';
}
$fa_conf .= Resources::minify(file_get_contents($cfg['plugins_dir'] . '/fancyboxes/js/fancyboxes.cfg.js'), 'js');
if ($f_miniput['f_nomainjs']) {
    if ($env['ext'] != 'index' && $env['location'] != 'home') {
        Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.fancybox.pack.js');
        if ($f_miniput['f_scale']) {
            Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.jScale.js');
        }
        Resources::embedFooter($fa_conf);
    }
} else {
    Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.fancybox.pack.js');
    if ($f_miniput['f_scale']) {
        Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.jScale.js');
    }
    Resources::embedFooter($fa_conf);
}
Exemplo n.º 6
0
global $ckeditor_timestamp;
if (!$ckeditor_timestamp) {
    $ckeditor_timestamp = ckeditor_max_timestamp($cfg['plugins_dir'] . '/ckeditor/lib');
}
// Main CKEditor file
Resources::linkFileFooter(cot::$cfg['plugins_dir'] . '/ckeditor/lib/ckeditor.js?' . $ckeditor_timestamp, 'js');
// Load preset and connector
if (cot::$usr['id'] > 0) {
    $preset_name = 'group_' . cot::$usr['maingrp'];
    if (!file_exists(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.{$preset_name}.set.js")) {
        $preset_name = 'default';
    }
} else {
    $preset_name = file_exists(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.group_1.set.js") ? 'group_1' : 'default';
}
Resources::linkFileFooter(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.{$preset_name}.set.js?" . $ckeditor_timestamp);
if (!empty($ckeditor_css_to_load) && is_array($ckeditor_css_to_load)) {
    foreach ($ckeditor_css_to_load as $key => $css_file) {
        if (!file_exists($css_file)) {
            unset($ckeditor_css_to_load[$key]);
        }
    }
} else {
    // Default ckeditor content styles
    $ckeditor_css_connector = "CKEDITOR.config.contentsCss = ['" . cot::$cfg['plugins_dir'] . "/ckeditor/lib/styles.js?'];";
    $ckeditor_css_to_load = array(cot::$cfg['plugins_dir'] . '/ckeditor/lib/styles.js?' . $ckeditor_timestamp, cot::$cfg['plugins_dir'] . '/ckeditor/presets/contents.default.css?' . $ckeditor_timestamp);
}
if (sizeof($ckeditor_css_to_load)) {
    $ckeditor_css_connector = "CKEDITOR.config.contentsCss = ['" . implode("','", $ckeditor_css_to_load) . "'];";
}
Resources::embedFooter("CKEDITOR.timestamp = {$ckeditor_timestamp}; CKEDITOR.config.baseHref='{$cfg['mainurl']}/'; " . $ckeditor_css_connector);
Exemplo n.º 7
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=header.main
[END_COT_EXT]
==================== */
/**
 * Cotonti Banners Module
 * Banner rotation with statistics
 *
 * @package Banners
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL.');
$brsInclided = false;
if (cot::$cfg['headrc_consolidate'] && cot::$cache) {
    Resources::addFile(cot::$cfg['modules_dir'] . "/brs/js/brs.js");
    $brsInclided = true;
}
if (!empty($cache_ext) && cot::$usr['id'] == 0 && cot::$cfg['cache_' . $cache_ext]) {
    Resources::embedFooter("var brsX = '" . cot::$sys['xk'] . "'");
    if (!$brsInclided) {
        Resources::linkFileFooter(cot::$cfg['modules_dir'] . "/brs/js/brs.js");
    }
}
Exemplo n.º 8
0
 public function indexAction()
 {
     Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/advboard/js/advboard.compare.js');
     $sort = cot_import('s', 'G', 'ALP');
     // order field name
     $way = cot_import('w', 'G', 'ALP', 4);
     // order way (asc, desc)
     //$maxrowsperpage = cot::$cfg['advboard']['cat___default']['maxrowsperpage'];
     $maxrowsperpage = 0;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.first') as $pl) {
         include $pl;
     }
     /* ===== */
     $sort = empty($sort) ? cot::$cfg['advboard']['cat___default']['order'] : $sort;
     $way = empty($way) || !in_array($way, array('asc', 'desc')) ? cot::$cfg['advboard']['cat___default']['way'] : $way;
     $canonicalUrlParams = array('m' => 'compare');
     $where = array();
     if (!empty($_SESSION['advboard_compare']) && !empty($_SESSION['advboard_compare'][cot::$sys['site_id']])) {
         $where['id'] = array('id', array_keys($_SESSION['advboard_compare'][cot::$sys['site_id']]));
         $where['state'] = array('state', advboard_model_Advert::PUBLISHED);
         $where['begin'] = array('begin', cot::$sys['now'], '<=');
         $where['expire'] = array('SQL', "expire = 0 OR expire > " . cot::$sys['now']);
     }
     $template = array('advboard', 'compare');
     cot::$out['subtitle'] = cot::$L['advboard_compare'];
     // Building the canonical URL
     cot::$out['canonical_uri'] = cot_url('advboard', $canonicalUrlParams);
     $condition = array();
     foreach ($where as $key => $val) {
         $condition[] = $val;
     }
     $order = array(array('sticky', 'desc'), array($sort, $way));
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $advertisement = null;
     $totallines = 0;
     if (!empty($condition)) {
         $totallines = advboard_model_Advert::count($condition);
         if ($totallines > 0) {
             $advertisement = advboard_model_Advert::find($condition, $maxrowsperpage, 0, $order);
         }
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.main') as $pl) {
         include $pl;
     }
     /* ===== */
     $crumbs = array();
     if (cot::$cfg['advboard']['firstCrumb']) {
         $crumbs[] = array(cot_url('advboard'), cot::$L['advboard_ads']);
     }
     $crumbs[] = array(cot_url('advboard', array('m' => 'compare')), cot::$L['advboard_compare']);
     $breadcrumbs = '';
     if (!empty($crumbs)) {
         $breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
     }
     //        $pageUrlParams = $urlParams;
     //        if($durl > 1) $pageUrlParams['d'] = $durl;
     $view = new View();
     $view->breadcrumbs = $breadcrumbs;
     $view->page_title = htmlspecialchars(cot::$L['advboard_compare']);
     $view->advertisement = $advertisement;
     $view->totalitems = $totallines;
     //        $view->urlParams = $urlParams;
     //        $view->pageUrlParams = $pageUrlParams;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
Exemplo n.º 9
0
 /**
  * Список рассылок
  */
 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='******'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);
 }
Exemplo n.º 10
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=global
[END_COT_EXT]
* ==================== */
/**
 * share global
 *
 * @author  Roffun
 * @copyright Copyright (C)  Roffun | https://github.com/Roffun/share
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('share', 'plug');
Resources::linkFileFooter($cfg['plugins_dir'] . '/share/js/goodshare.min.js');
Resources::embedFooter('$(document).ready(function(){$(".goodshare").css("display","block");$(".goodshare [data-type=toggle]").click(function(){$(".goodshare .hidden").toggle();});$(".goodshare .sh-close").click(function(){$(".goodshare .hidden").toggle();});});');
Exemplo n.º 11
0
 /**
  * Список рассылок
  *
  * @return string
  * @throws Exception
  */
 public function indexAction()
 {
     $uid = cot_import('uid', 'G', 'INT');
     if (!$uid || !cot::$usr['isadmin']) {
         $uid = cot::$usr['id'];
     }
     // Мои подписки - только для авторизованных пользователей
     if (!$uid) {
         cot_die_message('404');
     }
     $user = cot_user_data($uid);
     if (!$user) {
         cot_die_message('404');
     }
     cot::$out['canonical_uri'] = cot_url('subscribe', array('m' => 'user', 'uid' => $uid));
     $urlParams = array('m' => 'user');
     if ($uid != cot::$usr['id']) {
         $urlParams['uid'] = $uid;
     }
     $crumbs = array();
     if ($uid != cot::$usr['id']) {
         cot::$out['subtitle'] = $title = cot::$L['subscribe_user_subscribes'] . ': ' . cot_user_full_name($user);
         $crumbs[] = array(cot_url("users"), cot::$L['Users']);
         $crumbs[] = array(cot_url("users", "m=details&id=" . $user["user_id"] . "&u=" . $user["user_name"]), cot_user_full_name($user));
         $crumbs[] = cot::$L['subscribe_user_subscribes'];
         $urlParams['uid'] = $user['user_id'];
     } else {
         cot::$out['subtitle'] = $title = cot::$L['subscribe_my'];
         $crumbs[] = array(cot_url('users', array('m' => 'details')), cot::$L['subscribe_my_page']);
         $crumbs[] = cot::$L['subscribe_my'];
     }
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.user.list.query') as $pl) {
         include $pl;
     }
     /* ===== */
     // Все подписки данного пользователя
     $userSubscribes = subscribe_model_Subscriber::find(array(array('user', $uid), array('email', $user['user_email'], '=', 'OR')), 0, 0, array(array('active', 'desc')));
     $subIds = array();
     $totallines = 0;
     if ($userSubscribes) {
         $totallines = count($userSubscribes);
         foreach ($userSubscribes as $subscriberRow) {
             $subIds[] = $subscriberRow->rawValue('subscribe');
         }
     }
     $subscribes = null;
     if (!empty($subIds)) {
         $subIds = array_unique($subIds);
         $subscribes = subscribe_model_Subscribe::find(array(array('id', $subIds)), 0, 0, array(array('title', 'asc')));
         if (!empty($subscribes)) {
             foreach ($userSubscribes as $key => $subscriberRow) {
                 // маловероятная ситуация, но все же
                 if (!isset($subscribes[$subscriberRow->rawValue('subscribe')])) {
                     // Рассылки больше не существует.
                     // Удалить подписку
                     $subscriberRow->delete();
                     unset($userSubscribes[$key]);
                 }
             }
         }
     }
     Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/subscribe/js/subscriber.js');
     $breadcrumbs = '';
     if (!empty($crumbs)) {
         $breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
     }
     $template = array('subscribe', 'user', 'list');
     $view = new View();
     $view->breadcrumbs = $breadcrumbs;
     $view->page_title = htmlspecialchars($title);
     $view->fistNumber = 1;
     $view->userSubscribes = $userSubscribes;
     $view->subscribes = $subscribes;
     $view->totalitems = $totallines;
     $view->user = $user;
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.user.list.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
Exemplo n.º 12
0
 /**
  * Список рассылок
  * @return string
  * @throws Exception
  */
 public function indexAction()
 {
     global $admintitle, $adminpath, $Ls;
     $admintitle = cot::$L['subscribe_subscribers'];
     $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'n' => 'user')), $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.subscriber.list.first') as $pl) {
         include $pl;
     }
     /* ===== */
     $sort = empty($sort) ? 'email' : $sort;
     $way = empty($way) || !in_array($way, array('asc', 'desc')) ? 'asc' : $way;
     $urlParams = array('m' => 'subscribe', 'n' => 'user');
     if ($sort != 'email') {
         $urlParams['s'] = $sort;
     }
     if ($way != 'asc') {
         $urlParams['w'] = $way;
     }
     $where = array();
     $states = array(-1 => cot::$R['code_option_empty'], 0 => cot::$L['Disabled'], 1 => cot::$L['Enabled']);
     // Фильтры
     $allowedFilters = array('id', 'sid', 'name', 'email', 'active');
     $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['id'])) {
             $where['id'] = array('id', $f['id']);
             $urlParams['f[id]'] = $f['id'];
         }
         if (!empty($f['sid'])) {
             $where['sid'] = array('subscribe', $f['sid']);
             $urlParams['f[sid]'] = $f['sid'];
         }
         $f['active'] = isset($_GET['f']['active']) ? cot_import($_GET['f']['active'], 'D', 'INT') : -2;
         if ($f['active'] == -1) {
             unset($where['active']);
         } elseif ($f['active'] >= 0 && $f['active'] < 2) {
             $where['active'] = array('active', $f['active']);
             $urlParams['f[active]'] = $f['active'];
         }
         if (!empty($f['name'])) {
             $where['name'] = array('name', '*' . $f['name'] . '*');
             $urlParams['f[name]'] = $f['name'];
         }
         if (!empty($f['email'])) {
             $where['email'] = array('email', '*' . $f['email'] . '*');
             $urlParams['f[email]'] = $f['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', 'user');
     $condition = array();
     foreach ($where as $key => $val) {
         $condition[] = $val;
     }
     $order = array(array($sort, $way));
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.admin.subscriber.list.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $totallines = subscribe_model_Subscriber::count($condition);
     $items = null;
     if ($totallines > 0) {
         $items = subscribe_model_Subscriber::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.subscriber.list.main') as $pl) {
         include $pl;
     }
     /* ===== */
     $pagenav = cot_pagenav('admin', $urlParams, $d, $totallines, $maxrowsperpage, 'd', '', true);
     if (empty($pagenav['current'])) {
         $pagenav['current'] = 1;
     }
     $pagenav['page'] = $pagenav['current'];
     if (!cot::$cfg['easypagenav']) {
         $pagenav['page'] = ($pagenav['current'] - 1) * $maxrowsperpage;
     }
     $subscribes = subscribe_model_Subscribe::keyValPairs();
     Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/subscribe/js/admin.subscriber.js');
     $template = array('subscribe', 'admin', 'subscriber', 'list');
     $view = new View();
     $view->page_title = $admintitle;
     $view->fistNumber = $d + 1;
     $view->items = $items;
     $view->totalitems = $totallines;
     $view->pagenav = $pagenav;
     $view->subscribes = $subscribes;
     $view->urlParams = $urlParams;
     $view->filter = $f;
     $view->filterForm = $filterForm;
     $view->states = $states;
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.admin.subscriber.list.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
Exemplo n.º 13
0
/**
 * Чекбокс "Добавить к сравнению
 *
 * @param advboard_model_Advert $item
 * @param string $title
 * @return string
 */
function adv_compare_checkbox($item, $title = null)
{
    static $loaded = false;
    $choosen = false;
    if ($item instanceof advboard_model_Advert) {
        $id = $item->id;
    } else {
        $id = $item;
    }
    if ($id == 0) {
        return '';
    }
    if (!empty($_SESSION['advboard_compare']) && !empty($_SESSION['advboard_compare'][cot::$sys['site_id']])) {
        if (isset($_SESSION['advboard_compare'][cot::$sys['site_id']][$id]) && !empty($_SESSION['advboard_compare'][cot::$sys['site_id']][$id])) {
            $choosen = true;
        }
    }
    if (is_null($title)) {
        $title = cot::$L['advboard_compare_add'];
    }
    $ret = cot_checkbox($choosen, 'advboard_comp[]', $title, array('class' => 'advboard_compare'), $id, 'input_check');
    if (!$loaded) {
        Resources::linkFileFooter(cot::$cfg["modules_dir"] . '/advboard/js/advboard.compare.form.js');
        $loaded = true;
        $ret .= cot_xp();
    }
    return $ret;
}