Example #1
0
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Development;
use Tygh\Registry;
use Tygh\Settings;
use Tygh\UpgradeCenter\App as UpgradeCenter;
use Tygh\UpgradeCenter\Log;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (in_array($mode, array('upgrade', 'revert'))) {
    // temporary set development mode, for full error displaying
    Development::enable('compile_check');
}
$app = UpgradeCenter::instance();
$custom_theme_files = array();
$skip_files = array('manifest.json');
$backend_files = array('admin_index' => 'admin.php', 'vendor_index' => 'vendor.php');
$uc_settings = Settings::instance()->getValues('Upgrade_center');
// If we're performing the update, check if upgrade center override controller is exist in the package
if (!empty($_SESSION['uc_package']) && file_exists(Registry::get('config.dir.upgrade') . $_SESSION['uc_package'] . '/uc_override.php')) {
    return include Registry::get('config.dir.upgrade') . $_SESSION['uc_package'] . '/uc_override.php';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'update_settings') {
        if (!empty($_REQUEST['settings_data'])) {
            foreach ($_REQUEST['settings_data'] as $setting_name => $setting_value) {
                Settings::instance()->updateValue($setting_name, $setting_value, 'Upgrade_center');
Example #2
0
            $theme = Themes::factory(fn_get_theme_path('[theme]', 'C'));
            $theme_manifest = $theme->getManifest();
            if (empty($theme_manifest['converted_to_css'])) {
                Styles::factory(fn_get_theme_path('[theme]', 'C'))->setStyle($_REQUEST['id'], $_REQUEST['status']);
                // Delete compiled CSS file
                fn_clear_cache('assets');
            } else {
                $layout = Layout::instance(Registry::get('runtime.company_id'))->getDefault();
                fn_set_notification('E', __('error'), __('theme_editor.error_theme_converted_to_css', array('[url]' => fn_url("customization.update_mode?type=theme_editor&status=enable&s_layout={$layout['layout_id']}"))));
            }
        }
    }
    if ($mode == 'update_dev_mode') {
        if (!empty($_REQUEST['dev_mode'])) {
            if (!empty($_REQUEST['state'])) {
                Development::enable($_REQUEST['dev_mode']);
            } else {
                Development::disable($_REQUEST['dev_mode']);
            }
            if ($_REQUEST['dev_mode'] == 'compile_check') {
                if (!empty($_REQUEST['state'])) {
                    fn_set_notification('W', __('warning'), __('warning_store_optimization_dev', array('[link]' => fn_url('themes.manage'))));
                } else {
                    fn_set_notification('W', __('warning'), __('warning_store_optimization_dev_disabled', array('[link]' => fn_url('themes.manage?ctpl'))));
                }
            }
        }
        exit;
    }
    return array(CONTROLLER_STATUS_OK, 'themes.manage');
}