1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 03:34:04 +02:00

- create forums by default

- hide prune options if not enabled
- fixed module management enable/disable switch if in module itself
- fixed some schema errors
- adjusted $user->page array generation for developers calling scripts outside of phpBB root


git-svn-id: file:///svn/phpbb/trunk@5995 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-06-01 13:47:42 +00:00
parent 4354cda6dc
commit 721a9dd4a1
22 changed files with 172 additions and 65 deletions

View File

@@ -85,7 +85,7 @@ class acp_forums
'forum_id' => $forum_id
);
// No break here
// No break here
case 'add':
@@ -416,7 +416,7 @@ class acp_forums
{
$forum_data = array(
'parent_id' => $this->parent_id,
'forum_type' => FORUM_CAT,
'forum_type' => FORUM_POST,
'forum_status' => ITEM_UNLOCKED,
'forum_name' => request_var('forum_name', '', true),
'forum_link' => '',

View File

@@ -495,6 +495,9 @@ class acp_modules
$template->assign_vars(array(
'S_NO_MODULES' => true,
'MODULE_TITLE' => $langname,
'MODULE_ENABLED' => ($row['module_enabled']) ? true : false,
'MODULE_DISPLAYED' => ($row['module_display']) ? true : false,
'U_EDIT' => $url . '&action=edit',
'U_DELETE' => $url . '&action=delete',

View File

@@ -1435,6 +1435,12 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
// Username, password, etc...
default:
$err = $user->lang[$result['error_msg']];
// Assign admin contact to some error messages
if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
{
$err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>');
}
break;
}
}

View File

@@ -1457,12 +1457,12 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
switch (SQL_LAYER)
{
case 'mssql':
case 'mssql-odbc':
$sql .= 'GROUP BY t.topic_id, t.post_approved';
case 'mssql_odbc':
$sql .= ' GROUP BY t.topic_id, t.post_approved';
break;
default:
$sql .= 'GROUP BY t.topic_id';
$sql .= ' GROUP BY t.topic_id';
break;
}
$result = $db->sql_query($sql);

View File

@@ -230,11 +230,13 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
if (!$row['parent_id'] && $row['forum_type'] == FORUM_CAT)
{
$template->assign_block_vars('forumrow', array(
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield']),
'U_VIEWFORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=" . $row['forum_id'])
'S_IS_CAT' => true,
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield']),
'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang['FORUM_CAT'] . '" />' : '',
'FORUM_FOLDER_IMG_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
'U_VIEWFORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&amp;f=" . $row['forum_id'])
);
continue;

View File

@@ -303,7 +303,7 @@ class p_master
*
* @final
*/
function load_active($mode = false)
function load_active($mode = false, $module_url = false, $execute_module = true)
{
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $user;
@@ -338,16 +338,33 @@ class p_master
// We pre-define the action parameter we are using all over the place
if (defined('IN_ADMIN'))
{
// Not being able to overwrite ;)
$this->module->u_action = "{$phpbb_admin_path}index.$phpEx$SID" . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;i={$this->p_id}&amp;mode={$this->p_mode}";
}
else
{
$this->module->u_action = "{$phpbb_root_path}{$user->page['page_dir']}{$user->page['page_name']}$SID" . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;i={$this->p_id}&amp;mode={$this->p_mode}";
// If user specified the module url we will use it...
if ($module_url !== false)
{
$this->module->u_action = $module_url;
}
else
{
$this->module->u_action = "{$user->page['script_path']}/{$user->page['page_name']}";
}
$this->module->u_action = $SID . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;i={$this->p_id}&amp;mode={$this->p_mode}";
}
// Execute the main method for the new instance, we send the module
// id and mode as parameters
$this->module->main(($this->p_name) ? $this->p_name : $this->p_id, $this->p_mode);
// Assign the module path for re-usage
$this->module->module_path = $module_path . '/';
// Execute the main method for the new instance, we send the module id and mode as parameters
// Users are able to call the main method after this function to be able to assign additional parameters manually
if ($execute_module)
{
$this->module->main(($this->p_name) ? $this->p_name : $this->p_id, $this->p_mode);
}
return;
}
@@ -403,6 +420,7 @@ class p_master
/**
* Build true binary tree from given array
* Not in use
*/
function build_tree(&$modules, &$parents)
{
@@ -447,6 +465,9 @@ class p_master
$current_id = false;
// Make sure the module_url has a question mark set, effectively determining the delimiter to use
$delim = (strpos($module_url, '?') === false) ? '?' : '&amp;';
$current_padding = $current_depth = 0;
$linear_offset = 'l_block1';
$tabular_offset = 't_block2';
@@ -484,14 +505,14 @@ class p_master
}
}
$u_title = $module_url . (($itep_ary['is_duplicate']) ? '&amp;icat=' . $current_id : '') . '&amp;i=' . (($itep_ary['cat']) ? $itep_ary['id'] : $itep_ary['name'] . '&amp;mode=' . $itep_ary['mode']);
$u_title = $module_url . $delim . 'i=' . (($itep_ary['cat']) ? $itep_ary['id'] : $itep_ary['name'] . (($itep_ary['is_duplicate']) ? '&amp;icat=' . $current_id : '') . '&amp;mode=' . $itep_ary['mode']);
$u_title .= (!$itep_ary['cat'] && isset($itep_ary['url_extra'])) ? $itep_ary['url_extra'] : '';
// Only output a categories items if it's currently selected
if (!$depth || ($depth && (in_array($itep_ary['parent'], array_values($this->module_cache['parents'])) || $itep_ary['parent'] == $this->p_parent)))
{
$use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset;
$tpl_ary = array(
'L_TITLE' => $itep_ary['lang'],
'S_SELECTED' => (in_array($itep_ary['id'], array_keys($this->module_cache['parents'])) || $itep_ary['id'] == $this->p_id) ? true : false,

View File

@@ -355,14 +355,8 @@ class custom_profile
WHERE user_id IN (' . implode(', ', array_map('intval', $user_id)) . ')';
$result = $db->sql_query($sql);
if (!($row = $db->sql_fetchrow($result)))
{
$db->sql_freeresult($result);
return array();
}
$user_fields = array();
do
while ($row = $db->sql_fetchrow($result))
{
foreach ($row as $ident => $value)
{
@@ -372,8 +366,7 @@ class custom_profile
$user_fields[$row['user_id']][$ident]['data'] = $this->profile_cache[$ident];
}
}
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
return $user_fields;
@@ -431,6 +424,10 @@ class custom_profile
switch ($this->profile_types[$field_type])
{
case 'int':
if ($value == '')
{
return NULL;
}
return (int) $value;
break;
@@ -493,7 +490,7 @@ class custom_profile
if ($ident_ary['data']['field_length'] == 1)
{
$this->options_lang[$field_id][$lang_id][(int) $value];
return (isset($this->options_lang[$field_id][$lang_id][(int) $value])) ? $this->options_lang[$field_id][$lang_id][(int) $value] : NULL;
}
else if (!$value)
{
@@ -527,6 +524,30 @@ class custom_profile
{
$value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
}
else if ($profile_row['field_type'] == FIELD_INT)
{
if (isset($_REQUEST[$profile_row['field_ident']]))
{
$value = ($_REQUEST[$profile_row['field_ident']] === '') ? NULL : request_var($profile_row['field_ident'], $default_value);
}
else
{
if (is_null($user->profile_fields[$user_ident]) && !$preview)
{
$value = NULL;
}
else if (!isset($user->profile_fields[$user_ident]) || $preview)
{
$value = $default_value;
}
else
{
$value = $user->profile_fields[$user_ident];
}
}
return (is_null($value)) ? '' : (int) $value;
}
else
{
$value = (isset($_REQUEST[$profile_row['field_ident']])) ? request_var($profile_row['field_ident'], $default_value, true) : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
@@ -818,6 +839,17 @@ class custom_profile
$var = request_var($var_name, $profile_row['field_default_value'], true);
break;
case FIELD_INT:
if (isset($_REQUEST[$var_name]) && $_REQUEST[$var_name] === '')
{
$var = NULL;
}
else
{
$var = request_var($var_name, $profile_row['field_default_value']);
}
break;
default:
$var = request_var($var_name, $profile_row['field_default_value']);
break;

View File

@@ -55,6 +55,8 @@ class session
}
}
// The following examples given are for an request uri of {path to the phpbb directory}/adm/index.php?i=10&b=2
// The current query string
$query_string = trim(implode('&', $args));
@@ -62,16 +64,30 @@ class session
$page_name = htmlspecialchars(basename($script_name));
// current directory within the phpBB root (for example: adm)
$page_dir = substr(str_replace(str_replace('\\', '/', realpath($root_path)), '', str_replace('\\', '/', realpath('./'))), 1);
$root_dirs = explode('/', str_replace('\\', '/', realpath($root_path)));
$page_dirs = explode('/', str_replace('\\', '/', realpath('./')));
$intersection = array_intersect_assoc($root_dirs, $page_dirs);
// Current page from phpBB root (for example: adm/index.php?i=10)
$root_dirs = array_diff_assoc($root_dirs, $intersection);
$page_dirs = array_diff_assoc($page_dirs, $intersection);
$page_dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs);
if ($page_dir && $page_dir{strlen($page_dir) - 1} == '/')
{
$page_dir = substr($page_dir, 0, -1);
}
// Current page from phpBB root (for example: adm/index.php?i=10&b=2)
$page = (($page_dir) ? $page_dir . '/' : '') . $page_name . (($query_string) ? "?$query_string" : '');
// The script path from the webroot to the current directory (for example: /phpBB2/adm) : always prefixed with /
$script_path = trim(str_replace('\\', '/', dirname($script_name)));
// The script path from the webroot to the phpBB root (for example: /phpBB2)
$root_script_path = ($page_dir) ? str_replace('/' . $page_dir, '', $script_path) : $script_path;
$script_dirs = explode('/', $script_path);
array_splice($script_dirs, -sizeof($page_dirs));
$root_script_path = implode('/', $script_dirs) . (sizeof($root_dirs) ? '/' . implode('/', $root_dirs) : '');
// We are on the base level (phpBB root == webroot), lets adjust the variables a bit...
if (!$root_script_path)

View File

@@ -242,6 +242,7 @@ class ucp_register
'user_email_hash' => (int) crc32(strtolower($email)) . strlen($email),
'group_id' => (int) $group_id,
'user_timezone' => (float) $tz,
'user_dateformat' => $config['default_dateformat'],
'user_lang' => $lang,
'user_style' => $config['default_style'],
'user_allow_pm' => 1,
@@ -258,6 +259,24 @@ class ucp_register
'user_dst' => 0,
'user_colour' => '',
'user_avatar' => '',
'user_avatar_type' => 0,
'user_avatar_width' => 0,
'user_avatar_height' => 0,
'user_new_privmsg' => 0,
'user_unread_privmsg' => 0,
'user_last_privmsg' => 0,
'user_message_rules' => 0,
'user_full_folder' => PRIVMSGS_NO_BOX,
'user_emailtime' => 0,
'user_notify' => 0,
'user_notify_pm' => 1,
'user_notify_type' => NOTIFY_EMAIL,
'user_allow_pm' => 1,
'user_allow_email' => 1,
'user_allow_viewonline' => 1,
'user_allow_viewemail' => 1,
'user_allow_massemail' => 1,
'user_sig' => '',
'user_sig_bbcode_uid' => '',