Procedural File: dh-api.php
Source Location: /dh-api.php
  
 
 
Page Details:
Ok I suck at phpdoc.org but it might be useful to use it!  Thanks boldmanuk for  http://discussion.dreamhost.com/showthreaded.pl?Board=forum_programming&Number=59785
 
 This file needs two more variables to work : $dh_username and $dh_password, your credentials to the DreamHost Panel. It is a work in progress, please contribute ! 
 
  
Tags:
  
  
  
 
   
	
	dhapi_dhapi_panelConnect [line 115]
	
    
    
		bool dhapi_dhapi_panelConnect(
)
     |   
     |  
 
		This actually connects to the panel. Three steps: - connect to the start page and gets the cookies,
 - send credentials to authenticate and get the panel,
 - reget the panel, in case of loss (...?)
  
Tags:
    
	
    	
	 
   
	
	dhapi_dhapi_panelDisconnect [line 98]
	
    
    
		void dhapi_dhapi_panelDisconnect(
)
     |   
     |  
 
		This function disconnects from the panel (deletes the cookie associated with the connection).    
	
    	 
	 
   
	
	dhapi_getSecurityKey [line 88]
	
    
    
		mixed dhapi_getSecurityKey(
string $dhapi_page)
     |   
     |  
 
		This function takes the HTML of the page and returns the security hash contained in the hidden form field "security key".
 Tags:
    
	
    		Parameters
    
		      
        | string   | 
        $dhapi_page   | 
        The HTML of the page returned by cURL. | 
       
				 
    	
	 
   
	
	dhapi_panelEmailCheck [line 385]
	
    
    
		bool dhapi_panelEmailCheck(
string $email)
     |   
     |  
 
		This function checks if an email address already exists. It takes the address as parameter and checks for USER in DOMAIN.
 Tags:
    
	
    		Parameters
    
		      
        | string   | 
        $email   | 
        This is the email address to check. | 
       
				 
    	
	 
   
	
	dhapi_panelEmailCreate [line 204]
	
    
    
		bool dhapi_panelEmailCreate(
string $email, string $redirect, mixed $redirect_only, mixed $name, string $pass, mixed $limMB, bool $warning, int $rem_qty, int $rem_age, bool $rem_new, mixed $rem_fol, bool $rem_mai)
     |   
     |  
 
		This function creates a new email account. Steps: - Get the "Create New Email Address" page to extract the security_key.
 - Post the variables to the "?" page.
 - Extract from the result page "error" or "success"
  
Tags:
    
	
    		Parameters
    
		      
        | string   | 
        $email   | 
        (input "text")        The email address, like user@example.com. The hashing is done inside the function. | 
       
		      
        | string   | 
        $redirect   | 
        (input "textarea")    The email address(es) to redirect the new one to, or empty (""). One or many line-separated addresses (NOTE: is this \\n, \\r, mix?). | 
       
		      
        | mixed   | 
        $redirect_only   | 
        (input "hidden")    Boolean "false" creates a normal inbox (also with forward capabilities) ; boolean "true" creates a forward-only email-address (no actual inbox is created) ; string "null" creates a "garbage email address. Warning : Last two value dump gecos and other values... | 
       
		      
        | mixed   | 
        $name   | 
        (input "text")        The "name" (ex: John Doe), facultative. | 
       
		      
        | string   | 
        $pass   | 
        (input "text")        The password for this account. It is used twice, so have it confirmed/checked before. Min 6 chars. TODO: Max? | 
       
		      
        | mixed   | 
        $limMB   | 
        (input "text")        Limit value of disk usage (in MB or empty), or "false". | 
       
		      
        | bool   | 
        $warning   | 
        (input "checkbox")    The "email me if my usage is within 10% of my limit (or 100MB, whichever is smaller)". | 
       
		      
        | int   | 
        $rem_qty   | 
        (input "text")        Remove read messages when inbox reaches this message quantity (max 2000). Set to false for 0. NOTE: MIN:0, MAX:2000. | 
       
		      
        | int   | 
        $rem_age   | 
        (input "text")        Remove read messages older than this numbers of days (max 9999). Set to false for 0. NOTE: MIN:0, MAX:9999. | 
       
		      
        | bool   | 
        $rem_new   | 
        (input "checkbox")    Remove even unread messages. | 
       
		      
        | mixed   | 
        $rem_fol   | 
        (input "text")        Save removed messages in this folder. Leave empty or set to false to really deleted them. NOTE: This will be formatted with imap_utf7_encode() so warn the user if input does not match formatted. | 
       
		      
        | bool   | 
        $rem_mai   | 
        (input "checkbox")    Email me when messages are removed. | 
       
				 
    	
	 
   
	
	dhapi_panelEmailDelete [line 445]
	
    
    
		bool dhapi_panelEmailDelete(
string $email)
     |   
     |  
 
		This functions deletes PERMANENTLY an email account and all its messages  First connects to the "Manage email" page and get the security code;  Then  requests the delete-email URI.
 Tags:
    
	
    		Parameters
    
		      
        | string   | 
        $email   | 
        The email address to delete. | 
       
				 
    	
	 
   
	
	dhapi_panelEmailEdit [line 302]
	
    
    
		bool dhapi_panelEmailEdit(
string $email, string $redirect, mixed $redirect_only, mixed $name, string $pass, mixed $limMB, bool $warning, int $rem_qty, int $rem_age, bool $rem_new, mixed $rem_fol, bool $rem_mai)
     |   
     |  
 
		This function edits an existing email account. Steps: - Get the "edit" page to extract the security_key.
 - Post the variables into the "?" page.
 - Extract from the result page...
  
Tags:
    
	
    		Parameters
    
		      
        | string   | 
        $email   | 
        (input "text")        The email address (user@domain) to edit. | 
       
		      
        | string   | 
        $redirect   | 
        (input "text")        The email address(es) to redirect this one, or empty (""). One or many line-separated addresses (NOTE: is this \\n, \\r, mix?). | 
       
		      
        | mixed   | 
        $redirect_only   | 
        (input "hidden")    Boolean "false" creates a normal inbox (also with forward capabilities) ; boolean "true" creates a forward-only email-address (no actual inbox is created) ; string "null" creates a "garbage email address. Warning : Last two value dump gecos and other values... | 
       
		      
        | mixed   | 
        $name   | 
        (input "text")        The "name" (ex: John Doe), facultative. | 
       
		      
        | string   | 
        $pass   | 
        (input "text")        The password for the account. It is used twice, so have it confirmed/checked before. Min 6 chars. TODO: Max? | 
       
		      
        | mixed   | 
        $limMB   | 
        (input "text")        Limit value of disk usage (in MB or empty), or "false". | 
       
		      
        | bool   | 
        $warning   | 
        (input "checkbox")    The "email me if my usage is within 10% of my limit (or 100MB, whichever is smaller)". | 
       
		      
        | int   | 
        $rem_qty   | 
        (input "text")        Remove read messages when inbox reaches this message quantity (max 2000). Set to false for 0. NOTE: MIN:0, MAX:2000. | 
       
		      
        | int   | 
        $rem_age   | 
        (input "text")        Remove read messages older than this numbers of days (max 9999). Set to false for 0. NOTE: MIN:0, MAX:9999. | 
       
		      
        | bool   | 
        $rem_new   | 
        (input "checkbox")    Remove even unread messages. | 
       
		      
        | mixed   | 
        $rem_fol   | 
        (input "text")        Save removed messages in this folder. Leave empty or set to false to really deleted them. NOTE: This will be formatted with imap_utf7_encode() so warn the user if input does not match formatted. | 
       
		      
        | bool   | 
        $rem_mai   | 
        (input "checkbox")    Email me when messages are removed. | 
       
				 
    	
	 
   
	
	dhapi_showCurlErrors [line 73]
	
    
    
		void dhapi_showCurlErrors(
 $dhapi_curlhan, mixed $chan)
     |   
     |  
 
		This function output eventuals cURL errors.    
	
    		 Parameters
    
		      
        | mixed   | 
        $chan   | 
        This is the result of curl_init(). | 
       
		      
        |    | 
        $dhapi_curlhan   | 
         | 
       
				 
    	
	 
        
       |