в файле {$error['file']} строка {$error['line']}
"); } }); function classname_exists($classname, $submodule = FALSE) { $classname=strtolower($classname); if ($submodule) { $paths = array(MODULES_LOCAL . $classname . '/' . ltrim($submodule, '_') . '/', MODULES . $classname . '/' . ltrim($submodule, '_') . '/', MODULES . $classname . '/' . ltrim($submodule, '_') . '/_'); $classname = $submodule; } else $paths = array(CL, UTILS, BASE, MODULES_LOCAL . $classname . '/', MODULES . ltrim($classname, '_') . '/', BASE . '_', UTILS . '_', MODULES . ltrim($classname, '_') . '/_'); foreach ($paths as $path) { if (file_exists($path . $classname . '.php')) return $path . $classname; } } function CreateEmptyClass($path_classname, $classname) { if (strpos($path_classname, '/_')) { if (trait_exists('_' . $classname, FALSE) && !trait_exists($classname, FALSE)) eval("trait {$classname} {use _{$classname};}"); elseif (class_exists('_' . $classname, FALSE) && !class_exists($classname, FALSE)) eval("class {$classname} extends _{$classname} {}"); } } spl_autoload_register(function ($classname) { $path_classname = classname_exists($classname); if ($path_classname) { include_once $path_classname . '.php'; CreateEmptyClass($path_classname, $classname); } }); >> define('DBHOST', 'localhost'); define('DBNAME', 'propert1_interactiv'); define('DBLOGIN', 'propert1_interac'); define('DBPASSWORD', 'mersedess350'); // <<< DataBase if (isset($_SERVER['SERVER_NAME'])) define('DOMAIN', 'http://' . $_SERVER['SERVER_NAME'] . '/'); else define('DOMAIN', 'http://' . DOMAIN_CLEAR . '/'); define('USER_PREFIX', ''); define('USER_UID_NUMBER', 5); define('USER_NUMBER_ON_FOLDER', 1000); // LUCENE >>> define('LUCENE', 1); define('LUCENE_ENCODING', 'UTF-8'); define('SEARCH_PATH_INDEX', TEMP . 'search_index/' . DOMAIN_CLEAR); define('SEARCH_MIN_SCORE', 0); // <<< LUCENE define('URL_TRANSLIT', 'RU'); set_include_path(CORE . 'lib/'); // ARRAYS >>> $menu = array('menu_main'=>'Главное','menu_bottom'=>'Нижнее', 'menu_left' => 'Левое', 'menu_right'=>'Правое'); $admin_menu_array = array( //array('name'=>'Галерея','url'=>'/gallery/?ADMIN'), ); //<<< ARRAYS // CACHE >>> define('CACHE_ENABLE', true); define('CACHE_HOST', 'localhost'); define('CACHE_PORT', 11211); define('CACHE_EXPIRE', Utils::SECONDS_IN_A_MINUTE); define('CACHE_PREFIX', DOMAIN); //<<< CACHEgetArr($sql, $order, $dir, $start, $per_page); * * @param string $iinput - field name to test * @param array $allowed - an array with allowed variants * @param string $default - optional variable to set if no match found. Default to false. * @return string|FALSE - either sanitized value or FALSE */ function filterVar($input, $allowed, $default = FALSE) { if(is_string($allowed)) $allowed=array_values(explode(',',str_replace(' ','',$allowed))); $found = array_search($input, $allowed); return ($found === FALSE) ? $default : $allowed[$found]; } /** * function to filter out arrays, for the whitelisting purposes useful to pass entire superglobal to the INSERT or UPDATE query OUGHT to be used for this purpose, as there could be fields to which user should have no access to. Example: $allowed = array('title','url','body','rating','term','type'); $data = filterArray($_POST,$allowed); $sql = "INSERT INTO ?n SET ?u"; $db->query($sql,$table,$data); * * @param array $input - source array * @param array $allowed - an array with allowed field names, or string with comma separate * @return array filtered out source array */ function filterArray($input, $allowed,$not=false) { if(is_string($allowed)) $allowed=array_values(explode(',',str_replace(' ','',$allowed))); foreach ( array_keys($input) as $key ) if ((!$not && !in_array($key, $allowed)) || ($not && in_array($key, $allowed))) unset($input[$key]); return $input; } function str_($str) { $s = new _String(); $s->set($str); return $s; } function str(&$str, $link = false) { $s = new _String(); ($link) ? $s->setLink($str) : $s->set($str); return $s; } function arr($arr) { $s = new _Array(); $s->set($arr); return $s; } /*********************** FOR XSLT >>>*********************************************/ function date_xsl($time, $format){ $func=(strstr($format, '%'))?'strftime':'date'; if (is_numeric($time)) return $func($format, $time); elseif (trim($time)=='') return $func($format); else return $func($format, strtotime($time)); } /*********************** <<