aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/cache/driver/redis.php1
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_location.php48
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php47
-rw-r--r--phpBB/phpbb/db/tools.php2
-rw-r--r--phpBB/phpbb/extension/exception.php2
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php2
-rw-r--r--phpBB/phpbb/pagination.php189
-rw-r--r--phpBB/phpbb/profilefields/manager.php35
-rw-r--r--phpBB/phpbb/profilefields/type/type_string.php2
-rw-r--r--phpBB/phpbb/request/deactivated_super_global.php1
-rw-r--r--phpBB/phpbb/user.php2
11 files changed, 224 insertions, 107 deletions
diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php
index 3c6cb0e138..2b6f9bf36d 100644
--- a/phpBB/phpbb/cache/driver/redis.php
+++ b/phpBB/phpbb/cache/driver/redis.php
@@ -157,4 +157,3 @@ class redis extends \phpbb\cache\driver\memory
return false;
}
}
-
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php
new file mode 100644
index 0000000000..4e62eab2d7
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php
@@ -0,0 +1,48 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class profilefield_location extends \phpbb\db\migration\profilefield_base_migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_on_memberlist',
+ );
+ }
+
+ protected $profilefield_name = 'phpbb_location';
+
+ protected $profilefield_database_type = array('VCHAR', '');
+
+ protected $profilefield_data = array(
+ 'field_name' => 'phpbb_location',
+ 'field_type' => 'profilefields.type.string',
+ 'field_ident' => 'phpbb_location',
+ 'field_length' => '20',
+ 'field_minlen' => '2',
+ 'field_maxlen' => '100',
+ 'field_novalue' => '',
+ 'field_default_value' => '',
+ 'field_validation' => '.*',
+ 'field_required' => 0,
+ 'field_show_novalue' => 0,
+ 'field_show_on_reg' => 0,
+ 'field_show_on_pm' => 1,
+ 'field_show_on_vt' => 1,
+ 'field_show_profile' => 1,
+ 'field_hide' => 0,
+ 'field_no_view' => 0,
+ 'field_active' => 1,
+ );
+
+ protected $user_column_name = 'user_from';
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php
new file mode 100644
index 0000000000..ce51944c3e
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php
@@ -0,0 +1,47 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class profilefield_on_memberlist extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_on_ml');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\profilefield_cleanup',
+ );
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'profile_fields' => array(
+ 'field_show_on_ml' => array('BOOL', 0),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'profile_fields' => array(
+ 'field_show_on_ml',
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 65098b643b..3a7207e743 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -492,7 +492,7 @@ class tools
// here lies an array, filled with information compiled on the column's data
$prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
- if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
+ if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen"
{
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
}
diff --git a/phpBB/phpbb/extension/exception.php b/phpBB/phpbb/extension/exception.php
index b1f4997fdd..82327c9d5e 100644
--- a/phpBB/phpbb/extension/exception.php
+++ b/phpBB/phpbb/extension/exception.php
@@ -18,4 +18,4 @@ class exception extends \UnexpectedValueException
{
return $this->getMessage();
}
-} \ No newline at end of file
+}
diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index 9d2aac329e..56485f5d37 100644
--- a/phpBB/phpbb/notification/type/report_pm_closed.php
+++ b/phpBB/phpbb/notification/type/report_pm_closed.php
@@ -114,7 +114,7 @@ class report_pm_closed extends \phpbb\notification\type\pm
*/
public function get_avatar()
{
- return $this->get_user_avatar($this->get_data('closer_id'));
+ return $this->user_loader->get_avatar($this->get_data('closer_id'));
}
/**
diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php
index 467dc2157f..57e7932341 100644
--- a/phpBB/phpbb/pagination.php
+++ b/phpBB/phpbb/pagination.php
@@ -76,107 +76,104 @@ class pagination
public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false)
{
$total_pages = ceil($num_items / $per_page);
-
- if ($total_pages == 1 || !$num_items)
- {
- return;
- }
-
$on_page = $this->get_on_page($per_page, $start);
-
- if ($reverse_count)
- {
- $start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
- $end_page = $total_pages;
- }
- else
- {
- // What we're doing here is calculating what the "start" and "end" pages should be. We
- // do this by assuming pagination is "centered" around the currently active page with
- // the three previous and three next page links displayed. Anything more than that and
- // we display the ellipsis, likewise anything less.
- //
- // $start_page is the page at which we start creating the list. When we have five or less
- // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that
- // and we calculate the start based on the active page. This is the min/max calculation.
- // First (max) would we end up starting on a page less than 1? Next (min) would we end
- // up starting so close to the end that we'd not display our minimum number of pages.
- //
- // $end_page is the last page in the list to display. Like $start_page we use a min/max to
- // determine this number. Again at most five pages? Then just display them all. More than
- // five and we first (min) determine whether we'd end up listing more pages than exist.
- // We then (max) ensure we're displaying the minimum number of pages.
- $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1;
- $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages;
- }
-
$u_previous_page = $u_next_page = '';
- if ($on_page != 1)
- {
- $u_previous_page = $this->generate_page_link($base_url, $on_page - 1, $start_name, $per_page);
- $this->template->assign_block_vars($block_var_name, array(
- 'PAGE_NUMBER' => '',
- 'PAGE_URL' => $u_previous_page,
- 'S_IS_CURRENT' => false,
- 'S_IS_PREV' => true,
- 'S_IS_NEXT' => false,
- 'S_IS_ELLIPSIS' => false,
- ));
- }
-
- // This do...while exists purely to negate the need for start and end assign_block_vars, i.e.
- // to display the first and last page in the list plus any ellipsis. We use this loop to jump
- // around a little within the list depending on where we're starting (and ending).
- $at_page = 1;
- do
+ if ($total_pages > 1)
{
- // We decide whether to display the ellipsis during the loop. The ellipsis is always
- // displayed as either the second or penultimate item in the list. So are we at either
- // of those points and of course do we even need to display it, i.e. is the list starting
- // on at least page 3 and ending three pages before the final item.
- $this->template->assign_block_vars($block_var_name, array(
- 'PAGE_NUMBER' => $at_page,
- 'PAGE_URL' => $this->generate_page_link($base_url, $at_page, $start_name, $per_page),
- 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page),
- 'S_IS_NEXT' => false,
- 'S_IS_PREV' => false,
- 'S_IS_ELLIPSIS' => ($at_page == 2 && $start_page > 2) || ($at_page == $total_pages - 1 && $end_page < $total_pages - 1),
- ));
-
- // We may need to jump around in the list depending on whether we have or need to display
- // the ellipsis. Are we on page 2 and are we more than one page away from the start
- // of the list? Yes? Then we jump to the start of the list. Likewise are we at the end of
- // the list and are there more than two pages left in total? Yes? Then jump to the penultimate
- // page (so we can display the ellipsis next pass). Else, increment the counter and keep
- // going
- if ($at_page == 2 && $at_page < $start_page - 1)
+ if ($reverse_count)
{
- $at_page = $start_page;
+ $start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
+ $end_page = $total_pages;
}
- else if ($at_page == $end_page && $end_page < $total_pages - 1)
+ else
{
- $at_page = $total_pages - 1;
+ // What we're doing here is calculating what the "start" and "end" pages should be. We
+ // do this by assuming pagination is "centered" around the currently active page with
+ // the three previous and three next page links displayed. Anything more than that and
+ // we display the ellipsis, likewise anything less.
+ //
+ // $start_page is the page at which we start creating the list. When we have five or less
+ // pages we start at page 1 since there will be no ellipsis displayed. Anymore than that
+ // and we calculate the start based on the active page. This is the min/max calculation.
+ // First (max) would we end up starting on a page less than 1? Next (min) would we end
+ // up starting so close to the end that we'd not display our minimum number of pages.
+ //
+ // $end_page is the last page in the list to display. Like $start_page we use a min/max to
+ // determine this number. Again at most five pages? Then just display them all. More than
+ // five and we first (min) determine whether we'd end up listing more pages than exist.
+ // We then (max) ensure we're displaying the minimum number of pages.
+ $start_page = ($total_pages > 5) ? min(max(1, $on_page - 3), $total_pages - 4) : 1;
+ $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages;
}
- else
+
+ if ($on_page != 1)
{
- $at_page++;
+ $u_previous_page = $this->generate_page_link($base_url, $on_page - 1, $start_name, $per_page);
+
+ $this->template->assign_block_vars($block_var_name, array(
+ 'PAGE_NUMBER' => '',
+ 'PAGE_URL' => $u_previous_page,
+ 'S_IS_CURRENT' => false,
+ 'S_IS_PREV' => true,
+ 'S_IS_NEXT' => false,
+ 'S_IS_ELLIPSIS' => false,
+ ));
}
- }
- while ($at_page <= $total_pages);
- if ($on_page != $total_pages)
- {
- $u_next_page = $this->generate_page_link($base_url, $on_page + 1, $start_name, $per_page);
+ // This do...while exists purely to negate the need for start and end assign_block_vars, i.e.
+ // to display the first and last page in the list plus any ellipsis. We use this loop to jump
+ // around a little within the list depending on where we're starting (and ending).
+ $at_page = 1;
+ do
+ {
+ // We decide whether to display the ellipsis during the loop. The ellipsis is always
+ // displayed as either the second or penultimate item in the list. So are we at either
+ // of those points and of course do we even need to display it, i.e. is the list starting
+ // on at least page 3 and ending three pages before the final item.
+ $this->template->assign_block_vars($block_var_name, array(
+ 'PAGE_NUMBER' => $at_page,
+ 'PAGE_URL' => $this->generate_page_link($base_url, $at_page, $start_name, $per_page),
+ 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page),
+ 'S_IS_NEXT' => false,
+ 'S_IS_PREV' => false,
+ 'S_IS_ELLIPSIS' => ($at_page == 2 && $start_page > 2) || ($at_page == $total_pages - 1 && $end_page < $total_pages - 1),
+ ));
- $this->template->assign_block_vars($block_var_name, array(
- 'PAGE_NUMBER' => '',
- 'PAGE_URL' => $u_next_page,
- 'S_IS_CURRENT' => false,
- 'S_IS_PREV' => false,
- 'S_IS_NEXT' => true,
- 'S_IS_ELLIPSIS' => false,
- ));
+ // We may need to jump around in the list depending on whether we have or need to display
+ // the ellipsis. Are we on page 2 and are we more than one page away from the start
+ // of the list? Yes? Then we jump to the start of the list. Likewise are we at the end of
+ // the list and are there more than two pages left in total? Yes? Then jump to the penultimate
+ // page (so we can display the ellipsis next pass). Else, increment the counter and keep
+ // going
+ if ($at_page == 2 && $at_page < $start_page - 1)
+ {
+ $at_page = $start_page;
+ }
+ else if ($at_page == $end_page && $end_page < $total_pages - 1)
+ {
+ $at_page = $total_pages - 1;
+ }
+ else
+ {
+ $at_page++;
+ }
+ }
+ while ($at_page <= $total_pages);
+
+ if ($on_page != $total_pages)
+ {
+ $u_next_page = $this->generate_page_link($base_url, $on_page + 1, $start_name, $per_page);
+
+ $this->template->assign_block_vars($block_var_name, array(
+ 'PAGE_NUMBER' => '',
+ 'PAGE_URL' => $u_next_page,
+ 'S_IS_CURRENT' => false,
+ 'S_IS_PREV' => false,
+ 'S_IS_NEXT' => true,
+ 'S_IS_ELLIPSIS' => false,
+ ));
+ }
}
// If the block_var_name is a nested block, we will use the last (most
@@ -203,6 +200,7 @@ class pagination
'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
+ $tpl_prefix . 'PAGE_NUMBER' => $this->on_page($num_items, $per_page, $start),
);
if ($tpl_block_name)
@@ -229,24 +227,15 @@ class pagination
/**
* Return current page
- * This function also sets certain specific template variables
*
- * @param string $base_url the base url used to call this page, used by Javascript for popup jump to page
* @param int $num_items the total number of items, posts, topics, etc.
* @param int $per_page the number of items, posts, etc. per page
* @param int $start the item which should be considered currently active, used to determine the page we're on
* @return string Descriptive pagination string (e.g. "page 1 of 10")
*/
- public function on_page($base_url, $num_items, $per_page, $start)
+ public function on_page($num_items, $per_page, $start)
{
$on_page = $this->get_on_page($per_page, $start);
-
- $this->template->assign_vars(array(
- 'PER_PAGE' => $per_page,
- 'ON_PAGE' => $on_page,
- 'BASE_URL' => $base_url,
- ));
-
return $this->user->lang('PAGE_OF', $on_page, max(ceil($num_items / $per_page), 1));
}
@@ -262,7 +251,7 @@ class pagination
{
if ($start < 0 || $start >= $num_items)
{
- return ($start < 0) ? 0 : floor(($num_items - 1) / $per_page) * $per_page;
+ return ($start < 0 || $num_items <= 0) ? 0 : floor(($num_items - 1) / $per_page) * $per_page;
}
return $start;
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index ead978374c..ac2542a6d4 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -243,6 +243,41 @@ class manager
}
/**
+ * Generate the template arrays in order to display the column names
+ *
+ * @param string $restrict_option Restrict the published fields to a certain profile field option
+ * @return array Returns an array with the template variables type, name and explain for the fields to display
+ */
+ public function generate_profile_fields_template_headlines($restrict_option = '')
+ {
+ if (!sizeof($this->profile_cache))
+ {
+ $this->build_cache();
+ }
+
+ $tpl_fields = array();
+
+ // Go through the fields in correct order
+ foreach ($this->profile_cache as $field_ident => $field_data)
+ {
+ if ($restrict_option && !$field_data[$restrict_option])
+ {
+ continue;
+ }
+
+ $profile_field = $this->type_collection[$field_data['field_type']];
+
+ $tpl_fields[] = array(
+ 'PROFILE_FIELD_TYPE' => $field_data['field_type'],
+ 'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
+ 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']),
+ );
+ }
+
+ return $tpl_fields;
+ }
+
+ /**
* Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled)
* This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template
*/
diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php
index 12a14d9b83..9d241c49ef 100644
--- a/phpBB/phpbb/profilefields/type/type_string.php
+++ b/phpBB/phpbb/profilefields/type/type_string.php
@@ -60,7 +60,7 @@ class type_string extends type_string_common
$options = array(
0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" name="field_length" size="5" value="' . $field_data['field_length'] . '" />'),
1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_minlen" size="5" value="' . $field_data['field_minlen'] . '" />'),
- 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" size="5" value="' . $field_data['field_maxlen'] . '" />'),
+ 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" name="field_maxlen" size="5" value="' . $field_data['field_maxlen'] . '" />'),
3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options($field_data) . '</select>'),
);
diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php
index b03624593e..b6940cf51f 100644
--- a/phpBB/phpbb/request/deactivated_super_global.php
+++ b/phpBB/phpbb/request/deactivated_super_global.php
@@ -112,4 +112,3 @@ class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAgg
$this->error();
}
}
-
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index b2ab187a70..2a7cc602da 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -183,7 +183,7 @@ class user extends \phpbb\session
unset($lang_set_ext);
$style_request = request_var('style', 0);
- if ($style_request && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
+ if ($style_request && (!$config['override_user_style'] || $auth->acl_get('a_styles')) && !defined('ADMIN_START'))
{
global $SID, $_EXTRA_URL;