mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10631] Fixing some issues spotted in extensions admin
Removing whitespace, cast the items from the json file straight into template vars (not via variables) and fixing some double quotes to single quotes. PHPBB3-10631
This commit is contained in:
parent
29a9f3e70d
commit
305b5fe939
1 changed files with 36 additions and 47 deletions
|
@ -21,25 +21,25 @@ if (!defined('IN_PHPBB'))
|
||||||
class acp_extensions
|
class acp_extensions
|
||||||
{
|
{
|
||||||
var $u_action;
|
var $u_action;
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
// Start the page
|
// Start the page
|
||||||
global $user, $template, $request;
|
global $user, $template, $request;
|
||||||
|
|
||||||
$user->add_lang(array('install', 'acp/customisations'));
|
$user->add_lang(array('install', 'acp/customisations'));
|
||||||
|
|
||||||
$this->page_title = 'ACP_EXTENSIONS';
|
$this->page_title = 'ACP_EXTENSIONS';
|
||||||
|
|
||||||
$action = $request->variable('action', '');
|
$action = $request->variable('action', '');
|
||||||
$ext_name = $request->variable('ext_name', '');
|
$ext_name = $request->variable('ext_name', '');
|
||||||
|
|
||||||
// Set action to list if not set
|
// Set action to list if not set
|
||||||
if (empty($action))
|
if (empty($action))
|
||||||
{
|
{
|
||||||
$action = "list";
|
$action = 'list';
|
||||||
}
|
}
|
||||||
|
|
||||||
// What are we doing?
|
// What are we doing?
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
|
@ -58,13 +58,13 @@ class acp_extensions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'enable':
|
case 'enable':
|
||||||
$name = $request->variable('ext_name', '');
|
$name = $request->variable('ext_name', '');
|
||||||
$this->enable_extension($name);
|
$this->enable_extension($name);
|
||||||
$this->tpl_name = 'acp_ext_enable';
|
$this->tpl_name = 'acp_ext_enable';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable_pre':
|
case 'disable_pre':
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -73,13 +73,13 @@ class acp_extensions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable':
|
case 'disable':
|
||||||
$name = $request->variable('ext_name', '');
|
$name = $request->variable('ext_name', '');
|
||||||
$this->disable_extension($name);
|
$this->disable_extension($name);
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge_pre':
|
case 'purge_pre':
|
||||||
$this->tpl_name = 'acp_ext_purge';
|
$this->tpl_name = 'acp_ext_purge';
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -88,13 +88,13 @@ class acp_extensions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'purge':
|
case 'purge':
|
||||||
$name = $request->variable('ext_name', '');
|
$name = $request->variable('ext_name', '');
|
||||||
$this->purge_extension($name);
|
$this->purge_extension($name);
|
||||||
$this->tpl_name = 'acp_ext_purge';
|
$this->tpl_name = 'acp_ext_purge';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete_pre':
|
case 'delete_pre':
|
||||||
$this->tpl_name = 'acp_ext_delete';
|
$this->tpl_name = 'acp_ext_delete';
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -103,12 +103,12 @@ class acp_extensions
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$name = $request->variable('ext_name', '');
|
$name = $request->variable('ext_name', '');
|
||||||
$this->tpl_name = 'acp_ext_delete';
|
$this->tpl_name = 'acp_ext_delete';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'details':
|
case 'details':
|
||||||
$name = $request->variable('ext_name', '');
|
$name = $request->variable('ext_name', '');
|
||||||
$filepath = $phpbb_root_path . 'ext/' . $name . '/extension.json';
|
$filepath = $phpbb_root_path . 'ext/' . $name . '/extension.json';
|
||||||
|
@ -121,7 +121,7 @@ class acp_extensions
|
||||||
function enable_extension($name)
|
function enable_extension($name)
|
||||||
{
|
{
|
||||||
global $phpbb_extension_manager, $template, $cache;
|
global $phpbb_extension_manager, $template, $cache;
|
||||||
|
|
||||||
$phpbb_extension_manager->enable($name);
|
$phpbb_extension_manager->enable($name);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'U_RETURN' => $this->u_action . '&action=list',
|
'U_RETURN' => $this->u_action . '&action=list',
|
||||||
|
@ -148,7 +148,7 @@ class acp_extensions
|
||||||
));
|
));
|
||||||
$cache->purge();
|
$cache->purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_enabled_exts()
|
function list_enabled_exts()
|
||||||
{
|
{
|
||||||
global $db, $template;
|
global $db, $template;
|
||||||
|
@ -172,7 +172,7 @@ class acp_extensions
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_disabled_exts()
|
function list_disabled_exts()
|
||||||
{
|
{
|
||||||
global $db, $template;
|
global $db, $template;
|
||||||
|
@ -197,14 +197,14 @@ class acp_extensions
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function list_avaliable_exts()
|
function list_avaliable_exts()
|
||||||
{
|
{
|
||||||
$phpbb_extension_manager->load_extensions();
|
$phpbb_extension_manager->load_extensions();
|
||||||
$allavailable = array_keys($phpbb_extension_manager->all_available());
|
$allavailable = array_keys($phpbb_extension_manager->all_available());
|
||||||
$allconfigured = array_keys($phpbb_extension_manager->all_configured());
|
$allconfigured = array_keys($phpbb_extension_manager->all_configured());
|
||||||
$uninstalled = array_diff($allavailable, $allconfigured);
|
$uninstalled = array_diff($allavailable, $allconfigured);
|
||||||
|
|
||||||
foreach ($uninstalled as $ext)
|
foreach ($uninstalled as $ext)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('disabled', array(
|
$template->assign_block_vars('disabled', array(
|
||||||
|
@ -215,42 +215,31 @@ class acp_extensions
|
||||||
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $ext['ext_name'],
|
'U_ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . $ext['ext_name'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_meta_info($filepath)
|
function get_meta_info($filepath)
|
||||||
{
|
{
|
||||||
global $template;
|
global $template;
|
||||||
|
|
||||||
$metadatafile = file_get_contents($filepath);
|
$metadatafile = file_get_contents($filepath);
|
||||||
$metadata = json_decode($metadatafile,true);
|
$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(
|
$template->assign_vars(array(
|
||||||
'NAME' => $name,
|
'NAME' => $metadata['name'],
|
||||||
'TYPE' => $type,
|
'TYPE' => $metadata['type'],
|
||||||
'DESCRIPTION' => $description,
|
'DESCRIPTION' => $metadata['description'],
|
||||||
'HOMEPAGE' => $homepage,
|
'HOMEPAGE' => $metadata['homepage'],
|
||||||
'VERSION' => $version,
|
'VERSION' => $metadata['version'],
|
||||||
'TIME' => $time,
|
'TIME' => $metadata['time'],
|
||||||
'LICENSE' => $licence,
|
'LICENSE' => $metadata['licence'],
|
||||||
'REQUIRE_PHP' => $require_php,
|
'REQUIRE_PHP' => $metadata['require']['php'],
|
||||||
'REQUIRE_PHPBB' => $require_phpbb,
|
'REQUIRE_PHPBB' => $metadata['require']['phpbb'],
|
||||||
'DISPLAY_NAME' => $display_name,
|
'DISPLAY_NAME' => $metadata['extra']['display-name'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($metadata["authors"] as $author)
|
foreach ($metadata["authors"] as $author)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('authors', array(
|
$template->assign_block_vars('authors', array(
|
||||||
|
@ -258,7 +247,7 @@ class acp_extensions
|
||||||
'AUTHOR_USERNAME' => $author["username"],
|
'AUTHOR_USERNAME' => $author["username"],
|
||||||
'AUTHOR_EMAIL' => $author["email"],
|
'AUTHOR_EMAIL' => $author["email"],
|
||||||
'AUTHOR_HOMEPAGE' => $author["homepage"],
|
'AUTHOR_HOMEPAGE' => $author["homepage"],
|
||||||
'AUTHOR_TYPE' => $author["type"],
|
'AUTHOR_ROLE' => $author["role"],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue