本文整理汇总了PHP中cot_build_extrafields函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_build_extrafields函数的具体用法?PHP cot_build_extrafields怎么用?PHP cot_build_extrafields使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_build_extrafields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: 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');
}
示例3: XTemplate
$t = new XTemplate($mskin);
cot_display_messages($t);
if ($db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) {
$t->assign(array('FORUMS_EDITPOST_TOPICTITTLE' => cot_inputbox('text', 'rtopictitle', $rowt['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_EDITPOST_TOPICDESCRIPTION' => cot_inputbox('text', 'rtopicdesc', $rowt['ft_desc'], array('size' => 56, 'maxlength' => 255))));
// Extra fields
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rowt['ft_' . $exfld['field_name']]);
$exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('FORUMS_EDITPOST_TOPIC_' . $uname => $exfld_val, 'FORUMS_EDITPOST_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST.TOPIC_EXTRAFLD');
}
$t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST');
}
$t->assign(array('FORUMS_EDITPOST_PAGETITLE' => $toptitle, 'FORUMS_EDITPOST_SUBTITLE' => $L['forums_postedby'] . ": <a href=\"users.php?m=details&id=" . $rowpost['fp_posterid'] . "\">" . $rowpost['fp_postername'] . "</a> @ " . cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED' => cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED_STAMP' => $rowpost['fp_updated'], 'FORUMS_EDITPOST_SEND' => cot_url('forums', "m=editpost&a=update&s=" . $s . "&q=" . $q . "&p=" . $p . '&d=' . $durl . "&" . cot_xg()), 'FORUMS_EDITPOST_TEXT' => cot_textarea('rmsgtext', $rowpost['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_EDITPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
// Extra fields
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rowpost['fp_' . $exfld['field_name']]);
$exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('FORUMS_EDITPOST_' . $uname => $exfld_val, 'FORUMS_EDITPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
/* === Hook === */
foreach (cot_getextplugins('forums.editpost.tags') as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
示例4: object_edittags
public function object_edittags($mavatar, $prefix = "mavatar_")
{
global $db_mavatars, $cot_extrafields;
$curr_mavatar = array('MAVATAR' => $this->object_tags($mavatar), 'ENABLED' => cot_checkbox(true, $prefix . 'enabled[' . $mavatar['id'] . ']', '', 'title="' . $L['Enabled'] . '"'), 'FILEORDER' => cot_inputbox('text', $prefix . 'order[' . $mavatar['id'] . ']', $mavatar['order'], 'maxlength="4" size="4"'), 'FILEDESC' => cot_inputbox('text', $prefix . 'desc[' . $mavatar['id'] . ']', $mavatar['desc']), 'FILEDESCTEXT' => cot_textarea($prefix . 'desc[' . $mavatar['id'] . ']', $mavatar['desc'], 2, 30), 'FILENEW' => cot_inputbox('hidden', $prefix . 'new[' . $mavatar['id'] . ']', 0));
foreach ($cot_extrafields[$db_mavatars] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields($prefix . $exfld['field_name'], $exfld, $mavatar[$exfld['field_name']]);
$exfld_title = isset($L['mavatar_' . $exfld['field_name'] . '_title']) ? $L['mavatar_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$curr_mavatar[$uname] = $exfld_val;
$curr_mavatar[$uname . '_TITLE'] = $exfld_title;
}
return $curr_mavatar;
}
示例5: cot_tplfile
require_once $cfg['system_dir'] . '/header.php';
$mskin = cot_tplfile(array('forums', 'newtopic', $structure['forums'][$s]['tpl']));
$t = new XTemplate($mskin);
$t->assign(array('FORUMS_NEWTOPIC_PAGETITLE' => $toptitle, 'FORUMS_NEWTOPIC_SUBTITLE' => htmlspecialchars(cot_parse_autourls($structure['forums'][$s]['desc'])), 'FORUMS_NEWTOPIC_SEND' => cot_url('forums', "m=newtopic&a=newtopic&s=" . $s), 'FORUMS_NEWTOPIC_TITLE' => cot_inputbox('text', 'rtopictitle', $rtopic['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_DESC' => cot_inputbox('text', 'rtopicdesc', $rtopic['ft_desc'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_TEXT' => cot_textarea('rmsgtext', $rmsg['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_NEWTOPIC_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
// Extra fields
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg['fp_' . $exfld['field_name']]);
$exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('FORUMS_NEWTOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
// Extra fields
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rtopic['ft_' . $exfld['field_name']]);
$exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('FORUMS_NEWTOPIC_TOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.TOPIC_EXTRAFLD');
}
if ($cfg['forums']['cat_' . $s]['allowprvtopics']) {
$t->assign('FORUMS_NEWTOPIC_ISPRIVATE', cot_checkbox($rtopic['ft_mode'], 'rtopicmode'));
$t->parse('MAIN.PRIVATE');
}
/* === Hook === */
foreach (cot_getextplugins('forums.newtopic.tags') as $pl) {
include $pl;
}
/* ===== */
cot_display_messages($t);
$t->parse('MAIN');
示例6: cot_comments_display
/**
* Generates comments display for a given item
*
* @param string $ext_name Module or plugin code
* @param string $code Item identifier
* @param string $cat Item category code (optional)
* @param bool $force_admin Enforces user to be administrator of comments for this item.
* E.g. to moderate his wall even if he is not a moderator
* @return string Rendered HTML output for comments
* @global CotDB $db
*/
function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false)
{
global $db, $db_com, $db_users, $cfg, $usr, $L, $sys, $R, $env, $pg, $cot_extrafields, $cache, $structure;
// Check permissions and enablement
list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'comments');
if ($auth_read && $auth_write && $force_admin) {
$auth_admin = true;
$_SESSION['cot_comments_force_admin'][$ext_name][$code] = true;
}
$enabled = cot_comments_enabled($ext_name, $cat, $code);
if (!$auth_read || !$enabled && !$auth_admin) {
return '';
}
$comments_join_columns = $comments_join_tables = $comments_join_where = '';
// Get the URL and parameters
$link_area = $env['ext'];
$link_params = $_GET;
if (defined('COT_PLUG')) {
$link_area = 'plug';
$link_params['e'] = $env['ext'];
}
if (isset($_GET['rwr'])) {
unset($link_params['rwr'], $link_params['e']);
}
$cot_com_back = array($link_area, $link_params);
$_SESSION['cot_com_back'][$ext_name][$cat][$code] = $cot_com_back;
$d_var = 'dcm';
list($pg, $d, $durl) = cot_import_pagenav($d_var, $cfg['plugin']['comments']['maxcommentsperpage']);
$d = empty($d) ? 0 : (int) $d;
if ($auth_write && $enabled) {
require_once cot_incfile('forms');
}
$t = new XTemplate(cot_tplfile('comments', 'plug'));
/* == Hook == */
foreach (cot_getextplugins('comments.main') as $pl) {
include $pl;
}
/* ===== */
$editor = cot::$cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : '';
$t->assign(array('COMMENTS_CODE' => $code, 'COMMENTS_FORM_SEND' => cot_url('plug', "e=comments&a=send&area={$ext_name}&cat={$cat}&item={$code}"), 'COMMENTS_FORM_AUTHOR' => $usr['id'] > 0 ? $usr['name'] : cot_inputbox('text', 'rname'), 'COMMENTS_FORM_AUTHORID' => $usr['id'], 'COMMENTS_FORM_TEXT' => $auth_write && $enabled ? cot_textarea('rtext', $rtext, 7, 120, '', $editor) . cot_inputbox('hidden', 'cb', base64_encode(serialize($cot_com_back))) : '', 'COMMENTS_DISPLAY' => $cfg['plugin']['comments']['expand_comments'] ? '' : 'none'));
if ($auth_write && $enabled) {
// Extra fields
if (!empty(cot::$extrafields[cot::$db->com])) {
foreach (cot::$extrafields[cot::$db->com] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $rcomments[$exfld['field_name']]);
$exfld_title = cot_extrafield_title($exfld, 'comments_');
$t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('COMMENTS.COMMENTS_NEWCOMMENT.EXTRAFLD');
}
}
$allowed_time = cot_build_timegap($sys['now'] - $cfg['plugin']['comments']['time'] * 60, $sys['now']);
$com_hint = cot_rc('com_edithint', array('time' => $allowed_time));
/* == Hook == */
foreach (cot_getextplugins('comments.newcomment.tags') as $pl) {
include $pl;
}
/* ===== */
$usr['id'] == 0 && $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.GUEST');
if ($usr['id'] == 0 && cot_check_messages() && $cache) {
if ($ext_name == 'page' && $cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$cat]['path']));
$cfg['cache_page'] = false;
}
}
cot_display_messages($t, 'COMMENTS.COMMENTS_NEWCOMMENT');
$t->assign('COMMENTS_FORM_HINT', $com_hint);
$t->parse('COMMENTS.COMMENTS_NEWCOMMENT');
} else {
$warning = $enabled ? $L['com_regonly'] : $L['com_closed'];
$t->assign('COMMENTS_CLOSED', $warning);
$t->parse('COMMENTS.COMMENTS_CLOSED');
}
$order = $cfg['plugin']['comments']['order'] == 'Chronological' ? 'ASC' : 'DESC';
$comments_order = "com_id {$order}";
/* == Hook == */
foreach (cot_getextplugins('comments.query') as $pl) {
include $pl;
}
/* ===== */
$sql = $db->query("SELECT c.*, u.* {$comments_join_columns}\n\t\tFROM {$db_com} AS c LEFT JOIN {$db_users} AS u ON u.user_id = c.com_authorid {$comments_join_tables}\n\t\tWHERE com_area = ? AND com_code = ? {$comments_join_where} ORDER BY {$comments_order} LIMIT ?, ?", array($ext_name, $code, (int) $d, (int) $cfg['plugin']['comments']['maxcommentsperpage']));
if ($sql->rowCount() > 0 && $enabled) {
$i = $d;
$kk = 0;
$totalitems = cot_comments_count($ext_name, $code);
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('comments.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
//.........这里部分代码省略.........
示例7: cot_tplfile
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['page'][$c]['title'];
$mskin = cot_tplfile(array('page', 'add', $structure['page'][$rpage['page_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('page.add.main') as $pl) {
include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
$pageadd_array = array('PAGEADD_PAGETITLE' => $L['page_addtitle'], 'PAGEADD_SUBTITLE' => $L['page_addsubtitle'], 'PAGEADD_ADMINEMAIL' => "mailto:" . $cfg['adminemail'], 'PAGEADD_FORM_SEND' => cot_url('page', 'm=add&a=add&c=' . $c), 'PAGEADD_FORM_CAT' => cot_selectbox_structure('page', $rpage['page_cat'], 'rpagecat'), 'PAGEADD_FORM_CAT_SHORT' => cot_selectbox_structure('page', $rpage['page_cat'], 'rpagecat', $c), 'PAGEADD_FORM_KEYWORDS' => cot_inputbox('text', 'rpagekeywords', $rpage['page_keywords'], array('size' => '32', 'maxlength' => '255')), 'PAGEADD_FORM_METATITLE' => cot_inputbox('text', 'rpagemetatitle', $rpage['page_metatitle'], array('size' => '64', 'maxlength' => '255')), 'PAGEADD_FORM_METADESC' => cot_textarea('rpagemetadesc', $rpage['page_metadesc'], 2, 64, array('maxlength' => '255')), 'PAGEADD_FORM_ALIAS' => cot_inputbox('text', 'rpagealias', $rpage['page_alias'], array('size' => '32', 'maxlength' => '255')), 'PAGEADD_FORM_TITLE' => cot_inputbox('text', 'rpagetitle', $rpage['page_title'], array('size' => '64', 'maxlength' => '255')), 'PAGEADD_FORM_DESC' => cot_textarea('rpagedesc', $rpage['page_desc'], 2, 64, array('maxlength' => '255')), 'PAGEADD_FORM_AUTHOR' => cot_inputbox('text', 'rpageauthor', $rpage['page_author'], array('size' => '24', 'maxlength' => '100')), 'PAGEADD_FORM_OWNER' => cot_build_user($usr['id'], htmlspecialchars($usr['name'])), 'PAGEADD_FORM_OWNERID' => $usr['id'], 'PAGEADD_FORM_DATE' => cot_selectbox_date($sys['now'], 'long', 'rpagedate'), 'PAGEADD_FORM_BEGIN' => cot_selectbox_date($sys['now'], 'long', 'rpagebegin'), 'PAGEADD_FORM_EXPIRE' => cot_selectbox_date(0, 'long', 'rpageexpire'), 'PAGEADD_FORM_FILE' => cot_selectbox($rpage['page_file'], 'rpagefile', range(0, 2), array($L['No'], $L['Yes'], $L['Members_only']), false), 'PAGEADD_FORM_URL' => cot_inputbox('text', 'rpageurl', $rpage['page_url'], array('size' => '56', 'maxlength' => '255')), 'PAGEADD_FORM_SIZE' => cot_inputbox('text', 'rpagesize', $rpage['page_size'], array('size' => '56', 'maxlength' => '255')), 'PAGEADD_FORM_TEXT' => cot_textarea('rpagetext', $rpage['page_text'], 24, 120, '', 'input_textarea_editor'), 'PAGEADD_FORM_PARSER' => cot_selectbox($cfg['page']['parser'], 'rpageparser', $parser_list, $parser_list, false));
$t->assign($pageadd_array);
// Extra fields
foreach ($cot_extrafields[$db_pages] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rpage' . $exfld['field_name'], $exfld, $rpage['page_' . $exfld['field_name']]);
$exfld_title = isset($L['page_' . $exfld['field_name'] . '_title']) ? $L['page_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('PAGEADD_FORM_' . $uname => $exfld_val, 'PAGEADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'PAGEADD_FORM_EXTRAFLD' => $exfld_val, 'PAGEADD_FORM_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
// Error and message handling
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('page.add.tags') as $pl) {
include $pl;
}
/* ===== */
if ($usr['isadmin']) {
if ($cfg['page']['autovalidate']) {
$usr_can_publish = TRUE;
}
示例8: array
}
if (!empty($pid)) {
$t->assign(cot_generate_projecttags($pid, 'SBR_PROJECT_'));
}
$patharray[] = array(cot_url('sbr'), $L['sbr']);
$patharray[] = array(cot_url('sbr', 'm=add&pid=' . $pid . '&uip=' . $uid), $L['sbr_addtitle']);
$t->assign(array('SBRADD_TITLE' => cot_breadcrumbs($patharray, $cfg['homebreadcrumb'], true), 'SBRADD_SUBTITLE' => $L['sbr_addtitle'], 'SBRADD_ADMINEMAIL' => "mailto:" . $cfg['adminemail'], 'SBRADD_FORM_SEND' => cot_url('sbr', 'm=add&pid=' . $pid . '&uid=' . $uid . '&a=add'), 'SBRADD_FORM_OWNER' => cot_build_user($usr['id'], htmlspecialchars($usr['name'])), 'SBRADD_FORM_OWNERID' => $usr['id'], 'SBRADD_FORM_MAINTITLE' => cot_inputbox('text', 'rsbrtitle', $rsbr['sbr_title'])));
for ($i = 1; $i <= $stagescount; $i++) {
$t->assign(array('STAGEADD_FORM_NUM' => $i, 'STAGEADD_FORM_TITLE' => cot_inputbox('text', 'rstagetitle[' . $i . ']', $rstagetitle[$i]), 'STAGEADD_FORM_TEXT' => cot_textarea('rstagetext[' . $i . ']', $rstagetext[$i], 10, 120, '', 'input_textarea'), 'STAGEADD_FORM_COST' => cot_inputbox('text', 'rstagecost[' . $i . ']', $rstagecost[$i], array('class' => 'stagecost', 'size' => '10', 'maxlength' => '100')), 'STAGEADD_FORM_DAYS' => cot_inputbox('text', 'rstagedays[' . $i . ']', $rstagedays[$i], array('size' => '10', 'maxlength' => '100'))));
/* === Hook === */
foreach (cot_getextplugins('sbr.add.stages.tags') as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.STAGE_ROW');
}
// Extra fields
foreach ($cot_extrafields[$db_sbr] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rsbr' . $exfld['field_name'], $exfld, $rsbr['sbr_' . $exfld['field_name']]);
$exfld_title = isset($L['sbr_' . $exfld['field_name'] . '_title']) ? $L['sbr_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('SBRADD_FORM_' . $uname => $exfld_val, 'SBRADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'SBRADD_FORM_EXTRAFLD' => $exfld_val, 'SBRADD_FORM_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
// Error and message handling
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('sbr.add.tags') as $pl) {
include $pl;
}
/* ===== */
示例9: XTemplate
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_market} AS m {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT m.*, u.* {$join_columns} \n\tFROM {$db_market} AS m {$join_condition}\n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid \n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('market', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('market'), $L['market']);
if (!empty($c)) {
$catpatharray = array_merge($catpatharray, cot_structure_buildpath('market', $c));
}
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("SEARCH_ACTION_URL" => cot_url('market', '', '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_market_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['market_mostrelevant'], $L['market_costasc'], $L['market_costdesc']), false), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, "CATALOG" => cot_build_structure_market_tree('', array($c), 0), "BREADCRUMBS" => $catpath, "CATTITLE" => !empty($c) ? $structure['market'][$c]['title'] : '', "CATDESC" => !empty($c) ? $structure['market'][$c]['desc'] : ''));
foreach ($cot_extrafields[$db_market] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, $shfld[$exfld['field_name']]);
$exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('SEARCH_' . $uname => $exfld_val, 'SEARCH_' . $uname . '_TITLE' => $exfld_title));
}
/* === Hook === */
foreach (cot_getextplugins('market.list.search.tags') as $pl) {
include $pl;
}
/* ===== */
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
$sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('market.list.loop');
示例10: cot_rc
}
}
$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();
}
}
cot::$out['subtitle'] = cot::$L['contact_title'];
cot_display_messages($t);
if (!$sent) {
$t->assign(array('CONTACT_FORM_SEND' => cot_url('plug', 'e=contact&tpl=' . $tplfile), 'CONTACT_FORM_AUTHOR' => cot::$usr['id'] == 0 ? cot_inputbox('text', 'ruser', $rcontact['contact_author'], 'size="24" maxlength="24"') : cot_inputbox('text', 'ruser', cot::$usr['name'], 'size="24" maxlength="24" readonly="readonly"'), 'CONTACT_FORM_EMAIL' => cot_inputbox('text', 'remail', $rcontact['contact_email'], 'size="24"'), 'CONTACT_FORM_SUBJECT' => cot_inputbox('text', 'rsubject', $rcontact['contact_subject'], 'size="24"'), 'CONTACT_FORM_TEXT' => cot_textarea('rtext', $rcontact['contact_text'], 8, 50, 'style="width:90%"')));
// Extra fields
if (!empty(cot::$extrafields[cot::$db->contact])) {
foreach (cot::$extrafields[cot::$db->contact] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rcontact' . $exfld['field_name'], $exfld, $rcontact[$exfld['field_name']]);
$exfld_title = cot_extrafield_title($exfld, 'contact_');
$t->assign(array('CONTACT_FORM_' . $uname => $exfld_val, 'CONTACT_FORM_' . $uname . '_TITLE' => $exfld_title, 'CONTACT_FORM_EXTRAFLD' => $exfld_val, 'CONTACT_FORM_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.FORM.EXTRAFLD');
}
}
if (cot::$usr['id'] == 0 && !empty($cot_captcha)) {
$t->assign(array('CONTACT_FORM_VERIFY_IMG' => cot_captcha_generate(), 'CONTACT_FORM_VERIFY' => cot_inputbox('text', 'rverify', '', 'id="rverify" size="20"')));
$t->parse('MAIN.FORM.CAPTCHA');
}
$t->parse('MAIN.FORM');
}
示例11: cot_url
if ($usr['isadmin']) {
$t->assign(array('FORUMS_POSTS_MOVE_URL' => cot_url('forums', 'm=topics&a=move&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_BUMP_URL' => cot_url('forums', 'm=topics&a=bump&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_LOCK_URL' => cot_url('forums', 'm=topics&a=lock&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_STICKY_URL' => cot_url('forums', 'm=topics&a=sticky&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_ANNOUNCE_URL' => cot_url('forums', 'm=topics&a=announcement&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_PRIVATE_URL' => cot_url('forums', 'm=topics&a=private&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_CLEAR_URL' => cot_url('forums', 'm=topics&a=clear&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'FORUMS_POSTS_DELETE_URL' => cot_confirm_url(cot_url('forums', 'm=topics&a=delete&s=' . $s . '&q=' . $q . '&x=' . $sys['xk']), 'forums', 'forums_confirm_delete_topic'), 'FORUMS_POSTS_MOVEBOX_SELECT' => cot_selectbox('', 'ns', array_keys($movebox), array_values($movebox), false), 'FORUMS_POSTS_MOVEBOX_KEEP' => cot_checkbox('0', 'ghost')));
$t->parse('MAIN.FORUMS_POSTS_ADMIN');
}
$allowreplybox = $cfg['forums']['antibumpforums'] && $row['fp_posterid'] > 0 && $row['fp_posterid'] == $usr['id'] && $usr['auth_write'] ? FALSE : TRUE;
if (($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0 && $allowreplybox && $usr['auth_write']) {
if ($quote > 0) {
$sql_forums_quote = $db->query("SELECT fp_id, fp_text, fp_postername, fp_posterid, fp_creation FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? AND fp_id = ? LIMIT 1", array($q, $s, $quote));
if ($row4 = $sql_forums_quote->fetch()) {
$rmsg['fp_text'] = cot_rc('forums_code_quote', array('url' => cot_url('forums', 'm=posts&q=' . $q . '&d=' . $durl, '#' . $row4['fp_id'], $forums_quote_htmlspecialchars_bypass), 'id' => $row4['fp_id'], 'date' => cot_date('datetime_medium', $row4['fp_creation']), 'postername' => $row4['fp_postername'], 'text' => $row4['fp_text']));
}
}
// Extra fields
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg[$exfld['field_name']]);
$exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t->assign(array('FORUMS_POSTS_NEWPOST_' . $uname => $exfld_val, 'FORUMS_POSTS_NEWPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_POSTS_NEWPOST_EXTRAFLD' => $exfld_val, 'FORUMS_POSTS_NEWPOST_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.FORUMS_POSTS_NEWPOST.EXTRAFLD');
}
$t->assign(array('FORUMS_POSTS_NEWPOST_SEND' => cot_url('forums', "m=posts&a=newpost&s=" . $s . "&q=" . $q), 'FORUMS_POSTS_NEWPOST_TEXT' => $R['forums_code_newpost_mark'] . cot_textarea('rmsgtext', $rmsg['fp_text'], 16, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_POSTS_NEWPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('forums.posts.newpost.tags') as $pl) {
include $pl;
}
/* ===== */
$t->parse('MAIN.FORUMS_POSTS_NEWPOST');
} elseif ($rowt['ft_state']) {
$t->assign('FORUMS_POSTS_TOPICLOCKED_BODY', $L['forums_topiclocked']);
$t->parse('MAIN.FORUMS_POSTS_TOPICLOCKED');
示例12: editAction
//.........这里部分代码省略.........
}
}
// Сохранение
if ($act == 'save') {
unset($_POST['id'], $_POST['user'], $_POST['x'], $_POST['act']);
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.save.first') as $pl) {
include $pl;
}
/* ===== */
$data = $_POST;
$data['next_run'] = cot_import_date('next_run');
if (!empty($data['next_run'])) {
$data['next_run'] = date('Y-m-d H:i:s', $data['next_run']);
}
$item->setData($data);
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.save.validate') as $pl) {
include $pl;
}
/* ===== */
// There is some errors
if (!$item->validate() || cot_error_found()) {
$urlParams = array('m' => 'subscribe', 'a' => 'edit');
if ($item->id > 0) {
$urlParams['id'] = $item->id;
}
cot_redirect(cot_url('admin', $urlParams, '', true));
}
$isNew = $item->id == 0;
// Перерасчет времени следующего запуска
// Делать это в админке при редактировании рассылки и при выполнении рассылки
// А то могут быть коллизии
$recalculate = true;
if (!empty($item->next_run)) {
$tmp = strtotime($item->next_run);
if ($tmp > cot::$sys['now']) {
$recalculate = false;
}
}
if ($recalculate) {
$item->next_run = $item->getNextRunDate();
}
// Сохранение
if ($item->save()) {
cot_message(cot::$L['Saved']);
$urlParams = array('m' => 'subscribe', 'a' => 'edit', 'id' => $item->id);
$redirectUrl = cot_url('admin', $urlParams, '', true);
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.save.done') as $pl) {
include $pl;
}
/* ===== */
// Редирект на станицу рассылки
cot_redirect($redirectUrl);
}
}
// 'input_textarea_editor', 'input_textarea_medieditor', 'input_textarea_minieditor', ''
$editor = 'input_textarea_editor';
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.edit.main') as $pl) {
include $pl;
}
/* ===== */
$nextRun = 0;
if (!empty($item->next_run)) {
$nextRun = strtotime($item->next_run);
}
$formElements = array('hidden' => array('element' => cot_inputbox('hidden', 'act', 'save')), 'title' => array('element' => cot_inputbox('text', 'title', $item->rawValue('title')), 'required' => true, 'label' => subscribe_model_Subscribe::fieldLabel('title')), 'alias' => array('element' => cot_inputbox('text', 'alias', $item->rawValue('alias')), 'label' => subscribe_model_Subscribe::fieldLabel('alias')), 'admin_note' => array('element' => cot_textarea('admin_note', $item->rawValue('admin_note'), 5, 120, ''), 'label' => subscribe_model_Subscribe::fieldLabel('admin_note')), 'from_mail' => array('element' => cot_inputbox('text', 'from_mail', $item->rawValue('from_mail')), 'label' => subscribe_model_Subscribe::fieldLabel('from_mail'), 'hint' => cot::$L['subscribe_from_mail_hint']), 'from_title' => array('element' => cot_inputbox('text', 'from_title', $item->rawValue('from_title')), 'label' => subscribe_model_Subscribe::fieldLabel('from_title')), 'subject' => array('element' => cot_inputbox('text', 'subject', $item->rawValue('subject')), 'label' => subscribe_model_Subscribe::fieldLabel('subject')), 'description' => array('element' => cot_textarea('description', $item->rawValue('description'), 5, 120, '', $editor), 'label' => subscribe_model_Subscribe::fieldLabel('description')), 'content_url' => array('element' => cot_inputbox('text', 'content_url', $item->rawValue('content_url')), 'label' => subscribe_model_Subscribe::fieldLabel('content_url'), 'hint' => cot::$L['subscribe_content_url_hint']), 'text' => array('element' => cot_textarea('text', $item->rawValue('text'), 5, 120, '', $editor), 'label' => subscribe_model_Subscribe::fieldLabel('text'), 'hint' => cot::$L['subscribe_text_hint']), 'next_run' => array('element' => cot_selectbox_date($nextRun, 'long', 'next_run'), 'label' => subscribe_model_Subscribe::fieldLabel('next_run'), 'hint' => cot::$L['subscribe_next_run_hint'] . " " . cot::$usr['timetext']), 'sched_mday' => array('element' => cot_inputbox('text', 'sched_mday', $item->rawValue('sched_mday')), 'label' => subscribe_model_Subscribe::fieldLabel('sched_mday'), 'hint' => cot::$L['subscribe_sched_mday_hint']), 'sched_wday' => array('element' => cot_inputbox('text', 'sched_wday', $item->rawValue('sched_wday')), 'label' => subscribe_model_Subscribe::fieldLabel('sched_wday'), 'hint' => cot::$L['subscribe_sched_wday_hint']), 'sched_time' => array('element' => cot_inputbox('text', 'sched_time', $item->rawValue('sched_time')), 'label' => subscribe_model_Subscribe::fieldLabel('sched_time'), 'hint' => cot::$L['subscribe_sched_time_hint']), 'active' => array('element' => cot_checkbox($item->rawValue('active'), 'active', subscribe_model_Subscribe::fieldLabel('active'))), 'periodical' => array('element' => cot_checkbox($item->rawValue('periodical'), 'periodical', subscribe_model_Subscribe::fieldLabel('periodical'))), 'sort' => array('element' => cot_inputbox('text', 'sort', $item->rawValue('sort')), 'label' => subscribe_model_Subscribe::fieldLabel('sort')));
if (!empty($cot_extrafields[cot::$db->subscribe])) {
// Extra fields for subscribe
foreach ($cot_extrafields[cot::$db->subscribe] as $exfld) {
$fName = $exfld['field_name'];
$formElements[$fName] = array('element' => cot_build_extrafields($fName, $exfld, $item->rawValue($fName)));
if ($exfld['field_type'] !== 'checkbox') {
isset(cot::$L['subscribe_' . $exfld['field_name'] . '_title']) ? cot::$L['subscribe_' . $exfld['field_name'] . '_title'] : subscribe_model_Subscribe::fieldLabel($fName);
}
}
}
$subscribers = subscribe_model_Subscriber::count(array(array('subscribe', $item->id)));
$activeSubscribers = subscribe_model_Subscriber::count(array(array('subscribe', $item->id), array('active', 1)));
$actionParams = array('m' => 'subscribe', 'a' => 'edit');
if ($item->id > 0) {
$actionParams['id'] = $item->id;
}
$template = array('subscribe', 'admin', 'edit');
$view = new View();
$view->page_title = $admintitle;
$view->item = $item;
$view->subscribers = $subscribers;
$view->activeSubscribers = $activeSubscribers;
$view->formElements = $formElements;
$view->formAction = cot_url('admin', $actionParams);
/* === Hook === */
foreach (cot_getextplugins('subscribe.admin.edit.view') as $pl) {
include $pl;
}
/* ===== */
return $view->render($template);
}
示例13: 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'];
}
//.........这里部分代码省略.........
示例14: cot_incfile
require_once cot_incfile('projects', 'module');
list($pn, $p, $d_url) = cot_import_pagenav('p', $cfg['projects']['indexlimit']);
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('projects', 'any', 'RWA');
$t_pr = new XTemplate(cot_tplfile('projects.index', 'module'));
if (is_array($projects_types)) {
foreach ($projects_types as $i => $pr_type) {
$t_pr->assign(array('PTYPE_ROW_ID' => $i, 'PTYPE_ROW_TITLE' => $pr_type, 'PTYPE_ROW_URL' => cot_url('projects', 'type=' . $i)));
$t_pr->parse("SEARCH.PTYPES.PTYPES_ROWS");
}
}
$t_pr->assign(array('PTYPE_ALL_URL' => cot_url('projects', ''), 'REALIZED_URL' => cot_url('projects', 'realized=1'), "FORPRO_URL" => cot_url('projects', 'forpro=1')));
$t_pr->parse("SEARCH.PTYPES");
$t_pr->assign(array('SEARCH_ACTION_URL' => cot_url('projects', '', '', true), 'SEARCH_SQ' => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_projects_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['projects_mostrelevant'], $L['projects_costasc'], $L['projects_costdesc']), false)));
foreach ($cot_extrafields[$db_projects] as $exfld) {
$uname = strtoupper($exfld['field_name']);
$exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, '');
$exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
$t_pr->assign(array('SEARCH_' . $uname => $exfld_val, 'SEARCH_' . $uname . '_TITLE' => $exfld_title));
}
/* === Hook === */
foreach (cot_getextplugins('projects.index.searchtags') as $pl) {
include $pl;
}
/* ===== */
$t_pr->parse('SEARCH');
$t->assign('PROJECTS_SEARCH', $t_pr->text('SEARCH'));
// Количество реализованных проектов
$sql = $db->query("SELECT COUNT(*) FROM {$db_projects} WHERE item_state=0 AND item_realized=1");
$countofrealizedprojects = $sql->fetchColumn();
$t->assign(array("COUNTOFREALIZEDPROJECTS" => $countofrealizedprojects));
$where = array();
示例15: foreach
/* === 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']);
$exfld_val = cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $ruser['user_' . $exfld['field_name']]);
$exfld_title = cot_extrafield_title($exfld, 'user_');
$t->assign(array('USERS_REGISTER_' . $uname => $exfld_val, 'USERS_REGISTER_' . $uname . '_TITLE' => $exfld_title, 'USERS_REGISTER_EXTRAFLD' => $exfld_val, 'USERS_REGISTER_EXTRAFLD_TITLE' => $exfld_title));
$t->parse('MAIN.EXTRAFLD');
}
}
/* === Hook === */
foreach (cot_getextplugins('users.register.tags') as $pl) {
include $pl;
}
/* ===== */
// Error and message handling
cot_display_messages($t);
$t->parse('MAIN');
$t->out('MAIN');
require_once cot::$cfg['system_dir'] . '/footer.php';