aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/acp/acp_forums.php81
-rw-r--r--phpBB/includes/functions_acp.php37
-rw-r--r--phpBB/includes/functions_content.php21
-rw-r--r--phpBB/includes/functions_display.php68
-rw-r--r--phpBB/includes/functions_mcp.php95
-rw-r--r--phpBB/includes/functions_posting.php345
-rw-r--r--phpBB/includes/functions_privmsgs.php110
-rw-r--r--phpBB/includes/mcp/mcp_forum.php97
8 files changed, 420 insertions, 434 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index dd9ff37773..7f1e629875 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -944,63 +944,62 @@ class acp_forums
/**
* Update forum data
*/
- function update_forum_data(&$forum_data)
+ function update_forum_data(&$forum_data_ary)
{
global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
$errors = array();
- $forum_data_ary = $forum_data;
+ $forum_data = $forum_data_ary;
/**
* Validate the forum data before we create/update the forum
*
* @event core.acp_manage_forums_validate_data
- * @var array forum_data_ary Array with new forum data
+ * @var array forum_data Array with new forum data
* @var array errors Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1
- * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
- $vars = array('forum_data_ary', 'errors');
+ $vars = array('forum_data', 'errors');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars)));
- $forum_data = $forum_data_ary;
- unset($forum_data_ary);
+ $forum_data_ary = $forum_data;
+ unset($forum_data);
- if ($forum_data['forum_name'] == '')
+ if ($forum_data_ary['forum_name'] == '')
{
$errors[] = $user->lang['FORUM_NAME_EMPTY'];
}
- if (utf8_strlen($forum_data['forum_desc']) > 4000)
+ if (utf8_strlen($forum_data_ary['forum_desc']) > 4000)
{
$errors[] = $user->lang['FORUM_DESC_TOO_LONG'];
}
- if (utf8_strlen($forum_data['forum_rules']) > 4000)
+ if (utf8_strlen($forum_data_ary['forum_rules']) > 4000)
{
$errors[] = $user->lang['FORUM_RULES_TOO_LONG'];
}
- if ($forum_data['forum_password'] || $forum_data['forum_password_confirm'])
+ if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm'])
{
- if ($forum_data['forum_password'] != $forum_data['forum_password_confirm'])
+ if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm'])
{
- $forum_data['forum_password'] = $forum_data['forum_password_confirm'] = '';
+ $forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = '';
$errors[] = $user->lang['FORUM_PASSWORD_MISMATCH'];
}
}
- if ($forum_data['prune_days'] < 0 || $forum_data['prune_viewed'] < 0 || $forum_data['prune_freq'] < 0)
+ if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0)
{
- $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0;
+ $forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0;
$errors[] = $user->lang['FORUM_DATA_NEGATIVE'];
}
$range_test_ary = array(
- array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'),
+ array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'),
);
- if (!empty($forum_data['forum_image']) && !file_exists($phpbb_root_path . $forum_data['forum_image']))
+ if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))
{
$errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];
}
@@ -1014,17 +1013,17 @@ class acp_forums
// 8 = prune stickies
// 16 = show active topics
// 32 = enable post review
- $forum_data['forum_flags'] = 0;
- $forum_data['forum_flags'] += ($forum_data['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0;
- $forum_data['forum_flags'] += ($forum_data['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0;
- $forum_data['forum_flags'] += ($forum_data['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
- $forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0;
- $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
- $forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0;
- $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;
+ $forum_data_ary['forum_flags'] = 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0;
+ $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;
// Unset data that are not database fields
- $forum_data_sql = $forum_data;
+ $forum_data_sql = $forum_data_ary;
unset($forum_data_sql['forum_link_track']);
unset($forum_data_sql['prune_old_polls']);
@@ -1062,22 +1061,21 @@ class acp_forums
}
unset($forum_data_sql['forum_password_unset']);
- $forum_data_ary = $forum_data;
+ $forum_data = $forum_data_ary;
/**
* Remove invalid values from forum_data_sql that should not be updated
*
* @event core.acp_manage_forums_update_data_before
- * @var array forum_data_ary Array with forum data
+ * @var array forum_data Array with forum data
* @var array forum_data_sql Array with data we are going to update
* If forum_data_sql[forum_id] is set, we update
* that forum, otherwise a new one is created.
* @since 3.1.0-a1
- * @change 3.2.0-a1 Replaced forum_data by forum_data_ary
*/
- $vars = array('forum_data_ary', 'forum_data_sql');
+ $vars = array('forum_data', 'forum_data_sql');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars)));
- $forum_data = $forum_data_ary;
- unset($forum_data_ary);
+ $forum_data_ary = $forum_data;
+ unset($forum_data);
$is_new_forum = !isset($forum_data_sql['forum_id']);
@@ -1134,9 +1132,9 @@ class acp_forums
$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql);
$db->sql_query($sql);
- $forum_data['forum_id'] = $db->sql_nextid();
+ $forum_data_ary['forum_id'] = $db->sql_nextid();
- $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data['forum_name']));
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name']));
}
else
{
@@ -1351,17 +1349,17 @@ class acp_forums
$db->sql_query($sql);
// Add it back
- $forum_data['forum_id'] = $forum_id;
+ $forum_data_ary['forum_id'] = $forum_id;
- $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data['forum_name']));
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name']));
}
- $forum_data_ary = $forum_data;
+ $forum_data = $forum_data_ary;
/**
* Event after a forum was updated or created
*
* @event core.acp_manage_forums_update_data_after
- * @var array forum_data_ary Array with forum data
+ * @var array forum_data Array with forum data
* @var array forum_data_sql Array with data we updated
* @var bool is_new_forum Did we create a forum or update one
* If you want to overwrite this value,
@@ -1369,12 +1367,11 @@ class acp_forums
* @var array errors Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1
- * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
- $vars = array('forum_data_ary', 'forum_data_sql', 'is_new_forum', 'errors');
+ $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars)));
- $forum_data = $forum_data_ary;
- unset($forum_data_ary);
+ $forum_data_ary = $forum_data;
+ unset($forum_data);
return $errors;
}
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 390b59b9e9..f6c01c46ff 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -230,7 +230,7 @@ function h_radio($name, $input_ary, $input_default = false, $id = false, $key =
/**
* Build configuration template for acp configuration pages
*/
-function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
+function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars)
{
global $user, $module, $phpbb_dispatcher;
@@ -238,18 +238,18 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$name = 'config[' . $config_key . ']';
// Make sure there is no notice printed out for non-existent config options (we simply set them)
- if (!isset($new[$config_key]))
+ if (!isset($new_ary[$config_key]))
{
- $new[$config_key] = '';
+ $new_ary[$config_key] = '';
}
switch ($tpl_type[0])
{
case 'password':
- if ($new[$config_key] !== '')
+ if ($new_ary[$config_key] !== '')
{
// replace passwords with asterixes
- $new[$config_key] = '********';
+ $new_ary[$config_key] = '********';
}
case 'text':
case 'url':
@@ -267,7 +267,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
- $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
+ $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new_ary[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
break;
case 'number':
@@ -279,7 +279,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$maxlength = strlen( (string) $max );
}
- $tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new[$config_key] . '" />';
+ $tpl = '<input id="' . $key . '" type="number" maxlength="' . (( $maxlength != '' ) ? $maxlength : 255) . '"' . (( $min != '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="' . $name . '" value="' . $new_ary[$config_key] . '" />';
break;
case 'dimension':
@@ -293,19 +293,19 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$size = $maxlength = strlen( (string) $max );
}
- $tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new[$config_key . '_height'] . '" />';
+ $tpl = '<input id="' . $key . '" type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_width]" value="' . $new_ary[$config_key . '_width'] . '" /> x <input type="number"' . (( $size != '' ) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength != '') ? $maxlength : 255) . '"' . (( $min !== '' ) ? ' min="' . $min . '"' : '') . (( $max != '' ) ? ' max="' . $max . '"' : '') . ' name="config[' . $config_key . '_height]" value="' . $new_ary[$config_key . '_height'] . '" />';
break;
case 'textarea':
$rows = (int) $tpl_type[1];
$cols = (int) $tpl_type[2];
- $tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new[$config_key] . '</textarea>';
+ $tpl = '<textarea id="' . $key . '" name="' . $name . '" rows="' . $rows . '" cols="' . $cols . '">' . $new_ary[$config_key] . '</textarea>';
break;
case 'radio':
- $key_yes = ($new[$config_key]) ? ' checked="checked"' : '';
- $key_no = (!$new[$config_key]) ? ' checked="checked"' : '';
+ $key_yes = ($new_ary[$config_key]) ? ' checked="checked"' : '';
+ $key_no = (!$new_ary[$config_key]) ? ' checked="checked"' : '';
$tpl_type_cond = explode('_', $tpl_type[1]);
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
@@ -342,7 +342,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
switch ($value)
{
case '{CONFIG_VALUE}':
- $value = $new[$config_key];
+ $value = $new_ary[$config_key];
break;
case '{KEY}':
@@ -355,7 +355,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
}
else
{
- $args = array($new[$config_key], $key);
+ $args = array($new_ary[$config_key], $key);
}
$return = call_user_func_array($call, $args);
@@ -383,7 +383,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$tpl .= $vars['append'];
}
- $new_ary = $new;
+ $new = $new_ary;
/**
* Overwrite the html code we display for the config value
*
@@ -393,17 +393,16 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
* 1 [optional] => string: size, int: minimum
* 2 [optional] => string: max. length, int: maximum
* @var string key Should be used for the id attribute in html
- * @var array new_ary Array with the config values we display
+ * @var array new Array with the config values we display
* @var string name Should be used for the name attribute
* @var array vars Array with the options for the config
* @var string tpl The resulting html code we display
* @since 3.1.0-a1
- * @change 3.2.0-a1 Replaced new with new_ary
*/
- $vars = array('tpl_type', 'key', 'new_ary', 'name', 'vars', 'tpl');
+ $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl');
extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars)));
- $new = $new_ary;
- unset($new_ary);
+ $new_ary = $new;
+ unset($new);
return $tpl;
}
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index b87220caa5..997cafdea4 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -957,10 +957,10 @@ function smiley_text($text, $force_option = false)
* @param mixed $forum_id The forum id the attachments are displayed in (false if in private message)
* @param string &$message The post/private message
* @param array &$attachments The attachments to parse for (inline) display. The attachments array will hold templated data after parsing.
-* @param array &$update_count The attachment counts to be updated - will be filled
+* @param array &$update_count_ary The attachment counts to be updated - will be filled
* @param bool $preview If set to true the attachments are parsed for preview. Within preview mode the comments are fetched from the given $attachments array and not fetched from the database.
*/
-function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $preview = false)
+function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false)
{
if (!sizeof($attachments))
{
@@ -1159,7 +1159,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'U_INLINE_LINK' => $inline_link,
);
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
// Images, but display Thumbnail
@@ -1172,7 +1172,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'THUMB_IMAGE' => $thumbnail_link,
);
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
// Macromedia Flash Files
@@ -1187,7 +1187,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
// Viewed/Heared File ... update the download count
- $update_count[] = $attachment['attach_id'];
+ $update_count_ary[] = $attachment['attach_id'];
break;
default:
@@ -1210,7 +1210,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
}
- $update_count_ary = $update_count;
+ $update_count = $update_count_ary;
/**
* Use this event to modify the attachment template data.
*
@@ -1224,9 +1224,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
* @var array extensions Array with attachment extensions data
* @var mixed forum_id The forum id the attachments are displayed in (false if in private message)
* @var bool preview Flag indicating if we are in post preview mode
- * @var array update_count_ary Array with attachment ids to update download count
+ * @var array update_count Array with attachment ids to update download count
* @since 3.1.0-RC5
- * @change 3.2.0-a1 Replaced update_count with update_count_ary
*/
$vars = array(
'attachment',
@@ -1236,11 +1235,11 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'extensions',
'forum_id',
'preview',
- 'update_count_ary',
+ 'update_count',
);
extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars)));
- $update_count = $update_count_ary;
- unset($update_count_ary);
+ $update_count_ary = $update_count;
+ unset($update_count);
$template->assign_block_vars('_file', $block_array);
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 9e45f32689..e3412c9875 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -750,12 +750,12 @@ function generate_forum_rules(&$forum_data)
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
-function generate_forum_nav(&$forum_data)
+function generate_forum_nav(&$forum_data_ary)
{
global $db, $user, $template, $auth, $config;
global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
- if (!$auth->acl_get('f_list', $forum_data['forum_id']))
+ if (!$auth->acl_get('f_list', $forum_data_ary['forum_id']))
{
return;
}
@@ -763,7 +763,7 @@ function generate_forum_nav(&$forum_data)
$navlinks = $navlinks_parents = $forum_template_data = array();
// Get forum parents
- $forum_parents = get_forum_parents($forum_data);
+ $forum_parents = get_forum_parents($forum_data_ary);
$microdata_attr = 'data-forum-id';
@@ -793,46 +793,45 @@ function generate_forum_nav(&$forum_data)
}
$navlinks = array(
- 'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
- 'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
- 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
- 'FORUM_NAME' => $forum_data['forum_name'],
- 'FORUM_ID' => $forum_data['forum_id'],
- 'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"',
- 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']),
+ 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false,
+ 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false,
+ 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false,
+ 'FORUM_NAME' => $forum_data_ary['forum_name'],
+ 'FORUM_ID' => $forum_data_ary['forum_id'],
+ 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"',
+ 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']),
);
$forum_template_data = array(
- 'FORUM_ID' => $forum_data['forum_id'],
- 'FORUM_NAME' => $forum_data['forum_name'],
- 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),
+ 'FORUM_ID' => $forum_data_ary['forum_id'],
+ 'FORUM_NAME' => $forum_data_ary['forum_name'],
+ 'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']),
- 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
+ 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data_ary['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data_ary['forum_options'])) ? true : false,
);
- $forum_data_ary = $forum_data;
+ $forum_data = $forum_data_ary;
/**
* Event to modify the navlinks text
*
* @event core.generate_forum_nav
- * @var array forum_data_ary Array with the forum data
+ * @var array forum_data Array with the forum data
* @var array forum_template_data Array with generic forum template data
* @var string microdata_attr The microdata attribute
* @var array navlinks_parents Array with the forum parents navlinks data
* @var array navlinks Array with the forum navlinks data
* @since 3.1.5-RC1
- * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
$vars = array(
- 'forum_data_ary',
+ 'forum_data',
'forum_template_data',
'microdata_attr',
'navlinks_parents',
'navlinks',
);
extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));
- $forum_data = $forum_data_ary;
- unset($forum_data_ary);
+ $forum_data_ary = $forum_data;
+ unset($forum_data);
$template->assign_block_vars_array('navlinks', $navlinks_parents);
$template->assign_block_vars('navlinks', $navlinks);
@@ -1164,14 +1163,14 @@ function display_reasons($reason_id = 0)
/**
* Display user activity (action forum/topic)
*/
-function display_user_activity(&$userdata)
+function display_user_activity(&$userdata_ary)
{
global $auth, $template, $db, $user;
global $phpbb_root_path, $phpEx;
global $phpbb_container, $phpbb_dispatcher;
// Do not display user activity for users having more than 5000 posts...
- if ($userdata['user_posts'] > 5000)
+ if ($userdata_ary['user_posts'] > 5000)
{
return;
}
@@ -1198,7 +1197,7 @@ function display_user_activity(&$userdata)
// Obtain active forum
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . '
+ WHERE poster_id = ' . $userdata_ary['user_id'] . '
AND post_postcount = 1
AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
GROUP BY forum_id
@@ -1220,7 +1219,7 @@ function display_user_activity(&$userdata)
// Obtain active topic
$sql = 'SELECT topic_id, COUNT(post_id) AS num_posts
FROM ' . POSTS_TABLE . '
- WHERE poster_id = ' . $userdata['user_id'] . '
+ WHERE poster_id = ' . $userdata_ary['user_id'] . '
AND post_postcount = 1
AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
GROUP BY topic_id
@@ -1240,24 +1239,23 @@ function display_user_activity(&$userdata)
}
}
- $userdata_ary = $userdata;
+ $userdata = $userdata_ary;
/**
* Alter list of forums and topics to display as active
*
* @event core.display_user_activity_modify_actives
- * @var array userdata_ary User's data
+ * @var array userdata User's data
* @var array active_f_row List of active forums
* @var array active_t_row List of active posts
* @since 3.1.0-RC3
- * @change 3.2.0-a1 Replaced userdata with userdata_ary
*/
- $vars = array('userdata_ary', 'active_f_row', 'active_t_row');
+ $vars = array('userdata', 'active_f_row', 'active_t_row');
extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars)));
- $userdata = $userdata_ary;
- unset($userdata_ary);
+ $userdata_ary = $userdata;
+ unset($userdata);
- $userdata['active_t_row'] = $active_t_row;
- $userdata['active_f_row'] = $active_f_row;
+ $userdata_ary['active_t_row'] = $active_t_row;
+ $userdata_ary['active_f_row'] = $active_f_row;
$active_f_name = $active_f_id = $active_f_count = $active_f_pct = '';
if (!empty($active_f_row['num_posts']))
@@ -1265,7 +1263,7 @@ function display_user_activity(&$userdata)
$active_f_name = $active_f_row['forum_name'];
$active_f_id = $active_f_row['forum_id'];
$active_f_count = $active_f_row['num_posts'];
- $active_f_pct = ($userdata['user_posts']) ? ($active_f_count / $userdata['user_posts']) * 100 : 0;
+ $active_f_pct = ($userdata_ary['user_posts']) ? ($active_f_count / $userdata_ary['user_posts']) * 100 : 0;
}
$active_t_name = $active_t_id = $active_t_count = $active_t_pct = '';
@@ -1274,10 +1272,10 @@ function display_user_activity(&$userdata)
$active_t_name = $active_t_row['topic_title'];
$active_t_id = $active_t_row['topic_id'];
$active_t_count = $active_t_row['num_posts'];
- $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0;
+ $active_t_pct = ($userdata_ary['user_posts']) ? ($active_t_count / $userdata_ary['user_posts']) * 100 : 0;
}
- $l_active_pct = ($userdata['user_id'] != ANONYMOUS && $userdata['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE'];
+ $l_active_pct = ($userdata_ary['user_id'] != ANONYMOUS && $userdata_ary['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE'];
$template->assign_vars(array(
'ACTIVE_FORUM' => $active_f_name,
diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php
index f9e38e8aa0..dfe3fefbd0 100644
--- a/phpBB/includes/functions_mcp.php
+++ b/phpBB/includes/functions_mcp.php
@@ -367,12 +367,12 @@ function phpbb_get_pm_data($pm_ids)
* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table
* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table
*/
-function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
+function phpbb_mcp_sorting($mode, &$sort_days_val, &$sort_key_val, &$sort_dir_val, &$sort_by_sql_ary, &$sort_order_sql, &$total_val, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
{
global $db, $user, $auth, $template, $request, $phpbb_dispatcher;
- $sort_days = $request->variable('st', 0);
- $min_time = ($sort_days) ? time() - ($sort_days * 86400) : 0;
+ $sort_days_val = $request->variable('st', 0);
+ $min_time = ($sort_days_val) ? time() - ($sort_days_val * 86400) : 0;
switch ($mode)
{
@@ -512,8 +512,8 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
break;
}
- $sort_key = $request->variable('sk', $default_key);
- $sort_dir = $request->variable('sd', $default_dir);
+ $sort_key_val = $request->variable('sk', $default_key);
+ $sort_dir_val = $request->variable('sd', $default_dir);
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
switch ($type)
@@ -522,46 +522,46 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
$limit_days = array(0 => $user->lang['ALL_TOPICS'], 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('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
- $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
+ $sort_by_sql_ary = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views');
$limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : '';
break;
case 'posts':
$limit_days = array(0 => $user->lang['ALL_POSTS'], 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('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
- $sort_by_sql = array('a' => 'u.username_clean', 't' => array('p.post_time', 'p.post_id'), 's' => 'p.post_subject');
+ $sort_by_sql_ary = array('a' => 'u.username_clean', 't' => array('p.post_time', 'p.post_id'), 's' => 'p.post_subject');
$limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : '';
break;
case 'reports':
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 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('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
- $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => array('p.post_time', 'p.post_id'), 't' => 'r.report_time', 's' => 'p.post_subject');
+ $sort_by_sql_ary = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => array('p.post_time', 'p.post_id'), 't' => 'r.report_time', 's' => 'p.post_subject');
break;
case 'pm_reports':
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 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('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
- $sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject');
+ $sort_by_sql_ary = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject');
break;
case 'logs':
$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('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
- $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
+ $sort_by_sql_ary = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
$limit_time_sql = ($min_time) ? "AND l.log_time >= $min_time" : '';
break;
}
// Default total to -1 to allow editing by the event
- $total = -1;
+ $total_val = -1;
- $sort_by_sql_ary = $sort_by_sql;
- $sort_days_val = $sort_days;
- $sort_dir_val = $sort_dir;
- $sort_key_val = $sort_key;
- $total_val = $total;
+ $sort_by_sql = $sort_by_sql_ary;
+ $sort_days = $sort_days_val;
+ $sort_dir = $sort_dir_val;
+ $sort_key = $sort_key_val;
+ $total = $total_val;
/**
* This event allows you to control the SQL query used to get the total number
* of reports the user can access.
@@ -576,20 +576,19 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
* @var string type Which kind of information is this being used for displaying. Posts, topics, etc...
* @var int forum_id The forum id of the posts the user is trying to access, if not 0
* @var int topic_id The topic id of the posts the user is trying to access, if not 0
- * @var int sort_days_val The max age of the oldest report to be shown, in days
- * @var string sort_key_val The way the user has decided to sort the data.
+ * @var int sort_days The max age of the oldest report to be shown, in days
+ * @var string sort_key The way the user has decided to sort the data.
* The valid values must be in the keys of the sort_by_* variables
- * @var string sort_dir_val Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query
+ * @var string sort_dir Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query
* @var int limit_days The possible max ages of the oldest report for the user to choose, in days.
- * @var array sort_by_sql_ary SQL text (values) for the possible names of the ways of sorting data (keys).
+ * @var array sort_by_sql SQL text (values) for the possible names of the ways of sorting data (keys).
* @var array sort_by_text Language text (values) for the possible names of the ways of sorting data (keys).
* @var int min_time Integer with the minimum post time that the user is searching for
* @var int limit_time_sql Time limiting options used in the SQL query.
- * @var int total_val The total number of reports that exist. Only set if you want to override the result
+ * @var int total The total number of reports that exist. Only set if you want to override the result
* @var string where_sql Extra information included in the WHERE clause. It must end with "WHERE" or "AND" or "OR".
* Set to "WHERE" and set total above -1 to override the total value
* @since 3.1.4-RC1
- * @change 3.2.0-a1 Replaced sort_days, sort_key, sort_dir, sort_by_sql, total with replacement variables
*/
$vars = array(
'sql',
@@ -597,47 +596,47 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
'type',
'forum_id',
'topic_id',
- 'sort_days_val',
- 'sort_key_val',
- 'sort_dir_val',
+ 'sort_days',
+ 'sort_key',
+ 'sort_dir',
'limit_days',
- 'sort_by_sql_ary',
+ 'sort_by_sql',
'sort_by_text',
'min_time',
'limit_time_sql',
- 'total_val',
+ 'total',
'where_sql',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_sorting_query_before', compact($vars)));
- $sort_by_sql = $sort_by_sql_ary;
- $sort_days = $sort_days_val;
- $sort_key = $sort_key_val;
- $sort_dir = $sort_dir_val;
- $total = $total_val;
- unset($sort_by_sql_ary);
- unset($sort_days_val);
- unset($sort_key_val);
- unset($sort_dir_val);
- unset($total_val);
+ $sort_by_sql_ary = $sort_by_sql;
+ $sort_days_val = $sort_days;
+ $sort_key_val = $sort_key;
+ $sort_dir_val = $sort_dir;
+ $total_val = $total;
+ unset($sort_by_sql);
+ unset($sort_days);
+ unset($sort_key);
+ unset($sort_dir);
+ unset($total);
- if (!isset($sort_by_sql[$sort_key]))
+ if (!isset($sort_by_sql_ary[$sort_key_val]))
{
- $sort_key = $default_key;
+ $sort_key_val = $default_key;
}
- $direction = ($sort_dir == 'd') ? 'DESC' : 'ASC';
+ $direction = ($sort_dir_val == 'd') ? 'DESC' : 'ASC';
- if (is_array($sort_by_sql[$sort_key]))
+ if (is_array($sort_by_sql_ary[$sort_key_val]))
{
- $sort_order_sql = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
+ $sort_order_sql = implode(' ' . $direction . ', ', $sort_by_sql_ary[$sort_key_val]) . ' ' . $direction;
}
else
{
- $sort_order_sql = $sort_by_sql[$sort_key] . ' ' . $direction;
+ $sort_order_sql = $sort_by_sql_ary[$sort_key_val] . ' ' . $direction;
}
$s_limit_days = $s_sort_key = $s_sort_dir = $sort_url = '';
- gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url);
+ gen_sort_selects($limit_days, $sort_by_text, $sort_days_val, $sort_key_val, $sort_dir_val, $s_limit_days, $s_sort_key, $s_sort_dir, $sort_url);
$template->assign_vars(array(
'S_SELECT_SORT_DIR' => $s_sort_dir,
@@ -645,15 +644,15 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
'S_SELECT_SORT_DAYS' => $s_limit_days)
);
- if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE')
+ if (($sort_days_val && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_topics', 'deleted_posts')) || $where_sql != 'WHERE')
{
$result = $db->sql_query($sql);
- $total = (int) $db->sql_fetchfield('total');
+ $total_val = (int) $db->sql_fetchfield('total');
$db->sql_freeresult($result);
}
- else if ($total < -1)
+ else if ($total_val < -1)
{
- $total = -1;
+ $total_val = -1;
}
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 4f14dc8683..a5b3111257 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1360,12 +1360,12 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
* Submit Post
* @todo Split up and create lightweight, simple API for this.
*/
-function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true)
+function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data_ary, $update_message = true, $update_search_index = true)
{
global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
- $poll_ary = $poll;
- $data_ary = $data;
+ $poll = $poll_ary;
+ $data = $data_ary;
/**
* Modify the data for post submitting
*
@@ -1374,28 +1374,27 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var string subject Variable containing post subject value
* @var string username Variable containing post author name
* @var int topic_type Variable containing topic type value
- * @var array poll_ary Array with the poll data for the post
- * @var array data_ary Array with the data for the post
+ * @var array poll Array with the poll data for the post
+ * @var array data Array with the data for the post
* @var bool update_message Flag indicating if the post will be updated
* @var bool update_search_index Flag indicating if the search index will be updated
* @since 3.1.0-a4
- * @change 3.2.0-a1 Replaced poll and data with poll_ary and data_ary
*/
$vars = array(
'mode',
'subject',
'username',
'topic_type',
- 'poll_ary',
- 'data_ary',
+ 'poll',
+ 'data',
'update_message',
'update_search_index',
);
extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars)));
- $poll = $poll_ary;
- $data = $data_ary;
- unset($poll_ary);
- unset($data_ary);
+ $poll_ary = $poll;
+ $data_ary = $data;
+ unset($poll);
+ unset($data);
// We do not handle erasing posts here
if ($mode == 'delete')
@@ -1403,9 +1402,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
return false;
}
- if (!empty($data['post_time']))
+ if (!empty($data_ary['post_time']))
{
- $current_time = $data['post_time'];
+ $current_time = $data_ary['post_time'];
}
else
{
@@ -1424,31 +1423,31 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
else if ($mode == 'edit')
{
- $post_mode = ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit'));
+ $post_mode = ($data_ary['topic_posts_approved'] + $data_ary['topic_posts_unapproved'] + $data_ary['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data_ary['topic_first_post_id'] == $data_ary['post_id']) ? 'edit_first_post' : (($data_ary['topic_last_post_id'] == $data_ary['post_id']) ? 'edit_last_post' : 'edit'));
}
// First of all make sure the subject and topic title are having the correct length.
// To achieve this without cutting off between special chars we convert to an array and then count the elements.
$subject = truncate_string($subject, 120);
- $data['topic_title'] = truncate_string($data['topic_title'], 120);
+ $data_ary['topic_title'] = truncate_string($data_ary['topic_title'], 120);
// Collect some basic information about which tables and which rows to update/insert
$sql_data = $topic_row = array();
- $poster_id = ($mode == 'edit') ? $data['poster_id'] : (int) $user->data['user_id'];
+ $poster_id = ($mode == 'edit') ? $data_ary['poster_id'] : (int) $user->data['user_id'];
// Retrieve some additional information if not present
- if ($mode == 'edit' && (!isset($data['post_visibility']) || !isset($data['topic_visibility']) || $data['post_visibility'] === false || $data['topic_visibility'] === false))
+ if ($mode == 'edit' && (!isset($data_ary['post_visibility']) || !isset($data_ary['topic_visibility']) || $data_ary['post_visibility'] === false || $data_ary['topic_visibility'] === false))
{
$sql = 'SELECT p.post_visibility, t.topic_type, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_visibility
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_id = p.topic_id
- AND p.post_id = ' . $data['post_id'];
+ AND p.post_id = ' . $data_ary['post_id'];
$result = $db->sql_query($sql);
$topic_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $data['topic_visibility'] = $topic_row['topic_visibility'];
- $data['post_visibility'] = $topic_row['post_visibility'];
+ $data_ary['topic_visibility'] = $topic_row['topic_visibility'];
+ $data_ary['post_visibility'] = $topic_row['post_visibility'];
}
// This variable indicates if the user is able to post or put into the queue
@@ -1456,7 +1455,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Check the permissions for post approval.
// Moderators must go through post approval like ordinary users.
- if (!$auth->acl_get('f_noapprove', $data['forum_id']))
+ if (!$auth->acl_get('f_noapprove', $data_ary['forum_id']))
{
// Post not approved, but in queue
$post_visibility = ITEM_UNAPPROVED;
@@ -1472,13 +1471,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// MODs/Extensions are able to force any visibility on posts
- if (isset($data['force_approved_state']))
+ if (isset($data_ary['force_approved_state']))
{
- $post_visibility = (in_array((int) $data['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data['force_approved_state'] : $post_visibility;
+ $post_visibility = (in_array((int) $data_ary['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_approved_state'] : $post_visibility;
}
- if (isset($data['force_visibility']))
+ if (isset($data_ary['force_visibility']))
{
- $post_visibility = (in_array((int) $data['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data['force_visibility'] : $post_visibility;
+ $post_visibility = (in_array((int) $data_ary['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_visibility'] : $post_visibility;
}
// Start the transaction here
@@ -1490,25 +1489,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'post':
case 'reply':
$sql_data[POSTS_TABLE]['sql'] = array(
- 'forum_id' => $data['forum_id'],
+ 'forum_id' => $data_ary['forum_id'],
'poster_id' => (int) $user->data['user_id'],
- 'icon_id' => $data['icon_id'],
+ 'icon_id' => $data_ary['icon_id'],
'poster_ip' => $user->ip,
'post_time' => $current_time,
'post_visibility' => $post_visibility,
- 'enable_bbcode' => $data['enable_bbcode'],
- 'enable_smilies' => $data['enable_smilies'],
- 'enable_magic_url' => $data['enable_urls'],
- 'enable_sig' => $data['enable_sig'],
+ 'enable_bbcode' => $data_ary['enable_bbcode'],
+ 'enable_smilies' => $data_ary['enable_smilies'],
+ 'enable_magic_url' => $data_ary['enable_urls'],
+ 'enable_sig' => $data_ary['enable_sig'],
'post_username' => (!$user->data['is_registered']) ? $username : '',
'post_subject' => $subject,
- 'post_text' => $data['message'],
- 'post_checksum' => $data['message_md5'],
- 'post_attachment' => (!empty($data['attachment_data'])) ? 1 : 0,
- 'bbcode_bitfield' => $data['bbcode_bitfield'],
- 'bbcode_uid' => $data['bbcode_uid'],
- 'post_postcount' => ($auth->acl_get('f_postcount', $data['forum_id'])) ? 1 : 0,
- 'post_edit_locked' => $data['post_edit_locked']
+ 'post_text' => $data_ary['message'],
+ 'post_checksum' => $data_ary['message_md5'],
+ 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0,
+ 'bbcode_bitfield' => $data_ary['bbcode_bitfield'],
+ 'bbcode_uid' => $data_ary['bbcode_uid'],
+ 'post_postcount' => ($auth->acl_get('f_postcount', $data_ary['forum_id'])) ? 1 : 0,
+ 'post_edit_locked' => $data_ary['post_edit_locked']
);
break;
@@ -1525,19 +1524,19 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// If normal edit display edit info
// Display edit info if edit reason given or user is editing his post, which is not the last within the topic.
- if ($data['post_edit_reason'] || (!$auth->acl_get('m_edit', $data['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
+ if ($data_ary['post_edit_reason'] || (!$auth->acl_get('m_edit', $data_ary['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post')))
{
- $data['post_edit_reason'] = truncate_string($data['post_edit_reason'], 255, 255, false);
+ $data_ary['post_edit_reason'] = truncate_string($data_ary['post_edit_reason'], 255, 255, false);
$sql_data[POSTS_TABLE]['sql'] = array(
'post_edit_time' => $current_time,
- 'post_edit_reason' => $data['post_edit_reason'],
- 'post_edit_user' => (int) $data['post_edit_user'],
+ 'post_edit_reason' => $data_ary['post_edit_reason'],
+ 'post_edit_user' => (int) $data_ary['post_edit_user'],
);
$sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1';
}
- else if (!$data['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data['forum_id']))
+ else if (!$data_ary['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data_ary['forum_id']))
{
$sql_data[POSTS_TABLE]['sql'] = array(
'post_edit_reason' => '',
@@ -1548,14 +1547,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods
if ($user->data['user_id'] != $poster_id)
{
- $log_subject = ($subject) ? $subject : $data['topic_title'];
+ $log_subject = ($subject) ? $subject : $data_ary['topic_title'];
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_EDITED', false, array(
- 'forum_id' => $data['forum_id'],
- 'topic_id' => $data['topic_id'],
- 'post_id' => $data['post_id'],
+ 'forum_id' => $data_ary['forum_id'],
+ 'topic_id' => $data_ary['topic_id'],
+ 'post_id' => $data_ary['post_id'],
$log_subject,
(!empty($username)) ? $username : $user->lang['GUEST'],
- $data['post_edit_reason']
+ $data_ary['post_edit_reason']
));
}
@@ -1565,27 +1564,27 @@ 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' => $data['forum_id'],
- 'poster_id' => $data['poster_id'],
- 'icon_id' => $data['icon_id'],
+ 'forum_id' => $data_ary['forum_id'],
+ 'poster_id' => $data_ary['poster_id'],
+ 'icon_id' => $data_ary['icon_id'],
// We will change the visibility later
//'post_visibility' => $post_visibility,
- 'enable_bbcode' => $data['enable_bbcode'],
- 'enable_smilies' => $data['enable_smilies'],
- 'enable_magic_url' => $data['enable_urls'],
- 'enable_sig' => $data['enable_sig'],
- 'post_username' => ($username && $data['poster_id'] == ANONYMOUS) ? $username : '',
+ 'enable_bbcode' => $data_ary['enable_bbcode'],
+ 'enable_smilies' => $data_ary['enable_smilies'],
+ 'enable_magic_url' => $data_ary['enable_urls'],
+ 'enable_sig' => $data_ary['enable_sig'],
+ 'post_username' => ($username && $data_ary['poster_id'] == ANONYMOUS) ? $username : '',
'post_subject' => $subject,
- 'post_checksum' => $data['message_md5'],
- 'post_attachment' => (!empty($data['attachment_data'])) ? 1 : 0,
- 'bbcode_bitfield' => $data['bbcode_bitfield'],
- 'bbcode_uid' => $data['bbcode_uid'],
- 'post_edit_locked' => $data['post_edit_locked'])
+ 'post_checksum' => $data_ary['message_md5'],
+ 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0,
+ 'bbcode_bitfield' => $data_ary['bbcode_bitfield'],
+ 'bbcode_uid' => $data_ary['bbcode_uid'],
+ 'post_edit_locked' => $data_ary['post_edit_locked'])
);
if ($update_message)
{
- $sql_data[POSTS_TABLE]['sql']['post_text'] = $data['message'];
+ $sql_data[POSTS_TABLE]['sql']['post_text'] = $data_ary['message'];
}
break;
@@ -1600,8 +1599,8 @@ 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' => $data['forum_id'],
- 'icon_id' => $data['icon_id'],
+ 'forum_id' => $data_ary['forum_id'],
+ 'icon_id' => $data_ary['icon_id'],
'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0,
'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0,
'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0,
@@ -1611,15 +1610,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
'topic_first_poster_colour' => $user->data['user_colour'],
'topic_type' => $topic_type,
- 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0,
- 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : 0,
- 'topic_status' => (isset($data['topic_status'])) ? $data['topic_status'] : ITEM_UNLOCKED,
+ 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,
+ 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0,
+ 'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED,
);
- if (isset($poll['poll_options']) && !empty($poll['poll_options']))
+ if (isset($poll_ary['poll_options']) && !empty($poll_ary['poll_options']))
{
- $poll_start = ($poll['poll_start']) ? $poll['poll_start'] : $current_time;
- $poll_length = $poll['poll_length'] * 86400;
+ $poll_start = ($poll_ary['poll_start']) ? $poll_ary['poll_start'] : $current_time;
+ $poll_length = $poll_ary['poll_length'] * 86400;
if ($poll_length < 0)
{
$poll_start = $poll_start + $poll_length;
@@ -1631,15 +1630,15 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array(
- 'poll_title' => $poll['poll_title'],
+ 'poll_title' => $poll_ary['poll_title'],
'poll_start' => $poll_start,
- 'poll_max_options' => $poll['poll_max_options'],
+ 'poll_max_options' => $poll_ary['poll_max_options'],
'poll_length' => $poll_length,
- 'poll_vote_change' => $poll['poll_vote_change'])
+ 'poll_vote_change' => $poll_ary['poll_vote_change'])
);
}
- $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
+ $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
if ($post_visibility == ITEM_APPROVED)
{
@@ -1665,9 +1664,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
(($post_visibility == ITEM_APPROVED) ? ', topic_posts_approved = topic_posts_approved + 1' : '') .
(($post_visibility == ITEM_UNAPPROVED) ? ', topic_posts_unapproved = topic_posts_unapproved + 1' : '') .
(($post_visibility == ITEM_DELETED) ? ', topic_posts_softdeleted = topic_posts_softdeleted + 1' : '') .
- ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
+ ((!empty($data_ary['attachment_data']) || (isset($data_ary['topic_attachment']) && $data_ary['topic_attachment'])) ? ', topic_attachment = 1' : '');
- $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
+ $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : '');
if ($post_visibility == ITEM_APPROVED)
{
@@ -1685,10 +1684,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_topic':
case 'edit_first_post':
- if (isset($poll['poll_options']))
+ if (isset($poll_ary['poll_options']))
{
- $poll_start = ($poll['poll_start'] || empty($poll['poll_options'])) ? $poll['poll_start'] : $current_time;
- $poll_length = $poll['poll_length'] * 86400;
+ $poll_start = ($poll_ary['poll_start'] || empty($poll_ary['poll_options'])) ? $poll_ary['poll_start'] : $current_time;
+ $poll_length = $poll_ary['poll_length'] * 86400;
if ($poll_length < 0)
{
$poll_start = $poll_start + $poll_length;
@@ -1701,27 +1700,27 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$sql_data[TOPICS_TABLE]['sql'] = array(
- 'forum_id' => $data['forum_id'],
- 'icon_id' => $data['icon_id'],
+ 'forum_id' => $data_ary['forum_id'],
+ 'icon_id' => $data_ary['icon_id'],
'topic_title' => $subject,
'topic_first_poster_name' => $username,
'topic_type' => $topic_type,
- 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data['topic_time_limit'] * 86400) : 0,
- 'poll_title' => (isset($poll['poll_options'])) ? $poll['poll_title'] : '',
- 'poll_start' => (isset($poll['poll_options'])) ? $poll_start : 0,
- 'poll_max_options' => (isset($poll['poll_options'])) ? $poll['poll_max_options'] : 1,
- 'poll_length' => (isset($poll['poll_options'])) ? $poll_length : 0,
- 'poll_vote_change' => (isset($poll['poll_vote_change'])) ? $poll['poll_vote_change'] : 0,
+ 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,
+ 'poll_title' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '',
+ 'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0,
+ 'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1,
+ 'poll_length' => (isset($poll_ary['poll_options'])) ? $poll_length : 0,
+ 'poll_vote_change' => (isset($poll_ary['poll_vote_change'])) ? $poll_ary['poll_vote_change'] : 0,
'topic_last_view_time' => $current_time,
- 'topic_attachment' => (!empty($data['attachment_data'])) ? 1 : (isset($data['topic_attachment']) ? $data['topic_attachment'] : 0),
+ 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : (isset($data_ary['topic_attachment']) ? $data_ary['topic_attachment'] : 0),
);
break;
}
- $poll_ary = $poll;
- $data_ary = $data;
+ $poll = $poll_ary;
+ $data = $data_ary;
/**
* Modify sql query data for post submitting
*
@@ -1734,11 +1733,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var int topic_type Variable containing topic type value
* @var string username Variable containing post author name
* @since 3.1.3-RC1
- * @change 3.2.0-a1 Replace poll and data with poll_ary and data_ary
*/
$vars = array(
- 'data_ary',
- 'poll_ary',
+ 'data',
+ 'poll',
'post_mode',
'sql_data',
'subject',
@@ -1746,10 +1744,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'username',
);
extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars)));
- $poll = $poll_ary;
- $data = $data_ary;
- unset($poll_ary);
- unset($data_ary);
+ $poll_ary = $poll;
+ $data_ary = $data;
+ unset($poll);
+ unset($data);
// Submit new topic
if ($post_mode == 'post')
@@ -1758,10 +1756,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']);
$db->sql_query($sql);
- $data['topic_id'] = $db->sql_nextid();
+ $data_ary['topic_id'] = $db->sql_nextid();
$sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array(
- 'topic_id' => $data['topic_id'])
+ 'topic_id' => $data_ary['topic_id'])
);
unset($sql_data[TOPICS_TABLE]['sql']);
}
@@ -1772,18 +1770,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($post_mode == 'reply')
{
$sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array(
- 'topic_id' => $data['topic_id'],
+ 'topic_id' => $data_ary['topic_id'],
));
}
$sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']);
$db->sql_query($sql);
- $data['post_id'] = $db->sql_nextid();
+ $data_ary['post_id'] = $db->sql_nextid();
if ($post_mode == 'post' || $post_visibility == ITEM_APPROVED)
{
$sql_data[TOPICS_TABLE]['sql'] = array(
- 'topic_last_post_id' => $data['post_id'],
+ 'topic_last_post_id' => $data_ary['post_id'],
'topic_last_post_time' => $current_time,
'topic_last_poster_id' => $sql_data[POSTS_TABLE]['sql']['poster_id'],
'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'],
@@ -1794,7 +1792,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($post_mode == 'post')
{
- $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data['post_id'];
+ $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data_ary['post_id'];
}
// Update total post count and forum information
@@ -1806,7 +1804,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$config->increment('num_posts', 1, false);
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data['post_id'];
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data_ary['post_id'];
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'";
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time;
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id'];
@@ -1822,7 +1820,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . '
- WHERE topic_id = ' . $data['topic_id'];
+ WHERE topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
unset($sql_data[TOPICS_TABLE]['sql']);
@@ -1833,14 +1831,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
$sql = 'UPDATE ' . POSTS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . '
- WHERE post_id = ' . $data['post_id'];
+ WHERE post_id = ' . $data_ary['post_id'];
$db->sql_query($sql);
unset($sql_data[POSTS_TABLE]['sql']);
}
// Update Poll Tables
- if (isset($poll['poll_options']))
+ if (isset($poll_ary['poll_options']))
{
$cur_poll_options = array();
@@ -1848,7 +1846,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
$sql = 'SELECT *
FROM ' . POLL_OPTIONS_TABLE . '
- WHERE topic_id = ' . $data['topic_id'] . '
+ WHERE topic_id = ' . $data_ary['topic_id'] . '
ORDER BY poll_option_id';
$result = $db->sql_query($sql);
@@ -1862,25 +1860,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_insert_ary = array();
- for ($i = 0, $size = sizeof($poll['poll_options']); $i < $size; $i++)
+ for ($i = 0, $size = sizeof($poll_ary['poll_options']); $i < $size; $i++)
{
- if (strlen(trim($poll['poll_options'][$i])))
+ if (strlen(trim($poll_ary['poll_options'][$i])))
{
if (empty($cur_poll_options[$i]))
{
// If we add options we need to put them to the end to be able to preserve votes...
$sql_insert_ary[] = array(
'poll_option_id' => (int) sizeof($cur_poll_options) + 1 + sizeof($sql_insert_ary),
- 'topic_id' => (int) $data['topic_id'],
- 'poll_option_text' => (string) $poll['poll_options'][$i]
+ 'topic_id' => (int) $data_ary['topic_id'],
+ 'poll_option_text' => (string) $poll_ary['poll_options'][$i]
);
}
- else if ($poll['poll_options'][$i] != $cur_poll_options[$i])
+ else if ($poll_ary['poll_options'][$i] != $cur_poll_options[$i])
{
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . "
- SET poll_option_text = '" . $db->sql_escape($poll['poll_options'][$i]) . "'
+ SET poll_option_text = '" . $db->sql_escape($poll_ary['poll_options'][$i]) . "'
WHERE poll_option_id = " . $cur_poll_options[$i]['poll_option_id'] . '
- AND topic_id = ' . $data['topic_id'];
+ AND topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}
}
@@ -1888,29 +1886,29 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary);
- if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
+ if (sizeof($poll_ary['poll_options']) < sizeof($cur_poll_options))
{
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '
- WHERE poll_option_id > ' . sizeof($poll['poll_options']) . '
- AND topic_id = ' . $data['topic_id'];
+ WHERE poll_option_id > ' . sizeof($poll_ary['poll_options']) . '
+ AND topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}
// If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option
- if ($mode == 'edit' && sizeof($poll['poll_options']) != sizeof($cur_poll_options))
+ if ($mode == 'edit' && sizeof($poll_ary['poll_options']) != sizeof($cur_poll_options))
{
- $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data['topic_id']);
- $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data['topic_id']);
+ $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']);
+ $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']);
}
}
// Submit Attachments
- if (!empty($data['attachment_data']) && $data['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit')))
+ if (!empty($data_ary['attachment_data']) && $data_ary['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit')))
{
$space_taken = $files_added = 0;
$orphan_rows = array();
- foreach ($data['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $pos => $attach_row)
{
$orphan_rows[(int) $attach_row['attach_id']] = array();
}
@@ -1932,7 +1930,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$db->sql_freeresult($result);
}
- foreach ($data['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $pos => $attach_row)
{
if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
@@ -1960,8 +1958,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$files_added++;
$attach_sql = array(
- 'post_msg_id' => $data['post_id'],
- 'topic_id' => $data['topic_id'],
+ 'post_msg_id' => $data_ary['post_id'],
+ 'topic_id' => $data_ary['topic_id'],
'is_orphan' => 0,
'poster_id' => $poster_id,
'attach_comment' => $attach_row['attach_comment'],
@@ -1983,32 +1981,32 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
$first_post_has_topic_info = ($post_mode == 'edit_first_post' &&
- (($post_visibility == ITEM_DELETED && $data['topic_posts_softdeleted'] == 1) ||
- ($post_visibility == ITEM_UNAPPROVED && $data['topic_posts_unapproved'] == 1) ||
- ($post_visibility == ITEM_REAPPROVE && $data['topic_posts_unapproved'] == 1) ||
- ($post_visibility == ITEM_APPROVED && $data['topic_posts_approved'] == 1)));
+ (($post_visibility == ITEM_DELETED && $data_ary['topic_posts_softdeleted'] == 1) ||
+ ($post_visibility == ITEM_UNAPPROVED && $data_ary['topic_posts_unapproved'] == 1) ||
+ ($post_visibility == ITEM_REAPPROVE && $data_ary['topic_posts_unapproved'] == 1) ||
+ ($post_visibility == ITEM_APPROVED && $data_ary['topic_posts_approved'] == 1)));
// Fix the post's and topic's visibility and first/last post information, when the post is edited
- if (($post_mode != 'post' && $post_mode != 'reply') && $data['post_visibility'] != $post_visibility)
+ if (($post_mode != 'post' && $post_mode != 'reply') && $data_ary['post_visibility'] != $post_visibility)
{
// If the post was not approved, it could also be the starter,
// so we sync the starter after approving/restoring, to ensure that the stats are correct
// Same applies for the last post
- $is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
- $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
+ $is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED);
+ $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED);
/* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
- $phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
+ $phpbb_content_visibility->set_post_visibility($post_visibility, $data_ary['post_id'], $data_ary['topic_id'], $data_ary['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
}
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info)
{
- if ($post_visibility == ITEM_APPROVED || $data['topic_visibility'] == $post_visibility)
+ if ($post_visibility == ITEM_APPROVED || $data_ary['topic_visibility'] == $post_visibility)
{
// only the subject can be changed from edit
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
// Maybe not only the subject, but also changing anonymous usernames. ;)
- if ($data['poster_id'] == ANONYMOUS)
+ if ($data_ary['poster_id'] == ANONYMOUS)
{
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'";
}
@@ -2019,13 +2017,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// it just means that we might have to
$sql = 'SELECT forum_last_post_id, forum_last_post_subject
FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . (int) $data['forum_id'];
+ WHERE forum_id = ' . (int) $data_ary['forum_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// this post is the latest post in the forum, better update
- if ($row['forum_last_post_id'] == $data['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data['poster_id'] == ANONYMOUS))
+ if ($row['forum_last_post_id'] == $data_ary['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data_ary['poster_id'] == ANONYMOUS))
{
// the post's subject changed
if ($row['forum_last_post_subject'] !== $subject)
@@ -2034,7 +2032,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// Update the user name if poster is anonymous... just in case a moderator changed it
- if ($data['poster_id'] == ANONYMOUS)
+ if ($data_ary['poster_id'] == ANONYMOUS)
{
$sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'";
}
@@ -2045,9 +2043,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Update forum stats
$where_sql = array(
- POSTS_TABLE => 'post_id = ' . $data['post_id'],
- TOPICS_TABLE => 'topic_id = ' . $data['topic_id'],
- FORUMS_TABLE => 'forum_id = ' . $data['forum_id'],
+ POSTS_TABLE => 'post_id = ' . $data_ary['post_id'],
+ TOPICS_TABLE => 'topic_id = ' . $data_ary['topic_id'],
+ FORUMS_TABLE => 'forum_id = ' . $data_ary['forum_id'],
USERS_TABLE => 'user_id = ' . $poster_id
);
@@ -2064,7 +2062,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($topic_type == POST_GLOBAL)
{
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE topic_moved_id = ' . $data['topic_id'];
+ WHERE topic_moved_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}
@@ -2082,7 +2080,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
}
// Index message contents
- if ($update_search_index && $data['enable_indexing'])
+ if ($update_search_index && $data_ary['enable_indexing'])
{
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = $config['search_type'];
@@ -2100,23 +2098,23 @@ 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, $data['forum_id']);
+ $search->index($mode, $data_ary['post_id'], $data_ary['message'], $subject, $poster_id, $data_ary['forum_id']);
}
// Topic Notification, do not change if moderator is changing other users posts...
if ($user->data['user_id'] == $poster_id)
{
- if (!$data['notify_set'] && $data['notify'])
+ if (!$data_ary['notify_set'] && $data_ary['notify'])
{
$sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id)
- VALUES (' . $user->data['user_id'] . ', ' . $data['topic_id'] . ')';
+ VALUES (' . $user->data['user_id'] . ', ' . $data_ary['topic_id'] . ')';
$db->sql_query($sql);
}
- else if (($config['email_enable'] || $config['jab_enable']) && $data['notify_set'] && !$data['notify'])
+ else if (($config['email_enable'] || $config['jab_enable']) && $data_ary['notify_set'] && !$data_ary['notify'])
{
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
WHERE user_id = ' . $user->data['user_id'] . '
- AND topic_id = ' . $data['topic_id'];
+ AND topic_id = ' . $data_ary['topic_id'];
$db->sql_query($sql);
}
}
@@ -2124,12 +2122,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote')
{
// Mark this topic as posted to
- markread('post', $data['forum_id'], $data['topic_id']);
+ markread('post', $data_ary['forum_id'], $data_ary['topic_id']);
}
// 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', $data['forum_id'], $data['topic_id'], time());
+ markread('topic', $data_ary['forum_id'], $data_ary['topic_id'], time());
//
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -2137,7 +2135,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 = ' . $data['forum_id'];
+ AND forum_id = ' . $data_ary['forum_id'];
$result = $db->sql_query($sql);
$f_mark_time = (int) $db->sql_fetchfield('mark_time');
$db->sql_freeresult($result);
@@ -2152,12 +2150,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Update forum info
$sql = 'SELECT forum_last_post_time
FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $data['forum_id'];
+ WHERE forum_id = ' . $data_ary['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($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
+ update_forum_tracking_info($data_ary['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
// If a username was supplied or the poster is a guest, we will use the supplied username.
@@ -2166,11 +2164,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username'];
// Send Notifications
- $notification_data = array_merge($data, array(
- 'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject,
+ $notification_data = array_merge($data_ary, array(
+ 'topic_title' => (isset($data_ary['topic_title'])) ? $data_ary['topic_title'] : $subject,
'post_username' => $username,
'poster_id' => $poster_id,
- 'post_text' => $data['message'],
+ 'post_text' => $data_ary['message'],
'post_time' => $current_time,
'post_subject' => $subject,
));
@@ -2281,24 +2279,24 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($post_visibility == ITEM_APPROVED)
{
- $params .= '&amp;t=' . $data['topic_id'];
+ $params .= '&amp;t=' . $data_ary['topic_id'];
if ($mode != 'post')
{
- $params .= '&amp;p=' . $data['post_id'];
- $add_anchor = '#p' . $data['post_id'];
+ $params .= '&amp;p=' . $data_ary['post_id'];
+ $add_anchor = '#p' . $data_ary['post_id'];
}
}
else if ($mode != 'post' && $post_mode != 'edit_first_post' && $post_mode != 'edit_topic')
{
- $params .= '&amp;t=' . $data['topic_id'];
+ $params .= '&amp;t=' . $data_ary['topic_id'];
}
$url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
- $url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
+ $url = append_sid($url, 'f=' . $data_ary['forum_id'] . $params) . $add_anchor;
- $poll_ary = $poll;
- $data_ary = $data;
+ $poll = $poll_ary;
+ $data = $data_ary;
/**
* This event is used for performing actions directly after a post or topic
* has been submitted. When a new topic is posted, the topic ID is
@@ -2312,8 +2310,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var string subject Variable containing post subject value
* @var string username Variable containing post author name
* @var int topic_type Variable containing topic type value
- * @var array poll_ary Array with the poll data for the post
- * @var array data_ary Array with the data for the post
+ * @var array poll Array with the poll data for the post
+ * @var array data Array with the data for the post
* @var int post_visibility Variable containing up to date post visibility
* @var bool update_message Flag indicating if the post will be updated
* @var bool update_search_index Flag indicating if the search index will be updated
@@ -2322,25 +2320,24 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @since 3.1.0-a3
* @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* poll, update_message, update_search_index
- * @change 3.2.0-a1 Replaced data and poll with data_ary and poll_ary
*/
$vars = array(
'mode',
'subject',
'username',
'topic_type',
- 'poll_ary',
- 'data_ary',
+ 'poll',
+ 'data',
'post_visibility',
'update_message',
'update_search_index',
'url',
);
extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars)));
- $data = $data_ary;
- $poll = $poll_ary;
- unset($data_ary);
- unset($poll_ary);
+ $data_ary = $data;
+ $poll_ary = $poll;
+ unset($data);
+ unset($poll);
return $url;
}
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index a54770812e..cd1632846e 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1608,7 +1608,7 @@ function get_folder_status($folder_id, $folder)
/**
* Submit PM
*/
-function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
+function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true)
{
global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request;
@@ -1620,21 +1620,20 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$current_time = time();
- $data_ary = $data;
+ $data = $data_ary;
/**
* Get all parts of the PM that are to be submited to the DB.
*
* @event core.submit_pm_before
* @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit
* @var string subject Subject of the private message
- * @var array data_ary The whole row data of the PM.
+ * @var array data The whole row data of the PM.
* @since 3.1.0-b3
- * @change 3.2.0-a1 Replaced data with data_ary
*/
- $vars = array('mode', 'subject', 'data_ary');
+ $vars = array('mode', 'subject', 'data');
extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars)));
- $data = $data_ary;
- unset($data_ary);
+ $data_ary = $data;
+ unset($data);
// Collect some basic information about which tables and which rows to update/insert
$sql_data = array();
@@ -1650,9 +1649,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$_types = array('u', 'g');
foreach ($_types as $ug_type)
{
- if (isset($data['address_list'][$ug_type]) && sizeof($data['address_list'][$ug_type]))
+ if (isset($data_ary['address_list'][$ug_type]) && sizeof($data_ary['address_list'][$ug_type]))
{
- foreach ($data['address_list'][$ug_type] as $id => $field)
+ foreach ($data_ary['address_list'][$ug_type] as $id => $field)
{
$id = (int) $id;
@@ -1672,7 +1671,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
}
}
- if (isset($data['address_list']['g']) && sizeof($data['address_list']['g']))
+ if (isset($data_ary['address_list']['g']) && sizeof($data_ary['address_list']['g']))
{
// We need to check the PM status of group members (do they want to receive PM's?)
// Only check if not a moderator or admin, since they are allowed to override this user setting
@@ -1680,7 +1679,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$sql = 'SELECT u.user_type, ug.group_id, ug.user_id
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
- WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
+ WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data_ary['address_list']['g'])) . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' .
@@ -1689,7 +1688,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
while ($row = $db->sql_fetchrow($result))
{
- $field = ($data['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc';
+ $field = ($data_ary['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc';
$recipients[$row['user_id']] = $field;
}
$db->sql_freeresult($result);
@@ -1712,13 +1711,13 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
{
case 'reply':
case 'quote':
- $root_level = ($data['reply_from_root_level']) ? $data['reply_from_root_level'] : $data['reply_from_msg_id'];
+ $root_level = ($data_ary['reply_from_root_level']) ? $data_ary['reply_from_root_level'] : $data_ary['reply_from_msg_id'];
// Set message_replied switch for this user
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
SET pm_replied = 1
- WHERE user_id = ' . $data['from_user_id'] . '
- AND msg_id = ' . $data['reply_from_msg_id'];
+ WHERE user_id = ' . $data_ary['from_user_id'] . '
+ AND msg_id = ' . $data_ary['reply_from_msg_id'];
// no break
@@ -1727,19 +1726,19 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
case 'quotepost':
$sql_data = array(
'root_level' => $root_level,
- 'author_id' => $data['from_user_id'],
- 'icon_id' => $data['icon_id'],
- 'author_ip' => $data['from_user_ip'],
+ 'author_id' => $data_ary['from_user_id'],
+ 'icon_id' => $data_ary['icon_id'],
+ 'author_ip' => $data_ary['from_user_ip'],
'message_time' => $current_time,
- 'enable_bbcode' => $data['enable_bbcode'],
- 'enable_smilies' => $data['enable_smilies'],
- 'enable_magic_url' => $data['enable_urls'],
- 'enable_sig' => $data['enable_sig'],
+ 'enable_bbcode' => $data_ary['enable_bbcode'],
+ 'enable_smilies' => $data_ary['enable_smilies'],
+ 'enable_magic_url' => $data_ary['enable_urls'],
+ 'enable_sig' => $data_ary['enable_sig'],
'message_subject' => $subject,
- 'message_text' => $data['message'],
- 'message_attachment'=> (!empty($data['attachment_data'])) ? 1 : 0,
- 'bbcode_bitfield' => $data['bbcode_bitfield'],
- 'bbcode_uid' => $data['bbcode_uid'],
+ 'message_text' => $data_ary['message'],
+ 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0,
+ 'bbcode_bitfield' => $data_ary['bbcode_bitfield'],
+ 'bbcode_uid' => $data_ary['bbcode_uid'],
'to_address' => implode(':', $to),
'bcc_address' => implode(':', $bcc),
'message_reported' => 0,
@@ -1748,17 +1747,17 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
case 'edit':
$sql_data = array(
- 'icon_id' => $data['icon_id'],
+ 'icon_id' => $data_ary['icon_id'],
'message_edit_time' => $current_time,
- 'enable_bbcode' => $data['enable_bbcode'],
- 'enable_smilies' => $data['enable_smilies'],
- 'enable_magic_url' => $data['enable_urls'],
- 'enable_sig' => $data['enable_sig'],
+ 'enable_bbcode' => $data_ary['enable_bbcode'],
+ 'enable_smilies' => $data_ary['enable_smilies'],
+ 'enable_magic_url' => $data_ary['enable_urls'],
+ 'enable_sig' => $data_ary['enable_sig'],
'message_subject' => $subject,
- 'message_text' => $data['message'],
- 'message_attachment'=> (!empty($data['attachment_data'])) ? 1 : 0,
- 'bbcode_bitfield' => $data['bbcode_bitfield'],
- 'bbcode_uid' => $data['bbcode_uid']
+ 'message_text' => $data_ary['message'],
+ 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0,
+ 'bbcode_bitfield' => $data_ary['bbcode_bitfield'],
+ 'bbcode_uid' => $data_ary['bbcode_uid']
);
break;
}
@@ -1770,13 +1769,13 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward')
{
$db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data));
- $data['msg_id'] = $db->sql_nextid();
+ $data_ary['msg_id'] = $db->sql_nextid();
}
else if ($mode == 'edit')
{
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . '
- WHERE msg_id = ' . $data['msg_id'];
+ WHERE msg_id = ' . $data_ary['msg_id'];
$db->sql_query($sql);
}
}
@@ -1793,9 +1792,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
foreach ($recipients as $user_id => $type)
{
$sql_ary[] = array(
- 'msg_id' => (int) $data['msg_id'],
+ 'msg_id' => (int) $data_ary['msg_id'],
'user_id' => (int) $user_id,
- 'author_id' => (int) $data['from_user_id'],
+ 'author_id' => (int) $data_ary['from_user_id'],
'folder_id' => PRIVMSGS_NO_BOX,
'pm_new' => 1,
'pm_unread' => 1,
@@ -1814,9 +1813,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
if ($put_in_outbox)
{
$db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array(
- 'msg_id' => (int) $data['msg_id'],
- 'user_id' => (int) $data['from_user_id'],
- 'author_id' => (int) $data['from_user_id'],
+ 'msg_id' => (int) $data_ary['msg_id'],
+ 'user_id' => (int) $data_ary['from_user_id'],
+ 'author_id' => (int) $data_ary['from_user_id'],
'folder_id' => PRIVMSGS_OUTBOX,
'pm_new' => 0,
'pm_unread' => 0,
@@ -1830,17 +1829,17 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
{
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_lastpost_time = $current_time
- WHERE user_id = " . $data['from_user_id'];
+ WHERE user_id = " . $data_ary['from_user_id'];
$db->sql_query($sql);
}
// Submit Attachments
- if (!empty($data['attachment_data']) && $data['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward')))
+ if (!empty($data_ary['attachment_data']) && $data_ary['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward')))
{
$space_taken = $files_added = 0;
$orphan_rows = array();
- foreach ($data['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $pos => $attach_row)
{
$orphan_rows[(int) $attach_row['attach_id']] = array();
}
@@ -1863,7 +1862,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$db->sql_freeresult($result);
}
- foreach ($data['attachment_data'] as $pos => $attach_row)
+ foreach ($data_ary['attachment_data'] as $pos => $attach_row)
{
if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']]))
{
@@ -1891,10 +1890,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$files_added++;
$attach_sql = array(
- 'post_msg_id' => $data['msg_id'],
+ 'post_msg_id' => $data_ary['msg_id'],
'topic_id' => 0,
'is_orphan' => 0,
- 'poster_id' => $data['from_user_id'],
+ 'poster_id' => $data_ary['from_user_id'],
'attach_comment' => $attach_row['attach_comment'],
);
@@ -1919,14 +1918,14 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
{
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "
WHERE draft_id = $draft_id
- AND user_id = " . $data['from_user_id'];
+ AND user_id = " . $data_ary['from_user_id'];
$db->sql_query($sql);
}
$db->sql_transaction('commit');
// Send Notifications
- $pm_data = array_merge($data, array(
+ $pm_data = array_merge($data_ary, array(
'message_subject' => $subject,
'recipients' => $recipients,
));
@@ -1943,7 +1942,7 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$phpbb_notifications->add_notifications('notification.type.pm', $pm_data);
}
- $data_ary = $data;
+ $data = $data_ary;
/**
* Get PM message ID after submission to DB
*
@@ -1953,14 +1952,13 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
* @var array data_ary The whole row data of the PM.
* @var array pm_data The data sent to notification class
* @since 3.1.0-b5
- * @change 3.2.0-a1 Replaced data with data_ary
*/
- $vars = array('mode', 'subject', 'data_ary', 'pm_data');
+ $vars = array('mode', 'subject', 'data', 'pm_data');
extract($phpbb_dispatcher->trigger_event('core.submit_pm_after', compact($vars)));
- $data = $data_ary;
- unset($data_ary);
+ $data_ary = $data;
+ unset($data);
- return $data['msg_id'];
+ return $data_ary['msg_id'];
}
/**
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 8237b834d6..90a3db0949 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -203,9 +203,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_list = $topic_tracking_info = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row_ary = $db->sql_fetchrow($result))
{
- $topic_list[] = $row['topic_id'];
+ $topic_list[] = $row_ary['topic_id'];
}
$db->sql_freeresult($result);
@@ -214,9 +214,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true);
$result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row_ary = $db->sql_fetchrow($result))
{
- $topic_rows[$row['topic_id']] = $row;
+ $topic_rows[$row_ary['topic_id']] = $row_ary;
}
$db->sql_freeresult($result);
@@ -243,111 +243,110 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
{
$topic_title = '';
- $row = &$topic_rows[$topic_id];
+ $row_ary = &$topic_rows[$topic_id];
- $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row_ary, $forum_id) - 1;
- if ($row['topic_status'] == ITEM_MOVED)
+ if ($row_ary['topic_status'] == ITEM_MOVED)
{
$unread_topic = false;
}
else
{
- $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
+ $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row_ary['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
- topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
+ topic_status($row_ary, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
- $topic_title = censor_text($row['topic_title']);
+ $topic_title = censor_text($row_ary['topic_title']);
- $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
- $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row['topic_id'] : '';
+ $topic_unapproved = (($row_ary['topic_visibility'] == ITEM_UNAPPROVED || $row_ary['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false;
+ $posts_unapproved = ($row_ary['topic_visibility'] == ITEM_APPROVED && $row_ary['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false;
+ $topic_deleted = $row_ary['topic_visibility'] == ITEM_DELETED;
+ $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row_ary['topic_id'] : '';
$u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? $url . '&amp;i=queue&amp;mode=deleted_topics&amp;t=' . $topic_id : $u_mcp_queue;
$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']) : '',
+ 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row_ary['forum_id']) && $row_ary['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_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
- 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
- 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
+ 'TOPIC_ICON_IMG' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['img'] : '',
+ 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['width'] : '',
+ 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['height'] : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'POSTS_DELETED') : '',
- 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR' => get_username_string('username', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'U_TOPIC_AUTHOR' => get_username_string('profile', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
- 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR' => get_username_string('username', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title,
- 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1,
- 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
- 'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
- 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
- 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
+ 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row_ary, $row_ary['forum_id']) - 1,
+ 'LAST_POST_TIME' => $user->format_date($row_ary['topic_last_post_time']),
+ 'FIRST_POST_TIME' => $user->format_date($row_ary['topic_time']),
+ 'LAST_POST_SUBJECT' => $row_ary['topic_last_post_subject'],
+ 'LAST_VIEW_TIME' => $user->format_date($row_ary['topic_last_view_time']),
- 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
+ 'S_TOPIC_REPORTED' => (!empty($row_ary['topic_reported']) && empty($row_ary['topic_moved_id']) && $auth->acl_get('m_report', $row_ary['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
'S_TOPIC_DELETED' => $topic_deleted,
'S_UNREAD_TOPIC' => $unread_topic,
);
- if ($row['topic_status'] == ITEM_MOVED)
+ if ($row_ary['topic_status'] == ITEM_MOVED)
{
$topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"),
- 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row_ary['topic_moved_id']}"),
+ 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row_ary['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
'S_MOVED_TOPIC' => true,
- 'TOPIC_ID' => $row['topic_moved_id'],
+ 'TOPIC_ID' => $row_ary['topic_moved_id'],
));
}
else
{
if ($action == 'merge_topic' || $action == 'merge_topics')
{
- $u_select_topic = $url . "&amp;i=$id&amp;mode=forum_view&amp;action=$action&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
+ $u_select_topic = $url . "&amp;i=$id&amp;mode=forum_view&amp;action=$action&amp;to_topic_id=" . $row_ary['topic_id'] . $selected_ids;
}
else
{
- $u_select_topic = $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
+ $u_select_topic = $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row_ary['topic_id'] . $selected_ids;
}
$topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row['topic_id']}&amp;mode=topic_view"),
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row_ary['topic_id']}&amp;mode=topic_view"),
- 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false,
+ 'S_SELECT_TOPIC' => ($merge_select && !in_array($row_ary['topic_id'], $source_topic_ids)) ? true : false,
'U_SELECT_TOPIC' => $u_select_topic,
'U_MCP_QUEUE' => $u_mcp_queue,
- 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row['topic_id'] . '&amp;action=reports') : '',
- 'TOPIC_ID' => $row['topic_id'],
- 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false,
+ 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row_ary['topic_id'] . '&amp;action=reports') : '',
+ 'TOPIC_ID' => $row_ary['topic_id'],
+ 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row_ary['topic_id'], $topic_id_list)) ? true : false,
));
}
- $row_ary = $row;
+ $row = $row_ary;
/**
* Modify the topic data before it is assigned to the template in MCP
*
* @event core.mcp_view_forum_modify_topicrow
- * @var array row_ary Array with topic data
+ * @var array row Array with topic data
* @var array topic_row Template array with topic data
* @since 3.1.0-a1
- * @change 3.2.0-a1 Replace row with row_ary
*/
- $vars = array('row_ary', 'topic_row');
+ $vars = array('row', 'topic_row');
extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_topicrow', compact($vars)));
- $row = $row_ary;
- unset($row_ary);
+ $row_ary = $row;
+ unset($row);
$template->assign_block_vars('topicrow', $topic_row);
}