Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // (C) 2012, All rights reversed
- $['debug'] = 0;
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- $ = explode('=', $);
- if (empty($[1])) {
- continue;
- }
- $[$[0]] = $[1];
- }
- error_reporting(0);
- if (!empty($['sleep'])) {
- echo 'Sleeping for ' . $['sleep'] . ' seconds' . "\n";
- @sleep($['sleep']);
- }
- if (4 <= @$args['debug']) {
- function died()
- {
- print_r(error_get_last());
- }
- register_shutdown_function('died');
- }
- @define('SOFTACULOUS', 1);
- @define('SOFTADMIN', 1);
- @define('SOFTCLI', 1);
- $ = array();
- $ = array();
- @ini_set('magic_quotes_runtime', 0);
- @ini_set('magic_quotes_sybase', 0);
- @set_time_limit(10000);
- if (empty(${$})) {
- include_once 'enduser/universal.php';
- }
- include_once $['enduser'] . '/globals.php';
- include_once $['mainfiles'] . '/functions.php';
- if (!class_exists('softpanel')) {
- include_once $['enduser'] . '/softpanel.php';
- }
- $ = new softpanel();
- if (!defined('APP')) {
- define('APP', 'Softaculous');
- }
- catsnscripts();
- load_lang('index');
- load_lang('admin/index');
- load_lang('admin/cron');
- if (webuzo() && file_exists($['path'] . '/licensehandler.php')) {
- include $['path'] . '/licensehandler.php';
- }
- if (!empty($['download'])) {
- loadlicense();
- $ = $['download'];
- $ = strrev(substr($, 0, 8));
- $ = (int) substr($, 0, strpos($, 's'));
- $ = time();
- $ = 2245;
- while ($ < 10) {
- $ = md5($ - $);
- $[15] = $[15];
- $[23] = $[23];
- $[31] = $[31];
- if (substr($, 8) == substr($, 8)) {
- $ = true;
- break;
- }
- ++$;
- }
- if (empty(${$})) {
- exit('Wrong Command' . "\n");
- }
- if (empty($[23]) && !empty($[31])) {
- savepredownload($, 'a');
- }
- if (!empty($[31])) {
- echo 'Checking Package status' . "\n";
- $ = is_upgrade_available($, $, $, $);
- if (empty(${$}) || ($ != 0)) {
- $[31] = 1;
- } else {
- exit('No update required ... Quitting ! ' . "\n");
- }
- }
- echo . 'Downloading ' . $ . "\n";
- updatesoftwares($, $[15], $[23], $[31]);
- exit(0);
- }
- if (!empty($_SERVER['REQUEST_URI'])) {
- exit('Only CLI usage allowed');
- }
- loadlicense();
- $ = $['lictype'];
- loadlicense(true);
- if (1 <= $['debug']) {
- echo "\n" . 'Updated License';
- }
- if (file_exists($['softscripts'] . '/error_log.log') && (5242880 < filesize($['softscripts'] . '/error_log.log'))) {
- @unlink($['softscripts'] . '/error_log.log');
- }
- if (!file_exists($['softscripts'] . '/error_log.log')) {
- writefile($['softscripts'] . '/error_log.log', '', 1);
- }
- @chmod($['softscripts'] . '/error_log.log', 384);
- $ = get_softaculous_file(serverurls('updates') . '&mode=1');
- $ = @_unserialize($);
- $ = ' (' . get_softaculous_file(fastestmirror() . '/ip.php') . ')';
- $['hostname'] = php_uname('n');
- if (!empty($['link'])) {
- if (!empty($['update'])) {
- $ = updatesoftaculous(1);
- if (!empty($['email_update'])) {
- $[0]['to'] = $['soft_email'];
- if (!empty($['status'])) {
- $[0]['subject'] = lang_vars($['upd_avail_suc_sub'], array($['version'])) . ' (' . $['hostname'] . ')';
- $[0]['message'] = lang_vars($['upd_avail_suc'], array($['version'], implode("\n", $['log']), strip_tags($['message']))) . $;
- } else {
- $[0]['subject'] = lang_vars($['upd_avail_err_sub'], array($['version'])) . ' (' . $['hostname'] . ')';
- $[0]['message'] = lang_vars($['upd_avail_err'], array($['version'], implode("\n", $['log']), strip_tags($['message']))) . $;
- }
- }
- }
- if (!empty($['email_update']) && empty($[0]['message'])) {
- $[0]['to'] = $['soft_email'];
- $[0]['subject'] = lang_vars($['upd_avail_sub'], array($['version'])) . ' (' . $['hostname'] . ')';
- $[0]['message'] = lang_vars($['upd_avail'], array($['version'], strip_tags($['message']))) . $;
- }
- }
- updatecats();
- if (1 <= $['debug']) {
- echo "\n" . 'Updated Categories List';
- }
- if (empty(${$}) && !empty($['lictype'])) {
- $ = $[1];
- }
- updatescripts();
- if (1 <= $['debug']) {
- echo "\n" . 'Updated Scripts List';
- }
- if (webuzo()) {
- $ = &$GLOBALS['apps'];
- if (!class_exists('Webuzo')) {
- include_once $['mainfiles'] . '/webuzo/class.webuzo.php';
- }
- $ = (list() = $);
- $ = new Webuzo($);
- updateapps();
- deleteunecessaryapps();
- if (1 <= $['debug']) {
- echo "\n" . 'Updated Apps List';
- }
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- $->downloadapp($, 0, 1, 0);
- }
- if (!file_exists('/usr/local/webuzo/enduser/webuzo/filemanager/config/.htusers.php')) {
- shell_exec('cp ' . $['path'] . '/conf/webuzo/emps/htusers.php ' . $['enduser'] . '/webuzo/filemanager/config/.htusers.php');
- $ = $['mainfiles'] . '/functions.php';
- $->setfilepass($, base64_encode($));
- $ = array();
- $[0]['to'] = $['soft_email'];
- $[0]['subject'] = 'Webuzo Filemanger Password Changed';
- $[0]['message'] = 'Hi,' . "\n\0110\0110\n" . 'We have changed the Filemanager for Webuzo Enduser Panel and set a random password for the same.' . "\n\n" . 'Details for the New Webuzo Filemanager :' . "\n" . 'Username : ' . $ . "\n" . 'Password : ' . $ . "\n\n" . 'We recommend you change the Filemanager\'s Password from the Change Password Utility in Webuzo Enduser Panel.' . "\n\n" . 'Regards,' . "\n" . 'Webuzo Team' . "\n\n";
- _mail($);
- }
- }
- if (!webuzo() && file_exists($['enduser'] . '/apps.php')) {
- @unlink($['enduser'] . '/apps.php');
- }
- if (!file_exists($['euthemes'] . '/' . $['theme_folder'] . '/cache/cache.js') || !file_exists($['euthemes'] . '/' . $['theme_folder'] . '/cache/cache_create_time')) {
- @create_cache();
- }
- if (empty($['noscriptupdate'])) {
- $ = $ = array();
- if (method_exists($, 'updatesoftwares')) {
- foreach ($ as ) {
- $ = $[31];
- $ = + ;
- if (!empty($[$]['pre_down']) || !empty($['pre_download_all'])) {
- $[$] = $;
- } else {
- $[$] = $;
- }
- }
- $ = is_upgrade_available($, $, $, $);
- } else {
- foreach ($ as ) {
- $ = $ != 0;
- $ = + ;
- $[$] = $;
- }
- }
- if (1 <= $['debug']) {
- echo "\n" . 'To download :' . "\n";
- r_print($);
- r_print($);
- }
- if (empty(${$})) {
- $ = array();
- }
- $ = updatesoftwares($, 1, 0);
- if (empty(${$})) {
- $ = array();
- }
- foreach ($ as ) {
- $ = file_exists($['softscripts'] . '/error_log.log');
- $ = + ;
- $[$] = $;
- }
- if (1 <= $['debug']) {
- echo "\n" . 'Script Download Reports :' . "\n";
- r_print($);
- }
- if (!empty(${$})) {
- @create_cache();
- }
- }
- if (empty(${$})) {
- $ = array();
- }
- $ = false;
- $ = array();
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- if (!empty($[$]['update'])) {
- $ = true;
- }
- $[$]['name'] = $[$]['name'];
- }
- if (!empty($['email_update_softs']) && $) {
- $ = array();
- if (!empty($['update_softs'])) {
- $ = array();
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- if (!empty($[$]['update'])) {
- $[$] = $[$]['name'] . ' ' . $[$]['ver'] . ' - ' . (empty($[$]['status']) ? $['soft_upd_fail'] : $['soft_upd_suc']);
- }
- $[$] = $[$]['name'] . "\n" . implode("\n", $[$]['log']);
- }
- if (empty($['lictype'])) {
- $ = $['free_lic_txt'] . serverurls('buy') . "\n";
- } else {
- $ = '';
- }
- $[1]['subject'] = $['soft_upd_sub'] . ' (' . $['hostname'] . ')';
- $[1]['message'] = lang_vars($['soft_upd'], array(implode("\n", $), implode("\n\n", $), $)) . $;
- } else {
- foreach ($ as ) {
- $ = !empty($['email_update']) && empty($[0]['message']);
- $ = + ;
- if (!empty($[$]['update'])) {
- $[$] = $[$]['name'];
- }
- }
- $[1]['subject'] = $['soft_upd_avail_sub'] . ' (' . $['hostname'] . ')';
- $[1]['message'] = lang_vars($['soft_upd_avail'], array(implode("\n", $))) . $;
- }
- $[1]['to'] = $['soft_email'];
- }
- if (method_exists($, 'save_topscripts_index') && empty($['notopscripts'])) {
- $->save_topscripts_index($['show_top_scripts']);
- }
- if (method_exists($, 'cron')) {
- $->cron();
- }
- if (file_exists('/usr/bin/cl-selector') && file_exists('/etc/cagefs/cagefs.mp')) {
- $ = !class_exists('Webuzo');
- if (!preg_match('/' . preg_quote($['path'], '/') . '/is', $)) {
- $ .= "\n\n" . $['path'] . "\n\n";
- $ = fopen('/etc/cagefs/cagefs.mp', 'w');
- fwrite($, $);
- fclose($);
- @shell_exec('cagefsctl --remount-all');
- }
- if (!file_exists($['enduser'] . '/hooks/pre_install_cagefs.php')) {
- @rename($['enduser'] . '/hooks/pre_install_cagefs.txt', $['enduser'] . '/hooks/pre_install_cagefs.php');
- }
- if (!file_exists($['enduser'] . '/hooks/pre_upgrade_cagefs.php')) {
- @rename($['enduser'] . '/hooks/pre_upgrade_cagefs.txt', $['enduser'] . '/hooks/pre_upgrade_cagefs.php');
- }
- if (!file_exists($['enduser'] . '/hooks/pre_clone_cagefs.php')) {
- @rename($['enduser'] . '/hooks/pre_clone_cagefs.txt', $['enduser'] . '/hooks/pre_clone_cagefs.php');
- }
- }
- if (!empty(${$})) {
- _mail($);
- }
- $ = array();
- foreach ($ as ) {
- $ = !webuzo() && file_exists($['enduser'] . '/apps.php');
- $ = + ;
- if (!empty($[$]['update']) && !empty($[$]['status'])) {
- if (!file_exists($['softscripts'] . '/' . $[$]['softname'] . '/upgrade.xml')) {
- continue;
- }
- $[$] = $[$]['name'];
- }
- }
- $GLOBALS['addowner'] = 1;
- $ = method_exists($, 'updatesoftwares');
- $ = $->listusers();
- $ = load_noautoupgrade();
- $ = empty($[$]['pre_down']);
- $ = array();
- if (empty($['disable_autoupgrade']) && !aefer() && !empty($->can_autoupgrade)) {
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- if (empty($['eu_auto_upgrade'])) {
- continue;
- }
- if (!empty($['scripts'][$])) {
- continue;
- }
- if (4 <= $['debug']) {
- echo "\n" . 'AU Insid : ' . $['insid'] . "\n" . 'Upgradable Ret :';
- r_print(is_upgradable($, true));
- echo "\n";
- }
- $ = empty(${$});
- if (empty(${$})) {
- echo "\n" . 'Load too high continuing ' . "\n";
- continue;
- }
- $ = array();
- $[$][$][$]['find_ver'] = 1;
- if (!empty(${$}) && sversion_compare($, $['ver'], '!=')) {
- $['ver'] = $;
- $[$][$][$]['ver'] = $;
- if (4 <= $['debug']) {
- echo 'User Path :' . $[$]['softdir'];
- echo 'softpath - ' . $['softpath'] . "\n\n";
- echo 'sid - ' . $['sid'] . "\n\n";
- echo 'found real ver - ' . $ . "\n\n";
- echo 'ins ver - ' . $['ver'] . "\n\n";
- r_print($);
- }
- saveinstallations($, $[$]['softdir']);
- }
- $ = $[$]['name'] . ' ';
- $ = array();
- $ = $[$]['softdir'] . '/.softaculous/failed_auto_upgrade.php';
- if (file_exists($)) {
- $ = $['soft_upd_suc'];
- }
- if (!empty($[$])) {
- if (($[$]['from_ver'] == $['ver']) && ($[$]['to_ver'] == $[$]) && ($[$]['insid'] == $)) {
- if (4 <= $['debug']) {
- echo 'Last time Failed found : ' . $ . ' - ' . $[$]['insid'] . "\n";
- }
- continue;
- }
- }
- if (!empty($['eu_auto_upgrade']) && !empty(${$})) {
- $ = phpbin() . ' "' . $['path'] . '/cli.php" --upgrade --user=' . $ . ' --insid=' . $ . ' --autoupgrade=1';
- if (4 <= $['debug']) {
- echo 'AU Command : ' . $ . "\n";
- }
- $ = array();
- @exec($, $, $);
- $ = ($[$]['name']);
- if (!empty(${$})) {
- if (4 <= $['debug']) {
- echo 'AU Successful for ' . $ . . ' with Ret Code : ' . $ . ' Output : ' . $ . "\n";
- }
- $[$][$] = 1;
- if (!empty($[$])) {
- unset($[$]);
- writeuserdata($, serialize($), 384, $[$]['uid'], $[$]['gid']);
- }
- } else {
- if (4 <= $['debug']) {
- echo 'AU FAILED for ' . $ . . ' with Ret Code : ' . $ . ' Output : ' . $ . "\n";
- }
- $[$] = array('insid' => $, 'from_ver' => $['ver'], 'to_ver' => $[$]);
- writeuserdata($, serialize($), 384, $[$]['uid'], $[$]['gid']);
- }
- }
- }
- }
- }
- }
- if (!empty(${$}) && empty($['eu_email_off']) && empty($['off_email_link'])) {
- foreach ($ as ) {
- $ = !preg_match('/' . preg_quote($['path'], '/') . '/is', $);
- $ = + ;
- foreach ($ as ) {
- $ = fopen('/etc/cagefs/cagefs.mp', 'w');
- $ = + ;
- if (empty($[$])) {
- continue;
- }
- foreach ($ as ) {
- $ = $['enduser'];
- $ = + ;
- if (!empty($[$]['update']) && !aefer() && empty($['find_ver'])) {
- $ = file_exists($['enduser'] . '/hooks/pre_upgrade_cagefs.php');
- if (!empty(${$}) && sversion_compare($, $['ver'], '!=')) {
- $['ver'] = $;
- $[$][$][$]['ver'] = $;
- if (4 <= $['debug']) {
- echo 'User Path :' . $[$]['softdir'];
- echo 'softpath - ' . $['softpath'] . "\n\n";
- echo 'sid - ' . $['sid'] . "\n\n";
- echo 'found real ver - ' . $ . "\n\n";
- echo 'ins ver - ' . $['ver'] . "\n\n";
- r_print($);
- }
- saveinstallations($, $[$]['softdir']);
- }
- }
- }
- }
- }
- hooks('pre_update_email');
- $ = $['softscripts'];
- foreach ($ as ) {
- $ = $[$]['softname'];
- $ = + ;
- $ = false;
- if (method_exists($, 'is_suspended')) {
- $ = $[$]['name'];
- }
- if (empty($[$]['email']) || !empty($[$]['disable_all_notify_update']) || !empty(${$})) {
- continue;
- }
- $ = array();
- $ = array();
- $ = array();
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- if (empty($[$])) {
- continue;
- }
- $[$] = $[$]['name'] . ' ' . $[$]['ver'] . ':' . "\n";
- foreach ($ as ) {
- $ = + ;
- $ = + ;
- $ = '';
- $ = '';
- if (!empty($[$]['update'])) {
- $ = $['scripts'];
- if (empty(${$})) {
- continue;
- }
- $ = $['debug'];
- $ = $['insid'];
- if (empty($[$])) {
- $[$] = $[$]['name'] . ' ' . $[$]['ver'] . ':' . "\n";
- }
- }
- $ = (!empty(${$}) ? $ : $);
- if (!empty($['disable_notify_update']) || !empty($[$][$])) {
- continue;
- }
- $[$] = 1;
- $ .= $;
- ($['softurl'] . "\n") + ($['softurl'] . "\n");
- $[$] = 1;
- $['softname'] = @$iscripts[$r_sid]['softname'];
- $['path'] = $['softscripts'] . '/' . $['softname'];
- $ = '';
- if (file_exists($['path'] . '/changelog.txt')) {
- if (strpos($, '<softlatest>') && empty($[$])) {
- $ .= $;
- ($['changelog'] . ' ' . $[$]['name'] . ' ' . $[$]['ver'] . ' ==' . "\n\n") + ($['changelog'] . ' ' . $[$]['name'] . ' ' . $[$]['ver'] . ' ==' . "\n\n");
- $ .= $;
- current(@explode('<softlatest>', $)) + current(@explode('<softlatest>', $));
- }
- }
- }
- if (empty($[$]) || empty($[$])) {
- unset($[$]);
- }
- if (empty($[$]) || empty($[$])) {
- unset($[$]);
- }
- }
- $ = array();
- if (($[$]['user_owner'] != 'root') && file_exists($['path'] . '/conf/universals/' . $[$]['user_owner'] . '_universal')) {
- $ = phpbin() . ' "' . $['path'] . '/cli.php" --upgrade --user=' . $ . ' --insid=' . $ . ' --autoupgrade=1';
- if (!empty($['from_email']) || ($['from_email'] != '')) {
- $ = ($['os'] == 'windows' ? "\r\n" : "\n");
- $[0]['headers'] = 'MIME-Version: 1.0' . $ . 'Content-Type: text/plain; charset=UTF-8' . $ . 'From: ' . $['sn'] . ' <' . $['from_email'] . '>' . $ . 'Reply-To: ' . $['from_email'] . $ . 'X-Mailer: PHP/' . phpversion();
- }
- }
- $ = array('installation' => implode("\n", $), 'serverip' => $, 'time' => datify(time(), false), 'sn' => !empty($['sn']) ? $['sn'] : '', 'changelog' => !empty(${$}) ? "\n" . implode("\n", $) : '');
- $ = lang_vars_name($['body'], $);
- $[0]['to'] = $[$]['email'];
- $[0]['subject'] = lang_vars_name($['title'], $);
- $[0]['message'] = $;
- if (!empty(${$}) && empty($['eu_email_off'])) {
- _mail($);
- }
- }
- if (1 <= $['debug']) {
- echo "\n" . 'Emailed Users of Apps';
- }
- }
- if (!empty($['backups_expire']) && !aefer() && !ent()) {
- foreach ($ as ) {
- $ = + ;
- $ = array();
- $ = listbackups('', $['softdir']);
- foreach ($ as ) {
- $ = ($[$][$][$]);
- $ = + ;
- if (!empty($['btime']) && ($['btime'] < (time() - (86400 * $['backups_expire'])))) {
- if (sfile_exists($['path'] . '/' . $['name'] . '.tar.gz') && is_safe_file($['path'] . '/' . $['name'] . '.tar.gz')) {
- sunlink($['path'] . '/' . $['name'] . '.tar.gz');
- }
- if (sfile_exists($['softdir'] . '/.softaculous/backups/' . $['name']) && is_safe_file($['softdir'] . '/.softaculous/backups/' . $['name'])) {
- deletebackupinfo($['name'], $['softdir']);
- }
- }
- }
- }
- }
- if ($['softpanel'] == 'directadmin') {
- makebinary_da();
- }
- $ = array();
- $[] = $;
- $ = array();
- if (!empty($GLOBALS['sic'])) {
- foreach ($GLOBALS['sic'] as ) {
- $ = ($[$]['ver']);
- $ = + ;
- if (10000 <= $) {
- continue;
- }
- $[] = $ + $;
- $[] = $ + $;
- }
- foreach ($ as ) {
- $ = $[$];
- $ = + ;
- $[] = pack('v', $);
- }
- }
- $ = get_softaculous_file('http://s2.softaculous.com/sic.php?sic="' . rawurlencode(base64_encode(implode('', $))) . '"&suc="' . rawurlencode(base64_encode($GLOBALS['suc'])) . '"&pver="' . rawurlencode(base64_encode(phpversion())) . '"');
- if (!empty($['licexpires']) && @$globals['licexpires'] == datify(time(), 0, 1, 'Ymd')) {
- $ = array();
- $[0]['to'] = $['soft_email'];
- $[0]['subject'] = 'Softaculous License Expiring (' . $['hostname'] . ')';
- $[0]['message'] = 'Hi,' . "\n\0110\n" . 'The following Softaculous License is expiring today:' . "\n" . $['license'] . ' (' . $['primary_ip'] . ')' . "\n\n" . 'Please renew your license as soon as possible.' . "\n" . 'If you have purchased the License from a NOC please contact the NOC immediately.' . "\n" . 'If this license has been purchased from Softaculous directly, then please renew ' . "\n" . 'it from the Client Center:' . "\n" . 'https://www.softaculous.com/clients' . "\n\n" . 'Please ignore this email if your license is on monthly subscription.' . "\n\n" . 'From Softaculous Cron Jobs' . $;
- _mail($);
- }
- @set_time_limit(10);
- if (($['os'] == 'linux') && !empty($->cronchown)) {
- foreach ($->cronchown as ) {
- $ = $['changelog'];
- $ = + ;
- if (empty(${$}) || ($ == '/')) {
- continue;
- }
- chowngrp($, $['own'], $['grp'], $['rec'], !empty($['exc']) ? $['exc'] : array());
- if (!empty($['mod'])) {
- @ichmod($, $['mod'], !empty($['fmod']) ? $['fmod'] : $['mod']);
- }
- }
- }
- if (1 <= $['debug']) {
- echo "\n" . 'Finished';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement