<?php //Config App require_once DIR_ROOT . '/config/app.php'; //Composer autoload require_once DIR_ROOT . '/vendor/autoload.php'; //Constants require_once DIR_ROOT . '/core/constants.php'; //Config database require_once DIR_ROOT . '/config/database.php'; // VirtualQMOD \Prhost\System\Vqmod\Vqmod::bootup(DIR_STORAGE); //Bootstrap require_once DIR_APPLICATION . 'bootstrap.php';
<?php // Version define('VERSION', '2.0.0.0'); // VQMODDED Startup require_once \Prhost\System\Vqmod\Vqmod::modCheck(DIR_SYSTEM . 'startup.php'); // Registry $registry = new Registry(); // Loader $loader = new Loader($registry); $registry->set('load', $loader); // Config $config = new Config(); $registry->set('config', $config); // Database $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE); $registry->set('db', $db); // Store if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`ssl`, 'www.', '') = '" . $db->escape('https://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } else { $store_query = $db->query("SELECT * FROM " . DB_PREFIX . "store WHERE REPLACE(`url`, 'www.', '') = '" . $db->escape('http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } if ($store_query->num_rows) { $config->set('config_store_id', $store_query->row['store_id']); } else { $config->set('config_store_id', 0); } // Settings $query = $db->query("SELECT * FROM `" . DB_PREFIX . "setting` WHERE store_id = '0' OR store_id = '" . (int) $config->get('config_store_id') . "' ORDER BY store_id ASC"); foreach ($query->rows as $result) {
/** * VqmodObject::_parseMods() * * @param \DOMNode $node <modification> node to be parsed * @return null * @description Parses modifications in preparation for the applyMod method to work */ private function _parseMods(\DOMNode $node) { $files = $node->getElementsByTagName('file'); $replaces = Vqmod::$replaces; foreach ($files as $file) { $path = $file->getAttribute('path') ? $file->getAttribute('path') : ''; $filesToMod = explode(',', $file->getAttribute('name')); foreach ($filesToMod as $filename) { $fileToMod = $path . $filename; if (!empty($replaces)) { foreach ($replaces as $r) { if (count($r) == 2) { $fileToMod = preg_replace($r[0], $r[1], $fileToMod); } } } $error = $file->hasAttribute('error') ? $file->getAttribute('error') : 'log'; $fullPath = Vqmod::path($fileToMod); if ((!$fullPath || !file_exists($fullPath)) && strpos($fileToMod, '*') === false) { $fullPath = DIR_CORE . '/' . $fileToMod; } if (!$fullPath || !file_exists($fullPath)) { if (strpos($fileToMod, '*') !== false) { $fullPath = DIR_CORE . '/' . $fileToMod; } else { if ($error == 'log' || $error == 'abort') { $skip = $error == 'log' ? ' (SKIPPED)' : ' (ABORTING MOD)'; Vqmod::$log->write('VqmodObject::parseMods - Could not resolve path for [' . $fileToMod . ']' . $skip, $this); } if ($error == 'log' || $error == 'skip') { continue; } elseif ($error == 'abort') { return false; } } } $operations = $file->getElementsByTagName('operation'); foreach ($operations as $opIndex => $operation) { Vqmod::$fileModding = $fileToMod . '(' . $opIndex . ')'; $skipOperation = false; $error = $operation->hasAttribute('error') ? $operation->getAttribute('error') : 'abort'; $ignoreif = $operation->getElementsByTagName('ignoreif')->item(0); if ($ignoreif) { $ignoreif = new VQSearchNode($ignoreif); } else { $ignoreif = false; } $search = $operation->getElementsByTagName('search')->item(0); $add = $operation->getElementsByTagName('add')->item(0); if (!$search) { Vqmod::$log->write('Operation <search> tag missing', $this); $skipOperation = true; } if (!$add) { Vqmod::$log->write('Operation <add> tag missing', $this); $skipOperation = true; } if (!$skipOperation) { $this->mods[$fullPath][] = array('search' => new VQSearchNode($search), 'add' => new VQAddNode($add), 'ignoreif' => $ignoreif, 'error' => $error, 'fileToMod' => $fileToMod, 'opIndex' => $opIndex); } } Vqmod::$fileModding = false; } } }