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


PHP driver\driver_interface类代码示例

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


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

示例1: submit_options

    /**
     * Set ColorizeIt options for a revision.
     *
     * @param array $options
     * @param int $revision_id
     * @param \phpbb\db\driver\driver_interface $db
     *
     * @return null
     */
    public function submit_options($options, $revision_id, $db)
    {
        $options = serialize($options);
        $sql = 'UPDATE ' . TITANIA_REVISIONS_TABLE . '
		    SET revision_clr_options = "' . $db->sql_escape($options) . '"
		    WHERE revision_id = ' . (int) $revision_id;
        $db->sql_query($sql);
    }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:17,代码来源:colorizeit_helper.php

示例2: fix_tree

    /**
     * Fix tree.
     *
     * @param int $i
     * @param string $pkey
     * @param string $table
     * @param int $parent_id
     * @param array $where
     * @return bool
     */
    protected function fix_tree(&$i, $pkey, $table, $parent_id = 0, $where = array())
    {
        $changes_made = false;
        $sql = 'SELECT *
			FROM ' . $table . '
			WHERE parent_id = ' . (int) $parent_id . (!empty($where) ? ' AND ' . implode(' AND ', $where) : '') . '
			ORDER BY left_id ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            // First we update the left_id for this module
            if ($row['left_id'] != $i) {
                $this->db->sql_query('
					UPDATE ' . $table . '
					SET ' . $this->db->sql_build_array('UPDATE', array('left_id' => $i)) . "\n\t\t\t\t\tWHERE {$pkey} = {$row[$pkey]}");
                $changes_made = true;
            }
            $i++;
            // Then we go through any children and update their left/right id's
            $changes_made = $this->fix_tree($i, $pkey, $table, $row[$pkey], $where) || $changes_made;
            // Then we come back and update the right_id for this module
            if ($row['right_id'] != $i) {
                $this->db->sql_query('
					UPDATE ' . $table . '
					SET ' . $this->db->sql_build_array('UPDATE', array('right_id' => $i)) . "\n\t\t\t\t\tWHERE {$pkey} = {$row[$pkey]}");
                $changes_made = true;
            }
            $i++;
        }
        $this->db->sql_freeresult($result);
        return $changes_made;
    }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:41,代码来源:fix_tree.php

示例3: memberlist_modify_query

 public function memberlist_modify_query($event)
 {
     $sql_from = $event['sql_from'];
     $sql_where = $event['sql_where'];
     $user_from = $this->request->variable('user_from', '', true);
     $user_id = $this->request->variable('user_id', '');
     $this->template->assign_vars(array('USER_FROM' => $user_from, 'USER_ID' => (int) $user_id));
     if ($user_from) {
         $sql_from .= ', ' . PROFILE_FIELDS_DATA_TABLE . ' pf ';
         $pieces = explode(' ', $user_from);
         $sql_where .= ' AND (pf.pf_phpbb_location COLLATE utf8_general_ci ';
         $sql_where .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $pieces[0]));
         for ($i = 1; $i < sizeof($pieces); $i++) {
             $sql_where .= ' OR pf.pf_phpbb_location COLLATE utf8_general_ci ';
             $sql_where .= $this->db->sql_like_expression(str_replace('*', $this->db->get_any_char(), $pieces[$i]));
         }
         $sql_where .= ') AND u.user_id = pf.user_id';
         $event['sql_where'] = $sql_where;
         $event['sql_from'] = $sql_from;
     }
     if ((int) $user_id) {
         $sql_where .= ' AND u.user_id = ' . $user_id . '';
         $event['sql_where'] = $sql_where;
     }
 }
开发者ID:AlexSheer,项目名称:phpbb3.1-Search_User_From,代码行数:25,代码来源:listener.php

示例4: modify_posting

 public function modify_posting($event)
 {
     if ($event['mode'] == 'post' && !$event['forum_id']) {
         $forum_ary = array();
         $forum_read_ary = $this->auth->acl_getf('f_read');
         foreach ($forum_read_ary as $forum_id => $allowed) {
             if ($allowed['f_read'] && $this->auth->acl_get('f_post', $forum_id)) {
                 if (!$this->exclude_forum($forum_id, $this->config['newtopic_forum'])) {
                     continue;
                 }
                 $forum_ary[] = (int) $forum_id;
             }
         }
         if (sizeof($forum_ary)) {
             // Fetching topics of public forums
             $sql = 'SELECT forum_id, forum_name, forum_type FROM ' . FORUMS_TABLE . "\n\t\t\t\t\tWHERE " . $this->db->sql_in_set('forum_id', $forum_ary) . "\n\t\t\t\t\t\tAND forum_type != " . FORUM_LINK;
             $result = $this->db->sql_query($sql);
             $forumrow = $this->db->sql_fetchrowset($result);
             $this->db->sql_freeresult($result);
             $s_forum_options = '<select id="f" name="f" onchange="this.form.submit();">';
             foreach ($forumrow as $row) {
                 $s_forum_options .= '<option value="' . $row['forum_id'] . '"' . ($row['forum_id'] == $forum_id ? ' selected="selected"' : '') . '' . ($row['forum_type'] == FORUM_CAT ? ' disabled="disabled" class="disabled-option"' : '') . '>' . ($row['forum_type'] != FORUM_CAT ? '&nbsp;&nbsp;' : '') . $row['forum_name'] . '</option>';
                 $forum_id = $row['forum_type'] == FORUM_POST ? $row['forum_id'] : '';
             }
             $s_forum_options .= '</select>';
             $this->template->assign_vars(array('S_FORUM_OPTIONS' => $s_forum_options, 'S_FORUM_OPT_TRUE' => $forum_id ? true : false));
             $event['forum_id'] = $forum_id;
         }
     }
 }
开发者ID:Galixte,项目名称:newtopic,代码行数:30,代码来源:listener.php

示例5: create_report

 /**
  * Creates a report entity in the database
  *
  * @param	array	$report_data
  * @return	int	the ID of the created entity
  */
 protected function create_report(array $report_data)
 {
     $sql_ary = array('reason_id' => (int) $report_data['reason_id'], 'post_id' => $report_data['post_id'], 'pm_id' => $report_data['pm_id'], 'user_id' => (int) $this->user->data['user_id'], 'user_notify' => (int) $report_data['user_notify'], 'report_closed' => 0, 'report_time' => (int) time(), 'report_text' => (string) $report_data['report_text'], 'reported_post_text' => $report_data['reported_post_text'], 'reported_post_uid' => $report_data['reported_post_uid'], 'reported_post_bitfield' => $report_data['reported_post_bitfield'], 'reported_post_enable_bbcode' => $report_data['reported_post_enable_bbcode'], 'reported_post_enable_smilies' => $report_data['reported_post_enable_smilies'], 'reported_post_enable_magic_url' => $report_data['reported_post_enable_magic_url']);
     $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
     $this->db->sql_query($sql);
     return $this->db->sql_nextid();
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:13,代码来源:report_handler.php

示例6: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->db->sql_return_on_error(true);
     $table_prefix = $this->config->get('table_prefix');
     $change_prefix = $this->config->get('change_table_prefix', true);
     if (!defined('CONFIG_TABLE')) {
         // CONFIG_TABLE is required by sql_create_index() to check the
         // length of index names. However table_prefix is not defined
         // here yet, so we need to create the constant ourselves.
         define('CONFIG_TABLE', $table_prefix . 'config');
     }
     $db_table_schema = @file_get_contents($this->schema_file_path);
     $db_table_schema = json_decode($db_table_schema, true);
     $total = sizeof($db_table_schema);
     $i = $this->config->get('add_table_index', 0);
     $db_table_schema = array_slice($db_table_schema, $i);
     foreach ($db_table_schema as $table_name => $table_data) {
         $i++;
         $this->db_tools->sql_create_table($change_prefix ? $table_prefix . substr($table_name, 6) : $table_name, $table_data);
         // Stop execution if resource limit is reached
         if ($this->config->get_time_remaining() <= 0 || $this->config->get_memory_remaining() <= 0) {
             break;
         }
     }
     $this->config->set('add_table_index', $i);
     if ($i < $total) {
         throw new resource_limit_reached_exception();
     } else {
         @unlink($this->schema_file_path);
     }
 }
开发者ID:007durgesh219,项目名称:phpbb,代码行数:34,代码来源:add_tables.php

示例7: create_welcome_topic

    public function create_welcome_topic($user_id)
    {
        if (!$this->config['welcomerobot_enable']) {
            return false;
        }
        if (!function_exists('get_username_string')) {
            include $this->root_path . 'includes/functions_content.' . $this->phpEx;
        }
        if (!function_exists('submit_post')) {
            include $this->root_path . 'includes/functions_posting.' . $this->phpEx;
        }
        $sql = 'SELECT *
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = " . intval($user_id) . "";
        $dbresult = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($dbresult);
        $this->db->sql_freeresult($dbresult);
        if (empty($row)) {
            return false;
        }
        $username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
        $clean_username = utf8_clean_string($row['username']);
        $topic_title = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_title']);
        $topic_content = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_detail']);
        $poll = $uid = $bitfield = $options = '';
        // will be modified by generate_text_for_storage
        $allow_bbcode = $allow_urls = $allow_smilies = true;
        generate_text_for_storage($topic_content, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
        $data = array('forum_id' => $this->config['welcomerobot_forum'], 'topic_id' => 0, 'icon_id' => false, 'robot_name' => $this->config['welcomerobot_username'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $topic_content, 'message_md5' => md5($topic_content), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $topic_title, 'notify_set' => false, 'notify' => false, 'post_time' => 0, 'forum_name' => '', 'enable_indexing' => true, 'force_approved_state' => true);
        submit_post('post', $topic_title, 'robot_name', POST_NORMAL, $poll, $data);
        return true;
    }
开发者ID:Elias64,项目名称:autoPost,代码行数:31,代码来源:listener.php

示例8: like_post

 /**
  * Likes controller for route /like_post/{like}
  *
  * @param  int   @post_id  The post to be edited.
  */
 public function like_post($post_id)
 {
     // If unknown user or bot, cannot like.
     if ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot']) {
         return;
     }
     // Add language variables for response.
     $this->user->add_lang_ext('nuleaf/likes', 'likes');
     // Grab forum id for permission.
     $sql = 'SELECT forum_id
 FROM ' . POSTS_TABLE . '
 WHERE post_id = ' . $post_id;
     $result = $this->db->sql_query_limit($sql, 1);
     $forum_id = $this->db->sql_fetchrow($result)['forum_id'];
     $this->db->sql_freeresult($result);
     // Does the user have permission to like posts in this forum?
     if ($this->auth->acl_get('!f_like', $forum_id)) {
         $json_response = new json_response();
         $json_response->send(array('error' => $this->user->lang('LIKE_NOT_AUTHORIZED')));
         return;
     }
     if ($this->request->is_ajax()) {
         $liked = $this->likes_manager->is_liked($post_id);
         if ($liked) {
             // If post is already liked, unlike it.
             $likes_count = $this->likes_manager->unlike($post_id);
         } else {
             // Else like the post.
             $likes_count = $this->likes_manager->like($post_id);
         }
         // Since the post has now been liked/unliked, $liked is reversed.
         $json_response = new json_response();
         $json_response->send(array('likes_count' => $likes_count, 'liked' => !$liked, 'LIKE_POST' => $this->user->lang('LIKE_POST'), 'UNLIKE_POST' => $this->user->lang('UNLIKE_POST'), 'LIKE_BUTTON' => $this->user->lang('LIKE_BUTTON'), 'UNLIKE_BUTTON' => $this->user->lang('UNLIKE_BUTTON')));
     }
 }
开发者ID:NuLeaf,项目名称:nuleaf-forum,代码行数:40,代码来源:main.php

示例9: get_template_side

    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $style_count = 0;
        $style_select = '';
        $sql = 'SELECT style_id, style_name
			FROM ' . STYLES_TABLE . '
			WHERE style_active = 1
			ORDER BY LOWER(style_name) ASC';
        $result = $this->db->sql_query($sql, 3600);
        while ($row = $this->db->sql_fetchrow($result)) {
            $style = $this->request->variable('style', 0);
            if (!empty($style)) {
                $url = str_replace('style=' . $style, 'style=' . $row['style_id'], $this->modules_helper->route('board3_portal_controller'));
            } else {
                $url = $this->modules_helper->route('board3_portal_controller') . '?style=' . $row['style_id'];
            }
            ++$style_count;
            $style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>';
        }
        $this->db->sql_freeresult($result);
        if (strlen($style_select)) {
            $this->template->assign_var('STYLE_SELECT', $style_select);
        }
        // Assign specific vars
        $this->template->assign_vars(array('S_STYLE_OPTIONS' => $this->config['override_user_style'] || $style_count < 2 ? '' : $style_select));
        return 'stylechanger_side.html';
    }
开发者ID:alhitary,项目名称:Board3-Portal,代码行数:30,代码来源:stylechanger.php

示例10: main

    function main()
    {
        $sql = 'SELECT *
				FROM ' . $this->points_values_table;
        $result = $this->db->sql_query($sql);
        $points_values = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // Add part to bar
        $this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'FORUM_NAME' => sprintf($this->user->lang['POINTS_INFO'], $this->config['points_name'])));
        // Read out all the need values
        $info_attach = $points_values['points_per_attach'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach']) . '&nbsp;' . $this->config['points_name']);
        $info_addtional_attach = $points_values['points_per_attach_file'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_attach_file']) . '&nbsp;' . $this->config['points_name']);
        $info_poll = $points_values['points_per_poll'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll']) . '&nbsp;' . $this->config['points_name']);
        $info_poll_option = $points_values['points_per_poll_option'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_poll_option']) . '&nbsp;' . $this->config['points_name']);
        $info_topic_word = $points_values['points_per_topic_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_word']) . '&nbsp;' . $this->config['points_name']);
        $info_topic_character = $points_values['points_per_topic_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_topic_character']) . '&nbsp;' . $this->config['points_name']);
        $info_post_word = $points_values['points_per_post_word'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_word']) . '&nbsp;' . $this->config['points_name']);
        $info_post_character = $points_values['points_per_post_character'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_post_character']) . '&nbsp;' . $this->config['points_name']);
        $info_cost_warning = $points_values['points_per_warn'] == 0 ? sprintf($this->user->lang['INFO_NO_COST'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['points_per_warn']) . '&nbsp;' . $this->config['points_name']);
        $info_reg_bonus = $points_values['reg_points_bonus'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->functions_points->number_format_points($points_values['reg_points_bonus']) . '&nbsp;' . $this->config['points_name']);
        $info_points_bonus = $points_values['points_bonus_chance'] == 0 ? sprintf($this->user->lang['INFO_NO_POINTS'], $this->config['points_name']) : sprintf($this->user->lang['INFO_BONUS_CHANCE_EXPLAIN'], $this->functions_points->number_format_points($points_values['points_bonus_chance']), $this->functions_points->number_format_points($points_values['points_bonus_min']), $this->functions_points->number_format_points($points_values['points_bonus_max']), $this->config['points_name']);
        $this->template->assign_vars(array('USER_POINTS' => sprintf($this->functions_points->number_format_points($this->user->data['user_points'])), 'POINTS_NAME' => $this->config['points_name'], 'LOTTERY_NAME' => $points_values['lottery_name'], 'BANK_NAME' => $points_values['bank_name'], 'POINTS_INFO_DESCRIPTION' => sprintf($this->user->lang['POINTS_INFO_DESCRIPTION'], $this->config['points_name']), 'INFO_ATTACH' => $info_attach, 'INFO_ADD_ATTACH' => $info_addtional_attach, 'INFO_POLL' => $info_poll, 'INFO_POLL_OPTION' => $info_poll_option, 'INFO_TOPIC_WORD' => $info_topic_word, 'INFO_TOPIC_CHARACTER' => $info_topic_character, 'INFO_POST_WORD' => $info_post_word, 'INFO_POST_CHARACTER' => $info_post_character, 'INFO_COST_WARNING' => $info_cost_warning, 'INFO_REG_BONUS' => $info_reg_bonus, 'INFO_POINTS_BONUS' => $info_points_bonus, 'U_TRANSFER_USER' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'transfer_user')), 'U_LOGS' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'logs')), 'U_LOTTERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'lottery')), 'U_BANK' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'bank')), 'U_ROBBERY' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'robbery')), 'U_INFO' => $this->helper->route('dmzx_ultimatepoints_controller', array('mode' => 'info')), 'U_USE_TRANSFER' => $this->auth->acl_get('u_use_transfer'), 'U_USE_LOGS' => $this->auth->acl_get('u_use_logs'), 'U_USE_LOTTERY' => $this->auth->acl_get('u_use_lottery'), 'U_USE_BANK' => $this->auth->acl_get('u_use_bank'), 'U_USE_ROBBERY' => $this->auth->acl_get('u_use_robbery')));
        // Generate the page
        page_header($this->user->lang['POINTS_INFO']);
        // Generate the page template
        $this->template->set_filenames(array('body' => 'points/points_info.html'));
        page_footer();
    }
开发者ID:rampmaster,项目名称:Ultimate-Points-Extension,代码行数:28,代码来源:points_info.php

示例11: array

    /**
     * Modified version of the jumpbox, just lists authed forums (in the correct order)
     */
    function get_forum_list($ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
    {
        // This query is identical to the jumpbox one
        $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id
			FROM ' . FORUMS_TABLE . '
			ORDER BY left_id ASC';
        $result = $this->db->sql_query($sql, 600);
        // We include the forum root/index to make tree traversal easier
        $forum_list[0] = array('forum_id' => '0', 'forum_name' => $this->user->lang['FORUMS'], 'forum_type' => '0', 'link' => append_sid("{$this->root_path}index.{$this->phpEx}"), 'parent_id' => false, 'current' => false, 'current_child' => false, 'disabled' => false);
        // Sometimes it could happen that forums will be displayed here not be displayed within the index page
        // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions.
        // If this happens, the padding could be "broken"
        while ($row = $this->db->sql_fetchrow($result)) {
            $disabled = false;
            if (!$ignore_acl && $this->auth->acl_gets(array('f_list', 'f_read'), $row['forum_id'])) {
                if ($only_acl_post && !$this->auth->acl_get('f_post', $row['forum_id']) || !$this->auth->acl_get('m_approve', $row['forum_id']) && !$this->auth->acl_get('f_noapprove', $row['forum_id'])) {
                    $disabled = true;
                }
            } else {
                if (!$ignore_acl) {
                    continue;
                }
            }
            if (is_array($ignore_id) && in_array($row['forum_id'], $ignore_id) || $row['forum_id'] == $ignore_id || $row['forum_type'] == FORUM_CAT && $row['left_id'] + 1 == $row['right_id'] && $ignore_emptycat || $row['forum_type'] != FORUM_POST && $ignore_nonpost) {
                $disabled = true;
            }
            $u_viewforum = append_sid("{$this->root_path}viewforum.{$this->phpEx}", 'f=' . $row['forum_id']);
            $forum_list[$row['forum_id']] = array('forum_id' => $row['forum_id'], 'forum_name' => $row['forum_name'], 'forum_type' => $row['forum_type'], 'link' => $u_viewforum, 'parent_id' => $row['parent_id'], 'current' => false, 'current_child' => false, 'disabled' => $disabled);
        }
        $this->db->sql_freeresult($result);
        return $forum_list;
    }
开发者ID:Sajaki,项目名称:BreadcrumbMenu,代码行数:35,代码来源:listener.php

示例12: handle_downloadlog

    public function handle_downloadlog()
    {
        if (!$this->auth->acl_get('a_')) {
            trigger_error('Access Denied');
        } else {
            $this->user->add_lang_ext('dmzx/downloadlog', 'common');
            $fileid = $this->request->variable('file', 0);
            $start = $this->request->variable('start', 0);
            // Pagination number from ACP
            $dll = $this->config['downloadlog_value'];
            // Generate pagination
            $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
				FROM ' . $this->userdownloadslog_table . '
				WHERE user_id = user_id
				AND file_id = ' . $fileid;
            $result = $this->db->sql_query($sql);
            $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
            $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
				FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
				WHERE u.user_id = d.user_id
				AND file_id = ' . $fileid . '
				ORDER BY d.down_date DESC';
            $top_result = $this->db->sql_query_limit($sql, $dll, $start);
            while ($row = $this->db->sql_fetchrow($top_result)) {
                $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
            }
        }
        $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
        //Start pagination
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
        $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
        page_header('Downloaders Log', false);
        $this->template->set_filenames(array('body' => 'DownloadLog.html'));
        page_footer();
    }
开发者ID:phpbb-es,项目名称:Downloadlog,代码行数:35,代码来源:downloadlog.php

示例13: modify_replies

    /**
     * Changes the regex replacement for second pass
     *
     * @param object $event
     * @return null
     * @access public
     */
    public function modify_replies($event)
    {
        if (!function_exists('get_username_string')) {
            include $this->root_path . 'includes/functions_content.' . $this->php_ext;
        }
        // 1. output each line with user + post-count
        // 2. output in "inline-popup" like in "mark posts read"
        $topic_row = $event['topic_row'];
        $topic_id = $topic_row['TOPIC_ID'];
        $sql = 'SELECT COUNT(p.post_id) AS posts, p.poster_id, u.username, u.user_colour
		FROM phpbb_posts p, phpbb_users u
		WHERE p.topic_id = ' . (int) $topic_id . '
		AND p.poster_id = u.user_id
		GROUP BY p.poster_id
		ORDER BY posts DESC';
        $result = $this->db->sql_query_limit($sql, 5);
        while ($row = $this->db->sql_fetchrow($result)) {
            var_dump($row);
            $post_count = $row['posts'];
            $display_username = get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']);
            echo $display_username . ' with ' . $post_count . 'posts<br />';
        }
        $this->db->sql_freeresult($result);
        $topic_row['REPLIES'] = '<a href="#t=' . $topic_id . '" class="whoposted">' . $topic_row['REPLIES'] . '</a>';
        $event['topic_row'] = $topic_row;
    }
开发者ID:Crizz0,项目名称:whoposted,代码行数:33,代码来源:listener.php

示例14: page_header

    public function page_header($event)
    {
        if ($this->auth->acl_get('u_did_you_know')) {
            $sql_layer = $this->db->get_sql_layer();
            switch ($sql_layer) {
                case 'postgres':
                    $random = 'RANDOM()';
                    break;
                case 'mssql':
                case 'mssql_odbc':
                    $random = 'NEWID()';
                    break;
                default:
                    $random = 'RAND()';
                    break;
            }
            $sql = 'SELECT word, bbcode_uid, bbcode_bitfield, bbcode_options
				FROM ' . $this->did_you_know . "\n\t\t\t\tWHERE lang_iso = '{$this->user->data['user_lang']}'\n\t\t\t\t\tOR lang_iso = 'default'\n\t\t\t\tORDER BY {$random}";
            $result = $this->db->sql_query_limit($sql, 1);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            $word = generate_text_for_display($row['word'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
            $this->template->assign_vars(array('DID_YOU_KNOW' => str_replace("&quot;", '"', $word), 'S_DIDYOUKNOW' => !empty($this->user->data['user_didyouknow']) ? true : false, 'U_DYK_HIDE' => $this->helper->route('dmzx_didyouknow_controller', array('mode' => 'hide'))));
        }
    }
开发者ID:phpbb-es,项目名称:Did-You-Know,代码行数:25,代码来源:listener.php

示例15: add_page_header_links

    public function add_page_header_links($event)
    {
        if (!empty($this->config['allow_visits_counter'])) {
            $this->language->add_lang('common', 'dmzx/counter');
            $sql = 'SELECT COUNT(*) AS visits_counter
				FROM ' . $this->visits_counter_table . '
				WHERE ' . $this->db->sql_in_set('uvc_ip', $this->user->ip);
            $result = $this->db->sql_query($sql);
            $visits_counter = (int) $this->db->sql_fetchfield('visits_counter');
            $this->db->sql_freeresult($result);
            $visits = $this->config['visits_counter'];
            if ($visits_counter == 0) {
                $sql_ary = array('uvc_ip' => $this->user->ip, 'uvc_timestamp' => time());
                $sql = 'INSERT INTO ' . $this->visits_counter_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
                $this->db->sql_query($sql);
                $this->config->increment('visits_counter', 1, true);
            } else {
                $sql_ary = array('uvc_timestamp' => time());
                $sql = 'UPDATE ' . $this->visits_counter_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
					WHERE ' . $this->db->sql_in_set('uvc_ip', $this->user->ip);
                $this->db->sql_query($sql);
            }
            $timestamp = time() - 3600 * 24;
            $sql_ary = array($timestamp);
            $sql = 'DELETE FROM ' . $this->visits_counter_table . '
				WHERE uvc_timestamp < ' . $timestamp;
            $this->db->sql_query($sql);
            $sql = 'SELECT COUNT(*) AS num_del
				FROM ' . $this->visits_counter_table . ' ';
            $result = $this->db->sql_query($sql);
            $visitsok = (int) $this->db->sql_fetchfield('num_del');
            $this->template->assign_vars(array('UNIQUE_VISITS_COUNTER' => $this->language->lang('UNIQUE_VISITS_COUNTER', $visitsok)));
        }
    }
开发者ID:dmzx,项目名称:phpBB-3.2-Unique-Visits-Counter,代码行数:34,代码来源:listener.php


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