]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - soapscripts/listplugins
Comment only
[SourceForge/phpwiki.git] / soapscripts / listplugins
1 #!/usr/bin/php
2 <?php
3 if (count($argv) != 1) {
4     echo "usage: $argv[0]\n";
5     exit;
6 }
7
8 $wsdl = getenv('PHPWIKI_WSDL_URL');
9 if ($wsdl === false) {
10     $wsdl = "http://phpwiki.fr/PhpWiki.wsdl";
11 }
12
13 try {
14     $client = new SoapClient($wsdl);
15 } catch (SoapFault $fault) {
16     die($fault->faultstring);
17 }
18
19 $phpwiki = getenv("HOME")."/.phpwiki";
20 if (!file_exists($phpwiki)) {
21     $login = readline("Login: ");
22     $password = readline("Password: ");
23     $credentials = base64_encode($login.':'.$password);
24     if ($fp = fopen($phpwiki, 'w')) {
25         fprintf($fp, "%s:%s", $login, $password);
26         fclose($fp);
27         chmod($phpwiki, 0600);
28     }
29 } else {
30     $credentials = base64_encode(file_get_contents($phpwiki));
31 }
32
33 try {
34     $plugins = $client->listPlugins($credentials);
35     for ($i = 0; $i < count($plugins); $i++) {
36         echo $plugins[$i];
37         echo "\n";
38     }
39 } catch (SoapFault $e) {
40     echo 'Error: ' .  $e->getMessage() . "\n";
41 }