From: <var...@us...> - 2015-01-09 15:50:32
|
Revision: 9460 http://sourceforge.net/p/phpwiki/code/9460 Author: vargenau Date: 2015-01-09 15:50:25 +0000 (Fri, 09 Jan 2015) Log Message: ----------- Use consistent case Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-09 15:48:19 UTC (rev 9459) +++ trunk/SOAP.php 2015-01-09 15:50:25 UTC (rev 9460) @@ -289,7 +289,7 @@ require_once 'lib/WikiPlugin.php'; $w = new WikiPluginLoader(); $synopsis = ''; - $p = $w->getPlugin($pluginName, false); // second arg? + $p = $w->getPlugin($pluginname, false); // second arg? // trap php files which aren't WikiPlugin~s: wikiplugin + wikiplugin_cached only if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { $plugin_args = ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-14 14:08:21
|
Revision: 9470 http://sourceforge.net/p/phpwiki/code/9470 Author: vargenau Date: 2015-01-14 14:08:19 +0000 (Wed, 14 Jan 2015) Log Message: ----------- Rewrite with with native PHP 5 SOAP Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-14 12:55:08 UTC (rev 9469) +++ trunk/SOAP.php 2015-01-14 14:08:19 UTC (rev 9470) @@ -14,30 +14,20 @@ * Or do it dynamically in the soap class? No, the client must connect to us. * * @author: Reini Urban + * @author: Marc-Etienne Vargenau + * Rewrite with with native PHP 5 SOAP */ define ("WIKI_SOAP", true); define ("PHPWIKI_NOMAIN", true); -include_once './index.php'; -include_once 'lib/main.php'; +require_once (dirname(__FILE__) . '/lib/prepend.php'); +require_once(dirname(__FILE__) . '/lib/IniConfig.php'); +IniConfig(dirname(__FILE__) . "/config/config.ini"); +require_once(dirname(__FILE__) . '/lib/main.php'); -/* -// bypass auth and request loop for now. -// require_once('lib/prepend.php'); -include_once 'index.php'; - -//require_once('lib/stdlib.php'); -require_once 'lib/WikiDB.php'; -require_once 'lib/config.php'; -class WikiRequest extends Request {} -$request = new WikiRequest(); -require_once 'lib/PagePerm.php'; -require_once 'lib/WikiUser.php'; -require_once 'lib/WikiGroup.php'; -*/ - function checkCredentials(&$server, &$credentials, $access, $pagename) { +/* // check the "Authorization: Basic '.base64_encode("$this->username:$this->password").'\r\n'" header if (isset($server->header['Authorization'])) { $line = base64_decode(str_replace("Basic ", "", trim($server->header['Authorization']))); @@ -62,36 +52,11 @@ 'passwd' => $credentials['password'])); if (!mayAccessPage($access, $pagename)) $server->fault(401, '', "no permission"); +*/ } -$GLOBALS['SERVER_NAME'] = SERVER_URL; -$GLOBALS['SCRIPT_NAME'] = DATA_PATH . "/SOAP.php"; -$url = SERVER_URL . DATA_PATH . "/SOAP.php"; - -// Local or external wdsl support is experimental. -// It works without also. Just the client has to -// know the wdsl definitions. -$server = new soap_server( /* 'PhpWiki.wdsl' */); -// Now change the server url to ours, because in the wdsl is the original PhpWiki address -// <soap:address location="http://phpwiki.sourceforge.net/phpwiki/SOAP.php" /> -// <soap:operation soapAction="http://phpwiki.sourceforge.net/phpwiki/SOAP.php" /> - -$server->ports[$server->currentPort]['location'] = $url; -$server->bindings[$server->ports[$server->currentPort]['binding']]['endpoint'] = $url; -$server->soapaction = $url; // soap_transport_http - -$actions = array('getPageContent', 'getPageRevision', 'getCurrentRevision', - 'getPageMeta', 'doSavePage', 'getAllPagenames', - 'getBackLinks', 'doTitleSearch', 'doFullTextSearch', - 'getRecentChanges', 'listLinks', 'listPlugins', - 'getPluginSynopsis', 'callPlugin', 'listRelations', - 'linkSearch' -); -foreach ($actions as $action) { - $server->register($actions); - $server->operations[$actions]['soapaction'] = $url; -} - +class PhpWikiSoapServer +{ //todo: check and set credentials // requiredAuthorityForPage($action); // require 'edit' access @@ -104,8 +69,9 @@ $current = $page->getCurrentRevision(); $meta = $current->_data; $meta['summary'] = sprintf(_("SOAP Request %s", $credentials['username'])); // from user or IP ? - $version = $current->getVersion(); - return $page->save($content, $version + 1, $meta); + // $version = $current->getVersion(); + // return $page->save($content, $version + 1, $meta); + return $page->save($content, 5, $meta); } // require 'view' access @@ -127,7 +93,7 @@ checkCredentials($server, $credentials, 'view', $pagename); $dbi = WikiDB::open($GLOBALS['DBParams']); $page = $dbi->getPage($pagename); - $rev = $page->getCurrentRevision(); + $rev = $page->getRevision($revision); $text = $rev->getPackedContent(); return $text; } @@ -137,12 +103,12 @@ { global $server; checkCredentials($server, $credentials, 'view', $pagename); - if (!mayAccessPage('view', $pagename)) - $server->fault(401, '', "no permission"); + // if (!mayAccessPage('view', $pagename)) + // $server->fault(401, '', "no permission"); $dbi = WikiDB::open($GLOBALS['DBParams']); $page = $dbi->getPage($pagename); - $rev = $page->getCurrentRevision(); - $version = $current->getVersion(); + // $rev = $page->getCurrentRevision(); + $version = $page->getVersion(); return (double)$version; } @@ -192,6 +158,8 @@ // require 'view' access to TitleSearch function doTitleSearch($s, $credentials = false) { + require_once 'lib/TextSearchQuery.php'; + global $server; checkCredentials($server, $credentials, 'view', _("TitleSearch")); $dbi = WikiDB::open($GLOBALS['DBParams']); @@ -207,6 +175,8 @@ // require 'view' access to FullTextSearch function doFullTextSearch($s, $credentials = false) { + require_once 'lib/TextSearchQuery.php'; + global $server; checkCredentials($server, $credentials, 'view', _("FullTextSearch")); $dbi = WikiDB::open($GLOBALS['DBParams']); @@ -341,10 +311,11 @@ { global $server; checkCredentials($server, $credentials, 'view', _("HomePage")); + $dbi = WikiDB::open($GLOBALS['DBParams']); $also_attributes = $option & 2; $only_attributes = $option & 2 and !($option & 1); $sorted = !($option & 4); - return $dbh->listRelations($also_attributes, + return $dbi->listRelations($also_attributes, $only_attributes, $sorted); } @@ -374,8 +345,12 @@ return $links->asArray(); } -$server->service($GLOBALS['HTTP_RAW_POST_DATA']); +} +$server=new SoapServer('PhpWiki.wsdl'); +$server->setClass('PhpWikiSoapServer'); +$server->handle(); + // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-14 14:17:34
|
Revision: 9471 http://sourceforge.net/p/phpwiki/code/9471 Author: vargenau Date: 2015-01-14 14:17:27 +0000 (Wed, 14 Jan 2015) Log Message: ----------- Simplify require_once Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-14 14:08:19 UTC (rev 9470) +++ trunk/SOAP.php 2015-01-14 14:17:27 UTC (rev 9471) @@ -20,10 +20,10 @@ define ("WIKI_SOAP", true); define ("PHPWIKI_NOMAIN", true); -require_once (dirname(__FILE__) . '/lib/prepend.php'); -require_once(dirname(__FILE__) . '/lib/IniConfig.php'); -IniConfig(dirname(__FILE__) . "/config/config.ini"); -require_once(dirname(__FILE__) . '/lib/main.php'); +require_once 'lib/prepend.php'; +require_once 'lib/IniConfig.php'; +IniConfig('config/config.ini'); +require_once 'lib/main.php'; function checkCredentials(&$server, &$credentials, $access, $pagename) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-14 15:15:23
|
Revision: 9475 http://sourceforge.net/p/phpwiki/code/9475 Author: vargenau Date: 2015-01-14 15:15:14 +0000 (Wed, 14 Jan 2015) Log Message: ----------- Reformat Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-14 15:04:54 UTC (rev 9474) +++ trunk/SOAP.php 2015-01-14 15:15:14 UTC (rev 9475) @@ -26,328 +26,328 @@ function checkCredentials(&$server, &$credentials, $access, $pagename) { -/* - // check the "Authorization: Basic '.base64_encode("$this->username:$this->password").'\r\n'" header - if (isset($server->header['Authorization'])) { - $line = base64_decode(str_replace("Basic ", "", trim($server->header['Authorization']))); - list($credentials['username'], $credentials['password']) = explode(':', $line); - } else { - if (!isset($_SERVER)) - $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; - // TODO: where in the header is the client IP - if (!isset($credentials['username'])) { - if (isset($_SERVER['REMOTE_ADDR'])) - $credentials['username'] = $_SERVER['REMOTE_ADDR']; - elseif (isset($GLOBALS['REMOTE_ADDR'])) - $credentials['username'] = $GLOBALS['REMOTE_ADDR']; else - $credentials['username'] = $server->host; + /* + // check the "Authorization: Basic '.base64_encode("$this->username:$this->password").'\r\n'" header + if (isset($server->header['Authorization'])) { + $line = base64_decode(str_replace("Basic ", "", trim($server->header['Authorization']))); + list($credentials['username'], $credentials['password']) = explode(':', $line); + } else { + if (!isset($_SERVER)) + $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; + // TODO: where in the header is the client IP + if (!isset($credentials['username'])) { + if (isset($_SERVER['REMOTE_ADDR'])) + $credentials['username'] = $_SERVER['REMOTE_ADDR']; + elseif (isset($GLOBALS['REMOTE_ADDR'])) + $credentials['username'] = $GLOBALS['REMOTE_ADDR']; else + $credentials['username'] = $server->host; + } } - } - if (!isset($credentials['password'])) $credentials['password'] = ''; + if (!isset($credentials['password'])) $credentials['password'] = ''; - global $request; - $request->_user = WikiUser($credentials['username']); - $request->_user->AuthCheck(array('userid' => $credentials['username'], - 'passwd' => $credentials['password'])); - if (!mayAccessPage($access, $pagename)) - $server->fault(401, '', "no permission"); -*/ + global $request; + $request->_user = WikiUser($credentials['username']); + $request->_user->AuthCheck(array('userid' => $credentials['username'], + 'passwd' => $credentials['password'])); + if (!mayAccessPage($access, $pagename)) + $server->fault(401, '', "no permission"); + */ } class PhpWikiSoapServer { -//todo: check and set credentials -// requiredAuthorityForPage($action); -// require 'edit' access -function doSavePage($pagename, $content, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'edit', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - $current = $page->getCurrentRevision(); - $meta = $current->_data; - $meta['summary'] = sprintf(_("SOAP Request %s", $credentials['username'])); // from user or IP ? - // $version = $current->getVersion(); - // return $page->save($content, $version + 1, $meta); - return $page->save($content, 5, $meta); -} + //todo: check and set credentials + // requiredAuthorityForPage($action); + // require 'edit' access + function doSavePage($pagename, $content, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'edit', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + $current = $page->getCurrentRevision(); + $meta = $current->_data; + $meta['summary'] = sprintf(_("SOAP Request %s", $credentials['username'])); // from user or IP ? + // $version = $current->getVersion(); + // return $page->save($content, $version + 1, $meta); + return $page->save($content, 5, $meta); + } -// require 'view' access -function getPageContent($pagename, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - $rev = $page->getCurrentRevision(); - $text = $rev->getPackedContent(); - return $text; -} + // require 'view' access + function getPageContent($pagename, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + $rev = $page->getCurrentRevision(); + $text = $rev->getPackedContent(); + return $text; + } -// require 'view' access -function getPageRevision($pagename, $revision, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - $rev = $page->getRevision($revision); - $text = $rev->getPackedContent(); - return $text; -} + // require 'view' access + function getPageRevision($pagename, $revision, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + $rev = $page->getRevision($revision); + $text = $rev->getPackedContent(); + return $text; + } -// require 'view' access -function getCurrentRevision($pagename, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - // if (!mayAccessPage('view', $pagename)) - // $server->fault(401, '', "no permission"); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - // $rev = $page->getCurrentRevision(); - $version = $page->getVersion(); - return (double)$version; -} + // require 'view' access + function getCurrentRevision($pagename, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + // if (!mayAccessPage('view', $pagename)) + // $server->fault(401, '', "no permission"); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + // $rev = $page->getCurrentRevision(); + $version = $page->getVersion(); + return (double)$version; + } -// require 'change' or 'view' access ? -function getPageMeta($pagename, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - $rev = $page->getCurrentRevision(); - $meta = $rev->_data; - //todo: reformat the meta hash - return $meta; -} + // require 'change' or 'view' access ? + function getPageMeta($pagename, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + $rev = $page->getCurrentRevision(); + $meta = $rev->_data; + //todo: reformat the meta hash + return $meta; + } -// require 'view' access to AllPages -function getAllPagenames($credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', _("AllPages")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page_iter = $dbi->getAllPages(); - $pages = array(); - while ($page = $page_iter->next()) { - $pages[] = array('pagename' => $page->_pagename); + // require 'view' access to AllPages + function getAllPagenames($credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', _("AllPages")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page_iter = $dbi->getAllPages(); + $pages = array(); + while ($page = $page_iter->next()) { + $pages[] = array('pagename' => $page->_pagename); + } + return $pages; } - return $pages; -} -// require 'view' access -function getBacklinks($pagename, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $backend = &$dbi->_backend; - $result = $backend->get_links($pagename); - $page_iter = new WikiDB_PageIterator($dbi, $result); - $pages = array(); - while ($page = $page_iter->next()) { - $pages[] = array('pagename' => $page->getName()); + // require 'view' access + function getBacklinks($pagename, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $backend = &$dbi->_backend; + $result = $backend->get_links($pagename); + $page_iter = new WikiDB_PageIterator($dbi, $result); + $pages = array(); + while ($page = $page_iter->next()) { + $pages[] = array('pagename' => $page->getName()); + } + return $pages; } - return $pages; -} -// require 'view' access to TitleSearch -function doTitleSearch($s, $credentials = false) -{ - require_once 'lib/TextSearchQuery.php'; + // require 'view' access to TitleSearch + function doTitleSearch($s, $credentials = false) + { + require_once 'lib/TextSearchQuery.php'; - global $server; - checkCredentials($server, $credentials, 'view', _("TitleSearch")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $query = new TextSearchQuery($s); - $page_iter = $dbi->titleSearch($query); - $pages = array(); - while ($page = $page_iter->next()) { - $pages[] = array('pagename' => $page->getName()); + global $server; + checkCredentials($server, $credentials, 'view', _("TitleSearch")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $query = new TextSearchQuery($s); + $page_iter = $dbi->titleSearch($query); + $pages = array(); + while ($page = $page_iter->next()) { + $pages[] = array('pagename' => $page->getName()); + } + return $pages; } - return $pages; -} -// require 'view' access to FullTextSearch -function doFullTextSearch($s, $credentials = false) -{ - require_once 'lib/TextSearchQuery.php'; + // require 'view' access to FullTextSearch + function doFullTextSearch($s, $credentials = false) + { + require_once 'lib/TextSearchQuery.php'; - global $server; - checkCredentials($server, $credentials, 'view', _("FullTextSearch")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $query = new TextSearchQuery($s); - $page_iter = $dbi->fullSearch($query); - $pages = array(); - while ($page = $page_iter->next()) { - $pages[] = array('pagename' => $page->getName()); + global $server; + checkCredentials($server, $credentials, 'view', _("FullTextSearch")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $query = new TextSearchQuery($s); + $page_iter = $dbi->fullSearch($query); + $pages = array(); + while ($page = $page_iter->next()) { + $pages[] = array('pagename' => $page->getName()); + } + return $pages; } - return $pages; -} -// require 'view' access to RecentChanges -function getRecentChanges($limit = false, $since = false, $include_minor = false, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', _("RecentChanges")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $params = array('limit' => $limit, 'since' => $since, - 'include_minor_revisions' => $include_minor); - $page_iter = $dbi->mostRecent($params); - $pages = array(); - while ($page = $page_iter->next()) { - $pages[] = array('pagename' => $page->getName(), - 'lastModified' => $page->get('mtime'), - 'author' => $page->get('author'), - 'summary' => $page->get('summary'), // added with 1.3.13 - 'version' => $page->getVersion() - ); + // require 'view' access to RecentChanges + function getRecentChanges($limit = false, $since = false, $include_minor = false, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', _("RecentChanges")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $params = array('limit' => $limit, 'since' => $since, + 'include_minor_revisions' => $include_minor); + $page_iter = $dbi->mostRecent($params); + $pages = array(); + while ($page = $page_iter->next()) { + $pages[] = array('pagename' => $page->getName(), + 'lastModified' => $page->get('mtime'), + 'author' => $page->get('author'), + 'summary' => $page->get('summary'), // added with 1.3.13 + 'version' => $page->getVersion() + ); + } + return $pages; } - return $pages; -} -// require 'view' access -function listLinks($pagename, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', $pagename); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $page = $dbi->getPage($pagename); - $linkiterator = $page->getPageLinks(); - $links = array(); - while ($currentpage = $linkiterator->next()) { - if ($currentpage->exists()) - $links[] = array('pagename' => $currentpage->getName()); + // require 'view' access + function listLinks($pagename, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', $pagename); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $page = $dbi->getPage($pagename); + $linkiterator = $page->getPageLinks(); + $links = array(); + while ($currentpage = $linkiterator->next()) { + if ($currentpage->exists()) + $links[] = array('pagename' => $currentpage->getName()); + } + return $links; } - return $links; -} -function listPlugins($credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'change', _("HomePage")); - $plugin_dir = 'lib/plugin'; - if (defined('PHPWIKI_DIR')) - $plugin_dir = PHPWIKI_DIR . "/$plugin_dir"; - $pd = new fileSet($plugin_dir, '*.php'); - $plugins = $pd->getFiles(); - unset($pd); - sort($plugins); - $RetArray = array(); - if (!empty($plugins)) { - require_once 'lib/WikiPlugin.php'; - $w = new WikiPluginLoader(); - foreach ($plugins as $plugin) { - $pluginName = str_replace(".php", "", $plugin); - $p = $w->getPlugin($pluginName, false); // second arg? - // trap php files which aren't WikiPlugin~s: wikiplugin + wikiplugin_cached only - if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { - $RetArray[] = $pluginName; + function listPlugins($credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'change', _("HomePage")); + $plugin_dir = 'lib/plugin'; + if (defined('PHPWIKI_DIR')) + $plugin_dir = PHPWIKI_DIR . "/$plugin_dir"; + $pd = new fileSet($plugin_dir, '*.php'); + $plugins = $pd->getFiles(); + unset($pd); + sort($plugins); + $RetArray = array(); + if (!empty($plugins)) { + require_once 'lib/WikiPlugin.php'; + $w = new WikiPluginLoader(); + foreach ($plugins as $plugin) { + $pluginName = str_replace(".php", "", $plugin); + $p = $w->getPlugin($pluginName, false); // second arg? + // trap php files which aren't WikiPlugin~s: wikiplugin + wikiplugin_cached only + if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { + $RetArray[] = $pluginName; + } } } + return $RetArray; } - return $RetArray; -} -function getPluginSynopsis($pluginname, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'change', "Help/" . $pluginname . "Plugin"); - require_once 'lib/WikiPlugin.php'; - $w = new WikiPluginLoader(); - $synopsis = ''; - $p = $w->getPlugin($pluginname, false); // second arg? - // trap php files which aren't WikiPlugin~s: wikiplugin + wikiplugin_cached only - if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { - $plugin_args = ''; - $desc = $p->getArgumentsDescription(); - $src = array("\n", '"', "'", '|', '[', ']', '\\'); - $replace = array('%0A', '%22', '%27', '%7C', '%5B', '%5D', '%5C'); - $desc = str_replace("<br />", ' ', $desc->asXML()); - if ($desc) - $plugin_args = '\n' . str_replace($src, $replace, $desc); - $synopsis = "<?plugin " . $pluginname . $plugin_args . "?>"; // args? + function getPluginSynopsis($pluginname, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'change', "Help/" . $pluginname . "Plugin"); + require_once 'lib/WikiPlugin.php'; + $w = new WikiPluginLoader(); + $synopsis = ''; + $p = $w->getPlugin($pluginname, false); // second arg? + // trap php files which aren't WikiPlugin~s: wikiplugin + wikiplugin_cached only + if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { + $plugin_args = ''; + $desc = $p->getArgumentsDescription(); + $src = array("\n", '"', "'", '|', '[', ']', '\\'); + $replace = array('%0A', '%22', '%27', '%7C', '%5B', '%5D', '%5C'); + $desc = str_replace("<br />", ' ', $desc->asXML()); + if ($desc) + $plugin_args = '\n' . str_replace($src, $replace, $desc); + $synopsis = "<?plugin " . $pluginname . $plugin_args . "?>"; // args? + } + return $synopsis; } - return $synopsis; -} -// only plugins returning pagelists will return something useful. so omit the html output -function callPlugin($pluginname, $plugin_args, $credentials = false) -{ - global $request; - global $server; - checkCredentials($server, $credentials, 'change', "Help/" . $pluginname . "Plugin"); + // only plugins returning pagelists will return something useful. so omit the html output + function callPlugin($pluginname, $plugin_args, $credentials = false) + { + global $request; + global $server; + checkCredentials($server, $credentials, 'change', "Help/" . $pluginname . "Plugin"); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $basepage = ''; - require_once 'lib/WikiPlugin.php'; - $w = new WikiPluginLoader(); - $p = $w->getPlugin($pluginname, false); // second arg? - $pagelist = $p->run($dbi, $plugin_args, $request, $basepage); - $pages = array(); - if (is_object($pagelist) and is_a($pagelist, 'PageList')) { - foreach ($pagelist->pageNames() as $name) - $pages[] = array('pagename' => $name); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $basepage = ''; + require_once 'lib/WikiPlugin.php'; + $w = new WikiPluginLoader(); + $p = $w->getPlugin($pluginname, false); // second arg? + $pagelist = $p->run($dbi, $plugin_args, $request, $basepage); + $pages = array(); + if (is_object($pagelist) and is_a($pagelist, 'PageList')) { + foreach ($pagelist->pageNames() as $name) + $pages[] = array('pagename' => $name); + } + return $pages; } - return $pages; -} -/** - * array listRelations([ Integer option = 1 ]) - * - * Returns an array of all available relation names. - * option: 1 relations only ( with 0 also ) - * option: 2 attributes only - * option: 3 both, all names of relations and attributes - * option: 4 unsorted, this might be added as bitvalue: 7 = 4+3. default: sorted - * For some semanticweb autofill methods. - * - * @author: Reini Urban - */ -function listRelations($option = 1, $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', _("HomePage")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - $also_attributes = $option & 2; - $only_attributes = $option & 2 and !($option & 1); - $sorted = !($option & 4); - return $dbi->listRelations($also_attributes, - $only_attributes, - $sorted); -} + /** + * array listRelations([ Integer option = 1 ]) + * + * Returns an array of all available relation names. + * option: 1 relations only ( with 0 also ) + * option: 2 attributes only + * option: 3 both, all names of relations and attributes + * option: 4 unsorted, this might be added as bitvalue: 7 = 4+3. default: sorted + * For some semanticweb autofill methods. + * + * @author: Reini Urban + */ + function listRelations($option = 1, $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', _("HomePage")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + $also_attributes = $option & 2; + $only_attributes = $option & 2 and !($option & 1); + $sorted = !($option & 4); + return $dbi->listRelations($also_attributes, + $only_attributes, + $sorted); + } -// some basic semantic search -function linkSearch($linktype, $search, $pages = "*", $relation = "*", $credentials = false) -{ - global $server; - checkCredentials($server, $credentials, 'view', _("HomePage")); - $dbi = WikiDB::open($GLOBALS['DBParams']); - require_once 'lib/TextSearchQuery.php'; - $pagequery = new TextSearchQuery($pages); - $linkquery = new TextSearchQuery($search); - if ($linktype == 'relation') { - $relquery = new TextSearchQuery($relation); - $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery); - } elseif ($linktype == 'attribute') { // only numeric search with attributes! - $relquery = new TextSearchQuery($relation); - require_once 'lib/SemanticWeb.php'; - // search: "population > 1 million and area < 200 km^2" relation="*" pages="*" - $linkquery = new SemanticAttributeSearchQuery($search, $relation); - $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery); - } else { - // we already do have forward and backlinks as SOAP - $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype); + // some basic semantic search + function linkSearch($linktype, $search, $pages = "*", $relation = "*", $credentials = false) + { + global $server; + checkCredentials($server, $credentials, 'view', _("HomePage")); + $dbi = WikiDB::open($GLOBALS['DBParams']); + require_once 'lib/TextSearchQuery.php'; + $pagequery = new TextSearchQuery($pages); + $linkquery = new TextSearchQuery($search); + if ($linktype == 'relation') { + $relquery = new TextSearchQuery($relation); + $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery); + } elseif ($linktype == 'attribute') { // only numeric search with attributes! + $relquery = new TextSearchQuery($relation); + require_once 'lib/SemanticWeb.php'; + // search: "population > 1 million and area < 200 km^2" relation="*" pages="*" + $linkquery = new SemanticAttributeSearchQuery($search, $relation); + $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery); + } else { + // we already do have forward and backlinks as SOAP + $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype); + } + return $links->asArray(); } - return $links->asArray(); -} } -$server=new SoapServer('PhpWiki.wsdl'); +$server = new SoapServer('PhpWiki.wsdl'); $server->setClass('PhpWikiSoapServer'); $server->handle(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-14 15:49:04
|
Revision: 9477 http://sourceforge.net/p/phpwiki/code/9477 Author: vargenau Date: 2015-01-14 15:48:57 +0000 (Wed, 14 Jan 2015) Log Message: ----------- Use getVersion Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-14 15:35:08 UTC (rev 9476) +++ trunk/SOAP.php 2015-01-14 15:48:57 UTC (rev 9477) @@ -68,9 +68,8 @@ $current = $page->getCurrentRevision(); $meta = $current->_data; $meta['summary'] = sprintf(_("SOAP Request %s", $credentials['username'])); // from user or IP ? - // $version = $current->getVersion(); - // return $page->save($content, $version + 1, $meta); - return $page->save($content, 5, $meta); + $version = $current->getVersion(); + return $page->save($content, $version + 1, $meta); } // require 'view' access This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-16 14:37:29
|
Revision: 9483 http://sourceforge.net/p/phpwiki/code/9483 Author: vargenau Date: 2015-01-16 14:37:26 +0000 (Fri, 16 Jan 2015) Log Message: ----------- Improve getPageMeta Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-16 13:38:13 UTC (rev 9482) +++ trunk/SOAP.php 2015-01-16 14:37:26 UTC (rev 9483) @@ -117,10 +117,7 @@ checkCredentials($server, $credentials, 'view', $pagename); $dbi = WikiDB::open($GLOBALS['DBParams']); $page = $dbi->getPage($pagename); - $rev = $page->getCurrentRevision(); - $meta = $rev->_data; - //todo: reformat the meta hash - return $meta; + return $page->getMetaData(); } // require 'view' access to AllPages This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-19 16:20:55
|
Revision: 9484 http://sourceforge.net/p/phpwiki/code/9484 Author: vargenau Date: 2015-01-19 16:20:47 +0000 (Mon, 19 Jan 2015) Log Message: ----------- Update meta Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-16 14:37:26 UTC (rev 9483) +++ trunk/SOAP.php 2015-01-19 16:20:47 UTC (rev 9484) @@ -66,9 +66,15 @@ $dbi = WikiDB::open($GLOBALS['DBParams']); $page = $dbi->getPage($pagename); $current = $page->getCurrentRevision(); - $meta = $current->_data; - $meta['summary'] = sprintf(_("SOAP Request %s", $credentials['username'])); // from user or IP ? $version = $current->getVersion(); + $userid = $credentials['username']; + $summary = sprintf(_("SOAP Request by %s"), $userid); + $meta = array('author' => $userid, + 'author_id' => $userid, + 'summary' => $summary, + 'mtime' => time(), + 'pagetype' => 'wikitext' + ); return $page->save($content, $version + 1, $meta); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-21 16:07:45
|
Revision: 9486 http://sourceforge.net/p/phpwiki/code/9486 Author: vargenau Date: 2015-01-21 16:07:37 +0000 (Wed, 21 Jan 2015) Log Message: ----------- Sort result in getAllPagenames Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-20 13:41:47 UTC (rev 9485) +++ trunk/SOAP.php 2015-01-21 16:07:37 UTC (rev 9486) @@ -145,6 +145,7 @@ while ($page = $page_iter->next()) { $pages[] = array('pagename' => $page->_pagename); } + sort($pages); return $pages; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-01-21 16:26:42
|
Revision: 9487 http://sourceforge.net/p/phpwiki/code/9487 Author: vargenau Date: 2015-01-21 16:26:40 +0000 (Wed, 21 Jan 2015) Log Message: ----------- Display WDSL in browser Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-01-21 16:07:37 UTC (rev 9486) +++ trunk/SOAP.php 2015-01-21 16:26:40 UTC (rev 9487) @@ -355,13 +355,26 @@ } return $links->asArray(); } - } $server = new SoapServer('PhpWiki.wsdl'); $server->setClass('PhpWikiSoapServer'); -$server->handle(); +if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST') { + $server->handle(); +} elseif (isset($_SERVER['QUERY_STRING'])) { + // Return the WSDL + $wsdl = @implode('', @file('PhpWiki.wsdl')); + if (strlen($wsdl) > 1) { + header("Content-type: text/xml"); + echo $wsdl; + } else { + header("Status: 500 Internal Server Error"); + header("Content-type: text/plain"); + echo "HTTP/1.0 500 Internal Server Error"; + } +} + // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-18 12:55:21
|
Revision: 9542 http://sourceforge.net/p/phpwiki/code/9542 Author: vargenau Date: 2015-02-18 12:55:18 +0000 (Wed, 18 Feb 2015) Log Message: ----------- No comma at end Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-02-17 10:02:59 UTC (rev 9541) +++ trunk/SOAP.php 2015-02-18 12:55:18 UTC (rev 9542) @@ -56,7 +56,7 @@ $server->fault(401, "no permission, " . "access=$access, " . "pagename=$pagename, " - . "username=$username, " + . "username=$username" ); } $credentials = array('username' => $username, 'password' => $password); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-19 11:47:59
|
Revision: 9551 http://sourceforge.net/p/phpwiki/code/9551 Author: vargenau Date: 2015-02-19 11:47:57 +0000 (Thu, 19 Feb 2015) Log Message: ----------- Use Wikicreole syntax for plugins Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-02-19 10:59:14 UTC (rev 9550) +++ trunk/SOAP.php 2015-02-19 11:47:57 UTC (rev 9551) @@ -275,12 +275,10 @@ if (strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') { $plugin_args = ''; $desc = $p->getArgumentsDescription(); - $src = array("\n", '"', "'", '|', '[', ']', '\\'); - $replace = array('%0A', '%22', '%27', '%7C', '%5B', '%5D', '%5C'); $desc = str_replace("<br />", ' ', $desc->asXML()); if ($desc) - $plugin_args = '\n' . str_replace($src, $replace, $desc); - $synopsis = "<?plugin " . $pluginname . $plugin_args . "?>"; // args? + $plugin_args = ' ' . str_replace($src, $replace, $desc); + $synopsis = "<<" . $pluginname . $plugin_args . ">>"; } return $synopsis; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-19 15:49:39
|
Revision: 9553 http://sourceforge.net/p/phpwiki/code/9553 Author: vargenau Date: 2015-02-19 15:49:32 +0000 (Thu, 19 Feb 2015) Log Message: ----------- No str_replace Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-02-19 11:49:07 UTC (rev 9552) +++ trunk/SOAP.php 2015-02-19 15:49:32 UTC (rev 9553) @@ -120,11 +120,8 @@ { global $server; checkCredentials($server, $credentials, 'view', $pagename); - // if (!mayAccessPage('view', $pagename)) - // $server->fault(401, '', "no permission"); $dbi = WikiDB::open($GLOBALS['DBParams']); $page = $dbi->getPage($pagename); - // $rev = $page->getCurrentRevision(); $version = $page->getVersion(); return (double)$version; } @@ -282,7 +279,7 @@ $desc = $p->getArgumentsDescription(); $desc = str_replace("<br />", ' ', $desc->asXML()); if ($desc) - $plugin_args = ' ' . str_replace($src, $replace, $desc); + $plugin_args = ' ' . $desc; $synopsis = "<<" . $pluginname . $plugin_args . ">>"; } return $synopsis; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2015-02-26 09:20:05
|
Revision: 9563 http://sourceforge.net/p/phpwiki/code/9563 Author: vargenau Date: 2015-02-26 09:19:57 +0000 (Thu, 26 Feb 2015) Log Message: ----------- listRelations: remove duplicates Modified Paths: -------------- trunk/SOAP.php Modified: trunk/SOAP.php =================================================================== --- trunk/SOAP.php 2015-02-25 17:29:17 UTC (rev 9562) +++ trunk/SOAP.php 2015-02-26 09:19:57 UTC (rev 9563) @@ -326,9 +326,10 @@ $also_attributes = $option & 2; $only_attributes = $option & 2 and !($option & 1); $sorted = !($option & 4); - return $dbi->listRelations($also_attributes, + $relations = $dbi->listRelations($also_attributes, $only_attributes, $sorted); + return array_keys(array_flip($relations)); // Remove duplicates } // some basic semantic search This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |