コード例 #1
0
 /**
  * Gets the module list as an array from a given category ID.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @global db_driver $zdbh The ZPX database handle.
  * @param int $catid The name of the module category to get the list of modules from.
  * @return array Array containing the list of modules for the category ID supplied.
  */
 static function GetModuleList($catid = "")
 {
     global $zdbh;
     $user = ctrl_users::GetUserDetail();
     if ($catid == "") {
         $sql = "SELECT * FROM x_modules";
     } else {
         $sql = "SELECT * FROM x_modules WHERE mo_category_fk = :catid AND mo_type_en = 'user' AND mo_enabled_en = 'true' ORDER BY mo_name_vc";
     }
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':catid', $catid);
     $numrows->execute();
     if ($numrows->fetchColumn() != 0) {
         $sql = $zdbh->prepare($sql);
         $sql->bindParam(':catid', $catid);
         $res = array();
         $sql->execute();
         while ($row = $sql->fetch()) {
             if (ctrl_groups::CheckGroupModulePermissions($user['usergroupid'], $row['mo_id_pk'])) {
                 array_push($res, array('mo_id_pk' => $row['mo_id_pk'], 'mo_category_fk' => $row['mo_category_fk'], 'mo_name_vc' => $row['mo_name_vc'], 'mo_version_in' => $row['mo_version_in'], 'mo_folder_vc' => $row['mo_folder_vc'], 'mo_type_en' => $row['mo_type_en'], 'mo_desc_tx' => $row['mo_desc_tx'], 'mo_installed_ts' => $row['mo_installed_ts'], 'mo_enabled_en' => $row['mo_enabled_en'], 'mo_updatever_vc' => $row['mo_updatever_vc'], 'mo_updateurl_tx' => $row['mo_updateurl_tx']));
             }
         }
         return $res;
     } else {
         return false;
     }
 }
コード例 #2
0
 /**
  * Get the latest requests and updates the values avaliable to the model/view.
  * @author Bobby Allen (ballen@bobbyallen.me)
  */
 public function Init()
 {
     //Set class varables
     $this->vars_get = array($_GET);
     $this->vars_post = array($_POST);
     $this->vars_session = array($_SESSION);
     $this->vars_cookie = array($_COOKIE);
     //Here we get the users information
     $user = ctrl_users::GetUserDetail();
     if (!isset($this->vars_session[0]['zpuid'])) {
         ui_module::GetLoginTemplate();
     }
     if (isset($this->vars_get[0]['module'])) {
         ui_module::getModule($this->GetCurrentModule());
     }
     if (isset($this->vars_get[0]['action'])) {
         if (ctrl_groups::CheckGroupModulePermissions($user['usergroupid'], ui_module::GetModuleID())) {
             if (class_exists('module_controller', FALSE) && method_exists('module_controller', 'do' . $this->vars_get[0]['action'])) {
                 call_user_func(array('module_controller', 'do' . $this->vars_get[0]['action']));
             } else {
                 echo ui_sysmessage::shout("No 'do" . runtime_xss::xssClean($this->vars_get[0]['action']) . "' class exists - Please create it to enable controller actions and runtime placeholders within your module.");
             }
         }
     }
     return;
 }
コード例 #3
0
 static function getConfig()
 {
     global $zdbh;
     $currentuser = ctrl_users::GetUserDetail();
     $sql = "SELECT * FROM x_settings WHERE so_module_vc=:name AND so_usereditable_en = 'true' ORDER BY so_cleanname_vc";
     //$numrows = $zdbh->query($sql);
     $name = ui_module::GetModuleName();
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':name', $name);
     $numrows->execute();
     if ($numrows->fetchColumn() != 0) {
         $sql = $zdbh->prepare($sql);
         $sql->bindParam(':name', $name);
         $res = array();
         $sql->execute();
         while ($rowmailsettings = $sql->fetch()) {
             if (ctrl_options::CheckForPredefinedOptions($rowmailsettings['so_defvalues_tx'])) {
                 $fieldhtml = ctrl_options::OuputSettingMenuField($rowmailsettings['so_name_vc'], $rowmailsettings['so_defvalues_tx'], $rowmailsettings['so_value_tx']);
             } else {
                 $fieldhtml = ctrl_options::OutputSettingTextArea($rowmailsettings['so_name_vc'], $rowmailsettings['so_value_tx']);
             }
             array_push($res, array('cleanname' => ui_language::translate($rowmailsettings['so_cleanname_vc']), 'name' => $rowmailsettings['so_name_vc'], 'description' => ui_language::translate($rowmailsettings['so_desc_tx']), 'value' => $rowmailsettings['so_value_tx'], 'fieldhtml' => $fieldhtml));
         }
         return $res;
     } else {
         return false;
     }
 }
コード例 #4
0
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail();
     $bandwidthquota = $currentuser['bandwidthquota'];
     $bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']);
     if ($bandwidthquota == 0) {
         return '<div class="progress progress-striped"><div class="progress-bar progress-bar-success" style="width: 0%"></div></div>';
     } else {
         if (fs_director::CheckForEmptyValue($bandwidth)) {
             $bandwidth = 0;
         }
         $percent = round($bandwidth / $bandwidthquota * 100, 0);
         if ($percent >= 75) {
             $bar = 'danger';
         } else {
             $bar = 'success';
         }
         if ($percent >= 10) {
             $showpercent = $percent . '%';
         } else {
             $showpercent = '';
         }
         return '<div class="progress progress-striped"><div class="progress-bar progress-bar-' . $bar . '" style="width: ' . $percent . '%">' . $showpercent . '</div></div>';
     }
 }
コード例 #5
0
 /**
  * Used to translate a text string into the language preference of the user.
  * @author Russell Skinner (rskinner@zpanelcp.com)
  * @global db_driver $zdbh The ZPX database handle.
  * @param $message The string to translate.
  * @return string The transalated string.
  */
 static function translate($message)
 {
     global $zdbh;
     $message = addslashes($message);
     $currentuser = ctrl_users::GetUserDetail();
     $lang = $currentuser['language'];
     $column_names = self::GetColumnNames('x_translations');
     foreach ($column_names as $column_name) {
         $columnNameClean = $zdbh->mysqlRealEscapeString($column_name);
         $sql = $zdbh->prepare("SELECT * FROM x_translations WHERE " . $columnNameClean . " LIKE :message");
         $sql->bindParam(':message', $message);
         $sql->execute();
         $result = $sql->fetch();
         if ($result) {
             if (!fs_director::CheckForEmptyValue($result['tr_' . $lang . '_tx'])) {
                 return $result['tr_' . $lang . '_tx'];
             } else {
                 return stripslashes($message);
             }
         }
     }
     if (!fs_director::CheckForEmptyValue($message) && $lang == "en") {
         $sql = $zdbh->prepare("INSERT INTO x_translations (tr_en_tx) VALUES (:message)");
         $sql->bindParam(':message', $message);
         $sql->execute();
     }
     return stripslashes($message);
 }
コード例 #6
0
 public static function Template()
 {
     $active = isset($_REQUEST['module']) ? '' : 'class="active"';
     $line = '<li ' . $active . '><a href="."><: Home :></a></li>';
     $modcats = ui_moduleloader::GetModuleCats();
     rsort($modcats);
     foreach ($modcats as $modcat) {
         $shortName = $modcat['mc_name_vc'];
         switch ($shortName) {
             case 'Account Information':
                 $shortName = 'Account';
                 break;
             case 'Server Admin':
                 $shortName = 'Admin';
                 break;
             case 'Database Management':
                 $shortName = 'Database';
                 break;
             case 'Domain Management':
                 $shortName = 'Domain';
                 break;
             case 'File Management':
                 $shortName = 'File';
                 break;
             case 'Server Admin':
                 $shortName = 'Server';
                 break;
         }
         $shortName = '<: ' . $shortName . ' :>';
         $mods = ui_moduleloader::GetModuleList($modcat['mc_id_pk']);
         if (count($mods) > 0) {
             $line .= '<li class="dropdown">';
             // IF Account, show Gravatar Image
             if ($shortName == '<: Account :>') {
                 $currentuser = ctrl_users::GetUserDetail();
                 $image = self::get_gravatar($currentuser['email'], 22, 'mm', 'g', true);
                 $line .= '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $image . ' ' . $shortName . ' <b class="caret"></b></a>';
             } else {
                 $line .= '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $shortName . ' <b class="caret"></b></a>';
             }
             $line .= '<ul class="dropdown-menu">';
             foreach ($mods as $mod) {
                 $class_name = str_replace(array(' ', '_'), '-', strtolower($mod['mo_folder_vc']));
                 if (isset($_GET['module']) && $_GET['module'] == $mod['mo_folder_vc']) {
                     $line .= '<li class="active">';
                 } else {
                     $line .= '<li>';
                 }
                 $line .= '<a href="?module=' . $mod['mo_folder_vc'] . '"><i class="icon-' . $class_name . '"></i> <: ' . $mod['mo_name_vc'] . ' :></a></li>';
             }
             // If Account tab, show Logout Menu Item
             if ($shortName == '<: Account :>') {
                 $line .= '<li><a href="?logout"><i class="icon-phpinfo"></i> Logout</a></li>';
             }
             $line .= '</ul></li>';
         }
     }
     return $line;
 }
コード例 #7
0
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail(ctrl_auth::CurrentUserID());
     if ($currentuser['lastlogon']) {
         return date(ctrl_options::GetSystemOption('sentora_df'), $currentuser['lastlogon']);
     } else {
         return "<: Never :>";
     }
 }
コード例 #8
0
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail();
     if ($currentuser['bandwidthquota'] == 0) {
         $bandwidthquota = '<: Unlimited :>';
     } else {
         $bandwidthquota = fs_director::ShowHumanFileSize($currentuser['bandwidthquota']);
     }
     return $bandwidthquota;
 }
コード例 #9
0
ファイル: module.class.php プロジェクト: BIGGANI/zpanelx
 /**
  * Checks that the module exists.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @param string $name Name of the module to check that exists.
  * @return boolean
  */
 static function CheckModuleExists($name)
 {
     $user = ctrl_users::GetUserDetail();
     if (file_exists("modules/" . $name . "/module.zpm")) {
         if (ctrl_groups::CheckGroupModulePermissions($user['usergroupid'], self::GetModuleID())) {
             return true;
         }
     }
     return false;
 }
コード例 #10
0
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail();
     $subdomainsquota = $currentuser['subdomainquota'];
     if ($subdomainsquota < 0) {
         return '&#8734;';
     } else {
         return $subdomainsquota;
     }
 }
コード例 #11
0
ファイル: csspath.class.php プロジェクト: Boter/madmin-core
 public static function Template()
 {
     $user = ctrl_users::GetUserDetail();
     if (!fs_director::CheckForEmptyValue(fs_director::CheckForEmptyValue($user['usercss']))) {
         $retval = "etc/styles/" . ui_template::GetUserTemplate() . "/css/default.css";
     } else {
         $retval = "etc/styles/" . ui_template::GetUserTemplate() . "/css/" . $user['usercss'] . ".css";
     }
     return $retval;
 }
コード例 #12
0
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail();
     $forwardersquota = $currentuser['forwardersquota'];
     if ($forwardersquota < 0) {
         return '&#8734;';
     } else {
         return $forwardersquota;
     }
 }
コード例 #13
0
ファイル: controller.ext.php プロジェクト: BIGGANI/zpanelx
 static function doUpdateMessage()
 {
     global $controller;
     runtime_csfr::Protect();
     $currentuser = ctrl_users::GetUserDetail();
     $formvars = $controller->GetAllControllerRequests('FORM');
     self::ExectuteUpdateNotice($currentuser['userid'], $formvars['inNotice']);
     header("location: ./?module=" . $controller->GetCurrentModule() . "&saved=true");
     exit;
 }
コード例 #14
0
 public static function Template()
 {
     global $controller;
     $currentuser = ctrl_users::GetUserDetail();
     $domain = ctrl_users::GetUserDomains($currentuser['userid'], 3);
     if ($domain != 0) {
         return (string) $domain;
     }
     return (string) 0;
 }
コード例 #15
0
ファイル: template.class.php プロジェクト: Boter/madmin-core
 /**
  * Returns the name (folder name) of the template that should be used for the current user.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return string The template name.
  */
 static function GetUserTemplate()
 {
     $user = ctrl_users::GetUserDetail();
     if (fs_director::CheckForEmptyValue($user['usertheme'])) {
         # Lets use the reseller's theme they have setup!
         $reseller = ctrl_users::GetUserDetail($user['resellerid']);
         return $reseller['usertheme'];
     } else {
         return $user['usertheme'];
     }
 }
コード例 #16
0
 static function getReportToShow()
 {
     global $controller;
     $urlvars = $controller->GetAllControllerRequests('URL');
     if (isset($urlvars['domain']) && $urlvars['domain'] != "") {
         $currentuser = ctrl_users::GetUserDetail();
         $report_to_show = "modules/webalizer_stats/stats/" . $currentuser['username'] . "/" . $urlvars['domain'] . "/index.html";
         if (!file_exists($report_to_show)) {
             $report_to_show = false;
         }
         return $report_to_show;
     }
 }
コード例 #17
0
 public static function Template()
 {
     global $zdbh;
     $currentuser = ctrl_users::GetUserDetail();
     $user = $currentuser;
     $domain_limit = 4;
     /* Domains */
     $line = self::getDomains('domain', $domain_limit, $currentuser, $zdbh);
     /* Sub Domains */
     $line .= self::getDomains('subdomain', $domain_limit, $currentuser, $zdbh);
     /* Parked Domains */
     $line .= self::getDomains('parkeddomain', $domain_limit, $currentuser, $zdbh);
     return $line;
 }
コード例 #18
0
ファイル: notice.class.php プロジェクト: Boter/madmin-core
 public static function Template()
 {
     $user_array = ctrl_users::GetUserDetail();
     global $zdbh;
     $result = $zdbh->query("SELECT ac_notice_tx FROM x_accounts WHERE ac_id_pk = " . $user_array['resellerid'] . "")->Fetch();
     if ($result) {
         if ($result['ac_notice_tx'] != "") {
             return ui_sysmessage::shout(runtime_xss::xssClean($result['ac_notice_tx']), 'notice', 'Notice:', true);
         }
         return false;
     } else {
         return false;
     }
 }
コード例 #19
0
ファイル: controller.ext.php プロジェクト: Boter/madmin-core
 static function doUpdatePassword()
 {
     global $zdbh;
     global $controller;
     runtime_csfr::Protect();
     $currentuser = ctrl_users::GetUserDetail();
     $current_pass = $controller->GetControllerRequest('FORM', 'inCurPass');
     $newpass = $controller->GetControllerRequest('FORM', 'inNewPass');
     $conpass = $controller->GetControllerRequest('FORM', 'inConPass');
     $crypto = new runtime_hash();
     $crypto->SetPassword($newpass);
     $randomsalt = $crypto->RandomSalt();
     $crypto->SetSalt($randomsalt);
     $new_secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
     $sql = $zdbh->prepare("SELECT ac_pass_vc, ac_passsalt_vc FROM x_accounts WHERE ac_id_pk= :uid");
     $sql->bindParam(':uid', $currentuser['userid']);
     $sql->execute();
     $result = $sql->fetch();
     $userpasshash = new runtime_hash();
     $userpasshash->SetPassword($current_pass);
     $userpasshash->SetSalt($result['ac_passsalt_vc']);
     $current_secure_password = $userpasshash->CryptParts($userpasshash->Crypt())->Hash;
     if (fs_director::CheckForEmptyValue($newpass)) {
         // Current password is blank!
         self::$error = "error";
     } elseif ($current_secure_password != $result['ac_pass_vc']) {
         // Current password does not match!
         self::$error = "nomatch";
     } else {
         if ($newpass == $conpass) {
             // Check for password length...
             if (strlen($newpass) < ctrl_options::GetSystemOption('password_minlength')) {
                 self::$badpassword = true;
                 return false;
             }
             // Check that the new password matches the confirmation box.
             $sql = $zdbh->prepare("UPDATE x_accounts SET ac_pass_vc=:new_secure_password, ac_passsalt_vc= :randomsalt WHERE ac_id_pk=:userid");
             $sql->bindParam(':randomsalt', $randomsalt);
             $sql->bindParam(':new_secure_password', $new_secure_password);
             $sql->bindParam(':userid', $currentuser['userid']);
             $sql->execute();
             self::$error = "ok";
         } else {
             self::$error = "error";
         }
     }
 }
コード例 #20
0
 static function ExecuteUpdateAccountSettings($userid, $email, $fullname, $language, $phone, $address, $postalCode)
 {
     global $zdbh;
     $email = strtolower(str_replace(' ', '', $email));
     $fullname = ucwords($fullname);
     if (fs_director::CheckForEmptyValue(self::CheckUpdateForErrors($email, $fullname, $language, $phone, $address, $postalCode))) {
         return false;
     }
     $currentuser = ctrl_users::GetUserDetail();
     $sql = $zdbh->prepare("UPDATE x_accounts SET ac_email_vc = :email WHERE ac_id_pk = :userid");
     $sql->bindParam(':email', $email);
     $sql->bindParam(':userid', $userid);
     $sql->execute();
     $sql = $zdbh->prepare("UPDATE x_profiles SET ud_fullname_vc = :fullname, ud_language_vc = :language, ud_phone_vc = :phone, ud_address_tx  = :address, ud_postcode_vc = :postcode WHERE ud_user_fk = :userid");
     $sql->bindParam(':fullname', $fullname);
     $sql->bindParam(':language', $language);
     $sql->bindParam(':phone', $phone);
     $sql->bindParam(':address', $address);
     $sql->bindParam(':postcode', $postalCode);
     $sql->bindParam(':userid', $userid);
     $sql->execute();
     return true;
 }
コード例 #21
0
function DeleteParkedDomainsForDeletedClient()
{
    global $zdbh;
    $deletedclients = array();
    $sql = "SELECT COUNT(*) FROM x_accounts WHERE ac_deleted_ts IS NOT NULL";
    if ($numrows = $zdbh->query($sql)) {
        if ($numrows->fetchColumn() != 0) {
            $sql = $zdbh->prepare("SELECT * FROM x_accounts WHERE ac_deleted_ts IS NOT NULL");
            $sql->execute();
            while ($rowclient = $sql->fetch()) {
                $deletedclients[] = $rowclient['ac_id_pk'];
            }
        }
    }
    foreach ($deletedclients as $deletedclient) {
        $deletedir = false;
        //$result = $zdbh->query("SELECT * FROM x_vhosts WHERE vh_acc_fk=" . $deletedclient . " AND vh_type_in=3 AND vh_deleted_ts IS NULL")->Fetch();
        $numrows = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_acc_fk=:deletedclient AND vh_type_in=3 AND vh_deleted_ts IS NULL");
        $numrows->bindParam(':deletedclient', $deletedclient);
        $numrows->execute();
        $result = $numrows->fetch();
        if ($result) {
            $sql = $zdbh->prepare("UPDATE x_vhosts SET vh_deleted_ts=:time WHERE vh_acc_fk=:deletedclient AND vh_type_in=3");
            $time = time();
            $sql->bindParam(':time', $time);
            $sql->bindParam(':deletedclient', $deletedclient);
            $sql->execute();
            $deletedir = true;
        }
        if ($deletedir == true) {
            $currentuser = ctrl_users::GetUserDetail($deletedclient);
            if (is_dir(ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'])) {
                fs_filehandler::RemoveDirectory(ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username']);
            }
        }
    }
}
コード例 #22
0
 /**
  * @return bool
  */
 public function writeToFile()
 {
     global $zdbh;
     $user = ctrl_users::GetUserDetail();
     $line = "";
     $sql = "SELECT * FROM x_cronjobs WHERE ct_deleted_ts IS NULL";
     $numrows = $zdbh->query($sql);
     //common header whatever there are some cron task or not
     if ($this->getOsPlatformVersion() != "Windows") {
         $line .= 'SHELL=/bin/bash' . $this->newLine();
         $line .= 'PATH=/sbin:/bin:/usr/sbin:/usr/bin' . $this->newLine();
         $line .= 'HOME=/' . $this->newLine();
         $line .= $this->newLine();
     }
     $line .= $this->getCronFileHeader($user);
     //Write command lines in crontab, if any
     if ($numrows->fetchColumn() != 0) {
         $sql = $zdbh->prepare($sql);
         $sql->execute();
         while ($rowcron = $sql->fetch()) {
             $fetchRows = $zdbh->prepare("SELECT * FROM x_accounts WHERE ac_id_pk=:userid AND ac_deleted_ts IS NULL");
             $fetchRows->bindParam(':userid', $rowcron['ct_acc_fk']);
             $fetchRows->execute();
             $rowclient = $fetchRows->fetch();
             if ($rowclient && $rowclient['ac_enabled_in'] != 0) {
                 $line .= $rowcron['ct_timing_vc'] . " " . $this->getRestrictions($rowclient['ac_user_vc']) . $rowcron['ct_fullpath_vc'] . " > " . $this->getSystemOption('hosted_dir') . $rowclient['ac_user_vc'] . "/logs/cron." . $rowcron['ct_id_pk'] . ".log 2>&1" . $this->newLine();
             }
         }
     }
     if (fs_filehandler::UpdateFile($this->getSystemOption('cron_file'), 0644, $line)) {
         if ($this->getOsPlatformVersion() != "Windows") {
             $returnValue = ctrl_system::systemCommand($this->getSystemOption('zsudo'), array($this->getSystemOption('cron_reload_command'), $this->getSystemOption('cron_reload_flag'), $this->getSystemOption('cron_reload_user'), $this->getSystemOption('cron_reload_path')));
         }
         return true;
     }
     return false;
 }
コード例 #23
0
ファイル: controller.ext.php プロジェクト: BIGGANI/zpanelx
 static function doShadowUser()
 {
     global $zdbh;
     global $controller;
     runtime_csfr::Protect();
     $currentuser = ctrl_users::GetUserDetail();
     if ($currentuser['username'] == 'zadmin') {
         $sql = "SELECT * FROM x_accounts WHERE ac_deleted_ts IS NULL ORDER BY ac_user_vc";
         $numrows = $zdbh->prepare($sql);
     } else {
         $sql = "SELECT * FROM x_accounts WHERE ac_reseller_fk = :userid AND ac_deleted_ts IS NULL";
         $numrows = $zdbh->prepare($sql);
         $numrows->bindParam(':userid', $currentuser['userid']);
     }
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             $sql = $zdbh->prepare($sql);
             if ($currentuser['username'] == 'zadmin') {
                 //no bind needed
             } else {
                 //bind the username
                 $sql->bindParam(':userid', $currentuser['userid']);
             }
             $sql->execute();
             while ($rowclients = $sql->fetch()) {
                 if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'inShadow_' . $rowclients['ac_id_pk']))) {
                     ctrl_auth::KillCookies();
                     ctrl_auth::SetSession('ruid', $currentuser['userid']);
                     ctrl_auth::SetUserSession($rowclients['ac_id_pk'], runtime_sessionsecurity::getSessionSecurityEnabled());
                     header("location: /");
                     exit;
                 }
             }
         }
     }
 }
コード例 #24
0
 static function CheckForErrors()
 {
     global $zdbh;
     global $controller;
     $currentuser = ctrl_users::GetUserDetail();
     $dnsrecords = array();
     //Grab form inputs in array and assign them to variables
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'domainName'))) {
         $domainName = $controller->GetControllerRequest('FORM', 'domainName');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'domainID'))) {
         $domainID = $controller->GetControllerRequest('FORM', 'domainID');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'ttl'))) {
         $ttl = $controller->GetControllerRequest('FORM', 'ttl');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'original_ttl'))) {
         $original_ttl = $controller->GetControllerRequest('FORM', 'original_ttl');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'target'))) {
         $target = $controller->GetControllerRequest('FORM', 'target');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'original_target'))) {
         $original_target = $controller->GetControllerRequest('FORM', 'original_target');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'type'))) {
         $type = $controller->GetControllerRequest('FORM', 'type');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'delete'))) {
         $delete = $controller->GetControllerRequest('FORM', 'delete');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'hostName'))) {
         $hostName = $controller->GetControllerRequest('FORM', 'hostName');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'priority'))) {
         $priority = $controller->GetControllerRequest('FORM', 'priority');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'original_priority'))) {
         $original_priority = $controller->GetControllerRequest('FORM', 'original_priority');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'weight'))) {
         $weight = $controller->GetControllerRequest('FORM', 'weight');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'original_weight'))) {
         $original_weight = $controller->GetControllerRequest('FORM', 'original_weight');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'port'))) {
         $port = $controller->GetControllerRequest('FORM', 'port');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'original_port'))) {
         $original_port = $controller->GetControllerRequest('FORM', 'original_port');
     }
     if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'newRecords'))) {
         $newRecords = $controller->GetControllerRequest('FORM', 'newRecords');
     }
     //Get all existing records for domain and add the id's to an array
     $numrows = $zdbh->prepare('SELECT COUNT(*) FROM x_dns WHERE dn_acc_fk=:userid AND dn_vhost_fk=:domainID AND dn_deleted_ts IS NULL');
     $numrows->bindParam(':userid', $currentuser['userid']);
     $numrows->bindParam(':domainID', $domainID);
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             $sql = $zdbh->prepare('SELECT dn_id_pk FROM x_dns WHERE dn_acc_fk=:userid AND dn_vhost_fk=:domainID AND dn_deleted_ts IS NULL');
             $sql->bindParam(':userid', $currentuser['userid']);
             $sql->bindParam(':domainID', $domainID);
             $sql->execute();
             while ($rowdns = $sql->fetch()) {
                 $dnsrecords[] = $rowdns['dn_id_pk'];
             }
         }
     }
     //Existing Records
     //Sort through the dns record array by id and update as needed
     foreach ($dnsrecords as $id) {
         if ($delete[$id] == "false") {
             //TTL
             if (isset($ttl[$id]) && !fs_director::CheckForEmptyValue($ttl[$id]) && $ttl[$id] != $original_ttl[$id]) {
                 if (!is_numeric($ttl[$id])) {
                     self::SetError('TTL must be a numeric value.');
                     return FALSE;
                 }
             }
             //TARGET
             if (isset($target[$id]) && !fs_director::CheckForEmptyValue($target[$id]) && $target[$id] != $original_target[$id]) {
                 if ($type[$id] == "A") {
                     if (!self::IsValidIPv4($target[$id])) {
                         self::SetError('IP Address is not a valid IPV4 address.');
                         return FALSE;
                     }
                 } elseif ($type[$id] == "AAAA") {
                     if (!self::IsValidIPv6($target[$id])) {
                         self::SetError('IP Address is not a valid IPV6 address');
                         return FALSE;
                     }
                 } elseif ($type[$id] == "TXT") {
                 } elseif ($type[$id] == "SPF") {
                 } else {
                     if (!self::IsValidIP($target[$id])) {
                         if (!self::IsValidDomainName($target[$id])) {
                             self::SetError('An invalid domain name character was entered. Domain names are limited to alphanumeric characters and hyphens.');
                             return FALSE;
                         }
                     }
                     if (!self::IsValidDomainName($target[$id])) {
                         if (!self::IsValidIP($target[$id])) {
                             self::SetError('Target is not a valid IP address');
                             return FALSE;
                         }
                     }
                 }
             }
             //PRIORITY
             if (isset($priority[$id]) && !fs_director::CheckForEmptyValue($priority[$id]) && $priority[$id] != $original_priority[$id]) {
                 if (!is_numeric($priority[$id])) {
                     self::SetError('Priority must be a numeric value.');
                     return FALSE;
                 }
                 if ($priority[$id] < 0 || $priority[$id] > 65535) {
                     self::SetError('The priority of a dns record must be a numeric value between 0 and 65535');
                     return FALSE;
                 }
             }
             //WEIGHT
             if (isset($weight[$id]) && !fs_director::CheckForEmptyValue($weight[$id]) && $weight[$id] != $original_weight[$id]) {
                 if (!is_numeric($weight[$id])) {
                     self::SetError('Weight must be a numeric value.');
                     return FALSE;
                 }
                 if ($weight[$id] < 0 || $weight[$id] > 65535) {
                     self::SetError('The weight of a dns record must be a numeric value between 0 and 65535');
                     return FALSE;
                 }
             }
             //PORT
             if (isset($port[$id]) && !fs_director::CheckForEmptyValue($port[$id]) && $port[$id] != $original_port[$id]) {
                 if (!is_numeric($port[$id])) {
                     self::SetError('PORT must be a numeric value.');
                     return FALSE;
                 }
                 if ($port[$id] < 0 || $port[$id] > 65535) {
                     self::SetError('The port of a dns record must be a numeric value between 0 and 65535');
                     return FALSE;
                 }
             }
         }
     }
     //NEW Records
     //Find all new records in post array
     if (isset($newRecords) && !fs_director::CheckForEmptyValue($newRecords)) {
         $numnew = $newRecords;
         for ($id = 1; $id <= $numnew; $id++) {
             $NewId = 'new_' . $id;
             if (isset($type[$NewId])) {
                 if ($delete[$NewId] == "false" && !fs_director::CheckForEmptyValue($type[$NewId])) {
                     //HOSTNAME
                     if (isset($hostName[$NewId]) && !fs_director::CheckForEmptyValue($hostName[$NewId]) && $hostName[$NewId] != "@") {
                         //Check that hostname does not already exist.
                         $numrows = $zdbh->prepare('SELECT dn_id_pk FROM x_dns WHERE dn_host_vc=:hostName2 AND dn_vhost_fk=:domainID AND dn_deleted_ts IS NULL');
                         $hostName2 = $hostName[$NewId];
                         $numrows->bindParam(':hostName2', $hostName2);
                         $numrows->bindParam(':domainID', $domainID);
                         $numrows->execute();
                         if ($numrows->fetch()) {
                             self::SetError('Hostnames must be unique.');
                             return FALSE;
                         }
                         if ($type[$NewId] != "SRV") {
                             if (!($hostName[$NewId] == '*' or self::IsValidTargetName($hostName[$NewId]))) {
                                 self::SetError('Hostname invalid.');
                                 return FALSE;
                             }
                         }
                     }
                     //TTL
                     if (isset($ttl[$NewId]) && !fs_director::CheckForEmptyValue($ttl[$NewId])) {
                         if (!is_numeric($ttl[$NewId])) {
                             self::SetError('TTL must be a numeric value.');
                             return FALSE;
                         }
                     }
                     //TARGET
                     if (isset($target[$NewId]) && !fs_director::CheckForEmptyValue($target[$NewId])) {
                         if ($type[$NewId] == "A") {
                             if (!self::IsValidIPv4($target[$NewId])) {
                                 self::SetError('IP Address is not a valid IPV4 address.');
                                 return FALSE;
                             }
                         } elseif ($type[$NewId] == "AAAA") {
                             if (!self::IsValidIPv6($target[$NewId])) {
                                 self::SetError('IP Address is not a valid IPV6 address');
                                 return FALSE;
                             }
                         } elseif ($type[$NewId] == "TXT") {
                         } elseif ($type[$NewId] == "SPF") {
                         } elseif ($type[$NewId] == "NS") {
                         } else {
                             if (!self::IsValidIP($target[$NewId])) {
                                 if (!self::IsValidDomainName($target[$NewId])) {
                                     self::SetError('An invalid domain name character was entered. Domain names are limited to alphanumeric characters and hyphens.');
                                     return FALSE;
                                 }
                             }
                             if (!self::IsValidDomainName($target[$NewId])) {
                                 if (!self::IsValidIP($target[$NewId])) {
                                     self::SetError('Target is not a valid IP address');
                                     return FALSE;
                                 }
                             }
                         }
                     }
                     //PRIORITY
                     if (isset($priority[$NewId]) && !fs_director::CheckForEmptyValue($priority[$NewId])) {
                         if (!is_numeric($priority[$NewId])) {
                             self::SetError('Priority must be a numeric value.');
                             return FALSE;
                         }
                         if ($priority[$NewId] < 0 || $priority[$NewId] > 65535) {
                             self::SetError('The priority of a dns record must be a numeric value between 0 and 65535');
                             return FALSE;
                         }
                     }
                     //WEIGHT
                     if (isset($weight[$NewId]) && !fs_director::CheckForEmptyValue($weight[$NewId])) {
                         if (!is_numeric($weight[$NewId])) {
                             self::SetError('Weight must be a numeric value.');
                             return FALSE;
                         }
                         if ($weight[$NewId] < 0 || $weight[$NewId] > 65535) {
                             self::SetError('The weight of a dns record must be a numeric value between 0 and 65535');
                             return FALSE;
                         }
                     }
                     //PORT
                     if (isset($port[$NewId]) && !fs_director::CheckForEmptyValue($port[$NewId])) {
                         if (!is_numeric($port[$NewId])) {
                             self::SetError('PORT must be a numeric value.');
                             return FALSE;
                         }
                         if ($port[$NewId] < 0 || $port[$NewId] > 65535) {
                             self::SetError('The port of a dns record must be a numeric value between 0 and 65535');
                             return FALSE;
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
コード例 #25
0
ファイル: controller.ext.php プロジェクト: Boter/madmin-core
 static function DisplaypBar($total, $quota)
 {
     $currentuser = ctrl_users::GetUserDetail();
     $typequota = $currentuser[$quota];
     $type = ctrl_users::GetQuotaUsages($total, $currentuser['userid']);
     if ($typequota == 0) {
         return '';
     }
     //Quota are disabled
     if (fs_director::CheckForEmptyValue($type)) {
         return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=0"/>';
     }
     if ($type == $typequota) {
         return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=100"/>';
     }
     return '<img src="etc/lib/pChart2/MADmin/zProgress.php?percent=' . round($type / $typequota * 100, 0) . '"/>';
 }
コード例 #26
0
ファイル: controller.ext.php プロジェクト: Boter/madmin-core
 static function getIsReseller()
 {
     global $controller;
     $currentuser = ctrl_users::GetUserDetail();
     return self::CheckHasPackage($currentuser['userid']);
 }
コード例 #27
0
ファイル: usergroup.class.php プロジェクト: Boter/madmin-core
 public static function Template()
 {
     $user_array = ctrl_users::GetUserDetail();
     return $user_array['usergroup'];
 }
コード例 #28
0
ファイル: usedemail.class.php プロジェクト: Boter/madmin-core
 public static function Template()
 {
     $currentuser = ctrl_users::GetUserDetail();
     return ctrl_users::GetQuotaUsages('mailboxes', $currentuser['userid']);
 }
コード例 #29
0
function TriggerApacheQuotaUsage()
{
    global $zdbh;
    global $controller;
    $sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_deleted_ts IS NULL");
    $sql->execute();
    while ($rowvhost = $sql->fetch()) {
        if ($rowvhost['vh_enabled_in'] == 1 && ctrl_users::CheckUserEnabled($rowvhost['vh_acc_fk']) || $rowvhost['vh_enabled_in'] == 1 && ctrl_options::GetSystemOption('apache_allow_disabled') == strtolower("true")) {
            //$checksize = $zdbh->query("SELECT * FROM x_bandwidth WHERE bd_month_in = " . date("Ym") . " AND bd_acc_fk = " . $rowvhost['vh_acc_fk'] . "")->fetch();
            $date = date("Ym");
            $findsize = $zdbh->prepare("SELECT * FROM x_bandwidth WHERE bd_month_in = :date AND bd_acc_fk = :acc");
            $findsize->bindParam(':date', $date);
            $findsize->bindParam(':acc', $rowvhost['vh_acc_fk']);
            $findsize->execute();
            $checksize = $findsize->fetch();
            $currentuser = ctrl_users::GetUserDetail($rowvhost['vh_acc_fk']);
            if ($checksize['bd_diskover_in'] != $checksize['bd_diskcheck_in'] && $checksize['bd_diskover_in'] == 1) {
                echo "Disk usage over quota, triggering Apache..." . fs_filehandler::NewLine();
                $updateapache = $zdbh->prepare("UPDATE x_settings SET so_value_tx = 'true' WHERE so_name_vc ='apache_changed'");
                $updateapache->execute();
                //$updateapache = $zdbh->query("UPDATE x_bandwidth SET bd_diskcheck_in = 1 WHERE bd_acc_fk =" . $rowvhost['vh_acc_fk'] . "");
                $updateapache2 = $zdbh->prepare("UPDATE x_bandwidth SET bd_diskcheck_in = 1 WHERE bd_acc_fk = :acc");
                $updateapache2->bindParam(':acc', $rowvhost['vh_acc_fk']);
                $updateapache2->execute();
            }
            if ($checksize['bd_diskover_in'] != $checksize['bd_diskcheck_in'] && $checksize['bd_diskover_in'] == 0) {
                echo "Disk usage under quota, triggering Apache..." . fs_filehandler::NewLine();
                $updateapache = $zdbh->prepare("UPDATE x_settings SET so_value_tx = 'true' WHERE so_name_vc ='apache_changed'");
                $updateapache->execute();
                //$updateapache = $zdbh->query("UPDATE x_bandwidth SET bd_diskcheck_in = 0 WHERE bd_acc_fk =" . $rowvhost['vh_acc_fk'] . "");
                $updateapache2 = $zdbh->prepare("UPDATE x_bandwidth SET bd_diskcheck_in = 0 WHERE bd_acc_fk = :acc");
                $updateapache2->bindParam(':acc', $rowvhost['vh_acc_fk']);
                $updateapache2->execute();
            }
            if ($checksize['bd_transover_in'] != $checksize['bd_transcheck_in'] && $checksize['bd_transover_in'] == 1) {
                echo "Bandwidth usage over quota, triggering Apache..." . fs_filehandler::NewLine();
                $updateapache = $zdbh->prepare("UPDATE x_settings SET so_value_tx = 'true' WHERE so_name_vc ='apache_changed'");
                $updateapache->execute();
                //$updateapache = $zdbh->query("UPDATE x_bandwidth SET bd_transcheck_in = 1 WHERE bd_acc_fk =" . $rowvhost['vh_acc_fk'] . "");
                $updateapache2 = $zdbh->prepare("UPDATE x_bandwidth SET bd_transcheck_in = 1 WHERE bd_acc_fk = :acc");
                $updateapache2->bindParam(':acc', $rowvhost['vh_acc_fk']);
                $updateapache2->execute();
            }
            if ($checksize['bd_transover_in'] != $checksize['bd_transcheck_in'] && $checksize['bd_transover_in'] == 0) {
                echo "Bandwidth usage under quota, triggering Apache..." . fs_filehandler::NewLine();
                $updateapache = $zdbh->prepare("UPDATE x_settings SET so_value_tx = 'true' WHERE so_name_vc ='apache_changed'");
                $updateapache->execute();
                //$updateapache = $zdbh->query("UPDATE x_bandwidth SET bd_transcheck_in = 0 WHERE bd_acc_fk =" . $rowvhost['vh_acc_fk'] . "");
                $updateapache2 = $zdbh->prepare("UPDATE x_bandwidth SET bd_transcheck_in = 0 WHERE bd_acc_fk = :acc");
                $updateapache2->bindParam(':acc', $rowvhost['vh_acc_fk']);
                $updateapache2->execute();
            }
        }
    }
}
コード例 #30
0
ファイル: editor.php プロジェクト: TGates71/error_pages
 */
-->
<?php 
include '../../../cnf/db.php';
include '../../../dryden/db/driver.class.php';
include '../../../dryden/debug/logger.class.php';
include '../../../dryden/runtime/dataobject.class.php';
include '../../../dryden/ctrl/options.class.php';
include '../../../dryden/ctrl/auth.class.php';
include '../../../dryden/ctrl/users.class.php';
include '../../../inc/dbc.inc.php';
include 'controller.ext.php';
session_start();
if (isset($_SESSION['zpuid'])) {
    $userid = $_SESSION['zpuid'];
    $currentuser = ctrl_users::GetUserDetail($userid);
    $hostdatadir = ctrl_options::GetOption('hosted_dir') . "" . $currentuser['username'];
    $userName = $currentuser['username'];
}
// configuration
$selectedDomain = $_GET['domain'];
$url = "/modules/error_pages/code/editor.php";
$file = $hostdatadir . "/public_html" . $selectedDomain . "/_errorpages/";
$selectedDomainName = str_replace('_', '.', $selectedDomain);
$selectedDomainName = str_replace('/', '', $selectedDomainName);
?>
<script src="ckeditor/ckeditor.js"></script>
<!-- restore default pages confirm box -->
<script type="text/javascript">
	function confSubmit(form) {
		if (confirm("Are you sure you want to Restore the Default Pages?")) {