X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplugin.php;h=4ff78a8b4d03feffa9725651d60b0621dabf6e28;hb=c43a03e21bcd12b24be8a59741ec6591c1f651d7;hp=df33fd3f201975e0f63c3ebd2e331fb7e7636b2d;hpb=7ab117fd31c31cba4880cfcc63fc940531850455;p=friendica.git diff --git a/include/plugin.php b/include/plugin.php old mode 100755 new mode 100644 index df33fd3f20..4ff78a8b4d --- a/include/plugin.php +++ b/include/plugin.php @@ -5,7 +5,7 @@ if (! function_exists('uninstall_plugin')){ function uninstall_plugin($plugin){ logger("Addons: uninstalling " . $plugin); - q("DELETE FROM `addon` WHERE `name` = '%s' LIMIT 1", + q("DELETE FROM `addon` WHERE `name` = '%s' ", dbesc($plugin) ); @@ -17,7 +17,12 @@ function uninstall_plugin($plugin){ }} if (! function_exists('install_plugin')){ -function install_plugin($plugin){ +function install_plugin($plugin) { + + // silently fail if plugin was removed + + if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php')) + return false; logger("Addons: installing " . $plugin); $t = @filemtime('addon/' . $plugin . '/' . $plugin . '.php'); @include_once('addon/' . $plugin . '/' . $plugin . '.php'); @@ -32,9 +37,21 @@ function install_plugin($plugin){ intval($t), $plugin_admin ); + + // we can add the following with the previous SQL + // once most site tables have been updated. + // This way the system won't fall over dead during the update. + + if(file_exists('addon/' . $plugin . '/.hidden')) { + q("update addon set hidden = 1 where name = '%s' limit 1", + dbesc($plugin) + ); + } + return true; } else { logger("Addons: FAILED installing " . $plugin); + return false; } }} @@ -249,6 +266,7 @@ function get_theme_info($theme){ list($k,$v) = array_map("trim", explode(":",$l,2)); $k= strtolower($k); if ($k=="author"){ + $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m); if ($r) { $info['author'][] = array('name'=>$m[1], 'link'=>$m[2]);