当前位置: 首页>>代码示例>>PHP>>正文


PHP cot_build_extrafields_data函数代码示例

本文整理汇总了PHP中cot_build_extrafields_data函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_build_extrafields_data函数的具体用法?PHP cot_build_extrafields_data怎么用?PHP cot_build_extrafields_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cot_build_extrafields_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cot_generate_sbrtags

function cot_generate_sbrtags($item_data, $tag_prefix = '', $admin_rights = null, $pagepath_home = false)
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_sbr, $db_sbr_stages, $sys;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('sbrtags.first');
        $extp_main = cot_getextplugins('sbrtags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['sbr_id'] > 0 && !empty($item_data['sbr_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('plug', 'sbr', 'A');
        }
        $patharray[] = array(cot_url('sbr'), $L['sbr']);
        $patharray[] = array(cot_url('sbr', 'id=' . $item_data['sbr_id']), $item_data['sbr_title']);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $temp_array = array('ID' => $item_data['sbr_id'], 'STATUS' => $item_data['sbr_status'], 'LOCALSTATUS' => $L['sbr_status_' . $item_data['sbr_status']], 'LABELSTATUS' => $R['sbr_labels'][$item_data['sbr_status']], 'URL' => cot_url('sbr', 'id=' . $item_data['sbr_id']), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['sbr_title'], 'CREATEDATE' => date('d.m.Y H:i', $item_data['sbr_create']), 'CREATEDATE_STAMP' => $item_data['sbr_create'], 'BEGINDATE' => date('d.m.Y H:i', $item_data['sbr_begin']), 'BEGINDATE_STAMP' => $item_data['sbr_begin'], 'DONEDATE' => date('d.m.Y H:i', $item_data['sbr_done']), 'DONEDATE_STAMP' => $item_data['sbr_done'], 'COST' => $item_data['sbr_cost'], 'TAX' => $item_data['sbr_tax'], 'TOTAL' => $item_data['sbr_cost'] + $item_data['sbr_tax'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['sbr_employer']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('sbr', 'm=edit&id=' . $item_data['sbr_id']);
        }
        // Extrafields
        if (isset($cot_extrafields[$db_sbr])) {
            foreach ($cot_extrafields[$db_sbr] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['sbr_' . $exfld['field_name'] . '_title']) ? $L['sbr_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('sbr', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
开发者ID:cotemplate,项目名称:cot-sbr,代码行数:51,代码来源:sbr.functions.php

示例2: COUNT

$alloffers_count = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} WHERE offer_pid=" . $id)->fetchColumn();
$t_o->assign(array("ALLOFFERS_COUNT" => $alloffers_count));
/* === Hook === */
$extp1 = cot_getextplugins('projects.offers.choise.first');
$extp2 = cot_getextplugins('projects.offers.choise');
$extp3 = cot_getextplugins('projects.offers.posts.loop');
$extp4 = cot_getextplugins('projects.offers.loop');
/* ===== */
while ($offer = $sql->fetch()) {
    $t_o->assign(cot_generate_usertags($offer, 'OFFER_ROW_OWNER_'));
    $t_o->assign(array("OFFER_ROW_DATE" => cot_date('d.m.Y H:i', $offer['offer_date']), "OFFER_ROW_DATE_STAMP" => $offer['offer_date'], "OFFER_ROW_TEXT" => cot_parse($offer['offer_text']), "OFFER_ROW_COSTMIN" => number_format($offer['offer_cost_min'], '0', '.', ' '), "OFFER_ROW_COSTMAX" => number_format($offer['offer_cost_max'], '0', '.', ' '), "OFFER_ROW_TIMEMIN" => $offer['offer_time_min'], "OFFER_ROW_TIMEMAX" => $offer['offer_time_max'], "OFFER_ROW_TIMETYPE" => $L['offers_timetype'][$offer['offer_time_type']], "OFFER_ROW_HIDDEN" => $offer['offer_hidden'], "OFFER_ROW_CHOISE" => $offer['offer_choise']));
    // Extrafields
    if (isset($cot_extrafields[$db_projects_offers])) {
        foreach ($cot_extrafields[$db_projects_offers] as $exfld) {
            $uname = mb_strtoupper($exfld['field_name']);
            $t_o->assign(array('OFFER_ROW_' . $uname . '_TITLE' => isset($L['offers_' . $exfld['field_name'] . '_title']) ? $L['offers_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'OFFER_ROW_' . $uname => cot_build_extrafields_data('offers', $exfld, $offer['item_' . $exfld['field_name']])));
        }
    }
    $choise_enabled = true;
    /* === Hook - Part1 : Include === */
    foreach ($extp1 as $pl) {
        include $pl;
    }
    /* ===== */
    if ($usr['id'] == $item['item_userid'] && $choise_enabled) {
        $t_o->assign(array("OFFER_ROW_SETPERFORMER" => cot_url('projects', 'id=' . $id . '&a=setperformer&userid=' . $offer['user_id'] . '&' . cot_xg()), "OFFER_ROW_REFUSE" => cot_url('projects', 'id=' . $id . '&a=refuse&userid=' . $offer['user_id'] . '&' . cot_xg())));
        /* === Hook - Part2 : Include === */
        foreach ($extp2 as $pl) {
            include $pl;
        }
        /* ===== */
开发者ID:ASDAFF,项目名称:cot-freelance,代码行数:31,代码来源:projects.offers.php

示例3: cot_generate_markettags

/**
 * Returns all product tags for coTemplate
 *
 * @param mixed $item_data product Info Array or ID
 * @param string $tag_prefix Prefix for tags
 * @param int $textlength Text truncate
 * @param bool $admin_rights product Admin Rights
 * @param bool $pagepath_home Add home link for page path
 * @param string $emptytitle Page title text if page does not exist
 * @return array
 * @global CotDB $db
 */
function cot_generate_markettags($item_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_market, $usr, $sys, $cot_yesno, $structure, $db_structure;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('markettags.first');
        $extp_main = cot_getextplugins('markettags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_market} WHERE item_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['item_id'] > 0 && !empty($item_data['item_title'])) {
        if (is_null($admin_rights)) {
            $admin_rights = cot_auth('market', $item_data['item_cat'], 'A');
        }
        $item_data['item_pageurl'] = empty($item_data['item_alias']) ? cot_url('market', 'c=' . $item_data['item_cat'] . '&id=' . $item_data['item_id']) : cot_url('market', 'c=' . $item_data['item_cat'] . '&al=' . $item_data['item_alias']);
        $catpatharray[] = array(cot_url('market'), $L['market']);
        $itempatharray[] = array($item_data['item_pageurl'], $item_data['item_title']);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']), $itempatharray);
        $itempath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $patharray = array_merge($catpatharray, cot_structure_buildpath('market', $item_data['item_cat']));
        $catpath = cot_breadcrumbs($patharray, $pagepath_home, true);
        $text = cot_parse($item_data['item_text'], $cfg['market']['markup'], $item_data['item_parser']);
        $text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : $text;
        $item_data['item_status'] = cot_market_status($item_data['item_state']);
        $temp_array = array('ID' => $item_data['item_id'], 'ALIAS' => $item_data['item_alias'], 'STATE' => $item_data['item_state'], 'STATUS' => $item_data['item_status'], 'LOCALSTATUS' => $L['market_status_' . $item_data['item_status']], 'URL' => $item_data['item_pageurl'], 'USER_PRDURL' => cot_url('users', 'm=details&id=' . $item_data['item_userid'] . '&u=' . $item_data['user_name'] . '&tab=market'), 'TITLE' => $itempath, 'SHORTTITLE' => $item_data['item_title'], 'CAT' => $item_data['item_cat'], 'CATTITLE' => htmlspecialchars($structure['market'][$item_data['item_cat']]['title']), 'CATURL' => cot_url('market', 'c=' . $item_data['item_cat']), 'CATPATH' => $catpath, 'TEXT' => $text, 'SHORTTEXT' => $text_cut, 'COST' => number_format($item_data['item_cost'], '0', '.', ' '), 'DATE' => cot_date('datetime_medium', $item_data['item_date']), 'DATE_STAMP' => $item_data['item_date'], 'SHOW_URL' => $item_data['item_pageurl'], 'COUNT' => $item_data['item_count'], 'USER_IS_ADMIN' => $admin_rights || $usr['id'] == $item_data['item_userid']);
        if ($admin_rights || $usr['id'] == $item_data['item_userid']) {
            $temp_array['ADMIN_EDIT'] = cot_rc_link(cot_url('market', 'm=edit&id=' . $item_data['item_id']), $L['Edit']);
            $temp_array['ADMIN_EDIT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id']);
            $temp_array['HIDEPRODUCT_URL'] = cot_url('market', 'm=edit&id=' . $item_data['item_id'] . ($item_data['item_state'] == 1 ? '&a=public' : '&a=hide'));
            $temp_array['HIDEPRODUCT_TITLE'] = $item_data['item_state'] == 1 ? $L['Publish'] : $L['Hide'];
        }
        // Extrafields
        if (isset($cot_extrafields[$db_market])) {
            foreach ($cot_extrafields[$db_market] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array[$tag . '_TITLE'] = isset($L['market_' . $exfld['field_name'] . '_title']) ? $L['market_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array[$tag] = cot_build_extrafields_data('market', $exfld, $item_data['item_' . $exfld['field_name']]);
            }
        }
        // Extra fields for structure
        if (isset($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $tag = mb_strtoupper($exfld['field_name']);
                $temp_array['CAT_' . $tag . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                $temp_array['CAT_' . $tag] = cot_build_extrafields_data('structure', $exfld, $structure['market'][$item_data['item_cat']][$exfld['field_name']]);
            }
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    } else {
        $temp_array = array('TITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted'], 'SHORTTITLE' => !empty($emptytitle) ? $emptytitle : $L['Deleted']);
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
开发者ID:ASDAFF,项目名称:cot-freelance,代码行数:80,代码来源:market.functions.php

示例4: cot_generate_pagetags

/**
 * 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])) {
//.........这里部分代码省略.........
开发者ID:CrazyFreeMan,项目名称:Cotonti,代码行数:101,代码来源:page.functions.php

示例5: cot_comments_display


//.........这里部分代码省略.........
    }
    /* ===== */
    $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;
}
开发者ID:Roffun,项目名称:Cotonti,代码行数:101,代码来源:comments.functions.php

示例6: cot_generate_usertags

/**
 * 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;
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:69,代码来源:functions.php

示例7: foreach

foreach ($subcat as $x) {
    $kk++;
    $cat_childs = cot_structure_children('page', $x);
    $sub_count = 0;
    foreach ($cat_childs as $cat_child) {
        $sub_count += (int) $structure['page'][$cat_child]['count'];
    }
    $sub_url_path = $list_url_path;
    $sub_url_path['c'] = $x;
    $t->assign(array('LIST_ROWCAT_ID' => $structure['page'][$x]['id'], 'LIST_ROWCAT_URL' => cot_url('page', $sub_url_path), 'LIST_ROWCAT_TITLE' => $structure['page'][$x]['title'], 'LIST_ROWCAT_DESC' => $structure['page'][$x]['desc'], 'LIST_ROWCAT_ICON' => $structure['page'][$x]['icon'], 'LIST_ROWCAT_COUNT' => $sub_count, 'LIST_ROWCAT_ODDEVEN' => cot_build_oddeven($kk), 'LIST_ROWCAT_NUM' => $kk));
    // Extra fields for structure
    if (!empty(cot::$extrafields[cot::$db->structure])) {
        foreach (cot::$extrafields[cot::$db->structure] as $exfld) {
            $uname = strtoupper($exfld['field_name']);
            $exfld_title = cot_extrafield_title($exfld, 'structure_');
            $t->assign(array('LIST_ROWCAT_' . $uname . '_TITLE' => $exfld_title, 'LIST_ROWCAT_' . $uname => cot_build_extrafields_data('structure', $exfld, cot::$structure['page'][$x][$exfld['field_name']]), 'LIST_ROWCAT_' . $uname . '_VALUE' => cot::$structure['page'][$x][$exfld['field_name']]));
        }
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.LIST_ROWCAT');
}
$pagenav_cat = cot_pagenav('page', $list_url_path + array('d' => $durl), $dc, count($allsub), cot::$cfg['page']['maxlistsperpage'], 'dc');
$t->assign(array('LISTCAT_PAGEPREV' => $pagenav_cat['prev'], 'LISTCAT_PAGENEXT' => $pagenav_cat['next'], 'LISTCAT_PAGNAV' => $pagenav_cat['main']));
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('page.list.loop');
/* ===== */
开发者ID:Roffun,项目名称:Cotonti,代码行数:31,代码来源:page.list.php

示例8: cot_pagenav

    }
    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));
    if (!empty(cot::$extrafields[cot::$db->forum_topics])) {
        foreach (cot::$extrafields[cot::$db->forum_topics] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_title = cot_extrafield_title($exfld, 'forums_topic_');
            $t->assign(array('FORUMS_TOPICS_ROW_' . $tag . '_TITLE' => $exfld_title, 'FORUMS_TOPICS_ROW_' . $tag => cot_build_extrafields_data('forums', $exfld, $row['ft_' . $exfld['field_name']], cot::$cfg['forums']['markup'] && cot::$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, cot::$cfg['forums']['maxtopicsperpage']);
$toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? cot::$R['forums_code_admin_mark'] : '';
$jumpbox[cot_url('forums')] = cot::$L['Forums'];
foreach ($structure['forums'] as $key => $val) {
    if (cot_auth('forums', $key, 'R')) {
开发者ID:Roffun,项目名称:Cotonti,代码行数:31,代码来源:forums.topics.php

示例9: array

    if (!cot_error_found()) {
        $rcontact['contact_authorid'] = (int) $usr['id'];
        $rcontact['contact_date'] = (int) $sys['now'];
        $rcontact['contact_val'] = 0;
        if (in_array($cfg['plugin']['contact']['save'], array('db', 'both'))) {
            $db->insert($db_contact, $rcontact);
        }
        $semail = !empty($cfg['plugin']['contact']['email']) ? $cfg['plugin']['contact']['email'] : $cfg['adminemail'];
        if (cot_check_email($semail) && in_array($cfg['plugin']['contact']['save'], array('email', 'both'))) {
            $headers = "From: \"" . $rcontact['contact_author'] . "\" <" . $rcontact['contact_email'] . ">\n";
            $context = array('sitetitle' => $cfg["maintitle"], 'siteurl' => $cfg['mainurl'], 'author' => $rcontact['contact_author'], 'email' => $rcontact['contact_email'], 'subject' => $rcontact['contact_subject'], 'text' => $rcontact['contact_text']);
            $rextras = '';
            if (!empty(cot::$extrafields[cot::$db->contact])) {
                foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
                    $exfld_title = cot_extrafield_title($exfld, 'contact_');
                    $ex_body = cot_build_extrafields_data('contact', $exfld, $rcontact['contact_' . $exfld['field_name']]);
                    $rextras .= "\n" . $exfld_title . ": " . $ex_body;
                    $context['extra' . $exfld['field_name']] = $ex_body;
                    $context['extra' . $exfld['field_name'] . '_title'] = $exfld_title;
                    $context['extra' . $exfld['field_name'] . '_value'] = $rcontact['contact_' . $exfld['field_name']];
                }
            }
            $context['extra'] = $rextras;
            $rtextm = cot_rc(empty(cot::$cfg['plugin']['contact']['template']) ? cot::$R['contact_message'] : cot::$cfg['plugin']['contact']['template'], $context);
            cot_mail($semail, $rcontact['contact_subject'], $rtextm, $headers);
        }
        $sent = true;
        cot_message('contact_message_sent');
        cot_extrafield_movefiles();
    }
}
开发者ID:Roffun,项目名称:Cotonti,代码行数:31,代码来源:contact.php

示例10: cot_rc

    $rowt['ft_icon'] .= '_new';
    $rowt['ft_postisnew'] = TRUE;
}
if ($rowt['ft_postcount'] >= $cfg['forums']['hottopictrigger'] && !$rowt['ft_state'] && !$rowt['ft_sticky']) {
    $rowt['ft_icon'] = $rowt['ft_postisnew'] ? 'posts_new_hot' : 'posts_hot';
} else {
    $rowt['ft_icon'] .= $rowt['ft_sticky'] ? '_sticky' : '';
    $rowt['ft_icon'] .= $rowt['ft_state'] ? '_locked' : '';
}
$rowt['ft_icon_type'] = $rowt['ft_icon'];
$rowt['ft_icon'] = cot_rc('forums_icon_topic', array('icon' => $rowt['ft_icon']));
$rowt['ft_icon_type_ex'] = $rowt['ft_icon_type'];
if ($rowt['ft_user_posted']) {
    $rowt['ft_icon_type_ex'] .= '_posted';
}
$t->assign(array('FORUMS_POSTS_ICON' => $rowt['ft_icon'], 'FORUMS_POSTS_ICON_TYPE' => $rowt['ft_icon_type'], 'FORUMS_POSTS_ICON_TYPE_EX' => $rowt['ft_icon_type_ex']));
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
    $tag = mb_strtoupper($exfld['field_name']);
    $t->assign(array('FORUMS_POSTS_TOPIC_' . $tag . '_TITLE' => isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'FORUMS_POSTS_TOPIC_' . $tag => cot_build_extrafields_data('forums', $exfld, $rowt['ft_' . $exfld['field_name']], $cfg['forums']['markup'] && $cfg['forums']['cat_' . $s]['allowbbcodes']), 'FORUMS_POSTS_TOPIC_' . $tag . '_VALUE' => $rowt['ft_' . $exfld['field_name']]));
}
/* === Hook  === */
foreach (cot_getextplugins('forums.posts.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
if ($cache && $usr['id'] === 0 && $cfg['cache_forums']) {
    $cache->page->write();
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:31,代码来源:forums.posts.php

示例11: cot_url

        case 'polls':
            $row['com_url'] = cot_url('polls', 'id=' . $row['com_value'] . "&comments=1", '#c' . $row['com_id']);
            break;
        case 'e_shop':
            $row['com_url'] = cot_url('plug', 'e=e_shop&sh=product&productID=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        default:
            $row['com_url'] = '';
            break;
    }
    $t->assign(array('ADMIN_COMMENTS_ITEM_DEL_URL' => cot_url('admin', 'm=other&p=comments&a=delete&id=' . $row['com_id'] . '&' . cot_xg()), 'ADMIN_COMMENTS_ITEM_ID' => $row['com_id'], 'ADMIN_COMMENTS_CODE' => $row['com_code'], 'ADMIN_COMMENTS_AREA' => $row['com_area'], 'ADMIN_COMMENTS_AUTHOR' => $row['com_author'], 'ADMIN_COMMENTS_DATE' => cot_date('datetime_medium', $row['com_date']), 'ADMIN_COMMENTS_DATE_STAMP' => $row['com_date'], 'ADMIN_COMMENTS_TEXT' => $row['com_text'], 'ADMIN_COMMENTS_URL' => $row['com_url'], 'ADMIN_COMMENTS_ODDEVEN' => cot_build_oddeven($ii)));
    if (!empty(cot::$extrafields[cot::$db->com])) {
        foreach (cot::$extrafields[cot::$db->com] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $exfld_title = cot_extrafield_title($exfld, 'comments_');
            $t->assign(array('ADMIN_COMMENTS_' . $tag . '_TITLE' => $exfld_title, 'ADMIN_COMMENTS_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'ADMIN_COMMENTS_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']]));
        }
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_COMMENTS_ROW');
    $ii++;
}
$t->assign(array('ADMIN_COMMENTS_CONFIG_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=comments'), 'ADMIN_COMMENTS_ADMINWARNINGS' => $adminwarnings, 'ADMIN_COMMENTS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_COMMENTS_PAGNAV' => $pagenav['main'], 'ADMIN_COMMENTS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_COMMENTS_TOTALITEMS' => $totalitems, 'ADMIN_COMMENTS_COUNTER_ROW' => $ii));
/* === Hook  === */
foreach (cot_getextplugins('admin.comments.tags') as $pl) {
    include $pl;
}
开发者ID:Roffun,项目名称:Cotonti,代码行数:31,代码来源:comments.tools.php

示例12: editAction

 public function editAction()
 {
     global $structure, $cot_extrafields, $db_structure;
     $id = cot_import('id', 'G', 'INT');
     // id Объявления
     $c = cot_import('c', 'G', 'TXT');
     $act = cot_import('act', 'G', 'ALP');
     if (empty($act)) {
         $act = cot_import('act', 'P', 'ALP');
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.edit.first') as $pl) {
         include $pl;
     }
     /* ===== */
     // Права на любую категорию доски объявлений
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', 'any');
     cot_block(cot::$usr['auth_write']);
     if (!$c || !isset($structure['advboard'][$c])) {
         cot_die_message(404, TRUE);
     }
     $category = $structure['advboard'][$c];
     $category['config'] = cot::$cfg['advboard']['cat_' . $c];
     $category['code'] = $c;
     // Extra fields for structure
     foreach ($cot_extrafields[$db_structure] as $exfld) {
         $uname = $exfld['field_name'];
         $val = $structure['advboard'][$c][$exfld['field_name']];
         $category[$uname . '_title'] = isset(cot::$L['structure_' . $exfld['field_name'] . '_title']) ? cot::$L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
         $category[$uname] = cot_build_extrafields_data('structure', $exfld, $val);
         $category[$uname . '_value'] = $val;
     }
     $published = 0;
     if (!$id) {
         $advert = new advboard_model_Advert();
         $advert->category = $c;
         $advert->user = cot::$usr['id'];
     } else {
         $advert = advboard_model_Advert::getById($id);
         if (!$advert) {
             cot_die_message(404, TRUE);
         }
         if (!cot::$usr['isadmin']) {
             if ($advert->user != cot::$usr['id']) {
                 cot_die_message(404, TRUE);
             }
         }
         if ($c != $advert->category && isset($structure['advboard'][$advert->category])) {
             $tmp = array('c' => $advert->category, 'a' => 'edit', 'id' => $advert->id);
             if (!empty($act)) {
                 $tmp['act'] = $act;
             }
             cot_redirect(cot_url('advboard', array('c' => $advert->category, 'a' => 'edit', 'id' => $advert->id), '', true));
         }
         if ($act == 'clone') {
             $id = null;
             $advert = clone $advert;
             // Установить статус и пользователя нового объекта
             $advert->user = cot::$usr['id'];
             $advert->state = advboard_model_Advert::DRAFT;
         }
         $published = $advert->state < 2 ? 1 : 0;
     }
     //Проверим права на категорию:
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin'], cot::$usr['auth_upload']) = cot_auth('advboard', $c, 'RWA1');
     if ($structure['advboard'][$c]['locked'] && !cot::$usr['isadmin']) {
         cot_die_message(602, TRUE);
     } elseif ($advert->id == 0) {
         // Если у пользователя нет прав на подачу объявления, то ищем категорию куда он может подать оьбъявление
         if (!cot::$usr['auth_write']) {
             foreach ($structure['advboard'] as $catCode => $catRow) {
                 $auth_write = cot_auth('advboard', $catCode, 'W');
                 if ($auth_write) {
                     cot_redirect(cot_url('advboard', array('c' => $catCode, 'a' => 'edit'), '', true));
                 }
             }
         }
         cot_block(cot::$usr['auth_write']);
     }
     // Владелец объявления
     $user = array();
     if ($advert->user > 0) {
         $user = cot_user_data($advert->user);
     }
     $periodItems = adv_periodItems($c);
     // Сохранение
     if ($act == 'save') {
         unset($_POST['id'], $_POST['user']);
         cot_shield_protect();
         /* === Hook === */
         foreach (cot_getextplugins('advboard.save.first') as $pl) {
             include $pl;
         }
         /* ===== */
         // импортировать даты
         $begin = (int) cot_import_date('begin');
         $expire = (int) cot_import_date('expire');
         if ($begin == 0) {
             $begin = !empty($advert->begin) ? $advert->begin : cot::$sys['now'];
         }
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:advboard,代码行数:101,代码来源:Main.php

示例13: cot_generate_sectiontags

/**
 * 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;
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:41,代码来源:forums.functions.php

示例14: cot_url

            break;
        case 'polls':
            $row['com_url'] = cot_url('polls', 'id=' . $row['com_value'] . "&comments=1", '#c' . $row['com_id']);
            break;
        case 'e_shop':
            $row['com_url'] = cot_url('plug', 'e=e_shop&sh=product&productID=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        default:
            $row['com_url'] = '';
            break;
    }
    $t->assign(array('ADMIN_COMMENTS_ITEM_DEL_URL' => cot_url('admin', 'm=other&p=comments&a=delete&id=' . $row['com_id'] . '&' . cot_xg()), 'ADMIN_COMMENTS_ITEM_ID' => $row['com_id'], 'ADMIN_COMMENTS_CODE' => $row['com_code'], 'ADMIN_COMMENTS_AREA' => $row['com_area'], 'ADMIN_COMMENTS_AUTHOR' => $row['com_author'], 'ADMIN_COMMENTS_DATE' => cot_date('datetime_medium', $row['com_date']), 'ADMIN_COMMENTS_DATE_STAMP' => $row['com_date'], 'ADMIN_COMMENTS_TEXT' => $row['com_text'], 'ADMIN_COMMENTS_URL' => $row['com_url'], 'ADMIN_COMMENTS_ODDEVEN' => cot_build_oddeven($ii)));
    if (isset($cot_extrafields[$db_com])) {
        foreach ($cot_extrafields[$db_com] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $t->assign(array('ADMIN_COMMENTS_' . $tag . '_TITLE' => isset($L['comments_' . $exfld['field_name'] . '_title']) ? $L['comments_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'ADMIN_COMMENTS_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'ADMIN_COMMENTS_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']]));
        }
    }
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_COMMENTS_ROW');
    $ii++;
}
$t->assign(array('ADMIN_COMMENTS_CONFIG_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=comments'), 'ADMIN_COMMENTS_ADMINWARNINGS' => $adminwarnings, 'ADMIN_COMMENTS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_COMMENTS_PAGNAV' => $pagenav['main'], 'ADMIN_COMMENTS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_COMMENTS_TOTALITEMS' => $totalitems, 'ADMIN_COMMENTS_COUNTER_ROW' => $ii));
/* === Hook  === */
foreach (cot_getextplugins('admin.comments.tags') as $pl) {
    include $pl;
}
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:31,代码来源:comments.tools.php

示例15: distinct

    $admin_tags_join_fields = ", f.*";
    $admin_tags_join_tables = " LEFT JOIN {$db_forum_posts} AS f\n\t\tON t.tag_area = 'forums' AND t.tag_item = f.fp_id";
}
$totalitems = $db->query("SELECT distinct(tag) FROM {$db_tag_references} AS t WHERE 1 " . $admin_tags_join_where)->rowCount();
//$totalitems = $db->countRows($db_tags);
$pagenav = cot_pagenav('admin', 'm=other&p=tags&sorttype=' . $sorttype . '&sortway=' . $sortway . '&filter=' . $filter, $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql = $db->query("SELECT t.*,COUNT(*) AS tag_cnt, GROUP_CONCAT(t.tag_area,':',t.tag_item SEPARATOR ',') AS tag_grp {$admin_tags_join_fields}\n\tFROM {$db_tag_references} AS t {$admin_tags_join_tables}\n\tWHERE 1 {$admin_tags_join_where}\n\tGROUP BY t.tag\n\tORDER BY {$admin_tags_join_sorttype} {$sortway} LIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.tags.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    if (isset($cot_extrafields[$db_tag_references])) {
        foreach ($cot_extrafields[$db_tag_references] as $exfld) {
            $tag = mb_strtoupper($exfld['field_name']);
            $tt->assign(array('ADMIN_TAGS_' . $tag . '_TITLE' => isset($L['tags_' . $exfld['field_name'] . '_title']) ? $L['tags_' . $exfld['field_name'] . '_title'] : $exfld['field_description'], 'ADMIN_TAGS_' . $tag => cot_build_extrafields_data('tags', $exfld, $row['tag_' . $exfld['field_name']]), 'ADMIN_TAGS_' . $tag . '_VALUE' => $row['tag_' . $exfld['field_name']]));
        }
    }
    if (!empty($row['tag_grp'])) {
        $item_mas = array();
        $items = explode(',', $row['tag_grp']);
        foreach ($items as $val) {
            $item = explode(':', $val);
            $item_mas[$item[0]][] = $item[1];
        }
        foreach ($item_mas as $k => $v) {
            if ($k == 'pages') {
                foreach ($v as $kk => $vv) {
                    $row_item = cot_generate_pagetags($vv, 'ADMIN_TAGS_ITEM_', 200);
                    if ($row_item['ADMIN_TAGS_ITEM_TITLE'] == 'Удалено') {
                    } else {
开发者ID:Andreyjktl,项目名称:Cotonti,代码行数:31,代码来源:tags.tools.php


注:本文中的cot_build_extrafields_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。