Changing the behaviour of the hideonline permission.

Test the current setting before altering the memory limit during install(Bug #12195)

And another language var.


git-svn-id: file:///svn/phpbb/trunk@7755 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2007-06-14 15:03:52 +00:00
parent 9693f31404
commit 6813967ae1
11 changed files with 62 additions and 28 deletions

View file

@ -272,7 +272,8 @@ p a {
<li>[Fix] Able to delete posts within user prune panel (Bug #11849)</li> <li>[Fix] Able to delete posts within user prune panel (Bug #11849)</li>
<li>[Feature] Allow to specify dimensions of images manually on imageset config (Bug #11675)</li> <li>[Feature] Allow to specify dimensions of images manually on imageset config (Bug #11675)</li>
<li>[Fix] Correctly re-assign query result id after seeking rows (MSSQL/Firebird) (Bug #12369)</li> <li>[Fix] Correctly re-assign query result id after seeking rows (MSSQL/Firebird) (Bug #12369)</li>
<li>[Feature] Make effect of a changed hideonline permission instantaneous</li>
<li>[Fix] Do not overwrite larger memory values in the installer (Bug #12195)</li>
</ul> </ul>
</div> </div>

View file

@ -2130,24 +2130,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
// append/replace SID (may change during the session for AOL users) // append/replace SID (may change during the session for AOL users)
$redirect = reapply_sid($redirect); $redirect = reapply_sid($redirect);
// Make sure the user is able to hide his session
if (!$viewonline)
{
$check_auth = new auth();
$check_auth->acl($user->data);
// Reset online status if not allowed to hide the session...
if (!$check_auth->acl_get('u_hideonline'))
{
$sql = 'UPDATE ' . SESSIONS_TABLE . '
SET session_viewonline = 1
WHERE session_user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
}
unset($check_auth);
}
// Special case... the user is effectively banned, but we allow founders to login // Special case... the user is effectively banned, but we allow founders to login
if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
{ {
@ -3959,7 +3941,7 @@ function page_header($page_title = '', $display_online_list = true)
$user_colour = ''; $user_colour = '';
} }
if ($row['user_allow_viewonline'] && $row['session_viewonline']) if ($row['session_viewonline'])
{ {
$user_online_link = $row['username']; $user_online_link = $row['username'];
$logged_visible_online++; $logged_visible_online++;
@ -3970,7 +3952,7 @@ function page_header($page_title = '', $display_online_list = true)
$logged_hidden_online++; $logged_hidden_online++;
} }
if (($row['user_allow_viewonline'] && $row['session_viewonline']) || $auth->acl_get('u_viewonline')) if (($row['session_viewonline']) || $auth->acl_get('u_viewonline'))
{ {
if ($row['user_type'] <> USER_IGNORE) if ($row['user_type'] <> USER_IGNORE)
{ {

View file

@ -1506,6 +1506,33 @@ class user extends session
trigger_error('BOARD_UNAVAILABLE'); trigger_error('BOARD_UNAVAILABLE');
} }
} }
// Make sure the user is able to hide his session
if (!$this->data['session_viewonline'])
{
// Reset online status if not allowed to hide the session...
if (!$auth->acl_get('u_hideonline'))
{
$sql = 'UPDATE ' . SESSIONS_TABLE . '
SET session_viewonline = 1
WHERE session_user_id = ' . $this->data['user_id'];
$db->sql_query($sql);
$this->data['session_viewonline'] = 1;
}
}
elseif (!$this->data['user_allow_viewonline'])
{
// the user wants to hide and is allowed to -> cloaking device on.
if ($auth->acl_get('u_hideonline'))
{
$sql = 'UPDATE ' . SESSIONS_TABLE . '
SET session_viewonline = 0
WHERE session_user_id = ' . $this->data['user_id'];
$db->sql_query($sql);
$this->data['session_viewonline'] = 0;
}
}
// Does the user need to change their password? If so, redirect to the // Does the user need to change their password? If so, redirect to the
// ucp profile reg_details page ... of course do not redirect if we're already in the ucp // ucp profile reg_details page ... of course do not redirect if we're already in the ucp

View file

@ -406,7 +406,7 @@ function get_user_information($user_id, $user_row)
$update_time = $config['load_online_time'] * 60; $update_time = $config['load_online_time'] * 60;
if ($row) if ($row)
{ {
$user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'] && $user_row['user_allow_viewonline'])) ? true : false; $user_row['online'] = (time() - $update_time < $row['online_time'] && ($row['viewonline'])) ? true : false;
} }
} }

View file

@ -104,7 +104,30 @@ else
// Try to override some limits - maybe it helps some... // Try to override some limits - maybe it helps some...
@set_time_limit(0); @set_time_limit(0);
@ini_set('memory_limit', '128M'); $mem_limit = @ini_get('memory_limit');
if (!empty($mem_limit ))
{
$unit = strtolower(substr($mem_limit, -1, 1));
$mem_limit = (int)$mem_limit;
if ($unit == 'k')
{
$mem_limit = floor($mem_limit/1024);
}
elseif ($unit == 'g')
{
$mem_limit *= 1024;
}
elseif (is_numeric($unit))
{
$mem_limit = floor($mem_limit/1048576);
}
$mem_limit = max(128, $mem_limit) . 'M';
}
else
{
$mem_limit = '128M';
}
@ini_set('memory_limit', $mem_limit );
// Include essential scripts // Include essential scripts
require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx);

View file

@ -210,6 +210,7 @@ $lang = array_merge($lang, array(
'GLOBAL_ANNOUNCEMENT' => 'Global announcement', 'GLOBAL_ANNOUNCEMENT' => 'Global announcement',
'HIDE_ONLINE' => 'Hide my online status', 'HIDE_ONLINE' => 'Hide my online status',
'HIDE_ONLINE_EXPLAIN' => 'Changing this setting to "No" won\'t become effective until your next visit to the board.',
'HOLD_NEW_MESSAGES' => 'Do not accept new messages (New messages will be held back until enough space is available)', 'HOLD_NEW_MESSAGES' => 'Do not accept new messages (New messages will be held back until enough space is available)',
'HOLD_NEW_MESSAGES_SHORT' => 'New messages will be held back', 'HOLD_NEW_MESSAGES_SHORT' => 'New messages will be held back',

View file

@ -1434,7 +1434,7 @@ function show_profile($data)
if ($config['load_onlinetrack']) if ($config['load_onlinetrack'])
{ {
$update_time = $config['load_online_time'] * 60; $update_time = $config['load_online_time'] * 60;
$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['user_allow_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline'])) || $auth->acl_get('u_viewonline'))) ? true : false;
} }
else else
{ {

View file

@ -32,7 +32,7 @@
</dl> </dl>
<!-- IF S_CAN_HIDE_ONLINE --> <!-- IF S_CAN_HIDE_ONLINE -->
<dl> <dl>
<dt><label for="hideonline0">{L_HIDE_ONLINE}:</label></dt> <dt><label for="hideonline0">{L_HIDE_ONLINE}:</label><br /><span>{L_HIDE_ONLINE_EXPLAIN}</span></dt>
<dd> <dd>
<label for="hideonline1"><input type="radio" name="hideonline" id="hideonline1" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> <label for="hideonline1"><input type="radio" name="hideonline" id="hideonline1" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label for="hideonline0"><input type="radio" name="hideonline" id="hideonline0" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label> <label for="hideonline0"><input type="radio" name="hideonline" id="hideonline0" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>

View file

@ -41,7 +41,7 @@
</tr> </tr>
<!-- IF S_CAN_HIDE_ONLINE --> <!-- IF S_CAN_HIDE_ONLINE -->
<tr> <tr>
<td class="row1" width="50%"><b class="genmed">{L_HIDE_ONLINE}:</b></td> <td class="row1" width="50%"><b class="genmed">{L_HIDE_ONLINE}:</b><br /><span class="gensmall">{L_HIDE_ONLINE_EXPLAIN}</span></td>
<td class="row2"><input type="radio" class="radio" name="hideonline" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span>&nbsp;&nbsp;<input type="radio" class="radio" name="hideonline" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td> <td class="row2"><input type="radio" class="radio" name="hideonline" value="1"<!-- IF S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span>&nbsp;&nbsp;<input type="radio" class="radio" name="hideonline" value="0"<!-- IF not S_HIDE_ONLINE --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -139,7 +139,7 @@ while ($row = $db->sql_fetchrow($result))
$row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>'; $row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>';
} }
if (!$row['user_allow_viewonline'] || !$row['session_viewonline']) if (!$row['session_viewonline'])
{ {
$view_online = ($auth->acl_get('u_viewonline')) ? true : false; $view_online = ($auth->acl_get('u_viewonline')) ? true : false;
$logged_hidden_online++; $logged_hidden_online++;

View file

@ -1100,7 +1100,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache))
$update_time = $config['load_online_time'] * 60; $update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline'] && $user_cache[$row['session_user_id']]['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }