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


PHP user::format_date方法代码示例

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


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

示例1: get_year

 protected function get_year(array $now)
 {
     $start = $this->user->create_datetime()->setDate($now['year'], 1, 1)->setTime(0, 0, 0)->getTimestamp();
     $leap_year = gmdate('L', $start);
     $num_days = $leap_year ? 366 : 365;
     return array('start' => $start, 'stop' => $start + 86400 * $num_days - 1, 'date' => $this->user->format_date($start, 'Y', true));
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:7,代码来源:date_range.php

示例2: get_bookmarks

    public function get_bookmarks($ext_mode = '', $forums = array())
    {
        define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
        $start = $this->request->variable('start', 0);
        $sql = 'SELECT COUNT(post_id) as posts_count
			FROM ' . POSTS_BOOKMARKS_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'];
        $result = $this->db->sql_query($sql);
        $posts_count = (int) $this->db->sql_fetchfield('posts_count');
        $this->db->sql_freeresult($result);
        $sql_where = $sql_fields = '';
        if ($ext_mode != 'find') {
            $sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
            $sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
        }
        $pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
        $sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
			FROM ' . POSTS_BOOKMARKS_TABLE . ' b
			LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
			LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
			' . $sql_where . '
			WHERE b.user_id = ' . $this->user->data['user_id'] . '
			ORDER BY b.bookmark_time ASC';
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
            $post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
            // Send vars to template
            $this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
    }
开发者ID:AlexSheer,项目名称:phpbb3.1-PostBookmark,代码行数:34,代码来源:helper.php

示例3: modify_memberlist

 public function modify_memberlist($event)
 {
     $poster_data = $event['data'];
     $b = $event['template_data'];
     $b['JOINED'] = $this->user->format_date($poster_data['user_regdate'], $this->date_format);
     $event['template_data'] = $b;
 }
开发者ID:3D-I,项目名称:joined,代码行数:7,代码来源:listener.php

示例4: show_ucp_complete

    /**
     * This method is called to show the UCP page.
     * You can assign template variables to the template, or do anything else here.
     *
     * @param string $table
     * @param string $where Extra where clause. Please make sure to use AND as first.
     */
    protected function show_ucp_complete($table, $where = '')
    {
        $sql = 'SELECT *
			FROM ' . $this->db->sql_escape($table) . '
			WHERE user_id = ' . (int) $this->user->data['user_id'] . ' ' . $where . '
			ORDER BY registration_id ASC';
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('keys', array('CLASS' => $this->get_name(), 'ID' => $row['registration_id'], 'REGISTERED' => $this->user->format_date($row['registered']), 'LAST_USED' => $row['last_used'] ? $this->user->format_date($row['last_used']) : false, 'TYPE' => $this->user->lang($this->get_translatable_name())));
        }
        $this->db->sql_freeresult($result);
    }
开发者ID:paul999,项目名称:phpbb_2fa,代码行数:19,代码来源:abstract_module.php

示例5: modify_profile

 /**
  * Modify the joined date format in memberlist
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function modify_profile($event)
 {
     $data = $event['data'];
     $template_data = $event['template_data'];
     // Are we changing profile or memberlist?
     if (strlen($template_data['U_NOTES']) > 0) {
         $template_data['JOINED'] = $this->user->format_date($data['user_regdate'], $this->config['joined_dateformat_profile']);
     } else {
         $template_data['JOINED'] = $this->user->format_date($data['user_regdate'], $this->config['joined_dateformat_memberlist']);
     }
     $event->offsetSet('template_data', $template_data);
 }
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:19,代码来源:listener.php

示例6: get_template_side

    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $sql = 'SELECT user_id, username, user_regdate, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . '
				AND user_inactive_time = 0
			ORDER BY user_regdate DESC';
        $result = $this->db->sql_query_limit($sql, $this->config['board3_max_last_member_' . $module_id], 0, 600);
        while (($row = $this->db->sql_fetchrow($result)) && $row['username']) {
            $this->template->assign_block_vars('latest_members', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate'], $format = 'd M')));
        }
        $this->db->sql_freeresult($result);
        return 'latest_members_side.html';
    }
开发者ID:alhitary,项目名称:Board3-Portal,代码行数:17,代码来源:latest_members.php

示例7: display_24_hour_stats

 /**
  * Display stats on index page
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function display_24_hour_stats($event)
 {
     // if the user is a bot
     if ($this->user->data['is_bot']) {
         return;
     }
     $this->user->add_lang_ext('rmcgirr83/activity24hours', 'common');
     // obtain posts/topics/new users activity
     $activity = $this->obtain_activity_data();
     // obtain user activity data
     $active_users = $this->obtain_active_user_data();
     // Obtain guests data
     $total_guests_online_24 = $this->obtain_guest_count_24();
     $user_count = 0;
     foreach ((array) $active_users as $row) {
         if (!$row['session_viewonline'] && !empty($row['session_time']) || !$row['user_allow_viewonline']) {
             if ($this->auth->acl_get('u_viewonline') || $row['user_id'] === $this->user->data['user_id']) {
                 $row['username'] = '<em>' . $row['username'] . '</em>';
             } else {
                 continue;
             }
         }
         if ($row['user_lastvisit'] < $this->interval && $row['session_time'] < $this->interval) {
             continue;
         }
         $max_last_visit = max($row['user_lastvisit'], $row['session_time']);
         $hover_info = ' title="' . $this->user->format_date($max_last_visit) . '"';
         ++$user_count;
         $this->template->assign_block_vars('lastvisit', array('USERNAME_FULL' => '<span' . $hover_info . '>' . get_username_string($row['user_type'] == USER_IGNORE ? 'no_profile' : 'full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>'));
     }
     // assign the forum stats to the template.
     $this->template->assign_vars(array('USERS_24HOUR_TOTAL' => $this->user->lang('USERS_24HOUR_TOTAL', $user_count), 'USERS_ACTIVE' => $user_count, 'GUEST_ONLINE_24' => $this->config['load_online_guests'] ? $this->user->lang('GUEST_ONLINE_24', $total_guests_online_24) : '', 'HOUR_TOPICS' => $this->user->lang('24HOUR_TOPICS', $activity['topics']), 'HOUR_POSTS' => $this->user->lang('24HOUR_POSTS', $activity['posts']), 'HOUR_USERS' => $this->user->lang('24HOUR_USERS', $activity['users']), 'S_CAN_VIEW_24_HOURS' => true));
 }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-activity24hours,代码行数:40,代码来源:listener.php

示例8: search

    public function search($start = 1)
    {
        if (!$this->auth->acl_get('u_usermap_search')) {
            trigger_error('NOT_AUTHORISED');
        }
        $this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang('USERMAP_TITLE'), 'U_VIEW_FORUM' => $this->helper->route('tas2580_usermap_index', array())));
        $lon = substr($this->request->variable('lon', ''), 0, 10);
        $lat = substr($this->request->variable('lat', ''), 0, 10);
        $dst = $this->request->variable('dst', $this->config['tas2580_usermap_search_distance']);
        $alpha = 180 * $dst / (6378137 / 1000 * 3.14159);
        $min_lon = $this->db->sql_escape($lon - $alpha);
        $max_lon = $this->db->sql_escape($lon + $alpha);
        $min_lat = $this->db->sql_escape($lat - $alpha);
        $max_lat = $this->db->sql_escape($lat + $alpha);
        $where = " WHERE ( user_usermap_lon >= '{$min_lon}' AND user_usermap_lon <= '{$max_lon}') AND ( user_usermap_lat >= '{$min_lat}' AND user_usermap_lat<= '{$max_lat}')";
        $limit = (int) $this->config['topics_per_page'];
        $sql = 'SELECT COUNT(user_id) AS num_users
			FROM ' . USERS_TABLE . $where;
        $result = $this->db->sql_query($sql);
        $total_users = (int) $this->db->sql_fetchfield('num_users');
        $this->db->sql_freeresult($result);
        $sql = 'SELECT user_id, username, user_colour, user_regdate, user_posts, group_id, user_usermap_lon, user_usermap_lat
			FROM ' . USERS_TABLE . $where;
        $result = $this->db->sql_query_limit($sql, $limit, ($start - 1) * $limit);
        while ($row = $this->db->sql_fetchrow($result)) {
            $distance = $this->get_distance($lon, $lat, $row['user_usermap_lon'], $row['user_usermap_lat']);
            $this->template->assign_block_vars('memberrow', array('USER_ID' => $row['user_id'], 'USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate']), 'POSTS' => $row['user_posts'], 'GROUP_ID' => $row['group_id'], 'DISTANCE' => $distance));
        }
        $this->pagination->generate_template_pagination(array('routes' => array('tas2580_usermap_search', 'tas2580_usermap_search_page'), 'params' => array()), 'pagination', 'start', $total_users, $limit, ($start - 1) * $limit);
        $this->template->assign_vars(array('TOTAL_USERS' => $this->user->lang('TOTAL_USERS', (int) $total_users), 'L_SEARCH_EXPLAIN' => $this->user->lang('SEARCH_EXPLAIN', $dst, $lon, $lat)));
        return $this->helper->render('usermap_search.html', $this->user->lang('USERMAP_SEARCH'));
    }
开发者ID:phpbb-addons,项目名称:usermap,代码行数:32,代码来源:main.php

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

示例10: newusers

    public function newusers()
    {
        $howmany = $this->howmany();
        $sql_where = $this->ignore_users();
        $sql_and = !empty($sql_where) ? ' AND user_inactive_reason = 0' : ' WHERE user_inactive_reason = 0';
        // newest registered users
        if (($newest_users = $this->cache->get('_top_five_newest_users')) === false) {
            $newest_users = array();
            // grab most recent registered users
            $sql = 'SELECT user_id, username, user_colour, user_regdate
				FROM ' . USERS_TABLE . '
				' . $sql_where . '
				' . $sql_and . '
				ORDER BY user_regdate DESC';
            $result = $this->db->sql_query_limit($sql, $howmany);
            while ($row = $this->db->sql_fetchrow($result)) {
                $newest_users[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'user_regdate' => $row['user_regdate']);
            }
            $this->db->sql_freeresult($result);
            // cache this data for 5 minutes, this improves performance
            $this->cache->put('_top_five_newest_users', $newest_users, 300);
        }
        foreach ($newest_users as $row) {
            $username_string = $this->auth->acl_get('u_viewprofile') ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']);
            $this->template->assign_block_vars('top_five_newest', array('REG_DATE' => $this->user->format_date($row['user_regdate']), 'USERNAME_FULL' => $username_string));
        }
    }
开发者ID:phpbb-addons,项目名称:phpBB-3.1-topfive,代码行数:27,代码来源:topfive.php

示例11: get_last_visit

    protected function get_last_visit($user_id, $author = 0)
    {
        if ($user_id == $author) {
            $last_visit = '';
        } else {
            $sql = 'SELECT session_user_id, MAX(session_time) AS session_time
				FROM ' . SESSIONS_TABLE . '
				WHERE session_time >= ' . (time() - $this->config['session_length']) . '
					AND ' . $this->db->sql_in_set('session_user_id', $user_id) . '
				GROUP BY session_user_id';
            $result = $this->db->sql_query($sql);
            $session_times = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $session_times[$row['session_user_id']] = $row['session_time'];
            }
            $this->db->sql_freeresult($result);
            $sql = 'SELECT user_lastvisit
				FROM ' . USERS_TABLE . '
				WHERE ' . $this->db->sql_in_set('user_id', $user_id);
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                $session_time = !empty($session_times[$user_id]) ? $session_times[$user_id] : 0;
                $last_visit = !empty($session_time) ? $session_time : $row['user_lastvisit'];
                $last_visit = $this->user->format_date($last_visit);
            }
            $this->db->sql_freeresult($result);
        }
        return $last_visit;
    }
开发者ID:david63,项目名称:david63-pmmonitor,代码行数:29,代码来源:admin_controller.php

示例12: _update_check

    /**
     * Update website verification number after a missing backlink, and send notificaton
     *
     * @param	array	$u_array	Information about website
     * @param	int		$next_prune	Date of next auto check
     * @return	null
     */
    private function _update_check($u_array, $next_prune)
    {
        if (!class_exists('messenger')) {
            include $this->root_path . 'includes/functions_messenger.' . $this->php_ext;
        }
        $messenger = new \messenger(false);
        // cron.php don't call $user->setup(), so $this->timezone is unset.
        // We need to define it, because we use user->format_date below
        $this->user->timezone = new \DateTimeZone($this->config['board_timezone']);
        $sql = 'UPDATE ' . DIR_LINK_TABLE . '
			SET link_nb_check = link_nb_check + 1
			WHERE ' . $this->db->sql_in_set('link_id', array_keys($u_array));
        $this->db->sql_query($sql);
        foreach ($u_array as $data) {
            strip_bbcode($data['link_description']);
            $notification_data = array('cat_name' => \ernadoo\phpbbdirectory\core\categorie::getname((int) $data['link_cat']), 'link_id' => $data['link_id'], 'link_name' => $data['link_name'], 'link_url' => $data['link_url'], 'link_description' => $data['link_description'], 'next_cron' => $this->user->format_date($next_prune, $data['user_dateformat']));
            if ($data['link_nb_check']) {
                $this->notification->delete_notifications('ernadoo.phpbbdirectory.notification.type.directory_website_error_cron', $notification_data);
            }
            // New notification system can't send mail to an anonymous user with an email address stored in another table than phpbb_users
            if ($data['link_user_id'] == ANONYMOUS) {
                $username = $email = $data['link_guest_email'];
                $messenger->template('@ernadoo_phpbbdirectory/directory_website_error_cron', $data['user_lang']);
                $messenger->to($email, $username);
                $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($username), 'LINK_NAME' => $data['link_name'], 'LINK_URL' => $data['link_url'], 'LINK_DESCRIPTION' => $data['link_description'], 'NEXT_CRON' => $this->user->format_date($next_prune, $data['user_dateformat'])));
                $messenger->send(NOTIFY_EMAIL);
            } else {
                $this->notification->add_notifications('ernadoo.phpbbdirectory.notification.type.directory_website_error_cron', $notification_data);
            }
        }
    }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:38,代码来源:link.php

示例13: get_thanks

 public function get_thanks($post_id)
 {
     $view = $this->request->variable('view', '');
     $further_thanks_text = $return = '';
     $user_list = array();
     $further_thanks = $count = 0;
     $maxcount = isset($this->config['thanks_number_post']) ? $this->config['thanks_number_post'] : false;
     foreach ($this->thankers as $thanker) {
         if ($thanker['post_id'] == $post_id) {
             if ($count >= $maxcount) {
                 $further_thanks++;
             } else {
                 $user_list[] = get_username_string('full', $thanker['user_id'], $thanker['username'], $thanker['user_colour']) . ($this->config['thanks_time_view'] && $thanker['thanks_time'] ? ' (' . $this->user->format_date($thanker['thanks_time'], false, $view == 'print' ? true : false) . ')' : '');
                 $count++;
             }
         }
     }
     if (!empty($user_list)) {
         $return = implode($user_list, ' &bull; ');
     }
     if ($further_thanks > 0) {
         $further_thanks_text = $further_thanks == 1 ? $this->user->lang['FURTHER_THANKS'] : sprintf($this->user->lang['FURTHER_THANKS_PL'], $further_thanks);
     }
     $return = $return == '' ? false : $return . $further_thanks_text;
     return $return;
 }
开发者ID:borgesjoaquim,项目名称:thanks_for_posts,代码行数:26,代码来源:helper.php

示例14: view

    /**
     * Display popup comment
     *
     * @param	int		$link_id		The category ID
     * @param	int		$page			Page number taken from the URL
     * @param	string	$mode			add|edit
     * @return	\Symfony\Component\HttpFoundation\Response	A Symfony Response object
     * @throws	\phpbb\exception\http_exception
     */
    public function view($link_id, $page, $mode = 'new')
    {
        $this->_check_comments_enable($link_id);
        $comment_id = $this->request->variable('c', 0);
        $view = $this->request->variable('view', '');
        $start = ($page - 1) * $this->config['dir_comments_per_page'];
        $this->s_hidden_fields = array_merge($this->s_hidden_fields, array('page' => $page));
        $this->_populate_form($link_id, $mode);
        $sql = 'SELECT COUNT(comment_id) AS nb_comments
			FROM ' . DIR_COMMENT_TABLE . '
			WHERE comment_link_id = ' . (int) $link_id;
        $result = $this->db->sql_query($sql);
        $nb_comments = (int) $this->db->sql_fetchfield('nb_comments');
        $this->db->sql_freeresult($result);
        // Make sure $start is set to the last page if it exceeds the amount
        $start = $this->pagination->validate_start($start, $this->config['dir_comments_per_page'], $nb_comments);
        $sql_array = array('SELECT' => 'a.comment_id, a.comment_user_id, a. comment_user_ip, a.comment_date, a.comment_text, a.comment_uid, a.comment_bitfield, a.comment_flags, u.username, u.user_id, u.user_colour, z.foe', 'FROM' => array(DIR_COMMENT_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'a.comment_user_id = u.user_id'), array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id')), 'WHERE' => 'a.comment_link_id = ' . (int) $link_id, 'ORDER_BY' => 'a.comment_date DESC');
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $this->config['dir_comments_per_page'], $start);
        $have_result = false;
        while ($comments = $this->db->sql_fetchrow($result)) {
            $have_result = true;
            $edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_edit_comment_dir'));
            $delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_delete_comment_dir'));
            $this->template->assign_block_vars('comment', array('MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_USER' => get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), 'S_USER_IP' => $comments['comment_user_ip'], 'S_DATE' => $this->user->format_date($comments['comment_date']), 'S_COMMENT' => generate_text_for_display($comments['comment_text'], $comments['comment_uid'], $comments['comment_bitfield'], $comments['comment_flags']), 'S_ID' => $comments['comment_id'], 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_edit_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '', 'S_IGNORE_POST' => $comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id']) ? true : false, 'L_IGNORE_POST' => $comments['foe'] ? $this->user->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'L_POST_DISPLAY' => $comments['foe'] ? $this->user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?c=' . (int) $comments['comment_id'] . '&view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'S_INFO' => $this->auth->acl_get('m_info')));
        }
        $base_url = array('routes' => 'ernadoo_phpbbdirectory_comment_view_controller', 'params' => array('link_id' => (int) $link_id));
        $this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_comments, $this->config['dir_comments_per_page'], $start);
        $this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('DIR_NB_COMMS', (int) $nb_comments), 'S_HAVE_RESULT' => $have_result ? true : false));
        return $this->helper->render('comments.html', $this->user->lang['DIR_COMMENT_TITLE']);
    }
开发者ID:rmcgirr83,项目名称:ext-phpbb-directory,代码行数:40,代码来源:comments.php

示例15: main

 /**
  * @return Response
  */
 public function main()
 {
     $this->lang->add_lang('common', 'paul999/downloadpage');
     $sql = 'SELECT * FROM ' . $this->versions_table . ' WHERE active = 1 ORDER BY sort DESC';
     $result = $this->db->sql_query($sql);
     while ($row = $this->db->sql_fetchrow($result)) {
         $this->template->assign_block_vars('releases', array('NAME' => $row['name'], 'EOL' => $row['eol'], 'L_EOL' => $this->lang->lang('PHPBB_EOL', $row['name']), 'L_ALWAYS_CURRENT_DOWNLOAD' => $this->lang->lang('ALWAYS_CURRENT', ''), 'L_ALWAYS_CURRENT_UPDATE' => $this->lang->lang('ALWAYS_CURRENT', '')));
         // Yes, we do a queries in a loop here.
         // However, as the versions table should have <= 3 versions this should be fine.
         $sql_row = 'SELECT * FROM ' . $this->releases_table . ' WHERE version_id = ' . $row['version_id'] . ' AND active = 1 ORDER BY release_time DESC';
         $result_row = $this->db->sql_query($sql_row);
         while ($row_row = $this->db->sql_fetchrow($result_row)) {
             $this->template->assign_block_vars('releases.versions', array('RELEASED_AT' => $this->lang->lang('RELEASED_AT', $this->user->format_date($row_row['release_time']))));
             $sql = 'SELECT * FROM ' . $this->downloads_table . ' WHERE active = 1 AND release_id = ' . (int) $row_row['release_id'];
             $int_result = $this->db->sql_query($sql);
             while ($int_row = $this->db->sql_fetchrow($int_result)) {
                 $this->template->assign_block_vars('releases.versions.downloads', array('U_DOWNLOAD' => $this->controller_helper->route('paul999_downloadpage_download', array('id' => $int_row['download_id'])), 'NAME' => $int_row['name'], 'S_FULL_PACKAGE' => $int_row['type'] == constants::FULL_PACKAGE, 'S_LANG_PACKAGE' => $int_row['type'] == constants::TRANSLATION, 'S_UPDATE_PACKAGE' => $int_row['type'] == constants::UPDATE_PACKAGE));
             }
             $this->db->sql_freeresult($int_result);
         }
         $this->db->sql_freeresult($result_row);
     }
     $this->db->sql_freeresult($result);
     return $this->controller_helper->render('@paul999_downloadpage/download_main.html');
 }
开发者ID:paul999,项目名称:downloadpage,代码行数:28,代码来源:main_controller.php


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