protected function buildAjaxOut() { foreach ($this->data as $repl => $v) { $out .= "var {$repl}=\"" . my_js_conv($v) . "\"; "; } $out = preg_replace_callback("/<!--\\[([^\\[\\]]+)\\]-->/", "use_dictionary_callback", $out); $this->out = $out; }
<?php require_once "fn.php"; $CONFIG = (require "config.php"); try { DEBUG::start(); mb_internal_encoding("UTF-8"); setlocale(LC_ALL, "ru_RU.UTF-8"); $app = app::getInstance(); $app->setConfig($CONFIG); $app->setAjax($_REQUEST["ajax"]); $app->run(); $app->display(); DEBUG::finish(); if (($_REQUEST["debug"] || $CONFIG["debug"]) && !$_REQUEST["ajax"]) { echo DEBUG::out($CONFIG["debug_format"]); } } catch (Exception $e) { $str = "Unspecified fatal exception: " . $e->getMessage() . "\nException occurs in file " . $e->getFile() . " on line " . $e->getLine() . "\n\n"; if ($_REQUEST["ajax"]) { echo "var error=\"" . my_js_conv($str) . "\"; "; } else { echo str_replace("\n", "<br />", $str); } file_put_contents($CONFIG["tmp_dir"] . "/error.log", date("Y-m-d h:i:s") . " - " . $str, FILE_APPEND); }
<?php require_once dirname(__FILE__) . "/../fn.php"; require_once "req.php"; $CONFIG = (require dirname(__FILE__) . "/../config.php"); DB::setConfig($CONFIG["db"]); DEBUG::start(); ob_implicit_flush(1); mb_internal_encoding("UTF-8"); setlocale(LC_ALL, "ru_RU.UTF-8"); $out = "\n\nvar countries = new Array();\nvar cities = new Array();\n\ncountries[0] = '<!--[not_choosena]-->';\ncities[0] = new Array();\ncities[0][0] = '<!--[not_choosen]-->';\n\n"; $geo_countries = set_by_id(DB::f("select * from geo_countries")); $geo_cities = set_by_id(DB::f("select * from geo_cities")); foreach ($geo_countries as $rw) { $rw = my_js_conv($rw); $out .= "countries[" . $rw[id] . "] = '" . $rw[name] . "';\ncities[" . $rw[id] . "] = new Array();\ncities[" . $rw[id] . "][0] = '<!--[not_choosen]-->';\n"; } $out .= "\n\n"; foreach ($geo_cities as $rw) { $rw = my_js_conv($rw); $out .= "cities[" . $rw[country_id] . "][" . $rw[id] . "] = '" . $rw[name] . "';\n"; } $out = preg_replace_callback("/<!--\\[([^\\[\\]]+)\\]-->/", "use_dictionary_callback", $out); echo $out;