Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Loader)
- *
- * @ Version : 2.0.0.3
- * @ Author : DeZender
- * @ Release on : 06.05.2013
- * @ Official site : http://DeZender.Net
- *
- */
- /**
- * Calculation of Microtime
- *
- * @package time
- * @author Pulkit Gupta
- * @return Returns $usec and $sec
- * @since 1.0
- */
- function microtime_float() {
- list($usec, $sec) = explode(" ", microtime());
- return (double)$usec + (double)$sec;
- }
- /**
- * Is a substitute for the date() function. Will return the date in GMT by default.
- *
- * @package time
- * @author Pulkit Gupta
- * @param int $timestamp The timestamp to format
- * @param bool $today If true then a Today will be added instead of the date if the date is today
- * @param bool $adjust If true then the time will be adjusted to GMT
- * @param string $format The date() funtions format style
- * @return string The Date in the format given
- * @since 1.0
- */
- function datify($timestamp, $today = true, $adjust = true, $format = false) {
- global $l;
- global $user;
- global $globals;
- if (!empty($adjust))
- {
- $timestamp = max(0, $timestamp - (date("Z", time()) / 3600 - $globals["pgtimezone"]) * 3600);
- }
- if (!empty($format))
- {
- return date($format, $timestamp);
- }
- $todaytime = max(0, time() - (date("Z", time()) / 3600 - $globals["pgtimezone"]) * 3600);
- if ($today && date("F j, Y", $timestamp) == date("F j, Y", $todaytime))
- {
- $time = date("g:i a", $timestamp);
- return $l["today"] . $time;
- }
- return date("F j, Y, g:i a", $timestamp);
- }
- /**
- * Generate a random string for the given length
- *
- * @package string
- * @author Pulkit Gupta
- * @param int $length The number of charactes that should be returned
- * @return string Randomly geterated string of the given number of charaters
- * @since 1.0
- */
- function generateRandStr($length, $special = 0) {
- global $globals;
- global $softpanel;
- $randstack = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
- $specialchars = array("!", "[", "]", "(", ")", ".", "-", "@");
- if (!empty($softpanel["special_pass_chars"]))
- {
- $specialchars = $softpanel->special_pass_chars;
- }
- $randstr = "";
- while (strlen($randstr) < $length)
- {
- $randstr .= $randstack[array_rand($randstack)];
- if (!(!empty($special) && strlen($randstr) < $length && strlen($randstr) % 2 == 0))
- {
- continue;
- }
- $randstr .= $specialchars[array_rand($specialchars)];
- continue;
- }
- return str_shuffle($randstr);
- }
- /**
- * Takes care of Slashes
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string The string that will be processed
- * @return string A string that is safe to use for Database Queries, etc
- * @since 1.0
- */
- function inputsec($string) {
- if (!get_magic_quotes_gpc())
- {
- $string = addslashes($string);
- }
- else
- {
- $string = stripslashes($string);
- $string = addslashes($string);
- }
- $string = str_replace("`", "\\`", $string);
- return $string;
- }
- /**
- * Converts Special characters to html entities
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string The string containing special characters
- * @return string A string containing special characters replaced by html entities of the format &#ASCIICODE;
- * @since 1.0
- */
- function htmlizer($string) {
- global $globals;
- $string = htmlentities($string, ENT_QUOTES, $globals["charset"]);
- $string = preg_replace("/(&#(\\d{1,7}|x[0-9a-fA-F]{1,6});)/e", "entity_check(\\2);", $string);
- return $string;
- }
- /**
- * Used in function htmlizer()
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string
- * @return string
- * @since 1.0
- */
- function entity_check($string) {
- $num = substr($string, 0, 1) === "x" ? (hexdec(substr($string, 1))) : ((int)$string);
- $string = ((1114111 < $num) && (55296 <= $num && $num < 57343)) && $num < 32 ? "" : ("&#" . $num . ";");
- return $string;
- }
- /**
- * Cleans i.e. adds a slash (\) to a given variable
- *
- * @package string
- * @author Pulkit Gupta
- * @param array $var An array of arrays and strings
- * @return array
- * @since 1.0
- */
- function cleanVARS($var) {
- if (is_string($var))
- {
- $var = array($var);
- }
- foreach ($var as $k => $v)
- {
- if (is_array($v))
- {
- $var[$k] = cleanVARS($v);
- continue;
- }
- if (get_magic_quotes_gpc())
- {
- $v = stripslashes($v);
- }
- $v = htmlizer($v);
- $var[$k] = $v;
- continue;
- }
- return $var;
- }
- /**
- * This is used to make a query whenever required.
- *
- * @package database
- * @author Pulkit Gupta
- * @param string $query The MySQL QUERY String
- * @param boolean $count
- * @return resource The MySQL resource if the query was successful
- * @since 1.0
- */
- function makequery($query, $count = true) {
- global $user;
- global $conn;
- global $dbtables;
- global $logged_in;
- global $globals;
- global $l;
- global $theme;
- $result = soft_mysql_query($query, $conn);
- if (!$result)
- {
- die("Could not make the Query.<br /><br /><br />" . $query . "<br /><br />MySQL Error No : " . soft_mysql_errno($conn) . "<br /><br />MySQL Error : " . soft_mysql_error($conn));
- }
- if ($count)
- {
- $globals["queries"]++;
- }
- $globals["output_queries"] = 0;
- if (!empty($globals["output_queries"]))
- {
- echo "Queries: " . $query . "<br /><br />";
- }
- return $result;
- }
- /**
- * Checks if the given email is a VALID email address
- *
- * @package email
- * @author Pulkit Gupta
- * @param string $email The email address
- * @return boolean Returns true if valid, Returns False if invalid
- * @since 1.0
- */
- function emailvalidation($email) {
- $puny_email = check_punycode($email);
- if (!preg_match("/^([a-zA-Z0-9+])+([a-zA-Z0-9+\\._-])*@([a-zA-Z0-9+_-])+([.])+([a-zA-Z0-9\\._-]+)+\$/", $puny_email))
- {
- return false;
- }
- return true;
- }
- /**
- * Clean explode a string
- *
- * @package strings
- * @author Pulkit Gupta
- * @param string $chars The string to explode with
- * @param string $str The string to explode
- * @param int $int Are the results supposed to be integers
- * @return array Returns the exploded array after trimming
- * @since 1.0
- */
- function cexplode($chars, $str, $int = 0) {
- $r = explode($chars, $str);
- foreach ($r as $k => $v)
- {
- if ($int)
- {
- $r[$k] = (int)trim($v);
- continue;
- }
- $r[$k] = trim($v);
- continue;
- }
- return $r;
- }
- /**
- * Sends email(s) using PHP's mail() function or using SMTP.
- *
- * @package email
- * @author Pulkit Gupta
- * @param array $array, $array stands for mail(s). It loops on the basis of number of elements in it.
- * @return boolean
- * @since 1.0
- */
- function _mail($array) {
- global $user;
- global $globals;
- global $theme;
- global $conn;
- global $dbtables;
- include_once $globals["mainfiles"] . "/functions/mail_functions.php";
- hooks("pre_mail", $array);
- return _mail_fn($array);
- }
- /**
- * A funtion to insert an array within a array after a particular position
- *
- * @package arrays
- * @author Pulkit Gupta
- * @param array $array
- * @param int $position
- * @param array $insert_array
- * @return array The resulting array
- * @since 1.0
- */
- function array_insert(&$array, $position, $insert_array) {
- $first_array = array_splice($array, 0, $position);
- $array = array_merge($first_array, $insert_array, $array);
- return;
- }
- /**
- * This is complementary to the function array_insert() as it finds the position of a key
- *
- * @package arrays
- * @author Pulkit Gupta
- * @param array $array
- * @param int $index
- * @return int
- * @since 1.0
- */
- function find_pos($array, $index) {
- $keys = array_keys($array);
- $key = array_search($index, $keys);
- return $key + 1;
- }
- /**
- * Converts htmlentities to their real characters
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string The string containing htmlentities
- * @return string Returns translated string
- * @since 1.0
- */
- function unhtmlentities($string) {
- $string = preg_replace("~&#x([0-9a-f]+);~ei", "chr(hexdec(\"\\1\"))", $string);
- $string = preg_replace("~&#([0-9]+);~e", "chr(\"\\1\")", $string);
- $trans_tbl = get_html_translation_table(HTML_ENTITIES);
- $trans_tbl = array_flip($trans_tbl);
- return strtr($string, $trans_tbl);
- }
- /**
- * This function just redirects to the Location specified and dies
- * Primary Base $globals['index_url']
- *
- * @package headers
- * @author Pulkit Gupta
- * @param string $location The location to redirect to
- * @param boolean $header If true the header() function is used otherwise the HTML <meta> tag is used
- * @return NULL
- * @since 1.0
- */
- function redirect($location, $header = true, $raw = false) {
- global $globals;
- global $redirect;
- global $softpanel;
- $redirect = true;
- $prefix = empty($raw) ? ($globals["index"]) : "";
- if (((isset($_SERVER["argv"])) && isset($argv)) && isset($softpanel["softredirect"]))
- {
- $header = false;
- }
- if ($header)
- {
- header("Location: " . $prefix . $location);
- return null;
- }
- echo "<meta http-equiv=\"Refresh\" content=\"0;url=" . $prefix . $location . "\">";
- return;
- }
- /**
- * Returns the extension for the filename given
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $fname The filename e.g. filename.php
- * @return string Returns extension of file e.g. php
- * @since 1.0
- */
- function get_extension($fname) {
- $temp_r = explode(".", $fname);
- $ext = $temp_r[count($temp_r) - 1];
- return $ext;
- }
- /**
- * Detects whether the BROWSER has the capability to handle gzip or x-gzip compression
- *
- * @package browser
- * @author Pulkit Gupta
- * @return string The supported compression or false if no compression is supported
- * @since 1.0
- */
- function can_gzip() {
- global $isbot;
- if ((headers_sent() || connection_aborted()) && !empty($isbot))
- {
- return 0;
- }
- if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "x-gzip") !== false)
- {
- return "x-gzip";
- }
- if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false)
- {
- return "gzip";
- }
- return 0;
- }
- /**
- * Output buffer that controls the output of a page. ATM is not in use
- *
- * @package buffer
- * @author Pulkit Gupta
- * @param string $buffer
- * @return string The output buffer
- * @since 1.0
- */
- function softaculous_buffer($buffer) {
- global $globals;
- global $redirect;
- if (!empty($redirect))
- {
- return null;
- }
- if (!empty($globals["stop_buffer_process"]))
- {
- return $buffer;
- }
- if (preg_match("/\\<html(.*?)/is", $buffer))
- {
- if (empty($globals["lictype"]))
- {
- if (!preg_match("/" . preg_quote(unhtmlentities(strrev(";tg&a/;tl&.cnI suolucatfoS;tg&;touq&moc.suolucatfos.www//:ptth;touq&=ferh a;tl& 9002 ;ypoc;pma& ;tg&a/;tl&0.1 suolucatfoS eerF yB derewoP;tg&;touq&moc.suolucatfos.www//:ptth;touq&=ferh a;tl&")), "/") . "/", $buffer))
- {
- return null;
- }
- }
- if (!preg_match("/" . preg_quote(unhtmlentities(strrev(";tg&a/;tl&.cnI suolucatfoS;tg&;touq&moc.suolucatfos.www//:ptth;touq&=ferh a;tl& 9002 ;ypoc;pma& ;tg&a/;tl&0.1 suolucatfoS yB derewoP;tg&;touq&moc.suolucatfos.www//:ptth;touq&=ferh a;tl&")), "/") . "/", $buffer))
- {
- return null;
- }
- }
- if ($globals["gzip"])
- {
- if (extension_loaded("zlib") && @ini_get("zlib.output_compression") !== "1" || can_gzip())
- {
- $buffer = ob_gzhandler($buffer, 1);
- }
- }
- return $buffer;
- }
- /**
- * Loads the Language file specified.
- *
- * @package language
- * @author Pulkit Gupta
- * @param string $file The file name e.g. 'software' (The file extension is not required)
- * @return boolean false on error. Incase of failure a MAJOR ERROR is displayed
- * @since 1.0
- */
- function load_lang($file, $returnpath = false) {
- global $theme;
- global $globals;
- global $l;
- global $user;
- $file = $file . "_lang.php";
- $language = $globals["language"];
- if (!empty($user["language"]))
- {
- $language = $user["language"];
- }
- if (optGET("lang"))
- {
- $language = optGET("lang");
- }
- $path = $globals["enduser"] . "/languages/" . $language . "/" . $file;
- if ($returnpath)
- {
- return $path;
- }
- if ((empty($file)) && !(include_once $path))
- {
- if (!(include_once $globals["enduser"] . "/languages/english/" . $file))
- {
- reporterror("", "Unable to load the language files.");
- return false;
- }
- }
- return true;
- }
- /**
- * Replaces the Soft Variables with the supplied ones
- *
- * @package language
- * @author Pulkit Gupta
- * @param string $str The string containing the soft variable e.g. &soft-1;
- * @param array $array The array that will replace corresponding values in the string. $array[0] replaces &soft-1; and so on
- * @return string Returns the formatted string
- * @since 1.0
- */
- function lang_vars($str, $array) {
- $string = "";
- $str = preg_replace("/&soft-(\\d{1,2});/i", "&soft-\\1;", $str);
- $count = 0;
- foreach ($array as $v)
- {
- ++$count;
- $str = str_replace("&soft-" . $count . ";", $v, $str);
- continue;
- }
- return $str;
- }
- /**
- * This should be called first to initialize the theme file.
- *
- * @package theme
- * @author Pulkit Gupta
- * @param string $file Just the name and not trailing '_theme.php'
- * @param string $theme_file_name The Name of the file if a major error occurs
- * @return boolean false on failure and a major error is displayed
- * @since 1.0
- */
- function init_theme($file, $theme_file_name) {
- global $theme;
- global $globals;
- global $l;
- if (!(include_once $theme["path"] . "/" . $file . "_theme.php"))
- {
- if (!(include_once $globals["euthemes"] . "/default/" . $file . "_theme.php"))
- {
- reporterror($l["init_theme_error_t"], lang_vars($l["init_theme_error"], array($theme_file_name)));
- return false;
- }
- }
- return true;
- }
- /**
- * This should be called to check all the necessary functions exist in a theme
- *
- * @package theme
- * @author Pulkit Gupta
- * @param array $function_r The array of the functions
- * @param string $theme_file_name The Name for major error
- * @return boolean false on failure and a major error is displayed
- * @since 1.0
- */
- function init_theme_func($function_r, $theme_file_name) {
- global $theme;
- global $globals;
- global $act;
- global $load_hf;
- global $l;
- $i = 0;
- while ($i <= count($function_r))
- {
- if (!function_exists($function_r[$i]))
- {
- reporterror($l["init_theme_func_error_t"], lang_vars($l["init_theme_func_error"], array($theme_file_name)));
- return false;
- }
- ++$i;
- continue;
- }
- return true;
- }
- /**
- * This is to load a theme's settings. Call how many ever times required
- *
- * @package theme
- * @author Pulkit Gupta
- * @param string $folder
- * @return boolean
- * @since 1.0
- */
- function load_theme_settings($folder) {
- global $user;
- global $conn;
- global $dbtables;
- global $logged_in;
- global $globals;
- global $l;
- global $theme;
- global $softpanel;
- global $act;
- global $load_hf;
- $skins = array();
- $skin = array();
- $load_hf = true;
- $theme["path"] = $globals["euthemes"] . "/" . $folder;
- if (!(include_once $theme["path"] . "/theme_settings.php"))
- {
- $theme["path"] = $globals["euthemes"] . "/default";
- $globals["theme_folder"] = "default";
- if (!(include_once $theme["path"] . "/theme_settings.php"))
- {
- reporterror("", $l["load_theme_settings_error"]);
- $load_hf = false;
- return false;
- }
- }
- return true;
- }
- /**
- * Report a fatal error to the user
- *
- * @package error
- * @author Pulkit Gupta
- * @param string $title The <title> of the browser
- * @param string $text The text / error that will be shown
- * @param string $heading The heading of the error box
- * @param string $icon An icon will also be displayed
- * @return Returns boolean
- * @since 1.0
- */
- function reporterror($title, $text, $heading = "", $icon = "") {
- global $theme;
- global $globals;
- global $act;
- global $errortitle;
- global $errormessage;
- global $errorheading;
- global $erroricon;
- $act = "error_break";
- $errortitle = $title;
- $errormessage = $text;
- $errorheading = $heading;
- $erroricon = $icon;
- $globals["stop_buffer_process"] = true;
- return true;
- }
- /**
- * Reports a message and will stop every other process
- *
- * @package message
- * @author Pulkit Gupta
- * @param string $title The <title> of the browser
- * @param string $heading The heading of the message box
- * @param string $icon An icon will also be displayed
- * @param string $text The text that will be shown
- * @return Returns boolean
- * @since 1.0
- */
- function reportmessage($title, $heading, $icon, $text) {
- global $theme;
- global $globals;
- global $act;
- global $messagetitle;
- global $messagetext;
- global $messageheading;
- global $messageicon;
- $act = "error_break";
- $messagetitle = $title;
- $messagetext = $text;
- $messageheading = $heading;
- $messageicon = $icon;
- return true;
- }
- /**
- * Gives Copyright information
- *
- * @package copyright
- * @author Pulkit Gupta
- * @return string Returns copyright
- * @since 1.0
- */
- function copyright() {
- global $globals;
- if ($globals["softpanel"] == "ampps")
- {
- return "<a href=\"http://www.ampps.com\">Powered By" . (empty($globals["lictype"]) ? " FREE" : "") . " AMPPS " . $globals["ampps_version"] . "</a> © " . datify(time(), 0, 1, "Y") . " <a href=\"http://www.softaculous.com\">Softaculous Ltd.</a>";
- }
- if (defined("NEW_COPYRIGHT"))
- {
- return NEW_COPYRIGHT;
- }
- if ($globals["softpanel"] == "webuzo")
- {
- return "<a href=\"http://www.webuzo.com\">Powered By Webuzo " . $globals["webuzo_version"] . "</a> © " . datify(time(), 0, 1, "Y") . " <a href=\"http://www.softaculous.com\">Softaculous Ltd.</a>";
- }
- return "<a href=\"http://www.softaculous.com\">Powered By" . (empty($globals["lictype"]) ? " Free" : "") . " Softaculous " . $globals["version"] . "</a> © " . datify(time(), 0, 1, "Y") . " <a href=\"http://www.softaculous.com\">Softaculous Ltd.</a>";
- }
- /**
- * A Function to compress files and folders
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $path Path of file / dir to be compressed
- * @param string $name
- * @param string $method Method of compression zip, bz2, gzip
- * @return Returns compressed file
- * @since 1.0
- */
- function compress($path, $name, $method) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return compress_fn($path, $name, $method);
- }
- /**
- * This function will find the extension and try to decomress zip, tar, tgz, tbz
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file
- * @param string $destination
- * @param int $overwrite
- * @param array $include
- * @param array $exclude
- * @return boolean
- * @since 1.0
- */
- function decompress($file, $destination, $overwrite = 0, $include = array(), $exclude = array()) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return decompress_fn($file, $destination, $overwrite, $include, $exclude);
- }
- /**
- * A Function to create a ZIP file
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file The file that will be created
- * @param string $dir The directory to ZIP
- * @param boolean $overwrite
- * @return boolean False on failure
- * @since 1.0
- */
- function zip($file, $dir, $overwrite = 0) {
- global $globals;
- if (!defined("PCLZIP_TEMPORARY_DIR"))
- {
- define("PCLZIP_TEMPORARY_DIR", $globals["os"] == "linux" ? "/tmp/" : "");
- }
- if (!class_exists("PclZip"))
- {
- include_once $globals["mainfiles"] . "/classes/pclzip.php";
- }
- $archive = new PclZip($file);
- $rempath = is_dir($dir) ? $dir : (dirname($dir));
- $result = $archive->create($dir, PCLZIP_OPT_REMOVE_PATH, $rempath, PCLZIP_OPT_TEMP_FILE_ON);
- if ($result == 0)
- {
- return false;
- }
- return true;
- }
- /**
- * A Function to add file to a ZIP file
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file The existing ZIP file Path
- * @param string $dir The file / directory to add
- * @param string $addpath The path in the zip of the new file(s)
- * @param string $pre
- * @return boolean
- * @since 1.0
- */
- function add_to_zip($file, $dir, $addpath = "", $pre = "") {
- global $globals;
- if (!defined("PCLZIP_TEMPORARY_DIR"))
- {
- define("PCLZIP_TEMPORARY_DIR", $globals["os"] == "linux" ? "/tmp/" : "");
- }
- if (!class_exists("softpclzip"))
- {
- include_once $globals["mainfiles"] . "/classes/softaculous.pclzip.php";
- }
- $archive = new softpclzip($file);
- $rempath = is_dir($dir) ? $dir : (dirname($dir));
- if (empty($pre))
- {
- $result = $archive->_add($dir, PCLZIP_OPT_REMOVE_PATH, $rempath, PCLZIP_OPT_ADD_PATH, $addpath, PCLZIP_OPT_TEMP_FILE_ON);
- }
- else
- {
- $result = $archive->_add($dir, PCLZIP_OPT_REMOVE_PATH, $rempath, PCLZIP_OPT_ADD_PATH, $addpath, PCLZIP_CB_PRE_ADD, $pre, PCLZIP_OPT_TEMP_FILE_ON);
- }
- if ($result == 0)
- {
- if (!empty($_GET["debug"]) && $_GET["debug"] == "soft")
- {
- echo $archive->errorInfo();
- }
- return false;
- }
- return true;
- }
- /**
- * A Function to unzip a ZIP file
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file The ZIP File
- * @param string $destination The Final destination where the file will be unzipped
- * @param int $overwrite Whether to Overwrite existing files
- * @param array $include include files of the given pattern
- * @param array $exclude exclude files of the given pattern
- * @return boolean
- * @since 1.0
- */
- function unzip($file, $destination, $overwrite = 0, $include = array(), $exclude = array(), $ftemp = 0) {
- global $globals;
- global $unzip_inc;
- global $unzip_exc;
- if (!empty($include))
- {
- foreach ($include as $ik => $iv)
- {
- if (empty($iv))
- {
- unset($include[$ik]);
- continue;
- }
- $include[$ik] = preg_quote($iv, "/");
- $include[$ik] = str_replace("\\*", "([a-zA-Z0-9\\._-])*", $include[$ik]);
- continue;
- }
- }
- if (!empty($exclude))
- {
- foreach ($exclude as $ek => $ev)
- {
- if (empty($ev))
- {
- unset($exclude[$ek]);
- continue;
- }
- $exclude[$ek] = preg_quote($ev, "/");
- $exclude[$ek] = str_replace("\\*", "([a-zA-Z0-9\\._-])*", $exclude[$ek]);
- continue;
- }
- }
- $unzip_inc = $include;
- $unzip_exc = $exclude;
- if (!class_exists("softpclzip"))
- {
- include_once $globals["mainfiles"] . "/classes/softaculous.pclzip.php";
- }
- $archive = new softpclzip($file);
- if ($ftemp)
- {
- $result = $archive->_extract(PCLZIP_OPT_PATH, $destination, PCLZIP_CB_PRE_EXTRACT, "inc_exc", PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_TEMP_FILE_ON);
- }
- else
- {
- $result = $archive->_extract(PCLZIP_OPT_PATH, $destination, PCLZIP_CB_PRE_EXTRACT, "inc_exc", PCLZIP_OPT_REPLACE_NEWER);
- }
- if ($result == 0)
- {
- return false;
- }
- return true;
- }
- /**
- * Process includes and excludes of function unzip
- *
- * @package files
- * @author Pulkit Gupta
- * @param $p_event
- * @param $v
- * @return Returns boolean
- * @since 1.0
- */
- function inc_exc($p_event, &$v) {
- global $globals;
- global $unzip_inc;
- global $unzip_exc;
- $include = $unzip_inc;
- $exclude = $unzip_exc;
- if (!empty($include))
- {
- foreach ($include as $ik => $iv)
- {
- if (!!preg_match("/^" . $iv . "\$/is", $v["stored_filename"]))
- {
- continue;
- }
- return 0;
- }
- }
- if (!empty($exclude))
- {
- foreach ($exclude as $ek => $ev)
- {
- if (!preg_match("/^" . $ev . "\$/is", $v["stored_filename"]))
- {
- continue;
- }
- return 0;
- }
- }
- }
- /**
- * This function will decomress zip
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file
- * @param string $destination
- * @param int $overwrite
- * @param array $include
- * @param array $exclude
- * @return boolean
- * @since 1.0
- */
- function decompress_zip($file, $destination, $overwrite = 0, $include, $exclude) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return decompress_zip_fn($file, $destination, $overwrite, $include, $exclude);
- }
- /**
- * A Function to decompress a TGZ flie
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file
- * @param string $destination
- * @param int $overwrite
- * @return boolean
- * @since 1.0
- */
- function decompress_tgz($file, $destination, $overwrite = 0) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return decompress_tgz_fn($file, $destination, $overwrite);
- }
- /**
- * A Function to decompress a TAR flie
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file
- * @param string $destination
- * @param int $overwrite
- * @return boolean
- * @since 1.0
- */
- function decompress_tar($file, $destination, $overwrite = 0) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return decompress_tar_fn($file, $destination, $overwrite);
- }
- /**
- * A Function to decompress a TBZIP2 flie
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file
- * @param string $destination
- * @param int $overwrite
- * @return boolean
- * @since 1.0
- */
- function decompress_tbz($file, $destination, $overwrite = 0) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/compress_functions.php";
- return decompress_tbz_fn($file, $destination, $overwrite);
- }
- /**
- * A Function that creates a file for the given data
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $file Path of the file
- * @param string $data The data to be written
- * @param int $overwrite Overwrite if existing
- * @param octal $chmod The CHMOD value
- * @param string $dchmod The Directory CHMOD if a directory will be created recursively
- * @return boolean
- * @since 1.0
- */
- function writefile($file, $data, $overwrite = 0, $chmod = 0, $dchmod = 0) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return writefile_fn($file, $data, $overwrite, $chmod, $dchmod);
- }
- /**
- * A Function that lists files and folders in a folder
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $startdir The starting directory to scan
- * @param int $searchSubdirs Search Subdirectories
- * @param int $directoriesonly List only directories
- * @param int $maxlevel The maximum level to scan
- * @param int $level Starting Level
- * @return array Returns list of file & folder
- * @since 1.0
- */
- function filelist($startdir = "./", $searchSubdirs = 1, $directoriesonly = 0, $maxlevel = "all", $level = 1) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return filelist_fn($startdir, $searchSubdirs, $directoriesonly, $maxlevel, $level);
- }
- /**
- * A Function that reset lists files
- *
- * @package files
- * @author Pulkit Gupta
- * @since 1.0
- */
- function resetfilelist() {
- global $directorylist;
- $directorylist = array();
- return;
- }
- /**
- * Removes a Directory Recursively
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $path The path of the folder to be removed
- * @return boolean
- * @since 1.0
- */
- function rmdir_recursive($path) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return rmdir_recursive_fn($path);
- }
- /**
- * Copy a Directory from one folder to another
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $source The source directory
- * @param string $destination The destination directory
- * @return boolean
- * @since 1.0
- */
- function copydir($source, $destination) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return copydir_fn($source, $destination);
- }
- /**
- * Copies Recrsively a File / Folder and also maintains the PERMISSIONS and UID and GID
- *
- * @package softaculous
- * @subpackage settings
- * @author Pulkit Gupta
- * @param string $path The Source Path
- * @param string $dest The Destination Path
- * @return bool
- * @since 1.0
- */
- function copy_r($path, $dest) {
- if (is_dir($path))
- {
- @mkdir($dest);
- $stat = stat($path);
- if (!empty($stat["mode"]))
- {
- @chmod($dest, $stat["mode"]);
- }
- if (!empty($stat["uid"]))
- {
- @chown($dest, $stat["uid"]);
- }
- if (!empty($stat["gid"]))
- {
- @chgrp($dest, $stat["gid"]);
- }
- $objects = scandir($path);
- if (0 < sizeof($objects))
- {
- foreach ($objects as $file)
- {
- if (($file == ".") && $file == "..")
- {
- continue;
- }
- copy_r($path . "/" . $file, $dest . "/" . $file);
- continue;
- }
- }
- return true;
- }
- if (is_file($path))
- {
- $ret = copy($path, $dest);
- $stat = stat($path);
- if (!empty($stat["mode"]))
- {
- @chmod($dest, $stat["mode"]);
- }
- if (!empty($stat["uid"]))
- {
- @chown($dest, $stat["uid"]);
- }
- if (!empty($stat["gid"]))
- {
- @chgrp($dest, $stat["gid"]);
- }
- return $ret;
- }
- return false;
- }
- /**
- * A function to load a file from the net
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $url The URL to read
- * @param string $writefilename Instead of returning the data save it to the path given
- * @return string The data fetched
- * @since 1.0
- */
- function get_web_file($url, $writefilename = "") {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return get_web_file_fn($url, $writefilename);
- }
- /**
- * A function to save a web file in a file
- *
- * @package files
- * @author Pulkit Gupta
- * @param string $url The URL to read
- * @param string $path Save the fetched data to the path given
- * @return boolean
- * @since 1.0
- */
- function save_web_file($url, $path) {
- global $globals;
- include_once $globals["mainfiles"] . "/functions/file_functions.php";
- return save_web_file_fn($url, $path);
- }
- /**
- * A function to display preformatted array. Basically adds the <pre> before and after the print_r() output.
- *
- * @package arrays
- * @author Pulkit Gupta
- * @param array $array
- * @return string Best for HTML dump of an array.
- * @since 1.0
- */
- function r_print($array) {
- echo "<pre>";
- print_r($array);
- echo "</pre>";
- return;
- }
- /**
- * A function to find the String Length of a UTF-8 string
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string
- * @return int Returns length of string
- * @since 1.0
- */
- function _strlen($string) {
- global $globals;
- return strlen(utf8_decode($string));
- }
- /**
- * substr() for a UTF-8 string
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string The UTF-8 string
- * @param int $start The position to start at
- * @param int $length The length after the start
- * @return string Returns string
- * @since 1.0
- */
- function _substr($string, $start, $length = null) {
- global $globals;
- $r = preg_split("/(.)/" . ($globals["charset"] == "UTF-8" ? "u" : ""), $string, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
- if ($length === null)
- {
- return implode("", array_slice($r, $start));
- }
- return implode("", array_slice($r, $start, $length));
- }
- /**
- * Function to convert a UTF-8 string into lower case
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string
- * @return string Returns a lower case string
- * @since 1.0
- */
- function _strtolower($string) {
- global $globals;
- global $lower_upper;
- global $upper_lower;
- if ($globals["charset"] != "UTF-8")
- {
- return strtolower($string);
- }
- if (function_exists("mb_strtolower"))
- {
- return mb_strtolower($string, $globals["charset"]);
- }
- include_once $globals["mainfiles"] . "/functions/utf8_functions.php";
- return _strtolower_fn($string);
- }
- /**
- * Function to convert a UTF-8 string into upper case
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string
- * @return string Returns a upper case string
- * @since 1.0
- */
- function _strtoupper($string) {
- global $globals;
- global $upper_lower;
- global $lower_upper;
- if ($globals["charset"] != "UTF-8")
- {
- return strtoupper($string);
- }
- if (function_exists("mb_strtoupper"))
- {
- return mb_strtoupper($string, $globals["charset"]);
- }
- include_once $globals["mainfiles"] . "/functions/utf8_functions.php";
- return _strtoupper_fn($string);
- }
- /**
- * Make the first charater upper case of a UTF-8 string
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $string
- * @return string Returns a string
- * @since 1.0
- */
- function _ucfirst($string) {
- global $globals;
- if ($globals["charset"] != "UTF-8")
- {
- return ucfirst($string);
- }
- return _strtoupper(_substr($string, 0, 1)) . _substr($string, 1);
- }
- /**
- * Functions to find string position in a UTF-8 string
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $haystack
- * @param string $needle
- * @param int $offset
- * @return int Returns an integer of the position of the string found or false if not found
- * @since 1.0
- */
- function _strpos($haystack, $needle, $offset = 0) {
- $c = 0;
- $length = null;
- while ((is_null($length)) && $length < $offset)
- {
- $pos = strpos($haystack, $needle, $offset + $c);
- if ($pos === false)
- {
- return false;
- }
- $length = _strlen(substr($haystack, 0, $pos));
- if (!($length < $offset))
- {
- continue;
- }
- $c = $pos * $length;
- continue;
- }
- return $length;
- }
- /**
- * Unserialize a string and also fixes any broken serialized string before unserializing
- *
- * @package string
- * @author Pulkit Gupta
- * @param string $str
- * @return array Returns an array if successful otherwise false
- * @since 1.0
- */
- function _unserialize($str) {
- $var = @unserialize($str);
- if (empty($var))
- {
- $str = preg_replace("!s:(\\d+):\"(.*?)\";!se", "'s:'._strlen('\$2').':\"\$2\";'", $str);
- $var = @unserialize($str);
- }
- if ($var === false)
- {
- return false;
- }
- return $var;
- }
- /**
- * A compulsory POST which issues a error if the POST[$name] is not there
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The key of the $_POST array i.e. the name of the input / textarea text
- * @param string $e Error to throw if the POST is not made
- * @return string Returns the string if the POST is there otherwise will populate array $error and return false
- * @since 1.0
- */
- function POST($name, $e) {
- global $error;
- if ((!isset($_POST[$name])) && strlen(trim($_POST[$name])) < 1)
- {
- $error[$name] = $e;
- return null;
- }
- return inputsec(htmlizer(trim($_POST[$name])));
- }
- /**
- * OPTIONAL Post of the given POST Key
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The key of the $_POST array i.e. the name of the input / textarea text
- * @param string $default The value to return if the $_POST[$name] is NOT SET
- * @return string Returns the string if the POST is there otherwise the default value given.
- * @since 1.0
- */
- function optPOST($name, $default = "") {
- global $error;
- if (isset($_POST[$name]))
- {
- return inputsec(htmlizer(trim($_POST[$name])));
- }
- return $default;
- }
- /**
- * Check if a POST Checkbox is checked or not
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The name of the checkbox
- * @return boolean
- */
- function checkbox($name) {
- global $error;
- if (isset($_POST[$name]))
- {
- return true;
- }
- return false;
- }
- /**
- * A compulsory GET which issues a error if the GET[$name] is not there
- *
- * @package forms
- * @subpackage get
- * @author Pulkit Gupta
- * @param string $name The key of the $_GET array i.e. the name of the input / textarea text
- * @param string $e Error to throw if the GET is not made
- * @return string Returns the string if the GET is there otherwise will populate array $error and return false
- * @since 1.0
- */
- function GET($name, $e) {
- global $error;
- if ((!isset($_GET[$name])) && strlen(trim($_GET[$name])) < 1)
- {
- $error[$name] = $e;
- return null;
- }
- return inputsec(htmlizer(trim($_GET[$name])));
- }
- /**
- * OPTIONAL GET of the given GET Key i.e. dont throw a error if not there
- *
- * @package forms
- * @subpackage get
- * @author Pulkit Gupta
- * @param string $name The key of the $_GET array i.e. the name of the input / textarea text
- * @param string $default The value to return if the $_GET[$name] is NOT SET
- * @return string Returns the string if the GET is there otherwise the default value given.
- * @since 1.0
- */
- function optGET($name, $default = "") {
- global $error;
- if (isset($_GET[$name]))
- {
- return inputsec(htmlizer(trim($_GET[$name])));
- }
- return $default;
- }
- /**
- * Return the value of the POSTED key i.e. $_POST[$key]. Is mainly used for Themes to fill the forms again automatically.
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The key of the $_POST array i.e. the name of the input / textarea / select text
- * @param string $default (Optional) Default value when the POST is empty
- * @return string The value of the POSTED Key or the $default value when the POST is empty
- * @since 1.0
- */
- function POSTval($name, $default = "") {
- return !empty($_POST) ? (empty($_POST[$name]) ? "" : (inputsec(htmlizer(trim($_POST[$name]))))) : $default;
- }
- /**
- * Return the value of the POSTED key i.e. $_POST[$key]. Is mainly used for Themes to fill the forms again automatically.
- * The difference betweern aPOSTval() and POSTval() is that aPOSTval() just trims the value while POSTval will do
- * inputsec(htmlizer(trim($_POST[$name]))))
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The key of the $_POST array i.e. the name of the input / textarea / select text
- * @param string $default (Optional) Default value when the POST is empty
- * @return string The value of the POSTED Key or the $default value when the POST is empty
- * @since 1.0
- */
- function aPOSTval($name, $default = "") {
- return !empty($_POST) ? (empty($_POST[$name]) ? "" : (trim($_POST[$name]))) : $default;
- }
- /**
- * Was the Checkbox checked or not when the previous post was made.
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The name of the checkbox
- * @param bool $default (Optional) Should it be on or off by default
- * @return string If on then checked="checked" is returned else nothing is returned
- * @since 1.0
- */
- function POSTchecked($name, $default = false) {
- return !empty($_POST) ? (isset($_POST[$name]) ? "checked=\"checked\"" : "") : (!empty($default) ? "checked=\"checked\"" : "");
- }
- /**
- * Which radio box was checked when the previous post was made.
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The name of the checkbox
- * @param bool $default (Optional) Should it be on or off by default
- * @return string If on then checked="checked" is returned else nothing is returned
- * @since 1.0
- */
- function POSTradio($name, $val, $default = false) {
- return !empty($_POST) ? ($_POST[$name] == $val ? "checked=\"checked\"" : "") : (!empty($default) && $default == $val ? "checked=\"checked\"" : "");
- }
- /**
- * Was the OPTION selected or not when the previous post was made. If it is then the selected="selected" is returned
- *
- * @package forms
- * @subpackage post
- * @author Pulkit Gupta
- * @param string $name The name of the select box
- * @param string $value The value to match against the POSTED value
- * @param bool $default Should it be selected or not by default
- * @return string If the $value matches then selected="selected" is returned else nothing is returned
- * @since 1.0
- */
- function POSTselect($name, $value, $default = false) {
- if (empty($_POST))
- {
- if (!empty($default))
- {
- return "selected=\"selected\"";
- }
- }
- if (isset($_POST[$name]))
- {
- if (trim($_POST[$name]) == $value)
- {
- return "selected=\"selected\"";
- }
- }
- return;
- }
- /**
- * OPTIONAL REQUEST of the given REQUEST Key
- *
- * @package forms
- * @subpackage request
- * @author Pulkit Gupta
- * @param string $name The key of the $_REQUEST array i.e. the name of the input / textarea text
- * @param string $default The value to return if the $_REQUEST[$name] is NOT SET
- * @return string Returns the string if the REQUEST is there otherwise the default value given.
- * @since 1.0
- */
- function optREQ($name, $default = "") {
- global $error;
- if (isset($_REQUEST[$name]))
- {
- return inputsec(htmlizer(trim($_REQUEST[$name])));
- }
- return $default;
- }
- /**
- * Save the Global Settings of universal.php
- *
- * @package softaculous
- * @subpackage settings
- * @author Pulkit Gupta
- * @param array $rawdata An array of the new values against the keys
- * @param boolean $reload Reload the whole universal.php or not !
- * @return bool
- * @since 1.0
- */
- function saveglobals($rawdata = array(), $reload = false) {
- global $globals;
- global $softpanel;
- global $user;
- $data = @implode(file($globals["enduser"] . "/_universal.php"));
- if (empty($data))
- {
- return false;
- }
- $final_data = array();
- $final_data["path"] = $globals["path"];
- $final_data["softscripts"] = $globals["softscripts"];
- $final_data["sn"] = $globals["sn"];
- $final_data["cookie_name"] = $globals["cookie_name"];
- $final_data["gzip"] = $globals["gzip"];
- $final_data["language"] = $globals["language"];
- $final_data["soft_email"] = $globals["soft_email"];
- $final_data["from_email"] = $globals["from_email"];
- $final_data["theme_folder"] = $globals["theme_folder"];
- $final_data["timezone"] = $globals["timezone"];
- $final_data["mail"] = $globals["mail"];
- $final_data["mail_server"] = $globals["mail_server"];
- $final_data["mail_port"] = $globals["mail_port"];
- $final_data["mail_user"] = $globals["mail_user"];
- $final_data["mail_pass"] = $globals["mail_pass"];
- $final_data["off"] = $globals["off"];
- $final_data["off_subject"] = $globals["off_subject"];
- $final_data["off_message"] = $globals["off_message"];
- $final_data["update"] = $globals["update"];
- $final_data["update_softs"] = $globals["update_softs"];
- $final_data["add_softs"] = $globals["add_softs"];
- $final_data["email_update"] = $globals["email_update"];
- $final_data["email_update_softs"] = $globals["email_update_softs"];
- $final_data["cron_time"] = $globals["cron_time"];
- $final_data["chmod_files"] = $globals["chmod_files"];
- $final_data["chmod_dir"] = $globals["chmod_dir"];
- $final_data["is_vps"] = $globals["is_vps"];
- $final_data["eu_news_off"] = $globals["eu_news_off"];
- $final_data["eu_email_off"] = $globals["eu_email_off"];
- $final_data["random_username"] = $globals["random_username"];
- $final_data["random_pass"] = $globals["random_pass"];
- $final_data["off_demo_link"] = $globals["off_demo_link"];
- $final_data["off_screenshot_link"] = $globals["off_screenshot_link"];
- $final_data["off_rating_link"] = $globals["off_rating_link"];
- $final_data["off_review_link"] = $globals["off_review_link"];
- $final_data["off_email_link"] = $globals["off_email_link"];
- $final_data["random_dbprefix"] = $globals["random_dbprefix"];
- $final_data["logo_url"] = $globals["logo_url"];
- $final_data["php_bin"] = $globals["php_bin"];
- $final_data["chmod_conf_file"] = $globals["chmod_conf_file"];
- $final_data["off_sync_link"] = $globals["off_sync_link"];
- $final_data["off_panel_link"] = $globals["off_panel_link"];
- $final_data["no_prefill"] = $globals["no_prefill"];
- $final_data["footer_link"] = $globals["footer_link"];
- $final_data["remote_mysql"] = $globals["remote_mysql"];
- $final_data["perl_scripts"] = $globals["perl_scripts"];
- $final_data["show_top_scripts"] = $globals["show_top_scripts"];
- $final_data["append_apps"] = $globals["append_apps"];
- $final_data["user_mod_dir"] = $globals["user_mod_dir"];
- $final_data["show_in_notice"] = $globals["show_in_notice"];
- $final_data["disable_classes"] = $globals["disable_classes"];
- $final_data["panel_hf"] = $globals["panel_hf"];
- $final_data["disable_backup_restore"] = $globals["disable_backup_restore"];
- $final_data["nolabels"] = $globals["nolabels"];
- $final_data["group_order"] = $globals["group_order"];
- $final_data["disable_reseller_panel"] = $globals["disable_reseller_panel"];
- $final_data["default_protocol"] = $globals["default_protocol"];
- $final_data["network_interface"] = $globals["network_interface"];
- $final_data["proxy_ip"] = $globals["proxy_ip"];
- $final_data["proxy_port"] = $globals["proxy_port"];
- $final_data["proxy_user"] = $globals["proxy_user"];
- $final_data["proxy_pass"] = $globals["proxy_pass"];
- $final_data["proxy_check"] = $globals["proxy_check"];
- $final_data["bandwidth_limit"] = $globals["bandwidth_limit"];
- $final_data["adomain_path"] = $globals["adomain_path"];
- $final_data["empty_pass"] = $globals["empty_pass"];
- $final_data["empty_username"] = $globals["empty_username"];
- $final_data["show_cscript_in_top"] = $globals["show_cscript_in_top"];
- $final_data["pass_strength"] = $globals["pass_strength"];
- $final_data["off_remove_mail"] = $globals["off_remove_mail"];
- $final_data["off_backup_mail"] = $globals["off_backup_mail"];
- $final_data["off_install_mail"] = $globals["off_install_mail"];
- $final_data["off_edit_mail"] = $globals["off_edit_mail"];
- $final_data["admin_prefix"] = $globals["admin_prefix"];
- $final_data["disable_auto_backup"] = $globals["disable_auto_backup"];
- $final_data["bandwidth_up_limit"] = $globals["bandwidth_up_limit"];
- $final_data["webuzo_disable_username"] = $globals["webuzo_disable_username"];
- $final_data["off_clone_mail"] = $globals["off_clone_mail"];
- $final_data["disable_clone"] = $globals["disable_clone"];
- $final_data["disable_backup_upgrade"] = $globals["disable_backup_upgrade"];
- $final_data["ephp_bin"] = $globals["ephp_bin"];
- $final_data["no_strong_mysql_pass"] = $globals["no_strong_mysql_pass"];
- $final_data["install_tweet_off"] = $globals["install_tweet_off"];
- $final_data["install_tweet"] = $globals["install_tweet"];
- $final_data["upgrade_tweet_off"] = $globals["upgrade_tweet_off"];
- $final_data["upgrade_tweet"] = $globals["upgrade_tweet"];
- $final_data["clone_tweet_off"] = $globals["clone_tweet_off"];
- $final_data["clone_tweet"] = $globals["clone_tweet"];
- $final_data["no_ftp_encrypted"] = $globals["no_ftp_encrypted"];
- $final_data["salt"] = $globals["salt"];
- $final_data["pre_download_all"] = $globals["pre_download_all"];
- $final_data["session_timeout"] = $globals["session_timeout"];
- $final_data["eu_enable_themes"] = $globals["eu_enable_themes"];
- $final_data["auto_backup_limit"] = $globals["auto_backup_limit"];
- $final_data["disable_cats"] = $globals["disable_cats"];
- $final_data["remove_dir"] = $globals["remove_dir"];
- $final_data["remove_db"] = $globals["remove_db"];
- $final_data["remove_datadir"] = $globals["remove_datadir"];
- $final_data["remove_wwwdir"] = $globals["remove_wwwdir"];
- if (!empty($globals["ampps_enabled"]))
- {
- $final_data["no_ampps"] = $globals["no_ampps"];
- }
- foreach ($final_data as $k => $v)
- {
- if (isset($rawdata[$k]))
- {
- $final_data[$k] = $rawdata[$k];
- }
- if (asperapp(0, 0, 1))
- {
- if ($k == "path")
- {
- $data = str_replace("\$globals['" . $k . "'] = '';", "\$globals['" . $k . "'] = dirname(dirname(__FILE__));", $data);
- continue;
- }
- if ($k == "softscripts")
- {
- $data = str_replace("\$globals['" . $k . "'] = '';", "\$globals['" . $k . "'] = dirname(dirname(dirname(__FILE__))).'/scripts';", $data);
- continue;
- }
- }
- if (is_string($final_data[$k]))
- {
- $data = str_replace("\$globals['" . $k . "'] = '';", "\$globals['" . $k . "'] = '" . $final_data[$k] . "';", $data);
- continue;
- }
- if (is_int($final_data[$k]) || is_float($final_data[$k]))
- {
- $data = str_replace("\$globals['" . $k . "'] = '';", "\$globals['" . $k . "'] = " . $final_data[$k] . ";", $data);
- continue;
- }
- if (!is_bool($final_data[$k]))
- {
- continue;
- }
- $data = str_replace("\$globals['" . $k . "'] = '';", "\$globals['" . $k . "'] = " . ($final_data[$k] ? "true" : "false") . ";", $data);
- continue;
- }
- $path = str_replace($globals["path"], $final_data["path"], $globals["enduser"]);
- writefile($path . "/universal.php", $data, 1);
- if (!empty($reload))
- {
- include $path . "/universal.php";
- }
- return true;
- }
- /**
- * Add a CRON JOB of softaculous. It creates a file /etc/cron.d/softaculous
- *
- * @package softaculous
- * @subpackage cron
- * @author Pulkit Gupta
- * @param string $time The CRON Time setting
- * @return bool
- * @since 1.0
- */
- function add_cron($time) {
- global $globals;
- global $l;
- $data = $time . " root " . (empty($globals["php_bin"]) ? "/usr/bin/php" : ($globals["php_bin"])) . " " . $globals["path"] . "/cron.php >> /dev/null 2>&1" . "\n";
- if ($globals["softpanel"] == "webuzo")
- {
- $data .= "*/8 * * * * root " . (empty($globals["php_bin"]) ? "/usr/bin/php" : ($globals["php_bin"])) . " " . $globals["path"] . "/webuzocron.php >> /dev/null 2>&1" . "\n";
- }
- $data .= "\n";
- $data = str_replace("\r", "", $data);
- writefile("/etc/cron.d/softaculous", $data, 1);
- @chmod("/etc/cron.d/softaculous", 420);
- return true;
- }
- /**
- * Delete the CRON JOB of softaculous. It deletes the file /etc/cron.d/softaculous
- *
- * @package softaculous
- * @subpackage cron
- * @author Pulkit Gupta
- * @return bool
- * @since 1.0
- */
- function del_cron() {
- global $globals;
- global $l;
- @unlink("/etc/cron.d/softaculous");
- return true;
- }
- .......................................................................................
- ...........................................
- .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement