diff --git a/phpBB/adm/style/acp_ext_delete.html b/phpBB/adm/style/acp_ext_delete.html new file mode 100644 index 0000000000..1ce99b8905 --- /dev/null +++ b/phpBB/adm/style/acp_ext_delete.html @@ -0,0 +1,27 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+

{L_ENABLE_EXPLAIN}

+ + +

{L_DELETE_CONFIRM}

+ +
+
+ {L_DELETE} + +
+
+ +
+

{L_DELETE_SUCESS}

+
+

{L_RETURN}

+
+ + + \ No newline at end of file diff --git a/phpBB/adm/style/acp_ext_disable.html b/phpBB/adm/style/acp_ext_disable.html new file mode 100644 index 0000000000..2198db09a1 --- /dev/null +++ b/phpBB/adm/style/acp_ext_disable.html @@ -0,0 +1,27 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+

{L_ENABLE_EXPLAIN}

+ + +

{L_DISABLE_CONFIRM}

+ +
+
+ {L_DISABLE} + +
+
+ +
+

{L_DISABLE_SUCESS}

+
+

{L_RETURN}

+
+ + + \ No newline at end of file diff --git a/phpBB/adm/style/acp_ext_enable.html b/phpBB/adm/style/acp_ext_enable.html new file mode 100644 index 0000000000..4c94ce7b2b --- /dev/null +++ b/phpBB/adm/style/acp_ext_enable.html @@ -0,0 +1,27 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+

{L_ENABLE_EXPLAIN}

+ + +

{L_ENABLE_CONFIRM}

+ +
+
+ {L_ENABLE} + +
+
+ +
+

{L_ENABLE_SUCESS}

+
+

{L_RETURN}

+
+ + + \ No newline at end of file diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html new file mode 100644 index 0000000000..7058c9c7f7 --- /dev/null +++ b/phpBB/adm/style/acp_ext_list.html @@ -0,0 +1,60 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_NAME}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}
+ {L_ENABLED} {L_EXTENSIONS} +
{enabled.EXT_NAME}{L_DETAILS}{L_DISABLE} | {L_PURGE}
{L_DISABLED} {L_EXTENSIONS}
{disabled.EXT_NAME}{L_DETAILS}{L_ENABLE} | {L_PURGE} | {L_DELETE}
{L_AVALIABLE} {L_EXTENSIONS}
{avaliable.EXT_NAME}{L_DETAILS}{L_ENABLE} | {L_DELETE}
+ + \ No newline at end of file diff --git a/phpBB/adm/style/acp_ext_purge.html b/phpBB/adm/style/acp_ext_purge.html new file mode 100644 index 0000000000..c73bbe6e00 --- /dev/null +++ b/phpBB/adm/style/acp_ext_purge.html @@ -0,0 +1,27 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+

{L_ENABLE_EXPLAIN}

+ + +

{L_PURGE_CONFIRM}

+ +
+
+ {L_PURGE} + +
+
+ +
+

{L_PURGE_SUCESS}

+
+

{L_RETURN}

+
+ + + \ No newline at end of file diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php new file mode 100644 index 0000000000..a0a7db4474 --- /dev/null +++ b/phpBB/includes/acp/acp_extensions.php @@ -0,0 +1,265 @@ +add_lang(array('install', 'acp/customisations')); + + $this->page_title = 'ACP_EXTENSIONS'; + + $action = $request->variable('action', ''); + $ext_name = $request->variable('ext_name', ''); + + // Set action to list if not set + if (empty($action)) + { + $action = "list"; + } + + // What are we doing? + switch ($action) + { + case 'list': + default: + $this->list_enabled_exts(); + $this->list_disabled_exts(); + $this->tpl_name = 'acp_ext_list'; + break; + + case 'enable_pre': + $this->tpl_name = 'acp_ext_enable'; + $template->assign_vars(array( + 'PRE' => true, + 'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . $ext_name, + ) + ); + break; + + case 'enable': + $name = $request->variable('ext_name', ''); + $this->enable_extension($name); + $this->tpl_name = 'acp_ext_enable'; + break; + + case 'disable_pre': + $this->tpl_name = 'acp_ext_disable'; + $template->assign_vars(array( + 'PRE' => true, + 'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . $ext_name, + ) + ); + break; + + case 'disable': + $name = $request->variable('ext_name', ''); + $this->disable_extension($name); + $this->tpl_name = 'acp_ext_disable'; + break; + + case 'purge_pre': + $this->tpl_name = 'acp_ext_purge'; + $template->assign_vars(array( + 'PRE' => true, + 'U_PURGE' => $this->u_action . '&action=purge&ext_name=' . $ext_name, + ) + ); + break; + + case 'purge': + $name = $request->variable('ext_name', ''); + $this->purge_extension($name); + $this->tpl_name = 'acp_ext_purge'; + break; + + case 'delete_pre': + $this->tpl_name = 'acp_ext_delete'; + $template->assign_vars(array( + 'PRE' => true, + 'U_DELETE' => $this->u_action . '&action=delete&ext_name=' . $ext_name, + ) + ); + break; + + case 'delete': + $name = $request->variable('ext_name', ''); + $this->tpl_name = 'acp_ext_delete'; + break; + + case 'details': + $name = $request->variable('ext_name', ''); + $filepath = $phpbb_root_path . 'ext/' . $name . '/extension.json'; + $this->tpl_name = 'acp_ext_details'; + $this->get_meta_info($filepath); + break; + } + } + + function enable_extension($name) + { + global $phpbb_extension_manager, $template, $cache; + + $phpbb_extension_manager->enable($name); + $template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + $cache->purge(); + } + + function disable_extension($name) + { + global $phpbb_extension_manager, $template, $cache; + $phpbb_extension_manager->disable($name); + $template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + $cache->purge(); + } + + function purge_extension($name) + { + global $phpbb_extension_manager, $template, $cache; + $phpbb_extension_manager->purge($name); + $template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + $cache->purge(); + } + + function list_enabled_exts() + { + global $db, $template; + + $sql = 'SELECT ext_name + FROM ' . EXT_TABLE . ' + WHERE ext_active= 1 + ORDER BY ext_name ASC'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('enabled', array( + 'EXT_NAME' => $row['ext_name'], + + 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $row['ext_name'], + 'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $row['ext_name'], + 'U_DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . $row['ext_name'], + )); + } + $db->sql_freeresult($result); + + return; + } + + function list_disabled_exts() + { + global $db, $template; + + $sql = 'SELECT ext_name + FROM ' . EXT_TABLE . ' + WHERE ext_active= 0 + ORDER BY ext_name ASC'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('disabled', array( + 'EXT_NAME' => $row['ext_name'], + + 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $row['ext_name'], + 'U_PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . $row['ext_name'], + 'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $row['ext_name'], + 'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $row['ext_name'], + )); + } + $db->sql_freeresult($result); + + return; + } + + function list_avaliable_exts() + { + $phpbb_extension_manager->load_extensions(); + $allavailable = array_keys($phpbb_extension_manager->all_available()); + $allconfigured = array_keys($phpbb_extension_manager->all_configured()); + $uninstalled = array_diff($allavailable, $allconfigured); + + foreach ($uninstalled as $ext) + { + $template->assign_block_vars('disabled', array( + 'EXT_NAME' => $ext['ext_name'], + + 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . $ext['ext_name'], + 'U_DELETE' => $this->u_action . '&action=delete_pre&ext_name=' . $ext['ext_name'], + 'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $ext['ext_name'], + )); + } + + return; + } + + function get_meta_info($filepath) + { + global $template; + + $metadatafile = file_get_contents($filepath); + $metadata = json_decode($metadatafile,true); + + $name = $metadata["name"]; + $type = $metadata["type"]; + $description = $metadata["description"]; + $homepage = $metadata["homepage"]; + $version = $metadata["version"]; + $time = $metadata["time"]; + $licence = $metadata["licence"]; + $require_php = $metadata["require"]["php"]; + $require_phpbb = $metadata["require"]["phpbb"]; + $display_name = $metadata["extra"]["display-name"]; + + $template->assign_vars(array( + 'NAME' => $name, + 'TYPE' => $type, + 'DESCRIPTION' => $description, + 'HOMEPAGE' => $homepage, + 'VERSION' => $version, + 'TIME' => $time, + 'LICENSE' => $licence, + 'REQUIRE_PHP' => $require_php, + 'REQUIRE_PHPBB' => $require_phpbb, + 'DISPLAY_NAME' => $display_name, + ) + ); + + foreach ($metadata["authors"] as $author) + { + $template->assign_block_vars('authors', array( + 'AUTHOR_NAME' => $author["name"], + 'AUTHOR_USERNAME' => $author["username"], + 'AUTHOR_EMAIL' => $author["email"], + 'AUTHOR_HOMEPAGE' => $author["homepage"], + 'AUTHOR_TYPE' => $author["type"], + )); + } + } +} diff --git a/phpBB/includes/acp/info/acp_extensions.php b/phpBB/includes/acp/info/acp_extensions.php new file mode 100644 index 0000000000..87e30bf25d --- /dev/null +++ b/phpBB/includes/acp/info/acp_extensions.php @@ -0,0 +1,34 @@ + 'acp_extensions', + 'title' => 'ACP_EXTENSIONS', + 'version' => '1.0.0', + 'modes' => array( + 'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_CAT_SYSTEM')), + ), + ); + } + + function install() + { + } + + function uninstall() + { + } +} diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ea7864bd4c..ae7b9fcba3 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -345,6 +345,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_board', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bots', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_clearlogs', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_email', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_extensions', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_fauth', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forum', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumadd', 1); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 04df897dba..5eb10d50b3 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -81,6 +81,7 @@ $lang = array_merge($lang, array( 'ACP_EMAIL_SETTINGS' => 'Email settings', 'ACP_EXTENSION_GROUPS' => 'Manage extension groups', + 'ACP_EXTENSIONS' => 'Manage board extensions', 'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions', 'ACP_FORUM_LOGS' => 'Forum logs', diff --git a/phpBB/language/en/acp/customisations.php b/phpBB/language/en/acp/customisations.php new file mode 100644 index 0000000000..7ba463bc81 --- /dev/null +++ b/phpBB/language/en/acp/customisations.php @@ -0,0 +1,100 @@ + 'Extension', + 'EXTENSIONS' => 'Extensions', + 'EXTENSIONS_ADMIN' => 'Extensions Admin', + 'EXTENSIONS_EXPLAIN' => 'The Extensions Admin is a tool in your phpBB Board which allows you to manage all of your extensions. For more information about extensions please visit this page on phpBBs Offical Website.', + + 'DETAILS' => 'Details', + + 'AVALIABLE' => 'Avaliable', + 'ENABLED' => 'Enabled', + 'DISBALED' => 'Disabled', + + 'ENABLE' => 'Enable', + 'DISABLE' => 'Disable', + 'PURGE' => 'Purge', + 'DELETE' => 'Delete', + + 'ENABLED' => 'Enabled', + 'DISABLED' => 'Disabled', + 'PURGED' => 'Purged', + 'DELETED' => 'Deleted', + + 'ENABLE_EXPLAIN' => 'Enabling an extension allows you to use it on your board.', + 'DISABLE_EXPLAIN' => 'Disabling an extension keeps the files and data intact but is not working on your board.', + 'PURGE_EXPLAIN' => 'Purging an extension keeps the files but not the data on your board.', + 'DELETE_EXPLAIN' => 'Deleting an extension removes all traces of the extension except from your logs.', + + 'ENABLE_SUCESS' => 'Your extension was enabled sucessfully', + 'DISABLE_SUCESS' => 'Your extension was disabled sucessfully', + 'PURGE_SUCESS' => 'Your extension was purged sucessfully', + 'DELETE_SUCESS' => 'Your extension was deleted sucessfully', + + 'ENABLE_FAIL' => 'Your extension could not be enabled', + 'DISABLE_FAIL' => 'Your extension could not be disabled', + 'PURGE_FAIL' => 'Your extension could not be purged', + 'DELETE_FAIL' => 'Your extension could not be deleted', + + 'EXTENSION_NAME' => 'Extension Name', + 'EXTENSION_ACTIONS' => 'Actions', + 'EXTENSION_OPTIONS' => 'Options', + + 'ENABLE_CONFIRM' => 'Are you sure you wish to enable this extension?', + 'DISABLE_CONFIRM' => 'Are your sure you wish to disable this extension?', + 'PURGE_CONFIRM' => 'Are you sure you wish to purge (and not disable) this extension? This action will wipe the extension data on this board and is not reversible.', + 'DELETE_CONFIRM' => 'Are you sure you wish to delete (and not purge or disable) this extension? This action will remove the extension and all of its data from this board and is not reversible.', + + 'WARNING' => 'Warning', + 'RETURN' => 'Return', + + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', + '' => '', +)); + +?> \ No newline at end of file diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 17649693fa..bb068e625f 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -226,6 +226,7 @@ $lang = array_merge($lang, array( 'acl_a_switchperm' => array('lang' => 'Can use others permissions', 'cat' => 'permissions'), 'acl_a_styles' => array('lang' => 'Can manage styles', 'cat' => 'misc'), + 'acl_a_extensions' => array('lang' => 'Can manage extensions', 'cat' => 'misc'), 'acl_a_viewlogs' => array('lang' => 'Can view logs', 'cat' => 'misc'), 'acl_a_clearlogs' => array('lang' => 'Can clear logs', 'cat' => 'misc'), 'acl_a_modules' => array('lang' => 'Can manage modules', 'cat' => 'misc'),