login = 'https://'.$user.':'.$pass.'@'.$host.':2003/index.php'; } /** * Configure webuzo * * @category Configure * @param string $ip The IP Address on configure webuzo * @param string $user The username for webuzo * @param string $email The email for webuzo * @param string $pass The password * @param string $host The Primary domain * @param string $ns1 The nameserver * @param string $ns2 The nameserver * @param string $license The License Key * @return void */ function webuzo_configure($ip, $user, $email, $pass, $host, $ns1 = '', $ns2 ='', $license = '', $data = array()){ $data['uname'] = $user; $data['email'] = $email; $data['pass'] = $pass; $data['rpass'] = $pass; $data['domain'] = $host; $data['ns1'] = $ns1; $data['ns2'] = $ns2; $data['lic'] = $license; $data['submit'] = 1; $data['api'] = 1; $this->login = 'http://'.$ip.':2004/install.php?'; $return = $this->curl($this->login, $data); $this->chk_error(); return $return; } /** * A Function that will INSTALL apps. If the DATA is empty script information is retured * * @package API * @author Jigar Dhulla * @param int $sid Script ID * @param array $data DATA to POST * @return string $resp Response of Action. Default: Serialize * @since 4.1.3 */ function install_app($appid){ // Get the Scripts List $this->list_apps(); // Script present ? if(empty($this->apps[$appid])){ $this->error[] = 'App Not Found'; return false; } $act = 'act=apps&app='.$appid.'&install=1'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * List Services * * @category Database * @return string $resp Response of Action. Default: Serialize */ function list_services(){ $act = 'act=services'; $resp = trim($this->curl_call($act)); $this->chk_error(); return $resp; } /** * A Function that will REMOVE apps. If the DATA is empty script information is retured * * @package API * @author Jigar Dhulla * @param int $sid Script ID * @param array $data DATA to POST * @return string $resp Response of Action. Default: Serialize * @since 4.1.3 */ function remove_app($appid){ // Get the Scripts List $iapps = $this->list_installed_apps(); // Script present ? if(empty($iapps[$appid])){ $this->error[] = 'App Not Found'; return false; } $act = 'act=apps&app='.$appid.'&remove=1'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * A Function that will list scripts * * @package API * @author Jigar Dhulla * @return array $scripts List of Softaculous Scripts * @since 4.1.3 */ function list_apps(){ if(!empty($this->apps)){ return true; } // Get response from the server. $data = $this->curl_unserialize(''); $this->apps = $data['apps']; if(empty($this->apps)){ $this->error[] = 'Apps were not loaded.'; return false; }else{ return true; } } /** * A Function that will list installed scripts * * @package API * @author Jigar Dhulla * @return array $scripts List of Installed Softaculous Scripts * @since 4.1.3 */ function list_installed_apps(){ if(!empty($this->installed_apps)){ return $this->installed_apps; } // Get response from the server. $resp = $this->curl_unserialize('act=apps_installations'); $this->installed_apps = $resp['apps_ins']; return $resp['apps_ins']; } /////////////////////////////////////////////////////////////////////////////// // CATEGORY : FEATURES // /////////////////////////////////////////////////////////////////////////////// /** * Check login error * * @category error * @return array */ function chk_error(){ if(!empty($this->error)){ return $this->r_print($this->error[0]); } } /** * List Domains * * @category Domain * @return string $resp Response of Action. Default: Serialize */ function list_domains(){ $act = 'act=domainmanage'; $resp = $this->curl_call($act); $this->chk_error(); return trim($resp); } /** * Add Domain * * @category Domain * @param string $domain The domain to add * @param (Optional) string $domainpath The path for an ADD-ON domain * @param (Optional) string $ip Different IP Address for domain * @return string $resp Response of Action. Default: Serialize */ function add_domain($domain, $domainpath = '', $ip = ''){ // The act $act = 'act=domainadd'; $data['domain'] = $domain; $data['domainpath'] = $domainpath; $data['isaddon'] = !empty($domainpath); $data['ip'] = !empty($ip); $data['submitdomain'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete Domain * * @category Domain * @param string $domain The domain to delete * @return string $resp Response of Action. Default: Serialize */ function delete_domain($domain){ // The act $act = 'act=domainmanage'; $data['delete_domain_name'] = $domain; $data['delete_domain_id'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Change ROOT/Endusers's Password * * @category Password * @param string $pass The NEW password for the USER * @return string $resp Response of Action. Default: Serialize */ function change_password($pass, $user = ''){ // The act $act = 'act=changepassword'; if(!empty($user)){ $data['user'] = $user; } $data['newpass'] = $data['conf'] = $pass; $data['changepass'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Change File Manager Password * * @category Password * @param string $pass The NEW password for the File manager * @return string $resp Response of Action. Default: Serialize */ function change_fileman_pwd($pass){ // The act $act = 'act=changepassword'; $data['filepass'] = $pass; $data['changefilepass'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Change Apache Tomcat Manager's Password * * @category Password * @param string $pass The NEW password for the Apache Tomcat * @return string $resp Response of Action. Default: Serialize */ function change_tomcat_pwd($pass){ // The act $act = 'act=changepassword'; $data['tomcatpass'] = $pass; $data['changetomcatpass'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List FTP users * * @category FTP * @return array */ function list_ftpuser(){ $act = 'act=ftp'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Add FTP user * * @category FTP * @param string $user The FTP username * @param string $pass The password for the FTP user * @param string $directory The Directory path for the FTP users relative to /HOME/USER * @param string $quota_limit (Optional) Define a quota for the user * @return string $resp Response of Action. Default: Serialize */ function add_ftpuser($user, $pass, $directory, $quota_limit = ''){ $act = 'act=ftp_account'; $data['login'] = $user; $data['newpass'] = $data['conf'] = $pass; $data['dir'] = $directory; if(!empty($quota_limit)){ $data['quota'] = 'limited'; $data['quota_limit'] = $quota_limit; }else{ $data['quota'] = 'unlimited'; } $data['create_acc'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Edit FTP user * * @category FTP * @param string $user FTP user to EDIT data * @param string $quota_limit (Optional) Specify quota limit to the user * @return string $resp Response of Action. Default: Serialize */ function edit_ftpuser($user, $quota_limit = ''){ $act = 'act=ftp'; $data['edit_ftp_user'] = $user; if(!empty($quota_limit)){ $data['quota'] = 'limited'; $data['quota_limit'] = $quota_limit; }else{ $data['quota'] = 'unlimited'; } $data['edit_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Change FTP User's Password * * @category FTP * @param string $user FTP user to change Password * @param string $pass New password for the FTP user * @return string $resp Response of Action. Default: Serialize */ function change_ftpuser_pass($user, $pass){ $act = 'act=editftp'; $data['edit_ftp_user_pass'] = $user; $data['newpass'] = $data['conf'] = $pass; $data['changepass'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete FTP user * * @category FTP * @param string $user FTP user to delete * @return string $resp Response of Action. Default: Serialize */ function delete_ftpuser($user){ $act = 'act=ftp'; $data['delete_ftp_user'] = $user; $data['delete_fuser_id'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List FTP Connections * * @category FTP * @return array */ function list_ftp_connections(){ $act = 'act=ftp_connections'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Delete FTP Connection * * @category FTP * @param string $ftp_connection_id FTP Connection Process ID * @return string $resp Response of Action. Default: Serialize */ function delete_ftp_connection($ftp_connection_id){ $act = 'act=ftp_connections'; $data['ftp_connection_pid'] = $ftp_connection_id; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /////////////////////////////////////////////////////////////////////////////// // CATEGORY : DATABASE // /////////////////////////////////////////////////////////////////////////////// /** * List Database with its size and users * * @category Database * @return string $resp Response of Action. Default: Serialize */ function list_database(){ $act = 'act=dbmanage'; $resp = trim($this->curl_call($act)); $this->chk_error(); return $resp; } /** * Add Database * * @category database * @param string $db_name Database name to create * @return string $resp Response of Action. Default: Serialize */ function add_database($db_name){ $act = 'act=dbmanage'; $data['db'] = $db_name; $data['submitdb'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Delete Database * * @category database * @param string $db_name Database name to delete * @return string $resp Response of Action. Default: Serialize */ function delete_database($db_name){ $act = 'act=dbmanage'; $data['delete_db'] = $data['db'] = $db_name; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List Database Users * * @category Database * @return string $resp Response of Action. Default: Serialize */ function list_db_user(){ $act = 'act=dbmanage'; $resp = trim($this->curl_call($act)); $this->chk_error(); return $resp; } /** * Add Database User * * @category database * @param string $db_user Database username to ADD * @param string $pass Password for the database user * @return string $resp Response of Action. Default: Serialize */ function add_db_user($db_user, $pass){ $act = 'act=dbmanage'; $data['dbuser'] = $db_user; $data['dbpassword'] = $pass; $data['submituserdb'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Delete Database user * * @category database * @param string $db_user Database user to delete * @return string $resp Response of Action. Default: Serialize */ function delete_db_user($db_user){ $act = 'act=dbmanage'; $data['delete_dbuser'] = $db_user; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Set Privileges for a User to a specific database * * @category database * @param string $database Database name to ADD privileges * @param string $db_user Database users name to ADD privileges * @param string $host Database host * @param string $prilist Set of privileges to be given to the User * @return string $resp Response of Action. Default: Serialize */ function set_privileges($database, $db_user, $host, $prilist){ $act = 'act=dbmanage'; $data['dbname'] = $database; $data['dbuser'] = $db_user; $data['host'] = $host; $data['prilist'] = $prilist; $data['submitpri'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } ////////////////////////////////////////////////////////////////////////////// // CATEGORY : Advance Settings // ////////////////////////////////////////////////////////////////////////////// /** * Edit settings * * @category Advance settings * @param string $email Specify email address to SET * @param int $ins_email (Optional) Set 1 to receive installation emails, otherwise 0 * @param int $rem_email (Optional) Set 1 to receive installations removal email, otherwise 0 * @param int $edit_email (Optional) Set 1 to receive installations editting email, otherwise 0 * @return string $resp Response of Action. Default: Serialize */ function edit_settings($email, $ins_email = '', $rem_email = '', $edit_email = '' ){ $act = 'act=email'; $data['email'] = $email; $data['ins_email'] = empty($ins_email); $data['rem_email'] = empty($rem_email); $data['editdetail_email'] = empty($edit_email); $data['editemailsettings'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Manage Services * * @category Advanced Settings * @param string $service_name Specify the service to restart E.g exim, dovecot, tomcat, httpd, named, pure-ftpd, mysqld * @return string $resp Response of Action. Default: Serialize */ function manage_service($service_name, $action = 'restart'){ $act = 'act=services'; $data['service_name'] = $service_name; $data['action'] = $action; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Enable/Disable suPHP * * @category Security * @param string $action Specify on/off to START/STOP suPHP respectively * @return string $resp Response of Action. Default: Serialize */ function manage_suphp($action){ $act = 'act=apache_settings'; if($action != 'off'){ $data['suphpon'] = 1; }else{ $data['suphpon'] = NULL; } $data['editapachesettings'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Enable NGINX Proxy * * @category SystemApps * @param Integer $port Port for Proxy Server * @param Integer $htaccess - 0 to enable .htaccess * - 1 to disable .htaccess * @param String $proxy_server - Either "httpd" or "httpd2" * @return array $resp */ function enable_proxy($port, $htaccess, $proxy_server){ $act = 'act=apache_settings'; $data['port'] = $port; $data['ht_check'] = $htaccess; $data['webserver'] = $proxy_server; $data['enable_proxy'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Disable NGINX Proxy * * @category SystemApps * @param String $proxy_server - Default Webserver to be set - "httpd,httpd2,nginx,lighttpd" * @return array $resp */ function disable_proxy($set_default_webserver){ $act = 'act=apache_settings'; $data['webserver'] = $set_default_webserver; $data['disable_proxy'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } ////////////////////////////////////////////////////////////////////////////// // CATEGORY : Server Settings // ////////////////////////////////////////////////////////////////////////////// /** * List DNS Record * * @category Server Settings * @param string $domain Specify domain to list DNS records * @return string $resp Response of Action. Default: Serialize */ function list_dns_record($domain){ $act = 'act=advancedns'; $data['domain'] = $domain; $resp =$this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Add DNS Record * * @category Server Settings * @param string $domain Specify domain to ADD DNS record * @param string $name Specify record name * @param string $ttl Specify TTL * @param string $type Specify TYPE of record * @param string $address Specify destination address * @return string $resp Response of Action. Default: Serialize */ function add_dns_record($domain, $name, $ttl, $type, $address){ $act = 'act=advancedns'; $data['selectdomain'] = $domain; $data['name'] = $name; $data['ttl'] = $ttl; $data['selecttype'] = $type; $data['address'] = $address; $data['create_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Edit DNS Record * * @category Server Settings * @param string $id Specify ID of record to EDIT * @param string $domain Specify domain to ADD DNS record * @param string $name Specify record name * @param string $ttl Specify TTL * @param string $type Specify TYPE of record * @param string $address Specify destination address * @return string $resp Response of Action. Default: Serialize * @return array */ function edit_dns_record($id, $domain, $name, $ttl, $type, $address){ $act = 'act=advancedns'; $data['edit_record'] = $id; $data['domain_name'] = $domain; $data['name'] = $name; $data['ttl'] = $ttl; $data['type'] = $type; $data['record'] = $address; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete DNS Record * * @category Server Settings * @param string $id ID of Dns record for delete * @param string $domain Domain for the DNS record for delete * @return string $resp Response of Actions. Default: Serialize */ function delete_dns_record($id, $domain){ $act = 'act=advancedns'; $data['delete_record'] = $id; // Specify record to be DELETED $data['domain_name'] = $domain; // Specify the DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List CRON * * @category Server Settings * @return string $resp Response of Actions. Default: Serialize */ function list_cron(){ $act = 'act=cronjob'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Add a CRON * * @category Server Settings * @param string $minute Minute of the cron part * @param string $hour Hour of the cron part * @param string $day Day of the cron part * @param string $month Month of the cron part * @param string $weekday Weekend of the cron part * @param string $cmd Command of the cron part * @return string $resp Response of Actions. Default: Serialize */ function add_cron($minute, $hour, $day, $month, $weekday, $cmd){ $act = 'act=cronjob'; $data['minute'] = $minute; // Specify minutes $data['hour'] = $hour; // Specify hour $data['day'] = $day; // Specify day $data['month'] = $month; // Specify month $data['weekday'] = $weekday;// Specify weekday $data['cmd'] = $cmd; // Specify command $data['create_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Edit CRON * * @category Server Settings * @param string $id ID of the cron record. Get from the list of cron * @param string $minute Minute of the cron part * @param string $hour Hour of the cron part * @param string $day Day of the cron part * @param string $month Month of the cron part * @param string $weekday Weekend of the cron part * @param string $cmd Command of the cron part * @return string $resp Response of Actions. Default: Serialize */ function edit_cron($id, $minute, $hour, $day, $month, $weekday, $cmd){ $act = 'act=cronjob'; $data['minute'] = $minute; // Specify minutes $data['hour'] = $hour; // Specify hour $data['day'] = $day; // Specify day $data['month'] = $month; // Specify month $data['weekday'] = $weekday;// Specify weekday $data['cmd'] = $cmd; // Specify command $data['edit_record'] = 'c'. $id; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Delete CRON * * @category Server Settings * @param string $id ID of the cron record. Get from the list of cron * @return string $resp Response of Actions. Default: Serialize */ function delete_cron($id){ $act = 'act=cronjob'; $data['delete_record'] = 'c'. $id; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } ////////////////////////////////////////////////////////////////////////// // CATEGORY : Security // ////////////////////////////////////////////////////////////////////////// /** * List SSL Key * * @category Security * @return string $resp Response of Actions. Default: Serialize */ function list_ssl_key(){ $act = 'act=sslkey'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Create SSL Key * * @category Security * @param string $description Domain name or any name for the SSL Key * @param string $keysize Size of the SSl Key * @return string $resp Response of Actions. Default: Serialize */ function create_ssl_key($description, $keysize = ''){ $act = 'act=sslkey'; $data['selectdom'] = $description; // Specify DOMAIN $data['keysize'] = (empty($keysize) ? '1024' : $keysize); // Specify Key size $data['create_key'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Upload SSL Key * * @category Security * @param string $description Domain name or any name for the SSL Key * @param string $keypaste Entire SSL Key * @return string $resp Response of Actions. Default: Serialize */ function upload_ssl_key($description, $keypaste){ $act = 'act=sslkey'; $data['selectdom'] = $description; // Specify DOMAIN $data['kpaste'] = $keypaste; // Specify KEY contents $data['install_key'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Detail SSL Key * * @category Security * @param string $domain Specify domain name to detail view of SSL Key * @return string $resp Response of Actions. Default: Serialize */ function detail_ssl_key($domain){ $act = 'act=sslkey'; $data['detail_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete SSL Key * * @category Security * @param string $domain Specify domain name to delete SSL Key * @return string $resp Response of Actions. Default: Serialize */ function delete_ssl_key($domain){ $act = 'act=sslkey'; $data['delete_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List SSL CSR * * @category Security * @return string $resp Response of Actions. Default: Serialize */ function list_ssl_csr(){ $act = 'act=sslcsr'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Create SSL CSR * * @category Security * @param string $domain Domain name for the CSR * @param string $country_code Two latter Country Code * @param string $state Name of the State * @param string $locality Name of the Location * @param string $org Name of the Organitaion * @param string $org_unit Name of the Organitaion unit * @param string $passphrase Password prase * @param string $email Email address * @param string $key KEY use for creating new csr. if you want to generate new key then pass "newkey" as argument. * @return string $resp Response of Actions. Default: Serialize */ function create_ssl_csr($domain, $country_code, $state, $locality, $org, $org_unit, $passphrase, $email, $key){ $act = 'act=sslcsr'; $data['domain'] = $domain; // Specify DOMAIN - Note : Domain should have a Private KEY $data['country'] = $country_code; // Specify Country Code $data['state'] = $state; // Specify State $data['locality'] = $locality; // Specify Locality $data['organisation'] = $org; // Specify Organization $data['orgunit'] = $org_unit; // Specify Organization Unit $data['pass'] = $passphrase; // Specify PASSPHRASE $data['email'] = $email; // Specify Email $data['selectkey'] = $key; // Specify key. if you want to generate new key then pass "newkey" as argument. $data['createcsr'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Detail SSL CSR * * @category Security * @param string $domain Specify domain name to detail view of SSL CSR * @return string $resp Response of Actions. Default: Serialize */ function detail_ssl_csr($domain){ $act = 'act=sslcsr'; $data['detail_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete SSL CSR * * @category Security * @param string $domain Specify domain name to delete SSL CSR * @return string $resp Response of Actions. Default: Serialize */ function delete_ssl_csr($domain){ $act = 'act=sslcsr'; $data['delete_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List SSL Certificate * * @category Security * @return string $resp Response of Actions. Default: Serialize */ function list_ssl_crt(){ $act = 'act=sslcrt'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Create SSL Certificate * * @category Security * @param string $domain Domain for the Certificate * @param string $country_code Two latter Country Code * @param string $state Name of the State * @param string $locality Name of the Location * @param string $org Name of the Organitaion * @param string $org_unit Name of the Organitaion unit * @param string $email Email address * @param string $key KEY use for creating new csr. if you want to generate new key then pass "newkey" as argument. * @return string $resp Response of Actions. Default: Serialize */ function create_ssl_crt($domain, $country_code, $state, $locality, $org, $org_unit, $email, $key){ $act = 'act=sslcrt'; $data['domain'] = $domain; // Specify DOMAIN - Note : Domain should have a KEY $data['country'] = $country_code; // Specify Country Code $data['state'] = $state; // Specify State $data['locality'] = $locality; // Specify Locality $data['organisation'] = $org; // Specify Organization $data['orgunit'] = $org_unit; // Specify Organization Unit $data['email'] = $email; // Specify Email $data['selectkey'] = $key; // Specify key. if you want to generate new key then pass "newkey" as argument. $data['create_crt'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Upload SSL Certificate * * @category Security * @param string $keypaste Entire certificate. * @return string $resp Response of Actions. Default: Serialize */ function upload_ssl_crt($keypaste){ $act = 'act=sslcrt'; $data['kpaste'] = $keypaste; // Specify Certificatae Contents $data['install_crt'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Detail SSL Certificate * * @category Security * @param string $domain Specify domain name to detail view of SSL Certificat * @return string $resp Response of Actions. Default: Serialize */ function detail_ssl_crt($domain){ $act = 'act=sslcrt'; $data['detail_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete SSL Certificate * * @category Security * @param string $domain Specify domain name to delete SSL Certificat * @return string $resp Response of Actions. Default: Serialize */ function delete_ssl_crt($domain){ $act = 'act=sslcrt'; $data['delete_record'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List Blocked IP. * @return string $resp Response of Actions. Default: Serialize */ function list_ipblock(){ $act = 'act=ipblock'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Block IP * * @category Security * @param string $ip IP Address for block * @return string $resp Response of Actions. Default: Serialize */ function add_ipblock($ip){ $act = 'act=ipblock'; $data['dip'] = $ip; // Specify IP to block $data['add_ip'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete Blocked IP * * @category Security * @param string $ip IP Address for unblock * @return string $resp Response of Actions. Default: Serialize */ function delete_ipblock($ip){ $act = 'act=ipblock'; $data['delete_ip'] = $ip; // Specify IP to unblock $data['delete_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Enable/Disable SSH Access * * @category Security * @param string $action Action should be on or off * @return string $resp Response of Actions. Default: Serialize */ function ssh_access($action){ $act = 'act=ssh_access'; // Specify on/off to enable/disable SSH access respectively. if($action == 'off'){ $data['sshon'] = NULL; }else{ $data['sshon'] = 1; } $data['editsshsettings'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } ////////////////////////////////////////////////////////////////////////////// // CATEGORY : Email Server // ////////////////////////////////////////////////////////////////////////////// /** * List Email Users * * @category Email * @param string $domain Specify domain name for the Email User Account list * @return string $resp Response of Actions. Default: Serialize */ function list_emailuser($domain){ $act = 'act=email_account'; $data['domain'] = $domain; // Specify Domain $resp = trim($this->curl_call($act, $data)); $this->chk_error(); return $resp; } /** * Add Email User * * @category Email * @param string $domain Domain for the Email User Account to add * @param string $emailuser Email user name for add * @param string $password Password for user * @return string $resp Response of Actions. Default: Serialize */ function add_emailuser($domain, $emailuser, $password){ $act = 'act=email_account'; $data['selectdomain'] = $domain; // Specify DOMAIN $data['login'] = $emailuser; // Specify email user to create $data['newpass'] = $data['conf'] = $password; // Specfy PASSWORD $data['create_acc'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Change Email Users' Password * * @category Email * @param string $domain Domain for the Email User Account for change passsword * @param string $emailuser Email user name for change passsword * @param string $password New password for user * @return string $resp Response of Actions. Default: Serialize */ function change_email_user_pass($domain, $emailuser, $password){ $act = 'act=email_account'; $data['domain_name'] = $domain; // Specify DOMAIN $data['edit_record'] = $emailuser; // Specify record to be EDITTED $data['cpass'] = $password; // Specify PASSWORD $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete Email Users * * @category Email * @param string $domain Domain for the Email User Account for delete * @param string $emailuser Email user name for delete * @return string $resp Response of Actions. Default: Serialize */ function delete_email_user($domain, $emailuser){ $act = 'act=email_account'; $data['domain_name'] = $domain; // Specify DOMAIN $data['delete_record'] = $emailuser;// Specify record to be DELETED $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List Email Forwarder * * @category Email * @param string $domain Domain for the Email Forwarder list * @return string $resp Response of Actions. Default: Serialize */ function list_emailforward($domain){ $act = 'act=email_forward'; $data['domain'] = $domain; // Specify DOMAIN $resp = trim($this->curl_call($act, $data)); $this->chk_error(); return $resp; } /** * Add Email Forwarder * * @category Email * @param string $domain Domain for the Email Forwarder add * @param string $forward_address Forwarder name to add * @param string $forward_to To whome it is forwarded * @return string $resp Response of Actions. Default: Serialize */ function add_emailforward($domain, $forward_address, $forward_to){ $act = 'act=email_forward'; $data['selectdomain'] = $domain; // Specify DOMAIN $data['addemail'] = $forward_address; // Specify Senders Email Address $data['sendemail'] = $forward_to; // Specify Email Address to be Forwarded TO $data['create_acc'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete Email Forwarder * * @category Email * @param string $domain Domain for the Email Forwarder delete * @param string $forward_address Forwarder name * @param string $forward_to To whome it is forwarded * @return string $resp Response of Actions. Default: Serialize */ function delete_email_forward($domain, $forward_address, $forward_to){ $act = 'act=email_forward'; $data['domain_name'] = $domain; // Specify DOMAIN $data['forward_name'] = $forward_address; // Specify Forwarders Name $data['to_name'] = $forward_to; // Specify Recepients Name $data['delete_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List MX record * * @category Email Server * @param string $domain Domain for the MX Record list * @return string $resp Response of Actions. Default: Serialize */ function list_mx_entry($domain){ $act = 'act=mxentry'; $data['domain'] = $domain; // Specify DOMAIN $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Add MX record * * @category Email Server * @param string $domain Domain for the MX Record add * @param string $priority Priority for the MX Record Entry * @param string $destination Destination address * @return string $resp Response of Actions. Default: Serialize */ function add_mx_entry($domain, $priority, $destination){ $act = 'act=mxentry'; $data['selectdomain'] = $domain; // Specify the DOMAIN $data['priority'] = $priority; // Specify the PRIORITY $data['destination'] = $destination;// Specify the Destination $data['create_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Edit MX record * * @category Email Server * @param string $domain Domain for the MX Record edit * @param string $record Record no of the Entry * @param string $priority Priority for the MX Record Entry * @param string $destination Destination address * @return string $resp Response of Actions. Default: Serialize */ function edit_mx_entry($domain, $record, $priority, $destination){ $act = 'act=mxentry'; $data['domain_name'] = $domain; // Specify the DOMAIN $data['edit_record'] = $record; // Specify the record to be EDITTED $data['editpriority'] = $priority; // Specify the PRIORITY $data['editdestination'] = $destination; // Specify DESTINATION $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Delete MX record * * @category Email Server * @param string $domain Domain for the MX Record delete * @param string $record Record no of the Entry * @return string $resp Response of Actions. Default: Serialize */ function delete_mx_entry($domain, $record){ $act = 'act=mxentry'; $data['domain_name'] = $domain; $data['delete_record'] = $record; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Set Default * * @category Server * @param string $service Set the Default Service - php53/php54/nginx/httpd * @return string $resp Response of Actions. Default: Serialize */ function set_defaults($service){ $act = 'act=service_manager'; $php = array('php53', 'php54', 'php55'); $server = array('httpd', 'nginx', 'lighttpd'); if(in_array($service, $php)){ $data['default_php'] = $service; } if(in_array($service, $server)){ $data['webserver'] = $service; } $data['service_manager'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } ////////////////////////////////////////////////////////////////////////// // CATEGORY : Server Info // ////////////////////////////////////////////////////////////////////////// /** * Show Error Log * * @category Server Info * @param string $domain Domain for the error log (Opional) * @return string $resp Response of Actions. Default: Serialize */ function show_error_log($domain = ''){ $act = 'act=errorlog'; if(empty($domain)){ $data['domain_log'] = 'error_log'; }else{ $data['domain_log'] = $domain .'.err'; } $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Enable / Disable PHP Extensions * * @category Configuration * @param string (Optional) $extensions Extensions to enable (Empty results in list of Extensions and their status) * @return array $resp Response of Action. Default: Serialize */ function handle_php_ext($extensions = ''){ $act = 'act=php_ext'; if(!empty($extensions)){ $data['extensions'] = $extensions; $data['save_ext'] = 1; } $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Networking Tools * * @category DNS * @param string (Optional) $action Lookup by default (Available options are 'lookup' & 'traceroute') * @return array $resp Response of Action. Default: Serialize */ function dns_lookup($domain, $action = 'lookup'){ $act = 'act=network_tools'; $data['action'] = $action; $data['domain_name'] = $domain; $data['domain_lookup'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /** * Prints result * * @category Debug * @param Array $data * @return array */ function r_print($data){ echo '
'; print_r($data); echo ''; } /** * Set Bandwidth Limit * * @category Bandwidth * @param string $total_bandwidth Set your total available bandwidth in GB(Set 0 for unlimited) * @param string $bandwiwdth_email_alert Email alert limit value in GB * @return string $resp Response of Actions. Default: Serialize */ function set_bandwidth($total_bandwidth = '', $bandwidth_email_alert = ''){ $act = 'act=bandwidth'; $data['bandwidth_up_limit'] = $total_bandwidth; // Specify the total bandwidth in GB $data['bandwidth_limit'] = $bandwidth_email_alert; // Specify the email alert limit in GB $data['bandwidth_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * Reset Bandwidth Limit * * @category Bandwidth * @return string $resp Response of Actions. Default: Serialize */ function reset_bandwidth(){ $act = 'act=bandwidth'; $data['bandwidth_reset'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /** * List Login Logs * * @category Login * @return string $resp Response of Actions. Default: Serialize */ function list_login_logs(){ $act = 'act=login_logs'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * Delete all Login Logs * * @category Login * @return string $resp Response of Actions. Default: Serialize */ function delete_login_logs(){ $act = 'act=login_logs&delete_all=1'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /** * List Protected Users * * @category Apache * @return Array $resp Response of Actions. Default: Serialize */ function list_protected_users(){ $act = 'act=pass_protect_dir'; $resp = $this->curl_call($act); $this->chk_error(); return $resp; } /* * ---------------------------------- * Password Protect Directory * ---------------------------------- * * @category Apache * @param String $path - Path to the directory to be password protected * @param String $uname - User to be added for the directory * @param String $pass - Password to the user for the directory * @param String [OPTIONAL] $name - Alias Name for the directory. * @return Boolean * @version 2.2.0 * */ function add_pass_protect_dir($path, $uname, $pass, $name = ''){ $act = 'act=pass_protect_dir'; $data['dir_path'] = $path; // Path to password protect (No leading slashes) $data['username'] = $uname; // Alphanumeric Username $data['password'] = $data['re_password'] = $pass; // Password should not be less than 5 characters if(!empty($name)){ // Alias name $data['dir_name'] = $name; } $data['add_pass_protect'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /* * ------------------------------------------- * Delete Password Protected Directory User * ------------------------------------------- * * @category Apache * @param String $uname - User to be deleted * @param String $path - Path to the password protected directory * @return Boolean * @version 2.2.0 * */ function delete_pass_protected_user($uname, $path){ $act = 'act=pass_protect_dir'; $data['delete_record'] = $uname; $data['path'] = $path; $resp = $this->curl_call($act, $data); $this->chk_error(); return trim($resp); } /* * ------------------------------------------- * Read extra configuration file path * ------------------------------------------- * * @category Configuration * @param String $domain Domain for the extra path * @return array * @version 2.2.6 * */ function read_extra_conf($domain){ $act = 'act=extra_conf'; $data['domain'] = $domain; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /* * ------------------------------------------- * Add extra configuration file path * ------------------------------------------- * * @category Configuration * @param String $domain Domain for the extra path * @param String $path Path of your extra conf * @param String $webserver Webserver ID for whic you want to add, you will get it from w_list array key * @return string $resp Response of Actions. Default: Serialize * @version 2.2.6 * */ function add_extra_conf($domain, $path, $webserver){ $act = 'act=extra_conf'; $data['selectdomain'] = $domain; $data['selectweb'] = $webserver; $data['destination'] = $path; $data['create_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /* * ------------------------------------------- * Delete extra configuration file path * ------------------------------------------- * * @category Configuration * @param String $domain Domain for the extra path * @param String $path Path of your extra conf * @param String $webserver Webserver ID for whic you want to delete, you will get it from w_list array key * @return string $resp Response of Actions. Default: Serialize * @version 2.2.6 * */ function delete_extra_conf($domain, $path, $webserver){ $act = 'act=extra_conf'; $data['domain_name'] = $domain; $data['editwebserver'] = $webserver; $data['editdestination'] = $path; $data['delete_record'] = 1; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } /* * ------------------------------------------- * Edit extra configuration file path * ------------------------------------------- * * @category Configuration * @param String $domain Domain for the extra path * @param String $path Path of your extra conf * @param String $webserver Webserver ID for whic you want to delete, you will get it from w_list array key * @param String $id $id ID of the cron record. Get from the list of extra conf * @return string $resp Response of Actions. Default: Serialize * @version 2.2.6 * */ function edit_extra_conf($domain, $path, $webserver, $id){ $act = 'act=extra_conf'; $data['domain_name'] = $domain; $data['editwebserver'] = $webserver; $data['editdestination'] = $path; $data['edit_record'] = 'c'.$id; $resp = $this->curl_call($act, $data); $this->chk_error(); return $resp; } } ////////////////////////////////////////////////////////////////////// // EXAMPLES // ////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // CATEGORY : FEATURES // /////////////////////////////////////////////////////////////////////////////// //////////////////////////// // List Domain // //////////////////////////// /* $test = new Webuzo_API($webuzo_user, $webuzo_password, $host); // Get the list of domains $res = unserialize($test->list_domains()); // Done/Error if(empty($res['error'])){ $test->r_print($res); }else{ echo 'Error while listing domain