public function __construct($sessionName = '', $fingerHead = '') { $this->_consts = VBox::get('ConstData'); $this->_storage = new VSession($sessionName, $fingerHead); $this->isValid = $this->_storage->isValid(); //$this->prepData = FALSE; }
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($pageId = NULL) { if ($access = IniParser::getInstance()->getSection('access')) { if (isset($access['ip'])) { $ips = explode(',', $access['ip']); if (in_array(self::getIp(), $ips)) { if (!defined('WWW2')) { define('WWW2', true); } } } } $this->isCacher = FALSE; if (isset($pageId)) { $this->pageId = $pageId; $this->isCacher = TRUE; } else { @($this->requestURI = '/' . $_GET['request']); } if (!VBox::isExist('ConstData')) { $this->constData = VBox::get('ConstData'); } else { $this->constData = new ConstData(); VBox::set('ConstData', $this->constData); } /* italiano, 14.01.2015 if(!VBox::isExist('Event')) { VBox::set('Event', new Event()); } /* end */ }
public function getComments($args = null) { $db = VBox::get('ConstData')->getConst('langsDb'); if (isset($args[0]) && strpos($args[0], ',') !== false) { $where = " AND c.comment_product_id IN({$args[0]}) "; } elseif (isset($args[0]) && $args[0] > 0) { $where = " AND c.comment_product_id = '{$args[0]}' "; } elseif (isset($args[1]) && strpos($args[1], ',') !== false) { $where = " AND c.comment_id IN({$args[1]}) "; } elseif (isset($args[1]) && $args[1] > 0) { $where = " AND c.comment_id = '{$args[1]}' "; } else { $where = ''; } $q = "SELECT * FROM {$db}.comments AS c WHERE c.comment_hidden = '0'{$where} ORDER BY comment_order"; DB::executeQuery($q, 'comments'); $rows = DB::fetchResults('comments'); $comments = $pages = array(); foreach ($rows as $row) { $pages = explode(',', $row['comment_pages']); if (in_array($this->pageUrl, $pages) && isset($this->pageUrl)) { $comments[] = $row; } } return $comments; }
public function __construct() { if (VBox::isExist('ConstData')) { $this->dbName = VBox::get('ConstData')->getConst('langsDb') . '.'; } else { /* Exception */ } }
public function __construct() { $this->debug = isset($_GET['t']); $this->locale = isset($_GET['locale']) ? $_GET['locale'] : $_GET['locale']; if (VBox::isExist('purchase_account')) { $this->accaunt = VBox::get('purchase_account'); } }
public function __construct() { if (VBox::isExist('Page')) { $page = VBox::get('Page'); $this->PageId = $page->getPageId(); } else { $this->PageId = 0; } }
public function __construct() { if (VBox::isExist('Page')) { $this->languageId = VBox::get('Page')->languageId; $this->PageId = VBox::get('Page')->getPageId(); } else { $this->languageId = 1; $this->PageId = 1; } }
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 getNews($desc = "") { $db = VBox::get('ConstData')->getConst('langsDb'); $q = 'SELECT news_text, news_title FROM ' . $db . '.news_' . $this->mLanguage . ' ORDER BY news_order ' . $desc; DB::executeQuery($q, 'newsList'); $rows = DB::fetchResults('newsList'); $newsList = array(); foreach ($rows as $row) { $newsList[] = $row; } return $newsList; }
public function __construct() { $page = VBox::get('Page'); $pageAddress = $page->address['uri_address']; $pageLanguage = $page->language; $addressPrefix = $pageLanguage != 'en' ? '/' . $pageLanguage : ''; $this->formData = array(array('name' => $page->getLocalizedString('features'), 'address' => '/pc-inventory.html', 'title' => $page->getLocalizedString('features_title')), array('name' => $page->getLocalizedString('download'), 'address' => '/download.html', 'title' => $page->getLocalizedString('download_title'), 'attr' => 'class="download"'), array('name' => $page->getLocalizedString('pricing'), 'address' => '/pricing.html', 'title' => $page->getLocalizedString('pricing_title')), array('name' => $page->getLocalizedString('help'), 'address' => 'help.html', 'title' => $page->getLocalizedString('Help_title')), array('name' => $page->getLocalizedString('contacts'), 'address' => '/contacts.html', 'title' => $page->getLocalizedString('contacts_title')), array('name' => $page->getLocalizedString('Blog'), 'address' => 'http://blog.clearapps.com', 'title' => $page->getLocalizedString('Blog_title'))); for ($i = 0; $i < count($this->formData); $i++) { if ($pageAddress == $this->formData[$i]['address']) { $this->formData[$i]['selected'] = TRUE; } else { $this->formData[$i]['selected'] = FALSE; } } }
public function __construct() { if (VBox::isExist('Page')) { $this->page = VBox::get('Page'); $this->mLanguage = $this->page->language; if (isset($this->page->address['prefix'])) { $this->mAddressPrefix = $this->page->address['prefix']; } else { $this->mAddressPrefix = ''; } $this->mPageAddress = $this->page->address['uri_address']; $this->PageId = $this->page->getPageId(); } else { $this->mLanguage = 'en'; $this->mAddressPrefix = ''; $this->PageId = 0; } }
public function __construct($_key = null) { if (!VBox::isExist('Page') && isset($_POST['page_id'])) { include_once ENGINE_PATH . 'class/classPage.php'; $page = new Page($_POST['page_id']); $this->lstrings = $page->getLocalStrings(); } $this->db = VBox::get('ConstData')->getConst('langsDb'); /* //#1 for NameApi API $array_keys = array( '0b38c46364a919ef3ba2887081286c82-user1', //italiano 'bda2473939f5755ff0fbeabdbc033946-user1', //garbagecat76 'a950795667d63b9e3d37bcd31f7657b1-user1', //Andrew / andrewtest@rambler.ru / 5w25j3x8 'f8284e714c1539a8ebb06ddbb6409ffd-user1', //Svaran ); shuffle($array_keys); $this->key = $array_keys[0]; if(isset($_key)){ $this->key = $_key; } $context = Context::builder() ->apiKey($this->key) ->priority(Priority::REALTIME()) //->textCase(TextCase::TITLE_CASE()) ->build(); if (!isset(self::$service)) { self::$service = new Services\ServiceFactory($context); } // ping API service $pinger = self::$service->systemServices()->pinger(); $this->connected = $pinger->ping(); //#1 end */ }
public function __construct() { $this->page = VBox::get('Page'); $this->prepared = FALSE; $uri_address = $this->page->address['uri_address']; if (!substr_count($uri_address, '.html')) { $dirname = LOCAL_PATH . 'cache/cache' . $uri_address . (substr($uri_address, -1) != '/' ? '/' : ''); $filename = 'index'; $extension = '.html'; } else { $dirname = LOCAL_PATH . 'cache/cache' . (substr($uri_address, 0, 1) != '/' ? '/' : '') . $uri_address; $filename = ''; $extension = ''; } $this->cache_uri_address = $dirname . $filename . $extension; // if(!file_exists(LOCAL_PATH.'cache/'.$this->page->getPageId())) { if (file_exists($this->cache_uri_address)) { $this->prepared = true; } else { Error::logError('CachedPageHandler - No cache', 'The cache file "' . $this->cache_uri_address . '" is missing.'); } }
public function getCode() { $q = "SELECT COUNTRY_CODE2, COUNTRY_NAME FROM " . VBox::get('ConstData')->getConst('langsDb') . ".countries WHERE IP_FROM<=inet_aton('" . $this->IP . "') AND IP_TO>=inet_aton('" . $this->IP . "')"; DB::executeQuery($q, 'geo'); $rows = DB::fetchRow('geo'); if (count($rows) == 0) { return 'en'; } $user_country = $rows['COUNTRY_CODE2']; $user_lng = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $needed_locale = 'en'; foreach ($this->available_locales as $lang => $toplng) { if (in_array($user_country, $toplng)) { $needed_locale = $lang; break; } else { if (in_array($user_lng, $toplng)) { $needed_locale = $lang; } } } return strtolower($needed_locale); }
protected function parseAddress($uri) { $addr = array(); // $addr['domain_address'] = $addr['base_address'] = 'http://'.$_SERVER['HTTP_HOST']; $addr['domain_address'] = $addr['base_address'] = 'http://' . VBox::get('ConstData')->getConst('cachedDomain'); $addr['lang_prefix'] = $addr['prefix'] = $this->alLangs[$this->language]['prefix']; if (strlen($addr['lang_prefix'])) { $addr['base_address'] .= '/' . $addr['lang_prefix']; $addr['prefix'] = '/' . $addr['prefix']; } if (substr($uri, 0, 1) != '/') { $uri = '/' . $uri; } $addr['uri_address'] = $uri; $addr['full_address'] = $addr['base_address'] . $addr['uri_address']; $addr['params'] = array(); if (!substr_count($uri, '.html')) { if (strlen(trim($addr['uri_address'], '/')) != strlen(trim(VBox::get('ConstData')->getConst('request'), '/'))) { $params = substr(trim(VBox::get('ConstData')->getConst('request'), '/'), strlen(trim($addr['uri_address'], '/'))); $addr['params'] = explode('/', $params); } } return $addr; }
/** * @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 ''; }
private function sendForm($ini, $subject = null) { if (!substr_count($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) { return false; } $form = new Form(); if ($form->ParseSettings($ini)) { $this->formData = $form->BuildFormFields($_POST); if (empty($this->formData['error'])) { if (isset($_POST['emails'])) { if ($mSettings = $form->getmSettings()) { foreach ($mSettings as $key => $val) { if (1 == substr_count($key, 'mail')) { $form->delmSettings($key); } } } $form->setmSettings(array('emails' => $_POST['emails'])); } $subject = isset($subject) ? $subject : 'Request'; if (!empty($_POST['product']) && is_numeric($_POST['product'])) { $products = new Products(); $product = $products->getProductById($_POST['product']); $subject .= ' [' . $product['p_title'] . ']'; } elseif (!empty($_POST['product']) && is_string($_POST['product'])) { $subject .= ' [' . $_POST['product'] . ']'; $product = null; } $subject = isset($_POST['subject']) ? $_POST['subject'] : $subject; $msg = $subject . ' from ' . $_SERVER['HTTP_REFERER'] . "\n\n" . (isset($product) ? 'Product: ' . $product['p_title'] . "\n" : '') . $form->__toString(); if (isset($this->formData['AttachFile'])) { $filePath = $this->formData['AttachFile']['filepath']; $fileName = $this->formData['AttachFile']['filename']; } else { $filePath = ''; $fileName = ''; } if (!empty($_POST['subscribe']) && !empty($_POST['email']) && !empty($_POST['product'])) { $table_name = 'discount_subscribe'; $name = isset($_POST['name']) ? $_POST['name'] : ''; $q = sprintf("INSERT IGNORE INTO %s.%s (email, product_id, name, date) values('%s',%d, '%s', '%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, $_POST['email'], $_POST['product'], $name, date('Y-m-d')); DB::executeAlter($q, 'reg'); } if (!empty($_POST['notify']) && !empty($_POST['email']) && !empty($_POST['product'])) { $table_name = 'notify_users'; $q = 'SELECT * FROM ' . VBox::get('ConstData')->getConst('langsDb') . '.' . $table_name . ' WHERE nu_product_id = ? AND nu_email = ? LIMIT 1'; if (!DB::executeQuery($q, 'selectNotifyUser', array($_POST['product'], trim($_POST['email'])))) { $q = sprintf("INSERT IGNORE INTO %s.%s (nu_email, nu_product_id, nu_name, nu_date) values('%s',%d, '%s', '%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, trim($_POST['email']), $_POST['product'], $_POST['name'], date('Y-m-d h:i:s', time())); DB::executeAlter($q, 'reg'); } } if (isset($_POST['mail_body'])) { $mail_body = nl2br($_POST['mail_body']); $reply_to = isset($_POST['reply_to']) ? $_POST['reply_to'] : '*****@*****.**'; include_once ENGINE_PATH . 'class/classEmailReporter.php'; $reporter = new EmailReporter(); $reporter->setBody($mail_body); $reporter->send($this->formData['fields']['email'], array($reply_to => 'NetSpot'), $subject); } if (!empty($_POST['notify_template_stat']) && !empty($_POST['email']) && !empty($_POST['alias'])) { $table_name = 'email_stat'; /* add information at stat table */ $q = sprintf("INSERT INTO %s.%s (es_email, es_product_id, es_date) values('%s','%s','%s')", VBox::get('ConstData')->getConst('langsDb'), $table_name, $_POST['email'], $_POST['alias'], date('Y-m-d h:i:s', time())); DB::executeAlter($q, 'notify_template_stat'); if (!empty($_POST['template'])) { $last_id = DB::getLastInsertId(); if ($last_id) { include_once ENGINE_PATH . 'class/classEmailReporter.php'; $reporter = new EmailReporter(); $_subject = isset($_POST['templateSubject']) ? $_POST['templateSubject'] : 'Thank you for subscription'; $args = array(); $args['email'] = $_POST['email']; $args['hash'] = hash_hmac('md5', $last_id . $_POST['email'], 'stat'); $args['id'] = $last_id; $args['random'] = rand(0, 10000) . chr(rand(65, 90)); if (isset($_POST['args'])) { $args = $_POST['args']; } $mail_body = $reporter->renderingTpl($_POST['template']); $reporter->setBody($mail_body, $args); $reply_to = isset($_POST['reply_to']) ? $_POST['reply_to'] : '*****@*****.**'; $reporter->send($this->formData['fields']['email'], array($reply_to => 'NetSpot Software'), $_subject); } } } if (!empty($_POST['mailchimp_u']) && !empty($_POST['mailchimp_id'])) { $mailchimp_post_url = 'http://netspotapp.us12.list-manage.com/subscribe/post'; //netspotapp.us12.list-manage.com/subscribe/post?u=49afa3dbcd460871845fac4b8&id=df296d03d7 $attributes = array('u' => $_POST['mailchimp_u'], 'id' => $_POST['mailchimp_id'], 'MERGE0' => $_POST['email'], 'MERGE1' => isset($_POST['name']) ? $_POST['name'] : '', 'MERGE2' => ''); $errno = $error = false; if ($curl = curl_init()) { curl_setopt($curl, CURLOPT_URL, $mailchimp_post_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($attributes)); $out = curl_exec($curl); $info = curl_getinfo($curl); $errno = curl_errno($curl); $tickets_hasError = curl_error($curl); curl_close($curl); // echo $out; // var_dump($info); // var_dump($errno); //var_dump($tickets_hasError); } } if (empty($_POST['not_send'])) { $fromEmail = empty($this->formData['fields']['email']) ? '*****@*****.**' : $this->formData['fields']['email']; $fromName = empty($this->formData['fields']['name']) ? $fromEmail : $this->formData['fields']['name']; $form->SendMail($subject, $msg, $fromName, $fromName . ' <' . $fromEmail . '>', $filePath, $fileName); } } } }
public function callValidatecoupon() { $percent = 0; if (!empty($_POST['licenses'])) { $lics = explode(',', trim($_POST['licenses'])); $dbName = VBox::get('ConstData')->getConst('langsDb') . '.'; $q = 'SELECT cup_percent, cup_validlic, cup_unvalidlic, cup_quantity FROM ' . $dbName . 'pa_coupons WHERE cup_code = ? AND cup_blocked = "N" AND cup_date >= NOW() LIMIT 1'; if (DB::executeQuery($q, 'coupon', array($_POST['coupon']))) { $row = DB::fetchRow('coupon'); $validLic = unserialize($row['cup_validlic']); $unvalidLic = unserialize($row['cup_unvalidlic']); //if($_POST[''] >= $row['cup_quantity']) if (sizeof($unvalidLic)) { $res = array_intersect($lics, $unvalidLic); if (0 == sizeof($res)) { $percent = $row['cup_percent']; } } else { $res = array_intersect($lics, $validLic); if (sizeof($res)) { $percent = $row['cup_percent']; } } } } return $percent; }
private function loadLocalStrings() { if (VBox::get('ConstData')->getConst('siteId') == 1115) { $q = "\n\t\t\t\tSELECT ln.ls_id,ln.ls_nick,ls.ls_text FROM `local_nicks` AS ln\n\t\t\t\tLEFT JOIN `local_strings` AS `ls` ON ln.ls_id = ls.ls_id\n\t\t\t\tWHERE ls.ls_lang = ? "; DB::executeQuery($q, 'lstrings', array($this->languageId)); $rows = DB::fetchResults('lstrings'); $this->lStrings = array(); foreach ($rows as $row) { $this->lStrings[$row['ls_nick']] = $row['ls_text']; } } else { /* $q = 'SELECT ls_nick, ll_text FROM '.VBox::get('ConstData')->getConst('langsDb').'.lstrings AS ls LEFT JOIN '.VBox::get('ConstData')->getConst('langsDb').'.'.$this->language.' AS enls ON enls.ll_nick_id = ls.ls_id WHERE ls_site = ?';*/ $q = 'SELECT ls_nick, ll_text FROM lstrings AS ls LEFT JOIN ' . $this->language . ' AS enls ON enls.ll_nick_id = ls.ls_id'; // WHERE ls_site = ?'; // DB::executeQuery($q, 'lstrings', array(VBox::get('ConstData')->getConst('siteId'))); DB::executeQuery($q, 'lstrings'); $rows = DB::fetchResults('lstrings'); $this->lStrings = array(); foreach ($rows as $row) { $this->lStrings[$row['ls_nick']] = $row['ll_text']; } } }
function xmas2011_bundle_link($args) { include_once ENGINE_PATH . 'class/classPurchase.php'; $purchase = new Purchase(); $page = VBox::get('Page'); $pageLanguage = $page->language; $url = "&currency=usd&language=" . $pageLanguage . "&enablecoupon=false&x-tracking=xmas2011_bundle&cart="; $formatPrice = "&minquantity_%1\$d=1&maxquantity_%1\$d=1&dp_%1\$d=__PRICE:%2\$0.2f:%3\$s;N__CHECKSUM:%4\$s"; $count = sizeof($args); for ($i = 0; $i < $count; $i = $i + 3) { $url .= $args[$i] . ','; $price .= sprintf($formatPrice, $args[$i], $args[$i + 1], $args[$i + 2], md5('__PRICE:' . $args[$i + 1] . ';N#' . $purchase->CBPass)); } $url = substr($url, 0, -1) . $price; $cbUrl = $purchase->makeCBSecureLink($url, 'design052011a&x-trackinga=1', false); return $cbUrl; }
public function edit() { $host = self::getXadmin(); if (VBox::isExist('ClientScript')) { if (!in_array('jquery.js', $this->page_js)) { VBox::get('ClientScript')->registerScriptFile($args = array('url' => "//{$host}/js/jquery.js")); } VBox::get('ClientScript')->registerScriptFile($args = array('url' => "//{$host}/js/adminSection.js")); VBox::get('ClientScript')->registerCssFile($args = array('url' => "//{$host}/styles/adminSection.css")); VBox::get('ClientScript')->getScriptFiles(); VBox::get('ClientScript')->getCssFiles(); } echo '<div id="adminPanel" class="hidden-xs"><a class="admin-btn-close" href="#">Admin panel </a><div class="inner" style="display:none;">'; echo "<h4><a class=\"link\" href=\"http://" . $host . "/pages/editpage/site/{$this->site_id}/page/{$this->page_id}/\" target=\"_blank\"><strong>Click for edit page</strong></a></h4>"; echo "<h3>Site / Page info</h3>"; echo "<ul class=\"items\">"; echo "<li><b>Site ID / Page ID:</b> {$this->site_id} / {$this->page_id}</li>"; echo "<li><b>Cached domain:</b> " . VBox::get('ConstData')->getConst('cachedDomain') . "</li>"; echo "<li><b>Real domain:</b> " . VBox::get('ConstData')->getConst('realDomain') . "</li>"; echo "<li><b>Use js/css min:</b> " . ((bool) VBox::get('ConstData')->getConst('use_min') ? 'true' : 'false') . "</li>"; echo "</ul>"; echo "<h3>Functions</h3>"; echo "<ul class=\"items\">"; echo "<li>- <a data-type=\"console\" class=\"toggle\" href=\"#\"><span>show</span> consoles</a> <span class=\"count\"></span></li>"; echo "<li>- <a data-type=\"ext\" class=\"toggle\" href=\"#\"><span>show</span> extensions</a></li>"; echo "<li>- <a data-type=\"lstring\" class=\"toggle\" href=\"#\"><span>show</span> lstrings</a></li>"; echo "<li>- <a data-type=\"image\" class=\"toggle\" href=\"#\"><span>show</span> images</a></li>"; echo "<li>- <a data-type=\"link\" class=\"toggle\" href=\"#\"><span>show</span> links</a></li>"; echo "<li>- <a data-type=\"variable\" class=\"toggle\" href=\"#\"><span>show</span> \$vars.variables</a></li>"; echo "<li>- <a data-type=\"js\" class=\"toggle\" href=\"#\"><span>show</span> *.js files</a></li>"; echo "<li>- <a data-type=\"css\" class=\"toggle\" href=\"#\"><span>show</span> *.css files</a></li>"; echo "<h3>Select site for edit</h3>"; echo '<form method="get" action="//' . $host . '/pages/setsite/" target="_blank"><select name="site_id" onchange="this.form.submit()">'; foreach ($this->sites as $site) { if ($this->site_id === $site['s_id']) { $selected = " selected=\"selected\""; } else { $selected = ""; } echo '<option value="' . $site['s_id'] . '"' . $selected . '>' . $site['s_hostname'] . '</option>'; } echo "</select></form>"; echo '</div><div style="clear: both;"></div></div>'; }
protected function prepareForCB($operators2Currencies) { //oas($operators2Currencies); //oas( md5('__PRICE:29.93:USD;N#kt528ao4VC') ); foreach ($this->productArray['prices'] as $licenseId => $license) { //oas($license); if (isset($license[5]['contractIds'])) { foreach ($license[5]['contractIds'] as $currencyId => $contractId) { foreach ($this->productArray['prices'][$licenseId] as $currencyCode => $price) { if ((isset($operators2Currencies[5]) && in_array($currencyCode, $operators2Currencies[5]) || $this->productArray['operator_id'] == 5 || isset($this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')]) && $this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')] == 2) && ($currencyCode != 'contractIds' && $currencyCode != 'cbpasswords' && $currencyCode != 'packs')) { $this->productArray['prices'][$licenseId]['cbpasswords'][$contractId][$currencyCode] = md5('__PRICE:' . $price['price'] . ':' . $currencyCode . ';N#' . Purchase::CBPass); //echo ($contractId.'#'.$price['price'].$currencyCode.',N#'.Purchase::element5Pass)."<br>"; } } if (isset($this->productArray['prices'][$licenseId]['packs'])) { foreach ($this->productArray['prices'][$licenseId]['packs'] as $packId => $pack) { foreach ($pack as $currencyCode => $price) { if ((isset($operators2Currencies[5]) && in_array($currencyCode, $operators2Currencies[5]) || $this->productArray['operator_id'] == 5 || isset($this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')]) && $this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')] == 2) && ($currencyCode != 'min_usernumber' && $currencyCode != 'usernumber' && $currencyCode != 'cbpasswords')) { $this->productArray['prices'][$licenseId]['packs'][$packId]['cbpasswords'][$contractId][$currencyCode] = md5('__PRICE:' . $price . ':' . $currencyCode . ';N#' . Purchase::CBPass); //echo ($contractId.'#'.$price.$currencyCode.',N#'.Purchase::element5Pass)."<br>"; } } } } } } } if (isset($this->productArray['bundle_prices'])) { foreach ($this->productArray['bundle_prices'] as $bundleId => $bundle) { if (isset($bundle[5]['contractIds'])) { foreach ($bundle[5]['contractIds'] as $currencyId => $contractId) { foreach ($this->productArray['bundle_prices'][$bundleId] as $currencyCode => $price) { if ((isset($operators2Currencies[5]) && in_array($currencyCode, $operators2Currencies[5]) || $this->productArray['operator_id'] == 5 || isset($this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')]) && $this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')] == 2) && ($currencyCode != 'contractIds' && $currencyCode != 'cbpasswords')) { $this->productArray['bundle_prices'][$bundleId]['cbpasswords'][$contractId][$currencyCode] = md5('__PRICE:' . $price['price'] . ':' . $currencyCode . ';N#' . Purchase::CBPass); // echo ($contractId.'#'.$price['price'].$currencyCode.',N#'.Purchase::element5Pass)."<br>"; } } } } } } if (isset($this->productArray['offer_prices'])) { foreach ($this->productArray['offer_prices'] as $offerId => $offer) { if (empty($offer['price_percent'])) { foreach ($offer as $currencyCode => $price) { if ((isset($operators2Currencies[5]) && in_array($currencyCode, $operators2Currencies[5]) || $this->productArray['operator_id'] == 5 || isset($this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')]) && $this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')] == 2) && ($currencyCode != 'contract_id' && $currencyCode != 'cbpasswords' && $currencyCode != 'price_percent')) { $offerContractId = $offer[2][$currencyCode]; if ($offerContractId != NULL) { $contractHash = md5('__PRICE:' . $price . ':' . $currencyCode . ';N#' . Purchase::CBPass); } else { $contractHash = md5('__PRICE:' . $price . ':' . $currencyCode . ';N#' . Purchase::CBPass); } $this->productArray['offer_prices'][$offerId]['cbpasswords'][$currencyCode] = $contractHash; } } } } } }
<?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'; }
private function getSites($id = null) { if (isset($id)) { $where = " WHERE s_id={$id} "; } else { $where = ""; } $q = 'SELECT * FROM ' . VBox::get('ConstData')->getConst('adminDb') . '.sites AS s ' . $where . ' ORDER BY s_hostname'; DB::executeQuery($q, 'sites'); $result = DB::fetchResults('sites'); if (!empty($result)) { return $result; } return false; }
public function SendMail($email_subject, $email_message, $fromName = '', $email_from = NULL, $fileatt = NULL, $fileatt_name = NULL) { $email_to = ''; $email_from = $email_from ? $email_from : 'norepeat@' . $_SERVER['HTTP_HOST']; foreach ($this->mSettings as $key => $val) { if (1 == substr_count($key, 'mail')) { $email_to .= $val . ','; } } if (!empty($email_to)) { $email_to = trim($email_to, ','); } else { return FALSE; } $headers = "From: " . $email_from; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . str_replace("\n", "<br>", $email_message) . "\n\n"; /* FILE */ $ok = false; if ($fileatt != '') { $fileatt_type = "application/octet-stream"; // File Type $file = fopen($fileatt, 'rb'); $data = fread($file, filesize($fileatt)); $data = chunk_split(base64_encode($data)); fclose($file); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if ($ok == true) { unlink($fileatt); } unset($data, $file, $fileatt, $fileatt_type, $fileatt_name); } if ($ok == false) { @mail($email_to, $email_subject, $email_message, $headers); if ((bool) IniParser::getInstance()->getSettring('mail', 'toMail')) { $adminMail = IniParser::getInstance()->getSettring('mail', 'adminMail'); $subjectMail = IniParser::getInstance()->getSettring('mail', 'subjectMail'); @mail($adminMail, $email_subject . ($subjectMail ? $subjectMail : ''), $email_message, $headers); } /* Äîáîâëÿåì ïèñüìî â àðõèâ */ $q = 'INSERT INTO ' . VBox::get('ConstData')->getConst('langsDb') . '.email_archive SET ea_email_to = ?, ea_email_from = ?, ea_subject = ?, ea_message = ?'; DB::executeAlter($q, array($email_to, $email_from, $email_subject, $email_message)); } return TRUE; }
public function __construct() { DB::_set_table_name(VBox::get('ConstData')->getConst('langsDb') . '.' . $this->table_name); }
// Очистим таблицу case2page $q = "TRUNCATE TABLE case2page"; DB::executeAlter($q); // Выбираем все уникальные значения языков страниц $q = "select distinct pg_lang from pages where pg_hidden = ?"; DB::executeQuery($q, 'langs_data', array(0)); $langs_data = DB::fetchResults('langs_data'); //Запрос для выборки активных страниц для данного языка $q_page = "select pg_id from pages where pg_hidden = ? and pg_lang = ? and pg_id <>?"; //Запрос для выборки активных case для данного языка $q_case = "select cs_id from " . VBox::get('ConstData')->getConst('langsDb') . ".case_study where cs_hidden = ? and cs_lang_id = ?"; $q_res = ""; // Делаем цикл по языкам foreach ($langs_data as $lang) { // Выбираем все активные страницы для данного языка DB::executeQuery($q_page, 'pages_data_' . $lang['pg_lang'], array(0, $lang['pg_lang'], VBox::get('ConstData')->getConst('loginPage'))); $pages_data = DB::fetchResults('pages_data_' . $lang['pg_lang']); // Выбираем все активные case для данного языка DB::executeQuery($q_case, 'case_data_' . $lang['pg_lang'], array(0, $lang['pg_lang'])); $cases_data = DB::fetchResults('case_data_' . $lang['pg_lang']); // Определим колво елементов case $count_case = sizeof($cases_data); $cases = array(); foreach ($cases_data as $case) { array_push($cases, $case['cs_id']); } //Перемешиваем массив случайным образом shuffle($cases); //Счетчик цикла $j = 0; //Делаем цикл по кол-ву case на каждой странице
public function getProductByFile($file = null, $callback = true) { if (isset($file)) { $rows = array(); $q = 'SELECT p_id, p_title, p_version, p_faq_link, p_wiki_link, p_download, p_downloads FROM ' . VBox::get('ConstData')->getConst('langsDb') . '.products WHERE p_download LIKE \'%' . $file . '%\' LIMIT 1'; DB::executeQuery($q, 'prods'); $rows = DB::fetchRow('prods'); if ($rows) { if ($callback) { return $rows; } return true; } } return false; }
public static function getPartialAddress($address) { $urlStyle = VBox::get('ConstData')->getConst('addrType'); if ($urlStyle == 'searchfriendly') { $address = str_replace('.html', '', $address); } if ($urlStyle == 'oldschool' && VBox::get('ConstData')->getConst('trailingSlash')) { if (substr($address, strlen($address) - 1, 1) != '/') { if ($id = self::getPageIdByAddress($address . '/')) { return $id; } } } $addrMaxLength = VBox::get('ConstData')->getConst('addrMaxLength'); $address = explode('/', trim($address, '/')); $_address = ''; for ($i = $addrMaxLength; $i > 0; $i--) { if (empty($address[$i])) { continue; } $_address = '/' . implode('/', array_slice($address, 0, $i)); if ($urlStyle == 'searchfriendly') { $_address .= '.html'; } if ($urlStyle == 'oldschool' && VBox::get('ConstData')->getConst('trailingSlash')) { $_address .= '/'; } if ($id = self::getPageIdByAddress($_address)) { if (substr($address, strlen($address) - 1, 1) != '/') { if ($id = self::getPageIdByAddress($_address)) { if ($_address == '/uninstall/' || $_address == '/buynow/') { return $id; } else { header('HTTP/1.1 301 Found'); header('Location: ' . $_address); return $id; } } else { return FALSE; } } header('HTTP/1.1 301 Found'); header('Location: ' . $_address); } } return FALSE; }