本文整理汇总了PHP中DBModel::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DBModel::getInstance方法的具体用法?PHP DBModel::getInstance怎么用?PHP DBModel::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBModel
的用法示例。
在下文中一共展示了DBModel::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RecentRP_getRecentComments
function RecentRP_getRecentComments($blogid)
{
$context = Model_Context::getInstance();
$data = $context->getProperty('plugin.config');
$comments = array();
$limitLine = $data['repliesList'] ? $data['repliesList'] : $context->getProperty('skin.commentsOnRecent');
$pool = DBModel::getInstance();
$pool->reset('Comments');
$pool->setQualifier('blogid', 'equals', intval($context->getProperty('blog.id')));
$pool->setQualifier('isfiltered', 'equals', 0);
$pool->setQualifier('entry', 'neq', 0);
if ($data['repliesChk'] != 1) {
$pool->setQualifier('replier', null);
}
$pool->setOrder('written', 'DESC');
$pool->setLimit($limitLine);
$result = $pool->getAll();
foreach ($result as $comment) {
if ($data['repliesChk'] == 2) {
$pool->reset('Comments');
$pool->setQualifier('blogid', 'equals', $context->getProperty('blog.id'));
$pool->setQualifier('parent', 'equals', $comment['id']);
$row = $pool->getCount();
$comment['replier'] = $row ? "<img src=\"" . $context->getProperty("plugin.uri") . "/replier.gif\" width=\"11\" height=\"9\" align=\"top\" style=\"margin-left:2px;\" alt=\"\" />" : "";
} else {
$comment['replier'] = "";
}
$comment['secret'] = $comment['secret'] == 1 ? "<img src=\"" . $context->getProperty("plugin.uri") . "/secret.gif\" width=\"9\" height=\"11\" style=\"margin-left:2px;\" alt=\"\" />" : "";
array_push($comments, $comment);
}
return $comments;
}
示例2: getBlogidBySecondaryDomain
function getBlogidBySecondaryDomain($domain)
{
$pool = DBModel::getInstance();
$pool->init("BlogSettings");
$pool->setQualifier('name', 'eq', 'secondaryDomain', true);
$pool->setQualifierSet(array("value", "eq", $domain, true), "OR", array("value", "eq", substr($domain, 0, 4) == 'www.' ? substr($domain, 4) : 'www.' . $domain, true));
return $pool->getCell("blogid");
}
示例3: getBlogidByName
function getBlogidByName($name)
{
$query = DBModel::getInstance();
$query->reset('BlogSettings');
$query->setQualifier('name', 'equals', 'name', true);
$query->setQualifier('value', 'equals', $name, true);
return $query->getCell('blogid');
return false;
}
示例4: printMobileEntryContent
function printMobileEntryContent($blogid, $userid, $id)
{
$pool = DBModel::getInstance();
$pool->reset('Entries');
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->setQualifier('userid', 'eq', $userid);
$pool->setQualifier('id', 'eq', $id);
return $pool->getCell('content');
}
示例5: getSkinSettingForMigration
function getSkinSettingForMigration($blogid, $name, $default = null)
{
$pool = DBModel::getInstance();
$pool->reset("SkinSettingsMig");
$pool->setQualifier("blogid", "eq", $blogid);
$pool->setQualifier("name", "eq", $name, true);
$value = $pool->getCell("value");
return $value === null ? $default : $value;
}
示例6: initialize
private static function initialize()
{
global $memcache;
/** After PHP 5.0.5, session write performs after object destruction. */
self::$mc = $memcache;
/** To Avoid this, just copy memcache handle into Session object. */
self::$context = Model_Context::getInstance();
self::$pool = DBModel::getInstance();
}
示例7: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', Utils_Unicode::lessenAsEncoding($this->name, 32), false);
if (isset($this->value)) {
$query->setAttribute('value', Utils_Unicode::lessenAsEncoding($this->value, 255), true);
}
return $query;
}
示例8: getUserNamesOfBlog
static function getUserNamesOfBlog($blogid)
{
// TODO : Caching with global cache component. (Usually it is not changing easily.)
$pool = DBModel::getInstance();
$pool->reset('Privileges');
$pool->setQualifier('blogid', 'eq', $blogid);
$authorIds = $pool->getColumn('userid');
$pool->reset('Users');
$pool->setQualifier('userid', 'hasOneOf', $authorIds);
return $pool->getAll('userid,name');
}
示例9: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('UserSettings');
$query->setQualifier('userid', 'equals', getUserId());
$query->setQualifier('name', 'equals', $this->name, false);
if (isset($this->value)) {
$query->setAttribute('value', $this->value, true);
}
return $query;
}
示例10: FAS_Call
function FAS_Call($type, $name, $title, $url, $content)
{
$context = Model_Context::getInstance();
$pool = DBModel::getInstance();
$blogstr = $context->getProperty('uri.host') . $context->getProperty('uri.blog');
$DDosTimeWindowSize = 300;
$rpc = new XMLRPC();
$rpc->url = 'http://antispam.textcube.org/RPC/';
if ($rpc->call('checkSpam', $blogstr, $type, $name, $title, $url, $content, $_SERVER['REMOTE_ADDR']) == false) {
// call fail
// Do Local spam check with "Thief-cat algorithm"
$count = 0;
if ($type == 2) {
$storage = "RemoteResponses";
$pool->reset($storage);
$pool->setQualifier("url", "eq", $url, true);
$pool->setQualifier("isfiltered", ">", 0);
if ($cnt = $pool->getCount("id")) {
$count += $cnt;
}
} else {
// Comment Case
$storage = "Comments";
$pool->reset($storage);
$pool->setQualifier("comment", "eq", ${$content}, true);
$pool->setQualifier("name", "eq", $name, true);
$pool->setQualifier("homepage", "eq", $url, true);
$pool->setQualifier("isfiltered", ">", 0);
if ($cnt = $pool->getCount("id")) {
$count += $cnt;
}
}
// Check IP
$pool->reset($storage);
$pool->setQualifier("ip", "eq", $_SERVER['REMOTE_ADDR'], true);
$pool->setQualifier("written", ">", Timestamp::getUNIXtime() - $DDosTimeWindowSize);
if ($cnt = $pool->getCount("id")) {
$count += $cnt;
}
if ($count >= 10) {
return false;
}
return true;
}
if (!is_null($rpc->fault)) {
// FAS has some problem
return true;
}
if ($rpc->result['result'] == true) {
return false;
// it's spam
}
return true;
}
示例11: load
function load($fields = '*')
{
global $database;
$blogid = getBlogId();
$this->reset();
$query = DBModel::getInstance();
$query->reset('BlogSettings');
if ($query->doesExist()) {
$query->setQualifier('blogid', 'equals', $blogid);
$blogSettings = $query->getAll('name,value');
if (isset($blogSettings)) {
foreach ($blogSettings as $blogSetting) {
$name = $blogSetting['name'];
$value = $blogSetting['value'];
switch ($name) {
case 'logo':
$name = 'banner';
break;
case 'entriesOnPage':
$name = 'postsOnPage';
break;
case 'entriesOnList':
$name = 'postsOnList';
break;
case 'entriesOnRSS':
$name = 'postsOnFeed';
break;
case 'publishWholeOnRSS':
$name = 'publishWholeOnFeed';
break;
case 'allowWriteOnGuestbook':
$name = 'acceptGuestComment';
break;
case 'allowWriteDblCommentOnGuestbook':
$name = 'acceptcommentOnGuestComment';
break;
case 'defaultDomain':
case 'useSloganOnPost':
case 'useSloganOnCategory':
case 'useSloganOnTag':
case 'acceptGuestComment':
case 'acceptcommentOnGuestComment':
$value = $value ? true : false;
break;
}
$this->{$name} = $value;
}
}
return true;
}
return false;
}
示例12: _buildQuery
function _buildQuery()
{
$query = DBModel::getInstance();
$query->reset('BlogStatistics');
$query->setQualifier('blogid', 'equals', getBlogId());
if (isset($this->visits)) {
if (!Validator::number($this->visits, 0)) {
return $this->_error('visits');
}
$query->setAttribute('visits', $this->visits);
}
return $query;
}
示例13: getDefaultDBModelOnNotice
function getDefaultDBModelOnNotice($blogid)
{
$query = DBModel::getInstance();
$query->reset('Entries');
$query->setQualifier('blogid', 'equals', $blogid);
$query->setQualifier('draft', 'equals', 0);
if (!doesHaveOwnership()) {
$query->setQualifier('visibility', 'bigger', 1);
}
$query->setQualifier('category', 'equals', -2);
$query->setOrder('published', 'DESC');
return $query;
}
示例14: _buildQuery
function _buildQuery()
{
if (!Validator::directory($this->name)) {
return $this->_error('name');
}
$query = DBModel::getInstance();
$query->reset('Plugins');
$query->setQualifier('blogid', 'equals', getBlogId());
$query->setQualifier('name', 'equals', Utils_Unicode::lessenAsEncoding($this->name, 255), true);
if (isset($this->setting)) {
$query->setAttribute('settings', $this->setting, true);
}
return $query;
}
示例15: getEntriesByKeyword
function getEntriesByKeyword($blogid, $keyword)
{
$pool = DBModel::getInstance();
$pool->reset('Entries');
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->setQualifier('draft', 'eq', 0);
if (doesHaveOwnership()) {
$pool->setQualifier('visibility', 'b', 1);
}
$pool->setQualifier('category', 'beq', 0);
$pool->setQualifierSet(array('title', 'like', $keyword, true), 'OR', array('content', 'like', $keyword, true));
$pool->setOrder('published', 'DESC');
return $pool->getRow('id,userid,title,category,comments,published');
}