本文整理汇总了PHP中cmsCore::inRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::inRequest方法的具体用法?PHP cmsCore::inRequest怎么用?PHP cmsCore::inRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::inRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_arhive
function applet_arhive()
{
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES_ARCHIVE']);
$cfg = $inCore->loadComponentConfig('content');
$cfg_arhive = $inCore->loadComponentConfig('arhive');
cpAddPathway($_LANG['AD_ARTICLE_SITE'], 'index.php?view=tree');
cpAddPathway($_LANG['AD_ARTICLES_ARCHIVE'], 'index.php?view=arhive');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'saveconfig') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$cfg['source'] = cmsCore::request('source', 'str', '');
$inCore->saveComponentConfig('arhive', $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=arhive&do=config');
}
if ($do == 'config') {
$toolmenu = array(array('icon' => 'folders.gif', 'title' => $_LANG['AD_LIST_OF_ARTICLES'], 'link' => '?view=arhive'));
cpToolMenu($toolmenu);
cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
cmsCore::c('page')->initTemplate('applets', 'arhive')->assign('cfg_arhive', $cfg_arhive)->display();
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=arhive&do=config'), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=arhive&do=delete&multiple=1');"));
cpToolMenu($toolmenu);
//TABLE COLUMNS
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_CREATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => 15, 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=content&do=edit&id=%id%', 'filter' => 15), array('title' => $_LANG['AD_PARTITION'], 'field' => 'category_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpCatById', 'filterlist' => cpGetList('cms_category')));
//ACTIONS
$actions = array(array('title' => $_LANG['AD_TO_ARTICLES_CATALOG'], 'icon' => 'arhive_off.gif', 'link' => '?view=arhive&do=arhive_off&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=content&do=delete&id=%id%', 'confirm' => $_LANG['AD_DELETE_MATERIALS']));
//Print table
cpListTable('cms_content', $fields, $actions, 'is_arhive=1');
}
if ($do == 'arhive_off') {
if (cmsCore::inRequest('id')) {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '0');
cmsCore::redirect('?view=arhive');
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id, $cfg['af_delete']);
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'), $cfg['af_delete']);
}
cmsCore::redirect('?view=arhive');
}
}
示例2: __construct
public function __construct()
{
$this->inDB = cmsDatabase::getInstance();
$this->inCore = cmsCore::getInstance();
$this->query = self::getQuery();
$this->look = cmsCore::request('look', 'str', 'allwords');
$this->page = cmsCore::request('page', 'int', 1);
$this->from_pubdate = cmsCore::request('from_pubdate', 'str', '');
$this->order_by_date = cmsCore::inRequest('order_by_date') ? cmsCore::request('order_by_date', 'int', 0) : 1;
$this->from_component = self::getComponentsArrayForSearch();
$this->config = $this->inCore->loadComponentConfig('search');
cmsCore::loadLib('tags');
$this->getComponentsWithSupportSearch();
$this->parametrs_array = $this->gatherAnArrayOfQueryParametrs();
}
示例3: mod_invite
function mod_invite($mod, $cfg) {
global $_LANG;
$errors = false;
$is_redirect = false; // в модуле нельзя использовать cmsCore::redirectBack(), используем костыли ;)
if (cmsCore::inRequest('send_invite_email')) {
$is_redirect = true;
$username = cmsCore::request('username', 'str', '');
$email = cmsCore::request('friend_email', 'email', '');
if (!$username && !cmsCore::c('user')->id) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_NAME'], 'error'); $errors = true;
}
if (cmsCore::c('user')->id) {
$username = cmsCore::c('user')->nickname;
}
if (!$email) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_MAIL'], 'error'); $errors = true;
}
if (!$errors) {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$letter = cmsCore::getLanguageTextFile('mail_invite');
$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
$letter = str_replace('{site_url}', HOST, $letter);
$letter = str_replace('{username}', $username, $letter);
cmsCore::mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $username), $letter);
cmsCore::addSessionMessage($_LANG['INVITE_SENDED'], 'success');
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('user_id', cmsCore::c('user')->id)->
assign('is_redirect', $is_redirect)->
display();
return true;
}
示例4: die
<?php
if (!defined('VALID_CMS')) {
die('ACCESS DENIED');
}
///////////////////// форма загрузки фотографий 1 шаг //////////////////////////
if ($do_photo == 'addphoto') {
$inPage->addPathway($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_1']);
$inPage->setTitle($_LANG['ADD_PHOTO'] . ': ' . $_LANG['STEP_1']);
if (!cmsCore::inRequest('submit')) {
$inPage->initAutocomplete();
$autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
cmsPage::initTemplate('components', 'com_photos_add1')->assign('no_tags', false)->assign('is_admin', $inUser->is_admin)->assign('cfg', $model->config)->assign('autocomplete_js', $autocomplete_js)->display('com_photos_add1.tpl');
}
if (cmsCore::inRequest('submit')) {
$mod = array();
$mod['title'] = cmsCore::request('title', 'str', '');
$mod['description'] = cmsCore::request('description', 'str');
$mod['is_multi'] = cmsCore::request('only_mod', 'int', 0);
$mod['tags'] = cmsCore::request('tags', 'str');
$mod['comments'] = $inUser->is_admin ? cmsCore::request('comments', 'int') : 1;
if ($model->config['seo_user_access'] || $inUser->is_admin) {
$mod['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
$mod['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
$mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
}
cmsUser::sessionPut('mod', $mod);
cmsCore::redirect('/photos/' . $album['id'] . '/submit_photo.html');
}
}
////////////////// форма загрузки фотографий 2 шаг /////////////////////////////
示例5: users
function users()
{
header('X-Frame-Options: DENY');
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
global $_LANG;
$model = new cms_model_users();
// id пользователя
$id = cmsCore::request('id', 'int', 0);
// логин пользователя
$login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
$do = $inCore->do;
$page = cmsCore::request('page', 'int', 1);
$pagetitle = $inCore->getComponentTitle();
if ($model->config['sw_search'] != 2) {
$inPage->addPathway($pagetitle, '/users');
}
$inPage->setTitle($pagetitle);
$inPage->setDescription($pagetitle);
// js только авторизованным
if ($inUser->id) {
$inPage->addHeadJS('components/users/js/profile.js');
$inPage->addHeadJsLang(array('CONFIRM_CLEAN_CAT', 'CHOOSE_RECIPIENT', 'SEND_TO_USER', 'FRIENDSHIP_OFFER', 'STOP_FRIENDLY', 'REALY_STOP_FRIENDLY', 'ENTER_STATUS', 'HAVE_JUST'));
}
//============================================================================//
//========================= Список пользователей ============================//
//============================================================================//
if ($do == 'view') {
// если запрещен просмотр всех пользователей, 404
if ($model->config['sw_search'] == 2) {
cmsCore::error404();
}
//очищаем поисковые запросы если пришли со другой страницы
if (!strstr(cmsCore::getBackURL(), '/users')) {
cmsUser::sessionClearAll();
}
$stext = array();
// Возможные входные переменные
$name = cmsCore::getSearchVar('name');
$city = cmsCore::getSearchVar('city');
$hobby = cmsCore::getSearchVar('hobby');
$gender = cmsCore::getSearchVar('gender');
$orderby = cmsCore::request('orderby', array('karma', 'rating', 'regdate'), 'regdate');
$orderto = cmsCore::request('orderto', array('asc', 'desc'), 'desc');
$age_to = (int) cmsCore::getSearchVar('ageto', 'all');
$age_fr = (int) cmsCore::getSearchVar('agefrom', 'all');
$group_id = cmsCore::request('group_id', 'int', 0);
// Флаг о показе только онлайн пользователей
if (cmsCore::inRequest('online')) {
cmsUser::sessionPut('usr_online', (bool) cmsCore::request('online', 'int'));
$page = 1;
}
$only_online = cmsUser::sessionGet('usr_online');
if ($only_online) {
$stext[] = $_LANG['SHOWING_ONLY_ONLINE'];
}
///////////////////////////////////////
//////////Условия выборки//////////////
///////////////////////////////////////
// группа
if ($group_id) {
$model->whereUserGroupIs($group_id);
$link['group'] = '/users/group/' . $group_id;
$_LANG['GROUP_SEARCH_NAME'] = cmsUser::getGroupTitle($group_id);
}
// Добавляем в выборку имя, если оно есть
if ($name) {
$model->whereNameIs($name);
$stext[] = $_LANG['NAME'] . " — " . htmlspecialchars(stripslashes($name));
}
// Добавляем в выборку город, если он есть
if ($city) {
$model->whereCityIs($city);
$stext[] = $_LANG['CITY'] . " — " . htmlspecialchars(stripslashes($city));
}
// Добавляем в выборку хобби, если есть
if ($hobby) {
$model->whereHobbyIs($hobby);
$stext[] = $_LANG['HOBBY'] . " — " . htmlspecialchars(stripslashes($hobby));
}
// Добавляем в выборку пол, если есть
if ($gender) {
$model->whereGenderIs($gender);
if ($gender == 'm') {
$stext[] = $_LANG['MALE'];
} else {
$stext[] = $_LANG['FEMALE'];
}
}
// Добавляем в выборку возраст, более
if ($age_fr) {
$model->whereAgeFrom($age_fr);
$stext[] = $_LANG['NOT_YOUNG'] . " {$age_fr} " . $_LANG['YEARS'];
}
// Добавляем в выборку возраст, менее
if ($age_to) {
$model->whereAgeTo($age_to);
$stext[] = $_LANG['NOT_OLD'] . " {$age_fr} " . $_LANG['YEARS'];
//.........这里部分代码省略.........
示例6: cpListTable
function cpListTable($table, $_fields, $_actions, $where = '', $orderby = 'title')
{
$event = 'ADMIN_CPLISTTABLE_' . strtoupper($table) . '_' . strtoupper($GLOBALS['applet']) . (!empty($GLOBALS['component']) ? '_' . strtoupper($GLOBALS['component']) : '');
list($table, $_fields, $_actions, $where, $orderby) = cmsCore::callEvent($event, array($table, $_fields, $_actions, $where, $orderby));
global $_LANG;
$inDB = cmsDatabase::getInstance();
$perpage = 60;
$sql = 'SELECT *';
$is_actions = sizeof($_actions);
foreach ($_fields as $key => $value) {
if (isset($_fields[$key]['fdate'])) {
$sql .= ", DATE_FORMAT(" . $_fields[$key]['field'] . ", '" . $_fields[$key]['fdate'] . "') as `" . $_fields[$key]['field'] . "`";
}
}
$sql .= ' FROM ' . $table;
if (isset($_SESSION['filter_table']) && $_SESSION['filter_table'] != $table) {
unset($_SESSION['filter']);
}
if (cmsCore::inRequest('nofilter')) {
unset($_SESSION['filter']);
cmsCore::redirect('/admin/index.php?' . str_replace('&nofilter', '', $_SERVER['QUERY_STRING']));
}
$filter = false;
if (cmsCore::inRequest('filter')) {
$filter = cmsCore::request('filter', 'array_str', '');
$_SESSION['filter'] = $filter;
} elseif (isset($_SESSION['filter'])) {
$filter = $_SESSION['filter'];
}
if ($filter) {
$f = 0;
$sql .= ' WHERE 1=1';
foreach ($filter as $key => $value) {
if ($filter[$key] && $filter[$key] != -100) {
$sql .= ' AND ';
if (!is_numeric($filter[$key])) {
$sql .= $key . " LIKE '%" . $filter[$key] . "%'";
} else {
$sql .= $key . " = '" . $filter[$key] . "'";
}
$f++;
}
}
if (!isset($_SESSION['filter'])) {
$_SESSION['filter'] = $filter;
}
}
if (mb_strlen($where) > 3) {
if (mb_strstr($sql, 'WHERE')) {
$sql .= ' AND ' . $where;
} else {
$sql .= ' WHERE ' . $where;
}
}
$sort = cmsCore::request('sort', 'str', '');
if ($sort == false) {
if ($orderby) {
$sort = $orderby;
} else {
foreach ($_fields as $key => $value) {
if ($_fields[$key]['field'] == 'ordering' && $sort != 'NSLeft') {
$sort = 'ordering';
$so = 'asc';
}
}
}
}
if ($sort) {
$sql .= ' ORDER BY ' . $sort;
if (cmsCore::inRequest('so')) {
$sql .= ' ' . cmsCore::request('so', 'str', '');
}
}
$page = cmsCore::request('page', 'int', 1);
$total_rs = $inDB->query($sql);
$total = $inDB->num_rows($total_rs);
$sql .= " LIMIT " . ($page - 1) * $perpage . ", {$perpage}";
$result = $inDB->query($sql);
$_SESSION['filter_table'] = $table;
if ($inDB->error()) {
unset($_SESSION['filter']);
cmsCore::redirect('/admin/index.php?' . $_SERVER['QUERY_STRING']);
}
$filters = 0;
$f_html = '';
//Find and render filters
foreach ($_fields as $key => $value) {
if (isset($_fields[$key]['filter'])) {
$f_html .= '<td width="">' . $_fields[$key]['title'] . ': </td>';
if (!isset($filter[$_fields[$key]['field']])) {
$initval = '';
} else {
$initval = $filter[$_fields[$key]['field']];
}
$f_html .= '<td width="">';
$inputname = 'filter[' . $_fields[$key]['field'] . ']';
if (!isset($_fields[$key]['filterlist'])) {
$f_html .= '<input name="' . $inputname . '" type="text" size="' . $_fields[$key]['filter'] . '" class="filter_input" value="' . $initval . '"/></td>';
} else {
$f_html .= cpBuildList($inputname, $_fields[$key]['filterlist'], $initval);
//.........这里部分代码省略.........
示例7: registration
function registration()
{
header('X-Frame-Options: DENY');
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$inConf = cmsConfig::getInstance();
$model = new cms_model_registration();
cmsCore::loadModel('users');
$users_model = new cms_model_users();
global $_LANG;
$do = $inCore->do;
//============================================================================//
if ($do == 'sendremind') {
if ($inUser->id) {
cmsCore::error404();
}
$inPage->setTitle($_LANG['REMINDER_PASS']);
$inPage->addPathway($_LANG['REMINDER_PASS']);
if (!cmsCore::inRequest('goremind')) {
cmsPage::initTemplate('components', 'com_registration_sendremind')->display('com_registration_sendremind.tpl');
} else {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$email = cmsCore::request('email', 'email', '');
if (!$email) {
cmsCore::addSessionMessage($_LANG['ERR_EMAIL'], 'error');
cmsCore::redirectBack();
}
$usr = cmsUser::getShortUserData($email);
if (!$usr || $usr['is_locked'] || $usr['is_deleted']) {
cmsCore::addSessionMessage($_LANG['ADRESS'] . ' "' . $email . '" ' . $_LANG['NOT_IN_OUR_BASE'], 'error');
cmsCore::redirectBack();
}
if (cmsUser::userIsAdmin($usr['id'])) {
cmsCore::addSessionMessage($_LANG['NOT_ADMIN_SENDREMIND'], 'error');
cmsCore::redirectBack();
}
$usercode = md5($usr['id'] . '-' . uniqid() . '-' . microtime() . '-' . PATH);
$sql = "INSERT cms_users_activate (pubdate, user_id, code)\n VALUES (NOW(), '{$usr['id']}', '{$usercode}')";
$inDB->query($sql);
$newpass_link = HOST . '/registration/remind/' . $usercode;
$mail_message = $_LANG['HELLO'] . ', ' . $usr['nickname'] . '!' . "\n\n";
$mail_message .= $_LANG['REMINDER_TEXT'] . ' "' . $inConf->sitename . '".' . "\n\n";
$mail_message .= $_LANG['YOUR_LOGIN'] . ': ' . $usr['login'] . "\n\n";
$mail_message .= $_LANG['NEW_PASS_LINK'] . ":\n" . $newpass_link . "\n\n";
$mail_message .= $_LANG['LINK_EXPIRES'] . "\n\n";
$mail_message .= $_LANG['SIGNATURE'] . ', ' . $inConf->sitename . ' (' . HOST . ').' . "\n";
$mail_message .= date('d-m-Y (H:i)');
$inCore->mailText($email, $inConf->sitename . ' - ' . $_LANG['REMINDER_PASS'], $mail_message);
cmsCore::addSessionMessage($_LANG['NEW_PAS_SENDED'], 'info');
cmsCore::redirect('/login');
}
}
//============================================================================//
if ($do == 'remind') {
if ($inUser->id) {
cmsCore::error404();
}
$usercode = cmsCore::request('code', 'str', '');
//проверяем формат кода
if (!preg_match('/^[0-9a-f]{32}$/i', $usercode)) {
cmsCore::error404();
}
// проверяем код
$user_id = $inDB->get_field('cms_users_activate', "code = '{$usercode}'", 'user_id');
if (!$user_id) {
cmsCore::error404();
}
//получаем пользователя
$user = $inDB->get_fields('cms_users', "id = '{$user_id}'", '*');
if (!$user) {
cmsCore::error404();
}
if (cmsUser::userIsAdmin($user['id'])) {
cmsCore::error404();
}
if (cmsCore::inRequest('submit')) {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$errors = false;
$pass = cmsCore::request('pass', 'str', '');
$pass2 = cmsCore::request('pass2', 'str', '');
if (!$pass) {
cmsCore::addSessionMessage($_LANG['TYPE_PASS'], 'error');
$errors = true;
}
if ($pass && !$pass2) {
cmsCore::addSessionMessage($_LANG['TYPE_PASS_TWICE'], 'error');
$errors = true;
}
if ($pass && $pass2 && mb_strlen($pass) < 6) {
cmsCore::addSessionMessage($_LANG['PASS_SHORT'], 'error');
$errors = true;
}
if ($pass && $pass2 && $pass != $pass2) {
cmsCore::addSessionMessage($_LANG['WRONG_PASS'], 'error');
//.........这里部分代码省略.........
示例8: clubs
//.........这里部分代码省略.........
} else {
$club['photo_albums'] = array();
}
}
// Получаем плагины
$plugins = cmsCore::callTabEventPlugins('GET_SINGLE_CLUB', $club);
cmsPage::initTemplate('components', 'com_clubs_view_club')->
assign('club', $club)->
assign('is_access', $is_access)->
assign('user_id', $inUser->id)->
assign('is_admin', $is_admin)->
assign('is_moder', $is_moder)->
assign('plugins', $plugins)->
assign('is_member', $is_member)->
assign('is_photo_karma_enabled', ((($inUser->karma >= $club['photo_min_karma']) && $is_member) ? true : false))->
assign('is_blog_karma_enabled', ((($inUser->karma >= $club['blog_min_karma']) && $is_member) ? true : false))->
assign('cfg', $model->config)->
display();
}
///////////////////////// СОЗДАНИЕ КЛУБА ///////////////////////////////////////
if ($do == 'create'){
if(!cmsCore::isAjax()) { return false; }
if(!$inUser->id){ return false; }
$can_create = $model->canCreate();
// показываем форму
if (!cmsCore::inRequest('create') ){
cmsPage::initTemplate('components', 'com_clubs_create')->
assign('can_create', $can_create)->
assign('last_message', $model->last_message)->
display();
cmsCore::jsonOutput(array('error' => false,
'can_create' => (bool)$can_create,
'html' => ob_get_clean()));
}
if (cmsCore::inRequest('create')){
if (!$can_create){ return false; }
$title = $inCore->request('title', 'str');
$clubtype = $inCore->request('clubtype', 'str');
if (!$title || !in_array($clubtype, array('public','private'))){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['CLUB_REQ_TITLE']));
}
if ($inDB->get_field('cms_clubs', "LOWER(title) = '".mb_strtolower($title)."'", 'id')){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['CLUB_EXISTS']));
}
if(!cmsUser::checkCsrfToken()) { return false; }
$club_id = $model->addClub(array('admin_id'=>$inUser->id,
'title'=>$title,
'clubtype'=>$clubtype,
'create_karma'=>$inUser->karma,
示例9: applet_config
function applet_config()
{
// получаем оригинальный конфиг
$config = cmsConfig::getDefaultConfig();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_SITE_SETTING'];
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
$do = cmsCore::request('do', 'str', 'list');
if ($do == 'save') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$newCFG = array();
$newCFG['sitename'] = stripslashes(cmsCore::request('sitename', 'str', ''));
$newCFG['title_and_sitename'] = cmsCore::request('title_and_sitename', 'int', 0);
$newCFG['title_and_page'] = cmsCore::request('title_and_page', 'int', 0);
$newCFG['hometitle'] = stripslashes(cmsCore::request('hometitle', 'str', ''));
$newCFG['homecom'] = cmsCore::request('homecom', 'str', '');
$newCFG['siteoff'] = cmsCore::request('siteoff', 'int', 0);
$newCFG['debug'] = cmsCore::request('debug', 'int', 0);
$newCFG['offtext'] = htmlspecialchars(cmsCore::request('offtext', 'str', ''), ENT_QUOTES);
$newCFG['keywords'] = cmsCore::request('keywords', 'str', '');
$newCFG['metadesc'] = cmsCore::request('metadesc', 'str', '');
$newCFG['seourl'] = cmsCore::request('seourl', 'int', 0);
$newCFG['lang'] = cmsCore::request('lang', 'str', 'ru');
$newCFG['is_change_lang'] = cmsCore::request('is_change_lang', 'int', 0);
$newCFG['sitemail'] = cmsCore::request('sitemail', 'str', '');
$newCFG['sitemail_name'] = cmsCore::request('sitemail_name', 'str', '');
$newCFG['wmark'] = cmsCore::request('wmark', 'str', '');
$newCFG['template'] = cmsCore::request('template', 'str', '');
$newCFG['splash'] = cmsCore::request('splash', 'int', 0);
$newCFG['slight'] = cmsCore::request('slight', 'int', 0);
$newCFG['db_host'] = $config['db_host'];
$newCFG['db_base'] = $config['db_base'];
$newCFG['db_user'] = $config['db_user'];
$newCFG['db_pass'] = $config['db_pass'];
$newCFG['db_prefix'] = $config['db_prefix'];
$newCFG['show_pw'] = cmsCore::request('show_pw', 'int', 0);
$newCFG['last_item_pw'] = cmsCore::request('last_item_pw', 'int', 0);
$newCFG['index_pw'] = cmsCore::request('index_pw', 'int', 0);
$newCFG['fastcfg'] = cmsCore::request('fastcfg', 'int', 0);
$newCFG['mailer'] = cmsCore::request('mailer', 'str', '');
$newCFG['smtpsecure'] = cmsCore::request('smtpsecure', 'str', '');
$newCFG['smtpauth'] = cmsCore::request('smtpauth', 'int', 0);
$newCFG['smtpuser'] = cmsCore::inRequest('smtpuser') ? cmsCore::request('smtpuser', 'str', '') : $config['smtpuser'];
$newCFG['smtppass'] = cmsCore::inRequest('smtppass') ? cmsCore::request('smtppass', 'str', '') : $config['smtppass'];
$newCFG['smtphost'] = cmsCore::request('smtphost', 'str', '');
$newCFG['smtpport'] = cmsCore::request('smtpport', 'int', '25');
$newCFG['timezone'] = cmsCore::request('timezone', 'str', '');
$newCFG['timediff'] = cmsCore::request('timediff', 'str', '');
$newCFG['user_stats'] = cmsCore::request('user_stats', 'int', 0);
$newCFG['allow_ip'] = cmsCore::request('allow_ip', 'str', '');
if (cmsConfig::saveToFile($newCFG)) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
}
cmsCore::clearCache();
cmsCore::redirect('index.php?view=config');
}
?>
<div>
<?php
cpCheckWritable('/includes/config.inc.php');
?>
<div id="config_tabs" class="uitabs">
<ul id="tabs">
<li><a href="#basic"><span><?php
echo $_LANG['AD_SITE'];
?>
</span></a></li>
<li><a href="#home"><span><?php
echo $_LANG['AD_MAIN'];
?>
</span></a></li>
<li><a href="#design"><span><?php
echo $_LANG['AD_DESIGN'];
?>
</span></a></li>
<li><a href="#time"><span><?php
echo $_LANG['AD_TIME'];
?>
</span></a></li>
<li><a href="#database"><span><?php
echo $_LANG['AD_DB'];
?>
</span></a></li>
<li><a href="#mail"><span><?php
echo $_LANG['AD_POST'];
?>
</span></a></li>
//.........这里部分代码省略.........
示例10: applet_content
function applet_content() {
$inCore = cmsCore::getInstance();
cmsCore::m('content');
global $_LANG;
//check access
global $adminAccess;
if (!cmsUser::isAdminCan('admin/content', $adminAccess)) { cpAccessDenied(); }
$cfg = $inCore->loadComponentConfig('content');
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
$do = cmsCore::request('do', 'str', 'add');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'arhive_on') {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '1');
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO_ARHIVE'], 'success');
cmsCore::redirectBack();
}
if ($do == 'move') {
$item_id = cmsCore::request('id', 'int', 0);
$cat_id = cmsCore::request('cat_id', 'int', 0);
$dir = cmsCore::request('dir', 'str');
$step = 1;
cmsCore::m('content')->moveItem($item_id, $cat_id, $dir, $step);
cmsCore::halt(1);
}
if ($do == 'move_to_cat') {
$items = cmsCore::request('item', 'array_int');
$to_cat_id = cmsCore::request('obj_id', 'int', 0);
if ($items && $to_cat_id) {
$last_ordering = (int)cmsCore::c('db')->get_field('cms_content', "category_id = '". $to_cat_id ."' ORDER BY ordering DESC", 'ordering');
foreach ($items as $item_id) {
$article = cmsCore::m('content')->getArticle($item_id);
if (!$article) { continue; }
$last_ordering++;
cmsCore::m('content')->updateArticle(
$article['id'],
array(
'category_id' => $to_cat_id,
'ordering' => $last_ordering,
'url' => $article['url'],
'title' => cmsCore::c('db')->escape_string($article['title']),
'id' => $article['id'],
'user_id' => $article['user_id']
)
);
}
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_TO'], 'success');
}
cmsCore::redirect('?view=tree&cat_id='. $to_cat_id);
}
if ($do == 'show') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) { cmsCore::c('db')->setFlag('cms_content', $id, 'published', '1'); }
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_content', cmsCore::request('item', 'array_int'), 'published', '1');
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) { cmsCore::c('db')->setFlag('cms_content', $id, 'published', '0'); }
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_content', cmsCore::request('item', 'array_int'), 'published', '0');
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id);
cmsCore::addSessionMessage($_LANG['AD_ARTICLE_REMOVE'], 'success');
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'));
cmsCore::addSessionMessage($_LANG['AD_ARTICLES_REMOVE'], 'success');
}
cmsCore::redirectBack();
}
if ($do == 'update'){
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
//.........这里部分代码省略.........
示例11: applet_repairnested
function applet_repairnested()
{
$inCore = cmsCore::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$tables = array();
$tables[0]['name'] = 'cms_category';
$tables[0]['title'] = $_LANG['AD_ARTICLES_TREE'];
$tables[0]['differ'] = '';
$tables[1]['name'] = 'cms_photo_albums';
$tables[1]['title'] = $_LANG['AD_ALBUMS_TREE'];
$tables[1]['differ'] = '';
$tables[3]['name'] = 'cms_board_cats';
$tables[3]['title'] = $_LANG['AD_DESK_TREE'];
$tables[3]['differ'] = '';
$tables[4]['name'] = 'cms_uc_cats';
$tables[4]['title'] = $_LANG['AD_CATALOG_TREE'];
$tables[4]['differ'] = '';
$tables[5]['name'] = 'cms_menu';
$tables[5]['title'] = $_LANG['AD_MENU_TREE'];
$tables[5]['differ'] = '';
$tables[6]['name'] = 'cms_forums';
$tables[6]['title'] = $_LANG['AD_FORUMS_TREE'];
$tables[6]['differ'] = '';
if ($inCore->isComponentInstalled('maps')) {
$tables[7]['name'] = 'cms_map_cats';
$tables[7]['title'] = $_LANG['AD_MAPS_TREE'];
$tables[7]['differ'] = '';
}
if ($inCore->isComponentInstalled('video')) {
$tables[8]['name'] = 'cms_video_category';
$tables[8]['title'] = $_LANG['AD_VIDEO_TREE'];
$tables[8]['differ'] = '';
}
if ($inCore->isComponentInstalled('shop')) {
$tables[9]['name'] = 'cms_shop_cats';
$tables[9]['title'] = $_LANG['AD_SHOP_TREE'];
$tables[9]['differ'] = '';
}
if (cmsCore::inRequest('tables')) {
if (is_array($_POST['tables'])) {
foreach ($_POST['tables'] as $table_id) {
if (cmsCore::request('go_repair', 'int', 0)) {
repairNestedSet($tables[(int) $table_id]);
} else {
if (cmsCore::request('go_repair_tree', 'int', 0)) {
if (tree_all_ns($tables[(int) $table_id]['name']) !== false) {
cmsCore::addSessionMessage($tables[(int) $table_id]['title'] . ' ' . $_LANG['AD_RESTORED'], 'success');
}
}
}
}
}
}
$GLOBALS['cp_page_title'] = $_LANG['AD_CHECKING_TREES'];
cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
cpAddPathway($_LANG['AD_CHECKING_TREES'], 'index.php?view=repairnested');
$GLOBALS['cp_page_head'][] = '<script type="text/javascript" src="/admin/js/repair.js"></script>';
$errors_found = false;
echo '<h3>' . $_LANG['AD_TREE_FULL'] . '</h3>';
echo '<div style="margin:20px; margin-top:0px;">';
echo '<form method="post" action="" id="repairform">';
echo '<input id="go_repair" type="hidden" name="go_repair" value="0">';
echo '<input id="go_repair_tree" type="hidden" name="go_repair_tree" value="0">';
echo '<table cellpadding="2">';
foreach ($tables as $id => $table) {
$errors = checkNestedSet($table);
echo '<tr>';
echo '<td width="15">' . ($errors ? '<input type="checkbox" name="tables[]" value="' . $id . '" checked="checked"/>' : '') . '</td>';
echo '<td><div>';
echo '<span>' . $table['title'] . '</span> — ' . ($errors ? '<span style="color:red">' . $_LANG['AD_ERROR_FOUND'] . '</span>' : '<span style="color:green">' . $_LANG['AD_NO_ERROR_FOUND'] . '</span>');
echo '</div></td>';
echo '</tr>';
if ($errors) {
$errors_found = true;
}
}
echo '</table>';
echo '</div>';
if ($errors_found) {
echo '<div style="margin-bottom:20px">';
echo '<input type="button" onclick="repairTreesRoot()" value="' . $_LANG['AD_REPAIR'] . '"> ';
echo '<input type="button" onclick="repairTrees()" value="' . $_LANG['AD_REPAIR_TOTREE'] . '">';
echo '</div>';
}
cmsPage::displayLangJS(array('AD_REPAIR_CONFIRM', 'AD_REPAIR_TOTREE_CONFIRM'));
}
示例12: assign
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
$is_moder = $model->checkUserRightsInClub('moderator');
if (!$is_admin && !$is_moder) { cmsCore::halt(); }
if (!cmsCore::inRequest('goadd')){
cmsPage::initTemplate('components', 'com_blog_edit_cat')->
assign('mod', $cat)->
assign('form_action', ($bdo=='newcat' ? '/clubs/'.$blog['id'].'/newcat.html' : '/clubs/editcat'.$cat['id'].'.html'))->
display();
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
if (cmsCore::inRequest('goadd')){
if(!cmsUser::checkCsrfToken()) { cmsCore::halt(); }
$new_cat['title'] = cmsCore::request('title', 'str', '');
$new_cat['description'] = cmsCore::request('description', 'str', '');
$new_cat['blog_id'] = $blog['id'];
if (mb_strlen($new_cat['title'])<3) { cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['CAT_ERR_TITLE'])); }
if ($bdo=='newcat'){
$cat['id'] = $inBlog->addBlogCategory($new_cat);
cmsCore::addSessionMessage($_LANG['CAT_IS_ADDED'], 'success');
}
if ($bdo=='editcat'){
$inBlog->updateBlogCategory($cat['id'], $new_cat);
示例13: cpAddPathway
</div>
<div>
<input name="opt" type="hidden" value="saveconfig" />
<input type="submit" class="btn btn-primary" name="save" value="<?php echo $_LANG['SAVE']; ?>" />
<input type="button" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.location.href='index.php?view=components';"/>
</div>
</form>
<?php
}
if ($opt == 'import_xls') {
cpAddPathway($_LANG['AD_EXCEL_IMPORT']);
echo '<h3>'. $_LANG['AD_EXCEL_IMPORT'] .'</h3>';
if (cmsCore::inRequest('cat_id')) {
$cat_id = cmsCore::request('cat_id', 'int', 0);
$cat = cmsCore::c('db')->get_fields('cms_uc_cats', "id = '$cat_id'", '*');
if (!$cat) { cmsCore::error404(); }
$fstruct = cmsCore::yamlToArray($cat['fieldsstruct']);
?>
<form action="index.php?view=components&do=config&id=<?php echo $id; ?>" method="POST" enctype="multipart/form-data" name="addform">
<input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
<div style="width:650px;">
<p><strong><?php echo $_LANG['AD_CAT_BOARD']; ?>:</strong> <a href="index.php?view=components&do=config&id=<?php echo $id; ?>&opt=import_xls"><?php echo $cat['title']; ?></a></p>
<p><?php echo $_LANG['AD_CHECK_EXCEL_FILE']; ?></p>
<div class="form-group">
<label><?php echo $_LANG['AD_EXCEL_FILE']; ?></label>
<input type="file" class="form-control" name="xlsfile" />
示例14: board
//.........这里部分代码省略.........
cmsCore::c('page')->setTitle($pagetitle);
cmsCore::c('page')->setDescription(crop($pagedesc));
cmsCore::c('page')->setKeywords($pagekeys);
cmsPage::initTemplate('components', 'com_board_item')->
assign('item', $item)->
assign('cfg', cmsCore::m('board')->config)->
assign('user_id', cmsCore::c('user')->id)->
assign('is_admin', cmsCore::c('user')->is_admin)->
assign('formsdata', cmsForm::getFieldsValues($item['form_id'], $item['form_array']))->
assign('is_moder', cmsCore::m('board')->is_moderator_by_group)->
display();
}
/////////////////////////////// NEW BOARD ITEM /////////////////////////////////
if ($do == 'additem') {
// Получаем категории, в которые может загружать пользователь
$catslist = cmsCore::m('board')->getPublicCats(cmsCore::m('board')->category_id);
if (!$catslist) {
cmsCore::addSessionMessage($_LANG['YOU_CANT_ADD_ADV_ANY'], 'error');
$inCore->redirect('/board');
}
$cat['is_photos'] = 1;
$formsdata = array();
if (cmsCore::m('board')->category_id && cmsCore::m('board')->category_id != cmsCore::m('board')->root_cat['id']) {
$cat = cmsCore::m('board')->getCategory(cmsCore::m('board')->category_id);
$formsdata = cmsForm::getFieldsHtml($cat['form_id']);
}
cmsCore::c('page')->addPathway($_LANG['ADD_ADV']);
if ( !cmsCore::inRequest('submit') ) {
if (IS_BILLING) { cmsBilling::checkBalance('board', 'add_item'); }
cmsCore::c('page')->setTitle($_LANG['ADD_ADV']);
$item = cmsUser::sessionGet('item');
if ($item) { cmsUser::sessionDel('item'); }
$item['city'] = !empty($item['city']) ? $item['city'] : cmsCore::c('user')->city;
cmsPage::initTemplate('components', 'com_board_edit')->
assign('action', "/board/add.html")->
assign('form_do', 'add')->
assign('cfg', cmsCore::m('board')->config)->
assign('cat', $cat)->
assign('item', $item)->
assign('pagetitle', $_LANG['ADD_ADV'])->
assign('formsdata', $formsdata)->
assign('is_admin', cmsCore::c('user')->is_admin)->
assign('is_user', cmsCore::c('user')->id)->
assign('catslist', $catslist)->
assign('is_billing', IS_BILLING)->assign('balance', cmsCore::c('user')->balance)->
display();
cmsUser::sessionClearAll();
return;
}
if ( cmsCore::inRequest('submit') ) {
// проверяем на заполненость скрытое поле
$title_fake = cmsCore::request('title_fake', 'str', '');
// если оно заполнено, считаем что это бот, 404
if ($title_fake) { cmsCore::error404(); }
示例15: applet_modules
function applet_modules() {
$inCore = cmsCore::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_MODULES']);
cpAddPathway($_LANG['AD_MODULES'], 'index.php?view=modules');
cmsCore::c('page')->addHeadJS('admin/js/modules.js');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
$co = cmsCore::request('co', 'int', -1);
if ($do == 'config') {
$module_name = cpModuleById($id);
$module_title = cpModuleTitleById($id);
if (!$module_name) { cmsCore::redirect('index.php?view=modules&do=edit&id='. $id); }
$xml_file = PATH .'/admin/modules/'. $module_name .'/backend.xml';
$php_file = 'modules/'. $module_name .'/backend.php';
if (file_exists($php_file)) {
include $php_file;
return;
}
$cfg = $inCore->loadModuleConfig($id);
cpAddPathway($module_title, '?view=modules&do=edit&id='. $id);
cpAddPathway($_LANG['AD_SETTINGS']);
echo '<h3>'. $module_title .'</h3>';
$toolmenu = array(
array( 'icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:submitModuleConfig();' ),
array( 'icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=modules' ),
array( 'icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_MODULE_VIEW'], 'link' => '?view=modules&do=edit&id='. $id )
);
cpToolMenu($toolmenu);
?>
<form action="index.php?view=modules&do=save_auto_config&id=<?php echo $id; ?>" method="post" name="optform" target="_self" id="optform">
<div class="panel panel-default" style="width:650px;">
<div class="panel-body">
<?php
if (file_exists($xml_file)) {
cmsCore::loadClass('formgen');
$formGen = new cmsFormGen($xml_file, $cfg);
echo $formGen->getHTML();
} else {
?>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_MODULE_TEMPLATE']; ?></label>
<div class="col-sm-7">
<input type="text" class="form-control" value="<?php echo $cfg['tpl']; ?>" />
</div>
</div>
<?php
}
?>
</div>
<div class="panel-footer">
<input type="submit" name="save" class="btn btn-primary" value="<?php echo $_LANG['SAVE']; ?>" />
</div>
</div>
<script type="text/javascript">
function submitModuleConfig(){
$('#optform').submit();
}
</script>
</form>
<?php
return;
}
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$module_name = cpModuleById($id);
$is_ajax = cmsCore::inRequest('ajax');
if ($is_ajax) {
$title = cmsCore::request('title', 'str', '');
$published = cmsCore::request('published', 'int', 0);
cmsCore::c('db')->query("UPDATE cms_modules SET title='". $title ."', published='". $published ."' WHERE id=". $id);
if (cmsCore::inRequest('content')) {
$content = cmsCore::c('db')->escape_string(cmsCore::request('content', 'html'));
cmsCore::c('db')->query("UPDATE cms_modules SET content='". $content ."' WHERE id=". $id);
}
}
if (cmsCore::inRequest('title_only')) { cmsCore::redirectBack(); }
$xml_file = PATH .'/admin/modules/'. $module_name .'/backend.xml';
//.........这里部分代码省略.........