Added constants file and removed constants.php edit;
Added links to main menu installation; Added ability to handle language variables as link title;
This commit is contained in:
12
install.xml
12
install.xml
@@ -538,18 +538,6 @@ Deny from All
|
||||
}]]></action>
|
||||
</edit>
|
||||
</open>
|
||||
<open src="includes/constants.php">
|
||||
<edit>
|
||||
<find><![CDATA[// Additional tables]]></find>
|
||||
<action type="after-add"><![CDATA[define('PORTAL_ROOT_PATH', 'portal/');
|
||||
define('PORTAL_ICONS_PATH', 'images/portal/icons');
|
||||
|
||||
define('PORTAL_BLOCKS_TABLE', $table_prefix . 'portal_blocks');
|
||||
define('PORTAL_CONFIG_TABLE', $table_prefix . 'portal_config');
|
||||
//define('PORTAL_PAGES_TABLE', $table_prefix . 'portal_pages');
|
||||
define('PORTAL_LINKS_TABLE', $table_prefix . 'portal_links');]]></action>
|
||||
</edit>
|
||||
</open>
|
||||
<open src="includes/functions.php">
|
||||
<edit>
|
||||
<find><![CDATA[// The following assigns all _common_ variables that may be used at any point in a template.]]></find>
|
||||
|
||||
@@ -23,6 +23,8 @@ class acp_portal
|
||||
{
|
||||
global $db, $user, $cache, $template, $display_vars;
|
||||
global $config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpEx;
|
||||
|
||||
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
|
||||
$portal_root_path = PORTAL_ROOT_PATH;
|
||||
if (!function_exists('column_string_const'))
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
|
||||
|
||||
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
||||
include($phpbb_root_path . 'common.' . $phpEx);
|
||||
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
|
||||
$portal_root_path = PORTAL_ROOT_PATH;
|
||||
$portal_icons_path = PORTAL_ICONS_PATH;
|
||||
include($phpbb_root_path . $portal_root_path . 'includes/functions_modules.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
include($phpbb_root_path . $portal_root_path . 'includes/functions.' . $phpEx);
|
||||
|
||||
25
root/portal/includes/constants.php
Normal file
25
root/portal/includes/constants.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Portal
|
||||
* @version $Id$
|
||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
global $table_prefix;
|
||||
|
||||
// Config constants
|
||||
define('B3_LINKS_CAT', 0);
|
||||
define('B3_LINKS_INT', 1);
|
||||
define('B3_LINKS_EXT', 2);
|
||||
|
||||
// Tables and paths
|
||||
define('PORTAL_ROOT_PATH', 'portal/');
|
||||
define('PORTAL_MODULES_TABLE', $table_prefix . 'portal_modules');
|
||||
|
||||
?>
|
||||
@@ -54,12 +54,7 @@ class portal_main_menu_module
|
||||
|
||||
function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $phpEx, $phpbb_root_path;
|
||||
|
||||
// @todo: merge into constants file, maybe even portal contants file
|
||||
define('B3_LINKS_CAT', 0);
|
||||
define('B3_LINKS_INT', 1);
|
||||
define('B3_LINKS_EXT', 2);
|
||||
global $config, $template, $phpEx, $phpbb_root_path, $user;
|
||||
|
||||
$links_urls = $links_options = $links_titles = array();
|
||||
|
||||
@@ -67,12 +62,14 @@ class portal_main_menu_module
|
||||
$links_options = explode(';', $config['board3_links_options']);
|
||||
$links_titles = explode(';', $config['board3_links_titles']);
|
||||
|
||||
// @todo: add posibility to set permissions for links
|
||||
|
||||
for ($i = 0; $i < sizeof($links_urls); $i++)
|
||||
{
|
||||
if($links_options[$i] == B3_LINKS_CAT)
|
||||
{
|
||||
$template->assign_block_vars('portalmenu', array(
|
||||
'CAT_TITLE' => $links_titles[$i],
|
||||
'CAT_TITLE' => (isset($user->lang[$links_titles[$i]])) ? $user->lang[$links_titles[$i]] : $links_titles[$i],
|
||||
));
|
||||
}
|
||||
else
|
||||
@@ -88,7 +85,7 @@ class portal_main_menu_module
|
||||
}
|
||||
|
||||
$template->assign_block_vars('portalmenu.links', array(
|
||||
'LINK_TITLE' => $links_titles[$i],
|
||||
'LINK_TITLE' => (isset($user->lang[$links_titles[$i]])) ? $user->lang[$links_titles[$i]] : $links_titles[$i],
|
||||
'LINK_URL' => $cur_url,
|
||||
));
|
||||
}
|
||||
@@ -105,6 +102,7 @@ class portal_main_menu_module
|
||||
|
||||
function get_template_acp($module_id)
|
||||
{
|
||||
// do not remove this as it is needed in order to run manage_links
|
||||
return array(
|
||||
'title' => 'ACP_PORTAL_MENU',
|
||||
'vars' => array(
|
||||
@@ -119,9 +117,53 @@ class portal_main_menu_module
|
||||
*/
|
||||
function install($module_id)
|
||||
{
|
||||
set_config('board3_links_urls', '');
|
||||
set_config('board3_links_options', '');
|
||||
set_config('board3_links_titles', '');
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$links_titles = array(
|
||||
'M_CONTENT',
|
||||
'INDEX',
|
||||
'SEARCH',
|
||||
'REGISTER',
|
||||
'MEMBERLIST',
|
||||
'THE_TEAM',
|
||||
'M_HELP',
|
||||
'FAQ',
|
||||
'M_BBCODE',
|
||||
'M_TERMS',
|
||||
'M_PRV',
|
||||
);
|
||||
|
||||
$links_options = array(
|
||||
B3_LINKS_CAT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_CAT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
B3_LINKS_INT,
|
||||
);
|
||||
|
||||
$links_urls = array(
|
||||
'',
|
||||
'index.' . $phpEx,
|
||||
'search.' . $phpEx,
|
||||
'ucp.' . $phpEx . '?mode=register',
|
||||
'memberlist.' . $phpEx,
|
||||
'memberlist.' . $phpEx . '?mode=leaders',
|
||||
'',
|
||||
'faq.' . $phpEx,
|
||||
'faq.' . $phpEx . '?mode=bbcode',
|
||||
'ucp.' . $phpEx . '?mode=terms',
|
||||
'ucp.' . $phpEx . '?mode=privacy',
|
||||
);
|
||||
|
||||
set_config('board3_links_urls', implode(';', $links_urls));
|
||||
set_config('board3_links_options', implode(';', $links_options));
|
||||
set_config('board3_links_titles', implode(';', $links_titles));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -143,11 +185,6 @@ class portal_main_menu_module
|
||||
{
|
||||
global $config, $phpbb_admin_path, $user, $phpEx, $db, $template;
|
||||
|
||||
// @todo: merge into constants file, maybe even portal contants file
|
||||
define('B3_LINKS_CAT', 0);
|
||||
define('B3_LINKS_INT', 1);
|
||||
define('B3_LINKS_EXT', 2);
|
||||
|
||||
$action = request_var('action', '');
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
$action = (isset($_POST['save'])) ? 'save' : $action;
|
||||
|
||||
@@ -71,6 +71,6 @@
|
||||
</table>
|
||||
|
||||
<!--// board3 Portal by www.board3.de //-->
|
||||
<div class="copyright">Powered by <a href="http://www.board3.de/">Board3 Portal</a> © 2009 Board3 Group</div>
|
||||
<div class="copyright">Powered by <a href="http://www.board3.de/">Board3 Portal</a> © 2009 - 2010 Board3 Group</div>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
Reference in New Issue
Block a user