Net_Cyrus
[ class tree: Net_Cyrus ] [ index: Net_Cyrus ] [ all elements ]

Source for file test_cyrus.php

Documentation is available at test_cyrus.php

  1. <?
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar>       |
  17. // +----------------------------------------------------------------------+
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. /*
  25. This sample shows the use of the IMAP methods
  26. this is only useful for testing and to high level IMAP access example use
  27. */
  28.  
  29.  
  30. include_once('Net/Cyrus.php');
  31. //include_once('./Cyrus_horde.php');
  32.  
  33. error_reporting(E_ALL);
  34.  
  35. $user="user";
  36. $passwd="password";
  37. $host="localhost";
  38. $port="143";
  39.  
  40.  
  41.  
  42. //you can create a file called passwords.php and store your $user,$pass,$host and $port values in it
  43. // or you can modify this script
  44. @require_once("./passwords.php");
  45.  
  46.  
  47. //$cyrus= new  Net_Cyrus($user,$passwd,$host,$port);
  48. $cyrus= new  Net_Cyrus();
  49. //$cyrus->setDebug(true);
  50.  
  51.  
  52.  
  53.  
  54. if(PEAR::isError($ret= $cyrus->connect($user,$passwd,$host, $port) ) ){
  55.     echo "Error. "  . $ret->getMessage() . "\n" ;
  56.     exit();
  57. }
  58.  
  59.  
  60. //print_r($cyrus->connect());
  61.  
  62.  
  63.  
  64.  
  65. /*print_R($cyrus);
  66. exit();
  67. */
  68.  
  69.  
  70. $mailbox='user.damian';
  71.  
  72.  
  73. /*
  74. echo "getQuota('$mailbox')\n";
  75. print_r($cyrus->getQuota($mailbox));
  76. echo "\n";
  77.  
  78. echo "getACL('$mailbox')\n";
  79. print_r($cyrus->getACL($mailbox ));
  80. echo "\n";
  81.  
  82. echo "getACL('$mailbox', 'cyrus')\n";
  83. print_r($cyrus->getACL($mailbox , 'cyrus' ));
  84. echo "\n";
  85.  
  86. echo "getFolderList('$mailbox' . '.basura.*')\n";
  87. print_r($cyrus->getFolderList($mailbox . '.basura.*'));
  88. echo "\n";
  89.  
  90. echo "getFolderList()\n";
  91. print_r($cyrus->getFolderList());
  92. echo "\n";
  93.  
  94. */
  95.  
  96. echo "getUserList()\n";
  97. print_r($cyrus->getUserList());
  98. echo "\n";
  99.  
  100.  
  101.  
  102.  
  103. $user_to_create='damiancito';
  104. $user_to_create_new_name='damiancito_new';
  105.  
  106.  
  107. echo "deleteUser('$user_to_create')\n";
  108. if($cyrus->deleteUser($user_to_create)){
  109.     echo "The user $user_to_create was deleted";
  110. }else{
  111.     echo "The user $user_to_create was NOT deleted";
  112. }
  113. echo "\n";
  114.  
  115.  
  116. echo "deleteUser('$user_to_create_new_name')\n";
  117. if($cyrus->deleteUser($user_to_create_new_name)){
  118.     echo "The user $user_to_create was deleted";
  119. }else{
  120.     echo "The user $user_to_create was NOT deleted";
  121. }
  122. echo "\n";
  123.  
  124.  
  125.  
  126. echo "createUser('$user_to_create')\n";
  127. if($cyrus->createUser($user_to_create)){
  128.     echo "The user $user_to_create was created";
  129. }else{
  130.     echo "The user $user_to_create was NOT created";
  131. }
  132. echo "\n";
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. $cyrus->renameUser($user_to_create, $user_to_create_new_name);
  140.  
  141.  
  142. echo "userExists('$user_to_create')\n";
  143. if($cyrus->userExists($user_to_create) ){
  144.     echo "The mailbox $user_to_create exists!!\n";
  145. }else{
  146.     echo "ERROR!!! The mailbox $user_to_create does NOT exists!!\n";
  147. }
  148.  
  149. echo "userExists('$user_to_create_new_name')\n";
  150. if($cyrus->userExists($user_to_create_new_name) ){
  151.     echo "The mailbox $user_to_create_new_name exists!!\n";
  152. }else{
  153.     echo "ERROR!!! The mailbox $user_to_create_new_name does NOT exists!!\n";
  154. }
  155.  
  156.  
  157. echo "getUserList()\n";
  158. print_r($cyrus->getUserList());
  159. echo "\n";
  160.  
  161. echo "getACL('$user_to_create_new_name')\n";
  162. print_r($cyrus->getACL('user.' . $user_to_create_new_name ));
  163. echo "\n";
  164.  
  165.  
  166. $cyrus->disconnect();
  167. ?>

Documentation generated on Mon, 11 Mar 2019 13:52:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.