• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中DBModel的典型用法代码示例。如果您正苦于以下问题:PHP DBModel类的具体用法?PHP DBModel怎么用?PHP DBModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了DBModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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;
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:52,代码来源:Textcube.Data.BlogSetting.php


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


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


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


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


示例18: activate

	public function activate()
	{
		if ($this->_list !== null) {return false;}
		
		list ($qs, $args) = $this->getSQLQuery();
		$q = DB::prepare($qs);
		$q->execute($args);
		$this->_list = array();
		$this->rewind();
		foreach ($q->fetchAll() as $row)
		{
			$this->_list[] = DBModel::fetch($row, $this->_from);
		}
		return true;
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:15,代码来源:manycollection.class.php


示例19: suggestLocatives

function suggestLocatives($blogid, $filter)
{
    $pool = DBModel::getInstance();
    $pool->reset("Entries");
    $pool->setQualifier("blogid", "eq", $blogid);
    $pool->setQualifier("location", "like", $filter . '%', true);
    $pool->setGroup("location");
    $pool->setOrder("cnt", "desc");
    $pool->setLimit(10);
    $result = $pool->getAll("location, COUNT(*) cnt", array("filter" => "distinct"));
    $locatives = array();
    if ($result) {
        foreach ($result as $locative) {
            $locatives[] = $locative[0];
        }
    }
    return $locatives;
}
开发者ID:webhacking,项目名称:Textcube,代码行数:18,代码来源:locative.php


示例20: _getRecentEntries

function _getRecentEntries($blogid)
{
    $query = DBModel::getInstance();
    $query->reset('Entries');
    $query->setQualifier('blogid', 'equals', $blogid);
    $query->setQualifier('draft', 'equals', 0);
    if (doesHaveOwnership()) {
        $query->setQualifier('visibility', 'bigger', 0);
    }
    $query->setQualifier('category', 'bigger or same', 0);
    $query->setLimit(8);
    $query->setOrder('published', 'desc');
    $result = $query->getAll('id,title,comments');
    if (!empty($result)) {
        return $result;
    } else {
        return array();
    }
}
开发者ID:Avantians,项目名称:Textcube,代码行数:19,代码来源:index.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DBObject类代码示例发布时间:2022-05-23
下一篇:
PHP DBManagerFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap