Exemple #1
0
function cot_generate_sbrtags($item_data, $tag_prefix = '', $admin_rights = null, $pagepath_home = false)
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_sbr, $db_sbr_stages, $sys;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('sbrtags.first');
        $extp_main = cot_getextplugins('sbrtags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['sbr_id'] > 0 && !empty($item_data['sbr_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('plug', 'sbr', 'A');
        }
        $patharray[] = array(cot_url('sbr'), $L['sbr']);
        $patharray[] = array(cot_url('sbr', 'id=' . $item_data['sbr_id']), $item_data['sbr_title']);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $temp_array = array('ID' => $item_data['sbr_id'], 'STATUS' => $item_data['sbr_status'], 'LOCALSTATUS' => $L['sbr_status_' . $item_data['sbr_status']], 'LABELSTATUS' => $R['sbr_labels'][$item_data['sbr_status']], 'URL' => cot_url('sbr', 'id=' . $item_data['sbr_id']), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['sbr_title'], 'CREATEDATE' => date('d.m.Y H:i', $item_data['sbr_create']), 'CREATEDATE_STAMP' => $item_data['sbr_create'], 'BEGINDATE' => date('d.m.Y H:i', $item_data['sbr_begin']), 'BEGINDATE_STAMP' => $item_data['sbr_begin'], 'DONEDATE' => date('d.m.Y H:i', $item_data['sbr_done']), 'DONEDATE_STAMP' => $item_data['sbr_done'], 'COST' => $item_data['sbr_cost'], 'TAX' => $item_data['sbr_tax'], 'TOTAL' => $item_data['sbr_cost'] + $item_data['sbr_tax'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['sbr_employer']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']);
        }
        // Extrafields
        if (isset($cot_extrafields[$db_sbr])) {
            foreach ($cot_extrafields[$db_sbr] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['sbr_' . $exfld['field_name'] . '_title']) ? $L['sbr_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('sbr', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Exemple #2
0
// ========== Allowed =========
reset($cot_extensions);
sort($cot_extensions);
foreach ($cot_extensions as $k => $line) {
    $t->assign(array('ALLOWED_ROW_ICON' => $icon[$line[0]], 'ALLOWED_ROW_EXT' => $line[0], 'ALLOWED_ROW_DESC' => $filedesc[$line[0]]));
    $t->parse('MAIN.ALLOWED_ROW');
}
// ========== Create a new folder =========
if ($usr['auth_write']) {
    $t->assign(array('NEWFOLDER_FORM_ACTION' => cot_url('pfs', 'a=newfolder&' . $more)));
    $t->parse('MAIN.PFS_NEWFOLDER_FORM');
}
// ========== Putting all together =========
$out['subtitle'] = $L['Mypfs'];
/* ============= */
$t->assign('PFS_TITLE', cot_breadcrumbs($title, $cfg['homebreadcrumb']));
if ($standalone) {
    if ($c1 == 'pageform' && $c2 == 'rpageurl') {
        $addthumb = $thumbs_dir_user . "' + gfile + '";
        $addpix = "' + gfile + '";
        $addfile = $pfs_dir_user . "' + gfile + '";
        $pfs_code_addfile = $addfile;
        $pfs_code_addthumb = $addthumb;
        $pfs_code_addpix = $addpix;
    } else {
        $addthumb = $R['pfs_code_addthumb'];
        $addpix = $R['pfs_code_addpix'];
        $addfile = $R['pfs_code_addfile'];
        $pfs_code_addfile = cot_rc('pfs_code_addfile');
        $pfs_code_addthumb = cot_rc('pfs_code_addthumb');
        $pfs_code_addpix = cot_rc('pfs_code_addpix');
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=tags.search.pages.loop
[END_COT_EXT]
==================== */
/**
 * Tag search for i18n pages
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $tags = cot_tag_list($row['page_id'], 'pages', array('tag_locale' => $row['ipage_locale']));
    $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' => 'pages', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t), 'rel="nofollow"');
        $tag_i++;
    }
    $t->assign(array('TAGS_RESULT_ROW_URL' => empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale']) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ipage_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
}
/* === 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;
}
/* ===== */
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
Exemple #5
0
    $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');
}
$url_newpm = cot_url('pm', 'm=send');
$url_inbox = cot_url('pm');
$url_sentbox = cot_url('pm', 'f=sentbox');
$url_all = cot_url('pm', 'f=' . $f);
$url_unread = cot_url('pm', 'f=' . $f . '&filter=unread');
$url_starred = cot_url('pm', 'f=' . $f . '&filter=starred');
$t->assign(array('PM_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PM_SUBTITLE' => $subtitle, 'PM_FORM_UPDATE' => cot_url('pm', cot_xg() . '&f=' . $f . '&filter=' . $filter . '&d=' . $durl), 'PM_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : '') : '', 'PM_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PM_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_INBOX_URL' => $url_inbox, 'PM_INBOX_COUNT' => $totalinbox, 'PM_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_SENTBOX_URL' => $url_sentbox, 'PM_SENTBOX_COUNT' => $totalsentbox, 'PM_FILTER_ALL' => cot_rc_link($url_all, $L['pm_all'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_ALL_URL' => $url_all, 'PM_FILTER_UNREAD' => cot_rc_link($url_unread, $L['pm_unread'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_UNREAD_URL' => $url_unread, 'PM_FILTER_STARRED' => cot_rc_link($url_starred, $L['pm_starred'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_STARRED_URL' => $url_starred, 'PM_PAGEPREV' => $pagenav['prev'], 'PM_PAGENEXT' => $pagenav['next'], 'PM_PAGES' => $pagenav['main'], 'PM_CURRENTPAGE' => $pagenav['current'], 'PM_TOTALPAGES' => $pagenav['total'], 'PM_SENT_TYPE' => $f == 'sentbox' ? $L['Recipient'] : $L['Sender']));
/* === Hook === */
foreach (cot_getextplugins('pm.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
    foreach (cot_getextplugins('forums.editpost.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_forums_sectionsetlast($rowpost['fp_cat']);
    if ($cache) {
        $cfg['cache_forums'] && $cache->page->clear('forums');
        $cfg['cache_index'] && $cache->page->clear('index');
    }
    cot_redirect(cot_url('forums', "m=posts&q=" . $q . '&d=' . $durl, '#' . $p, true));
}
require_once cot_incfile('forms');
$crumbs = cot_forums_buildpath($s);
$crumbs[] = array(cot_url('forums', "m=posts&p=" . $p, "#" . $p), ($rowt['ft_mode'] == 1 ? '# ' : '') . htmlspecialchars($rowt['ft_title']));
$crumbs[] = array(cot_url('forums', "m=editpost&s={$s}&q=" . $q . "&p=" . $p . "&" . cot_xg()), $L['Edit']);
$toptitle = cot_breadcrumbs($crumbs, $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$sys['sublocation'] = $structure['forums'][$s]['title'];
$title_params = array('FORUM' => $L['Forums'], 'SECTION' => $structure['forums'][$s]['title'], 'TOPIC' => $rowt['ft_title'], 'EDIT' => $L['Edit']);
$out['subtitle'] = cot_title('{EDIT} - {TOPIC}', $title_params);
$out['head'] .= $R['code_noindex'];
/* === Hook === */
foreach (cot_getextplugins('forums.editpost.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$mskin = cot_tplfile(array('forums', 'editpost', $structure['forums'][$s]['tpl']));
$t = new XTemplate($mskin);
cot_display_messages($t);
if ($db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) {
/**
 * Returns all page tags for coTemplate
 *
 * @param mixed $page_data Page Info Array or ID
 * @param string $tag_prefix Prefix for tags
 * @param int $textlength Text truncate
 * @param bool $admin_rights Page Admin Rights
 * @param bool $pagepath_home Add home link for page path
 * @param string $emptytitle Page title text if page does not exist
 * @return array
 * @global CotDB $db
 */
function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_pages, $usr, $sys, $cot_yesno, $structure, $db_structure;
    static $extp_first = null, $extp_main = null;
    static $pag_auth = array();
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('pagetags.first');
        $extp_main = cot_getextplugins('pagetags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($page_data)) {
        $sql = $db->query("SELECT * FROM {$db_pages} WHERE page_id = '" . (int) $page_data . "' LIMIT 1");
        $page_data = $sql->fetch();
    }
    if ($page_data['page_id'] > 0 && !empty($page_data['page_title'])) {
        if (is_null($admin_rights)) {
            if (!isset($pag_auth[$page_data['page_cat']])) {
                $pag_auth[$page_data['page_cat']] = cot_auth('page', $page_data['page_cat'], 'RWA1');
            }
            $admin_rights = (bool) $pag_auth[$page_data['page_cat']][2];
        }
        $pagepath = cot_structure_buildpath('page', $page_data['page_cat']);
        $catpath = cot_breadcrumbs($pagepath, $pagepath_home);
        $page_data['page_pageurl'] = empty($page_data['page_alias']) ? cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id']) : cot_url('page', 'c=' . $page_data['page_cat'] . '&al=' . $page_data['page_alias']);
        $page_link[] = array($page_data['page_pageurl'], $page_data['page_title']);
        $page_data['page_fulltitle'] = cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home);
        if (!empty($page_data['page_url']) && $page_data['page_file']) {
            $dotpos = mb_strrpos($page_data['page_url'], ".") + 1;
            $type = mb_strtolower(mb_substr($page_data['page_url'], $dotpos, 5));
            $page_data['page_fileicon'] = cot_rc('page_icon_file_path', array('type' => $type));
            if (!file_exists($page_data['page_fileicon'])) {
                $page_data['page_fileicon'] = cot_rc('page_icon_file_default');
            }
            $page_data['page_fileicon'] = cot_rc('page_icon_file', array('icon' => $page_data['page_fileicon']));
        } else {
            $page_data['page_fileicon'] = '';
        }
        $date_format = 'datetime_medium';
        $text = cot_parse($page_data['page_text'], $cfg['page']['markup'], $page_data['page_parser']);
        $text_cut = cot_cut_more($text);
        if ($textlength > 0 && mb_strlen($text_cut) > $textlength) {
            $text_cut = cot_string_truncate($text_cut, $textlength);
        }
        $cutted = mb_strlen($text) > mb_strlen($text_cut) ? true : false;
        $cat_url = cot_url('page', 'c=' . $page_data['page_cat']);
        $validate_url = cot_url('admin', "m=page&a=validate&id={$page_data['page_id']}&x={$sys['xk']}");
        $unvalidate_url = cot_url('admin', "m=page&a=unvalidate&id={$page_data['page_id']}&x={$sys['xk']}");
        $edit_url = cot_url('page', "m=edit&id={$page_data['page_id']}");
        $delete_url = cot_url('page', "m=edit&a=update&delete=1&id={$page_data['page_id']}&x={$sys['xk']}");
        $page_data['page_status'] = cot_page_status($page_data['page_state'], $page_data['page_begin'], $page_data['page_expire']);
        $temp_array = array('URL' => $page_data['page_pageurl'], 'ID' => $page_data['page_id'], 'TITLE' => $page_data['page_fulltitle'], 'ALIAS' => $page_data['page_alias'], 'STATE' => $page_data['page_state'], 'STATUS' => $page_data['page_status'], 'LOCALSTATUS' => $L['page_status_' . $page_data['page_status']], 'SHORTTITLE' => htmlspecialchars($page_data['page_title'], ENT_COMPAT, 'UTF-8', false), 'CAT' => $page_data['page_cat'], 'CATURL' => $cat_url, 'CATTITLE' => htmlspecialchars($structure['page'][$page_data['page_cat']]['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link($cat_url, htmlspecialchars($structure['page'][$page_data['page_cat']]['title'])), 'CATDESC' => htmlspecialchars($structure['page'][$page_data['page_cat']]['desc']), 'CATICON' => $structure['page'][$page_data['page_cat']]['icon'], 'KEYWORDS' => htmlspecialchars($page_data['page_keywords']), 'DESC' => htmlspecialchars($page_data['page_desc']), 'TEXT' => $text, 'TEXT_CUT' => $text_cut, 'TEXT_IS_CUT' => $cutted, 'DESC_OR_TEXT' => !empty($page_data['page_desc']) ? htmlspecialchars($page_data['page_desc']) : $text, 'MORE' => $cutted ? cot_rc('list_more', array('page_url' => $page_data['page_pageurl'])) : '', 'AUTHOR' => htmlspecialchars($page_data['page_author']), 'OWNERID' => $page_data['page_ownerid'], 'OWNERNAME' => htmlspecialchars($page_data['user_name']), 'DATE' => cot_date($date_format, $page_data['page_date']), 'BEGIN' => cot_date($date_format, $page_data['page_begin']), 'EXPIRE' => cot_date($date_format, $page_data['page_expire']), 'UPDATED' => cot_date($date_format, $page_data['page_updated']), 'DATE_STAMP' => $page_data['page_date'], 'BEGIN_STAMP' => $page_data['page_begin'], 'EXPIRE_STAMP' => $page_data['page_expire'], 'UPDATED_STAMP' => $page_data['page_updated'], 'FILE' => $cot_yesno[$page_data['page_file']], 'FILE_URL' => empty($page_data['page_url']) ? '' : cot_url('page', 'c=' . $page_data['page_cat'] . '&id=' . $page_data['page_id'] . '&a=dl'), 'FILE_SIZE' => $page_data['page_size'] / 1024, 'FILE_SIZE_BYTES' => $page_data['page_size'], 'FILE_SIZE_READABLE' => cot_build_filesize($page_data['page_size'], 1), 'FILE_ICON' => $page_data['page_fileicon'], 'FILE_COUNT' => $page_data['page_filecount'], 'FILE_COUNTTIMES' => cot_declension($page_data['page_filecount'], $Ls['Times']), 'FILE_NAME' => basename($page_data['page_url']), 'COUNT' => $page_data['page_count'], 'ADMIN' => $admin_rights ? cot_rc('list_row_admin', array('unvalidate_url' => $unvalidate_url, 'edit_url' => $edit_url)) : '', 'NOTAVAILABLE' => $page_data['page_begin'] > $sys['now'] ? $L['page_notavailable'] . cot_build_timegap($sys['now'], $pag['page_begin']) : '');
        // Admin tags
        if ($admin_rights) {
            $validate_confirm_url = cot_confirm_url($validate_url, 'page', 'page_confirm_validate');
            $unvalidate_confirm_url = cot_confirm_url($unvalidate_url, 'page', 'page_confirm_unvalidate');
            $delete_confirm_url = cot_confirm_url($delete_url, 'page', 'page_confirm_delete');
            $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = $edit_url;
            $temp_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_confirm_url, $L['Validate'], 'class="confirmLink"') : cot_rc_link($unvalidate_confirm_url, $L['Putinvalidationqueue'], 'class="confirmLink"');
            $temp_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_confirm_url : $unvalidate_confirm_url;
            $temp_array['ADMIN_DELETE'] = cot_rc_link($delete_confirm_url, $L['Delete'], 'class="confirmLink"');
            $temp_array['ADMIN_DELETE_URL'] = $delete_confirm_url;
        } else {
            if ($usr['id'] == $page_data['page_ownerid']) {
                $temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
                $temp_array['ADMIN_EDIT_URL'] = $edit_url;
            }
        }
        if (cot_auth('page', 'any', 'W')) {
            $clone_url = cot_url('page', "m=add&c={$page_data['page_cat']}&clone={$page_data['page_id']}");
            $temp_array['ADMIN_CLONE'] = cot_rc_link($clone_url, $L['page_clone']);
            $temp_array['ADMIN_CLONE_URL'] = $clone_url;
        }
        // Extrafields
        if (isset($cot_extrafields[$db_pages])) {
            foreach ($cot_extrafields[$db_pages] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('page', $exfld, $page_data['page_' . $exfld['field_name']], $page_data['page_parser']);
                $temp_array[$tag . '_VALUE'] = $page_data['page_' . $exfld['field_name']];
            }
        }
        // Extra fields for structure
        if (isset($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['page'][$page_data['page_cat']][$exfld['field_name']]);
                $temp_array['CAT_' . $tag . '_VALUE'] = $structure['page'][$page_data['page_cat']][$exfld['field_name']];
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Exemple #8
0
$title[] = !$id ? $L['pmsend_title'] : $L['Edit'] . ' #' . $id;
$url_newpm = cot_url('pm', 'm=send');
$url_inbox = cot_url('pm');
$url_sentbox = cot_url('pm', 'f=sentbox');
if (COT_AJAX) {
    // Attach rich text editors to AJAX loaded page
    $rc_tmp = $out['footer_rc'];
    $out['footer_rc'] = '';
    if (is_array($cot_plugins['editor'])) {
        foreach ($cot_plugins['editor'] as $k) {
            if ($k['pl_code'] == $editor && cot_auth('plug', $k['pl_code'], 'R')) {
                include $cfg['plugins_dir'] . '/' . $k['pl_file'];
                break;
            }
        }
    }
    $text_editor_code = $out['footer_rc'];
    $out['footer_rc'] = $rc_tmp;
}
$t->assign(array('PMSEND_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PMSEND_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PMSEND_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PMSEND_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_INBOX_URL' => $url_inbox, 'PMSEND_INBOX_COUNT' => $totalinbox, 'PMSEND_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_SENTBOX_URL' => $url_sentbox, 'PMSEND_SENTBOX_COUNT' => $totalsentbox, 'PMSEND_FORM_SEND' => cot_url('pm', 'm=send&a=send' . $idurl), 'PMSEND_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'), 'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code, 'PMSEND_FORM_TOUSER' => cot_textarea('newpmrecipient', $touser, 3, 56, 'class="userinput"'), 'PMSEND_FORM_NOT_TO_SENTBOX' => cot_checkbox(false, 'fromstate', cot::$L['pm_notmovetosentbox'], '', '3')));
/* === Hook === */
foreach (cot_getextplugins('pm.send.tags') as $pl) {
    include $pl;
}
/* ===== */
if (!$id) {
    $t->parse('MAIN.PMSEND_USERLIST');
}
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=search.page.loop
[END_COT_EXT]
==================== */
/**
 * Displays translated pages in search results
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $page_url = empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl);
    $t->assign(array('PLUGIN_PR_CATEGORY' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'PLUGIN_PR_TITLE' => cot_rc_link($page_url, htmlspecialchars($row['ipage_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['ipage_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['ipage_date']), 'PLUGIN_PR_TIMESTAMP' => $row['ipage_date']));
}
Exemple #10
0
        $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;
        }
        /* ===== */
        $news->parse('NEWS');
        $news_html = $news->text('NEWS');
        // Cache for guests
        if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['news']['cache_ttl'] > 0) {
            $cache->disk->store($news_cache_id, $news_html, 'news');
        }
        $t->assign($catn == 0 ? 'INDEX_NEWS' : 'INDEX_NEWS_' . $tagname, $news_html);
        $catn++;
    }
}
Exemple #11
0
 public function indexAction()
 {
     Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/advboard/js/advboard.compare.js');
     $sort = cot_import('s', 'G', 'ALP');
     // order field name
     $way = cot_import('w', 'G', 'ALP', 4);
     // order way (asc, desc)
     //$maxrowsperpage = cot::$cfg['advboard']['cat___default']['maxrowsperpage'];
     $maxrowsperpage = 0;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.first') as $pl) {
         include $pl;
     }
     /* ===== */
     $sort = empty($sort) ? cot::$cfg['advboard']['cat___default']['order'] : $sort;
     $way = empty($way) || !in_array($way, array('asc', 'desc')) ? cot::$cfg['advboard']['cat___default']['way'] : $way;
     $canonicalUrlParams = array('m' => 'compare');
     $where = array();
     if (!empty($_SESSION['advboard_compare']) && !empty($_SESSION['advboard_compare'][cot::$sys['site_id']])) {
         $where['id'] = array('id', array_keys($_SESSION['advboard_compare'][cot::$sys['site_id']]));
         $where['state'] = array('state', advboard_model_Advert::PUBLISHED);
         $where['begin'] = array('begin', cot::$sys['now'], '<=');
         $where['expire'] = array('SQL', "expire = 0 OR expire > " . cot::$sys['now']);
     }
     $template = array('advboard', 'compare');
     cot::$out['subtitle'] = cot::$L['advboard_compare'];
     // Building the canonical URL
     cot::$out['canonical_uri'] = cot_url('advboard', $canonicalUrlParams);
     $condition = array();
     foreach ($where as $key => $val) {
         $condition[] = $val;
     }
     $order = array(array('sticky', 'desc'), array($sort, $way));
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $advertisement = null;
     $totallines = 0;
     if (!empty($condition)) {
         $totallines = advboard_model_Advert::count($condition);
         if ($totallines > 0) {
             $advertisement = advboard_model_Advert::find($condition, $maxrowsperpage, 0, $order);
         }
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.main') as $pl) {
         include $pl;
     }
     /* ===== */
     $crumbs = array();
     if (cot::$cfg['advboard']['firstCrumb']) {
         $crumbs[] = array(cot_url('advboard'), cot::$L['advboard_ads']);
     }
     $crumbs[] = array(cot_url('advboard', array('m' => 'compare')), cot::$L['advboard_compare']);
     $breadcrumbs = '';
     if (!empty($crumbs)) {
         $breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
     }
     //        $pageUrlParams = $urlParams;
     //        if($durl > 1) $pageUrlParams['d'] = $durl;
     $view = new View();
     $view->breadcrumbs = $breadcrumbs;
     $view->page_title = htmlspecialchars(cot::$L['advboard_compare']);
     $view->advertisement = $advertisement;
     $view->totalitems = $totallines;
     //        $view->urlParams = $urlParams;
     //        $view->pageUrlParams = $pageUrlParams;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.compare.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
        }
        $cot_act[$parents[0]] += $cot_sections_act[$i];
    }
}
$secact_max = count($cot_act) > 0 ? max($cot_act) : 0;
$out['subtitle'] = $L['Forums'];
/* === Hook === */
foreach (cot_getextplugins('forums.sections.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate(cot_tplfile('forums.sections'));
$url_markall = cot_url('forums', "n=markall");
$title[] = array(cot_url('forums'), $L['Forums']);
$t->assign(array('FORUMS_RSS' => cot_url('rss', 'm=forums'), 'FORUMS_SECTIONS_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'FORUMS_SECTIONS_MARKALL' => $usr['id'] > 0 ? cot_rc_link($url_markall, $L['forums_markallasread']) : '', 'FORUMS_SECTIONS_MARKALL_URL' => $usr['id'] > 0 ? $url_markall : ''));
$xx = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('forums.sections.loop');
/* ===== */
/* === Hook - Part1 : Set === */
$extps = cot_getextplugins('forums.sections.loop.sections');
/* ===== */
/* === Hook - Part1 : Set === */
$extpss = cot_getextplugins('forums.sections.loop.subsections');
/* ===== */
foreach ($fstlvl as $x) {
    if (is_array($nxtlvl[$x])) {
        $yy = 0;
        foreach ($nxtlvl[$x] as $y) {
            if (is_array($nxtlvl[$y]) && $cfg['forums']['cat_' . $y]['defstate']) {
Exemple #13
0
 public function editAction()
 {
     global $structure, $cot_extrafields, $db_structure;
     $id = cot_import('id', 'G', 'INT');
     // id Объявления
     $c = cot_import('c', 'G', 'TXT');
     $act = cot_import('act', 'G', 'ALP');
     if (empty($act)) {
         $act = cot_import('act', 'P', 'ALP');
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.edit.first') as $pl) {
         include $pl;
     }
     /* ===== */
     // Права на любую категорию доски объявлений
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', 'any');
     cot_block(cot::$usr['auth_write']);
     if (!$c || !isset($structure['advboard'][$c])) {
         cot_die_message(404, TRUE);
     }
     $category = $structure['advboard'][$c];
     $category['config'] = cot::$cfg['advboard']['cat_' . $c];
     $category['code'] = $c;
     // Extra fields for structure
     foreach ($cot_extrafields[$db_structure] as $exfld) {
         $uname = $exfld['field_name'];
         $val = $structure['advboard'][$c][$exfld['field_name']];
         $category[$uname . '_title'] = isset(cot::$L['structure_' . $exfld['field_name'] . '_title']) ? cot::$L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
         $category[$uname] = cot_build_extrafields_data('structure', $exfld, $val);
         $category[$uname . '_value'] = $val;
     }
     $published = 0;
     if (!$id) {
         $advert = new advboard_model_Advert();
         $advert->category = $c;
         $advert->user = cot::$usr['id'];
     } else {
         $advert = advboard_model_Advert::getById($id);
         if (!$advert) {
             cot_die_message(404, TRUE);
         }
         if (!cot::$usr['isadmin']) {
             if ($advert->user != cot::$usr['id']) {
                 cot_die_message(404, TRUE);
             }
         }
         if ($c != $advert->category && isset($structure['advboard'][$advert->category])) {
             $tmp = array('c' => $advert->category, 'a' => 'edit', 'id' => $advert->id);
             if (!empty($act)) {
                 $tmp['act'] = $act;
             }
             cot_redirect(cot_url('advboard', array('c' => $advert->category, 'a' => 'edit', 'id' => $advert->id), '', true));
         }
         if ($act == 'clone') {
             $id = null;
             $advert = clone $advert;
             // Установить статус и пользователя нового объекта
             $advert->user = cot::$usr['id'];
             $advert->state = advboard_model_Advert::DRAFT;
         }
         $published = $advert->state < 2 ? 1 : 0;
     }
     //Проверим права на категорию:
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin'], cot::$usr['auth_upload']) = cot_auth('advboard', $c, 'RWA1');
     if ($structure['advboard'][$c]['locked'] && !cot::$usr['isadmin']) {
         cot_die_message(602, TRUE);
     } elseif ($advert->id == 0) {
         // Если у пользователя нет прав на подачу объявления, то ищем категорию куда он может подать оьбъявление
         if (!cot::$usr['auth_write']) {
             foreach ($structure['advboard'] as $catCode => $catRow) {
                 $auth_write = cot_auth('advboard', $catCode, 'W');
                 if ($auth_write) {
                     cot_redirect(cot_url('advboard', array('c' => $catCode, 'a' => 'edit'), '', true));
                 }
             }
         }
         cot_block(cot::$usr['auth_write']);
     }
     // Владелец объявления
     $user = array();
     if ($advert->user > 0) {
         $user = cot_user_data($advert->user);
     }
     $periodItems = adv_periodItems($c);
     // Сохранение
     if ($act == 'save') {
         unset($_POST['id'], $_POST['user']);
         cot_shield_protect();
         /* === Hook === */
         foreach (cot_getextplugins('advboard.save.first') as $pl) {
             include $pl;
         }
         /* ===== */
         // импортировать даты
         $begin = (int) cot_import_date('begin');
         $expire = (int) cot_import_date('expire');
         if ($begin == 0) {
             $begin = !empty($advert->begin) ? $advert->begin : cot::$sys['now'];
         }
         // Пересчитать период публикации объявления
         if ($expire == 0 && cot::$cfg['advboard']['cat_' . $c]['maxPeriod'] > 0) {
             $period = cot_import('period', 'P', 'INT');
             $maxPeriod = max($periodItems);
             if (empty($period)) {
                 $period = $maxPeriod;
             }
             if (!cot::$usr['isadmin'] && $period > $maxPeriod) {
                 $period = $maxPeriod;
             }
             if ($period > 0) {
                 $expire = $begin + $period * 86400;
             }
         }
         if ($category['config']['title_require']) {
             $advert->setValidator('title', 'required');
         }
         // Валидатор 'allowemptytext'
         if (!$category['config']['allowemptytext']) {
             $advert->setValidator('text', 'required');
         }
         if ($category['config']['phone_require']) {
             // проверить надичие заполненного поля в профиле пользователя - владельца
             if (empty($user['user_phone'])) {
                 $advert->setValidator('phone', 'required');
             }
         }
         if ($category['config']['city_require']) {
             // Проверить наличие заполненного города (id или названия) в профиле владельца
             if (empty($user['user_city_name']) && empty($user['user_city'])) {
                 if (cot_plugin_active('regioncity')) {
                     $advert->setValidator('city', function ($value) {
                         $value = (int) $value;
                         if ($value == 0) {
                             return cot::$L['field_required'] . ': ' . advboard_model_Advert::fieldLabel('city');
                         }
                         return true;
                     });
                 } else {
                     $advert->setValidator('city_name', 'required');
                 }
             }
         }
         if (cot::$usr['id'] == 0) {
             $advert->setValidator('person', 'required');
             // Email
             $email = cot_import('email', 'P', 'TXT');
             if (cot::$cfg['advboard']['guestEmailRequire']) {
                 if ($email == '') {
                     cot_error(cot::$L['advboard_err_noemail'], 'email');
                 }
             }
             if ($email != '') {
                 $tmp = advert_checkEmail($email);
                 if ($tmp !== true) {
                     cot_error($tmp, 'email');
                 }
             }
             // Капча
             if (cot::$cfg['advboard']['guestUseCaptcha']) {
                 $verify = cot_import('verify', 'P', 'TXT');
                 if (!cot_captcha_validate($verify)) {
                     cot_error(cot::$L['captcha_verification_failed'], 'verify');
                 }
             }
         }
         $advert->setData($_POST);
         $advert->begin = $begin;
         $advert->expire = $expire;
         if (!cot::$usr['isadmin']) {
             if (!cot::$cfg['advboard']['cat_' . $c]['allowSticky']) {
                 $advert->sticky = 0;
             }
             if (cot::$usr['id'] == 0) {
                 $advert->sticky = 0;
             }
             // гости не дают срочных объявлений
         }
         $advert->category = $c;
         if (empty($advert->user) || !cot::$usr['isadmin']) {
             $advert->user = cot::$usr['id'];
         }
         $published = cot_import('published', 'P', 'BOL');
         if (!$published) {
             $advert->state = advboard_model_Advert::DRAFT;
         } elseif (cot::$usr['isadmin'] || cot_auth('advboard', $c, '2')) {
             $advert->state = advboard_model_Advert::PUBLISHED;
         } else {
             $advert->state = advboard_model_Advert::AWAITING_MODERATION;
         }
         /* === Hook === */
         foreach (cot_getextplugins('advboard.save.validate') as $pl) {
             include $pl;
         }
         /* ===== */
         // There is some errors
         if (!$advert->validate() || cot_error_found()) {
             $urlParams = array('c' => $c, 'a' => 'edit');
             if ($advert->id > 0) {
                 $urlParams['id'] = $advert->id;
             }
             cot_redirect(cot_url('advboard', $urlParams, '', true));
         }
         if (empty($advert->sort)) {
             $advert->sort = cot::$sys['now'];
         }
         $isNew = $advert->id == 0;
         // Сохранение
         if ($advert->save()) {
             // Для незарега запомним id страницы для чтого, чтобы он мог ее отредактировать в пределах сесии
             if ($isNew) {
                 if (cot::$usr['id'] == 0) {
                     if (empty($_SESSION['advboard'])) {
                         $_SESSION['advboard'] = array();
                     }
                     if (!in_array($id, $_SESSION['advboard'])) {
                         $_SESSION['advboard'][] = $advert->id;
                     }
                 }
                 if ($advert->state == advboard_model_Advert::PUBLISHED) {
                     cot_message(cot::$L['advboard_created']);
                 }
             } else {
                 if ($advert->state == advboard_model_Advert::PUBLISHED) {
                     cot_message(cot::$L['advboard_updated']);
                 }
             }
             if ($advert->state == advboard_model_Advert::AWAITING_MODERATION) {
                 cot_message(cot::$L['advboard_awaiting_moderation']);
             } elseif ($advert->state == advboard_model_Advert::DRAFT) {
                 cot_message(cot::$L['Saved']);
             }
             $redirectUrl = $advert->getUrl(true);
             /* === Hook === */
             foreach (cot_getextplugins('advboard.save.done') as $pl) {
                 include $pl;
             }
             /* ===== */
             // Редирект на станицу объявления
             cot_redirect($redirectUrl);
         }
     }
     $crumbs = cot_structure_buildpath('advboard', $c);
     if (cot::$cfg['advboard']['firstCrumb']) {
         array_unshift($crumbs, array(cot_url('advboard'), cot::$L['advboard_ads']));
     }
     if (!$id) {
         $crumbs[] = $title = cot::$L['advboard_add_new'];
         cot::$out['subtitle'] = $title;
     } else {
         $crumbs[] = array($advert->url, $advert->title);
         $crumbs[] = cot::$L['Edit'];
         $title = cot::$L['advboard_advert'] . ' #' . $advert->id;
         if (!empty($advert->title)) {
             $title = $advert->title;
         }
         $title .= ': ' . cot::$L['Edit'];
         if (!empty(cot::$out['subtitle'])) {
             $title .= ' - ' . cot::$out['subtitle'];
         }
         cot::$out['subtitle'] = $title;
     }
     // Elemets placeholders
     $placeHolder_Person = '';
     $placeHolder_Phone = '';
     $placeHolder_Email = '';
     $placeHolder_City = '';
     //if($advboard->user == cot::$usr['id'] && cot::$usr['id'] > 0) {
     if (!empty($user)) {
         // Контакное лицо
         $placeHolder_Person = cot_user_full_name($user);
         // Телефон
         if (!empty($user['user_phone'])) {
             $placeHolder_Phone = $user['user_phone'];
         }
         // email
         if (!$user['user_hideemail']) {
             $placeHolder_Email = $user['user_email'];
         }
         // город
         if (!empty($user['user_city_name'])) {
             $placeHolder_City = $user['user_city_name'];
         }
     }
     // 'input_textarea_editor', 'input_textarea_medieditor', 'input_textarea_minieditor', ''
     $editor = 'input_textarea_editor';
     /* === Hook === */
     foreach (cot_getextplugins('advboard.edit.main') as $pl) {
         include $pl;
     }
     /* ===== */
     $minYear = date('Y');
     $maxYear = $minYear + 30;
     $price = $advert->rawValue('price');
     if ($price <= 0) {
         $price = '';
     }
     $formElements = array('hidden' => array('element' => cot_inputbox('hidden', 'act', 'save')), 'category' => array('element' => cot_selectbox_structure('advboard', $advert->category, 'category'), 'label' => advboard_model_Advert::fieldLabel('category')), 'price' => array('element' => cot_inputbox('text', 'price', $price), 'label' => advboard_model_Advert::fieldLabel('price'), 'hint' => cot::$L['advboard_price_hint']), 'title' => array('element' => cot_inputbox('text', 'title', $advert->rawValue('title')), 'required' => true, 'label' => advboard_model_Advert::fieldLabel('title')), 'description' => array('element' => cot_inputbox('text', 'description', $advert->rawValue('description')), 'label' => advboard_model_Advert::fieldLabel('description')), 'text' => array('element' => cot_textarea('text', $advert->rawValue('text'), 5, 120, '', $editor), 'label' => advboard_model_Advert::fieldLabel('text')), 'person' => array('element' => cot_inputbox('text', 'person', $advert->rawValue('person'), array('class' => 'form-control', 'placeholder' => $placeHolder_Person)), 'label' => advboard_model_Advert::fieldLabel('person'), 'required' => cot::$usr['id'] == 0), 'email' => array('element' => cot_inputbox('text', 'email', $advert->rawValue('email'), array('class' => 'form-control', 'placeholder' => $placeHolder_Email)), 'label' => advboard_model_Advert::fieldLabel('email')), 'city' => array('element' => cot_inputbox('text', 'city_name', $advert->rawValue('city_name'), array('class' => 'form-control', 'placeholder' => $placeHolder_City)), 'label' => advboard_model_Advert::fieldLabel('city_name'), 'required' => $category['config']['city_require']), 'phone' => array('element' => cot_inputbox('text', 'phone', $advert->rawValue('phone'), array('class' => 'form-control', 'placeholder' => $placeHolder_Phone)), 'label' => advboard_model_Advert::fieldLabel('phone'), 'required' => $category['config']['phone_require']), 'sticky' => array('element' => cot_checkbox($advert->sticky, 'sticky', advboard_model_Advert::fieldLabel('sticky')), 'label' => advboard_model_Advert::fieldLabel('sticky')), 'published' => array('element' => cot_checkbox($published, 'published', cot::$L['advboard_published'] . '?'), 'label' => cot::$L['advboard_published'] . '?'), 'begin' => array('element' => cot_selectbox_date($advert->begin, 'long', 'begin', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('begin')), 'expire' => array('element' => cot_selectbox_date($advert->expire, 'long', 'expire', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('expire')), 'sort' => array('element' => cot_selectbox_date($advert->sort, 'long', 'sort', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('sort')), 'period' => array('element' => cot_selectbox('', 'period', $periodItems, array(), false), 'label' => cot::$L['advboard_period']));
     if (!empty($cot_extrafields[cot::$db->advboard])) {
         // Extra fields for ads
         foreach ($cot_extrafields[cot::$db->advboard] as $exfld) {
             $fName = $exfld['field_name'];
             $formElements[$fName] = array('element' => cot_build_extrafields($fName, $exfld, $advert->rawValue($fName)));
             if ($exfld['field_type'] !== 'checkbox') {
                 $formElements[$fName]['label'] = isset(cot::$L['advboard_' . $exfld['field_name'] . '_title']) ? cot::$L['advboard_' . $exfld['field_name'] . '_title'] : advboard_model_Advert::fieldLabel($fName);
             }
         }
     }
     if (cot_plugin_active('regioncity')) {
         $formElements['city']['element'] = rec_select2_city('city', $advert->rawValue('city'), true, array('class' => 'form-control', 'placeholder' => $placeHolder_City));
     }
     if ($category['config']['city_require']) {
         $formElements['city']['required'] = true;
     }
     if ($category['config']['phone_require']) {
         $formElements['phone']['required'] = true;
     }
     // Hints
     if (!empty($user)) {
         // Контакное лицо
         $formElements['person']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . cot_user_full_name($user);
         // Телефон
         if (!empty($user['user_phone'])) {
             $formElements['phone']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_phone'];
         }
         // email
         if (!$user['user_hideemail']) {
             $formElements['email']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_email'];
         }
         // город
         if (!empty($user['user_city_name'])) {
             $formElements['city']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_city_name'];
         }
     }
     if (!cot::$usr['isadmin']) {
         unset($formElements['begin']);
         unset($formElements['expire']);
         unset($formElements['sort']);
         if (cot::$usr['id'] == 0) {
             if (cot::$cfg['advboard']['guestEmailRequire']) {
                 $formElements['email']['required'] = true;
             }
             // Гости не дают срочных объявлений
             unset($formElements['sticky']);
             // Капча
             if (cot::$cfg['advboard']['guestUseCaptcha']) {
                 $formElements['verify'] = array('element' => cot_inputbox('text', 'verify'), 'img' => cot_captcha_generate(), 'label' => cot::$L['advboard_captcha'], 'required' => true);
             }
         }
         if (!cot::$cfg['advboard']['cat_' . $c]['allowSticky'] && isset($formElements['sticky'])) {
             unset($formElements['sticky']);
         }
     } else {
         // Администратор напрямую указывает дату окончания публикации
         unset($formElements['period']);
     }
     $actionParams = array('a' => 'edit', 'c' => $advert->category);
     if ($advert->id > 0) {
         $actionParams['id'] = $advert->id;
     }
     $view = new View();
     $view->breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
     $view->page_title = $title;
     $view->category = $category;
     $view->advert = $advert;
     $view->user = $user;
     $view->formElements = $formElements;
     $view->formAction = cot_url('advboard', $actionParams);
     /* === Hook === */
     foreach (cot_getextplugins('advboard.edit.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render(array('advboard', 'edit', $structure['advboard'][$c]['tpl']));
 }
Exemple #14
0
if ($empty) {
    cot_die_message(907, TRUE);
}
if (empty($out['subtitle'])) {
    if (empty($L['plu_title'])) {
        $L['plu_title'] = $L[$extname . '_title'];
    }
    $out['subtitle'] = empty($L['plu_title']) ? $out['plu_title'] : $L['plu_title'];
}
$sys['sublocation'] = $out['subtitle'];
if ($ext_display_header) {
    $t_plug = $t;
    require_once $cfg['system_dir'] . '/header.php';
    $t = $t_plug;
}
if ($autoassigntags) {
    array_unshift($pltitle, array(cot_url('plug', "e={$e}"), $out['subtitle']));
    if (empty($o)) {
        $t->assign(array('PLUGIN_TITLE' => cot_breadcrumbs($pltitle, $cfg['homebreadcrumb']), 'PLUGIN_SUBTITLE' => $plugin_subtitle, 'PLUGIN_BODY' => $plugin_body));
    } else {
        cot_sendheaders();
        $t->assign(array('POPUP_C1' => $c1, 'POPUP_C2' => $c2, 'POPUP_BODY' => $popup_body));
    }
}
if (is_object($t)) {
    $t->parse('MAIN');
    $t->out('MAIN');
}
if ($ext_display_header) {
    require_once $cfg['system_dir'] . '/footer.php';
}
Exemple #15
0
/* === Hook === */
foreach (cot_getextplugins('sbr.list.first') as $pl) {
    include $pl;
}
/* ===== */
$out['subtitle'] = $L['sbr_mydeals'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('sbr', 'list', $status), 'plug');
/* === Hook === */
foreach (cot_getextplugins('sbr.list.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$patharray[] = array(cot_url('sbr'), $L['sbr']);
$t->assign(array('SBR_TITLE' => cot_breadcrumbs($patharray, $cfg['homebreadcrumb'], true), 'SBR_COUNTERS' => cot_sbr_counters()));
$where = array();
$order = array();
if (!empty($status)) {
    $where['status'] = "sbr_status='" . $db->prep($status) . "'";
}
$where['userid'] = "(sbr_employer=" . $usr['id'] . " OR sbr_performer=" . $usr['id'] . ")";
$order['date'] = "sbr_create DESC";
/* === Hook === */
foreach (cot_getextplugins('sbr.list.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_sbr} \n\t" . $where . "")->fetchColumn();
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');
}
        }
        cot_extrafield_movefiles();
        /* === Hook === */
        foreach (cot_getextplugins('forums.newtopic.newtopic.done') as $pl) {
            include $pl;
        }
        /* ===== */
        if ($cache) {
            $cfg['cache_forums'] && $cache->page->clear('forums');
            $cfg['cache_index'] && $cache->page->clear('index');
        }
        cot_shield_update(45, "New topic");
        cot_redirect(cot_url('forums', "m=posts&q={$q}&n=last", '#bottom', true));
    }
}
$toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$sys['sublocation'] = $structure['forums'][$s]['title'];
$out['subtitle'] = $L['forums_newtopic'];
$out['head'] .= $R['code_noindex'];
/* === Hook === */
foreach (cot_getextplugins('forums.newtopic.main') as $pl) {
    include $pl;
}
/* ===== */
require_once cot_incfile('forms');
require_once $cfg['system_dir'] . '/header.php';
$mskin = cot_tplfile(array('forums', 'newtopic', $structure['forums'][$s]['tpl']));
$t = new XTemplate($mskin);
$t->assign(array('FORUMS_NEWTOPIC_PAGETITLE' => $toptitle, 'FORUMS_NEWTOPIC_SUBTITLE' => htmlspecialchars(cot_parse_autourls($structure['forums'][$s]['desc'])), 'FORUMS_NEWTOPIC_SEND' => cot_url('forums', "m=newtopic&a=newtopic&s=" . $s), 'FORUMS_NEWTOPIC_TITLE' => cot_inputbox('text', 'rtopictitle', $rtopic['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_DESC' => cot_inputbox('text', 'rtopicdesc', $rtopic['ft_desc'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_TEXT' => cot_textarea('rmsgtext', $rmsg['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_NEWTOPIC_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
// Extra fields
Exemple #18
0
        $rsubject = $L['pasrec_title'];
        $rbody = $L['Hi'] . " " . $rusername . ",\n\n" . $L['pasrec_email2'] . "\n\n" . $newpass . "\n\n" . $L['aut_contactadmin'];
        cot_mail($rusermail, $rsubject, $rbody);
        $msg = 'auth';
    } else {
        $env['status'] = '403 Forbidden';
        cot_shield_update(7, "Log in");
        cot_log("Pass recovery failed, user : " . $rusername);
        cot_redirect(cot_url('message', 'msg=151', '', true));
    }
}
$out['subtitle'] = $L['pasrec_title'];
$out['head'] .= $R['code_noindex'];
$title[] = $L['pasrec_title'];
$mskin = cot_tplfile('users.passrecover', 'module');
/* === Hook === */
foreach (cot_getextplugins('users.passrecover.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$t->assign(array('PASSRECOVER_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PASSRECOVER_URL_FORM' => cot_url('users', 'm=passrecover&a=request')));
/* === Hook === */
foreach (cot_getextplugins('users.passrecover.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Exemple #19
0
    }
    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 #20
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 #21
0
Hooks=page.list.tags
Tags=page.list.tpl:{I18N_LANG_ROW_URL},{I18N_LANG_ROW_CODE},{I18N_LANG_ROW_TITLE},{I18N_LANG_ROW_CLASS},{I18N_LANG_ROW_SELECTED}
[END_COT_EXT]
==================== */
/**
 * Redefines category tags and assings i18n tags
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($i18n_enabled) {
    if ($cat_i18n && $i18n_notmain) {
        // Override category tags
        $catpath = cot_breadcrumbs(cot_i18n_build_catpath('page', $c, $i18n_locale), $cfg['homebreadcrumb']);
        $urlparams = !$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang'] ? "c={$c}&l={$i18n_locale}" : "c={$c}";
        $t->assign(array('LIST_PAGETITLE' => $catpath, 'LIST_CATEGORY' => htmlspecialchars($cat_i18n['title']), 'LIST_CAT_RSS' => cot_url('rss', $urlparams), 'LIST_CATTITLE' => $cat_i18n['title'], 'LIST_CATPATH' => $catpath, 'LIST_CATDESC' => $cat_i18n['desc']));
    }
    // Render language selection
    $cat_i18n_locales = cot_i18n_list_cat_locales($c);
    if (count($cat_i18n_locales) > 0) {
        array_unshift($cat_i18n_locales, $cfg['defaultlang']);
        foreach ($cat_i18n_locales as $lc) {
            if ($lc == $i18n_locale) {
                $lc_class = 'selected';
                $lc_selected = 'selected="selected"';
            } else {
                $lc_class = '';
                $lc_selected = '';
            }
Exemple #22
0
$title_params = array('EDIT' => $L['Edit'], 'NAME' => $urr['user_name']);
$out['subtitle'] = cot_title('{EDIT} - {NAME}', $title_params);
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'edit', $usr['maingrp']), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.edit.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$protected = $sys['protecttopadmin'] ? array('disabled' => 'disabled') : array();
$editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : '';
$delete_pfs = cot_module_active('pfs') ? cot_checkbox(false, 'ruserdelpfs', $L['PFS']) : '';
$t->assign(array('USERS_EDIT_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name']), array(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit'])), $cfg['homebreadcrumb']), 'USERS_EDIT_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_EDIT_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_EDIT_SUBTITLE' => $L['useed_subtitle'], 'USERS_EDIT_SEND' => cot_url('users', 'm=edit&a=update&' . cot_xg() . '&id=' . $urr['user_id']), 'USERS_EDIT_ID' => $urr['user_id'], 'USERS_EDIT_NAME' => cot_inputbox('text', 'rusername', $urr['user_name'], array('size' => 32, 'maxlength' => 100) + $protected), 'USERS_EDIT_ACTIVE' => $user_form_active, 'USERS_EDIT_BANNED' => $user_form_banned, 'USERS_EDIT_THEME' => cot_inputbox('text', 'rusertheme', $urr['user_theme'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_LANG' => cot_inputbox('text', 'ruserlang', $urr['user_lang'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_NEWPASS' => cot_inputbox('password', 'rusernewpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off') + $protected), 'USERS_EDIT_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_EDIT_GROUPS' => cot_build_groupsms($urr['user_id'], $usr['isadmin'], $urr['user_maingrp']), 'USERS_EDIT_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_EDIT_EMAIL' => cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64)), 'USERS_EDIT_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_EDIT_TEXT' => cot_textarea('rusertext', $urr['user_text'], 4, 56, array('class' => $editor_class)), 'USERS_EDIT_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_EDIT_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_EDIT_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_EDIT_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_EDIT_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_EDIT_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_EDIT_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_EDIT_LOGCOUNT' => $urr['user_logcount'], 'USERS_EDIT_LASTIP' => cot_build_ipsearch($urr['user_lastip']), 'USERS_EDIT_DELETE' => $sys['user_istopadmin'] ? cot_radiobox(0, 'ruserdelete', array(1, 0), array($L['Yes'], $L['No'])) . $delete_pfs : $L['na']));
// Extra fields
foreach ($cot_extrafields[$db_users] as $exfld) {
    $tag = strtoupper($exfld['field_name']);
    $t->assign(array('USERS_EDIT_' . $tag => cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]), 'USERS_EDIT_' . $tag . '_TITLE' => isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description']));
}
// Error and message reporting
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('users.edit.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
/**
 * Returns all product tags for coTemplate
 *
 * @param mixed $item_data product Info Array or ID
 * @param string $tag_prefix Prefix for tags
 * @param int $textlength Text truncate
 * @param bool $admin_rights product Admin Rights
 * @param bool $pagepath_home Add home link for page path
 * @param string $emptytitle Page title text if page does not exist
 * @return array
 * @global CotDB $db
 */
function cot_generate_markettags($item_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_market, $usr, $sys, $cot_yesno, $structure, $db_structure;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('markettags.first');
        $extp_main = cot_getextplugins('markettags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_market} WHERE item_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['item_id'] > 0 && !empty($item_data['item_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('market', $item_data['item_cat'], 'A');
        }
        $item_data['item_pageurl'] = empty($item_data['item_alias']) ? cot_url('market', 'c=' . $item_data['item_cat'] . '&id=' . $item_data['item_id']) : cot_url('market', 'c=' . $item_data['item_cat'] . '&al=' . $item_data['item_alias']);
        $catpatharray[] = array(cot_url('market'), $L['market']);
        $itempatharray[] = array($item_data['item_pageurl'], $item_data['item_title']);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']), $itempatharray);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']));
        $catpath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $text = cot_parse($item_data['item_text'], $cfg['market']['markup'], $item_data['item_parser']);
        $text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : $text;
        $item_data['item_status'] = cot_market_status($item_data['item_state']);
        $temp_array = array('ID' => $item_data['item_id'], 'ALIAS' => $item_data['item_alias'], 'STATE' => $item_data['item_state'], 'STATUS' => $item_data['item_status'], 'LOCALSTATUS' => $L['market_status_' . $item_data['item_status']], 'URL' => $item_data['item_pageurl'], 'USER_PRDURL' => cot_url('users', 'm=details&id=' . $item_data['item_userid'] . '&u=' . $item_data['user_name'] . '&tab=market'), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['item_title'], 'CAT' => $item_data['item_cat'], 'CATTITLE' => htmlspecialchars($structure['market'][$item_data['item_cat']]['title']), 'CATURL' => cot_url('market', 'c=' . $item_data['item_cat']), 'CATPATH' => $catpath, 'TEXT' => $text, 'SHORTTEXT' => $text_cut, 'COST' => number_format($item_data['item_cost'], '0', '.', ' '), 'DATE' => cot_date('datetime_medium', $item_data['item_date']), 'DATE_STAMP' => $item_data['item_date'], 'SHOW_URL' => $item_data['item_pageurl'], 'COUNT' => $item_data['item_count'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['item_userid']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('market', 'm=edit&id=' . $item_data['item_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id']);
            $temp_array['HIDEPRODUCT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id'] . ($item_data['item_state'] == 1 ? '&a=public' : '&a=hide'));
            $temp_array['HIDEPRODUCT_TITLE'] = $item_data['item_state'] == 1 ? $L['Publish'] : $L['Hide'];
        }
        // Extrafields
        if (isset($cot_extrafields[$db_market])) {
            foreach ($cot_extrafields[$db_market] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['market_' . $exfld['field_name'] . '_title']) ? $L['market_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('market', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        // Extra fields for structure
        if (isset($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['market'][$item_data['item_cat']][$exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Exemple #24
0
} elseif (empty($id) && empty($u) && $usr['id'] > 0) {
    $id = $usr['id'];
}
cot_die(empty($id), true);
$sql = $db->query("SELECT * FROM {$db_users} WHERE user_id={$id} LIMIT 1");
cot_die($sql->rowCount() == 0, true);
$urr = $sql->fetch();
$title_params = array('USER' => $L['User'], 'NAME' => $urr['user_name']);
$out['subtitle'] = cot_title('title_users_details', $title_params);
$mskin = cot_tplfile(array('users', 'details'), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.details.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$t->assign(cot_generate_usertags($urr, 'USERS_DETAILS_', '', true));
$t->assign(array('USERS_DETAILS_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name'])), $cfg['homebreadcrumb']), 'USERS_DETAILS_SUBTITLE' => $L['use_subtitle']));
/* === Hook === */
foreach (cot_getextplugins('users.details.tags') as $pl) {
    include $pl;
}
/* ===== */
if ($usr['isadmin']) {
    $t->assign(array('USERS_DETAILS_ADMIN_EDIT' => cot_rc_link(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit']), 'USERS_DETAILS_ADMIN_EDIT_URL' => cot_url('users', 'm=edit&id=' . $urr['user_id'])));
    $t->parse('MAIN.USERS_DETAILS_ADMIN');
}
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Exemple #25
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 #26
0
    $sql_pfs_update = $db->query("UPDATE {$db_pfs} SET\n\t\tpfs_desc='" . $db->prep($rdesc) . "',\n\t\tpfs_folderid={$folderid}\n\t\tWHERE pfs_userid={$userid} AND pfs_id={$id}");
    cot_redirect(cot_url('pfs', "f={$pfs_folderid}&" . $more, '', true));
}
/* ============= */
$out['subtitle'] = $L['pfs_title'];
if (!$standalone) {
    require_once $cfg['system_dir'] . '/header.php';
}
$t = new XTemplate(cot_tplfile('pfs.edit'));
if ($standalone) {
    cot_sendheaders();
    $html = Resources::render();
    if ($html) {
        $out['head_head'] = $html . $out['head_head'];
    }
    $t->assign(array('PFS_HEAD' => $out['head_head']));
    $t->parse('MAIN.STANDALONE_HEADER');
    $t->parse('MAIN.STANDALONE_FOOTER');
}
$t->assign(array('PFS_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PFS_ACTION' => cot_url('pfs', 'm=edit&a=update&id=' . $pfs_id . '&' . $more), 'PFS_FILE' => $pfs_file, 'PFS_DATE' => cot_date('datetime_medium', $pfs_date), 'PFS_DATE_STAMP' => $pfs_date, 'PFS_FOLDER' => cot_selectbox_folders($userid, '', $pfs_folderid), 'PFS_URL' => $ff, 'PFS_DESC' => cot_inputbox('text', 'rdesc', $pfs_desc, 'size="56" maxlength="255"'), 'PFS_SIZE' => cot_build_filesize($pfs_size_bytes, 1), 'PFS_SIZE_BYTES' => $pfs_size_bytes, 'PFS_SIZE_KB' => $pfs_size_bytes / 1024));
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('pfs.edit.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
if (!$standalone) {
    require_once $cfg['system_dir'] . '/footer.php';
}
Exemple #27
0
defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('forums', 'any');
cot_block($usr['isadmin']);
$t = new XTemplate(cot_tplfile('forums.admin', 'module', true));
require_once cot_incfile('forums', 'module');
$adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
$adminpath[] = array(cot_url('admin', 'm=extensions&a=details&mod=' . $m), $cot_modules[$m]['title']);
$adminpath[] = array(cot_url('admin', 'm=' . $m), $L['Administration']);
$adminhelp = $L['adm_help_forums'];
$adminsubtitle = $L['Forums'];
/* === Hook  === */
foreach (cot_getextplugins('forums.admin.first') as $pl) {
    include $pl;
}
/* ===== */
$sql_forums = $db->query("SELECT * FROM {$db_forum_topics} WHERE 1 ORDER BY ft_creationdate DESC LIMIT 10");
$ii = 0;
while ($row = $sql_forums->fetch()) {
    $ii++;
    $t->assign(array('ADMIN_FORUMS_ROW_II' => $ii, 'ADMIN_FORUMS_ROW_FORUMS' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'ADMIN_FORUMS_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['ft_id']), 'ADMIN_FORUMS_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'ADMIN_FORUMS_ROW_POSTCOUNT' => $row['ft_postcount']));
    $t->parse('MAIN.ADMIN_FORUMS_ROW_USER');
}
$sql_forums->closeCursor();
$t->assign(array('ADMIN_FORUMS_URL_CONFIG' => cot_url('admin', 'm=config&n=edit&o=module&p=forums'), 'ADMIN_FORUMS_URL_STRUCTURE' => cot_url('admin', 'm=structure&n=forums'), 'ADMIN_FORUMS_TOTALTOPICS' => $db->countRows($db_forum_topics), 'ADMIN_FORUMS_TOTALPOSTS' => $db->countRows($db_forum_posts), 'ADMIN_FORUMS_TOTALVIEWS' => $db->query("SELECT SUM(fs_viewcount) FROM {$db_forum_stats}")->fetchColumn()));
/* === Hook  === */
foreach (cot_getextplugins('forums.admin.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$adminmain = $t->text('MAIN');
Exemple #28
0
    $list_url_path['w'] = $w;
}
$list_url = cot_url('page', $list_url_path);
// Building the canonical URL
$pageurl_params = array('c' => $c, 'ord' => $o, 'p' => $p);
if ($durl > 1) {
    $pageurl_params['d'] = $durl;
}
if ($dcurl > 1) {
    $pageurl_params['dc'] = $dcurl;
}
$catpatharray = cot_structure_buildpath('page', $c);
$catpath = $c == 'all' || $c == 'system' || $c == 'unvalidated' || $c == 'saved_drafts' ? $cat['title'] : cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$shortpath = $catpatharray;
array_pop($shortpath);
$catpath_short = $c == 'all' || $c == 'system' || $c == 'unvalidated' || $c == 'saved_drafts' ? '' : cot_breadcrumbs($shortpath, $cfg['homebreadcrumb']);
/* === Hook === */
foreach (cot_getextplugins('page.list.query') as $pl) {
    include $pl;
}
/* ===== */
if (empty($sql_page_string)) {
    $where = array_filter($where);
    $where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
    $sql_page_count = "SELECT COUNT(*) FROM {$db_pages} as p {$join_condition} LEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid {$where}";
    $sql_page_string = "SELECT p.*, u.* {$join_columns}\n\t\tFROM {$db_pages} as p {$join_condition}\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\t\t{$where}\n\t\tORDER BY {$orderby} LIMIT {$d}, " . $cfg['page']['maxrowsperpage'];
}
$totallines = $db->query($sql_page_count, $params)->fetchColumn();
$sqllist = $db->query($sql_page_string, $params);
if (!$cfg['easypagenav'] && $durl > 0 && $cfg['page']['maxrowsperpage'] > 0 && $durl % $cfg['page']['maxrowsperpage'] > 0 || $d > 0 && $d >= $totallines) {
    cot_redirect(cot_url('page', $list_url_path + array('dc' => $dcurl)));
==================== */
/**
 * Inserts translated categories into search category list
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (is_array($i18n_structure) && count($i18n_structure) > 0) {
    // Add translated categories into the multiselect
    foreach ($i18n_structure as $cat => $row) {
        if (isset($pages_cat_list[$cat])) {
            // Permissions to main category already checked
            foreach ($row as $lc => $x) {
                $pages_cat_list[$cat . ':' . $lc] = cot_breadcrumbs(cot_i18n_build_catpath('page', $cat, $lc), false, true, true);
            }
        }
    }
    // Extract previously selected options, they are handled separately
    $i18n_search_cats = array();
    if (is_array($rs['pag']['sub'])) {
        $subcnt = count($rs['pag']['sub']);
        $tmp = array();
        for ($i = 0; $i < $subcnt; $i++) {
            if (mb_strpos($rs['pag']['sub'][$i], ':') !== false) {
                list($cat, $lc) = explode(':', $rs['pag']['sub'][$i]);
                $i18n_search_cats[$lc][] = $cat;
            } else {
                $tmp[] = $rs['pag']['sub'][$i];
            }
Exemple #30
0
foreach (cot_getextplugins('sbr.add.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
if (!empty($uid)) {
    $t->assign(cot_generate_usertags($uid, 'SBR_PERFORMER_'));
} else {
    $t->assign('SBRADD_FORM_PERFORMER', cot_inputbox('text', 'rsbrperformer', $rsbrperformer, 'placeholder="' . $L['sbr_performer_placeholder'] . '"'));
}
if (!empty($pid)) {
    $t->assign(cot_generate_projecttags($pid, 'SBR_PROJECT_'));
}
$patharray[] = array(cot_url('sbr'), $L['sbr']);
$patharray[] = array(cot_url('sbr', 'm=add&pid=' . $pid . '&uip=' . $uid), $L['sbr_addtitle']);
$t->assign(array('SBRADD_TITLE' => cot_breadcrumbs($patharray, $cfg['homebreadcrumb'], true), 'SBRADD_SUBTITLE' => $L['sbr_addtitle'], 'SBRADD_ADMINEMAIL' => "mailto:" . $cfg['adminemail'], 'SBRADD_FORM_SEND' => cot_url('sbr', 'm=add&pid=' . $pid . '&uid=' . $uid . '&a=add'), 'SBRADD_FORM_OWNER' => cot_build_user($usr['id'], htmlspecialchars($usr['name'])), 'SBRADD_FORM_OWNERID' => $usr['id'], 'SBRADD_FORM_MAINTITLE' => cot_inputbox('text', 'rsbrtitle', $rsbr['sbr_title'])));
for ($i = 1; $i <= $stagescount; $i++) {
    $t->assign(array('STAGEADD_FORM_NUM' => $i, 'STAGEADD_FORM_TITLE' => cot_inputbox('text', 'rstagetitle[' . $i . ']', $rstagetitle[$i]), 'STAGEADD_FORM_TEXT' => cot_textarea('rstagetext[' . $i . ']', $rstagetext[$i], 10, 120, '', 'input_textarea'), 'STAGEADD_FORM_COST' => cot_inputbox('text', 'rstagecost[' . $i . ']', $rstagecost[$i], array('class' => 'stagecost', 'size' => '10', 'maxlength' => '100')), 'STAGEADD_FORM_DAYS' => cot_inputbox('text', 'rstagedays[' . $i . ']', $rstagedays[$i], array('size' => '10', 'maxlength' => '100'))));
    /* === Hook === */
    foreach (cot_getextplugins('sbr.add.stages.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.STAGE_ROW');
}
// Extra fields
foreach ($cot_extrafields[$db_sbr] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rsbr' . $exfld['field_name'], $exfld, $rsbr['sbr_' . $exfld['field_name']]);
    $exfld_title = isset($L['sbr_' . $exfld['field_name'] . '_title']) ? $L['sbr_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('SBRADD_FORM_' . $uname => $exfld_val, 'SBRADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'SBRADD_FORM_EXTRAFLD' => $exfld_val, 'SBRADD_FORM_EXTRAFLD_TITLE' => $exfld_title));