Esempio n. 1
0
 /**
  * 初始化
  */
 public function init()
 {
     $this->_bootstrap = $this->getInvokeArg('bootstrap');
     $this->_multidb = $this->_bootstrap->getResource('multidb');
     $this->_options = $this->_bootstrap->getOptions();
     $this->_helper->viewRenderer->view->setBasePath(APPLICATION_PATH . '/modules/foreign/views');
     $this->_helper->viewRenderer->setViewScriptPathSpec(':module#:controller#:action.:suffix');
     $this->_tsId = $this->_request->getParam('ts');
     $tuduId = $this->_request->getParam('tid');
     $unId = $this->_request->getParam('fid');
     if (!$this->_tsId || !$tuduId || !$unId) {
         $this->getResponse()->setHttpResponseCode(404);
         $this->getResponse()->sendResponse();
         return;
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->getTsDb($this->_tsId)));
     $this->_manager = Tudu_Tudu_Manager::getInstance();
     $this->_deliver = new Tudu_Deliver($this->getTsDb($this->_tsId));
     $this->_tudu = $this->_manager->getTuduById($tuduId, $unId);
     $this->_user = $this->_manager->getUser($tuduId, $unId);
     if (null !== $this->_user) {
         // 用户请求语言
         $language = $this->_request->getHeader('ACCEPT_LANGUAGE');
         if (strpos($language, 'zh') !== false) {
             if (strpos($language, 'hk') !== false || strpos($language, 'tw') !== false) {
                 $language = 'zh_TW';
             } else {
                 $language = 'zh_CN';
             }
         } else {
             $language = 'en_US';
         }
         $this->_user['option'] = array('language' => $language);
         if (null !== $this->_tudu) {
             $this->_session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
             $this->_sessionId = Zend_Session::getId();
             //
             /*if (isset($this->_session->foreign['uniqueid']) && $this->_session->foreign['uniqueid'] != $this->_user['uniqueid']) {
                   $this->_destroySession();
               }*/
             $this->_session->foreign['uniqueid'] = $this->_user['uniqueid'];
             $this->_session->foreign['address'] = $this->_user['email'] ? $this->_user['email'] : $this->_user['uniqueid'];
             $this->_session->foreign['truename'] = $this->_user['truename'];
             $this->_session->foreign['logintime'] = time();
             $this->_session->foreign['orgid'] = $this->_tudu->orgId;
             $this->_session->foreign['tsid'] = $this->_tsId;
             $this->_session->foreign['lasttime'] = time();
             if (empty($this->_session->auth)) {
                 $this->_session->auth = array('uniqueid' => $this->_user['uniqueid'], 'address' => $this->_session->foreign['address'], 'logintime' => $this->_session->foreign['logintime']);
             }
         }
         $this->_timestamp = time();
         $this->view->options = $this->_options;
         $this->view->tsid = $this->_tsId;
         $this->view->user = $this->_user;
     }
 }
Esempio n. 2
0
 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId,$dStartDate,$dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     /**/
     $dStartDate = new Zend_Date('2014-08-05', 'yyyy-MM-dd');
     $dEndDate = new Zend_Date('2014-08-05', 'yyyy-MM-dd');
     /**/
     $options = $this->_client->getOptions();
     $options[CURLOPT_ENCODING] = "gzip,deflate";
     $options[CURLOPT_HTTPHEADER] = array('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: es,en-us;q=0.7,en;q=0.3', 'Accept-Encoding: gzip, deflate', 'Connection: keep-alive');
     $this->_client->setOptions($options);
     $urls = array();
     $urls[] = new Oara_Curl_Request("https://advertiser.zanox.com/advertisertransactionconfirmation/main/app?dest=sales&program=7641", array());
     $exportReport = $this->_client->get($urls);
     $timestampStartDate = strtotime($dStartDate->toString("dd-MM-yyyy"));
     //'05-08-2014'
     $timestampEndDate = strtotime($dEndDate->toString("dd-MM-yyyy"));
     $timestampStartDate = $timestampStartDate - 3600;
     $timestampStartDate = $timestampStartDate . '000';
     $timestampEndDate = $timestampEndDate - 3600;
     $timestampEndDate = $timestampEndDate . '000';
     $valuesFromExport = array();
     $valuesFromExport[] = new Oara_Curl_Parameter('transaction_type', 'SALE');
     $valuesFromExport[] = new Oara_Curl_Parameter('approved', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('rejected', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('open', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('invalid', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('confirmed', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('date_from', $timestampStartDate);
     //1407193200000 ==> "1407196800 - 3600" ++ "000"
     $valuesFromExport[] = new Oara_Curl_Parameter('date_to', $timestampEndDate);
     $valuesFromExport[] = new Oara_Curl_Parameter('sale_date', 'true');
     $valuesFromExport[] = new Oara_Curl_Parameter('pattern', '');
     $valuesFromExport[] = new Oara_Curl_Parameter('pattern_field', 'ORDER_ID');
     $valuesFromExport[] = new Oara_Curl_Parameter('sort_column', 'SALE_DATE');
     $valuesFromExport[] = new Oara_Curl_Parameter('sort_direction', 'DESC');
     $valuesFromExport[] = new Oara_Curl_Parameter('tracking_category', '');
     $valuesFromExport[] = new Oara_Curl_Parameter('program_id', $this->_idProgram);
     $valuesFromExport[] = new Oara_Curl_Parameter('locale_name', 'en_US');
     $urls = array();
     $urls[] = new Oara_Curl_Request('https://advertiser.zanox.com/advertisertransactionconfirmation/main/export?', $valuesFromExport);
     $result = $this->_client->get($urls);
     echo $result[0];
     $exportData = str_getcsv($result[0], ";");
     /**/
     $exportData = null;
     $folder = realpath(dirname(COOKIES_BASE_DIR)) . '/pdf/';
     $my_file = $folder . 'tracking_pps_report.csv';
     $csvfile = fopen($my_file, 'rb');
     while (!feof($csvfile)) {
         $exportData[] = fgetcsv($csvfile, 1000, ";");
     }
     /**/
     for ($j = 1; $j < count($exportData) - 5; $j++) {
         if ($exportData[$j][2] == null) {
             throw new Exception('Order ID is null');
         } else {
             $transaction = array();
             $transaction['custom_id'] = $exportData[$j][4];
             $transaction['unique_id'] = $exportData[$j][2];
             $transaction['merchantId'] = $this->_idProgram;
             $transactionDate = new Zend_Date($exportData[$j][12], 'dd/MM/yy HH:mm CEST');
             $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
             $transaction['amount'] = $exportData[$j][7];
             $transaction['commission'] = $exportData[$j][8];
             if ($exportData[$j][0] == 'Confirmed') {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             } else {
                 if ($exportData[$j][0] == 'Open') {
                     $transaction['status'] = Oara_Utilities::STATUS_PENDING;
                 } else {
                     if ($exportData[$j][0] == 'Rejected') {
                         $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                     }
                 }
             }
             $totalTransactions[] = $transaction;
         }
     }
     return $totalTransactions;
 }
Esempio n. 3
0
/**
 * This function is called from the parser, before <nowiki> parts have been
 * removed and before templates etc are expanded.
 *
 * @param unknown_type $parser
 * @param unknown_type $text
 * @param unknown_type $strip_stat
 */
function smwfAAMBeforeStrip(&$parser, &$text, &$strip_stat)
{
    $popts = $parser->getOptions();
    if (method_exists($popts, "getParsingContext")) {
        if ($popts->getParsingContext() != "Main article") {
            return true;
        }
    }
    global $smwgDisableAAMParser;
    if ($smwgDisableAAMParser) {
        return true;
    }
    global $smwgHaloIP, $smwgHaloAAMParser;
    require_once "{$smwgHaloIP}/includes/SMW_AAMParser.php";
    if ($smwgHaloAAMParser == null) {
        $smwgHaloAAMParser = new SMWH_AAMParser($text);
    }
    $parser->mOptions->setEditSection(false);
    $text = $smwgHaloAAMParser->addWikiTextOffsets($text);
    return true;
}