本文整理汇总了PHP中cot_tplfile函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_tplfile函数的具体用法?PHP cot_tplfile怎么用?PHP cot_tplfile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_tplfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cot_ukarma
function cot_ukarma($userid, $area = 'users', $code = '', $onlyscore = false)
{
global $db, $cfg, $db_ukarma, $db_users;
if ($area == 'users' && $db->fieldExists($db_users, "user_ukarma")) {
$score = $db->query("SELECT user_ukarma FROM {$db_users} WHERE user_id=" . $userid)->fetchColumn();
} else {
$where['ukarma_userid'] = "ukarma_userid=" . $userid;
if (!empty($area) && $area != 'users') {
$where['ukarma_area'] = "ukarma_area='" . $area . "'";
}
if (!empty($code)) {
$where['ukarma_code'] = "ukarma_code='" . $code . "'";
}
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$score = $db->query("SELECT SUM(ukarma_value) FROM {$db_ukarma} {$where}")->fetchColumn();
}
if ($onlyscore) {
return !empty($score) ? $score : 0;
}
if ($score > 0) {
$sign = '+';
} elseif ($score < 0) {
$sign = '-';
}
$t = new XTemplate(cot_tplfile(array('ukarma', $area), 'plug'));
$t->assign(cot_generate_usertags($userid, 'UKARMA_USER_'));
$t->assign(array('UKARMA_AREA' => $area, 'UKARMA_CODE' => $code, 'UKARMA_SELECTOR' => 'ukarma_' . $userid . $area . $code, 'UKARMA_SCOREENABLED' => cot_ukarma_checkenablescore($userid, $area, $code), 'UKARMA_SCORE' => !empty($score) ? $score : 0, 'UKARMA_SCORE_ABS' => !empty($score) ? abs($score) : 0, 'UKARMA_SIGN' => $sign));
$t->parse('MAIN');
return $t->text('MAIN');
}
示例2: indexAction
public function indexAction()
{
global $structure;
if (!cot_module_active('rss')) {
cot_die_message(404, TRUE);
}
$c = cot_import('c', 'G', 'TXT');
if (!empty($c)) {
if (!isset($structure['advboard'][$c])) {
cot_die_message(404, TRUE);
}
list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c);
cot_block(cot::$usr['auth_read']);
}
$rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle'];
$rss_link = cot::$cfg['mainurl'];
$rss_description = cot::$cfg['subtitle'];
$domain = cot::$sys['domain'];
$condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now']));
if (!empty($c)) {
$rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle'];
$condition[] = array('category', $c);
}
$advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc')));
$t = new XTemplate(cot_tplfile('rss'));
$now = cot::$sys['now'];
$now += cot::$usr['timezone'] * 3600;
$t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now))));
if (!empty($advertisement)) {
foreach ($advertisement as $advert) {
$url = $advert->url;
if (!cot_url_check($url)) {
$url = COT_ABSOLUTE_URL . $url;
}
$date = '';
if (!empty($advert->created)) {
$date = strtotime($advert->created);
$date += cot::$usr['timezone'] * 3600;
$date = date('r', $date);
$date = $this->fixPubDate($date);
}
$text = $advert->text;
$textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']);
if ($textlength > 0 && mb_strlen($text) > $textlength) {
$text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']);
}
$t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url));
$t->parse('MAIN.ITEM_ROW');
}
}
$t->parse('MAIN');
// ob_clean();
header('Content-type: text/xml; charset=UTF-8');
echo $t->text('MAIN');
exit;
}
示例3: form_structure_editor
function form_structure_editor($id)
{
global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R;
$row = $cot_structure->category($id);
if (empty($row)) {
return null;
}
$ii++;
$structure_id = $row['structure_id'];
$structure_code = $row['structure_code'];
$n = $row['structure_area'];
$dozvil = $row['structure_count'] > 0 ? false : true;
$is_module = cot_module_active($n);
$t = new XTemplate(cot_tplfile('cateditor.admin.edit', 'plug'));
$t->assign(array('ADMIN_STRUCTURE_HEADER' => $row['structure_title'], 'ADMIN_STRUCTURE_DEL_URL' => $dozvil ? cot_confirm_url(cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=delete&id=' . $row['structure_id'] . '&' . cot_xg()), 'admin') : '', 'ADMIN_STRUCTURE_UPDATE_FORM_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&id=' . $structure_id . '&a=update'), 'ADMIN_STRUCTURE_ID' => $row['structure_id'], 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', $structure_code, 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_PATHFIELDIMG' => mb_strpos($row['structure_path'], '.') == 0 ? $R['admin_icon_join1'] : $R['admin_icon_join2'], 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath', $row['structure_path'], 'size="12" maxlength="255"'), 'ADMIN_STRUCTURE_TPL' => cot_inputbox('text', 'rstructuretpl', $row['structure_tpl'], 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', $row['structure_title'], 'size="32" maxlength="255"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', $row['structure_desc'], 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', $row['structure_icon'], 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox($row['structure_locked'], 'rstructurelocked'), 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($cot_structure->get_parent($id), 'rstructureparent', true, 'disabled="disabled"'), 'ADMIN_STRUCTURE_JUMPTO_URL' => cot_url($n, 'c=' . $structure_code), 'ADMIN_STRUCTURE_RIGHTS_URL' => $is_module ? cot_url('admin', 'm=rightsbyitem&ic=' . $n . '&io=' . $structure_code) : '', 'ADMIN_STRUCTURE_ODDEVEN' => cot_build_oddeven($ii)));
foreach ($cot_extrafields[$db_structure] as $exfld) {
$exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, $row['structure_' . $exfld['field_name']]);
$exfld_title = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) => $exfld_val, 'ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) . '_TITLE' => $exfld_title, 'ADMIN_STRUCTURE_EXTRAFLD' => $exfld_val, 'ADMIN_STRUCTURE_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
require_once cot_incfile('configuration');
$optionslist = cot_config_list($is_module ? 'module' : 'plug', $n, $structure_code);
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.config.edit.loop');
/* ===== */
foreach ($optionslist as $row_c) {
list($title, $hint) = cot_config_titles($row_c['config_name'], $row_c['config_text']);
if ($row_c['config_type'] == COT_CONFIG_TYPE_SEPARATOR) {
$t->assign('ADMIN_CONFIG_FIELDSET_TITLE', $title);
$t->parse('MAIN.OPTIONS.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_FIELDSET_BEGIN');
} else {
$t->assign(array('ADMIN_CONFIG_ROW_CONFIG' => cot_config_input($row_c['config_name'], $row_c['config_type'], $row_c['config_value'], $row_c['config_variants']), 'ADMIN_CONFIG_ROW_CONFIG_TITLE' => $title, 'ADMIN_CONFIG_ROW_CONFIG_MORE_URL' => cot_url('admin', 'm=structure&n=' . $n . '&d=' . $durl . '&id=' . $structure_id . '&al=' . $structure_code . '&a=reset&v=' . $row_c['config_name'] . '&' . cot_xg()), 'ADMIN_CONFIG_ROW_CONFIG_MORE' => $hint));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_ROW_OPTION');
}
$t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW');
}
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.tags') as $pl) {
include $pl;
}
/* ===== */
$t->assign('CONFIG_HIDDEN', cot_inputbox('hidden', 'editconfig', $structure_code));
$t->parse('MAIN.CONFIG');
$t->parse('MAIN');
return $t->text('MAIN');
}
示例4: share
function share()
{
global $cfg;
if ($cfg['jquery']) {
$t = new XTemplate(cot_tplfile('share', 'plug'));
if ($cfg['plugin']['share']['sh_counter']) {
$t->assign(array('SHARE_GP_COUNTER' => '<q data-counter="gp"></q>', 'SHARE_VK_COUNTER' => '<q data-counter="vk"></q>', 'SHARE_FB_COUNTER' => '<q data-counter="fb"></q>', 'SHARE_MR_COUNTER' => '<q data-counter="mr"></q>', 'SHARE_LI_COUNTER' => '<q data-counter="li"></q>', 'SHARE_OK_COUNTER' => '<q data-counter="ok"></q>', 'SHARE_TM_COUNTER' => '<q data-counter="tm"></q>', 'SHARE_PT_COUNTER' => '<q data-counter="pt"></q>', 'SHARE_RD_COUNTER' => '<q data-counter="rd"></q>', 'SHARE_SU_COUNTER' => '<q data-counter="su"></q>', 'SHARE_PO_COUNTER' => '<q data-counter="po"></q>', 'SHARE_BF_COUNTER' => '<q data-counter="bf"></q>', 'SHARE_XI_COUNTER' => '<q data-counter="xi"></q>'));
}
$t->assign(array('SHARE_MESSAGERS' => $cfg['plugin']['share']['sh_messagers'], 'SHARE_SIZE' => 'sh-' . $cfg['plugin']['share']['sh_size']));
$t->parse('MAIN');
return $t->text('MAIN');
}
}
示例5: cot_get_topusers
function cot_get_topusers($maingrp, $count, $sqlsearch = '', $tpl = 'index')
{
global $L, $cfg, $db, $db_users;
$t1 = new XTemplate(cot_tplfile(array('userpoints', $tpl), 'plug'));
$sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : '';
$topusers = $db->query("SELECT * FROM {$db_users}\n\t\tWHERE user_userpoints>0 AND user_maingrp=" . $maingrp . " {$sqlsearch} ORDER BY user_userpoints DESC LIMIT " . $count)->fetchAll();
foreach ($topusers as $tur) {
$t1->assign(cot_generate_usertags($tur, 'TOP_ROW_'));
$t1->parse('MAIN.TOP_ROW');
}
$t1->parse('MAIN');
return $t1->text('MAIN');
}
示例6: karma_gadget
function karma_gadget($user_id, $user_karma, $location, $location_id, $module = false)
{
global $usr, $cfg, $karma_cache, $color;
$color = explode(",", $cfg['plugin']['karma']['karma_color']);
if (!$karma_cache[$user_id]) {
$negative = !$cfg['plugin']['karma']['neg_rec'] && $usr['profile']['user_karma'] < 0 ? false : true;
$k_add = cot_auth('plug', 'karma', 'W') && $usr['id'] > 0 && $location != 'self' ? true : "";
$karmat = new XTemplate(cot_tplfile(array('karma', 'gadget'), true));
$module = urlencode($module);
$karmat->assign(array("PAGE_KARMA_D" => number_format($user_karma, '1', '.', ' '), "PAGE_KARMA_ADD" => $user_id != $usr['id'] && $k_add ? cot_url('plug', 'r=karma&act=change&lct=' . $location . '&value=add&fp=' . $location_id . '&mod=' . $module) : false, "PAGE_KARMA_DEL" => $user_id != $usr['id'] && $negative && $k_add ? cot_url('plug', 'r=karma&act=change&lct=' . $location . '&value=del&fp=' . $location_id . '&mod=' . $module) : false, "PAGE_KARMA_URL" => $k_add || $location == 'self' ? cot_url('plug', 'r=karma&act=show&fp=' . $user_id) : false, "PAGE_KARMA_MINI" => $cfg['plugin']['karma']['karma_com'] ? '' : 'karma_mini'));
$karmat->parse('MAIN');
$karma_cache[$user_id] = $karmat->text('MAIN');
}
return $karma_cache[$user_id];
}
示例7: form_structure_new
function form_structure_new($parentid = '')
{
global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R;
$t = new XTemplate(cot_tplfile('cateditor.admin.new', 'plug'));
$t->assign(array('ADMIN_STRUCTURE_URL_FORM_ADD' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=add'), 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', null, 'size="16"'), 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($parentid, 'rstructureparent'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', null, 'size="64" maxlength="100"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', null, 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', null, 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox(null, 'rstructurelocked'), 'ADMIN_STRUCTURE_TPL' => cot_inputbox('text', 'rstructuretpl', null, 'size="10" maxlength="255"')));
// Extra fields
foreach ($cot_extrafields[$db_structure] as $exfld) {
$exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, null);
$exfld_title = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) => $exfld_val, 'ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) . '_TITLE' => $exfld_title, 'ADMIN_STRUCTURE_EXTRAFLD' => $exfld_val, 'ADMIN_STRUCTURE_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
$t->parse('MAIN');
return $t->text('MAIN');
}
示例8: cot_get_paytop
function cot_get_paytop($area = '', $count = 0, $order = "s.service_id DESC")
{
global $db, $cfg, $sys, $db_payments_services, $db_users;
$pt_cfg = cot_cfg_paytop();
if ($count == 0) {
$count = $pt_cfg[$area]['count'];
}
if (empty($area) && !isset($pt_cfg[$area]['cost'])) {
return false;
}
$t1 = new XTemplate(cot_tplfile(array('paytop', 'list', $area), 'plug'));
$paytopcount = $db->query("SELECT COUNT(*) FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'])->fetchColumn();
$paytops = $db->query("SELECT * FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'] . " ORDER BY {$order} LIMIT " . $count)->fetchAll();
$jj = 0;
foreach ($paytops as $tur) {
$jj++;
$t1->assign(cot_generate_usertags($tur, 'TOP_ROW_'));
$t1->assign(array('TOP_ROW_JJ' => $jj, 'TOP_ROW_EXPIRE' => $tur['service_expire']));
$t1->parse('MAIN.TOP_ROW');
}
$t1->assign(array('PAYTOP_BUY_URL' => cot_url('plug', 'e=paytop&area=' . $area), 'PAYTOP_COUNT' => $paytopcount));
$t1->parse('MAIN');
return $t1->text('MAIN');
}
示例9: defined
<?php
/**
* [BEGIN_COT_EXT]
* Hooks=tools
* [END_COT_EXT]
*/
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('paytop', 'plug');
$pt_cfg = cot_cfg_paytop();
$t = new XTemplate(cot_tplfile('paytop.admin', 'plug', true));
$id = cot_import('id', 'G', 'INT');
if ($a == 'add') {
$username = cot_import('username', 'P', 'TXT', 100, TRUE);
$area = cot_import('area', 'P', 'ALP');
$times = cot_import('times', 'P', 'INT');
$urr_id = $db->query("SELECT user_id FROM {$db_users} WHERE user_name='" . $username . "'")->fetchColumn();
cot_check(empty($username), 'paytop_error_username');
cot_check(empty($urr_id), 'paytop_error_userempty');
cot_check(empty($times), 'paytop_error_timesempty');
cot_check(empty($area), 'paytop_error_areaempty');
if (!cot_error_found()) {
cot_payments_userservice('paytop.' . $area, $urr_id, $times * $pt_cfg[$area]['period']);
/* === Hook === */
foreach (cot_getextplugins('paytop.done') as $pl) {
include $pl;
}
/* ===== */
/* === Hook === */
foreach (cot_getextplugins('paytop.' . $area . '.done') as $pl) {
include $pl;
示例10: cot_rc
$rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', 'id=' . $id, '', true)));
cot_mail($item['user_email'], $L['project_added_mail_subj'], $rbody);
}
}
$db->update($db_projects, $prj, "item_id=" . (int) $id);
cot_projects_sync($item['item_cat']);
/* === Hook === */
foreach (cot_getextplugins('projects.preview.save.done') as $pl) {
include $pl;
}
/* ===== */
cot_redirect($r_url);
exit;
}
$out['subtitle'] = $L['projects'];
$mskin = cot_tplfile(array('projects', 'preview', $structure['projects'][$item['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('projects.preview.main') as $pl) {
include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
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;
}
$r_url = empty($item['item_alias']) ? cot_url('projects', 'c=' . $item['item_cat'] . '&id=' . $id) : cot_url('projects', 'c=' . $item['item_cat'] . '&al=' . $item['item_alias']);
$t->assign(cot_generate_usertags($item, 'PRJ_OWNER_'));
$t->assign(cot_generate_projecttags($item, 'PRJ_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
$t->assign(array("PRJ_SHOW_URL" => $cfg['mainurl'] . '/' . $r_url, "PRJ_SAVE_URL" => cot_url('projects', 'm=preview&a=save&id=' . $item['item_id'] . '&' . cot_xg()), "PRJ_EDIT_URL" => cot_url('projects', 'm=edit&id=' . $item['item_id'])));
示例11: cot_redirect
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 === */
foreach (cot_getextplugins('folio.tags') as $pl) {
include $pl;
}
/* ===== */
if ($usr['isadmin']) {
$t->parse('MAIN.PRD_ADMIN');
示例12: cot_redirect
}
/* ===== */
cot_redirect(cot_url('message', 'msg=109', '', true));
}
} elseif ($row['user_maingrp'] == -1) {
$sql = $db->update($db_users, array('user_maingrp' => $row['user_sid']), "user_id='" . $row['user_id'] . "' AND user_lostpass='{$v}'");
cot_redirect(cot_url('message', 'msg=106', '', true));
}
} else {
$env['status'] = '403 Forbidden';
cot_shield_update(7, "Account validation");
cot_log("Wrong validation URL", 'sec');
cot_redirect(cot_url('message', 'msg=157', '', true));
}
}
$mskin = cot_tplfile('users.register', 'module');
/* === Hook === */
foreach (cot_getextplugins('users.register.main') as $pl) {
include $pl;
}
/* ===== */
$out['subtitle'] = $L['aut_registertitle'];
$out['head'] .= $R['code_noindex'];
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$t->assign(array('USERS_REGISTER_TITLE' => $L['aut_registertitle'], 'USERS_REGISTER_SUBTITLE' => $L['aut_registersubtitle'], 'USERS_REGISTER_ADMINEMAIL' => $cot_adminemail, 'USERS_REGISTER_SEND' => cot_url('users', 'm=register&a=add'), 'USERS_REGISTER_USER' => cot_inputbox('text', 'rusername', $ruser['user_name'], array('size' => 24, 'maxlength' => 100)), 'USERS_REGISTER_EMAIL' => cot_inputbox('text', 'ruseremail', $ruser['user_email'], array('size' => 24, 'maxlength' => 64)), 'USERS_REGISTER_PASSWORD' => cot_inputbox('password', 'rpassword1', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_PASSWORDREPEAT' => cot_inputbox('password', 'rpassword2', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_COUNTRY' => cot_selectbox_countries($ruser['user_country'], 'rcountry'), 'USERS_REGISTER_TIMEZONE' => cot_selectbox_timezone($ruser['user_timezone'], 'rusertimezone'), 'USERS_REGISTER_GENDER' => cot_selectbox_gender($ruser['user_gender'], 'rusergender'), 'USERS_REGISTER_BIRTHDATE' => cot_selectbox_date(0, 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false)));
// Extra fields
if (!empty(cot::$extrafields[cot::$db->users])) {
foreach (cot::$extrafields[cot::$db->users] as $exfld) {
$uname = strtoupper($exfld['field_name']);
示例13: cot_poll_form
/**
* Generates Poll form
*
* @param int $id Poll ID or Poll Code if $type is not epmty
* @param string $formlink Poll form url
* @param string $theme Poll template name
* @param string $type Poll type
* @return array
* @global CotDB $db
*/
function cot_poll_form($id, $formlink = '', $theme = '', $type = '')
{
global $db, $cfg, $db_polls, $db_polls_options, $db_polls_voters, $usr;
$canvote = false;
if (!is_array($id)) {
$id = (int) $id;
$where = !$type ? "poll_id = {$id}" : "poll_type = '" . $db->prep($type) . "' AND poll_code = '{$id}'";
$sql = $db->query("SELECT * FROM {$db_polls} WHERE {$where} LIMIT 1");
if (!($row = $sql->fetch())) {
return false;
}
} else {
$row = $id;
}
$id = $row['poll_id'];
$alreadyvoted = 0;
if ($cfg['polls']['ip_id_polls'] == 'id' && $usr['id'] > 0) {
$where = "pv_userid = '" . $usr['id'] . "'";
$canvote = true;
} else {
$where = $usr['id'] > 0 ? "(pv_userid = '" . $usr['id'] . "' OR pv_userip = '" . $usr['ip'] . "')" : "pv_userip = '" . $usr['ip'] . "'";
$canvote = true;
}
$sql2 = $db->query("SELECT pv_id FROM {$db_polls_voters} WHERE pv_pollid = {$id} AND {$where} LIMIT 1");
$alreadyvoted = $sql2->rowCount() == 1 ? 1 : 0;
$themefile = cot_tplfile(array('polls', $theme), 'module');
$t = new XTemplate($themefile);
if ($alreadyvoted) {
$poll_block = 'POLL_VIEW_VOTED';
} elseif (!$canvote) {
$poll_block = 'POLL_VIEW_DISABLED';
} elseif ($row['poll_state']) {
$poll_block = 'POLL_VIEW_LOCKED';
} else {
$poll_block = 'POLL_VIEW';
}
$sql2 = $db->query("SELECT SUM(po_count) FROM {$db_polls_options} WHERE po_pollid = {$id}");
$totalvotes = $sql2->fetchColumn();
$sql1 = $db->query("SELECT po_id, po_text, po_count FROM {$db_polls_options} WHERE po_pollid = {$id} ORDER by po_id ASC");
while ($row1 = $sql1->fetch()) {
$po_id = $row1['po_id'];
$po_count = $row1['po_count'];
$percent = @round(100 * ($po_count / $totalvotes), 1);
$input_type = $row['poll_multiple'] ? 'checkbox' : 'radio';
$polloptions_input = $alreadyvoted || !$canvote ? "" : '<input type="' . $input_type . '" name="vote[]" value="' . $po_id . '" /> ';
// TODO - to resorses
$polloptions = cot_parse($row1['po_text'], $cfg['polls']['markup']);
$t->assign(array('POLL_OPTIONS' => $polloptions, 'POLL_PER' => $percent, 'POLL_COUNT' => $po_count, 'POLL_INPUT' => $polloptions_input));
$t->parse($poll_block . ".POLLTABLE");
}
$sql1->closeCursor();
$t->assign(array('POLL_VOTERS' => $totalvotes, 'POLL_SINCE' => cot_date('datetime_medium', $row['poll_creationdate']), 'POLL_SINCE_STAMP' => $row['poll_creationdate'], 'POLL_SINCE_SHORT' => cot_date('date_short', $row['poll_creationdate']), 'POLL_TITLE' => cot_parse($row['poll_text'], $cfg['polls']['markup']), 'POLL_ID' => $id, 'POLL_FORM_URL' => empty($formlink) ? cot_url('polls', 'id=' . $id) : $formlink, 'POLL_FORM_BUTTON' => $pollbutton));
$t->parse($poll_block);
$row['poll_alreadyvoted'] = $alreadyvoted;
$row['poll_count'] = $totalvotes;
$row['poll_block'] = $t->text($poll_block);
return $row;
}
示例14: defined
/* ====================
[BEGIN_COT_EXT]
Hooks=admin.config.edit.loop
[END_COT_EXT]
==================== */
/**
* news admin usability modification
*
* @package News
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('page', 'module');
if ($p == 'news' && $row['config_name'] == 'category' && $cfg['jquery']) {
$sskin = cot_tplfile('news.admin', 'plug', true);
$tt = new XTemplate($sskin);
$categories = explode(',', $row['config_value']);
$jj = 0;
foreach ($categories as $k => $v) {
$v = explode('|', trim($v));
if (isset($structure['page'][$v[0]])) {
$jj++;
$tt->assign(array('ADDNUM' => $jj, 'ADDCATEGORY' => $v[0], 'ADDCOUNT' => (int) $v[1] > 0 ? $v[1] : $cfg['plugin']['news']['maxpages'], 'ADDCUT' => (int) $v[2] > 0 ? $v[2] : ''));
$tt->parse('MAIN.ADDITIONAL');
}
}
if ($jj == 0) {
$tt->assign(array('ADDNUM' => 1, 'ADDCATEGORY' => '', 'ADDCOUNT' => $cfg['plugin']['news']['maxpages'], 'ADDCUT' => ''));
$tt->parse('MAIN.ADDITIONAL');
}
示例15: empty
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
$rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
cot_mail($offer['user_email'], $rsubject, $rbody);
}
cot_message($L['offers_add_post'], 'ok');
/* === Hook === */
foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
include $pl;
}
/* ===== */
}
cot_redirect(cot_url('projects', 'id=' . $id, '', true));
exit;
}
$t_o = new XTemplate(cot_tplfile(array('projects', 'offers', $structure['projects'][$item['item_cat']]['tpl'])));
// Вычисление выбранного исполнителя по проекту
if ($item['item_performer']) {
$t_o->assign(cot_generate_usertags($item['item_performer'], 'PRJ_PERFORMER_'));
}
$where = array();
$order = array();
// Показать не автору только видимые проедложения:
if ($usr['id'] != $item['item_userid'] && !$usr['isadmin']) {
$where['forshow'] = "(o.offer_hidden!=1 OR o.offer_userid=" . $usr['id'] . ")";
}
// ==================================================
$where['pid'] = "o.offer_pid=" . $id;
$order['date'] = "o.offer_date DESC";
$query_limit = $cfg['projects']['offersperpage'] > 0 ? "LIMIT {$d}, " . $cfg['projects']['offersperpage'] : '';
/* === Hook === */