defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.');
$t = new XTemplate(cot_tplfile('pfs.admin.allpfs'));
$adminpath[] = array(cot_url('admin', 'm=other'), $L['Other']);
$adminpath[] = array(cot_url('admin', 'm=pfs'), $L['PFS']);
$adminpath[] = array(cot_url('admin', 'm=pfs&s=allpfs'), $L['adm_allpfs']);
$adminhelp = $L['adm_help_allpfs'];
$adminsubtitle = $L['adm_allpfs'];
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['maxrowsperpage']);
/* === Hook === */
foreach (cot_getextplugins('admin.pfs.allpfs.first') as $pl) {
    include $pl;
}
/* ===== */
unset($disp_list);
$totalitems = $db->query("SELECT COUNT(DISTINCT pfs_userid) FROM {$db_pfs} WHERE pfs_folderid>=0")->fetchColumn();
$pagenav = cot_pagenav('admin', 'm=pfs&s=allpfs', $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_pfs = $db->query("SELECT DISTINCT p.pfs_userid, u.user_name, u.user_id, COUNT(*) FROM {$db_pfs} AS p\n\tLEFT JOIN {$db_users} AS u ON p.pfs_userid=u.user_id\n\tWHERE pfs_folderid>=0 GROUP BY p.pfs_userid ORDER BY u.user_name ASC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.pfs.allpfs.loop');
/* ===== */
foreach ($sql_pfs->fetchAll() as $row) {
    $row['user_name'] = $row['user_id'] == 0 ? $L['SFS'] : $row['user_name'];
    $row['user_id'] = $row['user_id'] == 0 ? '0' : $row['user_id'];
    $t->assign(array('ADMIN_ALLPFS_ROW_URL' => cot_url('pfs', 'userid=' . $row['user_id']), 'ADMIN_ALLPFS_ROW_USER' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])), 'ADMIN_ALLPFS_ROW_COUNT' => $row['COUNT(*)']));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ALLPFS_ROW');
}
$list_url_path = array('c' => $c, 'sort' => $sort, 'sq' => $sq);
// Building the canonical URL
$out['canonical_uri'] = cot_url('market', $list_url_path);
$mskin = cot_tplfile(array('market', 'list', $structure['market'][$c]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('market.list.query') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_market} AS m {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT m.*, u.* {$join_columns} \n\tFROM {$db_market} AS m {$join_condition}\n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid \n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('market', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('market'), $L['market']);
if (!empty($c)) {
    $catpatharray = array_merge($catpatharray, cot_structure_buildpath('market', $c));
}
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("SEARCH_ACTION_URL" => cot_url('market', '', '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_market_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['market_mostrelevant'], $L['market_costasc'], $L['market_costdesc']), false), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, "CATALOG" => cot_build_structure_market_tree('', array($c), 0), "BREADCRUMBS" => $catpath, "CATTITLE" => !empty($c) ? $structure['market'][$c]['title'] : '', "CATDESC" => !empty($c) ? $structure['market'][$c]['desc'] : ''));
foreach ($cot_extrafields[$db_market] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, $shfld[$exfld['field_name']]);
    $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('SEARCH_' . $uname => $exfld_val, 'SEARCH_' . $uname . '_TITLE' => $exfld_title));
}
/* === Hook === */
foreach (cot_getextplugins('market.list.search.tags') as $pl) {
    include $pl;
    cot_message('adm_trashcan_prune');
    cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
} elseif ($a == 'restore') {
    cot_check_xg();
    /* === Hook === */
    foreach (cot_getextplugins('trashcan.admin.restore') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_trash_restore($id);
    cot_message('adm_trashcan_restored');
    cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
}
$tr_t = new XTemplate(cot_tplfile($info ? 'trashcan.info.admin' : 'trashcan.admin', 'plug', true));
$totalitems = (int) $db->query("SELECT COUNT(*) FROM {$db_trash} WHERE tr_parentid=0")->fetchColumn();
$pagenav = cot_pagenav('admin', 'm=other&p=trashcan', $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_query = $info ? "AND tr_id={$id} LIMIT 1" : "ORDER by tr_id DESC LIMIT {$d}, " . $maxperpage;
$sql = $db->query("SELECT t.*, u.user_name FROM {$db_trash} AS t\n\tLEFT JOIN {$db_users} AS u ON t.tr_trashedby=u.user_id\n\tWHERE tr_parentid=0 {$sql_query}");
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('trashcan.admin.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    $ii++;
    switch ($row['tr_type']) {
        case 'comment':
            $icon = $R['admin_icon_comments'];
            $typestr = $L['Comment'];
            $enabled = cot_plugin_active('comments') ? 1 : 0;
            break;
        case 'forumpost':
Exemple #4
0
}
/* === 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']);
    $pm_desc = cot_string_truncate($pm_data, 100, true, false, '...');
    if ($f == 'sentbox') {
        $star_class = $row['pm_fromstate'] == 2 ? 1 : 0;
    } else {
        $star_class = $row['pm_tostate'] == 2 ? 1 : 0;
// ==================================================
$where['pid'] = "o.offer_pid=" . $id;
$order['date'] = "o.offer_date DESC";
$query_limit = $cfg['projects']['offersperpage'] > 0 ? "LIMIT {$d}, " . $cfg['projects']['offersperpage'] : '';
/* === Hook === */
foreach (cot_getextplugins('projects.offers.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totaloffers = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} AS o \n\t" . $where . "")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_projects_offers} AS o LEFT JOIN {$db_users} AS u ON u.user_id=o.offer_userid\n\t" . $where . " \n\t" . $order . "\n\t" . $query_limit . "");
if ($cfg['projects']['offersperpage'] > 0) {
    $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $id) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
    $offersnav = cot_pagenav('projects', $urlparams, $d, $totaloffers, $cfg['projects']['offersperpage']);
    $t_o->assign(array("OFFERSNAV_PAGES" => $offersnav['main'], "OFFERSNAV_PREV" => $offersnav['prev'], "OFFERSNAV_NEXT" => $offersnav['next'], "OFFERSNAV_COUNT" => $totaloffers));
}
$alloffers_count = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} WHERE offer_pid=" . $id)->fetchColumn();
$t_o->assign(array("ALLOFFERS_COUNT" => $alloffers_count));
/* === Hook === */
$extp1 = cot_getextplugins('projects.offers.choise.first');
$extp2 = cot_getextplugins('projects.offers.choise');
$extp3 = cot_getextplugins('projects.offers.posts.loop');
$extp4 = cot_getextplugins('projects.offers.loop');
/* ===== */
while ($offer = $sql->fetch()) {
    $t_o->assign(cot_generate_usertags($offer, 'OFFER_ROW_OWNER_'));
    $t_o->assign(array("OFFER_ROW_DATE" => cot_date('d.m.Y H:i', $offer['offer_date']), "OFFER_ROW_DATE_STAMP" => $offer['offer_date'], "OFFER_ROW_TEXT" => cot_parse($offer['offer_text']), "OFFER_ROW_COSTMIN" => number_format($offer['offer_cost_min'], '0', '.', ' '), "OFFER_ROW_COSTMAX" => number_format($offer['offer_cost_max'], '0', '.', ' '), "OFFER_ROW_TIMEMIN" => $offer['offer_time_min'], "OFFER_ROW_TIMEMAX" => $offer['offer_time_max'], "OFFER_ROW_TIMETYPE" => $L['offers_timetype'][$offer['offer_time_type']], "OFFER_ROW_HIDDEN" => $offer['offer_hidden'], "OFFER_ROW_CHOISE" => $offer['offer_choise']));
    // Extrafields
    if (isset($cot_extrafields[$db_projects_offers])) {
Exemple #6
0
    }
}
if ($days > 0) {
    $timeminus = $days * 86400;
    $timeback = $sys['now'] - $timeminus;
}
require_once cot_incfile('recentitems', 'plug');
$totalrecent[] = 0;
if ($cfg['plugin']['recentitems']['newpages'] && cot_module_active('page') && (empty($mode) || $mode == 'pages')) {
    require_once cot_incfile('page', 'module');
    $res = cot_build_recentpages('recentitems.pages', $timeback, $cfg['plugin']['recentitems']['itemsperpage'], $d, $pagetitlelimit, $cfg['plugin']['recentitems']['newpagestext'], $cfg['plugin']['recentitems']['rightscan']);
    $t->assign('RECENT_PAGES', $res);
}
if ($cfg['plugin']['recentitems']['newforums'] && cot_module_active('forums') && (empty($mode) || $mode == 'forums')) {
    require_once cot_incfile('forums', 'module');
    $res = cot_build_recentforums('recentitems.forums', $timeback, $cfg['plugin']['recentitems']['itemsperpage'], $d, $forumtitlelimit, $cfg['plugin']['recentitems']['rightscan']);
    $t->assign('RECENT_FORUMS', $res);
}
if ($mode != 'pages' || $mode != 'forums') {
    /* === Hook === */
    foreach (cot_getextplugins('recentitems.tags') as $pl) {
        include $pl;
    }
    /* ===== */
}
$out['subtitle'] = $L['recentitems_title'];
$totalpages = max($totalrecent);
$days = $days > 0 ? "&days=" . $days : "";
$mode = !empty($mode) ? "&mode=" . $mode : "";
$pagenav = cot_pagenav('plug', 'e=recentitems' . $days . $mode, $d, $totalpages, $cfg['plugin']['recentitems']['itemsperpage']);
$t->assign(array('PAGE_PAGENAV' => $pagenav['main'], 'PAGE_PAGEPREV' => $pagenav['prev'], 'PAGE_PAGENEXT' => $pagenav['next']));
        $rinput['type_title'] = cot_import($rtitle, 'D', 'TXT');
        if (!empty($rinput['type_title'])) {
            $db->update($db_projects_types, $rinput, "type_id=" . (int) $rid);
        } else {
            $db->delete($db_projects_types, "type_id=" . (int) $rid);
        }
    }
    if (!empty($rdefault)) {
        $db->update($db_config, array('config_value' => $rdefault), "config_name = ? \n\t\t\tAND config_cat = ?", array('default_type', 'projects'));
    }
    $cache && $cache->clear();
    cot_redirect(cot_url('admin', 'm=projects&p=types&d=' . $d_url, '#footer', true));
    exit;
}
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_projects_types}")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_projects_types} ORDER by type_title ASC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagenav = cot_pagenav('admin', 'm=projects&p=types', $d, $totalitems, $cfg['maxrowsperpage']);
$t = new XTemplate(cot_tplfile('projects.admin.types', 'module'));
$jj = 0;
while ($item = $sql->fetch()) {
    $jj++;
    $t->assign(array('TYPE_ROW_ID' => cot_inputbox('text', 'rtitle[' . $item['type_id'] . ']', $item['type_title']), 'TYPE_ROW_TITLE' => cot_inputbox('text', 'rtitle[' . $item['type_id'] . ']', $item['type_title']), 'TYPE_ROW_DEFAULT' => cot_radiobox($cfg['projects']['default_type'], 'rdefault', $item['type_id']), 'TYPE_ROW_DEL_URL' => cot_url('admin', 'm=projects&p=types&id=' . $item['type_id'] . '&a=delete'), 'TYPE_ROW_NUM' => $jj, 'TYPE_ROW_ODDEVEN' => cot_build_oddeven($jj)));
    $t->parse("MAIN.ROWS");
}
if ($jj == 0) {
    $t->parse("MAIN.NOROWS");
}
$t->assign(array("EDITFORM_ACTION_URL" => cot_url('admin', 'm=projects&p=types&a=edit&d=' . $d_url), "ADDFORM_ACTION_URL" => cot_url('admin', 'm=projects&p=types&a=add'), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "ADDFORM_TITLE" => cot_inputbox('text', 'rtitle', ''), "ADDFORM_DEFAULT" => cot_inputbox('checkbox', 'rdefault', 1)));
$t->parse("MAIN.ADDFORM");
$t->parse("MAIN");
$adminmain = $t->text("MAIN");
Exemple #8
0
}
$list_url_path = array('c' => $c, 'sort' => $sort, 'sq' => $sq);
// Building the canonical URL
$out['canonical_uri'] = cot_url('folio', $list_url_path);
$mskin = cot_tplfile(array('folio', 'list', $structure['folio'][$c]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('folio.list.query') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_folio} AS f {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT f.*, u.* {$join_columns} \n\tFROM {$db_folio} AS f {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid \n\t" . $where . " \n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('folio', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('folio'), $L['folio']);
if (!empty($c)) {
    $catpatharray = array_merge($catpatharray, cot_structure_buildpath('folio', $c));
}
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("SEARCH_ACTION_URL" => cot_url('folio', '', '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_folio_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['folio_mostrelevant'], $L['folio_costasc'], $L['folio_costdesc']), false), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, "CATALOG" => cot_build_structure_folio_tree('', array($c), 0), "BREADCRUMBS" => $catpath));
foreach ($cot_extrafields[$db_folio] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, $shfld[$exfld['field_name']]);
    $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('SEARCH_' . $uname => $exfld_val, 'SEARCH_' . $uname . '_TITLE' => $exfld_title));
}
/* === Hook === */
foreach (cot_getextplugins('folio.list.search.tags') as $pl) {
    include $pl;
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$sql_projects_count_cat = $db->query("SELECT item_cat, COUNT(item_cat) as cat_count FROM {$db_projects} " . $wherecount . " GROUP BY item_cat")->fetchAll();
$sql_projects_count = $db->query("SELECT * FROM {$db_projects} as p \n\t" . $wherecount . "");
$projects_count_all = $projects_count = $sql_projects_count->rowCount();
$sqllist = $db->query("SELECT * FROM {$db_projects} AS p\n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $cfg['projects']['cat___default']['maxrowsperpage']);
foreach ($sql_projects_count_cat as $value) {
    $page_nav[$value['item_cat']] = $value['cat_count'];
    $t1->assign(array("PRJ_CAT_ROW_TITLE" => &$structure['projects'][$value['item_cat']]['title'], "PRJ_CAT_ROW_ICON" => &$structure['projects'][$value['item_cat']]['icon'], "PRJ_CAT_ROW_URL" => cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name'] . '&tab=projects&cat=' . $value['item_cat']), "PRJ_CAT_ROW_COUNT_PROJECTS" => $value['cat_count'], "PRJ_CAT_ROW_SELECT" => $category && $category == $value['item_cat'] ? 1 : ''));
    $t1->parse("MAIN.CAT_ROW");
}
$opt_array = array('m' => 'details', 'id' => $urr['user_id'], 'u' => $urr['user_name'], 'tab' => 'projects');
if ($category) {
    $projects_count = $page_nav[$category];
    $opt_array['cat'] = $category;
}
$pagenav = cot_pagenav('users', $opt_array, $d, $projects_count, $cfg['projects']['cat___default']['maxrowsperpage'], 'dprj');
$t1->assign(array("PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $projects_count));
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
    $sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('projects.userdetails.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $t1->assign(cot_generate_projecttags($item, 'PRJ_ROW_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    /* === Hook === */
    foreach ($extp as $pl) {
        include $pl;
    }
     foreach (cot_getextplugins('admin.extrafields.delete') as $pl) {
         include $pl;
     }
     /* ===== */
     if (cot_extrafield_remove($n, $name)) {
         cot_message('adm_extrafield_removed');
     } else {
         cot_error('adm_extrafield_not_removed');
     }
     //cot_redirect(cot_url('admin', "m=extrafields&n=$n&d=$durl", '', true));
 }
 $cache && $cache->db->remove('cot_extrafields', 'system');
 cot_load_extrafields(true);
 $totalitems = $db->query("SELECT COUNT(*) FROM {$db_extra_fields} WHERE field_location = '{$n}'")->fetchColumn();
 $res = $db->query("SELECT * FROM {$db_extra_fields} WHERE field_location = '{$n}' ORDER BY field_name ASC LIMIT {$d}, " . $maxperpage);
 $pagenav = cot_pagenav('admin', 'm=extrafields&n=' . $n, $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 $field_types = array('input', 'inputint', 'currency', 'double', 'textarea', 'select', 'checkbox', 'radio', 'datetime', 'country', 'range', 'checklistbox', 'file');
 $ii = 0;
 /* === Hook - Part1 : Set === */
 $extp = cot_getextplugins('admin.extrafields.loop');
 /* ===== */
 foreach ($res->fetchAll() as $row) {
     $ii++;
     $t->assign(array('ADMIN_EXTRAFIELDS_ROW_NAME' => cot_inputbox('text', 'field_name[' . $row['field_name'] . ']', $row['field_name'], 'class="exfldname"'), 'ADMIN_EXTRAFIELDS_ROW_FIELDNAME' => htmlspecialchars($row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_DESCRIPTION' => cot_textarea('field_description[' . $row['field_name'] . ']', $row['field_description'], 1, 30, 'class="exflddesc"'), 'ADMIN_EXTRAFIELDS_ROW_SELECT' => cot_selectbox($row['field_type'], 'field_type[' . $row['field_name'] . ']', $field_types, $field_types, false, 'class="exfldtype"'), 'ADMIN_EXTRAFIELDS_ROW_VARIANTS' => cot_textarea('field_variants[' . $row['field_name'] . ']', $row['field_variants'], 1, 60, 'class="exfldvariants"'), 'ADMIN_EXTRAFIELDS_ROW_PARAMS' => cot_textarea('field_params[' . $row['field_name'] . ']', $row['field_params'], 1, 60, 'class="exfldparams"'), 'ADMIN_EXTRAFIELDS_ROW_HTML' => cot_textarea('field_html[' . $row['field_name'] . ']', $row['field_html'], 1, 60, 'class="exfldhtml"'), 'ADMIN_EXTRAFIELDS_ROW_DEFAULT' => cot_textarea('field_default[' . $row['field_name'] . ']', $row['field_default'], 1, 60, 'class="exflddefault"'), 'ADMIN_EXTRAFIELDS_ROW_REQUIRED' => cot_checkbox($row['field_required'], 'field_required[' . $row['field_name'] . ']', '', 'class="exfldrequired"'), 'ADMIN_EXTRAFIELDS_ROW_ENABLED' => cot_checkbox($row['field_enabled'], 'field_enabled[' . $row['field_name'] . ']', '', 'title="' . $L['adm_extrafield_enable'] . '" class="exfldenabled" '), 'ADMIN_EXTRAFIELDS_ROW_PARSE' => cot_selectbox($row['field_parse'], 'field_parse[' . $row['field_name'] . ']', $parse_type, array($L['Default'], $L['No']), false, 'class="exfldparse"'), 'ADMIN_EXTRAFIELDS_ROW_BIGNAME' => strtoupper($row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_ID' => $row['field_name'], 'ADMIN_EXTRAFIELDS_ROW_DEL_URL' => cot_url('admin', 'm=extrafields&n=' . $n . '&a=del&name=' . $row['field_name']), 'ADMIN_EXTRAFIELDS_ROW_COUNTER_ROW' => $ii, 'ADMIN_EXTRAFIELDS_ROW_ODDEVEN' => cot_build_oddeven($ii)));
     /* === Hook - Part2 : Include === */
     foreach ($extp as $pl) {
         include $pl;
     }
     /* ===== */
     $t->parse('MAIN.TABLE.EXTRAFIELDS_ROW');
 }
Exemple #11
0
 public function indexAction()
 {
     global $structure;
     $uid = cot_import('uid', 'G', 'INT');
     if (empty($uid)) {
         $uid = cot::$usr['id'];
     }
     // Незарегов, если они не смотрят объявления другого пользователя перенаправляем
     if (!$uid) {
         cot_redirect(cot_url('advboard', '', '', true));
     }
     // Проверить существование пользователя
     $user = cot_user_data($uid);
     if (!$user) {
         cot_die_message(404, TRUE);
     }
     $maxrowsperpage = cot::$cfg['advboard']['cat___default']['maxrowsperpage'];
     if ($maxrowsperpage < 1) {
         $maxrowsperpage = 1;
     }
     list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
     //page number for pages list
     $condition = array(array('user', $uid));
     if (!cot::$usr['isadmin'] && $uid != cot::$usr['id']) {
         $condition[] = array('state', advboard_model_Advert::PUBLISHED);
         $condition[] = array('begin', cot::$sys['now'], '<=');
         $condition[] = array('SQL', "expire = 0 OR expire > " . cot::$sys['now']);
     }
     $order = array(array('state', 'ASC'), array('sort', 'DESC'));
     cot::$out['canonical_uri'] = cot_url('advboard', array('m' => 'user', 'uid' => $uid));
     $urlParams = array('m' => 'user');
     if ($uid != cot::$usr['id']) {
         $urlParams['uid'] = $uid;
     }
     $title = '';
     $crumbs = array();
     if ($uid != cot::$usr['id']) {
         cot::$out['subtitle'] = $title = cot::$L['advboard_user_ads'] . ': ' . 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['advboard_user_ads'];
         //            $advUrlParams['uid']  = $user['user_id'];
         $urlParams['uid'] = $user['user_id'];
     } else {
         cot::$out['subtitle'] = $title = cot::$L['advboard_my_ads'];
         $crumbs[] = array(cot_url('users', array('m' => 'details')), cot::$L['advboard_my_page']);
         $crumbs[] = cot::$L['advboard_my_ads'];
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.user.list.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $totallines = advboard_model_Advert::count($condition);
     $advertisement = advboard_model_Advert::find($condition, $maxrowsperpage, $d, $order);
     $addNewUrl = '';
     if ((cot::$usr['auth_write'] || cot::$usr['isadmin']) && !empty($structure['advboard'])) {
         // Ищем категорию куда пользователь может подать оьбъявление
         foreach ($structure['advboard'] as $catCode => $catRow) {
             $auth_write = cot_auth('advboard', $catCode, 'W');
             if ($auth_write) {
                 $addNewUrl = cot_url('advboard', array('a' => 'edit', 'c' => $catCode));
                 break;
             }
         }
     }
     $pagenav = cot_pagenav('advboard', $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('advboard', 'list', 'user');
     $pageUrlParams = $urlParams;
     if ($durl > 1) {
         $pageUrlParams['d'] = $durl;
     }
     $view = new View();
     $view->breadcrumbs = $breadcrumbs;
     $view->page_title = htmlspecialchars($title);
     $view->advertisement = $advertisement;
     $view->allowComments = true;
     $view->totalitems = $totallines;
     $view->pagenav = $pagenav;
     $view->addNewUrl = $addNewUrl;
     $view->urlParams = $urlParams;
     $view->pageUrlParams = $pageUrlParams;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.user.list.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
Exemple #12
0
    }
    $t->assign(cot_generate_usertags($row, 'FORUMS_POSTS_ROW_USER'));
    $t->assign(array('FORUMS_POSTS_ROW_ID' => $row['fp_id'], 'FORUMS_POSTS_ROW_POSTID' => 'post_' . $row['fp_id'], 'FORUMS_POSTS_ROW_IDURL' => cot_url('forums', 'm=posts&id=' . $row['fp_id']), 'FORUMS_POSTS_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['fp_topicid'] . '&d=' . $durl, "#" . $row['fp_id']), 'FORUMS_POSTS_ROW_CREATION' => cot_date('datetime_medium', $row['fp_creation']), 'FORUMS_POSTS_ROW_CREATION_STAMP' => $row['fp_creation'], 'FORUMS_POSTS_ROW_UPDATED' => cot_date('datetime_medium', $row['fp_updated']), 'FORUMS_POSTS_ROW_UPDATED_STAMP' => $row['fp_updated'], 'FORUMS_POSTS_ROW_UPDATER' => htmlspecialchars($row['fp_updater']), 'FORUMS_POSTS_ROW_UPDATEDBY' => $row['fp_updatedby'], 'FORUMS_POSTS_ROW_TEXT' => cot_parse($row['fp_text'], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_POSTS_ROW_ANCHORLINK' => cot_rc('forums_code_post_anchor', array('id' => $row['fp_id'])), 'FORUMS_POSTS_ROW_POSTERNAME' => cot_build_user($row['fp_posterid'], htmlspecialchars($row['fp_postername'])), 'FORUMS_POSTS_ROW_POSTERID' => $row['fp_posterid'], 'FORUMS_POSTS_ROW_POSTERIP' => $usr['isadmin'] ? cot_build_ipsearch($row['fp_posterip']) : '', 'FORUMS_POSTS_ROW_DELETE' => $rowdelete, 'FORUMS_POSTS_ROW_DELETE_URL' => $rowdelete_url, 'FORUMS_POSTS_ROW_EDIT' => $rowedit, 'FORUMS_POSTS_ROW_EDIT_URL' => $rowedit_url, 'FORUMS_POSTS_ROW_QUOTE' => $rowquote, 'FORUMS_POSTS_ROW_QUOTE_URL' => $rowquote_url, 'FORUMS_POSTS_ROW_BOTTOM' => (empty($id) ? $d + $fp_num : $id) == $totalposts ? $R['forums_code_bottom'] : ($usr['id'] > 0 && $n == 'unread' && $row['fp_creation'] > $usr['lastvisit'] ? $R['forums_code_unread'] : ''), 'FORUMS_POSTS_ROW_ODDEVEN' => cot_build_oddeven($fp_num), 'FORUMS_POSTS_ROW_NUM' => $fp_num, 'FORUMS_POSTS_ROW_ORDER' => empty($id) ? $d + $fp_num : $id));
    foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
        $tag = mb_strtoupper($exfld['field_name']);
        $t->assign(array('FORUMS_POSTS_ROW_' . $tag . '_TITLE' => isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'FORUMS_POSTS_ROW_' . $tag => cot_build_extrafields_data('forums', $exfld, $row['fp_' . $exfld['field_name']], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_POSTS_ROW_' . $tag . '_VALUE' => $row['fp_' . $exfld['field_name']]));
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_POSTS_ROW');
}
$lastpage = $d + $cfg['forums']['maxpostsperpage'] < $totalposts ? FALSE : TRUE;
$pagenav = cot_pagenav('forums', "m=posts&q={$q}", $d, $totalposts, $cfg['forums']['maxpostsperpage']);
$jumpbox[cot_url('forums')] = $L['Forums'];
foreach ($structure['forums'] as $key => $val) {
    if (cot_auth('forums', $key, 'R') && strpos($val['path'], '.')) {
        $val['tpath'] == $s || ($movebox[$key] = $val['tpath']);
        $jumpbox[cot_url('forums', 'm=topics&s=' . $key, '', true)] = $val['tpath'];
    }
}
if ($usr['isadmin']) {
    $t->assign(array('FORUMS_POSTS_MOVE_URL' => cot_url('forums', 'm=topics&a=move&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_BUMP_URL' => cot_url('forums', 'm=topics&a=bump&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_LOCK_URL' => cot_url('forums', 'm=topics&a=lock&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_STICKY_URL' => cot_url('forums', 'm=topics&a=sticky&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_ANNOUNCE_URL' => cot_url('forums', 'm=topics&a=announcement&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_PRIVATE_URL' => cot_url('forums', 'm=topics&a=private&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_CLEAR_URL' => cot_url('forums', 'm=topics&a=clear&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_DELETE_URL' => cot_confirm_url(cot_url('forums', 'm=topics&a=delete&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'forums', 'forums_confirm_delete_topic'), 'FORUMS_POSTS_MOVEBOX_SELECT' => cot_selectbox('', 'ns', array_keys($movebox), array_values($movebox), false), 'FORUMS_POSTS_MOVEBOX_KEEP' => cot_checkbox('0', 'ghost')));
    $t->parse('MAIN.FORUMS_POSTS_ADMIN');
}
$allowreplybox = $cfg['forums']['antibumpforums'] && $row['fp_posterid'] > 0 && $row['fp_posterid'] == $usr['id'] && $usr['auth_write'] ? FALSE : TRUE;
if (($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0 && $allowreplybox && $usr['auth_write']) {
    if ($quote > 0) {
        $sql_forums_quote = $db->query("SELECT fp_id, fp_text, fp_postername, fp_posterid, fp_creation FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? AND fp_id = ? LIMIT 1", array($q, $s, $quote));
Exemple #13
0
 $sql = $db->query("SELECT p.*, u.* {$news_join_columns}\n\t\t\tFROM {$db_pages} AS p LEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid {$news_join_tables}\n\t\t\tWHERE {$where} ORDER BY page_date DESC LIMIT " . $v[3]['d'] . ", " . $v[1]);
 $totalnews = $db->query("SELECT COUNT(*)\n\t\t\tFROM {$db_pages} AS p {$news_join_tables} WHERE " . $where)->fetchColumn();
 if ($v[3]['d'] < 0 || $totalnews > 0 && $v[3]['d'] > $totalnews) {
     cot_die_message(404);
 }
 if (!$cfg['plugin']['news']['syncpagination']) {
     $news_link_params .= $catn != 0 && $d != 0 ? '&d=' . $durl : '';
     $xx = 0;
     foreach ($cats as $key => $var) {
         $news_link_params .= $key != $cat && $var[3] != 0 && $xx != 0 ? "&" . $key . "d=" . $var[3]['durl'] : '';
         $xx++;
     }
 }
 $news_link = cot_url('index', $news_link_params);
 $catd = $catn != 0 && !$cfg['plugin']['news']['syncpagination'] ? $cat . "d" : "d";
 $pagenav = cot_pagenav('index', $news_link_params, $v[3]['d'], $totalnews, $v[1], $catd);
 $filename = str_replace(array(' ', ',', '.', '-'), '_', $v[0]);
 $news = new XTemplate(cot_tplfile($catn == 0 ? "news" : "news." . $filename, 'plug'));
 $sql_rowset = $sql->fetchAll();
 $jj = 0;
 foreach ($sql_rowset as $pag) {
     $jj++;
     $url = cot_url('index', 'c=' . $pag['page_cat']);
     $news->assign(cot_generate_pagetags($pag, 'PAGE_ROW_', $v[2]));
     $news->assign(array('PAGE_ROW_NEWSPATH' => cot_rc_link($url, htmlspecialchars($structure['page'][$row['page_cat']]['title'])), 'PAGE_ROW_NEWSPATH_URL' => $url, 'PAGE_ROW_CATDESC' => htmlspecialchars($structure['page'][$pag['page_cat']]['desc']), 'PAGE_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_NUM' => $jj));
     $news->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
     /* === Hook - Part2 : Include === LOOP === */
     foreach ($news_extp as $pl) {
         include $pl;
     }
     /* ===== */
Exemple #14
0
$admin_comments_join_fields = '';
$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']) {
function cot_tag_search_projects($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_projects, $o, $row, $sys;
    if (!cot_module_active('projects')) {
        return;
    }
    $query = cot_tag_parse_query($query, 'p.item_id');
    if (empty($query)) {
        return;
    }
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_state = 0")->fetchColumn();
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `item_title`';
            break;
        case 'date':
            $order = 'ORDER BY `item_date` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `item_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.projects.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT DISTINCT p.* {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id {$join_tables}\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_id IS NOT NULL AND p.item_state = 0 {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$cfg['maxrowsperpage']}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_projects']);
    $pcount = $sql->rowCount();
    /* == Hook : Part 1 == */
    $extp = cot_getextplugins('tags.search.projects.loop');
    /* ===== */
    if ($pcount > 0) {
        foreach ($sql->fetchAll() as $row) {
            $tags = cot_tag_list($row['item_id'], 'projects');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'projects', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $t->assign(cot_generate_projecttags($row, 'TAGS_RESULT_ROW_'));
            $t->assign(array('TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['item_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_structure_buildpath('projects', $row['item_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            /* == Hook : Part 2 == */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'projects', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $cfg['maxrowsperpage']);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
        /* == Hook == */
        foreach (cot_getextplugins('tags.search.projects.tags') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    if ($pcount == 0) {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
/**
 * Global tag cloud and search form
 *
 * @param string $area Site area
 * @global CotDB $db
 */
function cot_tag_search_form($area = 'all')
{
    global $db, $dt, $perpage, $lang, $tl, $qs, $t, $L, $R, $cfg, $db_tag_references, $tc_styles;
    $limit = $perpage > 0 ? "{$dt}, {$perpage}" : NULL;
    $tcloud = cot_tag_cloud($area, $cfg['plugin']['tags']['order'], $limit);
    $tc_html = $R['tags_code_cloud_open'];
    foreach ($tcloud as $tag => $cnt) {
        $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
        $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
        $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
        foreach ($tc_styles as $key => $val) {
            if ($cnt <= $key) {
                $dim = $val;
                break;
            }
        }
        $tc_html .= cot_rc('tags_link_cloud_tag', array('url' => cot_url('plug', array('e' => 'tags', 'a' => $area, 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), 'tag_title' => htmlspecialchars($tag_t), 'dim' => $dim));
    }
    $tc_html .= $R['tags_code_cloud_close'];
    $t->assign('TAGS_CLOUD_BODY', $tc_html);
    $t->parse('MAIN.TAGS_CLOUD');
    if ($perpage > 0) {
        $where = $area == 'all' ? '' : "WHERE tag_area = '{$area}'";
        $sql = $db->query("SELECT COUNT(DISTINCT `tag`) FROM {$db_tag_references} {$where}");
        $totalitems = (int) $sql->fetchColumn();
        $pagenav = cot_pagenav('plug', 'e=tags&a=' . $area, $dt, $totalitems, $perpage, 'dt');
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
    }
}
Exemple #17
0
        cot_error($L['plu_noneresult'] . $R['code_error_separator']);
    }
    if (!cot_error_found()) {
        $t->parse('MAIN.RESULTS');
    }
    $rs_url_path = array();
    foreach ($rs as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $sk => $sv) {
                $rs_url_path['rs[' . $k . '][' . $sk . ']'] = $sv;
            }
        } else {
            $rs_url_path['rs[' . $k . ']'] = $v;
        }
    }
    $pagenav = cot_pagenav('plug', array('e' => 'search', 'sq' => $sq, 'tab' => $tab) + $rs_url_path, $d, array_sum($totalitems), $cfg_maxitems);
}
// Search title
$crumbs = array(array(cot_url('plug', 'e=search'), $L['plu_search']));
if (!empty($tab)) {
    $crumbs[] = array(cot_url('plug', 'e=search&tab=' . $tab), $L['plu_tabs_' . $tab]);
}
$out['head'] .= $R['code_noindex'];
$search_subtitle = empty($tab) ? $L['plu_search'] : $L['plu_tabs_' . $tab] . ' - ' . $L['plu_search'];
$out['subtitle'] = empty($sq) ? $search_subtitle : htmlspecialchars(strip_tags($sq)) . ' - ' . $L['plu_result'];
$t->assign(array('PLUGIN_TITLE' => cot_breadcrumbs($crumbs, $cfg['breadcrumb'], true), 'PLUGIN_SEARCH_ACTION' => cot_url('plug', 'e=search&tab=' . $tab), 'PLUGIN_SEARCH_TEXT' => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'size="32" maxlength="' . $cfg['plugin']['search']['maxsigns'] . '"'), 'PLUGIN_SEARCH_USER' => cot_inputbox('text', 'rs[setuser]', htmlspecialchars($rs['setuser']), 'class="userinput" size="32"'), 'PLUGIN_SEARCH_DATE_SELECT' => cot_selectbox($rs['setlimit'], 'rs[setlimit]', range(0, 5), array($L['plu_any_date'], $L['plu_last_2_weeks'], $L['plu_last_1_month'], $L['plu_last_3_month'], $L['plu_last_1_year'], $L['plu_need_datas']), false), 'PLUGIN_SEARCH_DATE_FROM' => cot_selectbox_date($rs['setfrom'], 'short', 'rfrom', cot_date('Y', $sys['now']) + 1), 'PLUGIN_SEARCH_DATE_TO' => cot_selectbox_date($rs['setto'], 'short', 'rto', cot_date('Y', $sys['now']) + 1), 'PLUGIN_SEARCH_FOUND' => array_sum($totalitems) > 0 ? array_sum($totalitems) : '', 'PLUGIN_PAGEPREV' => $pagenav['prev'], 'PLUGIN_PAGENEXT' => $pagenav['next'], 'PLUGIN_PAGENAV' => $pagenav['main']));
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('search.tags') as $pl) {
    include $pl;
}
Exemple #18
0
                } else {
                    $notfoundet .= '#' . $id . ' - ' . $L['Error'] . '<br  />';
                }
            }
        }
        $cache && $cache->db->remove('structure', 'system');
        if ($cache && $cfg['cache_index']) {
            $cache->page->clear('index');
        }
        if (!empty($perelik)) {
            cot_message($notfoundet . $perelik . ' - ' . $L['adm_queue_deleted']);
        }
    }
}
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE " . $sqlwhere)->fetchColumn();
$pagenav = cot_pagenav('admin', $common_params, $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_page = $db->query("SELECT p.*, u.user_name\n\tFROM {$db_pages} as p\n\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\tWHERE {$sqlwhere}\n\t\tORDER BY {$sqlsorttype} {$sqlsortway}\n\t\tLIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.admin.loop');
/* ===== */
foreach ($sql_page->fetchAll() as $row) {
    $sql_page_subcount = $db->query("SELECT SUM(structure_count) FROM {$db_structure} WHERE structure_path LIKE '" . $db->prep($structure['page'][$row["page_cat"]]['rpath']) . "%' ");
    $sub_count = $sql_page_subcount->fetchColumn();
    $row['page_file'] = intval($row['page_file']);
    $t->assign(cot_generate_pagetags($row, 'ADMIN_PAGE_', 200));
    $t->assign(array('ADMIN_PAGE_ID_URL' => cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id']), 'ADMIN_PAGE_OWNER' => cot_build_user($row['page_ownerid'], htmlspecialchars($row['user_name'])), 'ADMIN_PAGE_FILE_BOOL' => $row['page_file'], 'ADMIN_PAGE_URL_FOR_VALIDATED' => cot_confirm_url(cot_url('admin', $common_params . '&a=validate&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_validate'), 'ADMIN_PAGE_URL_FOR_UNVALIDATE' => cot_confirm_url(cot_url('admin', $common_params . '&a=unvalidate&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_unvalidate'), 'ADMIN_PAGE_URL_FOR_DELETED' => cot_confirm_url(cot_url('admin', $common_params . '&a=delete&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_delete'), 'ADMIN_PAGE_URL_FOR_EDIT' => cot_url('page', 'm=edit&id=' . $row['page_id']), 'ADMIN_PAGE_ODDEVEN' => cot_build_oddeven($ii), 'ADMIN_PAGE_CAT_COUNT' => $sub_count));
    $t->assign(cot_generate_usertags($row['page_ownerid'], 'ADMIN_PAGE_OWNER_'), htmlspecialchars($row['user_name']));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
/**
 * 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']);
            $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;
}
Exemple #20
0
 /**
  * Список писем в очереди на отправку
  * @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;
     }
     $pagenav['page'] = $pagenav['current'];
     if (!cot::$cfg['easypagenav']) {
         $pagenav['page'] = ($pagenav['current'] - 1) * $maxrowsperpage;
     }
     $subscribes = subscribe_model_Subscribe::keyValPairs();
     $template = array('subscribe', 'admin', 'queue', '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;
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.admin.queue.list.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$sql_market_count_cat = $db->query("SELECT item_cat, COUNT(item_cat) as cat_count FROM {$db_market} " . $wherecount . " GROUP BY item_cat")->fetchAll();
$sql_market_count = $db->query("SELECT * FROM {$db_market} as m \n\t" . $wherecount . "");
$market_count_all = $market_count = $sql_market_count->rowCount();
$sqllist = $db->query("SELECT * FROM {$db_market} AS m\n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $cfg['market']['cat___default']['maxrowsperpage']);
foreach ($sql_market_count_cat as $value) {
    $page_nav[$value['item_cat']] = $value['cat_count'];
    $t1->assign(array("PRD_CAT_ROW_TITLE" => &$structure['folio'][$value['item_cat']]['title'], "PRD_CAT_ROW_ICON" => &$structure['folio'][$value['item_cat']]['icon'], "PRD_CAT_ROW_URL" => cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name'] . '&tab=market&cat=' . $value['item_cat']), "PRD_CAT_ROW_COUNT_MARKET" => $value['cat_count'], "PRD_CAT_ROW_SELECT" => $category && $category == $value['item_cat'] ? 1 : ''));
    $t1->parse("MAIN.CAT_ROW");
}
$opt_array = array('m' => 'details', 'id' => $urr['user_id'], 'u' => $urr['user_name'], 'tab' => 'market');
if ($category) {
    $market_count = $page_nav[$category];
    $opt_array['cat'] = $category;
}
$pagenav = cot_pagenav('users', $opt_array, $d, $market_count, $cfg['market']['cat___default']['maxrowsperpage'], 'dmarket');
$t1->assign(array("PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $market_count));
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
    $sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('market.userdetails.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $t1->assign(cot_generate_markettags($item, 'PRD_ROW_', $cfg['market']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    /* === Hook === */
    foreach ($extp as $pl) {
        include $pl;
    }
Exemple #22
0
$sql_users = $db->query("\n\tSELECT DISTINCT u.*, o.*, {$is_user_check}\n\tFROM {$db_online} AS o\n\t{$join_condition} {$where}\n\tORDER BY is_user DESC, online_lastseen DESC {$limit}\n");
$sql_users_count = $db->query("SELECT COUNT(*) as cnt, {$is_user_check} FROM {$db_online} as o {$where} GROUP BY is_user");
$who_guests = 0;
$who_users = 0;
foreach ($sql_users_count as $row) {
    if ($row['is_user']) {
        $who_users = (int) $row['cnt'];
    } else {
        $who_guests = (int) $row['cnt'];
    }
}
$totallines = $who_users + $who_guests;
if (!$cfg['easypagenav'] && $durl > 0 && $maxuserssperpage > 0 && $durl % $maxuserssperpage > 0 || $d > 0 && $d >= $totallines) {
    cot_redirect(cot_url('whosonline'));
}
$pagenav = cot_pagenav('whosonline', array('d' => $durl), $d, $totallines, $maxuserssperpage);
/* === Hooks - Part1 : Set === */
$users_loop_hook = cot_getextplugins('whosonline.users.loop');
$guests_loop_hook = cot_getextplugins('whosonline.guests.loop');
/* ===== */
if ($maxuserssperpage) {
    $fpu = $who_users / $maxuserssperpage;
    if ($durl > ceil($fpu)) {
        $guest_start_num = $maxuserssperpage - $who_users % $maxuserssperpage + ($durl - 1 - ceil($fpu)) * $maxuserssperpage;
    }
}
foreach ($sql_users->fetchAll() as $row) {
    if ($hiddenusers && in_array($row['user_id'], $hiddenusers)) {
        if (cot_auth('plug', 'hiddengroups', '1')) {
            $t->assign('USER_HIDDEN', $L['Hidden']);
        } else {
Exemple #23
0
/**
 * Search by tag in forums
 *
 * @param string $query User-entered query string
 * @global CotDB $db
 */
function cot_tag_search_forums($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_forum_topics, $o, $row;
    if (!cot_module_active('forums')) {
        return;
    }
    $query = cot_tag_parse_query($query, 't.ft_id');
    if (empty($query)) {
        return;
    }
    $maxperpage = cot::$cfg['maxrowsperpage'] && is_numeric(cot::$cfg['maxrowsperpage']) && cot::$cfg['maxrowsperpage'] > 0 ? cot::$cfg['maxrowsperpage'] : 15;
    $join_columns = '';
    $join_tables = '';
    $join_where = '';
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `ft_title`';
            break;
        case 'date':
            $order = 'ORDER BY `ft_updated` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `ft_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.forums.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) {$join_where}")->fetchColumn();
    $sql = $db->query("SELECT DISTINCT t.ft_id, t.ft_cat, t.ft_title {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) AND t.ft_id IS NOT NULL {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$maxperpage}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_forums']);
    if ($sql->rowCount() > 0) {
        while ($row = $sql->fetch()) {
            $tags = cot_tag_list($row['ft_id'], 'forums');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'forums', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $master = $row['fs_masterid'] > 0 ? array($row['fs_masterid'], $row['fs_mastername']) : false;
            $t->assign(array('TAGS_RESULT_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['ft_id']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'forums', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $maxperpage);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
    } else {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
Exemple #24
0
    // Extra fields for structure
    if (!empty(cot::$extrafields[cot::$db->structure])) {
        foreach (cot::$extrafields[cot::$db->structure] as $exfld) {
            $uname = strtoupper($exfld['field_name']);
            $exfld_title = cot_extrafield_title($exfld, 'structure_');
            $t->assign(array('LIST_ROWCAT_' . $uname . '_TITLE' => $exfld_title, 'LIST_ROWCAT_' . $uname => cot_build_extrafields_data('structure', $exfld, cot::$structure['page'][$x][$exfld['field_name']]), 'LIST_ROWCAT_' . $uname . '_VALUE' => cot::$structure['page'][$x][$exfld['field_name']]));
        }
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.LIST_ROWCAT');
}
$pagenav_cat = cot_pagenav('page', $list_url_path + array('d' => $durl), $dc, count($allsub), cot::$cfg['page']['maxlistsperpage'], 'dc');
$t->assign(array('LISTCAT_PAGEPREV' => $pagenav_cat['prev'], 'LISTCAT_PAGENEXT' => $pagenav_cat['next'], 'LISTCAT_PAGNAV' => $pagenav_cat['main']));
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.list.loop');
/* ===== */
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_rowset_other = false;
/* === Hook === */
foreach (cot_getextplugins('page.list.before_loop') as $pl) {
    include $pl;
}
/* ===== */
if (!$sqllist_rowset_other) {
    foreach ($sqllist_rowset as $pag) {
        $jj++;
Exemple #25
0
    $db->update($db_contact, array('contact_val' => 1), "contact_id = {$id}");
    cot_message('Updated');
} elseif ($a == 'unval') {
    $db->update($db_contact, array('contact_val' => 0), "contact_id = {$id}");
    cot_message('Updated');
} elseif ($a == 'send' && $rtext != '') {
    $row = $db->query("SELECT contact_email FROM {$db_contact} WHERE contact_id = {$id}")->fetch();
    cot_mail($row['contact_email'], $cfg['mainurl'], $rtext);
    $db->update($db_contact, array('contact_reply' => $rtext), "contact_id = {$id}");
    cot_message('Done');
}
$adminsubtitle = $L['contact_title'];
$tuman = new XTemplate(cot_tplfile('contact.tools', 'plug', true));
$totallines = $db->query("SELECT COUNT(*) FROM {$db_contact}")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_contact} ORDER BY contact_val ASC, contact_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagnav = cot_pagenav('admin', 'm=other&p=contact', $d, $totallines, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$i = 0;
foreach ($sql->fetchAll() as $row) {
    $i++;
    $shorttext = $row['contact_text'];
    $shorttext = cot_string_truncate($shorttext, 150);
    $shorttext .= '...';
    $val = $row['contact_val'] == 1 ? 'unval' : 'val';
    $urlParams = array('m' => 'other', 'p' => 'contact');
    $tmp = $urlParams;
    $tmp['id'] = $row['contact_id'];
    if ($durl > 0) {
        $tmp['d'] = $durl;
    }
    $viewLink = cot_url('admin', $tmp, '#view');
    $tuman->assign(array('CONTACT_DATE' => cot_date('date_full', $row['contact_date']), 'CONTACT_DATE_STAMP' => $row['contact_date'], 'CONTACT_USER' => $row['contact_authorid'] > 0 ? cot_build_user($row['contact_authorid'], $row['contact_author']) : $row['contact_author'], 'CONTACT_EMAIL' => $row['contact_email'], 'CONTACT_ID' => $row['contact_id'], 'CONTACT_DELLINK' => cot_confirm_url(cot_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id'])), 'CONTACT_VIEWLINK' => $viewLink, 'CONTACT_VAL' => $val, 'CONTACT_VALLINK' => cot_url('admin', 'm=other&p=contact&a=' . $val . '&id=' . $row['contact_id']), 'CONTACT_READLINK' => cot_url('admin', 'm=other&p=contact&a=val&id=' . $row['contact_id']), 'CONTACT_UNREADLINK' => cot_url('admin', 'm=other&p=contact&a=unval&id=' . $row['contact_id']), 'CONTACT_SUBJECT' => $row['contact_subject'], 'CONTACT_TEXT' => $row['contact_text'], 'CONTACT_REPLY' => !empty($row['contact_reply']), 'CONTACT_TEXTSHORT' => $shorttext, 'CONTACT_ODDEVEN' => cot_build_oddeven($i), 'CONTACT_I' => $i));
}
$list_url_path = array('c' => $c, 'type' => $type, 'sort' => $sort, 'sq' => $sq);
// Building the canonical URL
$out['canonical_uri'] = cot_url('projects', $list_url_path);
$mskin = cot_tplfile(array('projects', 'list', $structure['projects'][$c]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('projects.list.query') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_projects} AS p {$join_condition}\n\tLEFT JOIN {$db_users} AS u ON u.user_id=p.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT p.*, u.* {$join_columns} \n\tFROM {$db_projects} AS p {$join_condition}\n\tLEFT JOIN {$db_users} AS u ON u.user_id=p.item_userid\n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('projects', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('projects'), $L['projects']);
if (!empty($c)) {
    $catpatharray = array_merge($catpatharray, cot_structure_buildpath('projects', $c));
}
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
if (is_array($projects_types)) {
    foreach ($projects_types as $i => $pr_type) {
        $t->assign(array("PTYPE_ROW_ID" => $i, "PTYPE_ROW_TITLE" => $pr_type, "PTYPE_ROW_URL" => cot_url('projects', 'c=' . $c . '&type=' . $i), "PTYPE_ROW_ACT" => $type == $i ? 'act' : ''));
        $t->parse("MAIN.PTYPES.PTYPES_ROWS");
    }
}
$t->assign(array("PTYPE_ALL_URL" => cot_url('projects', 'c=' . $c), "PTYPE_ALL_ACT" => empty($type) && empty($realized) ? true : false, "REALIZED_URL" => cot_url('projects', 'c=' . $c . '&realized=1'), "FORPRO_URL" => cot_url('projects', 'c=' . $c . '&type=' . $type . '&forpro=1'), "REALIZED_ACT" => !empty($realized) ? true : false, "SUBMITNEWPROJECT_URL" => cot_url('projects', 'm=add&c=' . $c . '&type=' . $type)));
$t->parse("MAIN.PTYPES");
$t->assign(array("SEARCH_ACTION_URL" => cot_url('projects', "&type=" . $type, '', 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), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, "CATALOG" => cot_build_structure_projects_tree('', array($c)), "BREADCRUMBS" => $catpath, "CATTITLE" => !empty($c) ? $structure['projects'][$c]['title'] : '', "CATDESC" => !empty($c) ? $structure['projects'][$c]['desc'] : '', "SUBMITNEWPROJECT_URL" => cot_url('projects', 'm=add&c=' . $c . '&type=' . $type)));
foreach ($cot_extrafields[$db_projects] as $exfld) {
 $adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
 $adminpath[] = array($is_module ? cot_url('admin', 'm=' . $n) : cot_url('admin', 'm=extensions&a=details&pl=' . $n), $ext_info['name']);
 $adminpath[] = array(cot_url('admin', 'm=structure&n=' . $n), $L['Structure']);
 if ($id > 0 || !empty($al)) {
     $where = $id > 0 ? 'structure_id=' . (int) $id : "structure_code='" . $db->prep($al) . "'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE {$where} LIMIT 1");
     cot_die($sql->rowCount() == 0);
 } elseif ($mode && ($mode == 'all' || $structure[$n][$mode])) {
     $sqlmask = $mode == 'all' ? "structure_path NOT LIKE '%.%'" : "structure_path LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%' AND structure_path NOT LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%.%'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask} ORDER BY structure_path ASC, structure_code ASC LIMIT {$d}, " . $maxrowsperpage);
     $totalitems = $db->query("SELECT COUNT(*) FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask}")->fetchColumn();
     $pagenav = cot_pagenav('admin', 'm=structure&n=' . $n . '&mode=' . $mode, $d, $totalitems, $maxrowsperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 } else {
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' ORDER BY structure_path ASC, structure_code ASC LIMIT {$d}, " . $maxrowsperpage);
     $totalitems = $db->query("SELECT COUNT(*) FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "'")->fetchColumn();
     $pagenav = cot_pagenav('admin', 'm=structure&n=' . $n, $d, $totalitems, $maxrowsperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 }
 $t->assign(array('ADMIN_STRUCTURE_UPDATE_FORM_URL' => cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&a=update&d=' . $durl), 'ADMIN_PAGE_STRUCTURE_RESYNCALL' => cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&a=resyncall&' . cot_xg() . '&d=' . $durl), 'ADMIN_STRUCTURE_URL_EXTRAFIELDS' => cot_url('admin', 'm=extrafields&n=' . $db_structure)));
 $ii = 0;
 /* === Hook - Part1 : Set === */
 $extp = cot_getextplugins('admin.structure.loop');
 /* ===== */
 foreach ($sql->fetchAll() as $row) {
     $id && ($adminpath[] = array(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&id=' . $id), htmlspecialchars($row['structure_title'])));
     $al && ($adminpath[] = array(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&al=' . $al), htmlspecialchars($row['structure_title'])));
     $ii++;
     $structure_id = $row['structure_id'];
     $structure_code = $row['structure_code'];
     $pathfielddep = count(explode(".", $row['structure_path']));
     $dozvil = $row['structure_count'] > 0 ? false : true;
     $pathspaceimg = '';
Exemple #28
0
/**
 * Generates comments display for a given item
 *
 * @param string $ext_name Module or plugin code
 * @param string $code Item identifier
 * @param string $cat Item category code (optional)
 * @param bool $force_admin Enforces user to be administrator of comments for this item.
 *	E.g. to moderate his wall even if he is not a moderator
 * @return string Rendered HTML output for comments
 * @global CotDB $db
 */
function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false)
{
    global $db, $db_com, $db_users, $cfg, $usr, $L, $sys, $R, $env, $pg, $cot_extrafields, $cache, $structure;
    // Check permissions and enablement
    list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'comments');
    if ($auth_read && $auth_write && $force_admin) {
        $auth_admin = true;
        $_SESSION['cot_comments_force_admin'][$ext_name][$code] = true;
    }
    $enabled = cot_comments_enabled($ext_name, $cat, $code);
    if (!$auth_read || !$enabled && !$auth_admin) {
        return '';
    }
    $comments_join_columns = $comments_join_tables = $comments_join_where = '';
    // Get the URL and parameters
    $link_area = $env['ext'];
    $link_params = $_GET;
    if (defined('COT_PLUG')) {
        $link_area = 'plug';
        $link_params['e'] = $env['ext'];
    }
    if (isset($_GET['rwr'])) {
        unset($link_params['rwr'], $link_params['e']);
    }
    $cot_com_back = array($link_area, $link_params);
    $_SESSION['cot_com_back'][$ext_name][$cat][$code] = $cot_com_back;
    $d_var = 'dcm';
    list($pg, $d, $durl) = cot_import_pagenav($d_var, $cfg['plugin']['comments']['maxcommentsperpage']);
    $d = empty($d) ? 0 : (int) $d;
    if ($auth_write && $enabled) {
        require_once cot_incfile('forms');
    }
    $t = new XTemplate(cot_tplfile('comments', 'plug'));
    /* == Hook == */
    foreach (cot_getextplugins('comments.main') as $pl) {
        include $pl;
    }
    /* ===== */
    $editor = cot::$cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : '';
    $t->assign(array('COMMENTS_CODE' => $code, 'COMMENTS_FORM_SEND' => cot_url('plug', "e=comments&a=send&area={$ext_name}&cat={$cat}&item={$code}"), 'COMMENTS_FORM_AUTHOR' => $usr['id'] > 0 ? $usr['name'] : cot_inputbox('text', 'rname'), 'COMMENTS_FORM_AUTHORID' => $usr['id'], 'COMMENTS_FORM_TEXT' => $auth_write && $enabled ? cot_textarea('rtext', $rtext, 7, 120, '', $editor) . cot_inputbox('hidden', 'cb', base64_encode(serialize($cot_com_back))) : '', 'COMMENTS_DISPLAY' => $cfg['plugin']['comments']['expand_comments'] ? '' : 'none'));
    if ($auth_write && $enabled) {
        // Extra fields
        if (!empty(cot::$extrafields[cot::$db->com])) {
            foreach (cot::$extrafields[cot::$db->com] as $exfld) {
                $uname = strtoupper($exfld['field_name']);
                $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $rcomments[$exfld['field_name']]);
                $exfld_title = cot_extrafield_title($exfld, 'comments_');
                $t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title));
                $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.EXTRAFLD');
            }
        }
        $allowed_time = cot_build_timegap($sys['now'] - $cfg['plugin']['comments']['time'] * 60, $sys['now']);
        $com_hint = cot_rc('com_edithint', array('time' => $allowed_time));
        /* == Hook == */
        foreach (cot_getextplugins('comments.newcomment.tags') as $pl) {
            include $pl;
        }
        /* ===== */
        $usr['id'] == 0 && $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.GUEST');
        if ($usr['id'] == 0 && cot_check_messages() && $cache) {
            if ($ext_name == 'page' && $cfg['cache_page']) {
                $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$cat]['path']));
                $cfg['cache_page'] = false;
            }
        }
        cot_display_messages($t, 'COMMENTS.COMMENTS_NEWCOMMENT');
        $t->assign('COMMENTS_FORM_HINT', $com_hint);
        $t->parse('COMMENTS.COMMENTS_NEWCOMMENT');
    } else {
        $warning = $enabled ? $L['com_regonly'] : $L['com_closed'];
        $t->assign('COMMENTS_CLOSED', $warning);
        $t->parse('COMMENTS.COMMENTS_CLOSED');
    }
    $order = $cfg['plugin']['comments']['order'] == 'Chronological' ? 'ASC' : 'DESC';
    $comments_order = "com_id {$order}";
    /* == Hook == */
    foreach (cot_getextplugins('comments.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT c.*, u.* {$comments_join_columns}\n\t\tFROM {$db_com} AS c LEFT JOIN {$db_users} AS u ON u.user_id = c.com_authorid {$comments_join_tables}\n\t\tWHERE com_area = ? AND com_code = ? {$comments_join_where} ORDER BY {$comments_order} LIMIT ?, ?", array($ext_name, $code, (int) $d, (int) $cfg['plugin']['comments']['maxcommentsperpage']));
    if ($sql->rowCount() > 0 && $enabled) {
        $i = $d;
        $kk = 0;
        $totalitems = cot_comments_count($ext_name, $code);
        /* === Hook - Part1 : Set === */
        $extp = cot_getextplugins('comments.loop');
        /* ===== */
        foreach ($sql->fetchAll() as $row) {
            $i++;
            $kk++;
            $com_admin = $auth_admin ? cot_rc('comments_code_admin', array('ipsearch' => cot_build_ipsearch($row['com_authorip']), 'delete_url' => cot_confirm_url(cot_url('plug', 'e=comments&a=delete&cat=' . $cat . '&id=' . $row['com_id'] . '&' . cot_xg()), 'comments', 'comments_confirm_delete'))) : '';
            $com_text = cot_parse($row['com_text'], $cfg['plugin']['comments']['markup']);
            $time_limit = $sys['now'] < $row['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE;
            $usr['isowner_com'] = $time_limit && ($usr['id'] > 0 && $row['com_authorid'] == $usr['id'] || $usr['id'] == 0 && !empty($_SESSION['cot_comments_edit'][$row['com_id']]) && $usr['ip'] == $row['com_authorip']);
            $com_gup = $sys['now'] - ($row['com_date'] + $cfg['plugin']['comments']['time'] * 60);
            $allowed_time = $usr['isowner_com'] && !$usr['isadmin'] ? ' - ' . cot_build_timegap($sys['now'] + $com_gup, $sys['now']) . $L['plu_comgup'] : '';
            $com_edit = $auth_admin || $usr['isowner_com'] ? cot_rc('comments_code_edit', array('edit_url' => cot_url('plug', 'e=comments&m=edit&cat=' . $cat . '&id=' . $row['com_id']), 'allowed_time' => $allowed_time)) : '';
            if ($row['com_area'] == 'page') {
                if ($usr['id'] == 0 && $usr['isowner_com'] && $cfg['cache_page']) {
                    $cfg['cache_page'] = $cfg['cache_index'] = false;
                }
            }
            $t->assign(array('COMMENTS_ROW_ID' => $row['com_id'], 'COMMENTS_ROW_ORDER' => $cfg['plugin']['comments']['order'] == 'Recent' ? $totalitems - $i + 1 : $i, 'COMMENTS_ROW_URL' => cot_url($link_area, $link_params, '#c' . $row['com_id']), 'COMMENTS_ROW_AUTHOR' => cot_build_user($row['com_authorid'], htmlspecialchars($row['com_author'])), 'COMMENTS_ROW_AUTHORID' => $row['com_authorid'], 'COMMENTS_ROW_TEXT' => $com_text, 'COMMENTS_ROW_DATE' => cot_date('datetime_medium', $row['com_date']), 'COMMENTS_ROW_DATE_STAMP' => $row['com_date'], 'COMMENTS_ROW_ADMIN' => $com_admin, 'COMMENTS_ROW_EDIT' => $com_edit, 'COMMENTS_ROW_ODDEVEN' => cot_build_oddeven($kk), 'COMMENTS_ROW_NUM' => $kk));
            // Extrafields
            if (!empty(cot::$extrafields[cot::$db->com])) {
                foreach (cot::$extrafields[cot::$db->com] as $exfld) {
                    $tag = mb_strtoupper($exfld['field_name']);
                    $exfld_title = cot_extrafield_title($exfld, 'comments_');
                    $t->assign(array('COMMENTS_ROW_' . $tag . '_TITLE' => $exfld_title, 'COMMENTS_ROW_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'COMMENTS_ROW_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']]));
                }
            }
            $t->assign(cot_generate_usertags($row, 'COMMENTS_ROW_AUTHOR_', htmlspecialchars($row['com_author'])));
            /* === Hook - Part2 : Include === */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('COMMENTS.COMMENTS_ROW');
        }
        $pagenav = cot_pagenav($link_area, $link_params, $d, $totalitems, $cfg['plugin']['comments']['maxcommentsperpage'], $d_var, '#comments', $cfg['jquery'] && $cfg['ajax_enabled'], 'comments', 'plug', "e=comments&area={$ext_name}&cat={$cat}&item={$code}");
        $t->assign(array('COMMENTS_PAGES_INFO' => cot_rc('comments_code_pages_info', array('totalitems' => $totalitems, 'onpage' => $i - $d)), 'COMMENTS_PAGES_TOTALITEMS' => $totalitems, 'COMMENTS_PAGES_PAGESPREV' => $pagenav['prev'], 'COMMENTS_PAGES_PAGNAV' => $pagenav['main'], 'COMMENTS_PAGES_PAGESNEXT' => $pagenav['next']));
        $t->parse('COMMENTS.PAGNAVIGATOR');
    } elseif (!$sql->rowCount() && $enabled) {
        $t->assign(array('COMMENTS_EMPTYTEXT' => $L['com_nocommentsyet']));
        $t->parse('COMMENTS.COMMENTS_EMPTY');
    }
    /* == Hook == */
    foreach (cot_getextplugins('comments.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('COMMENTS');
    $res_display = $t->text('COMMENTS');
    return $res_display;
}
Exemple #29
0
$out['subtitle'] = $L['ukarma_title'];
$t = new XTemplate(cot_tplfile(array('ukarma', 'statistics'), 'plug'));
$where = array();
$order = array();
$where['userid'] = "ukarma_userid=" . $usr['id'];
$order['date'] = "ukarma_date DESC";
/* === Hook === */
foreach (cot_getextplugins('ukarma.statistics.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_ukarma}  \n\t" . $where . "")->fetchColumn();
$sqllist_rowset = $db->query("SELECT * FROM {$db_ukarma} AS k\n\tLEFT JOIN {$db_users} AS u ON u.user_id=k.ukarma_ownerid\n\t" . $where . " \n\t" . $order . "\n\tLIMIT {$d}, " . $cfg['maxrowsperpage'])->fetchAll();
$pagenav = cot_pagenav('ukarma', '', $d, $totalitems, $cfg['maxrowsperpage']);
$t->assign(array("PAGENAV_COUNT" => $totalitems, "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next']));
/* === Hook === */
$extp = cot_getextplugins('ukarma.statistics.loop');
/* ===== */
foreach ($sqllist_rowset as $score) {
    $jj++;
    $t->assign(cot_generate_usertags($score, 'UKARMA_ROW_OWNER_'));
    if ($score['ukarma_value'] > 0) {
        $sign = '+';
    } elseif ($score['ukarma_value'] < 0) {
        $sign = '-';
    }
    $t->assign(array('UKARMA_ROW_DATE' => $score['ukarma_date'], 'UKARMA_ROW_AREA' => $score['ukarma_area'], 'UKARMA_ROW_CODE' => $score['ukarma_code'], 'UKARMA_ROW_SCORE' => !empty($score['ukarma_value']) ? $score['ukarma_value'] : 0, 'UKARMA_ROW_SCORE_ABS' => !empty($score['ukarma_value']) ? abs($score['ukarma_value']) : 0, 'UKARMA_ROW_SIGN' => $sign));
    switch ($score['ukarma_area']) {
        case 'forums':
    default:
        $where['order_status'] = "o.order_status!='new'";
        break;
}
$order['date'] = 'o.order_date DESC';
/* === Hook === */
foreach (cot_getextplugins('marketorders.purchases.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$query_limit = $cfg['plugin']['marketorders']['ordersperpage'] > 0 ? "LIMIT {$d}, " . $cfg['plugin']['marketorders']['ordersperpage'] : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_market_orders} AS o \n\tLEFT JOIN {$db_market} AS m ON o.order_pid=m.item_id\n\t" . $where . "")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_market_orders} AS o\n\tLEFT JOIN {$db_market} AS m ON o.order_pid=m.item_id\n\t" . $where . "\n\t" . $order . "\n\t" . $query_limit . "");
$pagenav = cot_pagenav('marketorders', 'm=purchases&status=' . $status, $d, $totalitems, $cfg['plugin']['marketorders']['ordersperpage']);
$t->assign(array("PAGENAV_COUNT" => $totalitems, "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next']));
$catpatharray[] = array(cot_url('market'), $L['market']);
$catpatharray[] = array('', $L['marketorders_purchases_title']);
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("BREADCRUMBS" => $catpath));
/* === Hook === */
$extp = cot_getextplugins('marketorders.purchases.loop');
/* ===== */
while ($marketorder = $sql->fetch()) {
    $t->assign(cot_generate_markettags($marketorder, 'ORDER_ROW_PRD_'));
    $t->assign(cot_generate_usertags($marketorder['order_seller'], 'ORDER_ROW_SELLER_'));
    $t->assign(array("ORDER_ROW_ID" => $marketorder['order_id'], "ORDER_ROW_URL" => cot_url('marketorders', 'm=order&id=' . $marketorder['order_id']), "ORDER_ROW_COUNT" => $marketorder['order_count'], "ORDER_ROW_COST" => $marketorder['order_cost'], "ORDER_ROW_COMMENT" => $marketorder['order_text'], "ORDER_ROW_EMAIL" => $marketorder['order_email'], "ORDER_ROW_PAID" => $marketorder['order_paid'], "ORDER_ROW_STATUS" => $marketorder['order_status'], "ORDER_ROW_WARRANTYDATE" => $marketorder['order_paid'] + $cfg['plugin']['marketorders']['warranty'] * 60 * 60 * 24));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;