*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'disable_mode') {
    if (!empty($_REQUEST['type'])) {
        $c_mode = $_REQUEST['type'];
        $avail_modes = array_keys(fn_get_customization_modes());
        if (!in_array($c_mode, $avail_modes)) {
            return array(CONTROLLER_STATUS_NO_PAGE);
        }
        if ($c_mode == 'theme_editor') {
            unset($_SESSION['demo_customize_theme']);
        }
        fn_update_customization_mode(array($c_mode => 'disable'));
        return array(CONTROLLER_STATUS_OK, 'index.index');
    }
}
//comparison list number for footer
$view->assign('comparison_list_no', count($_SESSION["comparison_list"]));
Example #2
0
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (!Registry::get('runtime.customization_mode.design') && !Registry::get('runtime.customization_mode.live_editor')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'update_customization_mode') {
        fn_update_customization_mode($_REQUEST['customization_modes']);
        return array(CONTROLLER_STATUS_OK, $_REQUEST['current_url']);
    }
    if ($mode == 'live_editor_update') {
        fn_trusted_vars('value');
        fn_live_editor_update_object($_REQUEST);
        exit;
    }
    if ($mode == 'save_template') {
        fn_trusted_vars('content');
        $ext = fn_strtolower(fn_get_file_ext($_REQUEST['file']));
        if ($ext == 'tpl') {
            $theme_path = fn_get_theme_path('[themes]/[theme]/templates/', 'C');
            if (fn_put_contents($_REQUEST['file'], $_REQUEST['content'], $theme_path)) {
                fn_set_notification('N', __('notice'), __('text_file_saved', array('[file]' => fn_basename($_REQUEST['file']))));
            }
         fn_set_notification('W', __('warning'), __('text_select_vendor'));
         return array(CONTROLLER_STATUS_REDIRECT, $return_url);
     }
     $c_mode = $_REQUEST['type'];
     $status = $_REQUEST['status'];
     $avail_modes = array_keys(fn_get_customization_modes());
     if (!in_array($c_mode, $avail_modes)) {
         return array(CONTROLLER_STATUS_NO_PAGE);
     }
     $changed_modes = array();
     if ($status == 'enable') {
         // disable all other modes
         $changed_modes = array_fill_keys($avail_modes, 'disable');
     }
     $changed_modes[$c_mode] = $status;
     fn_update_customization_mode($changed_modes);
     if ($status == 'enable') {
         // redirect to frontend after enabling mode
         if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id') && !Registry::get('runtime.simple_ultimate')) {
             $extra_url = '&switch_company_id=' . Registry::get('runtime.company_id');
         } else {
             $extra_url = '';
         }
         if (!empty($_REQUEST['s_layout'])) {
             $extra_url .= '&redirect_url=' . urlencode('index.index?s_layout=' . $_REQUEST['s_layout']);
         }
         $url = 'profiles.act_as_user?user_id=' . $auth['user_id'] . '&area=C' . $extra_url;
         return array(CONTROLLER_STATUS_REDIRECT, $url);
     }
     return array(CONTROLLER_STATUS_REDIRECT, $return_url);
 }