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/get_categories.php
<?php

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

$mgc->design->set_templates_dir($mgc->config->xbackend.'/tpls/html');
$mgc->design->set_compiled_dir($mgc->config->xbackend.'/tpls/compiled');
$lang_id  = $mgc->languages->lang_id();
$lang_sql = $mgc->languages->get_query(array('object'=>'category'));
$result = array();

// Перевод админки
$backend_translations = new stdClass();
$manager = $mgc->managers->get_manager();
$file = $mgc->config->xbackend."/lang/".$manager->lang.".php";
if (!file_exists($file)) {
    foreach (glob($mgc->config->xbackend."/lang/??.php") as $f) {
        $file = $mgc->config->xbackend."/lang/".pathinfo($f, PATHINFO_FILENAME).".php";
        break;
    }
}
require_once($file);
$mgc->design->assign('btr', $backend_translations);

/*Выборка категории и её деток*/
if($mgc->request->get("category_id")) {
    $category_id = $mgc->request->get("category_id", 'integer');
    $categories = $mgc->categories->get_category($category_id);
    $mgc->design->assign('categories_ajax', $categories->subcategories);
    $result['success'] = true;
    $result['cats'] = $mgc->design->fetch("categories_ajax.tpl");
} else {
    $result['success ']= false;
}

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