Exemple #1
0
 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;
 }
Exemple #2
0
 public function __construct($sessionName = '', $fingerHead = '')
 {
     $this->_consts = VBox::get('ConstData');
     $this->_storage = new VSession($sessionName, $fingerHead);
     $this->isValid = $this->_storage->isValid();
     //$this->prepData = FALSE;
 }
Exemple #3
0
 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;
     }
 }
Exemple #4
0
 public function __construct()
 {
     if (VBox::isExist('ConstData')) {
         $this->dbName = VBox::get('ConstData')->getConst('langsDb') . '.';
     } else {
         /* Exception */
     }
 }
Exemple #5
0
 public function __construct()
 {
     if (VBox::isExist('Page')) {
         $page = VBox::get('Page');
         $this->PageId = $page->getPageId();
     } else {
         $this->PageId = 0;
     }
 }
Exemple #6
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;
     }
 }
Exemple #7
0
 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', '');
 }
Exemple #8
0
 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;
 }
Exemple #9
0
 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;
         }
     }
 }
Exemple #10
0
 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;
 }
Exemple #11
0
 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;
     }
 }
Exemple #12
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.');
     }
 }
Exemple #14
0
 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;
 }
Exemple #16
0
 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&amp;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);
             }
         }
     }
 }
Exemple #17
0
 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();
 }
Exemple #18
0
  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'];
          }
      }
  }
Exemple #19
0
 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;
 }
Exemple #20
0
 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;
 }
Exemple #21
0
 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;
 }
Exemple #22
0
 public function getPage($pageId)
 {
     VBox::set('ConstData', new ConstData($this->siteDbName));
     return new AdminPage($pageId, $this->siteDbName);
 }
Exemple #23
0
 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;
                     }
                 }
             }
         }
     }
 }
Exemple #24
0
 function xmas2011_bundle_link($args)
 {
     include_once ENGINE_PATH . 'class/classPurchase.php';
     $purchase = new Purchase();
     $page = VBox::get('Page');
     $pageLanguage = $page->language;
     $url = "&amp;currency=usd&amp;language=" . $pageLanguage . "&amp;enablecoupon=false&amp;x-tracking=xmas2011_bundle&amp;cart=";
     $formatPrice = "&amp;minquantity_%1\$d=1&amp;maxquantity_%1\$d=1&amp;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&amp;x-trackinga=1', false);
     return $cbUrl;
 }
 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;
 }
Exemple #26
0
$vbox = new VBox();
$vbox->PackStart($comboimage);
$vbox->PackEnd($entry);
$vbox->PackStart($check);
$hbox = new HBox();
$hbox->PackStart($button);
$hbox->PackStart($radio);
$hbox->PackEnd($vbox);
//$hbox->Show ();
$toolbar = new Toolbar();
$toolbar->Add($button);
$toolbar->Add($entry);
$toolbar->Add($comboimage);
$toolbar->Add($spin);
$toolbar->SetStyle("background-color: #331");
$editor = new VBox();
$editor->PackStart($toolbar);
$editor->PackStart($textarea);
$viewport = new ViewPort("viewport", 600, 180);
$viewport->Add($editor);
//$viewport->Show ();
$menu = new MenuBar();
$menu->Add("Archivo");
$menu->Add("Archivo/Abrir");
$menu->Add("Archivo/Cerrar");
$menu->Add("Archivo/Guardar");
$menu->Add("Archivo/Guardar/Guardar como archivo");
$menu->Add("Archivo/Guardar/Guardar como PDF");
$menu->Add("Editar");
$menu->Add("Editar/Copiar");
$menu->Add("Editar/Cortar");
Exemple #27
0
 /**
  * @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 '';
 }
Exemple #28
0
 protected static function init()
 {
     self::$box = new self();
 }
Exemple #29
0
<?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';
}
Exemple #30
0
 public function __construct()
 {
     DB::_set_table_name(VBox::get('ConstData')->getConst('langsDb') . '.' . $this->table_name);
 }