From d419c1932416a96b5949cd8c91a0cce523c4c129 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 17:39:02 +0100 Subject: [PATCH 1/8] [feature/controller] Update readme for Board3 Portal 2.1.x As migrations do not work yet, include instructions for manually installing it. B3P-114 --- README.md | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b0575091..4f48d005 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,222 @@ -#Board3 Portal 2.0.0 +#Board3 Portal 2.1.0 -Board Portal 2.0.0 is a second generation portal for phpBB 3.0.x. It adds a portal with several blocks to your forum. +Board Portal 2.1.0 is a second generation portal for phpBB 3.1.x. It adds a portal with several blocks to your forum. You can change the settings, move the blocks, add new blocks and more in the ACP. ##How to use -You can download the current development version of Board3 Portal 2.0.0 here or download the current release at [www.board3.de](http://www.board3.de/ "Board3 • Portal"). -Board3 Portal can be installed via AutoMOD or manually by following the instructions in install.xml (open it with your browser). +You can download the current development version of Board3 Portal 2.1.x here or download the current release at [www.board3.de](http://www.board3.de/ "Board3 • Portal"). +Board3 Portal 2.1.x can currently not be installed. + +Once the portal has been merged into the new extension system, you can manually install it by executing the following SQL queries (tested on MySQL): +```sql +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 09. Jan 2013 um 17:28 +-- Server Version: 5.5.27 +-- PHP-Version: 5.4.8 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `qi_board3` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `phpbb_portal_config` +-- + +CREATE TABLE IF NOT EXISTS `phpbb_portal_config` ( + `config_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `config_value` mediumtext COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`config_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Daten für Tabelle `phpbb_portal_config` +-- + +INSERT INTO `phpbb_portal_config` (`config_name`, `config_value`) VALUES +('board3_calendar_events_18', ''), +('board3_links_array_21', 0x613a323a7b693a303b613a343a7b733a353a227469746c65223b733a393a22426f617264332e6465223b733a333a2275726c223b733a32313a22687474703a2f2f7777772e626f617264332e64652f223b733a343a2274797065223b693a323b733a31303a227065726d697373696f6e223b733a303a22223b7d693a313b613a343a7b733a353a227469746c65223b733a393a2270687042422e636f6d223b733a333a2275726c223b733a32313a22687474703a2f2f7777772e70687062622e636f6d2f223b733a343a2274797065223b693a323b733a31303a227065726d697373696f6e223b733a303a22223b7d7d), +('board3_menu_array_1', 0x613a31313a7b693a303b613a343a7b733a353a227469746c65223b733a393a224d5f434f4e54454e54223b733a333a2275726c223b733a303a22223b733a343a2274797065223b693a303b733a31303a227065726d697373696f6e223b733a303a22223b7d693a313b613a343a7b733a353a227469746c65223b733a353a22494e444558223b733a333a2275726c223b733a393a22696e6465782e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a323b613a343a7b733a353a227469746c65223b733a363a22534541524348223b733a333a2275726c223b733a31303a227365617263682e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a333b613a343a7b733a353a227469746c65223b733a383a225245474953544552223b733a333a2275726c223b733a32313a227563702e7068703f6d6f64653d7265676973746572223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a313a2231223b7d693a343b613a343a7b733a353a227469746c65223b733a31303a224d454d4245524c495354223b733a333a2275726c223b733a31343a226d656d6265726c6973742e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a333a22322c33223b7d693a353b613a343a7b733a353a227469746c65223b733a383a225448455f5445414d223b733a333a2275726c223b733a32373a226d656d6265726c6973742e7068703f6d6f64653d6c656164657273223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a333a22322c33223b7d693a363b613a343a7b733a353a227469746c65223b733a363a224d5f48454c50223b733a333a2275726c223b733a303a22223b733a343a2274797065223b693a303b733a31303a227065726d697373696f6e223b733a303a22223b7d693a373b613a343a7b733a353a227469746c65223b733a333a22464151223b733a333a2275726c223b733a373a226661712e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a383b613a343a7b733a353a227469746c65223b733a383a224d5f4242434f4445223b733a333a2275726c223b733a31393a226661712e7068703f6d6f64653d6262636f6465223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a393b613a343a7b733a353a227469746c65223b733a373a224d5f5445524d53223b733a333a2275726c223b733a31383a227563702e7068703f6d6f64653d7465726d73223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a31303b613a343a7b733a353a227469746c65223b733a353a224d5f505256223b733a333a2275726c223b733a32303a227563702e7068703f6d6f64653d70726976616379223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d7d), +('board3_welcome_message_10', 0x57656c636f6d6520746f206d7920436f6d6d756e69747921); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `phpbb_portal_modules` +-- + +CREATE TABLE IF NOT EXISTS `phpbb_portal_modules` ( + `module_id` int(3) unsigned NOT NULL AUTO_INCREMENT, + `module_classname` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '', + `module_column` tinyint(3) NOT NULL DEFAULT '0', + `module_order` tinyint(3) NOT NULL DEFAULT '0', + `module_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `module_image_src` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `module_image_width` int(3) NOT NULL DEFAULT '0', + `module_image_height` int(3) NOT NULL DEFAULT '0', + `module_group_ids` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `module_status` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`module_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=22 ; + +-- +-- Daten für Tabelle `phpbb_portal_modules` +-- + +INSERT INTO `phpbb_portal_modules` (`module_id`, `module_classname`, `module_column`, `module_order`, `module_name`, `module_image_src`, `module_image_width`, `module_image_height`, `module_group_ids`, `module_status`) VALUES +(1, 'main_menu', 1, 1, 'M_MENU', 'portal_menu.png', 16, 16, '', 1), +(2, 'stylechanger', 1, 2, 'BOARD_STYLE', 'portal_style.png', 16, 16, '', 1), +(3, 'birthday_list', 1, 3, 'BIRTHDAYS', 'portal_birthday.png', 16, 16, '', 1), +(4, 'clock', 1, 5, 'CLOCK', 'portal_clock.png', 16, 16, '', 1), +(5, 'search', 1, 4, 'PORTAL_SEARCH', 'portal_search.png', 16, 16, '', 1), +(6, 'attachments', 1, 7, 'PORTAL_ATTACHMENTS', 'portal_attach.png', 16, 16, '', 1), +(7, 'topposters', 1, 8, 'TOPPOSTERS', 'portal_top_poster.png', 16, 16, '', 1), +(8, 'latest_members', 1, 9, 'LATEST_MEMBERS', 'portal_members.png', 16, 16, '', 1), +(10, 'welcome', 2, 1, 'PORTAL_WELCOME', '', 16, 16, '', 1), +(11, 'recent', 2, 2, 'PORTAL_RECENT', '', 16, 16, '', 1), +(12, 'announcements', 2, 3, 'GLOBAL_ANNOUNCEMENTS', '', 16, 16, '', 1), +(13, 'news', 2, 4, 'LATEST_NEWS', '', 0, 0, '', 1), +(14, 'poll', 2, 5, 'PORTAL_POLL', 'portal_poll.png', 16, 16, '', 1), +(15, 'whois_online', 2, 6, 'PORTAL_WHOIS_ONLINE', 'portal_friends.png', 16, 16, '', 1), +(16, 'user_menu', 3, 1, 'USER_MENU', 'portal_user.png', 16, 16, '', 1), +(17, 'statistics', 3, 2, 'STATISTICS', 'portal_statistics.png', 16, 16, '', 1), +(18, 'calendar', 3, 3, 'PORTAL_CALENDAR', 'portal_calendar.png', 16, 16, '', 1), +(19, 'leaders', 3, 4, 'THE_TEAM', 'portal_team.png', 16, 16, '', 1), +(20, 'latest_bots', 3, 5, 'LATEST_BOTS', 'portal_bots.png', 16, 16, '', 1), +(21, 'links', 3, 6, 'PORTAL_LINKS', 'portal_links.png', 16, 16, '', 1); + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +``` +and: +```sql +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 09. Jan 2013 um 17:37 +-- Server Version: 5.5.27 +-- PHP-Version: 5.4.8 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `qi_board3` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `phpbb_config` +-- + +CREATE TABLE IF NOT EXISTS `phpbb_config` ( + `config_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `config_value` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', + `is_dynamic` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`config_name`), + KEY `is_dynamic` (`is_dynamic`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Daten für Tabelle `phpbb_config` +-- + +INSERT INTO `phpbb_config` (`config_name`, `config_value`, `is_dynamic`) VALUES +('board3_announcements_archive_12', '1', 0), +('board3_announcements_day_12', '0', 0), +('board3_announcements_forum_exclude_12', '0', 0), +('board3_announcements_length_12', '200', 0), +('board3_announcements_permissions_12', '1', 0), +('board3_announcements_style_12', '0', 0), +('board3_attach_max_length_6', '15', 0), +('board3_attachments_exclude_6', '0', 0), +('board3_attachments_filetype_6', '', 0), +('board3_attachments_forum_exclude_6', '0', 0), +('board3_attachments_forum_ids_6', '', 0), +('board3_attachments_number_6', '8', 0), +('board3_birthdays_ahead_3', '30', 0), +('board3_calendar_sunday_color_18', '#FF0000', 0), +('board3_calendar_today_color_18', '#000000', 0), +('board3_clock_src_4', 'board3clock.swf', 0), +('board3_display_events_18', '0', 0), +('board3_display_jumpbox', '1', 0), +('board3_enable', '1', 0), +('board3_events_18', '', 0), +('board3_events_url_new_window_18', '0', 0), +('board3_forum_index', '1', 0), +('board3_global_announcements_forum_12', '', 0), +('board3_last_visited_bots_number_20', '1', 0), +('board3_leaders_ext_19', '0', 0), +('board3_left_column', '1', 0), +('board3_left_column_width', '180', 0), +('board3_links_21', '', 0), +('board3_links_url_new_window_21', '0', 0), +('board3_long_month_18', '0', 0), +('board3_max_last_member_8', '8', 0), +('board3_max_topics_11', '10', 0), +('board3_menu_1', '', 0), +('board3_menu_url_new_window_1', '0', 0), +('board3_news_archive_13', '1', 0), +('board3_news_exclude_13', '0', 0), +('board3_news_forum_13', '', 0), +('board3_news_length_13', '250', 0), +('board3_news_permissions_13', '1', 0), +('board3_news_show_last_13', '0', 0), +('board3_news_style_13', '0', 0), +('board3_number_of_announcements_12', '1', 0), +('board3_number_of_news_13', '5', 0), +('board3_phpbb_menu', '0', 0), +('board3_poll_allow_vote_14', '1', 0), +('board3_poll_exclude_id_14', '0', 0), +('board3_poll_hide_14', '0', 0), +('board3_poll_limit_14', '3', 0), +('board3_poll_topic_id_14', '', 0), +('board3_portal_version', '2.0.1', 0), +('board3_recent_exclude_forums_11', '1', 0), +('board3_recent_forum_11', '', 0), +('board3_recent_title_limit_11', '100', 0), +('board3_right_column', '1', 0), +('board3_right_column_width', '180', 0), +('board3_show_all_news_13', '1', 0), +('board3_show_announcements_replies_views_12', '1', 0), +('board3_show_news_replies_views_13', '1', 0), +('board3_sunday_first_18', '1', 0), +('board3_topposters_7', '5', 0), +('board3_user_menu_register_16', '1', 0), +('board3_version_check', '1', 0), +('board3_welcome_message_10', '', 0), +('board3_welcome_message_bitfield_10', '', 0), +('board3_welcome_message_uid_10', '', 0); + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +``` ##Support From 48bce54c483f541a36fe89b22976bc40b7363773 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 17:44:51 +0100 Subject: [PATCH 2/8] [feature/controller] Move main controller to controller directory A few minor improvements to variables etc. were also added. B3P-114 --- root/{controller.php => controller/main.php} | 100 +++++++++++++++---- 1 file changed, 80 insertions(+), 20 deletions(-) rename root/{controller.php => controller/main.php} (71%) diff --git a/root/controller.php b/root/controller/main.php similarity index 71% rename from root/controller.php rename to root/controller/main.php index e383a908..103eae68 100644 --- a/root/controller.php +++ b/root/controller/main.php @@ -1,21 +1,85 @@ auth = $auth; + $this->config = $config; + $this->template = $template; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/'; + } + /** * Extension front handler method. This is called automatically when your extension is accessed * through index.php?ext=example/foobar * @return null */ public function handle() - { - global $phpbb_root_path, $phpEx; - - $this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/'; - + { $this->check_permission(); // We defined the phpBB objects in __construct() and can use them in the rest of our class like this //echo 'Welcome, ' . $this->user->data['username']; @@ -45,11 +109,9 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller // check if user should be able to access this page private function check_permission() { - global $config, $auth, $phpbb_root_path, $phpEx; - - if (!isset($config['board3_enable']) || !$config['board3_enable'] || !$auth->acl_get('u_view_portal')) + if (!isset($this->config['board3_enable']) || !$this->config['board3_enable'] || !$this->auth->acl_get('u_view_portal')) { - redirect(append_sid($phpbb_root_path . 'index.' . $phpEx)); + redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext)); } } @@ -60,8 +122,6 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller */ private function display_modules() { - global $template, $phpbb_root_path; - /** * get initial data */ @@ -94,7 +154,7 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller $class_name = 'portal_' . $row['module_classname'] . '_module'; if (!class_exists($class_name)) { - include("{$this->root_path}modules/portal_{$row['module_classname']}.$phpEx"); + include("{$this->root_path}modules/portal_{$row['module_classname']}.{$this->php_ext}"); } if (!class_exists($class_name)) { @@ -117,7 +177,7 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller { $user->add_lang_ext('board3/portal', 'mods/portal/' . $module->language); } - if ($row['module_column'] == column_string_num('left') && $config['board3_left_column']) + if ($row['module_column'] == column_string_num('left') && $this->config['board3_left_column']) { $template_module = $module->get_template_side($row['module_id']); $template_column = 'left'; @@ -129,7 +189,7 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller $template_column = 'center'; ++$module_count['center']; } - if ($row['module_column'] == column_string_num('right') && $config['board3_right_column']) + if ($row['module_column'] == column_string_num('right') && $this->config['board3_right_column']) { $template_module = $module->get_template_side($row['module_id']); $template_column = 'right'; @@ -153,7 +213,7 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller // Custom Blocks that have been defined in the ACP will return an array instead of just the name of the template file if (is_array($template_module)) { - $template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( + $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'], 'IMAGE_SRC' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'], 'TITLE' => $template_module['title'], @@ -165,7 +225,7 @@ class phpbb_ext_board3_portal_controller extends phpbb_extension_controller } else { - $template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( + $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module, 'IMAGE_SRC' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'], 'IMAGE_WIDTH' => $row['module_image_width'], From 3a6640450cbe81d9487b94e9a6838b9d32902b45 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:19:55 +0100 Subject: [PATCH 3/8] [feature/controller] Update readme for correct database changes B3P-114 --- README.md | 87 ++++--------------------------------------------------- 1 file changed, 5 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index 4f48d005..d7904869 100644 --- a/README.md +++ b/README.md @@ -10,56 +10,18 @@ Board3 Portal 2.1.x can currently not be installed. Once the portal has been merged into the new extension system, you can manually install it by executing the following SQL queries (tested on MySQL): ```sql --- phpMyAdmin SQL Dump --- version 3.5.2.2 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Erstellungszeit: 09. Jan 2013 um 17:28 --- Server Version: 5.5.27 --- PHP-Version: 5.4.8 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Datenbank: `qi_board3` --- - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `phpbb_portal_config` --- - CREATE TABLE IF NOT EXISTS `phpbb_portal_config` ( `config_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', `config_value` mediumtext COLLATE utf8_bin NOT NULL, PRIMARY KEY (`config_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; --- --- Daten für Tabelle `phpbb_portal_config` --- - INSERT INTO `phpbb_portal_config` (`config_name`, `config_value`) VALUES ('board3_calendar_events_18', ''), ('board3_links_array_21', 0x613a323a7b693a303b613a343a7b733a353a227469746c65223b733a393a22426f617264332e6465223b733a333a2275726c223b733a32313a22687474703a2f2f7777772e626f617264332e64652f223b733a343a2274797065223b693a323b733a31303a227065726d697373696f6e223b733a303a22223b7d693a313b613a343a7b733a353a227469746c65223b733a393a2270687042422e636f6d223b733a333a2275726c223b733a32313a22687474703a2f2f7777772e70687062622e636f6d2f223b733a343a2274797065223b693a323b733a31303a227065726d697373696f6e223b733a303a22223b7d7d), ('board3_menu_array_1', 0x613a31313a7b693a303b613a343a7b733a353a227469746c65223b733a393a224d5f434f4e54454e54223b733a333a2275726c223b733a303a22223b733a343a2274797065223b693a303b733a31303a227065726d697373696f6e223b733a303a22223b7d693a313b613a343a7b733a353a227469746c65223b733a353a22494e444558223b733a333a2275726c223b733a393a22696e6465782e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a323b613a343a7b733a353a227469746c65223b733a363a22534541524348223b733a333a2275726c223b733a31303a227365617263682e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a333b613a343a7b733a353a227469746c65223b733a383a225245474953544552223b733a333a2275726c223b733a32313a227563702e7068703f6d6f64653d7265676973746572223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a313a2231223b7d693a343b613a343a7b733a353a227469746c65223b733a31303a224d454d4245524c495354223b733a333a2275726c223b733a31343a226d656d6265726c6973742e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a333a22322c33223b7d693a353b613a343a7b733a353a227469746c65223b733a383a225448455f5445414d223b733a333a2275726c223b733a32373a226d656d6265726c6973742e7068703f6d6f64653d6c656164657273223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a333a22322c33223b7d693a363b613a343a7b733a353a227469746c65223b733a363a224d5f48454c50223b733a333a2275726c223b733a303a22223b733a343a2274797065223b693a303b733a31303a227065726d697373696f6e223b733a303a22223b7d693a373b613a343a7b733a353a227469746c65223b733a333a22464151223b733a333a2275726c223b733a373a226661712e706870223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a383b613a343a7b733a353a227469746c65223b733a383a224d5f4242434f4445223b733a333a2275726c223b733a31393a226661712e7068703f6d6f64653d6262636f6465223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a393b613a343a7b733a353a227469746c65223b733a373a224d5f5445524d53223b733a333a2275726c223b733a31383a227563702e7068703f6d6f64653d7465726d73223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d693a31303b613a343a7b733a353a227469746c65223b733a353a224d5f505256223b733a333a2275726c223b733a32303a227563702e7068703f6d6f64653d70726976616379223b733a343a2274797065223b693a313b733a31303a227065726d697373696f6e223b733a303a22223b7d7d), ('board3_welcome_message_10', 0x57656c636f6d6520746f206d7920436f6d6d756e69747921); --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `phpbb_portal_modules` --- - CREATE TABLE IF NOT EXISTS `phpbb_portal_modules` ( `module_id` int(3) unsigned NOT NULL AUTO_INCREMENT, `module_classname` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '', @@ -74,10 +36,6 @@ CREATE TABLE IF NOT EXISTS `phpbb_portal_modules` ( PRIMARY KEY (`module_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=22 ; --- --- Daten für Tabelle `phpbb_portal_modules` --- - INSERT INTO `phpbb_portal_modules` (`module_id`, `module_classname`, `module_column`, `module_order`, `module_name`, `module_image_src`, `module_image_width`, `module_image_height`, `module_group_ids`, `module_status`) VALUES (1, 'main_menu', 1, 1, 'M_MENU', 'portal_menu.png', 16, 16, '', 1), (2, 'stylechanger', 1, 2, 'BOARD_STYLE', 'portal_style.png', 16, 16, '', 1), @@ -99,41 +57,9 @@ INSERT INTO `phpbb_portal_modules` (`module_id`, `module_classname`, `module_col (19, 'leaders', 3, 4, 'THE_TEAM', 'portal_team.png', 16, 16, '', 1), (20, 'latest_bots', 3, 5, 'LATEST_BOTS', 'portal_bots.png', 16, 16, '', 1), (21, 'links', 3, 6, 'PORTAL_LINKS', 'portal_links.png', 16, 16, '', 1); - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ``` and: ```sql --- phpMyAdmin SQL Dump --- version 3.5.2.2 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Erstellungszeit: 09. Jan 2013 um 17:37 --- Server Version: 5.5.27 --- PHP-Version: 5.4.8 - -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Datenbank: `qi_board3` --- - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `phpbb_config` --- - CREATE TABLE IF NOT EXISTS `phpbb_config` ( `config_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', `config_value` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', @@ -142,10 +68,6 @@ CREATE TABLE IF NOT EXISTS `phpbb_config` ( KEY `is_dynamic` (`is_dynamic`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; --- --- Daten für Tabelle `phpbb_config` --- - INSERT INTO `phpbb_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('board3_announcements_archive_12', '1', 0), ('board3_announcements_day_12', '0', 0), @@ -212,11 +134,12 @@ INSERT INTO `phpbb_config` (`config_name`, `config_value`, `is_dynamic`) VALUES ('board3_welcome_message_10', '', 0), ('board3_welcome_message_bitfield_10', '', 0), ('board3_welcome_message_uid_10', '', 0); - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; ``` +and finally: +```sql +INSERT INTO `phpbb_acl_options` (`auth_option`, `is_global`, `is_local`, `founder_only`) VALUES +('u_view_portal', 1, 0, 0), +('a_manage_portal', 1, 0, 0);``` ##Support From 93b3291de9234b6739a90f22cd49453e39e480fa Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:21:13 +0100 Subject: [PATCH 4/8] [feature/controller] Fix incorrect coding and docblocks in main controller B3P-114 --- root/controller/main.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/root/controller/main.php b/root/controller/main.php index 103eae68..bb84529f 100644 --- a/root/controller/main.php +++ b/root/controller/main.php @@ -7,17 +7,17 @@ * */ -class phpbb_ext_board3_portal_controller_main extends phpbb_extension_controller +class phpbb_ext_board3_portal_controller_main { /** * Auth object - * @var phpbb_aut + * @var phpbb_auth */ private $auth; /** * phpBB Config object - * @var phpbb_config + * @var phpbb_config_db */ private $config; @@ -56,7 +56,7 @@ class phpbb_ext_board3_portal_controller_main extends phpbb_extension_controller * NOTE: The parameters of this method must match in order and type with * the dependencies defined in the services.yml file for this service. * @param phpbb_auth $auth Auth object - * @param phpbb_config $config phpBB Config object + * @param phpbb_config_db $config phpBB Config object * @param phpbb_template $template Template object * @param phpbb_user $user User object * @param string $phpbb_root_path phpBB root path @@ -111,7 +111,7 @@ class phpbb_ext_board3_portal_controller_main extends phpbb_extension_controller { if (!isset($this->config['board3_enable']) || !$this->config['board3_enable'] || !$this->auth->acl_get('u_view_portal')) { - redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext)); + redirect(append_sid($this->phpbb_root_path . 'index' . $this->php_ext)); } } From 632c7ab24f5b4e47a530d99fd46422df5b44e385 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:22:44 +0100 Subject: [PATCH 5/8] [feature/controller] Add routing and services files B3P-114 --- root/config/routing.yml | 8 ++++++++ root/config/services.yml | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 root/config/routing.yml create mode 100644 root/config/services.yml diff --git a/root/config/routing.yml b/root/config/routing.yml new file mode 100644 index 00000000..fcca93e6 --- /dev/null +++ b/root/config/routing.yml @@ -0,0 +1,8 @@ +board3_controller: + pattern: /portal + defaults: { _controller: board3.portal.main:handle } + +# This is currently not supported yet +board3_pages_controller: + pattern: /portal/{page} + defaults: { _controller: board3.portal.main:handle_page, page: "portal" } \ No newline at end of file diff --git a/root/config/services.yml b/root/config/services.yml new file mode 100644 index 00000000..e1cd809a --- /dev/null +++ b/root/config/services.yml @@ -0,0 +1,11 @@ +services: + + board3.portal.main: + class: phpbb_ext_board3_portal_controller_main + arguments: + - @auth + - @config + - @template + - @user + - %core.root_path% + - .%core.php_ext% From 742ac5bdea19e6e2190f977d67bba7b781cc252e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:28:05 +0100 Subject: [PATCH 6/8] [feature/controller] Include portal files and fix incorrect variables B3P-114 --- root/controller/main.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/root/controller/main.php b/root/controller/main.php index bb84529f..98ba2ef5 100644 --- a/root/controller/main.php +++ b/root/controller/main.php @@ -71,6 +71,13 @@ class phpbb_ext_board3_portal_controller_main $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/'; + + if (!function_exists('obtain_portal_config')) + { + include($this->root_path . 'includes/constants' . $this->php_ext); + include($this->root_path . 'includes/functions_modules' . $this->php_ext); + include($this->root_path . 'includes/functions' . $this->php_ext); + } } /** @@ -154,11 +161,11 @@ class phpbb_ext_board3_portal_controller_main $class_name = 'portal_' . $row['module_classname'] . '_module'; if (!class_exists($class_name)) { - include("{$this->root_path}modules/portal_{$row['module_classname']}.{$this->php_ext}"); + include("{$this->root_path}modules/portal_{$row['module_classname']}{$this->php_ext}"); } if (!class_exists($class_name)) { - trigger_error(sprintf($user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR); + trigger_error(sprintf($this->user->lang['CLASS_NOT_FOUND'], $class_name, 'portal_' . $row['module_classname']), E_USER_ERROR); } $module = new $class_name(); @@ -168,14 +175,14 @@ class phpbb_ext_board3_portal_controller_main * the default group of a user always defines his/her permission (KISS) */ $group_ary = (!empty($row['module_group_ids'])) ? explode(',', $row['module_group_ids']) : ''; - if ((is_array($group_ary) && !in_array($user->data['group_id'], $group_ary))) + if ((is_array($group_ary) && !in_array($this->user->data['group_id'], $group_ary))) { continue; } if ($module->language) { - $user->add_lang_ext('board3/portal', 'mods/portal/' . $module->language); + $this->user->add_lang_ext('board3/portal', 'mods/portal/' . $module->language); } if ($row['module_column'] == column_string_num('left') && $this->config['board3_left_column']) { @@ -215,7 +222,7 @@ class phpbb_ext_board3_portal_controller_main { $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'], - 'IMAGE_SRC' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'], + 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'], 'TITLE' => $template_module['title'], 'CODE' => $template_module['code'], 'MODULE_ID' => $row['module_id'], @@ -227,11 +234,11 @@ class phpbb_ext_board3_portal_controller_main { $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module, - 'IMAGE_SRC' => $this->root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'], + 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'], 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height'], 'MODULE_ID' => $row['module_id'], - 'TITLE' => (isset($user->lang[$row['module_name']])) ? $user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']), + 'TITLE' => (isset($this->user->lang[$row['module_name']])) ? $this->user->lang[$row['module_name']] : utf8_normalize_nfc($row['module_name']), )); } unset($template_module); From edf7541001cb6f887b63aabef1d8db16d8d562aa Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 9 Jan 2013 18:29:25 +0100 Subject: [PATCH 7/8] [feature/controller] Fix displayal of readme B3P-114 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d7904869..0e14144f 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,8 @@ and finally: ```sql INSERT INTO `phpbb_acl_options` (`auth_option`, `is_global`, `is_local`, `founder_only`) VALUES ('u_view_portal', 1, 0, 0), -('a_manage_portal', 1, 0, 0);``` +('a_manage_portal', 1, 0, 0); +``` ##Support From b755201897c101dd1135e6e71a8ddc98fcd28f88 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 25 Feb 2013 11:41:57 +0100 Subject: [PATCH 8/8] [feature/controller] Fix missing issues that prevented portal from working The portal still requires the fix to PHPBB3-11323 in order to work. B3P-114 --- root/controller/main.php | 86 +++++++++++--------- root/portal/includes/functions.php | 6 +- root/portal/modules/portal_birthday_list.php | 8 +- root/portal/modules/portal_calendar.php | 13 +-- root/portal/modules/portal_news.php | 7 +- root/portal/modules/portal_statistics.php | 13 ++- root/portal/modules/portal_stylechanger.php | 2 +- root/portal/modules/portal_user_menu.php | 2 +- 8 files changed, 75 insertions(+), 62 deletions(-) diff --git a/root/controller/main.php b/root/controller/main.php index 98ba2ef5..5968328a 100644 --- a/root/controller/main.php +++ b/root/controller/main.php @@ -64,13 +64,16 @@ class phpbb_ext_board3_portal_controller_main */ public function __construct($auth, $config, $template, $user, $phpbb_root_path, $php_ext) { + global $portal_root_path; + $this->auth = $auth; $this->config = $config; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->root_path = $phpbb_root_path . '/ext/board3/portal/portal/'; + $this->root_path = $phpbb_root_path . 'ext/board3/portal/portal/'; + $portal_root_path = $this->root_path; if (!function_exists('obtain_portal_config')) { @@ -86,7 +89,7 @@ class phpbb_ext_board3_portal_controller_main * @return null */ public function handle() - { + { $this->check_permission(); // We defined the phpBB objects in __construct() and can use them in the rest of our class like this //echo 'Welcome, ' . $this->user->data['username']; @@ -96,39 +99,6 @@ class phpbb_ext_board3_portal_controller_main // 2) what language file to use $this->user->add_lang_ext('board3/portal', 'mods/portal'); - //$this->template->set_ext_dir_prefix($phpbb_root_path . 'ext/board3/portal/'); - - $this->display_modules(); - - // foobar_body.html is in ./ext/foobar/example/styles/prosilver/template/foobar_body.html - $this->template->set_filenames(array( - 'body' => 'portal/portal_body.html' - )); - - // And we assign template variables the same as before as well - $this->template->assign_var('MESSAGE', 'Yes, this is hard-coded language, which should still be avoided in virtually all cases.'); - - // And now to output the page. - page_header($this->user->lang('PORTAL')); - page_footer(); - } - - // check if user should be able to access this page - private function check_permission() - { - if (!isset($this->config['board3_enable']) || !$this->config['board3_enable'] || !$this->auth->acl_get('u_view_portal')) - { - redirect(append_sid($this->phpbb_root_path . 'index' . $this->php_ext)); - } - } - - /** - * Display the portal modules - * - * @return: true if page can be display, false if there are no modules to display - */ - private function display_modules() - { /** * get initial data */ @@ -222,7 +192,7 @@ class phpbb_ext_board3_portal_controller_main { $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module['template'], - 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $template_module['image_src'], + 'IMAGE_SRC' => $this->root_path . '../styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $template_module['image_src'], 'TITLE' => $template_module['title'], 'CODE' => $template_module['code'], 'MODULE_ID' => $row['module_id'], @@ -234,7 +204,7 @@ class phpbb_ext_board3_portal_controller_main { $this->template->assign_block_vars('modules_' . column_num_string($row['module_column']), array( 'TEMPLATE_FILE' => 'portal/modules/' . $template_module, - 'IMAGE_SRC' => $this->root_path . 'styles/' . $this->user->theme['theme_path'] . '/theme/images/portal/' . $row['module_image_src'], + 'IMAGE_SRC' => $this->root_path . '../styles/' . $this->user->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'], 'IMAGE_WIDTH' => $row['module_image_width'], 'IMAGE_HEIGHT' => $row['module_image_height'], 'MODULE_ID' => $row['module_id'], @@ -243,7 +213,45 @@ class phpbb_ext_board3_portal_controller_main } unset($template_module); } - return sizeof($portal_modules); + $module_count['total'] = sizeof($portal_modules); + + // Redirect to index if there are currently no active modules + if($module_count['total'] < 1) + { + redirect(append_sid($this->phpbb_root_path . 'index.' . $phpEx)); + } + + // Assign specific vars + $this->template->assign_vars(array( + // 'S_SMALL_BLOCK' => true, + 'S_PORTAL_LEFT_COLUMN' => $this->config['board3_left_column_width'], + 'S_PORTAL_RIGHT_COLUMN' => $this->config['board3_right_column_width'], + 'S_LEFT_COLUMN' => ($module_count['left'] > 0 && $this->config['board3_left_column']) ? true : false, + 'S_CENTER_COLUMN' => ($module_count['center'] > 0) ? true : false, + 'S_RIGHT_COLUMN' => ($module_count['right'] > 0 && $this->config['board3_right_column']) ? true : false, + 'S_TOP_COLUMN' => ($module_count['top'] > 0) ? true : false, + 'S_BOTTOM_COLUMN' => ($module_count['bottom'] > 0) ? true : false, + 'S_DISPLAY_PHPBB_MENU' => $this->config['board3_phpbb_menu'], + 'B3P_DISPLAY_JUMPBOX' => $this->config['board3_display_jumpbox'], + )); + + // And now to output the page. + page_header($this->user->lang('PORTAL')); + + // foobar_body.html is in ./ext/foobar/example/styles/prosilver/template/foobar_body.html + $this->template->set_filenames(array( + 'body' => 'portal/portal_body.html' + )); + + page_footer(); + } + + // check if user should be able to access this page + private function check_permission() + { + if (!isset($this->config['board3_enable']) || !$this->config['board3_enable'] || !$this->auth->acl_get('u_view_portal')) + { + redirect(append_sid($this->phpbb_root_path . 'index' . $this->php_ext)); + } } - } diff --git a/root/portal/includes/functions.php b/root/portal/includes/functions.php index 796c0c26..88b545d0 100644 --- a/root/portal/includes/functions.php +++ b/root/portal/includes/functions.php @@ -404,16 +404,16 @@ function character_limit(&$title, $limit = 0) */ function get_sub_taged_string($message, $bbcode_uid, $length) { - global $phpbb_root_path, $phpEx; + global $portal_root_path, $phpEx; if(!class_exists('phpbb_trim_message')) { - include($phpbb_root_path . 'includes/trim_message/trim_message.' . $phpEx); + include($portal_root_path . '../includes/trim_message/trim_message.' . $phpEx); } if(!class_exists('phpbb_trim_message_bbcodes')) { - include($phpbb_root_path . 'includes/trim_message/bbcodes.' . $phpEx); + include($portal_root_path . '../includes/trim_message/bbcodes.' . $phpEx); } $object = new phpbb_trim_message($message, $bbcode_uid, $length); diff --git a/root/portal/modules/portal_birthday_list.php b/root/portal/modules/portal_birthday_list.php index 9a2e5a45..2ffcaf9f 100644 --- a/root/portal/modules/portal_birthday_list.php +++ b/root/portal/modules/portal_birthday_list.php @@ -53,14 +53,16 @@ class portal_birthday_list_module // Generate birthday list if required ... / borrowed from index.php 3.0.6 $birthday_list = $birthday_ahead_list = ''; + if ($config['load_birthdays'] && $config['allow_birthdays']) { - $now = getdate(time() + $user->timezone + $user->dst - date('Z')); + $time = $user->create_datetime(); + $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset()); $cache_days = $config['board3_birthdays_ahead_' . $module_id]; $sql_days = ''; while ($cache_days > 0) { - $day = getdate(time() + 86400 * $cache_days + $user->timezone + $user->dst - date('Z')); + $day = phpbb_gmgetdate($time->getTimestamp() + 86400 * $cache_days + $time->getOffset()); $sql_days .= " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $day['mday'], $day['mon'])) . "%'"; $cache_days--; } @@ -76,7 +78,7 @@ class portal_birthday_list_module $order_by = 'SUBSTRING(u.user_birthday FROM 4 FOR 2) ASC, SUBSTRING(u.user_birthday FROM 1 FOR 2) ASC, u.username_clean ASC'; break; } - $now = getdate(time() + $user->timezone + $user->dst - date('Z')); + $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday FROM ' . USERS_TABLE . ' u LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid) diff --git a/root/portal/modules/portal_calendar.php b/root/portal/modules/portal_calendar.php index e2a965d1..43ca6ec5 100644 --- a/root/portal/modules/portal_calendar.php +++ b/root/portal/modules/portal_calendar.php @@ -89,8 +89,11 @@ class portal_calendar_module } // initialise some variables - $today_timestamp = time() + $user->timezone + $user->dst; - $mini_cal_today = date('Ymd', time() + $user->timezone + $user->dst - date('Z')); + $time = $user->create_datetime(); + $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset()); + $today_timestamp = $now[0]; + $mini_cal_today = date('Ymd', $today_timestamp - date('Z')); + $this->stamp = $today_timestamp; $s_cal_month = ($this->mini_cal_month != 0) ? $this->mini_cal_month . ' month' : $mini_cal_today; $this->getMonth($s_cal_month); $mini_cal_count = $this->mini_cal_fdow; @@ -102,8 +105,8 @@ class portal_calendar_module // output our general calendar bits $down = $this->mini_cal_month - 1; $up = $this->mini_cal_month + 1; - $prev_month = '<<'; - $next_month = '>>'; + $prev_month = '<<'; + $next_month = '>>'; $template->assign_block_vars('minical', array( 'S_SUNDAY_FIRST' => ($config['board3_sunday_first_' . $module_id]) ? true : false, @@ -576,7 +579,7 @@ class portal_calendar_module { global $user; - $this->stamp = strtotime($date) + $user->timezone + $user->dst; + $this->stamp = (empty($this->stamp)) ? strtotime($date) + $user->timezone + $user->dst : $this->stamp; return ($this->stamp); } diff --git a/root/portal/modules/portal_news.php b/root/portal/modules/portal_news.php index 4cc1088f..e63a8dd2 100644 --- a/root/portal/modules/portal_news.php +++ b/root/portal/modules/portal_news.php @@ -207,6 +207,8 @@ class portal_news_module // Grab icons $icons = $cache->obtain_icons(); + phpbb_generate_template_pagination($template, $view_topic_url, 'pagination', 'np', $fetch_news[$i]['topic_replies'], $config['board3_number_of_news_' . $module_id], $start); + $template->assign_block_vars('news_row', array( 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '', @@ -240,7 +242,6 @@ class portal_news_module 'S_NOT_LAST' => ($i < sizeof($fetch_news) - 1) ? true : false, 'S_POLL' => $fetch_news[$i]['poll'], 'S_UNREAD_INFO' => $unread_topic, - 'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url), 'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false, )); @@ -258,8 +259,8 @@ class portal_news_module { $template->assign_vars(array( 'NP_PAGINATION' => $pagination, - 'TOTAL_NEWS' => ($total_news == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $total_news), - 'NP_PAGE_NUMBER' => on_page($total_news, $config['board3_number_of_news_' . $module_id], $start)) + 'TOTAL_NEWS' => ($total_news == 1) ? sprintf($user->lang['VIEW_FORUM_TOPICS'][1], $total_news) : sprintf($user->lang['VIEW_FORUM_TOPICS'][2], $total_news), + 'NP_PAGE_NUMBER' => phpbb_on_page($template, $user, $view_topic_url, $total_news, $config['board3_number_of_news_' . $module_id], $start)) ); } } diff --git a/root/portal/modules/portal_statistics.php b/root/portal/modules/portal_statistics.php index e4bdba18..d558889e 100644 --- a/root/portal/modules/portal_statistics.php +++ b/root/portal/modules/portal_statistics.php @@ -63,9 +63,9 @@ class portal_statistics_module $total_users = $config['num_users']; $total_files = $config['num_files']; - $l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER'; - $l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER'; - $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER'; + $l_total_user_s = ($total_users == 0) ? sprintf($user->lang['TOTAL_USERS_ZERO'], $total_users) : sprintf($user->lang['TOTAL_USERS'][2], $total_users); + $l_total_post_s = ($total_posts == 0) ? sprintf($user->lang['TOTAL_POSTS_ZERO'], $total_posts) : sprintf($user->lang['TOTAL_POSTS_COUNT'][2], $total_posts); + $l_total_topic_s = ($total_topics == 0) ? sprintf($user->lang['TOTAL_TOPICS_ZERO'], $total_topics) : sprintf($user->lang['TOTAL_TOPICS'][2], $total_topics); // avarage stat $board_days = (time() - $config['board_startdate']) / 86400; @@ -116,12 +116,11 @@ class portal_statistics_module $topics_count = $this->get_topics_count(); - // Assign specific vars $template->assign_vars(array( - 'B3_TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts), - 'B3_TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics), - 'B3_TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users), + 'B3_TOTAL_POSTS' => $l_total_post_s, + 'B3_TOTAL_TOPICS' => $l_total_topic_s, + 'B3_TOTAL_USERS' => $l_total_user_s, 'B3_NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), 'B3_ANNOUNCE_COUNT' => $topics_count[POST_ANNOUNCE], 'B3_STICKY_COUNT' => $topics_count[POST_STICKY], diff --git a/root/portal/modules/portal_stylechanger.php b/root/portal/modules/portal_stylechanger.php index cb933b90..db233411 100644 --- a/root/portal/modules/portal_stylechanger.php +++ b/root/portal/modules/portal_stylechanger.php @@ -70,7 +70,7 @@ class portal_stylechanger_module $url = append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']); } ++$style_count; - $style_select .= ''; + $style_select .= ''; } $db->sql_freeresult($result); if(strlen($style_select)) diff --git a/root/portal/modules/portal_user_menu.php b/root/portal/modules/portal_user_menu.php index 47d31f69..a5276a18 100644 --- a/root/portal/modules/portal_user_menu.php +++ b/root/portal/modules/portal_user_menu.php @@ -51,7 +51,7 @@ class portal_user_menu_module { global $config, $template, $user, $auth, $db, $phpEx, $phpbb_root_path; - if (!function_exists('display_forums')) + if (!function_exists('get_user_avatar')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); }