/** * 用户验证 */ private static function _initialize() { require_once MVC_DIR . '/Initialize.class.php'; //权限验证类 $initialize = new Initialize(); $initialize->runGlobal(); }
public function __construct() { settype($this->catId, 'integer'); settype($this->subcatId, 'integer'); settype($this->showAll, 'bool'); $this->config = Initialize::obtain()->config; $this->mainBlocks = new MainBlocks(); }
public function __construct($array = []) { Initialize::run(true); if (Compose::run()) { echo '<pre>'; print_r($array); echo '</pre>'; } }
public function __construct() { $this->config = Initialize::obtain()->config; if ($_SERVER['SERVER_ADDR'] == '127.0.0.1') { $this->path = $this->config['localCorePath']; } else { $this->path = ROOT . 'admin/'; } }
/** * CONSTRUCTOR - Initialize */ public function __construct($start = '') { // Managed directives ini_set('default_charset', $charset = 'UTF-8'); ini_set('display_errors', 1); // Abort on startup error // Intercept errors/exceptions; PHP5.3-compatible error_reporting(E_ALL | E_STRICT); if (!ini_get('date.timezone')) { date_default_timezone_set('GMT'); } // define shorthand paths if (!defined('BASE')) { $base = dirname(__FILE__) . '/'; define("BASE", $base); define("CACHE", $base . 'cache/'); define("ADMIN", $base . 'admin/'); define("INSTALL", $base . 'install/'); define("LIBS", $base . 'libs/'); define("EXTENSIONS", $base . 'libs/extensions/'); define("FRAMEWORKS", $base . 'libs/frameworks/'); define("FUNCTIONS", $base . 'functions/'); define("CONTENT", $base . 'content/'); define("THEMES", $base . 'content/themes/'); define("PLUGINS", $base . 'content/plugins/'); define("ADMIN_THEMES", $base . 'content/admin_themes/'); define("SITEURL", BASEURL); } if (!$start) { // initialize parent::__construct(); $this->currentUser = UserBase::instance(); // the current user $this->displayUser = DisplayUser::instance(); $this->plugin = Plugin::instance(); // instantiate Plugin object $this->post = Post::instance(); // instantiate Post object $this->comment = Comment::instance(); $this->includes = IncludeCssJs::instance(); // instantiate Includes object $this->pageHandling = PageHandling::instance(); // instantiate PageHandling object $this->debug = Debug::instance(); // instantiate Debug object $this->csrf('set'); // set a csrfToken $this->db->setHotaru($this); // pass $h object to EzSQL for error reporting //$this->mdb->setHotaru($this); // pass $h object to meekroDb for error reporting //print 'time: ' . timer_stop(4,'hotaru'); //roughly here at 0.0040 Nov 2, 2014 tests // time: 0.0047 Nov11, 2014 after moving a few more functions to init } }
function lang($keyword, $esDinamico = false, $divisor = '[div]') { global $lang; if (!trim($keyword)) { return; } $keyword = utf8_strtolower($keyword); $config = Initialize::obtain()->config; // TEXTOS ESTATICOS //////////////////////////////////////////////////////////// if ($esDinamico === false) { $exist = false; // SI NO EXISTE EN EL ARRAY LANG, AGREGA A LA DB if (!isset($lang[$keyword])) { // VERIFY IF EXIST KEYWORD IN DB if ($config['siteUseDb']) { $exist = c("select keyword from static_lang_keys where keyword = '" . $keyword . "' and lang = '" . $_SESSION['lang'] . "' "); } // IF NOT EXIST, ADD TO DB if (!$exist) { if ($config['siteUseDb']) { sq("insert into static_lang_keys set dateLastUpdate = NOW(), dateInsert=NOW(), keyword = '" . $keyword . "', lang = '" . $_SESSION['lang'] . "', keyvalue = '" . $keyword . "' "); } } return utf8_ucfirst($keyword); } else { return utf8_ucfirst($lang[$keyword]); } } // TEXTOS DINAMICOS //////////////////////////////////////////////////////////////// if ($esDinamico === true) { $keyOfSelectedLang = array_search($_SESSION['lang'], $config['lang']); $keyword = explode($divisor, $keyword); // SI EXISTE, DEVUELVE VALOR if (isset($keyword[$keyOfSelectedLang])) { return $keyword[$keyOfSelectedLang]; } else { return $keyword[0]; } } }
{ define('YII_DEBUG', (bool) self::env('YII_DEBUG')); define('WEB_ROOT', dirname(__FILE__)); define('APP_ROOT', dirname(dirname(__FILE__)) . '/app'); } private static final function includeFrameworkLib() { $yii = stream_resolve_include_path('Yii-1.1.16/yii.php'); if ($yii === FALSE) { self::initError('A biblioteca base está inacessível.'); } else { require_once $yii; } } private static final function checkExtraConfigFiles() { $extraConfigs = ['database.php', 'routes.php', 'packages.php']; foreach ($extraConfigs as $configFile) { $path = APP_ROOT . "/configs/{$configFile}"; if (!is_readable($path)) { $filename = basename($path, '.php'); self::initError(sprintf('O arquivo de configuração %s não está acessível.', $filename)); } } } } /** * Chama o método de inicialização. */ Initialize::init();
public function initDatabase() { return View::make('common/home', array('db_result' => Initialize::makeTables())); }
public static function obtain($config = null, $path = null) { if (!self::$instance) { self::$instance = new self($config, $path); } return self::$instance; }
public function __construct($container_options, $mail_options) { $this->config = Initialize::obtain()->config; $this->container_options = $container_options; $this->mail_options = $mail_options; $this->Mail_Queue = new Mail_Queue($container_options, $mail_options); $this->ErrorManager = new ErrorManager(); }
public function tables() { // Collecting all table names and storing them (A) if (preg_match_all(Initialize::$replace["tableName"], Compose::databaseFile3(), $tableNameCode)) { new Compile($tableNameCode); $tableNames = $tableNameCode[1]; Initialize::databaseTableNames($tableNames); new Compile($tableNames); } else { echo "ERROR 1"; } echo Compose::databaseFile2(); echo '<br><br><br>'; new Compile((string) Compose::databaseFile3()); echo '<br><br><br>'; // For every table name.. for ($i = 0; $i < count($tableNames); $i++) { // Check if code in database file is written correctly (B) if (preg_match_all(sprintf(Initialize::$replace["table"], $tableNames[$i], $tableNames[$i]), Compose::databaseFile3(), $tableCode)) { new Compile($tableCode); // Store data in arrays $tables[$tableNames[$i]] = $tableCode[0][0]; $inTables[$tableNames[$i]] = $tableCode[1][0]; } else { echo "noo"; } // Initializing the code inside database table // Must initialize it here, if not, the collection of columns will not work.. [BUG] Initialize::databaseCode($inTables, "inTables"); // Collecting the columns from table (C) if (preg_match_all(sprintf(Initialize::$replace["tableColumns"], $tableNames[$i], $tableNames[$i]), Compose::databaseCode()["inTables"][$tableNames[$i]], $columns)) { $columnsCode[$tableNames[$i]] = $columns[0][0]; $column[] = $columns[1][0]; $sortColumns[$tableNames[$i]] = preg_split(Initialize::$replace["seperate"], $column[$i]); } else { echo "He has not created columns.."; } Initialize::databaseTableColumns($sortColumns); // Collecting all rows from tables (D) if (preg_match_all(sprintf(Initialize::$replace["tableRows"], $tableNames[$i]), Compose::undo(Compose::databaseCode()["inTables"][$tableNames[$i]]), $rows)) { new Compile($rows); $rowsCode[$tableNames[$i]] = $rows[0]; $newRows[$tableNames[$i]] = $rows[1]; foreach ($newRows[$tableNames[$i]] as $key => $value) { $newRows2[$tableNames[$i]][] = preg_split(Initialize::$replace["seperate"], $newRows[$tableNames[$i]][$key]); $newRows3[$tableNames[$i]][] = array_combine(Compose::databaseTableColumns()[$tableNames[$i]], $newRows2[$tableNames[$i]][$key]); } } } // End of loop //new Compile($newRows3); //new Compile($sortColumns); // Initializing the table code Initialize::databaseCode($tables, "tables"); // Initializing the column code inside table Initialize::databaseCode($columnsCode, "inTableColumns"); // Initializing the rows code inside table Initialize::databaseCode($rowsCode, "inTableRows"); Initialize::databaseTableRows($newRows3); new Compile(Compose::databaseCode()); }
<?php require_once '_init.php'; define('ID', sprintf('%d', $_POST['id'])); $media = a("SELECT item_id, nombre, tipo, tabla FROM files WHERE id=" . ID); // SI SE ENCONTRO LA ENTRADA EN LA TABLA FILES CON EL ID DATO if ($media) { define('TABLA', $_POST['tabla']); define('DELETEPATH', $_SERVER['DOCUMENT_ROOT'] . ROOT . 'admin/uploads/' . TABLA . '/'); // GET FILES OF SAME ITEM ID FOR ENABLE / DISABLE FILE FIELD $cantOfFilesInSameItemId = c("SELECT id from files WHERE item_id = " . $media['item_id'] . " AND tipo = '" . $media['tipo'] . "' AND tabla = '" . $media['tabla'] . "'"); $config = Initialize::obtain()->config; // AUDIOS if ($media['tipo'] == 'audios') { if ($config['convertAudio']) { $file = substr(trim($media['nombre']), 0, strlen(trim($media['nombre'])) - 4) . '-converted.mp3'; $file = DELETEPATH . $file; } else { $file = DELETEPATH . $media['nombre']; } } elseif ($media['tipo'] == 'videos') { if ($config['convertVideo']) { $file = substr(trim($media['nombre']), 0, strlen(trim($media['nombre'])) - 4) . '-converted.flv'; $file = DELETEPATH . $file; $preview = substr(trim($media['nombre']), 0, strlen(trim($media['nombre'])) - 4) . '-converted.flv1.jpg'; $preview = DELETEPATH . $preview; } else { $file = DELETEPATH . $media['nombre']; $preview = DELETEPATH . $media['fuente']; } } else {
$path = $_SERVER['HOME'] . '/public_html' . $config['root'] . $config['subdomainForCron'] . 'admin/'; define('CRON', true); } } define('PATH', $path); if ($config['siteUseDb']) { // INCLUDE DB CLASS require_once PATH . 'classes/class.Database.php'; // CONECT TO DB $db = Database::obtain($config['db_server'], $config['db_user'], $config['db_pass'], $config['db_name']); $db->connect(); } // INCLUE INIT CLASS require_once PATH . 'classes/class.Initialize.php'; // INIT ADMIN $init = Initialize::obtain($config, PATH); $lang = $init->getLangArray(); // INCLUDES if ($config['siteUseDb']) { require_once 'include.DbFunctions.php'; } require_once 'include.Format.php'; require_once 'include.Files.php'; // CLASSES require_once PATH . 'classes/class.ForeachContenidosListados.php'; require_once PATH . 'classes/class.FormInputs.php'; require_once PATH . 'classes/class.ImageResize.php'; require_once PATH . 'classes/class.ShowMedia.php'; require_once PATH . 'classes/class.EmailSender.php'; require_once PATH . 'classes/class.Upload.php'; require_once PATH . 'classes/class.Loop.php';
public static function where($column, $value) { if (Compose::prepared()) { foreach (Compose::databaseTableRows()[Compose::table()] as $key => $values) { if (Compose::databaseTableRows()[Compose::table()][$key][$column] == $value) { $sorted[Compose::table()][$key] = $values; } } Initialize::where($sorted); echo '<br><br><br><br><br><br><br><br><br><br>'; new Compile(Compose::where()); echo '<br><br><br><br><br><br><br><br><br><br>'; } }
public function __construct() { $this->config = Initialize::obtain()->config; }
public static function start_routing() { if (isset($_GET['file'])) { //The request is for an asset, so load it. $content_types = ["css" => "text/css", "js" => "applicaton/x-javascript", "woff2" => "font/woff2", "woff" => "font/woff", "ttf" => "font/ttf"]; foreach ($content_types as $control => $type) { if (strpos($_GET["get"], "." . $control)) { header('Content-type: ' . $type); } } $query = $_SERVER['REQUEST_URI']; $query = substr($query, strpos($query, "?") + 1); $query = explode("&", $query); $temp = $query; $query = array(); foreach ($temp as $q) { $t = explode("=", $q); if (!isset($_GET[$t[0]])) { if (count($t) > 1) { $_GET[$t[0]] = $t[1]; } else { $_GET[$t[0]] = null; } } } echo file_get_contents($_GET['get']); exit; } if (FW_CONFIGS) { //Environment is set, proceed to load //Split the url to pieces if (strpos($_SERVER['REQUEST_URI'], '?') !== false) { //While authenticating with Facebook, the returned URI sets a second "?", so let's change them into '&' $url = $_SERVER['REQUEST_URI']; $sub_url = "&" . substr($url, strpos($url, '?') + 1); while (($startpos = strpos($sub_url, "&")) !== false) { $startpos += 1; //Determine the parameter name $par_name = substr($sub_url, $startpos); $par_name = substr($par_name, 0, strpos($par_name, "=")); //Now get the value $sub_url = substr($sub_url, $startpos); $temp = substr($sub_url, strpos($sub_url, "=") + 1); if (($endpos = strpos($temp, "&")) === false) { $endpos = strlen($temp); } $par_value = substr($temp, 0, $endpos); $_GET[$par_name] = $par_value; $_REQUEST[$par_name] = $par_value; } } $url = Routing::split_url($_GET); //Rename url-parts for proper use if (isset($url[0])) { $class = $url[0]; } else { $class = null; } if (isset($url[1]) && $url[1] != "" && $url[1] != null && substr($url[1], 0, 1) != "_") { $action = $url[1]; } else { $action = 'index'; } $count = 2; $params = array(); while (isset($url[$count])) { array_push($params, $url[$count]); $count++; } //Be smart and get the correct controller for each page: $class = 'Controller\\' . ucfirst($class); if (class_exists($class)) { $obj = new $class(); //And execute the correct function please: if (method_exists($obj, $action)) { call_user_func_array(array($obj, $action), $params); } else { //Function not existing, render 404 $c = new Controller(); $c->error->trigger(404, "Function does not exist"); } } else { $LANDING_CONTROLLER = "Controller\\" . LANDING_CONTROLLER; $obj = new $LANDING_CONTROLLER(); $obj->index(); } } else { //Render the page for setting environment variables. That'll help users start more easily. $obj = new Initialize(); $obj->index(); } //Yep, that's it. }
public static function run($bool) { self::$run = $bool; }