本文整理汇总了PHP中cmsCore::redirectBack方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::redirectBack方法的具体用法?PHP cmsCore::redirectBack怎么用?PHP cmsCore::redirectBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::redirectBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Обновляет данные пользователя, если он не забанен
* заполняя ими свойства объекта
* @return bool
*/
public function update()
{
// привязка ip адреса к сессии
if (!$this->checkSpoofingSession()) {
$this->logout();
cmsCore::redirectBack();
}
$user_id = (int) (isset($_SESSION['user']['id']) ? $_SESSION['user']['id'] : 0);
// Свойства для гостя
if (!$user_id) {
self::setUserLogdate();
$guest_info = self::getGuestInfo();
foreach ($guest_info as $key => $value) {
$this->{$key} = $value;
}
} else {
// свойства для авторизованного пользователя
$info = $this->loadUser($user_id);
if (!$info) {
return false;
}
foreach ($info as $key => $value) {
$this->{$key} = $value;
}
$this->new_msg = self::getNewMessages($user_id);
$this->new_msg_count = $this->new_msg['total'];
$this->logdate = self::getUserLogdate();
}
// проверяем бан
$this->checkBan();
return true;
}
示例2: subscribes
function subscribes(){
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$do = $inCore->do;
//========================================================================================================================//
//========================================================================================================================//
if ($do=='view'){
$subscribe = cmsCore::request('subscribe', 'int', 0);
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('target_id', 'int', 0);
if (!$target_id || !$target){
cmsCore::error404();
}
if ($inUser->id){
cmsUser::subscribe($inUser->id, $target, $target_id, $subscribe);
}
if(cmsCore::isAjax()){
cmsCore::jsonOutput(array('subscribe'=>$subscribe));
} else {
cmsCore::redirectBack();
}
}
}
示例3: applet_cache
function applet_cache()
{
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('id', 'int', 0);
if (!$target || !$target_id) {
cmsCore::error404();
}
cmsCore::deleteCache($target, $target_id);
cmsCore::redirectBack();
}
示例4: applet_templates
function applet_templates()
{
global $adminAccess;
global $_LANG;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', array('config', 'save_config'), 'main');
cmsCore::c('page')->setTitle($_LANG['AD_TEMPLATES_SETTING']);
cpAddPathway($_LANG['AD_TEMPLATES_SETTING'], 'index.php?view=templates');
if ($do == 'main') {
cmsCore::c('page')->initTemplate('applets', 'templates')->assign('templates', cmsCore::getDirsList('/templates'))->display();
}
if ($do == 'config') {
$template = cmsCore::request('template', 'str', '');
cpAddPathway($_LANG['AD_TEMPLATE'] . ': ' . $template, 'index.php?view=templates&do=config&template=' . $template);
if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php')) {
cmsCore::error404();
}
include PATH . '/templates/' . $template . '/config.php';
if (function_exists('get_template_cfg_fields')) {
$tpl_cfgs = get_template_cfg_fields();
if (!empty($tpl_cfgs)) {
$tpl_cfgs_val = cmsCore::getTplCfg($template);
cmsCore::c('page')->initTemplate('applets', 'templates')->assign('template', $template)->assign('form_gen_form', cmsCore::c('form_gen')->generateForm($tpl_cfgs, $tpl_cfgs_val))->display();
} else {
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_NO_CONFIG'], 'error');
cmsCore::redirectBack();
}
} else {
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_ERROR'], 'error');
cmsCore::redirectBack();
}
}
if ($do == 'save_config') {
$template = cmsCore::request('template', 'str', '');
if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php') || !cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
include PATH . '/templates/' . $template . '/config.php';
if (function_exists('get_template_cfg_fields')) {
$tpl_cfgs = get_template_cfg_fields();
if (!empty($tpl_cfgs)) {
$tpl_cfgs = cmsCore::c('form_gen')->requestForm($tpl_cfgs);
cmsCore::saveTplCfg($tpl_cfgs, $template);
cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_SAVED'], 'success');
cmsCore::redirect('/admin/index.php?view=templates');
} else {
cmsCore::error404();
}
} else {
cmsCore::error404();
}
}
}
示例5: applet_cache
function applet_cache() {
$component = cmsCore::request('component', 'str', '');
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('target_id', 'str', '');
if (empty($component) || empty($target_id)) { cmsCore::error404(); }
cmsCore::c('cache')->remove($component, $target_id, $target);
cmsCore::redirectBack();
}
示例6: applet_clearcache
function applet_clearcache()
{
global $adminAccess;
global $_LANG;
if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
cpAccessDenied();
}
cmsCore::clearCache();
cmsCore::addSessionMessage($_LANG['AD_CLEAR_CACHE_SUCCESS'], 'success');
cmsCore::redirectBack();
}
示例7: applet_install
function applet_install() {
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['AD_SETUP_EXTENSION']);
$do = cmsCore::request('do', 'str', 'list');
global $adminAccess;
//-------------------------------- Модули ----------------------------------
//----------- Список модулей готовых к установке или обновлению ------------
if ($do == 'module') {
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) { cpAccessDenied(); }
cpAddPathway($_LANG['AD_SETUP_MODULES'], 'index.php?view=install&do=module');
$new_modules = $inCore->getNewModules();
$upd_modules = $inCore->getUpdatedModules();
echo '<h3>'. $_LANG['AD_SETUP_MODULES'] .'</h3>';
if (!$new_modules && !$upd_modules) {
echo '<p>'. $_LANG['AD_NO_SEARCH_MODULES'] .'</p>';
echo '<p>'. $_LANG['AD_IF_WANT_SETUP_MODULES'] .'</p>';
echo '<p><a class="btn btn-default" href="javascript:window.history.go(-1);">'. $_LANG['BACK'] .'</a></p>';
return;
}
if ($new_modules) {
echo '<div class="panel panel-default"><div class="panel-heading">'. $_LANG['AD_SEARCH_MODULES'] .'</div><div class="panel-body">';
modulesList($new_modules, $_LANG['AD_SETUP'], 'install_module');
echo '</div></div>';
}
if ($upd_modules) {
echo '<div class="panel panel-default"><div class="panel-heading">'. $_LANG['AD_MODULES_UPDATE'] .'</div><div class="panel-body">';
modulesList($upd_modules, $_LANG['AD_UPDATE'], 'upgrade_module');
echo '</div></div>';
}
echo '<p><a class="btn btn-default" href="javascript:window.history.go(-1);">'. $_LANG['BACK'] .'</a></p>';
}
//--------------------------- Установка модуля -----------------------------
if ($do == 'install_module') {
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) { cpAccessDenied(); }
$error = '';
$module_id = cmsCore::request('id', 'str', '');
if(!$module_id){ cmsCore::redirectBack(); }
if ($inCore->loadModuleInstaller($module_id)){
$_module = call_user_func('info_module_'.$module_id);
//////////////////////////////////////
$error = call_user_func('install_module_'.$module_id);
} else {
$error = $_LANG['AD_MODULE_WIZARD_FAILURE'];
}
if ($error === true) {
$inCore->installModule($_module, $_module['config']);
cmsCore::addSessionMessage($_LANG['AD_MODULE'].' <strong>"'.$_module['title'].'"</strong> '.$_LANG['AD_SUCCESS'].$_LANG['AD_IS_INSTALL'], 'success');
cmsCore::redirect('/admin/index.php?view=modules');
} else {
cmsCore::addSessionMessage($error , 'error');
cmsCore::redirectBack();
}
}
//--------------------------- Обновление модуля ----------------------------
if ($do == 'upgrade_module') {
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) { cpAccessDenied(); }
$error = '';
$module_id = cmsCore::request('id', 'str', '');
if(!$module_id){ cmsCore::redirectBack(); }
if ($inCore->loadModuleInstaller($module_id)) {
$_module = call_user_func('info_module_'.$module_id);
if (isset($_module['link'])) {
$_module['content'] = $_module['link'];
}
$error = call_user_func('upgrade_module_'.$module_id);
} else {
$error = $_LANG['AD_SETUP_WIZARD_FAILURE'];
}
if ($error === true) {
$inCore->upgradeModule($_module, $_module['config']);
cmsCore::addSessionMessage($_LANG['AD_MODULE'].' <strong>"'.$_module['title'].'"</strong> '.$_LANG['AD_SUCCESS'].$_LANG['AD_IS_UPDATE'], 'success');
cmsCore::redirect('/admin/index.php?view=modules');
} else {
cmsCore::addSessionMessage($error , 'error');
//.........这里部分代码省略.........
示例8: applet_usergroups
function applet_usergroups()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_USERS_GROUP'];
cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
cpAddPathway($_LANG['AD_USERS_GROUP'], 'index.php?view=usergroups');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
cmsCore::loadModel('users');
$model = new cms_model_users();
if ($do == 'list') {
$toolmenu[] = array('icon' => 'usergroupadd.gif', 'title' => $_LANG['AD_CREATE_GROUP'], 'link' => '?view=usergroups&do=add');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=usergroups&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:if(confirm('{$_LANG['AD_REMOVE_GROUP']}')) { checkSel('?view=users&do=delete&multiple=1'); }");
cpToolMenu($toolmenu);
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=usergroups&do=edit&id=%id%', 'filter' => '12');
$fields[] = array('title' => $_LANG['AD_FROM_USERS'], 'field' => 'id', 'width' => '100', 'prc' => 'getCountUsers');
$fields[] = array('title' => $_LANG['AD_IF_ADMIN'], 'field' => 'is_admin', 'width' => '110', 'prc' => 'cpYesNo');
$fields[] = array('title' => $_LANG['AD_ALIAS'], 'field' => 'alias', 'width' => '75', 'filter' => '12');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=usergroups&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_GROUP'], 'link' => '?view=usergroups&do=delete&id=%id%');
cpListTable('cms_user_groups', $fields, $actions);
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
$model->deleteGroup($id);
}
} else {
$model->deleteGroups(cmsCore::request('item', 'array_int', array()));
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=usergroups');
}
if ($do == 'submit' || $do == 'update') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$types = array('title' => array('title', 'str', ''), 'alias' => array('alias', 'str', ''), 'is_admin' => array('is_admin', 'int', 0), 'access' => array('access', 'array_str', array(), create_function('$a_list', 'return implode(\',\', $a_list);')));
$items = cmsCore::getArrayFromRequest($types);
if ($do == 'submit') {
$inDB->insert('cms_user_groups', $items);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=usergroups');
} else {
$inDB->update('cms_user_groups', $items, $id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
if (empty($_SESSION['editlist'])) {
cmsCore::redirect('index.php?view=usergroups');
} else {
cmsCore::redirect('index.php?view=usergroups&do=edit');
}
}
}
if ($do == 'add' || $do == 'edit') {
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
cpToolMenu($toolmenu);
if ($do == 'add') {
cpAddPathway($_LANG['AD_CREATE_GROUP']);
} else {
if (isset($_REQUEST['multiple'])) {
if (isset($_REQUEST['item'])) {
$_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
} else {
cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
cmsCore::redirectBack();
}
}
$ostatok = '';
if (isset($_SESSION['editlist'])) {
$item_id = array_shift($_SESSION['editlist']);
if (sizeof($_SESSION['editlist']) == 0) {
unset($_SESSION['editlist']);
} else {
$ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
}
} else {
$item_id = cmsCore::request('id', 'int', 0);
}
$mod = $inDB->get_fields('cms_user_groups', "id = '{$item_id}'", '*');
if (!$mod) {
cmsCore::error404();
}
echo '<h3>' . $_LANG['AD_EDIT_GROUP'] . ' ' . $ostatok . '</h3>';
cpAddPathway($_LANG['AD_EDIT_GROUP'] . ' ' . $mod['title']);
}
if (isset($mod['access'])) {
$mod['access'] = str_replace(', ', ',', $mod['access']);
$mod['access'] = explode(',', $mod['access']);
}
?>
<form id="addform" name="addform" method="post" action="index.php?view=usergroups">
<input type="hidden" name="csrf_token" value="<?php
//.........这里部分代码省略.........
示例9: array
$fields[] = array('title' => $_LANG['AD_BANNER_CTR'], 'field' => array('clicks', 'hits'), 'width' => '90', 'prc' => 'bannerCTRbyID');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_BANNER_DEL_CONFIRM'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete&item_id=%id%');
cpListTable('cms_banners', $fields, $actions, '', 'pubdate DESC');
}
if ($opt == 'add' || $opt == 'edit') {
if ($opt == 'add') {
echo '<h3>' . $_LANG['AD_ADD_BANNER'] . '</h3>';
cpAddPathway($_LANG['AD_ADD_BANNER']);
} else {
if (isset($_REQUEST['multiple'])) {
if (isset($_REQUEST['item'])) {
$_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
} else {
cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
cmsCore::redirectBack();
}
}
$ostatok = '';
if (isset($_SESSION['editlist'])) {
$item_id = array_shift($_SESSION['editlist']);
if (sizeof($_SESSION['editlist']) == 0) {
unset($_SESSION['editlist']);
} else {
$ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
}
} else {
$item_id = cmsCore::request('item_id', 'int', 0);
}
$mod = cms_model_banners::getBanner($item_id);
if (!$mod) {
示例10: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
$GLOBALS['cp_page_title'] = $_LANG['AD_PLUGINS'];
cpAddPathway($_LANG['AD_PLUGINS'], 'index.php?view=plugins');
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
// ===================================================================================== //
if ($do == 'hide') {
dbHide('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'show') {
dbShow('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'list') {
$toolmenu = array();
$toolmenu[1]['icon'] = 'install.gif';
$toolmenu[1]['title'] = $_LANG['AD_INSTALL_PLUGINS'];
$toolmenu[1]['link'] = '?view=install&do=plugin';
cpToolMenu($toolmenu);
$plugin_id = cmsCore::request('installed', 'str', '');
if ($plugin_id) {
$task = cmsCore::request('task', 'str', 'install');
if ($task == 'install' || $task == 'upgrade') {
$plugin = $inCore->loadPlugin($plugin_id);
$task_str = $task == 'install' ? $_LANG['AD_IS_INSTALL'] : $_LANG['AD_IS_UPDATE'];
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_PLUGIN'] . ' <strong>"' . $plugin->info['title'] . '"</strong> ' . $task_str . '. ' . $_LANG['AD_ENABLE_PLUGIN'] . '.</div>';
}
if ($task == 'remove') {
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_REMOVE_PLUGIN_OK'] . '.</div>';
}
}
$fields = array();
$fields[0]['title'] = 'id';
$fields[0]['field'] = 'id';
$fields[0]['width'] = '20';
$fields[1]['title'] = $_LANG['TITLE'];
$fields[1]['field'] = 'title';
$fields[1]['width'] = '250';
$fields[2]['title'] = $_LANG['DESCRIPTION'];
$fields[2]['field'] = 'description';
$fields[2]['width'] = '';
$fields[3]['title'] = $_LANG['AD_AUTHOR'];
$fields[3]['field'] = 'author';
$fields[3]['width'] = '160';
$fields[4]['title'] = $_LANG['AD_VERSION'];
$fields[4]['field'] = 'version';
$fields[4]['width'] = '50';
$fields[5]['title'] = $_LANG['AD_FOLDER'];
$fields[5]['field'] = 'plugin';
$fields[5]['width'] = '100';
$fields[6]['title'] = $_LANG['AD_ENABLE'];
$fields[6]['field'] = 'published';
$fields[6]['width'] = '60';
$actions = array();
$actions[0]['title'] = $_LANG['AD_CONFIG'];
$actions[0]['icon'] = 'config.gif';
$actions[0]['link'] = '?view=plugins&do=config&id=%id%';
$actions[1]['title'] = $_LANG['DELETE'];
$actions[1]['icon'] = 'delete.gif';
$actions[1]['confirm'] = $_LANG['AD_REMOVE_PLUGIN_FROM'];
$actions[1]['link'] = '?view=install&do=remove_plugin&id=%id%';
cpListTable('cms_plugins', $fields, $actions);
}
// ===================================================================================== //
if ($do == 'save_config') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$config = cmsCore::request('config', 'array_str');
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsUser::clearCsrfToken();
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
// ===================================================================================== //
if ($do == 'config') {
$plugin_name = $inCore->getPluginById($id);
if (!$plugin_name) {
cmsCore::error404();
}
$plugin = $inCore->loadPlugin($plugin_name);
$config = $inCore->loadPluginConfig($plugin_name);
$GLOBALS['cp_page_title'] = $plugin->info['title'];
cpAddPathway($plugin->info['title'], 'index.php?view=plugins&do=config&id=' . $id);
//.........这里部分代码省略.........
示例11: applet_modules
function applet_modules()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_MODULES'];
cpAddPathway($_LANG['AD_MODULES'], 'index.php?view=modules');
$GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/modules.js"></script>';
$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($xml_file)) {
if (file_exists($php_file)) {
include $php_file;
return;
}
cmsCore::halt();
}
$cfg = $inCore->loadModuleConfig($id);
cmsCore::loadClass('formgen');
$formGen = new cmsFormGen($xml_file, $cfg);
cpAddPathway($module_title, '?view=modules&do=edit&id=' . $id);
cpAddPathway($_LANG['AD_SETTINGS']);
echo '<h3>' . $module_title . '</h3>';
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:submitModuleConfig();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=modules');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_MODULE_VIEW'], 'link' => '?view=modules&do=edit&id=' . $id);
cpToolMenu($toolmenu);
echo '<form action="index.php?view=modules&do=save_auto_config&id=' . $id . '" method="post" name="optform" target="_self" id="optform">';
echo $formGen->getHTML();
echo '</form>';
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);
$inDB->query("UPDATE cms_modules SET title='{$title}', published='{$published}' WHERE id={$id}");
if (cmsCore::inRequest('content')) {
$content = $inDB->escape_string(cmsCore::request('content', 'html'));
$inDB->query("UPDATE cms_modules SET content='{$content}' WHERE id={$id}");
}
// Добавим возможность изменять css_префикс с фронта
if (cmsCore::inRequest('css_prefix')) {
// На шаблонах не не отдающих параметра затирать класс не будем
$css_prefix = cmsCore::request('css_prefix', 'str', '');
$inDB->query("UPDATE cms_modules SET css_prefix='{$css_prefix}' WHERE id='{$id}'");
}
}
if (cmsCore::inRequest('title_only')) {
cmsCore::redirectBack();
}
$xml_file = PATH . '/admin/modules/' . $module_name . '/backend.xml';
if (!file_exists($xml_file)) {
cmsCore::halt();
}
$cfg = array();
$backend = simplexml_load_file($xml_file);
foreach ($backend->params->param as $param) {
$name = (string) $param['name'];
$type = (string) $param['type'];
$default = (string) $param['default'];
switch ($param['type']) {
case 'number':
$value = cmsCore::request($name, 'int', $default);
break;
case 'string':
$value = cmsCore::request($name, 'str', $default);
break;
case 'html':
$value = cmsCore::badTagClear(cmsCore::request($name, 'html', $default));
break;
case 'flag':
$value = cmsCore::request($name, 'int', 0);
break;
case 'list':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
case 'list_function':
//.........这里部分代码省略.........
示例12: 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(); }
//.........这里部分代码省略.........
示例13: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
cmsCore::c('page')->setTitle($_LANG['AD_PLUGINS']);
cpAddPathway($_LANG['AD_PLUGINS'], 'index.php?view=plugins');
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'install.gif', 'title' => $_LANG['AD_INSTALL_PLUGINS'], 'link' => '?view=install&do=plugin'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=plugins'));
cpToolMenu($toolmenu);
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'link' => '?view=plugins&do=config&id=%id%', 'width' => '250'), array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => ''), array('title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '160'), array('title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '80'), array('title' => $_LANG['AD_FOLDER'], 'field' => 'plugin', 'width' => '100'), array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '80'));
$actions = array(array('title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=plugins&do=config&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=install&do=remove_plugin&id=%id%', 'confirm' => $_LANG['AD_REMOVE_PLUGIN_FROM']));
cpListTable('cms_plugins', $fields, $actions);
}
if ($do == 'save_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$plugin = $inCore->loadPlugin($plugin_name);
$plugin_cfg_fields = $plugin->getConfigFields();
if (empty($plugin_cfg_fields)) {
$config = cmsCore::request('config', 'array_str');
} else {
$config = cmsCore::c('form_gen')->requestForm($plugin->getConfigFields());
}
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', '');
$xml_file = PATH . '/plugins/' . $plugin_name . '/backend.xml';
if (!file_exists($xml_file)) {
cmsCore::error404();
}
$cfg = array();
$backend = simplexml_load_file($xml_file);
foreach ($backend->params->param as $param) {
$name = (string) $param['name'];
$type = (string) $param['type'];
$default = (string) $param['default'];
switch ($param['type']) {
case 'number':
$value = cmsCore::request($name, 'int', $default);
break;
case 'string':
$value = cmsCore::request($name, 'str', $default);
break;
case 'html':
$value = cmsCore::badTagClear(cmsCore::request($name, 'html', $default));
break;
case 'flag':
$value = cmsCore::request($name, 'int', 0);
break;
case 'list':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
case 'list_function':
$value = cmsCore::request($name, 'str', $default);
break;
case 'list_db':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
}
$cfg[$name] = $value;
}
if (!$cfg || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
if ($do == 'config') {
$plugin_name = $inCore->getPluginById($id);
if (!$plugin_name) {
cmsCore::error404();
}
$plugin = $inCore->loadPlugin($plugin_name);
$config = $inCore->loadPluginConfig($plugin_name);
//.........这里部分代码省略.........
示例14: applet_checksystem
//.........这里部分代码省略.........
}
} else {
echo '<p>'. $_LANG['AD_DELETED_FILES_NOT_FOUND'] .'</p>';
}
echo '</div>';
echo '</div>';
} else {
echo '<p>'. $_LANG['AD_LAST_CHECK_RESULT_NOT_FOUND'] .'</p>';
}
}
if ($do == 'start') {
cpAddPathway($_LANG['AD_START_NEW_CHECK']);
$imageFiles = getSystemImageFiles();
?>
<form class="form-horizontal" role="form" action="/admin/index.php?view=checksystem&do=start_scan" method="post" name="CFGform" target="_self" style="margin-bottom:30px">
<input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
<div style="width:750px;">
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_SELECT_IMG']; ?></label>
<div class="col-sm-7">
<select id="image" class="form-control" name="image">
<?php foreach ($imageFiles as $if) { ?>
<option value="<?php echo $if; ?>"><?php echo $if; ?></option>
<?php } ?>
</select>
</div>
</div>
<div>
<input type="submit" class="btn btn-primary" name="save" value="<?php echo $_LANG['AD_START']; ?>" />
<input type="button" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.history.back();" />
</div>
</div>
</form>
<?php
}
if ($do == 'start_scan') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$image = cmsCore::request('image', 'str', '');
if (empty($image) || !file_exists(PATH .'/cache/system/'. $image)) {
cmsCore::error404();
}
genSystemImage(PATH);
$old_files = unserialize(file_get_contents(PATH .'/cache/system/'. $image));
$data = array(
'modified_files' => array(),
'new_files' => array(),
'old_files' => array()
);
foreach ($GLOBALS['SYSTEM_IMAGE'] as $k=>$v) {
if (isset($old_files[$k])) {
if ($old_files[$k] != $v) {
$data['modified_files'][] = $k;
}
unset($old_files[$k]);
} else {
$data['new_files'][] = $k;
}
unset($GLOBALS['SYSTEM_IMAGE'][$k]);
}
foreach ($old_files as $k => $v) {
$data['old_files'][] = $k;
}
$data['date'] = date('Y-m-d H:i:s');
$data['img'] = $image;
file_put_contents(PATH .'/cache/last_check_result.serialize', serialize($data));
cmsCore::addSessionMessage($_LANG['AD_CHECK_SYSTEM_SUCCES'], 'success');
cmsCore::redirect('index.php?view=checksystem');
}
if ($do == 'save') {
$GLOBALS['SYSTEM_IMAGE'] = array();
genSystemImage(PATH);
$d = date('Y-m-d_H-i-s');
file_put_contents(PATH . '/cache/system/systemImage_'. $d .'.serialize', serialize($GLOBALS['SYSTEM_IMAGE']));
unset($GLOBALS['SYSTEM_IMAGE']);
cmsCore::addSessionMessage($_LANG['AD_NEW_IMG_GENERATED'] .': /cache/system/systemImage_'. $d .'.serialize', 'success');
cmsCore::redirectBack();
}
}
示例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';
//.........这里部分代码省略.........