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');
}
$t->assign(array('TYPE_ALL_URL' => cot_url('admin', 'm=projects&c=' . $c), 'TYPE_ALL_ACT' => empty($type) ? 'act' : ''));
$t->parse('MAIN.TYPES');
$t->assign(array("SEARCH_ACTION_URL" => cot_url('admin', "m=projects&c=" . $c . "&type=" . $type, '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', $sq, 'class="schstring"'), "SEARCH_STATE" => cot_radiobox($state, 'state', array(0, 1, 2), array('опубликованные', 'скрытые', 'на проверке')), "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), 'TYPES_EDIT' => cot_url('admin', 'm=projects&p=types'), 'PAGENAV_PAGES' => $pagenav['main'], 'PAGENAV_PREV' => $pagenav['prev'], 'PAGENAV_NEXT' => $pagenav['next'], 'CATALOG' => cot_build_structure_projects_tree('', array($c)), 'CATTITLE' => !empty($c) ? ' / ' . !empty($c) ? ' / ' . htmlspecialchars($structure['projects'][$c]['title']) : '' : ''));
$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.admin.list.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $jj++;
    $t->assign(cot_generate_usertags($item, 'PRJ_ROW_OWNER_'));
    $t->assign(cot_generate_projecttags($item, 'PRJ_ROW_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    $t->assign(array('PRJ_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PRJ_ROW_EDIT_URL' => cot_url('projects', 'm=edit&id=' . $item['item_id']), 'PRJ_ROW_VALIDATE_URL' => cot_url('admin', 'm=projects&p=default&a=validate&id=' . $item['item_id']), 'PRJ_ROW_DELETE_URL' => cot_url('admin', 'm=projects&p=default&a=delete&id=' . $item['item_id'])));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse("MAIN.PRJ_ROWS");
}
/* === Hook === */
$extp = cot_getextplugins('projects.admin.list.tags');
foreach ($extp as $pl) {
    include $pl;
}
/* ===== */
$t->parse("MAIN");
$adminmain = $t->text("MAIN");
Example #3
0
foreach (cot_getextplugins('market.list.search.tags') as $pl) {
    include $pl;
}
/* ===== */
$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.list.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $jj++;
    $t->assign(cot_generate_usertags($item, 'PRD_ROW_OWNER_'));
    $t->assign(cot_generate_markettags($item, 'PRD_ROW_', $cfg['market']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    $t->assign(array("PRD_ROW_ODDEVEN" => cot_build_oddeven($jj)));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse("MAIN.PRD_ROWS");
}
/* === Hook === */
foreach (cot_getextplugins('market.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$module_body = $t->text('MAIN');
    }
    $sqllist = $db->query("SELECT SQL_CALC_FOUND_ROWS p.* {$search_join_columns}\n\t\tFROM {$db_projects} AS p {$search_join_condition}\n\t\tWHERE {$where}\n\t\tORDER BY item_" . $rs['prjsort'] . " " . $rs['prjsort2'] . "\n\t\tLIMIT {$d}, " . $cfg_maxitems . $search_union_query);
    $items = $sql->rowCount();
    $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
    $jj = 0;
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    /* === Hook - Part 1 === */
    $extp = cot_getextplugins('projects.search.loop');
    /* ===== */
    foreach ($sqllist_rowset as $row) {
        $url_cat = cot_url('projects', 'c=' . $row['item_cat']);
        $url_prj = empty($row['item_alias']) ? cot_url('projects', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'] . '&highlight=' . $hl) : cot_url('projects', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'] . '&highlight=' . $hl);
        $t->assign(cot_generate_projecttags($row, 'PLUGIN_PROJECTSRES_'));
        $t->assign(array('PLUGIN_PROJECTSRES_CATEGORY' => cot_rc_link($url_cat, $structure['projects'][$row['item_cat']]['tpath']), 'PLUGIN_PROJECTSRES_CATEGORY_URL' => $url_cat, 'PLUGIN_PROJECTSRES_TITLE' => cot_rc_link($url_prj, htmlspecialchars($row['item_title'])), 'PLUGIN_PROJECTSRES_TEXT' => cot_clear_mark($row['item_text'], $words), 'PLUGIN_PROJECTSRES_TIME' => cot_date('datetime_medium', $row['item_date']), 'PLUGIN_PROJECTSRES_TIMESTAMP' => $row['item_date'], 'PLUGIN_PROJECTSRES_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PROJECTSRES_NUM' => $jj));
        /* === Hook - Part 2 === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.RESULTS.PROJECTS.ITEM');
        $jj++;
    }
    if ($jj > 0) {
        $t->parse('MAIN.RESULTS.PROJECTS');
    }
    unset($where_and, $where_or, $where);
}
function cot_getmarketlist($template = 'index', $count = 5, $sqlsearch = '', $order = "item_date DESC")
{
    global $db, $db_market, $cfg, $db_users;
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('market', 'any', 'RWA');
    $t = new XTemplate(cot_tplfile(array('market', $template), 'module'));
    $sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : '';
    $sqllist = $db->query("SELECT * FROM {$db_market} AS p LEFT JOIN {$db_users} AS u ON u.user_id=p.item_userid\n\tWHERE item_state=0 {$sqlsearch} ORDER BY {$order} LIMIT " . (int) $count);
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    foreach ($sqllist_rowset as $item) {
        $jj++;
        $t->assign(cot_generate_usertags($item, 'PRD_ROW_OWNER_'));
        $t->assign(cot_generate_markettags($item, 'PRD_ROW_', $cfg['market']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
        $t->assign(array("PRD_ROW_ODDEVEN" => cot_build_oddeven($jj)));
        $t->parse("MARKET.PRD_ROWS");
    }
    $t->parse("MARKET");
    return $t->text("MARKET");
}
        $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");
Example #7
0
/**
 * 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;
}
Example #8
0
     $where_and['or'] = '(' . implode(' OR ', $where_or) . ')';
     $where_and = array_diff($where_and, array(''));
     $where = implode(' AND ', $where_and);
     $maxitems = $cfg_maxitems - $items;
     $maxitems = $maxitems < 0 ? 0 : $maxitems;
     if (!$db->fieldExists($db_forum_topics, "ft_{$rs['frmsort']}")) {
         $rs['frmsort'] = 'updated';
     }
     $sql = $db->query("SELECT SQL_CALC_FOUND_ROWS p.*, t.*\n\t\t\t \tFROM {$db_forum_posts} AS p, {$db_forum_topics} AS t\n\t\t\t\tWHERE {$where} AND p.fp_topicid = t.ft_id\n\t\t\t\tGROUP BY t.ft_id ORDER BY ft_" . $rs['frmsort'] . " " . $rs['frmsort2'] . "\n\t\t\t\tLIMIT {$d}, {$maxitems}");
     $items = $sql->rowCount();
     $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
     $jj = 0;
     while ($row = $sql->fetch()) {
         if ($row['ft_updated'] > 0) {
             $post_url = $cfg['plugin']['search']['searchurl'] == 'Single' ? cot_url('forums', 'm=posts&id=' . $row['fp_id'] . '&highlight=' . $hl) : cot_url('forums', 'm=posts&p=' . $row['fp_id'] . '&highlight=' . $hl, '#' . $row['fp_id']);
             $t->assign(array('PLUGIN_FR_CATEGORY' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'PLUGIN_FR_TITLE' => cot_rc_link($post_url, htmlspecialchars($row['ft_title'])), 'PLUGIN_FR_TITLE_URL' => $post_url, 'PLUGIN_FR_TEXT' => cot_clear_mark($row['fp_text'], $words), 'PLUGIN_FR_TIME' => $row['ft_updated'] > 0 ? cot_date('datetime_medium', $row['ft_updated']) : cot_date('datetime_medium', $row['fp_updated']), 'PLUGIN_FR_TIMESTAMP' => $row['ft_updated'] > 0 ? $row['ft_updated'] : $row['fp_updated'], 'PLUGIN_FR_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_FR_NUM' => $jj));
             $t->parse('MAIN.RESULTS.FORUMS.ITEM');
         }
         $jj++;
     }
     $sql->closeCursor();
     if ($jj > 0) {
         $t->parse('MAIN.RESULTS.FORUMS');
     }
 }
 /* === Hook === */
 foreach (cot_getextplugins('search.list') as $pl) {
     include $pl;
 }
 /* ===== */
 if (array_sum($totalitems) < 1) {
Example #9
0
         $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;
     }
     /* ===== */
     $news->parse('NEWS.PAGE_ROW');
 }
 $url_newpage = cot_url('page', 'm=add&c=' . $cat);
 $news->assign(array('PAGE_PAGENAV' => $pagenav['main'], 'PAGE_PAGEPREV' => $pagenav['prev'], 'PAGE_PAGENEXT' => $pagenav['next'], 'PAGE_PAGELAST' => $pagenav['last'], 'PAGE_PAGENUM' => $pagenav['current'], 'PAGE_PAGECOUNT' => $pagenav['total'], 'PAGE_ENTRIES_ONPAGE' => $pagenav['onpage'], 'PAGE_ENTRIES_TOTAL' => $pagenav['entries'], 'PAGE_SUBMITNEWPOST' => cot_auth('page', $cat, 'W') ? cot_rc_link($url_newpage, $L['Submitnew']) : '', 'PAGE_SUBMITNEWPOST_URL' => cot_auth('page', $cat, 'W') ? $url_newpage : '', 'PAGE_CATTITLE' => $structure['page'][$cat]['title'], 'PAGE_CATPATH' => cot_breadcrumbs(cot_structure_buildpath('page', $cat), false), 'PAGE_CAT' => $cat));
 /* === Hook - Part2 : Include === TAGS === */
 foreach ($news_tags_extp as $pl) {
     include $pl;
 }
 /* ===== */
Example #10
0
            $db->delete($db_cache, "c_name = 'cot_rc_html'");
        }
    } else {
        cot_message('Error');
    }
}
$row = cot_diskcache_list();
$cachefiles = $cachesize = 0;
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.cache.disk.loop');
/* ===== */
foreach ($row as $i => $x) {
    $cachefiles += $x[0];
    $cachesize += $x[1];
    $t->assign(array('ADMIN_DISKCACHE_ITEM_DEL_URL' => cot_url('admin', 'm=cache&s=disk&a=delete&id=' . $i . '&' . cot_xg()), 'ADMIN_DISKCACHE_ITEM_NAME' => $i, 'ADMIN_DISKCACHE_FILES' => $x[0], 'ADMIN_DISKCACHE_SIZE' => $x[1], 'ADMIN_DISKCACHE_ROW_ODDEVEN' => cot_build_oddeven($ii)));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_DISKCACHE_ROW');
    $ii++;
}
$t->assign(array('ADMIN_DISKCACHE_URL_REFRESH' => cot_url('admin', 'm=cache&s=disk'), 'ADMIN_DISKCACHE_URL_PURGE' => cot_url('admin', 'm=cache&s=disk&a=purge&' . cot_xg()), 'ADMIN_DISKCACHE_CACHEFILES' => $cachefiles, 'ADMIN_DISKCACHE_CACHESIZE' => $cachesize));
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('admin.cache.disk.tags') as $pl) {
    include $pl;
}
/* ===== */
Example #11
0
            $row['com_url'] = cot_url('plug', 'e=gal&pic=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        case 'users':
            $row['com_url'] = cot_url('users', 'm=details&id=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        case 'polls':
            $row['com_url'] = cot_url('polls', 'id=' . $row['com_value'] . "&comments=1", '#c' . $row['com_id']);
            break;
        case 'e_shop':
            $row['com_url'] = cot_url('plug', 'e=e_shop&sh=product&productID=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        default:
            $row['com_url'] = '';
            break;
    }
    $t->assign(array('ADMIN_COMMENTS_ITEM_DEL_URL' => cot_url('admin', 'm=other&p=comments&a=delete&id=' . $row['com_id'] . '&' . cot_xg()), 'ADMIN_COMMENTS_ITEM_ID' => $row['com_id'], 'ADMIN_COMMENTS_CODE' => $row['com_code'], 'ADMIN_COMMENTS_AREA' => $row['com_area'], 'ADMIN_COMMENTS_AUTHOR' => $row['com_author'], 'ADMIN_COMMENTS_DATE' => cot_date('datetime_medium', $row['com_date']), 'ADMIN_COMMENTS_DATE_STAMP' => $row['com_date'], 'ADMIN_COMMENTS_TEXT' => $row['com_text'], 'ADMIN_COMMENTS_URL' => $row['com_url'], 'ADMIN_COMMENTS_ODDEVEN' => cot_build_oddeven($ii)));
    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('ADMIN_COMMENTS_' . $tag . '_TITLE' => $exfld_title, 'ADMIN_COMMENTS_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'ADMIN_COMMENTS_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']]));
        }
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_COMMENTS_ROW');
    $ii++;
}
Example #12
0
            $t->assign(array('FORUMS_SECTIONS_ROW_SUBITEMS' => is_array($nxtlvl[$y]) && $cfg['forums']['cat_' . $y]['defstate'] ? 1 : 0, 'FORUMS_SECTIONS_ROW_ACTIVITY' => cot_rc('forums_icon_section_activity', array('secact_num' => $secact_num)), 'FORUMS_SECTIONS_ROW_ACTIVITYVALUE' => $secact_num, 'FORUMS_SECTIONS_ROW_VIEWERS' => $cot_sections_vw_cur, 'FORUMS_SECTIONS_ROW_ODDEVEN' => cot_build_oddeven($yy), 'FORUMS_SECTIONS_ROW_NUM' => $yy));
            /* === Hook - Part2 : Include === */
            foreach ($extps as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('MAIN.FORUMS_SECTIONS.CAT.SECTION');
        }
    }
    $xx++;
    $fold = !$cfg['forums']['cat_' . $x]['defstate'];
    if ($c) {
        $fold = (int) ($c == 'fold' ? true : ($c == 'unfold' ? false : ($c == $x ? false : true)));
    }
    $t->assign(cot_generate_sectiontags($x, 'FORUMS_SECTIONS_ROW_', $cat_top[$x]));
    $t->assign(array('FORUMS_SECTIONS_ROW_FOLD' => $fold, 'FORUMS_SECTIONS_ROW_SUBITEMS' => is_array($nxtlvl[$x]) ? 1 : 0, 'FORUMS_SECTIONS_ROW_ODDEVEN' => cot_build_oddeven($xx), 'FORUMS_SECTIONS_ROW_NUM' => $xx));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_SECTIONS.CAT');
}
$t->parse('MAIN.FORUMS_SECTIONS');
/* === Hook === */
foreach (cot_getextplugins('forums.sections.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
Example #13
0
 }
 $t = new XTemplate(cot_tplfile('i18n.structure', 'plug'));
 // Render table
 $ii = 0;
 $k = -1;
 /* === Hook - Part1 : Set === */
 $extp = cot_getextplugins('i18n.structure.loop');
 /* ===== */
 foreach ($structure['page'] as $code => $row) {
     if (cot_i18n_enabled($code)) {
         $k++;
         if ($k < $d || $ii == $maxperpage) {
             continue;
         }
         $cat_i18n = $i18n_structure[$code][$i18n_locale];
         $t->assign(array('I18N_CATEGORY_ROW_TITLE' => htmlspecialchars($row['title']), 'I18N_CATEGORY_ROW_DESC' => htmlspecialchars($row['desc']), 'I18N_CATEGORY_ROW_CODE_NAME' => "code[{$ii}]", 'I18N_CATEGORY_ROW_CODE_VALUE' => $code, 'I18N_CATEGORY_ROW_ITITLE_NAME' => "title[{$ii}]", 'I18N_CATEGORY_ROW_ITITLE_VALUE' => htmlspecialchars($cat_i18n['title']), 'I18N_CATEGORY_ROW_IDESC_NAME' => "desc[{$ii}]", 'I18N_CATEGORY_ROW_IDESC_VALUE' => htmlspecialchars($cat_i18n['desc']), 'I18N_CATEGORY_ROW_ODDEVEN' => cot_build_oddeven($ii)));
         /* === Hook - Part2 : Include === */
         foreach ($extp as $pl) {
             include $pl;
         }
         /* ===== */
         $t->parse('MAIN.I18N_CATEGORY_ROW');
         $ii++;
     }
 }
 $totalitems = $k + 1;
 $pagenav = cot_pagenav('plug', 'e=i18n&m=structure&l=' . $i18n_locale, $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 $t->assign(array('I18N_ACTION' => cot_url('plug', 'e=i18n&m=structure&l=' . $i18n_locale . '&a=update&d=' . $durl), 'I18N_ORIGINAL_LANG' => $i18n_locales[$cfg['defaultlang']], 'I18N_TARGET_LANG' => $i18n_locales[$i18n_locale], 'I18N_PAGINATION_PREV' => $pagenav['prev'], 'I18N_PAGNAV' => $pagenav['main'], 'I18N_PAGINATION_NEXT' => $pagenav['next']));
 cot_display_messages($t);
 /* === Hook === */
 foreach (cot_getextplugins('i18n.structure.tags') as $pl) {
Example #14
0
            $row['ft_icon'] .= $row['ft_state'] ? '_locked' : '';
        }
        $row['ft_icon_type'] = $row['ft_icon'];
        $row['ft_icon'] = cot_rc('forums_icon_topic', array('icon' => $row['ft_icon']));
        $row['ft_lastpostername'] = cot_build_user($row['ft_lastposterid'], htmlspecialchars($row['ft_lastpostername']));
    }
    if ($row['ft_postcount'] > $cfg['forums']['maxpostsperpage'] && !$row['ft_movedto']) {
        $pn_q = $row['ft_movedto'] > 0 ? $row['ft_movedto'] : $row['ft_id'];
        $pn = cot_pagenav('forums', 'm=posts&q=' . $pn_q, 0, $row['ft_postcount'], $cfg['forums']['maxpostsperpage'], 'd');
        $row['ft_pages'] = cot_rc('forums_code_topic_pages', array('main' => $pn['main'], 'first' => $pn['first'], 'last' => $pn['last']));
    }
    $row['ft_icon_type_ex'] = $row['ft_icon_type'];
    if ($row['ft_user_posted']) {
        $row['ft_icon_type_ex'] .= '_posted';
    }
    $t->assign(array('FORUMS_TOPICS_ROW_ID' => $row['ft_id'], 'FORUMS_TOPICS_ROW_STATE' => $row['ft_state'], 'FORUMS_TOPICS_ROW_ICON' => $row['ft_icon'], 'FORUMS_TOPICS_ROW_ICON_TYPE' => $row['ft_icon_type'], 'FORUMS_TOPICS_ROW_ICON_TYPE_EX' => $row['ft_icon_type_ex'], 'FORUMS_TOPICS_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'FORUMS_TOPICS_ROW_DESC' => htmlspecialchars($row['ft_desc']), 'FORUMS_TOPICS_ROW_CREATIONDATE' => cot_date('datetime_short', $row['ft_creationdate']), 'FORUMS_TOPICS_ROW_CREATIONDATE_STAMP' => $row['ft_creationdate'], 'FORUMS_TOPICS_ROW_UPDATEDURL' => $row['ft_lastposturl'], 'FORUMS_TOPICS_ROW_UPDATED' => $row['ft_lastpostlink'], 'FORUMS_TOPICS_ROW_UPDATED_STAMP' => $row['ft_updated'], 'FORUMS_TOPICS_ROW_MOVED' => $row['ft_movedto'] > 0 ? 1 : 0, 'FORUMS_TOPICS_ROW_TIMEAGO' => cot_build_timegap($row['ft_updated']), 'FORUMS_TOPICS_ROW_POSTCOUNT' => $row['ft_postcount'], 'FORUMS_TOPICS_ROW_REPLYCOUNT' => $row['ft_replycount'], 'FORUMS_TOPICS_ROW_VIEWCOUNT' => $row['ft_viewcount'], 'FORUMS_TOPICS_ROW_FIRSTPOSTER' => cot_build_user($row['ft_firstposterid'], htmlspecialchars($row['ft_firstpostername'])), 'FORUMS_TOPICS_ROW_LASTPOSTER' => $row['ft_lastpostername'], 'FORUMS_TOPICS_ROW_USER_POSTED' => (int) $row['ft_user_posted'], 'FORUMS_TOPICS_ROW_URL' => $row['ft_url'], 'FORUMS_TOPICS_ROW_PREVIEW' => $row['ft_preview'] . '...', 'FORUMS_TOPICS_ROW_PAGES' => $row['ft_pages'], 'FORUMS_TOPICS_ROW_MAXPAGES' => $row['ft_maxpages'], 'FORUMS_TOPICS_ROW_ODDEVEN' => cot_build_oddeven($ft_num), 'FORUMS_TOPICS_ROW_NUM' => $ft_num, 'FORUMS_TOPICS_ROW' => $row));
    foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
        $tag = mb_strtoupper($exfld['field_name']);
        $t->assign(array('FORUMS_TOPICS_ROW_' . $tag . '_TITLE' => isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'FORUMS_TOPICS_ROW_' . $tag => cot_build_extrafields_data('forums', $exfld, $row['ft_' . $exfld['field_name']], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_TOPICS_ROW_' . $tag . '_VALUE' => $row['ft_' . $exfld['field_name']]));
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_TOPICS_ROW');
}
$pagenav = cot_pagenav('forums', "m=topics&s={$s}&ord={$o}&w={$w}", $d, $totaltopics, $cfg['forums']['maxtopicsperpage']);
$toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$jumpbox[cot_url('forums')] = $L['Forums'];
Example #15
0
$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++;
        $t->assign(cot_generate_pagetags($pag, 'LIST_ROW_', $cfg['page']['truncatetext'], $usr['isadmin']));
        $t->assign(array('LIST_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'LIST_ROW_ODDEVEN' => cot_build_oddeven($jj), 'LIST_ROW_NUM' => $jj));
        $t->assign(cot_generate_usertags($pag, 'LIST_ROW_OWNER_'));
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.LIST_ROW');
    }
}
/* === Hook === */
foreach (cot_getextplugins('page.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
Example #16
0
    while ($line = trim(fgets($fp), " \t\r\n")) {
        $parts = preg_split('#\\s+#', $line);
        $t->assign(array('ADMIN_URLS_ROW_I' => $ii, 'ADMIN_URLS_ROW_AREAS' => cot_selectbox($parts[0], 'area[]', $areas, $areas, false), 'ADMIN_URLS_ROW_PARTS1' => cot_inputbox('text', 'params[]', $parts[1]), 'ADMIN_URLS_ROW_PARTS2' => cot_inputbox('text', 'format[]', $parts[2]), 'ADMIN_URLS_ROW_ODDEVEN' => cot_build_oddeven($ii)));
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.ROW');
        $ii++;
    }
    fclose($fp);
}
$htaccess = $serv_type == 'apache' && is_writeable('./' . $conf_name) ? true : false;
if ($htaccess) {
    $htdata = file_get_contents('.htaccess');
    $htparts = explode("\n### COTONTI URLTRANS ###\n", $htdata);
    if (count($htparts) == 4) {
        $t->assign('ADMIN_URLS_CUSTOM_HTACCESS', $htparts[2]);
    }
}
// Error and message reporting
cot_display_messages($t);
$t->assign(array('ADMIN_URLS_II' => $ii, 'ADMIN_URLS_FORM_URL' => cot_url('admin', 'm=other&p=urleditor&a=save'), 'ADMIN_URLS_ROW_AREAS' => cot_selectbox('*', 'area[]', $areas, $areas, false), 'ADMIN_URLS_ROW_PARTS1' => cot_inputbox('text', 'params[]', ''), 'ADMIN_URLS_ROW_PARTS2' => cot_inputbox('text', 'format[]', ''), 'ADMIN_URLS_ROW_ODDEVEN' => cot_build_oddeven($ii)));
/* === Hook  === */
foreach (cot_getextplugins('admin.urls.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$adminmain = $t->text('MAIN');
Example #17
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;
}
Example #18
0
/* ===== */
$fp_num = 0;
foreach ($sql_forums->fetchAll() as $row) {
    $row['user_text'] = $cfg['forums']['cat_' . $s]['allowusertext'] ? $row['user_text'] : '';
    $fp_num++;
    $rowquote_url = $usr['id'] > 0 ? cot_url('forums', 'm=posts&s=' . $s . '&q=' . $q . '&quote=' . $row['fp_id'] . '&d=' . $durl . '&n=last', '#np') : '';
    $rowquote = $usr['id'] > 0 ? cot_rc('forums_rowquote', array('url' => $rowquote_url)) : '';
    $rowedit_url = ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) && $usr['id'] > 0 ? cot_url('forums', 'm=editpost&s=' . $s . '&q=' . $q . '&p=' . $row['fp_id'] . '&d=' . $durl . '&' . cot_xg()) : '';
    $rowedit = ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) && $usr['id'] > 0 ? cot_rc('forums_rowedit', array('url' => $rowedit_url)) : '';
    $rowdelete_url = $usr['id'] > 0 && ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) ? cot_confirm_url(cot_url('forums', 'm=posts&a=delete&' . cot_xg() . '&s=' . $s . '&q=' . $q . '&p=' . $row['fp_id'] . '&d=' . $durl), 'forums', 'forums_confirm_delete_post') : '';
    $rowdelete = $usr['id'] > 0 && ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600) && $fp_num > 1) ? cot_rc('forums_rowdelete', array('url' => $rowdelete_url)) : '';
    if (!empty($row['fp_updater'])) {
        $row['fp_updatedby'] = sprintf($L['forums_updatedby'], htmlspecialchars($row['fp_updater']), cot_date('datetime_medium', $row['fp_updated']), cot_build_timegap($row['fp_updated'], $sys['now']));
    }
    $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) {
function cot_usercategories_tree($chosen = '', $parent = '', $template = '', $level = 0)
{
    global $structure, $cfg, $gm, $group;
    global $i18n_notmain, $i18n_locale, $i18n_read;
    $urlparams = array('gm' => $gm, 'group' => $group);
    /* === Hook === */
    foreach (cot_getextplugins('usercategories.tree.first') as $pl) {
        include $pl;
    }
    /* ===== */
    if (empty($structure['usercategories'])) {
        return false;
    }
    if (!is_array($chosen)) {
        $chosen = explode(',', $chosen);
    }
    if (empty($parent)) {
        $i18n_enabled = $i18n_read;
        $children = array();
        foreach ($structure['usercategories'] as $i => $x) {
            if (mb_substr_count($structure['usercategories'][$i]['path'], ".") == 0) {
                $children[] = $i;
            }
        }
    } else {
        $i18n_enabled = $i18n_read && cot_i18n_enabled($parent);
        $children = $structure['usercategories'][$parent]['subcats'];
    }
    if (count($children) == 0) {
        return false;
    }
    $t1 = new XTemplate(cot_tplfile(array('usercategories', 'cattree', $template), 'plug'));
    /* === Hook === */
    foreach (cot_getextplugins('usercategories.tree.main') as $pl) {
        include $pl;
    }
    /* ===== */
    $level++;
    if ($parent) {
        $t1->assign(array("CAT_TITLE" => htmlspecialchars($structure['usercategories'][$parent]['title']), "CAT_DESC" => $structure['usercategories'][$parent]['desc'], "CAT_COUNT" => $structure['usercategories'][$parent]['count'], "CAT_ICON" => $structure['usercategories'][$parent]['icon']));
    }
    $t1->assign(array("CAT_URL" => cot_url("users", $urlparams + array('cat' => $parent)), "CAT_LEVEL" => $level));
    $jj = 0;
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('usercategories.tree.loop');
    /* ===== */
    foreach ($children as $row) {
        $jj++;
        $subcats = $structure['usercategories'][$row]['subcats'];
        $urlparams['cat'] = $row;
        $t1->assign(array("CAT_ROW_CAT" => $row, "CAT_ROW_TITLE" => htmlspecialchars($structure['usercategories'][$row]['title']), "CAT_ROW_DESC" => $structure['usercategories'][$row]['desc'], "CAT_ROW_COUNT" => $structure['usercategories'][$row]['count'], "CAT_ROW_ICON" => $structure['usercategories'][$row]['icon'], "CAT_ROW_URL" => cot_url("users", $urlparams), "CAT_ROW_SELECTED" => is_array($chosen) && in_array($row, $chosen) || !is_array($chosen) && $row == $chosen ? 1 : 0, "CAT_ROW_SUBCAT" => count($subcats) > 0 ? cot_usercategories_tree($chosen, $row, $template, $level) : '', "CAT_ROW_ODDEVEN" => cot_build_oddeven($jj), "CAT_ROW_JJ" => $jj));
        if ($i18n_enabled && $i18n_notmain) {
            $x_i18n = cot_i18n_get_cat($row, $i18n_locale);
            if ($x_i18n) {
                if (!$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang']) {
                    $urlparams['l'] = $i18n_locale;
                }
                $t1->assign(array('CAT_ROW_URL' => cot_url('users', $urlparams), 'CAT_ROW_TITLE' => $x_i18n['title'], 'CAT_ROW_DESC' => $x_i18n['desc']));
            }
        }
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t1->parse("MAIN.CAT_ROW");
    }
    if ($jj == 0) {
        return false;
    }
    $t1->parse("MAIN");
    return $t1->text("MAIN");
}
Example #20
0
     }
     //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');
 }
 $tags_list = '';
 $tags_list_li = '';
 if (is_array($extra_whitelist[$n]['tags'])) {
     foreach ($extra_whitelist[$n]['tags'] as $ktags => $vtags) {
         $tags_list .= cot_rc('admin_exflds_array', array('tplfile' => $ktags, 'tags' => $vtags));
         $tags_list_li .= '<li>' . cot_rc('admin_exflds_array', array('tplfile' => $ktags, 'tags' => $vtags)) . '</li>';
     }
 }
Example #21
0
$sql = $db->query("SELECT * FROM {$db_referers} ORDER BY ref_count DESC LIMIT {$d}, " . $maxperpage);
if ($sql->rowCount() > 0) {
    while ($row = $sql->fetch()) {
        preg_match("#//([^/]+)/#", $row['ref_url'], $a);
        $host = preg_replace('#^www\\.#i', '', $a[1]);
        $referers[$host][$row['ref_url']] = $row['ref_count'];
    }
    $sql->closeCursor();
    $ii = 0;
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('referers.admin.loop');
    /* ===== */
    foreach ($referers as $referer => $url) {
        $tt->assign('ADMIN_REFERERS_REFERER', htmlspecialchars($referer));
        foreach ($url as $uri => $count) {
            $tt->assign(array('ADMIN_REFERERS_URI' => htmlspecialchars(cot_cutstring($uri, 128)), 'ADMIN_REFERERS_COUNT' => $count, 'ADMIN_REFERERS_ODDEVEN' => cot_build_oddeven($ii)));
            /* === Hook - Part2 : Include === */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $tt->parse('MAIN.REFERERS_ROW.REFERERS_URI');
        }
        $tt->parse('MAIN.REFERERS_ROW');
        $ii++;
    }
    $is_ref_empty = true;
} else {
    $is_ref_empty = false;
}
$tt->assign(array('ADMIN_REFERERS_URL_PRUNE' => cot_url('admin', 'm=other&p=referers&a=prune&' . cot_xg()), 'ADMIN_REFERERS_URL_PRUNELOWHITS' => cot_url('admin', 'm=other&p=referers&a=prunelowhits&' . cot_xg()), 'ADMIN_REFERERS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_REFERERS_PAGNAV' => $pagenav['main'], 'ADMIN_REFERERS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_REFERERS_TOTALITEMS' => $totalitems, 'ADMIN_REFERERS_ON_PAGE' => $ii));
function cot_getprojectslist($template = 'index', $count = 5, $sqlsearch = '', $order = "item_date DESC")
{
    global $db, $db_projects, $db_users, $cfg;
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', 'any', 'RWA');
    $t = new XTemplate(cot_tplfile(array('projects', $template), 'module'));
    $sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : '';
    $totalitems = $db->query("SELECT COUNT(*) FROM {$db_projects} WHERE item_state=0 " . $sqlsearch)->fetchColumn();
    $sqllist = $db->query("SELECT * FROM {$db_projects} AS p LEFT JOIN {$db_users} AS u ON u.user_id=p.item_userid \n\tWHERE item_state=0 " . $sqlsearch . " ORDER BY {$order} LIMIT " . (int) $count);
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    foreach ($sqllist_rowset as $item) {
        $jj++;
        $t->assign(cot_generate_usertags($item, 'PRJ_ROW_OWNER_'));
        $t->assign(cot_generate_projecttags($item, 'PRJ_ROW_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
        $t->assign(array("PRJ_ROW_ODDEVEN" => cot_build_oddeven($jj)));
        $t->parse("PROJECTS.PRJ_ROWS");
    }
    // Количество реализованных проектов
    $t->assign(array("TOTALITEMS" => $totalitems, "COUNTOFREALIZEDPROJECTS" => $db->query("SELECT COUNT(*) FROM {$db_projects} WHERE item_state=0 AND item_realized=1")->fetchColumn()));
    $t->parse("PROJECTS");
    return $t->text('PROJECTS');
}
Example #23
0
        $jj = 0;
        while ($row = $sql->fetch()) {
            $jj++;
            $ext_info = cot_get_extensionparams($row['config_cat'], true);
            $t->assign(array('ADMIN_CONFIG_ROW_URL' => cot_url('admin', 'm=config&n=edit&o=module&p=' . $row['config_cat']), 'ADMIN_CONFIG_ROW_ICO' => $ext_info['icon'], 'ADMIN_CONFIG_ROW_NAME' => $ext_info['name'], 'ADMIN_CONFIG_ROW_DESC' => $ext_info['desc'], 'ADMIN_CONFIG_ROW_NUM' => $jj, 'ADMIN_CONFIG_ROW_ODDEVEN' => cot_build_oddeven($jj)));
            $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL.ADMIN_CONFIG_ROW');
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Modules']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        $sql = $db->query("\n\t\t\tSELECT DISTINCT(c.config_cat), r.ct_title FROM {$db_config} AS c\n\t\t\t\tLEFT JOIN {$db_core} AS r ON c.config_cat = r.ct_code\n\t\t\tWHERE config_owner = 'plug'\n\t\t\tAND config_type != '" . COT_CONFIG_TYPE_HIDDEN . "'\n\t\t\tORDER BY config_cat ASC\n\t\t");
        $jj = 0;
        while ($row = $sql->fetch()) {
            $jj++;
            $ext_info = cot_get_extensionparams($row['config_cat'], false);
            $t->assign(array('ADMIN_CONFIG_ROW_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=' . $row['config_cat']), 'ADMIN_CONFIG_ROW_ICO' => $ext_info['icon'], 'ADMIN_CONFIG_ROW_NAME' => $ext_info['name'], 'ADMIN_CONFIG_ROW_DESC' => $ext_info['desc'], 'ADMIN_CONFIG_ROW_NUM' => $jj, 'ADMIN_CONFIG_ROW_ODDEVEN' => cot_build_oddeven($jj)));
            $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL.ADMIN_CONFIG_ROW');
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Plugins']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        /* === Hook  === */
        foreach (cot_getextplugins('admin.config.default.tags') as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.DEFAULT');
        break;
}
cot_display_messages($t);
/* === Hook  === */
Example #24
0
        }
    }
}
$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;
    }
    /* ===== */
    $t->parse('MAIN.PAGE_ROW');
    $ii++;
}
$is_row_empty = $sql_page->rowCount() == 0 ? true : false;
$totaldbpages = $db->countRows($db_pages);
$sql_page_queued = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE page_state=1");
$sys['pagesqueued'] = $sql_page_queued->fetchColumn();
$t->assign(array('ADMIN_PAGE_URL_CONFIG' => cot_url('admin', 'm=config&n=edit&o=module&p=page'), 'ADMIN_PAGE_URL_ADD' => cot_url('page', 'm=add'), 'ADMIN_PAGE_URL_EXTRAFIELDS' => cot_url('admin', 'm=extrafields&n=' . $db_pages), 'ADMIN_PAGE_URL_STRUCTURE' => cot_url('admin', 'm=structure&n=page'), 'ADMIN_PAGE_FORM_URL' => cot_url('admin', $common_params . '&a=update_checked&d=' . $durl), 'ADMIN_PAGE_ORDER' => cot_selectbox($sorttype, 'sorttype', array_keys($sort_type), array_values($sort_type), false), 'ADMIN_PAGE_WAY' => cot_selectbox($sortway, 'sortway', array_keys($sort_way), array_values($sort_way), false), 'ADMIN_PAGE_FILTER' => cot_selectbox($filter, 'filter', array_keys($filter_type), array_values($filter_type), false), 'ADMIN_PAGE_TOTALDBPAGES' => $totaldbpages, 'ADMIN_PAGE_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_PAGE_PAGNAV' => $pagenav['main'], 'ADMIN_PAGE_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_PAGE_TOTALITEMS' => $totalitems, 'ADMIN_PAGE_ON_PAGE' => $ii));
cot_display_messages($t);
Example #25
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;
    }
    $url_edit = cot_url('pm', 'm=send&id=' . $row['pm_id']);
    $url_delete = cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f . '&d=' . $durl);
    $t->assign(array('PM_ROW_ID' => $row['pm_id'], 'PM_ROW_STATE' => $row['pm_tostate'], 'PM_ROW_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl))), 'PM_ROW_STAR_URL' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl), 'PM_ROW_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_ROW_DATE_STAMP' => $row['pm_date'], 'PM_ROW_TITLE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), htmlspecialchars($row['pm_title']), array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_URL' => cot_url('pm', 'm=message&id=' . $row['pm_id']), 'PM_ROW_TEXT' => $pm_data, 'PM_ROW_ICON_STATUS' => $row['pm_icon_readstatus'], 'PM_ROW_ICON_STARRED' => $row['pm_icon_starred'], 'PM_ROW_ICON_DELETE' => cot_rc_link($url_delete, $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_ICON_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete), $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_DELETE_URL' => $url_delete, 'PM_ROW_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete), 'PM_ROW_ICON_EDIT' => $row['pm_tostate'] == 0 ? cot_rc_link($url_edit, $R['pm_icon_edit'], array('title' => $L['Edit'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_ROW_EDIT_URL' => $row['pm_tostate'] == 0 ? $url_edit : '', 'PM_ROW_DESC' => $pm_desc, 'PM_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PM_ROW_NUM' => $jj));
    $t->assign(cot_generate_usertags($row, 'PM_ROW_USER_'));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.PM_ROW');
}
if ($jj == 0) {
    $t->parse('MAIN.PM_ROW_EMPTY');
}
if (!COT_AJAX) {
    $t->parse('MAIN.BEFORE_AJAX');
    $t->parse('MAIN.AFTER_AJAX');
}
Example #26
0
        $info['available'] = '?';
    }
    $t->assign(array('ADMIN_CACHE_MEMORY_DRIVER' => str_replace('_driver', '', $cache->mem_driver), 'ADMIN_CACHE_MEMORY_PERCENTBAR' => ceil($info['occupied'] / $info['max'] * 100), 'ADMIN_CACHE_MEMORY_AVAILABLE' => $info['available'], 'ADMIN_CACHE_MEMORY_MAX' => $info['max']));
    $t->parse('MAIN.ADMIN_CACHE_MEMORY');
}
$sql = $db->query("SELECT * FROM {$db_cache} WHERE 1 ORDER by c_name ASC");
$cachesize = 0;
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.cache.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    $row['c_value'] = htmlspecialchars($row['c_value']);
    $row['size'] = mb_strlen($row['c_value']);
    $cachesize += $row['size'];
    $t->assign(array('ADMIN_CACHE_ITEM_DEL_URL' => cot_url('admin', 'm=cache&a=delete&name=' . $row['c_name'] . '&' . cot_xg()), 'ADMIN_CACHE_ITEM_NAME' => $row['c_name'], 'ADMIN_CACHE_EXPIRE' => $row['c_expire'] > 0 ? cot_date('datetime_short', $row['c_expire']) : '-', 'ADMIN_CACHE_SIZE' => $row['size'], 'ADMIN_CACHE_VALUE' => $a == 'showall' ? $row['c_value'] : cot_cutstring($row['c_value'], 80), 'ADMIN_CACHE_ROW_ODDEVEN' => cot_build_oddeven($ii)));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_CACHE_ROW');
    $ii++;
}
$t->assign(array('ADMIN_CACHE_URL_REFRESH' => cot_url('admin', 'm=cache'), 'ADMIN_CACHE_URL_PURGE' => cot_url('admin', 'm=cache&a=purge&' . cot_xg()), 'ADMIN_CACHE_URL_SHOWALL' => cot_url('admin', 'm=cache&a=showall'), 'ADMIN_CACHE_CACHESIZE' => $cachesize));
cot_display_messages($t);
/* === Hook  === */
foreach (cot_getextplugins('admin.cache.tags') as $pl) {
    include $pl;
}
/* ===== */
Example #27
0
$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));
    // Extrafields
    if (!empty(cot::$extrafields[cot::$db->contact])) {
        foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
            $exfld_title = cot_extrafield_title($exfld, 'contact_');
            $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']]));
            $tuman->parse('MAIN.DATA.EXTRAFLD');
        }
    }
    $tuman->parse('MAIN.DATA');
}
$sql->closeCursor();
if ($a == '' && !empty($id)) {
    $row = $db->query("SELECT * FROM " . cot::$db->contact . " WHERE contact_id = {$id}")->fetch();
 *
 * @package locationselector
 * @version 2.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
if ($a == 'update') {
    $countriesfilter = cot_import('enabled_countries', 'P', 'ARR');
    $rconfig['config_value'] = implode(',', $countriesfilter);
    $db->update($db_config, $rconfig, "config_cat='locationselector' AND config_name='countriesfilter'");
    $cache && $cache->clear();
    cot_redirect(cot_url('admin', 'm=other&p=locationselector', '', true));
}
$t = new XTemplate(cot_tplfile('locationselector.country', 'plug'));
$countriesfilter = str_replace(' ', '', $cfg['plugin']['locationselector']['countriesfilter']);
$countriesfilter = explode(',', $countriesfilter);
$jj = 0;
foreach ($cot_countries as $code => $name) {
    $jj++;
    $flag = !file_exists('images/flags/' . $code . '.png') ? '00' : $code;
    $t->assign(array("COUNTRY_ROW_CODE" => $code, "COUNTRY_ROW_NAME" => $name, "COUNTRY_ROW_URL" => cot_url('admin', 'm=other&p=locationselector&n=region&country=' . $code), "COUNTRY_ROW_FLAG" => cot_rc('icon_flag', array('code' => $flag, 'alt' => '')), "COUNTRY_ROW_NUM" => $jj, "COUNTRY_ROW_ODDEVEN" => cot_build_oddeven($jj), "COUNTRY_ROW_CHECKED" => in_array($code, $countriesfilter) ? true : false));
    $t->parse("MAIN.ROWS");
}
$t->assign(array('LOCATIONSELECTOR_FORM_UPDATE' => cot_url('admin', 'm=other&p=locationselector&a=update')));
if ($jj == 0) {
    $t->parse("MAIN.NOROWS");
}
$t->parse("MAIN");
$plugin_body .= $t->text("MAIN");
     $structure_tpl_sym = '-';
     $check_tpl = "1";
 } elseif ($row['structure_tpl'] == 'same_as_parent') {
     $structure_tpl_sym = '*';
     $check_tpl = "2";
 } else {
     $structure_tpl_sym = '+';
     $check_tpl = "3";
 }
 foreach ($structure[$n] as $i => $x) {
     if ($i != 'all') {
         $cat_path[$i] = $x['tpath'];
     }
 }
 $cat_selectbox = cot_selectbox($row['structure_tpl'], 'rstructuretplforced[' . $structure_id . ']', array_keys($cat_path), array_values($cat_path), false);
 $t->assign(array('ADMIN_STRUCTURE_UPDATE_DEL_URL' => cot_confirm_url(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&a=delete&id=' . $structure_id . '&c=' . $row['structure_code'] . '&d=' . $durl . '&' . cot_xg()), 'admin'), 'ADMIN_STRUCTURE_ID' => $structure_id, 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode[' . $structure_id . ']', $structure_code, 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_SPACEIMG' => $pathspaceimg, 'ADMIN_STRUCTURE_LEVEL' => $pathfielddep > 0 ? $pathfielddep - 1 : 0, 'ADMIN_STRUCTURE_PATHFIELDIMG' => mb_strpos($row['structure_path'], '.') == 0 ? $R['admin_icon_join1'] : $R['admin_icon_join2'], 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath[' . $structure_id . ']', $row['structure_path'], 'size="12" maxlength="255"'), 'ADMIN_STRUCTURE_TPL_SYM' => $structure_tpl_sym, 'ADMIN_STRUCTURE_TPLMODE' => cot_radiobox($check_tpl, 'rstructuretplmode[' . $structure_id . ']', array('1', '2', '3'), array($L['adm_tpl_empty'], $L['adm_tpl_parent'], $L['adm_tpl_forced']), '', '<br />'), 'ADMIN_STRUCTURE_TPLQUICK' => cot_inputbox('text', 'rstructuretplquick[' . $structure_id . ']', $id > 0 && array_key_exists($row['structure_tpl'], $cat_path) ? '' : $row['structure_tpl'], 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle[' . $structure_id . ']', $row['structure_title'], 'size="32" maxlength="255"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc[' . $structure_id . ']', $row['structure_desc'], 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon[' . $structure_id . ']', $row['structure_icon'], 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox($row['structure_locked'], 'rstructurelocked[' . $structure_id . ']'), 'ADMIN_STRUCTURE_SELECT' => $cat_selectbox, 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], '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_OPTIONS_URL' => cot_url('admin', 'm=structure&n=' . $n . '&d=' . $durl . '&id=' . $structure_id . '&' . cot_xg()), 'ADMIN_STRUCTURE_ODDEVEN' => cot_build_oddeven($ii)));
 foreach ($cot_extrafields[$db_structure] as $exfld) {
     $exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'] . '_' . $structure_id, $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($id || !empty($al) ? 'MAIN.OPTIONS.EXTRAFLD' : 'MAIN.DEFAULT.ROW.EXTRAFLD');
 }
 /* === Hook - Part2 : Include === */
 foreach ($extp as $pl) {
     include $pl;
 }
 /* ===== */
 if ($id || !empty($al)) {
     require_once cot_incfile('configuration');
     $optionslist = cot_config_list($is_module ? 'module' : 'plug', $n, $structure_code);
     /* === Hook - Part1 : Set === */
Example #30
0
                    $ifstruct = $struct[$code];
                    if ($type == 'module') {
                        $jump_url = cot_url($code);
                        $arg = 'mod';
                    } else {
                        $jump_url = cot_url('plug', 'e=' . $code);
                        $arg = 'pl';
                    }
                    $icofile = ($type == 'module' ? $cfg['modules_dir'] : $cfg['plugins_dir']) . '/' . $code . '/' . $code . '.png';
                    $installed_ver = $installed_vers[$code];
                    $L['info_name'] = '';
                    $L['info_desc'] = '';
                    if (file_exists(cot_langfile($code, $type))) {
                        include cot_langfile($code, $type);
                    }
                    $t->assign(array('ADMIN_EXTENSIONS_DETAILS_URL' => cot_url('admin', "m=extensions&a=details&{$arg}={$code}"), 'ADMIN_EXTENSIONS_NAME' => empty($L['info_name']) ? $info['Name'] : $L['info_name'], 'ADMIN_EXTENSIONS_TYPE' => $type == 'module' ? $L['Module'] : $L['Plugin'], 'ADMIN_EXTENSIONS_CODE_X' => $code, 'ADMIN_EXTENSIONS_DESCRIPTION' => empty($L['info_desc']) ? $info['Description'] : $L['info_desc'], 'ADMIN_EXTENSIONS_ICO' => file_exists($icofile) ? $icofile : '', 'ADMIN_EXTENSIONS_EDIT_URL' => cot_url('admin', "m=config&n=edit&o={$type}&p={$code}"), 'ADMIN_EXTENSIONS_TOTALCONFIG' => $totalconfig, 'ADMIN_EXTENSIONS_PARTSCOUNT' => $info['Partscount'], 'ADMIN_EXTENSIONS_STATUS' => $status[$part_status], 'ADMIN_EXTENSIONS_VERSION' => $info['Version'], 'ADMIN_EXTENSIONS_VERSION_INSTALLED' => $installed_ver, 'ADMIN_EXTENSIONS_VERSION_COMPARE' => version_compare($info['Version'], $installed_ver), 'ADMIN_EXTENSIONS_RIGHTS_URL' => $type == 'module' ? cot_url('admin', "m=rightsbyitem&ic={$code}&io=a") : cot_url('admin', "m=rightsbyitem&ic={$type}&io={$code}"), 'ADMIN_EXTENSIONS_JUMPTO_URL_TOOLS' => $type == 'plug' ? cot_url('admin', "m=other&p={$code}") : cot_url('admin', "m={$code}"), 'ADMIN_EXTENSIONS_JUMPTO_URL' => $jump_url, 'ADMIN_EXTENSIONS_JUMPTO_URL_STRUCT' => cot_url('admin', "m=structure&n={$code}"), 'ADMIN_EXTENSIONS_ODDEVEN' => cot_build_oddeven($i)));
                    /* === Hook - Part2 : Include === */
                    foreach ($extp as $pl) {
                        include $pl;
                    }
                    /* ===== */
                    $t->parse('MAIN.DEFAULT.SECTION.ROW');
                }
            }
            $t->assign(array('ADMIN_EXTENSIONS_SECTION_TITLE' => $type == 'module' ? $L['Modules'] : $L['Plugins'], 'ADMIN_EXTENSIONS_CNT_EXTP' => $cnt_extp));
            $t->parse('MAIN.DEFAULT.SECTION');
        }
        $t->parse('MAIN.DEFAULT');
        break;
}
/*