diff options
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 27 | ||||
-rw-r--r-- | phpBB/index.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/acp/styles.php | 1 | ||||
-rw-r--r-- | phpBB/language/en/memberlist.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/db.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/manager.php | 40 | ||||
-rw-r--r-- | phpBB/phpbb/captcha/plugins/recaptcha.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/message/topic_form.php | 2 | ||||
-rw-r--r-- | phpBB/posting.php | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/forumlist_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_email.html | 2 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/memberlist_email.html | 4 | ||||
-rw-r--r-- | tests/avatar/fixtures/users.xml | 28 | ||||
-rw-r--r-- | tests/avatar/manager_test.php | 56 |
14 files changed, 145 insertions, 31 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index af3fd7937c..6bd27a8bca 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -29,14 +29,31 @@ class acp_styles protected $styles_path; protected $styles_path_absolute = 'styles'; protected $default_style = 0; + protected $styles_list_cols = 0; + protected $reserved_style_names = array('adm', 'admin', 'all'); + /** @var \phpbb\db\driver\driver_interface */ protected $db; + + /** @var \phpbb\user */ protected $user; + + /** @var \phpbb\template\template */ protected $template; + + /** @var \phpbb\request\request_interface */ protected $request; + + /** @var \phpbb\cache\driver\driver_interface */ protected $cache; + + /** @var \phpbb\auth\auth */ protected $auth; + + /** @var string */ protected $phpbb_root_path; + + /** @var string */ protected $php_ext; public function main($id, $mode) @@ -164,6 +181,12 @@ class acp_styles $last_installed = false; foreach ($dirs as $dir) { + if (in_array($dir, $this->reserved_style_names)) + { + $messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir)); + continue; + } + $found = false; foreach ($styles as &$style) { @@ -809,7 +832,7 @@ class acp_styles * Update styles tree * * @param array $styles Styles list, passed as reference - * @param array $style Current style, false if root + * @param array|false $style Current style, false if root * @return bool True if something was updated, false if not */ protected function update_styles_tree(&$styles, $style = false) @@ -1091,7 +1114,7 @@ class acp_styles /** * Install style * - * @param $style style data + * @param array $style style data * @return int Style id */ protected function install_style($style) diff --git a/phpBB/index.php b/phpBB/index.php index a36d74e0e9..df6932f6c0 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -185,7 +185,7 @@ $template->assign_vars(array( 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '') ); -$page_title = $user->lang['INDEX']; +$page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX']; /** * You can use this event to modify the page title and load data for the index diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 506d569d56..e6b05c8282 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -74,6 +74,7 @@ $lang = array_merge($lang, array( 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', 'STYLE_NAME' => 'Style name', + 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', 'STYLE_PATH' => 'Style path', 'STYLE_UNINSTALL' => 'Uninstall', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index b8c626d331..5605f8f4b5 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -48,7 +48,7 @@ $lang = array_merge($lang, array( 'BEFORE' => 'Before', - 'CC_EMAIL' => 'Send a copy of this email to yourself.', + 'CC_SENDER' => 'Send a copy of this email to yourself.', 'CONTACT_ADMIN' => 'Contact a Board Administrator', 'DEST_LANG' => 'Language', diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index ba67c11e75..d8c5fb72de 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -232,7 +232,7 @@ class db extends \phpbb\auth\provider\base // Give status about wrong password... return array( 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD, - 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD', + 'error_msg' => 'LOGIN_ERROR_PASSWORD', 'user_row' => $row, ); } diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 42ae61a9a2..8d83152ed6 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -326,17 +326,41 @@ class manager $driver->delete($avatar_data); } - $result = self::$default_row; + $result = $this->prefix_avatar_columns($prefix, self::$default_row); - foreach ($result as $key => $value) + $sql = 'UPDATE ' . $table . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id']; + $db->sql_query($sql); + + // Make sure we also delete this avatar from the users + if ($prefix === 'group_') { - $result[$prefix . $key] = $value; - unset($result[$key]); + $result = $this->prefix_avatar_columns('user_', self::$default_row); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . " + WHERE user_avatar = '" . $db->sql_escape($avatar_data['avatar']) . "'"; + $db->sql_query($sql); } + } - $sql = 'UPDATE ' . $table . ' - SET ' . $db->sql_build_array('UPDATE', $result) . ' - WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id']; - $db->sql_query($sql); + /** + * Prefix avatar columns + * + * @param string $prefix Column prefix + * @param array $data Column data + * + * @return array Column data with prefixed column names + */ + public function prefix_avatar_columns($prefix, $data) + { + foreach ($data as $key => $value) + { + $data[$prefix . $key] = $value; + unset($data[$key]); + } + + return $data; } } diff --git a/phpBB/phpbb/captcha/plugins/recaptcha.php b/phpBB/phpbb/captcha/plugins/recaptcha.php index ea446d7bc3..584f3afec1 100644 --- a/phpBB/phpbb/captcha/plugins/recaptcha.php +++ b/phpBB/phpbb/captcha/plugins/recaptcha.php @@ -26,8 +26,10 @@ class recaptcha extends captcha_abstract var $challenge; var $response; - // PHP4 Constructor - function phpbb_recaptcha() + /** + * Constructor + */ + public function __construct() { global $request; $this->recaptcha_server = $request->is_secure() ? $this->recaptcha_server_secure : $this->recaptcha_server; diff --git a/phpBB/phpbb/message/topic_form.php b/phpBB/phpbb/message/topic_form.php index 1e0f2a1945..174643bb81 100644 --- a/phpBB/phpbb/message/topic_form.php +++ b/phpBB/phpbb/message/topic_form.php @@ -117,7 +117,7 @@ class topic_form extends form 'TOPIC_NAME' => htmlspecialchars_decode($this->topic_row['topic_title']), 'U_TOPIC' => generate_board_url() . '/viewtopic.' . $this->phpEx . '?f=' . $this->topic_row['forum_id'] . '&t=' . $this->topic_id, )); - + $this->message->set_body($this->body); $this->message->add_recipient( $this->recipient_name, $this->recipient_address, diff --git a/phpBB/posting.php b/phpBB/posting.php index 4c32276d17..dda7455845 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1161,7 +1161,7 @@ if ($submit || $preview || $refresh) break; } - if (!$auth->acl_get($auth_option, $forum_id)) + if ($auth_option != '' && !$auth->acl_get($auth_option, $forum_id)) { // There is a special case where a user edits his post whereby the topic type got changed by an admin/mod. // Another case would be a mod not having sticky permissions for example but edit permissions. diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index c90f5b0639..3e7a2cd102 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -80,6 +80,8 @@ {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} <!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<br /> <!-- ENDIF --></span> </dd> + <!-- ELSE --> + <dd> </dd> <!-- ENDIF --> </dl> <!-- EVENT forumlist_body_forum_row_append --> diff --git a/phpBB/styles/prosilver/template/memberlist_email.html b/phpBB/styles/prosilver/template/memberlist_email.html index e848844093..1bfd83e3a1 100644 --- a/phpBB/styles/prosilver/template/memberlist_email.html +++ b/phpBB/styles/prosilver/template/memberlist_email.html @@ -80,7 +80,7 @@ <!-- IF S_REGISTERED_USER --> <dl> <dt> </dt> - <dd><label for="cc_email"><input type="checkbox" name="cc_email" id="cc_email" value="1" checked="checked" tabindex="5" /> {L_CC_EMAIL}</label></dd> + <dd><label for="cc_sender"><input type="checkbox" name="cc_sender" id="cc_sender" value="1" checked="checked" tabindex="5" /> {L_CC_SENDER}</label></dd> </dl> <!-- ENDIF --> </fieldset> diff --git a/phpBB/styles/subsilver2/template/memberlist_email.html b/phpBB/styles/subsilver2/template/memberlist_email.html index b52513c241..1416aa0c10 100644 --- a/phpBB/styles/subsilver2/template/memberlist_email.html +++ b/phpBB/styles/subsilver2/template/memberlist_email.html @@ -72,8 +72,8 @@ <td class="row2"> <table cellspacing="0" cellpadding="1" border="0"> <tr> - <td><input type="checkbox" class="radio" name="cc_email" value="1" checked="checked" /></td> - <td class="gen">{L_CC_EMAIL}</td> + <td><input type="checkbox" class="radio" name="cc_sender" value="1" checked="checked" /></td> + <td class="gen">{L_CC_SENDER}</td> </tr> </table> </td> diff --git a/tests/avatar/fixtures/users.xml b/tests/avatar/fixtures/users.xml index 3e6586e909..1773d438c2 100644 --- a/tests/avatar/fixtures/users.xml +++ b/tests/avatar/fixtures/users.xml @@ -29,5 +29,33 @@ <value></value> <value></value> </row> + <row> + <value>3</value> + <value>foo</value> + <value></value> + <value></value> + <value>g5_1414350991.jpg</value> + <value>avatar.driver.upload</value> + <value>80</value> + <value>80</value> + </row> + </table> + <table name="phpbb_groups"> + <column>group_id</column> + <column>group_type</column> + <column>group_name</column> + <column>group_avatar</column> + <column>group_avatar_type</column> + <column>group_avatar_width</column> + <column>group_avatar_height</column> + <row> + <value>5</value> + <value>3</value> + <value>ADMINISTRATORS</value> + <value>g5_1414350991.jpg</value> + <value>avatar.driver.upload</value> + <value>80</value> + <value>80</value> + </row> </table> </dataset> diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 81c153aed4..a109a7b5de 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -299,17 +299,32 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case public function data_handle_avatar_delete() { return array( - array(array( - 'avatar' => '', - 'avatar_type' => '', - 'avatar_width' => 0, - 'avatar_height' => 0, - ), 1, array( - 'avatar' => 'foobar@example.com', - 'avatar_type' => 'avatar.driver.gravatar', - 'avatar_width' => '16', - 'avatar_height' => '16', - ), USERS_TABLE, 'user_'), + array( + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), 1, array( + 'avatar' => 'foobar@example.com', + 'avatar_type' => 'avatar.driver.gravatar', + 'avatar_width' => '16', + 'avatar_height' => '16', + ), USERS_TABLE, 'user_', + ), + array( + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), 5, array( + 'avatar' => 'g5_1414350991.jpg', + 'avatar_type' => 'avatar.driver.upload', + 'avatar_width' => '80', + 'avatar_height' => '80' + ), GROUPS_TABLE, 'group_', + ), ); } @@ -333,4 +348,23 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $this->assertEquals($value, $row[$key]); } } + + /** + * @dependsOn test_handle_avatar_delete + */ + public function test_user_group_avatar_deleted() + { + $sql = 'SELECT * FROM ' . USERS_TABLE . ' + WHERE user_id = 3'; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->manager->clean_row($this->db->sql_fetchrow($result), 'user'); + $this->db->sql_freeresult($result); + + $this->assertEquals(array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => 0, + 'avatar_height' => 0, + ), $row); + } } |