コード例 #1
0
$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) {
    $t->assign(array('FORUMS_EDITPOST_TOPICTITTLE' => cot_inputbox('text', 'rtopictitle', $rowt['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_EDITPOST_TOPICDESCRIPTION' => cot_inputbox('text', 'rtopicdesc', $rowt['ft_desc'], array('size' => 56, 'maxlength' => 255))));
    // Extra fields
    foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rowt['ft_' . $exfld['field_name']]);
        $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $t->assign(array('FORUMS_EDITPOST_TOPIC_' . $uname => $exfld_val, 'FORUMS_EDITPOST_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST.TOPIC_EXTRAFLD');
    }
    $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST');
}
$t->assign(array('FORUMS_EDITPOST_PAGETITLE' => $toptitle, 'FORUMS_EDITPOST_SUBTITLE' => $L['forums_postedby'] . ": <a href=\"users.php?m=details&id=" . $rowpost['fp_posterid'] . "\">" . $rowpost['fp_postername'] . "</a> @ " . cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED' => cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED_STAMP' => $rowpost['fp_updated'], 'FORUMS_EDITPOST_SEND' => cot_url('forums', "m=editpost&a=update&s=" . $s . "&q=" . $q . "&p=" . $p . '&d=' . $durl . "&" . cot_xg()), 'FORUMS_EDITPOST_TEXT' => cot_textarea('rmsgtext', $rowpost['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_EDITPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
// Extra fields
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rowpost['fp_' . $exfld['field_name']]);
    $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('FORUMS_EDITPOST_' . $uname => $exfld_val, 'FORUMS_EDITPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.EXTRAFLD');
}
/* === Hook === */
foreach (cot_getextplugins('forums.editpost.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
コード例 #2
0
/**
 * 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;
}
コード例 #3
0
ファイル: sbr.stage.php プロジェクト: cotemplate/cot-sbr
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('forms');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'sbr');
/* === Hook === */
foreach (cot_getextplugins('sbr.stage.first') as $pl) {
    include $pl;
}
/* ===== */
if (!empty($num)) {
    $sql = $db->query("SELECT * FROM {$db_sbr_stages} WHERE stage_sid=" . $id . " AND stage_num=" . $num . " LIMIT 1");
    $stage = $sql->fetch();
}
$t->assign(array('STAGE_NUM' => $stage['stage_num'], 'STAGE_ID' => $stage['stage_id'], 'STAGE_TITLE' => $stage['stage_title'], 'STAGE_TEXT' => $stage['stage_text'], 'STAGE_COST' => $stage['stage_cost'], 'STAGE_DAYS' => $stage['stage_days'], 'STAGE_STATUS' => $stage['stage_status'], 'STAGE_BEGIN' => $stage['stage_begin'], 'STAGE_DONE' => $stage['stage_done'], 'STAGE_EXPIRE' => $stage['stage_expire'], 'STAGE_EXPIREDATE' => $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60, 'STAGE_EXPIREDAYS' => cot_build_timegap($sys['now'], $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60), 'STAGE_DONE_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=done'), 'STAGE_CLAIM_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=claim'), 'STAGE_DECISION_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=decision')));
$stagefiles = $db->query("SELECT * FROM {$db_sbr_files} WHERE file_sid=" . $id . " AND file_area='stage' AND file_code='" . $stage['stage_num'] . "' ORDER BY file_id ASC")->fetchAll();
if (count($stagefiles) > 0) {
    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.SBR.STAGE.FILES.FILE_ROW');
    }
    $t->parse('MAIN.SBR.STAGE.FILES');
}
/* === Hook === */
foreach (cot_getextplugins('sbr.stage.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN.SBR.STAGE');
コード例 #4
0
ファイル: comments.functions.php プロジェクト: Roffun/Cotonti
/**
 * 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;
}
コード例 #5
0
}
$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
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg['fp_' . $exfld['field_name']]);
    $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('FORUMS_NEWTOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.EXTRAFLD');
}
// Extra fields
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rtopic['ft_' . $exfld['field_name']]);
    $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('FORUMS_NEWTOPIC_TOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.TOPIC_EXTRAFLD');
コード例 #6
0
ファイル: whosonline.php プロジェクト: Andreyjktl/Cotonti
            $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;
        }
        /* ===== */
        $t->parse('MAIN.GUESTS');
    }
    //if (($count_users + $count_guests) >= $maxuserssperpage) break;
}
$sql_users->closeCursor();
$t->assign(array('WHO_PAGINATION' => $pagenav['main'], 'WHO_PAGEPREV' => $pagenav['prev'], 'WHO_PAGENEXT' => $pagenav['next'], 'WHO_CURRENTPAGE' => $pagenav['current'], 'WHO_TOTALLINES' => $totallines, 'WHO_MAXPERPAGE' => $maxuserssperpage, 'WHO_TOTALPAGES' => $pagenav['total'], 'STAT_MAXUSERS' => $maxusers, 'STAT_COUNT_USERS' => $who_users, 'STAT_COUNT_GUESTS' => $who_guests, 'USERS' => cot_declension($who_users, $Ls['Members'], true), 'GUESTS' => cot_declension($who_guests, $Ls['Guests'], true)));
コード例 #7
0
ファイル: functions.php プロジェクト: Andreyjktl/Cotonti
/**
 * Returns readable time difference or 'Just now'.
 *
 * @param int $time Timestamp
 * @param int $recently Seconds during which to show 'Just now'
 * @return string
 */
function cot_build_timeago($time, $recently = 60)
{
    global $L, $sys;
    if ($sys['now'] - $time < $recently) {
        return $L['JustNow'];
    }
    return cot_build_timegap($time) . ' ' . $L['Ago'];
}
コード例 #8
0
ファイル: forums.posts.php プロジェクト: Andreyjktl/Cotonti
if (($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0 && $allowreplybox && $usr['auth_write']) {
    if ($quote > 0) {
        $sql_forums_quote = $db->query("SELECT fp_id, fp_text, fp_postername, fp_posterid, fp_creation FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? AND fp_id = ? LIMIT 1", array($q, $s, $quote));
        if ($row4 = $sql_forums_quote->fetch()) {
            $rmsg['fp_text'] = cot_rc('forums_code_quote', array('url' => cot_url('forums', 'm=posts&q=' . $q . '&d=' . $durl, '#' . $row4['fp_id'], $forums_quote_htmlspecialchars_bypass), 'id' => $row4['fp_id'], 'date' => cot_date('datetime_medium', $row4['fp_creation']), 'postername' => $row4['fp_postername'], 'text' => $row4['fp_text']));
        }
    }
    // Extra fields
    foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg[$exfld['field_name']]);
        $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $t->assign(array('FORUMS_POSTS_NEWPOST_' . $uname => $exfld_val, 'FORUMS_POSTS_NEWPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_POSTS_NEWPOST_EXTRAFLD' => $exfld_val, 'FORUMS_POSTS_NEWPOST_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.FORUMS_POSTS_NEWPOST.EXTRAFLD');
    }
    $t->assign(array('FORUMS_POSTS_NEWPOST_SEND' => cot_url('forums', "m=posts&a=newpost&s=" . $s . "&q=" . $q), 'FORUMS_POSTS_NEWPOST_TEXT' => $R['forums_code_newpost_mark'] . cot_textarea('rmsgtext', $rmsg['fp_text'], 16, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_POSTS_NEWPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
    cot_display_messages($t);
    /* === Hook  === */
    foreach (cot_getextplugins('forums.posts.newpost.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.FORUMS_POSTS_NEWPOST');
} elseif ($rowt['ft_state']) {
    $t->assign('FORUMS_POSTS_TOPICLOCKED_BODY', $L['forums_topiclocked']);
    $t->parse('MAIN.FORUMS_POSTS_TOPICLOCKED');
} elseif (!$allowreplybox && ($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0) {
    $t->assign('FORUMS_POSTS_ANTIBUMP_BODY', $L['forums_antibump']);
    $t->parse('MAIN.FORUMS_POSTS_ANTIBUMP');
}
if ($rowt['ft_mode'] == 1) {
コード例 #9
0
ファイル: forums.topics.php プロジェクト: Andreyjktl/Cotonti
            $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'];
コード例 #10
0
/**
 * 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;
}
コード例 #11
0
ファイル: sbr.info.php プロジェクト: cotemplate/cot-sbr
<?php

/**
 * Info sbr.
 *
 * @package sbr
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
$sqllist_rowset = $db->query("SELECT * FROM {$db_sbr_stages} WHERE stage_sid=" . $sbr['sbr_id'] . " ORDER BY stage_num ASC")->fetchAll();
foreach ($sqllist_rowset as $stage) {
    $t->assign(array('STAGE_ROW_NUM' => $stage['stage_num'], 'STAGE_ROW_ID' => $stage['stage_id'], 'STAGE_ROW_TITLE' => $stage['stage_title'], 'STAGE_ROW_TEXT' => $stage['stage_text'], 'STAGE_ROW_COST' => $stage['stage_cost'], 'STAGE_ROW_DAYS' => $stage['stage_days'], 'STAGE_ROW_STATUS' => $stage['stage_status'], 'STAGE_ROW_BEGIN' => $stage['stage_begin'], 'STAGE_ROW_DONE' => $stage['stage_done'], 'STAGE_ROW_EXPIRE' => $stage['stage_expire'], 'STAGE_ROW_EXPIREDATE' => $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60, 'STAGE_ROW_EXPIREDAYS' => cot_build_timegap($sys['now'], $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60), 'STAGE_ROW_DONE_URL' => cot_url('sbr', 'id=' . $id . '&stageid=' . $stage['stage_id'] . '&a=done')));
    $stagefiles = $db->query("SELECT * FROM {$db_sbr_files} WHERE file_sid=" . $id . " AND file_area='stage' AND file_code='" . $stage['stage_num'] . "' ORDER BY file_id ASC")->fetchAll();
    if (count($stagefiles) > 0) {
        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.SBR.INFO.STAGE_ROW.FILES.FILE_ROW');
        }
        $t->parse('MAIN.SBR.INFO.STAGE_ROW.FILES');
    }
    if ($stage['stage_status'] == 'arbitration') {
        require_once cot_incfile('arbitration', 'plug');
        $arb = $db->query("SELECT * FROM {$db_arbitration} \n\t\t\tWHERE arb_area='sbr' AND arb_code=" . $stage['stage_id'] . " \n\t\t\t\tAND (arb_defendantid=" . $sbr['sbr_employer'] . " AND arb_claimantid=" . $sbr['sbr_performer'] . " OR arb_defendantid=" . $sbr['sbr_performer'] . " AND arb_claimantid=" . $sbr['sbr_employer'] . ")")->fetch();
        $t->assign(array("ARB_ID" => $arb['arb_id'], "ARB_DATE" => $arb['arb_date'], "ARB_TITLE" => $arb['arb_title'], "ARB_TEXT" => $arb['arb_claimtext']));
    }
    /* === Hook === */
    foreach (cot_getextplugins('sbr.stages.tags') as $pl) {
        include $pl;
コード例 #12
0
function cot_build_recentforums($template, $mode = 'recent', $maxperpage = 5, $d = 0, $titlelength = 0, $rightprescan = true)
{
    global $db, $L, $cfg, $db_forum_topics, $theme, $usr, $sys, $R, $structure;
    global $totalrecent;
    $recentitems = new XTemplate(cot_tplfile($template, 'plug'));
    if ($rightprescan) {
        $catsub = cot_structure_children('forums', '', true, true, $rightprescan);
        $incat = "AND ft_cat IN ('" . implode("','", $catsub) . "')";
    }
    /* === Hook === */
    foreach (cot_getextplugins('recentitems.recentforums.first') as $pl) {
        include $pl;
    }
    /* ===== */
    if ($mode == 'recent') {
        $sql = $db->query("SELECT * FROM {$db_forum_topics}\n\t\t\tWHERE (ft_movedto IS NULL OR ft_movedto = '') AND ft_mode=0 " . $incat . "\n\t\t\tORDER by ft_updated DESC LIMIT {$maxperpage}");
        $totalrecent['topics'] = $maxperpage;
    } else {
        $where = "WHERE ft_updated >= {$mode} " . $incat;
        $totalrecent['topics'] = $db->query("SELECT COUNT(*) FROM {$db_forum_topics} " . $where)->fetchColumn();
        $sql = $db->query("SELECT * FROM {$db_forum_topics} " . $where . " ORDER by ft_updated desc LIMIT {$d}, " . $maxperpage);
    }
    $ft_num = 0;
    while ($row = $sql->fetch()) {
        $row['ft_icon'] = 'posts';
        $row['ft_postisnew'] = FALSE;
        $row['ft_pages'] = '';
        $ft_num++;
        if ((int) $titlelength > 0 && mb_strlen($row['ft_title']) > $titlelength) {
            $row['ft_title'] = cot_string_truncate($row['ft_title'], $titlelength, false) . "...";
        }
        $build_forum = cot_breadcrumbs(cot_forums_buildpath($row['ft_cat'], false), false);
        $build_forum_short = cot_rc_link(cot_url('forums', 'm=topics&s=' . $row['ft_cat']), htmlspecialchars($structure['forums'][$row['ft_cat']]['title']));
        if ($row['ft_mode'] == 1) {
            $row['ft_title'] = "# " . $row['ft_title'];
        }
        if ($row['ft_movedto'] > 0) {
            $row['ft_url'] = cot_url('forums', 'm=posts&q=' . $row['ft_movedto']);
            $row['ft_icon'] = $R['forums_icon_posts_moved'];
            $row['ft_title'] = $L['Moved'] . ": " . $row['ft_title'];
            $row['ft_lastpostername'] = $R['forums_code_post_empty'];
            $row['ft_postcount'] = $R['forums_code_post_empty'];
            $row['ft_replycount'] = $R['forums_code_post_empty'];
            $row['ft_viewcount'] = $R['forums_code_post_empty'];
            $row['ft_lastpostername'] = $R['forums_code_post_empty'];
            $row['ft_lastposturl'] = cot_url('forums', 'm=posts&q=' . $row['ft_movedto'] . '&n=last', '#bottom');
            $row['ft_lastpostlink'] = cot_rc_link($row['ft_lastposturl'], $R['icon_follow']) . ' ' . $L['Moved'];
            $row['ft_timeago'] = cot_build_timegap($row['ft_updated'], $sys['now']);
        } else {
            $row['ft_url'] = cot_url('forums', 'm=posts&q=' . $row['ft_id']);
            $row['ft_lastposturl'] = $usr['id'] > 0 && $row['ft_updated'] > $usr['lastvisit'] ? cot_url('forums', 'm=posts&q=' . $row['ft_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $row['ft_id'] . '&n=last', '#bottom');
            $row['ft_lastpostlink'] = $usr['id'] > 0 && $row['ft_updated'] > $usr['lastvisit'] ? cot_rc_link($row['ft_lastposturl'], $R['icon_unread'], 'rel="nofollow"') : cot_rc_link($row['ft_lastposturl'], $R['icon_follow'], 'rel="nofollow"');
            $row['ft_lastpostlink'] .= cot_date('datetime_medium', $row['ft_updated']);
            $row['ft_timeago'] = cot_build_timegap($row['ft_updated'], $sys['now']);
            $row['ft_replycount'] = $row['ft_postcount'] - 1;
            if ($row['ft_updated'] > $usr['lastvisit'] && $usr['id'] > 0) {
                $row['ft_icon'] .= '_new';
                $row['ft_postisnew'] = TRUE;
            }
            if ($row['ft_postcount'] >= $cfg['forums']['hottopictrigger'] && !$row['ft_state'] && !$row['ft_sticky']) {
                $row['ft_icon'] = $row['ft_postisnew'] ? 'posts_new_hot' : 'posts_hot';
            } else {
                if ($row['ft_sticky']) {
                    $row['ft_icon'] .= '_sticky';
                }
                if ($row['ft_state']) {
                    $row['ft_icon'] .= '_locked';
                }
            }
            $row['ft_icon_type'] = $row['ft_icon'];
            $row['ft_icon'] = cot_rc('forums_icon_topic_t', array('icon' => $row['ft_icon'], 'title' => $L['recentitems_' . $row['ft_icon']]));
            $row['ft_lastpostername'] = cot_build_user($row['ft_lastposterid'], htmlspecialchars($row['ft_lastpostername']));
        }
        $row['ft_firstpostername'] = cot_build_user($row['ft_firstposterid'], htmlspecialchars($row['ft_firstpostername']));
        if ($row['ft_postcount'] > $cfg['forums']['maxtopicsperpage'] && $cfg['forums']['maxtopicsperpage'] > 0) {
            $row['ft_maxpages'] = ceil($row['ft_postcount'] / $cfg['forums']['maxtopicsperpage']);
            $row['ft_pages'] = $L['Pages'] . ":";
        }
        $recentitems->assign(array('FORUM_ROW_ID' => $row['ft_id'], 'FORUM_ROW_STATE' => $row['ft_state'], 'FORUM_ROW_ICON' => $row['ft_icon'], 'FORUM_ROW_ICON_TYPE' => $row['ft_icon_type'], 'FORUM_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'FORUM_ROW_PATH' => $build_forum, 'FORUM_ROW_PATH_SHORT' => $build_forum_short, 'FORUM_ROW_DESC' => htmlspecialchars($row['ft_desc']), 'FORUM_ROW_PREVIEW' => $row['ft_preview'] . '...', 'FORUM_ROW_CREATIONDATE' => cot_date('datetime_short', $row['ft_creationdate']), 'FORUM_ROW_CREATIONDATE_STAMP' => $row['ft_creationdate'], 'FORUM_ROW_UPDATED' => $row['ft_lastpostlink'], 'FORUM_ROW_UPDATED_STAMP' => $row['ft_updated'], 'FORUM_ROW_TIMEAGO' => $row['ft_timeago'], 'FORUM_ROW_POSTCOUNT' => $row['ft_postcount'], 'FORUM_ROW_REPLYCOUNT' => $row['ft_replycount'], 'FORUM_ROW_VIEWCOUNT' => $row['ft_viewcount'], 'FORUM_ROW_FIRSTPOSTER' => $row['ft_firstpostername'], 'FORUM_ROW_LASTPOSTER' => $row['ft_lastpostername'], 'FORUM_ROW_LASTPOSTURL' => $row['ft_lastposturl'], 'FORUM_ROW_URL' => $row['ft_url'], 'FORUM_ROW_PAGES' => $row['ft_pages'], 'FORUM_ROW_MAXPAGES' => $row['ft_maxpages'], 'FORUM_ROW_NUM' => $ft_num, 'FORUM_ROW_ODDEVEN' => cot_build_oddeven($ft_num), 'FORUM_ROW' => $row));
        $recentitems->parse('MAIN.TOPICS_ROW');
    }
    $sql->closeCursor();
    if ($d == 0 && $ft_num == 0) {
        $recentitems->parse('MAIN.NO_TOPICS_FOUND');
    }
    $recentitems->parse('MAIN');
    return $d == 0 || $ft_num > 0 ? $recentitems->text('MAIN') : '';
}