diff --git a/phpBB/adm/style/acp_storage.html b/phpBB/adm/style/acp_storage.html new file mode 100644 index 0000000000..39125f25ae --- /dev/null +++ b/phpBB/adm/style/acp_storage.html @@ -0,0 +1,36 @@ + + + + +

{L_TITLE}

+ +

{L_TITLE_EXPLAIN}

+ +
+ + +
+ {storage.LEGEND} +
+

{storage.TITLE_EXPLAIN}
+
+
+
+ + +
+ {adapter.NAME} + {adapter.SETTINGS} +
+ + + +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php new file mode 100644 index 0000000000..cbf2a56bba --- /dev/null +++ b/phpBB/includes/acp/acp_storage.php @@ -0,0 +1,132 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_storage +{ + /** @var \phpbb\config $config */ + protected $config; + + /** @var \phpbb\language\language $lang */ + protected $lang; + + /** @var \phpbb\request\request */ + protected $request; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** @var string */ + public $page_title; + + /** @var string */ + public $tpl_name; + + /** @var string */ + public $u_action; + + public function main($id, $mode) + { + global $phpbb_container; + + $this->config = $phpbb_container->get('config'); + $this->lang = $phpbb_container->get('language'); + $this->request = $phpbb_container->get('request'); + $this->template = $phpbb_container->get('template'); + $this->user = $phpbb_container->get('user'); + + // Add necesary language files + $this->user->add_lang(array('acp/storage')); + + switch($mode) + { + case 'settings': + $this->overview($id, $mode); + break; + } + } + + public function overview($id, $mode) + { + $form_name = 'acp_storage'; + add_form_key($form_name); + + global $phpbb_container; + $storage_collection = $phpbb_container->get('storage.storage_collection'); + $adapter_provider_collection = $phpbb_container->get('storage.provider_collection'); + + $storages = array(); + + foreach($storage_collection->getIterator() as $storage) + { + $this->template->assign_block_vars('storage', array( + 'LEGEND' => $storage->get_name(), + 'TITLE' => $storage->get_name(), + 'TITLE_EXPLAIN' => $storage->get_description(), + 'OPTIONS' => $this->generate_adapter_options(), + )); + + foreach($adapter_provider_collection as $provider) + { + if(!$provider->is_available()) + { + continue; + } + + $this->template->assign_block_vars('storage.adapter', array( + 'NAME' => get_class($provider), + 'SETTINGS' => print_r($provider->get_options(), 1), + )); + } + } + + // Template from adm/style + $this->tpl_name = 'acp_storage'; + + // Set page title + $this->page_title = 'STORAGE_TITLE'; + + $this->template->assign_vars(array( + )); + } + + protected function generate_adapter_options() + { + global $phpbb_container; + $adapter_provider_collection = $phpbb_container->get('storage.provider_collection'); + + $options = ''; + + foreach($adapter_provider_collection as $provider) + { + $class = get_class($provider); + $options .= ""; + } + + return $options; + } +} diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index fbe36bee05..b965d2e784 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -407,6 +407,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_reasons', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_roles', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_search', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_server', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_storage', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_styles', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_switchperm', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_uauth', 1); @@ -522,7 +523,7 @@ INSERT INTO phpbb_ranks (rank_title, rank_min, rank_special, rank_image) VALUES # -- Roles data # Standard Admin (a_) -INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 1, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option NOT IN ('a_switchperm', 'a_jabber', 'a_phpinfo', 'a_server', 'a_backup', 'a_styles', 'a_clearlogs', 'a_modules', 'a_language', 'a_email', 'a_bots', 'a_search', 'a_aauth', 'a_roles'); +INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 1, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option NOT IN ('a_switchperm', 'a_jabber', 'a_phpinfo', 'a_server', 'a_backup', 'a_styles', 'a_clearlogs', 'a_modules', 'a_language', 'a_email', 'a_bots', 'a_search', 'a_storage', 'a_aauth', 'a_roles'); # Forum admin (a_) INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 2, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option IN ('a_', 'a_authgroups', 'a_authusers', 'a_fauth', 'a_forum', 'a_forumadd', 'a_forumdel', 'a_mauth', 'a_prune', 'a_uauth', 'a_viewauth', 'a_viewlogs'); diff --git a/phpBB/language/en/acp/storage.php b/phpBB/language/en/acp/storage.php new file mode 100644 index 0000000000..36c8641431 --- /dev/null +++ b/phpBB/language/en/acp/storage.php @@ -0,0 +1,40 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( +)); diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index 089ccce737..be5d813056 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -45,6 +45,21 @@ class storage $this->storage_name = $storage_name; } + public function get_id() + { + return $this->storage_name; + } + + public function get_name() + { + return strtoupper('STORAGE_' . $this->storage_name . '_NAME'); + } + + public function get_description() + { + return strtoupper('STORAGE_' . $this->storage_name . '_DESCRIPTION'); + } + /** * Returns an adapter instance *