GIF89a; EcchiShell v1.0
//etc/zpanel/panel/dryden/ctrl/

$name); $zdbh->bindQuery($sqlString, $bindArray); $result = $zdbh->returnRow(); if ($result) { return $result['so_value_tx']; } else { return false; } } /** * An alias of 'GetSystemOption' to 'fix' the recent refactor of the sentora code, this was affecting third-party modules which relied on this old function name. * @author Bobby Allen * @param string $name The name of the system option. * @return string The system option value. * @deprecated since version 10.0.1 */ static function GetOption($name) { return self::GetSystemOption($name); } /** * 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. Sentora_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'); } /** * Gets user account information. * @author Bobby Allen (ballen@bobbyallen.me) * @global db_driver $zdbh The ZPX database handle. * @param int $id The user account ID. * @return mixed If the user exists it will return an array containing the account details for the user otherwise if the user doesn't exist will return 'false'. */ static function GetUserInfo($id) { global $zdbh; $bindArray = array( ':id' => $id, ); $sqlStatment = $zdbh->bindQuery("SELECT * FROM x_accounts WHERE ac_id_pk = :id", $bindArray); $results = $zdbh->returnRow(); if ($result) { return $result; } else { return false; } } /** * Gets user package information. * @author Bobby Allen (ballen@bobbyallen.me) * @global db_driver $zdbh The ZPX database handle. * @param int $id The user account ID. * @return mixed If the user and package details exist it will return an array containing the user's package details otherwise will return 'false'. */ static function GetPackageInfo($id) { global $zdbh; $bindArray = array( ':id' => $id, ); $sqlStatment = $zdbh->bindQuery("SELECT * FROM x_accounts WHERE ac_id_pk = :id", $bindArray); $results = $zdbh->returnRow(); if ($result) { $packageid = $result['ac_id_pk']; $result = $zdbh->query("SELECT * FROM x_packages WHERE pk_id_pk = '$packageid'")->Fetch(); if ($result) { return $result; } else { return false; } } else { return false; } } /** * Checks for predefined avaliable options to choose from. * @author Bobby Allen (ballen@bobbyallen.me) * @param string $dval The list of predefined values (seperated with a '|' pipe charater!) * @return boolean */ public static function CheckForPredefinedOptions($dval) { if ($dval == "") return false; return true; } /** * Dynamically builds a standard text field and will populate with a value if one is set. * @author Bobby Allen (ballen@bobbyallen.me) * @param string $name The name to use for the tag. * @param string $cval Current value of the field. * @return string The HTML code for the generated text field. */ public static function OutputSettingTextField($name, $cval = "", $readonly = false) { if($readonly){ $readonly = "readonly"; } if ($cval == "") return "\n"; return "\n"; } /** * Dynamicaly builds a single line text area and will populate with a value if one is set. * @author Bobby Allen (ballen@bobbyallen.me) * @param string $name The name to use for the "; } /** * Dynamically builds a drop-down menu of avaliable options based on predfined list of values (seperated with a '|' pipe character!) * @author Bobby Allen (ballen@bobbyallen.me) * @param string $name The name to use for the \n"; foreach ($values as $option) { if ($cval != $option) { $field .= "\t\n"; } else { $field .= "\t\n"; } } $field .= "\n"; return $field; } public static function CheckCloudLinuxStatus(){ return false; $cloudlinux = true; $cl_output=shell_exec('grep "^NAME=" /etc/os-release | awk -F"=" \'{ print $2 }\' | tr -d "\""'); if(!$cl_output){ $cloudlinux=false; } if(!is_dir('/opt/cloudlinux') || !is_dir('/scripts/cloudlinux')){ $cloudlinux=false; } $selectorctl=shell_exec("whereis selectorctl | awk '{ print $2 }'"); if(!$selectorctl){ $cloudlinux=false; } $lvectl=shell_exec("whereis lvectl | awk '{ print $2 }'"); if(!$lvectl){ $cloudlinux=false; } $quota=shell_exec("whereis quota | awk '{ print $2 }'"); if(!$quota){ $cloudlinux=false; } return $cloudlinux; } public static function CheckDiskUsageLimit($uid){ global $zdbh; $sql_for_quotas="SELECT qt_diskspace_bi FROM x_accounts JOIN x_quotas ON ac_package_fk = qt_package_fk WHERE ac_id_pk=:uid"; $sql_for_quotas = $zdbh->prepare($sql_for_quotas); $sql_for_quotas->bindParam(':uid', $uid); $sql_for_quotas->execute(); if($sql_for_quotas->rowCount() != 0){ $res = $sql_for_quotas->fetch(); $LimitDisk = $res['qt_diskspace_bi']; if($LimitDisk == 0) return false; $UsageDisk = ctrl_users::GetQuotaUsages('diskspace',$uid); $TotalDisk = round($UsageDisk / $LimitDisk * 100); if($TotalDisk > 90){ return true; }else{ return false; } return false; } } public static function RebuiltLighttpdConfiguration(){ global $zdbh; $RebuiltLighttpd = false; $cp_path = shell_exec("whereis cp | awk '{ print $2 }'| tr -d \"\n\""); $sed_path = shell_exec("whereis sed | awk '{ print $2 }'| tr -d \"\n\""); $sql="SELECT ac_user_vc FROM x_accounts WHERE ac_user_vc != 'zadmin' AND ac_deleted_ts IS NULL"; $sql = $zdbh->prepare($sql); $sql->execute(); while($result = $sql->fetch()){ $USERNAME = $result['ac_user_vc']; $user_config_lighttp = "/etc/lighttpd/$USERNAME-socket-include.conf"; $user_socket_lighttp = "/etc/sentora/panel/fastcgi/$USERNAME-startup.sh"; if(!file_exists($user_config_lighttp)){ $RebuiltLighttpd = true; $cmd = "$cp_path /etc/sentora/panel/fastcgi/.lighttpd_socket_conf.txt $user_config_lighttp"; shell_exec($cmd); $cmd = "$sed_path -i 's/OVIPANEL_FASTCGI_SOCKET_USER/$USERNAME/g' $user_config_lighttp"; shell_exec($cmd); } if(!file_exists($user_socket_lighttp)){ $RebuiltLighttpd = true; $cmd = "$cp_path /etc/sentora/panel/fastcgi/.startup.txt $user_socket_lighttp"; shell_exec($cmd); $cmd = "$sed_path -i 's/OVIPANEL_FASTCGI_SOCKET_USER/$USERNAME/g' $user_socket_lighttp"; shell_exec($cmd); } } if($RebuiltLighttpd === TRUE){ $service_path = shell_exec("whereis service | awk '{ print $2 }'| tr -d \"\n\""); shell_exec("$service_path lighttpd force-reload"); } } } ?>