function GenerateVisitorStats() { include 'cnf/db.php'; $z_db_user = $user; $z_db_pass = $pass; try { $zdbh = new db_driver("mysql:host=localhost;dbname=" . $dbname . "", $z_db_user, $z_db_pass); } catch (PDOException $e) { } $sql = $zdbh->prepare("SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL"); $sql->execute(); echo "Generating visitor stats html..." . fs_filehandler::NewLine(); while ($rowvhost = $sql->fetch()) { if (!file_exists(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "")) { @mkdir(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "", 777, TRUE); } if (sys_versions::ShowOSPlatformVersion() == "Windows") { $runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors.exe -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html"; } else { chmod(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors", 4777); $runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html"; } echo "Generating stats for: " . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . fs_filehandler::NewLine(); system($runcommand); } }
static function DisplayUsagepChart() { global $zdbh; global $controller; $currentuser = ctrl_users::GetUserDetail(); self::$diskquota = $currentuser['diskquota']; self::$diskspace = ctrl_users::GetQuotaUsages('diskspace', $currentuser['userid']); self::$bandwidthquota = module_controller::empty_as_0($currentuser['bandwidthquota']); self::$bandwidth = ctrl_users::GetQuotaUsages('bandwidth', $currentuser['userid']); self::$domainsquota = module_controller::empty_as_0($currentuser['domainquota']); self::$domains = ctrl_users::GetQuotaUsages('domains', $currentuser['userid']); self::$subdomainsquota = module_controller::empty_as_0($currentuser['subdomainquota']); self::$subdomains = ctrl_users::GetQuotaUsages('subdomains', $currentuser['userid']); self::$parkeddomainsquota = module_controller::empty_as_0($currentuser['parkeddomainquota']); self::$parkeddomains = ctrl_users::GetQuotaUsages('parkeddomains', $currentuser['userid']); self::$mysqlquota = module_controller::empty_as_0($currentuser['mysqlquota']); self::$mysql = ctrl_users::GetQuotaUsages('mysql', $currentuser['userid']); self::$ftpaccountsquota = module_controller::empty_as_0($currentuser['ftpaccountsquota']); self::$ftpaccounts = ctrl_users::GetQuotaUsages('ftpaccounts', $currentuser['userid']); self::$mailboxquota = module_controller::empty_as_0($currentuser['mailboxquota']); self::$mailboxes = ctrl_users::GetQuotaUsages('mailboxes', $currentuser['userid']); self::$forwardersquota = module_controller::empty_as_0($currentuser['forwardersquota']); self::$forwarders = ctrl_users::GetQuotaUsages('forwarders', $currentuser['userid']); self::$distlistsquota = $currentuser['distlistsquota']; self::$distlists = module_controller::empty_as_0(ctrl_users::GetQuotaUsages('distlists', $currentuser['userid'])); $maximum = self::$diskquota; $used = self::$diskspace; if ($maximum == 0) { if (sys_versions::ShowOSPlatformVersion() != 'Windows') { // We'll specify the full path to the hsoted directory to ensure that NFS mounts etc are taken into account. $free = disk_free_space(ctrl_options::GetOption('hosted_dir')); } else { // On Windows we'll check the disk (partition) that is configured for the 'hostdata' directory. $free = disk_free_space(substr(ctrl_options::GetOption('hosted_dir'), 0, 2)); } $freeLabel = fs_director::ShowHumanFileSize($free) . ' (' . ui_language::translate('Server disk') . ')'; } else { $free = max($maximum - $used, 0); $freeLabel = fs_director::ShowHumanFileSize($free); } $usedLabel = fs_director::ShowHumanFileSize($used); $line = '<table class="none" cellpadding="0" cellspacing="0">' . '<tr>' . '<td align="left" valign="top" width="350px">' . '<h2>' . ui_language::translate('Disk Usage Total') . '</h2>' . '<img src="etc/lib/pChart2/MADmin/z3DPie.php?score=' . $free . '::' . $used . '&imagesize=350::250&chartsize=150::120&radius=150' . '&labels=Free_Space: ' . $freeLabel . '::Used_Space: ' . $usedLabel . '&legendfont=verdana&legendfontsize=8&legendsize=10::220"/>' . '</td>' . '<td align="left" valign="top">' . '<h2>' . ui_language::translate('Package Usage Total') . '</h2>' . '<table class="table table-striped" border="0" cellspacing="0" cellpadding="0">' . module_controller::build_row_usage('Disk space', self::$diskspace, self::$diskquota == 0 ? -1 : self::$diskquota, true) . module_controller::build_row_usage('Bandwidth', self::$bandwidth, self::$bandwidthquota == 0 ? -1 : self::$bandwidthquota, true) . module_controller::build_row_usage('Domains', self::$domains, self::$domainsquota) . module_controller::build_row_usage('Sub-domains', self::$subdomains, self::$subdomainsquota) . module_controller::build_row_usage('Parked domains', self::$parkeddomains, self::$parkeddomainsquota) . module_controller::build_row_usage('FTP accounts', self::$ftpaccounts, self::$ftpaccountsquota) . module_controller::build_row_usage('MySQL® databases', self::$mysql, self::$mysqlquota) . module_controller::build_row_usage('Mailboxes', self::$mailboxes, self::$mailboxquota) . module_controller::build_row_usage('Mail forwarders', self::$forwarders, self::$forwardersquota) . module_controller::build_row_usage('Distribution lists', self::$distlists, self::$distlistsquota) . '</table>' . '</td>' . '</tr>' . '</table>'; return $line; }
--> <?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?")) { form.submit();
static function getCurrentAPIKey() { return ctrl_options::GetOption('apikey'); }
static function getRunInstallerForm() { global $controller; if (isset($_POST['startinstall']) && $_POST['startinstall'] == 'true') { //runtime_csfr::Protect(); // set base vars $start = $_POST['startinstall']; $zipfile = $_POST['pkgzip']; $pkgInstall = $_POST['pkg']; $pkgdb = $_POST['pkgdb']; if ($start) { if (!isset($_POST['submit'])) { if (isset($_SESSION['zpuid'])) { $userid = $_SESSION['zpuid']; $currentuser = ctrl_users::GetUserDetail($userid); $hostdatadir = ctrl_options::GetOption('hosted_dir') . "" . $currentuser['username']; $userName = $currentuser['username']; $random = rand(); $sysOS = php_uname('s'); $line = "<h2>Preparing to install " . $pkgInstall . ":</h2>"; if (!isset($startinstall)) { if ($pkgdb == "yes") { $line .= "<font color=\"red\"><strong>This package requires a database and database user.</strong></font><br />"; $line .= "<a target=\"_blank\" href=\"../../../?module=mysql_databases\">»Open« </a> database manager.<br />"; $line .= "<a target=\"_blank\" href=\"../../../?module=mysql_users\">»Open« </a> database user manager."; $line .= "<p> </p>"; } $line .= "<p>Please provide the domain and folder name to start the installation of " . $pkgInstall . ".</p>"; $line .= "<form id=\"form\" name=\"doInstall\" action=\"/?module=sentastico\" method=\"post\">"; $line .= "<table>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"site_domain\">Select domain: </label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>"; $line .= "<td align=\"center\">"; $list = ListDomain($currentuser['userid']); $line .= $list; $line .= "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"install_to_base_dir\">Tick to install to domain root:</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"install_to_base_dir\" value=\"0\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" onClick=\"if (this.checked) { document.getElementById('hiderow').style.display = 'none'; } else { document.getElementById('hiderow').style.display = ''; }\" name=\"install_to_base_dir\" value=\"1\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<font size=\"-1\" color=\"red\"><strong>ALL FILES AND FOLDERS WILL BE DELETED!</strong></font>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr id=\"hiderow\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td align=\"right\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"dir_to_install\">Install To Sub-Folder: public_html/[domain]/</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"dir_to_install\" style=\"width: 300px\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<font color=\"red\">NOTE:</font> For multiple subfolders use: subfolder/subsubfolder\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"3\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p> </p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\" class=\"button-align\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- inputs -->\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"startinstall\" value=\"true\"> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"u\" value=" . $currentuser['userid'] . "> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkgzip\" value=" . $zipfile . "> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkg\" value='" . $pkgInstall . "'> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"pkgdb\" value=" . $_POST['pkgdb'] . ">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-danger btn-small\" type=\"submit\" name=\"submit\" value=\"Install\" onclick=\"\$('#loading').show();\">Install</button> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button class=\"btn btn-danger btn-small\" type=\"button\" name=\"cancel\" value=\"Cancel\" onClick=\"javascript:location.href='?module=sentastico'\">Cancel</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t\t\t\t\t</table>"; $line .= "</form>"; $line .= "<div id=\"loading\" style=\"display:none;\">\n\t\t\t\t\t\t\t\t\t\t\t\tPlease wait...<br />\n\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"modules/sentastico/assets/bar.gif\" alt=\"\" /><br />\n\t\t\t\t\t\t\t\t\t\t\t\tUnpacking " . $pkgInstall . "...\n\t\t\t\t\t\t\t\t\t\t\t</div>"; } } } else { $userid = $_POST['u']; $installed = @$_SESSION['installed']; $install_to_base_dir = $_POST['install_to_base_dir']; $currentuser = ctrl_users::GetUserDetail($userid); $hostdatadir = ctrl_options::GetOption('hosted_dir') . "" . $currentuser['username']; $site_domain = clean($_POST['site_domain']); $dir_to_install = clean($_POST['dir_to_install']); $install_to_base_dir = clean($_POST['install_to_base_dir']); // Retrieve the directory for the Domain selected $domaindir = FetchDomainDir($userid, $site_domain); $completedir = $hostdatadir . "/public_html" . $domaindir . "/" . $dir_to_install . ""; $line = "<h2>Automated " . $pkgInstall . " Installation Status:</h2>"; if (file_exists($completedir) && $install_to_base_dir != '1' && empty($dir_to_install) && $installed != 'true') { $line .= "If not empty root folder<br><br>"; $line .= "<p><font color=\"red\"><strong>Destination folder already exists!</strong></font><br /><br />Sorry, the install folder (<strong>/public_html" . $domaindir . "/" . $dir_to_install . "</strong>) already exists or contains files.<br />Please go back and create a new folder.</p>"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; // START issue here with showing folder exists even if folder created upon unzip completion } else { if (file_exists($completedir) && $install_to_base_dir != '1' && isset($dir_to_install) && $installed != 'true') { $line .= "If not empty sub folder<br><br>"; $line .= "<p><font color=\"red\"><strong>Destination folder already exists!</strong></font><br /><br />Sorry, the install folder (<strong>/public_html" . $domaindir . "/" . $dir_to_install . "</strong>) already exists or contains files.<br />Please go back and create a new folder.</p>"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; // START issue here with showing folder exists even if folder created upon unzip completion } else { $line .= "Preparing folder: "; CreateDir($completedir, $domaindir, $dir_to_install); $line .= "<font color=\"green\">Folder created Successfully!</font>"; sleep(1); // Remove all Files in the install Folder emptyDir($completedir); sleep(3); set_time_limit(0); $line .= "<br />Installing files: "; $line .= "<form><input type='hidden' name='installed' value='InS'></form>"; // Un-Compressing The ZIP Archive if (UnZip($zipfile . ".zip", $completedir, $site_domain, $dir_to_install) == 'true') { $line .= "<font color=\"green\">Unzip was successful</font><br />"; $line .= "Package unzipped to: http://" . $site_domain . "/" . $dir_to_install . "<br /><br />"; if (file_exists($completedir . "/sentastico-install.php")) { $line .= "<a target=\"_blank\" href='http://" . $site_domain . "/" . $dir_to_install . "/sentastico-install.php'> <button class=\"btn btn-primary btn-small\" type=\"button\">Install Now</button> </a>"; $line .= "<button class=\"btn btn-danger btn-small\" onClick=\"javascript:location.href='?module=sentastico'\">Install Later</button>"; } else { $line .= "<a target=\"_blank\" href='http://" . $site_domain . "/" . $dir_to_install . "/'><button class=\"btn btn-primary btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Install Now</button></a> "; $line .= "<button class=\"btn btn-danger btn-small\" onClick=\"javascript:location.href='?module=sentastico'\">Install Later</button>"; } } else { $line .= "<font color=\"red\">Unzip was not successful</font><br /><br />"; $line .= "<p><button class=\"btn btn-danger btn-small\" type=\"button\" onClick=\"javascript:location.href='?module=sentastico'\">Start over</button></p>"; } $_SESSION['installed'] = 'true'; sleep(5); // Set file/folder ownership and permissions if on posix if (php_uname('s') != 'Windows NT') { $line .= "Setting file and folder permissions: " . php_uname('s'); fixPermissions($completedir); } } } } } return $line; } }