AVE.CMS v3.28
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

670 lines
15 KiB

8 years ago
<?php
7 years ago
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
if (!defined('ACP'))
{
header('Location:index.php');
exit;
}
require(BASE_DIR . '/class/class.rubs.php');
$AVE_Rubric = new AVE_Rubric;
$AVE_Template->config_load(BASE_DIR . '/admin/lang/' . $_SESSION['admin_language'] . '/rubs.txt', 'rubs');
switch($_REQUEST['action'])
{
case '' :
if(check_permission('rubric_view'))
{
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case 'quicksave':
$AVE_Rubric->quickSave();
break;
}
}
$AVE_Rubric->rubricList();
$AVE_Template->assign('templates', get_all_templates());
$AVE_Template->assign('content', $AVE_Template->fetch('rubs/list.tpl'));
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_VIEW'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'new':
if(check_permission('rubric_edit'))
{
$AVE_Template->assign('templates', get_all_templates());
$AVE_Rubric->rubricNew();
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE3'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'template':
8 years ago
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
7 years ago
case '':
$AVE_Rubric->rubricTemplateShow();
8 years ago
break;
7 years ago
case 'save':
8 years ago
7 years ago
$Rtemplate = $_POST['rubric_template'];
$Htemplate = $_POST['rubric_header_template'];
$Ftemplate = $_POST['rubric_footer_template'];
$Ttemplate = $_POST['rubric_teaser_template'];
$Atemplate = $_POST['rubric_admin_teaser_template'];
$check_code = strtolower($Rtemplate.$Htemplate.$Ttemplate.$Atemplate.$Ftemplate);
8 years ago
7 years ago
$ok = true;
if ((is_php_code($check_code)) && !check_permission('rubric_php') )
8 years ago
{
7 years ago
$AVE_Template->assign('php_forbidden', 1);
$ok = false;
}
if (! $ok)
{
$message = $AVE_Template->get_config_vars('RUBRIC_SAVED_PHP_ERR');
$header = $AVE_Template->get_config_vars('RUBRIC_ERROR');
$theme = 'error';
if (isAjax())
{
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
exit;
}
else
{
$AVE_Rubric->rubricTemplateShow(1);
}
8 years ago
}
else
{
7 years ago
$AVE_Rubric->rubricTemplateSave($Rtemplate, $Htemplate, $Ttemplate, $Atemplate, $Ftemplate);
8 years ago
}
7 years ago
break;
}
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE2'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'delete':
if(check_permission('rubric_edit'))
{
$AVE_Rubric->rubricDelete();
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'multi':
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case 'save':
$AVE_Rubric->rubricCopy();
break;
}
$AVE_Template->assign('content', $AVE_Template->fetch('rubs/multi.tpl'));
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_MULTIPLY'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'edit':
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case '':
switch($_REQUEST['submit'])
{
case 'saveperms':
if (check_permission('rubric_perms')){
$AVE_Rubric->rubricPermissionSave((int)$_REQUEST['Id']);
}
break;
case 'save':
$AVE_Rubric->rubricFieldSave((int)$_REQUEST['Id']);
break;
case 'linked_rubric':
$AVE_Rubric->rubricShow(1);
break;
case 'code':
if (check_permission('rubric_code')){
$AVE_Rubric->rubricCode((int)$_REQUEST['Id']);
}
break;
case 'description':
$AVE_Rubric->rubricDesc((int)$_REQUEST['Id']);
break;
}
}
$AVE_Rubric->rubricFieldShow((int)$_REQUEST['Id'], null);
break;
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE1'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'alias_add':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricAliasAdd();
8 years ago
}
7 years ago
break;
8 years ago
7 years ago
case 'code':
if (check_permission('rubric_code'))
{
$AVE_Rubric->rubricCodeEdit($_REQUEST['Id']);
}
break;
8 years ago
7 years ago
case 'field_template':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldTemplate();
}
break;
8 years ago
7 years ago
case 'field_template_save':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldTemplateSave((int)$_REQUEST['field_id'], (int)$_REQUEST['rubric_id']);
}
break;
8 years ago
7 years ago
case 'fieldssort':
if(check_permission_acp('rubric_edit'))
8 years ago
{
7 years ago
$AVE_Rubric->rubricFieldsSort((array)$_REQUEST['sort']);
}
exit;
8 years ago
7 years ago
case 'rubssort':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricsSort((array)$_REQUEST['sort']);
}
exit;
8 years ago
7 years ago
case 'alias_check':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricAliasCheck((int)$_REQUEST['rubric_id'],(int)$_REQUEST['field_id'], $_REQUEST['rubric_field_alias']);
}
break;
8 years ago
7 years ago
case 'newfield':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldNew((int)$_REQUEST['Id'], $_REQUEST['ajax']);
}
break;
8 years ago
7 years ago
case 'fields':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldShow((int)$_REQUEST['Id'], $_REQUEST['ajax']);
}
break;
8 years ago
7 years ago
case 'change':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldChange((int)$_REQUEST['field_id'], (int)$_REQUEST['rubric_id']);
}
break;
8 years ago
7 years ago
case 'changesave':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldChangeSave((int)$_REQUEST['field_id'], (int)$_REQUEST['rubric_id']);
}
break;
8 years ago
7 years ago
case 'changegroup':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldGroupChange((int)$_REQUEST['field_id'], (int)$_REQUEST['rubric_id']);
}
break;
case 'changegroupsave':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldGroupChangeSave((int)$_REQUEST['field_id'], (int)$_REQUEST['rubric_id']);
}
break;
case 'fieldsgroups':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldsGroups((int)$_REQUEST['Id']);
}
break;
case 'newfieldsgroup':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricNewGroupFields((int)$_REQUEST['Id']);
}
break;
case 'savefieldsgroup':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricEditGroupFields((int)$_REQUEST['Id']);
}
break;
case 'delfieldsgroup':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricDelGroupFields((int)$_REQUEST['Id'], (int)$_REQUEST['rubric_id']);
}
break;
case 'fieldsgroupssort':
if(check_permission_acp('rubric_edit'))
{
$AVE_Rubric->rubricFieldsGroupsSort((array)$_REQUEST['sort']);
}
exit;
case 'tmpls':
if (check_permission_acp('rubric_edit'))
{
$AVE_Rubric->tmplsList();
$AVE_Template->assign('content', $AVE_Template->fetch('rubs/tmpls.tpl'));
}
break;
case 'tmpls_edit':
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case '':
$AVE_Rubric->tmplsEdit();
break;
case 'save':
8 years ago
7 years ago
$title = $_POST['template_title'];
$template = $_POST['rubric_template'];
$check_code = strtolower($template);
$ok = true;
if((is_php_code($check_code)) && !check_permission('rubric_php') )
8 years ago
{
7 years ago
$AVE_Template->assign('php_forbidden', 1);
$ok = false;
}
if(! $ok)
{
$message = $AVE_Template->get_config_vars('RUBRIC_SAVED_PHP_ERR');
$header = $AVE_Template->get_config_vars('RUBRIC_ERROR');
$theme = 'error';
if (isAjax())
{
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
exit;
}
else
{
$AVE_Rubric->tmplsEdit();
}
8 years ago
}
else
{
7 years ago
$AVE_Rubric->tmplsSave($template, $title);
8 years ago
}
7 years ago
break;
}
8 years ago
}
7 years ago
else
8 years ago
{
7 years ago
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE2'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'tmpls_new':
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case '':
$AVE_Rubric->tmplsEdit();
break;
8 years ago
7 years ago
case 'save':
8 years ago
7 years ago
$title = $_POST['template_title'];
$template = $_POST['rubric_template'];
8 years ago
7 years ago
$check_code = strtolower($template);
8 years ago
7 years ago
$ok = true;
8 years ago
7 years ago
if((is_php_code($check_code)) && !check_permission('rubric_php') )
{
$AVE_Template->assign('php_forbidden', 1);
8 years ago
7 years ago
$ok = false;
}
8 years ago
7 years ago
if(! $ok)
8 years ago
{
7 years ago
$message = $AVE_Template->get_config_vars('RUBRIC_SAVED_PHP_ERR');
$header = $AVE_Template->get_config_vars('RUBRIC_ERROR');
$theme = 'error';
if (isAjax())
{
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
exit;
}
else
{
$AVE_Rubric->tmplsEdit();
}
8 years ago
}
else
{
7 years ago
$AVE_Rubric->tmplsSave($template, $title);
8 years ago
}
7 years ago
break;
}
8 years ago
}
7 years ago
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE2'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'tmpls_from':
if(check_permission('rubric_edit'))
8 years ago
{
7 years ago
switch($_REQUEST['sub'])
{
case '':
$AVE_Rubric->tmplsEdit();
break;
8 years ago
7 years ago
case 'save':
8 years ago
7 years ago
$title = $_POST['template_title'];
$template = $_POST['rubric_template'];
8 years ago
7 years ago
$check_code = strtolower($template);
8 years ago
7 years ago
$ok = true;
8 years ago
7 years ago
if((is_php_code($check_code)) && !check_permission('rubric_php') )
{
$AVE_Template->assign('php_forbidden', 1);
8 years ago
7 years ago
$ok = false;
}
8 years ago
7 years ago
if(! $ok)
8 years ago
{
7 years ago
$message = $AVE_Template->get_config_vars('RUBRIC_SAVED_PHP_ERR');
$header = $AVE_Template->get_config_vars('RUBRIC_ERROR');
$theme = 'error';
if (isAjax())
{
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
exit;
}
else
{
$AVE_Rubric->tmplsEdit();
}
8 years ago
}
else
{
7 years ago
$AVE_Rubric->tmplsSave($template, $title);
8 years ago
}
7 years ago
break;
}
8 years ago
}
7 years ago
else
8 years ago
{
7 years ago
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE2'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
8 years ago
7 years ago
case 'tmpls_copy':
if(check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case '':
$AVE_Rubric->tmplsEdit();
break;
8 years ago
7 years ago
case 'save':
8 years ago
7 years ago
$title = $_POST['template_title'];
$template = $_POST['rubric_template'];
8 years ago
7 years ago
$check_code = strtolower($template);
8 years ago
7 years ago
$ok = true;
8 years ago
7 years ago
if((is_php_code($check_code)) && !check_permission('rubric_php') )
{
$AVE_Template->assign('php_forbidden', 1);
8 years ago
7 years ago
$ok = false;
}
8 years ago
7 years ago
if(! $ok)
8 years ago
{
7 years ago
$message = $AVE_Template->get_config_vars('RUBRIC_SAVED_PHP_ERR');
$header = $AVE_Template->get_config_vars('RUBRIC_ERROR');
$theme = 'error';
if (isAjax())
{
echo json_encode(array('message' => $message, 'header' => $header, 'theme' => $theme));
exit;
}
else
{
$AVE_Rubric->tmplsEdit();
}
8 years ago
}
else
{
7 years ago
$AVE_Rubric->tmplsSave($template, $title);
8 years ago
}
7 years ago
break;
}
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE2'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
7 years ago
}
7 years ago
break;
case 'tmpls_del':
if(check_permission('rubric_edit'))
{
$AVE_Rubric->tmplsDelete();
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'rules':
if (check_permission('rubric_edit'))
{
switch($_REQUEST['sub'])
{
case '':
switch($_REQUEST['submit'])
{
case 'saveperms':
if (check_permission('rubric_perms'))
$AVE_Rubric->rubricPermissionSave((int)$_REQUEST['Id']);
break;
}
}
$AVE_Rubric->rubricRulesShow((int)$_REQUEST['Id'], null);
break;
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_CHANGE1'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftlist':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->ShowFields();
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftshowfield':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->ShowFieldsByType($_REQUEST['type']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftcreate':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->EditFieldTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftedit':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->EditFieldTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftempledit':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->EditFieldTpl('', $_REQUEST['fld'], $_REQUEST['type']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftsave':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->SaveFieldTpl((int)$_REQUEST['field_id'], $_REQUEST['field_name'], $_REQUEST['field_type'], $_REQUEST['func']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
case 'ftdelete':
if (check_permission('rubric_edit'))
{
$AVE_Rubric->DeleteFieldTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type'], $_REQUEST['func']);
}
else
{
$AVE_Template->assign('erorr', $AVE_Template->get_config_vars('RUBRIK_NO_PERMISSION'));
$AVE_Template->assign('content', $AVE_Template->fetch('error.tpl'));
}
break;
}
?>