From 5446f3ffde77013d4eaea1fb166bcbd905a777a4 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 22 Oct 2011 16:01:07 +0200 Subject: use correct phpdoc @return tag. --- inc/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/auth.php b/inc/auth.php index eff984b36..a52c14731 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -422,7 +422,7 @@ function auth_isadmin($user=null,$groups=null){ * @param $memberlist string commaseparated list of allowed users and groups * @param $user string user to match against * @param $groups array groups the user is member of - * @returns bool true for membership acknowledged + * @return bool true for membership acknowledged */ function auth_isMember($memberlist,$user,array $groups){ global $auth; -- cgit v1.2.3 From a4e0e797f6bce4aaabf4e115a277db8c9a1fa285 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 19 Nov 2011 14:40:11 +0100 Subject: enabled remote as plugintype --- inc/init.php | 2 +- inc/load.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/init.php b/inc/init.php index b3acf2e33..ba62fe079 100644 --- a/inc/init.php +++ b/inc/init.php @@ -200,7 +200,7 @@ init_paths(); init_files(); // setup plugin controller class (can be overwritten in preload.php) -$plugin_types = array('admin','syntax','action','renderer', 'helper'); +$plugin_types = array('admin','syntax','action','renderer', 'helper','remote'); global $plugin_controller_class, $plugin_controller; if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller'; diff --git a/inc/load.php b/inc/load.php index d30397f6e..b69d58140 100644 --- a/inc/load.php +++ b/inc/load.php @@ -89,7 +89,7 @@ function load_autoload($name){ } // Plugin loading - if(preg_match('/^(helper|syntax|action|admin|renderer)_plugin_([^_]+)(?:_([^_]+))?$/', + if(preg_match('/^(helper|syntax|action|admin|renderer|remote)_plugin_([^_]+)(?:_([^_]+))?$/', $name, $m)) { //try to load the wanted plugin file // include, but be silent. Maybe some other autoloader has an idea -- cgit v1.2.3 From 1017f6f159386699a10d2529c50fb5e28b5c1889 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 19 Nov 2011 14:40:29 +0100 Subject: begin with remote api --- inc/remote.php | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 inc/remote.php diff --git a/inc/remote.php b/inc/remote.php new file mode 100644 index 000000000..ea5e23af3 --- /dev/null +++ b/inc/remote.php @@ -0,0 +1,120 @@ + array( + * 'args' => array( + * 'type' => 'string|int|...', + * ) + * ) + * ) + * + * plugin names are formed the following: + * core methods begin by a 'dokuwiki' or 'wiki' followed by a . and the method name itself. + * i.e.: dokuwiki.version or wiki.getPage + * + * plugin methods are formed like 'plugin..'. + * i.e.: plugin.clock.getTime or plugin.clock_gmt.getTime + * + * + * + * @throws RemoteException + */ +class RemoteAPI { + + /** + * @var array remote methods provided by dokuwiki. + */ + private $coreMethods = array(); + + /** + * @var array remote methods provided by dokuwiki plugins - will be filled lazy via + * {@see RemoteAPI#getPluginMethods} + */ + private $pluginMethods = null; + + /** + * Get all available methods with remote access. + * + * @return array with information to all available methods + */ + public function getMethods() { + $this->forceAccess(); + return array_merge($this->getCoreMethods(), $this->getPluginMethods()); + } + + /** + * call a method via remote api. + * + * @param string $method name of the method to call. + * @param array $args arguments to pass to the given method + * @return mixed result of method call, must be a primitive type. + */ + public function call($method, $args) { + $this->forceAccess(); + $method = explode('.', $method); + if ($method[0] === 'plugin') { + $plugin = plugin_load('remote', $method[1]); + if (!$plugin) { + throw new RemoteException('Method unavailable'); + } + return call_user_func_array(array($plugin, $method[2]), $args); + } else { + // TODO call core method + } + + } + + /** + * @return bool true if the current user has access to remote api. + */ + public function hasAccess() { + global $conf; + if (!isset($conf['remote'])) { + return false; + } + return $conf['remote']; + } + + /** + * @throws RemoteException On denied access. + * @return void + */ + private function forceAccess() { + if (!$this->hasAccess()) { + throw new RemoteException('Access denied'); + } + } + + /** + * @return array all plugin methods. + */ + public function getPluginMethods() { + if ($this->pluginMethods === null) { + // TODO: find plugin methods + $this->pluginMethods = array(); + } + return $this->pluginMethods; + } + + /** + * @return array all core methods. + */ + public function getCoreMethods() { + return $this->coreMethods; + } +} + + +class RemoteException extends Exception {} \ No newline at end of file -- cgit v1.2.3 From 457ad80ad7c53870fc033997bfbf36e3904f9c4e Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 23 Nov 2011 20:25:58 +0100 Subject: introduced remote api class --- _test/index.php | 2 +- inc/load.php | 2 ++ inc/remote.php | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/_test/index.php b/_test/index.php index f59c44cf4..64ece4762 100644 --- a/_test/index.php +++ b/_test/index.php @@ -11,7 +11,7 @@ if(@file_exists(DOKU_CONF.'local.php')){ require_once(DOKU_CONF.'local.php'); } $conf['lang'] = 'en'; define('TEST_ROOT', dirname(__FILE__)); define('TMPL_FILESCHEME_PATH', TEST_ROOT . '/filescheme/'); -error_reporting(E_ALL); +error_reporting(E_ALL & ~E_DEPRECATED); set_time_limit(600); ini_set('memory_limit','128M'); diff --git a/inc/load.php b/inc/load.php index b69d58140..3f1f3429f 100644 --- a/inc/load.php +++ b/inc/load.php @@ -76,10 +76,12 @@ function load_autoload($name){ 'SafeFN' => DOKU_INC.'inc/SafeFN.class.php', 'Sitemapper' => DOKU_INC.'inc/Sitemapper.php', 'PassHash' => DOKU_INC.'inc/PassHash.class.php', + 'RemoteAPI' => DOKU_INC.'inc/remote.php', 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', 'DokuWiki_Syntax_Plugin' => DOKU_PLUGIN.'syntax.php', + 'DokuWiki_Remote_Plugin' => DOKU_PLUGIN.'remote.php', ); diff --git a/inc/remote.php b/inc/remote.php index ea5e23af3..13a38aa17 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -17,6 +17,7 @@ if (!defined('DOKU_INC')) die(); * 'args' => array( * 'type' => 'string|int|...', * ) + * 'return' => 'type' * ) * ) * @@ -102,8 +103,20 @@ class RemoteAPI { */ public function getPluginMethods() { if ($this->pluginMethods === null) { - // TODO: find plugin methods $this->pluginMethods = array(); + $plugins = plugin_list('remote'); + + foreach ($plugins as $pluginName) { + $plugin = plugin_load('remote', $pluginName); + if (!is_subclass_of($plugin, 'DokuWiki_Remote_Plugin')) { + throw new RemoteException("Plugin $pluginName dose not implement DokuWiki_Remote_Plugin"); + } + + $methods = $plugin->_getMethods(); + foreach ($methods as $method => $meta) { + $this->pluginMethods["plugin.$pluginName.$method"] = $meta; + } + } } return $this->pluginMethods; } -- cgit v1.2.3 From 2d2d9d0f3a410b31d76a2be193fe16b3dbd79096 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Mon, 28 Nov 2011 19:09:48 +0100 Subject: collect remote functions in a class --- inc/RemoteAPICore.php | 617 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 617 insertions(+) create mode 100644 inc/RemoteAPICore.php diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php new file mode 100644 index 000000000..c4324ba29 --- /dev/null +++ b/inc/RemoteAPICore.php @@ -0,0 +1,617 @@ + + * @param string $id file id + * @return media file + */ + function getAttachment($id){ + $id = cleanID($id); + if (auth_quickaclcheck(getNS($id).':*') < AUTH_READ) { + throw new RemoteAccessDenied(); + } + + $file = mediaFN($id); + if (!@ file_exists($file)) { + throw new RemoteException('The requested file does not exist'); + } + + $data = io_readFile($file, false); + $base64 = base64_encode($data); + return $base64; + } + + /** + * Return info about a media file + * + * @author Gina Haeussge + */ + function getAttachmentInfo($id){ + $id = cleanID($id); + $info = array( + 'lastModified' => 0, + 'size' => 0, + ); + + $file = mediaFN($id); + if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){ + $info['lastModified'] = new IXR_Date(filemtime($file)); + $info['size'] = filesize($file); + } + + return $info; + } + + /** + * Return a wiki page rendered to html + */ + function htmlPage($id,$rev=''){ + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_READ){ + throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + } + return p_wiki_xhtml($id,$rev,false); + } + + /** + * List all pages - we use the indexer list here + */ + function listPages(){ + $list = array(); + $pages = idx_get_indexer()->getPages(); + $pages = array_filter(array_filter($pages,'isVisiblePage'),'page_exists'); + + foreach(array_keys($pages) as $idx) { + $perm = auth_quickaclcheck($pages[$idx]); + if($perm < AUTH_READ) { + continue; + } + $page = array(); + $page['id'] = trim($pages[$idx]); + $page['perms'] = $perm; + $page['size'] = @filesize(wikiFN($pages[$idx])); + $page['lastModified'] = new IXR_Date(@filemtime(wikiFN($pages[$idx]))); + $list[] = $page; + } + + return $list; + } + + /** + * List all pages in the given namespace (and below) + */ + function readNamespace($ns,$opts){ + global $conf; + + if(!is_array($opts)) $opts=array(); + + $ns = cleanID($ns); + $dir = utf8_encodeFN(str_replace(':', '/', $ns)); + $data = array(); + $opts['skipacl'] = 0; // no ACL skipping for XMLRPC + search($data, $conf['datadir'], 'search_allpages', $opts, $dir); + return $data; + } + + /** + * List all pages in the given namespace (and below) + */ + function search($query){ + require_once(DOKU_INC.'inc/fulltext.php'); + + $regex = ''; + $data = ft_pageSearch($query,$regex); + $pages = array(); + + // prepare additional data + $idx = 0; + foreach($data as $id => $score){ + $file = wikiFN($id); + + if($idx < FT_SNIPPET_NUMBER){ + $snippet = ft_snippet($id,$regex); + $idx++; + }else{ + $snippet = ''; + } + + $pages[] = array( + 'id' => $id, + 'score' => $score, + 'rev' => filemtime($file), + 'mtime' => filemtime($file), + 'size' => filesize($file), + 'snippet' => $snippet, + ); + } + return $pages; + } + + /** + * Returns the wiki title. + */ + function getTitle(){ + global $conf; + return $conf['title']; + } + + /** + * List all media files. + * + * Available options are 'recursive' for also including the subnamespaces + * in the listing, and 'pattern' for filtering the returned files against + * a regular expression matching their name. + * + * @author Gina Haeussge + */ + function listAttachments($ns, $options = array()) { + global $conf; + global $lang; + + $ns = cleanID($ns); + + if (!is_array($options)) $options = array(); + $options['skipacl'] = 0; // no ACL skipping for XMLRPC + + + if(auth_quickaclcheck($ns.':*') >= AUTH_READ) { + $dir = utf8_encodeFN(str_replace(':', '/', $ns)); + + $data = array(); + search($data, $conf['mediadir'], 'search_media', $options, $dir); + $len = count($data); + if(!$len) return array(); + + for($i=0; $i<$len; $i++) { + unset($data[$i]['meta']); + $data[$i]['lastModified'] = new IXR_Date($data[$i]['mtime']); + } + return $data; + } else { + throw new RemoteAccessDenied(1, 'You are not allowed to list media files.'); + } + } + + /** + * Return a list of backlinks + */ + function listBackLinks($id){ + return ft_backlinks(cleanID($id)); + } + + /** + * Return some basic data about a page + */ + function pageInfo($id,$rev=''){ + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_READ){ + throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + } + $file = wikiFN($id,$rev); + $time = @filemtime($file); + if(!$time){ + throw new RemoteException(10, 'The requested page does not exist'); + } + + $info = getRevisionInfo($id, $time, 1024); + + $data = array( + 'name' => $id, + 'lastModified' => new IXR_Date($time), + 'author' => (($info['user']) ? $info['user'] : $info['ip']), + 'version' => $time + ); + + return ($data); + } + + /** + * Save a wiki page + * + * @author Michael Klier + */ + function putPage($id, $text, $params) { + global $TEXT; + global $lang; + global $conf; + + $id = cleanID($id); + $TEXT = cleanText($text); + $sum = $params['sum']; + $minor = $params['minor']; + + if(empty($id)) { + throw new RemoteException(1, 'Empty page ID'); + } + + if(!page_exists($id) && trim($TEXT) == '' ) { + throw new RemoteException(1, 'Refusing to write an empty new wiki page'); + } + + if(auth_quickaclcheck($id) < AUTH_EDIT) { + throw new RemoteAccessDenied(1, 'You are not allowed to edit this page'); + } + + // Check, if page is locked + if(checklock($id)) { + throw new RemoteException(1, 'The page is currently locked'); + } + + // SPAM check + if(checkwordblock()) { + throw new RemoteException(1, 'Positive wordblock check'); + } + + // autoset summary on new pages + if(!page_exists($id) && empty($sum)) { + $sum = $lang['created']; + } + + // autoset summary on deleted pages + if(page_exists($id) && empty($TEXT) && empty($sum)) { + $sum = $lang['deleted']; + } + + lock($id); + + saveWikiText($id,$TEXT,$sum,$minor); + + unlock($id); + + // run the indexer if page wasn't indexed yet + idx_addPage($id); + + return 0; + } + + /** + * Appends text to a wiki page. + */ + function appendPage($id, $text, $params) { + $currentpage = $this->rawPage($id); + if (!is_string($currentpage)) { + return $currentpage; + } + return $this->putPage($id, $currentpage.$text, $params); + } + + /** + * Uploads a file to the wiki. + * + * Michael Klier + */ + function putAttachment($id, $file, $params) { + $id = cleanID($id); + $auth = auth_quickaclcheck(getNS($id).':*'); + + if(!isset($id)) { + throw new RemoteException(1, 'Filename not given.'); + } + + global $conf; + + $ftmp = $conf['tmpdir'] . '/' . md5($id.clientIP()); + + // save temporary file + @unlink($ftmp); + if (preg_match('/^[A-Za-z0-9\+\/]*={0,2}$/', $file) === 1) { + // DEPRECATED: Double-decode file if it still looks like base64 + // after first decoding (which is done by the library) + $file = base64_decode($file); + } + io_saveFile($ftmp, $file); + + $res = media_save(array('name' => $ftmp), $id, $params['ow'], $auth, 'rename'); + if (is_array($res)) { + throw new RemoteException(-$res[1], $res[0]); + } else { + return $res; + } + } + + /** + * Deletes a file from the wiki. + * + * @author Gina Haeussge + */ + function deleteAttachment($id){ + $id = cleanID($id); + $auth = auth_quickaclcheck(getNS($id).':*'); + $res = media_delete($id, $auth); + if ($res & DOKU_MEDIA_DELETED) { + return 0; + } elseif ($res & DOKU_MEDIA_NOT_AUTH) { + throw new RemoteAccessDenied(1, "You don't have permissions to delete files."); + } elseif ($res & DOKU_MEDIA_INUSE) { + throw new RemoteException(1, 'File is still referenced'); + } else { + throw new RemoteException(1, 'Could not delete file'); + } + } + + /** + * Returns the permissions of a given wiki page + */ + function aclCheck($id) { + $id = cleanID($id); + return auth_quickaclcheck($id); + } + + /** + * Lists all links contained in a wiki page + * + * @author Michael Klier + */ + function listLinks($id) { + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_READ){ + throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + } + $links = array(); + + // resolve page instructions + $ins = p_cached_instructions(wikiFN($id)); + + // instantiate new Renderer - needed for interwiki links + include(DOKU_INC.'inc/parser/xhtml.php'); + $Renderer = new Doku_Renderer_xhtml(); + $Renderer->interwiki = getInterwiki(); + + // parse parse instructions + foreach($ins as $in) { + $link = array(); + switch($in[0]) { + case 'internallink': + $link['type'] = 'local'; + $link['page'] = $in[1][0]; + $link['href'] = wl($in[1][0]); + array_push($links,$link); + break; + case 'externallink': + $link['type'] = 'extern'; + $link['page'] = $in[1][0]; + $link['href'] = $in[1][0]; + array_push($links,$link); + break; + case 'interwikilink': + $url = $Renderer->_resolveInterWiki($in[1][2],$in[1][3]); + $link['type'] = 'extern'; + $link['page'] = $url; + $link['href'] = $url; + array_push($links,$link); + break; + } + } + + return ($links); + } + + /** + * Returns a list of recent changes since give timestamp + * + * @author Michael Hamann + * @author Michael Klier + */ + function getRecentChanges($timestamp) { + if(strlen($timestamp) != 10) { + throw new RemoteException(20, 'The provided value is not a valid timestamp'); + } + + $recents = getRecentsSince($timestamp); + + $changes = array(); + + foreach ($recents as $recent) { + $change = array(); + $change['name'] = $recent['id']; + $change['lastModified'] = new IXR_Date($recent['date']); + $change['author'] = $recent['user']; + $change['version'] = $recent['date']; + $change['perms'] = $recent['perms']; + $change['size'] = @filesize(wikiFN($recent['id'])); + array_push($changes, $change); + } + + if (!empty($changes)) { + return $changes; + } else { + // in case we still have nothing at this point + return new RemoteException('There are no changes in the specified timeframe'); + } + } + + /** + * Returns a list of recent media changes since give timestamp + * + * @author Michael Hamann + * @author Michael Klier + */ + function getRecentMediaChanges($timestamp) { + if(strlen($timestamp) != 10) + throw new RemoteException(20, 'The provided value is not a valid timestamp'); + + $recents = getRecentsSince($timestamp, null, '', RECENTS_MEDIA_CHANGES); + + $changes = array(); + + foreach ($recents as $recent) { + $change = array(); + $change['name'] = $recent['id']; + $change['lastModified'] = new IXR_Date($recent['date']); + $change['author'] = $recent['user']; + $change['version'] = $recent['date']; + $change['perms'] = $recent['perms']; + $change['size'] = @filesize(mediaFN($recent['id'])); + array_push($changes, $change); + } + + if (!empty($changes)) { + return $changes; + } else { + // in case we still have nothing at this point + throw new RemoteException(30, 'There are no changes in the specified timeframe'); + } + } + + /** + * Returns a list of available revisions of a given wiki page + * + * @author Michael Klier + */ + function pageVersions($id, $first) { + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_READ) { + throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + } + global $conf; + + $versions = array(); + + if(empty($id)) { + throw new RemoteException(1, 'Empty page ID'); + } + + $revisions = getRevisions($id, $first, $conf['recent']+1); + + if(count($revisions)==0 && $first!=0) { + $first=0; + $revisions = getRevisions($id, $first, $conf['recent']+1); + } + + if(count($revisions)>0 && $first==0) { + array_unshift($revisions, ''); // include current revision + array_pop($revisions); // remove extra log entry + } + + if(count($revisions) > $conf['recent']) { + array_pop($revisions); // remove extra log entry + } + + if(!empty($revisions)) { + foreach($revisions as $rev) { + $file = wikiFN($id,$rev); + $time = @filemtime($file); + // we check if the page actually exists, if this is not the + // case this can lead to less pages being returned than + // specified via $conf['recent'] + if($time){ + $info = getRevisionInfo($id, $time, 1024); + if(!empty($info)) { + $data['user'] = $info['user']; + $data['ip'] = $info['ip']; + $data['type'] = $info['type']; + $data['sum'] = $info['sum']; + $data['modified'] = new IXR_Date($info['date']); + $data['version'] = $info['date']; + array_push($versions, $data); + } + } + } + return $versions; + } else { + return array(); + } + } + + /** + * The version of Wiki RPC API supported + */ + function wiki_RPCVersion(){ + return 2; + } + + + /** + * Locks or unlocks a given batch of pages + * + * Give an associative array with two keys: lock and unlock. Both should contain a + * list of pages to lock or unlock + * + * Returns an associative array with the keys locked, lockfail, unlocked and + * unlockfail, each containing lists of pages. + */ + function setLocks($set){ + $locked = array(); + $lockfail = array(); + $unlocked = array(); + $unlockfail = array(); + + foreach((array) $set['lock'] as $id){ + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_EDIT || checklock($id)){ + $lockfail[] = $id; + }else{ + lock($id); + $locked[] = $id; + } + } + + foreach((array) $set['unlock'] as $id){ + $id = cleanID($id); + if(auth_quickaclcheck($id) < AUTH_EDIT || !unlock($id)){ + $unlockfail[] = $id; + }else{ + $unlocked[] = $id; + } + } + + return array( + 'locked' => $locked, + 'lockfail' => $lockfail, + 'unlocked' => $unlocked, + 'unlockfail' => $unlockfail, + ); + } + + function getAPIVersion(){ + return DOKU_XMLRPC_API_VERSION; + } + + function login($user,$pass){ + global $conf; + global $auth; + if(!$conf['useacl']) return 0; + if(!$auth) return 0; + + @session_start(); // reopen session for login + if($auth->canDo('external')){ + $ok = $auth->trustExternal($user,$pass,false); + }else{ + $evdata = array( + 'user' => $user, + 'password' => $pass, + 'sticky' => false, + 'silent' => true, + ); + $ok = trigger_event('AUTH_LOGIN_CHECK', $evdata, 'auth_login_wrapper'); + } + session_write_close(); // we're done with the session + + return $ok; + } + + +} \ No newline at end of file -- cgit v1.2.3 From f61380cb67f8216ae4c75922511ff5a07fd21ca0 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Mon, 28 Nov 2011 19:06:16 +0100 Subject: introduced first remote test cases --- _test/cases/inc/remote.test.php | 77 +++++++++++++++++++++++++++++++++++++++++ inc/remote.php | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 _test/cases/inc/remote.test.php diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php new file mode 100644 index 000000000..aa7a8cd1b --- /dev/null +++ b/_test/cases/inc/remote.test.php @@ -0,0 +1,77 @@ + array( + 'args' => array(), + 'return' => 'void' + ), + 'method2' => array( + 'args' => array('string', 'int', 'bool'), + 'return' => array('string'), + ) + ); + } +} + + +class remote_test extends UnitTestCase { + + var $originalConf; + + var $remote; + + function setUp() { + global $plugin_controller; + global $conf; + parent::setUp(); + $pluginManager = new MockDoku_Plugin_Controller(); + $pluginManager->setReturnValue('getList', array('testplugin')); + $pluginManager->setReturnValue('load', new remote_plugin_testplugin()); + $plugin_controller = $pluginManager; + + $this->originalConf = $conf; + + $this->remote = new RemoteAPI(); + } + + function tearDown() { + global $conf; + $conf = $this->originalConf; + } + + function test_pluginMethods() { + $methods = $this->remote->getPluginMethods(); + $this->assertEqual(array_keys($methods), array('plugin.testplugin.method1', 'plugin.testplugin.method2')); + } + + function test_hasAccessSuccess() { + global $conf; + $conf['remote'] = 1; + $this->assertTrue($this->remote->hasAccess()); + } + + function test_hasAccessFail() { + global $conf; + $conf['remote'] = 0; + $this->assertFalse($this->remote->hasAccess()); + } + + function test_forceAccessSuccess() { + global $conf; + $conf['remote'] = 1; + $this->remote->forceAccess(); // no exception should occur + } + + function test_forceAccessFail() { + global $conf; + $conf['remote'] = 0; + $this->expectException('RemoteException'); + $this->remote->forceAccess(); + } +} diff --git a/inc/remote.php b/inc/remote.php index 13a38aa17..6f48d2015 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -92,7 +92,7 @@ class RemoteAPI { * @throws RemoteException On denied access. * @return void */ - private function forceAccess() { + public function forceAccess() { if (!$this->hasAccess()) { throw new RemoteException('Access denied'); } -- cgit v1.2.3 From 3f3bb97fcdd30282632d96a5bb19d2ea61c01504 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Mon, 28 Nov 2011 20:59:49 +0100 Subject: removed dublicated content --- inc/remote.php | 3 ++- lib/exe/xmlrpc.php | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index 6f48d2015..14f6614f1 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -130,4 +130,5 @@ class RemoteAPI { } -class RemoteException extends Exception {} \ No newline at end of file +class RemoteException extends Exception {} +class RemoteAccessDenied extends RemoteException {} \ No newline at end of file diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index e5e3298ae..cb8dbf42d 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -21,6 +21,7 @@ if(!$conf['xmlrpc']) die('XML-RPC server not enabled.'); class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { var $methods = array(); var $public_methods = array(); + var $remote; /** * Checks if the current user is allowed to execute non anonymous methods @@ -67,6 +68,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * Constructor. Register methods and run Server */ function dokuwiki_xmlrpc_server(){ + $this->remote = new RemoteAPI(); $this->IXR_IntrospectionServer(); /* DokuWiki's own methods */ @@ -284,16 +286,11 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * Return a raw wiki page */ function rawPage($id,$rev=''){ - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_READ){ + try { + return $this->remote->rawPage($id, $rev); + } catch(RemoteAccessDenied $e) { return new IXR_Error(1, 'You are not allowed to read this page'); } - $text = rawWiki($id,$rev); - if(!$text) { - return pageTemplate($id); - } else { - return $text; - } } /** -- cgit v1.2.3 From 4815d222f25c9a31949297223c98cfca7151ae8d Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 8 Dec 2011 19:57:18 +0100 Subject: RemoteAPI can now handle remote calls. --- _test/cases/inc/remote.test.php | 102 ++++++++++++++++++++++++++++++++++++++++ inc/RemoteAPICore.php | 43 ++++++++++++++++- inc/remote.php | 68 +++++++++++++++++++-------- 3 files changed, 193 insertions(+), 20 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index aa7a8cd1b..b33d8039f 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -1,9 +1,74 @@ array( + 'args' => array(), + 'return' => 'string', + 'doc' => 'Test method', + 'name' => 'stringTestMethod', + ), 'wiki.intTestMethod' => array( + 'args' => array(), + 'return' => 'int', + 'doc' => 'Test method', + 'name' => 'intTestMethod', + ), 'wiki.floatTestMethod' => array( + 'args' => array(), + 'return' => 'float', + 'doc' => 'Test method', + 'name' => 'floatTestMethod', + ), 'wiki.dateTestMethod' => array( + 'args' => array(), + 'return' => 'date', + 'doc' => 'Test method', + 'name' => 'dateTestMethod', + ), 'wiki.fileTestMethod' => array( + 'args' => array(), + 'return' => 'file', + 'doc' => 'Test method', + 'name' => 'fileTestMethod', + ), 'wiki.voidTestMethod' => array( + 'args' => array(), + 'return' => 'void', + 'doc' => 'Test method', + 'name' => 'voidTestMethod', + ), 'wiki.oneStringArgMethod' => array( + 'args' => array('string'), + 'return' => 'string', + 'doc' => 'Test method', + 'name' => 'oneStringArgMethod', + ), 'wiki.twoArgMethod' => array( + 'args' => array('string', 'int'), + 'return' => 'array', + 'doc' => 'Test method', + 'name' => 'twoArgMethod', + ), 'wiki.twoArgWithDefaultArg' => array( + 'args' => array('string', 'string'), + 'return' => 'string', + 'doc' => 'Test method', + 'name' => 'twoArgWithDefaultArg', + ), + ); + } + function stringTestMethod() { return 'success'; } + function intTestMethod() { return 42; } + function floatTestMethod() { return 3.14159265; } + function dateTestMethod() { return 2623452346; } + function fileTestMethod() { return 'file content'; } + function voidTestMethod() { return null; } + function oneStringArgMethod($arg) {return $arg; } + function twoArgMethod($string, $int) { return array($string, $int); } + function twoArgWithDefaultArg($string1, $string2 = 'default') { return array($string1, $string2); } + +} + class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { function _getMethods() { return array( @@ -74,4 +139,41 @@ class remote_test extends UnitTestCase { $this->expectException('RemoteException'); $this->remote->forceAccess(); } + + function test_generalCoreFunctionWithoutArguments() { + global $conf; + $conf['remote'] = 1; + $remoteApi = new RemoteApi(); + $remoteApi->getCoreMethods(new RemoteAPICoreTest()); + + $this->assertEqual($remoteApi->call('wiki.stringTestMethod'), 'success'); + $this->assertEqual($remoteApi->call('wiki.intTestMethod'), 42); + $this->assertEqual($remoteApi->call('wiki.floatTestMethod'), 3.14159265); + $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), 2623452346); + $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), 'file content'); + $this->assertEqual($remoteApi->call('wiki.voidTestMethod'), null); + } + + function test_generalCoreFunctionOnArgumentMismatch() { + global $conf; + $conf['remote'] = 1; + $remoteApi = new RemoteApi(); + $remoteApi->getCoreMethods(new RemoteAPICoreTest()); + + $this->expectException('RemoteException'); + $remoteApi->call('wiki.voidTestMethod', array('something')); + } + + function test_generalCoreFunctionWithArguments() { + global $conf; + $conf['remote'] = 1; + + $remoteApi = new RemoteApi(); + $remoteApi->getCoreMethods(new RemoteAPICoreTest()); + + $this->assertEqual($remoteApi->call('wiki.oneStringArgMethod', array('string')), 'string'); + $this->assertEqual($remoteApi->call('wiki.twoArgMethod', array('string', 1)), array('string' , 1)); + $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string')), array('string', 'default')); + $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string', 'another')), array('string', 'another')); + } } diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index c4324ba29..a2e12c7f1 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -2,6 +2,47 @@ class RemoteAPICore { + function __getRemoteInfo() { + return array( + 'wiki.getPage' => array( + 'args' => array( + 'id' => array( + 'type' => 'string', + 'doc' => 'wiki page id' + ), + ), + 'return' => 'string', + 'doc' => 'Return a raw wiki page', + 'name' => 'rawPage', + ), + 'wiki.getPageVersion' => array( + 'args' => array( + 'id' => array( + 'type' => 'string', + 'doc' => 'wiki page id' + ), + 'rev' => array( + 'type' => 'int', + 'doc' => 'revision number of the page', + ), + ), + 'name' => 'rawPage', + 'return' => 'string', + 'doc' => 'Return a raw wiki page' + ), + 'wiki.getAttachment' => array( + 'args' => array( + 'type' => 'string', + 'doc' => 'file id', + ), + 'doc' => 'Return a media file', + 'return' => 'file', + 'name' => 'getAttachment', + ), + + ); + } + /** * Return a raw wiki page * @param string $id wiki page id @@ -58,7 +99,7 @@ class RemoteAPICore { $file = mediaFN($id); if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){ - $info['lastModified'] = new IXR_Date(filemtime($file)); + $info['lastModified'] = filemtime($file); $info['size'] = filesize($file); } diff --git a/inc/remote.php b/inc/remote.php index 14f6614f1..5f136a43d 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -2,6 +2,9 @@ if (!defined('DOKU_INC')) die(); +class RemoteException extends Exception {} +class RemoteAccessDenied extends RemoteException {} + /** * This class provides information about remote access to the wiki. * @@ -13,11 +16,16 @@ if (!defined('DOKU_INC')) die(); * == Information structure == * The information about methods will be given in an array with the following structure: * array( - * 'method.name' => array( + * 'method.remoteName' => array( * 'args' => array( - * 'type' => 'string|int|...', + * 'name' => array( + * 'type' => 'string|int|...|date|file', + * ['doc' = 'argument documentation'], + * ), * ) - * 'return' => 'type' + * 'name' => 'method name in class', + * 'return' => 'type', +* ['doc' = 'method documentation'], * ) * ) * @@ -35,9 +43,9 @@ if (!defined('DOKU_INC')) die(); class RemoteAPI { /** - * @var array remote methods provided by dokuwiki. + * @var RemoteAPICore */ - private $coreMethods = array(); + private $coreMethods = null; /** * @var array remote methods provided by dokuwiki plugins - will be filled lazy via @@ -62,19 +70,36 @@ class RemoteAPI { * @param array $args arguments to pass to the given method * @return mixed result of method call, must be a primitive type. */ - public function call($method, $args) { + public function call($method, $args = array()) { $this->forceAccess(); - $method = explode('.', $method); - if ($method[0] === 'plugin') { - $plugin = plugin_load('remote', $method[1]); + list($type, $pluginName, $call) = explode('.', $method, 3); + if ($type === 'plugin') { + $plugin = plugin_load('remote', $pluginName); if (!$plugin) { - throw new RemoteException('Method unavailable'); + throw new RemoteException('Method dose not exists'); } - return call_user_func_array(array($plugin, $method[2]), $args); + return call_user_func_array(array($plugin, $call), $args); } else { - // TODO call core method + $coreMethods = $this->getCoreMethods(); + if (!isset($coreMethods[$method])) { + throw new RemoteException('Method dose not exists'); + } + $this->checkArgumentLength($coreMethods[$method], $args); + return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); } + } + private function checkArgumentLength($method, $args) { + if (count($method['args']) < count($args)) { + throw new RemoteException('Method dose not exists - wrong parameter count.'); + } + } + + private function getMethodName($methodMeta, $method) { + if (isset($methodMeta[$method]['name'])) { + return $methodMeta[$method]['name']; + } + return $method; } /** @@ -122,13 +147,18 @@ class RemoteAPI { } /** + * @param RemoteAPICore $apiCore this parameter is used for testing. Here you can pass a non-default RemoteAPICore + * instance. (for mocking) * @return array all core methods. */ - public function getCoreMethods() { - return $this->coreMethods; + public function getCoreMethods($apiCore = null) { + if ($this->coreMethods === null) { + if ($apiCore === null) { + $this->coreMethods = new RemoteAPICore(); + } else { + $this->coreMethods = $apiCore; + } + } + return $this->coreMethods->__getRemoteInfo(); } -} - - -class RemoteException extends Exception {} -class RemoteAccessDenied extends RemoteException {} \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3 From 647919c9a61d928502b0b45063cc60702d0d310e Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 8 Dec 2011 20:33:30 +0100 Subject: added remote plugin calls. --- _test/cases/inc/remote.test.php | 43 +++++++++++++++++++++++++++++++++++++---- inc/remote.php | 7 +++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index b33d8039f..f0e7b3d27 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -75,13 +75,24 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { 'method1' => array( 'args' => array(), 'return' => 'void' - ), - 'method2' => array( + ), 'methodString' => array( + 'args' => array(), + 'return' => 'string' + ), 'method2' => array( + 'args' => array('string', 'int'), + 'return' => 'array', + 'name' => 'method2', + ), 'method2ext' => array( 'args' => array('string', 'int', 'bool'), - 'return' => array('string'), + 'return' => 'array', + 'name' => 'method2', ) ); } + + function method1() { return null; } + function methodString() { return 'success'; } + function method2($str, $int, $bool = false) { return array($str, $int, $bool); } } @@ -112,7 +123,11 @@ class remote_test extends UnitTestCase { function test_pluginMethods() { $methods = $this->remote->getPluginMethods(); - $this->assertEqual(array_keys($methods), array('plugin.testplugin.method1', 'plugin.testplugin.method2')); + $actual = array_keys($methods); + sort($actual); + $expect = array('plugin.testplugin.method1', 'plugin.testplugin.method2', 'plugin.testplugin.methodString', 'plugin.testplugin.method2ext'); + sort($expect); + $this->assertEqual($expect,$actual); } function test_hasAccessSuccess() { @@ -176,4 +191,24 @@ class remote_test extends UnitTestCase { $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string')), array('string', 'default')); $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string', 'another')), array('string', 'another')); } + + function test_pluginCallMethods() { + global $conf; + $conf['remote'] = 1; + + $remoteApi = new RemoteApi(); + $this->assertEqual($remoteApi->call('plugin.testplugin.method1'), null); + $this->assertEqual($remoteApi->call('plugin.testplugin.method2', array('string', 7)), array('string', 7, false)); + $this->assertEqual($remoteApi->call('plugin.testplugin.method2ext', array('string', 7, true)), array('string', 7, true)); + $this->assertEqual($remoteApi->call('plugin.testplugin.methodString'), 'success'); + } + + function test_notExistingCall() { + global $conf; + $conf['remote'] = 1; + + $remoteApi = new RemoteApi(); + $this->expectException('RemoteException'); + $remoteApi->call('dose not exist'); + } } diff --git a/inc/remote.php b/inc/remote.php index 5f136a43d..bc35d525e 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -75,10 +75,12 @@ class RemoteAPI { list($type, $pluginName, $call) = explode('.', $method, 3); if ($type === 'plugin') { $plugin = plugin_load('remote', $pluginName); + $methods = $this->getPluginMethods(); if (!$plugin) { throw new RemoteException('Method dose not exists'); } - return call_user_func_array(array($plugin, $call), $args); + $name = $this->getMethodName($methods, $method); + return call_user_func_array(array($plugin, $name), $args); } else { $coreMethods = $this->getCoreMethods(); if (!isset($coreMethods[$method])) { @@ -99,7 +101,8 @@ class RemoteAPI { if (isset($methodMeta[$method]['name'])) { return $methodMeta[$method]['name']; } - return $method; + $method = explode('.', $method); + return $method[count($method)-1]; } /** -- cgit v1.2.3 From 795114e73f18f06c2b32b433e150cad81da6581f Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 10 Dec 2011 14:05:33 +0100 Subject: changed return types --- _test/cases/inc/remote.test.php | 8 ++++---- inc/remote.php | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index f0e7b3d27..23186344b 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -60,8 +60,8 @@ class RemoteAPICoreTest { function stringTestMethod() { return 'success'; } function intTestMethod() { return 42; } function floatTestMethod() { return 3.14159265; } - function dateTestMethod() { return 2623452346; } - function fileTestMethod() { return 'file content'; } + function dateTestMethod() { return new RemoteDate(2623452346); } + function fileTestMethod() { return new RemoteFile('file content'); } function voidTestMethod() { return null; } function oneStringArgMethod($arg) {return $arg; } function twoArgMethod($string, $int) { return array($string, $int); } @@ -164,8 +164,8 @@ class remote_test extends UnitTestCase { $this->assertEqual($remoteApi->call('wiki.stringTestMethod'), 'success'); $this->assertEqual($remoteApi->call('wiki.intTestMethod'), 42); $this->assertEqual($remoteApi->call('wiki.floatTestMethod'), 3.14159265); - $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), 2623452346); - $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), 'file content'); + $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), new RemoteDate(2623452346)); + $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), new RemoteFile('file content')); $this->assertEqual($remoteApi->call('wiki.voidTestMethod'), null); } diff --git a/inc/remote.php b/inc/remote.php index bc35d525e..7e82b6845 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -5,6 +5,21 @@ if (!defined('DOKU_INC')) die(); class RemoteException extends Exception {} class RemoteAccessDenied extends RemoteException {} +abstract class RemoteDataType { + private $value; + + function __construct($value) { + $this->value = $value; + } + + function getValue() { + return $this->value; + } +} + +class RemoteDate extends RemoteDataType {} +class RemoteFile extends RemoteDataType {} + /** * This class provides information about remote access to the wiki. * -- cgit v1.2.3 From add86630b09f0e91952081112e3fa642ee35e499 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Mon, 12 Dec 2011 17:02:12 +0100 Subject: changed to new Remote Data objects --- inc/RemoteAPICore.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index a2e12c7f1..6b34d257a 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -81,8 +81,7 @@ class RemoteAPICore { } $data = io_readFile($file, false); - $base64 = base64_encode($data); - return $base64; + return new RemoteFile($data); } /** @@ -134,7 +133,7 @@ class RemoteAPICore { $page['id'] = trim($pages[$idx]); $page['perms'] = $perm; $page['size'] = @filesize(wikiFN($pages[$idx])); - $page['lastModified'] = new IXR_Date(@filemtime(wikiFN($pages[$idx]))); + $page['lastModified'] = new RemoteDate(@filemtime(wikiFN($pages[$idx]))); $list[] = $page; } @@ -181,7 +180,7 @@ class RemoteAPICore { $pages[] = array( 'id' => $id, - 'score' => $score, + 'score' => intval($score), 'rev' => filemtime($file), 'mtime' => filemtime($file), 'size' => filesize($file), @@ -210,7 +209,6 @@ class RemoteAPICore { */ function listAttachments($ns, $options = array()) { global $conf; - global $lang; $ns = cleanID($ns); @@ -228,7 +226,7 @@ class RemoteAPICore { for($i=0; $i<$len; $i++) { unset($data[$i]['meta']); - $data[$i]['lastModified'] = new IXR_Date($data[$i]['mtime']); + $data[$i]['lastModified'] = new RemoteDate($data[$i]['mtime']); } return $data; } else { @@ -261,7 +259,7 @@ class RemoteAPICore { $data = array( 'name' => $id, - 'lastModified' => new IXR_Date($time), + 'lastModified' => new RemoteDate($time), 'author' => (($info['user']) ? $info['user'] : $info['ip']), 'version' => $time ); @@ -344,7 +342,7 @@ class RemoteAPICore { * * Michael Klier */ - function putAttachment($id, $file, $params) { + function putAttachment($id, RemoteFile $file, $params) { $id = cleanID($id); $auth = auth_quickaclcheck(getNS($id).':*'); @@ -358,12 +356,7 @@ class RemoteAPICore { // save temporary file @unlink($ftmp); - if (preg_match('/^[A-Za-z0-9\+\/]*={0,2}$/', $file) === 1) { - // DEPRECATED: Double-decode file if it still looks like base64 - // after first decoding (which is done by the library) - $file = base64_decode($file); - } - io_saveFile($ftmp, $file); + io_saveFile($ftmp, $file->getValue()); $res = media_save(array('name' => $ftmp), $id, $params['ow'], $auth, 'rename'); if (is_array($res)) { @@ -468,7 +461,7 @@ class RemoteAPICore { foreach ($recents as $recent) { $change = array(); $change['name'] = $recent['id']; - $change['lastModified'] = new IXR_Date($recent['date']); + $change['lastModified'] = new RemoteDate($recent['date']); $change['author'] = $recent['user']; $change['version'] = $recent['date']; $change['perms'] = $recent['perms']; @@ -501,7 +494,7 @@ class RemoteAPICore { foreach ($recents as $recent) { $change = array(); $change['name'] = $recent['id']; - $change['lastModified'] = new IXR_Date($recent['date']); + $change['lastModified'] = new RemoteDate($recent['date']); $change['author'] = $recent['user']; $change['version'] = $recent['date']; $change['perms'] = $recent['perms']; @@ -565,7 +558,7 @@ class RemoteAPICore { $data['ip'] = $info['ip']; $data['type'] = $info['type']; $data['sum'] = $info['sum']; - $data['modified'] = new IXR_Date($info['date']); + $data['modified'] = new RemoteDate($info['date']); $data['version'] = $info['date']; array_push($versions, $data); } -- cgit v1.2.3 From fe092d886946cca23fa8ab1be240a356a1f60492 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 11 Dec 2011 11:24:19 +0100 Subject: transfered bugfix from dokuwiki 97a000f0551735b35606d94d59abc4ff440783a5 --- lib/exe/xmlrpc.php | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index cb8dbf42d..bcbae0a43 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -299,17 +299,16 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * @author Gina Haeussge */ function getAttachment($id){ - $id = cleanID($id); - if (auth_quickaclcheck(getNS($id).':*') < AUTH_READ) - return new IXR_Error(1, 'You are not allowed to read this file'); - - $file = mediaFN($id); - if (!@ file_exists($file)) - return new IXR_Error(1, 'The requested file does not exist'); - - $data = io_readFile($file, false); - $base64 = base64_encode($data); - return $base64; + try { + try { + return $this->remote->getAttachment($id); + } catch (RemoteAccessDenied $e) { + return new IXR_Error(1, 'You are not allowed to read this file'); + } + } + catch (RemoteException $e) { + return new IXR_Error(1, $e->getMessage()); + } } /** @@ -318,18 +317,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { * @author Gina Haeussge */ function getAttachmentInfo($id){ - $id = cleanID($id); - $info = array( - 'lastModified' => 0, - 'size' => 0, - ); - - $file = mediaFN($id); - if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){ - $info['lastModified'] = new IXR_Date(filemtime($file)); - $info['size'] = filesize($file); - } - + $info = $this->remote->getAttachmentInfo($id); + $info['lastModified'] = new IXR_Date($info['lastModified']); return $info; } -- cgit v1.2.3 From 37fa8abdcb4ed0634f9c21c8e6f2d727d1ffd600 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Dec 2011 14:35:48 +0100 Subject: added methods from xmlrpc.php to RemoteAPICore --- inc/RemoteAPICore.php | 174 +++++++++++++++++++++++++++++++++++++++++++------- inc/remote.php | 5 +- 2 files changed, 151 insertions(+), 28 deletions(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 6b34d257a..106ed598c 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -4,40 +4,167 @@ class RemoteAPICore { function __getRemoteInfo() { return array( - 'wiki.getPage' => array( + 'dokuwiki.getVersion' => array( + 'args' => array(), + 'return' => 'string', + 'doc' => 'Returns the running DokuWiki version.' + ), 'dokuwiki.login' => array( + 'args' => array( + 'username' => 'string', + 'password' => 'string' + ), + 'return' => 'int', + 'doc' => 'Tries to login with the given credentials and sets auth cookies.' + ), 'dokuwiki.getPagelist' => array( + 'args' => array( + 'namespace' => 'string', + 'options' => 'array' + ), + 'return' => 'array', + 'doc' => 'List all pages within the given namespace.', + 'name' => 'readNamespace' + ), 'dokuwiki.search' => array( 'args' => array( - 'id' => array( - 'type' => 'string', - 'doc' => 'wiki page id' - ), + 'search' => 'string' ), + 'return' => 'array', + 'doc' => 'Perform a fulltext search and return a list of matching pages' + ), 'dokuwiki.getTime' => array( + 'args' => array(), + 'return' => 'int', + 'doc' => 'Returns the current time at the remote wiki server as Unix timestamp.', + ), 'dokuwiki.setLocks' => array( + 'args' => array('lock' => 'array'), + 'return' => 'array', + 'doc' => 'Lock or unlock pages.' + ), 'dokuwiki.getTitle' => array( + 'args' => array(), 'return' => 'string', - 'doc' => 'Return a raw wiki page', + 'doc' => 'Returns the wiki title.' + ), 'dokuwiki.appendPage' => array( + 'args' => array( + 'pagename' => 'string', + 'rawWikiText' => 'string', + 'attrs' => 'array' + ), + 'return' => 'int', + 'doc' => 'Append text to a wiki page.' + ), 'wiki.getPage' => array( + 'args' => array( + 'id' => 'string' + ), + 'return' => 'string', + 'doc' => 'Get the raw Wiki text of page, latest version.', 'name' => 'rawPage', - ), - 'wiki.getPageVersion' => array( + ), 'wiki.getPageVersion' => array( 'args' => array( - 'id' => array( - 'type' => 'string', - 'doc' => 'wiki page id' - ), - 'rev' => array( - 'type' => 'int', - 'doc' => 'revision number of the page', - ), + 'id' => 'string', + 'rev' => 'int', ), 'name' => 'rawPage', 'return' => 'string', 'doc' => 'Return a raw wiki page' - ), - 'wiki.getAttachment' => array( + ), 'wiki.getPageHTML' => array( + 'args' => array( + 'id' => 'string' + ), + 'return' => 'string', + 'doc' => 'Return page in rendered HTML, latest version.', + 'name' => 'htmlPage' + ), 'wiki.getPageHTMLVersion' => array( 'args' => array( - 'type' => 'string', - 'doc' => 'file id', + 'id' => 'string', + 'rev' => 'int' ), + 'return' => 'string', + 'doc' => 'Return page in rendered HTML.', + 'name' => 'htmlPage' + ), 'wiki.getAllPages' => array( + 'args' => array(), + 'return' => 'array', + 'doc' => 'Returns a list of all pages. The result is an array of utf8 pagenames.', + 'name' => 'listPages' + ), 'wiki.getAttachments' => array( + 'args' => array( + 'namespace' => 'string', + 'options' => 'array' + ), + 'return' => 'array', + 'doc' => 'Returns a list of all media files.', + 'name' => 'listAttachments' + ), 'wiki.getBackLinks' => array( + 'args' => array( + 'id' => 'string' + ), + 'return' => 'array', + 'doc' => 'Returns the pages that link to this page.', + 'name' => 'listBackLinks' + ), 'wiki.getPageInfo' => array( + 'args' => array('id' => 'string'), + 'return' => 'array', + 'doc' => 'Returns a struct with infos about the page.', + 'name' => 'pageInfo' + ), 'wiki.getPageInfoVersion' => array( + 'args' => array( + 'id' => 'string', + 'version' => 'int', + ), + 'return' => 'array', + 'doc' => 'Returns a struct with infos about the page.', + 'name' => 'pageInfo' + ), 'wiki.getPageVersions' => array( + 'args' => array( + 'id' => 'string', + 'offset' => 'int' + ), + 'return' => 'array', + 'doc' => 'Returns the available revisions of the page.', + 'name' => 'pageVersions' + ), 'wiki.putPage' => array( + 'args' => array( + 'id' => 'string', + 'rawText' => 'string', + 'attrs' => 'array' + ), + 'return' => 'int', + 'doc' => 'Saves a wiki page.' + ), 'wiki.listLinks' => array( + 'args' => array('id' => 'string'), + 'return' => 'array', + 'doc' => 'Lists all links contained in a wiki page.' + ), 'wiki.getRecentChanges' => array( + 'args' => array('timestamp' => 'int'), + 'return' => 'array', + 'Returns a struct about all recent changes since given timestamp.' + ), 'wiki.getRecentMediaChanges' => array( + 'args' => array('timestamp' => 'int'), + 'return' => 'array', + 'Returns a struct about all recent media changes since given timestamp.' + ), 'wiki.aclCheck' => array( + 'args' => array('id' => 'string'), + 'return' => 'int', + 'doc' => 'Returns the permissions of a given wiki page.' + ), 'wiki.putAttachment' => array( + 'args' => array( + 'id' => 'string', + 'data' => 'file', + 'params' => 'array' + ), + 'return' => 'array', + 'doc' => 'Upload a file to the wiki.' + ), 'wiki.deleteAttachment' => array( + 'args' => array('id' => 'string'), + 'return' => 'int', + 'doc' => 'Delete a file from the wiki.' + ), 'wiki.getAttachment' => array( + 'args' => array('id' => 'string'), 'doc' => 'Return a media file', 'return' => 'file', 'name' => 'getAttachment', + ), 'wiki.getAttachmentInfo' => array( + 'args' => array('id' => 'string'), + 'return' => 'array', + 'doc' => 'Returns a struct with infos about the attachment.' ), ); @@ -63,7 +190,7 @@ class RemoteAPICore { } /** - * Return a media file encoded in base64 + * Return a media file * * @author Gina Haeussge * @param string $id file id @@ -92,13 +219,13 @@ class RemoteAPICore { function getAttachmentInfo($id){ $id = cleanID($id); $info = array( - 'lastModified' => 0, + 'lastModified' => new RemoteDate(0), 'size' => 0, ); $file = mediaFN($id); if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){ - $info['lastModified'] = filemtime($file); + $info['lastModified'] = new RemoteDate(filemtime($file)); $info['size'] = filesize($file); } @@ -275,7 +402,6 @@ class RemoteAPICore { function putPage($id, $text, $params) { global $TEXT; global $lang; - global $conf; $id = cleanID($id); $TEXT = cleanText($text); diff --git a/inc/remote.php b/inc/remote.php index 7e82b6845..e18c71092 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -33,10 +33,7 @@ class RemoteFile extends RemoteDataType {} * array( * 'method.remoteName' => array( * 'args' => array( - * 'name' => array( - * 'type' => 'string|int|...|date|file', - * ['doc' = 'argument documentation'], - * ), + * 'name' => 'type eg. string|int|...|date|file', * ) * 'name' => 'method name in class', * 'return' => 'type', -- cgit v1.2.3 From d80d35e22221ff74c4374f34927a5097362e23d8 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 22 Dec 2011 19:11:31 +0100 Subject: added forgotten remote.php in lib/plugins --- lib/plugins/remote.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/plugins/remote.php diff --git a/lib/plugins/remote.php b/lib/plugins/remote.php new file mode 100644 index 000000000..42c2f53c8 --- /dev/null +++ b/lib/plugins/remote.php @@ -0,0 +1,11 @@ + Date: Sun, 8 Jan 2012 14:38:52 +0100 Subject: removed xmlrpc and xmlrpcuser - added remote and remoteuser config option --- conf/dokuwiki.php | 4 ++-- lib/plugins/config/lang/ar/lang.php | 2 -- lib/plugins/config/lang/bg/lang.php | 2 -- lib/plugins/config/lang/ca-valencia/lang.php | 2 -- lib/plugins/config/lang/ca/lang.php | 2 -- lib/plugins/config/lang/cs/lang.php | 2 -- lib/plugins/config/lang/da/lang.php | 2 -- lib/plugins/config/lang/de-informal/lang.php | 2 -- lib/plugins/config/lang/de/lang.php | 2 -- lib/plugins/config/lang/el/lang.php | 4 +--- lib/plugins/config/lang/en/lang.php | 4 ++-- lib/plugins/config/lang/eo/lang.php | 2 -- lib/plugins/config/lang/es/lang.php | 2 -- lib/plugins/config/lang/eu/lang.php | 2 -- lib/plugins/config/lang/fa/lang.php | 2 -- lib/plugins/config/lang/fi/lang.php | 2 -- lib/plugins/config/lang/fr/lang.php | 2 -- lib/plugins/config/lang/gl/lang.php | 2 -- lib/plugins/config/lang/he/lang.php | 1 - lib/plugins/config/lang/hu/lang.php | 2 -- lib/plugins/config/lang/ia/lang.php | 2 -- lib/plugins/config/lang/id-ni/lang.php | 1 - lib/plugins/config/lang/it/lang.php | 2 -- lib/plugins/config/lang/ja/lang.php | 2 -- lib/plugins/config/lang/ko/lang.php | 2 -- lib/plugins/config/lang/la/lang.php | 2 -- lib/plugins/config/lang/lv/lang.php | 2 -- lib/plugins/config/lang/mr/lang.php | 2 -- lib/plugins/config/lang/nl/lang.php | 2 -- lib/plugins/config/lang/no/lang.php | 3 --- lib/plugins/config/lang/pl/lang.php | 2 -- lib/plugins/config/lang/pt-br/lang.php | 2 -- lib/plugins/config/lang/pt/lang.php | 2 -- lib/plugins/config/lang/ro/lang.php | 2 -- lib/plugins/config/lang/ru/lang.php | 2 -- lib/plugins/config/lang/sk/lang.php | 2 -- lib/plugins/config/lang/sl/lang.php | 2 -- lib/plugins/config/lang/sq/lang.php | 2 -- lib/plugins/config/lang/sr/lang.php | 2 -- lib/plugins/config/lang/sv/lang.php | 2 -- lib/plugins/config/lang/th/lang.php | 1 - lib/plugins/config/lang/uk/lang.php | 2 -- lib/plugins/config/lang/zh-tw/lang.php | 2 -- lib/plugins/config/lang/zh/lang.php | 2 -- lib/plugins/config/settings/config.metadata.php | 4 ++-- 45 files changed, 7 insertions(+), 89 deletions(-) diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index 298c8e572..4238f7e53 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -78,8 +78,8 @@ $conf['sneaky_index'] = 0; //check for namespace read permission i $conf['auth_security_timeout'] = 900; //time (seconds) auth data is considered valid, set to 0 to recheck on every page view $conf['securecookie'] = 1; //never send HTTPS cookies via HTTP -$conf['xmlrpc'] = 0; //Enable/disable XML-RPC interface -$conf['xmlrpcuser'] = '!!not set!!'; //Restrict XML-RPC access to this groups/users +$conf['remote'] = 0; //Enable/disable remote interfaces +$conf['remoteuser'] = '!!not set !!'; //user/groups that have access to remote interface (comma separated) /* Advanced Options */ diff --git a/lib/plugins/config/lang/ar/lang.php b/lib/plugins/config/lang/ar/lang.php index 63d258485..3855f4ac1 100644 --- a/lib/plugins/config/lang/ar/lang.php +++ b/lib/plugins/config/lang/ar/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'اجراءات أخرى (مفصولة بالف $lang['sneaky_index'] = 'افتراضيا، ستعرض دوكو ويكي كل اسماء النطاقات في عرض الفهرس. تفعيل هذا الخيار سيخفي مالا يملك المستخدم صلاحية قراءته. قد يؤدي هذا إلى اخفاء نطاقات فرعية متاحة. وقد يؤدي لجعل صفحة الفهرس معطلة في بعض اعدادات ACL.'; $lang['auth_security_timeout'] = 'زمن انتهاء أمان المواثقة (ثوان)'; $lang['securecookie'] = 'هل يفرض على كعكات التصفح المعدة عبر HTTPS ان ترسل فقط عبر HTTPS من قبل المتصفح؟ عطل هذا إن كان الولوج للويكي مؤمنا فقط عبر SSL لكن تصفح الويكي غير مؤمن.'; -$lang['xmlrpc'] = 'مكّن/عطل واجهة XML-RPC.'; -$lang['xmlrpcuser'] = 'احصر الوصول لـ XML-RPC بمستخدمين أو مجموعات مفصولة بالفاصلة هنا. اتركها فارغة لتمكين الوصول للجميع.'; $lang['updatecheck'] = 'تحقق من التحديثات و تنبيهات الأمان؟ دوكو ويكي ستحتاج للاتصال ب update.dokuwiki.org لأجل ذلك'; $lang['userewrite'] = 'استعمل عناوين URLs جميلة'; $lang['useslash'] = 'استخدم الشرطة كفاصل النطاق في العناوين'; diff --git a/lib/plugins/config/lang/bg/lang.php b/lib/plugins/config/lang/bg/lang.php index ff03fd9e2..8f61e96c0 100644 --- a/lib/plugins/config/lang/bg/lang.php +++ b/lib/plugins/config/lang/bg/lang.php @@ -88,8 +88,6 @@ $lang['sneaky_index'] = 'Стандартно DokuWiki ще показ $lang['auth_security_timeout'] = 'Автоматично проверяване на удостоверяването всеки (сек)'; $lang['securecookie'] = 'Да се изпращат ли бисквитките зададени чрез HTTPS, само чрез HTTPS от браузъра? Изключете опцията, когато SSL се ползва само за вписване, а четенето е без SSL. '; -$lang['xmlrpc'] = 'Включване/Изключване на интерфейса XML-RPC.'; -$lang['xmlrpcuser'] = 'Ограничаване на XML-RPC достъпа до отделени със запетая групи или потребители. Оставете празно, за да даде достъп на всеки.'; $lang['updatecheck'] = 'Проверяване за за нови версии и предупреждения за сигурността? Необходимо е Dokiwiki да може да се свързва със update.dokuwiki.org за тази функционалност.'; $lang['userewrite'] = 'Ползване на nice URL адреси'; $lang['useslash'] = 'Ползване на наклонена черта за разделител на именните пространства в URL'; diff --git a/lib/plugins/config/lang/ca-valencia/lang.php b/lib/plugins/config/lang/ca-valencia/lang.php index 76f11a4a5..4a8c10895 100644 --- a/lib/plugins/config/lang/ca-valencia/lang.php +++ b/lib/plugins/config/lang/ca-valencia/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'Atres accions (separades per comes)'; $lang['sneaky_index'] = 'Normalment, DokuWiki mostra tots els espais de noms en la vista d\'índex. Activant esta opció s\'ocultaran aquells per als que l\'usuari no tinga permís de llectura. Açò pot ocultar subespais accessibles i inutilisar l\'índex per a certes configuracions del ACL.'; $lang['auth_security_timeout'] = 'Temps de seguritat màxim per a l\'autenticació (segons)'; $lang['securecookie'] = '¿El navegador deuria enviar per HTTPS només les galletes que s\'han generat per HTTPS? Desactive esta opció quan utilise SSL només en la pàgina d\'inici de sessió.'; -$lang['xmlrpc'] = 'Activar/desactivar interfaç XML-RPC.'; -$lang['xmlrpcuser'] = 'Restringir l\'accés XML-RPC a la llista d\'usuaris i grups separada per comes definida ací. Deixar buit per a donar accés a tots.'; $lang['updatecheck'] = '¿Buscar actualisacions i advertències de seguritat? DokuWiki necessita conectar a update.dokuwiki.org per ad açò.'; $lang['userewrite'] = 'Utilisar URL millorades'; $lang['useslash'] = 'Utilisar \'/\' per a separar espais de noms en les URL'; diff --git a/lib/plugins/config/lang/ca/lang.php b/lib/plugins/config/lang/ca/lang.php index 1a2a22881..84680450a 100644 --- a/lib/plugins/config/lang/ca/lang.php +++ b/lib/plugins/config/lang/ca/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'Altres accions (separades per comes)'; $lang['sneaky_index'] = 'Per defecte, DokuWiki mostrarà tots els espai en la visualització d\'índex. Si activeu aquest paràmetre, s\'ocultaran aquells espais en els quals l\'usuari no té accés de lectura. Això pot fer que s\'ocultin subespais que sí que són accessibles. En algunes configuracions ACL pot fer que l\'índex resulti inutilitzable.'; $lang['auth_security_timeout'] = 'Temps d\'espera de seguretat en l\'autenticació (segons)'; $lang['securecookie'] = 'Les galetes que s\'han creat via HTTPS, només s\'han d\'enviar des del navegador per HTTPS? Inhabiliteu aquesta opció si només l\'inici de sessió del wiki es fa amb SSL i la navegació del wiki es fa sense seguretat.'; -$lang['xmlrpc'] = 'Habilita/inhabilita la interfície XML-RPC'; -$lang['xmlrpcuser'] = 'Restringeix l\'accés per XML-RPC als usuaris o grups següents, separats per comes. Deixeu aquest camp en blanc per donar accés a tothom.'; $lang['updatecheck'] = 'Comprova actualitzacions i avisos de seguretat. DokuWiki necessitarà contactar amb update.dokuwiki.org per utilitzar aquesta característica.'; $lang['userewrite'] = 'Utilitza URL nets'; $lang['useslash'] = 'Utilitza la barra / com a separador d\'espais en els URL'; diff --git a/lib/plugins/config/lang/cs/lang.php b/lib/plugins/config/lang/cs/lang.php index bf87e99d5..b9e6049a5 100644 --- a/lib/plugins/config/lang/cs/lang.php +++ b/lib/plugins/config/lang/cs/lang.php @@ -99,8 +99,6 @@ To může mít za následek, že index bude při některých nastaveních ACL nepoužitelný.'; $lang['auth_security_timeout'] = 'Časový limit pro autentikaci (v sekundách)'; $lang['securecookie'] = 'Má prohlížeč posílat cookies nastavené přes HTTPS opět jen přes HTTPS? Vypněte tuto volbu, pokud chcete, aby bylo pomocí SSL zabezpečeno pouze přihlašování do wiki, ale obsah budete prohlížet nezabezpečeně.'; -$lang['xmlrpc'] = 'Povolit/Zakázat rozhraní XML-RPC.'; -$lang['xmlrpcuser'] = 'Omezit přístup pomocí XML-RPC pouze na zde zadané skupiny či uživatele (oddělené čárkami). Necháte-li pole prázdné, dáte přístup komukoliv.'; $lang['updatecheck'] = 'Kontrolovat aktualizace a bezpečnostní varování? DokuWiki potřebuje pro tuto funkci přístup k update.dokuwiki.org'; $lang['userewrite'] = 'Používat "pěkná" URL'; $lang['useslash'] = 'Používat lomítko jako oddělovač jmenných prostorů v URL'; diff --git a/lib/plugins/config/lang/da/lang.php b/lib/plugins/config/lang/da/lang.php index a4c0bba75..7e8fe95af 100644 --- a/lib/plugins/config/lang/da/lang.php +++ b/lib/plugins/config/lang/da/lang.php @@ -92,8 +92,6 @@ $lang['disableactions_other'] = 'Andre muligheder (kommasepareret)'; $lang['sneaky_index'] = 'DokuWiki vil som standard vise alle navnerum i indholdsfortegnelsen. Ved at slå denne valgmulighed til vil skjule de navnerum, hvor brugeren ikke har læsetilladelse. Dette kan føre til, at tilgængelige undernavnerum bliver skjult. Ligeledes kan det også gøre indholdsfortegnelsen ubrugelig med visse ACL-opsætninger.'; $lang['auth_security_timeout'] = 'Tidsudløb for bekræftelse (sekunder)'; $lang['securecookie'] = 'Skal datafiler skabt af HTTPS kun sendes af HTTPS gennem browseren? Slå denne valgmulighed fra hvis kun brugen af din wiki er SSL-beskyttet, mens den almindelige tilgang udefra ikke er sikret.'; -$lang['xmlrpc'] = 'Slå XML-RPC-grænseflade til/fra.'; -$lang['xmlrpcuser'] = 'Begræns XML-RPC-adgang til de nævnte og med komma adskilte grupper eller brugere. Lad den stå tom for at give alle adgang.'; $lang['updatecheck'] = 'Kig efter opdateringer og sikkerhedsadvarsler? DokuWiki er nødt til at kontakte update.dokuwiki.org for at tilgå denne funktion.'; $lang['userewrite'] = 'Brug pæne netadresser'; $lang['useslash'] = 'Brug skråstreg som navnerumsdeler i netadresser'; diff --git a/lib/plugins/config/lang/de-informal/lang.php b/lib/plugins/config/lang/de-informal/lang.php index e63735edf..505d71a40 100644 --- a/lib/plugins/config/lang/de-informal/lang.php +++ b/lib/plugins/config/lang/de-informal/lang.php @@ -88,8 +88,6 @@ $lang['disableactions_other'] = 'Weitere Aktionen (durch Komma getrennt)'; $lang['sneaky_index'] = 'Standardmäßig zeigt DokuWiki alle Namensräume in der Indexansicht an. Bei Aktivierung dieser Einstellung werden alle Namensräume versteckt, in welchen der Benutzer keine Leserechte hat. Dies könnte dazu führen, dass lesbare Unternamensräume versteckt werden. Dies kann die Indexansicht bei bestimmten Zugangskontrolleinstellungen unbenutzbar machen.'; $lang['auth_security_timeout'] = 'Zeitüberschreitung bei der Authentifizierung (Sekunden)'; $lang['securecookie'] = 'Sollen Cookies, die via HTTPS gesetzt wurden nur per HTTPS versendet werden? Deaktiviere diese Option, wenn nur der Login deines Wikis mit SSL gesichert ist, aber das Betrachten des Wikis ungesichert geschieht.'; -$lang['xmlrpc'] = 'Aktiviere/Deaktiviere die XML-RPC-Schnittstelle'; -$lang['xmlrpcuser'] = 'XML-RPC-Zugriff auf folgende Gruppen oder Benutzer (kommasepariert) beschränken. Wenn du dieses Feld leer lässt, wir der Zugriff jedem gewährt.'; $lang['updatecheck'] = 'Automatisch auf Updates und Sicherheitswarnungen prüfen? DokuWiki muss sich dafür mit update.dokuwiki.org verbinden.'; $lang['userewrite'] = 'Benutze schöne URLs'; $lang['useslash'] = 'Benutze Schrägstrich als Namensraumtrenner in URLs'; diff --git a/lib/plugins/config/lang/de/lang.php b/lib/plugins/config/lang/de/lang.php index 1fb549597..79c6554e3 100644 --- a/lib/plugins/config/lang/de/lang.php +++ b/lib/plugins/config/lang/de/lang.php @@ -99,8 +99,6 @@ $lang['disableactions_other'] = 'Andere Aktionen (durch Komma getrennt)'; $lang['sneaky_index'] = 'Standardmäßig zeigt DokuWiki alle Namensräume in der Übersicht. Wenn diese Option aktiviert wird, werden alle Namensräume, für die der Benutzer keine Lese-Rechte hat, nicht angezeigt. Dies kann unter Umständen dazu führen, das lesbare Unter-Namensräume nicht angezeigt werden und macht die Übersicht evtl. unbrauchbar in Kombination mit bestimmten ACL Einstellungen.'; $lang['auth_security_timeout'] = 'Authentifikations-Timeout (Sekunden)'; $lang['securecookie'] = 'Sollen Cookies, die via HTTPS gesetzt wurden nur per HTTPS versendet werden? Deaktivieren Sie diese Option, wenn nur der Login Ihres Wikis mit SSL gesichert ist, aber das Betrachten des Wikis ungesichert geschieht.'; -$lang['xmlrpc'] = 'XML-RPC-Zugriff erlauben.'; -$lang['xmlrpcuser'] = 'XML-RPC-Zugriff auf folgende Gruppen oder Benutzer (kommasepariert) beschränken. Wenn Sie dieses Feld leer lassen, wir der Zugriff jedem gewährt.'; $lang['updatecheck'] = 'Automatisch auf Updates und Sicherheitswarnungen prüfen? DokuWiki muss sich dafür mit update.dokuwiki.org verbinden.'; $lang['userewrite'] = 'URL rewriting'; $lang['useslash'] = 'Schrägstrich (/) als Namensraumtrenner in URLs verwenden'; diff --git a/lib/plugins/config/lang/el/lang.php b/lib/plugins/config/lang/el/lang.php index 9f5d121de..093212664 100644 --- a/lib/plugins/config/lang/el/lang.php +++ b/lib/plugins/config/lang/el/lang.php @@ -93,8 +93,6 @@ $lang['disableactions_other'] = 'Άλλες λειτουργίες (διαχω $lang['sneaky_index'] = 'Εξ ορισμού, η εφαρμογή DokuWiki δείχνει όλους τους φακέλους στην προβολή Καταλόγου. Ενεργοποιώντας αυτή την επιλογή, δεν θα εμφανίζονται οι φάκελοι για τους οποίους ο χρήστης δεν έχει δικαιώματα ανάγνωσης αλλά και οι υπο-φάκελοί τους ανεξαρτήτως δικαιωμάτων πρόσβασης.'; $lang['auth_security_timeout'] = 'Διάρκεια χρόνου για ασφάλεια πιστοποίησης (δευτερόλεπτα)'; $lang['securecookie'] = 'Τα cookies που έχουν οριστεί μέσω HTTPS πρέπει επίσης να αποστέλλονται μόνο μέσω HTTPS από τον φυλλομετρητή? Απενεργοποιήστε αυτή την επιλογή όταν μόνο η είσοδος στο wiki σας διασφαλίζεται μέσω SSL αλλά η περιήγηση γίνεται και χωρίς αυτό.'; -$lang['xmlrpc'] = 'Ενεργοποίηση/Απενεργοποίηση της διασύνδεσης XML-RPC '; -$lang['xmlrpcuser'] = 'Περιορισμός XML-RPC πρόσβασης στις ομάδες η τους χρήστες (διαχωριζόμενοι με κόμμα). Αφήστε το κενό για πρόσβαση από όλους.'; $lang['updatecheck'] = 'Έλεγχος για ύπαρξη νέων εκδόσεων και ενημερώσεων ασφαλείας της εφαρμογής? Απαιτείται η σύνδεση με το update.dokuwiki.org για να λειτουργήσει σωστά αυτή η επιλογή.'; $lang['userewrite'] = 'Χρήση ωραίων URLs'; $lang['useslash'] = 'Χρήση slash σαν διαχωριστικό φακέλων στα URLs'; @@ -118,7 +116,7 @@ $lang['jpg_quality'] = 'Ποιότητα συμπίεσης JPG (0-100 $lang['subscribers'] = 'Να επιτρέπεται η εγγραφή στην ενημέρωση αλλαγών σελίδας'; $lang['subscribe_time'] = 'Χρόνος μετά τον οποίο οι λίστες ειδοποιήσεων και τα συνοπτικά θα αποστέλλονται (δευτερόλεπτα). Αυτό θα πρέπει να είναι μικρότερο από τον χρόνο που έχει η ρύθμιση recent_days.'; $lang['compress'] = 'Συμπίεση αρχείων CSS και javascript'; -$lang['cssdatauri'] = 'Το μέγεθος σε bytes στο οποίο οι εικόνες που αναφέρονται σε CSS αρχεία θα πρέπει να είναι ενσωματωμένες για τη μείωση των απαιτήσεων μιας κεφαλίδας αίτησης HTTP . Αυτή η τεχνική δεν θα λειτουργήσει σε IE <8! 400 με 600 bytes είναι μια καλή τιμή. Ορίστε την τιμή 0 για να το απενεργοποιήσετε.'; +$lang['cssdatauri'] = 'Το μέγεθος σε bytes στο οποίο οι εικόνες που αναφέρονται σε CSS αρχεία θα πρέπει να είναι ενσωματωμένες για τη μείωση των απαιτήσεων μιας κεφαλίδας αίτησης HTTP . Αυτή η τεχνική δεν θα λειτουργήσει σε IE <8! 400 με 600 bytes είναι μια καλή τιμή. Ορίστε την τιμή 0 για να το απενεργοποιήσετε.'; $lang['hidepages'] = 'Φίλτρο απόκρυψης σελίδων (regular expressions)'; $lang['send404'] = 'Αποστολή "HTTP 404/Page Not Found" για σελίδες που δεν υπάρχουν'; $lang['sitemap'] = 'Δημιουργία Google sitemap (ημέρες)'; diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index 380f2fd1d..27f754c2c 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -107,8 +107,8 @@ $lang['disableactions_other'] = 'Other actions (comma separated)'; $lang['sneaky_index'] = 'By default, DokuWiki will show all namespaces in the index view. Enabling this option will hide those where the user doesn\'t have read permissions. This might result in hiding of accessable subnamespaces. This may make the index unusable with certain ACL setups.'; $lang['auth_security_timeout'] = 'Authentication Security Timeout (seconds)'; $lang['securecookie'] = 'Should cookies set via HTTPS only be sent via HTTPS by the browser? Disable this option when only the login of your wiki is secured with SSL but browsing the wiki is done unsecured.'; -$lang['xmlrpc'] = 'Enable/disable XML-RPC interface.'; -$lang['xmlrpcuser'] = 'Restrict XML-RPC access to the comma separated groups or users given here. Leave empty to give access to everyone.'; +$lang['remote'] = 'Enable/disable Remote interface.'; +$lang['remoteuser'] = 'Restrict Remote access to the comma separated groups or users given here. Leave empty to give access to everyone.'; /* Advanced Options */ $lang['updatecheck'] = 'Check for updates and security warnings? DokuWiki needs to contact update.dokuwiki.org for this feature.'; diff --git a/lib/plugins/config/lang/eo/lang.php b/lib/plugins/config/lang/eo/lang.php index b0411ec14..3acb00545 100644 --- a/lib/plugins/config/lang/eo/lang.php +++ b/lib/plugins/config/lang/eo/lang.php @@ -93,8 +93,6 @@ $lang['disableactions_other'] = 'Aliaj agoj (apartite per komoj)'; $lang['sneaky_index'] = 'Apriore, DokuWiki montras ĉiujn nomspacojn en la indeksa modo. Ebligi tiun ĉi elekteblon kaŝus tion, kion la uzanto ne rajtas legi laŭ ACL. Tio povus rezulti ankaŭan kaŝon de alireblaj subnomspacoj. Kaj tiel la indekso estus neuzebla por kelkaj agordoj de ACL.'; $lang['auth_security_timeout'] = 'Sekureca Templimo por aŭtentigo (sekundoj)'; $lang['securecookie'] = 'Ĉu kuketoj difinitaj per HTTPS nur estu senditaj de la foliumilo per HTTPS? Malebligu tiun ĉi opcion kiam nur la ensaluto al via vikio estas sekurigita per SSL, sed foliumado de la vikio estas farita malsekure.'; -$lang['xmlrpc'] = 'Ebligi/malebligi la interfacon XML-RPC.'; -$lang['xmlrpcuser'] = 'Permesi XML-RPC-an aliron al certaj grupoj aŭ uzantoj, bonvolu meti iliajn komoseparitajn nomojn tie ĉi. Alirebli de ĉiu, ĝin lasu malplena.'; $lang['updatecheck'] = 'Ĉu kontroli aktualigojn kaj sekurecajn avizojn? DokuWiki bezonas kontakti update.dokuwiki.org por tiu ĉi trajto.'; $lang['userewrite'] = 'Uzi netajn URL-ojn'; $lang['useslash'] = 'Uzi frakcistrekon kiel apartigsignaĵo por nomspacoj en URL-oj'; diff --git a/lib/plugins/config/lang/es/lang.php b/lib/plugins/config/lang/es/lang.php index 1189a6781..fd911433c 100644 --- a/lib/plugins/config/lang/es/lang.php +++ b/lib/plugins/config/lang/es/lang.php @@ -102,8 +102,6 @@ $lang['disableactions_other'] = 'Otras acciones (separadas por coma)'; $lang['sneaky_index'] = 'Por defecto, DokuWiki mostrará todos los namespaces en el index. Habilitando esta opción los ocultará si el usuario no tiene permisos de lectura. Los sub-namespaces pueden resultar inaccesibles. El index puede hacerse poco usable dependiendo de las configuraciones ACL.'; $lang['auth_security_timeout'] = 'Tiempo de Autenticación (en segundos), por motivos de seguridad'; $lang['securecookie'] = 'Las cookies establecidas por HTTPS, ¿el naveagdor solo puede enviarlas por HTTPS? Inhabilite esta opción cuando solo se asegure con SSL la entrada, pero no la navegación de su wiki.'; -$lang['xmlrpc'] = 'Habilitar/Deshabilitar interfaz XML-RPC'; -$lang['xmlrpcuser'] = 'Restringir el acceso XML-RPC a los grupos o usuarios separados por coma mencionados aquí. Dejar en blanco para dar acceso a todo el mundo. '; $lang['updatecheck'] = '¿Comprobar actualizaciones y advertencias de seguridad? Esta característica requiere que DokuWiki se conecte a update.dokuwiki.org.'; $lang['userewrite'] = 'Usar URLs bonitas'; $lang['useslash'] = 'Usar barra (/) como separador de espacios de nombres en las URLs'; diff --git a/lib/plugins/config/lang/eu/lang.php b/lib/plugins/config/lang/eu/lang.php index 9d001d494..97addbb50 100644 --- a/lib/plugins/config/lang/eu/lang.php +++ b/lib/plugins/config/lang/eu/lang.php @@ -83,8 +83,6 @@ $lang['disableactions_other'] = 'Beste ekintzak (komaz bereiztuak)'; $lang['sneaky_index'] = 'Lehenespenez, DokuWiki-k izen-espazio guztiak indize bistan erakutsiko ditu. Aukera hau gaituta, erabiltzaieak irakurtzeko baimenik ez dituen izen-espazioak ezkutatuko dira. Honek atzigarriak diren azpi izen-espazioak ezkutatzen ditu. Agian honek indizea erabili ezin ahal izatea eragingo du AKL ezarpen batzuetan.'; $lang['auth_security_timeout'] = 'Kautotze Segurtasun Denbora-Muga (segunduak)'; $lang['securecookie'] = 'HTTPS bidez ezarritako cookie-ak HTTPS bidez bakarrik bidali beharko lituzke nabigatzaileak? Ezgaitu aukera hau bakarrik saio hasierak SSL bidezko segurtasuna badu baina wiki-areb nabigazioa modu ez seguruan egiten bada. '; -$lang['xmlrpc'] = 'Gaitu/ezgaitu XML-RPC interfazea.'; -$lang['xmlrpcuser'] = 'XML-RPC atzipena mugatu hemen emandako komaz bereiztutako talde eta erabiltzaileei. Utzi hutsik atzipena guztiei emateko.'; $lang['updatecheck'] = 'Konprobatu eguneratze eta segurtasun oharrak? DokuWiki-k honetarako update.dokuwiki.org kontaktatu behar du.'; $lang['userewrite'] = 'Erabili URL politak'; $lang['useslash'] = 'Erabili barra (/) izen-espazio banatzaile moduan URLetan'; diff --git a/lib/plugins/config/lang/fa/lang.php b/lib/plugins/config/lang/fa/lang.php index 42cc3ed05..c1a112365 100644 --- a/lib/plugins/config/lang/fa/lang.php +++ b/lib/plugins/config/lang/fa/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'فعالیت‌های دیگر (با ویرگ $lang['sneaky_index'] = 'به طور پیش‌فرض، DokuWiki در فهرست تمامی فضای‌نام‌ها را نمایش می‌دهد. فعال کردن این گزینه، مواردی را که کاربر حق خواندنشان را ندارد مخفی می‌کند. این گزینه ممکن است باعث دیده نشدن زیرفضای‌نام‌هایی شود که دسترسی خواندن به آن‌ها وجود دارد. و ممکن است باعث شود که فهرست در حالاتی از دسترسی‌ها، غیرقابل استفاده شود.'; $lang['auth_security_timeout'] = 'زمان انقضای معتبرسازی به ثانیه'; $lang['securecookie'] = 'آیا کوکی‌ها باید با قرارداد HTTPS ارسال شوند؟ این گزینه را زمانی که فقط صفحه‌ی ورود ویکی‌تان با SSL امن شده است، اما ویکی را ناامن مرور می‌کنید، غیرفعال نمایید.'; -$lang['xmlrpc'] = 'فعال/غیرفعال کردن XML-RPC'; -$lang['xmlrpcuser'] = 'محمدود کردن دسترسی به XML-RPC توسط گروه های جدا شده توسط ویرگول ویا اعضای داده شده در اینجا. این مکان را خالی بگزارید تا به همه دسترسی داده شود.'; $lang['updatecheck'] = 'هشدارهای به روز رسانی و امنیتی بررسی شود؟ برای این‌کار DokuWiki با سرور update.dokuwiki.org تماس خواهد گرفت.'; $lang['userewrite'] = 'از زیباکننده‌ی آدرس‌ها استفاده شود'; $lang['useslash'] = 'از اسلش «/» برای جداکننده‌ی آدرس فضای‌نام‌ها استفاده شود'; diff --git a/lib/plugins/config/lang/fi/lang.php b/lib/plugins/config/lang/fi/lang.php index 9598a0d93..f75a18ecd 100644 --- a/lib/plugins/config/lang/fi/lang.php +++ b/lib/plugins/config/lang/fi/lang.php @@ -88,8 +88,6 @@ $lang['disableactions_other'] = 'Muut toiminnot (pilkulla erotettuna)'; $lang['sneaky_index'] = 'Oletuksena DokuWiki näyttää kaikki nimiavaruudet index-näkymäsä. Tämä asetus piilottaa ne, joihin käyttäjällä ei ole lukuoikeuksia. Tämä voi piilottaa joitakin sallittuja alinimiavaruuksia. Tästä johtuen index-näkymä voi olla käyttökelvoton joillakin ACL-asetuksilla'; $lang['auth_security_timeout'] = 'Autentikoinnin aikakatkaisu (sekunteja)'; $lang['securecookie'] = 'Lähetetäänkö HTTPS:n kautta asetetut evästetiedot HTTPS-yhteydellä? Kytke pois, jos vain wikisi kirjautuminen on suojattu SSL:n avulla, mutta muuten wikiä käytetään ilman suojausta.'; -$lang['xmlrpc'] = 'Käytä/poista XML-RPC liityntää'; -$lang['xmlrpcuser'] = 'Estä XML-RPC:n käyttö pilkulla erotetun listan ryhmille tai käyttäjille. Jätä tyhjäksi salliaksesi käyttö kaikille.'; $lang['updatecheck'] = 'Tarkista päivityksiä ja turvavaroituksia? Tätä varten DokuWikin pitää ottaa yhteys update.dokuwiki.orgiin.'; $lang['userewrite'] = 'Käytä siivottuja URLeja'; $lang['useslash'] = 'Käytä kauttaviivaa nimiavaruuksien erottimena URL-osoitteissa'; diff --git a/lib/plugins/config/lang/fr/lang.php b/lib/plugins/config/lang/fr/lang.php index 8f669a629..42a7f8d07 100644 --- a/lib/plugins/config/lang/fr/lang.php +++ b/lib/plugins/config/lang/fr/lang.php @@ -96,8 +96,6 @@ $lang['disableactions_other'] = 'Autres actions (séparées par des virgules)'; $lang['sneaky_index'] = 'Par défaut, DokuWiki affichera toutes les catégories dans la vue par index. Activer cette option permet de cacher celles pour lesquelles l\'utilisateur n\'a pas la permission de lecture. Il peut en résulter le masquage de sous-catégories accessibles. Ceci peut rendre l\'index inutilisable avec certaines ACL.'; $lang['auth_security_timeout'] = 'Délai d\'expiration de sécurité (secondes)'; $lang['securecookie'] = 'Les cookies mis via HTTPS doivent-ils n\'être envoyé par le navigateur que via HTTPS ? Ne désactivez cette option que si la connexion à votre wiki est sécurisée avec SSL mais que la navigation sur le wiki n\'est pas sécurisée.'; -$lang['xmlrpc'] = 'Activer l\'interface XML-RPC.'; -$lang['xmlrpcuser'] = 'Restreindre l\'accès à XML-RPC aux groupes et utilisateurs indiqués ici. Laisser vide afin que tout le monde y ait accès.'; $lang['updatecheck'] = 'Vérifier les mises à jour ? DokuWiki doit pouvoir contacter update.dokuwiki.org.'; $lang['userewrite'] = 'URL esthétiques'; $lang['useslash'] = 'Utiliser « / » comme séparateur de catégorie dans les URL'; diff --git a/lib/plugins/config/lang/gl/lang.php b/lib/plugins/config/lang/gl/lang.php index 07d62b7af..861336371 100644 --- a/lib/plugins/config/lang/gl/lang.php +++ b/lib/plugins/config/lang/gl/lang.php @@ -84,8 +84,6 @@ $lang['disableactions_other'] = 'Outras accións (separadas por comas)'; $lang['sneaky_index'] = 'O DokuWiki amosará por defecto todos os nomes de espazo na vista de índice. Se activas isto agocharanse aqueles onde o usuario non teña permisos de lectura.'; $lang['auth_security_timeout'] = 'Tempo Límite de Seguridade de Autenticación (segundos)'; $lang['securecookie'] = 'Deben enviarse só vía HTTPS polo navegador as cookies configuradas vía HTTPS? Desactiva esta opción cando só o inicio de sesión do teu wiki estea asegurado con SSL pero a navegación do mesmo se faga de xeito inseguro.'; -$lang['xmlrpc'] = 'Activar/Desactivar interface XML-RPC'; -$lang['xmlrpcuser'] = 'Restrinxir o acceso mediante XML-RPC á lista separada por comas dos grupos e/ou usuarios proporcionados aquí. Déixao baleiro para darlle acceso a todas as persoas.'; $lang['updatecheck'] = 'Comprobar se hai actualizacións e avisos de seguridade? O DokuWiki precisa contactar con update.dokuwiki.org para executar esta característica.'; $lang['userewrite'] = 'Utilizar URLs amigábeis'; $lang['useslash'] = 'Utilizar a barra inclinada (/) como separador de nome de espazo nos URLs'; diff --git a/lib/plugins/config/lang/he/lang.php b/lib/plugins/config/lang/he/lang.php index e80a1bd7a..b200082c9 100644 --- a/lib/plugins/config/lang/he/lang.php +++ b/lib/plugins/config/lang/he/lang.php @@ -82,7 +82,6 @@ $lang['disableactions_wikicode'] = 'הצגת המקור/יצוא גולמי'; $lang['disableactions_other'] = 'פעולות אחרות (מופרדות בפסיק)'; $lang['sneaky_index'] = 'כברירת מחדל, דוקוויקי יציג את כל מרחבי השמות בתצוגת תוכן הענינים. בחירה באפשרות זאת תסתיר את אלו שבהם למשתמש אין הרשאות קריאה. התוצאה עלולה להיות הסתרת תת מרחבי שמות אליהם יש למשתמש גישה. באופן זה תוכן הענינים עלול להפוך לחסר תועלת עם הגדרות ACL מסוימות'; $lang['auth_security_timeout'] = 'מגבלת אבטח פסק הזמן להזדהות (שניות)'; -$lang['xmlrpc'] = 'לאפשר.לחסום את מנשק XML-RPC'; $lang['updatecheck'] = 'בדיקת עידכוני אבטחה והתראות? על DokuWiki להתקשר אל update.dokuwiki.org לצורך כך.'; $lang['userewrite'] = 'השתמש בכתובות URL יפות'; $lang['useslash'] = 'השתמש בלוכסן להגדרת מרחבי שמות בכתובות'; diff --git a/lib/plugins/config/lang/hu/lang.php b/lib/plugins/config/lang/hu/lang.php index f991b7c95..a1de94160 100644 --- a/lib/plugins/config/lang/hu/lang.php +++ b/lib/plugins/config/lang/hu/lang.php @@ -89,8 +89,6 @@ $lang['disableactions_other'] = 'Egyéb tevékenységek (vesszővel elválasztv $lang['sneaky_index'] = 'Alapértelmezetten minden névtér látszik a DokuWiki áttekintő (index) oldalán. Ezen opció bekapcsolása után azok nem jelennek meg, melyekhez a felhasználónak nincs olvasás joga. De ezzel eltakarhatunk egyébként elérhető al-névtereket is, így bizonyos ACL beállításoknál használhatatlan indexet eredményez ez a beállítás.'; $lang['auth_security_timeout'] = 'Authentikációs biztonsági időablak (másodperc)'; $lang['securecookie'] = 'A böngészők a HTTPS felett beállított sütijüket csak HTTPS felett küldhetik? Kapcsoljuk ki ezt az opciót, ha csak a bejelentkezést védjük SSL-lel, a wiki tartalmának böngészése nyílt forgalommal történik.'; -$lang['xmlrpc'] = 'XML-RPC interfész engedélyezése/tiltása'; -$lang['xmlrpcuser'] = 'Korlátozza XML-RPC hozzáférést az itt megadott vesszővel elválasztott csoportok vagy felhasználók számára. Hagyja üresen, ha mindenki számára biztosítja a hozzáférést.'; $lang['updatecheck'] = 'Frissítések és biztonsági figyelmeztetések figyelése. Ehhez a DokuWikinek kapcsolatba kell lépnie a update.dokuwiki.org-gal.'; $lang['userewrite'] = 'Szép URL-ek használata'; $lang['useslash'] = 'Per-jel használata névtér-elválasztóként az URL-ekben'; diff --git a/lib/plugins/config/lang/ia/lang.php b/lib/plugins/config/lang/ia/lang.php index 689869b89..fdb9d954e 100644 --- a/lib/plugins/config/lang/ia/lang.php +++ b/lib/plugins/config/lang/ia/lang.php @@ -83,8 +83,6 @@ $lang['disableactions_other'] = 'Altere actiones (separate per commas)'; $lang['sneaky_index'] = 'Normalmente, DokuWiki monstra tote le spatios de nomines in le vista del indice. Si iste option es active, illos ubi le usator non ha le permission de lectura essera celate. Isto pote resultar in le celamento de subspatios de nomines accessibile. Isto pote render le indice inusabile con certe configurationes de ACL.'; $lang['auth_security_timeout'] = 'Expiration pro securitate de authentication (secundas)'; $lang['securecookie'] = 'Debe le cookies definite via HTTPS solmente esser inviate via HTTPS per le navigator? Disactiva iste option si solmente le apertura de sessiones a tu wiki es protegite con SSL ma le navigation del wiki es facite sin securitate.'; -$lang['xmlrpc'] = 'Activar/disactivar interfacie XML-RPC.'; -$lang['xmlrpcuser'] = 'Limitar le accesso a XML-RPC al gruppos o usatores date hic, separate per commas. Lassa isto vacue pro dar accesso a omnes.'; $lang['updatecheck'] = 'Verificar si existe actualisationes e advertimentos de securitate? DokuWiki debe contactar update.dokuwiki.org pro exequer iste function.'; $lang['userewrite'] = 'Usar URLs nette'; $lang['useslash'] = 'Usar le barra oblique ("/") como separator de spatios de nomines in URLs'; diff --git a/lib/plugins/config/lang/id-ni/lang.php b/lib/plugins/config/lang/id-ni/lang.php index edde733fb..7b7e14ce5 100644 --- a/lib/plugins/config/lang/id-ni/lang.php +++ b/lib/plugins/config/lang/id-ni/lang.php @@ -5,7 +5,6 @@ * @author Harefa * @author Yustinus Waruwu */ -$lang['xmlrpc'] = 'Orifi/böi\'orifi XML-RPC interface.'; $lang['renderer_xhtml'] = 'Fake Renderer ba zito\'ölö (XHTML) Wiki-output.'; $lang['renderer__core'] = '%s (dokuwiki core)'; $lang['renderer__plugin'] = '%s (plugin)'; diff --git a/lib/plugins/config/lang/it/lang.php b/lib/plugins/config/lang/it/lang.php index c4dd433ed..9c348dcee 100644 --- a/lib/plugins/config/lang/it/lang.php +++ b/lib/plugins/config/lang/it/lang.php @@ -94,8 +94,6 @@ $lang['disableactions_other'] = 'Altre azioni (separate da virgola)'; $lang['sneaky_index'] = 'Normalmente, DokuWiki mostra tutte le categorie nella vista indice. Abilitando questa opzione, saranno nascoste quelle per cui l\'utente non ha il permesso in lettura. Questo potrebbe far sì che alcune sottocategorie accessibili siano nascoste. La pagina indice potrebbe quindi diventare inutilizzabile con alcune configurazioni dell\'ACL.'; $lang['auth_security_timeout'] = 'Tempo di sicurezza per l\'autenticazione (secondi)'; $lang['securecookie'] = 'Devono i cookies impostati tramite HTTPS essere inviati al browser solo tramite HTTPS? Disattiva questa opzione solo quando l\'accesso al tuo wiki viene effettuato con il protocollo SSL ma la navigazione del wiki non risulta sicura.'; -$lang['xmlrpc'] = 'Abilita/disabilita interfaccia XML-RPC.'; -$lang['xmlrpcuser'] = 'Limita l\'accesso XML-RPC ai gruppi o utenti indicati qui (separati da virgola). Lascia il campo vuoto per dare accesso a tutti.'; $lang['updatecheck'] = 'Controllare aggiornamenti e avvisi di sicurezza? DokuWiki deve contattare update.dokuwiki.org per questa funzione.'; $lang['userewrite'] = 'Usa il rewrite delle URL'; $lang['useslash'] = 'Usa la barra rovescia (slash) come separatore nelle URL'; diff --git a/lib/plugins/config/lang/ja/lang.php b/lib/plugins/config/lang/ja/lang.php index 19f10af48..61161290d 100644 --- a/lib/plugins/config/lang/ja/lang.php +++ b/lib/plugins/config/lang/ja/lang.php @@ -89,8 +89,6 @@ $lang['disableactions_other'] = 'その他の動作(カンマ区切り)'; $lang['sneaky_index'] = 'デフォルトでは索引にすべての名前空間を表示しますが、この機能はユーザーに閲覧権限のない名前空間を非表示にします。ただし、閲覧が可能な副名前空間まで表示されなくなるため、ACLの設定が適正でない場合は索引機能が使えなくなる場合があります。'; $lang['auth_security_timeout'] = '認証タイムアウト設定(秒)'; $lang['securecookie'] = 'クッキーをHTTPSにてセットする場合は、ブラウザよりHTTPS経由で送信された場合にみに制限しますか?ログインのみをSSLで行う場合は、この機能を無効にしてください。'; -$lang['xmlrpc'] = 'XML-RPCインターフェースを有効/無効にする'; -$lang['xmlrpcuser'] = 'XML-RPCアクセスを指定グループとユーザーに制限します(半角コンマ区切り)。 すべての人にアクセスを許可する場合は空のままにしてください。'; $lang['updatecheck'] = 'DokuWikiの更新とセキュリティに関する情報をチェックしますか? この機能は update.dokuwiki.org への接続が必要です。'; $lang['userewrite'] = 'URLの書き換え'; $lang['useslash'] = 'URL上の名前空間の区切りにスラッシュを使用'; diff --git a/lib/plugins/config/lang/ko/lang.php b/lib/plugins/config/lang/ko/lang.php index 20cfcdcfe..1c929c25c 100644 --- a/lib/plugins/config/lang/ko/lang.php +++ b/lib/plugins/config/lang/ko/lang.php @@ -90,8 +90,6 @@ $lang['sneaky_index'] = '기본적으로, DokuWiki는 색인 목록에 특정 ACL 설정은 색인 사용이 불가능하게 할 수도 있습니다.'; $lang['auth_security_timeout'] = '인증 보안 초과 시간(초)'; $lang['securecookie'] = 'HTTPS로 보내진 쿠키는 HTTPS에만 적용 할까요? 위키의 로그인 페이지만 SSL로 암호화 하고 위키 페이지는 그렇지 않은경우 꺼야 합니다.'; -$lang['xmlrpc'] = 'XML-RPC 인터페이스 지원/무시'; -$lang['xmlrpcuser'] = '주어진 그룹이나 유저들에게만 XML-RPC접근을 허락하려면 컴마로 구분하여 적으세요. 비어두면 모두에게 허용됩니다.'; $lang['updatecheck'] = '업데이트와 보안 문제를 검사(DokuWiki를 update.dokuwiki.org에 연결해야 합니다.)'; $lang['userewrite'] = 'URL rewriting기능 사용'; $lang['useslash'] = 'URL에서 네임스페이스 구분자로 슬래쉬 문자 사용'; diff --git a/lib/plugins/config/lang/la/lang.php b/lib/plugins/config/lang/la/lang.php index 07d92ae36..057e69974 100644 --- a/lib/plugins/config/lang/la/lang.php +++ b/lib/plugins/config/lang/la/lang.php @@ -82,8 +82,6 @@ $lang['disableactions_other'] = 'Aliae actiones (uirgulis diuisae)'; $lang['sneaky_index'] = 'Hic uicis omnia genera in indice inserit. Si ineptam hanc optionem facias, solum ea, quae Sodales uidere possunt, in indice erunt. Hoc suggreges et suggenera abscondere potest.'; $lang['auth_security_timeout'] = 'Confirmationis Tempus (secundis)'; $lang['securecookie'] = 'Formulae HTTPS mittine solum per HTTPS possunt? Ineptam hanc optio facias, si accessus uicis tutus est, sed interretis non.'; -$lang['xmlrpc'] = 'Aptam\Ineptam XML-RPC administrationem facere'; -$lang['xmlrpcuser'] = 'Accessus XML-RPC gregibus uel Sodalibus in hoc indice astringere. Nihil scribere ut omnes accessum habeant'; $lang['updatecheck'] = 'Nouationes et fiducias inspicerene? Hic uicis connectere update.dokuwiki.org debes.'; $lang['userewrite'] = 'VRL formosis uti'; $lang['useslash'] = 'Repagula in URL, ut genera diuidas, uti'; diff --git a/lib/plugins/config/lang/lv/lang.php b/lib/plugins/config/lang/lv/lang.php index 2f5883269..f95697c46 100644 --- a/lib/plugins/config/lang/lv/lang.php +++ b/lib/plugins/config/lang/lv/lang.php @@ -84,8 +84,6 @@ $lang['disableactions_other'] = 'citas darbības (atdalīt ar komatiem)'; $lang['sneaky_index'] = 'Pēc noklusētā DokuWiki lapu sarakstā parāda visu nodaļu lapas. Ieslēdzot šo parametru, noslēps tās nodaļas, kuras apmeklētājam nav tiesības lasīt. Bet tad tiks arī paslēptas dziļākas, bet atļautas nodaļas. Atsevišķos pieejas tiesību konfigurācijas gadījumos lapu saraksts var nedarboties.'; $lang['auth_security_timeout'] = 'Autorizācijas drošības intervāls (sekundēs)'; $lang['securecookie'] = 'Vai pa HTTPS sūtāmās sīkdatnes sūtīt tikai pa HTTPS? Atslēdz šo iespēju, kad tikai pieteikšanās wiki sistēmā notiek pa SSL šifrētu savienojumu, bet skatīšana - pa nešifrētu.'; -$lang['xmlrpc'] = 'Ieslēgt/izslēgt XML-RPC interfeisu.'; -$lang['xmlrpcuser'] = 'Ierobežot XML-RPC piekļuvi norādītām lietotāju grupām vai lietotājiem (atdalīt ar komatiem!). Atstāt tukšu, lai piekļuve būtu visiem.'; $lang['updatecheck'] = 'Pārbaudīt, vai pieejami atjauninājumi un drošības brīdinājumi? Dokuwiki sazināsies ar update.dokuwiki.org'; $lang['userewrite'] = 'Ērti lasāmas adreses (URL)'; $lang['useslash'] = 'Lietot slīpiņu par URL atdalītāju'; diff --git a/lib/plugins/config/lang/mr/lang.php b/lib/plugins/config/lang/mr/lang.php index 321e05546..4f33bfa7c 100644 --- a/lib/plugins/config/lang/mr/lang.php +++ b/lib/plugins/config/lang/mr/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'इतर क्रिया ( स्वल् $lang['sneaky_index'] = 'सूची दृश्यामधे डिफॉल्ट स्वरूपात डॉक्युविकी सगळे नेमस्पेस दाखवते. हा पर्याय चालू केल्यास सदस्याला वाचण्याची परवानगी नसलेले नेमस्पेस दिसणार नाहीत. यामुळे परवानगी असलेले उप - नेमस्पेस न दिसण्याची शक्यता आहे. यामुळे काही विशिष्ठ ACL सेटिंगसाठी सूची वापरता येण्यासारखी राहणार नाही.'; $lang['auth_security_timeout'] = 'अधिकृत करण्याच्या प्रक्रियेची कालमर्यादा'; $lang['securecookie'] = 'HTTPS वापरून सेट केलेले कूकीज ब्राउजरने HTTPS द्वाराच पाठवले पाहिजेत का? जर तुमच्या विकीचं फ़क्त लॉगिन पानच SSL वापरून सुरक्षित केलं असेल व पानांचं ब्राउजिंग असुरक्षित असेल तर हा पर्याय चालू करू नका.'; -$lang['xmlrpc'] = 'XML-RPC इंटरफेस चालू/बंद करा'; -$lang['xmlrpcuser'] = 'XML-RPC सुविधा फ़क्त इथे स्वल्पविरामाने अलग करून दिलेल्या गट किंवा वापरकर्त्याला उपलब्ध आहेत. सर्वाना ही सुविधा देण्यासाठी ही जागा रिकामी सोडा.'; $lang['updatecheck'] = 'अपडेट आणि सुरक्षिततेविशयी सूचनान्वर पाळत ठेऊ का? या सुविधेसाठी डॉक्युविकीला update.dokuwiki.org शी संपर्क साधावा लागेल.'; $lang['userewrite'] = 'छान छान URL वापर'; $lang['useslash'] = 'URL मधे नेमस्पेस अलग करण्यासाठी \'/\' चिह्न वापरा'; diff --git a/lib/plugins/config/lang/nl/lang.php b/lib/plugins/config/lang/nl/lang.php index f6574ee2c..6bde9eb4e 100644 --- a/lib/plugins/config/lang/nl/lang.php +++ b/lib/plugins/config/lang/nl/lang.php @@ -94,8 +94,6 @@ $lang['disableactions_other'] = 'Andere akties (gescheiden door komma\'s)'; $lang['sneaky_index'] = 'Met de standaardinstellingen zal DokuWiki alle namespaces laten zien in de index. Het inschakelen van deze optie zorgt ervoor dat de namespaces waar de gebruiker geen leestoegang tot heeft, verborgen worden. Dit kan resulteren in het verbergen van subnamespaces waar de gebruiker wel toegang to heeft. Dit kan de index onbruikbaar maken met bepaalde ACL-instellingen.'; $lang['auth_security_timeout'] = 'Authenticatiebeveiligings-timeout (seconden)'; $lang['securecookie'] = 'Moeten cookies die via HTTPS gezet zijn alleen via HTTPS verzonden worden door de browser? Zet deze optie uit als alleen het inloggen op de wiki beveiligd is, maar het gebruik verder niet.'; -$lang['xmlrpc'] = 'Inschakelen/uitschakelen XML-RPC interface.'; -$lang['xmlrpcuser'] = 'Beperk XML-RPC toegang tot de lijst met kommagescheiden groepen of gebruikers die hier zijn opgegeven. Laat leeg om iedereen toegang te geven.'; $lang['updatecheck'] = 'Controleer op nieuwe versies en beveiligingswaarschuwingen? DokuWiki moet hiervoor contact opnemen met update.dokuwiki.org.'; $lang['userewrite'] = 'Gebruik nette URL\'s'; $lang['useslash'] = 'Gebruik slash (/) als scheiding tussen namepaces in URL\'s'; diff --git a/lib/plugins/config/lang/no/lang.php b/lib/plugins/config/lang/no/lang.php index 3c4890149..2245a8813 100644 --- a/lib/plugins/config/lang/no/lang.php +++ b/lib/plugins/config/lang/no/lang.php @@ -99,9 +99,6 @@ $lang['disableactions_other'] = 'Andre kommandoer (kommaseparert)'; $lang['sneaky_index'] = 'DokuWiki vil som standard vise alle navnerom i innholdsfortegnelsen. Hvis du skrur på dette alternativet vil brukere bare se de navnerommene der de har lesetilgang. Dette kan føre til at tilgjengelige undernavnerom skjules. Det kan gjøre innholdsfortegnelsen ubrukelig med enkelte ACL-oppsett.'; $lang['auth_security_timeout'] = 'Autentisering utløper etter (sekunder)'; $lang['securecookie'] = 'Skal informasjonskapsler satt via HTTPS kun sendes via HTTPS av nettleseren? Skal ikke velges dersom bare innloggingen til din wiki er sikret med SSL, og annen navigering på wikien er usikret.'; -$lang['xmlrpc'] = 'Slå på/slå av XML-RPC-grensesnitt'; -$lang['xmlrpcuser'] = 'Å tillate XML-RPC-adgang til bestemte grupper eller brukere, sette deres navne (kommaseparert) her. Slik får du tilgang til alle, la feltet tomt. -'; $lang['updatecheck'] = 'Se etter oppdateringer og sikkerhetsadvarsler? Denne funksjonen er avhengig av å kontakte update.dokuwiki.org.'; $lang['userewrite'] = 'Bruk pene URLer'; $lang['useslash'] = 'Bruk / som skilletegn mellom navnerom i URLer'; diff --git a/lib/plugins/config/lang/pl/lang.php b/lib/plugins/config/lang/pl/lang.php index 6e94a2e3d..0e69cc8f1 100644 --- a/lib/plugins/config/lang/pl/lang.php +++ b/lib/plugins/config/lang/pl/lang.php @@ -92,8 +92,6 @@ $lang['disableactions_other'] = 'Inne akcje (oddzielone przecinkiem)'; $lang['sneaky_index'] = 'Domyślnie, Dokuwiki pokazuje wszystkie katalogi w indeksie. Włączenie tej opcji ukryje katalogi, do których użytkownik nie ma praw. Może to spowodować ukrycie podkatalogów, do których użytkownik ma prawa. Ta opcja może spowodować błędne działanie indeksu w połączeniu z pewnymi konfiguracjami praw dostępu.'; $lang['auth_security_timeout'] = 'Czas wygaśnięcia uwierzytelnienia (w sekundach)'; $lang['securecookie'] = 'Czy ciasteczka wysłane do przeglądarki przez HTTPS powinny być przez nią odsyłane też tylko przez HTTPS? Odznacz tę opcję tylko wtedy, gdy logowanie użytkowników jest zabezpieczone SSL, ale przeglądanie stron odbywa się bez zabezpieczenia.'; -$lang['xmlrpc'] = 'Włącz/wyłącz interfejs XML-RPC'; -$lang['xmlrpcuser'] = 'Lista użytkowników i grup, którzy mogą korzystać z protokołu XML-RPC. Nazwy grup i użytkowników rozdziel przecinkami, puste pole oznacza dostęp dla wszystkich.'; $lang['updatecheck'] = 'Sprawdzanie aktualizacji i bezpieczeństwa. DokuWiki będzie kontaktować się z serwerem update.dokuwiki.org.'; $lang['userewrite'] = 'Proste adresy URL'; $lang['useslash'] = 'Używanie ukośnika jako separatora w adresie URL'; diff --git a/lib/plugins/config/lang/pt-br/lang.php b/lib/plugins/config/lang/pt-br/lang.php index 093e60ff8..8c0ef713a 100644 --- a/lib/plugins/config/lang/pt-br/lang.php +++ b/lib/plugins/config/lang/pt-br/lang.php @@ -98,8 +98,6 @@ $lang['disableactions_other'] = 'Outras ações (separadas por vírgula)'; $lang['sneaky_index'] = 'Por padrão, o DokuWiki irá exibir todos os espaços de nomes na visualização do índice. Ao habilitar essa opção, serão escondidos aqueles que o usuário não tiver permissão de leitura. Isso pode resultar na omissão de subespaços de nomes, tornando o índice inútil para certas configurações de ACL.'; $lang['auth_security_timeout'] = 'Tempo limite de segurança para autenticações (seg)'; $lang['securecookie'] = 'Os cookies definidos via HTTPS devem ser enviados para o navegador somente via HTTPS? Desabilite essa opção quando somente a autenticação do seu wiki for realizada de maneira segura via SSL e a navegação, de maneira insegura.'; -$lang['xmlrpc'] = 'Habilitar/desabilitar interface XML-RPC.'; -$lang['xmlrpcuser'] = 'Acesso Restrito ao XML-RPC para grupos separados por virgula ou usuários aqui. Deixe em branco para conveder acesso a todos.'; $lang['updatecheck'] = 'Verificar atualizações e avisos de segurança? O DokuWiki precisa contactar o "splitbrain.org" para efetuar esse recurso.'; $lang['userewrite'] = 'Usar URLs "limpas"'; $lang['useslash'] = 'Usar a barra como separador de espaços de nomes nas URLs'; diff --git a/lib/plugins/config/lang/pt/lang.php b/lib/plugins/config/lang/pt/lang.php index fe05bd281..d0fe0ac0d 100644 --- a/lib/plugins/config/lang/pt/lang.php +++ b/lib/plugins/config/lang/pt/lang.php @@ -87,8 +87,6 @@ $lang['disableactions_other'] = 'Outras acções (separadas por vírgula)'; $lang['sneaky_index'] = 'Por norma, o DokuWiki irá exibir todos os espaços de nomes na visualização do índice. Ao habilitar essa opção, serão escondidos aqueles em que o utilizador não tenha permissão de leitura. Isto pode resultar na omissão de sub-ramos acessíveis, que poderá tornar o índice inútil para certas configurações de ACL.'; $lang['auth_security_timeout'] = 'Tempo limite de segurança para autenticações (seg)'; $lang['securecookie'] = 'Os cookies definidos via HTTPS deverão ser enviados para o navegador somente via HTTPS? Desabilite essa opção quando somente a autenticação do seu wiki for realizada de maneira segura via SSL e a navegação de maneira insegura.'; -$lang['xmlrpc'] = 'Habilitar/desabilitar interface XML-RPC.'; -$lang['xmlrpcuser'] = 'Restringir acesso XML-RPC para os grupos separados por vírgula ou utilizadores inseridos aqui. Deixar vazio para dar acesso a todos.'; $lang['updatecheck'] = 'Verificar por actualizações e avisos de segurança? O DokuWiki precisa contactar o "splitbrain.org" para efectuar esta verificação.'; $lang['userewrite'] = 'Usar URLs SEO'; $lang['useslash'] = 'Usar a barra como separador de espaços de nomes nas URLs'; diff --git a/lib/plugins/config/lang/ro/lang.php b/lib/plugins/config/lang/ro/lang.php index 6b0a0e91a..5b15ec3dc 100644 --- a/lib/plugins/config/lang/ro/lang.php +++ b/lib/plugins/config/lang/ro/lang.php @@ -89,8 +89,6 @@ $lang['disableactions_other'] = 'Alte acţiuni (separate prin virgulă)'; $lang['sneaky_index'] = 'Implicit, DokuWiki va arăta toate numele de spaţii la vizualizarea indexului. Activând această opţiune vor fi ascunse acelea la care utilizatorul nu are drepturi de citire. Aceasta poate determina ascunderea sub-numelor de spaţii accesibile. Aceasta poate face index-ul inutilizabil cu anumite setări ale ACL'; $lang['auth_security_timeout'] = 'Timpul de expirare al Autentificării Securizate (secunde)'; $lang['securecookie'] = 'Cookies-urile setate via HTTPS să fie trimise doar via HTTPS de către browser? Dezactivaţi această opţiune numai când login-ul wiki-ului este securizat cu SSL dar navigarea wiki-ului se realizează nesecurizat.'; -$lang['xmlrpc'] = 'Activează/dezactivează interfaţa XML-RPC'; -$lang['xmlrpcuser'] = 'Restricţionaţi accesul XML-RPC la grupurile sau utilizatorii separaţi prin virgulă daţi aici. Lasaţi gol pentru a da acces tuturor.'; $lang['updatecheck'] = 'Verificare actualizări şi avertismente privind securitatea? DokuWiki trebuie să contacteze update.dokuwiki.org pentru această facilitate.'; $lang['userewrite'] = 'Folosire URL-uri "nice"'; $lang['useslash'] = 'Foloseşte slash-ul ca separator de spaţii de nume în URL-uri'; diff --git a/lib/plugins/config/lang/ru/lang.php b/lib/plugins/config/lang/ru/lang.php index f29257a28..cd93526e0 100644 --- a/lib/plugins/config/lang/ru/lang.php +++ b/lib/plugins/config/lang/ru/lang.php @@ -95,8 +95,6 @@ $lang['disableactions_other'] = 'Другие операции (через за $lang['sneaky_index'] = 'По умолчанию, «ДокуВики» показывает в индексе страниц все пространства имён. Включение этой опции скроет пространства имён, для которых пользователь не имеет прав чтения. Это может привести к скрытию доступных вложенных пространств имён и потере функциональности индекса страниц при некоторых конфигурациях прав доступа.'; $lang['auth_security_timeout'] = 'Интервал для безопасности авторизации (сек.)'; $lang['securecookie'] = 'Должны ли куки (cookies), выставленные через HTTPS, отправляться браузером только через HTTPS. Отключите эту опцию в случае, когда только логин вашей вики передаётся через SSL, а обычный просмотр осуществляется в небезопасном режиме.'; -$lang['xmlrpc'] = 'Включить/выключить XML-RPC интерфейс.'; -$lang['xmlrpcuser'] = 'Запретить XML-RPC-доступ для списка групп и пользователей, перечисленных через запятую. Оставьте пустым, если хотите оставить доступ всем.'; $lang['updatecheck'] = 'Проверять наличие обновлений и предупреждений о безопасности? Для этого «ДокуВики» потребуется связываться с сайтом splitbrain.org.'; $lang['userewrite'] = 'Удобочитаемые адреса (URL)'; $lang['useslash'] = 'Использовать слэш'; diff --git a/lib/plugins/config/lang/sk/lang.php b/lib/plugins/config/lang/sk/lang.php index 72ce10775..d583c5d15 100644 --- a/lib/plugins/config/lang/sk/lang.php +++ b/lib/plugins/config/lang/sk/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'Iné akcie (oddelené čiarkou)'; $lang['sneaky_index'] = 'DokuWiki implicitne ukazuje v indexe všetky menné priestory. Povolením tejto voľby sa nezobrazia menné priestory, ku ktorým nemá používateľ právo na čítanie. Dôsledkom môže byť nezobrazenie vnorených prístupných menných priestorov. Táto voľba môže mať za následok nepoužiteľnosť indexu s určitými ACL nastaveniami.'; $lang['auth_security_timeout'] = 'Časový limit pri prihlasovaní (v sekundách)'; $lang['securecookie'] = 'Mal by prehliadač posielať cookies nastavené cez HTTPS posielať iba cez HTTPS (bezpečné) pripojenie? Vypnite túto voľbu iba v prípade, ak je prihlasovanie do Vašej wiki zabezpečené SSL, ale prezeranie wiki je nezabezpečené.'; -$lang['xmlrpc'] = 'Povoliť/zakázať XML-RPC rozhranie.'; -$lang['xmlrpcuser'] = 'Obmedziť XML-RPC prístup iba pre uvedené skupiny alebo používateľov (oddelených čiarkami).'; $lang['updatecheck'] = 'Kontrolovať aktualizácie a bezpečnostné upozornenia? DokuWiki potrebuje pre túto funkciu prístup k update.dokuwiki.org.'; $lang['userewrite'] = 'Používať nice URLs'; $lang['useslash'] = 'Používať lomku (/) ako oddeľovač v URL'; diff --git a/lib/plugins/config/lang/sl/lang.php b/lib/plugins/config/lang/sl/lang.php index dadd01595..03bae8e37 100644 --- a/lib/plugins/config/lang/sl/lang.php +++ b/lib/plugins/config/lang/sl/lang.php @@ -86,8 +86,6 @@ $lang['disableactions_other'] = 'Druga dejanja (z vejico ločen seznam)'; $lang['sneaky_index'] = 'Privzeto pokaže sistem DokuWiki vse imenske prostore v pogledu kazala. Z omogočanjem te možnosti bodo skriti vsi imenski prostori, v katere prijavljen uporabnik nima dovoljenj dostopa. S tem je mogoče preprečiti dostop do podrejenih strani. Možnost lahko vpliva na uporabnost nastavitev nadzora dostopa ACL.'; $lang['auth_security_timeout'] = 'Varnostna časovna omejitev overitve (v sekundah)'; $lang['securecookie'] = 'Ali naj se piškotki poslani preko varne povezave HTTPS v brskalniku pošiljajo le preko HTTPS? Onemogočanje možnosti je priporočljivo le takrat, ko je prijava varovana s protokolom SSL, brskanje po strani pa ni posebej zavarovano.'; -$lang['xmlrpc'] = 'Omogoči/Onemogoči vmesnik XML-RPC.'; -$lang['xmlrpcuser'] = 'Omejitev dostopa do vmesnika XML-RPC z vejico ločenim seznamom skupin in uporabnikov. Prazno polje pomeni, prost dostop za vse uporabnike.'; $lang['updatecheck'] = 'Ali naj sistem preveri za posodobitve in varnostna opozorila.'; $lang['userewrite'] = 'Uporabi olepšan zapis naslovov URL'; $lang['useslash'] = 'Uporabi poševnico kot ločilnik imenskih prostorov v naslovih URL'; diff --git a/lib/plugins/config/lang/sq/lang.php b/lib/plugins/config/lang/sq/lang.php index adeb2a47d..69e283b11 100644 --- a/lib/plugins/config/lang/sq/lang.php +++ b/lib/plugins/config/lang/sq/lang.php @@ -83,8 +83,6 @@ $lang['disableactions_other'] = 'Veprime të tjera (të ndarë me presje)'; $lang['sneaky_index'] = 'Vetiu DokuWiki tregon të gjithë hapësirat e emrit në shikimin e index-it. Aktivizimi i kësaj alternative do të fshehë ato ku përdoruesi nuk ka të drejta leximi. Kjo mund të përfundojë në fshehje të nënhapësirave të emrit të aksesueshme. Kjo mund ta bëjë index-in të papërdorshëm me disa konfigurime të caktuara të ACL-së.'; $lang['auth_security_timeout'] = 'Koha e Përfundimit për Autentikim (sekonda)'; $lang['securecookie'] = 'A duhet që cookies të vendosura nëpërmjet HTTPS të dërgohen vetëm nëpërmjet HTTPS nga shfletuesit? Caktivizojeni këtë alternativë kur vetëm hyrja në wiki-n tuaj sigurohet me SSL por shfletimi i wiki-t bëhet në mënyrë të pasigurtë.'; -$lang['xmlrpc'] = 'Aktivizo/Caktivizo ndërfaqen XML-RPC'; -$lang['xmlrpcuser'] = 'Kufizo aksesin XML-RPC vetëm tek grupet ose përdoruesit e ndarë me presje të dhënë këtu. Lëre bosh për t\'i dhënë akses të gjithëve.'; $lang['updatecheck'] = 'Kontrollo për përditësime dhe paralajmërime sigurie? DokuWiki duhet të kontaktojë me update.dokuwiki.org për këtë veti.'; $lang['userewrite'] = 'Përdor URL të këndshme.'; $lang['useslash'] = 'Përdor / si ndarës të hapësirave të emrit në URL'; diff --git a/lib/plugins/config/lang/sr/lang.php b/lib/plugins/config/lang/sr/lang.php index 5906dcd7e..c675b84e6 100644 --- a/lib/plugins/config/lang/sr/lang.php +++ b/lib/plugins/config/lang/sr/lang.php @@ -84,8 +84,6 @@ $lang['disableactions_other'] = 'Остале наредбе (раздвоје $lang['sneaky_index'] = 'По инсталацији DokuWiki ће у индексу приказати све именске просторе. Укључивањем ове опције именски простори у којима корисник нема право читања ће бити сакривени. Консеквенца је да ће и доступни подпростори бити сакривени. Ово доводи до неупотребљивости Права приступа у неким поставкама.'; $lang['auth_security_timeout'] = 'Временска пауза у аутентификацији (секунде)'; $lang['securecookie'] = 'Да ли колачићи који су постављени преко ХТТПС треба слати веб читачу само преко ХТТПС? Искључите ову опцију само ако је пријављивање на вики заштићено ССЛом а остали део викија незаштићен.'; -$lang['xmlrpc'] = 'Укључи/искључи ИксМЛ-РПЦ интерфејс'; -$lang['xmlrpcuser'] = 'Ограничи ИксМЛ-РПЦ приступ на наведене групе корисника раздвојене зарезом. Остави празно да би свима дао приступ.'; $lang['updatecheck'] = 'Провера надоградњи и сигурносних упозорења? Dokuwiki мора да контактира update.dokuwiki.org ради добијања информација.'; $lang['userewrite'] = 'Направи леп УРЛ'; $lang['useslash'] = 'Користи косу црту у УРЛу за раздвајање именских простора '; diff --git a/lib/plugins/config/lang/sv/lang.php b/lib/plugins/config/lang/sv/lang.php index dfd93d37d..3d8392840 100644 --- a/lib/plugins/config/lang/sv/lang.php +++ b/lib/plugins/config/lang/sv/lang.php @@ -97,8 +97,6 @@ $lang['disableactions_other'] = 'Andra funktioner (kommaseparerade)'; $lang['sneaky_index'] = 'Som standard visar DokuWiki alla namnrymder på indexsidan. Genom att aktivera det här valet döljer man namnrymder som användaren inte har behörighet att läsa. Det kan leda till att man döljer åtkomliga undernamnrymder, och gör indexet oanvändbart med vissa ACL-inställningar.'; $lang['auth_security_timeout'] = 'Autentisieringssäkerhets timeout (sekunder)'; $lang['securecookie'] = 'Skall cookies som sätts via HTTPS endast skickas via HTTPS från webbläsaren? Avaktivera detta alternativ endast om inloggningen till din wiki är säkrad med SSL men läsning av wikin är osäkrad.'; -$lang['xmlrpc'] = 'Aktivera/avaktivera XML-RPC-gränssnitt'; -$lang['xmlrpcuser'] = 'Begränsa XML-RPC tillträde till komma separerade grupper eller användare som ges här. Lämna tomt för att ge tillgång till alla.'; $lang['updatecheck'] = 'Kontrollera uppdateringar och säkerhetsvarningar? DokuWiki behöver kontakta update.dokuwiki.org för den här funktionen.'; $lang['userewrite'] = 'Använd rena webbadresser'; $lang['useslash'] = 'Använd snedstreck för att separera namnrymder i webbadresser'; diff --git a/lib/plugins/config/lang/th/lang.php b/lib/plugins/config/lang/th/lang.php index ce7c55e91..140a287df 100644 --- a/lib/plugins/config/lang/th/lang.php +++ b/lib/plugins/config/lang/th/lang.php @@ -41,7 +41,6 @@ $lang['defaultgroup'] = 'กลุ่มมาตรฐาน'; $lang['profileconfirm'] = 'ใส่รหัสผ่านเพื่อยืนยันการเปลี่ยนแปลงข้อมูล'; $lang['disableactions_check'] = 'ตรวจสอบ'; $lang['auth_security_timeout'] = 'ระยะเวลาที่จะตัดการเชื่อมต่อแบบการใช้งานด้วยสิทธิ์ผู้ใช้ (วินาที)'; -$lang['xmlrpc'] = 'ใช้งาน/ยกเลิก การเชื่อมต่อแบบ XML-RPC'; $lang['userewrite'] = 'แสดงที่อยู่เว็บ (URL) แบบอ่านเข้าใจง่าย'; $lang['cachetime'] = 'ระยะเวลาสำหรับการเก็บแคช (วินาที)'; $lang['locktime'] = 'ระยะเวลานานสุด ที่จะล็อคไม่ให้แก้ไขไฟล์ (วินาที)'; diff --git a/lib/plugins/config/lang/uk/lang.php b/lib/plugins/config/lang/uk/lang.php index 72d7e12f5..375c5d3bf 100644 --- a/lib/plugins/config/lang/uk/lang.php +++ b/lib/plugins/config/lang/uk/lang.php @@ -91,8 +91,6 @@ $lang['disableactions_other'] = 'Інші дії (розділені комам $lang['sneaky_index'] = 'За замовчуванням, ДокуВікі показує всі простори імен в змісті. Активація цієї опції сховає ті простори, де користувач не має прав на читання. Результатом може бути неможливість доступу до певних відкритих просторів імен. Це зробить неможливим використання змісту при певних конфігураціях.'; $lang['auth_security_timeout'] = 'Таймаут аутентифікації (в секундах)'; $lang['securecookie'] = 'Чи повинен браузер надсилати файли cookies тільки через HTTPS? Вимкніть цей параметр, лише тоді, якщо вхід до Вікі захищено SSL, але перегляд сторінок відбувається у незахищеному режимі.'; -$lang['xmlrpc'] = 'Дозволити/заборонити XML-RPC інтерфейс'; -$lang['xmlrpcuser'] = 'Заборонити XML-RPC доступ до користувачів або груп поданих тут та розділених комою. Залишіть поле незаповненим, щоб дозволити доступ усім.'; $lang['updatecheck'] = 'Перевірити наявність оновлень чи попереджень безпеки? Для цього ДокуВікі необхідно зв\'язатися зі update.dokuwiki.org.'; $lang['userewrite'] = 'Красиві URL'; $lang['useslash'] = 'Слеш, як розділювач просторів імен в URL'; diff --git a/lib/plugins/config/lang/zh-tw/lang.php b/lib/plugins/config/lang/zh-tw/lang.php index 29aeaec3b..2919ec113 100644 --- a/lib/plugins/config/lang/zh-tw/lang.php +++ b/lib/plugins/config/lang/zh-tw/lang.php @@ -89,8 +89,6 @@ $lang['disableactions_other'] = '其他功能 (逗號分隔)'; $lang['sneaky_index'] = '預設情況下,DokuWiki 會在索引頁會顯示所有命名空間。啟用此選項會隱藏用戶沒有閱讀權限的頁面,但也可能將能閱讀的子頁面一併隱藏。在特定 ACL 設定下,這可能導致索引無法使用。'; $lang['auth_security_timeout'] = '安全認證的計時 (秒)'; $lang['securecookie'] = 'HTTPS 頁面設定的 cookie 是否只能由瀏覽器經 HTTPS 傳送?取消此選項後,只有登入維基會被 SSL 保護而瀏覽時不會。'; -$lang['xmlrpc'] = '啟用/停用 XML-RPC 介面'; -$lang['xmlrpcuser'] = 'XML-RPC 存取權限將局限於在此提供的群組或使用者 (逗號分隔)。若要開放權限給所有人請留白。'; $lang['updatecheck'] = '檢查更新與安全性警告?DokuWiki 需要聯繫 update.dokuwiki.org 才能使用此功能。'; $lang['userewrite'] = '使用好看的 URL'; $lang['useslash'] = '在 URL 中使用斜線作為命名空間的分隔字元'; diff --git a/lib/plugins/config/lang/zh/lang.php b/lib/plugins/config/lang/zh/lang.php index 7a7f0f504..fa51cb1ef 100644 --- a/lib/plugins/config/lang/zh/lang.php +++ b/lib/plugins/config/lang/zh/lang.php @@ -96,8 +96,6 @@ $lang['disableactions_other'] = '其他功能(用英文逗号分隔)'; $lang['sneaky_index'] = '默认情况下,DokuWiki 在索引页会显示所有 namespace。启用该选项能隐藏那些用户没有权限阅读的页面。但也可能将用户能够阅读的子页面一并隐藏。这有可能导致在特定 ACL 设置下,索引功能不可用。'; $lang['auth_security_timeout'] = '认证安全超时(秒)'; $lang['securecookie'] = '要让浏览器须以HTTPS方式传送在HTTPS会话中设置的cookies吗?请只在登录过程为SSL加密而浏览维基为明文的情况下打开此选项。'; -$lang['xmlrpc'] = '启用/禁用 XML-RPC 交互界面。'; -$lang['xmlrpcuser'] = '将 XML-RPC 连接限制在用逗号分隔的组或用户中。留空对所有人开启连接权限。'; $lang['updatecheck'] = '自动检查更新并接收安全警告吗?开启该功能后 DokuWiki 将自动访问 splitbrain.org。'; $lang['userewrite'] = '使用更整洁的 URL'; $lang['useslash'] = '在 URL 中使用斜杠作为命名空间的分隔符'; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 5f2c32ea7..b95c8d75c 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -136,8 +136,8 @@ $meta['disableactions'] = array('disableactions', $meta['sneaky_index'] = array('onoff'); $meta['auth_security_timeout'] = array('numeric'); $meta['securecookie'] = array('onoff'); -$meta['xmlrpc'] = array('onoff'); -$meta['xmlrpcuser'] = array('string'); +$meta['remote'] = array('onoff'); +$meta['remoteuser'] = array('string'); $meta['_anti_spam'] = array('fieldset'); $meta['usewordblock']= array('onoff'); -- cgit v1.2.3 From a317247b19c498f4292480110cf0e0a1ce9780e8 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 14:54:53 +0100 Subject: updated remote hasAccess function --- _test/cases/inc/remote.test.php | 46 +++++++++++++++++++++++++++++++++++++++-- inc/remote.php | 13 +++++++++--- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index 23186344b..b6a683f45 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -99,12 +99,15 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { class remote_test extends UnitTestCase { var $originalConf; + var $userinfo; var $remote; function setUp() { global $plugin_controller; global $conf; + global $USERINFO; + parent::setUp(); $pluginManager = new MockDoku_Plugin_Controller(); $pluginManager->setReturnValue('getList', array('testplugin')); @@ -112,13 +115,19 @@ class remote_test extends UnitTestCase { $plugin_controller = $pluginManager; $this->originalConf = $conf; + $conf['remote'] = 1; + $conf['useacl'] = 0; + $this->userinfo = $USERINFO; $this->remote = new RemoteAPI(); } function tearDown() { global $conf; + global $USERINFO; $conf = $this->originalConf; + $USERINFO = $this->userinfo; + } function test_pluginMethods() { @@ -131,8 +140,6 @@ class remote_test extends UnitTestCase { } function test_hasAccessSuccess() { - global $conf; - $conf['remote'] = 1; $this->assertTrue($this->remote->hasAccess()); } @@ -142,6 +149,41 @@ class remote_test extends UnitTestCase { $this->assertFalse($this->remote->hasAccess()); } + function test_hasAccessFailAcl() { + global $conf; + $conf['useacl'] = 1; + $this->assertFalse($this->remote->hasAccess()); + } + + function test_hasAccessSuccessAclEmptyRemoteUser() { + global $conf; + $conf['useacl'] = 1; + $conf['remoteuser'] = ''; + + $this->assertTrue($this->remote->hasAccess()); + } + + function test_hasAccessSuccessAcl() { + global $conf; + global $USERINFO; + $conf['useacl'] = 1; + $conf['remoteuser'] = '@grp,@grp2'; + $USERINFO['grps'] = array('grp'); + + $this->assertTrue($this->remote->hasAccess()); + } + + function test_hasAccessFailAcl2() { + global $conf; + global $USERINFO; + $conf['useacl'] = 1; + $conf['remoteuser'] = '@grp'; + $USERINFO['grps'] = array('grp1'); + + $this->assertFalse($this->remote->hasAccess()); + } + + function test_forceAccessSuccess() { global $conf; $conf['remote'] = 1; diff --git a/inc/remote.php b/inc/remote.php index e18c71092..94d428e8c 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -71,7 +71,6 @@ class RemoteAPI { * @return array with information to all available methods */ public function getMethods() { - $this->forceAccess(); return array_merge($this->getCoreMethods(), $this->getPluginMethods()); } @@ -122,10 +121,18 @@ class RemoteAPI { */ public function hasAccess() { global $conf; - if (!isset($conf['remote'])) { + global $USERINFO; + if (!$conf['remote']) { return false; } - return $conf['remote']; + if(!$conf['useacl']) { + return true; + } + if(trim($conf['remoteuser']) == '') { + return true; + } + + return auth_isMember($conf['remoteuser'], $_SERVER['REMOTE_USER'], (array) $USERINFO['grps']); } /** -- cgit v1.2.3 From 4beb39ea51a46409ab3abd4a1b880bf5d3d5dc4a Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 15:31:46 +0100 Subject: enforce acl on remote method call --- _test/cases/inc/remote.test.php | 52 +++++++++++++++++++++++++++++++++++++++-- inc/remote.php | 15 ++++++++++-- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index b6a683f45..07ca9d0e8 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -54,7 +54,13 @@ class RemoteAPICoreTest { 'return' => 'string', 'doc' => 'Test method', 'name' => 'twoArgWithDefaultArg', - ), + ), 'wiki.publicCall' => array( + 'args' => array(), + 'return' => 'boolean', + 'doc' => 'testing for public access', + 'name' => 'publicCall', + 'public' => 1 + ) ); } function stringTestMethod() { return 'success'; } @@ -66,6 +72,7 @@ class RemoteAPICoreTest { function oneStringArgMethod($arg) {return $arg; } function twoArgMethod($string, $int) { return array($string, $int); } function twoArgWithDefaultArg($string1, $string2 = 'default') { return array($string1, $string2); } + function publicCall() {return true;} } @@ -86,6 +93,12 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { 'args' => array('string', 'int', 'bool'), 'return' => 'array', 'name' => 'method2', + ), 'publicCall' => array( + 'args' => array(), + 'return' => 'boolean', + 'doc' => 'testing for public access', + 'name' => 'publicCall', + 'public' => 1 ) ); } @@ -93,6 +106,8 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { function method1() { return null; } function methodString() { return 'success'; } function method2($str, $int, $bool = false) { return array($str, $int, $bool); } + function publicCall() {return true;} + } @@ -134,7 +149,7 @@ class remote_test extends UnitTestCase { $methods = $this->remote->getPluginMethods(); $actual = array_keys($methods); sort($actual); - $expect = array('plugin.testplugin.method1', 'plugin.testplugin.method2', 'plugin.testplugin.methodString', 'plugin.testplugin.method2ext'); + $expect = array('plugin.testplugin.method1', 'plugin.testplugin.method2', 'plugin.testplugin.methodString', 'plugin.testplugin.method2ext', 'plugin.testplugin.publicCall'); sort($expect); $this->assertEqual($expect,$actual); } @@ -253,4 +268,37 @@ class remote_test extends UnitTestCase { $this->expectException('RemoteException'); $remoteApi->call('dose not exist'); } + + function test_publicCallCore() { + global $conf; + $conf['useacl'] = 1; + $remoteApi = new RemoteApi(); + $remoteApi->getCoreMethods(new RemoteAPICoreTest()); + $this->assertTrue($remoteApi->call('wiki.publicCall')); + } + + function test_publicCallPlugin() { + global $conf; + $conf['useacl'] = 1; + $remoteApi = new RemoteApi(); + $this->assertTrue($remoteApi->call('plugin.testplugin.publicCall')); + } + + function test_publicCallCoreDeny() { + global $conf; + $conf['useacl'] = 1; + $remoteApi = new RemoteApi(); + $remoteApi->getCoreMethods(new RemoteAPICoreTest()); + $this->expectException('RemoteAccessDenied'); + $remoteApi->call('wiki.stringTestMethod'); + } + + function test_publicCallPluginDeny() { + global $conf; + $conf['useacl'] = 1; + $remoteApi = new RemoteApi(); + $this->expectException('RemoteAccessDenied'); + $remoteApi->call('plugin.testplugin.methodString'); + } + } diff --git a/inc/remote.php b/inc/remote.php index 94d428e8c..15d2308f8 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -82,7 +82,6 @@ class RemoteAPI { * @return mixed result of method call, must be a primitive type. */ public function call($method, $args = array()) { - $this->forceAccess(); list($type, $pluginName, $call) = explode('.', $method, 3); if ($type === 'plugin') { $plugin = plugin_load('remote', $pluginName); @@ -90,10 +89,12 @@ class RemoteAPI { if (!$plugin) { throw new RemoteException('Method dose not exists'); } + $this->checkAccess($methods[$method]); $name = $this->getMethodName($methods, $method); return call_user_func_array(array($plugin, $name), $args); } else { $coreMethods = $this->getCoreMethods(); + $this->checkAccess($coreMethods[$method]); if (!isset($coreMethods[$method])) { throw new RemoteException('Method dose not exists'); } @@ -102,6 +103,16 @@ class RemoteAPI { } } + private function checkAccess($methodMeta) { + if (!isset($methodMeta['public'])) { + $this->forceAccess(); + } else{ + if ($methodMeta['public'] == '0') { + $this->forceAccess(); + } + } + } + private function checkArgumentLength($method, $args) { if (count($method['args']) < count($args)) { throw new RemoteException('Method dose not exists - wrong parameter count.'); @@ -141,7 +152,7 @@ class RemoteAPI { */ public function forceAccess() { if (!$this->hasAccess()) { - throw new RemoteException('Access denied'); + throw new RemoteAccessDenied(); } } -- cgit v1.2.3 From 27bf90be7901fc8002eb1f253df9785610d586f1 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 15:56:24 +0100 Subject: set login as public method --- inc/RemoteAPICore.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 106ed598c..023fcb803 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -14,7 +14,8 @@ class RemoteAPICore { 'password' => 'string' ), 'return' => 'int', - 'doc' => 'Tries to login with the given credentials and sets auth cookies.' + 'doc' => 'Tries to login with the given credentials and sets auth cookies.', + 'public' => '1' ), 'dokuwiki.getPagelist' => array( 'args' => array( 'namespace' => 'string', -- cgit v1.2.3 From 3a13cfe7e12afabb47139702b7f118d63ccf42c2 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 18:10:38 +0100 Subject: set login as public method --- inc/remote.php | 1 + lib/exe/xmlrpc.php | 848 +---------------------------------------------------- 2 files changed, 15 insertions(+), 834 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index 15d2308f8..76d07b344 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -1,6 +1,7 @@ public_methods[] = $method; - return parent::addCallback($method, $callback, $args, $help); + function dokuwiki_xmlrpc_server(){ + $this->remote = new RemoteAPI(); + $this->IXR_Server(); } - /** - * Execute a call, extends parent method - * - * Checks for authentication first - */ function call($methodname, $args){ - if(!in_array($methodname,$this->public_methods) && !$this->checkAuth()){ + try { + //print 'a'; + $result = $this->remote->call($methodname, $args); + return $result; + } catch (RemoteAccessDenied $e) { if (!isset($_SERVER['REMOTE_USER'])) { header('HTTP/1.1 401 Unauthorized'); } else { header('HTTP/1.1 403 Forbidden'); } - return new IXR_Error(-32603, 'server error. not authorized to call method "'.$methodname.'".'); + return new IXR_Error(-32603, 'server error. not authorized to call method'); + } catch (RemoteException $e) { + return new IXR_Error($e->getCode(), $e->getMessage()); } - return parent::call($methodname, $args); } - /** - * Constructor. Register methods and run Server - */ - function dokuwiki_xmlrpc_server(){ - $this->remote = new RemoteAPI(); - $this->IXR_IntrospectionServer(); - - /* DokuWiki's own methods */ - $this->addCallback( - 'dokuwiki.getXMLRPCAPIVersion', - 'this:getAPIVersion', - array('integer'), - 'Returns the XMLRPC API version.', - true - ); - - $this->addCallback( - 'dokuwiki.getVersion', - 'getVersion', - array('string'), - 'Returns the running DokuWiki version.', - true - ); - - $this->addCallback( - 'dokuwiki.login', - 'this:login', - array('integer','string','string'), - 'Tries to login with the given credentials and sets auth cookies.', - true - ); - - $this->addCallback( - 'dokuwiki.getPagelist', - 'this:readNamespace', - array('struct','string','struct'), - 'List all pages within the given namespace.' - ); - - $this->addCallback( - 'dokuwiki.search', - 'this:search', - array('struct','string'), - 'Perform a fulltext search and return a list of matching pages' - ); - - $this->addCallback( - 'dokuwiki.getTime', - 'time', - array('int'), - 'Return the current time at the wiki server.' - ); - - $this->addCallback( - 'dokuwiki.setLocks', - 'this:setLocks', - array('struct','struct'), - 'Lock or unlock pages.' - ); - - - $this->addCallback( - 'dokuwiki.getTitle', - 'this:getTitle', - array('string'), - 'Returns the wiki title.', - true - ); - - $this->addCallback( - 'dokuwiki.appendPage', - 'this:appendPage', - array('int', 'string', 'string', 'struct'), - 'Append text to a wiki page.' - ); - - /* Wiki API v2 http://www.jspwiki.org/wiki/WikiRPCInterface2 */ - $this->addCallback( - 'wiki.getRPCVersionSupported', - 'this:wiki_RPCVersion', - array('int'), - 'Returns 2 with the supported RPC API version.', - true - ); - $this->addCallback( - 'wiki.getPage', - 'this:rawPage', - array('string','string'), - 'Get the raw Wiki text of page, latest version.' - ); - $this->addCallback( - 'wiki.getPageVersion', - 'this:rawPage', - array('string','string','int'), - 'Get the raw Wiki text of page.' - ); - $this->addCallback( - 'wiki.getPageHTML', - 'this:htmlPage', - array('string','string'), - 'Return page in rendered HTML, latest version.' - ); - $this->addCallback( - 'wiki.getPageHTMLVersion', - 'this:htmlPage', - array('string','string','int'), - 'Return page in rendered HTML.' - ); - $this->addCallback( - 'wiki.getAllPages', - 'this:listPages', - array('struct'), - 'Returns a list of all pages. The result is an array of utf8 pagenames.' - ); - $this->addCallback( - 'wiki.getAttachments', - 'this:listAttachments', - array('struct', 'string', 'struct'), - 'Returns a list of all media files.' - ); - $this->addCallback( - 'wiki.getBackLinks', - 'this:listBackLinks', - array('struct','string'), - 'Returns the pages that link to this page.' - ); - $this->addCallback( - 'wiki.getPageInfo', - 'this:pageInfo', - array('struct','string'), - 'Returns a struct with infos about the page.' - ); - $this->addCallback( - 'wiki.getPageInfoVersion', - 'this:pageInfo', - array('struct','string','int'), - 'Returns a struct with infos about the page.' - ); - $this->addCallback( - 'wiki.getPageVersions', - 'this:pageVersions', - array('struct','string','int'), - 'Returns the available revisions of the page.' - ); - $this->addCallback( - 'wiki.putPage', - 'this:putPage', - array('int', 'string', 'string', 'struct'), - 'Saves a wiki page.' - ); - $this->addCallback( - 'wiki.listLinks', - 'this:listLinks', - array('struct','string'), - 'Lists all links contained in a wiki page.' - ); - $this->addCallback( - 'wiki.getRecentChanges', - 'this:getRecentChanges', - array('struct','int'), - 'Returns a struct about all recent changes since given timestamp.' - ); - $this->addCallback( - 'wiki.getRecentMediaChanges', - 'this:getRecentMediaChanges', - array('struct','int'), - 'Returns a struct about all recent media changes since given timestamp.' - ); - $this->addCallback( - 'wiki.aclCheck', - 'this:aclCheck', - array('int', 'string'), - 'Returns the permissions of a given wiki page.' - ); - $this->addCallback( - 'wiki.putAttachment', - 'this:putAttachment', - array('struct', 'string', 'base64', 'struct'), - 'Upload a file to the wiki.' - ); - $this->addCallback( - 'wiki.deleteAttachment', - 'this:deleteAttachment', - array('int', 'string'), - 'Delete a file from the wiki.' - ); - $this->addCallback( - 'wiki.getAttachment', - 'this:getAttachment', - array('base64', 'string'), - 'Download a file from the wiki.' - ); - $this->addCallback( - 'wiki.getAttachmentInfo', - 'this:getAttachmentInfo', - array('struct', 'string'), - 'Returns a struct with infos about the attachment.' - ); - - /** - * Trigger XMLRPC_CALLBACK_REGISTER, action plugins can use this event - * to extend the XMLRPC interface and register their own callbacks. - * - * Event data: - * The XMLRPC server object: - * - * $event->data->addCallback() - register a callback, the second - * paramter has to be of the form "plugin::" - * - * $event->data->callbacks - an array which holds all awaylable - * callbacks - */ - trigger_event('XMLRPC_CALLBACK_REGISTER', $this); - - $this->serve(); - } - - /** - * Return a raw wiki page - */ - function rawPage($id,$rev=''){ - try { - return $this->remote->rawPage($id, $rev); - } catch(RemoteAccessDenied $e) { - return new IXR_Error(1, 'You are not allowed to read this page'); - } - } - - /** - * Return a media file encoded in base64 - * - * @author Gina Haeussge - */ - function getAttachment($id){ - try { - try { - return $this->remote->getAttachment($id); - } catch (RemoteAccessDenied $e) { - return new IXR_Error(1, 'You are not allowed to read this file'); - } - } - catch (RemoteException $e) { - return new IXR_Error(1, $e->getMessage()); - } - } - - /** - * Return info about a media file - * - * @author Gina Haeussge - */ - function getAttachmentInfo($id){ - $info = $this->remote->getAttachmentInfo($id); - $info['lastModified'] = new IXR_Date($info['lastModified']); - return $info; - } - - /** - * Return a wiki page rendered to html - */ - function htmlPage($id,$rev=''){ - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); - } - return p_wiki_xhtml($id,$rev,false); - } - - /** - * List all pages - we use the indexer list here - */ - function listPages(){ - $list = array(); - $pages = idx_get_indexer()->getPages(); - $pages = array_filter(array_filter($pages,'isVisiblePage'),'page_exists'); - - foreach(array_keys($pages) as $idx) { - $perm = auth_quickaclcheck($pages[$idx]); - if($perm < AUTH_READ) { - continue; - } - $page = array(); - $page['id'] = trim($pages[$idx]); - $page['perms'] = $perm; - $page['size'] = @filesize(wikiFN($pages[$idx])); - $page['lastModified'] = new IXR_Date(@filemtime(wikiFN($pages[$idx]))); - $list[] = $page; - } - - return $list; - } - - /** - * List all pages in the given namespace (and below) - */ - function readNamespace($ns,$opts){ - global $conf; - - if(!is_array($opts)) $opts=array(); - - $ns = cleanID($ns); - $dir = utf8_encodeFN(str_replace(':', '/', $ns)); - $data = array(); - $opts['skipacl'] = 0; // no ACL skipping for XMLRPC - search($data, $conf['datadir'], 'search_allpages', $opts, $dir); - return $data; - } - - /** - * List all pages in the given namespace (and below) - */ - function search($query){ - require_once(DOKU_INC.'inc/fulltext.php'); - - $regex = ''; - $data = ft_pageSearch($query,$regex); - $pages = array(); - - // prepare additional data - $idx = 0; - foreach($data as $id => $score){ - $file = wikiFN($id); - - if($idx < FT_SNIPPET_NUMBER){ - $snippet = ft_snippet($id,$regex); - $idx++; - }else{ - $snippet = ''; - } - - $pages[] = array( - 'id' => $id, - 'score' => $score, - 'rev' => filemtime($file), - 'mtime' => filemtime($file), - 'size' => filesize($file), - 'snippet' => $snippet, - ); - } - return $pages; - } - - /** - * Returns the wiki title. - */ - function getTitle(){ - global $conf; - return $conf['title']; - } - - /** - * List all media files. - * - * Available options are 'recursive' for also including the subnamespaces - * in the listing, and 'pattern' for filtering the returned files against - * a regular expression matching their name. - * - * @author Gina Haeussge - */ - function listAttachments($ns, $options = array()) { - global $conf; - global $lang; - - $ns = cleanID($ns); - - if (!is_array($options)) $options = array(); - $options['skipacl'] = 0; // no ACL skipping for XMLRPC - - - if(auth_quickaclcheck($ns.':*') >= AUTH_READ) { - $dir = utf8_encodeFN(str_replace(':', '/', $ns)); - - $data = array(); - search($data, $conf['mediadir'], 'search_media', $options, $dir); - $len = count($data); - if(!$len) return array(); - - for($i=0; $i<$len; $i++) { - unset($data[$i]['meta']); - $data[$i]['lastModified'] = new IXR_Date($data[$i]['mtime']); - } - return $data; - } else { - return new IXR_Error(1, 'You are not allowed to list media files.'); - } - } - - /** - * Return a list of backlinks - */ - function listBackLinks($id){ - return ft_backlinks(cleanID($id)); - } - - /** - * Return some basic data about a page - */ - function pageInfo($id,$rev=''){ - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); - } - $file = wikiFN($id,$rev); - $time = @filemtime($file); - if(!$time){ - return new IXR_Error(10, 'The requested page does not exist'); - } - - $info = getRevisionInfo($id, $time, 1024); - - $data = array( - 'name' => $id, - 'lastModified' => new IXR_Date($time), - 'author' => (($info['user']) ? $info['user'] : $info['ip']), - 'version' => $time - ); - - return ($data); - } - - /** - * Save a wiki page - * - * @author Michael Klier - */ - function putPage($id, $text, $params) { - global $TEXT; - global $lang; - global $conf; - - $id = cleanID($id); - $TEXT = cleanText($text); - $sum = $params['sum']; - $minor = $params['minor']; - - if(empty($id)) - return new IXR_Error(1, 'Empty page ID'); - - if(!page_exists($id) && trim($TEXT) == '' ) { - return new IXR_ERROR(1, 'Refusing to write an empty new wiki page'); - } - - if(auth_quickaclcheck($id) < AUTH_EDIT) - return new IXR_Error(1, 'You are not allowed to edit this page'); - - // Check, if page is locked - if(checklock($id)) - return new IXR_Error(1, 'The page is currently locked'); - - // SPAM check - if(checkwordblock()) - return new IXR_Error(1, 'Positive wordblock check'); - - // autoset summary on new pages - if(!page_exists($id) && empty($sum)) { - $sum = $lang['created']; - } - - // autoset summary on deleted pages - if(page_exists($id) && empty($TEXT) && empty($sum)) { - $sum = $lang['deleted']; - } - - lock($id); - - saveWikiText($id,$TEXT,$sum,$minor); - - unlock($id); - - // run the indexer if page wasn't indexed yet - idx_addPage($id); - - return 0; - } - - /** - * Appends text to a wiki page. - */ - function appendPage($id, $text, $params) { - $currentpage = $this->rawPage($id); - if (!is_string($currentpage)) { - return $currentpage; - } - return $this->putPage($id, $currentpage.$text, $params); - } - - /** - * Uploads a file to the wiki. - * - * Michael Klier - */ - function putAttachment($id, $file, $params) { - $id = cleanID($id); - $auth = auth_quickaclcheck(getNS($id).':*'); - - if(!isset($id)) { - return new IXR_ERROR(1, 'Filename not given.'); - } - - global $conf; - - $ftmp = $conf['tmpdir'] . '/' . md5($id.clientIP()); - - // save temporary file - @unlink($ftmp); - if (preg_match('/^[A-Za-z0-9\+\/]*={0,2}$/', $file) === 1) { - // DEPRECATED: Double-decode file if it still looks like base64 - // after first decoding (which is done by the library) - $file = base64_decode($file); - } - io_saveFile($ftmp, $file); - - $res = media_save(array('name' => $ftmp), $id, $params['ow'], $auth, 'rename'); - if (is_array($res)) { - return new IXR_ERROR(-$res[1], $res[0]); - } else { - return $res; - } - } - - /** - * Deletes a file from the wiki. - * - * @author Gina Haeussge - */ - function deleteAttachment($id){ - $id = cleanID($id); - $auth = auth_quickaclcheck(getNS($id).':*'); - $res = media_delete($id, $auth); - if ($res & DOKU_MEDIA_DELETED) { - return 0; - } elseif ($res & DOKU_MEDIA_NOT_AUTH) { - return new IXR_ERROR(1, "You don't have permissions to delete files."); - } elseif ($res & DOKU_MEDIA_INUSE) { - return new IXR_ERROR(1, 'File is still referenced'); - } else { - return new IXR_ERROR(1, 'Could not delete file'); - } - } - - /** - * Returns the permissions of a given wiki page - */ - function aclCheck($id) { - $id = cleanID($id); - return auth_quickaclcheck($id); - } - - /** - * Lists all links contained in a wiki page - * - * @author Michael Klier - */ - function listLinks($id) { - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); - } - $links = array(); - - // resolve page instructions - $ins = p_cached_instructions(wikiFN($id)); - - // instantiate new Renderer - needed for interwiki links - include(DOKU_INC.'inc/parser/xhtml.php'); - $Renderer = new Doku_Renderer_xhtml(); - $Renderer->interwiki = getInterwiki(); - - // parse parse instructions - foreach($ins as $in) { - $link = array(); - switch($in[0]) { - case 'internallink': - $link['type'] = 'local'; - $link['page'] = $in[1][0]; - $link['href'] = wl($in[1][0]); - array_push($links,$link); - break; - case 'externallink': - $link['type'] = 'extern'; - $link['page'] = $in[1][0]; - $link['href'] = $in[1][0]; - array_push($links,$link); - break; - case 'interwikilink': - $url = $Renderer->_resolveInterWiki($in[1][2],$in[1][3]); - $link['type'] = 'extern'; - $link['page'] = $url; - $link['href'] = $url; - array_push($links,$link); - break; - } - } - - return ($links); - } - - /** - * Returns a list of recent changes since give timestamp - * - * @author Michael Hamann - * @author Michael Klier - */ - function getRecentChanges($timestamp) { - if(strlen($timestamp) != 10) - return new IXR_Error(20, 'The provided value is not a valid timestamp'); - - $recents = getRecentsSince($timestamp); - - $changes = array(); - - foreach ($recents as $recent) { - $change = array(); - $change['name'] = $recent['id']; - $change['lastModified'] = new IXR_Date($recent['date']); - $change['author'] = $recent['user']; - $change['version'] = $recent['date']; - $change['perms'] = $recent['perms']; - $change['size'] = @filesize(wikiFN($recent['id'])); - array_push($changes, $change); - } - - if (!empty($changes)) { - return $changes; - } else { - // in case we still have nothing at this point - return new IXR_Error(30, 'There are no changes in the specified timeframe'); - } - } - - /** - * Returns a list of recent media changes since give timestamp - * - * @author Michael Hamann - * @author Michael Klier - */ - function getRecentMediaChanges($timestamp) { - if(strlen($timestamp) != 10) - return new IXR_Error(20, 'The provided value is not a valid timestamp'); - - $recents = getRecentsSince($timestamp, null, '', RECENTS_MEDIA_CHANGES); - - $changes = array(); - - foreach ($recents as $recent) { - $change = array(); - $change['name'] = $recent['id']; - $change['lastModified'] = new IXR_Date($recent['date']); - $change['author'] = $recent['user']; - $change['version'] = $recent['date']; - $change['perms'] = $recent['perms']; - $change['size'] = @filesize(mediaFN($recent['id'])); - array_push($changes, $change); - } - - if (!empty($changes)) { - return $changes; - } else { - // in case we still have nothing at this point - return new IXR_Error(30, 'There are no changes in the specified timeframe'); - } - } - - /** - * Returns a list of available revisions of a given wiki page - * - * @author Michael Klier - */ - function pageVersions($id, $first) { - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_READ){ - return new IXR_Error(1, 'You are not allowed to read this page'); - } - global $conf; - - $versions = array(); - - if(empty($id)) - return new IXR_Error(1, 'Empty page ID'); - - $revisions = getRevisions($id, $first, $conf['recent']+1); - - if(count($revisions)==0 && $first!=0) { - $first=0; - $revisions = getRevisions($id, $first, $conf['recent']+1); - } - - if(count($revisions)>0 && $first==0) { - array_unshift($revisions, ''); // include current revision - array_pop($revisions); // remove extra log entry - } - - $hasNext = false; - if(count($revisions)>$conf['recent']) { - $hasNext = true; - array_pop($revisions); // remove extra log entry - } - - if(!empty($revisions)) { - foreach($revisions as $rev) { - $file = wikiFN($id,$rev); - $time = @filemtime($file); - // we check if the page actually exists, if this is not the - // case this can lead to less pages being returned than - // specified via $conf['recent'] - if($time){ - $info = getRevisionInfo($id, $time, 1024); - if(!empty($info)) { - $data['user'] = $info['user']; - $data['ip'] = $info['ip']; - $data['type'] = $info['type']; - $data['sum'] = $info['sum']; - $data['modified'] = new IXR_Date($info['date']); - $data['version'] = $info['date']; - array_push($versions, $data); - } - } - } - return $versions; - } else { - return array(); - } - } - - /** - * The version of Wiki RPC API supported - */ - function wiki_RPCVersion(){ - return 2; - } - - - /** - * Locks or unlocks a given batch of pages - * - * Give an associative array with two keys: lock and unlock. Both should contain a - * list of pages to lock or unlock - * - * Returns an associative array with the keys locked, lockfail, unlocked and - * unlockfail, each containing lists of pages. - */ - function setLocks($set){ - $locked = array(); - $lockfail = array(); - $unlocked = array(); - $unlockfail = array(); - - foreach((array) $set['lock'] as $id){ - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_EDIT || checklock($id)){ - $lockfail[] = $id; - }else{ - lock($id); - $locked[] = $id; - } - } - - foreach((array) $set['unlock'] as $id){ - $id = cleanID($id); - if(auth_quickaclcheck($id) < AUTH_EDIT || !unlock($id)){ - $unlockfail[] = $id; - }else{ - $unlocked[] = $id; - } - } - - return array( - 'locked' => $locked, - 'lockfail' => $lockfail, - 'unlocked' => $unlocked, - 'unlockfail' => $unlockfail, - ); - } - - function getAPIVersion(){ - return DOKU_XMLRPC_API_VERSION; - } - - function login($user,$pass){ - global $conf; - global $auth; - if(!$conf['useacl']) return 0; - if(!$auth) return 0; - - @session_start(); // reopen session for login - if($auth->canDo('external')){ - $ok = $auth->trustExternal($user,$pass,false); - }else{ - $evdata = array( - 'user' => $user, - 'password' => $pass, - 'sticky' => false, - 'silent' => true, - ); - $ok = trigger_event('AUTH_LOGIN_CHECK', $evdata, 'auth_login_wrapper'); - } - session_write_close(); // we're done with the session - - return $ok; - } - - } $server = new dokuwiki_xmlrpc_server(); -- cgit v1.2.3 From bb680e43a5c33747ab844580e1e80c4fdc2fe580 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 18:14:44 +0100 Subject: added missing getVersion --- inc/RemoteAPICore.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 023fcb803..6b665e083 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -171,6 +171,10 @@ class RemoteAPICore { ); } + function getVersion() { + return getVersion(); + } + /** * Return a raw wiki page * @param string $id wiki page id -- cgit v1.2.3 From cb0d045e79603fb7f0c6703aaf633c8d0e34c117 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 18:21:48 +0100 Subject: added missing getTime --- inc/RemoteAPICore.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 6b665e083..a19c1b84e 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -175,6 +175,10 @@ class RemoteAPICore { return getVersion(); } + function getTime() { + return time(); + } + /** * Return a raw wiki page * @param string $id wiki page id -- cgit v1.2.3 From 1232df5e9480465ff8b2e24ce5760766b3bd908c Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 18:27:27 +0100 Subject: treat null as empty array --- inc/remote.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inc/remote.php b/inc/remote.php index 76d07b344..c18cb3713 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -83,6 +83,9 @@ class RemoteAPI { * @return mixed result of method call, must be a primitive type. */ public function call($method, $args = array()) { + if ($args === null) { + $args = array(); + } list($type, $pluginName, $call) = explode('.', $method, 3); if ($type === 'plugin') { $plugin = plugin_load('remote', $pluginName); -- cgit v1.2.3 From f95017850a515969190f54df3d57a00449245bb9 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 18:37:59 +0100 Subject: delegate file and date transformation to remote library --- inc/RemoteAPICore.php | 26 ++++++++++++++++---------- inc/remote.php | 33 +++++++++++++++++++++++++++++---- lib/exe/xmlrpc.php | 10 ++++++++++ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index a19c1b84e..639aa4536 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -2,6 +2,12 @@ class RemoteAPICore { + private $api; + + public function __construct(RemoteAPI $api) { + $this->api = $api; + } + function __getRemoteInfo() { return array( 'dokuwiki.getVersion' => array( @@ -217,7 +223,7 @@ class RemoteAPICore { } $data = io_readFile($file, false); - return new RemoteFile($data); + return $this->api->toFile($data); } /** @@ -228,13 +234,13 @@ class RemoteAPICore { function getAttachmentInfo($id){ $id = cleanID($id); $info = array( - 'lastModified' => new RemoteDate(0), + 'lastModified' => $this->api->toDate(0), 'size' => 0, ); $file = mediaFN($id); if ((auth_quickaclcheck(getNS($id).':*') >= AUTH_READ) && file_exists($file)){ - $info['lastModified'] = new RemoteDate(filemtime($file)); + $info['lastModified'] = $this->api->toDate(filemtime($file)); $info['size'] = filesize($file); } @@ -269,7 +275,7 @@ class RemoteAPICore { $page['id'] = trim($pages[$idx]); $page['perms'] = $perm; $page['size'] = @filesize(wikiFN($pages[$idx])); - $page['lastModified'] = new RemoteDate(@filemtime(wikiFN($pages[$idx]))); + $page['lastModified'] = $this->api->toDate(@filemtime(wikiFN($pages[$idx]))); $list[] = $page; } @@ -362,7 +368,7 @@ class RemoteAPICore { for($i=0; $i<$len; $i++) { unset($data[$i]['meta']); - $data[$i]['lastModified'] = new RemoteDate($data[$i]['mtime']); + $data[$i]['lastModified'] = $this->api->toDate($data[$i]['mtime']); } return $data; } else { @@ -395,7 +401,7 @@ class RemoteAPICore { $data = array( 'name' => $id, - 'lastModified' => new RemoteDate($time), + 'lastModified' => $this->api->toDate($time), 'author' => (($info['user']) ? $info['user'] : $info['ip']), 'version' => $time ); @@ -477,7 +483,7 @@ class RemoteAPICore { * * Michael Klier */ - function putAttachment($id, RemoteFile $file, $params) { + function putAttachment($id, $file, $params) { $id = cleanID($id); $auth = auth_quickaclcheck(getNS($id).':*'); @@ -596,7 +602,7 @@ class RemoteAPICore { foreach ($recents as $recent) { $change = array(); $change['name'] = $recent['id']; - $change['lastModified'] = new RemoteDate($recent['date']); + $change['lastModified'] = $this->api->toDate($recent['date']); $change['author'] = $recent['user']; $change['version'] = $recent['date']; $change['perms'] = $recent['perms']; @@ -629,7 +635,7 @@ class RemoteAPICore { foreach ($recents as $recent) { $change = array(); $change['name'] = $recent['id']; - $change['lastModified'] = new RemoteDate($recent['date']); + $change['lastModified'] = $this->api->toDate($recent['date']); $change['author'] = $recent['user']; $change['version'] = $recent['date']; $change['perms'] = $recent['perms']; @@ -693,7 +699,7 @@ class RemoteAPICore { $data['ip'] = $info['ip']; $data['type'] = $info['type']; $data['sum'] = $info['sum']; - $data['modified'] = new RemoteDate($info['date']); + $data['modified'] = $this->api->toDate($info['date']); $data['version'] = $info['date']; array_push($versions, $data); } diff --git a/inc/remote.php b/inc/remote.php index c18cb3713..71ceb97b5 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -18,9 +18,6 @@ abstract class RemoteDataType { } } -class RemoteDate extends RemoteDataType {} -class RemoteFile extends RemoteDataType {} - /** * This class provides information about remote access to the wiki. * @@ -66,6 +63,14 @@ class RemoteAPI { */ private $pluginMethods = null; + private $dateTransformation; + private $fileTransformation; + + public function __construct() { + $this->dateTransformation = array($this, 'dummyTransformation'); + $this->fileTransformation = array($this, 'dummyTransformation'); + } + /** * Get all available methods with remote access. * @@ -191,11 +196,31 @@ class RemoteAPI { public function getCoreMethods($apiCore = null) { if ($this->coreMethods === null) { if ($apiCore === null) { - $this->coreMethods = new RemoteAPICore(); + $this->coreMethods = new RemoteAPICore($this); } else { $this->coreMethods = $apiCore; } } return $this->coreMethods->__getRemoteInfo(); } + + public function toFile($data) { + return call_user_func($this->fileTransformation, $data); + } + + public function toDate($data) { + return call_user_func($this->dateTransformation, $data); + } + + public function dummyTransformation($data) { + return $data; + } + + public function setDateTransformation($dateTransformation) { + $this->dateTransformation = $dateTransformation; + } + + public function setFileTransformation($fileTransformation) { + $this->fileTransformation = $fileTransformation; + } } \ No newline at end of file diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 9888c9a61..44b4ba7a0 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -27,6 +27,8 @@ class dokuwiki_xmlrpc_server extends IXR_Server { */ function dokuwiki_xmlrpc_server(){ $this->remote = new RemoteAPI(); + $this->remote->setDateTransformation(array($this, 'toDate')); + $this->remote->setFileTransformation(array($this, 'toFile')); $this->IXR_Server(); } @@ -47,6 +49,14 @@ class dokuwiki_xmlrpc_server extends IXR_Server { } } + function toDate($data) { + return new IXR_Date($data); + } + + function toFile($data) { + return new IXR_Base64($data); + } + } $server = new dokuwiki_xmlrpc_server(); -- cgit v1.2.3 From 6e8160489a60f00eb756682b574be72693c7878b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 19:29:39 +0100 Subject: adjusted test cases --- _test/cases/inc/remote.test.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index 07ca9d0e8..c4f0cd2c2 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -66,8 +66,8 @@ class RemoteAPICoreTest { function stringTestMethod() { return 'success'; } function intTestMethod() { return 42; } function floatTestMethod() { return 3.14159265; } - function dateTestMethod() { return new RemoteDate(2623452346); } - function fileTestMethod() { return new RemoteFile('file content'); } + function dateTestMethod() { return 2623452346; } + function fileTestMethod() { return 'file content'; } function voidTestMethod() { return null; } function oneStringArgMethod($arg) {return $arg; } function twoArgMethod($string, $int) { return array($string, $int); } @@ -131,6 +131,7 @@ class remote_test extends UnitTestCase { $this->originalConf = $conf; $conf['remote'] = 1; + $conf['remoteuser'] = '!!not set!!'; $conf['useacl'] = 0; $this->userinfo = $USERINFO; @@ -221,8 +222,8 @@ class remote_test extends UnitTestCase { $this->assertEqual($remoteApi->call('wiki.stringTestMethod'), 'success'); $this->assertEqual($remoteApi->call('wiki.intTestMethod'), 42); $this->assertEqual($remoteApi->call('wiki.floatTestMethod'), 3.14159265); - $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), new RemoteDate(2623452346)); - $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), new RemoteFile('file content')); + $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), 2623452346); + $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), 'file content'); $this->assertEqual($remoteApi->call('wiki.voidTestMethod'), null); } -- cgit v1.2.3 From e61127e4af913a252fbe5c8f427501268501895c Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 8 Jan 2012 19:31:10 +0100 Subject: refactored RemoteAccessDenied to RemoteAccessDeniedException --- _test/cases/inc/remote.test.php | 4 ++-- inc/RemoteAPICore.php | 18 +++++++++--------- inc/remote.php | 4 ++-- lib/exe/xmlrpc.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index c4f0cd2c2..f5da3c06d 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -290,7 +290,7 @@ class remote_test extends UnitTestCase { $conf['useacl'] = 1; $remoteApi = new RemoteApi(); $remoteApi->getCoreMethods(new RemoteAPICoreTest()); - $this->expectException('RemoteAccessDenied'); + $this->expectException('RemoteAccessDeniedException'); $remoteApi->call('wiki.stringTestMethod'); } @@ -298,7 +298,7 @@ class remote_test extends UnitTestCase { global $conf; $conf['useacl'] = 1; $remoteApi = new RemoteApi(); - $this->expectException('RemoteAccessDenied'); + $this->expectException('RemoteAccessDeniedException'); $remoteApi->call('plugin.testplugin.methodString'); } diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 639aa4536..2fecc3032 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -194,7 +194,7 @@ class RemoteAPICore { function rawPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } $text = rawWiki($id,$rev); if(!$text) { @@ -214,7 +214,7 @@ class RemoteAPICore { function getAttachment($id){ $id = cleanID($id); if (auth_quickaclcheck(getNS($id).':*') < AUTH_READ) { - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } $file = mediaFN($id); @@ -253,7 +253,7 @@ class RemoteAPICore { function htmlPage($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } return p_wiki_xhtml($id,$rev,false); } @@ -372,7 +372,7 @@ class RemoteAPICore { } return $data; } else { - throw new RemoteAccessDenied(1, 'You are not allowed to list media files.'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to list media files.'); } } @@ -389,7 +389,7 @@ class RemoteAPICore { function pageInfo($id,$rev=''){ $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } $file = wikiFN($id,$rev); $time = @filemtime($file); @@ -432,7 +432,7 @@ class RemoteAPICore { } if(auth_quickaclcheck($id) < AUTH_EDIT) { - throw new RemoteAccessDenied(1, 'You are not allowed to edit this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to edit this page'); } // Check, if page is locked @@ -519,7 +519,7 @@ class RemoteAPICore { if ($res & DOKU_MEDIA_DELETED) { return 0; } elseif ($res & DOKU_MEDIA_NOT_AUTH) { - throw new RemoteAccessDenied(1, "You don't have permissions to delete files."); + throw new RemoteAccessDeniedException(1, "You don't have permissions to delete files."); } elseif ($res & DOKU_MEDIA_INUSE) { throw new RemoteException(1, 'File is still referenced'); } else { @@ -543,7 +543,7 @@ class RemoteAPICore { function listLinks($id) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ){ - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } $links = array(); @@ -659,7 +659,7 @@ class RemoteAPICore { function pageVersions($id, $first) { $id = cleanID($id); if(auth_quickaclcheck($id) < AUTH_READ) { - throw new RemoteAccessDenied(1, 'You are not allowed to read this page'); + throw new RemoteAccessDeniedException(1, 'You are not allowed to read this page'); } global $conf; diff --git a/inc/remote.php b/inc/remote.php index 71ceb97b5..8c505911c 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -4,7 +4,7 @@ if (!defined('DOKU_INC')) die(); require_once(DOKU_INC.'inc/RemoteAPICore.php'); class RemoteException extends Exception {} -class RemoteAccessDenied extends RemoteException {} +class RemoteAccessDeniedException extends RemoteException {} abstract class RemoteDataType { private $value; @@ -161,7 +161,7 @@ class RemoteAPI { */ public function forceAccess() { if (!$this->hasAccess()) { - throw new RemoteAccessDenied(); + throw new RemoteAccessDeniedException(); } } diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 44b4ba7a0..ce9ef1484 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -37,7 +37,7 @@ class dokuwiki_xmlrpc_server extends IXR_Server { //print 'a'; $result = $this->remote->call($methodname, $args); return $result; - } catch (RemoteAccessDenied $e) { + } catch (RemoteAccessDeniedException $e) { if (!isset($_SERVER['REMOTE_USER'])) { header('HTTP/1.1 401 Unauthorized'); } else { -- cgit v1.2.3 From 995dc0ce9ce4e23e9f15e7088aa1219ab72835cb Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 22 Jan 2012 11:58:01 +0100 Subject: fixed testcase --- _test/cases/inc/remote.test.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index f5da3c06d..186f8e65a 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -2,9 +2,14 @@ require_once DOKU_INC . 'inc/init.php'; require_once DOKU_INC . 'inc/RemoteAPICore.php'; +require_once DOKU_INC . 'inc/auth/basic.class.php'; Mock::generate('Doku_Plugin_Controller'); +class MockAuth extends auth_basic { + function isCaseSensitive() { return true; } +} + class RemoteAPICoreTest { function __getRemoteInfo() { @@ -122,6 +127,7 @@ class remote_test extends UnitTestCase { global $plugin_controller; global $conf; global $USERINFO; + global $auth; parent::setUp(); $pluginManager = new MockDoku_Plugin_Controller(); @@ -136,6 +142,8 @@ class remote_test extends UnitTestCase { $this->userinfo = $USERINFO; $this->remote = new RemoteAPI(); + + $auth = new MockAuth(); } function tearDown() { @@ -185,7 +193,6 @@ class remote_test extends UnitTestCase { $conf['useacl'] = 1; $conf['remoteuser'] = '@grp,@grp2'; $USERINFO['grps'] = array('grp'); - $this->assertTrue($this->remote->hasAccess()); } -- cgit v1.2.3 From 200ff6b799de7ba300488ec4cb4833c0092761e5 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 22 Jan 2012 11:58:39 +0100 Subject: removed unused class --- inc/remote.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index 8c505911c..0a507e95d 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -6,18 +6,6 @@ require_once(DOKU_INC.'inc/RemoteAPICore.php'); class RemoteException extends Exception {} class RemoteAccessDeniedException extends RemoteException {} -abstract class RemoteDataType { - private $value; - - function __construct($value) { - $this->value = $value; - } - - function getValue() { - return $this->value; - } -} - /** * This class provides information about remote access to the wiki. * -- cgit v1.2.3 From 2d74814f032eb77d6ed604f6328edfc229446c3b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 5 Feb 2012 12:30:02 +0100 Subject: added getapi methods to remote plugin --- lib/plugins/remote.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/plugins/remote.php b/lib/plugins/remote.php index 42c2f53c8..a51f701fb 100644 --- a/lib/plugins/remote.php +++ b/lib/plugins/remote.php @@ -2,10 +2,20 @@ abstract class DokuWiki_Remote_Plugin extends DokuWiki_Plugin { + private $api; + + public function __construct() { + $this->api = new RemoteAPI(); + } + /** * @abstract * @return array Information to all provided methods. {@see RemoteAPI}. */ public abstract function _getMethods(); + protected function getApi() { + return $this->api; + } + } -- cgit v1.2.3 From 750a55de568a82aaa40ca384a17a64804e94f2b9 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 5 Feb 2012 12:33:35 +0100 Subject: corrected comment --- inc/remote.php | 3 ++- lib/exe/xmlrpc.php | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index 0a507e95d..82a0d3c08 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -23,7 +23,8 @@ class RemoteAccessDeniedException extends RemoteException {} * ) * 'name' => 'method name in class', * 'return' => 'type', -* ['doc' = 'method documentation'], + * 'public' => 1/0 - method bypass default group check (used by login) + * ['doc' = 'method documentation'], * ) * ) * diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index ce9ef1484..a48ac41b0 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -34,7 +34,6 @@ class dokuwiki_xmlrpc_server extends IXR_Server { function call($methodname, $args){ try { - //print 'a'; $result = $this->remote->call($methodname, $args); return $result; } catch (RemoteAccessDeniedException $e) { -- cgit v1.2.3 From 03d7247e047c21d2733f837148a1499f56784ae3 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sun, 5 Feb 2012 12:36:19 +0100 Subject: moved plugin and core method calls to seperate function --- inc/remote.php | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index 82a0d3c08..105969f8b 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -82,23 +82,31 @@ class RemoteAPI { } list($type, $pluginName, $call) = explode('.', $method, 3); if ($type === 'plugin') { - $plugin = plugin_load('remote', $pluginName); - $methods = $this->getPluginMethods(); - if (!$plugin) { - throw new RemoteException('Method dose not exists'); - } - $this->checkAccess($methods[$method]); - $name = $this->getMethodName($methods, $method); - return call_user_func_array(array($plugin, $name), $args); + return $this->callPlugin($pluginName, $method, $args); } else { - $coreMethods = $this->getCoreMethods(); - $this->checkAccess($coreMethods[$method]); - if (!isset($coreMethods[$method])) { - throw new RemoteException('Method dose not exists'); - } - $this->checkArgumentLength($coreMethods[$method], $args); - return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); + return $this->callCoreMethod($method, $args); + } + } + + private function callPlugin($pluginName, $method, $args) { + $plugin = plugin_load('remote', $pluginName); + $methods = $this->getPluginMethods(); + if (!$plugin) { + throw new RemoteException('Method dose not exists'); + } + $this->checkAccess($methods[$method]); + $name = $this->getMethodName($methods, $method); + return call_user_func_array(array($plugin, $name), $args); + } + + private function callCoreMethod($method, $args) { + $coreMethods = $this->getCoreMethods(); + $this->checkAccess($coreMethods[$method]); + if (!isset($coreMethods[$method])) { + throw new RemoteException('Method dose not exists'); } + $this->checkArgumentLength($coreMethods[$method], $args); + return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); } private function checkAccess($methodMeta) { -- cgit v1.2.3 From 4ea1d54936a1d1e9b919e06639632bc2ac65f6d3 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 11:01:38 +0100 Subject: typo fixes --- inc/remote.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/remote.php b/inc/remote.php index c8af76420..fb095f517 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -92,7 +92,7 @@ class RemoteAPI { $plugin = plugin_load('remote', $pluginName); $methods = $this->getPluginMethods(); if (!$plugin) { - throw new RemoteException('Method dose not exists', -32603); + throw new RemoteException('Method does not exist', -32603); } $this->checkAccess($methods[$method]); $name = $this->getMethodName($methods, $method); @@ -103,7 +103,7 @@ class RemoteAPI { $coreMethods = $this->getCoreMethods(); $this->checkAccess($coreMethods[$method]); if (!isset($coreMethods[$method])) { - throw new RemoteException('Method dose not exists', -32603); + throw new RemoteException('Method does not exist', -32603); } $this->checkArgumentLength($coreMethods[$method], $args); return call_user_func_array(array($this->coreMethods, $this->getMethodName($coreMethods, $method)), $args); @@ -121,7 +121,7 @@ class RemoteAPI { private function checkArgumentLength($method, $args) { if (count($method['args']) < count($args)) { - throw new RemoteException('Method dose not exists - wrong parameter count.', -32603); + throw new RemoteException('Method does not exist - wrong parameter count.', -32603); } } @@ -173,7 +173,7 @@ class RemoteAPI { foreach ($plugins as $pluginName) { $plugin = plugin_load('remote', $pluginName); if (!is_subclass_of($plugin, 'DokuWiki_Remote_Plugin')) { - throw new RemoteException("Plugin $pluginName dose not implement DokuWiki_Remote_Plugin"); + throw new RemoteException("Plugin $pluginName does not implement DokuWiki_Remote_Plugin"); } $methods = $plugin->_getMethods(); -- cgit v1.2.3 From c2eb026d070a5ba9ba1ee8754c3a862a026a7ea8 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 11:04:12 +0100 Subject: changed error code for unauthorized method calls. --- inc/remote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/remote.php b/inc/remote.php index fb095f517..b4cc8e6cc 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -158,7 +158,7 @@ class RemoteAPI { */ public function forceAccess() { if (!$this->hasAccess()) { - throw new RemoteAccessDeniedException('server error. not authorized to call method', -32603); + throw new RemoteAccessDeniedException('server error. not authorized to call method', -32604); } } -- cgit v1.2.3 From 96946cc94d3ecb3832e2a1ce35c49743e25329e1 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 11:25:00 +0100 Subject: replaced $HTTP_RAW_POST_DATA with http_get_raw_post_data function --- inc/IXR_Library.php | 7 ++++--- inc/httputils.php | 8 ++++++++ lib/exe/xmlrpc.php | 3 --- lib/plugins/acl/ajax.php | 11 ++++++----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php index c8255e6d9..ce5a4d914 100644 --- a/inc/IXR_Library.php +++ b/inc/IXR_Library.php @@ -302,11 +302,12 @@ class IXR_Server { } function serve($data = false) { if (!$data) { - global $HTTP_RAW_POST_DATA; - if (!$HTTP_RAW_POST_DATA) { + + $postData = trim(http_get_raw_post_data()); + if (!$postData) { die('XML-RPC server accepts POST requests only.'); } - $data = $HTTP_RAW_POST_DATA; + $data = $postData; } $this->message = new IXR_Message($data); if (!$this->message->parse()) { diff --git a/inc/httputils.php b/inc/httputils.php index 0ad97a9a1..b815f3ca6 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -249,3 +249,11 @@ function http_cached_finish($file, $content) { print $content; } } + +function http_get_raw_post_data() { + static $postData = null; + if ($postData === null) { + $postData = file_get_contents('php://input'); + } + return $postData; +} diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 93086e891..cbec90bff 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -1,9 +1,6 @@ */ -//fix for Opera XMLHttpRequests -if(!count($_POST) && !empty($HTTP_RAW_POST_DATA)){ - parse_str($HTTP_RAW_POST_DATA, $_POST); -} - if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../'); require_once(DOKU_INC.'inc/init.php'); //close session session_write_close(); +//fix for Opera XMLHttpRequests +$postData = http_get_raw_post_data(); +if(!count($_POST) && !empty($postData)){ + parse_str($postData, $_POST); +} + if(!auth_isadmin()) die('for admins only'); if(!checkSecurityToken()) die('CRSF Attack'); -- cgit v1.2.3 From 7c35ac36c1dea2d6f26d8184dcbf1fe5afae59ac Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 13:15:18 +0100 Subject: added RPC_CALL_ADD event. This event enables plugins to register custom method names. --- _test/cases/inc/remote.test.php | 12 ++++++++++++ inc/remote.php | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index 186f8e65a..f03d13ce1 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -309,4 +309,16 @@ class remote_test extends UnitTestCase { $remoteApi->call('plugin.testplugin.methodString'); } + function test_pluginCallCustomPath() { + global $EVENT_HANDLER; + $EVENT_HANDLER->register_hook('RPC_CALL_ADD', 'BEFORE', &$this, 'pluginCallCustomPathRegister'); + + $remoteApi = new RemoteAPI(); + $result = $remoteApi->call('custom.path'); + $this->assertEqual($result, 'success'); + } + + function pluginCallCustomPathRegister(&$event, $param) { + $event->data['custom.path'] = array('testplugin', 'methodString'); + } } diff --git a/inc/remote.php b/inc/remote.php index b4cc8e6cc..089a5f7d4 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -35,8 +35,6 @@ class RemoteAccessDeniedException extends RemoteException {} * plugin methods are formed like 'plugin..'. * i.e.: plugin.clock.getTime or plugin.clock_gmt.getTime * - * - * * @throws RemoteException */ class RemoteAPI { @@ -52,6 +50,14 @@ class RemoteAPI { */ private $pluginMethods = null; + /** + * @var array contains custom calls to the api. Plugins can use the XML_CALL_REGISTER event. + * The data inside is 'custom.call.something' => array('plugin name', 'remote method name') + * + * The remote method name is the same as in the remote name returned by _getMethods(). + */ + private $pluginCustomCalls = null; + private $dateTransformation; private $fileTransformation; @@ -83,9 +89,34 @@ class RemoteAPI { list($type, $pluginName, $call) = explode('.', $method, 3); if ($type === 'plugin') { return $this->callPlugin($pluginName, $method, $args); - } else { + } + if ($this->coreMethodExist($method)) { return $this->callCoreMethod($method, $args); } + return $this->callCustomCallPlugin($method, $args); + } + + private function coreMethodExist($name) { + $coreMethods = $this->getCoreMethods(); + return array_key_exists($name, $coreMethods); + } + + private function callCustomCallPlugin($method, $args) { + $customCalls = $this->getCustomCallPlugins(); + if (!array_key_exists($method, $customCalls)) { + throw new RemoteException('Method does not exist', -32603); + } + $customCall = $customCalls[$method]; + return $this->callPlugin($customCall[0], $customCall[1], $args); + } + + private function getCustomCallPlugins() { + if ($this->pluginCustomCalls === null) { + $data = array(); + trigger_event('RPC_CALL_ADD', $data); + $this->pluginCustomCalls = $data; + } + return $this->pluginCustomCalls; } private function callPlugin($pluginName, $method, $args) { -- cgit v1.2.3 From 895122581107d99070522a1b5121f01e69d8a4de Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 13:33:00 +0100 Subject: added dokuwiki.getXMLRPCAPIVersion and wiki.getRPCVersionSupported --- inc/RemoteAPICore.php | 99 ++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 64 deletions(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index d525b17e0..38f7072ad 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -20,25 +20,17 @@ class RemoteAPICore { 'return' => 'string', 'doc' => 'Returns the running DokuWiki version.' ), 'dokuwiki.login' => array( - 'args' => array( - 'username' => 'string', - 'password' => 'string' - ), + 'args' => array('string', 'string'), 'return' => 'int', 'doc' => 'Tries to login with the given credentials and sets auth cookies.', 'public' => '1' ), 'dokuwiki.getPagelist' => array( - 'args' => array( - 'namespace' => 'string', - 'options' => 'array' - ), + 'args' => array('string', 'array'), 'return' => 'array', 'doc' => 'List all pages within the given namespace.', 'name' => 'readNamespace' ), 'dokuwiki.search' => array( - 'args' => array( - 'search' => 'string' - ), + 'args' => array('string'), 'return' => 'array', 'doc' => 'Perform a fulltext search and return a list of matching pages' ), 'dokuwiki.getTime' => array( @@ -46,7 +38,7 @@ class RemoteAPICore { 'return' => 'int', 'doc' => 'Returns the current time at the remote wiki server as Unix timestamp.', ), 'dokuwiki.setLocks' => array( - 'args' => array('lock' => 'array'), + 'args' => array('array'), 'return' => 'array', 'doc' => 'Lock or unlock pages.' ), 'dokuwiki.getTitle' => array( @@ -54,40 +46,26 @@ class RemoteAPICore { 'return' => 'string', 'doc' => 'Returns the wiki title.' ), 'dokuwiki.appendPage' => array( - 'args' => array( - 'pagename' => 'string', - 'rawWikiText' => 'string', - 'attrs' => 'array' - ), + 'args' => array('string', 'string', 'array'), 'return' => 'int', 'doc' => 'Append text to a wiki page.' ), 'wiki.getPage' => array( - 'args' => array( - 'id' => 'string' - ), + 'args' => array('string'), 'return' => 'string', 'doc' => 'Get the raw Wiki text of page, latest version.', 'name' => 'rawPage', ), 'wiki.getPageVersion' => array( - 'args' => array( - 'id' => 'string', - 'rev' => 'int', - ), + 'args' => array('string', 'int'), 'name' => 'rawPage', 'return' => 'string', 'doc' => 'Return a raw wiki page' ), 'wiki.getPageHTML' => array( - 'args' => array( - 'id' => 'string' - ), + 'args' => array('string'), 'return' => 'string', 'doc' => 'Return page in rendered HTML, latest version.', 'name' => 'htmlPage' ), 'wiki.getPageHTMLVersion' => array( - 'args' => array( - 'id' => 'string', - 'rev' => 'int' - ), + 'args' => array('string', 'int'), 'return' => 'string', 'doc' => 'Return page in rendered HTML.', 'name' => 'htmlPage' @@ -97,86 +75,79 @@ class RemoteAPICore { 'doc' => 'Returns a list of all pages. The result is an array of utf8 pagenames.', 'name' => 'listPages' ), 'wiki.getAttachments' => array( - 'args' => array( - 'namespace' => 'string', - 'options' => 'array' - ), + 'args' => array('string', 'array'), 'return' => 'array', 'doc' => 'Returns a list of all media files.', 'name' => 'listAttachments' ), 'wiki.getBackLinks' => array( - 'args' => array( - 'id' => 'string' - ), + 'args' => array('string'), 'return' => 'array', 'doc' => 'Returns the pages that link to this page.', 'name' => 'listBackLinks' ), 'wiki.getPageInfo' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'return' => 'array', 'doc' => 'Returns a struct with infos about the page.', 'name' => 'pageInfo' ), 'wiki.getPageInfoVersion' => array( - 'args' => array( - 'id' => 'string', - 'version' => 'int', - ), + 'args' => array('string', 'int'), 'return' => 'array', 'doc' => 'Returns a struct with infos about the page.', 'name' => 'pageInfo' ), 'wiki.getPageVersions' => array( - 'args' => array( - 'id' => 'string', - 'offset' => 'int' - ), + 'args' => array('string', 'int'), 'return' => 'array', 'doc' => 'Returns the available revisions of the page.', 'name' => 'pageVersions' ), 'wiki.putPage' => array( - 'args' => array( - 'id' => 'string', - 'rawText' => 'string', - 'attrs' => 'array' - ), + 'args' => array('string', 'string', 'array'), 'return' => 'int', 'doc' => 'Saves a wiki page.' ), 'wiki.listLinks' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'return' => 'array', 'doc' => 'Lists all links contained in a wiki page.' ), 'wiki.getRecentChanges' => array( - 'args' => array('timestamp' => 'int'), + 'args' => array('int'), 'return' => 'array', 'Returns a struct about all recent changes since given timestamp.' ), 'wiki.getRecentMediaChanges' => array( - 'args' => array('timestamp' => 'int'), + 'args' => array('int'), 'return' => 'array', 'Returns a struct about all recent media changes since given timestamp.' ), 'wiki.aclCheck' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'return' => 'int', 'doc' => 'Returns the permissions of a given wiki page.' ), 'wiki.putAttachment' => array( - 'args' => array( - 'id' => 'string', - 'data' => 'file', - 'params' => 'array' - ), + 'args' => array('string', 'file', 'array'), 'return' => 'array', 'doc' => 'Upload a file to the wiki.' ), 'wiki.deleteAttachment' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'return' => 'int', 'doc' => 'Delete a file from the wiki.' ), 'wiki.getAttachment' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'doc' => 'Return a media file', 'return' => 'file', 'name' => 'getAttachment', ), 'wiki.getAttachmentInfo' => array( - 'args' => array('id' => 'string'), + 'args' => array('string'), 'return' => 'array', 'doc' => 'Returns a struct with infos about the attachment.' + ), 'dokuwiki.getXMLRPCAPIVersion' => array( + 'args' => array(), + 'name' => 'getAPIVersion', + 'return' => 'int', + 'doc' => 'Returns the XMLRPC API version.', + 'public' => '1', + ), 'wiki.getRPCVersionSupported' => array( + 'args' => array(), + 'name' => 'wiki_RPCVersion', + 'return' => 'int', + 'doc' => 'Returns 2 with the supported RPC API version.', + 'public' => '1' ), ); -- cgit v1.2.3 From 418431a22a4a8f9d62e60e1d8eaa9bcf321377ce Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Wed, 21 Mar 2012 13:34:19 +0100 Subject: updated comment --- inc/remote.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/remote.php b/inc/remote.php index 089a5f7d4..0347bd900 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -19,7 +19,7 @@ class RemoteAccessDeniedException extends RemoteException {} * array( * 'method.remoteName' => array( * 'args' => array( - * 'name' => 'type eg. string|int|...|date|file', + * 'type eg. string|int|...|date|file', * ) * 'name' => 'method name in class', * 'return' => 'type', -- cgit v1.2.3 From 37e579189fae39899d3856598affa31dfd39328b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 22 Mar 2012 12:04:56 +0100 Subject: removed require_once for autoloaded fulltext.php --- inc/RemoteAPICore.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 38f7072ad..450c6f39e 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -278,8 +278,6 @@ class RemoteAPICore { * List all pages in the given namespace (and below) */ function search($query){ - require_once(DOKU_INC.'inc/fulltext.php'); - $regex = ''; $data = ft_pageSearch($query,$regex); $pages = array(); -- cgit v1.2.3 From b967e5fc8fd93226eba7926c13b73b93878f182b Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Thu, 22 Mar 2012 12:11:31 +0100 Subject: removed requires, changed conf check in xmlrpc.php --- inc/load.php | 1 + inc/remote.php | 1 - lib/exe/xmlrpc.php | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/inc/load.php b/inc/load.php index 3f1f3429f..f3ab5bcdd 100644 --- a/inc/load.php +++ b/inc/load.php @@ -77,6 +77,7 @@ function load_autoload($name){ 'Sitemapper' => DOKU_INC.'inc/Sitemapper.php', 'PassHash' => DOKU_INC.'inc/PassHash.class.php', 'RemoteAPI' => DOKU_INC.'inc/remote.php', + 'RemoteAPICore' => DOKU_INC.'inc/RemoteAPICore.php', 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', diff --git a/inc/remote.php b/inc/remote.php index 0347bd900..2ef28afd2 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -1,7 +1,6 @@