public function mygetPageContent($args) { $reg_exp = '#<body>(.*?)<\\/body>#si'; if (VBox::isExist('Page')) { $old_page = @VBox::get('Page'); } $pageId = (int) $args[0]; // var_dump($pageId); $page = new Page($pageId); // var_dump($page->checkHidden()); if ($page && !$page->checkHidden()) { $page->dropAllHeaders(); ob_start(); $agregator = new Agregator($pageId); $agregator->process(true); $content = ob_get_contents(); ob_clean(); if (!is_null($old_page)) { VBox::set('Page', $old_page); } if (!isset($args[1]) && preg_match($reg_exp, $content, $matches)) { return $matches[1]; } return $content; } }
public function __construct($localPath, $cacheDir, $cachecount = 5) { $this->dbName = ''; $this->isValidFS = FALSE; $this->localPath = ''; $this->cachePath = ''; $this->cacheLog['error'] = array(); $this->cacheLog['event'] = array(); $this->setLogMode(1); $this->cachecount = $cachecount; // date_default_timezone_set("UTC"); if (VBox::isExist('ConstData')) { $this->_constData = VBox::get('ConstData'); } else { $this->_constData = new ConstData(); VBox::set('ConstData', $this->_constData); } $this->loginPage = VBox::get('ConstData')->getConst('loginPage'); // $this->cachecount = $this->_constData->getConst('cachecount'); if (!file_exists($localPath . $cacheDir . '/')) { mkdir($localPath . $cacheDir . '/', 0775, TRUE); } if (file_exists($localPath . $cacheDir . '/')) { $this->localPath = $localPath; $this->cachePath = $localPath . $cacheDir . '/'; $this->isValidFS = TRUE; } }
public function __construct($localPath) { $this->dbName = ''; $this->localPath = $localPath; if (VBox::isExist('ConstData')) { $this->_constData = VBox::get('ConstData'); } else { VBox::set('ConstData', new ConstData()); $this->_constData = VBox::get('ConstData'); } $this->_constData->setConst('request', ''); }
public function __construct() { $path = dirname(__FILE__); $length = intval(strpos($path, 'jcontroller')); if (0 == $length) { return; } $path = rtrim(substr($path, 0, $length - 1), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'includes.inc.php'; if (!file_exists($path)) { return; } include_once $path; VBox::set('ConstData', new ConstData()); $this->isValid = TRUE; }
public function makePurchaseLink($product = 'orderpro', $cur = 'USD', $recommendation = '', $coupon = '') { $url = ''; if ($this->accaunt < 0) { $this->ip = isset($_GET['ip']) ? $_GET['ip'] : $this->getIp(); $randomAccaunt = isset($this->randomAccauntsArray[$product]) ? $this->randomAccauntsArray[$product] : $this->randomAccauntDefault; if ($randomAccaunt > 0) { $this->accaunt = 0; if (isset($_COOKIE['netspot_accaunt'])) { $this->accaunt = $_COOKIE['netspot_accaunt']; } elseif (!ereg('MSIE', getenv('HTTP_USER_AGENT')) == false) { $this->accaunt = $this->getRandomAccaunt(75); } else { if (!$this->locale) { $this->locale = $this->getCountryForIpJson2($this->ip); } $this->checkRandAccount($randomAccaunt); if ($this->locale && !in_array($this->locale, $this->locales)) { $this->accaunt = $this->getRandomAccaunt(60, $this->locale); } } setcookie("netspot_accaunt", $this->accaunt, 0x6fffffff); } VBox::set('purchase_account', $this->accaunt); } $this->oa('1 locale: ' . $this->locale); $this->oa('60 accaunt: ' . $this->accaunt); if ($recommendation == '') { $recommendation = $this->recommendation[$this->operator][$product][$this->accaunt]; } $url = sprintf($this->urls[$this->operator][$product], $this->licenses[$this->operator][$product][$this->accaunt], $recommendation); if ($coupon !== '') { $url .= '&coupon=' . $coupon; } $request = $_REQUEST; //unset($request['product']); //unset($request['cur']); //unset($request['recommendation']); //unset($request['coupon']); unset($request['ip']); unset($request['t']); unset($request['locale']); $request = http_build_query($request); if ($request) { $url .= '&' . $request; } return $url; }
/** * @author italiano * @date 12.12.2014 * return result localExt function */ private function _getLocalExt($string = null) { $string = trim($string); $content = ''; $data = array(); if (isset($string)) { $data = explode(' ', $string); } $class = $args = null; foreach ($data as $value) { list($type, $attr) = explode('=', $value); $attr = trim(str_replace('"', '', $attr)); $type = trim($type); switch ($type) { case "class": $class = $attr; break; case "params": $args = explode(',', $attr); break; } } if (file_exists(LOCAL_PATH . 'application/localExt/' . $class . '/index.php')) { if (isset($args)) { VBox::set($class, new $class($args)); } else { VBox::set($class, new $class()); } $content = VBox::get($class)->getResult(); return $content; VBox::clear($class); } return ''; }
public function getPage($pageId) { VBox::set('ConstData', new ConstData($this->siteDbName)); return new AdminPage($pageId, $this->siteDbName); }
<?php set_time_limit(360); if ($_SERVER['HTTP_HOST'] == NULL) { ini_set('magic_quotes_runtime', 'Off'); ini_set('display_errors', 'off'); include_once 'application/includes.inc.php'; VBox::set('ConstData', new ConstData()); $isCacheable = VBox::get('ConstData')->getConst('isCacheable'); // get isCacheable if ((bool) $isCacheable) { $localPath = LOCAL_PATH; //local path to site $cachePath = IniParser::getSettring('cache', 'cache_path'); //path to cache dir $cachecount = IniParser::getSettring('cache', 'cachecount'); //count copy of cache include_once ENGINE_PATH . 'class/classReCacher.php'; $cacher = new ReCacher($localPath, $cachePath, $cachecount); $cacher->setLogMode(2); $cacher->_rebuildAllCache(); unset($cacher); } include_once LOCAL_PATH . 'application/final.inc.php'; }
public function prepareData() { $index = -1; $blocks2pagesId = 0; foreach ($this->blocksData as $row) { // Проверяем новый ли блок, если новый то инкерементим индекс if ($blocks2pagesId != $row['bp_id']) { $blocks2pagesId = $row['bp_id']; $index++; } // Проходим по массиву и ищем в нём дочерние блоки по отношинию к // текущему блоку, если есть таковой то добовляем их имена файлов // в данные текущего блока foreach ($this->blocksData as $tmpRow) { if ($row['bp_id'] == $tmpRow['bp_parent']) { $this->blocks[$index]['files_to_include'][$tmpRow['bp_id']] = $tmpRow['b_file']; } } if ($row['bd_hidden'] != 1) { // Инициализация смартевских переменных switch ($row['bf_type']) { case 'S': // String $this->blocks[$index][$row['bf_name']] = $row['bd_value']; break; case 'A': // Array // Array case 'I': // Image // Image case 'W': // Flash if (strlen($row['bd_value'])) { $this->blocks[$index][$row['bf_name']] = unserialize($row['bd_value']); } break; case 'G': // Gloabal Extension $row['bd_value'] = trim($row['bd_value']); $funcData = array(); if (strlen($row['bd_value'])) { $funcData = explode('|', $row['bd_value']); } $defData = explode('|', $row['bf_default']); $func = $defData[0]; $extName = $defData[1]; $args = array(); for ($i = 0; $i < count($funcData); $i++) { $argData = explode(':', $funcData[$i]); switch ($argData[0]) { case 'n': // variable Name $args[] = ${$argData}[1]; break; case 'v': // variable Value $args[] = $argData[1]; break; } } if (!VBox::isExist($extName)) { VBox::set($extName, new $extName()); } if (empty($args)) { $this->blocks[$index][$row['bf_name']] = VBox::get($extName)->{$func}(); } else { $this->blocks[$index][$row['bf_name']] = VBox::get($extName)->{$func}($args); } VBox::clear($extName); break; case 'E': // Extension if (isset($this->extensions[$row['bf_name']])) { $extName = $row['bf_name']; $row['bd_value'] = trim($row['bd_value']); if (!empty($row['bd_value'])) { $funcData = explode('|', $row['bd_value']); $args = array(); for ($i = 0; $i < count($funcData); $i++) { $argData = explode(':', $funcData[$i]); switch ($argData[0]) { case 'n': // variable Name $args[] = ${$argData}[1]; break; case 'v': // variable Value $args[] = $argData[1]; break; } } } //if(!VBox::isExist($extName)) { if (empty($args)) { VBox::set($extName, new $extName()); } else { VBox::set($extName, new $extName($args)); } //} $this->blocks[$index][$row['bf_name']] = VBox::get($extName)->getResult(); VBox::clear($extName); } break; case 'J': // Json Array if (strlen($row['bd_value'])) { $this->blocks[$index][$row['bf_name']] = json_encode(unserialize($row['bd_value'])); } break; case 'L': // select if (strlen($row['bd_value'])) { /* italiano 13.02.2015 */ $val = unserialize($row['bd_value']); if (is_array($val) && count($val) == 1) { $this->blocks[$index][$row['bf_name']] = key($val); $this->blocks[$index][$row['bf_name'] . '_val'] = current($val); } else { $this->blocks[$index][$row['bf_name']] = $val; } /* end */ } break; } /* italiano, 04.03.2015 */ if (defined('WWW2') && WWW2) { $this->blocks[$index]['edit_params']['block'] = $row['b_name']; $this->blocks[$index]['edit_params']['file'] = $row['b_file']; if (isset($row['bf_type']) && !empty($row['bf_type'])) { if ($row['bf_type'] == "L" || $row['bf_type'] == "I" || $row['bf_type'] == "A" || $row['bf_type'] == "W") { $value = array(); $value = unserialize($row['bd_value']); } else { $value = ''; $value = $row['bd_value']; } $this->blocks[$index]['edit_params']['fields'][] = array('type' => $row['bf_type'], 'id' => $row['bd_id'], 'name' => $row['bf_name'], 'fsid' => $row['bd_bp_id'], 'value' => $value, 'default' => $row['bf_default']); } } /* [end]*/ } // if hidden field } $this->prepared = TRUE; }
private function printWWWSection($dontCheckHidden = false) { /***********************************/ include_once ENGINE_PATH . 'class/classPage.php'; include_once ENGINE_PATH . 'class/classPageReCacher.php'; /***********************************/ if ($this->pageId == $this->constData->getConst('loginPage')) { header('HTTP/1.1 403 Forbidden'); return; } if ($this->isCacher) { $page = new PageReCacher($this->pageId); } else { $page = new Page($this->pageId); } VBox::set('Page', $page); // if page is hidden // if(!$dontCheckHidden && $page->checkHidden() && substr_count($_SERVER['HTTP_REFERER'],$page->address['base_address'])==0) { if (!$dontCheckHidden && $page->checkHidden()) { //if (isset($_GET['t'])) { echo $_GET['t'].' test '.$this->pageId; die(); } if ($this->checkInGreenList()) { return TRUE; } header('HTTP/1.1 302 Found'); header('Location: ' . $page->address['base_address']); return; } /***********************************/ include_once ENGINE_PATH . 'class/classBlocksData.php'; include_once ENGINE_PATH . 'class/classRealPageHandler.php'; include_once LIB_PATH . 'Smarty/Smarty.class.php'; /***********************************/ //proceed uncached version code $pageHandler = new RealPageHandler(); $pageHandler->printPage(); }
if (!substr_count($_SERVER['HTTP_HOST'], 'www2.') && count($_REQUEST) <= 1) { $uri_address = $_SERVER['DOCUMENT_ROOT'] . '/cache/cache/' . $request; if (!substr_count($uri_address, '.html')) { $cache_uri_address = $uri_address . (substr($uri_address, -1) != '/' ? '/' : '') . 'index.html'; } else { $cache_uri_address = $uri_address; } if ($content = file_get_contents($cache_uri_address, FALSE)) { echo $content; exit; } } include_once 'application/includes.inc.php'; include_once ENGINE_PATH . 'class/classURIHandler.php'; $constData = new ConstData(); VBox::set('ConstData', $constData); //var_dump($request); if ($request != null) { // different checks for bad urs. unfortunately, there are so many of them .pics //$badFiles = array('.jpg','.gif','.ico','.png','.bmp','.php','.php3','.asp','.aspx'); $badFiles = array('.gif', '.ico', '.bmp', '.php', '.php3', '.asp', '.aspx'); if (in_array(strrchr($request, '.'), $badFiles)) { header('HTTP/1.1 404 Not Found'); //header('Location: http://'.$_SERVER['HTTP_HOST'].'/'.$matched[1].'.html'); // include_once(LOCAL_PATH.$constData->getConst('404page')); $uri_address = $_SERVER['DOCUMENT_ROOT'] . '/cache/cache/404.html'; echo file_get_contents($uri_address, FALSE); include_once LOCAL_PATH . 'application/final.inc.php'; exit; } // .htm pages are not acceptable