- support re-caching of theme data if stylesheet.css changed and load_tplcompile enabled

- mcp fixes
- fixed some usability issues


git-svn-id: file:///svn/phpbb/trunk@6447 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-10-06 18:43:55 +00:00
parent c645088a34
commit 0f0d160ded
20 changed files with 87 additions and 55 deletions

View file

@ -2310,7 +2310,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
{
foreach ($matches[0] as $idx => $match)
{
$stylesheet = str_replace($match, $this->load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet);
$stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet);
}
}

View file

@ -406,6 +406,7 @@ if (!function_exists('realpath'))
* @copyright 2006 Project Minerva Team
* @param string $path The path which we should attempt to resolve.
* @return mixed
* @ignore
*/
function phpbb_realpath($path)
{
@ -582,6 +583,7 @@ else
{
/**
* A wrapper for realpath
* @ignore
*/
function phpbb_realpath($path)
{

View file

@ -1117,7 +1117,7 @@ function validate_username($username)
return false;
}
if (!preg_match('#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#i', $username))
if (!preg_match('#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#i', $username) || strpos($username, '"') !== false || strpos($username, '"') !== false)
{
return 'INVALID_CHARS';
}

View file

@ -74,6 +74,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_CAN_LOCK' => $auth->acl_get('m_lock', $forum_id),
'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id),
'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id),
'S_MERGE_SELECT' => ($action == 'merge_select') ? true : false,
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '',

View file

@ -134,6 +134,7 @@ function mcp_post_details($id, $mode, $action)
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
'POSTER_NAME' => $poster,
'POST_PREVIEW' => $message,
@ -220,20 +221,8 @@ function mcp_post_details($id, $mode, $action)
$sql = 'SELECT poster_id, COUNT(poster_id) as postings
FROM ' . POSTS_TABLE . "
WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
GROUP BY poster_id";
// Firebird does not support ORDER BY on aliased columns
// MySQL does not support ORDER BY on functions
switch (SQL_LAYER)
{
case 'firebird':
$sql .= ' ORDER BY COUNT(poster_id) DESC';
break;
default:
$sql .= ' ORDER BY postings DESC';
break;
}
GROUP BY poster_id
ORDER BY postings DESC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@ -256,7 +245,7 @@ function mcp_post_details($id, $mode, $action)
while ($row = $db->sql_fetchrow($result))
{
$users_ary[$row['user_id']]['username'] = strtolower($row['username']);
$users_ary[$row['user_id']]['username'] = $row['username'];
$usernames_ary[strtolower($row['username'])] = $users_ary[$row['user_id']];
}
$db->sql_freeresult($result);
@ -269,7 +258,7 @@ function mcp_post_details($id, $mode, $action)
'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id),
'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author=' . urlencode($user_row['username']) . '&sr=topics'))
'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics'))
);
}
}

View file

@ -197,6 +197,7 @@ function mcp_topic_view($id, $mode, $action)
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
'S_REPORT_VIEW' => ($action == 'reports') ? true : false,
'S_MERGE_VIEW' => ($action == 'merge') ? true : false,
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
'S_TOPIC_ICON' => $icon_id,

View file

@ -785,6 +785,7 @@ class session
$result = $db->sql_query($sql);
$ban_triggered_by = 'user';
while ($row = $db->sql_fetchrow($result))
{
if ((!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) ||
@ -800,6 +801,20 @@ class session
{
$banned = true;
$ban_row = $row;
if (!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id)
{
$ban_triggered_by = 'user';
}
else if (!empty($row['ban_ip']) && preg_match('#^' . str_replace('*', '.*?', $row['ban_ip']) . '$#i', $user_ip))
{
$ban_triggered_by = 'ip';
}
else
{
$ban_triggered_by = 'email';
}
// Don't break. Check if there is an exclude rule for this user
}
}
@ -823,6 +838,8 @@ class session
$message = sprintf($this->lang[$message], $till_date, '<a href="mailto:' . $config['board_contact'] . '">', '</a>');
$message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : '';
$message .= '<br /><br /><em>' . $user->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>';
trigger_error($message);
}

View file

@ -20,7 +20,7 @@ class ucp_attachments_info
'title' => 'UCP_ATTACHMENTS',
'version' => '1.0.0',
'modes' => array(
'attachments' => array('title' => 'UCP_ATTACHMENTS', 'auth' => 'acl_u_attach', 'cat' => array('UCP_ATTACHMENTS')),
'attachments' => array('title' => 'UCP_MAIN_ATTACHMENTS', 'auth' => 'acl_u_attach', 'cat' => array('UCP_MAIN')),
),
);
}

View file

@ -21,8 +21,8 @@ class ucp_prefs_info
'version' => '1.0.0',
'modes' => array(
'personal' => array('title' => 'UCP_PREFS_PERSONAL', 'auth' => '', 'cat' => array('UCP_PREFS')),
'view' => array('title' => 'UCP_PREFS_VIEW', 'auth' => '', 'cat' => array('UCP_PREFS')),
'post' => array('title' => 'UCP_PREFS_POST', 'auth' => '', 'cat' => array('UCP_PREFS')),
'view' => array('title' => 'UCP_PREFS_VIEW', 'auth' => '', 'cat' => array('UCP_PREFS')),
),
);
}

View file

@ -20,10 +20,10 @@ class ucp_profile_info
'title' => 'UCP_PROFILE',
'version' => '1.0.0',
'modes' => array(
'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => '', 'cat' => array('UCP_PROFILE')),
'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
),
);
}

View file

@ -2089,7 +2089,6 @@ class install_install extends module
'UCP_PREFS' => null,
'UCP_PM' => null,
'UCP_USERGROUPS' => null,
'UCP_ATTACHMENTS' => null,
'UCP_ZEBRA' => null,
),
);

View file

@ -83,6 +83,9 @@ $lang = array_merge($lang, array(
'BACK_TO_TOP' => 'Top',
'BACK_TO_PREV' => 'Back to previous page',
'BAN_TRIGGERED_BY_EMAIL'=> 'This ban has been issued on your email address.',
'BAN_TRIGGERED_BY_IP' => 'This ban has been issued on your ip address.',
'BAN_TRIGGERED_BY_USER' => 'This ban has been issued on your username.',
'BBCODE_GUIDE' => 'BBCode guide',
'BCC' => 'BCC',
'BIRTHDAYS' => 'Birthdays',
@ -445,6 +448,7 @@ $lang = array_merge($lang, array(
'SEARCH_FOR' => 'Search for',
'SEARCH_FORUM' => 'Search this forum',
'SEARCH_NEW' => 'View new posts',
'SEARCH_POSTS_BY' => 'Search posts by',
'SEARCH_SELF' => 'View your posts',
'SEARCH_TOPIC' => 'Search this topic',
'SEARCH_UNANSWERED' => 'View unanswered posts',

View file

@ -264,6 +264,7 @@ $lang = array_merge($lang, array(
'SEARCH_POSTS_BY_USER' => 'Search posts by',
'SELECT_ACTION' => 'Select desired action',
'SELECT_TOPICS_FROM' => 'Select topics from',
'SELECT_TOPIC' => 'Select topic',
'SELECT_USER' => 'Select user',
'SORT_ACTION' => 'Log action',

View file

@ -196,8 +196,6 @@ $lang = array_merge($lang, array(
'USER_CANNOT_EDIT' => 'You cannot edit posts in this forum',
'USER_CANNOT_REPLY' => 'You cannot reply in this forum',
'USER_CANNOT_FORUM_POST' => 'You are not able to do posting operations on this forum due to the forum type not supporting it.',
'USERNAME_DISALLOWED' => 'The username you entered has been banned.',
'USERNAME_TAKEN' => 'The username you entered is already in use, please select an alternative.',
'VIEW_MESSAGE' => '%sView your submitted message%s',

View file

@ -401,36 +401,37 @@ $lang = array_merge($lang, array(
'UCP_JABBER' => 'Jabber address',
'UCP_MAIN' => 'Overview',
'UCP_MAIN_BOOKMARKS' => 'Bookmarks',
'UCP_MAIN_DRAFTS' => 'Saved drafts',
'UCP_MAIN_ATTACHMENTS' => 'Manage attachments',
'UCP_MAIN_BOOKMARKS' => 'Manage bookmarks',
'UCP_MAIN_DRAFTS' => 'Manage drafts',
'UCP_MAIN_FRONT' => 'Front page',
'UCP_MAIN_SUBSCRIBED' => 'Subscribed',
'UCP_MAIN_SUBSCRIBED' => 'Manage subscriptions',
'UCP_MSNM' => 'MSN Messenger',
'UCP_NO_ATTACHMENTS' => 'You have posted no files',
'UCP_PREFS' => 'Forum preferences',
'UCP_PREFS_PERSONAL' => 'Personal settings',
'UCP_PREFS_POST' => 'Posting messages',
'UCP_PREFS_VIEW' => 'Viewing posts',
'UCP_PREFS_PERSONAL' => 'Edit global settings',
'UCP_PREFS_POST' => 'Edit posting defaults',
'UCP_PREFS_VIEW' => 'Edit display options',
'UCP_PM' => 'Private messages',
'UCP_PM_COMPOSE' => 'Compose message',
'UCP_PM_DRAFTS' => 'PM drafts',
'UCP_PM_OPTIONS' => 'Options',
'UCP_PM_DRAFTS' => 'Manage PM drafts',
'UCP_PM_OPTIONS' => 'Edit options',
'UCP_PM_POPUP' => 'Private messages',
'UCP_PM_POPUP_TITLE' => 'Private message popup',
'UCP_PM_UNREAD' => 'Unread messages',
'UCP_PM_VIEW' => 'View messages',
'UCP_PROFILE' => 'Profile',
'UCP_PROFILE_AVATAR' => 'Your avatar',
'UCP_PROFILE_PROFILE_INFO' => 'Your profile',
'UCP_PROFILE_REG_DETAILS' => 'Registration details',
'UCP_PROFILE_SIGNATURE' => 'Your signature',
'UCP_PROFILE_AVATAR' => 'Edit avatar',
'UCP_PROFILE_PROFILE_INFO' => 'Edit profile',
'UCP_PROFILE_REG_DETAILS' => 'Edit account settings',
'UCP_PROFILE_SIGNATURE' => 'Edit signature',
'UCP_USERGROUPS' => 'Usergroups',
'UCP_USERGROUPS_MEMBER' => 'Memberships',
'UCP_USERGROUPS_MEMBER' => 'Edit memberships',
'UCP_USERGROUPS_MANAGE' => 'Manage groups',
'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.',
@ -438,9 +439,9 @@ $lang = array_merge($lang, array(
'UCP_RESEND' => 'Send activation email',
'UCP_WELCOME' => 'Welcome to the User Control Panel. From here you can monitor, view and update your profile, preferences, subscribed forums and topics. You can also send messages to other users (if permitted). Please ensure you read any announcements before continuing.',
'UCP_YIM' => 'Yahoo Messenger',
'UCP_ZEBRA' => 'Friends and Foes',
'UCP_ZEBRA_FOES' => 'Foes',
'UCP_ZEBRA_FRIENDS' => 'Friends',
'UCP_ZEBRA' => 'Friends &amp; Foes',
'UCP_ZEBRA_FOES' => 'Manage foes',
'UCP_ZEBRA_FRIENDS' => 'Manage friends',
'UNKNOWN_FOLDER' => 'Unknown folder',
'UNWATCH_MARKED' => 'Unwatch marked',
'UPLOAD_AVATAR_FILE' => 'Upload from your machine',

View file

@ -689,13 +689,14 @@ if ($submit || $preview || $refresh)
}
// Validate username
if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['post_username']))
if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['username'] && $post_data['post_username'] != $post_data['username']))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
if (($result = validate_username(($mode == 'edit' && $post_data['post_username']) ? $post_data['post_username'] : $post_data['username'])) != false)
if (($result = validate_username($post_data['username'])) !== false)
{
$error[] = $user->lang[$result];
$user->add_lang('ucp');
$error[] = $user->lang[$result . '_USERNAME'];
}
}

View file

@ -54,6 +54,7 @@ if ($id && $sid)
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
$db = new $sql_db();
$cache = new cache();
@ -64,6 +65,8 @@ if ($id && $sid)
exit;
}
$config = $cache->obtain_config();
$sql = "SELECT s.session_id, u.user_lang
FROM {$table_prefix}sessions s, {$table_prefix}users u
WHERE s.session_id = '" . $db->sql_escape($sid) . "'
@ -89,11 +92,26 @@ if ($id && $sid)
exit;
}
/**
* @todo What happens if the theme_data value is older than the file?
* It should be re-cached as is done with templates and the template cache
* if ($theme['theme_mtime'] < filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
*/
// Re-cache stylesheet data if necessary
if ($config['load_tplcompile'] && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
{
include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
$theme['theme_data'] = acp_styles::db_theme_data($theme);
$theme['theme_mtime'] = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
// Save CSS contents
$sql_ary = array(
'theme_mtime' => $theme['theme_mtime'],
'theme_data' => $theme['theme_data']
);
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
WHERE theme_id = $id";
$db->sql_query($sql);
$cache->destroy('sql', STYLES_THEME_TABLE);
}
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
header('Content-type: text/css');

View file

@ -4,7 +4,7 @@
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap="nowrap"><span class="gensmall"><!-- IF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->:</span>&nbsp;<select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }">
<td nowrap="nowrap"><span class="gensmall"><!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->:</span>&nbsp;<select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }">
<!-- BEGIN jumpbox_forums -->
<!-- IF jumpbox_forums.S_FORUM_COUNT eq 2 --><option value="-1">------------------</option><!-- ENDIF -->

View file

@ -1,7 +1,11 @@
<!-- INCLUDE mcp_header.html -->
<!-- IF S_MERGE_SELECT --><div style="float: right;"><!-- INCLUDE jumpbox.html --></div><!-- ENDIF -->
<!-- IF U_VIEW_FORUM_LOGS --><a href="{U_VIEW_FORUM_LOGS}">{L_VIEW_FORUM_LOGS}</a><!-- ENDIF -->
<!-- IF S_MERGE_SELECT --><br clear="right" /><!-- ENDIF -->
<form method="post" id="mcp" action="{S_MCP_ACTION}">
<table class="tablebg" width="100%" cellspacing="1">

View file

@ -127,12 +127,8 @@
<td colspan="2" class="cat"><b class="gen">{L_OTHER_USERS}</b></td>
</tr>
<!-- BEGIN userrow -->
<!-- IF userrow.S_ROW_COUNT is even -->
<tr class="row1">
<!-- ELSE -->
<tr class="row2">
<!-- ENDIF -->
<td><span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a> [ {userrow.NUM_POSTS} {userrow.L_POST_S} ]</span></td>
<!-- IF userrow.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td><span class="gen"><!-- IF userrow.U_PROFILE --><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a><!-- ELSE -->{userrow.USERNAME}<!-- ENDIF --> [ {userrow.NUM_POSTS} {userrow.L_POST_S} ]</span></td>
<td align="center"><a href="{userrow.U_SEARCHPOSTS}">{SEARCH_IMG}</a></td>
</tr>
<!-- BEGINELSE -->