- changed _module_*_url to only use the main module name but the mode as parameter

- custom module lang function now suffixed by _lang
- added general custom function with mode and module_row parameter

- do not display friends/foes if zebra has been disabled


git-svn-id: file:///svn/phpbb/trunk@5767 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-04-08 13:01:04 +00:00
parent 4801f813cd
commit 96afdb5168
5 changed files with 35 additions and 34 deletions

View file

@ -56,7 +56,6 @@ $f_permissions = array(
'f_read' => array(1, 0),
'f_post' => array(1, 0),
'f_reply' => array(1, 0),
'f_quote' => array(1, 0),
'f_edit' => array(1, 0),
'f_user_lock' => array(1, 0),
'f_delete' => array(1, 0),
@ -69,7 +68,6 @@ $f_permissions = array(
'f_attach' => array(1, 0),
'f_download'=> array(1, 0),
'f_icons' => array(1, 0),
'f_html' => array(1, 0),
'f_bbcode' => array(1, 0),
'f_smilies' => array(1, 0),
'f_img' => array(1, 0),
@ -77,7 +75,6 @@ $f_permissions = array(
'f_sigs' => array(1, 0),
'f_search' => array(1, 0),
'f_email' => array(1, 0),
'f_rate' => array(1, 0),
'f_print' => array(1, 0),
'f_ignoreflood' => array(1, 0),
'f_postcount' => array(1, 0),
@ -161,11 +158,9 @@ $u_permissions = array(
'u_attach' => array(0, 1),
'u_sig' => array(0, 1),
'u_pm_attach' => array(0, 1),
'u_pm_html' => array(0, 1),
'u_pm_bbcode' => array(0, 1),
'u_pm_smilies' => array(0, 1),
'u_pm_download' => array(0, 1),
'u_pm_report' => array(0, 1),
'u_pm_edit' => array(0, 1),
'u_pm_printpm' => array(0, 1),
'u_pm_emailpm' => array(0, 1),
@ -235,7 +230,6 @@ $sql = 'UPDATE ' . USERS_TABLE . " SET user_permissions = ''";
$db->sql_query($sql);
$cache->destroy('acl_options');
$cache->save();
echo "<p><b>Done</b></p>\n";

View file

@ -176,12 +176,19 @@ class p_master
$depth = sizeof($this->module_cache['parents'][$row['module_id']]);
// We need to prefix the functions to not create a naming conflict
$url_func = '_module_' . $row['module_name'] . '_' . $row['module_mode'] . '_url';
$lang_func = '_module_' . $row['module_name'];
// Function for building 'url_extra'
$url_func = '_module_' . $row['module_name'] . '_url';
// Function for building the language name
$lang_func = '_module_' . $row['module_name'] . '_lang';
// Custom function for calling parameters on module init (for example assigning template variables)
$custom_func = '_module_' . $row['module_name'];
$names[$row['module_name'] . '_' . $row['module_mode']][] = true;
$this->module_ary[] = array(
$module_row = array(
'depth' => $depth,
'id' => (int) $row['module_id'],
@ -194,7 +201,7 @@ class p_master
'mode' => (string) $row['module_mode'],
'display' => (int) $row['module_display'],
'url_extra' => (function_exists($url_func)) ? $url_func() : '',
'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode']) : '',
'lang' => ($row['module_name'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']),
'langname' => $row['module_langname'],
@ -202,6 +209,13 @@ class p_master
'left' => $row['left_id'],
'right' => $row['right_id'],
);
if (function_exists($custom_func))
{
$custom_func($row['module_mode'], $module_row);
}
$this->module_ary[] = $module_row;
}
unset($this->module_cache['modules'], $names);

View file

@ -198,32 +198,12 @@ page_footer();
/**
* Functions used to generate additional URL paramters
*/
function _module_main_front_url()
function _module_main_url($mode)
{
return extra_url();
}
function _module_main_forum_view_url()
{
return extra_url();
}
function _module_main_topic_view_url()
{
return extra_url();
}
function _module_main_post_details_url()
{
return extra_url();
}
function _module_logs_forum_logs_url()
{
return extra_url();
}
function _module_logs_topic_logs_url()
function _module_logs_url($mode)
{
return extra_url();
}

View file

@ -112,7 +112,8 @@
<div style="padding: 2px;"></div>
<!-- ENDIF -->
<table class="tablebg" width="100%" cellspacing="1">
<!-- IF S_ZEBRA_ENABLED -->
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th>{L_FRIENDS}</th>
</tr>
@ -150,7 +151,8 @@
</td>
</tr>
</table>
</table>
<!-- ENDIF -->
</td>
<td><img src="images/spacer.gif" width="4" alt="" /></td>

View file

@ -249,4 +249,15 @@ $template->set_filenames(array(
page_footer();
/**
* Function for assigning a template var if the zebra module got included
*/
function _module_zebra($mode, &$module_row)
{
global $template;
$template->assign_var('S_ZEBRA_ENABLED', true);
}
?>