本文整理汇总了PHP中DBC类的典型用法代码示例。如果您正苦于以下问题:PHP DBC类的具体用法?PHP DBC怎么用?PHP DBC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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());
}
}
开发者ID:WyriMaps,项目名称:php-wow-dbc,代码行数:14,代码来源:DBCRecord.class.php
示例2: before
public function before($context)
{/*{{{*/
parent::before($context);
$group = DAL::get()->find_parent('FinanceInspectGroup');
DBC::requireTrue($group->among($context->response->curInspector), '你没有权限访问');
}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:7,代码来源:financialinterceptor.php
示例3: addFlowChargeOrder
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));
}
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:30,代码来源:chargecontroller.php
示例4: validate
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('玩家不存在');
}
}
开发者ID:WeishengChang,项目名称:wogap,代码行数:7,代码来源:PlayerMessageModel.php
示例5: detail
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;
}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:35,代码来源:articlecontroller.php
示例6: testMigrateData
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}");
}
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:27,代码来源:migration_tables_core_127.mig.test.php
示例7: newPost
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);
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:25,代码来源:articlecommentcontroller.php
示例8: sanitizeShowData
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;
}
开发者ID:WeishengChang,项目名称:wogap,代码行数:29,代码来源:ItemSynController.php
示例9: detail
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, 'Êý¾ÝÎÊÌâ');
}
}
}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:27,代码来源:threadcontroller.php
示例10: testMigrateData
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}.");
}
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:35,代码来源:migration_tables_core_122.mig.test.php
示例11: url
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;
}
}
}
开发者ID:jschalkwijk,项目名称:MVC,代码行数:26,代码来源:index.php
示例12: export
/**
* 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);
}
开发者ID:WyriMaps,项目名称:php-wow-dbc,代码行数:50,代码来源:DBCXMLExporter.class.php
示例13: before
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);
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:8,代码来源:auditflowproposalmarkinterceptor.php
示例14: before
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, '您没有认领汇款权限');
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:8,代码来源:claimremitinterceptor.php
示例15:
/**
* 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);
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:16,代码来源:Acls.php
示例16: saveCurrentAppUrl
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');
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:9,代码来源:managercontroller.php
示例17: before
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']);
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:9,代码来源:nfsauditinterceptor.php
示例18: getPayItemList
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;
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:9,代码来源:alipay.php
示例19: getChannelsAndAffiliates
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);
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:9,代码来源:Channel.php
示例20: modifyPost
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)));
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:10,代码来源:projectantithromboticdrugmgrcontroller.php
注:本文中的DBC类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论