$v){ $isLast = $k==$count-1; if($isLast) { $aa[] = $v; } else { $aa[] = strtolower($v); } } $paths = []; $isController = $aa[0]=='controller'; $isTheme = ($aa[0]=='themes' || ($isController and $aa[1]=='themes')) ; if($isTheme) $folder .= '../'; if($isController) { array_shift($aa); array_pop($aa); $paths[] = $folder.implode("/",$aa)."/controller.php"; } else { $ss = array_pop($aa); $paths[] = $folder . implode('/', $aa) . "/" . $ss . ".php"; $paths[] = $folder . strtolower(str_replace('\\','/',$x)). "/model.php"; } foreach ($paths as $p) { if(include_once($p)) { break; } } } spl_autoload_register ( 'CMSBuilderAutoload' ); include_once(dirname(__FILE__).'/../config.php'); include_once(dirname(__FILE__).'/core/core/connect.php'); ob_start(); // echo ob_get_clean(); - происходит в Core::end(); // Инициализируем основные функции. Core::init(); if($_GET['api']==1) { if(in_array($_SERVER['HTTP_HOST'],[ 'alsor.in', 'app.taskcrm.in', 'achi.in', 'localhost', //'contact.in', 'compare.in', //'changeblog.in', 'fixgardencrm.in', 'fnews.in', 'geek.in', 'minicourse.in', 'merakom.in', 'merabase.in', //'module.in', 'msto.in', 'roots3.in', 'rootscrm.in', 'module.in', 'vhl.in', //'timer.in', 'mquest.in', 'merakomis.in', 'photo.in', '127.0.0.2', 'ref.bur-indeetc.ru', 'sarkko.in', // public ])){ //header('Access-Control-Allow-Origin: http://localhost'); header('Access-Control-Allow-Origin: *'); //header('Access-Control-Allow-Origin: http://localhost'); header('Access-Control-Allow-Methods: *'); //header('Access-Control-Allow-Headers: cache-control, Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers'); //header('Access-Control-Allow-Headers: expires,pragma,Cache-Control, Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers'); header('Access-Control-Allow-Headers: *'); header('Cache-Control: no-store'); //header('Cache-Control: max-age=0'); } if(in_array($_SERVER['HTTP_HOST'],[ 'gigapolis.world', 'visuella.ru', '127.0.0.2', ])){ header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: *'); header('Access-Control-Allow-Headers: *'); header('Cache-Control: no-store'); } $a = 'controller\\' . str_replace('.', '\\', $_REQUEST['module']) . '\Api'; $func = $_REQUEST['action']; try { $s = new $a(); $s->$func($_REQUEST); } catch (Exception $e) { } Core::end(); exit; } //echo '

'.var_dump('END',microtime(true)-$start_engine);