當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。