示例#1
0
 static function doInstallModule()
 {
     self::$error_message = "";
     self::$error = false;
     if ($_FILES['modulefile']['error'] > 0) {
         self::$error_message = "Couldn't upload the file, " . $_FILES['modulefile']['error'] . "";
     } else {
         $archive_ext = fs_director::GetFileExtension($_FILES['modulefile']['name']);
         $module_folder = fs_director::GetFileNameNoExtentsion($_FILES['modulefile']['name']);
         $module_dir = ctrl_options::GetSystemOption('sentora_root') . 'modules/' . $module_folder;
         if (!fs_director::CheckFolderExists($module_dir)) {
             if ($archive_ext != 'zpp') {
                 self::$error_message = "Package type was not detected as a .zpp (Sentora Package) archive.";
             } else {
                 if (fs_director::CreateDirectory($module_dir)) {
                     if (sys_archive::Unzip($_FILES['modulefile']['tmp_name'], $module_dir . '/')) {
                         if (!fs_director::CheckFileExists($module_dir . '/module.xml')) {
                             self::$error_message = "No module.xml file found in the unzipped archive.";
                         } else {
                             ui_module::ModuleInfoToDB($module_folder);
                             $extra_config = $module_dir . "/deploy/install.run";
                             if (fs_director::CheckFileExists($extra_config)) {
                                 exec(ctrl_options::GetSystemOption('php_exer') . " " . $extra_config . "");
                             }
                             self::$ok = true;
                         }
                     } else {
                         self::$error_message = "Couldn't unzip the archive (" . $_FILES['modulefile']['tmp_name'] . ") to " . $module_dir . '/';
                     }
                 } else {
                     self::$error_message = "Couldn't create module folder in " . $module_dir;
                 }
             }
         } else {
             self::$error_message = "The module " . $module_folder . " is already installed on this server!";
         }
     }
     return;
 }
<?php

global $zdbh;
/*
 * Calculate the home directory size for each 'active' user account on the server.
 */
$userssql = $zdbh->query("SELECT ac_id_pk, ac_user_vc FROM x_accounts WHERE ac_deleted_ts IS NULL");
echo fs_filehandler::NewLine() . "START Calculating disk Usage for all client accounts.." . fs_filehandler::NewLine();
while ($userdir = $userssql->fetch()) {
    $homedirectory = ctrl_options::GetSystemOption('hosted_dir') . $userdir['ac_user_vc'];
    if (fs_director::CheckFolderExists($homedirectory)) {
        $size = fs_director::GetDirectorySize($homedirectory);
    } else {
        $size = 0;
    }
    $currentuser = ctrl_users::GetUserDetail($userdir['ac_id_pk']);
    //$checksql = $zdbh->query("SELECT COUNT(*) AS total FROM x_bandwidth WHERE bd_month_in = " . date("Ym") . " AND bd_acc_fk = " . $userdir['ac_id_pk'] . "")->fetch();
    $numrows = $zdbh->prepare("SELECT COUNT(*) AS total FROM x_bandwidth WHERE bd_month_in = :date AND bd_acc_fk = :ac_id_pk");
    $date = date("Ym");
    $numrows->bindParam(':date', $date);
    $numrows->bindParam(':ac_id_pk', $userdir['ac_id_pk']);
    $numrows->execute();
    $checksql = $numrows->fetch();
    if ($checksql['total'] == 0) {
        //      $zdbh->query("INSERT INTO x_bandwidth (bd_acc_fk, bd_month_in, bd_transamount_bi, bd_diskamount_bi, bd_diskover_in, bd_diskcheck_in, bd_transover_in, bd_transcheck_in ) VALUES (" . $userdir['ac_id_pk'] . "," . date("Ym") . ",0,0,0,0,0,0);");
        $numrows3 = $zdbh->prepare("INSERT INTO x_bandwidth (bd_acc_fk, bd_month_in, bd_transamount_bi, bd_diskamount_bi, bd_diskover_in, bd_diskcheck_in, bd_transover_in, bd_transcheck_in ) VALUES (:ac_id_pk,:date,0,0,0,0,0,0);");
        //removed ;from end of statments
        $date = date("Ym");
        $numrows3->bindParam(':date', $date);
        $numrows3->bindParam(':ac_id_pk', $userdir['ac_id_pk']);
        $numrows3->execute();