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


PHP users::o方法代码示例

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


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

示例1: execute

 /**
  * Выполнение очистки сайта
  * @param bool $force выполнять клинап вне зависимости от времени
  * @return null
  */
 public function execute($force = false)
 {
     if (!longval(config::o()->v('cleanup_each'))) {
         return;
     }
     $hour = 3600;
     // Секунд в часу
     $time = stats::o()->read('last_cleanup');
     if (!$force && time() < $time + config::o()->v('cleanup_each') * $hour) {
         return;
     }
     stats::o()->write('last_cleanup', time());
     users::o()->admin_mode();
     users::o()->set_tmpvars(array('id' => -1));
     /* @var $mailer mailer */
     $mailer = n("mailer");
     $mailer->change_type('content')->cleanup();
     $mailer->change_type('categories')->cleanup();
     /* @var $attach attachments */
     $attach = n("attachments");
     $attach->clear();
     users::o()->groups_autoupdate();
     foreach ($this->methods as $m) {
         $this->call_method('clear_' . $m);
     }
     users::o()->remove_tmpvars();
     users::o()->admin_mode(false);
     //cache::o()->clear_ocache(config::o()->v('cache_oldtime') * 3600);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:34,代码来源:class.cleanup.php

示例2: add

 /**
  * Добавление/редактирование группы
  * @param int $id ID группы
  * @param bool $add добавление?
  * @param bool $onlyperms только права?
  * @return null
  * @throws EngineException
  */
 public function add($id, $add = false, $onlyperms = false)
 {
     if (is_array($id) && $onlyperms) {
         $row = $id;
     } else {
         $row = users::o()->get_group($id);
     }
     if (!$row) {
         throw new EngineException();
     }
     users::o()->acp_modules($row);
     tpl::o()->assign('id', $add ? 0 : $id);
     tpl::o()->assign('row', $row);
     $r = db::o()->query('SELECT cat FROM groups_perm GROUP BY cat');
     tpl::o()->assign('types', db::o()->fetch2array($r, null, array('cat')));
     $r = db::o()->query('SELECT cat, perm, allowed FROM groups_perm');
     $perms = null;
     while ($row = db::o()->fetch_assoc($r)) {
         $perms[$row["cat"]][] = $row;
     }
     tpl::o()->assign('perms', $perms);
     tpl::o()->assign('allowed_modules', allowed::o()->get("acp_modules"));
     tpl::o()->register_modifier('show_selector', array($this, 'show_selector'));
     tpl::o()->display('admin/groups/' . ($onlyperms ? 'perms' : 'add') . '.tpl');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:33,代码来源:groups.php

示例3: init

 /**
  * Инициализация чата
  * @return null
  */
 public function init()
 {
     if (!users::o()->perm('chat')) {
         return;
     }
     if (!config::o()->mstate('chat')) {
         return;
     }
     lang::o()->get("blocks/chat");
     tpl::o()->display('chat/index.tpl');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:15,代码来源:chat.php

示例4: init

 /**
  * Функция вызова captcha
  * @return null
  */
 public function init()
 {
     $background = 'include/backgrounds/' . $this->bckgrnds[rand(0, count($this->bckgrnds) - 1)];
     $code = mb_strtoupper(users::o()->generate_salt(6));
     if (!$_SESSION['captcha_key']) {
         $_SESSION['captcha_key'] = array();
     }
     array_unshift($_SESSION['captcha_key'], $code);
     unset($_SESSION['captcha_key'][self::capacity]);
     /* @var $uploader uploader */
     $uploader = n("uploader");
     $uploader->watermark($background, $code, 'auto', false, '', 'cc', true, false);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:17,代码来源:class.captcha.php

示例5: users_init

/**
 * Инициализация юзерей
 * @return null
 */
function users_init()
{
    users::o()->init();
    if (!defined("DELAYED_SINIT")) {
        users::o()->write_session();
    }
    tpl::o()->assign('groups', users::o()->get_group());
    tpl::o()->assign('curlang', users::o()->get_lang());
    tpl::o()->assign('curtheme', users::o()->get_theme());
    tpl::o()->assign('curtheme_color', users::o()->get_theme(true));
    tpl::o()->assign('curuser', users::o()->v('username'));
    tpl::o()->assign('curgroup', users::o()->v('group'));
}
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:17,代码来源:init.php

示例6: init

 /**
  * Инициализация блока контента
  * @return null
  */
 public function init()
 {
     lang::o()->get("content");
     if (!users::o()->perm('content')) {
         return;
     }
     /* @var $content content */
     $content = plugins::o()->get_module("content");
     if (!is_callable(array($content, "show"))) {
         return;
     }
     tpl::o()->assign('content_in_block', true);
     $content->show();
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:18,代码来源:content.php

示例7: init

 /**
  * Инициализация блока-торрентов
  * @return null
  */
 public function init()
 {
     if (!config::o()->v('torrents_on')) {
         return;
     }
     lang::o()->get("blocks/content");
     if (!users::o()->perm('content')) {
         return;
     }
     $curcats = $this->settings['cats'];
     if (!$curcats) {
         return;
     }
     print "Torrents block inited";
     $this->get_children($curcats);
     tpl::o()->assign('curcats', array_reverse($curcats));
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:21,代码来源:torrents.php

示例8: 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

示例9: init

 /**
  * Инициализация Ajax-части нижнего блока
  * @return null
  */
 public function init()
 {
     lang::o()->get("blocks/downm");
     switch ($_GET["act"]) {
         case "content":
             users::o()->check_perms("content", 1, 2);
             $sticky = isset($_GET["sticky"]) ? (bool) $_GET["sticky"] : true;
             $this->show_content($sticky);
             break;
         case "comments":
             users::o()->check_perms('comment', 1, 2);
             /* @var $comments comments */
             $comments = n("comments");
             $comments->usertable();
             break;
         default:
             users::o()->check_perms('profile', 1, 2);
             $this->show_online();
             break;
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:25,代码来源:downm.php

示例10: quick_edit

 /**
  * Форма быстрого редактирования контента
  * @param int $id ID контента
  * @return null
  * @throws EngineException
  */
 protected function quick_edit($id)
 {
     lang::o()->get("content");
     $cols = $lj = $where = "";
     if ($this->tstate) {
         $cols = ', t.*';
         $lj = ' LEFT JOIN content_torrents AS t ON t.cid=c.id';
         $where = " AND (t.banned <> '2' OR t.banned IS NULL)";
     }
     $row = db::o()->p($id)->query('SELECT c.* ' . $cols . ' FROM content AS c ' . $lj . '
         WHERE  c.id=?' . $where . ' LIMIT 1');
     $row = db::o()->fetch_assoc($row);
     if (!$row) {
         throw new EngineException();
     }
     if (users::o()->v('id') == $row['poster_id']) {
         users::o()->check_perms('edit_content');
     } else {
         users::o()->check_perms('edit_content', '2');
     }
     tpl::o()->assign('row', $row);
     tpl::o()->display('content/edit.tpl');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:29,代码来源:content.php

示例11: pcre_callback_hide

 /**
  * Обработка значений для preg_replace_callback тега hide
  * @param array $matches входящий массив парсенной строки
  * @param bool $rss RSS?
  * @return string HTML код
  */
 protected function pcre_callback_hide($matches, $rss = false)
 {
     $vars = array();
     if (users::o()->v()) {
         if ($matches[1]) {
             $matches[1] = longval(trim($matches[1]));
             if ($matches[1] <= users::o()->v('content_count')) {
                 return $matches[3];
             }
             if (!$rss) {
                 $vars = array($matches[1], users::o()->v('content_count'));
                 $text = "hidden_need_content_you_have";
             }
         } elseif ($matches[2]) {
             $grps = array_map('longval', explode(",", $matches[2]));
             $c = count($grps);
             for ($i = 0; $i < $c; $i++) {
                 if (!users::o()->get_group($grps[$i])) {
                     continue;
                 }
                 if (!$rss) {
                     $pretext .= ($pretext ? ", " : "") . display::o()->user_group_color($grps[$i]);
                 }
                 if (users::o()->v('group') == $grps[$i]) {
                     return $matches[3];
                 }
             }
             if (!$rss) {
                 $vars = array($pretext, display::o()->user_group_color(users::o()->v('group')));
                 $text = "hidden_group_to_see";
             }
         } else {
             return $matches[3];
         }
     }
     if (!$rss) {
         $text = "hidden_register_to_see";
     }
     //else
     //    return $matches[3];
     if (!$rss) {
         if (!$vars) {
             $vars = furl::o()->construct("registration");
         }
         ob_start();
         /* @var $m message */
         $m = n("message");
         $m->stitle("hidden_text")->sonly_box()->info($text, $vars);
         $cont = ob_get_contents();
         ob_end_clean();
         return $cont;
     }
     return lang::o()->v('hidden_text');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:60,代码来源:class.bbcodes.php

示例12: timer

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"));
// проверка на права
tpl::o()->register_modifier('user', array(users::o(), "v"));
// поле юзера
/**
 * Не смей удалять копирайт ниже, а то дядя Ваня тебя покарает своим большим чёрным банхаммером.
 */
tpl::o()->assign("copyright", "Powered by <a href=\"http://ctrev.cyber-tm.ru/\" title=\"Go to the official site of CTRev\">CTRev v." . ENGINE_VERSION . ' ' . ENGINE_STAGE . "</a> &copy; <a href=\"http://cyber-tm.ru\" title=\"Go to the official site of Cyber-Team\">Cyber-Team</a> 2008-2012");
tpl::o()->assign("designed_by", "Дизайн сайта разработал <u>А. Воробей</u>. All Rights Reserved.");
//tpl::o()->assign_by_ref('config', $CONFIG);
require_once ROOT . 'include/init.php';
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:31,代码来源:core.php

示例13: usertable

 /**
  * Отображение комментариев пользователя/пользователей
  * @param int $id ID пользователя
  * @param string $where доп. условие
  * @return null
  */
 public function usertable($id = null, $where = null)
 {
     lang::o()->get('profile');
     if (!$this->state) {
         disabled(false);
         return false;
     }
     if (!users::o()->perm('comment')) {
         n("message")->stype("error")->info('comment_you_cannt_view');
         return;
     }
     $id = (int) $id;
     $select = "c.id,c.posted_time,c.type,c.toid";
     if (!$id) {
         $select .= ",c.poster_id";
     }
     $where = $id ? 'c.poster_id=' . $id : ($where ? $where : '');
     $comm_row = db::o()->no_parse()->query('SELECT ' . $select . (!$id ? ",u.username,u.group" : "") . '
         FROM ' . db::table('comments') . ' AS c
         ' . (!$id ? 'LEFT JOIN ' . db::table('users') . ' AS u ON c.poster_id=u.id' : '') . '
         ' . ($where ? " WHERE " . $where : "") . '
         ORDER BY c.posted_time DESC
         LIMIT ' . config::o()->v('last_profile_comments'));
     $cr = array();
     while ($rows = db::o()->fetch_assoc($comm_row)) {
         $res = db::o()->p($rows["toid"])->query('SELECT ' . $this->title_cols[$rows["type"]] . ' AS title
             FROM ' . $rows["type"] . ' WHERE id=? LIMIT 1');
         $res = db::o()->fetch_assoc($res);
         $rows["title"] = $res["title"];
         $cr[] = $rows;
     }
     tpl::o()->assign("comm_row", $cr);
     tpl::o()->display("profile/last_comments.tpl");
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:40,代码来源:class.comments.php

示例14: check_dict

 /**
  * Проверка dict перед записью
  * @param string $t путь к файлу торрента
  * @param array $filelist список файлов
  * @param int $filesize размер файла
  * @param array $announce_list список аннонсеров
  * @return array массив из словаря и раздела info словаря
  * @throws EngineException 
  */
 protected function check_dict($t, &$filelist = null, &$filesize = null, &$announce_list = null)
 {
     $dict = $this->bdec($t, true);
     if (!$dict) {
         throw new EngineException('bencode_cant_parse_file');
     }
     list($info) = $this->dict_check($dict, "info");
     list($filelist, $filesize) = $this->dict_filelist($info);
     $idict =& $dict['info'];
     if (config::o()->v('DHT_on') == 0) {
         $idict['private'] = 1;
     } elseif (config::o()->v('DHT_on') == 1) {
         unset($idict['private']);
     }
     // не меняем, если -1
     $announce_list = $this->announce_lists($dict);
     $announce_list = serialize($announce_list);
     // удаляем излишки
     unset($dict['nodes']);
     unset($idict['crc32']);
     unset($idict['ed2k']);
     unset($idict['md5sum']);
     unset($idict['sha1']);
     unset($idict['tiger']);
     unset($dict['azureus_properties']);
     $dict['publisher.utf-8'] = $dict['publisher'] = $dict['created by'] = users::o()->v('username');
     $dict['publisher-url.utf-8'] = $dict['publisher-url'] = furl::o()->construct("users", array("user" => users::o()->v('username'), 'noencode' => true));
     return array($dict, $idict);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:38,代码来源:class.bittorrent.php

示例15: vote

 /**
  * Голосование в опросе
  * @param int $poll_id ID опроса
  * @param integer|array $answers ответы
  * @return bool true, в случае успешного завершения
  * @throws EngineException 
  */
 public function vote($poll_id, $answers)
 {
     if (!$this->state) {
         return;
     }
     users::o()->check_perms('polls', 1, 2);
     $poll_id = (int) $poll_id;
     if (!$answers) {
         throw new EngineException('polls_so_much_votes');
     }
     $answers = (array) (is_array($answers) ? array_map('intval', $answers) : array(longval($answers)));
     $user_id = (int) users::o()->v('id');
     $user_ip = users::o()->get_ip();
     $day = 60 * 60 * 24;
     $row = db::o()->p($user_id ? $user_id : $user_ip, $poll_id)->query('SELECT p.*,
         pv.question_id, pv.user_ip, pv.user_id FROM polls AS p
         LEFT JOIN poll_votes AS pv ON pv.question_id=p.id AND ' . ($user_id ? 'pv.user_id = ?' : 'pv.user_id=0 AND pv.user_ip = ?') . '
         WHERE p.id = ? LIMIT 1');
     $row = db::o()->fetch_assoc($row);
     if (!$row) {
         throw new EngineException();
     }
     if ((!$row['change_votes'] || !users::o()->v()) && $row['question_id']) {
         throw new EngineException('polls_you_re_voted');
     }
     if ($row['max_votes'] < count($answers) || !$answers) {
         throw new EngineException('polls_so_much_votes');
     }
     if ($row["poll_ends"]) {
         if (time() - $row["posted_time"] > $row["poll_ends"] * $day) {
             throw new EngineException('polls_already_ends');
         }
     }
     $update = array('answers_id' => serialize($answers));
     try {
         plugins::o()->pass_data(array("row" => &$row), true)->run_hook('polls_vote');
     } catch (PReturn $e) {
         return $e->r();
     }
     if (!$row['question_id']) {
         $update['user_id'] = $user_id;
         $update['question_id'] = $poll_id;
         $update['user_ip'] = $user_ip;
         db::o()->insert($update, 'poll_votes');
     } else {
         db::o()->p($row["user_id"], $row["user_ip"], $row['question_id'])->update($update, 'poll_votes', 'WHERE user_id = ?
                 AND user_ip = ? AND question_id=? LIMIT 1');
     }
     $this->uncache($poll_id, true);
     return true;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:58,代码来源:class.polls.php


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