/**
  * Constructs a new record found at the given zero-based position in the associated DBC
  */
 public function __construct(DBC $dbc, $pos)
 {
     $this->_dbc = $dbc;
     $this->_pos = $pos;
     $this->_offset = DBC::HEADER_SIZE + $pos * $dbc->getRecordSize();
     $handle = $dbc->getHandle();
     fseek($handle, $this->_offset);
     if ($dbc->getRecordSize() > 0) {
         $this->_data = fread($handle, $dbc->getRecordSize());
     }
 }
    public function before($context) 
    {/*{{{*/
        parent::before($context);
        $group = DAL::get()->find_parent('FinanceInspectGroup');

        DBC::requireTrue($group->among($context->response->curInspector), '你没有权限访问');
    }/*}}}*/
 public function addFlowChargeOrder($request, $response)
 {
     /*{{{*/
     $refId = $request->getRequest('refid', true);
     $ref = DAL::get()->find('DoctorPatientRef', $refId);
     $isdpRef = $ref instanceof DoctorPatientRef;
     $isUserSelf = $ref->user->id == $this->user->id;
     $isOpenCharge = $ref->space->isChargeOpened();
     DBC::requireTrue($isdpRef && $isUserSelf && $isOpenCharge, '对不起,您不能预充值');
     if ($this->checkCanCharge($ref)) {
         $this->message("抱歉!现在不能购买。您已经提前购买了{$ref->space->name}医生的3次指导机会,为避免资源浪费,请在使用后再次够买。", $response, array('text' => '点击这里继续', 'url' => $ref->getUrl()));
     } else {
         $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($ref->space);
         $charge = $product->salePrice;
         $cashAccount = $this->user->getCashAccount();
         if ($cashAccount->amount >= $charge) {
             $serviceOrder = ServiceOrderClient::getInstance()->create($ref, $product, $this->user);
             if (false == $serviceOrder->isNull()) {
                 ServiceOrderClient::getInstance()->pay($serviceOrder, $this->user);
                 $serviceOrder = DAL::get()->find('serviceOrder', $serviceOrder->id, true);
             }
             if ($serviceOrder->isPaid()) {
                 $response->setRedirect($serviceOrder->successUrl());
                 return parent::DIRECT_OUTPUT;
             }
         }
         $url = 'http://' . URL_PREFIX . 'passport.haodf.com/telpayment/showtelaccount';
         $this->message('您的余额不足,不能购买,请充值后重新购买', $response, array('text' => '去充值', 'url' => $url));
     }
 }
 public function validate(&$data, $single = false)
 {
     $p = DBC::queryOneAssoc("\n\t\t\tSELECT p_id\n\t\t\tFROM wog_player\n\t\t\tWHERE p_id={$data['p_id']}\n\t\t");
     if (!$p) {
         alert('玩家不存在');
     }
 }
    public function detail($request, $response)
    {/*{{{*/
		$articleId = intval($request->getRequest('article_id', 0));
		$article = DAL::get()->find('article', $articleId);
        if($article->isNull())
        {
            $this->_exit404();
        }
        DBC::requireFalse($article->isDelete(), "文章已经被删除了!");
        DBC::requireFalse($article->isShield(), "文章正在审核中!");
        if ($article->isAuditing())
        {
            $result = $this->filterArticle($article);
            if (false == empty($result['title']) || false == empty($result['content']))
            {
                DBC::requireFalse(true, "文章正在审核中!");
            }
        }
        $isShare = $request->getRequest('isShare', '');
        //分享文章阅读量统计
        if(false == empty($isShare))
        {
            HitClient::getInstance()->increaseArticleHitsForShare($article->id);
        }
        $response->article = $article;
        $response->topTitle = XString::truncate($article->title, 18);
        $response->title = $article->title."_好大夫在线";

        $articleAttachmentRef = new NullEntity();
        if ($article->hasDocAttachment())
        {
            $articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
        }
        $response->articleAttachmentRef = $articleAttachmentRef;
    }/*}}}*/
 function testMigrateData()
 {
     $prefix = $this->getPrefix();
     $this->initDatabase(126, array('zones', 'ad_zone_assoc', 'placement_zone_assoc', 'banners'));
     $aAValues = array(array('zoneid' => 1, 'zonetype' => 0, 'what' => ''), array('zoneid' => 2, 'zonetype' => 0, 'what' => 'bannerid:3'), array('zoneid' => 3, 'zonetype' => 3, 'what' => 'clientid:3'), array('zoneid' => 4, 'zonetype' => 3, 'what' => 'clientid:5', 'delivery' => phpAds_ZoneText), array('zoneid' => 5, 'zonetype' => 3, 'what' => 'clientid:5', 'delivery' => phpAds_ZoneBanner, 'width' => 468, 'height' => 60), array('zoneid' => 6, 'zonetype' => 0, 'what' => 'bannerid:2,bannerid:3'), array('zoneid' => 7, 'zonetype' => 3, 'what' => 'clientid:3,clientid:4'), array('zoneid' => 8, 'zonetype' => 0, 'what' => 'bannerid:2,bannerid:3,bannerid:4,bannerid:5'), array('zoneid' => 9, 'zonetype' => 3, 'what' => 'clientid:,clientid:3'));
     foreach ($aAValues as $aValues) {
         // Set empty defaults for NOT NULL fields
         $aValues['chain'] = $aValues['prepend'] = $aValues['append'] = '';
         $sql = OA_DB_Sql::sqlForInsert('zones', $aValues);
         $this->oDbh->exec($sql);
     }
     $aABannerValues = array(array('bannerid' => 1, 'campaignid' => 3), array('bannerid' => 2, 'campaignid' => 3), array('bannerid' => 3, 'campaignid' => 4), array('bannerid' => 4, 'campaignid' => 4), array('bannerid' => 5, 'campaignid' => 5, 'storagetype' => 'txt'), array('bannerid' => 6, 'campaignid' => 5, 'storagetype' => 'sql', 'width' => 468, 'height' => 60), array('bannerid' => 7, 'campaignid' => 5, 'storagetype' => 'sql', 'width' => 125, 'height' => 125));
     foreach ($aABannerValues as $aBannerValues) {
         // Set empty defaults for NOT NULL fields
         $aBannerValues['htmltemplate'] = $aBannerValues['htmlcache'] = $aBannerValues['bannertext'] = $aBannerValues['compiledlimitation'] = $aBannerValues['append'] = '';
         $sql = OA_DB_Sql::sqlForInsert('banners', $aBannerValues);
         $this->oDbh->exec($sql);
     }
     $this->upgradeToVersion(127);
     $aAssocTables = array("{$prefix}ad_zone_assoc WHERE link_type = 1" => 17, "{$prefix}ad_zone_assoc WHERE link_type = 0" => 7, "{$prefix}placement_zone_assoc" => 6);
     foreach ($aAssocTables as $assocTable => $cAssocs) {
         $rsCAssocs = DBC::NewRecordSet("SELECT count(*) AS cassocs FROM {$assocTable}");
         $this->assertTrue($rsCAssocs->find());
         $this->assertTrue($rsCAssocs->fetch());
         $this->assertEqual($cAssocs, $rsCAssocs->get('cassocs'), "%s: The table involved: {$assocTable}");
     }
 }
 public function newPost($request, $response)
 {
     /*{{{*/
     $verifyOk = Captcha::verify($request->verifyStr, XIpLocation::getIp(), 'article', $request->article_id, $request->token);
     DBC::requireTrue($verifyOk, "您输入的验证码有误!");
     //禁用词检查
     $title = $request->title;
     $result = DoctorClient::getInstance()->getProfanityCheck($title);
     DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败");
     DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功");
     $title = $result['CONTENT'];
     $content = htmlspecialchars($request->getRequest('content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
     $result = DoctorClient::getInstance()->getProfanityCheck($content);
     DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败");
     DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功");
     $content = $result['CONTENT'];
     $article = DAL::get()->find('article', $request->article_id);
     $feilds = array();
     $feilds['ip'] = XIpLocation::getIp();
     $feilds['ipLocation'] = XIpLocation::getLocationArea();
     $userId = $this->user->isNull() == false ? $this->user->id : '';
     $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds);
     squid::clean($article->getUrl(), true);
     $this->message('您发表的评论已经提交,待网站审核通过后即可展示。', $response);
 }
    public static function sanitizeShowData($d)
    {
        if ($d['syn_need_mission'] == 0) {
            $d['m_subject'] = '無';
        }
        if (in_array($d['d_type'], array(5, 6))) {
            $d['d_name'] .= '*' . $d['syn_num'];
        }
        $tmplist = explode(',', $d['syn_element']);
        $itemlist = $listmap = [];
        $listmap = [];
        $result = array();
        foreach ($tmplist as $v) {
            $v = explode('*', $v);
            $itemlist[] = $v[0];
            $listmap[$v[0]] = $v[1];
        }
        $query = DBC::query('
			SELECT d_id, d_name
			FROM wog_df
			WHERE d_id IN (' . implode(',', $itemlist) . ')
		');
        while ($item = $query->fetchAssoc()) {
            $result[] = $item['d_name'] . '*' . $listmap[$item['d_id']];
        }
        $d['syn_name'] = implode(', ', $result);
        unset($d['d_type']);
        return $d;
    }
 public function detail($request, $response)
 {/*{{{*/
     $threadId = (int)$request->case_id;
     $criticalNum = 100*100*1000;
     $correctNum = 100*100*100;
     $threadId = $threadId > $criticalNum ? $threadId : $threadId-$correctNum;
     
     $proposal = DAL::get()->find('proposal', $threadId);
     if(false == $proposal->isNull())
     {
         $response->setRedirect($proposal->getTouchUrl());
         return 0;
     }
     else
     {
         $intention = DAL::get()->find('intention', $threadId);
         if(false == $intention->isNull())
         {
             $response->setRedirect($intention->getTouchUrl());
             return 0;
         }
         else
         {
             DBC::requireTrue(false, 'Êý¾ÝÎÊÌâ');
         }
     }
 }/*}}}*/
 function testMigrateData()
 {
     $prefix = $this->getPrefix();
     $this->initDatabase(121, array('clients', 'campaigns'));
     $aCampaigns = array(array('clientid' => 3, 'parent' => 1, 'views' => '100', target => '1000'), array('clientid' => 4, 'parent' => 1, 'views' => '200', target => '1'), array('clientid' => 5, 'parent' => 1, 'views' => '200', target => '0'));
     $cCampaigns = count($aCampaigns);
     $aAValues = array(array('clientid' => 1, 'parent' => 0, 'views' => '0', target => '0'), array('clientid' => 2, 'parent' => 0, 'views' => '0', target => '0'));
     $aAValues = array_merge($aAValues, $aCampaigns);
     foreach ($aAValues as $aValues) {
         $sql = OA_DB_Sql::sqlForInsert('clients', $aValues);
         $this->oDbh->exec($sql);
     }
     $this->upgradeToVersion(122);
     $tableCampaigns = $this->oDbh->quoteIdentifier($prefix . 'campaigns', true);
     $rsCampaigns = DBC::NewRecordSet("SELECT * from {$tableCampaigns}");
     $this->assertTrue($rsCampaigns->find());
     $this->assertEqual($cCampaigns, $rsCampaigns->getRowCount());
     for ($idxCampaign = 0; $idxCampaign < $cCampaigns; $idxCampaign++) {
         $this->assertTrue($rsCampaigns->fetch());
         $this->assertEqual($aCampaigns[$idxCampaign]['clientid'], $rsCampaigns->get('campaignid'));
         $this->assertEqual($aCampaigns[$idxCampaign]['parent'], $rsCampaigns->get('clientid'));
         $this->assertEqual($aCampaigns[$idxCampaign]['views'], $rsCampaigns->get('views'));
         $priority = $aCampaigns[$idxCampaign]['target'] > 0 ? 5 : 0;
         $this->assertEqual($priority, $rsCampaigns->get('priority'));
     }
     $tableClients = $this->oDbh->quoteIdentifier($prefix . 'clients', true);
     $rsClients = DBC::NewRecordSet("SELECT count(*) AS nclients FROM {$tableClients}");
     $this->assertTrue($rsClients->find());
     $this->assertTrue($rsClients->fetch());
     $this->assertEqual(count($aAValues) - $cCampaigns, $rsClients->get('nclients'));
     if ($this->oDbh->dbsyntax == 'pgsql') {
         $value = $this->oDbh->queryOne("SELECT NEXTVAL('{$prefix}campaigns_campaignid_seq')");
         $this->assertTrue($value > 5, "The current sequence value is {$value}.");
     }
 }
Beispiel #11
0
 private function url()
 {
     $dbc = new DBC();
     if (isset($_GET['url'])) {
         // get the URL from the base defined in the.htaccess file.
         // filter url
         # Example: www.yourdomain.com/example-page/hello/1/title/
         $url = filter_var(mysqli_real_escape_string($dbc->connect(), trim($_GET['url'])), FILTER_SANITIZE_URL);
         // delete last / if it is there.
         $url = rtrim($url, '/');
         # Exampele change 1: $url = example-page/hello/1/title
         /*
          * Remove the - (dash) in the url : EX. example-page/hello. Classnames can't have the - (dash) so class is written as examplePage.
          * to call the function we need to remove the - (dash)
          */
         # Example change 2: $url = examplepage/hello/1/title
         $url = str_replace('-', '', $url);
         // create array with all the url parts.
         # Example change 3: $url = ["examplepage","hello",1,"title"]
         $url = explode('/', $url);
         // add all array values to the class var routes.
         foreach ($url as $key => $value) {
             $this->routes[$key] = $value;
         }
     }
 }
 /**
  * Exports given DBC in XML format to given target (defaults to output stream)
  */
 public function export(DBC $dbc, $target = self::OUTPUT)
 {
     $map = $dbc->getMap();
     if ($map === null) {
         throw new DBCException(self::NO_MAP);
         return;
     }
     $dom = new DOMDocument('1.0');
     $dom->formatOutput = true;
     $edbc = $dom->appendChild($dom->createElement('dbc'));
     $efields = $edbc->appendChild($dom->createElement('fields'));
     $erecords = $edbc->appendChild($dom->createElement('records'));
     $fields = $map->getFields();
     foreach ($fields as $name => $rule) {
         $count = max($rule & 0xff, 1);
         if ($rule & DBCMap::UINT_MASK) {
             $type = 'uint';
         } else {
             if ($rule & DBCMap::INT_MASK) {
                 $type = 'int';
             } else {
                 if ($rule & DBCMap::FLOAT_MASK) {
                     $type = 'float';
                 } else {
                     if ($rule & DBCMap::STRING_MASK || $rule & DBCMap::STRING_LOC_MASK) {
                         $type = 'string';
                     }
                 }
             }
         }
         for ($i = 1; $i <= $count; $i++) {
             $suffix = $count > 1 ? $i : '';
             $efields->appendChild($dom->createElement($name . $suffix, $type));
         }
     }
     foreach ($dbc as $i => $record) {
         $pairs = $record->extract();
         $erecord = $erecords->appendChild($dom->createElement('record'));
         foreach ($pairs as $field => $value) {
             $attr = $dom->createAttribute($field);
             $attr->value = $value;
             $erecord->appendChild($attr);
         }
     }
     $data = $dom->saveXML();
     file_put_contents($target, $data);
 }
 public function before($context)
 {
     parent::before($context);
     $mark = DAL::get()->find('flowproposalmark', $context->request->markId);
     DBC::requireFalse($mark->isNull(), '无效的标记');
     $inspectNames = array($mark->inspector->user->name, 'lihao120', 'sunnysmell', 'lyly006', 'pilack');
     $context->request->validAccess = in_array($context->response->curInspector->user->name, $inspectNames);
 }
	public function before($context)
	{
        $userId = UserClient::getInstance()->getCheckedSeed('id');      
        $user = DAL::get()->mustFind('user', $userId);
        $inspector = DAL::get()->find_actived('inspector', $user);
        $hasClaimPaymentPower = $inspector->isInRenLingHuiKuanGroup();
        DBC::requireTrue($hasClaimPaymentPower, '您没有认领汇款权限');
	}
Beispiel #15
0
 /**
  * Returns the record set for either 'acls' or 'acls_channels' table,
  * all records and rows.
  *
  * @param string $table Either 'acls' or 'acls_channels'
  * @return RecordSet
  */
 function &getRsAcls($table, $orderBy = false)
 {
     $table = $this->oDbh->quoteIdentifier($this->getTablePrefix() . $table);
     $query = "\n            SELECT\n                *\n            FROM\n                {$table}";
     if ($orderBy) {
         $query .= " ORDER BY " . $this->oDbh->quoteIdentifier($orderBy);
     }
     return DBC::NewRecordSet($query);
 }
 public function saveCurrentAppUrl($request, $response)
 {
     if (!$this->curOperator->isOperatorAdmin()) {
         throw new TelConfException('抱歉,此座席无权限查看!');
     }
     DBC::requireTrue(in_array('haodfhw', array('byteh', 'haodfhw', 'miaoqing1983', 'zhb110good')), '没有权限,亲!');
     PhoneConferenceClient::getInstance()->updateProviderCurrentAppUrl($request->callcenterProviderId, $request->currentAppUrl);
     $response->setRedirect('callcenterprovider');
 }
 public function before($context)
 {
     parent::before($context);
     $flowGroup = DAL::get()->find_parent('FlowPostInspectGroup');
     $followupGroup = DAL::get()->find_parent('followupPostInspectGroup');
     DBC::requireTrue($flowGroup->among($context->response->curInspector) || $followupGroup->among($context->response->curInspector), '你没有权限访问');
     $userInfo = $context->request->getCookie('userinfo');
     $context->response->auditor = DAL::get()->find_by_userid('auditor', $userInfo['id']);
 }
Beispiel #18
0
 public function getPayItemList($pageNo, $pageSize, $startTime, $endTime)
 {
     /*{{{*/
     DBC::requireTrue(XDateTime::getSecondDiffDesc($endTime, $startTime) < 3600, "查询时间不能超过一天");
     $parameter = array("service" => "account.page.query", "partner" => $this->partner, "_input_charset" => $this->_input_charset, "page_no" => $pageNo, "page_size" => $pageSize, "gmt_start_time" => $startTime, "gmt_end_time" => $endTime, "logon_id" => "", "trade_no" => "", "merchant_out_order_no" => "", "deposit_bank_no" => "", "trans_code" => "");
     $alipay = new alipay_service($parameter, $this->security_code, $this->sign_type);
     $url = $alipay->create_url();
     return $url;
 }
 function getChannelsAndAffiliates()
 {
     $prefix = $this->getTablePrefix();
     $oDbh = OA_DB::singleton();
     $tableCh = $oDbh->quoteIdentifier($prefix . 'channel', true);
     $tableAf = $oDbh->quoteIdentifier($prefix . 'affiliates', true);
     $query = "\n            SELECT\n                ch.channelid,\n                ch.affiliateid,\n                ch.name,\n                af.name AS affiliatename\n            FROM\n                {$tableCh} AS ch,\n                {$tableAf} AS af\n            WHERE\n                af.affiliateid=ch.affiliateid\n            ORDER BY ch.channelid\n    ";
     return DBC::NewRecordSet($query);
 }
 public function modifyPost($request, $response)
 {
     /*{{{*/
     $projectAntithromboticDrug = DAL::get()->find('ProjectAntithromboticDrug', $request->projectAntithromboticDrugId);
     DBC::requireTrue($projectAntithromboticDrug instanceof ProjectAntithromboticDrug, "²»´æÔڸüÈÍù/¿¹Ë¨Ò©ÎïÖÎÁÆ");
     $params = $request->vars;
     ProjectInterviewClient::getInstance()->modifyAntithromboticDrug($projectAntithromboticDrug->id, $params);
     $preMsg = "¼ÈÍù/¿¹Ë¨Ò©ÎïÖÎÁÆ " . $projectAntithromboticDrug->getDrugNameDesc() . " Ð޸ijɹ¦";
     $response->setRedirect($response->router->urlfor('projectantithromboticdrugmgr/modify', array('preMsg' => $preMsg, 'projectAntithromboticDrugId' => $projectAntithromboticDrug->id)));
 }
Beispiel #21
0
 public static function setup($dsn, $username = '', $password = '')
 {
     if (is_array($dsn) && isset($dsn['hostname']) && isset($dsn['dbname'])) {
         self::$db = new PDO('mysql:host=' . $dsn['hostname'] . ';dbname=' . $dsn['dbname'] . ';charset=utf8', isset($dsn['username']) ? $dsn['username'] : $username, isset($dsn['password']) ? $dsn['password'] : $password);
     } else {
         self::$db = new PDO($dsn, $username, $password);
     }
     self::$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement_extended', array(self::$db)));
     self::$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
 }
 public function modifyZhiJiaPost($request, $response)
 {
     /*{{{*/
     $projectSupport = DAL::get()->find('ProjectSupport', $request->projectSupportId);
     DBC::requireTrue($projectSupport instanceof ProjectSupport, "不存在该支架");
     $params = $request->vars;
     ProjectInterviewClient::getInstance()->modifyZhiJia($projectSupport->id, $params);
     $preMsg = "支架 " . $projectSupport->getCodeDesc() . " 修改成功";
     $response->setRedirect($response->router->urlfor('projectsupportmgr/modifyzhijia', array('preMsg' => $preMsg, 'projectSupportId' => $projectSupport->id)));
 }
Beispiel #23
0
 private function checkCacheConfigs($configs)
 {
     /*{{{*/
     foreach ($configs as $type => $servers) {
         foreach ($servers as $i => $server) {
             DBC::requireTrue(isset($server['host']), "memcache {$type} type[{$i}][host] not defined");
             DBC::requireTrue(isset($server['port']), "memcache {$type} type[{$i}][port] not defined");
         }
     }
 }
 public function listOfFunpoint4Mv($request, $response)
 {
 	$deleted = $request->deleted;
 	$response->deleted = isset($deleted)?$deleted:-1;
 	 
 	$funpointid = $request->funpointid;
 	$funpoint = Funpoint::getById($funpointid);
 	 
 	DBC::requireTrue($funpoint instanceof Funpoint,'功能点不存在,id='.$funpointid);
 	$response->funpoint =  $funpoint;
 }
 public function before($context)
 {
     parent::before($context);
     $group = DAL::get()->find_parent('PatientClubInspectGroup');
     DBC::requireTrue($group->among($context->response->curInspector), '你没有权限访问');
     $userInfo = $context->request->getCookie('userinfo');
     $auditor = DAL::get()->find_by_userid('auditor', $userInfo['id']);
     if ($context->action == 'exportcontacts' && false == in_array($auditor->user->name, self::$exportContactsAuditor)) {
         throw new BizException('你没有权限访问');
     }
 }
 public function before($context)
 {
     /*{{{*/
     parent::before($context);
     $userInfo = $context->request->getCookie('userinfo');
     $auditor = DAL::get()->find_by_userid('auditor', $userInfo['id']);
     $followupAuditor = DAL::get()->find_by_auditorid_and_deleted('FollowupAuditor', $auditor->id, FollowupAuditor::DELETED_NO);
     DBC::requireFalse($followupAuditor->isNull(), '没有权限, 不是随访审核员');
     $context->response->followupAuditor = $followupAuditor;
     $context->response->auditor = $auditor;
 }
 public function before($context)
 {
     parent::before($context);
     $userInfo = $context->request->getCookie('userinfo');
     $inspector = DAL::get()->find_by_userid('inspector', $userInfo['id']);
     $user = DAL::get()->find('user', $userInfo['id']);
     DBC::requireTrue(Inspector::isInSpector($user), '你没有权限访问');
     $leaderGroup = DAL::get()->queryBuAndSaleLeaderIdAndAdmin("Inspector");
     DBC::requireTrue(in_array($inspector->id, $leaderGroup), "没有操作权限!");
     $context->response->curInspector = $inspector;
 }
 function getPublishersByTracker($trackerid)
 {
     $prefix = $this->getTablePrefix();
     $oDbh = OA_DB::singleton();
     $tableAza = $oDbh->quoteIdentifier($prefix . 'ad_zone_assoc', true);
     $tableZ = $oDbh->quoteIdentifier($prefix . 'zones', true);
     $tableP = $oDbh->quoteIdentifier($prefix . 'affiliates', true);
     $tableB = $oDbh->quoteIdentifier($prefix . 'banners', true);
     $tableCt = $oDbh->quoteIdentifier($prefix . 'campaigns_trackers', true);
     $query = "\n            SELECT\n                p.affiliateid AS affiliateid,\n                p.name AS name\n            FROM\n                {$tableAza} aza\n                JOIN {$tableZ} z ON (aza.zone_id = z.zoneid)\n                JOIN {$tableP} p USING (affiliateid)\n                JOIN {$tableB} b ON (aza.ad_id = b.bannerid)\n                JOIN {$tableCt} ct USING (campaignid)\n            WHERE\n                ct.trackerid = " . DBC::makeLiteral($trackerid) . "\n            GROUP BY\n                p.affiliateid,\n                name\n            ORDER BY\n                name\n        ";
     return DBC::NewRecordSet($query);
 }
 function testMigrateCampaignIds()
 {
     $this->initDatabase(123, array('banners'));
     $sql = OA_DB_Sql::sqlForInsert('banners', array('bannerid' => '1', 'clientid' => '4', 'htmltemplate' => '', 'htmlcache' => '', 'bannertext' => '', 'compiledlimitation' => '', 'append' => ''));
     $this->oDbh->exec($sql);
     $this->upgradeToVersion(124);
     $table = $this->oDbh->quoteIdentifier($this->getPrefix() . 'banners', true);
     $rsBanners = DBC::NewRecordSet("SELECT campaignid FROM {$table}");
     $this->assertTrue($rsBanners->find());
     $this->assertTrue($rsBanners->fetch());
     $this->assertEqual(4, $rsBanners->get('campaignid'));
 }
Beispiel #30
0
 public static function get()
 {
     if (self::$instance == null) {
         try {
             self::$instance = new PDO('mysql:host=' . self::$host . ';dbname=' . self::$db, self::$user, self::$pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
         } catch (PDOException $e) {
             echo "Error!: " . $e->getMessage() . "<br/>";
             die;
         }
     }
     return self::$instance;
 }