diff options
author | Andreas Gohr <andi@splitbrain.org> | 2014-01-19 20:12:52 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2014-01-19 20:12:52 +0100 |
commit | 0f569f4da813eb51aa75b3fe4a6e5c871b688eea (patch) | |
tree | 7db6c06417b07bb1bbaa5319d9605dfdcb21e1b0 /lib/plugins/plugin/classes/ap_manage.class.php | |
parent | 8426a3ee6fca3bd0fc582d6c405f5d30e12028d0 (diff) | |
parent | 30b90257784ae25a5e30c968b4c9391bb47ff1a1 (diff) | |
download | rpg-0f569f4da813eb51aa75b3fe4a6e5c871b688eea.tar.gz rpg-0f569f4da813eb51aa75b3fe4a6e5c871b688eea.tar.bz2 |
Merge branch 'extension_manager'
* extension_manager: (71 commits)
added plugins group to test
show a message when search returns no results
added missing localization
better filename parsing
use DOKU_LF
remove unneeded try/catch blocks
typo fix
purge cache only once on install
check for admin in AJAX backend
now use new core funtion to recursively delete
added status to info list of extension plugin
added css and html changes for RTL scripts to extension manager
added basic mobile styles to extension manager (not great, but makes things at least readable)
fixed and improved some HTML in extension manager
added git warning
fixed strict standard error and added some docblock
removed the old plugin manager
typo fix
protect authplain and current auth plugin
do not show updates for bundled plugins
...
Conflicts:
lib/plugins/plugin/lang/hu/admin_plugin.txt
lib/plugins/plugin/lang/hu/lang.php
Diffstat (limited to 'lib/plugins/plugin/classes/ap_manage.class.php')
-rw-r--r-- | lib/plugins/plugin/classes/ap_manage.class.php | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/lib/plugins/plugin/classes/ap_manage.class.php b/lib/plugins/plugin/classes/ap_manage.class.php deleted file mode 100644 index 48be63050..000000000 --- a/lib/plugins/plugin/classes/ap_manage.class.php +++ /dev/null @@ -1,202 +0,0 @@ -<?php - -class ap_manage { - - var $manager = null; - var $lang = array(); - var $plugin = ''; - var $downloaded = array(); - - function ap_manage(&$manager, $plugin) { - $this->manager = & $manager; - $this->plugin = $plugin; - $this->lang = & $manager->lang; - } - - function process() { - return ''; - } - - function html() { - print $this->manager->locale_xhtml('admin_plugin'); - $this->html_menu(); - } - - // build our standard menu - function html_menu($listPlugins = true) { - global $ID; - - ptln('<div class="pm_menu">'); - - ptln('<div class="common">'); - ptln(' <h2>'.$this->lang['download'].'</h2>'); - ptln(' <form action="'.wl($ID).'" method="post">'); - ptln(' <fieldset class="hidden">',4); - ptln(' <input type="hidden" name="do" value="admin" />'); - ptln(' <input type="hidden" name="page" value="plugin" />'); - formSecurityToken(); - ptln(' </fieldset>'); - ptln(' <fieldset>'); - ptln(' <legend>'.$this->lang['download'].'</legend>'); - ptln(' <label for="dw__url">'.$this->lang['url'].'<input name="url" id="dw__url" class="edit" type="text" maxlength="200" /></label>'); - ptln(' <input type="submit" class="button" name="fn[download]" value="'.$this->lang['btn_download'].'" />'); - ptln(' </fieldset>'); - ptln(' </form>'); - ptln('</div>'); - - if ($listPlugins) { - ptln('<h2>'.$this->lang['manage'].'</h2>'); - - ptln('<form action="'.wl($ID).'" method="post" class="plugins">'); - - ptln(' <fieldset class="hidden">'); - ptln(' <input type="hidden" name="do" value="admin" />'); - ptln(' <input type="hidden" name="page" value="plugin" />'); - formSecurityToken(); - ptln(' </fieldset>'); - - $this->html_pluginlist(); - - ptln(' <fieldset class="buttons">'); - ptln(' <input type="submit" class="button" name="fn[enable]" value="'.$this->lang['btn_enable'].'" />'); - ptln(' </fieldset>'); - - // ptln(' </div>'); - ptln('</form>'); - } - - ptln('</div>'); - } - - function html_pluginlist() { - global $plugin_protected; - - foreach ($this->manager->plugin_list as $plugin) { - - $disabled = plugin_isdisabled($plugin); - $protected = in_array($plugin,$plugin_protected); - - $checked = ($disabled) ? '' : ' checked="checked"'; - $check_disabled = ($protected) ? ' disabled="disabled"' : ''; - - // determine display class(es) - $class = array(); - if (in_array($plugin, $this->downloaded)) $class[] = 'new'; - if ($disabled) $class[] = 'disabled'; - if ($protected) $class[] = 'protected'; - - $class = count($class) ? ' class="'.join(' ', $class).'"' : ''; - - ptln(' <fieldset'.$class.'>'); - ptln(' <legend>'.$plugin.'</legend>'); - ptln(' <input type="checkbox" class="enable" name="enabled[]" id="dw__p_'.$plugin.'" value="'.$plugin.'"'.$checked.$check_disabled.' />'); - ptln(' <h3 class="legend"><label for="dw__p_'.$plugin.'">'.$plugin.'</label></h3>'); - - $this->html_button($plugin, 'info', false, 6); - if (in_array('settings', $this->manager->functions)) { - $this->html_button($plugin, 'settings', !@file_exists(DOKU_PLUGIN.$plugin.'/settings.php'), 6); - } - $this->html_button($plugin, 'update', !$this->plugin_readlog($plugin, 'url'), 6); - $this->html_button($plugin, 'delete', $protected, 6); - - ptln(' </fieldset>'); - } - } - - function html_button($plugin, $btn, $disabled=false, $indent=0) { - $disabled = ($disabled) ? 'disabled="disabled"' : ''; - ptln('<input type="submit" class="button" '.$disabled.' name="fn['.$btn.']['.$plugin.']" value="'.$this->lang['btn_'.$btn].'" />',$indent); - } - - /** - * Refresh plugin list - */ - function refresh() { - global $config_cascade; - - // expire dokuwiki caches - // touching local.php expires wiki page, JS and CSS caches - @touch(reset($config_cascade['main']['local'])); - - // update latest plugin date - FIXME - global $ID; - send_redirect(wl($ID,array('do'=>'admin','page'=>'plugin'),true, '&')); - } - - /** - * Write a log entry to the given target directory - */ - function plugin_writelog($target, $cmd, $data) { - - $file = $target.'/manager.dat'; - - switch ($cmd) { - case 'install' : - $url = $data[0]; - $date = date('r'); - if (!$fp = @fopen($file, 'w')) return; - fwrite($fp, "installed=$date\nurl=$url\n"); - fclose($fp); - break; - - case 'update' : - $url = $data[0]; - $date = date('r'); - if (!$fp = @fopen($file, 'r+')) return; - $buffer = ""; - while (($line = fgets($fp)) !== false) { - $urlFound = strpos($line,"url"); - if($urlFound !== false) $line="url=$url\n"; - $buffer .= $line; - } - $buffer .= "updated=$date\n"; - fseek($fp, 0); - fwrite($fp, $buffer); - fclose($fp); - break; - } - } - - function plugin_readlog($plugin, $field) { - static $log = array(); - $file = DOKU_PLUGIN.plugin_directory($plugin).'/manager.dat'; - - if (!isset($log[$plugin])) { - $tmp = @file_get_contents($file); - if (!$tmp) return ''; - $log[$plugin] = & $tmp; - } - - if ($field == 'ALL') { - return $log[$plugin]; - } - - $match = array(); - if (preg_match_all('/'.$field.'=(.*)$/m',$log[$plugin], $match)) - return implode("\n", $match[1]); - - return ''; - } - - /** - * delete, with recursive sub-directory support - */ - function dir_delete($path) { - if (!is_string($path) || $path == "") return false; - - if (is_dir($path) && !is_link($path)) { - if (!$dh = @opendir($path)) return false; - - while ($f = readdir($dh)) { - if ($f == '..' || $f == '.') continue; - $this->dir_delete("$path/$f"); - } - - closedir($dh); - return @rmdir($path); - } - return @unlink($path); - } - - -} |