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


PHP db::o方法代码示例

本文整理汇总了PHP中db::o方法的典型用法代码示例。如果您正苦于以下问题:PHP db::o方法的具体用法?PHP db::o怎么用?PHP db::o使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db的用法示例。


在下文中一共展示了db::o方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: count_content

 /**
  * Подсчёт кол-ва контента в данном месяце и в данном году
  * @param int $month данный месяц
  * @param int $year данный год
  * @return string JS массив кол-ва торрентов по дням
  */
 public function count_content($month = null, $year = null)
 {
     $month = !$month ? date("n") : $month;
     $year = !$year ? date("Y") : $year;
     if (!($r = cache::o()->read('calendar/c' . $month . '-' . $year))) {
         $year_after = $month == 12 ? $year + 1 : $year;
         $month_after = $month < 12 ? $month + 1 : 1;
         $from = mktime(null, null, null, $month, 1, $year);
         $to = mktime(null, null, null, $month_after, 1, $year_after);
         $datas = db::o()->p($from, $to)->query('SELECT posted_time FROM content 
             WHERE posted_time BETWEEN ? AND ?');
         //$count = count($datas);
         $content = array();
         while ($data = db::o()->fetch_assoc($datas)) {
             $day = date("j", $data["posted_time"]);
             $content[$day]++;
         }
         $ncontent = "";
         for ($i = 0; $i <= 31; $i++) {
             $ncontent .= ($ncontent !== "" ? ", " : "") . longval($content[$i]);
         }
         $r = array("new Array(" . $ncontent . ")");
         cache::o()->write($r);
     }
     return $r[0];
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:32,代码来源:calendar.php

示例2: __construct

 /**
  * Конструктор? А где конструктор? А нет его.
  * @return null 
  */
 private function __construct()
 {
     if (!$this->res) {
         $res = db::o()->query("SELECT * FROM stats");
         $this->res = db::o()->fetch2array($res, null, array("name" => "value"));
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:11,代码来源:class.stats.php

示例3: __construct

 /**
  * Инициализация файловых типов
  * @return null
  */
 public function __construct()
 {
     if (self::$inited) {
         return false;
     }
     self::$file_types = db::o()->cname('filetypes')->ckeys('name', 0)->query("SELECT * FROM allowed_ft");
     lang::o()->get("file");
     self::$inited = true;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:13,代码来源:class.uploader.php

示例4: init

 /**
  * Инициализация блока новостей
  * @return null
  */
 public function init()
 {
     if (!config::o()->mstate('news')) {
         return;
     }
     lang::o()->get('news');
     $l = (int) config::o()->v('news_max');
     $a = db::o()->cname('news')->query('SELECT n.*, u.username, u.group FROM news AS n
         LEFT JOIN users AS u ON u.id=n.poster_id
         ORDER BY n.posted_time DESC' . ($l ? ' LIMIT ' . $l : ""));
     tpl::o()->assign('rows', $a);
     tpl::o()->display('news/index.tpl');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:17,代码来源:news.php

示例5: init

 /**
  * Стат. страницы
  * @return null
  */
 public function init()
 {
     $url = $_GET['page'];
     $r = db::o()->p($url)->query('SELECT * FROM static WHERE url=? LIMIT 1');
     $row = db::o()->fetch_assoc($r);
     if (!$row) {
         furl::o()->location('');
     }
     $this->title = $row['title'];
     tpl::o()->assign('title', $row['title']);
     tpl::o()->assign('content', $row['content']);
     tpl::o()->assign('type', $row['type']);
     tpl::o()->display('static.tpl');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:18,代码来源:statics.php

示例6: edit_form

 /**
  * Метод редактирования комментария
  * @param int $id ID комментария
  * @return null
  */
 protected function edit_form($id)
 {
     $id = (int) $id;
     lang::o()->get('comments');
     $poster = db::o()->p($id)->query('SELECT poster_id, text FROM comments WHERE id=? LIMIT 1');
     $poster = db::o()->fetch_assoc($poster);
     if (!$poster) {
         return;
     }
     if ($poster['poster_id'] == users::o()->v('id')) {
         users::o()->check_perms('edit_comm');
     } else {
         users::o()->check_perms('edit_comm', 2);
     }
     $name = "comment_" . $id;
     tpl::o()->assign("text", $poster['text']);
     tpl::o()->assign("id", $id);
     tpl::o()->assign("name", $name);
     $this->comments->add("", $name, $id);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:25,代码来源:comments_manage.php

示例7: delete

 /**
  * Удаление стат. страницы
  * @param int $id ID страницы
  * @return null
  */
 public function delete($id)
 {
     $id = (int) $id;
     db::o()->p($id)->delete('static', 'WHERE id=? LIMIT 1');
     log_add('deleted_static', 'admin', $id);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:11,代码来源:spages.php

示例8: query_stat

/**
 * Вывод статистики по запросам
 * @return string HTML код
 */
function query_stat()
{
    if (!config::o()->v('show_process') || !users::o()->perm('acp', 2)) {
        return;
    }
    $r = "";
    foreach (db::o()->query_stat as $n => $stat) {
        $r .= "[" . ($n + 1) . "] => \n            <b><font color='" . ($stat['seconds'] > 0.01 ? "red" : "green") . "'>\n                " . $stat["seconds"] . "</font></b> [" . $stat["query"] . "]<br>";
    }
    return "<div class='query_stat'>" . $r . "</div>";
}
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:15,代码来源:functions_smarty.php

示例9: groups_autoupdate

 /**
  * Автоапдейт групп
  * @return null
  */
 public function groups_autoupdate()
 {
     $a = $k = array();
     try {
         plugins::o()->pass_data(array('update_columns' => &$this->update_columns), true)->run_hook('users_groups_autoupdate');
     } catch (PReturn $e) {
         return $e->r();
     }
     $cols = $this->update_columns;
     $c = count($cols);
     $w = array();
     foreach ($this->groups as $id => $group) {
         $t = false;
         for ($i = 0; $i < $c; $i++) {
             $v = $group[$cols[$i] . "_count"];
             if ($v) {
                 if (!$a[$i] || !in_array($v, $a[$i])) {
                     $a[$i][$k[$i]++] = $v;
                 }
                 $t = true;
             }
         }
         if ($t) {
             $w[] = $id;
         }
     }
     if (!$w) {
         return;
     }
     $w[] = $this->find_group('default');
     for ($i = 0; $i < $c; $i++) {
         if ($a[$i]) {
             sort($a[$i]);
         }
     }
     foreach ($this->groups as $id => $group) {
         $where = "";
         for ($i = 0; $i < $c; $i++) {
             if (!$a[$i]) {
                 continue;
             }
             $e = $cols[$i] . "_count";
             $v = $group[$e];
             if (($j = array_search($v, $a[$i])) !== false) {
                 db::o()->p($v);
                 $where .= ($where ? " AND " : "") . "`" . $e . "`>=?";
                 if ($a[$i][++$j]) {
                     db::o()->p($a[$i][$j]);
                     $where .= " AND `" . $e . "`<?";
                 }
             }
         }
         if (!$where) {
             continue;
         }
         db::o()->p($w)->update(array("group" => $id), "users", "WHERE " . $where . " AND `group` IN (@" . count($w) . '?)');
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:62,代码来源:class.users.php

示例10: select4insert

 /**
  * Выборка и вставка значений из таблицы
  * @param string $table имя таблицы вставки
  * @param string $orderby сортировка таблицы выборки
  * @param string $ftable имя таблицы выборки
  * @param string $cond условие для выборки
  * @param int $limit ограничение
  * @param bool $noerr без ошибок?
  * @return bool статус выбокри/вставки
  */
 private function select4insert($table, $orderby, $ftable, $cond, $limit, $noerr = false)
 {
     $query = "SELECT ";
     $c = count($this->columns);
     for ($i = 0; $i < $c; $i++) {
         $query .= ($i ? ', ' : '') . $this->columns[$i];
     }
     $orderby = '`' . implode('`, `', array_map('trim', explode(',', $orderby))) . '`';
     $query .= " FROM `" . $this->db . "`.`" . $this->prefix . $ftable . "`" . ($cond ? " WHERE " . $cond : "") . "\n            ORDER BY " . $orderby . "\n            LIMIT " . $limit . ',' . $this->peronce;
     $r = db::o()->no_error()->no_parse()->query($query);
     if (db::o()->errno()) {
         printf(lang::o()->v('convert_select_error'), $ftable, db::o()->errno(), db::o()->errtext());
         if ($noerr) {
             return false;
         } else {
             die;
         }
     }
     while ($row = db::o()->fetch_assoc($r)) {
         db::o()->ignore()->insert($this->insert($row), $table, true);
     }
     db::o()->no_error()->save_last_table();
     if (db::o()->errno()) {
         printf(lang::o()->v('convert_insert_error'), $table, db::o()->errno(), db::o()->errtext());
         if ($noerr) {
             return false;
         } else {
             die;
         }
     }
     printf(lang::o()->v('convert_inserted_table'), $limit, $limit + $this->peronce - 1, $table, $ftable);
     return true;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:43,代码来源:convert.php

示例11: load

 /**
  * Загрузка полей
  * @return null
  */
 protected function load()
 {
     if (self::$fields) {
         return;
     }
     self::$fields = db::o()->cname('userfields')->ckeys('field')->query('SELECT * FROM users_fields');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:11,代码来源:class.userfields.php

示例12: uninstall

 /**
  * Удаление плагина
  * @param bool $replaced было ли успешно ВСЁ замененённое сохранено?
  * @return null
  */
 public function uninstall($replaced = false)
 {
     db::o()->no_error()->query("ALTER TABLE `users` DROP `converted`");
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:9,代码来源:plugin.convert_cyberhype.php

示例13: save_order

 /**
  * Сохранение порядка блоков
  * @return null
  * @throws EngineException
  */
 public function save_order($sort)
 {
     if (!$sort) {
         throw new EngineException();
     }
     foreach ($sort as $p => $obj) {
         foreach ($obj as $s => $id) {
             $id = (int) $id;
             db::o()->p($id)->update(array('pos' => (int) $s, 'type' => blocks_man::$types[$p]), 'blocks', 'WHERE id=? LIMIT 1');
         }
     }
     db::o()->query('ALTER TABLE `blocks` ORDER BY `pos`');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:18,代码来源:blocks.php

示例14: save

 /**
  * Сохранение настроек плагина
  * @param array $data массив данных
  * @return null
  * @throws EngineException 
  */
 protected function save($data)
 {
     $admin_file = globals::g('admin_file');
     $id = $data['id'];
     $settings = serialize(modsettings::o()->save($id, $data));
     db::o()->p($id)->update(array('settings' => $settings), 'plugins', 'WHERE file=? LIMIT 1');
     plugins::o()->manager->uncache();
     furl::o()->location($admin_file);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:15,代码来源:plugins.php

示例15: die

 * @version           	1.00
 */
if (!defined('INSITE')) {
    die('Remote access denied!');
}
require_once ROOT . 'include/system/allowed.php';
require_once ROOT . 'include/system/globals.php';
require_once ROOT . 'include/system/autoload.php';
require_once ROOT . 'include/functions.php';
globals::s('start', timer());
// Start time
require_once ROOT . 'include/smarty/Smarty.class.php';
require_once ROOT . 'include/functions_smarty.php';
@set_error_handler("myerror_report");
// Присваиваем функцию myerror_report, вместо стандартной, помогает избежать раскрытия путей.
db::o()->connect();
init_baseurl();
lang::o()->change_folder(config::o()->v('default_lang'));
init_spaths();
tpl::o()->register_modifier('lang', array(lang::o(), 'v'));
// языковая переменная
tpl::o()->register_modifier('getlang', array(lang::o(), 'get'));
// подключение языка прямо в шаблоне
tpl::o()->register_modifier('islang', array(lang::o(), 'visset'));
// языковая переменная
tpl::o()->register_modifier('config', array(config::o(), 'v'));
// конфиг. переменная
tpl::o()->register_modifier('mstate', array(config::o(), 'mstate'));
// разрешён ли модуль
tpl::o()->register_modifier('perm', array(users::o(), "perm"));
// проверка на права
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:31,代码来源:core.php


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