diff --git a/2fa.php b/2fa.php
index b267a90c..2d5d5a54 100644
--- a/2fa.php
+++ b/2fa.php
@@ -3,6 +3,10 @@ if (! defined('AREA')) {
header("Location: index.php");
exit();
}
+
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if (Settings::Get('2fa.enabled') != '1') {
dynamic_error("2FA not activated");
}
diff --git a/admin_admins.php b/admin_admins.php
index 49784818..66c4b573 100644
--- a/admin_admins.php
+++ b/admin_admins.php
@@ -20,6 +20,10 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Admins as Admins;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
diff --git a/admin_autoupdate.php b/admin_autoupdate.php
index ec3242fe..505e34c5 100644
--- a/admin_autoupdate.php
+++ b/admin_autoupdate.php
@@ -20,6 +20,8 @@
define('AREA', 'admin');
require './lib/init.php';
+use \Froxlor\Http\HttpClient;
+
// define update-uri
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
diff --git a/admin_configfiles.php b/admin_configfiles.php
index 6ca70336..e43ae2e8 100644
--- a/admin_configfiles.php
+++ b/admin_configfiles.php
@@ -18,6 +18,8 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Settings as Settings;
+
if ($userinfo['change_serversettings'] == '1') {
if ($action == 'setconfigured')
diff --git a/admin_cronjobs.php b/admin_cronjobs.php
index e70dbcaa..079eb321 100644
--- a/admin_cronjobs.php
+++ b/admin_cronjobs.php
@@ -18,6 +18,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Api\Commands\Cronjobs as Cronjobs;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
diff --git a/admin_customers.php b/admin_customers.php
index 3a8c66f1..a9c0bcd1 100644
--- a/admin_customers.php
+++ b/admin_customers.php
@@ -20,6 +20,10 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Customers as Customers;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
diff --git a/admin_domains.php b/admin_domains.php
index cfb56908..c3aec573 100644
--- a/admin_domains.php
+++ b/admin_domains.php
@@ -19,6 +19,10 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Domains as Domains;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
diff --git a/admin_index.php b/admin_index.php
index 660d2539..087eef50 100644
--- a/admin_index.php
+++ b/admin_index.php
@@ -20,6 +20,11 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Froxlor as Froxlor;
+use Froxlor\Api\Commands\Admins as Admins;
+
if ($action == 'logout') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
@@ -348,7 +353,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
- } catch(phpmailerException $e) {
+ } catch(\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
diff --git a/admin_ipsandports.php b/admin_ipsandports.php
index c9165618..bc70a9ba 100644
--- a/admin_ipsandports.php
+++ b/admin_ipsandports.php
@@ -19,6 +19,10 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
diff --git a/admin_logger.php b/admin_logger.php
index 9c344702..84c73109 100644
--- a/admin_logger.php
+++ b/admin_logger.php
@@ -20,6 +20,8 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+
if ($page == 'log'
&& $userinfo['change_serversettings'] == '1'
) {
diff --git a/admin_message.php b/admin_message.php
index bd7213cf..44331eba 100644
--- a/admin_message.php
+++ b/admin_message.php
@@ -20,6 +20,8 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
diff --git a/admin_phpsettings.php b/admin_phpsettings.php
index 01ac2d7d..71b77007 100644
--- a/admin_phpsettings.php
+++ b/admin_phpsettings.php
@@ -19,6 +19,10 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Api\Commands\PhpSettings as PhpSettings;
+use Froxlor\Api\Commands\FpmDaemons as FpmDaemons;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
diff --git a/admin_plans.php b/admin_plans.php
index eaee22b2..bdcc767b 100644
--- a/admin_plans.php
+++ b/admin_plans.php
@@ -17,6 +17,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
diff --git a/admin_templates.php b/admin_templates.php
index 5a138fc0..dab6cc71 100644
--- a/admin_templates.php
+++ b/admin_templates.php
@@ -20,6 +20,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if (isset($_POST['subjectid'])) {
$subjectid = intval($_POST['subjectid']);
$mailbodyid = intval($_POST['mailbodyid']);
diff --git a/admin_tickets.php b/admin_tickets.php
index fbb569a3..6727871e 100644
--- a/admin_tickets.php
+++ b/admin_tickets.php
@@ -20,6 +20,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
diff --git a/admin_traffic.php b/admin_traffic.php
index 31b2fc2f..bfbb627a 100644
--- a/admin_traffic.php
+++ b/admin_traffic.php
@@ -19,6 +19,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
diff --git a/admin_updates.php b/admin_updates.php
index 33ba90a6..97508130 100644
--- a/admin_updates.php
+++ b/admin_updates.php
@@ -18,6 +18,9 @@
define('AREA', 'admin');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
if ($page == 'overview') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
diff --git a/api_keys.php b/api_keys.php
index 34d9e322..d77e9abd 100644
--- a/api_keys.php
+++ b/api_keys.php
@@ -20,6 +20,8 @@ if (! defined('AREA')) {
*
*/
+use Froxlor\Database as Database;
+
// This file is being included in admin_index and customer_index
// and therefore does not need to require lib/init.php
diff --git a/customer_domains.php b/customer_domains.php
index 45b02893..f916ee56 100644
--- a/customer_domains.php
+++ b/customer_domains.php
@@ -20,6 +20,11 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\SubDomains as SubDomains;
+use Froxlor\Api\Commands\Certificates as Certificates;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','domains')) {
redirectTo('customer_index.php');
diff --git a/customer_email.php b/customer_email.php
index 4662656a..f6fda2d2 100644
--- a/customer_email.php
+++ b/customer_email.php
@@ -20,6 +20,12 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Emails as Emails;
+use Froxlor\Api\Commands\EmailAccounts as EmailAccounts;
+use Froxlor\Api\Commands\EmailForwarders as EmailForwarders;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','email')) {
redirectTo('customer_index.php');
diff --git a/customer_extras.php b/customer_extras.php
index abd4b08e..203544b8 100644
--- a/customer_extras.php
+++ b/customer_extras.php
@@ -19,6 +19,12 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\DirOptions as DirOptions;
+use Froxlor\Api\Commands\DirProtections as DirProtections;
+use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras')) {
redirectTo('customer_index.php');
diff --git a/customer_ftp.php b/customer_ftp.php
index b2131b07..23c1bbab 100644
--- a/customer_ftp.php
+++ b/customer_ftp.php
@@ -20,6 +20,10 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Ftps as Ftps;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
redirectTo('customer_index.php');
diff --git a/customer_index.php b/customer_index.php
index f1ba35fb..f41c1720 100644
--- a/customer_index.php
+++ b/customer_index.php
@@ -20,6 +20,10 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Customers as Customers;
+
if ($action == 'logout') {
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
@@ -286,7 +290,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
- } catch(phpmailerException $e) {
+ } catch(\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
diff --git a/customer_logger.php b/customer_logger.php
index 366b9735..43800c3a 100644
--- a/customer_logger.php
+++ b/customer_logger.php
@@ -19,6 +19,9 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
redirectTo('customer_index.php');
diff --git a/customer_mysql.php b/customer_mysql.php
index 5407b172..2403df2d 100644
--- a/customer_mysql.php
+++ b/customer_mysql.php
@@ -20,6 +20,10 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Mysqls as Mysqls;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
redirectTo('customer_index.php');
diff --git a/customer_tickets.php b/customer_tickets.php
index 5262adb5..d7f6ddb2 100644
--- a/customer_tickets.php
+++ b/customer_tickets.php
@@ -20,6 +20,8 @@
define('AREA', 'customer');
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
if (isset($_POST['id'])) {
diff --git a/customer_traffic.php b/customer_traffic.php
index abca00b0..5d3e90ba 100644
--- a/customer_traffic.php
+++ b/customer_traffic.php
@@ -21,6 +21,9 @@ define('AREA', 'customer');
$intrafficpage = 1;
require './lib/init.php';
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
redirectTo('customer_index.php');
diff --git a/dns_editor.php b/dns_editor.php
index 3f731dcd..8fd4604f 100644
--- a/dns_editor.php
+++ b/dns_editor.php
@@ -19,6 +19,9 @@ if (! defined('AREA')) {
*
*/
+use Froxlor\Database as Database;
+use Froxlor\Api\Commands\DomainZones as DomainZones;
+
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php
diff --git a/index.php b/index.php
index 45ef4333..dad7e5d4 100644
--- a/index.php
+++ b/index.php
@@ -19,6 +19,10 @@
define('AREA', 'login');
require './lib/init.php';
+use \Froxlor\Database;
+use \Froxlor\Settings;
+use \Froxlor\FroxlorLogger;
+
if ($action == '') {
$action = 'login';
}
@@ -285,7 +289,7 @@ if ($action == '2fa_entercode') {
$mail->MsgHTML(str_replace("\n", "
", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$mail->Send();
- } catch (phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -514,7 +518,7 @@ if ($action == 'forgotpwd') {
$mail->MsgHTML(str_replace("\n", "
", $mail_body));
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
$mail->Send();
- } catch (phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php
index f8c0714f..cc3b4fb1 100644
--- a/lib/Froxlor/Api/Commands/Customers.php
+++ b/lib/Froxlor/Api/Commands/Customers.php
@@ -717,7 +717,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
'company' => $company
)));
$this->mailer()->send();
- } catch (\phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (\Exception $e) {
diff --git a/lib/Froxlor/Api/Commands/EmailAccounts.php b/lib/Froxlor/Api/Commands/EmailAccounts.php
index f261a694..fac5a27a 100644
--- a/lib/Froxlor/Api/Commands/EmailAccounts.php
+++ b/lib/Froxlor/Api/Commands/EmailAccounts.php
@@ -219,7 +219,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
$this->mailer()->msgHTML(str_replace("\n", "
", $mail_body));
$this->mailer()->addAddress($email_full);
$this->mailer()->send();
- } catch (\phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (\Exception $e) {
@@ -249,7 +249,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
$this->mailer()->msgHTML(str_replace("\n", "
", $mail_body));
$this->mailer()->addAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($customer));
$this->mailer()->send();
- } catch (\phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (\Exception $e) {
diff --git a/lib/Froxlor/Api/Commands/Ftps.php b/lib/Froxlor/Api/Commands/Ftps.php
index bdb4709b..9868117e 100644
--- a/lib/Froxlor/Api/Commands/Ftps.php
+++ b/lib/Froxlor/Api/Commands/Ftps.php
@@ -206,7 +206,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
$this->mailer()->msgHTML(str_replace("\n", "
", $mail_body));
$this->mailer()->addAddress($customer['email'], getCorrectUserSalutation($customer));
$this->mailer()->send();
- } catch (\phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (\Exception $e) {
diff --git a/lib/Froxlor/Api/Commands/Mysqls.php b/lib/Froxlor/Api/Commands/Mysqls.php
index afeabc0a..7c01ae50 100644
--- a/lib/Froxlor/Api/Commands/Mysqls.php
+++ b/lib/Froxlor/Api/Commands/Mysqls.php
@@ -149,7 +149,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$this->mailer()->msgHTML(str_replace("\n", "
", $mail_body));
$this->mailer()->addAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$this->mailer()->send();
- } catch (\phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (\Exception $e) {
diff --git a/lib/ajax.php b/lib/ajax.php
index 3b17e436..4ff56013 100644
--- a/lib/ajax.php
+++ b/lib/ajax.php
@@ -16,18 +16,16 @@
*
*/
+require __DIR__ . '/vendor/autoload.php';
+
// Load the user settings
-define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
if (! file_exists('./userdata.inc.php')) {
die();
}
require './userdata.inc.php';
require './tables.inc.php';
-require './classes/database/class.Database.php';
-require './classes/settings/class.Settings.php';
require './functions/validate/function.validate_ip.php';
require './functions/validate/function.validateDomain.php';
-require './classes/cURL/class.HttpClient.php';
if (isset($_POST['action'])) {
$action = $_POST['action'];
@@ -39,7 +37,7 @@ if (isset($_POST['action'])) {
if ($action == "newsfeed") {
if (isset($_GET['role']) && $_GET['role'] == "customer") {
- $feed = Settings::Get("customer.news_feed_url");
+ $feed = \Froxlor\Settings::Get("customer.news_feed_url");
} else {
$feed = "https://inside.froxlor.org/news/";
}
@@ -50,7 +48,7 @@ if ($action == "newsfeed") {
}
if (function_exists('curl_version')) {
- $output = HttpClient::urlGet($feed);
+ $output = \Froxlor\Http\HttpClient::urlGet($feed);
$news = simplexml_load_string(trim($output));
} else {
outputItem("Newsfeed not available due to missing php-curl extension", "Please install the php-curl extension in order to view our newsfeed.");
diff --git a/lib/classes/ticket/class.ticket.php b/lib/classes/ticket/class.ticket.php
index b3b14384..530abbb0 100644
--- a/lib/classes/ticket/class.ticket.php
+++ b/lib/classes/ticket/class.ticket.php
@@ -1,5 +1,9 @@
MsgHTML(str_replace("\n", "
", $mail_body));
$mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
$mail->Send();
- } catch (phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -357,7 +361,7 @@ class ticket
$mail->MsgHTML(str_replace("\n", "
", $mail_body));
$mail->AddAddress($admin['email'], $admin['name']);
$mail->Send();
- } catch (phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
diff --git a/lib/cron_init.php b/lib/cron_init.php
index a432c593..2e0ac436 100644
--- a/lib/cron_init.php
+++ b/lib/cron_init.php
@@ -1,4 +1,7 @@
- (2003-2009)
- * @author Froxlor team (2010-)
- * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
- * @package Cron
- *
+ * @copyright (c) the authors
+ * @author Florian Lippert (2003-2009)
+ * @author Froxlor team (2010-)
+ * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
+ * @package Cron
+ *
*/
-if (@php_sapi_name() != 'cli'
- && @php_sapi_name() != 'cgi'
- && @php_sapi_name() != 'cgi-fcgi'
-) {
+if (@php_sapi_name() != 'cli' && @php_sapi_name() != 'cgi' && @php_sapi_name() != 'cgi-fcgi') {
die('This script will only work in the shell.');
}
+require __DIR__ . '/vendor/autoload.php';
+
// ensure that default timezone is set
-if (function_exists("date_default_timezone_set")
- && function_exists("date_default_timezone_get")
-) {
+if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
@date_default_timezone_set(@date_default_timezone_get());
}
$basename = basename($_SERVER['PHP_SELF'], '.php');
$crontype = "";
if (isset($argv) && is_array($argv) && count($argv) > 1) {
- for($x=1;$x < count($argv);$x++) {
- if (substr(strtolower($argv[$x]), 0, 2) == '--'
- && strlen($argv[$x]) > 3
- ) {
+ for ($x = 1; $x < count($argv); $x ++) {
+ if (substr(strtolower($argv[$x]), 0, 2) == '--' && strlen($argv[$x]) > 3) {
$crontype = substr(strtolower($argv[$x]), 2);
- $basename .= "-".$crontype;
+ $basename .= "-" . $crontype;
break;
}
}
@@ -54,14 +52,13 @@ $lockfile = $lockdir . $lockfName;
// froxlor installation isn't in /var/www/froxlor
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
-
// create and open the lockfile!
$keepLockFile = false;
$debugHandler = fopen($lockfile, 'w');
fwrite($debugHandler, 'Setting Lockfile to ' . $lockfile . "\n");
fwrite($debugHandler, 'Setting Froxlor installation path to ' . FROXLOR_INSTALL_DIR . "\n");
-if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
+if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
die("Froxlor does not seem to be installed yet - skipping cronjob");
}
@@ -70,11 +67,15 @@ require FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php';
fwrite($debugHandler, 'Userdatas included' . "\n");
// Legacy sql-root-information
-if (isset($sql['root_user'])
- && isset($sql['root_password'])
- && (!isset($sql_root) || !is_array($sql_root))
-) {
- $sql_root = array(0 => array('caption' => 'Default', 'host' => $sql['host'], 'user' => $sql['root_user'], 'password' => $sql['root_password']));
+if (isset($sql['root_user']) && isset($sql['root_password']) && (! isset($sql_root) || ! is_array($sql_root))) {
+ $sql_root = array(
+ 0 => array(
+ 'caption' => 'Default',
+ 'host' => $sql['host'],
+ 'user' => $sql['root_user'],
+ 'password' => $sql['root_password']
+ )
+ );
unset($sql['root_user']);
unset($sql['root_password']);
}
@@ -82,14 +83,14 @@ if (isset($sql['root_user'])
// Includes the Functions
require FROXLOR_INSTALL_DIR . '/lib/functions.php';
-//Includes the MySQL-Tabledefinitions etc.
+// Includes the MySQL-Tabledefinitions etc.
require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
fwrite($debugHandler, 'Table definitions included' . "\n");
// try database connection, it will throw
// and exception itself if failed
try {
- Database::query("SELECT 1");
+ \Froxlor\Database\Database::query("SELECT 1");
} catch (Exception $e) {
// Do not proceed further if no database connection could be established
fclose($debugHandler);
@@ -104,9 +105,7 @@ $lockDirHandle = opendir($lockdir);
while ($fName = readdir($lockDirHandle)) {
- if ($lockFilename == substr($fName, 0, strlen($lockFilename))
- && $lockfName != $fName
- ) {
+ if ($lockFilename == substr($fName, 0, strlen($lockFilename)) && $lockfName != $fName) {
// Check if last run jailed out with an exception
$croncontent = file($lockdir . $fName);
$lastline = $croncontent[(count($croncontent) - 1)];
@@ -119,29 +118,28 @@ while ($fName = readdir($lockDirHandle)) {
// Check if cron is running or has died.
$check_pid = substr(strrchr($fName, "-"), 1);
- system("kill -CHLD " . (int)$check_pid . " 1> /dev/null 2> /dev/null", $check_pid_return);
+ system("kill -CHLD " . (int) $check_pid . " 1> /dev/null 2> /dev/null", $check_pid_return);
if ($check_pid_return == 1) {
- // Result: Existing lockfile/pid isn't running
- // Most likely it has died
+ // Result: Existing lockfile/pid isn't running
+ // Most likely it has died
//
- // Action: Remove it and continue
+ // Action: Remove it and continue
//
fwrite($debugHandler, 'Previous cronjob didn\'t exit clean. PID: ' . $check_pid . "\n");
fwrite($debugHandler, 'Removing lockfile: ' . $lockdir . $fName . "\n");
@unlink($lockdir . $fName);
-
} else {
- // Result: A Cronscript with this pid
- // is still running
- // Action: remove my own Lock and die
+ // Result: A Cronscript with this pid
+ // is still running
+ // Action: remove my own Lock and die
//
// close the current lockfile
fclose($debugHandler);
// ... and delete it
unlink($lockfile);
- dieWithMail('There is already a Cronjob for '.$crontype.' in progress. Exiting...' . "\n" . 'Take a look into the contents of ' . $lockdir . $lockFilename . '* for more information!' . "\n");
+ dieWithMail('There is already a Cronjob for ' . $crontype . ' in progress. Exiting...' . "\n" . 'Take a look into the contents of ' . $lockdir . $lockFilename . '* for more information!' . "\n");
}
}
}
@@ -150,51 +148,48 @@ while ($fName = readdir($lockDirHandle)) {
* if using fcgid or fpm for froxlor-vhost itself, we have to check
* whether the permission of the files are still correct
*/
-fwrite($debugHandler, 'Checking froxlor file permissions'."\n");
+fwrite($debugHandler, 'Checking froxlor file permissions' . "\n");
$_mypath = makeCorrectDir(FROXLOR_INSTALL_DIR);
-if (((int)Settings::Get('system.mod_fcgid') == 1 && (int)Settings::Get('system.mod_fcgid_ownvhost') == 1)
- || ((int)Settings::Get('phpfpm.enabled') == 1 && (int)Settings::Get('phpfpm.enabled_ownvhost') == 1)
-) {
- $user = Settings::Get('system.mod_fcgid_httpuser');
- $group = Settings::Get('system.mod_fcgid_httpgroup');
+if (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 && (int) \Froxlor\Settings::Get('system.mod_fcgid_ownvhost') == 1) || ((int) \Froxlor\Settings::Get('phpfpm.enabled') == 1 && (int) \Froxlor\Settings::Get('phpfpm.enabled_ownvhost') == 1)) {
+ $user = \Froxlor\Settings::Get('system.mod_fcgid_httpuser');
+ $group = \Froxlor\Settings::Get('system.mod_fcgid_httpgroup');
- if (Settings::Get('phpfpm.enabled') == 1) {
- $user = Settings::Get('phpfpm.vhost_httpuser');
- $group = Settings::Get('phpfpm.vhost_httpgroup');
+ if (\Froxlor\Settings::Get('phpfpm.enabled') == 1) {
+ $user = \Froxlor\Settings::Get('phpfpm.vhost_httpuser');
+ $group = \Froxlor\Settings::Get('phpfpm.vhost_httpgroup');
}
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
} else {
// back to webserver permission
- $user = Settings::Get('system.httpuser');
- $group = Settings::Get('system.httpgroup');
+ $user = \Froxlor\Settings::Get('system.httpuser');
+ $group = \Froxlor\Settings::Get('system.httpgroup');
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
}
// Initialize logging
-$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'));
+$cronlog = \Froxlor\FroxlorLogger::getInstanceOf(array(
+ 'loginname' => 'cronjob'
+));
fwrite($debugHandler, 'Logger has been included' . "\n");
-if (hasUpdates($version) || hasDbUpdates($dbversion)
-) {
- if (Settings::Get('system.cron_allowautoupdate') == null
- || Settings::Get('system.cron_allowautoupdate') == 0
- ) {
+if (hasUpdates($version) || hasDbUpdates($dbversion)) {
+ if (\Froxlor\Settings::Get('system.cron_allowautoupdate') == null || \Froxlor\Settings::Get('system.cron_allowautoupdate') == 0) {
/**
* Do not proceed further if the Database version is not the same as the script version
*/
fclose($debugHandler);
unlink($lockfile);
$errormessage = "Version of file doesn't match version of database. Exiting...\n\n";
- $errormessage.= "Possible reason: Froxlor update\n";
- $errormessage.= "Information: Current version in database: ".Settings::Get('panel.version')." (DB: ".Settings::Get('panel.db_version').") - version of Froxlor files: ".$version." (DB: ".$dbversion.")\n";
- $errormessage.= "Solution: Please visit your Foxlor admin interface for further information.\n";
+ $errormessage .= "Possible reason: Froxlor update\n";
+ $errormessage .= "Information: Current version in database: " . \Froxlor\Settings::Get('panel.version') . " (DB: " . \Froxlor\Settings::Get('panel.db_version') . ") - version of Froxlor files: " . $version . " (DB: " . $dbversion . ")\n";
+ $errormessage .= "Solution: Please visit your Foxlor admin interface for further information.\n";
dieWithMail($errormessage);
}
- if (Settings::Get('system.cron_allowautoupdate') == 1) {
+ if (\Froxlor\Settings::Get('system.cron_allowautoupdate') == 1) {
/**
* let's walk the walk - do the dangerous shit
*/
@@ -206,7 +201,7 @@ if (hasUpdates($version) || hasDbUpdates($dbversion)
fwrite($debugHandler, "*** WARNING *** - If you don't want this to happen in the future consider removing the --allow-autoupdate flag from the cronjob\n");
// including update procedures
define('_CRON_UPDATE', 1);
- include_once FROXLOR_INSTALL_DIR.'/install/updatesql.php';
+ include_once FROXLOR_INSTALL_DIR . '/install/updatesql.php';
// pew - everything went better than expected
$cronlog->logAction(CRON_ACTION, LOG_WARNING, 'Automatic update done - you should check your settings to be sure everything is fine');
fwrite($debugHandler, '*** WARNING *** - Automatic update done - you should check your settings to be sure everything is fine' . "\n");
@@ -215,7 +210,7 @@ if (hasUpdates($version) || hasDbUpdates($dbversion)
fwrite($debugHandler, 'Froxlor version and database version are correct' . "\n");
-$cronscriptDebug = (Settings::Get('system.debug_cron') == '1') ? true : false;
+$cronscriptDebug = (\Froxlor\Settings::Get('system.debug_cron') == '1') ? true : false;
// Create a new idna converter
-$idna_convert = new idna_convert_wrapper();
+$idna_convert = new \Froxlor\Idna\IdnaWrapper();
diff --git a/lib/cron_shutdown.php b/lib/cron_shutdown.php
index 62f7f2e7..7ed2207c 100644
--- a/lib/cron_shutdown.php
+++ b/lib/cron_shutdown.php
@@ -20,7 +20,7 @@
// check for cron.d-generation task and create it if necessary
checkCrondConfigurationFile();
-if (Settings::Get('logger.log_cron') == '1') {
+if (\Froxlor\Settings::Get('logger.log_cron') == '1') {
$cronlog->setCronLog(0);
fwrite($debugHandler, 'Logging for cron has been shutdown' . "\n");
}
@@ -31,8 +31,6 @@ if ($keepLockFile === true) {
fclose($debugHandler);
-if ($keepLockFile === false
- && $cronscriptDebug === false
-) {
+if ($keepLockFile === false && $cronscriptDebug === false) {
unlink($lockfile);
}
diff --git a/lib/functions/output/function.dieWithMail.php b/lib/functions/output/function.dieWithMail.php
index d0e5015b..76396142 100644
--- a/lib/functions/output/function.dieWithMail.php
+++ b/lib/functions/output/function.dieWithMail.php
@@ -17,6 +17,7 @@
* @since 0.9.33
*
*/
+use Froxlor\Settings;
/**
* Cronjob function to end a cronjob in a critical condition
@@ -27,11 +28,11 @@
*
* @return void
*/
-function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
-
+function dieWithMail($message, $subject = "[froxlor] Cronjob error")
+{
if (Settings::Get('system.send_cron_errors') == '1') {
- $_mail = new PHPMailer(true);
+ $_mail = new \PHPMailer\PHPMailer\PHPMailer(true);
$_mail->CharSet = "UTF-8";
if (Settings::Get('system.mail_use_smtp')) {
@@ -48,7 +49,7 @@ function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
$_mail->Port = Settings::Get('system.mail_smtp_port');
}
- if (PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
+ if (\PHPMailer\PHPMailer\PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76
$_mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') {
@@ -63,7 +64,7 @@ function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
$_mail->MsgHTML(nl2br($message));
$_mail->AddAddress(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
$_mail->Send();
- } catch (phpmailerException $e) {
+ } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -79,5 +80,4 @@ function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
}
die($message);
-
}
diff --git a/lib/init.php b/lib/init.php
index dd8c905a..d23da853 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -17,6 +17,8 @@
*
*/
+require __DIR__ . '/vendor/autoload.php';
+
use \Froxlor\Database;
use \Froxlor\Settings;
diff --git a/lib/version.inc.php b/lib/version.inc.php
index d7d2f222..8766d185 100644
--- a/lib/version.inc.php
+++ b/lib/version.inc.php
@@ -16,10 +16,10 @@
*/
// Main version variable
-$version = '0.10.0';
+$version = \Froxlor\Froxlor::VERSION;
// Database version (YYYYMMDDC where C is a daily counter)
-$dbversion = '201812180';
+$dbversion = \Froxlor\Froxlor::DBVERSION;
// Distribution branding-tag (used for Debian etc.)
-$branding = '';
+$branding = \Froxlor\Froxlor::BRANDING;
diff --git a/logfiles_viewer.php b/logfiles_viewer.php
index 3226d25a..f796b9e3 100644
--- a/logfiles_viewer.php
+++ b/logfiles_viewer.php
@@ -19,6 +19,9 @@ if (! defined('AREA')) {
*
*/
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\SubDomains as SubDomains;
+
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php
diff --git a/scripts/jobs/cron_usage.inc.diskspace.php b/scripts/jobs/cron_usage.inc.diskspace.php
index 045ae9a2..af41baa4 100644
--- a/scripts/jobs/cron_usage.inc.diskspace.php
+++ b/scripts/jobs/cron_usage.inc.diskspace.php
@@ -14,6 +14,8 @@
* @package Cron
*
*/
+use \Froxlor\Database;
+use \Froxlor\Settings;
if ((int)Settings::Get('system.report_webmax') > 0)
{
@@ -97,7 +99,7 @@ if ((int)Settings::Get('system.report_webmax') > 0)
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
$mail->Send();
- } catch(phpmailerException $e) {
+ } catch(\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -187,7 +189,7 @@ if ((int)Settings::Get('system.report_webmax') > 0)
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
$mail->Send();
- } catch(phpmailerException $e) {
+ } catch(\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
diff --git a/ssl_certificates.php b/ssl_certificates.php
index eb08f534..ba55cf72 100644
--- a/ssl_certificates.php
+++ b/ssl_certificates.php
@@ -19,6 +19,10 @@ if (! defined('AREA')) {
*
*/
+use Froxlor\Database as Database;
+use Froxlor\Settings as Settings;
+use Froxlor\Api\Commands\Certificates as Certificates;
+
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php