HEX
Server: Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 mod_fcgid/2.3.9 PHP/5.4.16
System: Linux dvm.vladweb.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: region-gk.ru (1016)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: /home/temp/yarusvl.ru/adminx/ajax/save_style.php
<?php

if(!$mgc->managers->access('design')) {
    exit();
}

// Проверка сессии для защиты от xss
if(!$mgc->request->check_session()) {
    trigger_error('Session expired', E_USER_WARNING);
    exit();
}
$content = $mgc->request->post('content');
$style = $mgc->request->post('style');
$theme = $mgc->request->post('theme', 'string');

if(pathinfo($style, PATHINFO_EXTENSION) != 'css') {
    exit();
}

/*Сохранение стилей из админки*/
$file = $mgc->config->root_dir.'tpls/'.$theme.'/css/'.$style;
if(is_file($file) && is_writable($file) && !is_file($mgc->config->root_dir.'tpls/'.$theme.'/locked')) {
    file_put_contents($file, $content);

    $css_version = ltrim($mgc->settings->css_version, '0');
    if (!$css_version) {
        $css_version = 0;
    }
    $mgc->settings->css_version = str_pad(++$css_version, 6, 0, STR_PAD_LEFT);

}

$result = true;
header("Content-type: application/json; charset=UTF-8");
header("Cache-Control: must-revalidate");
header("Pragma: no-cache");
header("Expires: -1");
$json = json_encode($result);
print $json;