Esempio n. 1
0
 /**
  * Sends the email with the contents of the object (Body etc. set using the parant calls in phpMailer!)
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return boolean 
  */
 public function SendEmail()
 {
     $this->Mailer = ctrl_options::GetSystemOption('mailer_type');
     $this->From = ctrl_options::GetSystemOption('email_from_address');
     $this->FromName = ctrl_options::GetSystemOption('email_from_name');
     if (ctrl_options::GetSystemOption('email_smtp') != 'false') {
         $this->IsSMTP();
         if (ctrl_options::GetSystemOption('smtp_auth') != 'false') {
             $this->SMTPAuth = true;
             $this->Username = ctrl_options::GetSystemOption('smtp_username');
             $this->Password = ctrl_options::GetSystemOption('smtp_password');
         }
         if (ctrl_options::GetSystemOption('smtp_secure') != 'false') {
             $this->SMTPSecure = ctrl_options::GetSystemOption('smtp_secure');
         }
         $this->Host = ctrl_options::GetSystemOption('smtp_server');
         $this->Port = ctrl_options::GetSystemOption('smtp_port');
     }
     ob_start();
     $send_resault = $this->Send();
     $error = ob_get_contents();
     ob_clean();
     if ($send_resault) {
         runtime_hook::Execute('OnSuccessfulSendEmail');
         return true;
     } else {
         $logger = new debug_logger();
         $logger->method = ctrl_options::GetSystemOption('logmode');
         $logger->logcode = "061";
         $logger->detail = 'Error sending email (using sys_email): ' . $error . '';
         $logger->writeLog();
         runtime_hook::Execute('OnFailedSendEmail');
         return false;
     }
 }
Esempio n. 2
0
 /**
  * Checks that the Server API given in the webservice request XML is valid and matches the one stored in the x_settings table.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return boolean
  */
 public function CheckServerAPIKey()
 {
     if ($this->wsdataarray['apikey'] != ctrl_options::GetSystemOption('apikey')) {
         runtime_hook::Execute('OnBadAPIKeyAuth');
         return false;
     } else {
         runtime_hook::Execute('OnGoodAPIKeyAuth');
         return true;
     }
 }
 /**
  * Runs though the functions array and loads the relivent function compiler
  * @author Sam Mottley (smottley@sentora.org)
  */
 static function CompileFunctions($data)
 {
     $temp = $data;
     runtime_hook::Execute('OnBeforeTemplateProcessor');
     foreach (ui_templateparser::$Functions as $Tag => $pattern) {
         $temp = call_user_func_array('ui_templateparser::Compile' . $Tag, array($pattern, $temp));
     }
     runtime_hook::Execute('OnAfterTemplateProcessor');
     return $temp;
 }
Esempio n. 4
0
 /**
  * Reports on whether a TCP or UDP port is listening for connections.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param int $port The port number of which to check (eg. 25 for SMTP).
  * @param boolean $udp Port is a UDP port as opposed to a TCP port.
  * @return boolean 
  * @change P.Peyremorte
  * - added port close if open successes
  */
 static function PortStatus($port, $udp = false)
 {
     $timeout = ctrl_options::GetSystemOption('servicechk_to');
     $ip = $udp ? 'udp://' . $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_ADDR'];
     $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
     if (!$fp) {
         runtime_hook::Execute('OnPortStatusDown');
         return false;
     }
     fclose($fp);
     runtime_hook::Execute('OnPortStatusUp');
     return true;
 }
Esempio n. 5
0
 static function doUpdateAccountSettings()
 {
     global $zdbh;
     global $controller;
     runtime_csfr::Protect();
     $currentuser = ctrl_users::GetUserDetail();
     $userid = $currentuser['userid'];
     $email = $controller->GetControllerRequest('FORM', 'inEmail');
     $fullname = $controller->GetControllerRequest('FORM', 'inFullname');
     $language = $controller->GetControllerRequest('FORM', 'inLanguage');
     $phone = $controller->GetControllerRequest('FORM', 'inPhone');
     $address = $controller->GetControllerRequest('FORM', 'inAddress');
     $postalCode = $controller->GetControllerRequest('FORM', 'inPostalCode');
     if (!fs_director::CheckForEmptyValue(self::ExecuteUpdateAccountSettings($userid, $email, $fullname, $language, $phone, $address, $postalCode))) {
         runtime_hook::Execute('OnAfterUpdateMyAccount');
         self::$ok = true;
     }
 }
 /**
  * Reports on whether a TCP or UDP port is listening for connections.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param int $port The port number of which to check (eg. 25 for SMTP).
  * @param boolean $udp Port is a UDP port as opposed to a TCP port.
  * @return boolean 
  */
 static function PortStatus($port, $udp = false)
 {
     $timeout = ctrl_options::GetSystemOption('servicechk_to');
     if ($udp) {
         $ip = 'udp://' . $_SERVER['SERVER_ADDR'];
     } else {
         $ip = $_SERVER['SERVER_ADDR'];
     }
     $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
     if (!$fp) {
         runtime_hook::Execute('OnPortStatusDown');
         $retval = false;
     } else {
         runtime_hook::Execute('OnPortStatusUp');
         $retval = true;
     }
     return $retval;
 }
Esempio n. 7
0
 /**
  * The main 'setter' class used to write/update system options.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @global db_driver $zdbh The ZPX database handle.
  * @param string $name The name of the system option (eg. zpanel_root)
  * @param string $value The value to set.
  * @param bool $create Instead of update the system option, create it instead?
  * @return bool
  */
 static function SetSystemOption($name, $value, $create = false)
 {
     global $zdbh;
     if ($create == false) {
         $bindArray = array(':name' => $name, ':value' => $value);
         if ($zdbh->bindQuery("UPDATE x_settings SET so_value_tx = :value WHERE so_name_vc = :name", $bindArray)) {
             return true;
         } else {
             return false;
         }
     } else {
         $bindArray = array(':name' => $name, ':value' => $value);
         if ($zdbh->bindQuery("INSERT INTO x_settings (so_name_vc, so_value_tx) VALUES (:name, :value)", $bindArray)) {
             return true;
         } else {
             return false;
         }
     }
     runtime_hook::Execute('OnSetSystemOption');
 }
Esempio n. 8
0
 /**
  * Writes the log infomation out to a predefined logging medium (from $this->method)
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @global db_driver $zdbh The ZPX database handle.
  * @return boolean 
  */
 function writeLog()
 {
     global $zdbh;
     runtime_hook::Execute('OnWriteErrorLog');
     if ($this->method == "screen") {
         die($this->logcode . ' - ' . $this->detail);
     } elseif ($this->method == "file") {
         fs_filehandler::AddTextToFile(ctrl_options::GetSystemOption('logfile'), date('c') . ' - ' . $this->logcode . ' - ' . $this->detail, 1);
     } elseif ($this->method == "email") {
         $email_log = new sys_email();
         $email_log->Subject = "Sentora Error Log";
         $email_log->Body = "" . date('c') . ' - ' . $this->logcode . ' - ' . $this->detail . "";
         $email_log->AddAddress(ctrl_options::GetSystemOption('email_from_address'));
         $email_log->SendEmail();
     } elseif ($this->method == "db") {
         $statement = "INSERT INTO x_logs (lg_user_fk, lg_code_vc, lg_module_vc, lg_detail_tx, lg_stack_tx) VALUES (0, '" . $this->logcode . "', 'NA', '" . $this->detail . "', '" . $this->mextra . "')";
         if ($zdbh->exec($statement)) {
             $retval = true;
         } else {
             $retval = false;
         }
         try {
             $statement = "INSERT INTO x_logs (lg_user_fk, lg_code_vc, lg_module_vc, lg_detail_tx, lg_stack_tx, lg_when_ts) VALUES (0, '" . $this->logcode . "', 'NA', '" . $this->detail . "', '" . $this->mextra . "','" . time() . "')";
             if ($zdbh->exec($statement) > 0) {
                 $retval = true;
             } else {
                 $retval = false;
             }
         } catch (Exception $e) {
             $temp_log_obj->method = "text";
             $temp_log_obj->logcode = "012";
             $temp_log_obj->detail = "Unable to log infomation to the required place (in the database)";
             $temp_log_obj->mextra = $e;
             $temp_log_obj->writeLog();
         }
         return true;
     } else {
         echo $this->logcode . " - " . $this->detail . " - " . $this->mextra;
     }
     return;
 }
 /**
  * Show HTML Alert Messages
  * Jason Davis (jason.davis.fl@gmail.com)
  * @param string $message The message to output to the screen.
  * @param string $class The CSS class name to use on the DIV.
  * @param string $title An Optional Heading/Title Message
  * @param string $closeBtn Optional TRUE or FALSE to show a Close button or not
  *
  * @return string The generated HTML source code.
  */
 static function shout($message, $class = "zannounce", $title = '', $closeBtn = true)
 {
     // Convert Sentora CSS Class to Bootstrap Class
     switch ($class) {
         case 'zannounce':
         case 'zannounceinfo':
         case 'alert-info':
             $class = 'alert-info';
             break;
         case 'zannounceerror':
         case 'alert-error':
             $class = 'alert-danger';
             break;
         case 'zannouncesuccess':
         case 'alert-success':
         case 'zannounceok':
             $class = 'alert-success';
             break;
         case 'zannounceprimary':
         case 'alert-primary':
             $class = 'alert-primary';
             break;
         case 'notice':
             $class = 'alert-info notice-manager-alert hidden';
             break;
         default:
             $class = 'alert-info';
     }
     runtime_hook::Execute('OnBeforeSysMessageShout');
     $line = '<div class="alert alert-block ' . $class . '">';
     $heading = $title ? '<h4>' . $title . '</h4>' : '';
     $closeBtn = $closeBtn ? '<button type="button" class="close" data-dismiss="alert">×</button>' : '';
     $line .= $closeBtn . $heading . '<p>' . $message . '</p></div>';
     runtime_hook::Execute('OnAfterSysMessageShout');
     return $line;
 }
 static function ExecuteDeleteForwarder($fw_id_pk)
 {
     global $zdbh;
     global $controller;
     runtime_hook::Execute('OnBeforeDeleteForwarer');
     //$rowforwarder = $zdbh->query("SELECT * FROM x_forwarders WHERE fw_id_pk=" . $fw_id_pk . "")->fetch();
     $numrows = $zdbh->prepare("SELECT * FROM x_forwarders WHERE fw_id_pk=:fw_id_pk");
     $numrows->bindParam(':fw_id_pk', $fw_id_pk);
     $numrows->execute();
     $rowforwarder = $numrows->fetch();
     self::$delete = true;
     // Include mail server specific file here.
     $MailServerFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('mailserver_php');
     if (file_exists($MailServerFile)) {
         include $MailServerFile;
     }
     $sql = "UPDATE x_forwarders SET fw_deleted_ts=:time WHERE fw_id_pk=:fw_id_pk";
     $sql = $zdbh->prepare($sql);
     $sql->bindParam(':fw_id_pk', $fw_id_pk);
     $sql->bindParam(':time', time());
     $sql->execute();
     runtime_hook::Execute('OnAfterDeleteForwarder');
     self::$ok = true;
 }
Esempio n. 11
0
 static function ExecuteDeleteFTP($ft_id_pk, $uid)
 {
     global $zdbh;
     global $controller;
     // Verify if Current user can Edit FTP Account.
     $currentuser = ctrl_users::GetUserDetail($uid);
     $sql = "SELECT * FROM x_ftpaccounts WHERE ft_acc_fk=:userid AND ft_id_pk=:editedUsrID AND ft_deleted_ts IS NULL";
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':userid', $currentuser['userid']);
     $numrows->bindParam(':editedUsrID', $ft_id_pk);
     $numrows->execute();
     if ($numrows->rowCount() == 0) {
         return;
     }
     // Delete User
     runtime_hook::Execute('OnBeforeDeleteFTPAccount');
     $rowftpsql = "SELECT * FROM x_ftpaccounts WHERE ft_id_pk=:ftIdPk";
     $rowftpfind = $zdbh->prepare($rowftpsql);
     $rowftpfind->bindParam(':ftIdPk', $ft_id_pk);
     $rowftpfind->execute();
     $rowftp = $rowftpfind->fetch();
     $sql = $zdbh->prepare("UPDATE x_ftpaccounts SET ft_deleted_ts=:time WHERE ft_id_pk=:ftpid");
     $sql->bindParam(':ftpid', $ft_id_pk);
     $sql->bindParam(':time', $ft_id_pk);
     $sql->execute();
     self::$delete = true;
     // Include FTP server specific file here.
     $FtpModuleFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('ftp_php');
     if (file_exists($FtpModuleFile)) {
         include $FtpModuleFile;
     }
     $retval = TRUE;
     runtime_hook::Execute('OnAfterDeleteFTPAccount');
     return $retval;
 }
Esempio n. 12
0
 static function ExecuteUpdateClient($clientid, $package, $enabled, $group, $fullname, $email, $address, $post, $phone, $newpass)
 {
     global $zdbh;
     runtime_hook::Execute('OnBeforeUpdateClient');
     //convert package to numerical id if needed
     if (!is_numeric($package)) {
         $package = self::getPackageIdFix($package);
     }
     if ($enabled == 0) {
         runtime_hook::Execute('OnBeforeDisableClient');
     }
     if ($enabled == 1) {
         runtime_hook::Execute('OnBeforeEnableClient');
     }
     if ($newpass != "") {
         // Check for password length...
         if (strlen($newpass) < ctrl_options::GetSystemOption('password_minlength')) {
             self::$badpassword = true;
             return false;
         }
         $crypto = new runtime_hash();
         $crypto->SetPassword($newpass);
         $randomsalt = $crypto->RandomSalt();
         $crypto->SetSalt($randomsalt);
         $secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
         $sql = $zdbh->prepare("UPDATE x_accounts SET ac_pass_vc= :newpass, ac_passsalt_vc= :passsalt WHERE ac_id_pk= :clientid");
         $sql->bindParam(':clientid', $clientid);
         $sql->bindParam(':newpass', $secure_password);
         $sql->bindParam(':passsalt', $randomsalt);
         $sql->execute();
     }
     $sql = $zdbh->prepare("UPDATE x_accounts SET ac_email_vc= :email, ac_package_fk= :package, ac_enabled_in= :isenabled, ac_group_fk= :group WHERE ac_id_pk = :clientid");
     $sql->bindParam(':email', $email);
     $sql->bindParam(':package', $package);
     $sql->bindParam(':isenabled', $enabled);
     $sql->bindParam(':group', $group);
     $sql->bindParam(':clientid', $clientid);
     //$sql->bindParam(':accountid', $clientid);
     $sql->execute();
     $sql = $zdbh->prepare("UPDATE x_profiles SET ud_fullname_vc= :fullname, ud_group_fk= :group, ud_package_fk= :package, ud_address_tx= :address,ud_postcode_vc= :postcode, ud_phone_vc= :phone WHERE ud_user_fk=:accountid");
     $sql->bindParam(':fullname', $fullname);
     $sql->bindParam(':group', $group);
     $sql->bindParam(':package', $package);
     $sql->bindParam(':address', $address);
     $sql->bindParam(':postcode', $post);
     $sql->bindParam(':phone', $phone);
     $sql->bindParam(':accountid', $clientid);
     $sql->execute();
     if ($enabled == 0) {
         runtime_hook::Execute('OnAfterDisableClient');
     }
     if ($enabled == 1) {
         runtime_hook::Execute('OnAfterEnableClient');
     }
     runtime_hook::Execute('OnAfterUpdateClient');
     self::$ok = true;
     return true;
 }
Esempio n. 13
0
 /**
  * Displays Controller debug infomation (mainly for module development and debugging)
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @global string $script_memory The current amount of memory that the script it using.
  * @global int $starttime The microtime of when the script started executing.
  * @return string HTML output of the debug infomation.
  */
 public function OutputControllerDebug()
 {
     global $script_memory;
     global $starttime;
     if (isset($this->vars_get[0]['debug'])) {
         ob_start();
         var_dump($this->GetAllControllerRequests('URL'));
         $set_urls = ob_get_contents();
         ob_end_clean();
         ob_start();
         var_dump($this->GetAllControllerRequests('FORM'));
         $set_forms = ob_get_contents();
         ob_end_clean();
         ob_start();
         var_dump($this->GetAllControllerRequests('USER'));
         $set_sessions = ob_get_contents();
         ob_end_clean();
         ob_start();
         var_dump($this->GetAllControllerRequests('COOKIE'));
         $set_cookies = ob_get_contents();
         ob_end_clean();
         $classes_loaded = debug_execution::GetLoadedClasses();
         ob_start();
         print_r($classes_loaded);
         $classes_array = ob_get_contents();
         ob_end_clean();
         $sql_queries = debug_execution::GetSQLQueriesExecuted();
         ob_start();
         print_r($sql_queries);
         $sql_array = ob_get_contents();
         ob_end_clean();
         $mtime = microtime();
         $mtime = explode(" ", $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $endtime = $mtime;
         $totaltime = $endtime - $starttime;
         runtime_hook::Execute('OnDisplayRuntimeDebug');
         return "<h1>Controller Debug Mode</h1><strong>PHP Script Memory Usage:</strong> " . debug_execution::ScriptMemoryUsage($script_memory) . "<br><strong>Script Execution Time: </strong> " . $totaltime . "<br><br><strong>URL Variables set:</strong><br><pre>" . $set_urls . "</pre><strong>POST Variables set:</strong><br><pre>" . $set_forms . "</pre><strong>SESSION Variables set:</strong><br><pre>" . $set_sessions . "</pre><strong>COOKIE Variables set:</strong><br><pre>" . $set_cookies . "</pre><br><br><strong>Loaded classes (Total: " . count($classes_loaded) . "):</strong><pre>" . $classes_array . "</pre><br><br><strong>SQL queries executed (Total: " . count($sql_queries) . "):</strong><pre>" . $sql_array . "</pre>";
     } else {
         return false;
     }
 }
Esempio n. 14
0
 static function ExecuteCreateClient($uid, $username, $packageid, $groupid, $fullname, $email, $address, $post, $phone, $password, $sendemail, $emailsubject, $emailbody)
 {
     global $zdbh;
     // Check for spaces and remove if found...
     $username = strtolower(str_replace(' ', '', $username));
     $reseller = ctrl_users::GetUserDetail($uid);
     // Check for errors before we continue...
     if (fs_director::CheckForEmptyValue(self::CheckCreateForErrors($username, $packageid, $groupid, $email, $password))) {
         return false;
     }
     runtime_hook::Execute('OnBeforeCreateClient');
     $crypto = new runtime_hash();
     $crypto->SetPassword($password);
     $randomsalt = $crypto->RandomSalt();
     $crypto->SetSalt($randomsalt);
     $secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
     // No errors found, so we can add the user to the database...
     $sql = $zdbh->prepare("INSERT INTO x_accounts (ac_user_vc, ac_pass_vc, ac_passsalt_vc, ac_email_vc, ac_package_fk, ac_group_fk, ac_usertheme_vc, ac_usercss_vc, ac_reseller_fk, ac_created_ts) VALUES (\n            :username, :password, :passsalt, :email, :packageid, :groupid, :resellertheme, :resellercss, :uid, :time)");
     $sql->bindParam(':uid', $uid);
     $time = time();
     $sql->bindParam(':time', $time);
     $sql->bindParam(':username', $username);
     $sql->bindParam(':password', $secure_password);
     $sql->bindParam(':passsalt', $randomsalt);
     $sql->bindParam(':email', $email);
     $sql->bindParam(':packageid', $packageid);
     $sql->bindParam(':groupid', $groupid);
     $sql->bindParam(':resellertheme', $reseller['usertheme']);
     $sql->bindParam(':resellercss', $reseller['usercss']);
     $sql->execute();
     // Now lets pull back the client ID so that we can add their personal address details etc...
     //$client = $zdbh->query("SELECT * FROM x_accounts WHERE ac_reseller_fk=" . $uid . " ORDER BY ac_id_pk DESC")->Fetch();
     $numrows = $zdbh->prepare("SELECT * FROM x_accounts WHERE ac_reseller_fk=:uid ORDER BY ac_id_pk DESC");
     $numrows->bindParam(':uid', $uid);
     $numrows->execute();
     $client = $numrows->fetch();
     $sql = $zdbh->prepare("INSERT INTO x_profiles (ud_user_fk, ud_fullname_vc, ud_group_fk, ud_package_fk, ud_address_tx, ud_postcode_vc, ud_phone_vc, ud_created_ts) VALUES (:userid, :fullname, :packageid, :groupid, :address, :postcode, :phone, :time)");
     $sql->bindParam(':userid', $client['ac_id_pk']);
     $sql->bindParam(':fullname', $fullname);
     $sql->bindParam(':packageid', $packageid);
     $sql->bindParam(':groupid', $groupid);
     $sql->bindParam(':address', $address);
     $sql->bindParam(':postcode', $post);
     $sql->bindParam(':phone', $phone);
     $time = time();
     $sql->bindParam(':time', $time);
     $sql->execute();
     // Now we add an entry into the bandwidth table, for the user for the upcoming month.
     $sql = $zdbh->prepare("INSERT INTO x_bandwidth (bd_acc_fk, bd_month_in, bd_transamount_bi, bd_diskamount_bi) VALUES (:ac_id_pk, :date, 0, 0)");
     $date = date("Ym", time());
     $sql->bindParam(':date', $date);
     $sql->bindParam(':ac_id_pk', $client['ac_id_pk']);
     $sql->execute();
     // Lets create the client diectories
     fs_director::CreateDirectory(ctrl_options::GetSystemOption('hosted_dir') . $username);
     fs_director::SetFileSystemPermissions(ctrl_options::GetSystemOption('hosted_dir') . $username, 0777);
     fs_director::CreateDirectory(ctrl_options::GetSystemOption('hosted_dir') . $username . "/public_html");
     fs_director::SetFileSystemPermissions(ctrl_options::GetSystemOption('hosted_dir') . $username . "/public_html", 0777);
     fs_director::CreateDirectory(ctrl_options::GetSystemOption('hosted_dir') . $username . "/backups");
     fs_director::SetFileSystemPermissions(ctrl_options::GetSystemOption('hosted_dir') . $username . "/backups", 0777);
     // Send the user account details via. email (if requested)...
     if ($sendemail != 0) {
         if (isset($_SERVER['HTTPS'])) {
             $protocol = 'https://';
         } else {
             $protocol = 'http://';
         }
         $emailsubject = str_replace("{{username}}", $username, $emailsubject);
         $emailsubject = str_replace("{{password}}", $password, $emailsubject);
         $emailsubject = str_replace("{{fullname}}", $fullname, $emailsubject);
         $emailbody = str_replace("{{username}}", $username, $emailbody);
         $emailbody = str_replace("{{password}}", $password, $emailbody);
         $emailbody = str_replace("{{fullname}}", $fullname, $emailbody);
         $emailbody = str_replace('{{controlpanelurl}}', $protocol . ctrl_options::GetSystemOption('MADmin_domain'), $emailbody);
         $phpmailer = new sys_email();
         $phpmailer->Subject = $emailsubject;
         $phpmailer->Body = $emailbody;
         $phpmailer->AddAddress($email);
         $phpmailer->SendEmail();
     }
     runtime_hook::Execute('OnAfterCreateClient');
     self::$resetform = true;
     self::$ok = true;
     return true;
 }
 static function ExecuteResetPassword($myuserid, $password)
 {
     global $zdbh;
     runtime_hook::Execute('OnBeforeResetDatabasePassword');
     //$rowuser = $zdbh->query("SELECT * FROM x_mysql_users WHERE mu_id_pk=" . $myuserid . " AND mu_deleted_ts IS NULL")->fetch();
     $numrows = $zdbh->prepare("SELECT * FROM x_mysql_users WHERE mu_id_pk=:myuserid AND mu_deleted_ts IS NULL");
     $numrows->bindParam(':myuserid', $myuserid);
     $numrows->execute();
     $rowuser = $numrows->fetch();
     // If errors are found, then exit before resetting password...
     if (fs_director::CheckForEmptyValue(self::CheckPasswordForErrors($password))) {
         return false;
     }
     $sql = "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = :mu_name_vc)";
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':mu_name_vc', $rowuser['mu_name_vc']);
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             // Set MySQL password for new user...
             $sql = $zdbh->prepare("SET PASSWORD FOR :mu_name_vc@:mu_access_vc=PASSWORD(:password)");
             $sql->bindParam(':mu_name_vc', $rowuser['mu_name_vc']);
             $sql->bindParam(':mu_access_vc', $rowuser['mu_access_vc']);
             $sql->bindParam(':password', $password);
             $sql->execute();
             $sql = $zdbh->prepare("FLUSH PRIVILEGES");
             $sql->execute();
             $sql = $zdbh->prepare("UPDATE x_mysql_users SET mu_pass_vc=:password WHERE mu_id_pk=:myuserid");
             $sql->bindParam(':password', $password);
             $sql->bindParam(':myuserid', $myuserid);
             $sql->execute();
         }
     }
     runtime_hook::Execute('OnAfterResetDatabasePassword');
     self::$ok = true;
     return true;
 }
Esempio n. 16
0
 /**
  * Gathers module infomation from the modules XML file and adds the details to the DB.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $module The name of the module (folder) of which to import the module infomation in for.
  * @return boolean
  */
 static function ModuleInfoToDB($module)
 {
     global $zdbh;
     global $zlo;
     runtime_hook::Execute('OnBeforeModuleInfoToDB');
     $mod_xml = "modules/{$module}/module.xml";
     try {
         $mod_config = new xml_reader(fs_filehandler::ReadFileContents($mod_xml));
         $mod_config->Parse();
         $module_name = $mod_config->document->name[0]->tagData;
         $module_version = $mod_config->document->version[0]->tagData;
         $module_description = $mod_config->document->desc[0]->tagData;
         $module_defaultcat = $mod_config->document->defaultcat[0]->tagData;
         $module_type = $mod_config->document->type[0]->tagData;
         if ($module_type != ("user" || "system" || "modadmin")) {
             $module_type = "user";
         }
         $sql = $zdbh->prepare("SELECT mc_id_pk FROM x_modcats WHERE mc_name_vc = :module_defaultcat");
         $sql->bindParam(':module_defaultcat', $module_defaultcat);
         $status = $sql->execute();
         $result = $sql->fetch();
         if ($result) {
             $cat_fk = $result['mc_id_pk'];
         } else {
             $cat_fk = 2;
         }
         $sql = $zdbh->prepare("INSERT INTO x_modules (mo_name_vc, mo_category_fk, mo_version_in, mo_folder_vc, mo_installed_ts, mo_type_en, mo_desc_tx) VALUES (:module_name, :cat_fk, :module_version, :module, " . time() . ", :module_type,  :module_description)");
         $sql->bindParam(':module_name', $module_name);
         $sql->bindParam(':cat_fk', $cat_fk);
         $sql->bindParam(':module_version', $module_version);
         $sql->bindParam(':module', $module);
         $sql->bindParam(':module_type', $module_type);
         $sql->bindParam(':module_description', $module_description);
         $sql->execute();
         return true;
     } catch (Exception $e) {
         return false;
     }
     runtime_hook::Execute('OnAfterModuleInfoToDB');
 }
 static function ExecuteDeleteDatabase($my_id_pk)
 {
     global $zdbh;
     runtime_hook::Execute('OnBeforeDeleteDatabase');
     $numrows = $zdbh->prepare("SELECT my_name_vc FROM x_mysql_databases WHERE my_id_pk=:my_id_pk");
     $numrows->bindParam(':my_id_pk', $my_id_pk);
     $numrows->execute();
     $rowmysql = $numrows->fetch();
     try {
         $my_name_vc = $zdbh->mysqlRealEscapeString($rowmysql['my_name_vc']);
         $sql = $zdbh->prepare("DROP DATABASE IF EXISTS `{$my_name_vc}`;");
         //$sql->bindParam(':my_name_vc', $rowmysql['my_name_vc'], PDO::PARAM_STR);
         $sql->execute();
         $sql = $zdbh->prepare("FLUSH PRIVILEGES");
         $sql->execute();
         $sql = $zdbh->prepare("UPDATE x_mysql_databases SET my_deleted_ts = :time WHERE my_id_pk = :my_id_pk");
         $sql->bindParam(':time', time());
         $sql->bindParam(':my_id_pk', $my_id_pk);
         $sql->execute();
         $sql = $zdbh->prepare("DELETE FROM x_mysql_dbmap WHERE mm_database_fk=:my_id_pk");
         $sql->bindParam(':my_id_pk', $my_id_pk);
         $sql->execute();
     } catch (PDOException $e) {
         return false;
     }
     runtime_hook::Execute('OnAfterDeleteDatabase');
     self::$ok = true;
     return true;
 }
Esempio n. 18
0
 /**
  * Sets file/directory permissions on a given path.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $path The full path of the file or folder on which to set the permissions on.
  * @param int $mode The UNIX permissions octal (eg. 0777 or 777)
  * @return boolean 
  */
 static function SetFileSystemPermissions($path, $mode)
 {
     if (file_exists($path)) {
         runtime_hook::Execute('OnBeforeSetFileSystemPerms');
         @chmod($path, $mode);
         runtime_hook::Execute('OnAfterSetFileSystemPerms');
         $retval = true;
     } else {
         $retval = false;
     }
     return $retval;
 }
Esempio n. 19
0
 static function ExecuteUpdatePackage($uid, $pid, $packagename, $EnablePHP, $Domains, $SubDomains, $ParkedDomains, $Mailboxes, $Fowarders, $DistLists, $FTPAccounts, $MySQL, $DiskQuota, $BandQuota)
 {
     global $zdbh;
     if (fs_director::CheckForEmptyValue(self::CheckNumeric($EnablePHP, $Domains, $SubDomains, $ParkedDomains, $Mailboxes, $Fowarders, $DistLists, $FTPAccounts, $MySQL, $DiskQuota, $BandQuota))) {
         return false;
     }
     $packagename = str_replace(' ', '', $packagename);
     // Check for errors before we continue...
     if (fs_director::CheckForEmptyValue(self::CheckCreateForErrors($packagename, $uid, $pid))) {
         return false;
     }
     runtime_hook::Execute('OnBeforeUpdatePackage');
     $sql = $zdbh->prepare("UPDATE x_packages SET pk_name_vc=:packagename,\n\t\t\t\t\t\t\t\tpk_enablephp_in = :php\n\t\t\t\t\t\t\t\tWHERE pk_id_pk  = :pid");
     $php = fs_director::GetCheckboxValue($EnablePHP);
     $sql->bindParam(':php', $php);
     $sql->bindParam(':pid', $pid);
     $sql->bindParam(':packagename', $packagename);
     $sql->execute();
     $sql = $zdbh->prepare("UPDATE x_quotas SET qt_domains_in = :Domains,\n\t\t\t\t\t\t\t\tqt_parkeddomains_in = :ParkedDomains,\n\t\t\t\t\t\t\t\tqt_ftpaccounts_in   = :FTPAccounts,\n\t\t\t\t\t\t\t\tqt_subdomains_in    = :SubDomains,\n\t\t\t\t\t\t\t\tqt_mailboxes_in     = :Mailboxes,\n\t\t\t\t\t\t\t\tqt_fowarders_in     = :Fowarders,\n\t\t\t\t\t\t\t\tqt_distlists_in     = :DistLists,\n\t\t\t\t\t\t\t\tqt_diskspace_bi     = :DiskQuotaFinal,\n\t\t\t\t\t\t\t\tqt_bandwidth_bi     = :BandQuotaFinal,\n\t\t\t\t\t\t\t\tqt_mysql_in         = :MySQL\n                                                                WHERE qt_package_fk = :pid");
     $DiskQuotaFinal = $DiskQuota * 1024000;
     $BandQuotaFinal = $BandQuota * 1024000;
     $sql->bindParam(':DiskQuotaFinal', $DiskQuotaFinal);
     $sql->bindParam(':BandQuotaFinal', $BandQuotaFinal);
     $sql->bindParam(':MySQL', $MySQL);
     $sql->bindParam(':DistLists', $DistLists);
     $sql->bindParam(':Fowarders', $Fowarders);
     $sql->bindParam(':Mailboxes', $Mailboxes);
     $sql->bindParam(':SubDomains', $SubDomains);
     $sql->bindParam(':FTPAccounts', $FTPAccounts);
     $sql->bindParam(':ParkedDomains', $ParkedDomains);
     $sql->bindParam(':Domains', $Domains);
     $sql->bindParam(':pid', $pid);
     $sql->execute();
     runtime_hook::Execute('OnAfterUpdatePackage');
     self::$ok = true;
     return true;
 }
 public function ExecuteAddParkedDomain($uid, $domain)
 {
     global $zdbh;
     $retval = FALSE;
     runtime_hook::Execute('OnBeforeAddParkedDomain');
     $currentuser = ctrl_users::GetUserDetail($uid);
     $domain = strtolower(str_replace(' ', '', $domain));
     if (!fs_director::CheckForEmptyValue(self::CheckCreateForErrors($domain))) {
         // If all has gone well we need to now create the domain in the database...
         $sql = $zdbh->prepare("INSERT INTO x_vhosts (vh_acc_fk,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_name_vc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_directory_vc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_type_in,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_created_ts) VALUES (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :userid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t '',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 3,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :time)");
         $sql->bindParam(':userid', $currentuser['userid']);
         $sql->bindParam(':domain', $domain);
         $time = time();
         $sql->bindParam(':time', $time);
         $sql->execute();
         # Only run if the Server platform is Windows.
         if (sys_versions::ShowOSPlatformVersion() == 'Windows') {
             if (ctrl_options::GetSystemOption('disable_hostsen') == 'false') {
                 # Lets add the hostname to the HOSTS file so that the server can view the domain immediately...
                 @exec("C:/zpanel/bin/zpss/setroute.exe " . $domain . "");
                 @exec("C:/zpanel/bin/zpss/setroute.exe www." . $domain . "");
             }
         }
         self::SetWriteApacheConfigTrue();
         $retval = TRUE;
         runtime_hook::Execute('OnAfterAddParkedDomain');
         return $retval;
     }
 }
Esempio n. 21
0
 static function ExecuteDeleteAlias($al_id_pk)
 {
     global $zdbh;
     global $controller;
     self::$delete = true;
     runtime_hook::Execute('OnBeforeDeleteAlias');
     //$rowalias = $zdbh->query("SELECT * FROM x_aliases WHERE al_id_pk=" . $al_id_pk . "")->Fetch();
     $bindArray = array(':id' => $al_id_pk);
     $sqlStatment = $zdbh->bindQuery("SELECT * FROM x_aliases WHERE al_id_pk=:id", $bindArray);
     $rowalias = $zdbh->returnRow();
     // Include mail server specific file here.
     if (file_exists("modules/" . $controller->GetControllerRequest('URL', 'module') . "/code/" . ctrl_options::GetSystemOption('mailserver_php') . "")) {
         include "modules/" . $controller->GetControllerRequest('URL', 'module') . "/code/" . ctrl_options::GetSystemOption('mailserver_php') . "";
     }
     $sqlStatmentUpdate = "UPDATE x_aliases SET al_deleted_ts=:time WHERE al_id_pk=:id";
     $sql = $zdbh->prepare($sqlStatmentUpdate);
     $sql->bindParam(':id', $al_id_pk);
     $sql->bindParam(':time', time());
     $sql->execute();
     runtime_hook::Execute('OnAfterDeleteAlias');
     self::$ok = true;
 }
                         $filetime = floor((time() - $filetime) / 86400);
                         echo "" . $file . " - " . $purge_date . " - " . $filetime . "";
                         if ($purge_date < $filetime) {
                             //delete the file
                             echo " - Deleting file..." . fs_filehandler::NewLine();
                             unlink($backupdir . $file);
                         } else {
                             echo " - Skipping file..." . fs_filehandler::NewLine();
                         }
                     }
                 }
             }
         }
     }
     echo "Backup Purging COMPLETE..." . fs_filehandler::NewLine();
     runtime_hook::Execute('OnAfterPurgeBackup');
 }
 // Clean temp backups....
 echo fs_filehandler::NewLine() . "Purging backups from temp folder..." . fs_filehandler::NewLine();
 clearstatcache();
 echo "[FILE][PURGE_DATE][FILE_DATE][ACTION]" . fs_filehandler::NewLine();
 $temp_dir = ctrl_options::GetSystemOption('sentora_root') . "/modules/backupmgr/temp/";
 if ($handle = @opendir($temp_dir)) {
     while (false !== ($file = readdir($handle))) {
         if ($file != "." && $file != "..") {
             $filetime = @filemtime($temp_dir . $file);
             if ($filetime == NULL) {
                 $filetime = @filemtime(utf8_decode($temp_dir . $file));
             }
             $filetime = floor((time() - $filetime) / 86400);
             echo "" . $file . " - " . $purge_date . " - " . $filetime . "";
Esempio n. 23
0
 /**
  * Destroys a session and ends a user's Zpanel session.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return bool
  */
 static function KillSession()
 {
     runtime_hook::Execute('OnUserLogout');
     $_SESSION['zpuid'] = null;
     if (isset($_SESSION['ruid'])) {
         unset($_SESSION['ruid']);
     }
     unset($_COOKIE['zUserSaltCookie']);
     return true;
 }
 static function ExecuteDeleteDistListUser($du_id_pk)
 {
     global $zdbh;
     global $controller;
     $numrows = $zdbh->prepare("SELECT * FROM x_distlistusers WHERE du_id_pk=:du_id_pk AND du_deleted_ts IS NULL");
     $numrows->bindParam(':du_id_pk', $du_id_pk);
     $numrows->execute();
     $rowdlu = $numrows->fetch();
     //WARNING : $rowdlu is used in mail server specific file
     $numrows = $zdbh->prepare("SELECT * FROM x_distlists WHERE dl_id_pk=:du_distlist_fk AND dl_deleted_ts IS NULL");
     $numrows->bindParam(':du_distlist_fk', $rowdlu['du_distlist_fk']);
     $numrows->execute();
     $rowdl = $numrows->fetch();
     $dladdress = $rowdl['dl_address_vc'];
     //WARNING : $dladdress is used in mail server specific file
     runtime_hook::Execute('OnBeforeDeleteDistListUser');
     self::$deleteuser = true;
     // Include mail server specific file here.
     $MailServerFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('mailserver_php');
     if (file_exists($MailServerFile)) {
         include $MailServerFile;
     }
     $sql = "UPDATE x_distlistusers SET du_deleted_ts=:time WHERE du_id_pk=:du_id_pk";
     $sql = $zdbh->prepare($sql);
     $time = time();
     $sql->bindParam(':time', $time);
     $sql->bindParam(':du_id_pk', $du_id_pk);
     $sql->execute();
     runtime_hook::Execute('OnAfterDeleteDistListUser');
     self::$ok = true;
     return true;
 }
Esempio n. 25
0
    $sql = $zdbh->prepare("SELECT ac_passsalt_vc FROM x_accounts WHERE ac_user_vc = :username AND ac_deleted_ts IS NULL");
    $sql->bindParam(':username', $_POST['inUsername']);
    $sql->execute();
    $result = $sql->fetch();
    $crypto = new runtime_hash();
    $crypto->SetPassword($_POST['inPassword']);
    $crypto->SetSalt($result['ac_passsalt_vc']);
    $secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
    if (!ctrl_auth::Authenticate($_POST['inUsername'], $secure_password, $rememberdetails, false, $inSessionSecuirty)) {
        header("location: ./?invalidlogin");
        exit;
    }
}
if (isset($_COOKIE['zUser'])) {
    if (isset($_COOKIE['zSec'])) {
        if ($_COOKIE['zSec'] == false) {
            $secure = false;
        } else {
            $secure = true;
        }
    } else {
        $secure = true;
    }
    ctrl_auth::Authenticate($_COOKIE['zUser'], $_COOKIE['zPass'], false, true, $secure);
}
if (!isset($_SESSION['zpuid'])) {
    ctrl_auth::RequireUser();
}
runtime_hook::Execute('OnBeforeControllerInit');
$controller->Init();
ui_templateparser::Generate("etc/styles/" . ui_template::GetUserTemplate());
Esempio n. 26
0
 static function ExecuteDisableMailbox($mid)
 {
     global $zdbh;
     runtime_hook::Execute('OnBeforeDisableMailbox');
     $sql = $zdbh->prepare("UPDATE x_mailboxes SET mb_enabled_in=0 WHERE mb_id_pk=:mid");
     $sql->bindParam(':mid', $mid);
     $sql->execute();
     $retval = true;
     runtime_hook::Execute('OnAfterDisableMailbox');
     return $retval;
 }
Esempio n. 27
0
    ctrl_options::SetSystemOption('daemon_hourrun', time());
    runtime_hook::Execute("OnStartDaemonHour");
    runtime_hook::Execute("OnDaemonHour");
    runtime_hook::Execute("OnEndDaemonHour");
}
if (time() >= ctrl_options::GetSystemOption('daemon_dayrun') + 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_dayrun', time());
    runtime_hook::Execute("OnStartDaemonDay");
    runtime_hook::Execute("OnDaemonDay");
    runtime_hook::Execute("OnEndDaemonDay");
}
if (time() >= ctrl_options::GetSystemOption('daemon_weekrun') + 7 * 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_weekrun', time());
    runtime_hook::Execute("OnStartDaemonWeek");
    runtime_hook::Execute("OnDaemonWeek");
    runtime_hook::Execute("OnEndDaemonWeek");
}
if (time() >= ctrl_options::GetSystemOption('daemon_monthrun') + 30 * 24 * 3600) {
    ctrl_options::SetSystemOption('daemon_monthrun', time());
    runtime_hook::Execute("OnStartDaemonMonth");
    runtime_hook::Execute("OnDaemonMonth");
    runtime_hook::Execute("OnEndDaemonMonth");
}
echo "\nDaemon run complete! (" . date($dateformat) . ")\n";
ctrl_options::SetSystemOption('daemon_lastrun', time());
$daemonLog->detail = "Daemon execution completed!";
$daemonLog->writeLog();
if (!runtime_controller::IsCLI()) {
    echo "</pre>";
}
exit;
Esempio n. 28
0
 static function ExecuteAddDomain($uid, $domain, $destination, $autohome)
 {
     global $zdbh;
     $retval = FALSE;
     runtime_hook::Execute('OnBeforeAddDomain');
     $currentuser = ctrl_users::GetUserDetail($uid);
     $domain = strtolower(str_replace(' ', '', $domain));
     if (!fs_director::CheckForEmptyValue(self::CheckCreateForErrors($domain))) {
         //** New Home Directory **//
         if ($autohome == 1) {
             $destination = "/" . str_replace(".", "_", $domain);
             $vhost_path = ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . "/public_html/" . $destination . "/";
             fs_director::CreateDirectory($vhost_path);
             fs_director::SetFileSystemPermissions($vhost_path, 0777);
             //** Existing Home Directory **//
         } else {
             $destination = "/" . $destination;
             $vhost_path = ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . "/public_html/" . $destination . "/";
         }
         // Error documents:- Error pages are added automatically if they are found in the _errorpages directory
         // and if they are a valid error code, and saved in the proper format, i.e. <error_number>.html
         fs_director::CreateDirectory($vhost_path . "/_errorpages/");
         $errorpages = ctrl_options::GetSystemOption('static_dir') . "/errorpages/";
         if (is_dir($errorpages)) {
             if ($handle = @opendir($errorpages)) {
                 while (($file = @readdir($handle)) !== false) {
                     if ($file != "." && $file != "..") {
                         $page = explode(".", $file);
                         if (!fs_director::CheckForEmptyValue(self::CheckErrorDocument($page[0]))) {
                             fs_filehandler::CopyFile($errorpages . $file, $vhost_path . '/_errorpages/' . $file);
                         }
                     }
                 }
                 closedir($handle);
             }
         }
         // Lets copy the default welcome page across...
         if (!file_exists($vhost_path . "/index.html") && !file_exists($vhost_path . "/index.php") && !file_exists($vhost_path . "/index.htm")) {
             fs_filehandler::CopyFileSafe(ctrl_options::GetSystemOption('static_dir') . "pages/welcome.html", $vhost_path . "/index.html");
         }
         // If all has gone well we need to now create the domain in the database...
         $sql = $zdbh->prepare("INSERT INTO x_vhosts (vh_acc_fk,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_name_vc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_directory_vc,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_type_in,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t vh_created_ts) VALUES (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :userid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :domain,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :destination,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t :time)");
         //CLEANER FUNCTION ON $domain and $homedirectory_to_use (Think I got it?)
         $time = time();
         $sql->bindParam(':time', $time);
         $sql->bindParam(':userid', $currentuser['userid']);
         $sql->bindParam(':domain', $domain);
         $sql->bindParam(':destination', $destination);
         $sql->execute();
         // Only run if the Server platform is Windows.
         if (sys_versions::ShowOSPlatformVersion() == 'Windows') {
             if (ctrl_options::GetSystemOption('disable_hostsen') == 'false') {
                 // Lets add the hostname to the HOSTS file so that the server can view the domain immediately...
                 @exec("C:/Sentora/bin/zpss/setroute.exe " . $domain . "");
                 @exec("C:/Sentora/bin/zpss/setroute.exe www." . $domain . "");
             }
         }
         self::SetWriteApacheConfigTrue();
         $retval = TRUE;
         runtime_hook::Execute('OnAfterAddDomain');
         return $retval;
     }
 }
Esempio n. 29
0
 static function ExecuteDeleteFTP($ft_id_pk)
 {
     global $zdbh;
     global $controller;
     runtime_hook::Execute('OnBeforeDeleteFTPAccount');
     $rowftpsql = "SELECT * FROM x_ftpaccounts WHERE ft_id_pk=:ftIdPk";
     $rowftpfind = $zdbh->prepare($rowftpsql);
     $rowftpfind->bindParam(':ftIdPk', $ft_id_pk);
     $rowftpfind->execute();
     $rowftp = $rowftpfind->fetch();
     $sql = $zdbh->prepare("UPDATE x_ftpaccounts SET ft_deleted_ts=:time WHERE ft_id_pk=:ftpid");
     $sql->bindParam(':ftpid', $ft_id_pk);
     $sql->bindParam(':time', $ft_id_pk);
     $sql->execute();
     self::$delete = true;
     // Include FTP server specific file here.
     $FtpModuleFile = 'modules/' . $controller->GetControllerRequest('URL', 'module') . '/code/' . ctrl_options::GetSystemOption('ftp_php');
     if (file_exists($FtpModuleFile)) {
         include $FtpModuleFile;
     }
     $retval = TRUE;
     runtime_hook::Execute('OnAfterDeleteFTPAccount');
     return $retval;
 }
Esempio n. 30
0
 static function ExecuteDeleteBackup($username, $file)
 {
     runtime_hook::Execute('OnBeforeDeleteBackup');
     $backup_file_to_delete = ctrl_options::GetSystemOption('hosted_dir') . $username . "/backups/" . $file . ".zip";
     unlink($backup_file_to_delete);
     runtime_hook::Execute('OnAfterDeleteBackup');
 }