Current File : //root/panel/modules/weebly/code/controller.ext.php
<?php

/**
 * @copyright 2014-2015 Sentora Project (http://www.sentora.org/) 
 * Sentora is a GPL fork of the ZPanel Project whose original header follows:
 *
 * ZPanel - A Cross-Platform Open-Source Web Hosting Control panel.
 *
 * @package ZPanel
 * @version $Id$
 * @author Bobby Allen - ballen@bobbyallen.me
 * @copyright (c) 2008-2014 ZPanel Group - http://www.zpanelcp.com/
 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License v3
 *
 * This program (ZPanel) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
 

 
class module_controller extends ctrl_module
{
	static $complete;
    static $error;
    static $writeerror;
    static $nosub;
    static $alreadyexists;
    static $badname;
    static $blank;
    static $ok;
	static $del;
	static $validemail;
    static $badpointing;
	static $httpcodeerror;
	static $create;
	static $weeblyid;
	static $weeblysiteid;
	static $weeblysitefail;
	
     static function get_client_ip() 
	 {
		$ipaddress = '';
		if (getenv('HTTP_CLIENT_IP'))
		$ipaddress = getenv('HTTP_CLIENT_IP');
		else if(getenv('HTTP_X_FORWARDED_FOR'))
		$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
		else if(getenv('HTTP_X_FORWARDED'))
		$ipaddress = getenv('HTTP_X_FORWARDED');
		else if(getenv('HTTP_FORWARDED_FOR'))
		$ipaddress = getenv('HTTP_FORWARDED_FOR');
		else if(getenv('HTTP_FORWARDED'))
		$ipaddress = getenv('HTTP_FORWARDED');
		else if(getenv('REMOTE_ADDR'))
		$ipaddress = getenv('REMOTE_ADDR');
		else
		$ipaddress = 'UNKNOWN';
		return $ipaddress;
	}
	
	static function getWeeblyList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListWeeblyList($currentuser['userid']);
    }
	
	static public function ListWeeblyList()
    {
		global $zdbh;
		global $controller;	
		$currentuser = ctrl_users::GetUserDetail();
        $sql = "SELECT * FROM x_weebly_user WHERE vh_acc_fk=:userid AND w_deleted_ts IS NULL";
        $numrows = $zdbh->prepare($sql);
        $numrows->bindParam(':userid', $currentuser['userid']);
        $numrows->execute();
        if ($numrows->fetchColumn() <> 0) {
            $sql = $zdbh->prepare($sql);
            $sql->bindParam(':userid', $currentuser['userid']);
            $res = array();
            $sql->execute();
            while ($rowmailboxes = $sql->fetch()) {
           
	                $res[] = array('domain' => $rowmailboxes['w_domain'],
                    'weeblyid' => $rowmailboxes['w_id']);
            }
            return $res;
        } else {
            return false;
        }
    }
	
	static function getCreatedDomain()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListDomain($currentuser['userid']);
    }
	
	static function gethelpicon()
	{
		global $zdbh;
		global $controller;
		$temp=$controller->GetControllerRequest('URL','module') ;
		$val = '/assets/one.txt';
		$val1 = '/modules/';
		$name=file_get_contents("modules/$temp/assets/helpicon.txt");
		return $name;
	}
	
	static function getCurrentID()
    {
        global $controller;
        $id = $controller->GetControllerRequest('URL', 'id');
        return ($id) ? $id : '';
    }

    static function getCurrentDomain()
    {
        global $controller;
        $domain = $controller->GetControllerRequest('URL', 'domain');
        return ($domain) ? $domain : '';
    }
	
	
	
	static function doWeeblyButtonDisable()
    {
	
		global $controller;
		if (isset($_POST['dom_detail'])) {
            if (self::ExecuteWeeblyButtonDisable($_POST['dom_detail'])) {
                self::$ok = TRUE;
                return true;
            }
			else {
            return false;
        }
        }
		
        return;
	}
	
	static function ExecuteWeeblyButtonDisable($domain)
    {
        global $zdbh;
        $retval = TRUE;
		$sql = $zdbh->prepare("SELECT * FROM x_weebly_user WHERE w_domain=:domain");
		$sql->bindParam(':domain', $domain);
		$sql->execute();
		$row = $sql->fetch();
		$weebly_status = $row['w_created_ts'];
		echo $w_created_ts;
		exit;
	}
	
	static function doCreateLink()
    {
		global $controller;
		if (isset($_POST['w_id'])) {
            if (self::ExecuteCreateLink($_POST['w_id'])) {
                self::$ok = TRUE;
                return true;
            }
			else {
				return false;
			}
        }
        return;
	}
	
	static function ExecuteCreateLink($wid)
    {
		global $zdbh;
		global $controller;
        $retval = FALSE;
		$sql_link = $zdbh->prepare("SELECT * FROM x_weebly_user WHERE w_id=:wid and w_ip_deleted IS NULL");
		$sql_link->bindParam(':wid', $wid);
		$sql_link->execute();
		$row_link = $sql_link->fetch();
		$user_id = $row_link['w_user_id'];
		$site_id = $row_link['w_site_id'];
		$base_api = "https://api.weeblycloud.com/";
		$api_key = '88wj02if3u7freangnqgd8r6ore9dk6k';
		$api_secret = 'bkwcaz4l2t0hw3541dm88zh8zss4n3e1a1cck8gatnjaynhem3uocnfuccbolwhb';
		$plnid = 9;
		$request_type = "POST";
		$url = "user/$user_id/site/$site_id/loginLink";
		$hash = hash_hmac('SHA256', $request_type . "\n" . $url . "\n", $api_secret);
		$hash = base64_encode($hash);

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $base_api.$url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_type);
	   // curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
					'Content-type: application/json',
					'X-Public-Key: ' . $api_key,
					'X-Signed-Request-Hash: ' . $hash
				));

		$out = curl_exec($ch);
		$info = curl_getinfo($ch);
		//print_r($link);
		curl_close($ch);
		$resultl = json_decode($out);
		$link = $resultl->link;
		header("Location: $link");
	}
	
    static function doCreateWeebly()
    {
		global $controller;
		if (isset($_POST['inDomain'])) {
            if (self::ExecuteCreateWeebly($_POST['inDomain'])) {
                self::$ok = TRUE;
                return true;
            }
			else {
            return false;
        }
        }
        return;
	}
	
	static function ExecuteCreateWeebly($domain)
    {
		
        global $zdbh;
		global $controller;
        $retval = FALSE; 
		$currentuser = ctrl_users::GetUserDetail();
		
		if (!fs_director::CheckForEmptyValue(self::CheckCreateForErrors($domain))) {
		
		$sql1 = $zdbh->prepare("select * from x_accounts where ac_deleted_ts IS NULL and ac_id_pk IN (select vh_acc_fk from x_vhosts where vh_name_vc=:domain and vh_deleted_ts IS NULL)");
		$sql1->bindParam(':domain', $domain);
		$sql1->execute();
		$row_set = $sql1->fetch();
		$created_user_id = $row_set['ac_id_pk'];
		$username = $row_set['ac_user_vc'];
		
		$we_en = $zdbh->prepare("SELECT COUNT(*) FROM x_ftpaccounts WHERE ft_user_vc=:uname AND ft_deleted_ts IS NULL");
		$we_en->bindParam(':uname', $username);
		$we_en->execute();
		$count = $we_en->fetchColumn();
			
		if($count != 0)
		{
			$we_us = $zdbh->prepare("select * from x_ftpaccounts where ft_user_vc=:uname AND ft_deleted_ts IS NULL");
			$we_us->bindParam(':uname', $username);
			$we_us->execute();
			$row_ftp = $we_us->fetch();
			$ftp_user = $row_ftp['ft_user_vc'];
			$ftp_pass = $row_ftp['ft_password_vc'];
			
			$we_dir = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL");
			$we_dir->bindParam(':domain', $domain);
			$we_dir->execute();
			$row_ftp_dir = $we_dir->fetch();
			$ftp_dir = $row_ftp_dir['vh_directory_vc'];
			if($ftp_dir == "/")
			{
				$homedir = "/public_html". $ftp_dir;
			}
			else
			{
				$homedir = "/public_html". $ftp_dir ."/";
			}
		}
		else
		{
			$password = self::RandomPassword();
			$currentuser = ctrl_users::GetUserDetail($uid);
			runtime_hook::Execute('OnBeforeCreateFTPAccount');
			$access_type = 'RW';
			$homedirectory_to_use = '/';
			$userId = $currentuser['userid'];
			$sql = $zdbh->prepare("INSERT INTO x_ftpaccounts (ft_acc_fk, ft_user_vc, ft_directory_vc, ft_access_vc, ft_password_vc, ft_created_ts) VALUES (:userid, :username, :homedir, :accesstype, :password, :time)");
			$sql->bindParam(':userid', $created_user_id);
			$sql->bindParam(':username', $username);
			$sql->bindParam(':homedir', $homedirectory_to_use);
			$sql->bindParam(':accesstype', $access_type);
			$sql->bindParam(':password', $password);
			$sql->bindParam(':time', time());
			$sql->execute();
			self::$create = true;
			
			// Include FTP server specific file here.
			$ftp_db = ctrl_options::GetSystemOption('ftp_db');
			include('cnf/db.php');
			$z_db_user = $user;
			$z_db_pass = $pass;
			try {
				$ftp_db = new db_driver("mysql:host=" . $host . ";dbname=$ftp_db", $z_db_user, $z_db_pass);
			} catch (PDOException $e) {

			}
			// Included after acount has been created
			$we_dir = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL");
			$we_dir->bindParam(':domain', $domain);
			$we_dir->execute();
			$row_ftp_dir = $we_dir->fetch();
			$ftp_dir = $row_ftp_dir['vh_directory_vc'];
			$homedir = ctrl_options::GetSystemOption('hosted_dir') . $username . "/";
				
			$sql = $ftp_db->prepare("INSERT INTO ftpquotalimits (name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail) VALUES (:username, 'user', 'true', 'hard', 0, 0, 0, 0, 0, 0);");
			$sql->bindParam(':username', $username);
			$sql->execute();
			$sql = $ftp_db->prepare("INSERT INTO ftpuser (id, userid, passwd, homedir, shell, count, accessed, modified) VALUES ('', :username, :password, :homedir, '/sbin/nologin', 0, '', '');");
			$sql->bindParam(':username', $username);
			$sql->bindParam(':password', $password);
			$sql->bindParam(':homedir', $homedir);
			$sql->execute();
			runtime_hook::Execute('OnAfterCreateFTPAccount');
				
			$we_us = $zdbh->prepare("select * from x_ftpaccounts where ft_user_vc=:uname AND ft_deleted_ts IS NULL");
			$we_us->bindParam(':uname', $username);
			$we_us->execute();
			$row_ftp = $we_us->fetch();
			$ftp_user = $row_ftp['ft_user_vc'];
			$ftp_pass = $row_ftp['ft_password_vc'];
			
			$we_dir = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL");
			$we_dir->bindParam(':domain', $domain);
			$we_dir->execute();
			$row_ftp_dir = $we_dir->fetch();
			$ftp_dir = $row_ftp_dir['vh_directory_vc'];
			if($ftp_dir == "/")
			{
				$homedir = "/public_html". $ftp_dir;
			}
			else
			{
				$homedir = "/public_html". $ftp_dir ."/";
			}
		}
		$date = date("Y-m-d h:i:sa");
		$myfile = fopen("/etc/sentora/panel/modules/weebly/code/weebly.log", "w");
		$txt = "Weebly log for $domain $date Start \n";
		$we_user = $zdbh->prepare("SELECT * FROM x_weebly");
		$we_user->execute();
		$row_user = $we_user->fetch();
		$user_id = $row_user['we_user_id'];
		$txt .= "Weebly user_id $user_id \n";
		
		if($user_id != "")
		{
			$base_api = "https://api.weeblycloud.com/";
			$api_key = '88wj02if3u7freangnqgd8r6ore9dk6k';
			$api_secret = 'bkwcaz4l2t0hw3541dm88zh8zss4n3e1a1cck8gatnjaynhem3uocnfuccbolwhb';
			$plnid = 9;
			$request_type = "POST";
			/**** CREATE SITE for particular user  *****/
			$url = "user/$user_id/site";
			$data = array( "domain" => "$domain", "plan_id" => "$plnid", "site_title" => "$domain");

			$content = json_encode($data);
			$hash = hash_hmac('SHA256', $request_type . "\n" . $url . "\n" . $content, $api_secret);
			$hash = base64_encode($hash);

			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $base_api.$url);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_type);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
			curl_setopt($ch, CURLOPT_HTTPHEADER, array(
					'Content-type: application/json',
					'X-Public-Key: ' . $api_key,
					'X-Signed-Request-Hash: ' . $hash
			));

			$out = curl_exec($ch);
			$info = curl_getinfo($ch);
			curl_close($ch);
			$result = json_decode($out);
			$site_id = $result->site->site_id;
			$txt .= "Weebly site_id $site_id \n";
			$txt .= "Weebly ftp_user $ftp_user ftp_pass $ftp_pass homedir $homedir \n";
			if($site_id != "")
			{
				$host = ctrl_options::GetSystemOption('server_ip');
				/**** Update FTp details *****/
				$url = "user/$user_id/site/$site_id/setPublishCredentials";
				$data = array(
								"publish_host" => "$host",
								"publish_username" => "$ftp_user",
								"publish_password" => "$ftp_pass",
								"publish_path" => "$homedir"
				);

				$content = json_encode($data);
				$hash = hash_hmac('SHA256', $request_type . "\n" . $url . "\n" . $content, $api_secret);
				$hash = base64_encode($hash);

				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, $base_api.$url);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_type);
				curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
				curl_setopt($ch, CURLOPT_HTTPHEADER, array(
								'Content-type: application/json',
								'X-Public-Key: ' . $api_key,
								'X-Signed-Request-Hash: ' . $hash
				));
				$out = curl_exec($ch);
				$info = curl_getinfo($ch);
				curl_close($ch);
				$ftpaccess = 1;
				$sitcre = 1;
				$resultw = json_decode($out);
				$res = $resultw->success;
				$txt .= "Weebly result $res \n";
				if($res == 1)
				{
					$url = "user/$user_id/site/$site_id/loginLink";

					$hash = hash_hmac('SHA256', $request_type . "\n" . $url . "\n", $api_secret);
					$hash = base64_encode($hash);

					$ch = curl_init();
					curl_setopt($ch, CURLOPT_URL, $base_api.$url);
					curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
					curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request_type);
				   // curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
					curl_setopt($ch, CURLOPT_HTTPHEADER, array(
								'Content-type: application/json',
								'X-Public-Key: ' . $api_key,
								'X-Signed-Request-Hash: ' . $hash
							));

					$out = curl_exec($ch);
					$info = curl_getinfo($ch);
					//print_r($link);
					curl_close($ch);

					$resultl = json_decode($out);
					$link = $resultl->link;
					$txt .= "Weebly Link $link \n";
					$txt .= ".....Weebly Log $created_user_id End..... \n";
					fwrite($myfile, $txt);
					fclose($myfile);
					
					$wee_user = $zdbh->prepare("INSERT INTO x_weebly_user (vh_acc_fk,w_user_id,w_site_id,w_domain,w_link,w_ftp_user,w_ftp_pass,w_ftp_dir,w_created_ts) VALUES (:userid,:user_id, :site_id, :domain, :link, :ftp_user, :ftp_pass, :ftp_dir, :time)");
					$wee_user->bindParam(':userid', $created_user_id);
					$wee_user->bindParam(':user_id', $user_id);
					$wee_user->bindParam(':site_id', $site_id);
					$wee_user->bindParam(':domain', $domain);
					$wee_user->bindParam(':link', $link);
					$wee_user->bindParam(':ftp_user', $ftp_user);
					$wee_user->bindParam(':ftp_pass', $ftp_pass);
					$wee_user->bindParam(':ftp_dir', $homedir);
					$wee_user->bindParam(':time', time());
					$wee_user->execute();
					
				}
				else
				{
					self::$weeblysitefail = TRUE;
					return FALSE;
				}
			}
			else {
				self::$weeblysiteid = TRUE;
				return FALSE;
			}
		}
		else
		{
			self::$weeblyid = TRUE;
            return FALSE;
		}
			
            $retval = TRUE;
			//exit;
			return $retval;
		} 
    }
	
	static function RandomPassword()
    {
        $minpasswordlength = ctrl_options::GetSystemOption('password_minlength');
        $trylength = 9;
        if ($trylength < $minpasswordlength) {
            $uselength = $minpasswordlength;
        } else {
            $uselength = $trylength;
        }
        $password = fs_director::GenerateRandomPassword($uselength, 4);
        return $password;
    }

	static function CheckCreateForErrors($domain)
    {
	
        global $zdbh;
        global $controller;
        // Check for spaces and remove if found...
		
        $domain = strtolower(str_replace(' ', '', $domain));
        // Check to make sure the domain is not blank before we go any further...
        if ($domain == '') {
            self::$blank = TRUE;
            return FALSE;
        }
        // Check for invalid characters in the domain...
        if (!self::IsValidDomainName($domain)) {
            self::$badname = TRUE;
            return FALSE;
        }
        // Check to make sure the domain is in the correct format before we go any further...
        if (strpos($domain, 'www.') === 0) {
            self::$error = TRUE;
            return FALSE;
        }
		
		/*$server_ip = ctrl_options::GetSystemOption('server_ip');
		$recordresult = dns_get_record($domain , DNS_A);
		if(empty($recordresult))
		{
			return TRUE;
			echo "BADPOINTING";
			exit;
		}
		foreach($recordresult as $keys=>$values)
		{
			if(trim($values['ip']) != trim($server_ip))
			{ 
		return TRUE;
				echo "BADPOINTING";
				exit;
			}
		}
		
				

				 $ch = curl_init();
				// set url 
				curl_setopt($ch, CURLOPT_URL, $domain);
				//return the transfer as a string 
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				// $output contains the output string 
				$output = curl_exec($ch);
				$http_code = curl_getinfo ($ch, CURLINFO_HTTP_CODE) ;
				if($http_code!=200)
				{
						echo "HTTPCODEERR";
						exit;
				}

		  		*/
			$sock_err=0;
			$service_port = 4444 ;
			$address = gethostbyname('localhost');
			$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
			if ($socket === false) {
			echo "SOCKETERR";
			$sock_err=1;
			} 
			$result = socket_connect($socket, $address, $service_port);
			if ($result === false) {
			echo "SOCKETERR";
			$sock_err=1;
			}
			socket_close($socket);
			if($sock_err==1)
			exit;
			
        // Check to see if the domain already exists in Sentora somewhere and redirect if it does....
        $sql = "SELECT COUNT(*) FROM x_vhosts WHERE vh_name_vc=:domain AND vh_deleted_ts IS NULL";
        $numrows = $zdbh->prepare($sql);
        $numrows->bindParam(':domain', $domain);

        if ($numrows->execute()) {
            if ($numrows->fetchColumn() == 0) {
                self::$alreadyexists = TRUE;
                return FALSE;
            }
        }
        return TRUE;
    }
	
	static function IsValidEmail($email)
    {
        return preg_match('/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i', $email) == 1;
    }
	
	static function IsValidDomainName($a)
    {
        if (stristr($a, '.')) {
            $part = explode(".", $a);
            foreach ($part as $check) {
                if (!preg_match('/^[a-z\d][a-z\d-]{0,62}$/i', $check) || preg_match('/-$/', $check)) {
                    return false;
                }
            }
        } else {
            return false;
        }
        return true;
    }
	
	
    static function ListDomains($uid)
    {
        global $zdbh;
        $currentuser = ctrl_users::GetUserDetail($uid);
        $sql = "SELECT * FROM x_vhosts WHERE vh_acc_fk=:userid AND vh_enabled_in=1 AND vh_deleted_ts IS NULL AND vh_name_vc NOT IN (select w_domain from x_weebly_user where vh_acc_fk=:userid and w_deleted_ts is null) ORDER BY vh_name_vc ASC";
        
        $numrows = $zdbh->prepare($sql);
        $numrows->bindParam(':userid', $currentuser['userid']);
        $numrows->execute();
		$domaincount = $numrows->fetchColumn();
        if ($domaincount > 0) {
            $sql = $zdbh->prepare($sql);
            $sql->bindParam(':userid', $currentuser['userid']);
            $res = array();
            $sql->execute();
            while ($rowdomains = $sql->fetch()) {
                $res[] = array('domain' => ui_language::translate($rowdomains['vh_name_vc']));
            }
            return $res;
        } else {
            return false;
        }
    }
	
	
    static function getDomainList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListDomains($currentuser['userid']);
    }
	
	static function getEmailList()
    {
        $currentuser = ctrl_users::GetUserDetail();
		return $currentuser['email'];
       // return self::ListEmail($currentuser['userid']);
    }
	
    
    static function getQuotaLimit()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return ($currentuser['mailboxquota'] < 0) or //-1 = unlimited
                ($currentuser['mailboxquota'] > ctrl_users::GetQuotaUsages('mailboxes', $currentuser['userid']));
    }

    
	static function getResult()
    {
        if (!fs_director::CheckForEmptyValue(self::$blank)) {
            return ui_sysmessage::shout(ui_language::translate("Your Domain can not be empty. Please enter a valid Domain Name and try again."), "zannounceerror");
        }
        if (!fs_director::CheckForEmptyValue(self::$badname)) {
            return ui_sysmessage::shout(ui_language::translate("Your Domain name is not valid. Please enter a valid Domain Name: i.e. 'domain.com'"), "zannounceerror");
        }
        if (!fs_director::CheckForEmptyValue(self::$badpointing)) {
            return ui_sysmessage::shout(ui_language::translate("Your Domain name is not pointing to the IP"), "zannounceerror");
        }
        if (!fs_director::CheckForEmptyValue(self::$alreadyexists)) {
            return ui_sysmessage::shout(ui_language::translate("Your Domain name is not registred on this server."), "zannounceerror");
        }
        if (!fs_director::CheckForEmptyValue(self::$error)) {
            return ui_sysmessage::shout(ui_language::translate("Please remove 'www'. The 'www' will automatically work with all Domains / Subdomains."), "zannounceerror");
        }
		if (!fs_director::CheckForEmptyValue(self::$weeblyid)) {
            return ui_sysmessage::shout(ui_language::translate("Weebly ID miss, Not able to add site on weebly. Contact Hostingraja Support."), "zannounceerror");
        }
		if (!fs_director::CheckForEmptyValue(self::$weeblysiteid)) {
            return ui_sysmessage::shout(ui_language::translate("Weebly SiteID miss, Not able to add site on weebly. Contact Hostingraja Support."), "zannounceerror");
        }
		if (!fs_director::CheckForEmptyValue(self::$weeblysitefail)) {
            return ui_sysmessage::shout(ui_language::translate("Not able to add site on weebly. Contact Hostingraja Support."), "zannounceerror");
        }
        if (!fs_director::CheckForEmptyValue(self::$ok)) {
            return ui_sysmessage::shout(ui_language::translate("Weebly created successfully."), "zannounceok");
        }
		
        return "";
    }
 	
}