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


PHP System::database方法代码示例

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


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

示例1: SmiliesReplace

/**
 * Парсер смайликов.
 * @param  $text
 * @return void
 */
function SmiliesReplace(&$text)
{
    static $codes = null;
    if (!isset($codes)) {
        $codes = array();
        $smilies_dir = System::config('general/smilies_dir');
        $smilies = System::database()->Select('smilies');
        // Пусть отключенные смайлики тоже парсятся
        foreach ($smilies as $smile) {
            $sub_codes = explode(',', $smile['code']);
            $smile_file = SafeDB($smile['file'], 255, str);
            if ($smile['desc'] != '') {
                $title = SafeDB($smile['desc'], 255, str);
            } else {
                $title = SafeDB(GetFileName($smile_file, true), 255, str);
            }
            foreach ($sub_codes as $code) {
                $code = trim($code);
                if ($code != '') {
                    $codes[$code] = '<img src="' . RealPath2($smilies_dir . $smile_file) . '" title="' . $title . '">';
                }
            }
        }
    }
    $text = strtr($text, $codes);
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:31,代码来源:smilies.php

示例2: IndexForumEditTopic

function IndexForumEditTopic()
{
    global $forum_lang;
    if (!System::user()->Auth) {
        System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['error_auth'] . '</p>');
        return;
    }
    $topic = SafeEnv($_GET['topic'], 11, int);
    $post = System::database()->Select('forum_posts', "`object`='{$topic}' and `delete`='0'");
    SortArray($post, 'id', false);
    System::database()->Select('forum_topics', "`id`='{$topic}'");
    $topic = System::database()->FetchRow();
    if ($topic['delete'] == 0 || System::config('forum/basket') == false) {
        $title = '';
        if (SafeDB($topic['starter_id'], 11, str) == System::user()->Get('u_id') or System::user()->IsAdmin()) {
            $title = SafeDB($topic['title'], 0, str);
        }
        if (System::user()->Get('u_id') == $post[0]['user_id'] || System::user()->isAdmin()) {
            ForumRenderPostForm(true, 0, SafeEnv($_GET['topic'], 11, int), SafeDB($post[0]['id'], 11, int), SafeDB($post[0]['message'], 0, str, false, true), $title);
        } else {
            System::site()->AddTextBox($forum_lang['forum'], '<p align="center">' . $forum_lang['no_right_comment_edit'] . '</p>');
            return;
        }
    } else {
        System::site()->AddTextBox($forum_lang['topic_basket_current_post'], '<p align="center">' . $forum_lang['topic_basket_post'] . '<br><input type="button" value="' . $forum_lang['back'] . '"onclick="history.back();"></p>');
    }
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:27,代码来源:edittopic.php

示例3: getconf_TemplatesList

function getconf_TemplatesList($name)
{
    $r = array();
    $templates = System::database()->Select('templates', "`admin`='0'");
    foreach ($templates as $t) {
        $r[] = array(SafeDB($t['folder'], 255, str), SafeDB($t['name'], 255, str));
    }
    return $r;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:9,代码来源:index.php

示例4: IndexForumMarkRead

function IndexForumMarkRead()
{
    $mark_forums = array();
    // Форумы на которых устанавливать метки
    $forums_tree = ForumTree::Instance();
    if (isset($_GET['forum'])) {
        // Только внутри определённого форума
        $forum = SafeDB($_GET['forum'], 11, int);
        $mark_forums = $forums_tree->GetAllAccessForumId($forum);
    } else {
        // На всех форумах
        $mark_forums = $forums_tree->GetAllAccessForumId();
    }
    $user_id = System::user()->Get('u_id');
    if (System::user()->Auth) {
        // Загружаем данные о прочтении тем пользователем
        $read_data = Forum_Marker_GetReadData();
        // Загружаем топики (агрегированы по forum_id)
        $topics = ForumCacheGetTopics();
        $del_where = '';
        $insert_values = array();
        $time = time();
        foreach ($mark_forums as $forum_id) {
            if (!isset($topics[$forum_id])) {
                continue;
            }
            foreach ($topics[$forum_id] as $topic) {
                $tid = SafeEnv($topic['id'], 11, int);
                // Не прочитана или метка устарела
                if (!isset($read_data[$topic['id']])) {
                    $insert_values[] = "'{$user_id}','{$tid}','{$time}'";
                    // Добавить новую метку
                } elseif ($read_data[$topic['id']]['date'] < $topic['last_post']) {
                    $del_where .= "(`tid`='{$tid}' and `mid`= '{$user_id}') or ";
                    // Удалить текущую метку
                    $insert_values[] = "'{$user_id}','{$tid}','{$time}'";
                    // Добавить новую метку
                }
            }
        }
        // Удаляем устаревшие метки
        if ($del_where != '') {
            $del_where = substr($del_where, 0, -4);
            // Удаляем .or.
            System::database()->Delete('forum_topics_read', $del_where);
        }
        // Добавляем новые метки
        // TODO: В будущем нужно перейти на InnoDB и использовать транзакции как в MySQL так и в FilesDB.
        if (count($insert_values) > 0) {
            foreach ($insert_values as $vals) {
                System::database()->Insert('forum_topics_read', $vals);
            }
        }
    }
    GO(GetSiteUrl() . Ufu('index.php?name=forum' . (isset($forum) ? '&op=showforum&forum=' . $forum : ''), 'forum/' . (isset($forum) ? '{forum}/' : '')));
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:56,代码来源:markread.php

示例5: getconf_Polls_list

function getconf_Polls_list($name)
{
    $polls = System::database()->Select('polls', "`showinblock`='1'");
    $polls_cnt = count($polls);
    $polls_data = array();
    for ($i = 0; $i < $polls_cnt; $i++) {
        $polls_data[] = array($polls[$i]['id'], $polls[$i]['question']);
    }
    return $polls_data;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:10,代码来源:index.php

示例6: init

 /**
  * Initialises the system
  * @static
  */
 public static function init()
 {
     self::redirectHTTPS();
     Router::getInstance()->init(HOST_PATH, MOD_REWRITE);
     self::$database = new Database('mysql:dbname=' . DATABASE_NAME . ';host=' . DATABASE_HOST, DATABASE_USER, DATABASE_PASS);
     self::$session = new Session();
     self::$user = System::getSession()->getUID() != NULL ? User::find('_id', System::getSession()->getUID()) : NULL;
     self::$language = new L10N(System::getUser() != NULL ? System::getUser()->lang : LANGUAGE);
     self::buildNavigation();
 }
开发者ID:nicefirework,项目名称:sharecloud,代码行数:14,代码来源:System.class.php

示例7: getconf_Pages

function getconf_Pages($name)
{
    global $config;
    $pages = System::database()->Select('pages', "`enabled`='1' and `type`='page'");
    $r = array();
    foreach ($pages as $page) {
        $r[] = array(SafeEnv($page['link'], 255, str), SafeEnv($page['title'], 255, str));
    }
    return $r;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:10,代码来源:index.php

示例8: PluginsGetInstalled

/**
 * Загружает информацию об установленных подключаемых плагинах из базы данных и возвращает результат.
 * Кэшируется.
 * @return array
 */
function PluginsGetInstalled()
{
    static $plugins = null;
    if (System::cache()->HasCache(system_cache, 'plugins')) {
        $plugins = System::cache()->Get(system_cache, 'plugins');
    }
    if (!isset($plugins)) {
        $plugins = System::database()->Select('plugins', "(`type`='5' or `type`='7') and `enabled`='1'");
        System::cache()->Write(system_cache, 'plugins', $plugins, Day2Sec);
    }
    return $plugins;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:17,代码来源:plugins.php

示例9: CalcMailCounter

function CalcMailCounter($topic_id, $inc)
{
    System::database()->Select('mail_topics', "`id`='" . $topic_id . "'");
    $topic = System::database()->FetchRow();
    if ($inc == true) {
        $counter_val = $topic['send_count'] + 1;
        $date = ",last_send='" . time() . "'";
    } else {
        $counter_val = $topic['send_count'] - 1;
        $date = '';
    }
    System::database()->Update('mail_topics', "send_count='" . $counter_val . "'" . $date, "`id`='" . $topic_id . "'");
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:13,代码来源:functions.php

示例10: getconf_MainModules

function getconf_MainModules($name)
{
    // В $name имя элемента настройки вызвавшей функцию для своего заполнения.
    global $config;
    $mods = System::database()->Select('modules', "`isindex`='1'");
    $r = array();
    for ($i = 0, $cnt = count($mods); $i < $cnt; $i++) {
        // 1 значение,
        // 2 надпись которую будет видеть пользователь
        $r[] = array($mods[$i]['folder'], $mods[$i]['name']);
    }
    return $r;
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:13,代码来源:index.php

示例11: IndexForumSubscription

function IndexForumSubscription()
{
    global $forum_lang;
    $forums_tree = ForumTree::Instance();
    // Проверки на доступ
    if (CheckGet('topic')) {
        // Тема
        $topic_id = SafeEnv($_GET['topic'], 11, int);
        System::database()->Select('forum_topics', "`id`='{$topic_id}'");
        if (System::database()->NumRows() > 0) {
            $topic = System::database()->FetchRow();
        } else {
            System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_access_category']);
            return;
        }
        if ($topic['delete'] == '1') {
            // Тема на удалении
            System::site()->AddTextBox($forum_lang['error'], $forum_lang['topic_basket'] . '.' . $forum_lang['no_topic_basket_edit']);
            return;
        }
        if ($topic['close_topics'] == '1') {
            // Тема закрыта
            System::site()->AddTextBox($forum_lang['error'], $forum_lang['topic_close_for_discussion'] . '.' . $forum_lang['no_create_new_message_current_topic_add']);
            return;
        }
        // Форум
        $forum_id = SafeEnv($topic['forum_id'], 11, int);
        if (!isset($forums_tree->IdCats[$forum_id])) {
            System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_data']);
            return;
        }
        $forum_config = $forums_tree->GetForumConfigRecursive($forum_id);
        if (!$forum_config['access']) {
            // Доступ
            System::site()->AddTextBox($forum_lang['error'], $forum_config['access_reason']);
            return;
        } elseif (!$forum_config['new_message_email']) {
            // Разрешено ли подписываться на новые сообщения (+ защита от гостей)
            System::site()->AddTextBox($forum_lang['error'], $forum_config['add_post_reason']);
            return;
        }
    } else {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_data']);
        return;
    }
    Forum_Subscription($topic_id);
    // Подписка (обратное действие, если пользователь уже подписан)
    GO(Ufu('index.php?name=forum&op=showtopic&topic=' . $topic_id . '&view=lastpost', 'forum/topic{topic}-new.html'));
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:49,代码来源:subscription.php

示例12: AuditWriteReferer

/**
 * Записывает реферал в базу данных.
 * @param $referer
 */
function AuditWriteReferer($referer)
{
    if (trim($referer) != '' && !IsMainHost($referer)) {
        $referer = SafeEnv(Url($referer), 255, str);
        $count = 1;
        System::database()->Select('referers', "`referer`='{$referer}'");
        if (System::database()->NumRows() > 0) {
            $ref = System::database()->FetchRow();
            $count = SafeDB($ref['count'], 11, int);
            $count++;
            System::database()->Update('referers', "count='{$count}'", "`referer`='{$referer}'");
        } else {
            $values = Values('', $referer, $count);
            System::database()->Insert('referers', $values);
        }
    }
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:21,代码来源:audit.php

示例13: IndexForumCloseTopic

function IndexForumCloseTopic()
{
    if (!System::user()->isAdmin()) {
        HackOff();
        return;
    }
    if (CheckGet('topic')) {
        $topic_id = SafeEnv($_GET['topic'], 11, int);
    } else {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_data']);
        return;
    }
    System::database()->Select('forum_topics', "`id`='{$topic_id}'");
    $topic = System::database()->FetchRow();
    $forum_id = SafeDB($topic['forum_id'], 11, int);
    System::database()->Update('forum_topics', "`close_topics`='1'", "`id`='{$topic_id}'");
    GO(Ufu('index.php?name=forum&op=showforum&forum=' . $forum_id, 'forum/{forum}/'));
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:18,代码来源:closetopic.php

示例14: LoadOnline

 public function LoadOnline($MainPage = false)
 {
     if (!$this->online_load) {
         $onlinerows = System::database()->Select('forum_online');
         $this->OnlineCount = count($onlinerows);
         $this->MainPage = $MainPage;
         if ($MainPage) {
             $levels = array(1 => 'admins', 2 => 'members', 3 => 'guests');
             $this->AllOnline = array('admins' => array(), 'members' => array(), 'guests' => array(), 'count' => $this->OnlineCount);
         }
         $online_cat = array();
         // Онлайн пользователи агрегированные по категориям
         $online_topic = array();
         // Онлайн пользователи агнегированные по топикам
         $cat_topics_id = array();
         foreach ($onlinerows as $row) {
             if ($MainPage) {
                 $this->AllOnline[$levels[$row['user_level']]][] = $row;
             }
             if ($row['forum_topic'] != '0') {
                 // Пользователь читает топик
                 $online_topic[$row['forum_topic']]['u'][] = $row;
                 if (!isset($online_topic[$row['forum_topic']]['c'])) {
                     $online_topic[$row['forum_topic']]['c'] = 0;
                 }
                 $online_topic[$row['forum_topic']]['c']++;
                 if (!in_array($row['forum_topic'], $cat_topics_id)) {
                     $cat_topics_id[$row['forum_cat']][] = $row['forum_topic'];
                 }
             } else {
                 $online_cat[$row['forum_cat']]['u'][] = $row;
                 if (!isset($online_cat[$row['forum_cat']]['c'])) {
                     $online_cat[$row['forum_cat']]['c'] = 0;
                 }
                 $online_cat[$row['forum_cat']]['c']++;
             }
         }
         $this->online_cat = $online_cat;
         $this->online_topic = $online_topic;
         $this->cat_topics_id = $cat_topics_id;
         $this->online_load = true;
     }
 }
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:43,代码来源:forum_online.class.php

示例15: ViewLevelToStr

                $vt = 'Неограниченно';
            }
            $adin = '(Просматривают: ' . ViewLevelToStr($msg['view'], 'Только администраторы', 'Только пользователи', 'Только анонимные пользователи', 'Все посетители') . ' - ' . $vt . ' - <a href="' . ADMIN_FILE . '?exe=messages&a=msgeditor&id=' . $msg['id'] . '">Редактировать</a>)';
        }
        if ($msg['view_title'] == 1) {
            // Показывать заголовок
            $title = $msg['title'];
        } else {
            $title = '';
        }
        System::site()->AddMessage($title, $msg['text'], $adin);
    }
}
foreach ($msgs as $a) {
    if ($a['position'] == '1') {
        MessagesRender($a);
    } else {
        $bottomMessages[] = $a;
    }
}
if ($disableMsg !== false) {
    $disableMsg = substr($disableMsg, 4);
    System::database()->Update('messages', "active='0'", $disableMsg);
}
function BottomMessages()
{
    global $bottomMessages;
    foreach ($bottomMessages as $a) {
        MessagesRender($a);
    }
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:31,代码来源:messages.inc.php


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