示例#1
0
 public function callcheckLocale()
 {
     $result = 0;
     if (isset($_POST['pg_id'])) {
         $pg_id = $_POST['pg_id'];
     } else {
         return $result;
     }
     include_once ENGINE_PATH . 'class/classGeoip.php';
     include_once ENGINE_PATH . 'class/classPage.php';
     $page = new Page($pg_id);
     $geo = new Geo();
     $currenLocale = $geo->getCode();
     $pageLang = $page->language;
     //	var_dump($currenLocale, $pageLang);
     if ($currenLocale != $pageLang) {
         $geotext = $page->getLocalizedString('geotext', $currenLocale);
         $relpages = $page->getRelativePageAddresses();
         //var_dump($relpages);
         if (isset($relpages[$currenLocale])) {
             $result = "<a href='" . $relpages[$currenLocale] . "'>" . $geotext . "</a>";
         }
     }
     echo $result;
 }
示例#2
0
 public function __construct($productId)
 {
     if (!empty($productId[0])) {
         $this->productId = intval($productId[0]);
     }
     if (1 > $this->productId) {
         return;
     }
     $this->purchase = new Purchase();
     if ($this->purchase->init($this->productId)) {
         if (isset($_POST['process'])) {
             $this->postValid = $this->validatePost();
         } else {
             $cur = "USD";
             $geo = new Geo();
             $code = $geo->getCode();
             if (!empty($code)) {
                 $cur = $this->purchase->detectCurrency($code);
             }
             if (isset($productId[1])) {
                 $cur = $productId[1];
             }
             //	if(isset($_COOKIE['currency']) && $_COOKIE['currency']!='null' && $cur!=='RUB')
             //	    $cur = $_COOKIE['currency'];
             if (isset($_GET['cur'])) {
                 $cur = $_GET['cur'];
             }
             $this->licenseData = $this->purchase->processLicenseData();
             $this->licenseData['geo_currency'] = $cur;
             $this->licenseData['currencies'] = $this->purchase->returnCurrency();
             if (isset($_COOKIE['operatorid'])) {
                 $this->licenseData['operator_id'] = $_COOKIE['operatorid'];
             }
             if (isset($_GET['operator'])) {
                 $this->licenseData['operator_id'] = $_GET['operator'];
             }
             if (isset($productId[2])) {
                 $this->licenseData['operator_id'] = $productId[2];
             }
         }
     }
 }