Merge pull request #153 from marc1706/fix/namespaces

[fix/namespaces] Fix portal after adding namespaces
This commit is contained in:
Marc Alexander
2013-10-17 12:43:52 -07:00
12 changed files with 86 additions and 68 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "board3/portal",
"type": "phpbb3-extension",
"type": "phpbb-extension",
"description": "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.",
"homepage": "http://www.board3.de",
"version": "2.1.0-dev",
@@ -47,7 +47,7 @@
}],
"require": {
"php": ">=5.2",
"phpbb": "3.1.0-dev"
"phpbb/phpbb": "3.1.0-dev"
},
"extra": {
"display-name": "Board3 Portal"

View File

@@ -1,11 +1,12 @@
services:
board3.portal.main:
class: phpbb_ext_board3_portal_controller_main
class: \board3\portal\controller\main
arguments:
- @auth
- @config
- @template
- @user
- @path_helper
- %core.root_path%
- .%core.php_ext%

View File

@@ -7,7 +7,9 @@
*
*/
class phpbb_ext_board3_portal_controller_main
namespace board3\portal\controller;
class main
{
/**
* Auth object
@@ -57,6 +59,12 @@ class phpbb_ext_board3_portal_controller_main
*/
private $includes_path;
/**
* phpBB path helper
* @var \phpbb\path_helper
*/
protected $path_helper;
/**
* Constructor
* NOTE: The parameters of this method must match in order and type with
@@ -65,10 +73,11 @@ class phpbb_ext_board3_portal_controller_main
* @param phpbb_config_db $config phpBB Config object
* @param phpbb_template $template Template object
* @param phpbb_user $user User object
* @param \phpbb\path_helper $path_helper phpBB path helper
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
*/
public function __construct($auth, $config, $template, $user, $phpbb_root_path, $php_ext)
public function __construct($auth, $config, $template, $user, $path_helper, $phpbb_root_path, $php_ext)
{
global $portal_root_path;
@@ -76,6 +85,7 @@ class phpbb_ext_board3_portal_controller_main
$this->config = $config;
$this->template = $template;
$this->user = $user;
$this->path_helper = $path_helper;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->includes_path = $phpbb_root_path . 'ext/board3/portal/portal/';
@@ -90,21 +100,21 @@ class phpbb_ext_board3_portal_controller_main
}
}
/**
* Extension front handler method. This is called automatically when your extension is accessed
* through index.php?ext=example/foobar
* @return null
*/
public function handle()
{
/**
* Extension front handler method. This is called automatically when your extension is accessed
* through index.php?ext=example/foobar
* @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'];
// 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'];
// The following takes two arguments:
// 1) which extension language folder we're using (it's not smart enough to use its own automatically)
// 2) what language file to use
$this->user->add_lang_ext('board3/portal', 'mods/portal');
// The following takes two arguments:
// 1) which extension language folder we're using (it's not smart enough to use its own automatically)
// 2) what language file to use
$this->user->add_lang_ext('board3/portal', 'mods/portal');
/**
* get initial data
@@ -199,7 +209,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->style['style_path'] . '/theme/images/portal/' . $template_module['image_src'],
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . $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'],
@@ -211,7 +221,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->style['style_path'] . '/theme/images/portal/' . $row['module_image_src'],
'IMAGE_SRC' => $this->path_helper->get_web_root_path() . $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'],
@@ -240,19 +250,19 @@ class phpbb_ext_board3_portal_controller_main
'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'],
'T_EXT_THEME_PATH' => $this->phpbb_root_path . 'ext/board3/portal/styles/' . $this->user->style['style_path'] . '/theme/',
'T_EXT_THEME_PATH' => $this->path_helper->get_web_root_path() . $this->root_path . 'styles/' . $this->user->style['style_path'] . '/theme/',
));
// And now to output the page.
page_header($this->user->lang('PORTAL'));
// 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'
));
// 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();
}
page_footer();
}
// check if user should be able to access this page
private function check_permission()

View File

@@ -4,6 +4,8 @@
// however you can override the default methods and add custom
// installation logic
class phpbb_ext_board3_portal_ext extends phpbb_extension_base
namespace board3\portal;
class ext extends \phpbb\extension\base
{
}

View File

@@ -7,7 +7,9 @@
*
*/
class phpbb_ext_board3_portal_migrations_210_beta1 extends phpbb_db_migration
namespace board3\portal\migrations;
class v210_beta1 extends \phpbb\db\migration\migration
{
/**
* Portal config table
@@ -22,7 +24,7 @@ class phpbb_ext_board3_portal_migrations_210_beta1 extends phpbb_db_migration
static public function depends_on()
{
return array('phpbb_db_migration_data_310_extensions');
return array('\phpbb\db\migration\data\v310\extensions');
}
public function update_schema()

View File

@@ -110,8 +110,8 @@ class portal_calendar_module
// output our general calendar bits
$down = $this->mini_cal_month - 1;
$up = $this->mini_cal_month + 1;
$prev_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&amp;m$module_id=$down#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="&lt;&lt;" /></a>';
$next_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&amp;m$module_id=$up#minical$module_id") . '"><img src="' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt="&gt;&gt;" /></a>';
$prev_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&amp;m$module_id=$down#minical$module_id") . '"><img src="./../' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_left_arrow.png' . '" title="' . $user->lang['VIEW_PREVIOUS_MONTH'] . '" height="16" width="16" alt="&lt;&lt;" /></a>';
$next_month = '<a href="' . append_sid("{$phpbb_root_path}app.$phpEx", "controller=portal&amp;m$module_id=$up#minical$module_id") . '"><img src="./../' . $portal_root_path . 'styles/' . $user->style['style_path'] . '/theme/images/portal/cal_icon_right_arrow.png' . '" title="' . $user->lang['VIEW_NEXT_MONTH'] . '" height="16" width="16" alt="&gt;&gt;" /></a>';
$template->assign_block_vars('minical', array(
'S_SUNDAY_FIRST' => ($config['board3_sunday_first_' . $module_id]) ? true : false,
@@ -591,11 +591,6 @@ class portal_calendar_module
**/
private function makeTimestamp($date)
{
<<<<<<< HEAD
=======
global $user;
>>>>>>> 36903cb... Display correct day of the week with negative UTC offset
$this->stamp = strtotime($date);
return ($this->stamp);
}

View File

@@ -348,7 +348,7 @@ class portal_poll_module
$sql = 'SELECT t.poll_title, t.poll_start, t.topic_id, t.topic_first_post_id, t.forum_id, t.poll_length, t.poll_vote_change, t.poll_max_options, t.topic_status, f.forum_status, p.bbcode_bitfield, p.bbcode_uid
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id AND t.topic_approved = 1 AND t.poll_start > 0
WHERE t.forum_id = f.forum_id AND t.topic_visibility = 1 AND t.poll_start > 0
{$where}
AND t.topic_moved_id = 0
AND p.post_id = t.topic_first_post_id

View File

@@ -1 +1 @@
<link href="./ext/board3/portal/styles/prosilver/theme/portal.css" rel="stylesheet" type="text/css" />
<link href="{T_EXT_THEME_PATH}portal.css" rel="stylesheet" type="text/css" />

View File

@@ -1,6 +1,6 @@
<!-- Config for the left and right blocks //-->
<!-- DEFINE $LR_BLOCK_H_L = '<div class="forabg"><div class="inner"><span class="corners-top"><span></span></span><ul class="topiclist"><li class="header"><dl><dt style="padding: 0px 0px 2px; white-space: nowrap; margin-bottom: 0px; margin-top: 0px;">' -->
<!-- DEFINE $LR_BLOCK_H_R = '</dt><dd></dd></dl></li></ul><ul class="topiclist forums"><li><dl><dd style="border-left: 0px; width: 100%;"><div style="text-align: left; margin: 5px 5px 5px 5px">' -->
<!-- DEFINE $LR_BLOCK_H_R = '</dt><dd></dd></dl></li></ul><ul class="topiclist forums"><li><dl><dt></dt><dd style="border-left: 0px; width: 100%;"><div style="text-align: left; margin: 5px 5px 5px 5px">' -->
<!-- DEFINE $LR_BLOCK_F_L = '</div></dd></dl></li></ul>' -->
<!-- DEFINE $LR_BLOCK_F_R = '<span class="corners-bottom"><span></span></span></div></div><br style="clear:both" />' -->

View File

@@ -10,10 +10,10 @@
<!-- ELSE -->
<!-- IF news_row.S_FIRST_ROW -->
{$CC_BLOCK_H_L}
<dt id="n" <!-- IF S_DISPLAY_NEWS_RVS -->style="width: 44%"<!-- ELSE -->style="width: 60%"<!-- ENDIF -->>{$TITLE}</dt>
<dt id="n">{$TITLE}</dt>
<!-- IF S_DISPLAY_NEWS_RVS -->
<dd class="posts" style="width: 11%">{L_REPLIES}</dd>
<dd class="views" style="width: 11%">{L_VIEWS}</dd>
<dd class="posts">{L_REPLIES}</dd>
<dd class="views">{L_VIEWS}</dd>
<!-- ENDIF -->
<dd class="lastpost" style="width: 25%"><span>{L_LAST_POST}</span></dd>
{$CC_BLOCK_H_R}
@@ -21,31 +21,39 @@
<!-- ENDIF -->
<li class="row<!-- IF news_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
<dl class="icon {news_row.TOPIC_IMG_STYLE}">
<dt style="<!-- IF S_DISPLAY_NEWS_RVS -->width: 44%;<!-- ELSE -->width: 60%;<!-- ENDIF --> <!-- IF news_row.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{news_row.TOPIC_FOLDER_IMG_ALT}"><!-- IF news_row.S_UNREAD_TOPIC --><a href="{news_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><!-- IF news_row.ATTACH_ICON_IMG -->{news_row.ATTACH_ICON_IMG} <!-- ENDIF --><!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}" title="{news_row.TITLE}" class="topictitle">{news_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> &bull; <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->
<!-- IF news_row.PAGINATION -->
<div class="pagination">
<ul><!-- BEGIN pagination -->
<!-- IF news_row.pagination.S_IS_PREV -->
<!-- ELSEIF news_row.pagination.S_IS_CURRENT --><li class="active"><span>{news_row.pagination.PAGE_NUMBER}</span></li>
<!-- ELSEIF news_row.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li>
<!-- ELSEIF news_row.pagination.S_IS_NEXT -->
<!-- ELSE --><li><a href="{news_row.pagination.PAGE_URL}">{news_row.pagination.PAGE_NUMBER}</a></li>
<!-- ENDIF -->
<!-- END pagination --->
</ul>
</div>
<dt <!-- IF news_row.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{news_row.TOPIC_FOLDER_IMG_ALT}">
<!-- IF news_row.S_UNREAD_TOPIC -->
<a href="{news_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a>
<!-- ENDIF -->
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} &raquo; {news_row.TIME}
<!-- IF news_row.FORUM_NAME -->
<br />{L_FORUM}: <a href="{news_row.U_VIEWFORUM}" style="font-weight: bold;">{news_row.FORUM_NAME}</a>
<!-- ENDIF -->
<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news_row.FORUM_NAME -->&bull; <!-- ENDIF -->{L_REPLIES}: <strong>{news_row.REPLIES}</strong> &bull; {L_VIEWS}: <strong>{news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
<!-- IF news_row.ATTACH_ICON_IMG -->{news_row.ATTACH_ICON_IMG} <!-- ENDIF -->
<!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF -->
<div class="list-inner">
<a href="{news_row.U_VIEW_COMMENTS}" title="{news_row.TITLE}" class="topictitle">{news_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> &bull; <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->
<!-- IF news_row.PAGINATION -->
<div class="pagination">
<ul><!-- BEGIN pagination -->
<!-- IF news_row.pagination.S_IS_PREV -->
<!-- ELSEIF news_row.pagination.S_IS_CURRENT --><li class="active"><span>{news_row.pagination.PAGE_NUMBER}</span></li>
<!-- ELSEIF news_row.pagination.S_IS_ELLIPSIS --><li class="ellipsis"><span>{L_ELLIPSIS}</span></li>
<!-- ELSEIF news_row.pagination.S_IS_NEXT -->
<!-- ELSE --><li><a href="{news_row.pagination.PAGE_URL}">{news_row.pagination.PAGE_NUMBER}</a></li>
<!-- ENDIF -->
<!-- END pagination --->
</ul>
</div>
<!-- ENDIF -->
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} &raquo; {news_row.TIME}
<!-- IF news_row.FORUM_NAME -->
<br />{L_FORUM}: <a href="{news_row.U_VIEWFORUM}" style="font-weight: bold;">{news_row.FORUM_NAME}</a>
<!-- ENDIF -->
<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news_row.FORUM_NAME -->&bull; <!-- ENDIF -->{L_REPLIES}: <strong>{news_row.REPLIES}</strong> &bull; {L_VIEWS}: <strong>{news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
</div> <!-- \END <div class="list-inner"> -->
</dt>
<!-- IF S_DISPLAY_NEWS_RVS -->
<dd class="posts" style="width: 11%">{news_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
<dd class="views" style="width: 11%">{news_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
<dd class="posts">{news_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
<dd class="views">{news_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
<!-- ENDIF -->
<dd class="lastpost" style="width: 25%"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {news_row.USERNAME_FULL_LAST} <!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn>{L_POST_BY_AUTHOR} {news_row.USERNAME_FULL_LAST} <!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><br />
{news_row.LAST_POST_TIME}</span>
</dd>
</dl>

View File

@@ -1,7 +1,7 @@
<!-- IF .latest_announcements or .latest_hot_topics or .latest_topics -->
{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
<ul class="topiclist bg1">
<li><dl>
<li><dl><dt></dt>
<dd style="border-left:0px; width:100%">
<table style="width: 100%;">
<tr>

View File

@@ -1,6 +1,6 @@
{$C_BLOCK_H_L}<!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{$TITLE}</a><!-- ELSE -->{$TITLE}<!-- ENDIF -->{$C_BLOCK_H_R}
<ul class="topiclist bg1">
<li><dl>
<li><dl><dt></dt>
<dd style="border-left:0px">
<p style="margin: 0 5px 0 5px;">{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
<!-- IF PORTAL_LEGEND --><br /><em>{L_LEGEND}: {PORTAL_LEGEND}</em><!-- ENDIF --></p>