本文整理汇总了PHP中cot_module_active函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_module_active函数的具体用法?PHP cot_module_active怎么用?PHP cot_module_active使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_module_active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
global $structure;
if (!cot_module_active('rss')) {
cot_die_message(404, TRUE);
}
$c = cot_import('c', 'G', 'TXT');
if (!empty($c)) {
if (!isset($structure['advboard'][$c])) {
cot_die_message(404, TRUE);
}
list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c);
cot_block(cot::$usr['auth_read']);
}
$rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle'];
$rss_link = cot::$cfg['mainurl'];
$rss_description = cot::$cfg['subtitle'];
$domain = cot::$sys['domain'];
$condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now']));
if (!empty($c)) {
$rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle'];
$condition[] = array('category', $c);
}
$advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc')));
$t = new XTemplate(cot_tplfile('rss'));
$now = cot::$sys['now'];
$now += cot::$usr['timezone'] * 3600;
$t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now))));
if (!empty($advertisement)) {
foreach ($advertisement as $advert) {
$url = $advert->url;
if (!cot_url_check($url)) {
$url = COT_ABSOLUTE_URL . $url;
}
$date = '';
if (!empty($advert->created)) {
$date = strtotime($advert->created);
$date += cot::$usr['timezone'] * 3600;
$date = date('r', $date);
$date = $this->fixPubDate($date);
}
$text = $advert->text;
$textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']);
if ($textlength > 0 && mb_strlen($text) > $textlength) {
$text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']);
}
$t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url));
$t->parse('MAIN.ITEM_ROW');
}
}
$t->parse('MAIN');
// ob_clean();
header('Content-type: text/xml; charset=UTF-8');
echo $t->text('MAIN');
exit;
}
示例2: form_structure_editor
function form_structure_editor($id)
{
global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R;
$row = $cot_structure->category($id);
if (empty($row)) {
return null;
}
$ii++;
$structure_id = $row['structure_id'];
$structure_code = $row['structure_code'];
$n = $row['structure_area'];
$dozvil = $row['structure_count'] > 0 ? false : true;
$is_module = cot_module_active($n);
$t = new XTemplate(cot_tplfile('cateditor.admin.edit', 'plug'));
$t->assign(array('ADMIN_STRUCTURE_HEADER' => $row['structure_title'], 'ADMIN_STRUCTURE_DEL_URL' => $dozvil ? cot_confirm_url(cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=delete&id=' . $row['structure_id'] . '&' . cot_xg()), 'admin') : '', 'ADMIN_STRUCTURE_UPDATE_FORM_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&id=' . $structure_id . '&a=update'), 'ADMIN_STRUCTURE_ID' => $row['structure_id'], 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', $structure_code, 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_PATHFIELDIMG' => mb_strpos($row['structure_path'], '.') == 0 ? $R['admin_icon_join1'] : $R['admin_icon_join2'], 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath', $row['structure_path'], 'size="12" maxlength="255"'), 'ADMIN_STRUCTURE_TPL' => cot_inputbox('text', 'rstructuretpl', $row['structure_tpl'], 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', $row['structure_title'], 'size="32" maxlength="255"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', $row['structure_desc'], 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', $row['structure_icon'], 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox($row['structure_locked'], 'rstructurelocked'), 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($cot_structure->get_parent($id), 'rstructureparent', true, 'disabled="disabled"'), 'ADMIN_STRUCTURE_JUMPTO_URL' => cot_url($n, 'c=' . $structure_code), 'ADMIN_STRUCTURE_RIGHTS_URL' => $is_module ? cot_url('admin', 'm=rightsbyitem&ic=' . $n . '&io=' . $structure_code) : '', 'ADMIN_STRUCTURE_ODDEVEN' => cot_build_oddeven($ii)));
foreach ($cot_extrafields[$db_structure] as $exfld) {
$exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, $row['structure_' . $exfld['field_name']]);
$exfld_title = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) => $exfld_val, 'ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) . '_TITLE' => $exfld_title, 'ADMIN_STRUCTURE_EXTRAFLD' => $exfld_val, 'ADMIN_STRUCTURE_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
require_once cot_incfile('configuration');
$optionslist = cot_config_list($is_module ? 'module' : 'plug', $n, $structure_code);
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.config.edit.loop');
/* ===== */
foreach ($optionslist as $row_c) {
list($title, $hint) = cot_config_titles($row_c['config_name'], $row_c['config_text']);
if ($row_c['config_type'] == COT_CONFIG_TYPE_SEPARATOR) {
$t->assign('ADMIN_CONFIG_FIELDSET_TITLE', $title);
$t->parse('MAIN.OPTIONS.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_FIELDSET_BEGIN');
} else {
$t->assign(array('ADMIN_CONFIG_ROW_CONFIG' => cot_config_input($row_c['config_name'], $row_c['config_type'], $row_c['config_value'], $row_c['config_variants']), 'ADMIN_CONFIG_ROW_CONFIG_TITLE' => $title, 'ADMIN_CONFIG_ROW_CONFIG_MORE_URL' => cot_url('admin', 'm=structure&n=' . $n . '&d=' . $durl . '&id=' . $structure_id . '&al=' . $structure_code . '&a=reset&v=' . $row_c['config_name'] . '&' . cot_xg()), 'ADMIN_CONFIG_ROW_CONFIG_MORE' => $hint));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_ROW_OPTION');
}
$t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW');
}
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.tags') as $pl) {
include $pl;
}
/* ===== */
$t->assign('CONFIG_HIDDEN', cot_inputbox('hidden', 'editconfig', $structure_code));
$t->parse('MAIN.CONFIG');
$t->parse('MAIN');
return $t->text('MAIN');
}
示例3: defined
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['projects']['prjsearch']) {
$rs['prjtitle'] = cot_import($rs['prjtitle'], 'D', 'INT');
$rs['prjtext'] = cot_import($rs['prjtext'], 'D', 'INT');
$rs['prjsort'] = cot_import($rs['prjsort'], 'D', 'ALP');
$rs['prjsort'] = empty($rs['prjsort']) ? 'date' : $rs['prjsort'];
$rs['prjsort2'] = cot_import($rs['prjsort2'], 'D', 'ALP') == 'DESC' ? 'DESC' : 'ASC';
$rs['projectssub'] = cot_import($rs['projectssub'], 'D', 'ARR');
$rs['projectssubcat'] = cot_import($rs['projectssubcat'], 'D', 'BOL') ? 1 : 0;
if ($rs['prjtitle'] < 1 && $rs['prjtext'] < 1) {
$rs['prjtitle'] = 1;
$rs['prjtext'] = 1;
}
if (($tab == 'projects' || empty($tab)) && cot_module_active('projects')) {
require_once cot_incfile('projects', 'module');
// Making the category list
$projects_cat_list['all'] = $L['plu_allcategories'];
foreach ($structure['projects'] as $cat => $x) {
if ($cat != 'all' && $cat != 'system' && cot_auth('projects', $cat, 'R') && $x['group'] == 0) {
$projects_cat_list[$cat] = $x['tpath'];
$prj_catauth[] = $db->prep($cat);
}
}
if ($rs['projectssub'][0] == 'all' || !is_array($rs['projectssub'])) {
$rs['projectssub'] = array();
$rs['projectssub'][] = 'all';
}
/* === Hook === */
foreach (cot_getextplugins('projects.search.catlist') as $pl) {
示例4: cot_url
$t->parse('LIST.ADMIN_STRUCTURE_EXT');
}
}
} else {
$t->parse('LIST.ADMIN_STRUCTURE_EMPTY');
}
$t->assign(array('ADMIN_STRUCTURE_EXFLDS_URL' => cot_url('admin', 'm=extrafields')));
$t->parse('LIST');
$adminmain = $t->text('LIST');
} else {
$parse = false;
if (cot_plugin_active($n)) {
$is_module = false;
$parse = true;
}
if (cot_module_active($n)) {
$is_module = true;
$parse = true;
}
if (!$parse) {
cot_redirect(cot_url('admin', 'm=structure', '', true));
}
// Edit structure for a module
if (file_exists(cot_incfile($n, $is_module ? 'module' : 'plug'))) {
require_once cot_incfile($n, $is_module ? 'module' : 'plug');
}
if (empty($adminhelp)) {
$adminhelp = $L['adm_help_structure'];
}
if ($a == 'reset' && !empty($al)) {
cot_config_reset($n, $v, $is_module, $al);
示例5: defined
/**
* [BEGIN_COT_EXT]
* Hooks=search.list
* [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.');
if ($cfg['projects']['prjsearch'] && ($tab == 'projects' || empty($tab)) && cot_module_active('projects') && !cot_error_found()) {
if ($rs['projectssub'][0] != 'all' && count($rs['projectssub']) > 0) {
if ($rs['projectssubcat']) {
$tempcat = array();
foreach ($rs['projectssub'] as $scat) {
$tempcat = array_merge(cot_structure_children('projects', $scat), $tempcat);
}
$tempcat = array_unique($tempcat);
$where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
} else {
$tempcat = array();
foreach ($rs['projectssub'] as $scat) {
$tempcat[] = $db->prep($scat);
}
$where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
}
示例6: cot_page_enum
//.........这里部分代码省略.........
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']);
$t->assign(array('PAGE_ROW_COMMENTS' => cot_comments_link('page', $rowe_urlp, 'page', $pag['page_id'], $pag['page_cat'], $pag), 'PAGE_ROW_COMMENTS_COUNT' => cot_comments_count('page', $pag['page_id'], $pag)));
}
$t->parse("MAIN.PAGE_ROW");
}
// Render pagination
$url_params = $_GET;
$url_area = 'index';
$module_name = cot_import('e', 'G', 'ALP');
if (cot_module_active($module_name)) {
$url_area = $url_params['e'];
unset($url_params['e']);
}
if (cot_plugin_active($module_name)) {
$url_area = 'plug';
}
unset($url_params[$pagination]);
if (!empty($pagination)) {
$pagenav = cot_pagenav($url_area, $url_params, $d, $totalitems, $count, $pagination);
}
$t->assign(array('PAGE_TOP_PAGINATION' => $pagenav['main'], 'PAGE_TOP_PAGEPREV' => $pagenav['prev'], 'PAGE_TOP_PAGENEXT' => $pagenav['next'], 'PAGE_TOP_FIRST' => $pagenav['first'], 'PAGE_TOP_LAST' => $pagenav['last'], 'PAGE_TOP_CURRENTPAGE' => $pagenav['current'], 'PAGE_TOP_TOTALLINES' => $totalitems, 'PAGE_TOP_MAXPERPAGE' => $count, 'PAGE_TOP_TOTALPAGES' => $pagenav['total']));
/* === Hook === */
foreach (cot_getextplugins('pagelist.tags') as $pl) {
include $pl;
}
/* ===== */
$t->parse("MAIN");
$page_query_html = $t->text("MAIN");
if ($cache && (int) $cache_ttl > 0) {
$cache->disk->store($md5hash, $page_query_html, 'page');
}
return $page_query_html;
}
示例7: defined
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=header.main
[END_COT_EXT]
==================== */
/**
* Ads board module for Cotonti Siena
*
* @package Advboard
* @author Kalnov Alexey <kalnovalexey@yandex.ru>
* @copyright (c) 2015 Portal30 Studio http://portal30.ru
*/
defined('COT_CODE') or die('Wrong URL');
if (!defined('COT_ADMIN') && cot::$cfg['advboard']['rssToHeader'] == 1 && cot_module_active('rss')) {
require_once cot_incfile('advboard', 'module');
// Получить все категории
if (!empty($structure['advboard'])) {
foreach ($structure['advboard'] as $adv_rssCode => $adv_rssCat) {
if ($adv_rssCat['count'] == 0 || !cot_auth('advboard', $adv_rssCode, 'R')) {
continue;
}
$advCatTitle = htmlspecialchars($adv_rssCat['title']);
$adv_rssUrl = cot_url('advboard', array('m' => 'rss', 'c' => $adv_rssCode));
if (!cot_url_check($adv_rssUrl)) {
$adv_rssUrl = COT_ABSOLUTE_URL . $adv_rssUrl;
}
cot::$out['head_head'] .= "\n" . '<link rel="alternate" type="application/rss+xml" title="' . cot::$L['advboard_rss_feed'] . $advCatTitle . '" href="' . $adv_rssUrl . '" />';
}
}
示例8: cot_rc_link
$t->assign(cot_generate_pagetags($row, 'PLUGIN_PR_'));
$t->assign(array('PLUGIN_PR_CATEGORY' => cot_rc_link($url_cat, $structure['page'][$row['page_cat']]['tpath']), 'PLUGIN_PR_CATEGORY_URL' => $url_cat, 'PLUGIN_PR_TITLE' => cot_rc_link($url_page, htmlspecialchars($row['page_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['page_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['page_date']), 'PLUGIN_PR_TIMESTAMP' => $row['page_date'], 'PLUGIN_PR_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PR_NUM' => $jj));
/* === Hook - Part 2 === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.RESULTS.PAGES.ITEM');
$jj++;
}
if ($jj > 0) {
$t->parse('MAIN.RESULTS.PAGES');
}
unset($where_and, $where_or, $where);
}
if (($tab == 'frm' || empty($tab)) && cot_module_active('forums') && $cfg['plugin']['search']['forumsearch'] && !cot_error_found()) {
if ($rs['frmsub'][0] != 'all' && count($rs['frmsub']) > 0) {
if ($rs['frmsubcat']) {
$tempcat = array();
foreach ($rs['frmsub'] as $scat) {
$tempcat = array_merge(cot_structure_children('forums', $scat), $tempcat);
}
$tempcat = array_unique($tempcat);
$where_and['cat'] = "t.ft_cat IN ('" . implode("','", $tempcat) . "')";
} else {
$tempcat = array();
foreach ($rs['frmsub'] as $scat) {
$tempcat[] = $db->prep($scat);
}
$where_and['cat'] = "t.ft_cat IN ('" . implode("','", $tempcat) . "')";
}
示例9: foreach
$admin_comments_join_tables = '';
$admin_comments_join_where = '';
/* === Hook === */
foreach (cot_getextplugins('admin.comments.first') as $pl) {
include $pl;
}
/* ===== */
if ($a == 'delete') {
cot_check_xg();
$db->delete($db_com, "com_id={$id}");
$adminwarnings = $sql ? $L['adm_comm_already_del'] : $L['Error'];
}
$is_adminwarnings = isset($adminwarnings);
$totalitems = $db->countRows($db_com);
$pagenav = cot_pagenav('admin', 'm=other&p=comments', $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
if (cot_module_active('page')) {
require_once cot_incfile('page', 'module');
$admin_comments_join_fields = ", p.*";
$admin_comments_join_tables = " LEFT JOIN {$db_pages} AS p\n\t\tON c.com_area = 'page' AND c.com_code = p.page_id";
}
$sql = $db->query("SELECT c.* {$admin_comments_join_fields}\n\tFROM {$db_com} AS c {$admin_comments_join_tables}\n\tWHERE 1 {$admin_comments_join_where}\n\tORDER BY com_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.comments.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
$row['com_text'] = htmlspecialchars(cot_cutstring(strip_tags($row['com_text']), 40));
$row['com_type'] = mb_substr($row['com_code'], 0, 1);
$row['com_value'] = $row['com_code'];
switch ($row['com_area']) {
case 'page':
示例10: cot_reviews_list
/**
* Форма просмара отзывов /добавление отзыва
*
* @param int $userid id пользователя
* @param string $area модуль/плагин
* @param string $code код
* @param string $name URL Module or script name
* @param mixed $params URL parameters as array or parameter string
* @param string $tail URL postfix, e.g. anchor
* @param bool $showall show all reviews
* @return string
*/
function cot_reviews_list($userid, $area, $code = '', $name = '', $params = '', $tail = '', $showall = false)
{
global $db_reviews, $db_users, $db, $L, $usr, $cfg;
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'reviews', 'RWA');
if ($usr['auth_read']) {
$t1 = new XTemplate(cot_tplfile(array('reviews', $area), 'plug'));
require_once cot_langfile('reviews', 'plug');
if (!$showall) {
$sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
$sqlarea = " AND item_area='" . $db->prep($area) . "'";
}
$sql = $db->query("SELECT * FROM {$db_reviews} as r LEFT JOIN {$db_users} as u ON u.user_id=r.item_userid \n\t\t\tWHERE item_touserid=" . (int) $userid . $sqlarea . $sqlcode . " ORDER BY item_date ASC");
if (is_array($params)) {
$params2 = array();
foreach ($array as $key => $value) {
$params2[$key] = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $value);
}
$params = $params2;
} else {
$params = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $params);
}
$redirect = cot_url($name, $params, $tail, true);
$redirect = base64_encode($redirect);
while ($item = $sql->fetch()) {
if ($usr['id'] == $item['item_userid'] || $usr['isadmin']) {
$t1->assign(array('REVIEW_FORM_ID' => $item['item_id'], 'REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=update&area=' . $area . '&code=' . $code . '&touser=' . $userid . '&redirect=' . $redirect . '&itemid=' . $item['item_id']), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $item['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($item['item_score'], 'rscore', $L['review_score_values'], $L['review_score_titles']), 'REVIEW_FORM_USERID' => $item['item_userid'], 'REVIEW_FORM_DELETE_URL' => cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&touser=' . $userid . '&redirect=' . $redirect . '&itemid=' . $item['item_id'])));
$t1->parse('MAIN.REVIEWS_ROWS.EDITFORM');
}
$t1->assign(cot_generate_usertags($item, 'REVIEW_ROW_'));
$t1->assign(array('REVIEW_ROW_ID' => $item['item_id'], 'REVIEW_ROW_TEXT' => $item['item_text'], 'REVIEW_ROW_TOUSER' => $item['item_touser'], 'REVIEW_ROW_OWNERID' => $item['item_userid'], 'REVIEW_ROW_OWNER' => cot_build_user($item['item_userid'], htmlspecialchars($item['user_name'])), 'REVIEW_ROW_SCORE' => $item['item_score'] > 0 ? '+' . $item['item_score'] : $item['item_score'], 'REVIEW_ROW_AREA' => $item['item_area'], 'REVIEW_ROW_CODE' => $item['item_code'], 'REVIEW_ROW_DATE' => $item['item_date'], 'REVIEW_ROW_DELETE_URL' => $usr['id'] == $item['item_userid'] || $usr['isadmin'] ? cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&itemid=' . $item['item_id'] . '&redirect=' . $redirect) : ''));
if ($item['item_area'] == 'projects' && !empty($item['item_code'])) {
require_once cot_incfile('projects', 'module');
global $db_projects;
$prj = $db->query("SELECT * FROM {$db_projects} WHERE item_id=" . $item['item_code'])->fetch();
$t1->assign(cot_generate_projecttags($prj, 'REVIEW_ROW_PRJ_'));
}
$t1->parse('MAIN.REVIEWS_ROWS');
}
if ($cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $usr['id'] > 0 && $usr['auth_write'] && $usr['id'] != $userid) {
require_once cot_incfile('projects', 'module');
global $db_projects_offers, $db_projects;
$prj_reviews_sql = $db->query("SELECT item_code FROM {$db_reviews} WHERE item_area='projects' AND item_userid=" . $usr['id']);
while ($row = $prj_reviews_sql->fetch()) {
$prjreviews[] = $row['item_code'];
}
$prjreviews_string = count($prjreviews) > 0 ? "AND o.offer_pid NOT IN (" . implode(",", $prjreviews) . ")" : '';
$bothprj_count = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t")->fetchColumn();
if ($bothprj_count > 0) {
$bothprj_sql = $db->query("SELECT * FROM {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t");
while ($bprj = $bothprj_sql->fetch()) {
$prj_ids[] = $bprj['offer_pid'];
$prj_titles[] = $bprj['item_title'];
}
}
$area = 'projects';
$usr['auth_write'] = (int) $bothprj_count == 0 ? false : $usr['auth_write'];
} else {
$sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
$sqlarea = " AND item_area='" . $db->prep($area) . "'";
$reviews_count = $db->query("SELECT COUNT(*) FROM {$db_reviews} \n\t\t\t\tWHERE item_userid=" . (int) $usr['id'] . "\n\t\t\t\t\tAND item_touserid=" . (int) $userid . $sqlarea . $sqlcode)->fetchColumn();
$usr['auth_write'] = $reviews_count > 0 ? false : $usr['auth_write'];
}
if ($usr['auth_write'] && $usr['id'] != $userid) {
cot_display_messages($t1);
$t1->assign(array('REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=add&area=' . $area . '&touser=' . $userid . '&redirect=' . $redirect), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $ritem['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($ritem['item_score'], 'rscore', $L['reviews_score_values'], $L['reviews_score_titles']), 'REVIEW_FORM_PROJECTS' => $cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $bothprj_count > 0 ? cot_selectbox($pid, 'code', $prj_ids, $prj_titles, false) : '', 'REVIEW_FORM_ACTION' => 'ADD'));
$t1->parse('MAIN.FORM');
}
$t1->parse('MAIN');
return $t1->text('MAIN');
}
return '';
}
示例11: defined
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['market']['marketsearch']) {
$rs['markettitle'] = cot_import($rs['markettitle'], 'D', 'INT');
$rs['markettext'] = cot_import($rs['markettext'], 'D', 'INT');
$rs['marketsort'] = cot_import($rs['marketsort'], 'D', 'ALP');
$rs['marketsort'] = empty($rs['marketsort']) ? 'date' : $rs['marketsort'];
$rs['marketsort2'] = cot_import($rs['marketsort2'], 'D', 'ALP') == 'DESC' ? 'DESC' : 'ASC';
$rs['marketsub'] = cot_import($rs['marketsub'], 'D', 'ARR');
$rs['marketsubcat'] = cot_import($rs['marketsubcat'], 'D', 'BOL') ? 1 : 0;
if ($rs['markettitle'] < 1 && $rs['markettext'] < 1) {
$rs['markettitle'] = 1;
$rs['markettext'] = 1;
}
if (($tab == 'market' || empty($tab)) && cot_module_active('market')) {
require_once cot_incfile('market', 'module');
// Making the category list
$market_cat_list['all'] = $L['plu_allcategories'];
foreach ($structure['market'] as $cat => $x) {
if ($cat != 'all' && $cat != 'system' && cot_auth('market', $cat, 'R') && $x['group'] == 0) {
$market_cat_list[$cat] = $x['tpath'];
$market_catauth[] = $db->prep($cat);
}
}
if ($rs['marketsub'][0] == 'all' || !is_array($rs['marketsub'])) {
$rs['marketsub'] = array();
$rs['marketsub'][] = 'all';
}
/* === Hook === */
foreach (cot_getextplugins('market.search.catlist') as $pl) {
示例12: defined
* @license BSD
* */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('tagslance', 'plug');
if ($a == 'folio' && cot_module_active('folio')) {
if (empty($qs)) {
// Form and cloud
cot_tag_search_form('folio');
} else {
// Search results
cot_tag_search_folio($qs);
}
}
if ($a == 'market' && cot_module_active('market')) {
if (empty($qs)) {
// Form and cloud
cot_tag_search_form('market');
} else {
// Search results
cot_tag_search_market($qs);
}
}
if ($a == 'projects' && cot_module_active('projects')) {
if (empty($qs)) {
// Form and cloud
cot_tag_search_form('projects');
} else {
// Search results
cot_tag_search_projects($qs);
}
}
示例13: build_tree
public function build_tree($parent = null, $depth = 0, $tpl = 'cateditor.tree', $selectedid = null)
{
$array = array();
$array = empty($parent) ? $this->childs_null : $this->childs[$parent];
$is_module = cot_module_active($this->area);
if (!empty($parent)) {
// cot_print($parent, );
}
if (empty($array)) {
return false;
} else {
$t = new XTemplate(cot_tplfile($tpl, 'plug'));
foreach ($array as $id) {
$row = $this->data[$id];
$t->assign(array('ADMIN_STRUCTURE_EDIT_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $this->area . '&id=' . $row['structure_id']), 'ADMIN_STRUCTURE_AJAX_EDIT_URL' => cot_url('index', 'r=cateditor&n=' . $this->area . '&id=' . $row['structure_id']), 'ADMIN_STRUCTURE_RIGHTS_URL' => $is_module ? cot_url('admin', 'm=rightsbyitem&ic=' . $this->area . '&io=' . $row['structure_code']) : '', 'ADMIN_STRUCTURE_OPEN_URL' => cot_url($n, 'c=' . $row['structure_code']), 'ADMIN_STRUCTURE_ID' => $row['structure_id'], 'ADMIN_STRUCTURE_CODE' => $row['structure_code'], 'ADMIN_STRUCTURE_TITLE' => $row['structure_title'], 'ADMIN_STRUCTURE_DESC' => $row['structure_desc'], 'ADMIN_STRUCTURE_SELECTED' => $row['structure_id'] == $selectedid ? 1 : 0, 'ADMIN_STRUCTURE_ICON' => $row['structure_icon'], 'ADMIN_STRUCTURE_CHILDREN' => $this->build_tree($row['structure_id'], $depth + 1, $tpl), 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], 'ADMIN_STRUCTURE_DEPTH' => $depth));
$t->parse("MAIN.CATS.ROW");
}
$t->parse("MAIN.CATS");
if (empty($parent)) {
$t->parse("MAIN");
return $t->text("MAIN");
}
return $t->text("MAIN.CATS");
}
}
示例14: cot_incfile
require_once cot_incfile('page', 'module');
// Try to load from cache for guests
if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
$ri_cache_id = "{$theme}.{$lang}.pages";
$ri_html = $cache->disk->get($ri_cache_id, 'recentitems', (int) $cfg['plugin']['recentitems']['cache_ttl']);
}
if (empty($ri_html)) {
$ri_html = cot_build_recentpages('recentitems.pages.index', 'recent', $cfg['plugin']['recentitems']['maxpages'], 0, $cfg['plugin']['recentitems']['recentpagestitle'], $cfg['plugin']['recentitems']['recentpagestext'], $cfg['plugin']['recentitems']['rightscan']);
if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
$cache->disk->store($ri_cache_id, $ri_html, 'recentitems');
}
}
$t->assign('RECENT_PAGES', $ri_html);
unset($ri_html);
}
if ($enforums && $cfg['plugin']['recentitems']['recentforums'] && cot_module_active('forums')) {
require_once cot_incfile('forums', 'module');
// Try to load from cache for guests
if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
$ri_cache_id = "{$theme}.{$lang}.forums";
$ri_html = $cache->disk->get($ri_cache_id, 'recentitems', (int) $cfg['plugin']['recentitems']['cache_ttl']);
}
if (empty($ri_html)) {
$ri_html = cot_build_recentforums('recentitems.forums.index', 'recent', $cfg['plugin']['recentitems']['maxtopics'], 0, $cfg['plugin']['recentitems']['recentforumstitle'], $cfg['plugin']['recentitems']['rightscan']);
if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
$cache->disk->store($ri_cache_id, $ri_html, 'recentitems');
}
}
$t->assign('RECENT_FORUMS', $ri_html);
unset($ri_html);
}
示例15: unset
/**
* Adv edit template
* @author Kalnov Alexey <kalnovalexey@yandex.ru>
* @copyright Portal30 Studio http://portal30.ru
*
* @note Поля формы можно выводить и "поштучно". Но мне в цикле оказалось гораздо удобнее
*/
//var_dump_($this->category);
/** @var advboard_model_Advert $advert */
$advert = $this->advert;
$labelClass = 'col-xs-12 col-md-3';
$elementClass = 'col-xs-12 col-md-9';
$formElements = $this->formElements;
unset($this->formElements);
// Добавим виджет файлов, если необходимо
if (cot::$usr['auth_upload'] && cot_module_active('files') && cot_auth('files', 'a', 'W')) {
array_insert($formElements, 'text', array('files' => array('element' => cot_files_filebox('advboard', intval($advert->id), '', 'all'), 'label' => cot::$L['files_attachments'])));
}
echo $this->breadcrumbs;
?>
<div class="row">
<div class="<?php
echo $labelClass;
?>
hidden-xs"></div>
<div class="<?php
echo $elementClass;
?>
">
<h2 class="page" style="margin-top: 0;"><?php