Merge branch 'develop' into feature/prune-users

* develop: (170 commits)
  [ticket/10145] Always recompile all templates when DEBUG_EXTRA is defined.
  [feature/attachment-management-no-reassignment] Handle privacy and some more.
  [ticket/10148] Turn TEMPLATE_BITFIELD into an instance variable.
  [ticket/10147] Corrected a typo in includes/functions_template.php.
  [ticket/10141] Save a hash lookup when value is not in cache.
  [ticket/10143] Added tests for storing a previously deleted value in db cache.
  [ticket/10105] Update AIM express link.
  [ticket/10105] Update AIM application download link.
  [ticket/10137] Remove unintended space at end of PHP_URL_FOPEN_SUPPORT_EXPLAIN.
  [ticket/10141] Split double-assignment into conditional and unconditional part.
  [ticket/10141] Use a cache in $auth->_fill_acl() for better performance.
  [ticket/9961] Create log entries when users are activated.
  [ticket/10139] Make signatures of set_atomic() consistent by using $new_value.
  [ticket/10139] Rename $cache to $use_cache to avoid confusion with cache object
  [ticket/10006] Remove unneeded if statements
  [ticket/10006] Remove return values
  [ticket/10006] More testing
  [ticket/10006] Tweak the tests a bit
  [ticket/10006] Add phpbb_config::delete
  [ticket/7941] Added @return to generate_board_url docstring.
  ...
This commit is contained in:
Oleg Pudeyev 2011-05-08 03:21:19 -04:00
commit ab44fe5e39
139 changed files with 3946 additions and 2356 deletions

2
.gitignore vendored
View file

@ -1,8 +1,10 @@
*~
phpunit.xml
phpBB/cache/*.php
phpBB/cache/queue.php.lock
phpBB/config.php
phpBB/files/*
phpBB/images/avatars/gallery/*
phpBB/images/avatars/upload/*
phpBB/store/*
tests/phpbb_unit_tests.sqlite2

View file

@ -13,6 +13,7 @@
<!-- These are the main targets which you will probably want to use -->
<target name="package" depends="clean,prepare,create-package" />
<target name="all" depends="clean,prepare,test,docs,create-package" />
<target name="build" depends="clean,prepare,test,docs" />
<target name="prepare">
<mkdir dir="build/logs" />

View file

@ -55,12 +55,24 @@ quit()
fi
}
msg=$(grep -nE '.{81,}' "$1");
# Check for empty commit message
if ! grep -qv '^#' "$1"
then
# Commit message is empty (or contains only comments).
# Let git handle this.
# It will abort with a message like so:
#
# Aborting commit due to empty commit message.
exit 0
fi
msg=$(grep -v '^#' "$1" |grep -nE '.{81,}')
if [ $? -eq 0 ]
then
echo "The following lines are greater than 80 characters long:\n" >&2;
echo $msg >&2;
echo "The following lines are greater than 80 characters long:" >&2;
echo >&2
echo "$msg" >&2;
quit $ERR_LENGTH;
fi
@ -107,7 +119,19 @@ do
case $expect in
"header")
err=$ERR_HEADER;
echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$"
result=$?
if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
then
# Don't be too strict.
# Commits may be temporary, intended to be squashed later.
# Just issue a warning here.
echo "Warning: heading should be a sentence beginning with a capital letter." 1>&2
echo "You entered:" 1>&2
echo "$line" 1>&2
fi
# restore exit code
(exit $result)
;;
"empty")
err=$ERR_EMPTY;
@ -128,6 +152,10 @@ do
# Should not end up here
false
;;
"possibly-eof")
# Allow empty and/or comment lines at the end
! tail -n +"$i" "$1" |grep -qvE '^($|#)'
;;
"comment")
echo "$line" | grep -Eq "^#";
;;
@ -188,7 +216,7 @@ do
in_description=1;
;;
"footer")
expecting="footer eof";
expecting="footer possibly-eof";
if [ "$tickets" = "" ]
then
tickets="$line";
@ -199,6 +227,9 @@ do
"comment")
# Comments should expect the same thing again
;;
"possibly-eof")
expecting="eof";
;;
*)
echo "Unrecognised token $expect" >&2;
quit 254;

View file

@ -35,7 +35,7 @@ then
# Branch is prefixed with 'ticket/', append ticket ID to message
if [ "$branch" != "${branch##ticket/}" ];
then
tail="\n\nPHPBB3-${branch##ticket/}";
tail="$(printf "\n\nPHPBB3-${branch##ticket/}")";
fi
echo "[$branch] $tail$(cat "$1")" > "$1"

175
git-tools/merge.php Executable file
View file

@ -0,0 +1,175 @@
#!/usr/bin/env php
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
function show_usage()
{
$filename = basename(__FILE__);
echo "$filename merges a github pull request.\n";
echo "\n";
echo "Usage: [php] $filename -p pull_request_id [OPTIONS]\n";
echo "\n";
echo "Options:\n";
echo " -p pull_request_id The pull request id to be merged (mandatory)\n";
echo " -r remote Remote of upstream, defaults to 'upstream' (optional)\n";
echo " -d Outputs the commands instead of running them (optional)\n";
echo " -h This help text\n";
exit(2);
}
// Handle arguments
$opts = getopt('p:r:dh');
if (empty($opts) || isset($opts['h']))
{
show_usage();
}
$pull_id = get_arg($opts, 'p', '');
$remote = get_arg($opts, 'r', 'upstream');
$dry_run = !get_arg($opts, 'd', true);
try
{
exit(work($pull_id, $remote));
}
catch (RuntimeException $e)
{
echo $e->getMessage();
exit($e->getCode());
}
function work($pull_id, $remote)
{
// Get some basic data
$pull = get_pull('phpbb', 'phpbb3', $pull_id);
if (!$pull_id)
{
show_usage();
}
if ($pull['state'] != 'open')
{
throw new RuntimeException(sprintf("Error: pull request is closed\n",
$target_branch), 5);
}
$pull_user = $pull['head'][0];
$pull_branch = $pull['head'][1];
$target_branch = $pull['base'][1];
switch ($target_branch)
{
case 'develop-olympus':
run("git checkout develop-olympus");
run("git pull $remote develop-olympus");
add_remote($pull_user, 'phpbb3');
run("git fetch $pull_user");
run("git merge --no-ff $pull_user/$pull_branch");
run("phpunit");
run("git checkout develop");
run("git pull $remote develop");
run("git merge --no-ff develop-olympus");
run("phpunit");
break;
case 'develop':
run("git checkout develop");
run("git pull $remote develop");
add_remote($pull_user, 'phpbb3');
run("git fetch $pull_user");
run("git merge --no-ff $pull_user/$pull_branch");
run("phpunit");
break;
default:
throw new RuntimeException(sprintf("Error: pull request target branch '%s' is not a main branch\n",
$target_branch), 5);
break;
}
}
function add_remote($username, $repository, $pushable = false)
{
$url = get_repository_url($username, $repository, false);
run("git remote add $username $url", true);
if ($pushable)
{
$ssh_url = get_repository_url($username, $repository, true);
run("git remote set-url --push $username $ssh_url");
}
}
function get_repository_url($username, $repository, $ssh = false)
{
$url_base = ($ssh) ? 'git@github.com:' : 'git://github.com/';
return $url_base . $username . '/' . $repository . '.git';
}
function api_request($query)
{
$contents = file_get_contents("http://github.com/api/v2/json/$query");
if ($contents === false)
{
throw new RuntimeException("Error: failed to retrieve pull request data\n", 4);
}
return json_decode($contents);
}
function get_pull($username, $repository, $pull_id)
{
$request = api_request("pulls/$username/$repository/$pull_id");
$pull = $request->pull;
$pull_data = array(
'base' => array($pull->base->user->login, $pull->base->ref),
'head' => array($pull->head->user->login, $pull->head->ref),
'state' => $pull->state,
);
return $pull_data;
}
function get_arg($array, $index, $default)
{
return isset($array[$index]) ? $array[$index] : $default;
}
function run($cmd, $ignore_fail = false)
{
global $dry_run;
if (!empty($dry_run))
{
echo "$cmd\n";
}
else
{
passthru(escapeshellcmd($cmd), $status);
if ($status != 0 && !$ignore_fail)
{
throw new RuntimeException(sprintf("Error: command '%s' failed with status %s'\n",
$cmd, $status), 6);
}
}
}

View file

@ -371,6 +371,79 @@
</fieldset>
</form>
<!-- ELSEIF S_MANAGE -->
<form id="attachments" method="post" action="{U_ACTION}">
<fieldset class="tabulated">
<legend>{L_TITLE}</legend>
<!-- IF PAGINATION or TOTAL_FILES -->
<div class="pagination">
{L_NUMBER_FILES}: {TOTAL_FILES} &bull; {L_TOTAL_SIZE}: {TOTAL_SIZE}<!-- IF S_ON_PAGE --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {S_ON_PAGE}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
<table cellspacing="1">
<thead>
<tr>
<th>{L_FILENAME}</th>
<th>{L_POSTED}</th>
<th>{L_FILESIZE}</th>
<th>{L_DELETE}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN attachments -->
<!-- IF attachments.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
<td>
<!-- IF attachments.S_IN_MESSAGE -->{L_EXTENSION_GROUP}: <strong><!-- IF attachments.EXT_GROUP_NAME -->{attachments.EXT_GROUP_NAME}<!-- ELSE -->{L_NO_EXT_GROUP}<!-- ENDIF --></strong><br />{attachments.L_DOWNLOAD_COUNT}<br />{L_IN} {L_PRIVATE_MESSAGE}
<!-- ELSE --><a href="{attachments.U_FILE}" style="font-weight: bold;">{attachments.REAL_FILENAME}</a><br /><!-- IF attachments.COMMENT -->{attachments.COMMENT}<br /><!-- ENDIF -->{attachments.L_DOWNLOAD_COUNT}<br />{L_TOPIC}: <a href="{attachments.U_VIEW_TOPIC}">{attachments.TOPIC_TITLE}</a><!-- ENDIF -->
</td>
<td>{attachments.FILETIME}<br />{L_POST_BY_AUTHOR} {attachments.ATTACHMENT_POSTER}</td>
<td>{attachments.FILESIZE}</td>
<td><input type="checkbox" class="radio" name="delete[{attachments.ATTACH_ID}]" /></td>
</tr>
<!-- END attachments -->
<tr class="row4">
<td colspan="3">&nbsp;</td>
<td class="small"><a href="#" onclick="marklist('attachments', 'delete', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('attachments', 'delete', false); return false;">{L_UNMARK_ALL}</a></td>
</tr>
</tbody>
</table>
<!-- IF TOTAL_FILES -->
<fieldset class="display-options">
{L_DISPLAY_LOG}: &nbsp;{S_LIMIT_DAYS}&nbsp;{L_SORT_BY}: {S_SORT_KEY} {S_SORT_DIR}
<input class="button2" type="submit" value="{L_GO}" name="sort" />
</fieldset>
<hr />
<div class="pagination">
{L_NUMBER_FILES}: {TOTAL_FILES} &bull; {L_TOTAL_SIZE}: {TOTAL_SIZE}<!-- IF S_ON_PAGE --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {S_ON_PAGE}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
<p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
</p>
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- IF S_ACTION_OPTIONS -->
<fieldset>
<legend>{L_RESYNC_STATS}</legend>
<form id="action_stats_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_stats">{L_RESYNC_FILES_STATS}</label><br /><span>{L_RESYNC_FILES_STATS_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
</dl>
</form>
</fieldset>
<!-- ENDIF -->
<!-- ENDIF -->
<!-- INCLUDE overall_footer.html -->

View file

@ -33,7 +33,7 @@
{
document.getElementById('acp_unban').unbangivereason.innerHTML = ban_give_reason[option];
document.getElementById('acp_unban').unbanreason.innerHTML = ban_reason[option];
document.getElementById('acp_unban').unbanlength.innerHTML = ban_length[option];
document.getElementById('acp_unban').unbanlength.value = ban_length[option];
}
// ]]>

View file

@ -38,6 +38,10 @@
<dt><label for="priority">{L_MAIL_PRIORITY}:</label></dt>
<dd><select id="priority" name="mail_priority_flag">{S_PRIORITY_OPTIONS}</select></dd>
</dl>
<dl>
<dt><label for="banned">{L_MAIL_BANNED}:</label><br /><span>{L_MAIL_BANNED_EXPLAIN}</span></dt>
<dd><input id="banned" name="mail_banned_flag" type="checkbox" class="radio" /></dd>
</dl>
<dl>
<dt><label for="send">{L_SEND_IMMEDIATELY}:</label></dt>
<dd><input id="send" type="checkbox" class="radio" name="send_immediately" checked="checked" /></dd>

View file

@ -70,6 +70,10 @@
<dt><label for="group_legend">{L_GROUP_LEGEND}:</label></dt>
<dd><input name="group_legend" type="checkbox" value="1" class="radio" id="group_legend"{GROUP_LEGEND} /></dd>
</dl>
<dl>
<dt><label for="group_teampage">{L_GROUP_TEAMPAGE}:</label></dt>
<dd><input name="group_teampage" type="checkbox" value="1" class="radio" id="group_teampage"{GROUP_TEAMPAGE} /></dd>
</dl>
<dl>
<dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}:</label><br /><span>{L_GROUP_RECEIVE_PM_EXPLAIN}</span></dt>
<dd><input name="group_receive_pm" type="checkbox" value="1" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd>

View file

@ -0,0 +1,158 @@
<!-- INCLUDE overall_header.html -->
<a name="maincontent"></a>
<h1>{L_MANAGE_LEGEND}</h1>
<form id="legend_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
<fieldset>
<legend>{L_LEGEND_SETTINGS}</legend>
<dl>
<dt><label for="legend_sort_groupname">{L_LEGEND_SORT_GROUPNAME}:</label><br /><span>{L_LEGEND_SORT_GROUPNAME_EXPLAIN}</span></dt>
<dd>
<label><input type="radio" name="legend_sort_groupname" class="radio" value="1"<!-- IF LEGEND_SORT_GROUPNAME --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="legend_sort_groupname" class="radio" value="0"<!-- IF not LEGEND_SORT_GROUPNAME --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
<input type="hidden" name="action" value="set_config_legend" />
{S_FORM_TOKEN}
</p>
</fieldset>
</form>
<p>{L_LEGEND_EXPLAIN}</p>
<table cellspacing="1">
<col class="col1" /><col class="col2" /><col class="col2" />
<thead>
<tr>
<th style="width: 50%">{L_GROUP}</th>
<th>{L_GROUP_TYPE}</th>
<th>{L_ACTION}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN legend -->
<tr>
<td><strong{legend.GROUP_COLOUR}>{legend.GROUP_NAME}</strong></td>
<td style="text-align: center;">{legend.GROUP_TYPE}</td>
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
<!-- IF legend.S_FIRST_ROW && not legend.S_LAST_ROW -->
{ICON_MOVE_UP_DISABLED}
<a href="{legend.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
<!-- ELSEIF not legend.S_FIRST_ROW && not legend.S_LAST_ROW -->
<a href="{legend.U_MOVE_UP}">{ICON_MOVE_UP}</a>
<a href="{legend.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
<!-- ELSEIF legend.S_LAST_ROW && not legend.S_FIRST_ROW -->
<a href="{legend.U_MOVE_UP}">{ICON_MOVE_UP}</a>
{ICON_MOVE_DOWN_DISABLED}
<!-- ELSE -->
{ICON_MOVE_UP_DISABLED}
{ICON_MOVE_DOWN_DISABLED}
<!-- ENDIF -->
<a href="{legend.U_DELETE}">{ICON_DELETE}</a>
</td>
</tr>
<!-- BEGINELSE -->
<tr>
<td colspan="3" class="row3">{L_NO_GROUPS_ADDED}</td>
</tr>
<!-- END legend -->
</tbody>
</table>
<form id="acp_groups" method="post" action="{U_ACTION_LEGEND}">
<fieldset class="quick">
<select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_LEGEND}</select>
<input class="button2" type="submit" name="submit" value="{L_ADD}" />
<input type="hidden" name="action" value="add" />
{S_FORM_TOKEN}
</fieldset>
</form>
<h1>{L_MANAGE_TEAMPAGE}</h1>
<form id="teampage_settings" method="post" action="{U_ACTION}"<!-- IF S_CAN_UPLOAD --> enctype="multipart/form-data"<!-- ENDIF -->>
<fieldset>
<legend>{L_TEAMPAGE_SETTINGS}</legend>
<dl>
<dt><label for="teampage_multiple">{L_TEAMPAGE_MULTIPLE}:</label><br /><span>{L_TEAMPAGE_MULTIPLE_EXPLAIN}</span></dt>
<dd>
<label><input type="radio" name="teampage_multiple" class="radio" value="1"<!-- IF DISPLAY_MULTIPLE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="teampage_multiple" class="radio" value="0"<!-- IF not DISPLAY_MULTIPLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<dl>
<dt><label for="teampage_forums">{L_TEAMPAGE_FORUMS}:</label><br /><span>{L_TEAMPAGE_FORUMS_EXPLAIN}</span></dt>
<dd>
<label><input type="radio" name="teampage_forums" class="radio" value="1"<!-- IF DISPLAY_FORUMS --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="teampage_forums" class="radio" value="0"<!-- IF not DISPLAY_FORUMS --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="update" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
<input type="hidden" name="action" value="set_config_teampage" />
{S_FORM_TOKEN}
</p>
</fieldset>
</form>
<p>{L_TEAMPAGE_EXPLAIN}</p>
<table cellspacing="1">
<col class="col1" /><col class="col2" /><col class="col2" />
<thead>
<tr>
<th style="width: 50%">{L_GROUP}</th>
<th>{L_GROUP_TYPE}</th>
<th>{L_ACTION}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN teampage -->
<tr>
<td><strong{teampage.GROUP_COLOUR}>{teampage.GROUP_NAME}</strong></td>
<td style="text-align: center;">{teampage.GROUP_TYPE}</td>
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
<!-- IF teampage.S_FIRST_ROW && not teampage.S_LAST_ROW -->
{ICON_MOVE_UP_DISABLED}
<a href="{teampage.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
<!-- ELSEIF not teampage.S_FIRST_ROW && not teampage.S_LAST_ROW -->
<a href="{teampage.U_MOVE_UP}">{ICON_MOVE_UP}</a>
<a href="{teampage.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
<!-- ELSEIF teampage.S_LAST_ROW && not teampage.S_FIRST_ROW -->
<a href="{teampage.U_MOVE_UP}">{ICON_MOVE_UP}</a>
{ICON_MOVE_DOWN_DISABLED}
<!-- ELSE -->
{ICON_MOVE_UP_DISABLED}
{ICON_MOVE_DOWN_DISABLED}
<!-- ENDIF -->
<a href="{teampage.U_DELETE}">{ICON_DELETE}</a>
</td>
</tr>
<!-- BEGINELSE -->
<tr>
<td colspan="3" class="row3">{L_NO_GROUPS_ADDED}</td>
</tr>
<!-- END teampage -->
</tbody>
</table>
<form id="acp_groups" method="post" action="{U_ACTION_TEAMPAGE}">
<fieldset class="quick">
<select name="g"><option value="0">{L_SELECT_GROUP}</option>{S_GROUP_SELECT_TEAMPAGE}</select>
<input class="button2" type="submit" name="submit" value="{L_ADD}" />
<input type="hidden" name="action" value="add" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- INCLUDE overall_footer.html -->

View file

@ -35,8 +35,8 @@
</dl>
<dl>
<dt><label for="special_rank">{L_RANK_SPECIAL}:</label></dt>
<dd><label><input onchange="dE('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
<label><input onchange="dE('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
<dd><label><input onclick="dE('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> />{L_YES}</label>
<label><input onclick="dE('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
<dl>

View file

@ -118,11 +118,6 @@ else
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
}
if (defined('IN_CRON'))
{
$phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
}
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
{
require($phpbb_root_path . 'config.' . $phpEx);

View file

@ -62,14 +62,11 @@ function do_cron($cron_lock, $run_tasks)
if ($config['use_system_cron'])
{
$use_shutdown_function = false;
$cron = new phpbb_cron_manager($phpbb_root_path . 'includes/cron/task', $phpEx, $cache->get_driver());
}
else
{
$cron_type = request_var('cron_type', '');
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;
// Comment this line out for debugging so the page does not return an image.
output_image();
@ -95,23 +92,13 @@ if ($cron_lock->acquire())
}
if ($task->is_ready())
{
if ($use_shutdown_function && !$task->is_shutdown_function_safe())
{
$use_shutdown_function = false;
}
$run_tasks = array($task);
}
}
}
if ($use_shutdown_function)
{
register_shutdown_function('do_cron', $cron_lock, $run_tasks);
}
else
{
do_cron($cron_lock, $run_tasks);
}
}
else
{
if (defined('DEBUG_EXTRA'))

View file

@ -1146,7 +1146,8 @@ function get_schema_struct()
'group_receive_pm' => array('BOOL', 0),
'group_message_limit' => array('UINT', 0),
'group_max_recipients' => array('UINT', 0),
'group_legend' => array('BOOL', 1),
'group_legend' => array('UINT', 0),
'group_teampage' => array('UINT', 0),
),
'PRIMARY_KEY' => 'group_id',
'KEYS' => array(

View file

@ -22,20 +22,18 @@ involved in phpBB.
phpBB Lead Developer: naderman (Nils Adermann)
phpBB Developers: A_Jelly_Doughnut (Josh Woody)
Acyd Burn (Meik Sievertsen) [Lead 09/2005 - 01/2010]
phpBB Developers: Acyd Burn (Meik Sievertsen) [Lead 09/2005 - 01/2010]
APTX (Marek A. R.)
bantu (Andreas Fischer)
dhn (Dominik Dröscher)
ckwalsh (Cullen Walsh)
igorw (Igor Wiedler)
kellanved (Henry Sudhof)
nickvergessen (Joas Schilling)
nn- (Oleg Pudeyev)
rxu (Ruslan Uzdenov)
Terrafrost (Jim Wigginton)
ToonArmy (Chris Smith)
Contributions by: Brainy (Cullen Walsh)
leviatan21 (Gabriel Vazquez)
Contributions by: leviatan21 (Gabriel Vazquez)
Raimon (Raimon Meuldijk)
Xore (Robert Hetzler)
@ -47,10 +45,13 @@ phpBB Project Manager: theFinn (James Atkinson) [Founder - 04/2007]
phpBB Lead Developer: psoTFX (Paul S. Owen) [2001 - 09/2005]
phpBB Developers: Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006]
phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010]
Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006]
BartVB (Bart van Bragt) [11/2000 - 03/2006]
DavidMJ (David M.) [12/2005 - 08/2009]
dhn (Dominik Dröscher) [05/2007 - 01/2011]
GrahamJE (Graham Eames) [09/2005 - 11/2006]
TerraFrost (Jim Wigginton) [04/2009 - 01/2011]
Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009]
-- Copyrights --

View file

@ -79,6 +79,7 @@
<li><a href="#postinstall">Important (security related) post-Install tasks for all installation methods</a>
<ol style="list-style-type: lower-roman;">
<li><a href="#avatars">Uploadable avatars</a></li>
<li><a href="#webserver_configuration">Webserver configuration</a></li>
</ol>
</li>
<li><a href="#disclaimer">Disclaimer</a></li>
@ -408,6 +409,12 @@
<p>Please be aware that setting a directories permissions to global write access is a potential security issue. While it is unlikely that anything nasty will occur (such as all the avatars being deleted) there are always people out there to cause trouble. Therefore you should monitor this directory and if possible make regular backups.</p>
<a name="webserver_configuration"></a><h3>6.ii. Webserver configuration</h3>
<p>Depending on your web server you may have to configure your server to deny web access to the <code>cache/</code>, <code>files/</code>, <code>store/</code> and other directories. This is to prevent users from accessing sensitive files.</p>
<p>For <strong>apache</strong> there are <code>.htaccess</code> files already in place to do this for you. For other webservers you will have to adjust the configuration yourself. Sample files for <strong>nginx</strong> and <strong>lighttpd</strong> to help you get started may be found in docs directory.</p>
</div>
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>

View file

@ -249,6 +249,11 @@ PHPBB_ACM_MEMCACHE_PORT (overwrite memcached port, default is 11211)
PHPBB_ACM_MEMCACHE_COMPRESS (overwrite memcached compress setting, default is disabled)
PHPBB_ACM_MEMCACHE_HOST (overwrite memcached host name, default is localhost)
PHPBB_ACM_REDIS_HOST (overwrite redis host name, default is localhost)
PHPBB_ACM_REDIS_PORT (overwrite redis port, default is 6379)
PHPBB_ACM_REDIS_PASSWORD (overwrite redis password, default is empty)
PHPBB_ACM_REDIS_DB (overwrite redis default database)
PHPBB_QA (Set board to QA-Mode, which means the updater also checks for RC-releases)
</pre></div>
@ -1097,7 +1102,7 @@ append_sid(&quot;{$phpbb_root_path}memberlist.$phpEx&quot;, 'mode=group&amp;amp;
<h4>General function usage: </h4>
<p>Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistant over the code.</p>
<p>Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistent over the code.</p>
<ul>
<li>

View file

@ -18,14 +18,23 @@ http {
gzip_vary on;
gzip_http_version 1.1;
gzip_min_length 700;
# Compression levels over 6 do not give an appreciable improvement
# in compression ratio, but take more resources.
gzip_comp_level 6;
gzip_disable "MSIE [1-6]\.";
# IE 6 and lower do not support gzip with Vary correctly.
gzip_disable "msie6";
# Before nginx 0.7.63:
#gzip_disable "MSIE [1-6]\.";
# Catch-all server for requests to invalid hosts.
# Also catches vulnerability scanners probing IP addresses.
# Should be first.
server {
listen 80;
# default specifies that this block is to be used when
# no other block matches.
listen 80 default;
server_name bogus;
return 444;
root /var/empty;
@ -34,14 +43,20 @@ http {
# If you have domains with and without www prefix,
# redirect one to the other.
server {
listen 80;
# Default port is 80.
#listen 80;
server_name myforums.com;
rewrite ^(.*)$ http://www.myforums.com$1 permanent;
# A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
rewrite ^ http://www.myforums.com$request_uri permanent;
# Equivalent to:
#rewrite ^(.*)$ http://www.myforums.com$1 permanent;
}
# The actual board domain.
server {
listen 80;
#listen 80;
server_name www.myforums.com;
root /path/to/phpbb;
@ -53,8 +68,10 @@ http {
# Deny access to internal phpbb files.
location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
internal;
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
# Pass the php scripts to fastcgi server specified in upstream declaration.
@ -68,8 +85,8 @@ http {
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
internal;
deny all;
internal;
}
}

View file

@ -194,8 +194,7 @@ else
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Global announcement?
$f_download = (!$row) ? $auth->acl_getf_global('f_download') : $auth->acl_get('f_download', $row['forum_id']);
$f_download = $auth->acl_get('f_download', $row['forum_id']);
if ($auth->acl_get('u_download') && $f_download)
{

View file

@ -95,11 +95,13 @@ while ($row = $feed->get_item())
$title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : '');
$item_time = (int) $row[$feed->get('date')];
$published = ($feed->get('published') !== NULL) ? (int) $row[$feed->get('published')] : 0;
$updated = ($feed->get('updated') !== NULL) ? (int) $row[$feed->get('updated')] : 0;
$item_row = array(
'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
'pubdate' => feed_format_date($item_time),
'published' => ($published > 0) ? feed_format_date($published) : '',
'updated' => ($updated > 0) ? feed_format_date($updated) : '',
'link' => '',
'title' => censor_text($title),
'category' => ($config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
@ -113,7 +115,7 @@ while ($row = $feed->get_item())
$item_vars[] = $item_row;
$feed_updated_time = max($feed_updated_time, $item_time);
$feed_updated_time = max($feed_updated_time, $published, $updated);
}
// If we do not have any items at all, sending the current time is better than sending no time.
@ -192,7 +194,13 @@ foreach ($item_vars as $row)
echo '<author><name><![CDATA[' . $row['author'] . ']]></name></author>' . "\n";
}
echo '<updated>' . $row['pubdate'] . '</updated>' . "\n";
echo '<updated>' . ((!empty($row['updated'])) ? $row['updated'] : $row['published']) . '</updated>' . "\n";
if (!empty($row['published']))
{
echo '<published>' . $row['published'] . '</published>' . "\n";
}
echo '<id>' . $row['link'] . '</id>' . "\n";
echo '<link href="' . $row['link'] . '"/>' . "\n";
echo '<title type="html"><![CDATA[' . $row['title'] . ']]></title>' . "\n\n";
@ -675,7 +683,8 @@ class phpbb_feed_post_base extends phpbb_feed_base
$this->set('author_id', 'user_id');
$this->set('creator', 'username');
$this->set('date', 'post_time');
$this->set('published', 'post_time');
$this->set('updated', 'post_edit_time');
$this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
@ -695,7 +704,7 @@ class phpbb_feed_post_base extends phpbb_feed_base
if ($config['feed_item_statistics'])
{
$item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time'])
. ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')])
. (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : '');
}
}
@ -717,7 +726,8 @@ class phpbb_feed_topic_base extends phpbb_feed_base
$this->set('author_id', 'topic_poster');
$this->set('creator', 'topic_first_poster_name');
$this->set('date', 'topic_time');
$this->set('published', 'post_time');
$this->set('updated', 'post_edit_time');
$this->set('text', 'post_text');
$this->set('bitfield', 'bbcode_bitfield');
@ -737,7 +747,7 @@ class phpbb_feed_topic_base extends phpbb_feed_base
if ($config['feed_item_statistics'])
{
$item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
. ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('date')])
. ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')])
. ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'])
. ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views']
. (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : '');
@ -765,9 +775,6 @@ class phpbb_feed_overall extends phpbb_feed_post_base
return false;
}
// Add global forum id
$forum_ids[] = 0;
// m_approve forums
$fid_m_approve = $this->get_moderator_approve_forums();
$sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', $fid_m_approve) : '';
@ -800,7 +807,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
// Get the actual data
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name, ' .
'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
USERS_TABLE => 'u',
@ -905,12 +912,11 @@ class phpbb_feed_forum extends phpbb_feed_post_base
global $auth, $db;
$m_approve = ($auth->acl_get('m_approve', $this->forum_id)) ? true : false;
$forum_ids = array(0, $this->forum_id);
// Determine topics with recent activity
$sql = 'SELECT topic_id, topic_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . '
WHERE forum_id = ' . $this->forum_id . '
AND topic_moved_id = 0
' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . '
ORDER BY topic_last_post_time DESC';
@ -932,7 +938,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
}
$this->sql = array(
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
POSTS_TABLE => 'p',
@ -999,64 +1005,6 @@ class phpbb_feed_topic extends phpbb_feed_post_base
trigger_error('NO_TOPIC');
}
if ($this->topic_data['topic_type'] == POST_GLOBAL)
{
// We need to find at least one postable forum where feeds are enabled,
// that the user can read and maybe also has approve permissions.
$in_fid_ary = $this->get_readable_forums();
if (empty($in_fid_ary))
{
// User cannot read any forums
trigger_error('SORRY_AUTH_READ');
}
if (!$this->topic_data['topic_approved'])
{
// Also require m_approve
$in_fid_ary = array_intersect($in_fid_ary, $this->get_moderator_approve_forums());
if (empty($in_fid_ary))
{
trigger_error('SORRY_AUTH_READ');
}
}
// Diff excluded forums
$in_fid_ary = array_diff($in_fid_ary, $this->get_excluded_forums());
if (empty($in_fid_ary))
{
trigger_error('SORRY_AUTH_READ');
}
// Also exclude passworded forums
$in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums());
if (empty($in_fid_ary))
{
trigger_error('SORRY_AUTH_READ');
}
$sql = 'SELECT forum_id, left_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . '
AND ' . $db->sql_in_set('forum_id', $in_fid_ary) . '
ORDER BY left_id ASC';
$result = $db->sql_query_limit($sql, 1);
$this->forum_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (empty($this->forum_data))
{
// No forum found.
trigger_error('SORRY_AUTH_READ');
}
unset($in_fid_ary);
}
else
{
$this->forum_id = (int) $this->topic_data['forum_id'];
// Make sure topic is either approved or user authed
@ -1090,14 +1038,13 @@ class phpbb_feed_topic extends phpbb_feed_post_base
unset($forum_ids_passworded);
}
}
}
function get_sql()
{
global $auth, $db;
$this->sql = array(
'SELECT' => 'p.post_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
'u.username, u.user_id',
'FROM' => array(
POSTS_TABLE => 'p',
@ -1136,7 +1083,7 @@ class phpbb_feed_forums extends phpbb_feed_base
$this->set('text', 'forum_desc');
$this->set('bitfield', 'forum_desc_bitfield');
$this->set('bbcode_uid','forum_desc_uid');
$this->set('date', 'forum_last_post_time');
$this->set('updated', 'forum_last_post_time');
$this->set('options', 'forum_desc_options');
}
@ -1235,9 +1182,6 @@ class phpbb_feed_news extends phpbb_feed_topic_base
return false;
}
// Add global forum
$in_fid_ary[] = 0;
// We really have to get the post ids first!
$sql = 'SELECT topic_first_post_id, topic_time
FROM ' . TOPICS_TABLE . '
@ -1261,8 +1205,8 @@ class phpbb_feed_news extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time,
p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
POSTS_TABLE => 'p',
@ -1308,9 +1252,6 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
return false;
}
// Add global forum
$in_fid_ary[] = 0;
// We really have to get the post ids first!
$sql = 'SELECT topic_first_post_id, topic_time
FROM ' . TOPICS_TABLE . '
@ -1334,8 +1275,8 @@ class phpbb_feed_topics extends phpbb_feed_topic_base
$this->sql = array(
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time,
p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, t.topic_last_post_time,
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
POSTS_TABLE => 'p',
@ -1381,8 +1322,6 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
$this->set('author_id', 'topic_last_poster_id');
$this->set('creator', 'topic_last_poster_name');
$this->set('date', 'topic_last_post_time');
$this->set('text', 'post_text');
}
function get_sql()
@ -1402,9 +1341,6 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
return false;
}
// Add global forum
$in_fid_ary[] = 0;
// Search for topics in last X days
$last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : '';
@ -1434,7 +1370,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base
'SELECT' => 'f.forum_id, f.forum_name,
t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views,
t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time,
p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url',
'FROM' => array(
TOPICS_TABLE => 't',
POSTS_TABLE => 'p',

View file

@ -61,6 +61,10 @@ class acp_attachments
$l_title = 'ACP_ORPHAN_ATTACHMENTS';
break;
case 'manage':
$l_title = 'ACP_MANAGE_ATTACHMENTS';
break;
default:
trigger_error('NO_MODE', E_USER_ERROR);
break;
@ -1043,6 +1047,230 @@ class acp_attachments
$db->sql_freeresult($result);
break;
case 'manage':
if ($submit)
{
$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array();
if (sizeof($delete_files))
{
// Select those attachments we want to delete...
$sql = 'SELECT real_filename
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('attach_id', $delete_files) . '
AND is_orphan = 0';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$deleted_filenames[] = $row['real_filename'];
}
$db->sql_freeresult($result);
if ($num_deleted = delete_attachments('attach', $delete_files))
{
if (sizeof($delete_files) != $num_deleted)
{
$error[] = $user->lang['FILES_GONE'];
}
add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $deleted_filenames));
$notify[] = sprintf($user->lang['LOG_ATTACHMENTS_DELETED'], implode(', ', $deleted_filenames));
}
else
{
$error[] = $user->lang['NO_FILES_TO_DELETE'];
}
}
}
$template->assign_vars(array(
'S_MANAGE' => true)
);
$start = request_var('start', 0);
// Sort keys
$sort_days = request_var('st', 0);
$sort_key = request_var('sk', 't');
$sort_dir = request_var('sd', 'd');
// Sorting
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('f' => $user->lang['FILENAME'], 't' => $user->lang['FILEDATE'], 's' => $user->lang['FILESIZE'], 'x' => $user->lang['EXTENSION'], 'd' => $user->lang['DOWNLOADS'],'p' => $user->lang['ATTACH_POST_TYPE'], 'u' => $user->lang['AUTHOR']);
$sort_by_sql = array('f' => 'a.real_filename', 't' => 'a.filetime', 's' => 'a.filesize', 'x' => 'a.extension', 'd' => 'a.download_count', 'p' => 'a.in_message', 'u' => 'u.username');
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
$min_filetime = ($sort_days) ? (time() - ($sort_days * 86400)) : '';
$limit_filetime = ($min_filetime) ? " AND a.filetime >= $min_filetime " : '';
$start = ($sort_days && isset($_POST['sort'])) ? 0 : $start;
$attachments_per_page = (int) $config['topics_per_page'];
// Handle files stats resync
$action = request_var('action', '');
$resync_files_stats = false;
if ($action && $action = 'stats')
{
if (!confirm_box(true))
{
confirm_box(false, $user->lang['RESYNC_FILES_STATS_CONFIRM'], build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'action' => $action,
)));
}
else
{
$resync_files_stats = true;
add_log('admin', 'LOG_RESYNC_FILES_STATS');
}
}
// Check if files stats are accurate
$sql = 'SELECT COUNT(attach_id) as num_files
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql, 600);
$num_files_real = (int) $db->sql_fetchfield('num_files');
if ($resync_files_stats === true)
{
set_config('num_files', $num_files_real, true);
}
$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as upload_dir_size
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql, 600);
$total_size_real = (float) $db->sql_fetchfield('upload_dir_size');
if ($resync_files_stats === true)
{
set_config('upload_dir_size', $total_size_real, true);
}
$db->sql_freeresult($result);
// Get current files stats
$num_files = (int) $config['num_files'];
$total_size = (float) $config['upload_dir_size'];
// Issue warning message if files stats are inaccurate
if (($num_files != $num_files_real) || ($total_size != $total_size_real))
{
$error[] = sprintf($user->lang['FILES_STATS_WRONG'], $num_files_real, get_formatted_filesize($total_size_real));
$template->assign_vars(array(
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
'U_ACTION' => $this->u_action,)
);
}
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start > $num_files)
{
$start = ($start < 0) ? 0 : floor(($num_files - 1) / $attachments_per_page) * $attachments_per_page;
}
// If the user is trying to reach the second half of the attachments list, fetch it starting from the end
$store_reverse = false;
$sql_limit = $attachments_per_page;
if ($start > $num_files / 2)
{
$store_reverse = true;
if ($start + $attachments_per_page > $num_files)
{
$sql_limit = min($attachments_per_page, max(1, $num_files - $start));
}
// Select the sort order. Add time sort anchor for non-time sorting cases
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : '';
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor;
$sql_start = max(0, $num_files - $sql_limit - $start);
}
else
{
// Select the sort order. Add time sort anchor for non-time sorting cases
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : '';
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor;
$sql_start = $start;
}
$attachments_list = array();
// Just get the files
$sql = 'SELECT a.*, u.username, u.user_colour, t.topic_title
FROM ' . ATTACHMENTS_TABLE . ' a
LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = a.poster_id)
LEFT JOIN ' . TOPICS_TABLE . " t ON (a.topic_id = t.topic_id)
WHERE a.is_orphan = 0
$limit_filetime
ORDER BY $sql_sort_order";
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$i = ($store_reverse) ? $sql_limit - 1 : 0;
// Store increment value in a variable to save some conditional calls
$i_increment = ($store_reverse) ? -1 : 1;
while ($attachment_row = $db->sql_fetchrow($result))
{
$attachments_list[$i] = $attachment_row;
$i = $i + $i_increment;
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'TOTAL_FILES' => $num_files,
'TOTAL_SIZE' => get_formatted_filesize($total_size),
'PAGINATION' => generate_pagination($this->u_action . "&amp;$u_sort_param", $num_files, $attachments_per_page, $start, true),
'S_ON_PAGE' => on_page($num_files, $attachments_per_page, $start),
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir)
);
// Grab extensions
$extensions = $cache->obtain_attach_extensions(true);
for ($i = 0, $end = sizeof($attachments_list); $i < $end; ++$i)
{
$row = $attachments_list[$i];
$row['extension'] = strtolower(trim((string) $row['extension']));
$comment = ($row['attach_comment'] && !$row['in_message']) ? str_replace(array("\n", "\r"), array('<br />', "\n"), $row['attach_comment']) : '';
$display_cat = $extensions[$row['extension']]['display_cat'];
$l_downloaded_viewed = ($display_cat == ATTACHMENT_CATEGORY_NONE) ? 'DOWNLOAD_COUNT' : 'VIEWED_COUNT';
$l_download_count = (!isset($row['download_count']) || (int) $row['download_count'] == 0) ? $user->lang[$l_downloaded_viewed . '_NONE'] : (((int) $row['download_count'] == 1) ? sprintf($user->lang[$l_downloaded_viewed], $row['download_count']) : sprintf($user->lang[$l_downloaded_viewed . 'S'], $row['download_count']));
$template->assign_block_vars('attachments', array(
'ATTACHMENT_POSTER' => get_username_string('full', (int) $row['poster_id'], (string) $row['username'], (string) $row['user_colour'], (string) $row['username']),
'FILESIZE' => get_formatted_filesize((int) $row['filesize']),
'FILETIME' => $user->format_date((int) $row['filetime']),
'REAL_FILENAME' => (!$row['in_message']) ? utf8_wordwrap(utf8_basename((string) $row['real_filename']), 40, '<br />', true) : '',
'PHYSICAL_FILENAME' => utf8_basename((string) $row['physical_filename']),
'EXT_GROUP_NAME' => (!empty($extensions[$row['extension']]['group_name'])) ? $user->lang['EXT_GROUP_' . $extensions[$row['extension']]['group_name']] : '',
'COMMENT' => $comment,
'TOPIC_TITLE' => (!$row['in_message']) ? (string) $row['topic_title'] : '',
'ATTACH_ID' => (int) $row['attach_id'],
'POST_ID' => (int) $row['post_msg_id'],
'TOPIC_ID' => (int) $row['topic_id'],
'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? (int) $post_ids[$row['attach_id']] : '',
'L_DOWNLOAD_COUNT' => $l_download_count,
'S_IN_MESSAGE' => (bool) $row['in_message'],
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&amp;p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}",
'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&amp;id=' . $row['attach_id']))
);
}
break;
}
if (sizeof($error))

View file

@ -110,10 +110,10 @@ class acp_board
'vars' => array(
'legend1' => 'ACP_AVATAR_SETTINGS',
'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false),
'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
@ -124,7 +124,7 @@ class acp_board
'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rwpath', 'type' => 'text:20:255', 'explain' => true),
'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true)
'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
)
);
break;
@ -296,7 +296,7 @@ class acp_board
'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false),
'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true)
'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true),
)
);
break;
@ -340,7 +340,7 @@ class acp_board
'title' => 'ACP_AUTH_SETTINGS',
'vars' => array(
'legend1' => 'ACP_AUTH_SETTINGS',
'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false)
'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'select_auth_method', 'explain' => false),
)
);
break;

View file

@ -56,6 +56,18 @@ class acp_disallow
trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'SELECT disallow_id
FROM ' . DISALLOW_TABLE . "
WHERE disallow_username = '" . $db->sql_escape($disallowed_user) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
trigger_error($user->lang['DISALLOWED_ALREADY'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
$db->sql_query($sql);

View file

@ -82,23 +82,48 @@ class acp_email
{
if ($group_id)
{
$sql = 'SELECT u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
WHERE ug.group_id = ' . $group_id . '
$sql_ary = array(
'SELECT' => 'u.user_email, u.username, u.username_clean, u.user_lang, u.user_jabber, u.user_notify_type',
'FROM' => array(
USERS_TABLE => 'u',
USER_GROUP_TABLE => 'ug',
),
'WHERE' => 'ug.group_id = ' . $group_id . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY u.user_lang, u.user_notify_type';
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')',
'ORDER_BY' => 'u.user_lang, u.user_notify_type',
);
}
else
{
$sql = 'SELECT username, username_clean, user_email, user_jabber, user_notify_type, user_lang
FROM ' . USERS_TABLE . '
WHERE user_allow_massemail = 1
AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY user_lang, user_notify_type';
$sql_ary = array(
'SELECT' => 'u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type',
'FROM' => array(
USERS_TABLE => 'u',
),
'WHERE' => 'u.user_allow_massemail = 1
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')',
'ORDER_BY' => 'u.user_lang, u.user_notify_type',
);
}
// Mail banned or not
if (!isset($_REQUEST['mail_banned_flag']))
{
$sql_ary['WHERE'] .= ' AND (b.ban_id IS NULL
OR b.ban_exclude = 1)';
$sql_ary['LEFT_JOIN'] = array(
array(
'FROM' => array(
BANLIST_TABLE => 'b',
),
'ON' => 'u.user_id = b.ban_userid',
),
);
}
$sql = $db->sql_build_query('SELECT', $sql_ary);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);

View file

@ -35,6 +35,12 @@ class acp_groups
$form_key = 'acp_groups';
add_form_key($form_key);
if ($mode == 'position')
{
$this->manage_position();
return;
}
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
// Check and set some common vars
@ -306,6 +312,7 @@ class acp_groups
'rank' => request_var('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'legend' => isset($_REQUEST['group_legend']) ? 1 : 0,
'teampage' => isset($_REQUEST['group_teampage']) ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0),
'max_recipients' => request_var('group_max_recipients', 0),
'founder_manage' => 0,
@ -419,6 +426,7 @@ class acp_groups
'avatar_height' => 'int',
'receive_pm' => 'int',
'legend' => 'int',
'teampage' => 'int',
'message_limit' => 'int',
'max_recipients'=> 'int',
'founder_manage'=> 'int',
@ -584,6 +592,7 @@ class acp_groups
'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
'GROUP_FOUNDER_MANAGE' => (isset($group_row['group_founder_manage']) && $group_row['group_founder_manage']) ? ' checked="checked"' : '',
'GROUP_LEGEND' => (isset($group_row['group_legend']) && $group_row['group_legend']) ? ' checked="checked"' : '',
'GROUP_TEAMPAGE' => (isset($group_row['group_teampage']) && $group_row['group_teampage']) ? ' checked="checked"' : '',
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,
'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',
@ -793,4 +802,122 @@ class acp_groups
}
}
}
public function manage_position()
{
global $config, $db, $template, $user;
$this->tpl_name = 'acp_groups_position';
$this->page_title = 'ACP_GROUPS_POSITION';
$field = request_var('field', '');
$action = request_var('action', '');
$group_id = request_var('g', 0);
if ($field && !in_array($field, array('legend', 'teampage')))
{
// Invalid mode
trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
else if ($field)
{
$group_position = new phpbb_group_positions($db, $field, $this->u_action);
}
switch ($action)
{
case 'set_config_legend':
set_config('legend_sort_groupname', request_var('legend_sort_groupname', 0));
break;
case 'set_config_teampage':
set_config('teampage_forums', request_var('teampage_forums', 0));
set_config('teampage_multiple', request_var('teampage_multiple', 0));
break;
case 'add':
$group_position->add_group($group_id);
break;
case 'delete':
$group_position->delete_group($group_id);
break;
case 'move_up':
$group_position->move_up($group_id);
break;
case 'move_down':
$group_position->move_down($group_id);
break;
}
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
FROM ' . GROUPS_TABLE . '
ORDER BY group_legend, group_name ASC';
$result = $db->sql_query($sql);
$s_group_select_legend = '';
while ($row = $db->sql_fetchrow($result))
{
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
if ($row['group_legend'])
{
$template->assign_block_vars('legend', array(
'GROUP_NAME' => $group_name,
'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '',
'GROUP_TYPE' => $user->lang[phpbb_group_positions::group_type_language($row['group_type'])],
'U_MOVE_DOWN' => "{$this->u_action}&amp;field=legend&amp;action=move_down&amp;g=" . $row['group_id'],
'U_MOVE_UP' => "{$this->u_action}&amp;field=legend&amp;action=move_up&amp;g=" . $row['group_id'],
'U_DELETE' => "{$this->u_action}&amp;field=legend&amp;action=delete&amp;g=" . $row['group_id'],
));
}
else
{
$s_group_select_legend .= '<option value="' . (int) $row['group_id'] . '">' . $group_name . '</option>';
}
}
$db->sql_freeresult($result);
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_teampage
FROM ' . GROUPS_TABLE . '
ORDER BY group_teampage, group_name ASC';
$result = $db->sql_query($sql);
$s_group_select_teampage = '';
while ($row = $db->sql_fetchrow($result))
{
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
if ($row['group_teampage'])
{
$template->assign_block_vars('teampage', array(
'GROUP_NAME' => $group_name,
'GROUP_COLOUR' => ($row['group_colour']) ? ' style="color: #' . $row['group_colour'] . '"' : '',
'GROUP_TYPE' => $user->lang[phpbb_group_positions::group_type_language($row['group_type'])],
'U_MOVE_DOWN' => "{$this->u_action}&amp;field=teampage&amp;action=move_down&amp;g=" . $row['group_id'],
'U_MOVE_UP' => "{$this->u_action}&amp;field=teampage&amp;action=move_up&amp;g=" . $row['group_id'],
'U_DELETE' => "{$this->u_action}&amp;field=teampage&amp;action=delete&amp;g=" . $row['group_id'],
));
}
else
{
$s_group_select_teampage .= '<option value="' . (int) $row['group_id'] . '">' . $group_name . '</option>';
}
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'U_ACTION' => $this->u_action,
'U_ACTION_LEGEND' => $this->u_action . '&amp;field=legend',
'U_ACTION_TEAMPAGE' => $this->u_action . '&amp;field=teampage',
'S_GROUP_SELECT_LEGEND' => $s_group_select_legend,
'S_GROUP_SELECT_TEAMPAGE' => $s_group_select_teampage,
'DISPLAY_FORUMS' => ($config['teampage_forums']) ? true : false,
'DISPLAY_MULTIPLE' => ($config['teampage_multiple']) ? true : false,
'LEGEND_SORT_GROUPNAME' => ($config['legend_sort_groupname']) ? true : false,
));
}
}

View file

@ -395,6 +395,10 @@ class acp_icons
{
// skip images where add wasn't checked
}
else if (!file_exists($phpbb_root_path . $img_path . '/' . $image))
{
$errors[$image] = 'SMILIE_NO_FILE';
}
else
{
if ($image_width[$image] == 0 || $image_height[$image] == 0)

View file

@ -384,17 +384,30 @@ class acp_search
AND post_id <= ' . (int) ($post_counter + $this->batch_size);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
$buffer = $db->sql_buffer_nested_transactions();
if ($buffer)
{
// Indexing enabled for this forum or global announcement?
// Global announcements get indexed by default.
if (!$row['forum_id'] || (isset($forums[$row['forum_id']]) && $forums[$row['forum_id']]))
$rows = $db->sql_fetchrowset($result);
$rows[] = false; // indicate end of array for while loop below
$db->sql_freeresult($result);
}
$i = 0;
while ($row = ($buffer ? $rows[$i++] : $db->sql_fetchrow($result)))
{
// Indexing enabled for this forum
if (isset($forums[$row['forum_id']]) && $forums[$row['forum_id']])
{
$this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
}
$row_count++;
}
if (!$buffer)
{
$db->sql_freeresult($result);
}
$post_counter += $this->batch_size;
}

View file

@ -45,7 +45,7 @@ class acp_styles
$bitfield->set(9);
$bitfield->set(11);
$bitfield->set(12);
define('TEMPLATE_BITFIELD', $bitfield->get_base64());
$this->template_bitfield = $bitfield->get_base64();
unset($bitfield);
$user->add_lang('acp/styles');
@ -716,7 +716,7 @@ parse_css_file = {PARSE_CSS_FILE}
$save_changes = (isset($_POST['save'])) ? true : false;
// make sure template_file path doesn't go upwards
$template_file = str_replace('..', '.', $template_file);
$template_file = preg_replace('#\.{2,}#', '.', $template_file);
// Retrieve some information about the template
$sql = 'SELECT template_storedb, template_path, template_name
@ -3496,7 +3496,7 @@ parse_css_file = {PARSE_CSS_FILE}
}
else
{
$sql_ary['bbcode_bitfield'] = TEMPLATE_BITFIELD;
$sql_ary['bbcode_bitfield'] = $this->template_bitfield;
}
// We set a pre-defined bitfield here which we may use further in 3.2

View file

@ -23,7 +23,8 @@ class acp_attachments_info
'attach' => array('title' => 'ACP_ATTACHMENT_SETTINGS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_ATTACHMENTS')),
'extensions' => array('title' => 'ACP_MANAGE_EXTENSIONS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')),
'ext_groups' => array('title' => 'ACP_EXTENSION_GROUPS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')),
'orphan' => array('title' => 'ACP_ORPHAN_ATTACHMENTS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS'))
'orphan' => array('title' => 'ACP_ORPHAN_ATTACHMENTS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')),
'manage' => array('title' => 'ACP_MANAGE_ATTACHMENTS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')),
),
);
}

View file

@ -21,6 +21,7 @@ class acp_groups_info
'version' => '1.0.0',
'modes' => array(
'manage' => array('title' => 'ACP_GROUPS_MANAGE', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')),
'position' => array('title' => 'ACP_GROUPS_POSITION', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')),
),
);
}

View file

@ -109,6 +109,7 @@ class auth
*/
function _fill_acl($user_permissions)
{
$seq_cache = array();
$this->acl = array();
$user_permissions = explode("\n", $user_permissions);
@ -125,8 +126,17 @@ class auth
while ($subseq = substr($seq, $i, 6))
{
if (isset($seq_cache[$subseq]))
{
$converted = $seq_cache[$subseq];
}
else
{
$converted = $seq_cache[$subseq] = str_pad(base_convert($subseq, 36, 2), 31, 0, STR_PAD_LEFT);
}
// We put the original bitstring into the acl array
$this->acl[$f] .= str_pad(base_convert($subseq, 36, 2), 31, 0, STR_PAD_LEFT);
$this->acl[$f] .= $converted;
$i += 6;
}
}

150
phpBB/includes/cache/driver/redis.php vendored Executable file
View file

@ -0,0 +1,150 @@
<?php
/**
*
* @package acm
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (!defined('PHPBB_ACM_REDIS_PORT'))
{
define('PHPBB_ACM_REDIS_PORT', 6379);
}
if (!defined('PHPBB_ACM_REDIS_HOST'))
{
define('PHPBB_ACM_REDIS_HOST', 'localhost');
}
if (!defined('PHPBB_ACM_REDIS'))
{
//can define multiple servers with host1/port1,host2/port2 format
define('PHPBB_ACM_REDIS', PHPBB_ACM_REDIS_HOST . '/' . PHPBB_ACM_REDIS_PORT);
}
/**
* ACM for Redis
*
* Compatible with the php extension phpredis available
* at https://github.com/nicolasff/phpredis
*
* @package acm
*/
class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
{
var $extension = 'redis';
var $redis;
function __construct()
{
// Call the parent constructor
parent::__construct();
$this->redis = new Redis();
foreach (explode(',', PHPBB_ACM_REDIS) as $server)
{
$parts = explode('/', $server);
$this->redis->connect(trim($parts[0]), trim($parts[1]));
}
if (defined('PHPBB_ACM_REDIS_PASSWORD'))
{
if (!$this->redis->auth(PHPBB_ACM_REDIS_PASSWORD))
{
global $acm_type;
trigger_error("Incorrect password for the ACM module $acm_type.", E_USER_ERROR);
}
}
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$this->redis->setOption(Redis::OPT_PREFIX, $this->key_prefix);
if (defined('PHPBB_ACM_REDIS_DB'))
{
if (!$this->redis->select(PHPBB_ACM_REDIS_DB))
{
global $acm_type;
trigger_error("Incorrect database for the ACM module $acm_type.", E_USER_ERROR);
}
}
}
/**
* Unload the cache resources
*
* @return void
*/
function unload()
{
parent::unload();
$this->redis->close();
}
/**
* Purge cache data
*
* @return void
*/
function purge()
{
$this->redis->flushDB();
parent::purge();
}
/**
* Fetch an item from the cache
*
* @access protected
* @param string $var Cache key
* @return mixed Cached data
*/
function _read($var)
{
return $this->redis->get($var);
}
/**
* Store data in the cache
*
* @access protected
* @param string $var Cache key
* @param mixed $data Data to store
* @param int $ttl Time-to-live of cached data
* @return bool True if the operation succeeded
*/
function _write($var, $data, $ttl = 2592000)
{
return $this->redis->setex($var, $ttl, $data);
}
/**
* Remove an item from the cache
*
* @access protected
* @param string $var Cache key
* @return bool True if the operation succeeded
*/
function _delete($var)
{
if ($this->redis->delete($var) > 0)
{
return true;
}
return false;
}
}

View file

@ -194,6 +194,7 @@ class phpbb_cache_service
'max_filesize' => (int) $row['max_filesize'],
'allow_group' => $row['allow_group'],
'allow_in_pm' => $row['allow_in_pm'],
'group_name' => $row['group_name'],
);
$allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();

View file

@ -112,7 +112,7 @@ class captcha
$noise_bitmaps = $this->captcha_noise_bg_bitmaps();
for ($i = 0; $i < $code_len; ++$i)
{
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data'])));
$noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data'])));
list($min, $max) = $noise[$i]->range();
//$box = $noise[$i]->dimensions($sizes[$i]);
@ -1669,32 +1669,32 @@ class captcha
'height' => 15,
'data' => array(
'A' => $chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)],
'B' => $chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)],
'C' => $chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)],
'D' => $chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)],
'E' => $chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)],
'F' => $chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)],
'G' => $chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)],
'H' => $chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)],
'I' => $chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)],
'J' => $chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)],
'K' => $chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)],
'L' => $chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)],
'M' => $chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)],
'N' => $chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)],
'O' => $chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)],
'P' => $chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)],
'Q' => $chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)],
'R' => $chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)],
'S' => $chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)],
'T' => $chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)],
'U' => $chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)],
'V' => $chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)],
'W' => $chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)],
'X' => $chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)],
'Y' => $chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)],
'Z' => $chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)],
'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)],
'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)],
'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)],
'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)],
'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)],
'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)],
'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)],
'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)],
'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)],
'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)],
'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)],
'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)],
'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)],
'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)],
'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)],
'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)],
'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)],
'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)],
'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)],
'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)],
'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)],
'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)],
'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)],
'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)],
'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)],
'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)],
'1' => array(
array(0,0,0,1,1,0,0,0,0),

View file

@ -207,7 +207,6 @@ class phpbb_default_captcha
{
if ($this->check_code())
{
// $this->delete_code(); commented out to allow posting.php to repeat the question
$this->solved = true;
}
else
@ -329,17 +328,6 @@ class phpbb_default_captcha
return (strcasecmp($this->code, $this->confirm_code) === 0);
}
function delete_code()
{
global $db, $user;
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . $this->type;
$db->sql_query($sql);
}
function get_attempt_count()
{
return $this->attempts;

View file

@ -379,7 +379,6 @@ class phpbb_captcha_qa
{
if ($this->check_answer())
{
// $this->delete_code(); commented out to allow posting.php to repeat the question
$this->solved = true;
}
else
@ -566,20 +565,6 @@ class phpbb_captcha_qa
return $this->solved;
}
/**
* API function - clean the entry
*/
function delete_code()
{
global $db, $user;
$sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . $this->type;
$db->sql_query($sql);
}
/**
* API function
*/

View file

@ -103,15 +103,28 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
return count($this->config);
}
/**
* Removes a configuration option
*
* @param String $key The configuration option's name
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached
* @return void
*/
public function delete($key, $use_cache = true)
{
unset($this->config[$key]);
}
/**
* Sets a configuration option's value
*
* @param string $key The configuration option's name
* @param string $value New configuration value
* @param bool $cache Whether this variable should be cached or if it
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
public function set($key, $value, $cache = true)
public function set($key, $value, $use_cache = true)
{
$this->config[$key] = $value;
}
@ -122,16 +135,16 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
*
* @param string $key The configuration option's name
* @param string $old_value Current configuration value
* @param string $value New configuration value
* @param bool $cache Whether this variable should be cached or if it
* @param string $new_value New configuration value
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
* @return bool True if the value was changed, false otherwise.
*/
public function set_atomic($key, $old_value, $value, $cache = true)
public function set_atomic($key, $old_value, $new_value, $use_cache = true)
{
if (!isset($this->config[$key]) || $this->config[$key] == $old_value)
{
$this->config[$key] = $value;
$this->config[$key] = $new_value;
return true;
}
return false;
@ -142,10 +155,10 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
*
* @param string $key The configuration option's name
* @param int $increment Amount to increment by
* @param bool $cache Whether this variable should be cached or if it
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
function increment($key, $increment, $cache = true)
function increment($key, $increment, $use_cache = true)
{
if (!isset($this->config[$key]))
{

View file

@ -90,17 +90,39 @@ class phpbb_config_db extends phpbb_config
parent::__construct($config);
}
/**
* Removes a configuration option
*
* @param String $key The configuration option's name
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached
* @return void
*/
public function delete($key, $use_cache = true)
{
$sql = 'DELETE FROM ' . $this->table . "
WHERE config_name = '" . $this->db->sql_escape($key) . "'";
$this->db->sql_query($sql);
unset($this->config[$key]);
if ($use_cache)
{
$this->cache->destroy('config');
}
}
/**
* Sets a configuration option's value
*
* @param string $key The configuration option's name
* @param string $value New configuration value
* @param bool $cache Whether this variable should be cached or if it
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
public function set($key, $value, $cache = true)
public function set($key, $value, $use_cache = true)
{
$this->set_atomic($key, false, $value, $cache);
$this->set_atomic($key, false, $value, $use_cache);
}
/**
@ -111,11 +133,11 @@ class phpbb_config_db extends phpbb_config
* @param mixed $old_value Current configuration value or false to ignore
* the old value
* @param string $new_value New configuration value
* @param bool $cache Whether this variable should be cached or if it
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached
* @return bool True if the value was changed, false otherwise
*/
public function set_atomic($key, $old_value, $new_value, $cache = true)
public function set_atomic($key, $old_value, $new_value, $use_cache = true)
{
$sql = 'UPDATE ' . $this->table . "
SET config_value = '" . $this->db->sql_escape($new_value) . "'
@ -138,11 +160,11 @@ class phpbb_config_db extends phpbb_config
$sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', array(
'config_name' => $key,
'config_value' => $new_value,
'is_dynamic' => ($cache) ? 0 : 1));
'is_dynamic' => ($use_cache) ? 0 : 1));
$this->db->sql_query($sql);
}
if ($cache)
if ($use_cache)
{
$this->cache->destroy('config');
}
@ -159,14 +181,14 @@ class phpbb_config_db extends phpbb_config
*
* @param string $key The configuration option's name
* @param int $increment Amount to increment by
* @param bool $cache Whether this variable should be cached or if it
* @param bool $use_cache Whether this variable should be cached or if it
* changes too frequently to be efficiently cached.
*/
function increment($key, $increment, $cache = true)
function increment($key, $increment, $use_cache = true)
{
if (!isset($this->config[$key]))
{
$this->set($key, '0', $cache);
$this->set($key, '0', $use_cache);
}
$sql_update = $this->db->cast_expr_to_string($this->db->cast_expr_to_bigint('config_value') . ' + ' . (int) $increment);
@ -175,7 +197,7 @@ class phpbb_config_db extends phpbb_config
SET config_value = ' . $sql_update . "
WHERE config_name = '" . $this->db->sql_escape($key) . "'");
if ($cache)
if ($use_cache)
{
$this->cache->destroy('config');
}

View file

@ -51,23 +51,4 @@ abstract class phpbb_cron_task_base implements phpbb_cron_task
{
return true;
}
/**
* Returns whether this cron task can be run in shutdown function.
*
* By the time shutdown sequence invokes a particular piece of code,
* resources that that code requires may already be released.
* If so, a particular cron task may be marked shutdown function-
* unsafe, and it will be executed in normal program flow.
*
* Generally speaking cron tasks should start off as shutdown function-
* safe, and only be marked shutdown function-unsafe if a problem
* is discovered.
*
* @return bool Whether the cron task is shutdown function-safe.
*/
public function is_shutdown_function_safe()
{
return true;
}
}

View file

@ -64,21 +64,4 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
global $config;
return $config['last_queue_run'] < time() - $config['queue_interval_config'];
}
/**
* Returns whether this cron task can be run in shutdown function.
*
* A user reported that using the mail() function during shutdown
* function execution does not work. Therefore if email is delivered
* via the mail() function (as opposed to SMTP) queue cron task marks
* itself shutdown function-unsafe.
*
* @return bool
*/
public function is_shutdown_function_safe()
{
global $config;
// A user reported using the mail() function while using shutdown does not work. We do not want to risk that.
return !$config['smtp_delivery'];
}
}

View file

@ -45,20 +45,4 @@ interface phpbb_cron_task
* @return bool
*/
public function should_run();
/**
* Returns whether this cron task can be run in shutdown function.
*
* By the time shutdown sequence invokes a particular piece of code,
* resources that that code requires may already be released.
* If so, a particular cron task may be marked shutdown function-
* unsafe, and it will be executed in normal program flow.
*
* Generally speaking cron tasks should start off as shutdown function-
* safe, and only be marked shutdown function-unsafe if a problem
* is discovered.
*
* @return bool
*/
public function is_shutdown_function_safe();
}

View file

@ -241,6 +241,16 @@ class dbal
return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\'');
}
/**
* Returns whether results of a query need to be buffered to run a transaction while iterating over them.
*
* @return bool Whether buffering is required.
*/
function sql_buffer_nested_transaction()
{
return false;
}
/**
* SQL Transaction
* @access private

View file

@ -28,6 +28,7 @@ class dbal_firebird extends dbal
var $last_query_text = '';
var $service_handle = false;
var $affected_rows = 0;
var $connect_error = '';
/**
* Connect to server
@ -53,9 +54,35 @@ class dbal_firebird extends dbal
$use_database = $this->server . ':' . $this->dbname;
}
$this->db_connect_id = ($this->persistency) ? @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
if ($this->persistency)
{
if (!function_exists('ibase_pconnect'))
{
$this->connect_error = 'ibase_pconnect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3);
}
else
{
if (!function_exists('ibase_connect'))
{
$this->connect_error = 'ibase_connect function does not exist, is interbase extension installed?';
return $this->sql_error('');
}
$this->db_connect_id = @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
}
$this->service_handle = (function_exists('ibase_service_attach') && $this->server) ? @ibase_service_attach($this->server, $this->user, $sqlpassword) : false;
// Do not call ibase_service_attach if connection failed,
// otherwise error message from ibase_(p)connect call will be clobbered.
if ($this->db_connect_id && function_exists('ibase_service_attach') && $this->server)
{
$this->service_handle = @ibase_service_attach($this->server, $this->user, $sqlpassword);
}
else
{
$this->service_handle = false;
}
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
@ -487,8 +514,24 @@ class dbal_firebird extends dbal
*/
function _sql_error()
{
// Need special handling here because ibase_errmsg returns
// connection errors, however if the interbase extension
// is not installed then ibase_errmsg does not exist and
// we cannot call it.
if (function_exists('ibase_errmsg'))
{
$msg = @ibase_errmsg();
if (!$msg)
{
$msg = $this->connect_error;
}
}
else
{
$msg = $this->connect_error;
}
return array(
'message' => @ibase_errmsg(),
'message' => $msg,
'code' => (@function_exists('ibase_errcode') ? @ibase_errcode() : '')
);
}

View file

@ -50,7 +50,7 @@ class result_mssqlnative
}
}
$this->m_row_count = count($this->m_rows);
$this->m_row_count = sizeof($this->m_rows);
}
private function array_to_obj($array, &$obj)
@ -258,6 +258,14 @@ class dbal_mssqlnative extends dbal
return ($this->sql_server_version) ? 'MSSQL<br />' . $this->sql_server_version : 'MSSQL';
}
/**
* {@inheritDoc}
*/
function sql_buffer_nested_transaction()
{
return true;
}
/**
* SQL Transaction
* @access private

View file

@ -269,11 +269,12 @@ class dbal_oracle extends dbal
{
$cols = explode(', ', $regs[2]);
preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER);
/* The code inside this comment block breaks clob handling, but does allow the
database restore script to work. If you want to allow no posts longer than 4KB
and/or need the db restore script, uncomment this.
preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER);
if (sizeof($cols) !== sizeof($vals))
{

View file

@ -18,6 +18,11 @@ if (!defined('IN_PHPBB'))
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
if (!class_exists('phpbb_error_collector'))
{
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}
/**
* PostgreSQL Database Abstraction Layer
* Minimum Requirement is Version 7.3+
@ -26,6 +31,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
class dbal_postgres extends dbal
{
var $last_query_text = '';
var $connect_error = '';
/**
* Connect to server
@ -81,13 +87,29 @@ class dbal_postgres extends dbal
if ($this->persistency)
{
if (!function_exists('pg_pconnect'))
{
$this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
$collector = new phpbb_error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
else
{
if (!function_exists('pg_connect'))
{
$this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
$collector = new phpbb_error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
$collector->uninstall();
if ($this->db_connect_id)
{
if (version_compare($this->sql_server_info(true), '8.2', '>='))
@ -102,6 +124,7 @@ class dbal_postgres extends dbal
return $this->db_connect_id;
}
$this->connect_error = $collector->format_errors();
return $this->sql_error('');
}
@ -387,8 +410,19 @@ class dbal_postgres extends dbal
*/
function _sql_error()
{
// pg_last_error only works when there is an established connection.
// Connection errors have to be tracked by us manually.
if ($this->db_connect_id)
{
$message = @pg_last_error($this->db_connect_id);
}
else
{
$message = $this->connect_error;
}
return array(
'message' => (!$this->db_connect_id) ? @pg_last_error() : @pg_last_error($this->db_connect_id),
'message' => $message,
'code' => ''
);
}

View file

@ -0,0 +1,61 @@
<?php
/**
*
* @package phpBB
* @version $Id$
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class phpbb_error_collector
{
var $errors;
function phpbb_error_collector()
{
$this->errors = array();
}
function install()
{
set_error_handler(array(&$this, 'error_handler'));
}
function uninstall()
{
restore_error_handler();
}
function error_handler($errno, $msg_text, $errfile, $errline)
{
$this->errors[] = array($errno, $msg_text, $errfile, $errline);
}
function format_errors()
{
$text = '';
foreach ($this->errors as $error)
{
if (!empty($text))
{
$text .= "<br />\n";
}
list($errno, $msg_text, $errfile, $errline) = $error;
$text .= "Errno $errno: $msg_text";
if (defined('DEBUG_EXTRA') || defined('IN_INSTALL'))
{
$text .= " at $errfile line $errline";
}
}
return $text;
}
}

View file

@ -48,11 +48,16 @@ function set_var(&$result, $var, $type, $multibyte = false)
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
* @param bool $cookie This param is mapped to phpbb_request_interface::COOKIE as the last param for
* phpbb_request_interface::variable for backwards compatability reasons.
* @param phpbb_request_interface|null|false If an instance of phpbb_request_interface is given the instance is stored in
* a static variable and used for all further calls where this parameters is null. Until
* the function is called with an instance it automatically creates a new phpbb_request
* instance on every call. By passing false this per-call instantiation can be restored
* after having passed in a phpbb_request_interface instance.
*
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
* the same as that of $default. If the variable is not set $default is returned.
*/
function request_var($var_name, $default, $multibyte = false, $cookie = false, phpbb_request_interface $request = null)
function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null)
{
// This is all just an ugly hack to add "Dependency Injection" to a function
// the only real code is the function call which maps this function to a method.
@ -67,6 +72,15 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, p
return;
}
}
else if ($request === false)
{
$static_request = null;
if (empty($var_name))
{
return;
}
}
$tmp_request = $static_request;
@ -168,8 +182,8 @@ function unique_id($extra = 'c')
if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
{
set_config('rand_seed', $config['rand_seed'], true);
set_config('rand_seed_last_update', time(), true);
set_config('rand_seed', $config['rand_seed'], true);
$dss_seeded = true;
}
@ -444,7 +458,7 @@ function _hash_crypt_private($password, $setting, &$itoa64)
$output = '*';
// Check for correct hash
if (substr($setting, 0, 3) != '$H$')
if (substr($setting, 0, 3) != '$H$' && substr($setting, 0, 3) != '$P$')
{
return $output;
}
@ -1309,35 +1323,6 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $
{
$mark_time = array();
// Get global announcement info
if ($global_announce_list && sizeof($global_announce_list))
{
if (!isset($forum_mark_time[0]))
{
global $db;
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND forum_id = 0";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
$mark_time[0] = $row['mark_time'];
}
}
else
{
if ($forum_mark_time[0] !== false)
{
$mark_time[0] = $forum_mark_time[0];
}
}
}
if (!empty($forum_mark_time[$forum_id]) && $forum_mark_time[$forum_id] !== false)
{
$mark_time[$forum_id] = $forum_mark_time[$forum_id];
@ -1346,17 +1331,10 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $
$user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark'];
foreach ($topic_ids as $topic_id)
{
if ($global_announce_list && isset($global_announce_list[$topic_id]))
{
$last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
}
else
{
$last_read[$topic_id] = $user_lastmark;
}
}
}
return $last_read;
}
@ -1366,7 +1344,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $
*/
function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false)
{
global $config, $user;
global $config, $user, $request;
$last_read = array();
@ -1398,8 +1376,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
$sql = 'SELECT forum_id, mark_time
FROM ' . FORUMS_TRACK_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND forum_id " .
(($global_announce_list && sizeof($global_announce_list)) ? "IN (0, $forum_id)" : "= $forum_id");
AND forum_id = $forum_id";
$result = $db->sql_query($sql);
$mark_time = array();
@ -1412,18 +1389,11 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
$user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark'];
foreach ($topic_ids as $topic_id)
{
if ($global_announce_list && isset($global_announce_list[$topic_id]))
{
$last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
}
else
{
$last_read[$topic_id] = $user_lastmark;
}
}
}
}
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
global $tracking_topics;
@ -1458,13 +1428,6 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
if (sizeof($topic_ids))
{
$mark_time = array();
if ($global_announce_list && sizeof($global_announce_list))
{
if (isset($tracking_topics['f'][0]))
{
$mark_time[0] = base_convert($tracking_topics['f'][0], 36, 10) + $config['board_startdate'];
}
}
if (isset($tracking_topics['f'][$forum_id]))
{
@ -1474,18 +1437,11 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
$user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user_lastmark;
foreach ($topic_ids as $topic_id)
{
if ($global_announce_list && isset($global_announce_list[$topic_id]))
{
$last_read[$topic_id] = (isset($mark_time[0])) ? $mark_time[0] : $user_lastmark;
}
else
{
$last_read[$topic_id] = $user_lastmark;
}
}
}
}
return $last_read;
}
@ -1630,7 +1586,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
*/
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
{
global $db, $tracking_topics, $user, $config;
global $db, $tracking_topics, $user, $config, $request;
// Determine the users last forum mark time if not given.
if ($mark_time_forum === false)
@ -2069,7 +2025,10 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
/**
* Generate board url (example: http://www.example.com/phpBB)
*
* @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com)
*
* @return string the generated board url
*/
function generate_board_url($without_script_path = false)
{
@ -4595,7 +4554,7 @@ function page_footer($run_cron = true)
// Call cron-type script
$call_cron = false;
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'])
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'])
{
$call_cron = true;
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();

View file

@ -2208,6 +2208,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync
if (!($prune_flags & FORUM_FLAG_PRUNE_ANNOUNCE))
{
$sql_and .= ' AND topic_type <> ' . POST_ANNOUNCE;
$sql_and .= ' AND topic_type <> ' . POST_GLOBAL;
}
if (!($prune_flags & FORUM_FLAG_PRUNE_STICKY))
@ -2694,31 +2695,11 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$default_forum_id = 0;
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_id'])
{
if ($auth->acl_getf_global('f_read'))
{
if (!$default_forum_id)
{
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
$f_result = $db->sql_query_limit($sql, 1);
$default_forum_id = (int) $db->sql_fetchfield('forum_id', false, $f_result);
$db->sql_freeresult($f_result);
}
$is_auth[$row['topic_id']] = $default_forum_id;
}
}
else
{
if ($auth->acl_get('f_read', $row['forum_id']))
{
$is_auth[$row['topic_id']] = $row['forum_id'];
}
}
if ($auth->acl_gets('a_', 'm_', $row['forum_id']))
{

View file

@ -104,18 +104,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_tracking_info = array();
$branch_root_id = $root_data['forum_id'];
// Check for unread global announcements (index page only)
$ga_unread = false;
if ($root_data['forum_id'] == 0)
{
$unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0', '', 1);
if (!empty($unread_ga_list))
{
$ga_unread = true;
}
}
while ($row = $db->sql_fetchrow($result))
{
$forum_id = $row['forum_id'];
@ -269,8 +257,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
}
else
{
// Add 0 to forums array to mark global announcements correctly
$forum_ids[] = 0;
markread('topics', $forum_ids);
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
}
@ -323,12 +309,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false;
// Mark the first visible forum on index as unread if there's any unread global announcement
if ($ga_unread && !empty($forum_ids_moderator) && $forum_id == $forum_ids_moderator[0])
{
$forum_unread = true;
}
$folder_image = $folder_alt = $l_subforums = '';
$subforums_list = array();
@ -464,6 +444,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
'TOPICS' => $row['forum_topics'],
$l_post_click_count => $post_click_count,
'FORUM_IMG_STYLE' => $folder_image,
'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'),
'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',

View file

@ -338,7 +338,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
$topic_type_array[] = array(
'VALUE' => $topic_value['const'],
'S_CHECKED' => ($cur_topic_type == $topic_value['const'] || ($forum_id == 0 && $topic_value['const'] == POST_GLOBAL)) ? ' checked="checked"' : '',
'S_CHECKED' => ($cur_topic_type == $topic_value['const']) ? ' checked="checked"' : '',
'L_TOPIC_TYPE' => $user->lang[$topic_value['lang']]
);
}
@ -560,7 +560,6 @@ function get_supported_image_types($type = false)
if ($type !== false)
{
// Type is one of the IMAGETYPE constants - it is fetched from getimagesize()
// We do not use the constants here, because some were not available in PHP 4.3.x
switch ($type)
{
// GIF
@ -1465,11 +1464,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
delete_topics('topic_id', array($topic_id), false);
if ($data['topic_type'] != POST_GLOBAL)
{
$sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1';
$sql_data[FORUMS_TABLE] .= ($data['topic_approved']) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : '';
}
$update_sql = update_post_information('forum', $forum_id, true);
if (sizeof($update_sql))
@ -1489,10 +1485,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($data['topic_type'] != POST_GLOBAL)
{
$sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
}
$sql_data[TOPICS_TABLE] = 'topic_poster = ' . intval($row['poster_id']) . ', topic_first_post_id = ' . intval($row['post_id']) . ", topic_first_poster_colour = '" . $db->sql_escape($row['user_colour']) . "', topic_first_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "', topic_time = " . (int) $row['post_time'];
@ -1503,10 +1496,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
break;
case 'delete_last_post':
if ($data['topic_type'] != POST_GLOBAL)
{
$sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
}
$update_sql = update_post_information('forum', $forum_id, true);
if (sizeof($update_sql))
@ -1548,10 +1538,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($data['topic_type'] != POST_GLOBAL)
{
$sql_data[FORUMS_TABLE] = ($data['post_approved']) ? 'forum_posts = forum_posts - 1' : '';
}
$sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
$next_post_id = (int) $row['post_id'];
@ -1703,7 +1690,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'post':
case 'reply':
$sql_data[POSTS_TABLE]['sql'] = array(
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
'forum_id' => $data['forum_id'],
'poster_id' => (int) $user->data['user_id'],
'icon_id' => $data['icon_id'],
'poster_ip' => $user->ip,
@ -1771,7 +1758,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array(
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
'forum_id' => $data['forum_id'],
'poster_id' => $data['poster_id'],
'icon_id' => $data['icon_id'],
'post_approved' => (!$post_approval) ? 0 : $data['post_approved'],
@ -1807,7 +1794,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_poster' => (int) $user->data['user_id'],
'topic_time' => $current_time,
'topic_last_view_time' => $current_time,
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
'forum_id' => $data['forum_id'],
'icon_id' => $data['icon_id'],
'topic_approved' => $post_approval,
'topic_title' => $subject,
@ -1843,14 +1830,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
if ($topic_type != POST_GLOBAL)
{
if ($post_approval)
{
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
}
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real + 1' . (($post_approval) ? ', forum_topics = forum_topics + 1' : '');
}
break;
case 'reply':
@ -1863,7 +1847,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
if ($post_approval && $topic_type != POST_GLOBAL)
if ($post_approval)
{
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
}
@ -1887,7 +1871,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$sql_data[TOPICS_TABLE]['sql'] = array(
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
'forum_id' => $data['forum_id'],
'icon_id' => $data['icon_id'],
'topic_approved' => (!$post_approval) ? 0 : $data['topic_approved'],
'topic_title' => $subject,
@ -2002,61 +1986,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
unset($sql_data[POSTS_TABLE]['sql']);
}
$make_global = false;
// Are we globalising or unglobalising?
if ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic')
{
if (!sizeof($topic_row))
{
$sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_approved, topic_last_post_id
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $data['topic_id'];
$result = $db->sql_query($sql);
$topic_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
// globalise/unglobalise?
if (($topic_row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL) || ($topic_row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL))
{
if (!empty($sql_data[FORUMS_TABLE]['stat']) && implode('', $sql_data[FORUMS_TABLE]['stat']))
{
$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $sql_data[FORUMS_TABLE]['stat']) . ' WHERE forum_id = ' . $data['forum_id']);
}
$make_global = true;
$sql_data[FORUMS_TABLE]['stat'] = array();
}
// globalise
if ($topic_row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL)
{
// Decrement topic/post count
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies_real'] + 1);
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real - 1' . (($topic_row['topic_approved']) ? ', forum_topics = forum_topics - 1' : '');
// Update forum_ids for all posts
$sql = 'UPDATE ' . POSTS_TABLE . '
SET forum_id = 0
WHERE topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
}
// unglobalise
else if ($topic_row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL)
{
// Increment topic/post count
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + ' . ($topic_row['topic_replies_real'] + 1);
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real + 1' . (($topic_row['topic_approved']) ? ', forum_topics = forum_topics + 1' : '');
// Update forum_ids for all posts
$sql = 'UPDATE ' . POSTS_TABLE . '
SET forum_id = ' . $data['forum_id'] . '
WHERE topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
}
}
// Update the topics table
if (isset($sql_data[TOPICS_TABLE]['sql']))
{
@ -2219,9 +2148,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// we need to update the last forum information
// only applicable if the topic is not global and it is approved
// we also check to make sure we are not dealing with globaling the latest topic (pretty rare but still needs to be checked)
if ($topic_type != POST_GLOBAL && !$make_global && ($post_approved || !$data['post_approved']))
// only applicable if the topic is approved
if ($post_approved || !$data['post_approved'])
{
// the last post makes us update the forum table. This can happen if...
// We make a new topic
@ -2311,78 +2239,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
}
}
else if ($make_global)
{
// somebody decided to be a party pooper, we must recalculate the whole shebang (maybe)
$sql = 'SELECT forum_last_post_id
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $data['forum_id'];
$result = $db->sql_query($sql);
$forum_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// we made a topic global, go get new data
if ($topic_row['topic_type'] != POST_GLOBAL && $topic_type == POST_GLOBAL && $forum_row['forum_last_post_id'] == $topic_row['topic_last_post_id'])
{
// we need a fresh change of socks, everything has become invalidated
$sql = 'SELECT MAX(topic_last_post_id) as last_post_id
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . (int) $data['forum_id'] . '
AND topic_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// any posts left in this forum?
if (!empty($row['last_post_id']))
{
$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE p.poster_id = u.user_id
AND p.post_id = ' . (int) $row['last_post_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// salvation, a post is found! jam it into the forums table
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
}
else
{
// just our luck, the last topic in the forum has just been globalized...
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = 0';
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = ''";
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = 0';
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = 0';
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = ''";
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = ''";
}
}
else if ($topic_row['topic_type'] == POST_GLOBAL && $topic_type != POST_GLOBAL && $forum_row['forum_last_post_id'] < $topic_row['topic_last_post_id'])
{
// this post has a higher id, it is newer
$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE p.poster_id = u.user_id
AND p.post_id = ' . (int) $topic_row['topic_last_post_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// salvation, a post is found! jam it into the forums table
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . (int) $row['post_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . (int) $row['post_time'];
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $row['poster_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape(($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'";
}
}
// topic sync time!
// simply, we update if it is a reply or the last post is edited
@ -2470,7 +2326,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement
if ($make_global)
if ($topic_type == POST_GLOBAL)
{
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE topic_moved_id = ' . $data['topic_id'];
@ -2514,7 +2370,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
trigger_error($error);
}
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']);
$search->index($mode, $data['post_id'], $data['message'], $subject, $poster_id, $data['forum_id']);
}
// Topic Notification, do not change if moderator is changing other users posts...
@ -2543,7 +2399,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Mark this topic as read
// We do not use post_time here, this is intended (post_time can have a date in the past if editing a message)
markread('topic', (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $data['topic_id'], time());
markread('topic', $data['forum_id'], $data['topic_id'], time());
//
if ($config['load_db_lastread'] && $user->data['is_registered'])
@ -2551,7 +2407,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql = 'SELECT mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
AND forum_id = ' . (($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']);
AND forum_id = ' . $data['forum_id'];
$result = $db->sql_query($sql);
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
$db->sql_freeresult($result);
@ -2564,23 +2420,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered'])
{
// Update forum info
if ($topic_type == POST_GLOBAL)
{
$sql = 'SELECT MAX(topic_last_post_time) as forum_last_post_time
FROM ' . TOPICS_TABLE . '
WHERE forum_id = 0';
}
else
{
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $data['forum_id'];
}
$result = $db->sql_query($sql);
$forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time');
$db->sql_freeresult($result);
update_forum_tracking_info((($topic_type == POST_GLOBAL) ? 0 : $data['forum_id']), $forum_last_post_time, $f_mark_time, false);
update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
// Send Notifications

View file

@ -322,7 +322,7 @@ class template_compile
// Is the designer wanting to call another loop in a loop?
if (strpos($tag_args, '!') === 0)
{
// Count the number if ! occurrences (not allowed in vars)
// Count the number of ! occurrences (not allowed in vars)
$no_nesting = substr_count($tag_args, '!');
$tag_args = substr($tag_args, $no_nesting);
}

View file

@ -761,7 +761,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
}
else
{
trigger_error('LENGTH_BAN_INVALID');
trigger_error('LENGTH_BAN_INVALID', E_USER_WARNING);
}
}
}
@ -821,7 +821,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
// Make sure we have been given someone to ban
if (!sizeof($sql_usernames))
{
trigger_error('NO_USER_SPECIFIED');
trigger_error('NO_USER_SPECIFIED', E_USER_WARNING);
}
$sql = 'SELECT user_id
@ -852,7 +852,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
else
{
$db->sql_freeresult($result);
trigger_error('NO_USERS');
trigger_error('NO_USERS', E_USER_WARNING);
}
$db->sql_freeresult($result);
break;
@ -954,7 +954,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
if (empty($banlist_ary))
{
trigger_error('NO_IPS_DEFINED');
trigger_error('NO_IPS_DEFINED', E_USER_WARNING);
}
}
break;
@ -982,12 +982,12 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
if (sizeof($ban_list) == 0)
{
trigger_error('NO_EMAILS_DEFINED');
trigger_error('NO_EMAILS_DEFINED', E_USER_WARNING);
}
break;
default:
trigger_error('NO_MODE');
trigger_error('NO_MODE', E_USER_WARNING);
break;
}
@ -1449,6 +1449,31 @@ function validate_match($string, $optional = false, $match = '')
return false;
}
/**
* Validate Language Pack ISO Name
*
* Tests whether a language name is valid and installed
*
* @param string $lang_iso The language string to test
*
* @return bool|string Either false if validation succeeded or
* a string which will be used as the error message
* (with the variable name appended)
*/
function validate_language_iso_name($lang_iso)
{
global $db;
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'";
$result = $db->sql_query($sql);
$lang_id = (int) $db->sql_fetchfield('lang_id');
$db->sql_freeresult($result);
return ($lang_id) ? false : 'WRONG_DATA';
}
/**
* Check to see if the username has been taken, or if it is disallowed.
* Also checks if it includes the " character, which we don't allow in usernames.
@ -1608,8 +1633,9 @@ function validate_password($password)
{
global $config, $db, $user;
if (!$password)
if ($password === '' || $config['pass_complex'] === 'PASS_TYPE_ANY')
{
// Password empty or no password complexity required.
return false;
}
@ -1620,7 +1646,6 @@ function validate_password($password)
{
$upp = '\p{Lu}';
$low = '\p{Ll}';
$let = '\p{L}';
$num = '\p{N}';
$sym = '[^\p{Lu}\p{Ll}\p{N}]';
$pcre = true;
@ -1630,7 +1655,6 @@ function validate_password($password)
mb_regex_encoding('UTF-8');
$upp = '[[:upper:]]';
$low = '[[:lower:]]';
$let = '[[:lower:][:upper:]]';
$num = '[[:digit:]]';
$sym = '[^[:upper:][:lower:][:digit:]]';
$mbstring = true;
@ -1639,7 +1663,6 @@ function validate_password($password)
{
$upp = '[A-Z]';
$low = '[a-z]';
$let = '[a-zA-Z]';
$num = '[0-9]';
$sym = '[^A-Za-z0-9]';
$pcre = true;
@ -1649,22 +1672,22 @@ function validate_password($password)
switch ($config['pass_complex'])
{
// No break statements below ...
// We require strong passwords in case pass_complex is not set or is invalid
default:
// Require mixed case letters, numbers and symbols
case 'PASS_TYPE_SYMBOL':
$chars[] = $sym;
// Require mixed case letters and numbers
case 'PASS_TYPE_ALPHA':
$chars[] = $num;
// Require mixed case letters
case 'PASS_TYPE_CASE':
$chars[] = $low;
$chars[] = $upp;
break;
case 'PASS_TYPE_ALPHA':
$chars[] = $let;
$chars[] = $num;
break;
case 'PASS_TYPE_SYMBOL':
$chars[] = $low;
$chars[] = $upp;
$chars[] = $num;
$chars[] = $sym;
break;
}
if ($pcre)
@ -2485,6 +2508,69 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
if (!sizeof($error))
{
$current_legend = phpbb_group_positions::GROUP_DISABLED;
$current_teampage = phpbb_group_positions::GROUP_DISABLED;
$legend = new phpbb_group_positions($db, 'legend');
$teampage = new phpbb_group_positions($db, 'teampage');
if ($group_id)
{
$current_legend = $legend->get_group_value($group_id);
$current_teampage = $teampage->get_group_value($group_id);
}
if (!empty($group_attributes['group_legend']))
{
if (($group_id && ($current_legend == phpbb_group_positions::GROUP_DISABLED)) || !$group_id)
{
// Old group currently not in the legend or new group, add at the end.
$group_attributes['group_legend'] = 1 + $legend->get_group_count();
}
else
{
// Group stayes in the legend
$group_attributes['group_legend'] = $current_legend;
}
}
else if ($group_id && ($current_legend > phpbb_group_positions::GROUP_DISABLED))
{
// Group is removed from the legend
$legend->delete_group($group_id, true);
$group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED;
}
else
{
$group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED;
}
if (!empty($group_attributes['group_teampage']))
{
if (($group_id && ($current_teampage == phpbb_group_positions::GROUP_DISABLED)) || !$group_id)
{
// Old group currently not on the teampage or new group, add at the end.
$group_attributes['group_teampage'] = 1 + $teampage->get_group_count();
}
else
{
// Group stayes on the teampage
$group_attributes['group_teampage'] = $current_teampage;
}
}
else if ($group_id && ($current_teampage > phpbb_group_positions::GROUP_DISABLED))
{
// Group is removed from the teampage
$teampage->delete_group($group_id, true);
$group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED;
}
else
{
$group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED;
}
// Unset the objects, we don't need them anymore.
unset($legend);
unset($teampage);
$user_ary = array();
$sql_ary = array(
'group_name' => (string) $name,
@ -2709,6 +2795,14 @@ function group_delete($group_id, $group_name = false)
}
while ($start);
// Delete group from legend and teampage
$legend = new phpbb_group_positions($db, 'legend');
$legend->delete_group($group_id);
unset($legend);
$teampage = new phpbb_group_positions($db, 'teampage');
$teampage->delete_group($group_id);
unset($teampage);
// Delete group
$sql = 'DELETE FROM ' . GROUPS_TABLE . "
WHERE group_id = $group_id";

View file

@ -0,0 +1,261 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Group Position class, containing all functions to manage the groups in the teampage and legend.
*
* group_teampage/group_legend is an ascending list 1, 2, ..., n for groups which are displayed. 1 is the first group, n the last.
* If the value is 0 (self::GROUP_DISABLED) the group is not displayed.
* @package phpBB3
*/
class phpbb_group_positions
{
/**
* Group is not displayed
*/
const GROUP_DISABLED = 0;
/**
* phpbb-database object
*/
public $db = null;
/**
* Name of the field we want to handle: either 'teampage' or 'legend'
*/
private $field = '';
/**
* URI for the adm_back_link when there was an error.
*/
private $adm_back_link = '';
/**
* Constructor
*/
public function __construct ($db, $field, $adm_back_link = '')
{
$this->adm_back_link = $adm_back_link;
if (!in_array($field, array('teampage', 'legend')))
{
$this->error('NO_MODE');
}
$this->db = $db;
$this->field = $field;
}
/**
* Returns the group_{$this->field} for a given group, if the group exists.
* @param int $group_id group_id of the group to be selected
* @return int position of the group
*/
public function get_group_value($group_id)
{
$sql = 'SELECT group_' . $this->field . '
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . (int) $group_id;
$result = $this->db->sql_query($sql);
$current_value = $this->db->sql_fetchfield('group_' . $this->field);
$this->db->sql_freeresult($result);
if ($current_value === false)
{
// Group not found.
$this->error('NO_GROUP');
}
return (int) $current_value;
}
/**
* Get number of groups, displayed on the teampage/legend
*
* @return int value of the last group displayed
*/
public function get_group_count()
{
$sql = 'SELECT group_' . $this->field . '
FROM ' . GROUPS_TABLE . '
ORDER BY group_' . $this->field . ' DESC';
$result = $this->db->sql_query_limit($sql, 1);
$group_count = (int) $this->db->sql_fetchfield('group_' . $this->field);
$this->db->sql_freeresult($result);
return $group_count;
}
/**
* Addes a group by group_id
*
* @param int $group_id group_id of the group to be added
* @return void
*/
public function add_group($group_id)
{
$current_value = $this->get_group_value($group_id);
if ($current_value == self::GROUP_DISABLED)
{
// Group is currently not displayed, add it at the end.
$next_value = 1 + $this->get_group_count();
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_' . $this->field . ' = ' . $next_value . '
WHERE group_' . $this->field . ' = ' . self::GROUP_DISABLED . '
AND group_id = ' . (int) $group_id;
$this->db->sql_query($sql);
}
}
/**
* Deletes a group by setting the field to self::GROUP_DISABLED and closing the gap in the list.
*
* @param int $group_id group_id of the group to be deleted
* @param bool $skip_group Skip setting the group to GROUP_DISABLED, to save the query, when you need to update it anyway.
* @return void
*/
public function delete_group($group_id, $skip_group = false)
{
$current_value = $this->get_group_value($group_id);
if ($current_value != self::GROUP_DISABLED)
{
$this->db->sql_transaction('begin');
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_' . $this->field . ' = group_' . $this->field . ' - 1
WHERE group_' . $this->field . ' > ' . $current_value;
$this->db->sql_query($sql);
if (!$skip_group)
{
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_' . $this->field . ' = ' . self::GROUP_DISABLED . '
WHERE group_id = ' . (int) $group_id;
$this->db->sql_query($sql);
}
$this->db->sql_transaction('commit');
}
}
/**
* Moves a group up by group_id
*
* @param int $group_id group_id of the group to be moved
* @return void
*/
public function move_up($group_id)
{
$this->move($group_id, 1);
}
/**
* Moves a group down by group_id
*
* @param int $group_id group_id of the group to be moved
* @return void
*/
public function move_down($group_id)
{
$this->move($group_id, -1);
}
/**
* Moves a group up/down
*
* @param int $group_id group_id of the group to be moved
* @param int $delta number of steps:
* - positive = move up
* - negative = move down
* @return void
*/
public function move($group_id, $delta)
{
if (!is_int($delta) || !$delta)
{
return;
}
$move_up = ($delta > 0) ? true : false;
$current_value = $this->get_group_value($group_id);
if ($current_value != self::GROUP_DISABLED)
{
$this->db->sql_transaction('begin');
// First we move all groups between our current value and the target value up/down 1,
// so we have a gap for our group to move.
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_' . $this->field . ' = group_' . $this->field . (($move_up) ? ' + 1' : ' - 1') . '
WHERE group_' . $this->field . ' > ' . self::GROUP_DISABLED . '
AND group_' . $this->field . (($move_up) ? ' >= ' : ' <= ') . ($current_value - $delta) . '
AND group_' . $this->field . (($move_up) ? ' < ' : ' > ') . $current_value;
$this->db->sql_query($sql);
// Because there might be fewer groups above/below the group than we wanted to move,
// we use the number of changed groups, to update the group.
$delta = (int) $this->db->sql_affectedrows();
if ($delta)
{
// And now finally, when we moved some other groups and built a gap,
// we can move the desired group to it.
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_' . $this->field . ' = group_' . $this->field . (($move_up) ? ' - ' : ' + ') . $delta . '
WHERE group_id = ' . (int) $group_id;
$this->db->sql_query($sql);
}
$this->db->sql_transaction('commit');
}
}
/**
* Get group type language var
*
* @param int $group_type group_type from the groups-table
* @return string name of the language variable for the given group-type.
*/
static public function group_type_language($group_type)
{
switch ($group_type)
{
case GROUP_OPEN:
return 'GROUP_REQUEST';
case GROUP_CLOSED:
return 'GROUP_CLOSED';
case GROUP_HIDDEN:
return 'GROUP_HIDDEN';
case GROUP_SPECIAL:
return 'GROUP_SPECIAL';
case GROUP_FREE:
return 'GROUP_OPEN';
}
}
/**
* Error
*/
public function error($message)
{
global $user;
trigger_error($user->lang[$message] . (($this->adm_back_link) ? adm_back_link($this->adm_back_link) : ''), E_USER_WARNING);
}
}

View file

@ -150,10 +150,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$read_tracking_join = $read_tracking_select = '';
}
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t
WHERE t.forum_id IN($forum_id, 0)
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
' . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
$limit_time_sql
ORDER BY t.topic_type DESC, $sort_order_sql";
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
@ -188,11 +188,11 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
{
if ($config['load_db_lastread'])
{
$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']), array());
$topic_tracking_info = get_topic_tracking($forum_id, $topic_list, $topic_rows, array($forum_id => $forum_info['mark_time']));
}
else
{
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list, array());
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_list);
}
}
@ -225,6 +225,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_row = array(
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',

View file

@ -39,7 +39,7 @@ function mcp_front_view($id, $mode, $action)
{
$sql = 'SELECT COUNT(post_id) AS total
FROM ' . POSTS_TABLE . '
WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
AND post_approved = 0';
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
@ -47,8 +47,6 @@ function mcp_front_view($id, $mode, $action)
if ($total)
{
$global_id = $forum_list[0];
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
@ -62,7 +60,7 @@ function mcp_front_view($id, $mode, $action)
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '
AND post_approved = 0
ORDER BY post_time DESC';
$result = $db->sql_query_limit($sql, 5);
@ -91,17 +89,11 @@ function mcp_front_view($id, $mode, $action)
while ($row = $db->sql_fetchrow($result))
{
$global_topic = ($row['forum_id']) ? false : true;
if ($global_topic)
{
$row['forum_id'] = $global_id;
}
$template->assign_block_vars('unapproved', array(
'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']) : '',
'U_MCP_FORUM' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']),
'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
@ -109,7 +101,7 @@ function mcp_front_view($id, $mode, $action)
'AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),
'U_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']),
'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'FORUM_NAME' => $forum_names[$row['forum_id']],
'POST_ID' => $row['post_id'],
'TOPIC_TITLE' => $row['topic_title'],
'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
@ -159,15 +151,13 @@ function mcp_front_view($id, $mode, $action)
WHERE r.post_id = p.post_id
AND r.pm_id = 0
AND r.report_closed = 0
AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
AND ' . $db->sql_in_set('p.forum_id', $forum_list);
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
if ($total)
{
$global_id = $forum_list[0];
$sql = $db->sql_build_query('SELECT', array(
'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
@ -193,7 +183,7 @@ function mcp_front_view($id, $mode, $action)
AND p.topic_id = t.topic_id
AND r.user_id = u.user_id
AND p.poster_id = u2.user_id
AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
AND ' . $db->sql_in_set('p.forum_id', $forum_list),
'ORDER_BY' => 'p.post_time DESC'
));
@ -201,17 +191,11 @@ function mcp_front_view($id, $mode, $action)
while ($row = $db->sql_fetchrow($result))
{
$global_topic = ($row['forum_id']) ? false : true;
if ($global_topic)
{
$row['forum_id'] = $global_id;
}
$template->assign_block_vars('report', array(
'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view") : '',
'U_MCP_FORUM' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view"),
'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
@ -224,7 +208,7 @@ function mcp_front_view($id, $mode, $action)
'AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),
'U_AUTHOR' => get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']),
'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'FORUM_NAME' => $row['forum_name'],
'TOPIC_TITLE' => $row['topic_title'],
'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'REPORT_TIME' => $user->format_date($row['report_time']),
@ -347,9 +331,6 @@ function mcp_front_view($id, $mode, $action)
if (!empty($forum_list))
{
// Add forum_id 0 for global announcements
$forum_list[] = 0;
$log_count = false;
$log = array();
view_log('mod', $log, $log_count, 5, 0, $forum_list);

View file

@ -332,83 +332,13 @@ function change_topic_type($action, $topic_ids)
$success_msg = '';
if (confirm_box(true))
{
if ($new_topic_type != POST_GLOBAL)
{
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
AND forum_id <> 0';
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
// Reset forum id if a global topic is within the array
$to_forum_id = request_var('to_forum_id', 0);
if ($to_forum_id)
{
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type, forum_id = $to_forum_id
WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
AND forum_id = 0';
$db->sql_query($sql);
// Update forum_ids for all posts
$sql = 'UPDATE ' . POSTS_TABLE . "
SET forum_id = $to_forum_id
WHERE " . $db->sql_in_set('topic_id', $topic_ids) . '
AND forum_id = 0';
$db->sql_query($sql);
// Do a little forum sync stuff
$sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
$result = $db->sql_query($sql);
$row_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$sync_sql = array();
if ($row_data['topic_posts'])
{
$sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . (int) $row_data['topic_posts'];
}
if ($row_data['topics_authed'])
{
$sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . (int) $row_data['topics_authed'];
}
$sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . (int) sizeof($topic_ids);
foreach ($sync_sql as $forum_id_key => $array)
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . implode(', ', $array) . '
WHERE forum_id = ' . $forum_id_key;
$db->sql_query($sql);
}
sync('forum', 'forum_id', $to_forum_id);
}
}
else
{
// Get away with those topics already being a global announcement by re-calculating $topic_ids
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
AND forum_id <> 0';
$result = $db->sql_query($sql);
$topic_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ids[] = $row['topic_id'];
}
$db->sql_freeresult($result);
if (sizeof($topic_ids))
if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids))
{
// Delete topic shadows for global announcements
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
@ -416,48 +346,9 @@ function change_topic_type($action, $topic_ids)
$db->sql_query($sql);
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type, forum_id = 0
SET topic_type = $new_topic_type
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
// Update forum_ids for all posts
$sql = 'UPDATE ' . POSTS_TABLE . '
SET forum_id = 0
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
// Do a little forum sync stuff
$sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed
FROM ' . TOPICS_TABLE . ' t
WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids);
$result = $db->sql_query($sql);
$row_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$sync_sql = array();
if ($row_data['topic_posts'])
{
$sync_sql[$forum_id][] = 'forum_posts = forum_posts - ' . (int) $row_data['topic_posts'];
}
if ($row_data['topics_authed'])
{
$sync_sql[$forum_id][] = 'forum_topics = forum_topics - ' . (int) $row_data['topics_authed'];
}
$sync_sql[$forum_id][] = 'forum_topics_real = forum_topics_real - ' . (int) sizeof($topic_ids);
foreach ($sync_sql as $forum_id_key => $array)
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . implode(', ', $array) . '
WHERE forum_id = ' . $forum_id_key;
$db->sql_query($sql);
}
sync('forum', 'forum_id', $forum_id);
}
}
$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
@ -473,43 +364,9 @@ function change_topic_type($action, $topic_ids)
}
}
else
{
// Global topic involved?
$global_involved = false;
if ($new_topic_type != POST_GLOBAL)
{
$sql = 'SELECT forum_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
AND forum_id = 0';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
$global_involved = true;
}
}
if ($global_involved)
{
global $template;
$template->assign_vars(array(
'S_FORUM_SELECT' => make_forum_select(request_var('f', $forum_id), false, false, true, true),
'S_CAN_LEAVE_SHADOW' => false,
'ADDITIONAL_MSG' => (sizeof($topic_ids) == 1) ? $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENT'] : $user->lang['SELECT_FORUM_GLOBAL_ANNOUNCEMENTS'])
);
confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields), 'mcp_move.html');
}
else
{
confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
}
}
$redirect = request_var('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
@ -628,8 +485,6 @@ function mcp_move_topic($topic_ids)
$topic_posts_added += $topic_info['topic_replies'];
if ($topic_info['topic_type'] != POST_GLOBAL)
{
$topics_removed++;
$topic_posts_removed += $topic_info['topic_replies'];
@ -639,7 +494,6 @@ function mcp_move_topic($topic_ids)
$topic_posts_removed++;
}
}
}
$db->sql_transaction('begin');
@ -675,15 +529,6 @@ function mcp_move_topic($topic_ids)
$forum_ids[] = $row['forum_id'];
add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']);
// If we have moved a global announcement, we need to correct the topic type
if ($row['topic_type'] == POST_GLOBAL)
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_type = ' . POST_ANNOUNCE . '
WHERE topic_id = ' . (int) $row['topic_id'];
$db->sql_query($sql);
}
// Leave a redirection if required and only if the topic is visible to users
if ($leave_shadow && $row['topic_approved'] && $row['topic_type'] != POST_GLOBAL)
{
@ -1058,7 +903,10 @@ function mcp_fork_topic($topic_ids)
$total_posts = 0;
$new_topic_id_list = array();
if ($topic_data['enable_indexing'])
foreach ($topic_data as $topic_id => $topic_row)
{
if (!isset($search_type) && $topic_row['enable_indexing'])
{
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = basename($config['search_type']);
@ -1082,13 +930,11 @@ function mcp_fork_topic($topic_ids)
trigger_error($error);
}
}
else
else if (!isset($search_type) && !$topic_row['enable_indexing'])
{
$search_type = false;
}
foreach ($topic_data as $topic_id => $topic_row)
{
$sql_ary = array(
'forum_id' => (int) $to_forum_id,
'icon_id' => (int) $topic_row['icon_id'],
@ -1197,9 +1043,9 @@ function mcp_fork_topic($topic_ids)
// Copy whether the topic is dotted
markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
if ($search_type)
if (!empty($search_type))
{
$search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id);
$search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id);
$search_mode = 'reply'; // After one we index replies
}

View file

@ -268,13 +268,11 @@ class mcp_queue
trigger_error('NOT_MODERATOR');
}
$global_id = $forum_list[0];
$forum_list = implode(', ', $forum_list);
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
FROM ' . FORUMS_TABLE . "
WHERE forum_id IN (0, $forum_list)";
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
$result = $db->sql_query($sql);
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
$db->sql_freeresult($result);
@ -290,7 +288,6 @@ class mcp_queue
$forum_info = $forum_info[$forum_id];
$forum_list = $forum_id;
$global_id = $forum_id;
}
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
@ -312,10 +309,10 @@ class mcp_queue
if ($mode == 'unapproved_posts')
{
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
WHERE p.forum_id IN (0, $forum_list)
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . '
WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
AND p.post_approved = 0
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id
@ -344,11 +341,8 @@ class mcp_queue
$post_data = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_id'])
{
$forum_names[] = $row['forum_id'];
}
$post_data[$row['post_id']] = $row;
}
$db->sql_freeresult($result);
@ -368,7 +362,7 @@ class mcp_queue
{
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
FROM ' . TOPICS_TABLE . " t
WHERE forum_id IN (0, $forum_list)
WHERE " . $db->sql_in_set('forum_id', $forum_list) . "
AND topic_approved = 0
$limit_time_sql
ORDER BY $sort_order_sql";
@ -376,11 +370,8 @@ class mcp_queue
$rowset = array();
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_id'])
{
$forum_names[] = $row['forum_id'];
}
$rowset[] = $row;
}
$db->sql_freeresult($result);
@ -404,12 +395,6 @@ class mcp_queue
foreach ($rowset as $row)
{
$global_topic = ($row['forum_id']) ? false : true;
if ($global_topic)
{
$row['forum_id'] = $global_id;
}
if (empty($row['post_username']))
{
$row['post_username'] = $user->lang['GUEST'];
@ -417,7 +402,7 @@ class mcp_queue
$template->assign_block_vars('postrow', array(
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;start=$start&amp;mode=approve_details&amp;f={$row['forum_id']}&amp;p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&amp;t={$row['topic_id']}" : '')),
@ -427,7 +412,7 @@ class mcp_queue
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_ID' => $row['post_id'],
'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'FORUM_NAME' => $forum_names[$row['forum_id']],
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
'POST_TIME' => $user->format_date($row['post_time']))
@ -504,11 +489,7 @@ function approve_post($post_id_list, $id, $mode)
}
$topic_id_list[$post_data['topic_id']] = 1;
if ($post_data['forum_id'])
{
$forum_id_list[$post_data['forum_id']] = 1;
}
// User post update (we do not care about topic or post, since user posts are strictly connected to posts)
// But we care about forums where post counts get not increased. ;)
@ -519,11 +500,8 @@ function approve_post($post_id_list, $id, $mode)
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id)
{
if ($post_data['forum_id'])
{
$total_topics++;
}
$topic_approve_sql[] = $post_data['topic_id'];
$approve_log[] = array(
@ -543,8 +521,6 @@ function approve_post($post_id_list, $id, $mode)
);
}
if ($post_data['forum_id'])
{
$total_posts++;
// Increment by topic_replies if we approve a topic...
@ -553,7 +529,6 @@ function approve_post($post_id_list, $id, $mode)
{
$total_posts += $post_data['topic_replies'];
}
}
$post_approve_sql[] = $post_id;
}

View file

@ -312,7 +312,6 @@ class mcp_reports
$forum_info = $forum_info[$forum_id];
$forum_list = array($forum_id);
$global_id = $forum_id;
}
$forum_list[] = 0;
@ -382,14 +381,8 @@ class mcp_reports
$report_data = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
$global_topic = ($row['forum_id']) ? false : true;
if ($global_topic)
{
$row['forum_id'] = $global_id;
}
$template->assign_block_vars('postrow', array(
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&amp;start=$start&amp;mode=report_details&amp;f={$row['forum_id']}&amp;r={$row['report_id']}"),
@ -403,7 +396,7 @@ class mcp_reports
'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'FORUM_NAME' => $forum_data[$row['forum_id']]['forum_name'],
'POST_ID' => $row['post_id'],
'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_TIME' => $user->format_date($row['post_time']),

View file

@ -110,19 +110,19 @@ class bbcode_firstpass extends bbcode
// order, so it is important to keep [code] in first position and
// [quote] in second position.
$this->bbcodes = array(
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#ise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#ise' => "\$this->bbcode_quote('\$0')")),
'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")),
'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#iUe' => "\$this->bbcode_img('\$1')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")),
'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#ise' => "\$this->bbcode_underline('\$1')")),
'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\$1', '\$2')")),
'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')"))
'code' => array('bbcode_id' => 8, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uise' => "\$this->bbcode_code('\$1', '\$2')")),
'quote' => array('bbcode_id' => 0, 'regexp' => array('#\[quote(?:=&quot;(.*?)&quot;)?\](.+)\[/quote\]#uise' => "\$this->bbcode_quote('\$0')")),
'attachment' => array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#uise' => "\$this->bbcode_italic('\$1')")),
'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#uiUe' => "\$this->validate_url('\$2', '\$3')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](.*)\[/img\]#uiUe' => "\$this->bbcode_img('\$1')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uise' => "\$this->bbcode_color('\$1', '\$2')")),
'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#uise' => "\$this->bbcode_underline('\$1')")),
'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uise' => "\$this->bbcode_parse_list('\$0')")),
'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uise' => "\$this->validate_email('\$1', '\$2')")),
'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#uie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')"))
);
// Zero the parsed items array
@ -1332,7 +1332,9 @@ class parse_message extends bbcode_firstpass
{
if ($max_smilies)
{
$num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#', $this->message, $matches);
// 'u' modifier has been added to correctly parse smilies within unicode strings
// For details: http://tracker.phpbb.com/browse/PHPBB3-10117
$num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#u', $this->message, $matches);
unset($matches);
if ($num_matches !== false && $num_matches > $max_smilies)
@ -1343,7 +1345,10 @@ class parse_message extends bbcode_firstpass
}
// Make sure the delimiter # is added in front and at the end of every element within $match
$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#'), $replace, $this->message));
// 'u' modifier has been added to correctly parse smilies within unicode strings
// For details: http://tracker.phpbb.com/browse/PHPBB3-10117
$this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message));
}
}

View file

@ -60,7 +60,7 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable,
$file = '';
$line = 0;
$message = 'Illegal use of $' . $this->name . '. You must use the request class or request_var() to access input data. Found in %s on line %d. This error message was generated';
$message = 'Illegal use of $' . $this->name . '. You must use the request class or request_var() to access input data. Found in %s on line %d. This error message was generated by deactivated_super_global.';
$backtrace = debug_backtrace();
if (isset($backtrace[1]))

View file

@ -598,6 +598,13 @@ class session
$bot = false;
}
// Bot user, if they have a SID in the Request URI we need to get rid of it
// otherwise they'll index this page with the SID, duplicate content oh my!
if ($bot && isset($_GET['sid']))
{
redirect(build_url(array('sid')));
}
// If no data was returned one or more of the following occurred:
// Key didn't match one in the DB
// User does not exist
@ -634,12 +641,6 @@ class session
}
else
{
// Bot user, if they have a SID in the Request URI we need to get rid of it
// otherwise they'll index this page with the SID, duplicate content oh my!
if (isset($_GET['sid']))
{
redirect(build_url(array('sid')));
}
$this->data['session_last_visit'] = $this->time_now;
}

View file

@ -276,7 +276,7 @@ class template
$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
$recompile = false;
if (!file_exists($filename) || @filesize($filename) === 0)
if (!file_exists($filename) || @filesize($filename) === 0 || defined('DEBUG_EXTRA'))
{
$recompile = true;
}

View file

@ -98,6 +98,13 @@ class ucp_activate
SET user_actkey = ''
WHERE user_id = {$user_row['user_id']}";
$db->sql_query($sql);
// Create the correct logs
add_log('user', $user_row['user_id'], 'LOG_USER_ACTIVE_USER');
if ($auth->acl_get('a_user'))
{
add_log('admin', 'LOG_USER_ACTIVE', $user_row['username']);
}
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)

View file

@ -57,38 +57,29 @@ class ucp_main
$sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
AND tt.user_id = ' . $user->data['user_id'] . ')';
$sql_select .= ', tt.mark_time';
$sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id
AND ft.user_id = ' . $user->data['user_id'] . ')';
$sql_select .= ', ft.mark_time AS forum_mark_time';
}
$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
$folder = 'global_read';
$folder_new = 'global_unread';
// Get cleaned up list... return only those forums not having the f_read permission
$forum_ary = $auth->acl_getf('!f_read', true);
// Get cleaned up list... return only those forums having the f_read permission
$forum_ary = $auth->acl_getf('f_read', true);
$forum_ary = array_unique(array_keys($forum_ary));
// Determine first forum the user is able to read into - for global announcement link
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
if (sizeof($forum_ary))
{
$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
}
$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
$sql = "SELECT t.* $sql_select
FROM $sql_from
WHERE t.forum_id = 0
AND t.topic_type = " . POST_GLOBAL . '
WHERE t.topic_type = " . POST_GLOBAL . '
AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
ORDER BY t.topic_last_post_time DESC';
$topic_list = $rowset = array();
// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
if ($g_forum_id)
if (!empty($forum_ary))
{
$result = $db->sql_query($sql);
@ -100,15 +91,34 @@ class ucp_main
$db->sql_freeresult($result);
}
$topic_tracking_info = array();
$topic_forum_list = array();
foreach ($rowset as $t_id => $row)
{
if (isset($forum_tracking_info[$row['forum_id']]))
{
$row['forum_mark_time'] = $forum_tracking_info[$row['forum_id']];
}
$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0;
$topic_forum_list[$row['forum_id']]['topics'][] = (int) $t_id;
}
$topic_tracking_info = $tracking_topics = array();
if ($config['load_db_lastread'])
{
$topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list);
foreach ($topic_forum_list as $f_id => $topic_row)
{
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']));
}
}
else
{
$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $topic_list);
foreach ($topic_forum_list as $f_id => $topic_row)
{
$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']);
}
}
unset($topic_forum_list);
foreach ($topic_list as $topic_id)
{
@ -149,6 +159,7 @@ class ucp_main
'TOPIC_TITLE' => censor_text($row['topic_title']),
'TOPIC_TYPE' => $topic_type,
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',
@ -157,10 +168,10 @@ class ucp_main
'S_UNREAD' => $unread_topic,
'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id"))
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"))
);
}
@ -335,6 +346,7 @@ class ucp_main
$template->assign_block_vars('forumrow', array(
'FORUM_ID' => $forum_id,
'FORUM_IMG_STYLE' => $folder_image,
'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'),
'FORUM_IMAGE' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',
@ -748,14 +760,14 @@ class ucp_main
{
foreach ($topic_forum_list as $f_id => $topic_row)
{
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), ($f_id == 0) ? $global_announce_list : false);
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']));
}
}
else
{
foreach ($topic_forum_list as $f_id => $topic_row)
{
$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics'], $global_announce_list);
$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']);
}
}
@ -803,15 +815,15 @@ class ucp_main
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false,
'S_GLOBAL_TOPIC' => (!$forum_id) ? true : false,
'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&amp;t=$topic_id")),
'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&amp;t=$topic_id")),
'REPLIES' => $replies,
'VIEWS' => $row['topic_views'],
'TOPIC_TITLE' => censor_text($row['topic_title']),
'TOPIC_TYPE' => $topic_type,
'FORUM_NAME' => $row['forum_name'],
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],

View file

@ -165,10 +165,12 @@ function view_folder($id, $mode, $folder_id, $folder)
'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '',
'FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'FOLDER_IMG_STYLE' => $folder_img,
'FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',
'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'S_PM_UNREAD' => ($row['pm_unread']) ? true : false,
'S_PM_DELETED' => ($row['pm_deleted']) ? true : false,
'S_PM_REPORTED' => (isset($row['report_id'])) ? true : false,
'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false,

View file

@ -208,7 +208,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $author_id) : '',
'U_WWW' => (!empty($user_info['user_website'])) ? $user_info['user_website'] : '',
'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($user_info['user_icq']) : '',
'U_ICQ' => ($user_info['user_icq']) ? 'http://www.icq.com/people' . urlencode($user_info['user_icq']) . '/' : '',
'U_AIM' => ($user_info['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=aim&amp;u=' . $author_id) : '',
'U_YIM' => ($user_info['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($user_info['user_yim']) . '&amp;.src=pg' : '',
'U_MSN' => ($user_info['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=msnm&amp;u=' . $author_id) : '',

View file

@ -65,7 +65,7 @@ class ucp_prefs
$error = validate_data($data, array(
'dateformat' => array('string', false, 1, 30),
'lang' => array('match', false, '#^[a-z0-9_\-]{2,}$#i'),
'lang' => array('language_iso_name'),
'tz' => array('num', false, -14, 14),
));

View file

@ -57,7 +57,7 @@ class ucp_register
{
$use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);
if (file_exists($user->lang_path . $use_lang . '/'))
if (!validate_language_iso_name($use_lang))
{
if ($change_lang)
{
@ -211,7 +211,7 @@ class ucp_register
array('email')),
'email_confirm' => array('string', false, 6, 60),
'tz' => array('num', false, -14, 14),
'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'),
'lang' => array('language_iso_name'),
));
if (!check_form_key('ucp_register'))

View file

@ -1712,9 +1712,65 @@ function utf8_case_fold_nfc($text, $option = 'full')
return $text;
}
if (extension_loaded('intl'))
{
/**
* A wrapper function for the normalizer which takes care of including the class if required and modifies the passed strings
* to be in NFC (Normalization Form Composition).
* wrapper around PHP's native normalizer from intl
* previously a PECL extension, included in the core since PHP 5.3.0
* http://php.net/manual/en/normalizer.normalize.php
*
* @param mixed $strings a string or an array of strings to normalize
* @return mixed the normalized content, preserving array keys if array given.
*/
function utf8_normalize_nfc($strings)
{
if (empty($strings))
{
return $strings;
}
if (!is_array($strings))
{
if (Normalizer::isNormalized($strings))
{
return $strings;
}
return (string) Normalizer::normalize($strings);
}
else
{
foreach ($strings as $key => $string)
{
if (is_array($string))
{
foreach ($string as $_key => $_string)
{
if (Normalizer::isNormalized($strings[$key][$_key]))
{
continue;
}
$strings[$key][$_key] = (string) Normalizer::normalize($strings[$key][$_key]);
}
}
else
{
if (Normalizer::isNormalized($strings[$key]))
{
continue;
}
$strings[$key] = (string) Normalizer::normalize($strings[$key]);
}
}
}
return $strings;
}
}
else
{
/**
* A wrapper function for the normalizer which takes care of including the class if
* required and modifies the passed strings to be in NFC (Normalization Form Composition).
*
* @param mixed $strings a string or an array of strings to normalize
* @return mixed the normalized content, preserving array keys if array given.
@ -1756,6 +1812,7 @@ function utf8_normalize_nfc($strings)
return $strings;
}
}
/**
* This function is used to generate a "clean" version of a string.

View file

@ -36,17 +36,18 @@ $l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER'
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
$sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
WHERE group_legend > 0
ORDER BY ' . $order_legend . ' ASC';
}
else
{
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
@ -54,9 +55,9 @@ else
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
WHERE g.group_legend > 0
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
ORDER BY g.group_name ASC';
ORDER BY g.' . $order_legend . ' ASC';
}
$result = $db->sql_query($sql);

View file

@ -177,6 +177,69 @@ $database_update_info = database_update_info();
$error_ary = array();
$errored = false;
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE forum_id = 0
AND topic_type = ' . POST_GLOBAL;
$result = $db->sql_query_limit($sql, 1);
$has_global = (int) $db->sql_fetchfield('topic_id');
$db->sql_freeresult($result);
$ga_forum_id = request_var('ga_forum_id', 0);
if ($has_global && !$ga_forum_id)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrap">
<div id="page-header">&nbsp;</div>
<div id="page-body">
<div id="acp">
<div class="panel">
<span class="corners-top"><span></span></span>
<div id="content">
<div id="main" class="install-body">
<h1><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></h1>
<br />
<form action="" method="post" id="select_ga_forum_id">
<?php
if (isset($lang['SELECT_FORUM_GA']))
{
// Language string is available:
echo $lang['SELECT_FORUM_GA'];
}
else
{
echo 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):';
}
?>
<select id="ga_forum_id" name="ga_forum_id"><?php echo make_forum_select(false, false, true, true) ?></select>
<input type="submit" name="post" value="<?php echo $lang['SUBMIT']; ?>" class="button1" />
</form>
<?php
_print_footer();
exit;
}
header('Content-type: text/html; charset=UTF-8');
?>
@ -930,8 +993,19 @@ function database_update_info()
),
),
// No changes from 3.1.0-dev to 3.1.0-A1
'3.1.0-dev' => array(),
// Changes from 3.1.0-dev to 3.1.0-A1
'3.1.0-dev' => array(
'add_columns' => array(
GROUPS_TABLE => array(
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
),
),
'change_columns' => array(
GROUPS_TABLE => array(
'group_legend' => array('UINT', 0),
),
),
),
);
}
@ -1902,6 +1976,140 @@ function change_database_data(&$no_updates, $version)
// Changes from 3.1.0-dev to 3.1.0-A1
case '3.1.0-dev':
set_config('use_system_cron', 0);
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_teampage = 1
WHERE group_type = ' . GROUP_SPECIAL . "
AND group_name = 'ADMINISTRATORS'";
_sql($sql, $errored, $error_ary);
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_teampage = 2
WHERE group_type = ' . GROUP_SPECIAL . "
AND group_name = 'GLOBAL_MODERATORS'";
_sql($sql, $errored, $error_ary);
set_config('legend_sort_groupname', '0');
set_config('teampage_multiple', '1');
set_config('teampage_forums', '1');
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
$result = $db->sql_query($sql);
$next_legend = 1;
while ($row = $db->sql_fetchrow($result))
{
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_legend = ' . $next_legend . '
WHERE group_id = ' . (int) $row['group_id'];
_sql($sql, $errored, $error_ary);
$next_legend++;
}
$db->sql_freeresult($result);
unset($next_legend);
// Install modules
$modules_to_install = array(
'position' => array(
'base' => 'groups',
'class' => 'acp',
'title' => 'ACP_GROUPS_POSITION',
'auth' => 'acl_a_group',
'cat' => 'ACP_GROUPS',
),
'manage' => array(
'base' => 'attachments',
'class' => 'acp',
'title' => 'ACP_MANAGE_ATTACHMENTS',
'auth' => 'acl_a_attach',
'cat' => 'ACP_ATTACHMENTS',
),
);
_add_modules($modules_to_install);
// Localise Global Announcements
$sql = 'SELECT topic_id, topic_approved, (topic_replies + 1) AS topic_posts, topic_last_post_id, topic_last_post_subject, topic_last_post_time, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour
FROM ' . TOPICS_TABLE . '
WHERE forum_id = 0
AND topic_type = ' . POST_GLOBAL;
$result = $db->sql_query($sql);
$global_announcements = $update_lastpost_data = array();
$update_lastpost_data['forum_last_post_time'] = 0;
$update_forum_data = array(
'forum_posts' => 0,
'forum_topics' => 0,
'forum_topics_real' => 0,
);
while ($row = $db->sql_fetchrow($result))
{
$global_announcements[] = (int) $row['topic_id'];
$update_forum_data['forum_posts'] += (int) $row['topic_posts'];
$update_forum_data['forum_topics_real']++;
if ($row['topic_approved'])
{
$update_forum_data['forum_topics']++;
}
if ($update_lastpost_data['forum_last_post_time'] < $row['topic_last_post_time'])
{
$update_lastpost_data = array(
'forum_last_post_id' => (int) $row['topic_last_post_id'],
'forum_last_post_subject' => $row['topic_last_post_subject'],
'forum_last_post_time' => (int) $row['topic_last_post_time'],
'forum_last_poster_id' => (int) $row['topic_last_poster_id'],
'forum_last_poster_name' => $row['topic_last_poster_name'],
'forum_last_poster_colour' => $row['topic_last_poster_colour'],
);
}
}
$db->sql_freeresult($result);
if (!empty($global_announcements))
{
// Update the post/topic-count for the forum and the last-post if needed
$ga_forum_id = request_var('ga_forum_id', 0);
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $ga_forum_id;
$result = $db->sql_query($sql);
$lastpost = (int) $db->sql_fetchfield('forum_last_post_time');
$db->sql_freeresult($result);
$sql_update = 'forum_posts = forum_posts + ' . $update_forum_data['forum_posts'] . ', ';
$sql_update .= 'forum_topics_real = forum_topics_real + ' . $update_forum_data['forum_topics_real'] . ', ';
$sql_update .= 'forum_topics = forum_topics + ' . $update_forum_data['forum_topics'];
if ($lastpost < $update_lastpost_data['forum_last_post_time'])
{
$sql_update .= ', ' . $db->sql_build_array('UPDATE', $update_lastpost_data);
}
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . $sql_update . '
WHERE forum_id = ' . $ga_forum_id;
_sql($sql, $errored, $error_ary);
// Update some forum_ids
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
SET forum_id = $ga_forum_id
WHERE " . $db->sql_in_set('topic_id', $global_announcements);
_sql($sql, $errored, $error_ary);
}
unset($table_ary);
}
$no_updates = false;
break;
}
}

View file

@ -1867,7 +1867,7 @@ class install_install extends module
if (!$user_id)
{
// If we can't insert this user then continue to the next one to avoid inconsistant data
// If we can't insert this user then continue to the next one to avoid inconsistent data
$this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true);
continue;
}

View file

@ -444,7 +444,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm INTEGER DEFAULT 0 NOT NULL,
group_message_limit INTEGER DEFAULT 0 NOT NULL,
group_max_recipients INTEGER DEFAULT 0 NOT NULL,
group_legend INTEGER DEFAULT 1 NOT NULL
group_legend INTEGER DEFAULT 0 NOT NULL,
group_teampage INTEGER DEFAULT 0 NOT NULL
);;
ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);;

View file

@ -546,7 +546,8 @@ CREATE TABLE [phpbb_groups] (
[group_receive_pm] [int] DEFAULT (0) NOT NULL ,
[group_message_limit] [int] DEFAULT (0) NOT NULL ,
[group_max_recipients] [int] DEFAULT (0) NOT NULL ,
[group_legend] [int] DEFAULT (1) NOT NULL
[group_legend] [int] DEFAULT (0) NOT NULL ,
[group_teampage] [int] DEFAULT (0) NOT NULL
) ON [PRIMARY]
GO

View file

@ -316,7 +316,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (group_id),
KEY group_legend_name (group_legend, group_name(255))
);

View file

@ -316,7 +316,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (group_id),
KEY group_legend_name (group_legend, group_name)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;

View file

@ -605,7 +605,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm number(1) DEFAULT '0' NOT NULL,
group_message_limit number(8) DEFAULT '0' NOT NULL,
group_max_recipients number(8) DEFAULT '0' NOT NULL,
group_legend number(1) DEFAULT '1' NOT NULL,
group_legend number(8) DEFAULT '0' NOT NULL,
group_teampage number(8) DEFAULT '0' NOT NULL,
CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id)
)
/

View file

@ -459,7 +459,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
group_legend INT2 DEFAULT '1' NOT NULL CHECK (group_legend >= 0),
group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0),
group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0),
PRIMARY KEY (group_id)
);

View file

@ -151,6 +151,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user_filter', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('legend_sort_groupname', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0');
@ -238,6 +239,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port', '25');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_multiple', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_forums', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', '25');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
@ -520,13 +523,13 @@ INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_reg
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
# -- Groups
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 1, '', '', '', 0);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 2, 2, '', '', '', 0);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, 1, '', '', '', 0);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, 0, '', '', '', 5);
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, 0, '', '', '', 5);
# -- User -> Group
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0);
@ -566,7 +569,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
# No Avatar (u_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar', 'u_masspm', 'u_masspm_group');
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar');
# Full Moderator (m_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 10, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%';

View file

@ -308,7 +308,8 @@ CREATE TABLE phpbb_groups (
group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0',
group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0',
group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0',
group_legend INTEGER UNSIGNED NOT NULL DEFAULT '1'
group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0',
group_teampage INTEGER UNSIGNED NOT NULL DEFAULT '0'
);
CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);

View file

@ -62,6 +62,7 @@ $lang = array_merge($lang, array(
'ATTACH_MAX_PM_FILESIZE_EXPLAIN' => 'Maximum size of each file, with 0 being unlimited, attached to a private message.',
'ATTACH_ORPHAN_URL' => 'Orphan attachments',
'ATTACH_POST_ID' => 'Post ID',
'ATTACH_POST_TYPE' => 'Post type',
'ATTACH_QUOTA' => 'Total attachment quota',
'ATTACH_QUOTA_EXPLAIN' => 'Maximum drive space available for attachments for the whole board, with 0 being unlimited.',
'ATTACH_TO_POST' => 'Attach file to post',

View file

@ -100,6 +100,7 @@ $lang = array_merge($lang, array(
'ACP_GROUPS_MANAGE' => 'Manage groups',
'ACP_GROUPS_MANAGEMENT' => 'Group management',
'ACP_GROUPS_PERMISSIONS' => 'Groups permissions',
'ACP_GROUPS_POSITION' => 'Manage group positions',
'ACP_ICONS' => 'Topic icons',
'ACP_ICONS_SMILIES' => 'Topic icons/smilies',
@ -115,6 +116,10 @@ $lang = array_merge($lang, array(
'ACP_LOGGING' => 'Logging',
'ACP_MAIN' => 'ACP index',
'ACP_MANAGE_ATTACHMENTS' => 'Manage attachments',
'ACP_MANAGE_ATTACHMENTS_EXPLAIN' => 'Here you can list and delete files attached to posts and private messages.',
'ACP_MANAGE_EXTENSIONS' => 'Manage extensions',
'ACP_MANAGE_FORUMS' => 'Manage forums',
'ACP_MANAGE_RANKS' => 'Manage ranks',
@ -226,12 +231,16 @@ $lang = array_merge($lang, array(
'DOWNLOAD_AS' => 'Download as',
'DOWNLOAD_STORE' => 'Download or store file',
'DOWNLOAD_STORE_EXPLAIN' => 'You may directly download the file or save it in your <samp>store/</samp> folder.',
'DOWNLOADS' => 'Downloads',
'EDIT' => 'Edit',
'ENABLE' => 'Enable',
'EXPORT_DOWNLOAD' => 'Download',
'EXPORT_STORE' => 'Store',
'FILES_GONE' => 'Some of the attachments you selected for deletion do not exist. They may have been already deleted. Attachments that did exist were deleted.',
'FILES_STATS_WRONG' => 'Your files statistics are probably inaccurate and need to be resynchronised. Actual values: number of attachments = %1$d, total size of attachments = %2$s.',
'GENERAL_OPTIONS' => 'General options',
'GENERAL_SETTINGS' => 'General settings',
'GLOBAL_MASK' => 'Global permission mask',
@ -257,6 +266,7 @@ $lang = array_merge($lang, array(
'NOTIFY' => 'Notification',
'NO_ADMIN' => 'You are not authorised to administer this board.',
'NO_EMAILS_DEFINED' => 'No valid e-mail addresses found.',
'NO_FILES_TO_DELETE' => 'Attachments you selected for deletion do not exist.',
'NO_PASSWORD_SUPPLIED' => 'You need to enter your password to access the Administration Control Panel.',
'OFF' => 'Off',
@ -271,6 +281,8 @@ $lang = array_merge($lang, array(
'REMIND' => 'Remind',
'RESYNC' => 'Resynchronise',
'RESYNC_FILES_STATS' => 'Resynchronise files statistics',
'RESYNC_FILES_STATS_EXPLAIN' => 'Recalculates the total number and size of files attached to posts and private messages.',
'RETURN_TO' => 'Return to…',
'SELECT_ANONYMOUS' => 'Select anonymous user',
@ -283,6 +295,8 @@ $lang = array_merge($lang, array(
'SHOW_ALL_OPERATIONS' => 'Show all operations',
'TOTAL_SIZE' => 'Total size',
'UCP' => 'User Control Panel',
'USERNAMES_EXPLAIN' => 'Place each username on a separate line.',
'USER_CONTROL_PANEL' => 'User Control Panel',
@ -355,6 +369,7 @@ $lang = array_merge($lang, array(
'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the boards start date?',
'RESET_ONLINE' => 'Reset most users ever online',
'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?',
'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise files statistics?',
'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.',
'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?',
@ -659,6 +674,7 @@ $lang = array_merge($lang, array(
'LOG_REFERER_INVALID' => '<strong>Referer validation failed</strong><br />»Referer was “<em>%1$s</em>”. The request was rejected and the session killed.',
'LOG_RESET_DATE' => '<strong>Board start date reset</strong>',
'LOG_RESET_ONLINE' => '<strong>Most users online reset</strong>',
'LOG_RESYNC_FILES_STATS' => '<strong>Files statistics resynchronised</strong>',
'LOG_RESYNC_POSTCOUNTS' => '<strong>User post counts resynchronised</strong>',
'LOG_RESYNC_POST_MARKING' => '<strong>Dotted topics resynchronised</strong>',
'LOG_RESYNC_STATS' => '<strong>Post, topic and user statistics resynchronised</strong>',

View file

@ -53,6 +53,8 @@ $lang = array_merge($lang, array(
'SEND_TO_USERS' => 'Send to users',
'SEND_TO_USERS_EXPLAIN' => 'Entering names here will override any group selected above. Enter each username on a new line.',
'MAIL_BANNED' => 'Mail banned users',
'MAIL_BANNED_EXPLAIN' => 'When sending a mass e-mail to a group you can select here whether banned users will also receive the e-mail.',
'MAIL_HIGH_PRIORITY' => 'High',
'MAIL_LOW_PRIORITY' => 'Low',
'MAIL_NORMAL_PRIORITY' => 'Normal',

View file

@ -97,6 +97,8 @@ $lang = array_merge($lang, array(
'GROUP_SETTINGS_SAVE' => 'Group wide settings',
'GROUP_SKIP_AUTH' => 'Exempt group leader from permissions',
'GROUP_SKIP_AUTH_EXPLAIN' => 'If enabled group leader no longer inherit permissions from the group.',
'GROUP_SPECIAL' => 'Pre-defined',
'GROUP_TEAMPAGE' => 'Display group on teampage',
'GROUP_TYPE' => 'Group type',
'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.',
'GROUP_UPDATED' => 'Group preferences updated successfully.',
@ -105,19 +107,34 @@ $lang = array_merge($lang, array(
'GROUP_USERS_EXIST' => 'The selected users are already members.',
'GROUP_USERS_REMOVE' => 'Users removed from group and new defaults set successfully.',
'LEGEND_EXPLAIN' => 'These are the groups which are displayed in the group legend:',
'LEGEND_SETTINGS' => 'Legend settings',
'LEGEND_SORT_GROUPNAME' => 'Sort legend by group name',
'LEGEND_SORT_GROUPNAME_EXPLAIN' => 'The order below is ignored when this option is enabled.',
'MANAGE_LEGEND' => 'Manage group legend',
'MANAGE_TEAMPAGE' => 'Manage teampage',
'MAKE_DEFAULT_FOR_ALL' => 'Make default group for every member',
'MEMBERS' => 'Members',
'NO_GROUP' => 'No group specified.',
'NO_GROUPS_ADDED' => 'No groups added yet.',
'NO_GROUPS_CREATED' => 'No groups created yet.',
'NO_PERMISSIONS' => 'Do not copy permissions',
'NO_USERS' => 'You havent entered any users.',
'NO_USERS_ADDED' => 'No users were added to the group.',
'NO_VALID_USERS' => 'You havent entered any users eligible for that action.',
'SELECT_GROUP' => 'Select a group',
'SPECIAL_GROUPS' => 'Pre-defined groups',
'SPECIAL_GROUPS_EXPLAIN' => 'Pre-defined groups are special groups, they cannot be deleted or directly modified. However you can still add users and alter basic settings.',
'TEAMPAGE_EXPLAIN' => 'These are the groups which are displayed on the teampage:',
'TEAMPAGE_FORUMS' => 'Display moderated forums',
'TEAMPAGE_FORUMS_EXPLAIN' => 'If set to yes, moderators will have a list with all of the forums where they have moderator permissions displayed in their row. This can be very database intensive for big boards.',
'TEAMPAGE_MULTIPLE' => 'Display users in all groups',
'TEAMPAGE_MULTIPLE_EXPLAIN' => 'If set to no, the users will only be displayed in their primary group (If the primary group is not listed, the users will be displayed in their first displayed group).',
'TEAMPAGE_SETTINGS' => 'Teampage settings',
'TOTAL_MEMBERS' => 'Members',
'USERS_APPROVED' => 'Users approved successfully.',

View file

@ -168,8 +168,9 @@ $lang = array_merge($lang, array(
'SMILIES_CONFIG' => 'Smiley configuration',
'SMILIES_DELETED' => 'The smiley has been removed successfully.',
'SMILIES_EDIT' => 'Edit smiley',
'SMILIE_NO_CODE' => 'The smilie “%s” was ignored, as there was no code entered.',
'SMILIE_NO_EMOTION' => 'The smilie “%s” was ignored, as there was no emotion entered.',
'SMILIE_NO_CODE' => 'The smiley “%s” was ignored, as there was no code entered.',
'SMILIE_NO_EMOTION' => 'The smiley “%s” was ignored, as there was no emotion entered.',
'SMILIE_NO_FILE' => 'The smiley “%s” was ignored, as the file is missing.',
'SMILIES_NONE_EDITED' => 'No smilies were updated.',
'SMILIES_ONE_EDITED' => 'The smiley has been updated successfully.',
'SMILIES_EDITED' => 'The smilies have been updated successfully.',
@ -233,13 +234,13 @@ $lang = array_merge($lang, array(
// Disallow Usernames
$lang = array_merge($lang, array(
'ACP_DISALLOW_EXPLAIN' => 'Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of *. Please note that you will not be allowed to specify any username that has already been registered, you must first delete that name then disallow it.',
'ACP_DISALLOW_EXPLAIN' => 'Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of *.',
'ADD_DISALLOW_EXPLAIN' => 'You can disallow a username using the wildcard character * to match any character.',
'ADD_DISALLOW_TITLE' => 'Add a disallowed username',
'DELETE_DISALLOW_EXPLAIN' => 'You can remove a disallowed username by selecting the username from this list and clicking submit.',
'DELETE_DISALLOW_TITLE' => 'Remove a disallowed username',
'DISALLOWED_ALREADY' => 'The name you entered could not be disallowed. It either already exists in the list, exists in the word censor list, or a matching username is present.',
'DISALLOWED_ALREADY' => 'The name you entered is already disallowed.',
'DISALLOWED_DELETED' => 'The disallowed username has been successfully removed.',
'DISALLOW_SUCCESSFUL' => 'The disallowed username has been successfully added.',

View file

@ -190,7 +190,7 @@ $lang = array_merge($lang, array(
'FORM_INVALID' => 'The submitted form was invalid. Try submitting again.',
'FORUM' => 'Forum',
'FORUMS' => 'Forums',
'FORUMS_MARKED' => 'All forums have been marked read.',
'FORUMS_MARKED' => 'The selected forums have been marked read.',
'FORUM_CAT' => 'Forum category',
'FORUM_INDEX' => 'Board index',
'FORUM_LINK' => 'Forum link',
@ -322,6 +322,7 @@ $lang = array_merge($lang, array(
'MARK' => 'Mark',
'MARK_ALL' => 'Mark all',
'MARK_FORUMS_READ' => 'Mark forums read',
'MARK_SUBFORUMS_READ' => 'Mark subforums read',
'MB' => 'MB',
'MIB' => 'MiB',
'MCP' => 'Moderator Control Panel',

View file

@ -323,6 +323,7 @@ $lang = array_merge($lang, array(
'SERVER_CONFIG' => 'Server configuration',
'SEARCH_INDEX_UNCONVERTED' => 'Search index was not converted',
'SEARCH_INDEX_UNCONVERTED_EXPLAIN' => 'Your old search index was not converted. Searching will always yield an empty result. To create a new search index go to the Administration Control Panel, select Maintenance and then choose Search index from the submenu.',
'SELECT_FORUM_GA' => 'In phpBB 3.1 the global announcements are linked to forums. Select a forum for your current global announcements (can be moved later):',
'SOFTWARE' => 'Board software',
'SPECIFY_OPTIONS' => 'Specify conversion options',
'STAGE_ADMINISTRATOR' => 'Administrator details',

View file

@ -85,7 +85,7 @@ if ($post_id)
$db->sql_freeresult($result);
$topic_id = (int) $row['topic_id'];
$forum_id = (int) ($row['forum_id']) ? $row['forum_id'] : $forum_id;
$forum_id = (int) $row['forum_id'];
}
else if ($topic_id)
{
@ -400,12 +400,6 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false)
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_id'])
{
// Global Announcement?
$row['forum_id'] = request_var('f', 0);
}
$rowset[$row['topic_id']] = $row;
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
@ -485,12 +479,6 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_id'])
{
// Global Announcement?
$row['forum_id'] = request_var('f', 0);
}
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;

View file

@ -77,68 +77,108 @@ switch ($mode)
$page_title = $user->lang['THE_TEAM'];
$template_html = 'memberlist_leaders.html';
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
$sql_ary = array(
'SELECT' => 'g.group_id, g.group_name, g.group_colour, g.group_type, g.group_teampage, ug.user_id as ug_user_id',
$admin_id_ary = $global_mod_id_ary = $mod_id_ary = $forum_id_ary = array();
foreach ($user_ary as $forum_id => $forum_ary)
'FROM' => array(GROUPS_TABLE => 'g'),
'LEFT_JOIN' => array(
array(
'FROM' => array(USER_GROUP_TABLE => 'ug'),
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . (int) $user->data['user_id'],
),
),
'WHERE' => '',
'ORDER_BY' => 'g.group_teampage ASC',
);
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
$group_ids = $groups_ary = array();
while ($row = $db->sql_fetchrow($result))
{
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
{
$row['group_name'] = $user->lang['GROUP_UNDISCLOSED'];
$row['u_group'] = '';
}
else
{
$row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
$row['u_group'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']);
}
if ($row['group_teampage'])
{
// Only put groups into the array we want to display.
// We are fetching all groups, to ensure we got all data for default groups.
$group_ids[] = (int) $row['group_id'];
}
$groups_ary[(int) $row['group_id']] = $row;
}
$db->sql_freeresult($result);
$sql_ary = array(
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id',
'FROM' => array(
USER_GROUP_TABLE => 'ug',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 'ug.user_id = u.user_id AND ug.user_pending = 0',
),
array(
'FROM' => array(GROUPS_TABLE => 'g'),
'ON' => 'ug.group_id = g.group_id',
),
),
'WHERE' => $db->sql_in_set('g.group_id', $group_ids, false, true),
'ORDER_BY' => 'u.username_clean ASC',
);
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
$user_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$row['forums'] = '';
$row['forums_ary'] = array();
$user_ary[(int) $row['user_id']] = $row;
$user_ids[] = (int) $row['user_id'];
$group_users[(int) $row['group_id']][] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
if ($config['teampage_forums'])
{
$template->assign_var('S_DISPLAY_MODERATOR_FORUMS', true);
// Get all moderators
$perm_ary = $auth->acl_get_list(array_unique($user_ids), array('m_'), false);
foreach ($perm_ary as $forum_id => $forum_ary)
{
foreach ($forum_ary as $auth_option => $id_ary)
{
if (!$forum_id)
{
if ($auth_option == 'a_')
{
$admin_id_ary = array_merge($admin_id_ary, $id_ary);
}
else
{
$global_mod_id_ary = array_merge($global_mod_id_ary, $id_ary);
}
continue;
}
else
{
$mod_id_ary = array_merge($mod_id_ary, $id_ary);
}
if ($forum_id)
{
foreach ($id_ary as $id)
{
$forum_id_ary[$id][] = $forum_id;
}
}
}
}
$admin_id_ary = array_unique($admin_id_ary);
$global_mod_id_ary = array_unique($global_mod_id_ary);
$mod_id_ary = array_merge($mod_id_ary, $global_mod_id_ary);
$mod_id_ary = array_unique($mod_id_ary);
// Admin group id...
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'ADMINISTRATORS'";
$result = $db->sql_query($sql);
$admin_group_id = (int) $db->sql_fetchfield('group_id');
$db->sql_freeresult($result);
// Get group memberships for the admin id ary...
$admin_memberships = group_memberships($admin_group_id, $admin_id_ary);
$admin_user_ids = array();
if (!empty($admin_memberships))
if (!$forum_id)
{
// ok, we only need the user ids...
foreach ($admin_memberships as $row)
$user_ary[$id]['forums'] = $user->lang['ALL_FORUMS'];
}
else
{
$admin_user_ids[$row['user_id']] = true;
$user_ary[$id]['forums_ary'][] = $forum_id;
}
}
}
}
unset($admin_memberships);
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE;
@ -151,106 +191,66 @@ switch ($mode)
}
$db->sql_freeresult($result);
$sql = $db->sql_build_query('SELECT', array(
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id',
'FROM' => array(
USERS_TABLE => 'u',
GROUPS_TABLE => 'g'
),
'LEFT_JOIN' => array(
array(
'FROM' => array(USER_GROUP_TABLE => 'ug'),
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id']
)
),
'WHERE' => $db->sql_in_set('u.user_id', array_unique(array_merge($admin_id_ary, $mod_id_ary)), false, true) . '
AND u.group_id = g.group_id',
'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC'
));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
foreach ($user_ary as $user_id => $user_data)
{
$which_row = (in_array($row['user_id'], $admin_id_ary)) ? 'admin' : 'mod';
// We sort out admins not within the 'Administrators' group.
// Else, we will list those as admin only having the permission to view logs for example.
if ($which_row == 'admin' && empty($admin_user_ids[$row['user_id']]))
if (!$user_data['forums'])
{
// Remove from admin_id_ary, because the user may be a mod instead
unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]);
if (!in_array($row['user_id'], $mod_id_ary) && !in_array($row['user_id'], $global_mod_id_ary))
{
continue;
}
else
{
$which_row = 'mod';
}
}
$s_forum_select = '';
$undisclosed_forum = false;
if (isset($forum_id_ary[$row['user_id']]) && !in_array($row['user_id'], $global_mod_id_ary))
{
if ($which_row == 'mod' && sizeof(array_diff(array_keys($forums), $forum_id_ary[$row['user_id']])))
{
foreach ($forum_id_ary[$row['user_id']] as $forum_id)
foreach ($user_data['forums_ary'] as $forum_id)
{
$user_ary[$user_id]['forums_options'] = true;
if (isset($forums[$forum_id]))
{
if ($auth->acl_get('f_list', $forum_id))
{
$s_forum_select .= '<option value="">' . $forums[$forum_id] . '</option>';
$user_ary[$user_id]['forums'] .= '<option value="">' . $forums[$forum_id] . '</option>';
}
else
{
$undisclosed_forum = true;
}
}
}
}
}
// If the mod is only moderating non-viewable forums we skip the user. There is no gain in displaying the person then...
if (!$s_forum_select && $undisclosed_forum)
foreach ($groups_ary as $group_id => $group_data)
{
// $s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>';
if ($group_data['group_teampage'])
{
$template->assign_block_vars('group', array(
'GROUP_NAME' => $group_data['group_name'],
'GROUP_COLOR' => $group_data['group_colour'],
'U_GROUP' => $group_data['u_group'],
));
}
// Display group members.
if (!empty($group_users[$group_id]))
{
foreach ($group_users[$group_id] as $user_id)
{
if (isset($user_ary[$user_id]))
{
$row = $user_ary[$user_id];
if (!$config['teampage_multiple'] && ($group_id != $groups_ary[$row['default_group']]['group_id']) && $groups_ary[$row['default_group']]['group_teampage'])
{
// Display users in their primary group, instead of the first group, when it is displayed on the teampage.
continue;
}
// The person is moderating several "public" forums, therefore the person should be listed, but not giving the real group name if hidden.
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
{
$group_name = $user->lang['GROUP_UNDISCLOSED'];
$u_group = '';
}
else
{
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']);
}
$rank_title = $rank_img = '';
$rank_title = $rank_img = $rank_img_src = '';
get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);
$template->assign_block_vars($which_row, array(
$template->assign_block_vars('group.user', array(
'USER_ID' => $row['user_id'],
'FORUMS' => $s_forum_select,
'FORUMS' => $row['forums'],
'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false,
'RANK_TITLE' => $rank_title,
'GROUP_NAME' => $group_name,
'GROUP_COLOR' => $row['group_colour'],
'GROUP_NAME' => $groups_ary[$row['default_group']]['group_name'],
'GROUP_COLOR' => $groups_ary[$row['default_group']]['group_colour'],
'U_GROUP' => $groups_ary[$row['default_group']]['u_group'],
'RANK_IMG' => $rank_img,
'RANK_IMG_SRC' => $rank_img_src,
'U_GROUP' => $u_group,
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;u=' . $row['user_id']) : '',
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
@ -258,8 +258,15 @@ switch ($mode)
'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
));
if (!$config['teampage_multiple'])
{
unset($user_ary[$user_id]);
}
}
}
}
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']))
@ -1069,8 +1076,27 @@ switch ($mode)
$sql_where .= ($msn) ? ' AND u.user_msnm ' . $db->sql_like_expression(str_replace('*', $db->any_char, $msn)) . ' ' : '';
$sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->any_char, $jabber)) . ' ' : '';
$sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : '';
$sql_where .= (sizeof($joined) > 1 && isset($find_key_match[$joined_select])) ? " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, intval($joined[1]), intval($joined[2]), intval($joined[0])) : '';
$sql_where .= ($auth->acl_get('u_viewonline') && sizeof($active) > 1 && isset($find_key_match[$active_select])) ? " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . gmmktime(0, 0, 0, $active[1], intval($active[2]), intval($active[0])) : '';
if (isset($find_key_match[$joined_select]) && sizeof($joined) == 3)
{
$joined_time = gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]);
if ($joined_time !== false)
{
$sql_where .= " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . $joined_time;
}
}
if (isset($find_key_match[$active_select]) && sizeof($active) == 3 && $auth->acl_get('u_viewonline'))
{
$active_time = gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]);
if ($active_time !== false)
{
$sql_where .= " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . $active_time;
}
}
$sql_where .= ($search_group_id) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : '';
if ($search_group_id)
@ -1110,7 +1136,7 @@ switch ($mode)
$sql = 'SELECT DISTINCT poster_id
FROM ' . POSTS_TABLE . '
WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips)
AND forum_id IN (0, " . implode(', ', $ip_forums) . ')';
AND " . $db->sql_in_set('forum_id', $ip_forums);
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
@ -1692,7 +1718,7 @@ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = f
'U_EMAIL' => $email,
'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '',
'U_SHORT_WWW' => (!empty($data['user_website'])) ? ((strlen($data['user_website']) > 55) ? substr($data['user_website'], 0, 39) . ' ... ' . substr($data['user_website'], -10) : $data['user_website']) : '',
'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($data['user_icq']) : '',
'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/' . urlencode($data['user_icq']) . '/' : '',
'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=aim&amp;u=' . $user_id) : '',
'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($data['user_yim']) . '&amp;.src=pg' : '',
'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&amp;action=msnm&amp;u=' . $user_id) : '',

View file

@ -87,8 +87,7 @@ switch ($mode)
$sql = 'SELECT f.*, t.*
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.topic_id = $topic_id
AND (f.forum_id = t.forum_id
OR f.forum_id = $forum_id)" .
AND f.forum_id = t.forum_id" .
(($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND t.topic_approved = 1');
break;
@ -116,8 +115,7 @@ switch ($mode)
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND u.user_id = p.poster_id
AND (f.forum_id = t.forum_id
OR f.forum_id = $forum_id)" .
AND f.forum_id = t.forum_id" .
(($auth->acl_get('m_approve', $forum_id)) ? '' : ' AND p.post_approved = 1');
break;
@ -1005,60 +1003,6 @@ if ($submit || $preview || $refresh)
// Store message, sync counters
if (!sizeof($error) && $submit)
{
// Check if we want to de-globalize the topic... and ask for new forum
if ($post_data['topic_type'] != POST_GLOBAL)
{
$sql = 'SELECT topic_type, forum_id
FROM ' . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row && !$row['forum_id'] && $row['topic_type'] == POST_GLOBAL)
{
$to_forum_id = request_var('to_forum_id', 0);
if ($to_forum_id)
{
$sql = 'SELECT forum_type
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $to_forum_id;
$result = $db->sql_query($sql);
$forum_type = (int) $db->sql_fetchfield('forum_type');
$db->sql_freeresult($result);
if ($forum_type != FORUM_POST || !$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id)))
{
$to_forum_id = 0;
}
}
if (!$to_forum_id)
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
$template->assign_vars(array(
'S_FORUM_SELECT' => make_forum_select(false, false, false, true, true, true),
'S_UNGLOBALISE' => true)
);
$submit = false;
$refresh = true;
}
else
{
if (!$auth->acl_get('f_post', $to_forum_id))
{
// This will only be triggered if the user tried to trick the forum.
trigger_error('NOT_AUTHORISED');
}
$forum_id = $to_forum_id;
}
}
}
if ($submit)
{
// Lock/Unlock Topic

View file

@ -70,7 +70,7 @@ if ($post_id)
trigger_error('POST_NOT_EXIST');
}
$forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id;
$forum_id = (int) $report_data['forum_id'];
$topic_id = (int) $report_data['topic_id'];
$sql = 'SELECT *

View file

@ -719,11 +719,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
{
if ($user->data['is_registered'] && $config['load_db_lastread'])
{
$topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), ($forum_id) ? false : $forum['topic_list']);
$topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']));
}
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
{
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], ($forum_id) ? false : $forum['topic_list']);
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list']);
if (!$user->data['is_registered'])
{
@ -832,35 +832,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$result_topic_id = $row['topic_id'];
$topic_title = censor_text($row['topic_title']);
// we need to select a forum id for this global topic
if (!$forum_id)
{
if (!isset($g_forum_id))
{
// Get a list of forums the user cannot read
$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));
// Determine first forum the user is able to read (must not be a category)
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
if (sizeof($forum_ary))
{
$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
}
$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');
}
$u_forum_id = $g_forum_id;
}
else
{
$u_forum_id = $forum_id;
}
$view_topic_url_params = "f=$u_forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url_params = "f=$forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
@ -898,6 +870,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'PAGINATION' => topic_generate_pagination($replies, $view_topic_url),
'TOPIC_TYPE' => $topic_type,
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
@ -910,7 +883,6 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false,
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false,
'S_UNREAD_TOPIC' => $unread_topic,

View file

@ -70,12 +70,12 @@
<embed src="{_file.U_VIEW_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
</object>
<!-- ELSEIF _file.S_QUICKTIME_FILE -->
<object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="0" height="16">
<object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="320" height="285">
<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
<param name="controller" value="true" />
<param name="autoplay" value="false" />
<param name="type" value="video/quicktime" />
<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="0" height="16" type="video/quicktime" autoplay="false"></embed>
<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="320" height="285" type="video/quicktime" autoplay="false"></embed>
</object>
<!-- ELSEIF _file.S_RM_FILE -->
<object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50">

View file

@ -25,7 +25,7 @@
<!-- IF not forumrow.S_IS_CAT -->
<li class="row">
<dl class="icon" style="background-image: url({forumrow.FORUM_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
<dl class="icon {forumrow.FORUM_IMG_STYLE}">
<dt title="{forumrow.FORUM_FOLDER_IMG_ALT}">
<!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF -->

View file

@ -34,7 +34,7 @@
<!-- BEGIN topicrow -->
<li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">
<dl class="icon" style="background-image: url({topicrow.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
<dl class="icon {topicrow.TOPIC_IMG_STYLE}">
<dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->>
<!-- IF topicrow.S_SELECT_TOPIC --><a href="{topicrow.U_SELECT_TOPIC}" class="topictitle">[ {L_SELECT_MERGE} ]</a>&nbsp;&nbsp; <!-- ENDIF -->
<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>

View file

@ -39,7 +39,7 @@
<dt>&nbsp;</dt>
<dd><a href="{U_AIM_CONTACT}">{L_IM_ADD_CONTACT}</a></dd>
<dd><a href="{U_AIM_MESSAGE}">{L_IM_SEND_MESSAGE}</a></dd>
<dd><a href="http://www.aim.com/download.adp">{L_IM_DOWNLOAD_APP}</a> | <a href="http://aimexpress.oscar.aol.com/aimexpress/launch.adp?Brand=AIM">{L_IM_AIM_EXPRESS}</a></dd>
<dd><a href="http://www.aim.com">{L_IM_DOWNLOAD_APP}</a> | <a href="http://www.aim.com/products/express">{L_IM_AIM_EXPRESS}</a></dd>
</dl>
<!-- ENDIF -->

View file

@ -4,71 +4,42 @@
<form method="post" action="{S_MODE_ACTION}">
<!-- BEGIN group -->
<div class="forumbg">
<div class="inner"><span class="corners-top"><span></span></span>
<table class="table1" cellspacing="1">
<thead>
<tr>
<th class="name"><span class="rank-img">{L_RANK}&nbsp;</span>{L_ADMINISTRATORS}</th>
<th class="name"><span class="rank-img">{L_RANK}&nbsp;</span><!-- IF group.U_GROUP --><a href="{group.U_GROUP}">{group.GROUP_NAME}</a><!-- ELSE -->{group.GROUP_NAME}<!-- ENDIF --></th>
<th class="info">{L_PRIMARY_GROUP}</th>
<th class="info">{L_FORUMS}</th>
<!-- IF S_DISPLAY_MODERATOR_FORUMS --><th class="info">{L_MODERATOR}</th><!-- ENDIF -->
</tr>
</thead>
<tbody>
<!-- BEGIN admin -->
<tr class="<!-- IF admin.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<td><!-- IF admin.RANK_IMG --><span class="rank-img">{admin.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{admin.RANK_TITLE}</span><!-- ENDIF -->{admin.USERNAME_FULL}</td>
<td class="info"><!-- IF admin.U_GROUP -->
<a<!-- IF admin.GROUP_COLOR --> style="font-weight: bold; color:#{admin.GROUP_COLOR}"<!-- ENDIF --> href="{admin.U_GROUP}">{admin.GROUP_NAME}</a>
<!-- BEGIN user -->
<tr class="<!-- IF group.user.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF -->{group.user.USERNAME_FULL}</td>
<td class="info"><!-- IF group.user.U_GROUP -->
<a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color: #{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a>
<!-- ELSE -->
{admin.GROUP_NAME}
{group.user.GROUP_NAME}
<!-- ENDIF --></td>
<td class="info">-</td>
<!-- IF S_DISPLAY_MODERATOR_FORUMS -->
<td class="info"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td>
<!-- ENDIF -->
</tr>
<!-- BEGINELSE -->
<tr class="bg1">
<td colspan="3"><strong>{L_NO_ADMINISTRATORS}</strong></td>
<td colspan="3"><strong>{L_NO_MEMBERS}</strong></td>
</tr>
<!-- END admin -->
</tbody>
</table>
<span class="corners-bottom"><span></span></span></div>
</div>
<div class="forumbg">
<div class="inner"><span class="corners-top"><span></span></span>
<table class="table1" cellspacing="1">
<thead>
<tr>
<th class="name">{L_MODERATORS}</th>
<th class="info">&nbsp;</th>
<th class="info">&nbsp;</th>
</tr>
</thead>
<tbody>
<!-- BEGIN mod -->
<tr class="<!-- IF mod.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<td><!-- IF mod.RANK_IMG --><span class="rank-img">{mod.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{mod.RANK_TITLE}</span><!-- ENDIF -->{mod.USERNAME_FULL}</td>
<td class="info"><!-- IF mod.U_GROUP -->
<a<!-- IF mod.GROUP_COLOR --> style="font-weight: bold; color:#{mod.GROUP_COLOR}"<!-- ENDIF --> href="{mod.U_GROUP}">{mod.GROUP_NAME}</a>
<!-- ELSE -->
{mod.GROUP_NAME}
<!-- ENDIF --></td>
<td class="info"><!-- IF not mod.FORUMS -->{L_ALL_FORUMS}<!-- ELSE --><select style="width: 100%;">{mod.FORUMS}</select><!-- ENDIF --></td>
</tr>
<!-- BEGINELSE -->
<tr class="bg1">
<td colspan="3"><strong>{L_NO_MODERATORS}</strong></td>
</tr>
<!-- END mod -->
<!-- END user -->
</tbody>
</table>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- END group -->
</form>

View file

@ -37,7 +37,7 @@ function insert_single(user)
}
// ]]>
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/forum_fn.js"></script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
<!-- ENDIF -->
<h2 class="solo">{L_FIND_USERNAME}</h2>

View file

@ -81,8 +81,8 @@
// ]]>
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/styleswitcher.js"></script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/forum_fn.js"></script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/styleswitcher.js"></script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
@ -145,7 +145,7 @@
<ul class="linklist leftside">
<li class="icon-ucp">
<a href="{U_PROFILE}" title="{L_PROFILE}" accesskey="e">{L_PROFILE}</a>
<!-- IF S_DISPLAY_PM --> (<a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a>)<!-- ENDIF -->
<!-- IF S_DISPLAY_PM --> (<a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a>)<!-- ENDIF -->
<!-- IF S_DISPLAY_SEARCH --> &bull;
<a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a>
<!-- ENDIF -->

Some files were not shown because too many files have changed in this diff Show more