Suppress showing unsupported addons in the administration.

This commit is contained in:
Michael Vogel 2014-04-29 14:22:37 +02:00
parent 4ca857e110
commit 7b7e372fb0
2 changed files with 37 additions and 25 deletions

View file

@ -197,14 +197,14 @@ function plugin_is_app($name) {
return true; return true;
} }
} }
return false; return false;
}} }}
/* /*
* parse plugin comment in search of plugin infos. * parse plugin comment in search of plugin infos.
* like * like
* *
* * Name: Plugin * * Name: Plugin
* * Description: A plugin which plugs in * * Description: A plugin which plugs in
* * Version: 1.2.3 * * Version: 1.2.3
@ -222,7 +222,8 @@ function get_plugin_info($plugin){
'name' => $plugin, 'name' => $plugin,
'description' => "", 'description' => "",
'author' => array(), 'author' => array(),
'version' => "" 'version' => "",
'status' => ""
); );
if (!is_file("addon/$plugin/$plugin.php")) return $info; if (!is_file("addon/$plugin/$plugin.php")) return $info;

View file

@ -329,7 +329,7 @@ function admin_page_site_post(&$a){
$private_addons = ((x($_POST,'private_addons')) ? True : False); $private_addons = ((x($_POST,'private_addons')) ? True : False);
$disable_embedded = ((x($_POST,'disable_embedded')) ? True : False); $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False);
$allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False); $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False);
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
$no_openid = !((x($_POST,'no_openid')) ? True : False); $no_openid = !((x($_POST,'no_openid')) ? True : False);
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False); $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
@ -1028,13 +1028,24 @@ function admin_page_plugins(&$a){
*/ */
$plugins = array(); $plugins = array();
$files = glob("addon/*/"); $files = glob("addon/*/"); /* */
if($files) { if($files) {
foreach($files as $file) { foreach($files as $file) {
if (is_dir($file)){ if (is_dir($file)){
list($tmp, $id)=array_map("trim", explode("/",$file)); list($tmp, $id)=array_map("trim", explode("/",$file));
$info = get_plugin_info($id); $info = get_plugin_info($id);
$plugins[] = array( $id, (in_array($id, $a->plugins)?"on":"off") , $info); $show_plugin = true;
// If the addon is unsupported, then only show it, when it is enabled
if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins))
$show_plugin = false;
// Override the above szenario, when the admin really wants to see outdated stuff
if (get_config("system", "show_unsupported_addons"))
$show_plugin = true;
if ($show_plugin)
$plugins[] = array($id, (in_array($id, $a->plugins)?"on":"off") , $info);
} }
} }
} }
@ -1045,7 +1056,7 @@ function admin_page_plugins(&$a){
'$page' => t('Plugins'), '$page' => t('Plugins'),
'$submit' => t('Save Settings'), '$submit' => t('Save Settings'),
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
'$function' => 'plugins', '$function' => 'plugins',
'$plugins' => $plugins, '$plugins' => $plugins,
'$form_security_token' => get_form_security_token("admin_themes"), '$form_security_token' => get_form_security_token("admin_themes"),
)); ));
@ -1127,16 +1138,16 @@ function admin_page_themes(&$a){
$allowed_themes[] = trim($x); $allowed_themes[] = trim($x);
$themes = array(); $themes = array();
$files = glob('view/theme/*'); $files = glob('view/theme/*'); /* */
if($files) { if($files) {
foreach($files as $file) { foreach($files as $file) {
$f = basename($file); $f = basename($file);
$is_experimental = intval(file_exists($file . '/experimental')); $is_experimental = intval(file_exists($file . '/experimental'));
$is_supported = 1-(intval(file_exists($file . '/unsupported'))); // Is not used yet $is_supported = 1-(intval(file_exists($file . '/unsupported'))); // Is not used yet
$is_allowed = intval(in_array($f,$allowed_themes)); $is_allowed = intval(in_array($f,$allowed_themes));
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed); $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
} }
} }
if(! count($themes)) { if(! count($themes)) {
notice( t('No themes found.')); notice( t('No themes found.'));
@ -1272,12 +1283,12 @@ function admin_page_logs_post(&$a) {
set_config('system','debugging', $debugging); set_config('system','debugging', $debugging);
set_config('system','loglevel', $loglevel); set_config('system','loglevel', $loglevel);
} }
info( t("Log settings updated.") ); info( t("Log settings updated.") );
goaway($a->get_baseurl(true) . '/admin/logs' ); goaway($a->get_baseurl(true) . '/admin/logs' );
return; // NOTREACHED return; // NOTREACHED
} }
/** /**
@ -1285,7 +1296,7 @@ function admin_page_logs_post(&$a) {
* @return string * @return string
*/ */
function admin_page_logs(&$a){ function admin_page_logs(&$a){
$log_choices = Array( $log_choices = Array(
LOGGER_NORMAL => 'Normal', LOGGER_NORMAL => 'Normal',
LOGGER_TRACE => 'Trace', LOGGER_TRACE => 'Trace',
@ -1293,7 +1304,7 @@ function admin_page_logs(&$a){
LOGGER_DATA => 'Data', LOGGER_DATA => 'Data',
LOGGER_ALL => 'All' LOGGER_ALL => 'All'
); );
$t = get_markup_template("admin_logs.tpl"); $t = get_markup_template("admin_logs.tpl");
$f = get_config('system','logfile'); $f = get_config('system','logfile');
@ -1325,7 +1336,7 @@ readable.");
} }
fclose($fp); fclose($fp);
} }
} }
return replace_macros($t, array( return replace_macros($t, array(
'$title' => t('Administration'), '$title' => t('Administration'),
@ -1335,7 +1346,7 @@ readable.");
'$data' => $data, '$data' => $data,
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
'$logname' => get_config('system','logfile'), '$logname' => get_config('system','logfile'),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
'$debugging' => array('debugging', t("Enable Debugging"),get_config('system','debugging'), ""), '$debugging' => array('debugging', t("Enable Debugging"),get_config('system','debugging'), ""),
'$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")), '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your Friendica top-level directory.")),
@ -1354,7 +1365,7 @@ function admin_page_remoteupdate_post(&$a) {
return; return;
} }
if (x($_POST,'remotefile') && $_POST['remotefile']!=""){ if (x($_POST,'remotefile') && $_POST['remotefile']!=""){
$remotefile = $_POST['remotefile']; $remotefile = $_POST['remotefile'];
$ftpdata = (x($_POST['ftphost'])?$_POST:false); $ftpdata = (x($_POST['ftphost'])?$_POST:false);
@ -1377,14 +1388,14 @@ function admin_page_remoteupdate(&$a) {
$canwrite = canWeWrite(); $canwrite = canWeWrite();
$canftp = function_exists('ftp_connect'); $canftp = function_exists('ftp_connect');
$needupdate = true; $needupdate = true;
$u = checkUpdate(); $u = checkUpdate();
if (!is_array($u)){ if (!is_array($u)){
$needupdate = false; $needupdate = false;
$u = array('','',''); $u = array('','','');
} }
$tpl = get_markup_template("admin_remoteupdate.tpl"); $tpl = get_markup_template("admin_remoteupdate.tpl");
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
@ -1401,5 +1412,5 @@ function admin_page_remoteupdate(&$a) {
'$ftppwd' => array('ftppwd', t("FTP Password"), '',''), '$ftppwd' => array('ftppwd', t("FTP Password"), '',''),
'$remotefile'=>array('remotefile','', $u['2'],''), '$remotefile'=>array('remotefile','', $u['2'],''),
)); ));
} }