*/ if(!defined('DOKU_TINC')) define('DOKU_TINC',realpath(dirname(__FILE__).'/../../../').'/'); if(!defined('DOKU_PAGE')) define('DOKU_PAGE', DOKU_TINC.'data/pages/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_TINC.'lib/plugins/'); if (!defined('DOKU_REG')) define ('DOKU_REG', DOKU_PLUGIN.'autolink3/register/'); require_once(DOKU_PLUGIN.'admin.php'); /** * All DokuWiki plugins to extend the admin function * need to inherit from this class */ class admin_plugin_autolink3 extends DokuWiki_Admin_Plugin { function getInfo() { return array( 'author' => 'Arthur Lobert', 'email' => 'arthur.lobert@gmail.com', 'date' => @file_get_contents(DOKU_PLUGIN.'autolink3/VERSION'), 'name' => 'autolink3', 'desc' => 'Replace key words by appropriates links', 'url' => 'http://www.dokuwiki.org/plugin:autolink3', ); } function handle(){ $this->error = 0; if (isset($_REQUEST['word'])) $word = $_REQUEST['word']; if (isset($_REQUEST['link'])) $page = $_REQUEST['link']; if (isset($_REQUEST['local'])) $local = $_REQUEST['local']; if (isset($_REQUEST['supr'])) mod_link($_REQUEST['supr']); if (isset($_REQUEST['complete']) && isset($_REQUEST['new_link']) && $_REQUEST['new_link'] != '') { $new_ligne = sprintf("%s %s %s\r\n", $_REQUEST['new_link'],$_REQUEST['new_page'],$_REQUEST['new_locate']); mod_link($_REQUEST['ligne'], $new_ligne); } $rd = fopen (DOKU_REG."register.txt", "a"); $global = sprintf("%s %s %s\r\n", $word, $page, $local); if ($local && $word && $local && !is_link_exist($page, $local, $word)) fwrite ($rd, $global); elseif($_REQUEST['add']) $this->error = 1; fclose($rd); } /** * create the link tab of the plugin interface * @return $ret which is the appropriate html code */ private function _get_link_tab() { if (isset($_REQUEST['mod'])){ $ligne = str_replace(';', ' ',$_REQUEST['mod']); } $reg = read_file(); isset ($_REQUEST['arrow']) ? $reg = sort_tab($reg, compare_alpha,$_REQUEST['arrow']) : $reg = sort_tab($reg, compare_alpha,$_REQUEST['up']); $pages = get_dokupage_tree(DOKU_PAGE, $pages, '', 0); $local[] = ':'; $local = get_dokupage_tree(DOKU_PAGE, $local, '', 1); foreach($pages as $file): { $page_tree .= ""; } endforeach; foreach($local as $file): { $data_tree .= ""; } endforeach ; if (isset($reg)) foreach ($reg as $lign): { if ($lign != '\r\n') { $ret .= '