本文整理汇总了PHP中DBModel类的典型用法代码示例。如果您正苦于以下问题:PHP DBModel类的具体用法?PHP DBModel怎么用?PHP DBModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModel
function getModel($name)
{
global $db;
$m = new DBModel($name, false);
$m->setDb($db);
$m->useCache(false);
return $m;
}
示例2: 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;
}
示例3: actionGetAllNews
public function actionGetAllNews()
{
$news = DBModel::getDB()->getAllNews();
$view = new View();
$view->setData($news);
echo $view->render("main.php");
}
示例4: 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");
}
示例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: 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;
}
示例8: 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');
}
示例9: _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;
}
示例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: 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');
}
示例12: _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;
}
示例13: getDB
public static function getDB()
{
if (self::$dbModel == null) {
self::$dbModel = new self();
}
return self::$dbModel;
}
示例14: __construct
/**
* constructor
* @param \Nette\Database\Context $database
* @param int $id
* @return void
*/
public function __construct(\Nette\Database\Context $database, $config)
{
parent::__construct($database, $config);
$this->setTable($this->config["table"]);
$this->defaultValues = $this->config["default"];
return;
}
示例15: __construct
protected function __construct($group, $key, $allowed)
{
parent::__construct();
$this->groupID = $group;
$this->keyID = $key;
$this->allowed = $allowed;
}