function readPage($username = NULL, $password = NULL, $id = NULL, $loginToken = NULL, $editToken = NULL, $title = NULL, $revisionID = NULL) { $__pcpServer = new PCPServer(); $__userCredentials = new PCPUserCredentials($username, $password, $id, $loginToken, $editToken); $_REQUEST = array(); $__pcpServer->login($__userCredentials); // var_dump($__userCredentials,$title, $revisionID); // die; return simplexml_load_string(PCPUtil::createXMLResponse($__pcpServer->readPage($__userCredentials, $title, $revisionID)->toXML()), 'SimpleXMLElement', LIBXML_NOCDATA); }
<?php /** * @file * @ingroup DAPCPTest * * @author Dian */ chdir('C:\\xampp\\htdocs\\mw'); require_once 'C:/xampp/htdocs/mw/includes/Webstart.php'; $editTest = new PCPServer(); $uc = $editTest->login(new PCPUserCredentials("WikiSysop", "!>ontoprise?")); #var_dump($editTest->getCookies()); #$editTest->getEditToken("Main Page"); $uc->id = NULL; $uc->un = NULL; $editTest->updatePage($uc, "Testpage", "Works again.", "Page updated."); $editTest->logout(); //}else{ // print ("ERROR: Testing failed!".__FILE__); //}
<?php /** * @file * @ingroup DAPCPExample * * @author Dian */ // the path to your wiki installation home chdir('/xampp/htdocs/wiki'); require_once '/xampp/htdocs/wiki/includes/Webstart.php'; $readTest = new PCPServer(); $uc = new PCPUserCredentials("TestUser", "TestPassword"); if ($readTest->login($uc)) { echo $readTest->readPage($uc, "Main Page"); $readTest->logout(); } else { print "ERROR: Testing failed!"; }
protected function getSimpleTexts($username = NULL, $password = NULL, $id = NULL, $loginToken = NULL, $editToken = NULL, $title = NULL, $revisionID = NULL) { $__pcpServer = new PCPServer(); $__userCredentials = new PCPUserCredentials($username, $password, $id, $loginToken, $editToken); $__pcpServer->login($__userCredentials); $__pom = new POMPage($title, $__pcpServer->readPage($__userCredentials, $title, $revisionID)->text); $__result = array(); $__elementsIterator = $__pom->getSimpleTexts()->listIterator(); while ($__elementsIterator->hasNext()) { $__element =& $__elementsIterator->getNextNodeValueByReference(); $__array = $this->toArray($__element); $__result[get_class($__element)][$__element->id] = $__array; } return $__result; }
<?php /** * @file * @ingroup DAPCPTest * * @author Dian */ /** * This group contains all parts of the DataAPI that deal with tests for the PCP component * @defgroup DAPCPTest * @ingroup DAPCP */ chdir('F:\\xampp\\htdocs\\mw'); require_once 'F:/xampp/htdocs/mw/includes/Webstart.php'; $editTest = new PCPServer(); $uc = new PCPUserCredentials("WikiSysop", "", 1, "93f49f1cb77a00ae03b3eb90069d76dd"); //$editTest->login($uc); //if ($editTest->login($uc)){ #var_dump($editTest->getCookies()); #$editTest->getEditToken("Main Page"); var_dump($editTest->createPage($uc, "Another test", "Adding some content")); $editTest->logout(); //}else{ // print ("ERROR: Testing failed!".__FILE__); //}
<?php /** * @file * @ingroup DAPCPExample * * @author Dian */ /** * This group contains all parts of the DataAPI that provide examples for the PCP component * @defgroup DAPCPExample * @ingroup DAPCP */ // the path to your wiki installation home chdir('/xampp/htdocs/wiki'); require_once '/xampp/htdocs/wiki/includes/Webstart.php'; $createTest = new PCPServer(); $uc = new PCPUserCredentials("TestUser", "TestPassword"); if ($createTest->login($uc)) { echo $createTest->createPage($uc, "A test page", "Adding some content"); $createTest->logout(); } else { print "ERROR: Testing failed!"; }
private function serializedForm($title) { $__pageReader = new PCPServer(); $__page = $__pageReader->readPage(NULL, "Form:" . $title); return $this->formSerialize($__page->text, false, $__page->text, $title); }
<?php /** * @file * @ingroup DAPCPTest * * @author Dian */ chdir('F:\\xampp\\htdocs\\mw'); require_once 'F:/xampp/htdocs/mw/includes/Webstart.php'; $uc = new PCPUserCredentials("WikiSysop", "!>?"); $ws = new PCPWikiSystem("http://localhost/mw"); $loginTest = new PCPServer($uc, $ws); var_dump($loginTest->login($uc)); //$loginTest->logout($uc);
/** * Returns the edit token. * * @see PCPServer::getEditToken * * @param string $username The username * @param string_type $password * @return PCPUserCredentials The user credentials object, including the edit token. * @deprecated Edit tokens will be used only for internal purposes. */ protected function getEditToken($username = NULL, $password = NULL) { $__pcpServer = new PCPServer(); $__userCredentials = new PCPUserCredentials($username, $password); $__pcpServer->login($__userCredentials); $__et['editToken'] = $__pcpServer->getEditToken(); return $__et; }