当前位置: 首页>>代码示例>>PHP>>正文


PHP fs_director::SetFileSystemPermissions方法代码示例

本文整理汇总了PHP中fs_director::SetFileSystemPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP fs_director::SetFileSystemPermissions方法的具体用法?PHP fs_director::SetFileSystemPermissions怎么用?PHP fs_director::SetFileSystemPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fs_director的用法示例。


在下文中一共展示了fs_director::SetFileSystemPermissions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ExecuteCreateClient

 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;
 }
开发者ID:Boter,项目名称:madmin-core,代码行数:85,代码来源:controller.ext.php

示例2: BackupVhostConfigFile

function BackupVhostConfigFile()
{
    echo "Apache VHost backups are enabled... Backing up current vhost.conf to: " . ctrl_options::GetSystemOption('apache_budir') . fs_filehandler::NewLine();
    if (!is_dir(ctrl_options::GetSystemOption('apache_budir'))) {
        fs_director::CreateDirectory(ctrl_options::GetSystemOption('apache_budir'));
    }
    copy(ctrl_options::GetSystemOption('apache_vhost'), ctrl_options::GetSystemOption('apache_budir') . "VHOST_BACKUP_" . time());
    fs_director::SetFileSystemPermissions(ctrl_options::GetSystemOption('apache_budir') . ctrl_options::GetSystemOption('apache_vhost') . ".BU", 0777);
    if (ctrl_options::GetSystemOption('apache_purgebu') == strtolower("true")) {
        echo "Apache VHost purges are enabled... Purging backups older than: " . ctrl_options::GetSystemOption('apache_purge_date') . " days..." . fs_filehandler::NewLine();
        echo "[FILE][PURGE_DATE][FILE_DATE][ACTION]" . fs_filehandler::NewLine();
        $purge_date = ctrl_options::GetSystemOption('apache_purge_date');
        if ($handle = @opendir(ctrl_options::GetSystemOption('apache_budir'))) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != "..") {
                    $filetime = @filemtime(ctrl_options::GetSystemOption('apache_budir') . $file);
                    if ($filetime == NULL) {
                        $filetime = @filemtime(utf8_decode(ctrl_options::GetSystemOption('apache_budir') . $file));
                    }
                    $filetime = floor((time() - $filetime) / 86400);
                    echo $file . " - " . $purge_date . " - " . $filetime . "";
                    if ($purge_date < $filetime) {
                        //delete the file
                        echo " - Deleting file..." . fs_filehandler::NewLine();
                        unlink(ctrl_options::GetSystemOption('apache_budir') . $file);
                    } else {
                        echo " - Skipping file..." . fs_filehandler::NewLine();
                    }
                }
            }
        }
        echo "Purging old backups complete..." . fs_filehandler::NewLine();
    }
    echo "Apache backups complete..." . fs_filehandler::NewLine();
}
开发者ID:Boter,项目名称:madmin-core,代码行数:35,代码来源:OnDaemonRun.hook.php

示例3: WriteDNSNamedHook

function WriteDNSNamedHook()
{
    global $zdbh;
    $domains = array();
    //Get all the domain ID's we need and put them in an array.
    $sql = "SELECT COUNT(*) FROM x_dns WHERE dn_deleted_ts IS NULL";
    if ($numrows = $zdbh->query($sql)) {
        if ($numrows->fetchColumn() != 0) {
            $sql = $zdbh->prepare("SELECT * FROM x_dns WHERE dn_deleted_ts IS NULL GROUP BY dn_vhost_fk");
            $sql->execute();
            while ($rowdns = $sql->fetch()) {
                $domains[] = $rowdns['dn_name_vc'];
            }
        }
    }
    // Create named directory if it doesnt exists...
    if (!is_dir(ctrl_options::GetSystemOption('named_dir'))) {
        fs_director::CreateDirectory(ctrl_options::GetSystemOption('named_dir'));
        fs_director::SetFileSystemPermissions(ctrl_options::GetSystemOption('named_dir'));
    }
    $named_file = ctrl_options::GetSystemOption('named_dir') . ctrl_options::GetSystemOption('named_conf');
    echo "Updating " . $named_file . fs_filehandler::NewLine();
    // Now we have all domain ID's, loop through them and find records for each zone file.
    $line = "";
    foreach ($domains as $domain) {
        echo "CHECKING ZONE FILE: " . ctrl_options::GetSystemOption('zone_dir') . $domain . ".txt..." . fs_filehandler::NewLine();
        $command = ctrl_options::GetSystemOption('named_checkzone');
        $args = array($domain, ctrl_options::GetSystemOption('zone_dir') . $domain . ".txt");
        $retval = ctrl_system::systemCommand($command, $args);
        if ($retval == 0) {
            echo "Syntax check passed. Adding zone to " . ctrl_options::GetSystemOption('named_conf') . fs_filehandler::NewLine();
            $line .= "zone \"" . $domain . "\" IN {" . fs_filehandler::NewLine();
            $line .= "\ttype master;" . fs_filehandler::NewLine();
            $line .= "\tfile \"" . ctrl_options::GetSystemOption('zone_dir') . $domain . ".txt\";" . fs_filehandler::NewLine();
            $line .= "\tallow-transfer { " . ctrl_options::GetSystemOption('allow_xfer') . "; };" . fs_filehandler::NewLine();
            $line .= "};" . fs_filehandler::NewLine();
        } else {
            echo "Syntax ERROR. Skipping zone record." . fs_filehandler::NewLine();
        }
    }
    fs_filehandler::UpdateFile($named_file, 0777, $line);
}
开发者ID:bbspike,项目名称:sentora-core,代码行数:42,代码来源:OnDaemonRun.hook.php

示例4: UpdateFile

 /**
  * Updates an existing file and will chmod it too if required.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $path The path and file name to the file to update.
  * @param string $chmod Permissions mode to use for the new file. (eg. 0777)
  * @param string $sting The content to update the file with.
  * @return boolean 
  */
 static function UpdateFile($path, $chmod = 0777, $string = "")
 {
     if (!file_exists($path)) {
         fs_filehandler::ResetFile($path);
     }
     $fp = @fopen($path, 'w');
     @fwrite($fp, $string);
     @fclose($fp);
     fs_director::SetFileSystemPermissions($path, $chmod);
     return true;
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:19,代码来源:filehandler.class.php

示例5: ExecuteAddDomain

 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;
     }
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:63,代码来源:controller.ext.php

示例6: ExecuteBackup

function ExecuteBackup($userid, $username, $download = 0)
{
    include '../../../cnf/db.php';
    try {
        $zdbh = new db_driver("mysql:host=" . $host . ";dbname=" . $dbname . "", $user, $pass);
    } catch (PDOException $e) {
        exit;
    }
    $basedir = ctrl_options::GetSystemOption('temp_dir');
    if (!is_dir($basedir)) {
        fs_director::CreateDirectory($basedir);
    }
    $basedir = ctrl_options::GetSystemOption('sentora_root') . "etc/tmp/";
    if (!is_dir($basedir)) {
        fs_director::CreateDirectory($basedir);
    }
    $temp_dir = ctrl_options::GetSystemOption('sentora_root') . "etc/tmp/";
    // Lets grab and archive the user's web data....
    $homedir = ctrl_options::GetSystemOption('hosted_dir') . $username;
    $backupname = $username . "_" . date("M-d-Y_hms", time());
    $dbstamp = date("dmy_Gi", time());
    // We now see what the OS is before we work out what compression command to use..
    if (sys_versions::ShowOSPlatformVersion() == "Windows") {
        $resault = exec(fs_director::SlashesToWin(ctrl_options::GetSystemOption('zip_exe') . " a -tzip -y-r " . $temp_dir . $backupname . ".zip " . $homedir . "/public_html"));
    } else {
        //cd /var/sentora/hostdata/zadmin/; zip -r backups/backup.zip public_html/
        $resault = exec("cd " . $homedir . "/ && " . ctrl_options::GetSystemOption('zip_exe') . " -r9 " . $temp_dir . $backupname . " public_html/*");
        @chmod($temp_dir . $backupname . ".zip", 0777);
    }
    // Now lets backup all MySQL datbases for the user and add them to the archive...
    $sql = "SELECT COUNT(*) FROM x_mysql_databases WHERE my_acc_fk=:userid AND my_deleted_ts IS NULL";
    $numrows = $zdbh->prepare($sql);
    $numrows->bindParam(':userid', $userid);
    $numrows->execute();
    if ($numrows) {
        if ($numrows->fetchColumn() != 0) {
            $sql = $zdbh->prepare("SELECT * FROM x_mysql_databases WHERE my_acc_fk=:userid AND my_deleted_ts IS NULL");
            $sql->bindParam(':userid', $userid);
            $sql->execute();
            while ($row_mysql = $sql->fetch()) {
                $bkcommand = ctrl_options::GetSystemOption('mysqldump_exe') . " -h " . $host . " -u " . $user . " -p" . $pass . " --no-create-db " . $row_mysql['my_name_vc'] . " > " . $temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql";
                passthru($bkcommand);
                // Add it to the ZIP archive...
                if (sys_versions::ShowOSPlatformVersion() == "Windows") {
                    $resault = exec(fs_director::SlashesToWin(ctrl_options::GetSystemOption('zip_exe') . " u " . $temp_dir . $backupname . ".zip " . $temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql"));
                } else {
                    $resault = exec("cd " . $temp_dir . "/ && " . ctrl_options::GetSystemOption('zip_exe') . " " . $temp_dir . $backupname . "  " . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
                }
                unlink($temp_dir . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
            }
        }
    }
    // We have the backup now lets output it to disk or download
    if (file_exists($temp_dir . $backupname . ".zip")) {
        // If Disk based backups are allowed in backup config
        if (strtolower(ctrl_options::GetSystemOption('disk_bu')) == "true") {
            // Copy Backup to user home directory...
            $backupdir = $homedir . "/backups/";
            if (!is_dir($backupdir)) {
                fs_director::CreateDirectory($backupdir);
                @chmod($backupdir, 0777);
            }
            copy($temp_dir . $backupname . ".zip", $backupdir . $backupname . ".zip");
            fs_director::SetFileSystemPermissions($backupdir . $backupname . ".zip", 0777);
        } else {
            $backupdir = $temp_dir;
        }
        // If Client has checked to download file
        if ($download != 0) {
            /* Ajax not supporting headers - changed to link in temp dir.
                          if (sys_versions::ShowOSPlatformVersion() == "Windows") {
                          # Now we send the output (Windows)...
                          header('Pragma: public');
                          header('Expires: 0');
                          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                          header('Cache-Control: private', false);
                          header('Content-Type: application/zip');
                          header('Content-Disposition: attachment; filename=' . $backupname . '.zip');
                          header('Content-Transfer-Encoding: binary');
                          header('Content-Length: ' . filesize($backupdir . $backupname . '.zip ') . '');
                          readfile($backupdir . $backupname . ".zip ");
                          } else {
            
                          # Now we send the output (POSIX)...
                          $file = $backupdir . $backupname . ".zip";
                          header('Pragma: public');
                          header('Expires: 0');
                          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                          header('Cache-Control: private', false);
                          header('Content-Description: File Transfer');
                          header('Content-Transfer-Encoding: binary');
                          header('Content-Type: application/force-download');
                          header('Content-Length: ' . filesize($file));
                          header('Content-Disposition: attachment; filename=' . $backupname . '.zip');
                          readfile_chunked($file);
                          }
                         */
            fs_director::SetFileSystemPermissions($backupdir . $backupname . ".zip", 0777);
            return $temp_dir . $backupname . ".zip";
        }
//.........这里部分代码省略.........
开发者ID:bbspike,项目名称:sentora-core,代码行数:101,代码来源:dobackup.php

示例7: CreateDirectory

 /**
  * Creates a directory if it doesn't already exist!
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $path The full path of the folder to create.
  * @return boolean
  */
 static function CreateDirectory($path)
 {
     if (!file_exists($path)) {
         runtime_hook::Execute('OnBeforeDirectoryCreate');
         @mkdir($path, 0777, true);
         fs_director::SetFileSystemPermissions($path, 0777);
         runtime_hook::Execute('OnAfterDirectoryCreate');
         $retval = true;
     } else {
         $retval = false;
     }
     return $retval;
 }
开发者ID:Boter,项目名称:madmin-core,代码行数:19,代码来源:director.class.php

示例8: exec

                             $resault = exec("cd " . ctrl_options::GetSystemOption('temp_dir') . "/ && " . ctrl_options::GetSystemOption('zip_exe') . " " . ctrl_options::GetSystemOption('temp_dir') . $backupname . "  " . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
                         }
                         unlink(ctrl_options::GetSystemOption('temp_dir') . $row_mysql['my_name_vc'] . "_" . $dbstamp . ".sql");
                     }
                 }
             }
             // We have the backup now lets output it to disk or download
             if (file_exists(ctrl_options::GetSystemOption('temp_dir') . $backupname . ".zip")) {
                 // Copy Backup to user home directory...
                 $backupdir = $homedir . "/backups/";
                 if (!is_dir($backupdir)) {
                     mkdir($backupdir, 0777, TRUE);
                 }
                 copy(ctrl_options::GetSystemOption('temp_dir') . $backupname . ".zip", $backupdir . $backupname . ".zip");
                 unlink(ctrl_options::GetSystemOption('temp_dir') . $backupname . ".zip");
                 fs_director::SetFileSystemPermissions($backupdir . $backupname . ".zip", 0777);
                 echo $backupdir . $backupname . ".zip" . fs_filehandler::NewLine();
             }
         }
     }
     runtime_hook::Execute('OnAfterScheduleBackup');
     echo "Backup Schedule COMPLETE..." . fs_filehandler::NewLine();
 }
 // Purge backups are enabled....
 if (strtolower(ctrl_options::GetSystemOption('purge_bu')) == "true") {
     echo fs_filehandler::NewLine() . "Backup Purging enabled - Purging backups older than " . ctrl_options::GetSystemOption('purge_date') . " days..." . fs_filehandler::NewLine();
     runtime_hook::Execute('OnBeforePurgeBackup');
     clearstatcache();
     // Get all accounts
     $bsql = "SELECT * FROM x_accounts WHERE ac_enabled_in=1 AND ac_deleted_ts IS NULL";
     $numrows = $zdbh->query($bsql);
开发者ID:TGates71,项目名称:Sentora-Windows-Upgrade,代码行数:31,代码来源:OnDaemonDay.hook.php

示例9: ExecuteCreateClient

 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 = is_array($username) ? implode($username) : $username;
     $username = strtolower(str_replace(' ', '', $username));
     $reseller = ctrl_users::GetUserDetail($uid);
     if (!is_numeric($packageid)) {
         $packageid = self::getPackageIdFix($packageid);
     }
     // Check for errors before we continue...
     if (fs_director::CheckForEmptyValue(self::CheckCreateForErrors($username, $packageid, $groupid, $email, $password))) {
         $errormsg = " ";
         if (self::$alreadyexists) {
             $errormsg .= sprintf(ui_language::translate("That username is already taken (\"%s\"). "), (string) $username);
         }
         if (self::$badname) {
             $errormsg .= sprintf(ui_language::translate("That username is invalid (\"%s\"). "), (string) $username);
         }
         if (self::$badpassword) {
             $errormsg .= sprintf(ui_language::translate("That password doesn't meet the requirements (\"%s\"). "), (string) $password);
         }
         if (self::$userblank) {
             $errormsg .= sprintf(ui_language::translate("The username is empty (\"%s\"). "), (string) $username);
         }
         if (self::$emailblank) {
             $errormsg .= sprintf(ui_language::translate("The email is empty (\"%s\"). "), (string) $email);
         }
         if (self::$passwordblank) {
             $errormsg .= sprintf(ui_language::translate("The password is empty (\"%s\"). "), (string) $password);
         }
         if (self::$packageblank) {
             $errormsg .= sprintf(ui_language::translate("The package is empty (\"%s\"). "), (string) $packageid);
         }
         if (self::$groupblank) {
             $errormsg .= sprintf(ui_language::translate("The group is empty (\"%s\"). "), (string) $groupid);
         }
         return ui_language::translate("Failed the check for valid parameters. ") . $errormsg;
     }
     runtime_hook::Execute('OnBeforeCreateClient');
     $crypto = new runtime_hash();
     $crypto->SetPassword($password);
     $randomsalt = $crypto->RandomSalt();
     $crypto->SetSalt($randomsalt);
     $secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
     $time = time();
     // 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 (:username, :password, :passsalt, :email, :packageid, :groupid, :resellertheme, :resellercss, :uid, :time)");
     $sql->bindParam(':uid', $uid);
     $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...
     $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();
     $address = is_array($address) ? implode($address) : $address;
     $post = is_array($post) ? implode($post) : $post;
     $phone = is_array($phone) ? implode($phone) : $phone;
     $time = time();
     $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);
     $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 (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
             $protocol = 'https://';
         } else {
             $protocol = 'http://';
         }
         $domain = empty(ctrl_options::GetSystemOption('zpanel_domain')) ? ctrl_options::GetSystemOption('sentora_domain') : ctrl_options::GetSystemOption('zpanel_domain');
         $emailsubject = str_replace("{{username}}", $username, $emailsubject);
//.........这里部分代码省略.........
开发者ID:kadivar,项目名称:sentora-whmcs,代码行数:101,代码来源:controller.ext.php


注:本文中的fs_director::SetFileSystemPermissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。