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:
Marc Alexander
2010-10-01 11:52:05 +00:00
parent 8e11e32347
commit d78c37a4ee
6 changed files with 83 additions and 31 deletions

View File

@@ -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>

View File

@@ -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'))
{

View File

@@ -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);

View 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');
?>

View File

@@ -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,7 +102,8 @@ class portal_main_menu_module
function get_template_acp($module_id)
{
return array(
// do not remove this as it is needed in order to run manage_links
return array(
'title' => 'ACP_PORTAL_MENU',
'vars' => array(
'legend1' => 'ACP_PORTAL_MENU',
@@ -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;

View File

@@ -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> &copy; 2009 Board3 Group</div>
<div class="copyright">Powered by <a href="http://www.board3.de/">Board3 Portal</a> &copy; 2009 - 2010 Board3 Group</div>
<!-- INCLUDE overall_footer.html -->