本文整理汇总了PHP中cot_parse函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_parse函数的具体用法?PHP cot_parse怎么用?PHP cot_parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_parse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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])) {
//.........这里部分代码省略.........
示例2: 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;
}
示例3: 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;
}
示例4: list
}
$item = $sql->fetch();
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('folio', $item['item_cat'], 'RWA');
cot_block($usr['auth_read']);
if ($item['item_state'] != 0 && !$usr['isadmin'] && $usr['id'] != $item['item_userid']) {
cot_log("Attempt to directly access an un-validated", 'sec');
cot_redirect(cot_url('message', "msg=930", '', true));
exit;
}
if ($usr['id'] != $item['item_userid'] && (!$usr['isadmin'] || $cfg['folio']['count_admin'])) {
$item['item_count']++;
$db->update($db_folio, array('item_count' => $item['item_count']), "item_id=" . (int) $item['item_id']);
}
$title_params = array('TITLE' => empty($item['item_metatitle']) ? $item['item_title'] : $item['item_metatitle'], 'CATEGORY' => $structure['folio'][$item['item_cat']]['title']);
$out['subtitle'] = cot_title($cfg['folio']['title_folio'], $title_params);
$out['desc'] = !empty($item['item_metadesc']) ? $item['item_metadesc'] : cot_cutstring(strip_tags(cot_parse($item['item_text'], $cfg['folio']['markup'], $item['item_parser'])), 160);
$out['meta_keywords'] = !empty($item['item_keywords']) ? $item['item_keywords'] : $structure['folio'][$item['item_cat']]['keywords'];
// Building the canonical URL
$pageurl_params = array('c' => $item['item_cat']);
empty($al) ? $pageurl_params['id'] = $id : ($pageurl_params['al'] = $al);
$out['canonical_uri'] = cot_url('folio', $pageurl_params);
$mskin = cot_tplfile(array('folio', $structure['folio'][$item['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('folio.main') as $pl) {
include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$t->assign(cot_generate_usertags($item, 'PRD_OWNER_'));
$t->assign(cot_generate_foliotags($item, 'PRD_', $cfg['folio']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
/* === Hook === */
示例5: defined
[BEGIN_COT_EXT]
Hooks=forums.posts.tags
[END_COT_EXT]
==================== */
/**
* Polls
*
* @package Polls
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') or die('Wrong URL');
cot_poll_vote();
$poll_form = cot_poll_form($q, cot_url('forums', 'm=posts&q=' . $q), '', 'forum');
if ($poll_form) {
$t->assign(array('POLLS_TITLE' => cot_parse($poll_form['poll_text'], $cfg['polls']['markup']), 'POLLS_FORM' => $poll_form['poll_block']));
$t->parse('MAIN.POLLS_VIEW');
if ($poll_form['poll_alreadyvoted']) {
$extra = $votecasted ? $L['polls_votecasted'] : $L['polls_alreadyvoted'];
} else {
$extra = $L['polls_notyetvoted'];
}
$t->assign('POLLS_EXTRATEXT', $extra);
$t->parse('MAIN.POLLS_EXTRA');
if (!empty($poll_form['poll_text'])) {
$rowt['ft_title'] = $L['Poll'] . ": " . $rowt['ft_title'];
}
$crumbs = cot_forums_buildpath($s);
$toppath = cot_breadcrumbs($crumbs, $cfg['homebreadcrumb']);
$crumbs[] = $rowt['ft_title'];
$toptitle = cot_breadcrumbs($crumbs, $cfg['homebreadcrumb'], true);
示例6: COUNT
Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/pm/js/pm.js');
/* === Title === */
$totallines = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE {$sqlfilter}")->fetchColumn();
$elem = $f == 'sentbox' ? 'pm_touserid' : 'pm_fromuserid';
$pm_sql = $db->query("SELECT p.*, u.* FROM {$db_pm} AS p\n\t\tLEFT JOIN {$db_users} AS u\n\t\tON u.user_id = p.{$elem}\n\t\tWHERE {$sqlfilter}\n\t\tORDER BY pm_date DESC LIMIT {$d}," . $cfg['pm']['maxpmperpage']);
$pagenav = cot_pagenav('pm', 'f=' . $f . '&filter=' . $filter, $d, $totallines, $cfg['pm']['maxpmperpage'], 'd', '', $cfg['pm']['turnajax']);
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate(cot_tplfile(array('pm', 'list', $pmalttpl)));
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('pm.list.loop');
/* ===== */
foreach ($pm_sql->fetchAll() as $row) {
$jj++;
$row['pm_icon_readstatus'] = $row['pm_tostate'] == '0' ? cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon_new'], array('title' => $L['pm_unread'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon'], array('title' => $L['pm_read'], 'class' => 'ajax'));
$pm_data = cot_parse($row['pm_text'], $cfg['pm']['markup']);
$pm_desc = cot_string_truncate($pm_data, 100, true, false, '...');
if ($f == 'sentbox') {
$star_class = $row['pm_fromstate'] == 2 ? 1 : 0;
} else {
$star_class = $row['pm_tostate'] == 2 ? 1 : 0;
}
$url_edit = cot_url('pm', 'm=send&id=' . $row['pm_id']);
$url_delete = cot_url('pm', 'm=edit&a=delete&' . cot_xg() . '&id=' . $row['pm_id'] . '&f=' . $f . '&d=' . $durl);
$t->assign(array('PM_ROW_ID' => $row['pm_id'], 'PM_ROW_STATE' => $row['pm_tostate'], 'PM_ROW_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl))), 'PM_ROW_STAR_URL' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl), 'PM_ROW_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_ROW_DATE_STAMP' => $row['pm_date'], 'PM_ROW_TITLE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), htmlspecialchars($row['pm_title']), array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_URL' => cot_url('pm', 'm=message&id=' . $row['pm_id']), 'PM_ROW_TEXT' => $pm_data, 'PM_ROW_ICON_STATUS' => $row['pm_icon_readstatus'], 'PM_ROW_ICON_STARRED' => $row['pm_icon_starred'], 'PM_ROW_ICON_DELETE' => cot_rc_link($url_delete, $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_ICON_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete), $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_DELETE_URL' => $url_delete, 'PM_ROW_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete), 'PM_ROW_ICON_EDIT' => $row['pm_tostate'] == 0 ? cot_rc_link($url_edit, $R['pm_icon_edit'], array('title' => $L['Edit'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_ROW_EDIT_URL' => $row['pm_tostate'] == 0 ? $url_edit : '', 'PM_ROW_DESC' => $pm_desc, 'PM_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PM_ROW_NUM' => $jj));
$t->assign(cot_generate_usertags($row, 'PM_ROW_USER_'));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
示例7: cot_url
}
/* ===== */
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;
}
/* ===== */
$t_o->parse("MAIN.ROWS.CHOISE");
}
if ($usr['id'] == $offer['offer_userid'] || $usr['id'] == $item['item_userid'] || $usr['isadmin']) {
$sql_prjposts = $db->query("SELECT * FROM {$db_projects_posts} as p LEFT JOIN {$db_users} as u ON u.user_id=p.post_userid\n\t\t\tWHERE post_pid=" . $id . " AND post_oid=" . $offer['offer_id'] . " ORDER BY post_date ASC");
while ($posts = $sql_prjposts->fetch()) {
$t_o->assign(cot_generate_usertags($posts, 'POST_ROW_OWNER_'));
$t_o->assign(array("POST_ROW_TEXT" => cot_parse($posts['post_text']), "POST_ROW_DATE" => cot_date('d.m.y H:i', $posts['post_date']), "POST_ROW_DATE_STAMP" => $posts['post_date']));
/* === Hook - Part3 : Include === */
foreach ($extp3 as $pl) {
include $pl;
}
/* ===== */
$t_o->parse("MAIN.ROWS.POSTS.POSTS_ROWS");
}
$t_o->assign(array("ADDPOST_ACTION_URL" => cot_url('projects', 'id=' . $id . '&oid=' . $offer['offer_id'] . '&a=addpost'), "ADDPOST_TEXT" => cot_textarea('posttext', $offer_post['post_text'], 3, 60), "ADDPOST_OFFERID" => $offer['offer_id']));
$t_o->parse("MAIN.ROWS.POSTS.POSTFORM");
$t_o->parse("MAIN.ROWS.POSTS");
}
/* === Hook - Part4 : Include === */
foreach ($extp4 as $pl) {
include $pl;
}
示例8: COUNT
$query_limit = $cfg['projects']['offersperpage'] > 0 ? "LIMIT {$d}, " . $cfg['projects']['offersperpage'] : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} AS o \n\tLEFT JOIN {$db_projects} AS p ON o.offer_pid=p.item_id\n\t" . $where . "")->fetchColumn();
$sql = $db->query("SELECT o.* FROM {$db_projects_offers} AS o\n\tLEFT JOIN {$db_projects} AS p ON o.offer_pid=p.item_id\n\t" . $where . "\n\t" . $order . "\n\t" . $query_limit . "");
if ($cfg['projects']['offersperpage'] > 0) {
$pagenav = cot_pagenav('projects', 'm=useroffers&choise=' . $choise, $d, $totalitems, $cfg['projects']['offersperpage']);
$t->assign(array("PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next']));
}
$catpatharray[] = array(cot_url('projects'), $L['projects']);
$catpatharray[] = array('', $L['offers_useroffers']);
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("BREADCRUMBS" => $catpath));
/* === Hook === */
$extp = cot_getextplugins('projects.useroffers.loop');
/* ===== */
while ($offer = $sql->fetch()) {
$t->assign(cot_generate_projecttags($offer['offer_pid'], 'OFFER_ROW_PROJECT_'));
$t->assign(array("OFFER_ROW_DATE" => date('d.m.Y H:i', $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_CHOISE" => $offer['offer_choise']));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
$t->parse("MAIN.OFFER_ROWS");
}
/* === Hook === */
foreach (cot_getextplugins('projects.useroffers.tags') as $pl) {
include $pl;
}
/* ===== */
$t->parse("MAIN");
$module_body = $t->text('MAIN');
示例9: array
if ($sql->rowCount() > 0) {
$row = $sql->fetch();
if (cot_auth('page', $row['page_cat'], 'R')) {
$rss_title = $row['page_title'];
$rss_description = $L['rss_comments_item_desc'];
$page_args = array('c' => $row['page_cat']);
if (!empty($row['page_alias'])) {
$page_args['al'] = $row['page_alias'];
} else {
$page_args['id'] = $row['page_id'];
}
$sql = $db->query("SELECT c.*, u.user_name\n\t\t\t\t\tFROM {$db_com} AS c\n\t\t\t\t\tLEFT JOIN {$db_users} AS u ON c.com_authorid = u.user_id\n\t\t\t\t\tWHERE com_area = 'page' AND com_code='{$page_id}'\n\t\t\t\t\tORDER BY com_date DESC LIMIT " . $cfg['rss']['rss_maxitems']);
$i = 0;
while ($row1 = $sql->fetch()) {
$items[$i]['title'] = $L['rss_comment_of_user'] . " " . $row1['user_name'];
$text = cot_parse($row1['com_text'], $cfg['plugin']['comments']['parsebbcodecom']);
if ((int) $cfg['plugin']['comments']['rss_commentmaxsymbols'] > 0) {
$text .= cot_string_truncate($text, $cfg['plugin']['comments']['rss_commentmaxsymbols']) ? '...' : '';
}
$items[$i]['description'] = $text;
$items[$i]['link'] = cot_url('page', $page_args, '#c' . $row1['com_id'], true);
if (!cot_url_check($items[$i]['link'])) {
$items[$i]['link'] = COT_ABSOLUTE_URL . $items[$i]['link'];
}
$items[$i]['pubDate'] = cot_date('r', $row1['com_date']);
$i++;
}
// Attach original page text as last item
$row['page_pageurl'] = cot_url('page', $page_args, '', true);
$items[$i]['title'] = $L['rss_original'];
$items[$i]['description'] = cot_parse_page_text($row['page_text'], $row['page_pageurl'], $row['page_parser']);
示例10: cot_parse_post_text
function cot_parse_post_text($post_text)
{
global $cfg;
$post_text = cot_parse($post_text, $cfg['forums']['markup']);
if ((int) $cfg['rss']['rss_postmaxsymbols'] > 0) {
$post_text = cot_string_truncate($post_text, $cfg['rss']['rss_postmaxsymbols'], true, false, '...');
}
return $post_text;
}
示例11: array_merge
$i18n_array = array_merge($i18n_array, array('TITLE' => cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home), 'CATTITLE' => htmlspecialchars($cat_i18n['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link(cot_url('page', 'c=' . $page_data['page_cat'] . $append_param), htmlspecialchars($cat_i18n['title'])), 'CATDESC' => htmlspecialchars($cat_i18n['desc'])));
if ($admin_rights) {
$i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
$i18n_array['ADMIN_EDIT_URL'] = $edit_url;
$i18n_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_url, $L['Validate']) : cot_rc_link($unvalidate_url, $L['Putinvalidationqueue']);
$i18n_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_url : $unvalidate_url;
} else {
if ($usr['id'] == $page_data['page_ownerid']) {
$i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
$i18n_array['ADMIN_EDIT_URL'] = $edit_url;
}
}
} else {
$cat_i18n =& $structure['page'][$page_data['page_cat']];
}
if (!empty($page_data['ipage_title'])) {
$text = cot_parse($page_data['ipage_text'], $cfg['page']['markup']);
$text_cut = (int) $textlength > 0 ? cot_string_truncate($text, $textlength) : cot_cut_more($text);
$cutted = mb_strlen($text) > mb_strlen($text_cut) ? true : false;
$page_link = array(array(cot_url('page', $urlparams), $page_data['ipage_title']));
$i18n_array = array_merge($i18n_array, array('URL' => cot_url('page', $urlparams), 'TITLE' => cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home), 'SHORTTITLE' => htmlspecialchars($page_data['ipage_title']), 'DESC' => htmlspecialchars($page_data['ipage_desc']), 'TEXT' => $text, 'TEXT_CUT' => $text_cut, 'TEXT_IS_CUT' => $cutted, 'DESC_OR_TEXT' => !empty($page_data['ipage_desc']) ? htmlspecialchars($page_data['page_desc']) : $text, 'MORE' => $cutted ? cot_rc_link($page_data['page_pageurl'], $L['ReadMore']) : ''));
}
//$i18n_array['ADMIN_EDIT'] = '';
if ($i18n_write) {
if (!empty($page_data['ipage_id']) && ($i18n_admin || $pag_i18n['ipage_translatorid'] == $usr['id'])) {
// Edit translation
$i18n_array['ADMIN_EDIT'] = cot_rc_link(cot_url('plug', "e=i18n&m=page&a=edit&id=" . $page_data['page_id'] . "&l={$i18n_locale}"), $L['Edit']);
}
}
$temp_array = array_merge($temp_array, $i18n_array);
}
示例12: cot_build_extrafields_data
/**
* Returns Extra fields data
*
* @param string $name Lang row
* @param array $extrafields Extra fields data
* @param string $value Existing user value
* @param string $parser Non-default parser to use
* @return string
*/
function cot_build_extrafields_data($name, $extrafield, $value, $parser = '')
{
global $L;
$parse_type = array('HTML', 'Text');
switch ($extrafield['field_type']) {
case 'select':
case 'radio':
$value = htmlspecialchars($value);
return !empty($L[$extrafield['field_name'] . '_' . $value]) ? $L[$extrafield['field_name'] . '_' . $value] : $value;
break;
case 'checkbox':
$value = $value ? 1 : 0;
return $value;
break;
case 'datetime':
$extrafield['field_params'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_params']);
list($min, $max, $format) = explode(",", $extrafield['field_params'], 3);
return empty($format) ? $value : cot_date($format, $value);
break;
case 'checklistbox':
$value = htmlspecialchars($value);
$value = trim(str_replace(array(' , ', ', ', ' ,'), ',', $value));
$value = explode(',', $value);
$sep = !empty($extrafield['field_params']) ? $extrafield['field_params'] : ', ';
$result = '';
$i = 0;
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($i != 0) {
$result .= $sep;
}
$i++;
$result .= !empty($L[$extrafield['field_name'] . '_' . $v]) ? $L[$extrafield['field_name'] . '_' . $v] : $v;
}
}
return $result;
break;
case 'country':
case 'file':
case 'filesize':
$value = is_null($value) ? '' : $value;
return $value;
break;
case 'input':
case 'inputint':
case 'currency':
case 'double':
case 'textarea':
case 'range':
default:
$value = is_null($value) ? '' : $value;
$value = cot_parse($value, $extrafield['field_parse'] == 'Text' ? false : true, $parser);
return $value;
break;
}
}
示例13: cot_url
$c = $karmaarr[1];
$view_url = $karmaarr[0] ? cot_url('page', 'al=' . $karmaarr[0]) : cot_url('page', 'id=' . $row['karma_fp']);
$view_title = $L['karma_page'];
} elseif ($row['karma_locate'] == "com") {
$karmaarr = explode(":", $row['karma_al_name']);
$view_title = $L['karma_com'];
if ($karmaarr[2] == 'page' || empty($karmaarr[2]) && $karmaarr[0]) {
// page
$c = $karmaarr[1];
$view_url = $karmaarr[0] ? cot_url('page', 'al=' . $karmaarr[0], '#c' . $row['com_id']) : cot_url('page', $karmaarr[3], "#c" . $row['com_id']);
} elseif ($karmaarr[2] && $karmaarr[3]) {
// другой модуль/ плагин
$view_url = cot_url($karmaarr[2], $karmaarr[3], '#c' . $row['com_id']);
}
}
$kr->assign(array("KARMA_USER" => "<a href=\"" . cot_url('users', 'm=details&id=' . $row['user_id'] . '&u=' . $row['user_name']) . "\" target=_blank>" . $row['user_name'] . "</a>", "KARMA_VALUE" => abs($row['karma_value']), "KARMA_CLASS" => $row['karma_value'] < 0 ? "style=\"background:#aa0000\"" : "", "KARMA_TEXT" => cot_parse($row['karma_text']), "KARMA_VIEW_URL" => $view_url, "KARMA_VIEW_TITLE" => $view_title, "KARMA_ADMIN_URL" => cot_url('plug', 'r=karma&act=moderate&fp=' . $row['karma_id'] . '&ku=' . $fp), "KARMA_ADMIN_URL_AJAX" => "OnClick = \"if(confirm('" . $L['Delete'] . "?')){return ajaxSend({ url: '" . cot_url('plug', 'r=karma&act=moderate&fp=' . $row['karma_id'] . '&ku=' . $fp) . "', divId: 'karma_popup', errMsg: '" . $L['ajaxSenderror'] . "' });}else{return false;} \""));
if ($cfg['plugin']['karma']['karma_profile']) {
$kr->assign(cot_generate_usertags($row, "KARMA_USER_"));
}
$kr->parse("MAIN.SHOW.SHOW_ROW");
}
}
$kr->parse("MAIN.SHOW");
if ($aj) {
$popup_body .= $kr->text("MAIN.SHOW");
} else {
$kr->parse("MAIN");
$popup_body .= $kr->text("MAIN");
}
break;
}
示例14: cot_getextplugins
$t->parse('MAIN.POLLS_VIEW');
$extra = $L['polls_notyetvoted'];
if ($alreadyvoted) {
$extra = $votecasted ? $L['polls_votecasted'] : $L['polls_alreadyvoted'];
}
$t->assign(array('POLLS_EXTRATEXT' => $extra));
$t->parse('MAIN.POLLS_EXTRA');
} else {
$jj = 0;
$sql = $db->query("SELECT * FROM {$db_polls} WHERE poll_state = 0 AND poll_type = 'index' ORDER BY poll_id DESC");
/* === Hook - Part1 === */
$extp = cot_getextplugins('polls.viewall.tags');
/* ===== */
foreach ($sql->fetchAll() as $row) {
$jj++;
$t->assign(array('POLL_DATE' => cot_date('date_full', $row['poll_creationdate']), 'POLL_DATE_STAMP' => $row['poll_creationdate'], 'POLL_HREF' => cot_url('polls', 'id=' . $row['poll_id']), 'POLL_TEXT' => cot_parse($row['poll_text'], $cfg['polls']['markup']), 'POLL_NUM' => $jj, 'POLL_ODDEVEN' => cot_build_oddeven($jj)));
/* === Hook - Part2 === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.POLLS_VIEWALL.POLL_ROW');
}
if ($jj == 0) {
$t->parse('MAIN.POLLS_VIEWALL.POLL_NONE');
}
$t->parse('MAIN.POLLS_VIEWALL');
}
/* === Hook === */
foreach (cot_getextplugins('polls.tags') as $pl) {
include $pl;
示例15: 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;
}