Exemple #1
0
 /** 
  * preform an AB test
  * 
  * @depends testAddTest
  */
 public function testRunTest()
 {
     ABTest::control();
     // output would go here
     ABTest::test($this->testName);
     // output would go here
     ABTest::done();
 }
Exemple #2
0
 /**
  * ends the current test and captures the output from the test, storing it with the test name
  *
  * @return void
  * @author Craig Ulliott
  */
 private static function endTest()
 {
     // check we have initialised a test
     if (self::$currentTest) {
         // get the contents of the buffer and empty the buffer
         self::$testResults[self::$currentTest] = ob_get_clean();
     } else {
         throw new exception('no test is running');
     }
     self::$currentTest = null;
 }
Exemple #3
0
    public function processLicenseData($cur_code = 'USD')
    {
        $cCode = $this->getCurIdonCode($cur_code);
        $siteId = VBox::get('ConstData')->getConst('siteId');
        $q = '	SELECT 
							l_id,
							l_parentid,
							l_price,
							l_type,
							l_usernumber,
							l_min_usernumber,
							l_users_in_license,
							l_name,
							l_wiki_link,
							l_default,

							pr_curid,
							pr_price,

							oi_price_id,

							po_operator_id

					FROM ' . $this->dbName . 'pa_licenses
					
					LEFT JOIN ' . $this->dbName . 'pa_prices ON l_id = pr_lid
					LEFT JOIN ' . $this->dbName . 'pa_products_operators ON po_product_id = l_pid
					LEFT JOIN ' . $this->dbName . 'pa_operators_id ON oi_lid = l_id AND oi_curid = 12
                
					WHERE l_pid = ' . $this->productId . ' AND l_blocked = "N"
                
					ORDER BY l_order';
        //			var_dump($q);
        if (DB::executeQuery($q, 'lic')) {
            $rows = DB::fetchResults('lic');
            $sRows = sizeof($rows);
            /*************************************************
             * 	AB TESTTING
             **************************************************/
            $ab = false;
            switch ($this->productId) {
                case 128:
                    // folx
                    $ab = false;
                    break;
            }
            if ($ab) {
                if (isset($_COOKIE['op-' . $this->productId])) {
                    $ab = $_COOKIE['op-' . $this->productId];
                } else {
                    include_once ENGINE_PATH . 'class/classABTest.php';
                    $abTest = new ABTest();
                    $ab = $abTest->getOperator();
                }
            }
            for ($i = 0; $i < $sRows; $i++) {
                $lid = $rows[$i]['l_id'];
                $parentid = $rows[$i]['l_parentid'];
                $this->productArray['categories'][$rows[$i]['l_type']][$lid] = $lid;
                $this->productArray['lic'][$lid]['id'] = $lid;
                $this->productArray['lic'][$lid]['name'] = $rows[$i]['l_name'];
                $this->productArray['lic'][$lid]['parentid'] = $parentid;
                $this->productArray['lic'][$lid]['price'] = $rows[$i]['l_price'];
                $this->productArray['lic'][$lid]['cur_code'] = $cur_code;
                $this->productArray['lic'][$lid]['price_id'] = $rows[$i]['oi_price_id'];
                $this->productArray['lic'][$lid]['wiki_link'] = $rows[$i]['l_wiki_link'];
                $this->productArray['lic'][$lid]['default'] = $rows[$i]['l_default'];
                $this->productArray['lic'][$lid]['htmlprice'] = str_replace('.', '.<sup>', $rows[$i]['l_price']) . '</sup>';
                $this->productArray['lic'][$lid]['type'] = $rows[$i]['l_type'];
                $this->productArray['lic'][$lid]['usernumber'] = $rows[$i]['l_usernumber'];
                $this->productArray['lic'][$lid]['min_usernumber'] = $rows[$i]['l_min_usernumber'];
                $this->productArray['lic'][$lid]['users_in_license'] = $rows[$i]['l_users_in_license'];
                $this->productArray['operator_id'] = $rows[$i]['po_operator_id'];
                $this->productArray['lic'][$lid]['save'] = 0;
                if (0 < $rows[$i]['l_parentid']) {
                    $parentPrice = $this->productArray['lic'][$parentid]['price'];
                    if (0 < $parentPrice) {
                        $this->productArray['lic'][$lid]['save'] = 100 - round($rows[$i]['l_price'] * 100 / $parentPrice);
                    }
                }
                $cCode = $this->currencyData[$rows[$i]['pr_curid']]['code'];
                if (0 < $rows[$i]['l_price']) {
                    if ($parentid > 0) {
                        //							$this->productArray['prices'][$parentid]['packs'][$lid]['USD'] 				= $rows[$i]['l_price'];
                        $this->productArray['prices'][$parentid]['packs'][$lid][$cur_code] = $rows[$i]['l_price'];
                        $this->productArray['prices'][$parentid]['packs'][$lid][$cCode] = $rows[$i]['pr_price'];
                        $this->productArray['prices'][$parentid]['packs'][$lid]['min_usernumber'] = $rows[$i]['l_min_usernumber'];
                        $this->productArray['prices'][$parentid]['packs'][$lid]['usernumber'] = $rows[$i]['l_usernumber'];
                        $this->productArray['prices'][$parentid]['packs'][$lid]['users_in_license'] = $rows[$i]['l_users_in_license'];
                    } else {
                        //							$this->productArray['prices'][$lid]['USD']['price'] 	= $rows[$i]['l_price'];
                        $this->productArray['prices'][$lid][$cur_code]['price'] = $rows[$i]['l_price'];
                        $this->productArray['prices'][$lid][$cCode]['price'] = $rows[$i]['pr_price'];
                    }
                }
            }
        }
        $q = '	SELECT 
							oi_price_id,
							oi_default,
							oi_curid,
							oi_operator_id,

							l_id

					FROM ' . $this->dbName . 'pa_operators_id
                  
					LEFT JOIN ' . $this->dbName . 'pa_licenses ON oi_lid = l_id
					
					WHERE l_pid = ' . $this->productId . ' AND oi_blocked = "N"';
        /*LEFT JOIN '.$this->dbName.'pa_products_operators ON oi_operator_id = po_operator_id*/
        //var_dump($q);
        if (DB::executeQuery($q, 'lic_contracts')) {
            $rows = DB::fetchResults('lic_contracts');
            foreach ($rows as $row) {
                $cCode = $this->currencyData[$row['oi_curid']]['code'];
                //				if($row['oi_default'] == 'Y')
                //				if($cCode == 'USD')
                if ($cCode == $cur_code) {
                    $this->productArray['prices'][$row['l_id']][$row['oi_operator_id']]['contractIds']['default'] = $row['oi_price_id'];
                    //	$this->productArray['defaultOperatorId'] = $row['oi_operator_id'];
                }
                $this->productArray['prices'][$row['l_id']][$row['oi_operator_id']]['contractIds'][$cCode] = $row['oi_price_id'];
            }
        }
        $q = '	SELECT 
							oc_operator_id,
							c_code
              
					FROM ' . $this->dbName . 'pa_operators_currencies
				
					LEFT JOIN ' . $this->dbName . 'pa_currencies ON c_id = oc_currency_id';
        $operators2Currencies = array();
        $this->productArray['currencies2Operators'] = array();
        if (DB::executeQuery($q, 'opcur')) {
            $rows = DB::fetchResults('opcur');
            foreach ($rows as $row) {
                $operators2Currencies[$row['oc_operator_id']][] = $row['c_code'];
                $this->productArray['currencies2Operators'][$row['c_code']] = $row['oc_operator_id'];
            }
        }
        $q = '	SELECT *
              
					FROM ' . $this->dbName . 'pa_currencies
				';
        $this->productArray['currenciesRate'] = array();
        if (DB::executeQuery($q, 'curate')) {
            $rows = DB::fetchResults('curate');
            foreach ($rows as $row) {
                $this->productArray['currenciesRate'][$row['c_code']] = $row['c_ratio'];
            }
        }
        $q = '	SELECT 	os_operator_id,
							os_site_id
				  
					FROM ' . $this->dbName . 'pa_operators_sites';
        $this->productArray['operators2Sites'] = array();
        if (DB::executeQuery($q, 'opsite')) {
            $rows = DB::fetchResults('opsite');
            foreach ($rows as $row) {
                $this->productArray['operators2Sites'][$row['os_site_id']] = $row['os_operator_id'];
            }
        }
        if ($this->productArray['operator_id'] == 0 && isset($this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')])) {
            $this->productArray['operator_id'] = $this->productArray['operators2Sites'][VBox::get('ConstData')->getConst('siteId')];
        }
        $q = '	SELECT 	
							bn_id,
							bn_pid,
							bn_bundle_lid,
							bn_price,

							p_title,
							p_nick,
							p_wiki_link,
							p_page_link,

							l_price,

							oi_price_id,

							bnp_curid,
							bnp_price
		
					FROM ' . $this->dbName . 'pa_bundles
					
					LEFT JOIN ' . $this->dbName . 'pa_licenses ON l_id = bn_bundle_lid
					LEFT JOIN ' . $this->dbName . 'products ON p_id = l_pid
					LEFT JOIN ' . $this->dbName . 'pa_operators_id ON oi_lid = l_id AND oi_curid = 12
					LEFT JOIN ' . $this->dbName . 'pa_bundle_prices ON bnp_bnid = bn_id

					WHERE bn_pid = ' . $this->productId;
        if (DB::executeQuery($q, 'bundles')) {
            $rows = DB::fetchResults('bundles');
            for ($i = 0; $i < sizeof($rows); $i++) {
                $this->productArray['bundles'][$rows[$i]['bn_id']]['price'] = $rows[$i]['bn_price'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['price_id'] = $rows[$i]['oi_price_id'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['html_price'] = str_replace('.', '.<sup>', $rows[$i]['bn_price']) . '</sup>';
                $this->productArray['bundles'][$rows[$i]['bn_id']]['true_price'] = $rows[$i]['l_price'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['cur_code'] = $cur_code;
                $this->productArray['bundles'][$rows[$i]['bn_id']]['html_true_price'] = str_replace('.', '.<sup>', $rows[$i]['l_price']) . '</sup>';
                $this->productArray['bundles'][$rows[$i]['bn_id']]['product_title'] = $rows[$i]['p_title'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['product_nick'] = $rows[$i]['p_nick'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['product_wiki_link'] = $rows[$i]['p_wiki_link'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['product_page_link'] = $rows[$i]['p_page_link'];
                $cCode = $this->currencyData[$rows[$i]['bnp_curid']]['code'];
                //					$this->productArray['bundle_prices'][$rows[$i]['bn_id']]['USD']['price'] 	= $rows[$i]['bn_price'];
                $this->productArray['bundle_prices'][$rows[$i]['bn_id']][$cur_code]['price'] = $rows[$i]['bn_price'];
                $this->productArray['bundle_prices'][$rows[$i]['bn_id']][$cCode]['price'] = $rows[$i]['bnp_price'];
                $this->productArray['bundles'][$rows[$i]['bn_id']]['save'] = 100 - round($rows[$i]['bn_price'] * 100 / $rows[$i]['l_price']);
            }
        }
        $q = '	SELECT
							oi_price_id,
							oi_default,
							oi_curid,
							oi_operator_id,

							bn_id

					FROM ' . $this->dbName . 'pa_bundles
					
					LEFT JOIN ' . $this->dbName . 'pa_operators_id ON oi_lid = bn_bundle_lid
					
					WHERE bn_pid = ' . $this->productId;
        if (DB::executeQuery($q, 'bun_contracts')) {
            $rows = DB::fetchResults('bun_contracts');
            foreach ($rows as $row) {
                $cCode = $this->currencyData[$row['oi_curid']]['code'];
                //					if($cCode == 'USD')
                //					if($row['oi_default'] == 'Y')
                if ($cCode == $cur_code) {
                    $this->productArray['bundle_prices'][$row['bn_id']][$row['oi_operator_id']]['contractIds']['default'] = $row['oi_price_id'];
                }
                $this->productArray['bundle_prices'][$row['bn_id']][$row['oi_operator_id']]['contractIds'][$cCode] = $row['oi_price_id'];
            }
        }
        $q = 'SELECT l_id,
						 l_price,

						 pr_curid,
						 pr_price,

						 bn_id

				FROM ' . $this->dbName . 'pa_licenses
				LEFT JOIN ' . $this->dbName . 'pa_bundles ON bn_bundle_lid = l_id
				LEFT JOIN ' . $this->dbName . 'pa_prices ON pr_lid = l_id

			 WHERE bn_pid = ' . $this->productId;
        if (DB::executeQuery($q, 'bundlesPrices')) {
            $rows = DB::fetchResults('bundlesPrices');
            foreach ($rows as $row) {
                $cCode = $this->currencyData[$row['pr_curid']]['code'];
                //					$this->productArray['bundle_product_prices'][$row['bn_id']]['USD'] = $row['l_price'];
                $this->productArray['bundle_product_prices'][$row['bn_id']][$cur_code] = $row['l_price'];
                $this->productArray['bundle_product_prices'][$row['bn_id']][$cCode] = $row['pr_price'];
            }
        }
        $q = '	SELECT 
							af_id,
							af_text,
							af_default_price,
							af_price_percent,

							ac_contract_id,
							ac_operator_id,
							ac_cur_id,

							afp_curid,
							afp_price,

							ll_text

					FROM ' . $this->dbName . 'pa_adfeatures
					
					LEFT JOIN ' . $this->dbName . 'pa_adfeatures_prices ON afp_afid = af_id
					LEFT JOIN ' . $this->dbName . 'pa_adfeatures_contracts ON ac_adfeature_id = af_id
					LEFT JOIN ' . VBox::get('Page')->getSiteDbName() . 'lstrings ON ls_nick = af_text AND ls_site = ' . VBox::get('ConstData')->getConst('siteId') . '
					LEFT JOIN ' . VBox::get('Page')->getSiteDbName() . $this->language . ' ON ll_nick_id = ls_id

					WHERE afp_pid = ' . $this->productId . '
					
					ORDER BY af_id';
        if (DB::executeQuery($q, 'offers')) {
            $rows = DB::fetchResults('offers');
            for ($i = 0; $i < sizeof($rows); $i++) {
                $this->productArray['offers'][$rows[$i]['af_id']]['price'] = $rows[$i]['af_default_price'];
                $this->productArray['offers'][$rows[$i]['af_id']]['text'] = $rows[$i]['ll_text'];
                $cCode = $this->currencyData[$rows[$i]['afp_curid']]['code'];
                $this->productArray['offer_prices'][$rows[$i]['af_id']]['USD'] = $rows[$i]['af_default_price'];
                $this->productArray['offer_prices'][$rows[$i]['af_id']][$cCode] = $rows[$i]['afp_price'];
                $this->productArray['offer_prices'][$rows[$i]['af_id']]['price_percent'] = $rows[$i]['af_price_percent'];
                $this->productArray['offer_prices'][$rows[$i]['af_id']][$rows[$i]['ac_operator_id']][$this->currencyData[$rows[$i]['ac_cur_id']]['code']] = $rows[$i]['ac_contract_id'];
            }
        }
        $this->productArray['os'] = $this->checkOS($_SERVER['HTTP_USER_AGENT']);
        $this->productArray['dontshownote'] = isset($_COOKIE['dontshownote']) ? 1 : 0;
        if ($this->productArray['operator_id'] == 2) {
            $this->prepareForElement5($operators2Currencies);
        }
        //echo $this->productArray['operator_id'] . '<br>';
        if ($this->productArray['operator_id'] == 5) {
            $this->prepareForCB($operators2Currencies);
        }
        return $this->productArray;
    }
Exemple #4
0
require_once CORE_PATH . 'client/facebook/facebook_wrapper.php';
require_once CORE_PATH . 'client/wib/whereivebeen_wrapper.php';
// ------------------------------------------------------
// system configuration
require_once CORE_PATH . 'config.php';
// ------------------------------------------------------
// make cookies work in IE iframes
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
// if we're in dev, enable all query logs
if (ENV == 'dev' || array_val($_REQUEST, 'mongoose7')) {
    Log::enableAll();
}
// all users get a php session. we have our own session handler which uses the database
session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
session_start();
// are we overriding the test with a request variable
if ($current_test = array_val($_REQUEST, 'AB_USER_TEST')) {
    // save this for the duration of the users session
    $_SESSION['AB_USER_TEST'] = $current_test;
} else {
    // try and pull it from the session
    if (!($current_test = array_val($_SESSION, 'AB_USER_TEST'))) {
        // we dont have one in the session then assign a new one
        $current_test = ABTest::getRandomTest();
        $_SESSION['AB_USER_TEST'] = $current_test;
    }
}
// pass this to the AB framework, the framework will show content for this test only
ABTest::assignTest($current_test);
// load the configuration for simpledb
SimpleDB::loadConfiguration();