aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2003-05-11 16:21:35 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2003-05-11 16:21:35 +0000
commit4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff (patch)
tree477b69dc84a7ec7efc9c8de15b7b28b952320ec7 /phpBB
parent30fd2486d82d50fecd4ba5ec6b81eebc4fcfdf49 (diff)
downloadforums-4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff.tar
forums-4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff.tar.gz
forums-4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff.tar.bz2
forums-4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff.tar.xz
forums-4d1def879aef2b97a2dfe65c13f2c3c8e6b53aff.zip
a few updates, added #539865 and #694413.
git-svn-id: file:///svn/phpbb/trunk@4005 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/admin_attachments.php237
-rw-r--r--phpBB/adm/admin_board.php6
-rw-r--r--phpBB/common.php1
-rw-r--r--phpBB/download.php8
-rw-r--r--phpBB/includes/bbcode.php2
-rw-r--r--phpBB/includes/functions_posting.php251
-rw-r--r--phpBB/includes/message_parser.php31
-rw-r--r--phpBB/install/install.php91
-rw-r--r--phpBB/install/schemas/mysql_basic.sql19
-rw-r--r--phpBB/language/en/lang_admin.php12
-rw-r--r--phpBB/posting.php10
-rw-r--r--phpBB/viewtopic.php6
12 files changed, 510 insertions, 164 deletions
diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php
index db5181504f..667a40ee2e 100644
--- a/phpBB/adm/admin_attachments.php
+++ b/phpBB/adm/admin_attachments.php
@@ -127,7 +127,7 @@ if ($submit && ($mode == 'manage' || $mode == 'cats'))
}
// Adjust the Upload Directory
-if (!$new['allow_ftp_upload'])
+if (!$new['use_ftp_upload'])
{
if ( ($new['upload_dir'][0] == '/') || ( ($new['upload_dir'][0] != '/') && ($new['upload_dir'][1] == ':') ) )
{
@@ -153,6 +153,10 @@ switch ($mode)
$l_title = 'MANAGE_CATEGORIES';
break;
+ case 'extensions':
+ $l_title = 'MANAGE_EXTENSIONS';
+ break;
+
case 'ext_groups':
$l_title = 'EXTENSION_GROUPS_TITLE';
}
@@ -207,14 +211,126 @@ if ($submit && $mode == 'manage')
{
$upload_dir = ( ($new['upload_dir'][0] == '/') || ($new['upload_dir'][0] != '/' && $new['upload_dir'][1] == ':') ) ? $new['upload_dir'] : $phpbb_root_path . $new['upload_dir'];
- test_upload($error, $error_msg, $upload_dir, $new['ftp_path'], $new['allow_ftp_upload'], false);
+ test_upload($error, $error_msg, $upload_dir, $new['ftp_path'], $new['use_ftp_upload'], false);
}
if ($submit && $mode == 'cats')
{
$upload_dir = ( ($new['upload_dir'][0] == '/') || ($new['upload_dir'][0] != '/' && $new['upload_dir'][1] == ':') ) ? $new['upload_dir'] . '/thumbs' : $phpbb_root_path . $new['upload_dir'] . '/thumbs';
- test_upload($error, $error_msg, $upload_dir, $new['ftp_path'] . '/thumbs', $new['allow_ftp_upload'], true);
+ test_upload($error, $error_msg, $upload_dir, $new['ftp_path'] . '/thumbs', $new['use_ftp_upload'], true);
+}
+
+if ($submit && $mode == 'extensions')
+{
+ // Change Extensions ?
+ $extension_change_list = ( isset($_POST['extension_change_list']) ) ? $_POST['extension_change_list'] : array();
+ $extension_explain_list = ( isset($_POST['extension_explain_list']) ) ? $_POST['extension_explain_list'] : array();
+ $group_select_list = ( isset($_POST['group_select']) ) ? $_POST['group_select'] : array();
+
+ // Generate correct Change List
+ $extensions = array();
+
+ for ($i = 0; $i < count($extension_change_list); $i++)
+ {
+ $extensions[$extension_change_list[$i]]['comment'] = stripslashes(htmlspecialchars($extension_explain_list[$i]));
+ $extensions[$extension_change_list[$i]]['group_id'] = intval($group_select_list[$i]);
+ }
+
+ $sql = 'SELECT *
+ FROM ' . EXTENSIONS_TABLE . '
+ ORDER BY extension_id';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ( ($row['comment'] != $extensions[$row['extension_id']]['comment']) || (intval($row['group_id']) != intval($extensions[$row['extension_id']]['group_id'])) )
+ {
+ $sql = "UPDATE " . EXTENSIONS_TABLE . "
+ SET comment = '" . $extensions[$row['extension_id']]['comment'] . "', group_id = " . $extensions[$row['extension_id']]['group_id'] . "
+ WHERE extension_id = " . $row['extension_id'];
+ $db->sql_query($sql);
+ }
+ }
+ $db->sql_freeresult($result);
+
+ // Delete Extension ?
+ $extension_id_list = ( isset($_POST['extension_id_list']) ) ? $_POST['extension_id_list'] : array();
+
+ $extension_id_sql = implode(', ', $extension_id_list);
+
+ if ($extension_id_sql != '')
+ {
+ $sql = 'DELETE
+ FROM ' . EXTENSIONS_TABLE . '
+ WHERE extension_id IN (' . $extension_id_sql . ')';
+ $db->sql_query($sql);
+ }
+
+ // Add Extension ?
+ $add_extension = ( isset($_POST['add_extension']) ) ? trim(strip_tags($_POST['add_extension'])) : '';
+ $add_extension_explain = ( isset($_POST['add_extension_explain']) ) ? trim(strip_tags($_POST['add_extension_explain'])) : '';
+ $add_extension_group = ( isset($_POST['add_group_select']) ) ? intval($_POST['add_group_select']) : '';
+ $add = ( isset($_POST['add_extension_check']) ) ? TRUE : FALSE;
+
+ if ($add_extension != '' && $add)
+ {
+ if (!$error)
+ {
+ // check extension
+ $sql = "SELECT extension
+ FROM " . EXTENSIONS_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (strtolower(trim($row['extension'])) == strtolower(trim($add_extension)))
+ {
+ $error = TRUE;
+ if( isset($error_msg) )
+ {
+ $error_msg .= '<br />';
+ }
+ $error_msg .= sprintf($user->lang['EXTENSION_EXIST'], strtolower(trim($add_extension)));
+ }
+ }
+ $db->sql_freeresult($result);
+
+ // Extension Forbidden ?
+ if (!$error)
+ {
+ $sql = "SELECT extension
+ FROM " . FORBIDDEN_EXTENSIONS_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (strtolower(trim($row['extension'])) == strtolower(trim($add_extension)))
+ {
+ $error = TRUE;
+ if( isset($error_msg) )
+ {
+ $error_msg .= '<br />';
+ }
+ $error_msg .= sprintf($user->lang['CANNOT_ADD_FORBIDDEN_EXTENSION'], strtolower(trim($add_extension)));
+ }
+ }
+ }
+
+ if (!$error)
+ {
+ $sql = "INSERT INTO " . EXTENSIONS_TABLE . " (group_id, extension, comment)
+ VALUES (" . $add_extension_group . ", '" . strtolower(trim($add_extension)) . "', '" . trim($add_extension_explain) . "')";
+ $db->sql_query($sql);
+ }
+ }
+ }
+
+ if (!$error)
+ {
+ $notify = true;
+ $notify_msg = $user->lang['EXTENSIONS_UPDATED'];
+ }
}
if ($submit && $mode == 'ext_groups')
@@ -409,7 +525,7 @@ $select_pm_size_mode = size_select('pm_size', $pm_size);
?>
<form action="admin_attachments.<?php echo $phpEx . $SID . "&amp;mode=$mode"; ?>" method="post">
- <table cellspacing="1" cellpadding="0" border="0" align="center" width="100%">
+ <table cellspacing="1" cellpadding="0" border="0" align="center" width="99%">
<tr>
<td align="right"> &nbsp;&nbsp;
<?php
@@ -440,7 +556,7 @@ $select_pm_size_mode = size_select('pm_size', $pm_size);
if ($mode == 'manage')
{
- $yes_no_switches = array('disable_mod', 'allow_pm_attach', 'allow_ftp_upload', 'display_order', 'ftp_pasv_mode');
+ $yes_no_switches = array('disable_mod', 'allow_pm_attach', 'use_ftp_upload', 'display_order', 'ftp_pasv_mode');
for ($i = 0; $i < count($yes_no_switches); $i++)
{
@@ -449,7 +565,7 @@ if ($mode == 'manage')
}
?>
- <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
+ <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<tr>
<th align="center" colspan="2"><?php echo $user->lang['ATTACHMENT_SETTINGS']; ?></th>
</tr>
@@ -507,7 +623,7 @@ if ($mode == 'manage')
{
?>
- <input type="hidden" name="allow_ftp_upload" value="0" />
+ <input type="hidden" name="use_ftp_upload" value="0" />
<tr>
<td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
@@ -523,7 +639,7 @@ if ($mode == 'manage')
<tr>
<td class="row1" width="50%"><?php echo $user->lang['FTP_UPLOAD']; ?>:<br /><span class="gensmall"><?php echo $user->lang['FTP_UPLOAD_EXPLAIN']; ?></span></td>
- <td class="row2"><input type="radio" name="allow_ftp_upload" value="1" <?php echo $allow_ftp_upload_yes; ?> /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="allow_ftp_upload" value="0" <?php echo $allow_ftp_upload_no; ?> /> <?php echo $user->lang['NO']; ?></td>
+ <td class="row2"><input type="radio" name="use_ftp_upload" value="1" <?php echo $use_ftp_upload_yes; ?> /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="use_ftp_upload" value="0" <?php echo $use_ftp_upload_no; ?> /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
@@ -584,7 +700,7 @@ if ($mode == 'cats')
$create_thumbnail_no = (!$new['img_create_thumbnail']) ? 'checked="checked"' : '';
?>
- <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
+ <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<tr>
<th align="center" colspan="2"><?php echo $user->lang['SETTINGS_CAT_IMAGES']; ?></th>
</tr>
@@ -703,7 +819,7 @@ if ($mode == 'ext_groups')
//-->
</script>
- <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="100%">
+ <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<tr>
<th align="center" colspan="7"><?php echo $user->lang['EXTENSION_GROUPS_TITLE']; ?></th>
</tr>
@@ -839,6 +955,64 @@ if ($mode == 'ext_groups')
<?
}
+
+if ($mode == 'extensions')
+{
+?>
+ <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
+ <tr>
+ <th align="center" colspan="4"><?php echo $user->lang['MANAGE_EXTENSIONS']; ?></th>
+ </tr>
+ <tr>
+ <td class="spacer" colspan="4" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
+ </tr>
+ <tr>
+ <th>&nbsp;<?php echo $user->lang['COMMENT']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION_GROUP']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['ADD_EXTENSION']; ?>&nbsp;</th>
+ </tr>
+ <tr>
+ <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="add_extension_explain" class="post" value="<?php echo $add_extension_explain; ?>" /></td>
+ <td class="row2" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="<?php echo $add_extension; ?>" /></td>
+ <td class="row1" align="center" valign="middle"><?php echo (($submit) ? group_select('add_group_select', $add_extension_group) : group_select('add_group_select')) ?></td>
+ <td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
+ </tr>
+ <tr align="right">
+ <td class="cat" colspan="4"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /></td>
+ </tr>
+ <tr>
+ <th>&nbsp;<?php echo $user->lang['COMMENT']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['EXTENSION_GROUP']; ?>&nbsp;</th>
+ <th>&nbsp;<?php echo $user->lang['DELETE']; ?>&nbsp;</th>
+ </tr>
+
+<?
+ $sql = 'SELECT *
+ FROM ' . EXTENSIONS_TABLE . '
+ ORDER BY group_id';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+?>
+ <tr>
+ <input type="hidden" name="extension_change_list[]" value="<?php echo $row['extension_id']; ?>" />
+ <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="extension_explain_list[]" class="post" value="<?php echo $row['comment']; ?>" /></td>
+ <td class="row2" align="center" valign="middle"><b class="gen"><?php echo $row['extension']; ?></b></td>
+ <td class="row1" align="center" valign="middle"><?php echo group_select('group_select[]', $row['group_id']); ?></td>
+ <td class="row2" align="center" valign="middle"><input type="checkbox" name="extension_id_list[]" value="<?php echo $row['extension_id']; ?>" /></td>
+ </tr>
+<?
+ }
+?>
+ <tr>
+ <td class="cat" colspan="4" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td>
+ </tr>
+ </table>
+<?
+}
?>
</form>
@@ -1043,8 +1217,49 @@ function category_select($select_name, $group_id = -1)
return($group_select);
}
-// Build select for download modes
+// Extension group select
+function group_select($select_name, $default_group = -1)
+{
+ global $db, $user;
+
+ $group_select = '<select name="' . $select_name . '">';
+ $sql = 'SELECT group_id, group_name
+ FROM ' . EXTENSION_GROUPS_TABLE . '
+ ORDER BY group_name';
+ $result = $db->sql_query($sql);
+
+ $group_name = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $group_name[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $row['group_id'] = 0;
+ $row['group_name'] = $user->lang['NOT_ASSIGNED'];
+ $group_name[] = $row;
+
+ for ($i = 0; $i < count($group_name); $i++)
+ {
+ if ($default_group == -1)
+ {
+ $selected = ($i == 0) ? ' selected="selected"' : '';
+ }
+ else
+ {
+ $selected = ($group_name[$i]['group_id'] == $default_group) ? ' selected="selected"' : '';
+ }
+
+ $group_select .= '<option value="' . $group_name[$i]['group_id'] . '"' . $selected . '>' . $group_name[$i]['group_name'] . '</option>';
+ }
+
+ $group_select .= '</select>';
+
+ return $group_select;
+}
+
+// Build select for download modes
function download_select($select_name, $group_id = -1)
{
global $db, $user;
diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php
index 4a2ba30d10..75eb9e9d6b 100644
--- a/phpBB/adm/admin_board.php
+++ b/phpBB/adm/admin_board.php
@@ -332,6 +332,8 @@ switch ($mode)
$prune_yes = ($new['prune_enable']) ? 'checked="checked"' : '';
$prune_no = (!$new['prune_enable']) ? 'checked="checked"' : '';
+ $display_last_edited_yes = ($new['display_last_edited']) ? 'checked="checked"' : '';
+ $display_last_edited_no = (!$new['display_last_edited']) ? 'checked="checked"' : '';
?>
<tr>
<td class="row1" width="50%"><?php echo $user->lang['SITE_NAME']; ?>: </td>
@@ -383,6 +385,10 @@ switch ($mode)
<td class="row2"><input type="text" maxlength="3" size="3" name="edit_time" value="<?php echo $new['edit_time']; ?>" /></td>
</tr>
<tr>
+ <td class="row1"><?php echo $user->lang['DISPLAY_LAST_EDITED']; ?>: <br /><span class="gensmall"><?php echo $user->lang['DISPLAY_LAST_EDITED_EXPLAIN']; ?></span></td>
+ <td class="row2"><input type="radio" name="display_last_edited" value="1" <?php echo $display_last_edited_yes; ?> /><?php echo $user->lang['YES']; ?>&nbsp; &nbsp;<input type="radio" name="display_last_edited" value="0" <?php echo $display_last_edited_no; ?> /><?php echo $user->lang['NO']; ?></td>
+ </tr>
+ <tr>
<td class="row1"><?php echo $user->lang['FLOOD_INTERVAL']; ?>: <br /><span class="gensmall"><?php echo $user->lang['FLOOD_INTERVAL_EXPLAIN']; ?></span></td>
<td class="row2"><input type="text" size="3" maxlength="4" name="flood_interval" value="<?php echo $new['flood_interval']; ?>" /></td>
</tr>
diff --git a/phpBB/common.php b/phpBB/common.php
index c1524004dc..2f23b5ff91 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -137,6 +137,7 @@ define('CONFIG_TABLE', $table_prefix.'config');
define('CONFIRM_TABLE', $table_prefix.'confirm');
define('DISALLOW_TABLE', $table_prefix.'disallow'); //
define('EXTENSIONS_TABLE', $table_prefix.'extensions');
+define('FORBIDDEN_EXTENSIONS_TABLE', $table_prefix.'forbidden_extensions');
define('EXTENSION_GROUPS_TABLE', $table_prefix.'extension_groups');
define('FORUMS_TABLE', $table_prefix.'forums');
define('FORUMS_TRACK_TABLE', $table_prefix.'forums_marking');
diff --git a/phpBB/download.php b/phpBB/download.php
index be3a2f3c4c..fc5845bb97 100644
--- a/phpBB/download.php
+++ b/phpBB/download.php
@@ -115,7 +115,7 @@ function send_file_to_browser($real_filename, $mimetype, $physical_filename, $up
$gotit = FALSE;
- if (!intval($config['allow_ftp_upload']))
+ if (!intval($config['use_ftp_upload']))
{
if (@!file_exists($filename))
{
@@ -215,7 +215,7 @@ function send_file_to_browser($real_filename, $mimetype, $physical_filename, $up
}
readfile($filename);
}
-/* else if ((!$gotit) && (intval($config['allow_ftp_upload'])))
+/* else if ((!$gotit) && (intval($config['use_ftp_upload'])))
{
$conn_id = attach_init_ftp();
@@ -353,7 +353,7 @@ if (!$thumbnail)
// Determine the 'presenting'-method
if ($download_mode == PHYSICAL_LINK)
{
- if (intval($config['allow_ftp_upload']) && $config['upload_dir'] == '')
+ if (intval($config['use_ftp_upload']) && $config['upload_dir'] == '')
{
trigger_error('Physical Download not possible with the current Attachment Setting');
}
@@ -362,7 +362,7 @@ if ($download_mode == PHYSICAL_LINK)
}
else
{
- if (intval($config['allow_ftp_upload']))
+ if (intval($config['use_ftp_upload']))
{
// We do not need a download path, we are not downloading physically
send_file_to_browser($attachment['real_filename'], $attachment['mimetype'], $attachment['physical_filename'] , '', $attachment['attach_id']);
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 1922c13391..73f57d16f5 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -47,7 +47,7 @@ class bbcode
}
elseif (!$this->bbcode_bitfield)
{
- return;
+ return $message;
}
if (empty($this->bbcode_cache))
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 546531f863..3e0f0af014 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -239,17 +239,17 @@ function update_last_post_information($type, $id)
}
// Delete Attachment
-function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -1, $user_id = -1)
+function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = 'post', $user_id = -1)
{
global $db;
- // Generate Array, if it's not an array
- if ( ($post_id_array == -1) && ($attach_id_array == -1) && ($page == -1) )
+ if ($post_id_array == -1 && $attach_id_array == -1 && $page == -1)
{
return;
}
- if ( ($post_id_array == -1) && ($attach_id_array != -1) )
+ // Generate Array, if it's not an array
+ if ($post_id_array == -1 && $attach_id_array != -1)
{
$post_id_array = array();
@@ -272,17 +272,15 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
}
// Get the post_ids to fill the array
- $p_id = ($page == 'privmsgs') ? 'privmsgs_id' : 'post_id';
-
- $sql = "SELECT " . $p_id . "
- FROM " . ATTACHMENTS_TABLE . "
- WHERE attach_id IN (" . implode(', ', $attach_id_array) . ")
- GROUP BY " . $p_id;
+ $sql = 'SELECT ' . (($page == 'privmsgs') ? 'privmsgs_id' : 'post_id') . ' as id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE attach_id IN (' . implode(', ', $attach_id_array) . ')
+ GROUP BY id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
- $post_id_array[] = intval($row[$p_id]);
+ $post_id_array[] = intval($row['id']);
}
$db->sql_freeresult($result);
@@ -310,7 +308,6 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
else
{
$post_id = intval($post_id_array);
-
$post_id_array = array();
$post_id_array[] = $post_id;
}
@@ -327,12 +324,10 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
$attach_id_array = array();
// Get the attach_ids to fill the array
- $whereclause = ($page == 'privmsgs') ? 'WHERE privmsgs_id IN (' . implode(', ', $post_id_array) . ')' : 'WHERE post_id IN (' . implode(', ', $post_id_array) . ')';
-
- $sql = "SELECT attach_id
- FROM " . ATTACHMENTS_TABLE . " " .
- $whereclause . "
- GROUP BY attach_id";
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE ' . (($page == 'privmsgs') ? 'privmsgs_id' : 'post_id') . ' IN (' . implode(', ', $post_id_array) . ')
+ GROUP BY attach_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -360,7 +355,6 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
else
{
$attach_id = intval($attach_id_array);
-
$attach_id_array = array();
$attach_id_array[] = $attach_id;
}
@@ -378,9 +372,9 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
{
$post_id_array_2 = array();
- $sql = "SELECT privmsgs_type, privmsgs_to_userid, privmsgs_from_userid
- FROM " . PRIVMSGS_TABLE . "
- WHERE privmsgs_id IN (" . implode(', ', $post_id_array) . ")";
+ $sql = 'SELECT privmsgs_type, privmsgs_to_userid, privmsgs_from_userid
+ FROM ' . PRIVMSGS_TABLE . '
+ WHERE privmsgs_id IN (' . implode(', ', $post_id_array) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -395,18 +389,21 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
$post_id_array_2[] = $privmsgs_id;
}
break;
+
case PRIVMSGS_SENT_MAIL:
if ($row['privmsgs_from_userid'] == $user_id)
{
$post_id_array_2[] = $privmsgs_id;
}
break;
+
case PRIVMSGS_SAVED_OUT_MAIL:
if ($row['privmsgs_from_userid'] == $user_id)
{
$post_id_array_2[] = $privmsgs_id;
}
break;
+
case PRIVMSGS_SAVED_IN_MAIL:
if ($row['privmsgs_to_userid'] == $user_id)
{
@@ -424,36 +421,36 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
$sql_id = 'post_id';
}
- $sql = "DELETE FROM " . ATTACHMENTS_TABLE . "
- WHERE attach_id IN (" . implode(', ', $attach_id_array) . ")
- AND " . $sql_id . " IN (" . implode(', ', $post_id_array) . ")";
+ $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
+ WHERE attach_id IN (' . implode(', ', $attach_id_array) . ')
+ AND ' . $sql_id . ' IN (' . implode(', ', $post_id_array) . ')';
$db->sql_query($sql);
foreach ($attach_id_array as $attach_id)
{
- $sql = "SELECT attach_id
- FROM " . ATTACHMENTS_TABLE . "
- WHERE attach_id = " . $attach_id;
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE attach_id = ' . $attach_id;
$select_result = $db->sql_query($sql);
if (!is_array($db->sql_fetchrow($select_result)))
{
- $sql = "SELECT attach_id, physical_filename, thumbnail
- FROM " . ATTACHMENTS_DESC_TABLE . "
- WHERE attach_id = " . $attach_id;
+ $sql = 'SELECT attach_id, physical_filename, thumbnail
+ FROM ' . ATTACHMENTS_DESC_TABLE . '
+ WHERE attach_id = ' . $attach_id;
$result = $db->sql_query($sql);
// delete attachments
while ($row = $db->sql_fetchrow($result))
{
phpbb_unlink($row['physical_filename'], 'file', $config['use_ftp_upload']);
- if (intval($row['thumbnail']) == 1)
+ if (intval($row['thumbnail']))
{
phpbb_unlink($row['physical_filename'], 'thumbnail', $config['use_ftp_upload']);
}
- $sql = "DELETE FROM " . ATTACHMENTS_DESC_TABLE . "
- WHERE attach_id = " . $row['attach_id'];
+ $sql = 'DELETE FROM ' . ATTACHMENTS_DESC_TABLE . '
+ WHERE attach_id = ' . $row['attach_id'];
$db->sql_query($sql);
}
$db->sql_freeresult($result);
@@ -466,16 +463,16 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
{
foreach ($post_id_array as $privmsgs_id)
{
- $sql = "SELECT attach_id
- FROM " . ATTACHMENTS_TABLE . "
- WHERE privmsgs_id = " . $privmsgs_id;
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE privmsgs_id = ' . $privmsgs_id;
$select_result = $db->sql_query($sql);
if (!is_array($db->sql_fetchrow($select_result)))
{
- $sql = "UPDATE " . PRIVMSGS_TABLE . "
+ $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
SET privmsgs_attachment = 0
- WHERE privmsgs_id = " . $privmsgs_id;
+ WHERE privmsgs_id = ' . $privmsgs_id;
$db->sql_query($sql);
}
$db->sql_freeresult($select_result);
@@ -483,20 +480,20 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
}
else
{
- $sql = "SELECT topic_id
- FROM " . POSTS_TABLE . "
- WHERE post_id IN (" . implode(', ', $post_id_array) . ")
- GROUP BY topic_id";
+ $sql = 'SELECT topic_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_id IN (' . implode(', ', $post_id_array) . ')
+ GROUP BY topic_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_id = intval($row['topic_id']);
- $sql = "SELECT post_id
- FROM " . POSTS_TABLE . "
- WHERE topic_id = " . $topic_id . "
- GROUP BY post_id";
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE topic_id = ' . $topic_id . '
+ GROUP BY post_id';
$result2 = $db->sql_query($sql);
$post_ids = array();
@@ -511,30 +508,30 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -
{
$post_id_sql = implode(', ', $post_ids);
- $sql = "SELECT attach_id
- FROM " . ATTACHMENTS_TABLE . "
- WHERE post_id IN (" . $post_id_sql . ") ";
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE post_id IN (' . $post_id_sql . ') ';
$select_result = $db->sql_query_limit($sql, 1);
$set_id = ( !is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
$db->sql_freeresult($select_result);
- $sql = "UPDATE " . TOPICS_TABLE . "
- SET topic_attachment = " . $set_id . "
- WHERE topic_id = " . $topic_id;
+ $sql = 'UPDATE ' . TOPICS_TABLE . '
+ SET topic_attachment = ' . $set_id . '
+ WHERE topic_id = ' . $topic_id;
$db->sql_query($sql);
foreach ($post_ids as $post_id)
{
- $sql = "SELECT attach_id
- FROM " . ATTACHMENTS_TABLE . "
- WHERE post_id = " . $post_id;
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE post_id = ' . $post_id;
$select_result = $db->sql_query_limit($sql, 1);
$set_id = ( !is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
$db->sql_freeresult($select_result);
- $sql = "UPDATE " . POSTS_TABLE . "
- SET post_attachment = " . $set_id . "
- WHERE post_id = " . $post_id;
+ $sql = 'UPDATE ' . POSTS_TABLE . '
+ SET post_attachment = ' . $set_id . '
+ WHERE post_id = ' . $post_id;
$db->sql_query($sql);
}
}
@@ -549,8 +546,7 @@ function upload_attachment($filename)
global $_POST, $_FILES, $auth, $user, $config, $db;
$filedata = array();
- $filedata['error'] = false;
- $filedata['err_msg'] = '';
+ $filedata['error'] = array();
$filedata['post_attach'] = ($filename != '') ? true : false;
if (!$filedata['post_attach'])
@@ -573,8 +569,7 @@ function upload_attachment($filename)
// Check Extension
if (!in_array($filedata['extension'], $extensions['_allowed_']))
{
- $filedata['error'] = true;
- $filedata['err_msg'] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']);
+ $filedata['error'][] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']);
$filedata['post_attach'] = false;
return $filedata;
}
@@ -585,8 +580,7 @@ function upload_attachment($filename)
// check Filename
if ( preg_match("/[\\/:*?\"<>|]/i", $filename) )
{
- $filedata['error'] = true;
- $filedata['err_msg'] = sprintf($user->lang['INVALID_FILENAME'], $filename);
+ $filedata['error'][] = sprintf($user->lang['INVALID_FILENAME'], $filename);
$filedata['post_attach'] = false;
return $filedata;
}
@@ -594,34 +588,29 @@ function upload_attachment($filename)
// check php upload-size
if ( ($file == 'none') )
{
- $filedata['error'] = true;
- $filedata['err_msg'] = (@ini_get('upload_max_filesize') == '') ? $user->lang['ATTACHMENT_PHP_SIZE_NA'] : sprintf($user->lang['ATTACHMENT_PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+ $filedata['error'][] = (@ini_get('upload_max_filesize') == '') ? $user->lang['ATTACHMENT_PHP_SIZE_NA'] : sprintf($user->lang['ATTACHMENT_PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
$filedata['post_attach'] = false;
return $filedata;
}
-/*
// Check Image Size, if it is an image
- if ( (!$acl->gets('m_', 'a_')) && ($cat_id == IMAGE_CAT) )
+ if (!$acl->gets('m_', 'a_') && $cat_id == IMAGE_CAT)
{
- list($width, $height) = image_getdimension($file);
+ list($width, $height) = getimagesize($file);
- if ( ($width != 0) && ($height != 0) && (intval($attach_config['img_max_width']) != 0) && (intval($attach_config['img_max_height']) != 0) )
+ if ($width != 0 && $height != 0 && intval($config['img_max_width']) != 0 && intval($config['img_max_height']) != 0)
{
- if ( ($width > intval($attach_config['img_max_width'])) || ($height > intval($attach_config['img_max_height'])) )
+ if ($width > intval($config['img_max_width']) || $height > intval($attach_config['img_max_height']))
{
- $error = TRUE;
- if(!empty($error_msg))
- {
- $error_msg .= '<br />';
- }
- $error_msg .= sprintf($lang['Error_imagesize'], intval($attach_config['img_max_width']), intval($attach_config['img_max_height']));
+ $filedata['error'][] = sprintf($user->lang['Error_imagesize'], intval($attach_config['img_max_width']), intval($attach_config['img_max_height']));
+ $filedata['post_attach'] = false;
+ return $filedata;
}
}
}
-*/
+
// check Filesize
- if ( ($allowed_filesize != 0) && ($filedata['filesize'] > $allowed_filesize) && (!$acl->gets('m_', 'a_')) )
+ if ($allowed_filesize != 0 && $filedata['filesize'] > $allowed_filesize && !$acl->gets('m_', 'a_'))
{
$size_lang = ($allowed_filesize >= 1048576) ? $user->lang['MB'] : ( ($allowed_filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] );
@@ -634,8 +623,7 @@ function upload_attachment($filename)
$allowed_filesize = round($allowed_filesize / 1024 * 100) / 100;
}
- $filedata['error'] = true;
- $filedata['err_msg'] = sprintf($user->lang['ATTACHMENT_TOO_BIG'], $allowed_filesize, $size_lang);
+ $filedata['error'][] = sprintf($user->lang['ATTACHMENT_TOO_BIG'], $allowed_filesize, $size_lang);
$filedata['post_attach'] = false;
return $filedata;
}
@@ -645,8 +633,7 @@ function upload_attachment($filename)
{
if ($config['total_filesize'] + $filedata['filesize'] > $config['attachment_quota'])
{
- $filedata['error'] = true;
- $filedata['err_msg'] = $user->lang['ATTACH_QUOTA_REACHED'];
+ $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
$filedata['post_attach'] = false;
return $filedata;
}
@@ -718,9 +705,9 @@ function upload_attachment($filename)
/*
// Do we have to create a thumbnail ?
- if ( ($cat_id == IMAGE_CAT) && ($config['img_create_thumbnail']) )
+ if ($cat_id == IMAGE_CAT && $config['img_create_thumbnail'])
{
- $this->thumbnail = 1;
+ $filedata['thumbnail'] = 1;
}
*/
@@ -751,8 +738,7 @@ function upload_attachment($filename)
if ($result != '')
{
- $filedata['error'] = true;
- $filedata['err_msg'] = $result;
+ $filedata['error'][] = $result;
$filedata['post_attach'] = false;
}
return $filedata;
@@ -957,6 +943,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
'poster_ip' => $user->ip,
'post_approved' => ($auth->acl_get('f_moderate', $post_data['forum_id']) && !$auth->acl_get('f_ignorequeue', $post_data['forum_id'])) ? 0 : 1,
'post_edit_time' => ($mode == 'edit' && $post_data['poster_id'] == $user->data['user_id']) ? $current_time : 0,
+ 'post_edit_count' => ($mode == 'edit' && $post_data['poster_id'] == $user->data['user_id']) ? 'post_edit_count + 1' : 0,
'enable_sig' => $post_data['enable_sig'],
'enable_bbcode' => $post_data['enable_bbcode'],
'enable_html' => $post_data['enable_html'],
@@ -970,8 +957,8 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
if ($mode != 'edit')
{
$post_sql['post_time'] = $current_time;
-
}
+
if ($mode != 'edit' || $post_data['message_md5'] != $post_data['post_checksum'])
{
$post_sql = array_merge($post_sql, array(
@@ -980,7 +967,20 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
'post_encoding' => $user->lang['ENCODING']
));
}
- $sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_sql) . ' , post_edit_count = post_edit_count + 1 WHERE post_id = ' . $post_data['post_id'] : 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $post_sql);
+
+ if ($mode == 'edit')
+ {
+
+ $sql = 'UPDATE ' . POSTS_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $post_sql) .
+ (($post_data['poster_id'] == $user->data['user_id']) ? ' , post_edit_count = post_edit_count + 1' : '') . '
+ WHERE post_id = ' . $post_data['post_id'];
+ }
+ else
+ {
+ $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' .
+ $db->sql_build_array('INSERT', $post_sql);
+ }
$db->sql_query($sql);
$post_data['post_id'] = ($mode == 'edit') ? $post_data['post_id'] : $db->sql_nextid();
@@ -1212,6 +1212,60 @@ function user_notification($mode, $subject, $forum_id, $topic_id, $post_id)
}
}
+ $allowed_users = array();
+
+ $sql = "SELECT u.user_id
+ FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
+ WHERE tw.topic_id = $topic_id
+ AND tw.user_id NOT IN ($sql_ignore_users)
+ AND t.topic_id = tw.topic_id
+ AND u.user_id = tw.user_id";
+ $result = $db->sql_query($sql);
+ $ids = '';
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ids .= ($ids != '') ? ', ' . $row['user_id'] : $row['user_id'];
+ }
+ $db->sql_freeresult($result);
+
+ $sql = "SELECT a.user_id
+ FROM " . ACL_OPTIONS_TABLE . " ao, " . ACL_USERS_TABLE . " a
+ WHERE a.user_id IN (" . $ids . ")
+ AND ao.auth_option_id = a.auth_option_id
+ AND ao.auth_option = 'f_read'
+ AND a.forum_id = " . $forum_id;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $allowed_users[] = $row['user_id'];
+ }
+ $db->sql_freeresult($result);
+
+ // Now grab group settings ... users can belong to multiple groups so we grab
+ // the minimum setting for all options. ACL_NO overrides ACL_YES so act appropriatley
+ $sql = "SELECT ug.user_id, MIN(a.auth_setting) as min_setting
+ FROM " . USER_GROUP_TABLE . " ug, " . ACL_OPTIONS_TABLE . " ao, " . ACL_GROUPS_TABLE . " a
+ WHERE ug.user_id IN (" . $ids . ")
+ AND a.group_id = ug.group_id
+ AND ao.auth_option_id = a.auth_option_id
+ AND ao.auth_option = 'f_read'
+ AND a.forum_id = " . $forum_id . "
+ GROUP BY ao.auth_option, a.forum_id";
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['min_setting'] == 1)
+ {
+ $allowed_users[] = $row['user_id'];
+ }
+ }
+ $db->sql_freeresult($result);
+
+ $allowed_users = array_unique($allowed_users);
+
//
if ($topic_notification)
{
@@ -1241,7 +1295,7 @@ function user_notification($mode, $subject, $forum_id, $topic_id, $post_id)
$result = $db->sql_query($sql);
$email_users = array();
- $update_watched_sql_topic = $update_watched_sql_forum = '';
+ $update_watched_sql_topic = $update_watched_sql_forum = $delete_users_topic = '';
//
if ($row = $db->sql_fetchrow($result))
{
@@ -1259,16 +1313,21 @@ function user_notification($mode, $subject, $forum_id, $topic_id, $post_id)
$which_sql = ($topic_notification) ? 'update_watched_sql_topic' : 'update_watched_sql_forum';
do
{
- if (trim($row['user_email']) != '')
+ if (trim($row['user_email']) != '' && in_array($row['user_id'], $allowed_users))
{
$row['email_template'] = ($topic_notification) ? 'topic_notify' : 'newtopic_notify';
$email_users[] = $row;
$$which_sql .= ($$which_sql != '') ? ', ' . $row['user_id'] : $row['user_id'];
}
+ else if (!in_array($row['user_id'], $allowed_users))
+ {
+ $delete_users_topic .= ($delete_users_topic != '') ? ', ' . $row['user_id'] : $row['user_id'];
+ }
}
while ($row = $db->sql_fetchrow($result));
}
+ $db->sql_freeresult($result);
// Handle remaining Notifications (Forum)
if ($topic_notification)
@@ -1356,6 +1415,14 @@ function user_notification($mode, $subject, $forum_id, $topic_id, $post_id)
}
unset($bcc_list_ary);
+ if ($delete_users_topic != '')
+ {
+ $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
+ WHERE topic_id = " . $topic_id . "
+ AND user_id IN (" . $delete_users_topic . ")";
+ $db->sql_query($sql);
+ }
+
if ($update_watched_sql_topic != '')
{
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 9e7b2bc714..bac3348b40 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -576,8 +576,7 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
{
global $config, $_FILE, $_POST, $auth, $user;
- $error = false;
- $error_msg = '';
+ $error = array();
$num_attachments = count($this->attachment_data);
$this->filename_data['filecomment'] = ( isset($_POST['filecomment']) ) ? trim( strip_tags($_POST['filecomment'])) : '';
@@ -593,13 +592,9 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
{
$filedata = upload_attachment($this->filename_data['filename']);
- if ($filedata['error'])
- {
- $error = true;
- $error_msg .= (!empty($error_msg)) ? '<br />' . $filedata['err_msg'] : $filedata['err_msg'];
- }
+ $error = $filedata['error'];
- if (($filedata['post_attach']) && (!$error))
+ if (($filedata['post_attach']) && (!count($error)))
{
$new_entry = array(
'physical_filename' => $filedata['destination_filename'],
@@ -629,12 +624,11 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
}
else
{
- $error = true;
- $error_msg .= (!empty($error_msg)) ? '<br />' : '' . sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
+ $error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
}
}
- if ($preview || $refresh || $error)
+ if ($preview || $refresh || count($error))
{
// Perform actions on temporary attachments
if ($delete_file)
@@ -675,17 +669,13 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
if ((($add_file) || ($preview) ) && ($this->filename_data['filename'] != '') )
{
- if ( $num_attachments < $config['max_attachments'] ) //|| $auth->acl_gets('m_', 'a_', $forum_id) )
+ if ($num_attachments < $config['max_attachments'] || $auth->acl_gets('m_', 'a_'))
{
$filedata = upload_attachment($this->filename_data['filename']);
- if ($filedata['error'])
- {
- $error = true;
- $error_msg .= (!empty($error_msg)) ? '<br />' . $filedata['err_msg'] : $filedata['err_msg'];
- }
+ $error = array_merge($error, $filedata['error']);
- if (!$error)
+ if (!count($error))
{
$new_entry = array(
'physical_filename' => $filedata['destination_filename'],
@@ -705,14 +695,13 @@ echo "<pre><hr>processing <b>$username</b><hr></pre>";
}
else
{
- $error = true;
- $error_msg .= (!empty($error_msg)) ? '<br />' : '' . sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
+ $error[] = sprintf($user->lang['TOO_MANY_ATTACHMENTS'], $config['max_attachments']);
}
}
}
}
- return ($error_msg);
+ return ($error);
}
// Parse Poll
diff --git a/phpBB/install/install.php b/phpBB/install/install.php
index d060f7acb7..693fb55a0c 100644
--- a/phpBB/install/install.php
+++ b/phpBB/install/install.php
@@ -38,9 +38,9 @@ require($phpbb_root_path . 'includes/functions.'.$phpEx);
// Set some vars
define('ANONYMOUS', 1);
-define('ACL_DENY', 0);
-define('ACL_ALLOW', 1);
-define('ACL_INHERIT', 2);
+define('ACL_NO', 0);
+define('ACL_YES', 1);
+define('ACL_UNSET', -1);
$default_language = 'en';
$default_template = 'subSilver';
@@ -215,7 +215,7 @@ else if (!empty($_POST['send_file']) && $_POST['send_file'] == 2 && !defined("PH
$s_hidden_fields .= '<input type="hidden" name="upgrade" value="1" />';
}
- page_header($lang['FTP_INSTRUCTS']);
+ inst_page_header($lang['FTP_INSTRUCTS']);
?>
<tr>
@@ -236,7 +236,7 @@ else if (!empty($_POST['send_file']) && $_POST['send_file'] == 2 && !defined("PH
<?php
page_common_form($s_hidden_fields, $lang['TRANSFER_CONFIG']);
- page_footer();
+ inst_page_footer();
exit;
}
@@ -254,7 +254,7 @@ else if (!empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED"))
$s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($_POST['config_data']) . '" />';
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />';
- page_header($lang['NO_FTP_CONFIG'], "install.$phpEx");
+ inst_page_header($lang['NO_FTP_CONFIG'], "install.$phpEx");
if ($upgrade)
{
@@ -281,7 +281,7 @@ else if (!empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED"))
page_common_form($s_hidden_fields, $lang['DOWNLOAD_CONFIG']);
}
- page_footer($lang['DOWNLOAD_CONFIG'], $s_hidden_fields);
+ inst_page_footer($lang['DOWNLOAD_CONFIG'], $s_hidden_fields);
exit;
}
else
@@ -321,8 +321,8 @@ else if (!empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED"))
// Log user in
$auth->login($admin_name, $admin_pass1);
- page_header($lang['INST_STEP_2'], "../adm/index.$phpEx$SID");
- page_footer($lang['FINISH_INSTALL'], $s_hidden_fields);
+ inst_page_header($lang['INST_STEP_2'], "../adm/index.$phpEx$SID");
+ inst_page_footer($lang['FINISH_INSTALL'], $s_hidden_fields);
exit;
}
}
@@ -378,7 +378,7 @@ else if ((empty($install_step) || $admin_pass1 != $admin_pass2 || $board_email1
}
}
- $lang_options = language_select($language, 'language', '../language');
+ $lang_options = inst_language_select($language);
foreach($available_dbms as $dbms_name => $details)
{
@@ -392,7 +392,7 @@ else if ((empty($install_step) || $admin_pass1 != $admin_pass2 || $board_email1
$s_hidden_fields = '<input type="hidden" name="install_step" value="1" />';
- page_header($instruction_text, "install.$phpEx");
+ inst_page_header($instruction_text, "install.$phpEx");
?>
<tr>
@@ -482,7 +482,7 @@ else if ((empty($install_step) || $admin_pass1 != $admin_pass2 || $board_email1
</tr>
<?php
- page_footer($lang['START_INSTALL'], $s_hidden_fields, "install.$phpEx");
+ inst_page_footer($lang['START_INSTALL'], $s_hidden_fields, "install.$phpEx");
exit;
}
@@ -565,9 +565,9 @@ else
if (!$loaded_extension)
{
- page_header($lang['INSTALL'], '');
+ inst_page_header($lang['INSTALL'], '');
page_error($lang['INSTALLER_ERROR'], $lang['INSTALL_EXT_FAILED']);
- page_footer();
+ inst_page_footer();
exit;
}
}
@@ -614,9 +614,9 @@ else
if (!$db->sql_query($sql))
{
$error = $db->sql_error();
- page_header($lang['INSTALL'], '');
+ inst_page_header($lang['INSTALL'], '');
page_error($lang['INSTALLER_ERROR'], $lang['INSTALL_DB_ERROR'] . '<br />' . $error['message']);
- page_footer();
+ inst_page_footer();
exit;
}
}
@@ -634,9 +634,9 @@ else
if (!$db->sql_query($sql))
{
$error = $db->sql_error();
- page_header($lang['INSTALL'], '');
+ inst_page_header($lang['INSTALL'], '');
page_error($lang['INSTALLER_ERROR'], $lang['INSTALL_DB_ERROR'] . '<br />' . $error['message']);
- page_footer();
+ inst_page_footer();
exit;
}
}
@@ -688,9 +688,9 @@ else
if (!$db->sql_query($sql))
{
$error = $db->sql_error();
- page_header($lang['INSTALL'], '');
+ inst_page_header($lang['INSTALL'], '');
page_error($lang['INSTALLER_ERROR'], $lang['INSTALL_DB_ERROR'] . '<br />' . $error['message']);
- page_footer();
+ inst_page_footer();
exit;
}
}
@@ -724,7 +724,7 @@ else
if (extension_loaded('ftp') && !defined('NO_FTP'))
{
- page_header($lang['UNWRITEABLE_CONFIG'] . '<p>' . $lang['FTP_OPTION'] . '</p>');
+ inst_page_header($lang['UNWRITEABLE_CONFIG'] . '<p>' . $lang['FTP_OPTION'] . '</p>');
?>
<tr>
<th colspan="2"><?php echo $lang['FTP_CHOOSE']; ?></th>
@@ -741,7 +741,7 @@ else
}
else
{
- page_header($lang['UNWRITEABLE_CONFIG']);
+ inst_page_header($lang['UNWRITEABLE_CONFIG']);
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />';
}
@@ -769,7 +769,7 @@ else
page_common_form($s_hidden_fields, $lang['DOWNLOAD_CONFIG']);
}
- page_footer();
+ inst_page_footer();
exit;
}
@@ -805,8 +805,8 @@ else
// Log user in
$auth->login($admin_name, $admin_pass1);
- page_header($lang['INST_STEP_2'], "../adm/index.$phpEx$SID");
- page_footer($lang['FINISH_INSTALL'], $s_hidden_fields);
+ inst_page_header($lang['INST_STEP_2'], "../adm/index.$phpEx$SID");
+ inst_page_footer($lang['FINISH_INSTALL'], $s_hidden_fields);
exit;
}
}
@@ -826,7 +826,7 @@ function slash_input_data(&$data)
}
// Output page -> header
-function page_header($l_instructions, $s_action)
+function inst_page_header($l_instructions, $s_action)
{
global $phpEx, $lang;
@@ -866,7 +866,7 @@ td.cat { background-image: url('../adm/images/cellpic1.gif') }
}
// Output page -> footer
-function page_footer($l_submit, $s_hidden_fields)
+function inst_page_footer($l_submit, $s_hidden_fields)
{
global $lang;
@@ -926,4 +926,41 @@ function page_error($error_title, $error)
}
+function inst_language_select($default = '')
+{
+ global $phpbb_root_path, $phpEx;
+
+ $dir = @opendir($phpbb_root_path . 'language');
+ $user = array();
+
+ while ($file = readdir($dir))
+ {
+ $path = $phpbb_root_path . 'language/' . $file;
+
+ if (is_file($path) || is_link($path) || $file == '.' || $file == '..')
+ {
+ continue;
+ }
+
+ if (file_exists($path . '/iso.txt'))
+ {
+ list($displayname) = @file($path . '/iso.txt');
+ $lang[$displayname] = $file;
+ }
+ }
+ @closedir($dir);
+
+ @asort($lang);
+ @reset($lang);
+
+ foreach ($lang as $displayname => $filename)
+ {
+ $selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
+ $user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
+ }
+
+ return $user_select;
+}
+
+
?> \ No newline at end of file
diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql
index 6a6721613a..ff20ff8703 100644
--- a/phpBB/install/schemas/mysql_basic.sql
+++ b/phpBB/install/schemas/mysql_basic.sql
@@ -69,6 +69,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','address@yourdomain.tld');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact','contact@yourdomain.tld');
@@ -95,10 +96,26 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('lastread', '432000
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_ftp_upload', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize', '262144');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize_pm','262144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_dir', 'files');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_display_inlined', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('ftp_server', '');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('ftp_path','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('download_path','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('ftp_user','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('ftp_pass','');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('ftp_pasv_mode','1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_display_inlined','1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_width','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_height','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_width','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_height','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_create_thumbnail','0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_min_thumb_filesize','12000');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_imagick', '');
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_id', '2', 1);
diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php
index 2e241ae194..aa12af119f 100644
--- a/phpBB/language/en/lang_admin.php
+++ b/phpBB/language/en/lang_admin.php
@@ -549,6 +549,8 @@ $lang = array_merge($lang, array(
'BOXES_LIMIT_EXPLAIN' => 'Users are limited to no more than this many messages in each of their private message boxes. Enter 0 for unlimited messages.',
'EDIT_TIME' => 'Limit editing time',
'EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a new post, zero equals infinity',
+ 'DISPLAY_LAST_EDITED' => 'Display last edited time information',
+ 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts',
'FLOOD_INTERVAL' => 'Flood Interval',
'FLOOD_INTERVAL_EXPLAIN' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.',
'SEARCH_INTERVAL' => 'Search Flood Interval',
@@ -1012,6 +1014,16 @@ $lang = array_merge($lang, array(
'EXTENSION_GROUPS_UPDATED' => 'Extension Groups updated successfully',
'EXTENSION_GROUP_EXIST' => 'The Extension Group %s already exist',
+ 'MANAGE_EXTENSIONS' => 'Manage Extensions',
+ 'MANAGE_EXTENSIONS_EXPLAIN' => 'Here you can manage your allowed and forbidden file extensions. You are not able to manage forbidden file extensions with the extension groups management panel. To allow or disallow not forbidden file extensions, use the extension groups management panel.',
+ 'COMMENT' => 'Comment',
+ 'EXTENSION' => 'Extension',
+ 'ADD_EXTENSION' => 'Add extension',
+ 'EXTENSIONS_UPDATED' => 'Extensions successfully updated',
+ 'EXTENSION_EXIST' => 'The Extension %s already exist',
+ 'CANNOT_ADD_FORBIDDEN_EXTENSION' => 'The Extension %s is forbidden, you are not able to add it to the allowed Extensions',
+ 'NOT_ASSIGNED' => 'Not assigned',
+
'WELCOME_INSTALL' => 'Welcome to phpBB 2 Installation',
'INITIAL_CONFIG' => 'Basic Configuration',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 2864310d61..cf52fdb822 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -650,9 +650,11 @@ if ($submit || $preview || $refresh)
}
}
- if (($result = $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh)) != '')
+ $result = $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh);
+
+ if (count($result))
{
- $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result;
+ $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . implode('<br />', $result);
}
if ($mode != 'edit' && !$preview && !$refresh && !$perm['f_ignoreflood'])
@@ -822,11 +824,11 @@ if ($preview)
$bbcode = new bbcode($message_parser->bbcode_bitfield);
$preview_message = format_display($message_parser->message, $enable_html, $enable_bbcode, $message_parser->bbcode_uid, $enable_urls, $enable_smilies, $enable_sig);
-
+
$preview_subject = (sizeof($censors)) ? preg_replace($censors['match'], $censors['replace'], $subject) : $subject;
// Poll Preview
- if ( ( ($mode == 'post') || ( ($mode == 'edit') && ($post_id == $topic_first_post_id) && (empty($poll_last_vote)) )) && ( ($auth->acl_get('f_poll', $forum_id)) || ($auth->acl_get('m_edit', $forum_id)) ))
+ if ( ($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && empty($poll_last_vote))) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)) )
{
decode_text($poll_title, $message_parser->bbcode_uid);
$preview_poll_title = format_display(stripslashes($poll_title), $enable_html, $enable_bbcode, $message_parser->bbcode_uid, $enable_urls, $enable_smilies, false, false);
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index a480ca961f..d0084dd9bb 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1045,9 +1045,9 @@ foreach ($rowset as $key => $row)
// Editing information
- if (!empty($row['post_edit_count']))
+ if (!empty($row['post_edit_count']) && $config['display_last_edited'])
{
- $l_edit_time_total = ($row['post_edit_count'] == 1) ? $user->lang['Edited_time_total'] : $user->lang['Edited_times_total'];
+ $l_edit_time_total = ($row['post_edit_count'] == 1) ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $row['poster'], $user->format_date($row['post_edit_time']), $row['post_edit_count']);
}
@@ -1236,7 +1236,7 @@ foreach ($rowset as $key => $row)
// Images, but display Thumbnail
// NOTE: If you want to use the download.php everytime an thumnmail is displayed inlined, use this line:
// $thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'] . '&amp;thumb=1';
- if (!empty($config['allow_ftp_upload']) && trim($config['upload_dir']) == '')
+ if (!empty($config['use_ftp_upload']) && trim($config['upload_dir']) == '')
{
$thumb_source = $phpbb_root_path . "download.$phpEx$SID&amp;id=" . $attachment['attach_id'] . '&thumb=1';
}