protected function render() { foreach ($this->children as $child) { $this->data[basename($child)] = $this->getChild($child); } if (file_exists(DIR_TEMPLATE . $this->template)) { extract($this->data); ob_start(); require VQMod::modCheck(DIR_TEMPLATE . $this->template); $this->output = ob_get_contents(); ob_end_clean(); return $this->output; } else { trigger_error('Error: Could not load template ' . DIR_TEMPLATE . $this->template . '!'); exit; } }
/** * Allows loading from a specified directory instead of DIR_APPLICATION * * @param $model * @param $directory * @throws Exception when file was not found */ private function modelFromDirectory($model, $directory) { if (!$directory) { $directory = DIR_APPLICATION; } $file = $directory . '/model/' . $model . '.php'; $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model); if (file_exists($file)) { if (class_exists('VQMod')) { include_once VQMod::modCheck(modification($file), $file); } else { include_once $file; } $this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry)); } else { throw new Exception('Model not found', 404); } }
private function execute($action) { if (method_exists($action, 'getFile')) { if (file_exists($action->getFile())) { require_once VQMod::modCheck($action->getFile()); $class = $action->getClass(); $controller = new $class($this->registry); if (is_callable(array($controller, $action->getMethod()))) { $action = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs()); } else { $action = $this->error; $this->error = ''; } } else { $action = $this->error; $this->error = ''; } } else { $result = $action->execute($this->registry); if (is_object($result)) { $action = $result; } elseif ($result === false) { $action = $this->error; $this->error = ''; } else { $action = false; } } return $action; }
function autoload($class) { $file = DIR_SYSTEM . 'library/' . str_replace('\\', '/', strtolower($class)) . '.php'; if (is_file($file)) { include_once VQMod::modCheck(modification($file), $file); return true; } return false; }
public function __construct($driver, $hostname, $username, $password, $database) { if (file_exists(DIR_DATABASE . $driver . '.php')) { require_once VQMod::modCheck(DIR_DATABASE . $driver . '.php'); } else { exit('Error: Could not load database file ' . $driver . '!'); } $this->driver = new $driver($hostname, $username, $password, $database); }
public function query($sql) { require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/config.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/core.php'); $nitroPersistence = getNitroPersistence(); if (!empty($nitroPersistence['Nitro']['Enabled']) && $nitroPersistence['Nitro']['Enabled'] == 'yes' && !empty($nitroPersistence['Nitro']['DBCache']['Enabled']) && $nitroPersistence['Nitro']['DBCache']['Enabled'] == 'yes') { $nitro_matches = array(); $nitro_match = false; // Product COUNT Queries if (!empty($nitroPersistence['Nitro']['DBCache']['ProductCountQueries']) && $nitroPersistence['Nitro']['DBCache']['ProductCountQueries'] == 'yes') { $nitro_match = preg_match('~SELECT.*COUNT\\(.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(product)([\\s]|$)~i', $sql, $nitro_matches); } // Category COUNT Queries if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['CategoryCountQueries']) && $nitroPersistence['Nitro']['DBCache']['CategoryCountQueries'] == 'yes') { $nitro_match = preg_match('~SELECT.*COUNT\\(.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(category)([\\s]|$)~i', $sql, $nitro_matches); } // Category Queries if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['CategoryQueries']) && $nitroPersistence['Nitro']['DBCache']['CategoryQueries'] == 'yes') { $nitro_match = preg_match('~SELECT.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(category)([\\s]|$)~i', $sql, $nitro_matches); } // SEO URLs Queries if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['SeoUrls']) && $nitroPersistence['Nitro']['DBCache']['SeoUrls'] == 'yes') { $nitro_match = preg_match('~SELECT.*FROM.*[^0-9a-zA-Z_]' . DB_PREFIX . '(url_alias)([\\s]|$)~i', $sql, $nitro_matches); } // Search Queries if (!$nitro_match && !empty($nitroPersistence['Nitro']['DBCache']['Search']) && $nitroPersistence['Nitro']['DBCache']['Search'] == 'yes') { $nitro_match = preg_match('~SELECT.*WHERE.*(LIKE|MATCH)~i', $sql, $nitro_matches); if ($nitro_match) { $nitro_match = false; if (!empty($nitroPersistence['Nitro']['DBCache']['SearchKeywords'])) { $nitro_keywords = explode(",", $nitroPersistence['Nitro']['DBCache']['SearchKeywords']); foreach ($nitro_keywords as $nitro_keyword) { if (stripos(trim($nitro_keyword), $sql) !== FALSE) { $nitro_match = true; break; } } } } } if ($nitro_match) { require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/dbcache.php'); $nitro_cache_selector = strtolower($nitro_matches[1]) . '.' . md5($sql); // category.6ef5cee93ce985fe9de730a1d837455d $nitro_result = getNitroDBCache($nitro_cache_selector); if ($nitro_result !== FALSE) { return $nitro_result; } } } if (!empty($nitro_cache_selector)) { $nitro_db_result = $this->driver->query($sql); setNitroDBCache($nitro_cache_selector, $nitro_db_result); return $nitro_db_result; } return $this->driver->query($sql); }
private static function _autoloadController($class) { preg_match_all('/((?:^|[A-Z])[a-z]+)/', $class, $matches); if (isset($matches[0][1]) && isset($matches[0][2])) { $file = DIR_APPLICATION . 'controller/' . strtolower($matches[0][1]) . '/' . strtolower($matches[0][2]) . '.php'; if (file_exists($file)) { require_once VQMod::modCheck(VQMod::modCheck($file)); } } }
public function helper($helper) { $file = DIR_SYSTEM . 'helper/' . str_replace('../', '', (string) $helper) . '.php'; if (file_exists($file)) { include_once VQMod::modCheck(modification($file), $file); } else { trigger_error('Error: Could not load helper ' . $file . '!'); exit; } }
public function helper($helper) { $file = DIR_SYSTEM . 'helper/' . $helper . '.php'; if (file_exists($file)) { include_once VQMod::modCheck($file); } else { trigger_error('Error: Could not load helper ' . $file . '!'); exit; } }
function autoload($class) { $file = DIR_SYSTEM . 'library/' . str_replace('\\', '/', strtolower($class)) . '.php'; if (file_exists($file)) { include VQMod::modCheck(modification($file)); return true; } else { return false; } }
public function __construct($driver, $hostname, $username, $password, $database) { $file = DIR_DATABASE . $driver . '.php'; if (file_exists($file)) { require_once VQMod::modCheck($file); $class = 'DB' . $driver; $this->driver = new $class($hostname, $username, $password, $database); } else { exit('Error: Could not load database driver type ' . $driver . '!'); } }
public function load($filename) { $file = DIR_CONFIG . $filename . '.php'; if (file_exists($file)) { $_ = array(); require VQMod::modCheck($file); $this->data = array_merge($this->data, $_); } else { trigger_error('Error: Could not load config ' . $filename . '!'); exit; } }
public function database($driver, $hostname, $username, $password, $database) { $file = DIR_SYSTEM . 'database/' . $driver . '.php'; $class = 'Database' . preg_replace('/[^a-zA-Z0-9]/', '', $driver); if (file_exists($file)) { include_once VQMod::modCheck($file); $this->registry->set(str_replace('/', '_', $driver), new $class($hostname, $username, $password, $database)); } else { trigger_error('Error: Could not load database ' . $driver . '!'); exit; } }
public static function modCheck($file) { global $vqmod; if (class_exists('VQMod')) { if (isset($vqmod) && is_object($vqmod)) { return $vqmod->modCheck($file); } if (isset(VQMod::$_vqversion)) { return VQMod::modCheck($file); } } return $file; }
public function load($filename) { $_ = array(); $file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php'; if (file_exists($file)) { require VQMod::modCheck($file); } $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php'; if (file_exists($file)) { require VQMod::modCheck($file); } $this->data = array_merge($this->data, $_); return $this->data; }
public function fetch($filename) { $file = DIR_TEMPLATE . $filename; if (file_exists($file)) { extract($this->data); ob_start(); include VQMod::modCheck($file); $content = ob_get_clean(); return $content; } else { trigger_error('Error: Could not load template ' . $file . '!'); exit; } }
public function set($key, $value) { $this->delete($key); require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/config.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/core.php'); $nitroPersistence = getNitroPersistence(); if (!empty($nitroPersistence['Nitro']['Enabled']) && $nitroPersistence['Nitro']['Enabled'] == 'yes' && (empty($nitroPersistence['Nitro']['OpenCartCache']['Enabled']) || $nitroPersistence['Nitro']['OpenCartCache']['Enabled'] == 'no')) { return; } $nitro_expire = !empty($nitroPersistence['Nitro']['OpenCartCache']['ExpireTime']) ? (int) $nitroPersistence['Nitro']['OpenCartCache']['ExpireTime'] : 0; $this->expire = $nitro_expire; $file = DIR_CACHE . 'cache.' . preg_replace('/[^A-Z0-9\\._-]/i', '', $key) . '.' . (time() + $this->expire); $handle = fopen($file, 'w'); fwrite($handle, serialize($value)); fclose($handle); }
public function vqmod_resolve($file) { if (class_exists('VQMod')) { $is_static = false; $folder = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'vqmod' . DIRECTORY_SEPARATOR; $vqmod_file_contents = file_get_contents($folder . 'vqmod.php'); $is_static = stripos($vqmod_file_contents, 'public static function modCheck') !== FALSE; if ($is_static) { $file = VQMod::modCheck($file); } else { $vqmod = new VQMod(); $file = $vqmod->modCheck($file); unset($vqmod); } } return $file; }
public function execute($registry) { // Stop any magical methods being called if (substr($this->method, 0, 2) == '__') { return false; } if (is_file($this->file)) { include_once VQMod::modCheck($this->file); $class = $this->class; $controller = new $class($registry); if (is_callable(array($controller, $this->method))) { return call_user_func(array($controller, $this->method), $this->args); } else { return false; } } else { return false; } }
public function load($filename) { $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php'; if (file_exists($file)) { $_ = array(); require VQMod::modCheck($file); $this->data = array_merge($this->data, $_); return $this->data; } $file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php'; if (file_exists($file)) { $_ = array(); require VQMod::modCheck($file); $this->data = array_merge($this->data, $_); return $this->data; } else { trigger_error('Error: Could not load language ' . $filename . '!'); // exit(); } }
public function output() { if ($this->output) { if ($this->level) { $ouput = $this->compress($this->output, $this->level); } else { $ouput = $this->output; } if (!headers_sent()) { foreach ($this->headers as $header) { header($header, true); } } echo $ouput; require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/config.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/core.php'); $nitroPersistence = getNitroPersistence(); if (!empty($nitroPersistence['Nitro']['Enabled']) && $nitroPersistence['Nitro']['Enabled'] == 'yes' && $nitroPersistence['Nitro']['PageCache']['Enabled'] == 'yes') { require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/bottom.php'); } } }
public function uninstall() { $this->load->language('extension/openbay'); $this->load->model('extension/extension'); if (!$this->user->hasPermission('modify', 'extension/openbay')) { $this->session->data['error'] = $this->language->get('error_permission'); $this->response->redirect($this->url->link('extension/openbay', 'token=' . $this->session->data['token'], 'SSL')); } else { $this->session->data['success'] = $this->language->get('text_uninstall_success'); require_once VQMod::modCheck(DIR_APPLICATION . 'controller/openbay/' . $this->request->get['extension'] . '.php'); $this->load->model('extension/extension'); $this->load->model('setting/setting'); $this->model_extension_extension->uninstall('openbay', $this->request->get['extension']); $this->model_setting_setting->deleteSetting($this->request->get['extension']); $class = 'ControllerOpenbay' . str_replace('_', '', $this->request->get['extension']); $class = new $class($this->registry); if (method_exists($class, 'uninstall')) { $class->uninstall(); } $this->response->redirect($this->url->link('extension/openbay', 'token=' . $this->session->data['token'], 'SSL')); } }
public function save($file, $quality = 90) { require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/config.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'nitro/core/core.php'); $nitroPersistence = getNitroPersistence(); if (!empty($nitroPersistence['Nitro']['Enabled']) && $nitroPersistence['Nitro']['Enabled'] == 'yes' && !empty($nitroPersistence['Nitro']['ImageCache']['OverrideCompression']) && $nitroPersistence['Nitro']['ImageCache']['OverrideCompression'] == 'yes') { $nitro_quality = !empty($nitroPersistence['Nitro']['ImageCache']['JPEGCompression']) ? (int) $nitroPersistence['Nitro']['ImageCache']['JPEGCompression'] : $quality; $quality = $nitro_quality < 0 ? 0 : ($nitro_quality > 100 ? 100 : $nitro_quality); } $info = pathinfo($file); $extension = strtolower($info['extension']); if (is_resource($this->image)) { if ($extension == 'jpeg' || $extension == 'jpg') { imagejpeg($this->image, $file, $quality); } elseif ($extension == 'png') { imagepng($this->image, $file); } elseif ($extension == 'gif') { imagegif($this->image, $file); } imagedestroy($this->image); } }
private function execute($action) { if (file_exists($action->getFile())) { require_once VQMod::modCheck($action->getFile()); $class = $action->getClass(); $controller = new $class($this->registry); $ignore_class = array("Controlleraffiliateaccount", "Controlleraffiliateedit", "Controlleraffiliateforgotten", "Controlleraffiliatelogin", "Controlleraffiliatepassword", "Controlleraffiliatepayment", "Controlleraffiliateregister", "Controlleraffiliatesuccesstracking", "Controlleraffiliatetransaction", "Controlleraccountvoucher", "Controllerproductmanufacturer", "Controllerproductspecial"); if (in_array($class, $ignore_class)) { $action = $this->error; $this->error = ''; return $action; } if (is_callable(array($controller, $action->getMethod()))) { $action = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs()); } else { $action = $this->error; $this->error = ''; } } else { $action = $this->error; $this->error = ''; } return $action; }
exit; } // VirtualQMOD require_once './vqmod/vqmod.php'; VQMod::bootup(); // VQMODDED Startup require_once VQMod::modCheck(DIR_SYSTEM . 'startup.php'); // Application Classes require_once VQMod::modCheck(DIR_SYSTEM . 'library/customer.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/tax.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/length.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/cart.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/ocstore.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 {
exit; } // VirtualQMOD require_once './vqmod/vqmod.php'; VQMod::bootup(); // VQMODDED Startup require_once VQMod::modCheck(DIR_SYSTEM . 'startup.php'); // Application Classes require_once VQMod::modCheck(DIR_SYSTEM . 'library/customer.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/tax.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/length.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/cart.php'); require_once VQMod::modCheck(DIR_SYSTEM . 'library/api_log.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('http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . rtrim(dirname($_SERVER['PHP_SELF']), '/.\\') . '/') . "'"); } else {
public function __construct($registry) { $this->registry = $registry; require_once VQMod::modCheck(DIR_SYSTEM . 'library/msloader.php'); $registry->set('MsLoader', new MsLoader($registry)); }
public function php() { $this->load->language('extension/installer'); $json = array(); if (!$this->user->hasPermission('modify', 'extension/installer')) { $json['error'] = $this->language->get('error_permission'); } $file = DIR_UPLOAD . str_replace(array('../', '..\\', '..'), '', $this->request->post['path']) . '/install.php'; if (!file_exists($file)) { $json['error'] = $this->language->get('error_file'); } if (!$json) { try { include VQMod::modCheck($file); } catch (Exception $exception) { $json['error'] = sprintf($this->language->get('error_exception'), $exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine()); } } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); }
// Version define('VERSION', '1.5.6'); // Configuration if (file_exists('config.php')) { require_once 'config.php'; } // Install if (!defined('DIR_APPLICATION')) { header('Location: ../install/index.php'); exit; } //VirtualQMOD require_once '../vqmod/vqmod.php'; $vqmod = new VQMod(); // VQMODDED Startup require_once $vqmod->modCheck(DIR_SYSTEM . 'startup.php'); // Application Classes require_once $vqmod->modCheck(DIR_SYSTEM . 'library/currency.php'); require_once $vqmod->modCheck(DIR_SYSTEM . 'library/user.php'); require_once $vqmod->modCheck(DIR_SYSTEM . 'library/weight.php'); require_once $vqmod->modCheck(DIR_SYSTEM . 'library/length.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);
/** * {@inheritdoc} */ public function getSource($name) { ####-fix for give support to vqmod-### return file_get_contents(VQMod::modCheck($this->findTemplate($name))); return file_get_contents($this->findTemplate($name)); }