本文整理汇总了PHP中phpbb\template\template::set_filenames方法的典型用法代码示例。如果您正苦于以下问题:PHP template::set_filenames方法的具体用法?PHP template::set_filenames怎么用?PHP template::set_filenames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\template\template
的用法示例。
在下文中一共展示了template::set_filenames方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Automate setting up the page and creating the response object.
*
* @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param int $status_code The status code to be sent to the page header
* @param bool $display_online_list Do we display online users list
*
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false)
{
page_header($page_title, $display_online_list);
$this->template->set_filenames(array('body' => $template_file));
page_footer(true, false, false);
return new Response($this->template->assign_display('body'), $status_code);
}
示例2: main
public function main()
{
$topic_id = $this->request->variable('t', 0);
$post_id = $this->request->variable('p', 0);
$forum_id = $this->request->variable('f', 0);
$mode = $this->request->variable('mode', '');
$book_submit = $this->request->variable('book', false);
$viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic." . $this->php_ext . "", "f={$forum_id}&t={$topic_id}");
$return_link = '<br /><br />' . sprintf($this->user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>');
$body = 'add_bookmark';
if ($mode == 'delete') {
$sql = 'DELETE FROM ' . $this->postbookmark_table . "\n\t\t\t\tWHERE user_id = {$this->user->data['user_id']}\n\t\t\t\t\tAND post_id = {$post_id}";
$this->db->sql_query($sql);
$message = $this->user->lang['POST_BOOKMARK_REMOVED'];
$this->helper->output_response($message, $return_link, $viewtopic_url);
} else {
if ($mode == 'find') {
$body = 'find_bookmark';
$this->helper->get_bookmarks($mode);
} else {
$bookmark_desc = $this->request->variable('bookmark_desc', '', true);
if ($book_submit) {
$sql = 'INSERT INTO ' . $this->postbookmark_table . ' ' . $this->db->sql_build_array('INSERT', array('user_id' => $this->user->data['user_id'], 'post_id' => $post_id, 'topic_id' => $topic_id, 'bookmark_time' => time(), 'bookmark_desc' => $bookmark_desc));
$this->db->sql_query($sql);
$message = $this->user->lang['POST_BOOKMARK_ADDED'];
$this->helper->output_response($message, $return_link, $viewtopic_url);
}
}
}
$this->template->assign_vars(array('U_POST_ACTION' => append_sid("{$this->phpbb_root_path}postbookmark", "f={$forum_id}&t={$topic_id}&p={$post_id}&mode={$mode}")));
page_header($this->user->lang['POST_BOOKMARK_ADD']);
$this->template->set_filenames(array('body' => $body . '.html'));
page_footer();
return new Response('', 200);
}
示例3: on_kernel_exception
/**
* This listener is run when the KernelEvents::EXCEPTION event is triggered
*
* @param GetResponseForExceptionEvent $event
* @return null
*/
public function on_kernel_exception(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
$message = $exception->getMessage();
if ($exception instanceof \phpbb\exception\exception_interface) {
$message = $this->language->lang_array($message, $exception->get_parameters());
}
if (!$event->getRequest()->isXmlHttpRequest()) {
page_header($this->language->lang('INFORMATION'));
$this->template->assign_vars(array('MESSAGE_TITLE' => $this->language->lang('INFORMATION'), 'MESSAGE_TEXT' => $message));
$this->template->set_filenames(array('body' => 'message_body.html'));
page_footer(true, false, false);
$response = new Response($this->template->assign_display('body'), 500);
} else {
$data = array();
if (!empty($message)) {
$data['message'] = $message;
}
if (defined('DEBUG')) {
$data['trace'] = $exception->getTrace();
}
$response = new JsonResponse($data, 500);
}
if ($exception instanceof HttpExceptionInterface) {
$response->setStatusCode($exception->getStatusCode());
$response->headers->add($exception->getHeaders());
}
$event->setResponse($response);
}
示例4: 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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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']) . ' ' . $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();
}
示例5: render
/**
* Automate setting up the page and creating the response object.
*
* @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param int $status_code The status code to be sent to the page header
* @param bool $display_online_list Do we display online users list
* @param int $item_id Restrict online users to item id
* @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id
* @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers.
*
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false)
{
page_header($page_title, $display_online_list, $item_id, $item, $send_headers);
$this->template->set_filenames(array('body' => $template_file));
page_footer(true, false, false);
$headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array();
return new Response($this->template->assign_display('body'), $status_code, $headers);
}
示例6: get_edit_form
/**
* @param array $block_data
* @param array $default_settings
* @return template|string
*/
public function get_edit_form(array $block_data, array $default_settings)
{
global $module;
if (!function_exists('build_cfg_template')) {
include $this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext;
}
// We fake this class as it is needed by the build_cfg_template function
$module = new \stdClass();
$module->module = $this;
$this->_generate_config_fields($block_data['settings'], $default_settings);
$this->template->assign_vars(array('S_ACTIVE' => $block_data['status'], 'S_TYPE' => $block_data['type'], 'S_NO_WRAP' => $block_data['no_wrap'], 'S_HIDE_TITLE' => $block_data['hide_title'], 'S_BLOCK_CLASS' => trim($block_data['class']), 'S_GROUP_OPS' => $this->_get_group_options($block_data['permission'])));
$this->template->set_filenames(array('block_settings' => 'block_settings.html'));
return $this->template->assign_display('block_settings');
}
示例7: generate_page
/**
* @param int $user_id
* @param bool $admin
* @param bool $auto_login
* @param bool $viewonline
* @param string $redirect
*/
public function generate_page($user_id, $admin, $auto_login, $viewonline, $redirect)
{
$this->user->add_lang_ext('paul999/tfa', 'common');
$modules = $this->getModules();
/**
* @var module_interface $row
*/
foreach ($modules as $row) {
if ($row->is_usable($user_id)) {
$this->template->assign_block_vars('tfa_options', array_merge(array('ID' => $row->get_name(), 'NAME' => $this->user->lang($row->get_translatable_name()), 'U_SUBMIT_AUTH' => $this->controller_helper->route('paul999_tfa_read_controller_submit', array('user_id' => (int) $user_id, 'admin' => (int) $admin, 'auto_login' => (int) $auto_login, 'viewonline' => (int) $viewonline, 'class' => $row->get_name()))), $row->login_start($user_id)));
}
}
add_form_key('tfa_login_page');
$random = sha1(random_bytes(32));
if (!empty($this->user->data['tfa_random'])) {
throw new http_exception(400, 'TFA_SOMETHING_WENT_WRONG');
}
$sql_ary = array('tfa_random' => $random, 'tfa_uid' => $user_id);
$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\tWHERE\n\t\t\t\tsession_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "' AND\n\t\t\t\tsession_user_id = " . (int) $this->user->data['user_id'];
$this->db->sql_query($sql);
$this->template->assign_vars(array('REDIRECT' => $redirect, 'RANDOM' => $random));
page_header('TFA_KEY_REQUIRED');
$this->template->set_filenames(array('body' => '@paul999_tfa/authenticate_main.html'));
page_footer(false);
// Do not include cron on this page!
}
示例8: _get_form
/**
* Get the html form
*
* @param array $block_data
* @return string
*/
private function _get_form(array $block_data)
{
$selected_groups = $this->_ensure_array($block_data['permission']);
$this->template->assign_vars(array('S_ACTIVE' => $block_data['status'], 'S_TYPE' => $block_data['type'], 'S_NO_WRAP' => $block_data['no_wrap'], 'S_HIDE_TITLE' => $block_data['hide_title'], 'S_BLOCK_CLASS' => trim($block_data['class']), 'S_GROUP_OPS' => $this->groups->get_options('special', $selected_groups)));
$this->template->set_filenames(array('block_settings' => 'block_settings.html'));
return $this->template->assign_display('block_settings');
}
示例9: display_panels
/**
* Display the panels (tabs)
*/
public function display_panels()
{
foreach ($this->posting_panels as $name => $lang) {
$this->template->set_filenames(array($name => 'posting/panels/' . $name . '.html'));
$this->template->assign_block_vars('panels', array('NAME' => $name, 'TITLE' => $this->user->lang($lang), 'OUTPUT' => $this->template->assign_display($name)));
}
}
示例10: add_user_form_group
/**
* {@inheritdoc}
*/
public function add_user_form_group($title, $form)
{
$this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form));
$this->template->assign_block_vars('options', array('LEGEND' => $this->language->lang($title), 'S_LEGEND' => true));
foreach ($form as $input_name => $input_options) {
if (!isset($input_options['type'])) {
continue;
}
$tpl_ary = array();
$tpl_ary['TYPE'] = $input_options['type'];
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
$tpl_ary['KEY'] = $input_name;
$tpl_ary['S_EXPLAIN'] = false;
if (isset($input_options['default'])) {
$default = $input_options['default'];
$default = preg_replace_callback('#\\{L_([A-Z0-9\\-_]*)\\}#s', array($this, 'lang_replace_callback'), $default);
$tpl_ary['DEFAULT'] = $default;
}
if (isset($input_options['description'])) {
$tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']);
$tpl_ary['S_EXPLAIN'] = true;
}
if (in_array($input_options['type'], array('select', 'radio'))) {
for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) {
if (isset($input_options['options'][$i]['label'])) {
$input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']);
}
}
$tpl_ary['OPTIONS'] = $input_options['options'];
}
$this->template->assign_block_vars('options', $tpl_ary);
}
$this->template->set_filenames(array('form_install' => 'installer_form.html'));
$this->form = $this->template->assign_display('form_install');
}
示例11: 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();
}
示例12: template
/**
* Set email template to use
*/
function template($template_file, $template_lang = '', $template_path = '')
{
global $config, $phpbb_root_path, $phpEx, $user, $phpbb_extension_manager;
$this->setup_template();
if (!trim($template_file)) {
trigger_error('No template file for emailing set.', E_USER_ERROR);
}
if (!trim($template_lang)) {
// fall back to board default language if the user's language is
// missing $template_file. If this does not exist either,
// $this->template->set_filenames will do a trigger_error
$template_lang = basename($config['default_lang']);
}
if ($template_path) {
$template_paths = array($template_path);
} else {
$template_path = !empty($user->lang_path) ? $user->lang_path : $phpbb_root_path . 'language/';
$template_path .= $template_lang . '/email';
$template_paths = array($template_path);
// we can only specify default language fallback when the path is not a custom one for which we
// do not know the default language alternative
if ($template_lang !== basename($config['default_lang'])) {
$fallback_template_path = !empty($user->lang_path) ? $user->lang_path : $phpbb_root_path . 'language/';
$fallback_template_path .= basename($config['default_lang']) . '/email';
$template_paths[] = $fallback_template_path;
}
}
$this->set_template_paths(array(array('name' => $template_lang . '_email', 'ext_path' => 'language/' . $template_lang . '/email')), $template_paths);
$this->template->set_filenames(array('body' => $template_file . '.txt'));
return true;
}
示例13: stats
public function stats($top_id, $action)
{
if (!$this->config['top_rating_type'] && !isset($this->user->data['user_type'])) {
trigger_error($this->user->lang['NOT_VIEW_RATING']);
}
$statrow = $this->rating->view_stat($top_id);
if ($action && $statrow['top_type'] == 2) {
trigger_error($this->user->lang['TOP_CLOSED']);
}
switch ($action) {
case 'hosts':
if (!$statrow['top_id'] || !$statrow['top_hosts']) {
trigger_error('TOP_NOT');
}
$this->rating->view_stat_hosts($statrow['top_id'], $statrow['top_hosts']);
$page_title = $this->user->lang['TOP_HOSTS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
$this->template->assign_vars(array('S_STATS_HOSTS' => true));
break;
case 'online':
if (!$statrow['top_id'] || !$statrow['top_online']) {
trigger_error('TOP_NOT');
}
$this->rating->view_stat_online($statrow['top_id'], $statrow['top_online']);
$page_title = $this->user->lang['TOP_ONLINE'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
$this->template->assign_vars(array('S_STATS_ONLINE' => true));
break;
case 'click':
if (!$statrow['top_id'] || !$statrow['top_in'] && !$statrow['top_out']) {
trigger_error('TOP_NOT');
}
$top_count = $statrow['top_in'] + $statrow['top_out'];
$this->rating->view_stat_click($statrow['top_id'], $top_count);
$page_title = $this->user->lang['TOP_OUT'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
$this->template->assign_vars(array('S_STATS_CLICK' => true));
break;
case 'country':
if (!$statrow['top_id'] || !$statrow['top_in'] && !$statrow['top_out']) {
trigger_error('TOP_NOT');
}
$this->rating->view_country($statrow['top_id']);
$page_title = $this->user->lang['TOP_COUNTRYS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
$this->template->assign_vars(array('S_STATS_COUNTRY' => true));
break;
default:
$page_title = $this->user->lang['STATISTICS'] . str_replace(array('http://', 'https://'), ' ', $statrow['top_url']);
$catrow = $this->rating->view_cat($statrow['cat_id']);
$description = $statrow['post_text'];
strip_bbcode($description);
$description = str_replace(array(""", "/", "\n", "\t", "\r"), ' ', $description);
$this->template->assign_vars(array('DESCRIPTION' => $description, 'CAT_NAME' => $catrow[$statrow['cat_id']]['cat_title'], 'CAT_URL' => $this->helper->route("bb3top_rating_cat", array('cat_id' => $statrow['cat_id'])), 'S_STATS_DEFAULT' => true));
break;
}
$this->template->assign_vars(array('U_STAT_DEFAULT' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id)), 'U_STAT_HOSTS' => $this->helper->route("bb3top_rating_hosts", array('top_id' => $top_id)), 'U_STAT_ONLINE' => $this->helper->route("bb3top_rating_online", array('top_id' => $top_id)), 'U_STAT_CLICK' => $this->helper->route("bb3top_rating_click", array('top_id' => $top_id)), 'U_STAT_COUNTRY' => $this->helper->route("bb3top_rating_country", array('top_id' => $top_id)), 'U_CANONICAL' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id), false, '', true)));
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['RATING'], 'U_VIEW_FORUM' => $this->helper->route("bb3top_rating_category")));
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $page_title, 'U_VIEW_FORUM' => $this->helper->route("bb3top_rating_stats", array('top_id' => $top_id))));
page_header($page_title);
$this->template->set_filenames(array('body' => '@bb3top_rating/rating_stats.html'));
page_footer();
}
示例14: my
public function my()
{
// HAX (don't add to the view count every time this page is viewed)
// It doesn't look good to the advertisers since this is the only (in a vanilla install) page that would add to the view count but not display them it is fine
$this->config['ads_count_views'] = false;
$this->template->assign_vars(array('S_POSITION_LIST' => true, 'S_AD_LIST' => true));
// Positions
$positions = array();
$sql = 'SELECT position_id, lang_key FROM ' . ADS_POSITIONS_TABLE . ' ORDER BY position_id ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$positions[$row['position_id']] = isset($this->user->lang[$row['lang_key']]) ? $this->user->lang[$row['lang_key']] : $row['lang_key'];
}
$this->db->sql_freeresult($result);
// Forums
$forums = array();
$sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' ORDER BY forum_id ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$forums[$row['forum_id']] = $row['forum_name'];
}
$this->db->sql_freeresult($result);
// Advertisements
$ads = array();
$sql = 'SELECT * FROM ' . ADS_TABLE . '
WHERE ad_owner = ' . $this->user->data['user_id'] . '
ORDER BY ad_enabled DESC, ad_time DESC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$ads[$row['ad_id']] = $row;
$ads[$row['ad_id']]['positions'] = array();
$ads[$row['ad_id']]['forums'] = array();
}
$this->db->sql_freeresult($result);
if (sizeof($ads)) {
$sql = 'SELECT * FROM ' . ADS_IN_POSITIONS_TABLE . '
WHERE ' . $this->db->sql_in_set('ad_id', array_keys($ads));
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$ads[$row['ad_id']]['positions'][] = $positions[$row['position_id']];
}
$this->db->sql_freeresult($result);
$sql = 'SELECT * FROM ' . ADS_FORUMS_TABLE . '
WHERE ' . $this->db->sql_in_set('ad_id', array_keys($ads));
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$ads[$row['ad_id']]['forums'][] = $forums[$row['forum_id']];
}
$this->db->sql_freeresult($result);
}
foreach ($ads as $row) {
$ads_in_positions = implode('<br />', $row['positions']);
$ads_in_forums = implode('<br />', $row['forums']);
$this->template->assign_block_vars('ads', array('AD_ID' => $row['ad_id'], 'AD_ENABLED' => $row['ad_enabled'] ? $this->user->lang['TRUE'] : $this->user->lang['FALSE'], 'AD_CODE' => $row['ad_code'], 'AD_CODE_DISPLAY' => htmlspecialchars_decode($row['ad_code']), 'AD_TIME' => date('d F Y', $row['ad_time']), 'AD_TIME_END' => $row['ad_time_end'] ? date('d F Y', $row['ad_time_end']) : 0, 'AD_VIEW_LIMIT' => $row['ad_view_limit'], 'AD_VIEWS' => $row['ad_views'], 'AD_CLICK_LIMIT' => $row['ad_click_limit'], 'AD_CLICKS' => $row['ad_clicks'] ? $row['ad_clicks'] : $this->user->lang['0_OR_NA'], 'AD_IN_POSITIONS' => $ads_in_positions, 'AD_IN_FORUMS' => $row['all_forums'] ? $this->user->lang['ALL_FORUMS'] : $ads_in_forums));
}
page_header($this->user->lang['MY_ADS']);
$this->template->set_filenames(array('body' => '@bb3mobi_ads/acp_ads.html'));
page_footer();
}
示例15: modify_case_img
/**
* Changes the regex replacement for second pass
*
* @param object $event
* @return null
* @access public
*/
public function modify_case_img($event)
{
$bbcode_id = 4;
// [img] has bbcode_id 4 hardcoded
$bbcode_cache = $event['bbcode_cache'];
if (!isset($bbcode_cache[$bbcode_id]) || !$this->user->optionget('viewimg')) {
return;
}
$this->template->set_filenames(array('bbcode.html' => 'bbcode.html'));
$bbcode = new \bbcode();
// We need these otherwise we cannot use $bbcode->bbcode_tpl()
$bbcode->template_bitfield = new \bitfield($this->user->style['bbcode_bitfield']);
$bbcode->template_filename = $this->template->get_source_file_for_handle('bbcode.html');
$extimgaslink_boardurl = generate_board_url() . '/';
$bbcode_cache[$bbcode_id] = array('preg' => array('#\\[img:$uid\\](' . preg_quote($extimgaslink_boardurl, '#') . '.*?)\\[/img:$uid\\]#s' => $bbcode->bbcode_tpl('img', $bbcode_id), '#\\[img:$uid\\](.*?)\\[/img:$uid\\]#s' => str_replace('$2', $this->user->lang('EXTIMGLINK'), $bbcode->bbcode_tpl('url', $bbcode_id, true))));
$event['bbcode_cache'] = $bbcode_cache;
}