cot_redirect($r_url); exit; } $out['subtitle'] = $L['folio_edit_product_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['folio'][$item['item_cat']]['title']; $mskin = cot_tplfile(array('folio', 'edit', $structure['folio'][$item['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('folio.edit.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRDEDIT_FORM_SEND" => cot_url('folio', "m=edit&a=update&id=" . $item['item_id'] . "&r=" . $r), "PRDEDIT_FORM_ID" => $item['item_id'], "PRDEDIT_FORM_CAT" => cot_selectbox_structure('folio', $item['item_cat'], 'rcat'), "PRDEDIT_FORM_CATTITLE" => $structure['folio'][$item['item_cat']]['title'], "PRDEDIT_FORM_TITLE" => cot_inputbox('text', 'rtitle', $item['item_title'], 'size="56"'), "PRDEDIT_FORM_ALIAS" => cot_inputbox('text', 'ralias', $item['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRDEDIT_FORM_TEXT" => cot_textarea('rtext', $item['item_text'], 10, 60, 'id="formtext"', $folioeditor ? 'input_textarea_' . $folioeditor : ''), "PRDEDIT_FORM_COST" => cot_inputbox('text', 'rcost', $item['item_cost'], 'size="10"'), "PRDEDIT_FORM_STATE" => $item['item_state'], "PRDEDIT_FORM_PARSER" => cot_selectbox($item['item_parser'], 'rparser', cot_get_parsers(), cot_get_parsers(), false), "PRDEDIT_FORM_DELETE" => cot_radiobox(0, 'rdelete', array(1, 0), array($L['Yes'], $L['No'])))); // Extra fields foreach ($cot_extrafields[$db_folio] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $item['item_' . $exfld['field_name']]); $exfld_title = isset($L['folio_' . $exfld['field_name'] . '_title']) ? $L['folio_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRDEDIT_FORM_' . $uname => $exfld_val, 'PRDEDIT_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRDEDIT_FORM_EXTRAFLD' => $exfld_val, 'PRDEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('folio.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
cot_redirect($r_url); exit; } $out['subtitle'] = $L['projects_edit_project_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['projects'][$item['item_cat']]['title']; $mskin = cot_tplfile(array('projects', 'edit', $structure['projects'][$item['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('projects.edit.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRJEDIT_FORM_SEND" => cot_url('projects', "m=edit&a=update&id=" . $item['item_id'] . "&r=" . $r), "PRJEDIT_FORM_ID" => $item['item_id'], "PRJEDIT_FORM_CAT" => cot_selectbox_structure('projects', $item['item_cat'], 'rcat'), "PRJEDIT_FORM_CATTITLE" => $structure['projects'][$item['item_cat']]['title'], "PRJEDIT_FORM_TYPETITLE" => is_array($projects_types) && !empty($item['item_type']) ? $projects_types[$item['item_type']] : '', "PRJEDIT_FORM_TYPE" => is_array($projects_types) ? cot_selectbox($item['item_type'] ? $item['item_type'] : $cfg['projects']['default_type'], 'rtype', array_keys($projects_types), array_values($projects_types)) : 'empty', "PRJEDIT_FORM_TITLE" => cot_inputbox('text', 'rtitle', $item['item_title'], 'size="56"'), "PRJEDIT_FORM_ALIAS" => cot_inputbox('text', 'ralias', $item['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRJEDIT_FORM_TEXT" => cot_textarea('rtext', $item['item_text'], 10, 60, 'id="formtext"', $prjeditor ? 'input_textarea_' . $prjeditor : ''), "PRJEDIT_FORM_COST" => cot_inputbox('text', 'rcost', $item['item_cost'], 'size="10"'), "PRJEDIT_FORM_STATE" => $item['item_state'], "PRJEDIT_FORM_PARSER" => cot_selectbox($item['item_parser'], 'rparser', cot_get_parsers(), cot_get_parsers(), false), "PRJEDIT_FORM_DELETE" => cot_radiobox(0, 'rdelete', array(1, 0), array($L['Yes'], $L['No'])))); // Extra fields foreach ($cot_extrafields[$db_projects] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $item['item_' . $exfld['field_name']]); $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRJEDIT_FORM_' . $uname => $exfld_val, 'PRJEDIT_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRJEDIT_FORM_EXTRAFLD' => $exfld_val, 'PRJEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('projects.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
} /* ===== */ $t = new XTemplate($mskin); if (!empty($uid)) { $t->assign(cot_generate_usertags($uid, 'SBR_PERFORMER_')); } else { $t->assign('SBRADD_FORM_PERFORMER', cot_inputbox('text', 'rsbrperformer', $rsbrperformer, 'placeholder="' . $L['sbr_performer_placeholder'] . '"')); } 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'); }
// Extrafields if (!empty(cot::$extrafields[cot::$db->contact])) { foreach (cot::$extrafields[cot::$db->contact] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'contact_'); $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']])); $tuman->parse('MAIN.DATA.EXTRAFLD'); } } $tuman->parse('MAIN.DATA'); } $sql->closeCursor(); if ($a == '' && !empty($id)) { $row = $db->query("SELECT * FROM " . cot::$db->contact . " WHERE contact_id = {$id}")->fetch(); $tuman->assign(array('CONTACT_DATE' => cot_date('date_full', $row['contact_date']), 'CONTACT_DATE_STAMP' => $row['contact_date'], 'CONTACT_USER' => $row['contact_authorid'] > 0 ? cot_build_user($row['contact_authorid'], $row['contact_author']) : $row['contact_author'], 'CONTACT_EMAIL' => $row['contact_email'], 'CONTACT_ID' => $row['contact_id'], 'CONTACT_DELLINK' => cot_url('admin', 'm=other&p=contact&a=del&id=' . $row['contact_id']), 'CONTACT_VAL' => $row['contact_val'] == 1 ? 'unval' : 'val', 'CONTACT_VALLINK' => cot_url('admin', 'm=other&p=contact&a=' . $val . '&id=' . $row['contact_id']), 'CONTACT_READLINK' => cot_url('admin', 'm=other&p=contact&a=val&id=' . $row['contact_id']), 'CONTACT_UNREADLINK' => cot_url('admin', 'm=other&p=contact&a=unval&id=' . $row['contact_id']), 'CONTACT_SUBJECT' => $row['contact_subject'], 'CONTACT_TEXT' => $row['contact_text'], 'CONTACT_REPLY' => $row['contact_reply'], 'CONTACT_FORM_SEND' => cot_url("admin", 'm=other&p=contact&a=send&id=' . $row['contact_id']), 'CONTACT_FORM_TEXT' => cot_textarea('rtext', $rtext, 8, 64))); // Extrafields if (!empty(cot::$extrafields[cot::$db->contact])) { foreach (cot::$extrafields[cot::$db->contact] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields_data('contact', $exfld, $row['contact_' . $exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'contact_'); $tuman->assign(array('CONTACT_' . $tag . '_TITLE' => $exfld_title, 'CONTACT_' . $tag => $exfld_val, 'CONTACT_' . $tag . '_VALUE' => $row['contact_' . $exfld['field_name']], 'CONTACT_EXTRAFLD_TITLE' => $exfld_title, 'CONTACT_EXTRAFLD' => $exfld['field_type'] == 'file' ? cot_rc_link($cfg['extrafield_files_dir'] . '/' . $exfld_val, $exfld_val) : $exfld_val, 'CONTACT_EXTRAFLD_VALUE' => $row['contact_' . $exfld['field_name']])); $tuman->parse('MAIN.VIEW.EXTRAFLD'); } } $tuman->parse('MAIN.VIEW'); } cot_display_messages($tuman); $tuman->assign(array('CONTACT_PAGINATION' => $pagnav['main'], 'CONTACT_PREV' => $pagenav['prev'], 'CONTACT_NEXT' => $pagenav['next'])); $tuman->parse('MAIN');
if (empty($ritem['item_type']) && !empty($type)) { $ritem['item_type'] = $type; } $out['subtitle'] = $L['projects_add_project_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['projects'][$c]['title']; $mskin = cot_tplfile(array('projects', 'add', $structure['projects'][$ritem['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('projects.add.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRJADD_FORM_SEND" => cot_url('projects', 'm=add&c=' . $c . '&type=' . $type . '&a=add'), "PRJADD_FORM_CAT" => cot_selectbox_structure('projects', $ritem['item_cat'], 'rcat'), "PRJADD_FORM_CATTITLE" => !empty($c) ? $structure['projects'][$c]['title'] : '', "PRJADD_FORM_TYPE" => is_array($projects_types) ? cot_selectbox($ritem['item_type'] ? $ritem['item_type'] : $cfg['projects']['default_type'], 'rtype', array_keys($projects_types), array_values($projects_types)) : 'empty', "PRJADD_FORM_TYPETITLE" => is_array($projects_types) && !empty($type) ? $projects_types[$type] : '', "PRJADD_FORM_TITLE" => cot_inputbox('text', 'rtitle', $ritem['item_title'], 'size="56"'), "PRJADD_FORM_ALIAS" => cot_inputbox('text', 'ralias', $ritem['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRJADD_FORM_TEXT" => cot_textarea('rtext', $ritem['item_text'], 10, 60, 'id="formtext"', $prjeditor ? 'input_textarea_' . $prjeditor : ''), "PRJADD_FORM_COST" => cot_inputbox('text', 'rcost', $ritem['item_cost'], 'size="10"'), "PRJADD_FORM_PARSER" => cot_selectbox($cfg['projects']['parser'], 'rparser', $parser_list, $parser_list, false))); // Extra fields foreach ($cot_extrafields[$db_projects] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $ritem['item_' . $exfld['field_name']]); $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRJADD_FORM_' . $uname => $exfld_val, 'PRJADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRJADD_FORM_EXTRAFLD' => $exfld_val, 'PRJADD_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('projects.add.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
$mskin = cot_tplfile(array('forums', 'editpost', $structure['forums'][$s]['tpl'])); $t = new XTemplate($mskin); cot_display_messages($t); if ($db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) { $t->assign(array('FORUMS_EDITPOST_TOPICTITTLE' => cot_inputbox('text', 'rtopictitle', $rowt['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_EDITPOST_TOPICDESCRIPTION' => cot_inputbox('text', 'rtopicdesc', $rowt['ft_desc'], array('size' => 56, 'maxlength' => 255)))); // Extra fields foreach ($cot_extrafields[$db_forum_topics] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rowt['ft_' . $exfld['field_name']]); $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_EDITPOST_TOPIC_' . $uname => $exfld_val, 'FORUMS_EDITPOST_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST.TOPIC_EXTRAFLD'); } $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST'); } $t->assign(array('FORUMS_EDITPOST_PAGETITLE' => $toptitle, 'FORUMS_EDITPOST_SUBTITLE' => $L['forums_postedby'] . ": <a href=\"users.php?m=details&id=" . $rowpost['fp_posterid'] . "\">" . $rowpost['fp_postername'] . "</a> @ " . cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED' => cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED_STAMP' => $rowpost['fp_updated'], 'FORUMS_EDITPOST_SEND' => cot_url('forums', "m=editpost&a=update&s=" . $s . "&q=" . $q . "&p=" . $p . '&d=' . $durl . "&" . cot_xg()), 'FORUMS_EDITPOST_TEXT' => cot_textarea('rmsgtext', $rowpost['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_EDITPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600))); // Extra fields foreach ($cot_extrafields[$db_forum_posts] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rowpost['fp_' . $exfld['field_name']]); $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_EDITPOST_' . $uname => $exfld_val, 'FORUMS_EDITPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('forums.editpost.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $t->out('MAIN');
} $toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']); $toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : ''; $sys['sublocation'] = $structure['forums'][$s]['title']; $out['subtitle'] = $L['forums_newtopic']; $out['head'] .= $R['code_noindex']; /* === Hook === */ foreach (cot_getextplugins('forums.newtopic.main') as $pl) { include $pl; } /* ===== */ require_once cot_incfile('forms'); require_once $cfg['system_dir'] . '/header.php'; $mskin = cot_tplfile(array('forums', 'newtopic', $structure['forums'][$s]['tpl'])); $t = new XTemplate($mskin); $t->assign(array('FORUMS_NEWTOPIC_PAGETITLE' => $toptitle, 'FORUMS_NEWTOPIC_SUBTITLE' => htmlspecialchars(cot_parse_autourls($structure['forums'][$s]['desc'])), 'FORUMS_NEWTOPIC_SEND' => cot_url('forums', "m=newtopic&a=newtopic&s=" . $s), 'FORUMS_NEWTOPIC_TITLE' => cot_inputbox('text', 'rtopictitle', $rtopic['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_DESC' => cot_inputbox('text', 'rtopicdesc', $rtopic['ft_desc'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_NEWTOPIC_TEXT' => cot_textarea('rmsgtext', $rmsg['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_NEWTOPIC_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600))); // Extra fields foreach ($cot_extrafields[$db_forum_posts] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg['fp_' . $exfld['field_name']]); $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_NEWTOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } // Extra fields foreach ($cot_extrafields[$db_forum_topics] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rtopic['ft_' . $exfld['field_name']]); $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_NEWTOPIC_TOPIC_' . $uname => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_NEWTOPIC_TOPIC_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.TOPIC_EXTRAFLD');
/** * Редактирование рассылки * @return string * @throws Exception */ public function editAction() { global $cot_extrafields, $admintitle, $adminpath; $id = cot_import('id', 'G', 'INT'); // id Рассылки $act = cot_import('act', 'G', 'ALP'); if (empty($act)) { $act = cot_import('act', 'P', 'ALP'); } $adminpath[] = array(cot_url('admin', array('m' => 'subscribe')), cot::$L['subscribe_subscribes']); /* === Hook === */ foreach (cot_getextplugins('subscribe.admin.edit.first') as $pl) { include $pl; } /* ===== */ if (!$id) { $item = new subscribe_model_Subscribe(); $admintitle = cot::$L['subscribe_add_new']; $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit')), $admintitle); } else { $item = subscribe_model_Subscribe::getById($id); if (!$item) { cot_error(cot::$L['subscribe_err_not_found']); cot_redirect(cot_url('admin', array('m' => 'subscribe'), '', true)); } if ($act == 'clone') { $id = null; $item = clone $item; $admintitle = cot::$L['subscribe_add_new']; $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit')), $admintitle); } else { $admintitle = $item->title . " [" . cot::$L['Edit'] . "]"; $adminpath[] = array(cot_url('admin', array('m' => 'subscribe', 'a' => 'edit', 'id' => $item->id)), $admintitle); } } // Сохранение 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); }
if (($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0 && $allowreplybox && $usr['auth_write']) { if ($quote > 0) { $sql_forums_quote = $db->query("SELECT fp_id, fp_text, fp_postername, fp_posterid, fp_creation FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? AND fp_id = ? LIMIT 1", array($q, $s, $quote)); if ($row4 = $sql_forums_quote->fetch()) { $rmsg['fp_text'] = cot_rc('forums_code_quote', array('url' => cot_url('forums', 'm=posts&q=' . $q . '&d=' . $durl, '#' . $row4['fp_id'], $forums_quote_htmlspecialchars_bypass), 'id' => $row4['fp_id'], 'date' => cot_date('datetime_medium', $row4['fp_creation']), 'postername' => $row4['fp_postername'], 'text' => $row4['fp_text'])); } } // Extra fields foreach ($cot_extrafields[$db_forum_posts] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rmsg[$exfld['field_name']]); $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('FORUMS_POSTS_NEWPOST_' . $uname => $exfld_val, 'FORUMS_POSTS_NEWPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_POSTS_NEWPOST_EXTRAFLD' => $exfld_val, 'FORUMS_POSTS_NEWPOST_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.FORUMS_POSTS_NEWPOST.EXTRAFLD'); } $t->assign(array('FORUMS_POSTS_NEWPOST_SEND' => cot_url('forums', "m=posts&a=newpost&s=" . $s . "&q=" . $q), 'FORUMS_POSTS_NEWPOST_TEXT' => $R['forums_code_newpost_mark'] . cot_textarea('rmsgtext', $rmsg['fp_text'], 16, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_POSTS_NEWPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600))); cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('forums.posts.newpost.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.FORUMS_POSTS_NEWPOST'); } elseif ($rowt['ft_state']) { $t->assign('FORUMS_POSTS_TOPICLOCKED_BODY', $L['forums_topiclocked']); $t->parse('MAIN.FORUMS_POSTS_TOPICLOCKED'); } elseif (!$allowreplybox && ($cfg['forums']['enablereplyform'] || $lastpage) && !$rowt['ft_state'] && $usr['id'] > 0) { $t->assign('FORUMS_POSTS_ANTIBUMP_BODY', $L['forums_antibump']); $t->parse('MAIN.FORUMS_POSTS_ANTIBUMP'); } if ($rowt['ft_mode'] == 1) {
/** * Форма просмара отзывов /добавление отзыва * * @param int $userid id пользователя * @param string $area модуль/плагин * @param string $code код * @param string $name URL Module or script name * @param mixed $params URL parameters as array or parameter string * @param string $tail URL postfix, e.g. anchor * @param bool $showall show all reviews * @return string */ function cot_reviews_list($userid, $area, $code = '', $name = '', $params = '', $tail = '', $showall = false) { global $db_reviews, $db_users, $db, $L, $usr, $cfg; list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'reviews', 'RWA'); if ($usr['auth_read']) { $t1 = new XTemplate(cot_tplfile(array('reviews', $area), 'plug')); require_once cot_langfile('reviews', 'plug'); if (!$showall) { $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : ''; $sqlarea = " AND item_area='" . $db->prep($area) . "'"; } $sql = $db->query("SELECT * FROM {$db_reviews} as r LEFT JOIN {$db_users} as u ON u.user_id=r.item_userid \n\t\t\tWHERE item_touserid=" . (int) $userid . $sqlarea . $sqlcode . " ORDER BY item_date ASC"); if (is_array($params)) { $params2 = array(); foreach ($array as $key => $value) { $params2[$key] = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $value); } $params = $params2; } else { $params = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $params); } $redirect = cot_url($name, $params, $tail, true); $redirect = base64_encode($redirect); while ($item = $sql->fetch()) { if ($usr['id'] == $item['item_userid'] || $usr['isadmin']) { $t1->assign(array('REVIEW_FORM_ID' => $item['item_id'], 'REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=update&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id']), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $item['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($item['item_score'], 'rscore', $L['review_score_values'], $L['review_score_titles']), 'REVIEW_FORM_USERID' => $item['item_userid'], 'REVIEW_FORM_DELETE_URL' => cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id']))); $t1->parse('MAIN.REVIEWS_ROWS.EDITFORM'); } $t1->assign(cot_generate_usertags($item, 'REVIEW_ROW_')); $t1->assign(array('REVIEW_ROW_ID' => $item['item_id'], 'REVIEW_ROW_TEXT' => $item['item_text'], 'REVIEW_ROW_TOUSER' => $item['item_touser'], 'REVIEW_ROW_OWNERID' => $item['item_userid'], 'REVIEW_ROW_OWNER' => cot_build_user($item['item_userid'], htmlspecialchars($item['user_name'])), 'REVIEW_ROW_SCORE' => $item['item_score'] > 0 ? '+' . $item['item_score'] : $item['item_score'], 'REVIEW_ROW_AREA' => $item['item_area'], 'REVIEW_ROW_CODE' => $item['item_code'], 'REVIEW_ROW_DATE' => $item['item_date'], 'REVIEW_ROW_DELETE_URL' => $usr['id'] == $item['item_userid'] || $usr['isadmin'] ? cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&itemid=' . $item['item_id'] . '&redirect=' . $redirect) : '')); if ($item['item_area'] == 'projects' && !empty($item['item_code'])) { require_once cot_incfile('projects', 'module'); global $db_projects; $prj = $db->query("SELECT * FROM {$db_projects} WHERE item_id=" . $item['item_code'])->fetch(); $t1->assign(cot_generate_projecttags($prj, 'REVIEW_ROW_PRJ_')); } $t1->parse('MAIN.REVIEWS_ROWS'); } if ($cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $usr['id'] > 0 && $usr['auth_write'] && $usr['id'] != $userid) { require_once cot_incfile('projects', 'module'); global $db_projects_offers, $db_projects; $prj_reviews_sql = $db->query("SELECT item_code FROM {$db_reviews} WHERE item_area='projects' AND item_userid=" . $usr['id']); while ($row = $prj_reviews_sql->fetch()) { $prjreviews[] = $row['item_code']; } $prjreviews_string = count($prjreviews) > 0 ? "AND o.offer_pid NOT IN (" . implode(",", $prjreviews) . ")" : ''; $bothprj_count = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t")->fetchColumn(); if ($bothprj_count > 0) { $bothprj_sql = $db->query("SELECT * FROM {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t"); while ($bprj = $bothprj_sql->fetch()) { $prj_ids[] = $bprj['offer_pid']; $prj_titles[] = $bprj['item_title']; } } $area = 'projects'; $usr['auth_write'] = (int) $bothprj_count == 0 ? false : $usr['auth_write']; } else { $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : ''; $sqlarea = " AND item_area='" . $db->prep($area) . "'"; $reviews_count = $db->query("SELECT COUNT(*) FROM {$db_reviews} \n\t\t\t\tWHERE item_userid=" . (int) $usr['id'] . "\n\t\t\t\t\tAND item_touserid=" . (int) $userid . $sqlarea . $sqlcode)->fetchColumn(); $usr['auth_write'] = $reviews_count > 0 ? false : $usr['auth_write']; } if ($usr['auth_write'] && $usr['id'] != $userid) { cot_display_messages($t1); $t1->assign(array('REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=add&area=' . $area . '&touser='******'&redirect=' . $redirect), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $ritem['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($ritem['item_score'], 'rscore', $L['reviews_score_values'], $L['reviews_score_titles']), 'REVIEW_FORM_PROJECTS' => $cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $bothprj_count > 0 ? cot_selectbox($pid, 'code', $prj_ids, $prj_titles, false) : '', 'REVIEW_FORM_ACTION' => 'ADD')); $t1->parse('MAIN.FORM'); } $t1->parse('MAIN'); return $t1->text('MAIN'); } return ''; }
$urr = $sql->fetch(); $out['subtitle'] = $L['Profile']; $out['head'] .= $R['code_noindex']; $mskin = cot_tplfile(array('users', 'profile'), 'module'); /* === Hook === */ foreach (cot_getextplugins('users.profile.main') as $pl) { include $pl; } /* ===== */ require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate($mskin); require_once cot_incfile('forms'); $protected = !$cfg['users']['useremailchange'] ? array('disabled' => 'disabled') : array(); $profile_form_email = cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64) + $protected); $editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : ''; $t->assign(array('USERS_PROFILE_TITLE' => cot_rc_link(cot_url('users', 'm=profile'), $L['pro_title']), 'USERS_PROFILE_SUBTITLE' => $L['pro_subtitle'], 'USERS_PROFILE_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_PROFILE_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_PROFILE_FORM_SEND' => cot_url('users', "m=profile&a=update&" . cot_xg()), 'USERS_PROFILE_ID' => $urr['user_id'], 'USERS_PROFILE_NAME' => htmlspecialchars($urr['user_name']), 'USERS_PROFILE_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_PROFILE_GROUPS' => cot_build_groupsms($urr['user_id'], FALSE, $urr['user_maingrp']), 'USERS_PROFILE_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_PROFILE_TEXT' => cot_textarea('rusertext', $urr['user_text'], 8, 56, array('class' => $editor_class)), 'USERS_PROFILE_EMAIL' => $profile_form_email, 'USERS_PROFILE_EMAILPASS' => cot_inputbox('password', 'rmailpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_PROFILE_THEME' => cot_selectbox_theme($urr['user_theme'], $urr['user_scheme'], 'rusertheme'), 'USERS_PROFILE_LANG' => cot_selectbox_lang($urr['user_lang'], 'ruserlang'), 'USERS_PROFILE_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_PROFILE_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_PROFILE_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_PROFILE_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_PROFILE_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_PROFILE_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_PROFILE_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_PROFILE_LOGCOUNT' => $urr['user_logcount'], 'USERS_PROFILE_ADMINRIGHTS' => '', 'USERS_PROFILE_OLDPASS' => cot_inputbox('password', 'roldpass', '', array('size' => 12, 'maxlength' => 32)), 'USERS_PROFILE_NEWPASS1' => cot_inputbox('password', 'rnewpass1', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_NEWPASS2' => cot_inputbox('password', 'rnewpass2', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')))); // 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, $urr['user_' . $exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'user_'); $t->assign(array('USERS_PROFILE_' . $uname => $exfld_val, 'USERS_PROFILE_' . $uname . '_TITLE' => $exfld_title, 'USERS_PROFILE_EXTRAFLD' => $exfld_val, 'USERS_PROFILE_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } } /* === Hook === */ foreach (cot_getextplugins('users.profile.tags') as $pl) { include $pl; } /* ===== */
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']; } // Пересчитать период публикации объявления if ($expire == 0 && cot::$cfg['advboard']['cat_' . $c]['maxPeriod'] > 0) { $period = cot_import('period', 'P', 'INT'); $maxPeriod = max($periodItems); if (empty($period)) { $period = $maxPeriod; } if (!cot::$usr['isadmin'] && $period > $maxPeriod) { $period = $maxPeriod; } if ($period > 0) { $expire = $begin + $period * 86400; } } if ($category['config']['title_require']) { $advert->setValidator('title', 'required'); } // Валидатор 'allowemptytext' if (!$category['config']['allowemptytext']) { $advert->setValidator('text', 'required'); } if ($category['config']['phone_require']) { // проверить надичие заполненного поля в профиле пользователя - владельца if (empty($user['user_phone'])) { $advert->setValidator('phone', 'required'); } } if ($category['config']['city_require']) { // Проверить наличие заполненного города (id или названия) в профиле владельца if (empty($user['user_city_name']) && empty($user['user_city'])) { if (cot_plugin_active('regioncity')) { $advert->setValidator('city', function ($value) { $value = (int) $value; if ($value == 0) { return cot::$L['field_required'] . ': ' . advboard_model_Advert::fieldLabel('city'); } return true; }); } else { $advert->setValidator('city_name', 'required'); } } } if (cot::$usr['id'] == 0) { $advert->setValidator('person', 'required'); // Email $email = cot_import('email', 'P', 'TXT'); if (cot::$cfg['advboard']['guestEmailRequire']) { if ($email == '') { cot_error(cot::$L['advboard_err_noemail'], 'email'); } } if ($email != '') { $tmp = advert_checkEmail($email); if ($tmp !== true) { cot_error($tmp, 'email'); } } // Капча if (cot::$cfg['advboard']['guestUseCaptcha']) { $verify = cot_import('verify', 'P', 'TXT'); if (!cot_captcha_validate($verify)) { cot_error(cot::$L['captcha_verification_failed'], 'verify'); } } } $advert->setData($_POST); $advert->begin = $begin; $advert->expire = $expire; if (!cot::$usr['isadmin']) { if (!cot::$cfg['advboard']['cat_' . $c]['allowSticky']) { $advert->sticky = 0; } if (cot::$usr['id'] == 0) { $advert->sticky = 0; } // гости не дают срочных объявлений } $advert->category = $c; if (empty($advert->user) || !cot::$usr['isadmin']) { $advert->user = cot::$usr['id']; } $published = cot_import('published', 'P', 'BOL'); if (!$published) { $advert->state = advboard_model_Advert::DRAFT; } elseif (cot::$usr['isadmin'] || cot_auth('advboard', $c, '2')) { $advert->state = advboard_model_Advert::PUBLISHED; } else { $advert->state = advboard_model_Advert::AWAITING_MODERATION; } /* === Hook === */ foreach (cot_getextplugins('advboard.save.validate') as $pl) { include $pl; } /* ===== */ // There is some errors if (!$advert->validate() || cot_error_found()) { $urlParams = array('c' => $c, 'a' => 'edit'); if ($advert->id > 0) { $urlParams['id'] = $advert->id; } cot_redirect(cot_url('advboard', $urlParams, '', true)); } if (empty($advert->sort)) { $advert->sort = cot::$sys['now']; } $isNew = $advert->id == 0; // Сохранение if ($advert->save()) { // Для незарега запомним id страницы для чтого, чтобы он мог ее отредактировать в пределах сесии if ($isNew) { if (cot::$usr['id'] == 0) { if (empty($_SESSION['advboard'])) { $_SESSION['advboard'] = array(); } if (!in_array($id, $_SESSION['advboard'])) { $_SESSION['advboard'][] = $advert->id; } } if ($advert->state == advboard_model_Advert::PUBLISHED) { cot_message(cot::$L['advboard_created']); } } else { if ($advert->state == advboard_model_Advert::PUBLISHED) { cot_message(cot::$L['advboard_updated']); } } if ($advert->state == advboard_model_Advert::AWAITING_MODERATION) { cot_message(cot::$L['advboard_awaiting_moderation']); } elseif ($advert->state == advboard_model_Advert::DRAFT) { cot_message(cot::$L['Saved']); } $redirectUrl = $advert->getUrl(true); /* === Hook === */ foreach (cot_getextplugins('advboard.save.done') as $pl) { include $pl; } /* ===== */ // Редирект на станицу объявления cot_redirect($redirectUrl); } } $crumbs = cot_structure_buildpath('advboard', $c); if (cot::$cfg['advboard']['firstCrumb']) { array_unshift($crumbs, array(cot_url('advboard'), cot::$L['advboard_ads'])); } if (!$id) { $crumbs[] = $title = cot::$L['advboard_add_new']; cot::$out['subtitle'] = $title; } else { $crumbs[] = array($advert->url, $advert->title); $crumbs[] = cot::$L['Edit']; $title = cot::$L['advboard_advert'] . ' #' . $advert->id; if (!empty($advert->title)) { $title = $advert->title; } $title .= ': ' . cot::$L['Edit']; if (!empty(cot::$out['subtitle'])) { $title .= ' - ' . cot::$out['subtitle']; } cot::$out['subtitle'] = $title; } // Elemets placeholders $placeHolder_Person = ''; $placeHolder_Phone = ''; $placeHolder_Email = ''; $placeHolder_City = ''; //if($advboard->user == cot::$usr['id'] && cot::$usr['id'] > 0) { if (!empty($user)) { // Контакное лицо $placeHolder_Person = cot_user_full_name($user); // Телефон if (!empty($user['user_phone'])) { $placeHolder_Phone = $user['user_phone']; } // email if (!$user['user_hideemail']) { $placeHolder_Email = $user['user_email']; } // город if (!empty($user['user_city_name'])) { $placeHolder_City = $user['user_city_name']; } } // 'input_textarea_editor', 'input_textarea_medieditor', 'input_textarea_minieditor', '' $editor = 'input_textarea_editor'; /* === Hook === */ foreach (cot_getextplugins('advboard.edit.main') as $pl) { include $pl; } /* ===== */ $minYear = date('Y'); $maxYear = $minYear + 30; $price = $advert->rawValue('price'); if ($price <= 0) { $price = ''; } $formElements = array('hidden' => array('element' => cot_inputbox('hidden', 'act', 'save')), 'category' => array('element' => cot_selectbox_structure('advboard', $advert->category, 'category'), 'label' => advboard_model_Advert::fieldLabel('category')), 'price' => array('element' => cot_inputbox('text', 'price', $price), 'label' => advboard_model_Advert::fieldLabel('price'), 'hint' => cot::$L['advboard_price_hint']), 'title' => array('element' => cot_inputbox('text', 'title', $advert->rawValue('title')), 'required' => true, 'label' => advboard_model_Advert::fieldLabel('title')), 'description' => array('element' => cot_inputbox('text', 'description', $advert->rawValue('description')), 'label' => advboard_model_Advert::fieldLabel('description')), 'text' => array('element' => cot_textarea('text', $advert->rawValue('text'), 5, 120, '', $editor), 'label' => advboard_model_Advert::fieldLabel('text')), 'person' => array('element' => cot_inputbox('text', 'person', $advert->rawValue('person'), array('class' => 'form-control', 'placeholder' => $placeHolder_Person)), 'label' => advboard_model_Advert::fieldLabel('person'), 'required' => cot::$usr['id'] == 0), 'email' => array('element' => cot_inputbox('text', 'email', $advert->rawValue('email'), array('class' => 'form-control', 'placeholder' => $placeHolder_Email)), 'label' => advboard_model_Advert::fieldLabel('email')), 'city' => array('element' => cot_inputbox('text', 'city_name', $advert->rawValue('city_name'), array('class' => 'form-control', 'placeholder' => $placeHolder_City)), 'label' => advboard_model_Advert::fieldLabel('city_name'), 'required' => $category['config']['city_require']), 'phone' => array('element' => cot_inputbox('text', 'phone', $advert->rawValue('phone'), array('class' => 'form-control', 'placeholder' => $placeHolder_Phone)), 'label' => advboard_model_Advert::fieldLabel('phone'), 'required' => $category['config']['phone_require']), 'sticky' => array('element' => cot_checkbox($advert->sticky, 'sticky', advboard_model_Advert::fieldLabel('sticky')), 'label' => advboard_model_Advert::fieldLabel('sticky')), 'published' => array('element' => cot_checkbox($published, 'published', cot::$L['advboard_published'] . '?'), 'label' => cot::$L['advboard_published'] . '?'), 'begin' => array('element' => cot_selectbox_date($advert->begin, 'long', 'begin', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('begin')), 'expire' => array('element' => cot_selectbox_date($advert->expire, 'long', 'expire', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('expire')), 'sort' => array('element' => cot_selectbox_date($advert->sort, 'long', 'sort', $maxYear, $minYear), 'label' => advboard_model_Advert::fieldLabel('sort')), 'period' => array('element' => cot_selectbox('', 'period', $periodItems, array(), false), 'label' => cot::$L['advboard_period'])); if (!empty($cot_extrafields[cot::$db->advboard])) { // Extra fields for ads foreach ($cot_extrafields[cot::$db->advboard] as $exfld) { $fName = $exfld['field_name']; $formElements[$fName] = array('element' => cot_build_extrafields($fName, $exfld, $advert->rawValue($fName))); if ($exfld['field_type'] !== 'checkbox') { $formElements[$fName]['label'] = isset(cot::$L['advboard_' . $exfld['field_name'] . '_title']) ? cot::$L['advboard_' . $exfld['field_name'] . '_title'] : advboard_model_Advert::fieldLabel($fName); } } } if (cot_plugin_active('regioncity')) { $formElements['city']['element'] = rec_select2_city('city', $advert->rawValue('city'), true, array('class' => 'form-control', 'placeholder' => $placeHolder_City)); } if ($category['config']['city_require']) { $formElements['city']['required'] = true; } if ($category['config']['phone_require']) { $formElements['phone']['required'] = true; } // Hints if (!empty($user)) { // Контакное лицо $formElements['person']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . cot_user_full_name($user); // Телефон if (!empty($user['user_phone'])) { $formElements['phone']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_phone']; } // email if (!$user['user_hideemail']) { $formElements['email']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_email']; } // город if (!empty($user['user_city_name'])) { $formElements['city']['hint'] = cot::$L['advboard_leave_empty_to_use'] . ": " . $user['user_city_name']; } } if (!cot::$usr['isadmin']) { unset($formElements['begin']); unset($formElements['expire']); unset($formElements['sort']); if (cot::$usr['id'] == 0) { if (cot::$cfg['advboard']['guestEmailRequire']) { $formElements['email']['required'] = true; } // Гости не дают срочных объявлений unset($formElements['sticky']); // Капча if (cot::$cfg['advboard']['guestUseCaptcha']) { $formElements['verify'] = array('element' => cot_inputbox('text', 'verify'), 'img' => cot_captcha_generate(), 'label' => cot::$L['advboard_captcha'], 'required' => true); } } if (!cot::$cfg['advboard']['cat_' . $c]['allowSticky'] && isset($formElements['sticky'])) { unset($formElements['sticky']); } } else { // Администратор напрямую указывает дату окончания публикации unset($formElements['period']); } $actionParams = array('a' => 'edit', 'c' => $advert->category); if ($advert->id > 0) { $actionParams['id'] = $advert->id; } $view = new View(); $view->breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true); $view->page_title = $title; $view->category = $category; $view->advert = $advert; $view->user = $user; $view->formElements = $formElements; $view->formAction = cot_url('advboard', $actionParams); /* === Hook === */ foreach (cot_getextplugins('advboard.edit.view') as $pl) { include $pl; } /* ===== */ return $view->render(array('advboard', 'edit', $structure['advboard'][$c]['tpl'])); }
$extp = cot_getextplugins('payments.balance.transfers.loop'); /* ===== */ foreach ($transfers as $transfer) { $t->assign(array('TRANSFER_ROW_ID' => $transfer['trn_id'], 'TRANSFER_ROW_SUMM' => $transfer['trn_summ'], 'TRANSFER_ROW_DATE' => $transfer['trn_date'], 'TRANSFER_ROW_DONE' => $transfer['trn_done'], 'TRANSFER_ROW_COMMENT' => $transfer['trn_comment'], 'TRANSFER_ROW_STATUS' => $transfer['trn_status'], 'TRANSFER_ROW_LOCALSTATUS' => $L['payments_balance_transfer_status_' . $transfer['trn_status']])); $t->assign(cot_generate_usertags($transfer['trn_to'], 'TRANSFER_ROW_FOR_')); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.TRANSFERS.TRANSFER_ROW'); } } $t->parse('MAIN.TRANSFERS'); } else { $t->assign(array('TRANSFER_FORM_ACTION_URL' => cot_url('payments', 'm=balance&n=transfers&a=send'), 'TRANSFER_FORM_SUMM' => cot_inputbox('text', 'summ', $summ), 'TRANSFER_FORM_TAX' => !empty($taxsumm) ? $taxsumm : 0, 'TRANSFER_FORM_TOTAL' => !empty($sendersumm) ? $sendersumm : 0, 'TRANSFER_FORM_COMMENT' => cot_textarea('comment', $comment, 5, 40, '', ''), 'TRANSFER_FORM_USERNAME' => cot_inputbox('text', 'username', $username))); /* === Hook === */ foreach (cot_getextplugins('payments.balance.transfers.form') as $pl) { include $pl; } /* ===== */ cot_display_messages($t, 'MAIN.TRANSFERFORM'); $t->parse('MAIN.TRANSFERFORM'); } } if ($n == 'history') { list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['maxrowsperpage']); $totallines = $db->query("SELECT COUNT(*) FROM {$db_payments} \n\t\tWHERE pay_userid=" . $usr['id'] . " AND pay_status='done' AND pay_summ>0")->fetchColumn(); $pays = $db->query("SELECT * FROM {$db_payments} \n\t\tWHERE pay_userid=" . $usr['id'] . " AND pay_status='done' AND pay_summ>0\n\t\tORDER BY pay_pdate DESC LIMIT {$d}, " . $cfg['maxrowsperpage'])->fetchAll(); $pagenav = cot_pagenav('payments', 'm=balance', $d, $totallines, $cfg['maxrowsperpage']); $t->assign(array('HISTORY_COUNT' => $totallines, 'PAGENAV_PAGES' => $pagenav['main'], 'PAGENAV_PREV' => $pagenav['prev'], 'PAGENAV_NEXT' => $pagenav['next'], 'PAGENAV_CURRENTPAGE' => $pagenav['current']));
if (!empty($rinput['city_name'])) { $db->update($db_ls_cities, $rinput, "city_id=" . (int) $rid); } else { $db->delete($db_ls_cities, "city_id=" . (int) $rid); } } $cache && $cache->clear(); cot_redirect(cot_url('admin', 'm=other&p=locationselector&n=city&id=' . $id, '', true)); exit; } $t = new XTemplate(cot_tplfile('locationselector.city', 'plug')); $totalitems = $db->query("SELECT COUNT(*) FROM {$db_ls_cities} WHERE city_region=" . $id)->fetchColumn(); $sql = $db->query("SELECT * FROM {$db_ls_cities} WHERE city_region=" . $id . " ORDER by city_name ASC LIMIT {$d}, " . $cfg['maxrowsperpage']); $pagenav = cot_pagenav('admin', "m=other&p=locationselector&n=city&id=" . $id, $d, $totalitems, $cfg['maxrowsperpage']); $region = $db->query("SELECT * FROM {$db_ls_regions} WHERE region_id=" . (int) $id)->fetch(); $jj = 0; while ($item = $sql->fetch()) { $jj++; $t->assign(array("CITY_ROW_NAME" => cot_inputbox('text', 'rname[' . $item['city_id'] . ']', $item['city_name']), "CITY_ROW_DEL_URL" => cot_url('admin', 'm=other&p=locationselector&n=city&id=' . $id . '&a=del&cid=' . $item['city_id']))); $t->parse("MAIN.ROWS"); } if ($jj == 0) { $t->parse("MAIN.NOROWS"); } $t->assign(array("ADD_FORM_NAME" => cot_textarea('rname', '', 10, 60), "ADD_FORM_ACTION_URL" => cot_url('admin', 'm=other&p=locationselector&n=city&id=' . $id . '&a=add', '', true), "ADD_FORM_TITLE" => $title)); $t->parse("MAIN.ADDFORM"); $t->assign(array("EDIT_FORM_ACTION_URL" => cot_url('admin', 'm=other&p=locationselector&n=city&id=' . $id . '&a=edit&d=' . $d_url, '', true), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "COUNTRY_NAME" => $cot_countries[$region['region_country']], "REGION_NAME" => $region['region_name'])); $adminpath[] = array(cot_url('admin', 'm=other&p=locationselector&n=region&country=' . $region['region_country']), $cot_countries[$region['region_country']]); $adminpath[] = array(cot_url('admin', 'm=other&p=locationselector&n=city&id=' . $region['region_name']), $region['region_name']); $t->parse("MAIN"); $plugin_body .= $t->text("MAIN");
/** * Generates comments display for a given item * * @param string $ext_name Module or plugin code * @param string $code Item identifier * @param string $cat Item category code (optional) * @param bool $force_admin Enforces user to be administrator of comments for this item. * E.g. to moderate his wall even if he is not a moderator * @return string Rendered HTML output for comments * @global CotDB $db */ function cot_comments_display($ext_name, $code, $cat = '', $force_admin = false) { global $db, $db_com, $db_users, $cfg, $usr, $L, $sys, $R, $env, $pg, $cot_extrafields, $cache, $structure; // Check permissions and enablement list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'comments'); if ($auth_read && $auth_write && $force_admin) { $auth_admin = true; $_SESSION['cot_comments_force_admin'][$ext_name][$code] = true; } $enabled = cot_comments_enabled($ext_name, $cat, $code); if (!$auth_read || !$enabled && !$auth_admin) { return ''; } $comments_join_columns = $comments_join_tables = $comments_join_where = ''; // Get the URL and parameters $link_area = $env['ext']; $link_params = $_GET; if (defined('COT_PLUG')) { $link_area = 'plug'; $link_params['e'] = $env['ext']; } if (isset($_GET['rwr'])) { unset($link_params['rwr'], $link_params['e']); } $cot_com_back = array($link_area, $link_params); $_SESSION['cot_com_back'][$ext_name][$cat][$code] = $cot_com_back; $d_var = 'dcm'; list($pg, $d, $durl) = cot_import_pagenav($d_var, $cfg['plugin']['comments']['maxcommentsperpage']); $d = empty($d) ? 0 : (int) $d; if ($auth_write && $enabled) { require_once cot_incfile('forms'); } $t = new XTemplate(cot_tplfile('comments', 'plug')); /* == Hook == */ foreach (cot_getextplugins('comments.main') as $pl) { include $pl; } /* ===== */ $editor = cot::$cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : ''; $t->assign(array('COMMENTS_CODE' => $code, 'COMMENTS_FORM_SEND' => cot_url('plug', "e=comments&a=send&area={$ext_name}&cat={$cat}&item={$code}"), 'COMMENTS_FORM_AUTHOR' => $usr['id'] > 0 ? $usr['name'] : cot_inputbox('text', 'rname'), 'COMMENTS_FORM_AUTHORID' => $usr['id'], 'COMMENTS_FORM_TEXT' => $auth_write && $enabled ? cot_textarea('rtext', $rtext, 7, 120, '', $editor) . cot_inputbox('hidden', 'cb', base64_encode(serialize($cot_com_back))) : '', 'COMMENTS_DISPLAY' => $cfg['plugin']['comments']['expand_comments'] ? '' : 'none')); if ($auth_write && $enabled) { // Extra fields if (!empty(cot::$extrafields[cot::$db->com])) { foreach (cot::$extrafields[cot::$db->com] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $rcomments[$exfld['field_name']]); $exfld_title = cot_extrafield_title($exfld, 'comments_'); $t->assign(array('COMMENTS_FORM_' . $uname => $exfld_val, 'COMMENTS_FORM_' . $uname . '_TITLE' => $exfld_title, 'COMMENTS_FORM_EXTRAFLD' => $exfld_val, 'COMMENTS_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.EXTRAFLD'); } } $allowed_time = cot_build_timegap($sys['now'] - $cfg['plugin']['comments']['time'] * 60, $sys['now']); $com_hint = cot_rc('com_edithint', array('time' => $allowed_time)); /* == Hook == */ foreach (cot_getextplugins('comments.newcomment.tags') as $pl) { include $pl; } /* ===== */ $usr['id'] == 0 && $t->parse('COMMENTS.COMMENTS_NEWCOMMENT.GUEST'); if ($usr['id'] == 0 && cot_check_messages() && $cache) { if ($ext_name == 'page' && $cfg['cache_page']) { $cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$cat]['path'])); $cfg['cache_page'] = false; } } cot_display_messages($t, 'COMMENTS.COMMENTS_NEWCOMMENT'); $t->assign('COMMENTS_FORM_HINT', $com_hint); $t->parse('COMMENTS.COMMENTS_NEWCOMMENT'); } else { $warning = $enabled ? $L['com_regonly'] : $L['com_closed']; $t->assign('COMMENTS_CLOSED', $warning); $t->parse('COMMENTS.COMMENTS_CLOSED'); } $order = $cfg['plugin']['comments']['order'] == 'Chronological' ? 'ASC' : 'DESC'; $comments_order = "com_id {$order}"; /* == Hook == */ foreach (cot_getextplugins('comments.query') as $pl) { include $pl; } /* ===== */ $sql = $db->query("SELECT c.*, u.* {$comments_join_columns}\n\t\tFROM {$db_com} AS c LEFT JOIN {$db_users} AS u ON u.user_id = c.com_authorid {$comments_join_tables}\n\t\tWHERE com_area = ? AND com_code = ? {$comments_join_where} ORDER BY {$comments_order} LIMIT ?, ?", array($ext_name, $code, (int) $d, (int) $cfg['plugin']['comments']['maxcommentsperpage'])); if ($sql->rowCount() > 0 && $enabled) { $i = $d; $kk = 0; $totalitems = cot_comments_count($ext_name, $code); /* === Hook - Part1 : Set === */ $extp = cot_getextplugins('comments.loop'); /* ===== */ foreach ($sql->fetchAll() as $row) { $i++; $kk++; $com_admin = $auth_admin ? cot_rc('comments_code_admin', array('ipsearch' => cot_build_ipsearch($row['com_authorip']), 'delete_url' => cot_confirm_url(cot_url('plug', 'e=comments&a=delete&cat=' . $cat . '&id=' . $row['com_id'] . '&' . cot_xg()), 'comments', 'comments_confirm_delete'))) : ''; $com_text = cot_parse($row['com_text'], $cfg['plugin']['comments']['markup']); $time_limit = $sys['now'] < $row['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE; $usr['isowner_com'] = $time_limit && ($usr['id'] > 0 && $row['com_authorid'] == $usr['id'] || $usr['id'] == 0 && !empty($_SESSION['cot_comments_edit'][$row['com_id']]) && $usr['ip'] == $row['com_authorip']); $com_gup = $sys['now'] - ($row['com_date'] + $cfg['plugin']['comments']['time'] * 60); $allowed_time = $usr['isowner_com'] && !$usr['isadmin'] ? ' - ' . cot_build_timegap($sys['now'] + $com_gup, $sys['now']) . $L['plu_comgup'] : ''; $com_edit = $auth_admin || $usr['isowner_com'] ? cot_rc('comments_code_edit', array('edit_url' => cot_url('plug', 'e=comments&m=edit&cat=' . $cat . '&id=' . $row['com_id']), 'allowed_time' => $allowed_time)) : ''; if ($row['com_area'] == 'page') { if ($usr['id'] == 0 && $usr['isowner_com'] && $cfg['cache_page']) { $cfg['cache_page'] = $cfg['cache_index'] = false; } } $t->assign(array('COMMENTS_ROW_ID' => $row['com_id'], 'COMMENTS_ROW_ORDER' => $cfg['plugin']['comments']['order'] == 'Recent' ? $totalitems - $i + 1 : $i, 'COMMENTS_ROW_URL' => cot_url($link_area, $link_params, '#c' . $row['com_id']), 'COMMENTS_ROW_AUTHOR' => cot_build_user($row['com_authorid'], htmlspecialchars($row['com_author'])), 'COMMENTS_ROW_AUTHORID' => $row['com_authorid'], 'COMMENTS_ROW_TEXT' => $com_text, 'COMMENTS_ROW_DATE' => cot_date('datetime_medium', $row['com_date']), 'COMMENTS_ROW_DATE_STAMP' => $row['com_date'], 'COMMENTS_ROW_ADMIN' => $com_admin, 'COMMENTS_ROW_EDIT' => $com_edit, 'COMMENTS_ROW_ODDEVEN' => cot_build_oddeven($kk), 'COMMENTS_ROW_NUM' => $kk)); // Extrafields if (!empty(cot::$extrafields[cot::$db->com])) { foreach (cot::$extrafields[cot::$db->com] as $exfld) { $tag = mb_strtoupper($exfld['field_name']); $exfld_title = cot_extrafield_title($exfld, 'comments_'); $t->assign(array('COMMENTS_ROW_' . $tag . '_TITLE' => $exfld_title, 'COMMENTS_ROW_' . $tag => cot_build_extrafields_data('comments', $exfld, $row['com_' . $exfld['field_name']]), 'COMMENTS_ROW_' . $tag . '_VALUE' => $row['com_' . $exfld['field_name']])); } } $t->assign(cot_generate_usertags($row, 'COMMENTS_ROW_AUTHOR_', htmlspecialchars($row['com_author']))); /* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('COMMENTS.COMMENTS_ROW'); } $pagenav = cot_pagenav($link_area, $link_params, $d, $totalitems, $cfg['plugin']['comments']['maxcommentsperpage'], $d_var, '#comments', $cfg['jquery'] && $cfg['ajax_enabled'], 'comments', 'plug', "e=comments&area={$ext_name}&cat={$cat}&item={$code}"); $t->assign(array('COMMENTS_PAGES_INFO' => cot_rc('comments_code_pages_info', array('totalitems' => $totalitems, 'onpage' => $i - $d)), 'COMMENTS_PAGES_TOTALITEMS' => $totalitems, 'COMMENTS_PAGES_PAGESPREV' => $pagenav['prev'], 'COMMENTS_PAGES_PAGNAV' => $pagenav['main'], 'COMMENTS_PAGES_PAGESNEXT' => $pagenav['next'])); $t->parse('COMMENTS.PAGNAVIGATOR'); } elseif (!$sql->rowCount() && $enabled) { $t->assign(array('COMMENTS_EMPTYTEXT' => $L['com_nocommentsyet'])); $t->parse('COMMENTS.COMMENTS_EMPTY'); } /* == Hook == */ foreach (cot_getextplugins('comments.tags') as $pl) { include $pl; } /* ===== */ $t->parse('COMMENTS'); $res_display = $t->text('COMMENTS'); return $res_display; }
/* === Hook - Part2 : Include === */ foreach ($extp as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.TABLE.EXTRAFIELDS_ROW'); } $tags_list = ''; $tags_list_li = ''; if (is_array($extra_whitelist[$n]['tags'])) { foreach ($extra_whitelist[$n]['tags'] as $ktags => $vtags) { $tags_list .= cot_rc('admin_exflds_array', array('tplfile' => $ktags, 'tags' => $vtags)); $tags_list_li .= '<li>' . cot_rc('admin_exflds_array', array('tplfile' => $ktags, 'tags' => $vtags)) . '</li>'; } } $t->assign(array('ADMIN_EXTRAFIELDS_URL_FORM_EDIT' => cot_url('admin', 'm=extrafields&n=' . $n . '&a=upd&d=' . $durl), 'ADMIN_EXTRAFIELDS_NAME' => cot_inputbox('text', 'field_name', '', 'class="exfldname"'), 'ADMIN_EXTRAFIELDS_DESCRIPTION' => cot_textarea('field_description', '', 1, 30, 'class="exflddesc"'), 'ADMIN_EXTRAFIELDS_SELECT' => cot_selectbox('input', 'field_type', $field_types, $field_types, false, 'class="exfldtype"'), 'ADMIN_EXTRAFIELDS_VARIANTS' => cot_textarea('field_variants', '', 1, 60, 'class="exfldvariants"'), 'ADMIN_EXTRAFIELDS_PARAMS' => cot_textarea('field_params', '', 1, 60, 'class="exfldparams"'), 'ADMIN_EXTRAFIELDS_HTML' => cot_textarea('field_html', '', 1, 60, 'class="exfldhtml"'), 'ADMIN_EXTRAFIELDS_DEFAULT' => cot_textarea('field_default', '', 1, 60, 'class="exflddefault"'), 'ADMIN_EXTRAFIELDS_REQUIRED' => cot_checkbox(0, 'field_required', '', 'class="exfldrequired"'), 'ADMIN_EXTRAFIELDS_PARSE' => cot_selectbox('HTML', 'field_parse', $parse_type, array($L['Default'], $L['No']), false, 'class="exfldparse"'), 'ADMIN_EXTRAFIELDS_URL_FORM_ADD' => cot_url('admin', 'm=extrafields&n=' . $n . '&a=add&d=' . $durl), 'ADMIN_EXTRAFIELDS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_EXTRAFIELDS_PAGNAV' => $pagenav['main'], 'ADMIN_EXTRAFIELDS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_EXTRAFIELDS_TOTALITEMS' => $totalitems, 'ADMIN_EXTRAFIELDS_TAGS' => $tags_list)); cot_display_messages($t); if (isset($extra_whitelist[$n]['help'])) { $adminhelp = $extra_whitelist[$n]['help']; } else { $adminhelp = $L['adm_help_info']; if (!empty($tags_list)) { $adminhelp .= $L['adm_help_newtags'] . '<ul class="follow">' . $tags_list_li . '</ul>'; } } /* === Hook === */ foreach (cot_getextplugins('admin.extrafields.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.TABLE');
$variants = cot_import($variantss[$name], 'D', "HTM"); $default = cot_import($defaults[$name], 'D', "HTM"); $type = cot_import($types[$name], 'D', "INT"); cfg_editor::config_edit($c, $name, $order, $title, $desc, $type, $default, $variants); } cot_message('updated_success'); $cache && $cache->clear(); cot_redirect(cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c), '', true)); } if ($a == 'delete') { cot_check_xg(); $name = cot_import('rname', 'G', "ALP"); cfg_editor::config_delete($c, $name); cot_message('deleted_success'); $cache && $cache->clear(); cot_redirect(cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c), '', true)); } $rows = cfg_editor::config_list($c); foreach ($rows as $row) { $readonly = array(); if ($row['config_donor'] != 'configeditor') { $readonly = array('readonly' => 'readonly', 'disabled' => 'disabled'); } $t->assign(array('FORM_EDIT_NAME' => $row['config_name'], 'FORM_EDIT_TITLE' => cot_inputbox('text', 'rtitle[' . $row['config_name'] . ']', isset($L['cfg_' . $row['config_name']]) ? $L['cfg_' . $row['config_name']] : $row['config_text'], array('maxlength' => '255') + $readonly), 'FORM_EDIT_DESC' => cot_textarea('rdesc[' . $row['config_name'] . ']', isset($L['cfg_' . $row['config_name'] . '_hint']) ? $L['cfg_' . $row['config_name'] . '_hint'] : $row['config_desc'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_ORDER' => cot_inputbox('text', 'rorder[' . $row['config_name'] . ']', $row['config_order'], array('maxlength' => '2') + $readonly), 'FORM_EDIT_VARIANTS' => cot_textarea('rvariants[' . $row['config_name'] . ']', $row['config_variants'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_DEFAULT' => cot_textarea('rdefault[' . $row['config_name'] . ']', $row['config_default'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_TYPE' => cot_selectbox($row['config_type'], 'rtype[' . $row['config_name'] . ']', array_keys($types_array), array_values($types_array), false, $readonly), 'FORM_EDIT_DELETE_URL' => $row['config_donor'] != 'configeditor' ? '' : cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c, 'a' => 'delete', 'rname' => $row['config_name'], 'x' => $sys['xk'])))); $t->parse('MAIN.ROW'); } if (!count($rows)) { $t->parse('MAIN.NOROW'); } $t->assign(array('FORM_EDIT_URL' => cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'a' => 'update', 'c' => $c)), 'FORM_ADD_URL' => cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'a' => 'add', 'c' => $c)), 'FORM_ADD_TITLE' => cot_inputbox('text', 'rtitle', '', array('maxlength' => '255')), 'FORM_ADD_NAME' => cot_inputbox('text', 'rname', '', array('size' => '20', 'maxlength' => '32')), 'FORM_ADD_DESC' => cot_textarea('rdesc', '', 2, 60), 'FORM_ADD_ORDER' => cot_inputbox('text', 'rorder', '', array('maxlength' => '2')), 'FORM_ADD_VARIANTS' => cot_textarea('rvariants', '', 2, 60), 'FORM_ADD_DEFAULT' => cot_textarea('rdefault', '', 2, 60), 'FORM_ADD_TYPE' => cot_selectbox(0, 'rtype', array_keys($types_array), array_values($types_array), false))); cot_display_messages($t);
$context['extra' . $exfld['field_name'] . '_value'] = $rcontact['contact_' . $exfld['field_name']]; } } $context['extra'] = $rextras; $rtextm = cot_rc(empty(cot::$cfg['plugin']['contact']['template']) ? cot::$R['contact_message'] : cot::$cfg['plugin']['contact']['template'], $context); cot_mail($semail, $rcontact['contact_subject'], $rtextm, $headers); } $sent = true; cot_message('contact_message_sent'); cot_extrafield_movefiles(); } } 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');
$title[] = !$id ? $L['pmsend_title'] : $L['Edit'] . ' #' . $id; $url_newpm = cot_url('pm', 'm=send'); $url_inbox = cot_url('pm'); $url_sentbox = cot_url('pm', 'f=sentbox'); if (COT_AJAX) { // Attach rich text editors to AJAX loaded page $rc_tmp = $out['footer_rc']; $out['footer_rc'] = ''; if (is_array($cot_plugins['editor'])) { foreach ($cot_plugins['editor'] as $k) { if ($k['pl_code'] == $editor && cot_auth('plug', $k['pl_code'], 'R')) { include $cfg['plugins_dir'] . '/' . $k['pl_file']; break; } } } $text_editor_code = $out['footer_rc']; $out['footer_rc'] = $rc_tmp; } $t->assign(array('PMSEND_TITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PMSEND_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PMSEND_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PMSEND_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_INBOX_URL' => $url_inbox, 'PMSEND_INBOX_COUNT' => $totalinbox, 'PMSEND_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PMSEND_SENTBOX_URL' => $url_sentbox, 'PMSEND_SENTBOX_COUNT' => $totalsentbox, 'PMSEND_FORM_SEND' => cot_url('pm', 'm=send&a=send' . $idurl), 'PMSEND_FORM_TITLE' => cot_inputbox('text', 'newpmtitle', htmlspecialchars($newpmtitle), 'size="56" maxlength="255"'), 'PMSEND_FORM_TEXT' => cot_textarea('newpmtext', $newpmtext, 8, 56, '', 'input_textarea_editor') . $text_editor_code, 'PMSEND_FORM_TOUSER' => cot_textarea('newpmrecipient', $touser, 3, 56, 'class="userinput"'), 'PMSEND_FORM_NOT_TO_SENTBOX' => cot_checkbox(false, 'fromstate', cot::$L['pm_notmovetosentbox'], '', '3'))); /* === Hook === */ foreach (cot_getextplugins('pm.send.tags') as $pl) { include $pl; } /* ===== */ if (!$id) { $t->parse('MAIN.PMSEND_USERLIST'); } $t->parse('MAIN'); $t->out('MAIN'); require_once $cfg['system_dir'] . '/footer.php';
$title_params = array('EDIT' => $L['Edit'], 'NAME' => $urr['user_name']); $out['subtitle'] = cot_title('{EDIT} - {NAME}', $title_params); $out['head'] .= $R['code_noindex']; $mskin = cot_tplfile(array('users', 'edit', $usr['maingrp']), 'module'); /* === Hook === */ foreach (cot_getextplugins('users.edit.main') as $pl) { include $pl; } /* ===== */ require_once $cfg['system_dir'] . '/header.php'; $t = new XTemplate($mskin); require_once cot_incfile('forms'); $protected = $sys['protecttopadmin'] ? array('disabled' => 'disabled') : array(); $editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : ''; $delete_pfs = cot_module_active('pfs') ? cot_checkbox(false, 'ruserdelpfs', $L['PFS']) : ''; $t->assign(array('USERS_EDIT_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name']), array(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit'])), $cfg['homebreadcrumb']), 'USERS_EDIT_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_EDIT_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_EDIT_SUBTITLE' => $L['useed_subtitle'], 'USERS_EDIT_SEND' => cot_url('users', 'm=edit&a=update&' . cot_xg() . '&id=' . $urr['user_id']), 'USERS_EDIT_ID' => $urr['user_id'], 'USERS_EDIT_NAME' => cot_inputbox('text', 'rusername', $urr['user_name'], array('size' => 32, 'maxlength' => 100) + $protected), 'USERS_EDIT_ACTIVE' => $user_form_active, 'USERS_EDIT_BANNED' => $user_form_banned, 'USERS_EDIT_THEME' => cot_inputbox('text', 'rusertheme', $urr['user_theme'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_LANG' => cot_inputbox('text', 'ruserlang', $urr['user_lang'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_NEWPASS' => cot_inputbox('password', 'rusernewpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off') + $protected), 'USERS_EDIT_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_EDIT_GROUPS' => cot_build_groupsms($urr['user_id'], $usr['isadmin'], $urr['user_maingrp']), 'USERS_EDIT_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_EDIT_EMAIL' => cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64)), 'USERS_EDIT_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_EDIT_TEXT' => cot_textarea('rusertext', $urr['user_text'], 4, 56, array('class' => $editor_class)), 'USERS_EDIT_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_EDIT_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_EDIT_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_EDIT_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_EDIT_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_EDIT_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_EDIT_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_EDIT_LOGCOUNT' => $urr['user_logcount'], 'USERS_EDIT_LASTIP' => cot_build_ipsearch($urr['user_lastip']), 'USERS_EDIT_DELETE' => $sys['user_istopadmin'] ? cot_radiobox(0, 'ruserdelete', array(1, 0), array($L['Yes'], $L['No'])) . $delete_pfs : $L['na'])); // Extra fields foreach ($cot_extrafields[$db_users] as $exfld) { $tag = strtoupper($exfld['field_name']); $t->assign(array('USERS_EDIT_' . $tag => cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]), 'USERS_EDIT_' . $tag . '_TITLE' => isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description'])); } // Error and message reporting cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('users.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $t->out('MAIN'); require_once $cfg['system_dir'] . '/footer.php';
include $pl; } /* ===== */ cot_mail($cfg['adminemail'], $rsubject, $rbody); cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true)); exit; } cot_redirect(cot_url('marketorders', 'm=addclaim&id=' . $id, '', true)); exit; } $out['subtitle'] = $L['marketorders_neworder_title']; $out['head'] .= $R['code_noindex']; $mskin = cot_tplfile(array('marketorders', 'addclaim', $structure['market'][$item['item_cat']]['tpl']), 'plug'); /* === Hook === */ foreach (cot_getextplugins('marketorders.addclaim.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); $catpatharray[] = array(cot_url('market'), $L['market']); $catpatharray[] = array('', $L['marketorders_addclaim_title']); $catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true); $t->assign(array("BREADCRUMBS" => $catpath)); // Error and message handling cot_display_messages($t); $t->assign(array("CLAIM_FORM_SEND" => cot_url('marketorders', 'm=addclaim&id=' . $id . '&a=add'), "CLAIM_FORM_TEXT" => cot_textarea('rclaimtext', '', 5, 60))); /* === Hook === */ foreach (cot_getextplugins('marketorders.addclaim.tags') as $pl) { include $pl; } /* ===== */
$com_grp = $usr['isadmin'] ? 'adm' : 'usr'; cot_log('Edited comment #' . $id, $com_grp); cot_redirect(cot_url($url_area, $url_params, '#c' . $id, true)); } } $t->assign(array('COMMENTS_TITLE' => $plugin_title, 'COMMENTS_TITLE_URL' => cot_url('plug', 'e=comments'))); $t->parse('MAIN.COMMENTS_TITLE'); $sql = $db->query("SELECT * FROM {$db_com} WHERE com_id=? AND com_code=? AND com_area=?", array($id, $item, $area)); cot_die($sql->rowCount() != 1); $com = $sql->fetch(); $com_limit = $sys['now'] < $com['com_date'] + $cfg['plugin']['comments']['time'] * 60 ? TRUE : FALSE; $usr['isowner'] = $com_limit && ($usr['id'] > 0 && $com['com_authorid'] == $usr['id'] || $usr['id'] == 0 && isset($_SESSION['cot_comments_edit'][$id])); $usr['allow_write'] = $usr['isadmin'] || $usr['isowner']; cot_block($usr['allow_write']); $editor = $cfg['plugin']['comments']['markup'] ? 'input_textarea_minieditor' : ''; $t->assign(array('COMMENTS_FORM_POST' => cot_url('plug', 'e=comments&m=edit&a=update&area=' . $area . '&cat=' . $cat . '&item=' . $com['com_code'] . '&id=' . $com['com_id']), 'COMMENTS_POSTER_TITLE' => $L['Poster'], 'COMMENTS_POSTER' => $com['com_author'], 'COMMENTS_IP_TITLE' => $L['Ip'], 'COMMENTS_IP' => $com['com_authorip'], 'COMMENTS_DATE_TITLE' => $L['Date'], 'COMMENTS_DATE' => cot_date('datetime_medium', $com['com_date']), 'COMMENTS_DATE_STAMP' => $com['com_date'], 'COMMENTS_FORM_UPDATE_BUTTON' => $L['Update'], 'COMMENTS_FORM_TEXT' => cot_textarea('comtext', $com['com_text'], 8, 64, '', $editor))); // Extra fields foreach ($cot_extrafields[$db_com] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('rcomments' . $exfld['field_name'], $exfld, $com[$exfld['field_name']]); $exfld_title = isset($L['comments_' . $exfld['field_name'] . '_title']) ? $L['comments_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $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_FORM_EDIT.EXTRAFLD'); } /* == Hook == */ foreach (cot_getextplugins('comments.edit.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.COMMENTS_FORM_EDIT'); }
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; }
$t->assign(array('POST_FORM_ACTION' => cot_url('sbr', 'id=' . $id . '&num=' . $num . '&a=addpost'), 'POST_FORM_TO' => cot_selectbox($to, 'to', $R['sbr_posts_to_values'], $R['sbr_posts_to_titles']))); cot_display_messages($t, 'MAIN.SBR.POSTS.POSTFORM'); $t->parse('MAIN.SBR.POSTS.POSTFORM'); $t->parse('MAIN.SBR.POSTS'); /* === Hook === */ foreach (cot_getextplugins('sbr.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN.SBR'); } if ($action == 'done') { // Действие доступно только для заказчика cot_block($role == 'employer'); $t->assign(array('STAGEDONE_FORM_ACTION' => cot_url('sbr', 'id=' . $id . '&num=' . $num . '&a=done'), 'STAGEDONE_FORM_TEXT' => cot_textarea('rtext', $rtext, 5, 80))); cot_display_messages($t, 'MAIN.STAGEDONE'); $t->parse('MAIN.STAGEDONE'); } if ($action == 'claim') { $stage = $db->query("SELECT * FROM {$db_sbr_stages} WHERE stage_sid=" . $id . " AND stage_num=" . $num)->fetch(); cot_block(!empty($role) && $sbr['sbr_status'] == 'process' && $stage['stage_status'] == 'process'); $t->assign(array('CLAIM_FORM_ACTION' => cot_url('sbr', 'id=' . $id . '&num=' . $num . '&a=claim'), 'CLAIM_FORM_TEXT' => cot_textarea('rtext', $rtext, 5, 80))); cot_display_messages($t, 'MAIN.CLAIM'); $t->parse('MAIN.CLAIM'); } if ($action == 'decision') { cot_block($usr['isadmin'] && $sbr['sbr_status'] == 'claim'); $t->assign(array('DECISION_FORM_ACTION' => cot_url('sbr', 'id=' . $id . '&num=' . $num . '&a=decision'), 'DECISION_FORM_TEXT' => cot_textarea('rdecisiontext', $rtext, 5, 80), 'DECISION_FORM_PAYPERFORMER' => cot_inputbox('text', 'payperformer', $payperformer), 'DECISION_FORM_PAYEMPLOYER' => cot_inputbox('text', 'payemployer', $payemployer))); cot_display_messages($t, 'MAIN.DECISION'); $t->parse('MAIN.DECISION'); }
/* === Hook - Part4 : Include === */ foreach ($extp4 as $pl) { include $pl; } /* ===== */ $t_o->parse("MAIN.ROWS"); } $addoffer_enabled = true; /* === Hook === */ foreach (cot_getextplugins('projects.addofferform.main') as $pl) { include $pl; } /* ===== */ $sql = $db->query("SELECT * FROM {$db_projects_offers} WHERE offer_pid=" . $id . " AND offer_userid=" . $usr['id'] . ""); if ($sql->fetchColumn() == 0 && $addoffer_enabled && $usr['auth_offers'] && $usr['id'] != $item['item_userid'] && empty($performer)) { $t_o->assign(array("OFFER_FORM_COSTMIN" => cot_inputbox('text', 'costmin', $roffer['offer_cost_min'], 'size="7"'), "OFFER_FORM_COSTMAX" => cot_inputbox('text', 'costmax', $roffer['offer_cost_max'], 'size="7"'), "OFFER_FORM_TIMEMIN" => cot_inputbox('text', 'timemin', $roffer['offer_time_min'], 'size="7"'), "OFFER_FORM_TIMEMAX" => cot_inputbox('text', 'timemax', $roffer['offer_time_max'], 'size="7"'), "OFFER_FORM_TEXT" => cot_textarea('offertext', $roffer['offer_text'], 7, 40), "OFFER_FORM_HIDDEN" => cot_checkbox(0, 'hidden', $L['offers_hide_offer']), "OFFER_FORM_ACTION_URL" => cot_url('projects', 'id=' . $id . '&a=addoffer'), "OFFER_FORM_TIMETYPE" => cot_selectbox($timetype, 'timetype', array_keys($L['offers_timetype']), array_values($L['offers_timetype']), false))); // Extra fields foreach ($cot_extrafields[$db_projects_offers] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('roffer' . $exfld['field_name'], $exfld, $roffer['offer_' . $exfld['field_name']]); $exfld_title = isset($L['offers_' . $exfld['field_name'] . '_title']) ? $L['offers_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t_o->assign(array('OFFER_FORM_' . $uname => $exfld_val, 'OFFER_FORM_' . $uname . '_TITLE' => $exfld_title, 'OFFER_FORM_EXTRAFLD' => $exfld_val, 'OFFER_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t_o->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('projects.addofferform.tags') as $pl) { include $pl; } /* ===== */ $t_o->parse("MAIN.ADDOFFERFORM"); }
if (empty($rpage['page_cat']) && !empty($c)) { $rpage['page_cat'] = $c; $usr['isadmin'] = cot_auth('page', $rpage['page_cat'], 'A'); } $out['subtitle'] = $L['page_addsubtitle']; $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; }
/** * Returns config input * @param array $cfg_var Array with config Variable parameters * @return string */ function cot_config_input($cfg_var) { $name = $cfg_var['config_name']; $type = $cfg_var['config_type']; $value = $cfg_var['config_value']; $options = $cfg_var['config_variants']; $config_input = ''; switch ($type) { case COT_CONFIG_TYPE_STRING: $config_input = cot_inputbox('text', $name, $value); break; case COT_CONFIG_TYPE_SELECT: if (!empty($options)) { $params = explode(',', $options); $params_titles = cot_config_selecttitles($name, $params); } $config_input = is_array($params) ? cot_selectbox($value, $name, $params, $params_titles, false) : cot_inputbox('text', $name, $value); break; case COT_CONFIG_TYPE_RADIO: global $L; if (!empty($options)) { $params = explode(',', $options); $params_titles = cot_config_selecttitles($name, $params); if (empty($value)) { $value = $cfg_var['config_default']; } } else { $params = array(1, 0); $params_titles = array($L['Yes'], $L['No']); } $config_input = cot_radiobox($value, $name, $params, $params_titles, '', ' '); break; case COT_CONFIG_TYPE_RANGE: $range = preg_split('#\\s*,\\s*#', $options); $params = range($range[0], $range[1], empty($range[2]) ? 1 : $range[2]); $config_input = cot_selectbox($value, $name, $params, $params, false); break; case COT_CONFIG_TYPE_CUSTOM: if (preg_match('#^(\\w+)\\((.*?)\\)$#', $options, $mt) && function_exists($mt[1])) { $callback_params = preg_split('#\\s*,\\s*#', $mt[2]); if (count($callback_params) > 0 && !empty($callback_params[0])) { for ($i = 0; $i < count($callback_params); $i++) { $callback_params[$i] = str_replace(array("'", '"'), array('', ''), $callback_params[$i]); } } $config_input = call_user_func_array($mt[1], array_merge(array($cfg_var), $callback_params)); } else { $config_input = cot_inputbox('text', $name, $value); } break; case COT_CONFIG_TYPE_CALLBACK: if (preg_match('#^(\\w+)\\((.*?)\\)$#', $options, $mt) && function_exists($mt[1])) { $callback_params = preg_split('#\\s*,\\s*#', $mt[2]); if (count($callback_params) > 0 && !empty($callback_params[0])) { for ($i = 0; $i < count($callback_params); $i++) { $callback_params[$i] = str_replace("'", '', $callback_params[$i]); $callback_params[$i] = str_replace('"', '', $callback_params[$i]); } $params = call_user_func_array($mt[1], $callback_params); } else { $params = call_user_func($mt[1]); } // assume associative array as value=>title $assoc = range(0, count($params) - 1) != array_keys($params); if ($assoc) { $assoc_titles = array_values($params); $params = array_keys($params); } $params_titles = cot_config_selecttitles($name, $params); if ($assoc && $params_titles == $params) { $params_titles = $assoc_titles; } $config_input = cot_selectbox($value, $name, $params, $params_titles, false); } break; case COT_CONFIG_TYPE_HIDDEN: case COT_CONFIG_TYPE_SEPARATOR: break; default: $config_input = cot_textarea($name, $value, 8, 56); break; } return $config_input; }
if (empty($ritem['item_type']) && !empty($type)) { $ritem['item_type'] = $type; } $out['subtitle'] = $L['folio_add_work_title']; $out['head'] .= $R['code_noindex']; $sys['sublocation'] = $structure['folio'][$c]['title']; $mskin = cot_tplfile(array('folio', 'add', $structure['folio'][$ritem['item_cat']]['tpl'])); /* === Hook === */ foreach (cot_getextplugins('folio.add.main') as $pl) { include $pl; } /* ===== */ $t = new XTemplate($mskin); // Error and message handling cot_display_messages($t); $t->assign(array("PRDADD_FORM_SEND" => cot_url('folio', 'm=add&c=' . $c . '&a=add'), "PRDADD_FORM_CAT" => cot_selectbox_structure('folio', $ritem['item_cat'], 'rcat'), "PRDADD_FORM_CATTITLE" => !empty($c) ? $structure['folio'][$c]['title'] : '', "PRDADD_FORM_TITLE" => cot_inputbox('text', 'rtitle', $ritem['item_title'], 'size="56"'), "PRDADD_FORM_ALIAS" => cot_inputbox('text', 'ralias', $ritem['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRDADD_FORM_TEXT" => cot_textarea('rtext', $ritem['item_text'], 10, 60, 'id="formtext"', 'input_textarea_editor'), "PRDADD_FORM_COST" => cot_inputbox('text', 'rcost', $ritem['item_cost'], 'size="10"'), "PRDADD_FORM_PARSER" => cot_selectbox($cfg['folio']['parser'], 'rparser', $parser_list, $parser_list, false))); // Extra fields foreach ($cot_extrafields[$db_folio] as $exfld) { $uname = strtoupper($exfld['field_name']); $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $ritem['item_' . $exfld['field_name']]); $exfld_title = isset($L['folio_' . $exfld['field_name'] . '_title']) ? $L['folio_' . $exfld['field_name'] . '_title'] : $exfld['field_description']; $t->assign(array('PRDADD_FORM_' . $uname => $exfld_val, 'PRDADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRDADD_FORM_EXTRAFLD' => $exfld_val, 'PRDADD_FORM_EXTRAFLD_TITLE' => $exfld_title)); $t->parse('MAIN.EXTRAFLD'); } /* === Hook === */ foreach (cot_getextplugins('folio.add.tags') as $pl) { include $pl; } /* ===== */ $t->parse('MAIN'); $module_body = $t->text('MAIN');
cot_redirect(cot_url('plug', "e=i18n&m=page&a=edit&id={$id}&l={$i18n_locale}", '', true)); exit; } $db->update($db_i18n_pages, $pag_i18n, "ipage_id = ? AND ipage_locale = ?", array($id, $i18n_locale)); /* === Hook === */ foreach (cot_getextplugins('i18n.page.edit.update') as $pl) { include $pl; } /* =============*/ cot_message('Updated'); $page_urlp = empty($pag['page_alias']) ? 'c=' . $pag['page_cat'] . "&id={$id}&l={$i18n_locale}" : 'c=' . $pag['page_cat'] . '&al=' . $pag['page_alias'] . '&l=' . $i18n_locale; cot_redirect(cot_url('page', $page_urlp, '', true, false, true)); } $out['subtitle'] = $L['i18n_editing']; $t = new XTemplate(cot_tplfile('i18n.page', 'plug')); $t->assign(array('I18N_ACTION' => cot_url('plug', "e=i18n&m=page&a=edit&id={$id}&l={$i18n_locale}"), 'I18N_TITLE' => $L['i18n_editing'], 'I18N_ORIGINAL_LANG' => $i18n_locales[$cfg['defaultlang']], 'I18N_LOCALIZED_LANG' => $i18n_locales[$i18n_locale], 'I18N_PAGE_TITLE' => htmlspecialchars($pag['page_title']), 'I18N_PAGE_DESC' => htmlspecialchars($pag['page_desc']), 'I18N_PAGE_TEXT' => cot_parse($pag['page_text'], $cfg['page']['markup']), 'I18N_IPAGE_TITLE' => htmlspecialchars($pag_i18n['ipage_title']), 'I18N_IPAGE_DESC' => htmlspecialchars($pag_i18n['ipage_desc']), 'I18N_IPAGE_TEXT' => cot_textarea('translate_text', $pag_i18n['ipage_text'], 32, 80, '', 'input_textarea_editor'))); cot_display_messages($t); /* === Hook === */ foreach (cot_getextplugins('i18n.page.edit.tags') as $pl) { include $pl; } /* =============*/ } elseif ($a == 'delete' && ($i18n_admin || $usr['id'] == $pag['ipage_translatorid'])) { // Send to trashcan if available if ($cfg['plugin']['trashcan']['trash_page']) { require_once cot_incfile('trashcan', 'plug'); $row = $db->query("SELECT * FROM {$db_i18n_pages}\n\t\t\t\tWHERE ipage_id = {$id} AND ipage_locale = '{$i18n_locale}'")->fetch(); cot_trash_put('i18n_page', $L['i18n_translation'] . " #{$id} ({$i18n_locale}) " . $row['ipage_title'], $id, $row); } $db->delete($db_i18n_pages, "ipage_id = {$id} AND ipage_locale = '{$i18n_locale}'"); /* === Hook === */
/** * Returns Extra fields edit fields * * @param string $name Variable name * @param array $extrafields Extra fields data * @param string $data Existing data for fields * @return string */ function cot_build_extrafields($name, $extrafield, $data) { global $L, $R, $cfg, $pl; $data = $data == null ? $extrafield['field_default'] : $data; switch ($extrafield['field_type']) { case 'input': case 'inputint': case 'currency': case 'double': $result = cot_inputbox('text', $name, $data, '', $extrafield['field_html']); break; case 'textarea': $result = cot_textarea($name, $data, 4, 56, '', $extrafield['field_html']); break; case 'select': $extrafield['field_variants'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_variants']); $opt_array = explode(",", $extrafield['field_variants']); $ii = 0; $options_titles = $options_values = array(); foreach ($opt_array as $var) { $ii++; $var = trim($var); $options_titles[$ii] = !empty($L[$extrafield['field_name'] . '_' . $var]) ? $L[$extrafield['field_name'] . '_' . $var] : $var; $options_values[$ii] = $var; } $result = cot_selectbox(trim($data), $name, $options_values, $options_titles, false, '', $extrafield['field_html']); break; case 'radio': $extrafield['field_variants'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_variants']); $opt_array = explode(",", $extrafield['field_variants']); $options_titles = $options_values = array(); if (count($opt_array) > 0) { $ii = 0; foreach ($opt_array as $var) { $ii++; $var = trim($var); $options_titles[$ii] = !empty($L[$extrafield['field_name'] . '_' . $var]) ? $L[$extrafield['field_name'] . '_' . $var] : $var; $options_values[$ii] = $var; } } $result = cot_radiobox(trim($data), $name, $options_values, $options_titles, '', '', $extrafield['field_html']); break; case 'checkbox': $result = cot_checkbox($data, $name, $extrafield['field_description'], '', '1', $extrafield['field_html']); break; case 'datetime': global $sys; $extrafield['field_params'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_params']); list($min, $max, $format) = explode(",", $extrafield['field_params'], 3); $max = (int) $max > 0 ? $max : 2030; $min = (int) $min > 0 ? $min : 2000; $data = mb_substr($data, 0, 1) == "+" ? $sys['now'] + (int) mb_substr($data, 1) : $data; $data = mb_substr($data, 0, 1) == "-" ? $sys['now'] - (int) mb_substr($data, 1) : $data; $result = cot_selectbox_date((int) $data, 'long', $name, (int) $max, (int) $min, true, $extrafield['field_html']); break; case 'country': global $cot_countries; $result = cot_selectbox_countries(trim($data), $name, true, '', $extrafield['field_html']); break; case 'range': $extrafield['field_params'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_params']); list($min, $max) = explode(',', $extrafield['field_params'], 2); $result = cot_selectbox(trim($data), $name, range((int) $min, (int) $max), range((int) $min, (int) $max), true, '', $extrafield['field_html']); break; case 'checklistbox': $extrafield['field_variants'] = str_replace(array(' , ', ', ', ' ,'), ',', $extrafield['field_variants']); $opt_array = explode(",", $extrafield['field_variants']); $options_titles = $options_values = array(); if (count($opt_array) > 0) { $ii = 0; foreach ($opt_array as $var) { $ii++; $var = trim($var); $options_titles[$ii] = !empty($L[$extrafield['field_name'] . '_' . $var]) ? $L[$extrafield['field_name'] . '_' . $var] : $var; $options_values[$ii] = $var; } } if (!is_array($data)) { $data = trim(str_replace(array(' , ', ', ', ' ,'), ',', $data)); $data = explode(',', $data); } $result = cot_checklistbox($data, $name, $options_values, $options_titles, '', '', true, $extrafield['field_html']); break; case 'file': $extrafield['field_params'] = !empty($extrafield['field_params']) ? $extrafield['field_params'] : $cfg['extrafield_files_dir']; $extrafield['field_params'] .= mb_substr($extrafield['field_params'], -1) == '/' ? '' : '/'; $data_filepath = $extrafield['field_params'] . htmlspecialchars($data); /* === Hook === */ foreach (cot_getextplugins('extrafields.build.file') as $pl) { include $pl; } /* ===== */ $result = cot_filebox($name, htmlspecialchars($data), $data_filepath, 'rdel_' . $name, '', $extrafield['field_html']); break; default: $result = ''; break; } return $result; }