当前位置: 首页>>代码示例>>PHP>>正文


PHP DBModel类代码示例

本文整理汇总了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;
}
开发者ID:uning,项目名称:mall-back,代码行数:8,代码来源:config.php

示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:32,代码来源:index.php

示例3: actionGetAllNews

 public function actionGetAllNews()
 {
     $news = DBModel::getDB()->getAllNews();
     $view = new View();
     $view->setData($news);
     echo $view->render("main.php");
 }
开发者ID:ramiknexus7,项目名称:news,代码行数:7,代码来源:NewsController.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");
}
开发者ID:Avantians,项目名称:Textcube,代码行数:8,代码来源:service.php

示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:9,代码来源:checkup.php

示例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();
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:9,代码来源:Textcube.Control.Session.Memcached.php

示例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;
}
开发者ID:hinablue,项目名称:TextCube,代码行数:9,代码来源:blog.service.php

示例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');
}
开发者ID:ragi79,项目名称:Textcube,代码行数:9,代码来源:iphoneView.php

示例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;
 }
开发者ID:ni5am,项目名称:Textcube,代码行数:10,代码来源:Textcube.Data.ServiceSetting.php

示例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;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:54,代码来源:index.php

示例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');
 }
开发者ID:ragi79,项目名称:Textcube,代码行数:11,代码来源:Textcube.Core.php

示例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;
 }
开发者ID:ragi79,项目名称:Textcube,代码行数:11,代码来源:Textcube.Data.UserSetting.php

示例13: getDB

 public static function getDB()
 {
     if (self::$dbModel == null) {
         self::$dbModel = new self();
     }
     return self::$dbModel;
 }
开发者ID:ramiknexus7,项目名称:news,代码行数:7,代码来源:DBModel.php

示例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;
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:13,代码来源:PacsConfig.php

示例15: __construct

	protected function __construct($group, $key, $allowed)
	{
		parent::__construct();
		$this->groupID = $group;
		$this->keyID = $key;
		$this->allowed = $allowed;
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:7,代码来源:acl.model.php


注:本文中的DBModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。