Exemple #1
0
function cot_rights_parseline($row, $title, $link, $ico = '')
{
    global $L, $advanced, $t, $out;
    $mn['R'] = 1;
    $mn['W'] = 2;
    $mn['1'] = 4;
    if ($advanced) {
        $mn['2'] = 8;
        $mn['3'] = 16;
        $mn['4'] = 32;
        $mn['5'] = 64;
    } else {
        $rv['2'] = 8;
        $rv['3'] = 16;
        $rv['4'] = 32;
        $rv['5'] = 64;
    }
    $mn['A'] = 128;
    foreach ($mn as $code => $value) {
        $state[$code] = ($row['auth_rights'] & $value) == $value ? TRUE : FALSE;
        $locked[$code] = ($row['auth_rights_lock'] & $value) == $value ? TRUE : FALSE;
        $out['tpl_rights_parseline_locked'] = $locked[$code];
        $out['tpl_rights_parseline_state'] = $state[$code];
        $t->assign(array('ADMIN_RIGHTS_ROW_ITEMS_NAME' => 'auth[' . $row['auth_code'] . '][' . $row['auth_option'] . '][' . $code . ']', 'ADMIN_RIGHTS_ROW_ITEMS_CHECKED' => $state[$code] ? " checked=\"checked\"" : '', 'ADMIN_RIGHTS_ROW_ITEMS_DISABLED' => $locked[$code] ? " disabled=\"disabled\"" : ''));
        $t->parse('MAIN.RIGHTS_SECTION.RIGHTS_ROW.RIGHTS_ROW_ITEMS');
    }
    if (!$advanced) {
        $preserve = '';
        foreach ($rv as $code => $value) {
            if (($row['auth_rights'] & $value) == $value) {
                $preserve .= '<input type="hidden" name="auth[' . $row['auth_code'] . '][' . $row['auth_option'] . '][' . $code . ']" value="1" />';
            }
        }
        $t->assign('ADMIN_RIGHTS_ROW_PRESERVE', $preserve);
    }
    $ico = !empty($ico) && file_exists($ico) ? $ico : '';
    $t->assign(array('ADMIN_RIGHTS_ROW_AUTH_CODE' => $row['auth_code'], 'ADMIN_RIGHTS_ROW_TITLE' => $title, 'ADMIN_RIGHTS_ROW_LINK' => $link, 'ADMIN_RIGHTS_ROW_ICO' => $ico, 'ADMIN_RIGHTS_ROW_RIGHTSBYITEM' => cot_url('admin', 'm=rightsbyitem&ic=' . $row['auth_code'] . '&io=' . $row['auth_option']), 'ADMIN_RIGHTS_ROW_USER' => cot_build_user($row['auth_setbyuserid'], htmlspecialchars($row['user_name']))));
    $t->parse('MAIN.RIGHTS_SECTION.RIGHTS_ROW');
}
Exemple #2
0
         $news_link_params .= $key != $cat && $var[3] != 0 && $xx != 0 ? "&" . $key . "d=" . $var[3]['durl'] : '';
         $xx++;
     }
 }
 $news_link = cot_url('index', $news_link_params);
 $catd = $catn != 0 && !$cfg['plugin']['news']['syncpagination'] ? $cat . "d" : "d";
 $pagenav = cot_pagenav('index', $news_link_params, $v[3]['d'], $totalnews, $v[1], $catd);
 $filename = str_replace(array(' ', ',', '.', '-'), '_', $v[0]);
 $news = new XTemplate(cot_tplfile($catn == 0 ? "news" : "news." . $filename, 'plug'));
 $sql_rowset = $sql->fetchAll();
 $jj = 0;
 foreach ($sql_rowset as $pag) {
     $jj++;
     $url = cot_url('index', 'c=' . $pag['page_cat']);
     $news->assign(cot_generate_pagetags($pag, 'PAGE_ROW_', $v[2]));
     $news->assign(array('PAGE_ROW_NEWSPATH' => cot_rc_link($url, htmlspecialchars($structure['page'][$row['page_cat']]['title'])), 'PAGE_ROW_NEWSPATH_URL' => $url, 'PAGE_ROW_CATDESC' => htmlspecialchars($structure['page'][$pag['page_cat']]['desc']), 'PAGE_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_NUM' => $jj));
     $news->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
     /* === Hook - Part2 : Include === LOOP === */
     foreach ($news_extp as $pl) {
         include $pl;
     }
     /* ===== */
     $news->parse('NEWS.PAGE_ROW');
 }
 $url_newpage = cot_url('page', 'm=add&c=' . $cat);
 $news->assign(array('PAGE_PAGENAV' => $pagenav['main'], 'PAGE_PAGEPREV' => $pagenav['prev'], 'PAGE_PAGENEXT' => $pagenav['next'], 'PAGE_PAGELAST' => $pagenav['last'], 'PAGE_PAGENUM' => $pagenav['current'], 'PAGE_PAGECOUNT' => $pagenav['total'], 'PAGE_ENTRIES_ONPAGE' => $pagenav['onpage'], 'PAGE_ENTRIES_TOTAL' => $pagenav['entries'], 'PAGE_SUBMITNEWPOST' => cot_auth('page', $cat, 'W') ? cot_rc_link($url_newpage, $L['Submitnew']) : '', 'PAGE_SUBMITNEWPOST_URL' => cot_auth('page', $cat, 'W') ? $url_newpage : '', 'PAGE_CATTITLE' => $structure['page'][$cat]['title'], 'PAGE_CATPATH' => cot_breadcrumbs(cot_structure_buildpath('page', $cat), false), 'PAGE_CAT' => $cat));
 /* === Hook - Part2 : Include === TAGS === */
 foreach ($news_tags_extp as $pl) {
     include $pl;
 }
 /* ===== */
Exemple #3
0
    // Extrafields
    if (!empty(cot::$extrafields[cot::$db->contact])) {
        foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
            $exfld_title = cot_extrafield_title($exfld, 'contact_');
            $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']]));
            $tuman->parse('MAIN.DATA.EXTRAFLD');
        }
    }
    $tuman->parse('MAIN.DATA');
}
$sql->closeCursor();
if ($a == '' && !empty($id)) {
    $row = $db->query("SELECT * FROM " . cot::$db->contact . " WHERE contact_id = {$id}")->fetch();
    $tuman->assign(array('CONTACT_DATE' => cot_date('date_full', $row['contact_date']), 'CONTACT_DATE_STAMP' => $row['contact_date'], 'CONTACT_USER' => $row['contact_authorid'] > 0 ? cot_build_user($row['contact_authorid'], $row['contact_author']) : $row['contact_author'], 'CONTACT_EMAIL' => $row['contact_email'], 'CONTACT_ID' => $row['contact_id'], 'CONTACT_DELLINK' => cot_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id']), 'CONTACT_VAL' => $row['contact_val'] == 1 ? 'unval' : 'val', 'CONTACT_VALLINK' => cot_url('admin', 'm=other&p=contact&a=' . $val . '&id=' . $row['contact_id']), 'CONTACT_READLINK' => cot_url('admin', 'm=other&p=contact&a=val&id=' . $row['contact_id']), 'CONTACT_UNREADLINK' => cot_url('admin', 'm=other&p=contact&a=unval&id=' . $row['contact_id']), 'CONTACT_SUBJECT' => $row['contact_subject'], 'CONTACT_TEXT' => $row['contact_text'], 'CONTACT_REPLY' => $row['contact_reply'], 'CONTACT_FORM_SEND' => cot_url("admin", 'm=other&p=contact&a=send&id=' . $row['contact_id']), 'CONTACT_FORM_TEXT' => cot_textarea('rtext', $rtext, 8, 64)));
    // Extrafields
    if (!empty(cot::$extrafields[cot::$db->contact])) {
        foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]);
            $exfld_title = cot_extrafield_title($exfld, 'contact_');
            $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']]));
            $tuman->parse('MAIN.VIEW.EXTRAFLD');
        }
    }
    $tuman->parse('MAIN.VIEW');
}
cot_display_messages($tuman);
$tuman->assign(array('CONTACT_PAGINATION' => $pagnav['main'], 'CONTACT_PREV' => $pagenav['prev'], 'CONTACT_NEXT' => $pagenav['next']));
$tuman->parse('MAIN');
function cot_build_recentpages($template, $mode = 'recent', $maxperpage = 5, $d = 0, $titlelength = 0, $textlength = 0, $rightprescan = true, $cat = '')
{
    global $db, $structure, $db_pages, $db_users, $sys, $cfg, $L, $cot_extrafields, $usr;
    $recentitems = new XTemplate(cot_tplfile($template, 'plug'));
    // Load all cats and subcats in white list if set
    if (!empty($cfg['plugin']['recentitems']['whitelist'])) {
        $whitelist = array();
        foreach (preg_split('#\\r?\\n#', $cfg['plugin']['recentitems']['whitelist']) as $c) {
            $whitelist = array_merge($whitelist, cot_structure_children('page', $c, true, true, $rightprescan));
        }
    } else {
        $whitelist = false;
    }
    // Load all cats and subcats in black list if set
    if (!empty($cfg['plugin']['recentitems']['blacklist'])) {
        $blacklist = array();
        foreach (preg_split('#\\r?\\n#', $cfg['plugin']['recentitems']['blacklist']) as $c) {
            $blacklist = array_merge($blacklist, cot_structure_children('page', $c, true, true, $rightprescan));
        }
    } else {
        $blacklist = false;
    }
    if ($rightprescan || $cat) {
        // Get selected cats
        $catsub = cot_structure_children('page', $cat, true, true, $rightprescan);
        if ($whitelist) {
            // Must be both in selected and whitelist
            $catsub = array_intersect($catsub, $whitelist);
        } elseif ($blacklist) {
            // Must be in selected but not in blacklist
            $catsub = array_diff($catsub, $blacklist);
        }
        $incat = "AND page_cat IN ('" . implode("','", $catsub) . "')";
    } elseif ($whitelist) {
        // Only cats from white list
        $incat = "AND page_cat IN ('" . implode("','", $whitelist) . "')";
    } elseif ($blacklist) {
        // All cats but not in black list
        $incat = "AND page_cat NOT IN ('" . implode("','", $blacklist) . "')";
    }
    if ($mode == 'recent') {
        $where = "WHERE page_state=0 AND page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']}) AND page_cat <> 'system' " . $incat;
        $totalrecent['pages'] = $cfg['plugin']['recentitems']['maxpages'];
    } else {
        $where = "WHERE page_date >= {$mode} AND page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']}) AND page_state=0 AND page_cat <> 'system' " . $incat;
        $totalrecent['pages'] = $db->query("SELECT COUNT(*) FROM {$db_pages} " . $where)->fetchColumn();
    }
    $join_columns = '';
    $join_tables = '';
    /* === Hook === */
    foreach (cot_getextplugins('recentitems.recentpages.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT p.*, u.* {$join_columns}\n\t\tFROM {$db_pages} AS p\n\t\t\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\t\t{$join_tables}\n\t\t{$where} ORDER by page_date desc LIMIT {$d}, {$maxperpage}");
    $jj = 0;
    /* === Hook - Part1 === */
    $extp = cot_getextplugins('recentitems.recentpages.tags');
    /* ===== */
    foreach ($sql->fetchAll() as $pag) {
        $jj++;
        if ((int) $titlelength > 0 && mb_strlen($pag['page_title']) > $titlelength) {
            $pag['page_title'] = cot_string_truncate($pag['page_title'], $titlelength, false) . "...";
        }
        $recentitems->assign(cot_generate_pagetags($pag, 'PAGE_ROW_', $textlength));
        $recentitems->assign(array('PAGE_ROW_SHORTTITLE' => htmlspecialchars($pag['page_title']), 'PAGE_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_NUM' => $jj));
        $recentitems->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
        /* === Hook - Part2 === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $recentitems->parse('MAIN.PAGE_ROW');
    }
    if ($d == 0 && $jj == 0) {
        $recentitems->parse('MAIN.NO_PAGES_FOUND');
    }
    $recentitems->parse('MAIN');
    return $d == 0 || $jj > 0 ? $recentitems->text('MAIN') : '';
}
Exemple #5
0
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.list.loop');
/* ===== */
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_rowset_other = false;
/* === Hook === */
foreach (cot_getextplugins('page.list.before_loop') as $pl) {
    include $pl;
}
/* ===== */
if (!$sqllist_rowset_other) {
    foreach ($sqllist_rowset as $pag) {
        $jj++;
        $t->assign(cot_generate_pagetags($pag, 'LIST_ROW_', $cfg['page']['truncatetext'], $usr['isadmin']));
        $t->assign(array('LIST_ROW_OWNER' => cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])), 'LIST_ROW_ODDEVEN' => cot_build_oddeven($jj), 'LIST_ROW_NUM' => $jj));
        $t->assign(cot_generate_usertags($pag, 'LIST_ROW_OWNER_'));
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.LIST_ROW');
    }
}
/* === Hook === */
foreach (cot_getextplugins('page.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
/**
 * Generates comments display for a given item
 *
 * @param string $ext_name Module or plugin code
 * @param string $code Item identifier
 * @param string $cat Item category code (optional)
 * @param bool $force_admin Enforces user to be administrator of comments for this item.
 *	E.g. to moderate his wall even if he is not a moderator
 * @return string Rendered HTML output for comments
 * @global CotDB $db
 */
function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false)
{
    global $db, $db_com, $db_users, $cfg, $usr, $L, $sys, $R, $env, $pg, $cot_extrafields, $cache, $structure;
    // Check permissions and enablement
    list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'comments');
    if ($auth_read && $auth_write && $force_admin) {
        $auth_admin = true;
        $_SESSION['cot_comments_force_admin'][$ext_name][$code] = true;
    }
    $enabled = cot_comments_enabled($ext_name, $cat, $code);
    if (!$auth_read || !$enabled && !$auth_admin) {
        return '';
    }
    $comments_join_columns = $comments_join_tables = $comments_join_where = '';
    // Get the URL and parameters
    $link_area = $env['ext'];
    $link_params = $_GET;
    if (defined('COT_PLUG')) {
        $link_area = 'plug';
        $link_params['e'] = $env['ext'];
    }
    if (isset($_GET['rwr'])) {
        unset($link_params['rwr'], $link_params['e']);
    }
    $cot_com_back = array($link_area, $link_params);
    $_SESSION['cot_com_back'][$ext_name][$cat][$code] = $cot_com_back;
    $d_var = 'dcm';
    list($pg, $d, $durl) = cot_import_pagenav($d_var, $cfg['plugin']['comments']['maxcommentsperpage']);
    $d = empty($d) ? 0 : (int) $d;
    if ($auth_write && $enabled) {
        require_once cot_incfile('forms');
    }
    $t = new XTemplate(cot_tplfile('comments', 'plug'));
    /* == Hook == */
    foreach (cot_getextplugins('comments.main') as $pl) {
        include $pl;
    }
    /* ===== */
    $editor = cot::$cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : '';
    $t->assign(array('COMMENTS_CODE' => $code, 'COMMENTS_FORM_SEND' => cot_url('plug', "e=comments&a=send&area={$ext_name}&cat={$cat}&item={$code}"), 'COMMENTS_FORM_AUTHOR' => $usr['id'] > 0 ? $usr['name'] : cot_inputbox('text', 'rname'), 'COMMENTS_FORM_AUTHORID' => $usr['id'], 'COMMENTS_FORM_TEXT' => $auth_write && $enabled ? cot_textarea('rtext', $rtext, 7, 120, '', $editor) . cot_inputbox('hidden', 'cb', base64_encode(serialize($cot_com_back))) : '', 'COMMENTS_DISPLAY' => $cfg['plugin']['comments']['expand_comments'] ? '' : 'none'));
    if ($auth_write && $enabled) {
        // Extra fields
        if (!empty(cot::$extrafields[cot::$db->com])) {
            foreach (cot::$extrafields[cot::$db->com] as $exfld) {
                $uname = strtoupper($exfld['field_name']);
                $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $rcomments[$exfld['field_name']]);
                $exfld_title = cot_extrafield_title($exfld, 'comments_');
                $t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title));
                $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.EXTRAFLD');
            }
        }
        $allowed_time = cot_build_timegap($sys['now'] - $cfg['plugin']['comments']['time'] * 60, $sys['now']);
        $com_hint = cot_rc('com_edithint', array('time' => $allowed_time));
        /* == Hook == */
        foreach (cot_getextplugins('comments.newcomment.tags') as $pl) {
            include $pl;
        }
        /* ===== */
        $usr['id'] == 0 && $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.GUEST');
        if ($usr['id'] == 0 && cot_check_messages() && $cache) {
            if ($ext_name == 'page' && $cfg['cache_page']) {
                $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$cat]['path']));
                $cfg['cache_page'] = false;
            }
        }
        cot_display_messages($t, 'COMMENTS.COMMENTS_NEWCOMMENT');
        $t->assign('COMMENTS_FORM_HINT', $com_hint);
        $t->parse('COMMENTS.COMMENTS_NEWCOMMENT');
    } else {
        $warning = $enabled ? $L['com_regonly'] : $L['com_closed'];
        $t->assign('COMMENTS_CLOSED', $warning);
        $t->parse('COMMENTS.COMMENTS_CLOSED');
    }
    $order = $cfg['plugin']['comments']['order'] == 'Chronological' ? 'ASC' : 'DESC';
    $comments_order = "com_id {$order}";
    /* == Hook == */
    foreach (cot_getextplugins('comments.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT c.*, u.* {$comments_join_columns}\n\t\tFROM {$db_com} AS c LEFT JOIN {$db_users} AS u ON u.user_id = c.com_authorid {$comments_join_tables}\n\t\tWHERE com_area = ? AND com_code = ? {$comments_join_where} ORDER BY {$comments_order} LIMIT ?, ?", array($ext_name, $code, (int) $d, (int) $cfg['plugin']['comments']['maxcommentsperpage']));
    if ($sql->rowCount() > 0 && $enabled) {
        $i = $d;
        $kk = 0;
        $totalitems = cot_comments_count($ext_name, $code);
        /* === Hook - Part1 : Set === */
        $extp = cot_getextplugins('comments.loop');
        /* ===== */
        foreach ($sql->fetchAll() as $row) {
            $i++;
            $kk++;
            $com_admin = $auth_admin ? cot_rc('comments_code_admin', array('ipsearch' => cot_build_ipsearch($row['com_authorip']), 'delete_url' => cot_confirm_url(cot_url('plug', 'e=comments&a=delete&cat=' . $cat . '&id=' . $row['com_id'] . '&' . cot_xg()), 'comments', 'comments_confirm_delete'))) : '';
            $com_text = cot_parse($row['com_text'], $cfg['plugin']['comments']['markup']);
            $time_limit = $sys['now'] < $row['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE;
            $usr['isowner_com'] = $time_limit && ($usr['id'] > 0 && $row['com_authorid'] == $usr['id'] || $usr['id'] == 0 && !empty($_SESSION['cot_comments_edit'][$row['com_id']]) && $usr['ip'] == $row['com_authorip']);
            $com_gup = $sys['now'] - ($row['com_date'] + $cfg['plugin']['comments']['time'] * 60);
            $allowed_time = $usr['isowner_com'] && !$usr['isadmin'] ? ' - ' . cot_build_timegap($sys['now'] + $com_gup, $sys['now']) . $L['plu_comgup'] : '';
            $com_edit = $auth_admin || $usr['isowner_com'] ? cot_rc('comments_code_edit', array('edit_url' => cot_url('plug', 'e=comments&m=edit&cat=' . $cat . '&id=' . $row['com_id']), 'allowed_time' => $allowed_time)) : '';
            if ($row['com_area'] == 'page') {
                if ($usr['id'] == 0 && $usr['isowner_com'] && $cfg['cache_page']) {
                    $cfg['cache_page'] = $cfg['cache_index'] = false;
                }
            }
            $t->assign(array('COMMENTS_ROW_ID' => $row['com_id'], 'COMMENTS_ROW_ORDER' => $cfg['plugin']['comments']['order'] == 'Recent' ? $totalitems - $i + 1 : $i, 'COMMENTS_ROW_URL' => cot_url($link_area, $link_params, '#c' . $row['com_id']), 'COMMENTS_ROW_AUTHOR' => cot_build_user($row['com_authorid'], htmlspecialchars($row['com_author'])), 'COMMENTS_ROW_AUTHORID' => $row['com_authorid'], 'COMMENTS_ROW_TEXT' => $com_text, 'COMMENTS_ROW_DATE' => cot_date('datetime_medium', $row['com_date']), 'COMMENTS_ROW_DATE_STAMP' => $row['com_date'], 'COMMENTS_ROW_ADMIN' => $com_admin, 'COMMENTS_ROW_EDIT' => $com_edit, 'COMMENTS_ROW_ODDEVEN' => cot_build_oddeven($kk), 'COMMENTS_ROW_NUM' => $kk));
            // Extrafields
            if (!empty(cot::$extrafields[cot::$db->com])) {
                foreach (cot::$extrafields[cot::$db->com] as $exfld) {
                    $tag = mb_strtoupper($exfld['field_name']);
                    $exfld_title = cot_extrafield_title($exfld, 'comments_');
                    $t->assign(array('COMMENTS_ROW_' . $tag . '_TITLE' => $exfld_title, 'COMMENTS_ROW_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'COMMENTS_ROW_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']]));
                }
            }
            $t->assign(cot_generate_usertags($row, 'COMMENTS_ROW_AUTHOR_', htmlspecialchars($row['com_author'])));
            /* === Hook - Part2 : Include === */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('COMMENTS.COMMENTS_ROW');
        }
        $pagenav = cot_pagenav($link_area, $link_params, $d, $totalitems, $cfg['plugin']['comments']['maxcommentsperpage'], $d_var, '#comments', $cfg['jquery'] && $cfg['ajax_enabled'], 'comments', 'plug', "e=comments&area={$ext_name}&cat={$cat}&item={$code}");
        $t->assign(array('COMMENTS_PAGES_INFO' => cot_rc('comments_code_pages_info', array('totalitems' => $totalitems, 'onpage' => $i - $d)), 'COMMENTS_PAGES_TOTALITEMS' => $totalitems, 'COMMENTS_PAGES_PAGESPREV' => $pagenav['prev'], 'COMMENTS_PAGES_PAGNAV' => $pagenav['main'], 'COMMENTS_PAGES_PAGESNEXT' => $pagenav['next']));
        $t->parse('COMMENTS.PAGNAVIGATOR');
    } elseif (!$sql->rowCount() && $enabled) {
        $t->assign(array('COMMENTS_EMPTYTEXT' => $L['com_nocommentsyet']));
        $t->parse('COMMENTS.COMMENTS_EMPTY');
    }
    /* == Hook == */
    foreach (cot_getextplugins('comments.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('COMMENTS');
    $res_display = $t->text('COMMENTS');
    return $res_display;
}
/**
 * Returns all section tags for coTemplate
 *
 * @param string $cat Forums structure cat code
 * @param string $tag_prefix Prefix for tags
 * @param array $stat Category statistics
 *
 * @return array
 */
function cot_generate_sectiontags($cat, $tag_prefix = '', $stat = NULL)
{
    global $cfg, $structure, $cot_extrafields, $usr, $sys, $L, $db_structure;
    $stat['fs_lt_date'] = !empty($stat['fs_lt_date']) ? $stat['fs_lt_date'] : 0;
    $stat['fs_lt_posterid'] = !empty($stat['fs_lt_posterid']) ? $stat['fs_lt_posterid'] : 0;
    $usr['lastvisit'] = !empty($usr['lastvisit']) ? $usr['lastvisit'] : 0;
    $new_elems = $usr['id'] > 0 && $stat['fs_lt_date'] > $usr['lastvisit'] && $stat['fs_lt_posterid'] != $usr['id'];
    $sections = array($tag_prefix . 'CAT' => $cat, $tag_prefix . 'LOCKED' => $structure['forums'][$cat]['locked'], $tag_prefix . 'TITLE' => $structure['forums'][$cat]['title'], $tag_prefix . 'DESC' => cot_parse_autourls($structure['forums'][$cat]['desc']) . ($structure['forums'][$cat]['locked'] ? ' ' . $L['Locked'] : ''), $tag_prefix . 'ICON' => empty($structure['forums'][$cat]['icon']) ? '' : cot_rc('img_structure_cat', array('icon' => $structure['forums'][$cat]['icon'], 'title' => htmlspecialchars($structure['forums'][$cat]['title']), 'desc' => htmlspecialchars($structure['forums'][$cat]['desc']))), $tag_prefix . 'URL' => cot_url('forums', 'm=topics&s=' . $cat), $tag_prefix . 'SECTIONSURL' => cot_url('forums', 'c=' . $cat), $tag_prefix . 'NEWPOSTS' => $new_elems, $tag_prefix . 'CAT_DEFSTATE' => htmlspecialchars($cfg['forums']['cat_' . $cat]['defstate']));
    if (is_array($stat)) {
        if ($stat['fs_lt_date'] > 0) {
            $sections += array($tag_prefix . 'LASTPOSTDATE' => cot_date('datetime_short', $stat['fs_lt_date']), $tag_prefix . 'LASTPOSTER' => cot_build_user($stat['fs_lt_posterid'], htmlspecialchars($stat['fs_lt_postername'])), $tag_prefix . 'LASTPOST' => cot_rc_link($new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), cot_cutstring($stat['fs_lt_title'], 32)), $tag_prefix . 'LASTPOST_URL' => $new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), $tag_prefix . 'TIMEAGO' => cot_build_timegap($stat['fs_lt_date'], $sys['now']));
        }
        $sections += array($tag_prefix . 'TOPICCOUNT' => $stat['topiccount'], $tag_prefix . 'LASTPOSTDATE_STAMP' => $stat['fs_lt_date'], $tag_prefix . 'POSTCOUNT' => $stat['postcount'], $tag_prefix . 'VIEWCOUNT' => $stat['viewcount'], $tag_prefix . 'VIEWCOUNT_SHORT' => $stat['viewcount'] > 9999 ? floor($stat['viewcount'] / 1000) . 'k' : $stat['viewcount']);
    }
    if (!is_array($stat) || !$stat['fs_lt_date']) {
        $sections[$tag_prefix . 'LASTPOSTDATE'] = '';
        $sections[$tag_prefix . 'LASTPOSTER'] = '';
        $sections[$tag_prefix . 'LASTPOST'] = '';
        $sections[$tag_prefix . 'TIMEAGO'] = '';
        $sections[$tag_prefix . 'TOPICCOUNT'] = 0;
        $sections[$tag_prefix . 'POSTCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT_SHORT'] = 0;
    }
    foreach ($cot_extrafields[$db_structure] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $sections[$tag_prefix . $uname . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $sections[$tag_prefix . $uname] = cot_build_extrafields_data('structure', $exfld, $structure['forums'][$cat][$exfld['field_name']]);
        $sections[$tag_prefix . $uname . '_VALUE'] = $structure['forums'][$cat][$exfld['field_name']];
    }
    return $sections;
}
Exemple #8
0
    if ($durl > ceil($fpu)) {
        $guest_start_num = $maxuserssperpage - $who_users % $maxuserssperpage + ($durl - 1 - ceil($fpu)) * $maxuserssperpage;
    }
}
foreach ($sql_users->fetchAll() as $row) {
    if ($hiddenusers && in_array($row['user_id'], $hiddenusers)) {
        if (cot_auth('plug', 'hiddengroups', '1')) {
            $t->assign('USER_HIDDEN', $L['Hidden']);
        } else {
            continue;
        }
    }
    if ($row['is_user']) {
        $count_users++;
        $url_ipsearch = cot_url('admin', 'm=other&p=ipsearch&a=search&id=' . $row['online_ip'] . '&' . cot_xg());
        $t->assign(array('USER_LOCATION' => htmlspecialchars($row['online_location']), 'USER_SUBLOCATION' => htmlspecialchars($row['online_subloc']), 'USER_IP' => $ipsearch ? cot_rc_link($url_ipsearch, $row['online_ip']) : $row['online_ip'], 'USER_IP_URL' => $ipsearch ? $url_ipsearch : '', 'USER_LINK' => cot_build_user($row['online_userid'], htmlspecialchars($row['online_name'])), 'USER_LASTSEEN' => cot_build_timegap($row['online_lastseen'], $sys['now'])));
        $t->assign(cot_generate_usertags($row, 'USER_'));
        /* === Hook - Part2 : Include === */
        foreach ($users_loop_hook as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.USERS');
    } else {
        $count_guests++;
        $url_ipsearch = cot_url('admin', 'm=other&p=ipsearch&a=search&id=' . $row['online_ip'] . '&' . cot_xg());
        $t->assign(array('GUEST_LOCATION' => htmlspecialchars($row['online_location']), 'GUEST_SUBLOCATION' => htmlspecialchars($row['online_subloc']), 'GUEST_IP' => $ipsearch ? cot_rc_link($url_ipsearch, $row['online_ip']) : $row['online_ip'], 'GUEST_IP_URL' => $ipsearch ? $url_ipsearch : '', 'GUEST_NUMBER' => $count_guests + $guest_start_num, 'GUEST_LASTSEEN' => cot_build_timegap($row['online_lastseen'], $sys['now'])));
        /* === Hook - Part2 : Include === */
        foreach ($guests_loop_hook as $pl) {
            include $pl;
        }
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=forums.topics.tags
Tags=forums.topics.tpl:{FORUMS_TOPICS_VIEWERS},{FORUMS_TOPICS_VIEWER_NAMES}
[END_COT_EXT]
==================== */
/**
 * Forums online users in section display
 *
 * @package WhosOnline
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($cfg['forums']['cat_' . $s]['allowviewers']) {
    $v = 0;
    $sql_forums_view = $db->query("SELECT online_name, online_userid FROM {$db_online} WHERE online_location='Forums' AND online_subloc=" . $db->quote($structure['forums'][$s]['title']));
    while ($rowv = $sql_forums_view->fetch()) {
        if ($rowv['online_name'] != 'v') {
            $fs_viewers_names .= $v > 0 ? ', ' : '';
            $fs_viewers_names .= cot_build_user($rowv['online_userid'], htmlspecialchars($rowv['online_name']));
            $v++;
        }
    }
    $sql_forums_view->closeCursor();
    $fs_viewers = $v;
    $t->assign(array('FORUMS_TOPICS_VIEWERS' => $fs_viewers, 'FORUMS_TOPICS_VIEWER_NAMES' => $fs_viewers_names));
    $t->parse('MAIN.FORUMS_SECTIONS_VIEWERS');
}
Exemple #10
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));
function cot_rights_parseline($row, $title, $link)
{
    global $L, $advanced, $t, $out, $ic;
    $mn['R'] = 1;
    $mn['W'] = 2;
    if ($advanced || $ic == 'page') {
        $mn['1'] = 4;
    } else {
        $rv['1'] = 4;
    }
    if ($advanced) {
        $mn['2'] = 8;
        $mn['3'] = 16;
        $mn['4'] = 32;
        $mn['5'] = 64;
    } else {
        $rv['2'] = 8;
        $rv['3'] = 16;
        $rv['4'] = 32;
        $rv['5'] = 64;
    }
    $mn['A'] = 128;
    foreach ($mn as $code => $value) {
        $state[$code] = ($row['auth_rights'] & $value) == $value ? TRUE : FALSE;
        $locked[$code] = ($row['auth_rights_lock'] & $value) == $value ? TRUE : FALSE;
        $out['tpl_rights_parseline_locked'] = $locked[$code];
        $out['tpl_rights_parseline_state'] = $state[$code];
        $t->assign(array('ADMIN_RIGHTSBYITEM_ROW_ITEMS_NAME' => 'auth[' . $row['auth_groupid'] . '][' . $code . ']', 'ADMIN_RIGHTSBYITEM_ROW_ITEMS_CHECKED' => $state[$code] ? " checked=\"checked\"" : '', 'ADMIN_RIGHTSBYITEM_ROW_ITEMS_DISABLED' => $locked[$code] ? " disabled=\"disabled\"" : ''));
        $t->parse('MAIN.RIGHTSBYITEM_ROW.ROW_ITEMS');
    }
    if (!$advanced) {
        $preserve = '';
        foreach ($rv as $code => $value) {
            if (($row['auth_rights'] & $value) == $value) {
                $preserve .= '<input type="hidden" name="auth[' . $row['auth_groupid'] . '][' . $code . ']" value="1" />';
            }
        }
        $t->assign('ADMIN_RIGHTSBYITEM_ROW_PRESERVE', $preserve);
    }
    $t->assign(array('ADMIN_RIGHTSBYITEM_ROW_TITLE' => $title, 'ADMIN_RIGHTSBYITEM_ROW_LINK' => $link, 'ADMIN_RIGHTSBYITEM_ROW_USER' => cot_build_user($row['auth_setbyuserid'], htmlspecialchars($row['user_name'])), 'ADMIN_RIGHTSBYITEM_ROW_JUMPTO' => cot_url('users', 'g=' . $row['auth_groupid'])));
    $t->parse('MAIN.RIGHTSBYITEM_ROW');
}
Exemple #12
0
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('sbr', 'edit'), 'plug');
/* === Hook === */
foreach (cot_getextplugins('sbr.edit.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$t->assign(cot_generate_sbrtags($sbr, 'SBR_'));
$t->assign(cot_generate_usertags($sbr['sbr_performer'], 'SBR_PERFORMER_'));
if (!empty($sbr['sbr_pid'])) {
    $t->assign(cot_generate_projecttags($sbr['sbr_pid'], 'SBR_PROJECT_'));
}
$patharray[] = array(cot_url('sbr'), $L['sbr']);
$patharray[] = array(cot_url('sbr', 'm=edit&id=' . $id), $L['sbr_edittitle']);
$t->assign(array('SBREDIT_TITLE' => cot_breadcrumbs($patharray, $cfg['homebreadcrumb'], true), 'SBREDIT_SUBTITLE' => $L['sbr_edittitle'], 'SBREDIT_ADMINEMAIL' => "mailto:" . $cfg['adminemail'], 'SBREDIT_FORM_SEND' => cot_url('sbr', 'm=edit&id=' . $id . '&a=update'), 'SBREDIT_FORM_OWNER' => cot_build_user($usr['id'], htmlspecialchars($usr['name'])), 'SBREDIT_FORM_OWNERID' => $usr['id'], 'SBREDIT_FORM_MAINTITLE' => cot_inputbox('text', 'rsbrtitle', $sbr['sbr_title'])));
$stages = $db->query("SELECT * FROM {$db_sbr_stages} WHERE stage_sid=" . $sbr['sbr_id'] . " ORDER BY stage_num ASC")->fetchAll();
if (empty($stagescount)) {
    $stagescount = count($stages);
}
foreach ($stages as $stage) {
    $t->assign(array('STAGEEDIT_FORM_NUM' => $stage['stage_num'], 'STAGEEDIT_FORM_TITLE' => cot_inputbox('text', 'rstagetitle[' . $stage['stage_num'] . ']', $stage['stage_title']), 'STAGEEDIT_FORM_TEXT' => cot_textarea('rstagetext[' . $stage['stage_num'] . ']', $stage['stage_text'], 10, 120, '', 'input_textarea'), 'STAGEEDIT_FORM_COST' => cot_inputbox('text', 'rstagecost[' . $stage['stage_num'] . ']', $stage['stage_cost'], array('class' => 'stagecost', 'size' => '10', 'maxlength' => '100')), 'STAGEEDIT_FORM_DAYS' => cot_inputbox('text', 'rstagedays[' . $stage['stage_num'] . ']', $stage['stage_days'], array('size' => '10', 'maxlength' => '100'))));
    $stagefiles = $db->query("SELECT * FROM {$db_sbr_files} WHERE file_sid=" . $sbr['sbr_id'] . " AND file_area='stage' AND file_code='" . $stage['stage_num'] . "' ORDER BY file_id ASC")->fetchAll();
    foreach ($stagefiles as $file) {
        $t->assign(array('FILE_ROW_ID' => $file['file_id'], 'FILE_ROW_URL' => $file['file_url'], 'FILE_ROW_TITLE' => $file['file_title'], 'FILE_ROW_EXT' => $file['file_ext'], 'FILE_ROW_SIZE' => $file['file_size']));
        $t->parse('MAIN.STAGE_ROW.FILE_ROW');
    }
    /* === Hook === */
    foreach (cot_getextplugins('sbr.edit.stages.tags') as $pl) {
        include $pl;
    }
Exemple #13
0
    $ipmask1 = $userip[0] . "." . $userip[1] . "." . $userip[2] . "." . $userip[3];
    $ipmask2 = $userip[0] . "." . $userip[1] . "." . $userip[2];
    $ipmask3 = $userip[0] . "." . $userip[1];
    $res_host = @gethostbyaddr($id);
    $res_dns = $res_host == $id ? 'Unknown' : $res_host;
    $sql = $db->query("SELECT user_id, user_name, user_lastip FROM {$db_users} WHERE user_lastip='{$ipmask1}' ");
    $totalmatches1 = $sql->rowCount();
    while ($row = $sql->fetch()) {
        $t->assign(array('IPSEARCH_USER_IPMASK1' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])), 'IPSEARCH_USER_LASTIP_IPMASK1' => cot_build_ipsearch($row['user_lastip'])));
        $t->parse('MAIN.IPSEARCH_RESULTS.IPSEARCH_IPMASK1');
    }
    $sql->closeCursor();
    $sql = $db->query("SELECT user_id, user_name, user_lastip FROM {$db_users} WHERE user_lastip LIKE '{$ipmask2}.%' ");
    $totalmatches2 = $sql->rowCount();
    while ($row = $sql->fetch()) {
        $t->assign(array('IPSEARCH_USER_IPMASK2' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])), 'IPSEARCH_USER_LASTIP_IPMASK2' => cot_build_ipsearch($row['user_lastip'])));
        $t->parse('MAIN.IPSEARCH_RESULTS.IPSEARCH_IPMASK2');
    }
    $sql->closeCursor();
    $sql = $db->query("SELECT user_id, user_name, user_lastip FROM {$db_users} WHERE user_lastip LIKE '{$ipmask3}.%.%' ");
    $totalmatches3 = $sql->rowCount();
    while ($row = $sql->fetch()) {
        $t->assign(array('IPSEARCH_USER_IPMASK3' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])), 'IPSEARCH_USER_LASTIP_IPMASK3' => cot_build_ipsearch($row['user_lastip'])));
        $t->parse('MAIN.IPSEARCH_RESULTS.IPSEARCH_IPMASK3');
    }
    $sql->closeCursor();
    $t->assign(array('IPSEARCH_RES_DNS' => $res_dns, 'IPSEARCH_TOTALMATCHES1' => $totalmatches1, 'IPSEARCH_IPMASK1' => $ipmask1, 'IPSEARCH_TOTALMATCHES2' => $totalmatches2, 'IPSEARCH_IPMASK2' => $ipmask2, 'IPSEARCH_TOTALMATCHES3' => $totalmatches3, 'IPSEARCH_IPMASK3' => $ipmask3));
    $t->parse('MAIN.IPSEARCH_RESULTS');
}
$t->parse('MAIN');
$plugin_body .= $t->text('MAIN');
Exemple #14
0
/* ===== */
$fp_num = 0;
foreach ($sql_forums->fetchAll() as $row) {
    $row['user_text'] = $cfg['forums']['cat_' . $s]['allowusertext'] ? $row['user_text'] : '';
    $fp_num++;
    $rowquote_url = $usr['id'] > 0 ? cot_url('forums', 'm=posts&s=' . $s . '&q=' . $q . '&quote=' . $row['fp_id'] . '&d=' . $durl . '&n=last', '#np') : '';
    $rowquote = $usr['id'] > 0 ? cot_rc('forums_rowquote', array('url' => $rowquote_url)) : '';
    $rowedit_url = ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) && $usr['id'] > 0 ? cot_url('forums', 'm=editpost&s=' . $s . '&q=' . $q . '&p=' . $row['fp_id'] . '&d=' . $durl . '&' . cot_xg()) : '';
    $rowedit = ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) && $usr['id'] > 0 ? cot_rc('forums_rowedit', array('url' => $rowedit_url)) : '';
    $rowdelete_url = $usr['id'] > 0 && ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600)) ? cot_confirm_url(cot_url('forums', 'm=posts&a=delete&' . cot_xg() . '&s=' . $s . '&q=' . $q . '&p=' . $row['fp_id'] . '&d=' . $durl), 'forums', 'forums_confirm_delete_post') : '';
    $rowdelete = $usr['id'] > 0 && ($usr['isadmin'] || $row['fp_posterid'] == $usr['id'] && ($cfg['forums']['edittimeout'] == '0' || $sys['now'] - $row['fp_creation'] < $cfg['forums']['edittimeout'] * 3600) && $fp_num > 1) ? cot_rc('forums_rowdelete', array('url' => $rowdelete_url)) : '';
    if (!empty($row['fp_updater'])) {
        $row['fp_updatedby'] = sprintf($L['forums_updatedby'], htmlspecialchars($row['fp_updater']), cot_date('datetime_medium', $row['fp_updated']), cot_build_timegap($row['fp_updated'], $sys['now']));
    }
    $t->assign(cot_generate_usertags($row, 'FORUMS_POSTS_ROW_USER'));
    $t->assign(array('FORUMS_POSTS_ROW_ID' => $row['fp_id'], 'FORUMS_POSTS_ROW_POSTID' => 'post_' . $row['fp_id'], 'FORUMS_POSTS_ROW_IDURL' => cot_url('forums', 'm=posts&id=' . $row['fp_id']), 'FORUMS_POSTS_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['fp_topicid'] . '&d=' . $durl, "#" . $row['fp_id']), 'FORUMS_POSTS_ROW_CREATION' => cot_date('datetime_medium', $row['fp_creation']), 'FORUMS_POSTS_ROW_CREATION_STAMP' => $row['fp_creation'], 'FORUMS_POSTS_ROW_UPDATED' => cot_date('datetime_medium', $row['fp_updated']), 'FORUMS_POSTS_ROW_UPDATED_STAMP' => $row['fp_updated'], 'FORUMS_POSTS_ROW_UPDATER' => htmlspecialchars($row['fp_updater']), 'FORUMS_POSTS_ROW_UPDATEDBY' => $row['fp_updatedby'], 'FORUMS_POSTS_ROW_TEXT' => cot_parse($row['fp_text'], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_POSTS_ROW_ANCHORLINK' => cot_rc('forums_code_post_anchor', array('id' => $row['fp_id'])), 'FORUMS_POSTS_ROW_POSTERNAME' => cot_build_user($row['fp_posterid'], htmlspecialchars($row['fp_postername'])), 'FORUMS_POSTS_ROW_POSTERID' => $row['fp_posterid'], 'FORUMS_POSTS_ROW_POSTERIP' => $usr['isadmin'] ? cot_build_ipsearch($row['fp_posterip']) : '', 'FORUMS_POSTS_ROW_DELETE' => $rowdelete, 'FORUMS_POSTS_ROW_DELETE_URL' => $rowdelete_url, 'FORUMS_POSTS_ROW_EDIT' => $rowedit, 'FORUMS_POSTS_ROW_EDIT_URL' => $rowedit_url, 'FORUMS_POSTS_ROW_QUOTE' => $rowquote, 'FORUMS_POSTS_ROW_QUOTE_URL' => $rowquote_url, 'FORUMS_POSTS_ROW_BOTTOM' => (empty($id) ? $d + $fp_num : $id) == $totalposts ? $R['forums_code_bottom'] : ($usr['id'] > 0 && $n == 'unread' && $row['fp_creation'] > $usr['lastvisit'] ? $R['forums_code_unread'] : ''), 'FORUMS_POSTS_ROW_ODDEVEN' => cot_build_oddeven($fp_num), 'FORUMS_POSTS_ROW_NUM' => $fp_num, 'FORUMS_POSTS_ROW_ORDER' => empty($id) ? $d + $fp_num : $id));
    foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
        $tag = mb_strtoupper($exfld['field_name']);
        $t->assign(array('FORUMS_POSTS_ROW_' . $tag . '_TITLE' => isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'FORUMS_POSTS_ROW_' . $tag => cot_build_extrafields_data('forums', $exfld, $row['fp_' . $exfld['field_name']], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_POSTS_ROW_' . $tag . '_VALUE' => $row['fp_' . $exfld['field_name']]));
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_POSTS_ROW');
}
$lastpage = $d + $cfg['forums']['maxpostsperpage'] < $totalposts ? FALSE : TRUE;
$pagenav = cot_pagenav('forums', "m=posts&q={$q}", $d, $totalposts, $cfg['forums']['maxpostsperpage']);
$jumpbox[cot_url('forums')] = $L['Forums'];
foreach ($structure['forums'] as $key => $val) {
Exemple #15
0
$mskin = cot_tplfile(array('page', $cat['tpl']));
$env['last_modified'] = $pag['page_updated'];
/* === Hook === */
foreach (cot_getextplugins('page.main') as $pl) {
    include $pl;
}
/* ===== */
if ($pag['page_file']) {
    unset($_SESSION['dl']);
    $_SESSION['dl'] = $id;
}
require_once $cfg['system_dir'] . '/header.php';
require_once cot_incfile('users', 'module');
$t = new XTemplate($mskin);
$t->assign(cot_generate_pagetags($pag, 'PAGE_', 0, $usr['isadmin'], $cfg['homebreadcrumb']));
$t->assign('PAGE_OWNER', cot_build_user($pag['page_ownerid'], htmlspecialchars($pag['user_name'])));
$t->assign(cot_generate_usertags($pag, 'PAGE_OWNER_'));
$pag['page_file'] = intval($pag['page_file']);
if ($pag['page_file'] > 0) {
    if ($sys['now'] > $pag['page_begin']) {
        if (!empty($pag['page_url'])) {
            $dotpos = mb_strrpos($pag['page_url'], ".") + 1;
            $type = mb_strtolower(mb_substr($pag['page_url'], $dotpos, 5));
            $pag['page_fileicon'] = cot_rc('page_icon_file_path');
            if (!file_exists($pag['page_fileicon'])) {
                $pag['page_fileicon'] = cot_rc('page_icon_file_default');
            }
            $pag['page_fileicon'] = cot_rc('page_icon_file', array('icon' => $pag['page_fileicon']));
        } else {
            $pag['page_fileicon'] = '';
        }
Exemple #16
0
        }
    }
}
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE " . $sqlwhere)->fetchColumn();
$pagenav = cot_pagenav('admin', $common_params, $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_page = $db->query("SELECT p.*, u.user_name\n\tFROM {$db_pages} as p\n\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\tWHERE {$sqlwhere}\n\t\tORDER BY {$sqlsorttype} {$sqlsortway}\n\t\tLIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.admin.loop');
/* ===== */
foreach ($sql_page->fetchAll() as $row) {
    $sql_page_subcount = $db->query("SELECT SUM(structure_count) FROM {$db_structure} WHERE structure_path LIKE '" . $db->prep($structure['page'][$row["page_cat"]]['rpath']) . "%' ");
    $sub_count = $sql_page_subcount->fetchColumn();
    $row['page_file'] = intval($row['page_file']);
    $t->assign(cot_generate_pagetags($row, 'ADMIN_PAGE_', 200));
    $t->assign(array('ADMIN_PAGE_ID_URL' => cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id']), 'ADMIN_PAGE_OWNER' => cot_build_user($row['page_ownerid'], htmlspecialchars($row['user_name'])), 'ADMIN_PAGE_FILE_BOOL' => $row['page_file'], 'ADMIN_PAGE_URL_FOR_VALIDATED' => cot_confirm_url(cot_url('admin', $common_params . '&a=validate&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_validate'), 'ADMIN_PAGE_URL_FOR_UNVALIDATE' => cot_confirm_url(cot_url('admin', $common_params . '&a=unvalidate&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_unvalidate'), 'ADMIN_PAGE_URL_FOR_DELETED' => cot_confirm_url(cot_url('admin', $common_params . '&a=delete&id=' . $row['page_id'] . '&d=' . $durl . '&' . cot_xg()), 'page', 'page_confirm_delete'), 'ADMIN_PAGE_URL_FOR_EDIT' => cot_url('page', 'm=edit&id=' . $row['page_id']), 'ADMIN_PAGE_ODDEVEN' => cot_build_oddeven($ii), 'ADMIN_PAGE_CAT_COUNT' => $sub_count));
    $t->assign(cot_generate_usertags($row['page_ownerid'], 'ADMIN_PAGE_OWNER_'), htmlspecialchars($row['user_name']));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.PAGE_ROW');
    $ii++;
}
$is_row_empty = $sql_page->rowCount() == 0 ? true : false;
$totaldbpages = $db->countRows($db_pages);
$sql_page_queued = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE page_state=1");
$sys['pagesqueued'] = $sql_page_queued->fetchColumn();
$t->assign(array('ADMIN_PAGE_URL_CONFIG' => cot_url('admin', 'm=config&n=edit&o=module&p=page'), 'ADMIN_PAGE_URL_ADD' => cot_url('page', 'm=add'), 'ADMIN_PAGE_URL_EXTRAFIELDS' => cot_url('admin', 'm=extrafields&n=' . $db_pages), 'ADMIN_PAGE_URL_STRUCTURE' => cot_url('admin', 'm=structure&n=page'), 'ADMIN_PAGE_FORM_URL' => cot_url('admin', $common_params . '&a=update_checked&d=' . $durl), 'ADMIN_PAGE_ORDER' => cot_selectbox($sorttype, 'sorttype', array_keys($sort_type), array_values($sort_type), false), 'ADMIN_PAGE_WAY' => cot_selectbox($sortway, 'sortway', array_keys($sort_way), array_values($sort_way), false), 'ADMIN_PAGE_FILTER' => cot_selectbox($filter, 'filter', array_keys($filter_type), array_values($filter_type), false), 'ADMIN_PAGE_TOTALDBPAGES' => $totaldbpages, 'ADMIN_PAGE_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_PAGE_PAGNAV' => $pagenav['main'], 'ADMIN_PAGE_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_PAGE_TOTALITEMS' => $totalitems, 'ADMIN_PAGE_ON_PAGE' => $ii));
cot_display_messages($t);
Exemple #17
0
            $row['ft_icon'] .= $row['ft_state'] ? '_locked' : '';
        }
        $row['ft_icon_type'] = $row['ft_icon'];
        $row['ft_icon'] = cot_rc('forums_icon_topic', array('icon' => $row['ft_icon']));
        $row['ft_lastpostername'] = cot_build_user($row['ft_lastposterid'], htmlspecialchars($row['ft_lastpostername']));
    }
    if ($row['ft_postcount'] > $cfg['forums']['maxpostsperpage'] && !$row['ft_movedto']) {
        $pn_q = $row['ft_movedto'] > 0 ? $row['ft_movedto'] : $row['ft_id'];
        $pn = cot_pagenav('forums', 'm=posts&q=' . $pn_q, 0, $row['ft_postcount'], $cfg['forums']['maxpostsperpage'], 'd');
        $row['ft_pages'] = cot_rc('forums_code_topic_pages', array('main' => $pn['main'], 'first' => $pn['first'], 'last' => $pn['last']));
    }
    $row['ft_icon_type_ex'] = $row['ft_icon_type'];
    if ($row['ft_user_posted']) {
        $row['ft_icon_type_ex'] .= '_posted';
    }
    $t->assign(array('FORUMS_TOPICS_ROW_ID' => $row['ft_id'], 'FORUMS_TOPICS_ROW_STATE' => $row['ft_state'], 'FORUMS_TOPICS_ROW_ICON' => $row['ft_icon'], 'FORUMS_TOPICS_ROW_ICON_TYPE' => $row['ft_icon_type'], 'FORUMS_TOPICS_ROW_ICON_TYPE_EX' => $row['ft_icon_type_ex'], 'FORUMS_TOPICS_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'FORUMS_TOPICS_ROW_DESC' => htmlspecialchars($row['ft_desc']), 'FORUMS_TOPICS_ROW_CREATIONDATE' => cot_date('datetime_short', $row['ft_creationdate']), 'FORUMS_TOPICS_ROW_CREATIONDATE_STAMP' => $row['ft_creationdate'], 'FORUMS_TOPICS_ROW_UPDATEDURL' => $row['ft_lastposturl'], 'FORUMS_TOPICS_ROW_UPDATED' => $row['ft_lastpostlink'], 'FORUMS_TOPICS_ROW_UPDATED_STAMP' => $row['ft_updated'], 'FORUMS_TOPICS_ROW_MOVED' => $row['ft_movedto'] > 0 ? 1 : 0, 'FORUMS_TOPICS_ROW_TIMEAGO' => cot_build_timegap($row['ft_updated']), 'FORUMS_TOPICS_ROW_POSTCOUNT' => $row['ft_postcount'], 'FORUMS_TOPICS_ROW_REPLYCOUNT' => $row['ft_replycount'], 'FORUMS_TOPICS_ROW_VIEWCOUNT' => $row['ft_viewcount'], 'FORUMS_TOPICS_ROW_FIRSTPOSTER' => cot_build_user($row['ft_firstposterid'], htmlspecialchars($row['ft_firstpostername'])), 'FORUMS_TOPICS_ROW_LASTPOSTER' => $row['ft_lastpostername'], 'FORUMS_TOPICS_ROW_USER_POSTED' => (int) $row['ft_user_posted'], 'FORUMS_TOPICS_ROW_URL' => $row['ft_url'], 'FORUMS_TOPICS_ROW_PREVIEW' => $row['ft_preview'] . '...', 'FORUMS_TOPICS_ROW_PAGES' => $row['ft_pages'], 'FORUMS_TOPICS_ROW_MAXPAGES' => $row['ft_maxpages'], 'FORUMS_TOPICS_ROW_ODDEVEN' => cot_build_oddeven($ft_num), 'FORUMS_TOPICS_ROW_NUM' => $ft_num, 'FORUMS_TOPICS_ROW' => $row));
    foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
        $tag = mb_strtoupper($exfld['field_name']);
        $t->assign(array('FORUMS_TOPICS_ROW_' . $tag . '_TITLE' => isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'FORUMS_TOPICS_ROW_' . $tag => cot_build_extrafields_data('forums', $exfld, $row['ft_' . $exfld['field_name']], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_TOPICS_ROW_' . $tag . '_VALUE' => $row['ft_' . $exfld['field_name']]));
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_TOPICS_ROW');
}
$pagenav = cot_pagenav('forums', "m=topics&s={$s}&ord={$o}&w={$w}", $d, $totaltopics, $cfg['forums']['maxtopicsperpage']);
$toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$jumpbox[cot_url('forums')] = $L['Forums'];
Exemple #18
0
if (empty($rpage['page_cat']) && !empty($c)) {
    $rpage['page_cat'] = $c;
    $usr['isadmin'] = cot_auth('page', $rpage['page_cat'], 'A');
}
$out['subtitle'] = $L['page_addsubtitle'];
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['page'][$c]['title'];
$mskin = cot_tplfile(array('page', 'add', $structure['page'][$rpage['page_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('page.add.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$pageadd_array = array('PAGEADD_PAGETITLE' => $L['page_addtitle'], 'PAGEADD_SUBTITLE' => $L['page_addsubtitle'], 'PAGEADD_ADMINEMAIL' => "mailto:" . $cfg['adminemail'], 'PAGEADD_FORM_SEND' => cot_url('page', 'm=add&a=add&c=' . $c), 'PAGEADD_FORM_CAT' => cot_selectbox_structure('page', $rpage['page_cat'], 'rpagecat'), 'PAGEADD_FORM_CAT_SHORT' => cot_selectbox_structure('page', $rpage['page_cat'], 'rpagecat', $c), 'PAGEADD_FORM_KEYWORDS' => cot_inputbox('text', 'rpagekeywords', $rpage['page_keywords'], array('size' => '32', 'maxlength' => '255')), 'PAGEADD_FORM_METATITLE' => cot_inputbox('text', 'rpagemetatitle', $rpage['page_metatitle'], array('size' => '64', 'maxlength' => '255')), 'PAGEADD_FORM_METADESC' => cot_textarea('rpagemetadesc', $rpage['page_metadesc'], 2, 64, array('maxlength' => '255')), 'PAGEADD_FORM_ALIAS' => cot_inputbox('text', 'rpagealias', $rpage['page_alias'], array('size' => '32', 'maxlength' => '255')), 'PAGEADD_FORM_TITLE' => cot_inputbox('text', 'rpagetitle', $rpage['page_title'], array('size' => '64', 'maxlength' => '255')), 'PAGEADD_FORM_DESC' => cot_textarea('rpagedesc', $rpage['page_desc'], 2, 64, array('maxlength' => '255')), 'PAGEADD_FORM_AUTHOR' => cot_inputbox('text', 'rpageauthor', $rpage['page_author'], array('size' => '24', 'maxlength' => '100')), 'PAGEADD_FORM_OWNER' => cot_build_user($usr['id'], htmlspecialchars($usr['name'])), 'PAGEADD_FORM_OWNERID' => $usr['id'], 'PAGEADD_FORM_DATE' => cot_selectbox_date($sys['now'], 'long', 'rpagedate'), 'PAGEADD_FORM_BEGIN' => cot_selectbox_date($sys['now'], 'long', 'rpagebegin'), 'PAGEADD_FORM_EXPIRE' => cot_selectbox_date(0, 'long', 'rpageexpire'), 'PAGEADD_FORM_FILE' => cot_selectbox($rpage['page_file'], 'rpagefile', range(0, 2), array($L['No'], $L['Yes'], $L['Members_only']), false), 'PAGEADD_FORM_URL' => cot_inputbox('text', 'rpageurl', $rpage['page_url'], array('size' => '56', 'maxlength' => '255')), 'PAGEADD_FORM_SIZE' => cot_inputbox('text', 'rpagesize', $rpage['page_size'], array('size' => '56', 'maxlength' => '255')), 'PAGEADD_FORM_TEXT' => cot_textarea('rpagetext', $rpage['page_text'], 24, 120, '', 'input_textarea_editor'), 'PAGEADD_FORM_PARSER' => cot_selectbox($cfg['page']['parser'], 'rpageparser', $parser_list, $parser_list, false));
$t->assign($pageadd_array);
// Extra fields
foreach ($cot_extrafields[$db_pages] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rpage' . $exfld['field_name'], $exfld, $rpage['page_' . $exfld['field_name']]);
    $exfld_title = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('PAGEADD_FORM_' . $uname => $exfld_val, 'PAGEADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'PAGEADD_FORM_EXTRAFLD' => $exfld_val, 'PAGEADD_FORM_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.EXTRAFLD');
}
// Error and message handling
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('page.add.tags') as $pl) {
    include $pl;
}
Exemple #19
0
$id = cot_import('id', 'G', 'INT');
$v = $db->prep(cot_import('v', 'G', 'TXT'));
$gd_supported = array('jpg', 'jpeg', 'png', 'gif');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('pfs', 'a');
// cot_block($usr['auth_read']);
$pos = mb_strlen(mb_stristr($v, '-'));
$fid = mb_substr($v, 0, -$pos);
$imgpath = $cfg['pfs']['pfsuserfolder'] ? $cfg['pfs_dir'] . '/' . $fid . '/' . $v : $cfg['pfs_dir'] . $v;
$dotpos = mb_strrpos($imgpath, '.') + 1;
$f_extension = mb_strtolower(mb_substr($imgpath, $dotpos, 4));
if (!empty($v) && file_exists($imgpath) && in_array($f_extension, $gd_supported)) {
    $pfs_header1 = cot_rc('code_pfs_header', array('metas' => ''));
    $pfs_header2 = $R['code_pfs_header_end'];
    $pfs_footer = $R['code_pfs_footer'];
    $sql_pfs = $db->query("SELECT p.*, u.user_name FROM {$db_pfs} p, {$db_users} u WHERE p.pfs_file=" . $db->quote($v) . " AND p.pfs_userid=u.user_id LIMIT 1");
    if (!($row = $sql_pfs->fetch())) {
        $pfs_owner = $L['SFS'];
    } else {
        $pfs_owner = cot_build_user($row['pfs_userid'], htmlspecialchars($row['user_name']));
    }
    $pfs_img = "<img src=\"" . $imgpath . "\" alt=\"" . $row['pfs_desc'] . "\" />";
    $pfs_imgsize = @getimagesize($imgpath);
    $sql_pfs = $db->query("UPDATE {$db_pfs} SET pfs_count=pfs_count+1 WHERE pfs_file=" . $db->quote($v) . " LIMIT 1");
} else {
    cot_die();
}
/* ============= */
$t = new XTemplate(cot_tplfile('pfs.view'));
$t->assign(array('PFSVIEW_HEADER1' => $pfs_header1, 'PFSVIEW_HEADER2' => $pfs_header2, 'PFSVIEW_FOOTER' => $pfs_footer, 'PFSVIEW_FILE_NAME' => $id, 'PFSVIEW_FILE_DATE' => cot_date('datetime_medium', $row['pfs_date']), 'PFSVIEW_FILE_DATE_STAMP' => $row['pfs_date'], 'PFSVIEW_FILE_ID' => $row['pfs_id'], 'PFSVIEW_FILE_USERID' => $row['pfs_userid'], 'PFSVIEW_FILE_USERNAME' => $pfs_owner, 'PFSVIEW_FILE_DESC' => htmlspecialchars($row['pfs_desc']), 'PFSVIEW_FILE_COUNT' => $row['pfs_count'], 'PFSVIEW_FILE_SIZE' => cot_build_filesize($row['pfs_size'], 1), 'PFSVIEW_FILE_SIZE_BYTES' => $row['pfs_size'], 'PFSVIEW_FILE_SIZEX' => $pfs_imgsize[0], 'PFSVIEW_FILE_SIZEY' => $pfs_imgsize[1], 'PFSVIEW_FILE_IMAGE' => $pfs_img));
$t->parse('MAIN');
$t->out('MAIN');
Exemple #20
0
/**
 * Returns all user tags for XTemplate
 *
 * @param mixed $user_data User Info Array
 * @param string $tag_prefix Prefix for tags
 * @param string $emptyname Name text if user is not exist
 * @param bool $allgroups Build info about all user groups
 * @param bool $cacheitem Cache tags
 * @return array
 * @global CotDB $db
 */
function cot_generate_usertags($user_data, $tag_prefix = '', $emptyname = '', $allgroups = false, $cacheitem = true)
{
    global $db, $cot_extrafields, $cot_groups, $cfg, $L, $user_cache, $db_users;
    static $extp_first = null, $extp_main = null;
    $return_array = array();
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('usertags.first');
        $extp_main = cot_getextplugins('usertags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    $user_id = is_array($user_data) ? (int) $user_data['user_id'] : (is_numeric($user_data) ? (int) $user_data : 0);
    if (isset($user_cache[$user_id])) {
        $temp_array = $user_cache[$user_id];
    } else {
        if (!is_array($user_data) && $user_id > 0) {
            $sql = $db->query("SELECT * FROM {$db_users} WHERE user_id = {$user_id} LIMIT 1");
            $user_data = $sql->fetch();
        } else {
            if (!is_array($user_data)) {
                $user_data = array();
            }
        }
        if (is_array($user_data) && $user_data['user_id'] > 0 && !empty($user_data['user_name'])) {
            $user_data['user_birthdate'] = cot_date2stamp($user_data['user_birthdate']);
            $user_data['user_text'] = cot_parse($user_data['user_text'], $cfg['users']['usertextimg']);
            $temp_array = array('ID' => $user_data['user_id'], 'NAME' => cot_build_user($user_data['user_id'], htmlspecialchars($user_data['user_name'])), 'NICKNAME' => htmlspecialchars($user_data['user_name']), 'DETAILSLINK' => cot_url('users', 'm=details&id=' . $user_data['user_id'] . '&u=' . htmlspecialchars($user_data['user_name'])), 'DETAILSLINKSHORT' => cot_url('users', 'm=details&id=' . $user_data['user_id']), 'FULL_NAME' => htmlspecialchars(cot_user_full_name($user_data)), 'TITLE' => $cot_groups[$user_data['user_maingrp']]['title'], 'MAINGRP' => cot_build_group($user_data['user_maingrp']), 'MAINGRPID' => $user_data['user_maingrp'], 'MAINGRPNAME' => $cot_groups[$user_data['user_maingrp']]['name'], 'MAINGRPTITLE' => cot_build_group($user_data['user_maingrp'], true), 'MAINGRPSTARS' => cot_build_stars($cot_groups[$user_data['user_maingrp']]['level']), 'MAINGRPICON' => cot_build_groupicon($cot_groups[$user_data['user_maingrp']]['icon']), 'COUNTRY' => cot_build_country($user_data['user_country']), 'COUNTRYFLAG' => cot_build_flag($user_data['user_country']), 'TEXT' => $user_data['user_text'], 'EMAIL' => cot_build_email($user_data['user_email'], $user_data['user_hideemail']), 'THEME' => $user_data['user_theme'], 'SCHEME' => $user_data['user_scheme'], 'LANG' => $user_data['user_lang'], 'GENDER' => $user_data['user_gender'] == '' || $user_data['user_gender'] == 'U' ? '' : $L['Gender_' . $user_data['user_gender']], 'BIRTHDATE' => is_null($user_data['user_birthdate']) ? '' : cot_date('date_full', $user_data['user_birthdate']), 'BIRTHDATE_STAMP' => is_null($user_data['user_birthdate']) ? '' : $user_data['user_birthdate'], 'AGE' => is_null($user_data['user_birthdate']) ? '' : cot_build_age($user_data['user_birthdate']), 'TIMEZONE' => cot_build_timezone(cot_timezone_offset($user_data['user_timezone'], false, false)) . ' ' . str_replace('_', ' ', $user_data['user_timezone']), 'REGDATE' => cot_date('datetime_medium', $user_data['user_regdate']), 'REGDATE_STAMP' => $user_data['user_regdate'], 'LASTLOG' => cot_date('datetime_medium', $user_data['user_lastlog']), 'LASTLOG_STAMP' => $user_data['user_lastlog'], 'LOGCOUNT' => $user_data['user_logcount'], 'POSTCOUNT' => $user_data['user_postcount'], 'LASTIP' => $user_data['user_lastip']);
            if ($allgroups) {
                $temp_array['GROUPS'] = cot_build_groupsms($user_data['user_id'], FALSE, $user_data['user_maingrp']);
            }
            // Extra fields
            if (isset($cot_extrafields[$db_users])) {
                foreach ($cot_extrafields[$db_users] as $exfld) {
                    $temp_array[strtoupper($exfld['field_name'])] = cot_build_extrafields_data('user', $exfld, $user_data['user_' . $exfld['field_name']]);
                    $temp_array[strtoupper($exfld['field_name']) . '_TITLE'] = isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                    $temp_array[strtoupper($exfld['field_name']) . '_VALUE'] = $user_data['user_' . $exfld['field_name']];
                }
            }
        } else {
            $temp_array = array('ID' => 0, 'NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'NICKNAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'FULL_NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'MAINGRP' => cot_build_group(1), 'MAINGRPID' => 1, 'MAINGRPSTARS' => '', 'MAINGRPICON' => cot_build_groupicon($cot_groups[1]['icon']), 'COUNTRY' => cot_build_country(''), 'COUNTRYFLAG' => cot_build_flag(''), 'TEXT' => '', 'EMAIL' => '', 'GENDER' => '', 'BIRTHDATE' => '', 'BIRTHDATE_STAMP' => '', 'AGE' => '', 'REGDATE' => '', 'REGDATE_STAMP' => '', 'POSTCOUNT' => '', 'LASTIP' => '');
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
        if (is_array($user_data) && isset($user_data['user_id'])) {
            $cacheitem && ($user_cache[$user_data['user_id']] = $temp_array);
        }
    }
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
/* === Hook === */
foreach (cot_getextplugins('admin.pfs.allpfs.first') as $pl) {
    include $pl;
}
/* ===== */
unset($disp_list);
$totalitems = $db->query("SELECT COUNT(DISTINCT pfs_userid) FROM {$db_pfs} WHERE pfs_folderid>=0")->fetchColumn();
$pagenav = cot_pagenav('admin', 'm=pfs&s=allpfs', $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_pfs = $db->query("SELECT DISTINCT p.pfs_userid, u.user_name, u.user_id, COUNT(*) FROM {$db_pfs} AS p\n\tLEFT JOIN {$db_users} AS u ON p.pfs_userid=u.user_id\n\tWHERE pfs_folderid>=0 GROUP BY p.pfs_userid ORDER BY u.user_name ASC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.pfs.allpfs.loop');
/* ===== */
foreach ($sql_pfs->fetchAll() as $row) {
    $row['user_name'] = $row['user_id'] == 0 ? $L['SFS'] : $row['user_name'];
    $row['user_id'] = $row['user_id'] == 0 ? '0' : $row['user_id'];
    $t->assign(array('ADMIN_ALLPFS_ROW_URL' => cot_url('pfs', 'userid=' . $row['user_id']), 'ADMIN_ALLPFS_ROW_USER' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])), 'ADMIN_ALLPFS_ROW_COUNT' => $row['COUNT(*)']));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ALLPFS_ROW');
    $ii++;
}
$t->assign(array('ADMIN_ALLPFS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_ALLPFS_PAGNAV' => $pagenav['main'], 'ADMIN_ALLPFS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_ALLPFS_TOTALITEMS' => $totalitems, 'ADMIN_ALLPFS_ON_PAGE' => $ii));
/* === Hook  === */
foreach (cot_getextplugins('admin.pfs.allpfs.tags') as $pl) {
    include $pl;
}
/* ===== */
    $sys['whosonline_reg_count'] = $whosonline_data['reg_count'];
    $out['whosonline_reg_list'] = $whosonline_data['reg_list'];
    $cot_usersonline = $whosonline_data['user_list'];
    unset($whosonline_data);
} else {
    $online_timedout = $sys['now'] - $cfg['timedout'];
    $db->delete($db_online, "online_lastseen < {$online_timedout}");
    if (!$cfg['plugin']['whosonline']['disable_guests']) {
        $sys['whosonline_vis_count'] = $db->query("SELECT COUNT(*) FROM {$db_online} WHERE online_name='v'")->fetchColumn() + $not_counted_vis;
    }
    $sql_o = $db->query("SELECT DISTINCT o.online_name, o.online_userid FROM {$db_online} o WHERE o.online_name != 'v' ORDER BY online_name ASC");
    $sys['whosonline_reg_count'] = $sql_o->rowCount() + $not_counted_usr;
    $ii_o = 0;
    $cot_usersonline = array();
    while ($row_o = $sql_o->fetch()) {
        $out['whosonline_reg_list'] .= $ii_o > 0 ? ', ' : '';
        $out['whosonline_reg_list'] .= cot_build_user($row_o['online_userid'], htmlspecialchars($row_o['online_name']));
        $cot_usersonline[] = $row_o['online_userid'];
        $ii_o++;
    }
    $sql_o->closeCursor();
    if ($not_counted_usr) {
        $out['whosonline_reg_list'] .= (!empty($out['whosonline_reg_list']) ? ', ' : '') . cot_build_user($usr['id'], htmlspecialchars($usr['name']));
        $cot_usersonline[] = $usr['id'];
    }
    unset($ii_o, $sql_o, $row_o, $not_counted_usr, $not_counted_vis);
    if ($cache && $cache_type) {
        $whosonline_data = array('vis_count' => $sys['whosonline_vis_count'], 'reg_count' => $sys['whosonline_reg_count'], 'reg_list' => $out['whosonline_reg_list'], 'user_list' => $cot_usersonline);
        $cache_type->store('whosonline', $whosonline_data, 'system', 30);
    }
}
/**
 * Форма просмара отзывов /добавление отзыва
 *
 * @param int $userid id пользователя
 * @param string $area модуль/плагин
 * @param string $code код
 * @param string $name URL Module or script name
 * @param mixed $params URL parameters as array or parameter string
 * @param string $tail URL postfix, e.g. anchor
 * @param bool $showall show all reviews
 * @return string
 */
function cot_reviews_list($userid, $area, $code = '', $name = '', $params = '', $tail = '', $showall = false)
{
    global $db_reviews, $db_users, $db, $L, $usr, $cfg;
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'reviews', 'RWA');
    if ($usr['auth_read']) {
        $t1 = new XTemplate(cot_tplfile(array('reviews', $area), 'plug'));
        require_once cot_langfile('reviews', 'plug');
        if (!$showall) {
            $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
            $sqlarea = " AND item_area='" . $db->prep($area) . "'";
        }
        $sql = $db->query("SELECT * FROM {$db_reviews} as r LEFT JOIN {$db_users} as u ON u.user_id=r.item_userid \n\t\t\tWHERE item_touserid=" . (int) $userid . $sqlarea . $sqlcode . " ORDER BY item_date ASC");
        if (is_array($params)) {
            $params2 = array();
            foreach ($array as $key => $value) {
                $params2[$key] = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $value);
            }
            $params = $params2;
        } else {
            $params = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $params);
        }
        $redirect = cot_url($name, $params, $tail, true);
        $redirect = base64_encode($redirect);
        while ($item = $sql->fetch()) {
            if ($usr['id'] == $item['item_userid'] || $usr['isadmin']) {
                $t1->assign(array('REVIEW_FORM_ID' => $item['item_id'], 'REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=update&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id']), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $item['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($item['item_score'], 'rscore', $L['review_score_values'], $L['review_score_titles']), 'REVIEW_FORM_USERID' => $item['item_userid'], 'REVIEW_FORM_DELETE_URL' => cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id'])));
                $t1->parse('MAIN.REVIEWS_ROWS.EDITFORM');
            }
            $t1->assign(cot_generate_usertags($item, 'REVIEW_ROW_'));
            $t1->assign(array('REVIEW_ROW_ID' => $item['item_id'], 'REVIEW_ROW_TEXT' => $item['item_text'], 'REVIEW_ROW_TOUSER' => $item['item_touser'], 'REVIEW_ROW_OWNERID' => $item['item_userid'], 'REVIEW_ROW_OWNER' => cot_build_user($item['item_userid'], htmlspecialchars($item['user_name'])), 'REVIEW_ROW_SCORE' => $item['item_score'] > 0 ? '+' . $item['item_score'] : $item['item_score'], 'REVIEW_ROW_AREA' => $item['item_area'], 'REVIEW_ROW_CODE' => $item['item_code'], 'REVIEW_ROW_DATE' => $item['item_date'], 'REVIEW_ROW_DELETE_URL' => $usr['id'] == $item['item_userid'] || $usr['isadmin'] ? cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&itemid=' . $item['item_id'] . '&redirect=' . $redirect) : ''));
            if ($item['item_area'] == 'projects' && !empty($item['item_code'])) {
                require_once cot_incfile('projects', 'module');
                global $db_projects;
                $prj = $db->query("SELECT * FROM {$db_projects} WHERE item_id=" . $item['item_code'])->fetch();
                $t1->assign(cot_generate_projecttags($prj, 'REVIEW_ROW_PRJ_'));
            }
            $t1->parse('MAIN.REVIEWS_ROWS');
        }
        if ($cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $usr['id'] > 0 && $usr['auth_write'] && $usr['id'] != $userid) {
            require_once cot_incfile('projects', 'module');
            global $db_projects_offers, $db_projects;
            $prj_reviews_sql = $db->query("SELECT item_code FROM {$db_reviews} WHERE item_area='projects' AND item_userid=" . $usr['id']);
            while ($row = $prj_reviews_sql->fetch()) {
                $prjreviews[] = $row['item_code'];
            }
            $prjreviews_string = count($prjreviews) > 0 ? "AND o.offer_pid NOT IN (" . implode(",", $prjreviews) . ")" : '';
            $bothprj_count = $db->query("SELECT COUNT(*) FROM  {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t")->fetchColumn();
            if ($bothprj_count > 0) {
                $bothprj_sql = $db->query("SELECT * FROM  {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t");
                while ($bprj = $bothprj_sql->fetch()) {
                    $prj_ids[] = $bprj['offer_pid'];
                    $prj_titles[] = $bprj['item_title'];
                }
            }
            $area = 'projects';
            $usr['auth_write'] = (int) $bothprj_count == 0 ? false : $usr['auth_write'];
        } else {
            $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
            $sqlarea = " AND item_area='" . $db->prep($area) . "'";
            $reviews_count = $db->query("SELECT COUNT(*) FROM {$db_reviews} \n\t\t\t\tWHERE item_userid=" . (int) $usr['id'] . "\n\t\t\t\t\tAND item_touserid=" . (int) $userid . $sqlarea . $sqlcode)->fetchColumn();
            $usr['auth_write'] = $reviews_count > 0 ? false : $usr['auth_write'];
        }
        if ($usr['auth_write'] && $usr['id'] != $userid) {
            cot_display_messages($t1);
            $t1->assign(array('REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=add&area=' . $area . '&touser='******'&redirect=' . $redirect), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $ritem['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($ritem['item_score'], 'rscore', $L['reviews_score_values'], $L['reviews_score_titles']), 'REVIEW_FORM_PROJECTS' => $cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $bothprj_count > 0 ? cot_selectbox($pid, 'code', $prj_ids, $prj_titles, false) : '', 'REVIEW_FORM_ACTION' => 'ADD'));
            $t1->parse('MAIN.FORM');
        }
        $t1->parse('MAIN');
        return $t1->text('MAIN');
    }
    return '';
}
Exemple #24
0
            $icon = $R['admin_icon_page'];
            $typestr = $L['Page'];
            $enabled = cot_module_active('page') ? 1 : 0;
            break;
        case 'user':
            $icon = $R['admin_icon_user'];
            $typestr = $L['User'];
            $enabled = 1;
            break;
        default:
            $icon = $R['admin_icon_tools'];
            $typestr = $row['tr_type'];
            $enabled = 1;
            break;
    }
    $tr_t->assign(array('ADMIN_TRASHCAN_DATE' => cot_date('datetime_medium', $row['tr_date']), 'ADMIN_TRASHCAN_DATE_STAMP' => $row['tr_date'], 'ADMIN_TRASHCAN_TYPESTR_ICON' => $icon, 'ADMIN_TRASHCAN_TYPESTR' => $typestr, 'ADMIN_TRASHCAN_TITLE' => htmlspecialchars($row['tr_title']), 'ADMIN_TRASHCAN_TRASHEDBY' => $row['tr_trashedby'] == 0 ? $L['System'] : cot_build_user($row['tr_trashedby'], htmlspecialchars($row['user_name'])), 'ADMIN_TRASHCAN_ROW_WIPE_URL' => cot_url('admin', 'm=other&p=trashcan&a=wipe&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_RESTORE_URL' => cot_url('admin', 'm=other&p=trashcan&a=restore&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_INFO_URL' => cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $row['tr_id']), 'ADMIN_TRASHCAN_ROW_RESTORE_ENABLED' => $enabled));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    if ($info) {
        $adminpath[] = array(cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $id), $row['tr_title']);
        $data = unserialize($row['tr_datas']);
        foreach ($data as $key => $val) {
            $tr_t->assign(array('ADMIN_TRASHCAN_INFO_ROW' => htmlspecialchars($key), 'ADMIN_TRASHCAN_INFO_VALUE' => $val));
            $tr_t->parse('MAIN.TRASHCAN_ROW.TRASHCAN_INFOROW');
        }
    }
    $tr_t->parse('MAIN.TRASHCAN_ROW');
}
Exemple #25
0
        $text_editor_code = $out['footer_rc'];
        $out['footer_rc'] = $rc_tmp;
    }
    $t->assign(array('PM_QUOTE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $id . '&q=quote&history=' . (int) $history . '&d=' . $durl), $L['Quote'], array('onclick' => $onclick)), 'PM_FORM_SEND' => cot_url('pm', 'm=send&a=send&to=' . $to), 'PM_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'), 'PM_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code));
    /* === Hook === */
    foreach (cot_getextplugins('pm.reply.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.REPLY');
}
if (!COT_AJAX) {
    $t->parse('MAIN.BEFORE_AJAX');
    $t->parse('MAIN.AFTER_AJAX');
}
$pm_username = cot_build_user($row_user['user_id'], htmlspecialchars($row_user['user_name']));
$title[] = array(cot_url('users', 'm=details&id=' . $row_user['user_id']), $row_user['user_name']);
$title[] = array(cot_url('pm', 'm=message&id=' . $id), $row['pm_title']);
$t->assign(array('PM_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PM_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link(cot_url('pm', 'm=send'), $L['pm_sendnew'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_INBOX' => cot_rc_link(cot_url('pm'), $L['pm_inbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_INBOX_COUNT' => $totalinbox, 'PM_SENTBOX' => cot_rc_link(cot_url('pm', 'f=sentbox'), $L['pm_sentbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_SENTBOX_COUNT' => $totalsentbox, 'PM_ID' => $row['pm_id'], 'PM_STATE' => $row['pm_tostate'], 'PM_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_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_DATE_STAMP' => $row['pm_date'], 'PM_TITLE' => htmlspecialchars($row['pm_title']), 'PM_TEXT' => '<div id="pm_text">' . $pm_maindata . '</div>', 'PM_DELETE' => cot_rc_link(cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f), $L['Delete'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url(cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f)), $L['Delete'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_EDIT' => $row['pm_icon_edit'], 'PM_HISTORY' => cot_rc_link(cot_url('pm', 'm=message&id=' . $id . '&q=' . $q . '&history=1&d=' . $durl), $L['pm_messagehistory'], array("rel" => "get-ajaxHistory", 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_SENT_TYPE' => $f == 'sentbox' ? $L['Recipient'] : $L['Sender']));
$t->assign(cot_generate_usertags($row_user, 'PM_USER_'));
/* === Hook === */
foreach (cot_getextplugins('pm.tags') as $pl) {
    include $pl;
}
/* ===== */
if (COT_AJAX && $history) {
    $t->out('MAIN.HISTORY');
} else {
    $t->parse('MAIN');
    $t->out('MAIN');
}