diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_attachments.php | 35 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_bbcodes.php | 6 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 26 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 18 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 7 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewmessage.php | 30 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 37 |
8 files changed, 126 insertions, 35 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 3cfe5de293..2480f1f025 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -922,6 +922,9 @@ class acp_attachments case 'orphan': + /* @var $pagination \phpbb\pagination */ + $pagination = $this->phpbb_container->get('pagination'); + if ($submit) { $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); @@ -1064,13 +1067,29 @@ class acp_attachments 'S_ORPHAN' => true) ); + $attachments_per_page = (int) $config['topics_per_page']; + + // Get total number or orphans older than 3 hours + $sql = 'SELECT COUNT(attach_id) as num_files, SUM(filesize) as total_size + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $num_files = (int) $row['num_files']; + $total_size = (int) $row['total_size']; + $this->db->sql_freeresult($result); + + $start = $request->variable('start', 0); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + // Just get the files with is_orphan set and older than 3 hours $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' WHERE is_orphan = 1 AND filetime < ' . (time() - 3*60*60) . ' ORDER BY filetime DESC'; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, $attachments_per_page, $start); while ($row = $db->sql_fetchrow($result)) { @@ -1086,6 +1105,20 @@ class acp_attachments } $db->sql_freeresult($result); + $pagination->generate_template_pagination( + $this->u_action, + 'pagination', + 'start', + $num_files, + $attachments_per_page, + $start + ); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + )); + break; case 'manage': diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index f958ae93c7..18d574081a 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -553,10 +553,10 @@ class acp_bbcodes } // Lowercase tags - $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+=?).*/i', '$1', $bbcode_match); - $bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+)=?.*/i', '$1', $bbcode_match); + $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match); + $bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match); - if (!preg_match('/^[a-zA-Z0-9_-]+=?$/', $bbcode_tag)) + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag)) { global $user; trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index b954f90451..4c390c5f0e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -398,7 +398,7 @@ class acp_styles // Reset default style for users who use selected styles $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = 0 + SET user_style = ' . (int) $this->default_style . ' WHERE user_style IN (' . implode(', ', $ids) . ')'; $this->db->sql_query($sql); @@ -1249,7 +1249,7 @@ class acp_styles // Change default style for users $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = 0 + SET user_style = ' . (int) $this->default_style . ' WHERE user_style = ' . $id; $this->db->sql_query($sql); @@ -1355,18 +1355,18 @@ class acp_styles } // Hardcoded template bitfield to add for new templates + $default_bitfield = '1111111111111'; + $bitfield = new bitfield(); - $bitfield->set(0); - $bitfield->set(1); - $bitfield->set(2); - $bitfield->set(3); - $bitfield->set(4); - $bitfield->set(8); - $bitfield->set(9); - $bitfield->set(11); - $bitfield->set(12); - $value = $bitfield->get_base64(); - return $value; + for ($i = 0; $i < strlen($default_bitfield); $i++) + { + if ($default_bitfield[$i] == '1') + { + $bitfield->set($i); + } + } + + return $bitfield->get_base64(); } } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cf442bbc33..beaa1d11f1 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -813,16 +813,22 @@ class acp_users break; default: + $u_action = $this->u_action; + /** * Run custom quicktool code * * @event core.acp_users_overview_run_quicktool - * @var array user_row Current user data * @var string action Quick tool that should be run + * @var array user_row Current user data + * @var string u_action The u_action link * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added u_action */ - $vars = array('action', 'user_row'); + $vars = array('action', 'user_row', 'u_action'); extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); + + unset($u_action); break; } @@ -1485,12 +1491,14 @@ class acp_users * Validate profile data in ACP before submitting to the database * * @event core.acp_users_profile_validate - * @var bool submit Flag indicating if submit button has been pressed * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data * @var array error Array with the form errors * @since 3.1.4-RC1 + * @changed 3.1.12-RC1 Removed submit, added user_id, user_row */ - $vars = array('submit', 'data', 'error'); + $vars = array('data', 'user_id', 'user_row', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); if (!sizeof($error)) @@ -2489,7 +2497,7 @@ class acp_users 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', - 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], + 'GROUP_NAME' => $group_helper->get_name($data['group_name']), 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 43d8cce3c4..2cd62d7bac 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4070,11 +4070,6 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) if ($driver) { $html = $driver->get_custom_html($user, $row, $alt); - if (!empty($html)) - { - return $html; - } - $avatar_data = $driver->get_data($row); } else @@ -4082,7 +4077,7 @@ function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) $avatar_data['src'] = ''; } - if (!empty($avatar_data['src'])) + if (empty($html) && !empty($avatar_data['src'])) { if ($lazy) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 32bee14eef..171a73a8de 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -537,7 +537,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Create last post link information, if appropriate if ($row['forum_last_post_id']) { - if ($row['forum_password_last_post'] === '' && $auth->acl_get('f_read', $row['forum_id_last_post'])) + if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post'])) { $last_post_subject = censor_text($row['forum_last_post_subject']); $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 48d14a133c..cf767a7cce 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -267,6 +267,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) * @var array user_info User data of the sender * @since 3.1.0-a1 * @changed 3.1.6-RC1 Added user_info into event + * @changed 3.2.2-RC1 Deprecated + * @deprecated 4.0.0 Event name is misspelled and is replaced with new event with correct name */ $vars = array( 'id', @@ -281,6 +283,34 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) ); extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_messsage', compact($vars))); + /** + * Modify pm and sender data before it is assigned to the template + * + * @event core.ucp_pm_view_message + * @var mixed id Active module category (can be int or string) + * @var string mode Active module + * @var int folder_id ID of the folder the message is in + * @var int msg_id ID of the private message + * @var array folder Array with data of user's message folders + * @var array message_row Array with message data + * @var array cp_row Array with senders custom profile field data + * @var array msg_data Template array with message data + * @var array user_info User data of the sender + * @since 3.2.2-RC1 + */ + $vars = array( + 'id', + 'mode', + 'folder_id', + 'msg_id', + 'folder', + 'message_row', + 'cp_row', + 'msg_data', + 'user_info', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_message', compact($vars))); + $template->assign_vars($msg_data); $contact_fields = array( diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 3d70c42256..a7a93d6115 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -527,7 +527,6 @@ class ucp_register { $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); } - $s_hidden_fields = build_hidden_fields($s_hidden_fields); // Visual Confirmation - Show images if ($config['enable_confirm']) @@ -553,8 +552,7 @@ class ucp_register // Assign template vars for timezone select phpbb_timezone_select($template, $user, $data['tz'], true); - $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', + $template_vars = array( 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], @@ -569,13 +567,41 @@ class ucp_register 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_REGISTRATION' => true, 'S_COPPA' => $coppa, - 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), 'COOKIE_NAME' => $config['cookie_name'], 'COOKIE_PATH' => $config['cookie_path'], + ); + + $tpl_name = 'ucp_register'; + + /** + * Modify template data on the registration page + * + * @event core.ucp_register_modify_template_data + * @var array template_vars Array with template data + * @var array data Array with user data, read only + * @var array error Array with errors + * @var array s_hidden_fields Array with hidden field elements + * @var string tpl_name Template name + * @since 3.2.2-RC1 + */ + $vars = array( + 'template_vars', + 'data', + 'error', + 's_hidden_fields', + 'tpl_name', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); + + $template_vars = array_merge($template_vars, array( + 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), )); + $template->assign_vars($template_vars); + // $user->profile_fields = array(); @@ -583,8 +609,7 @@ class ucp_register $cp->generate_profile_fields('register', $user->get_iso_lang_id()); // - $this->tpl_name = 'ucp_register'; - $this->page_title = 'UCP_REGISTRATION'; + $this->tpl_name = $tpl_name; } /** |