use namespaces in modules
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
4
2fa.php
4
2fa.php
@@ -3,6 +3,10 @@ if (! defined('AREA')) {
|
|||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (Settings::Get('2fa.enabled') != '1') {
|
if (Settings::Get('2fa.enabled') != '1') {
|
||||||
dynamic_error("2FA not activated");
|
dynamic_error("2FA not activated");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif(isset($_GET['id'])) {
|
} elseif(isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use \Froxlor\Http\HttpClient;
|
||||||
|
|
||||||
// define update-uri
|
// define update-uri
|
||||||
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
|
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
|
||||||
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if ($userinfo['change_serversettings'] == '1') {
|
if ($userinfo['change_serversettings'] == '1') {
|
||||||
|
|
||||||
if ($action == 'setconfigured')
|
if ($action == 'setconfigured')
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Api\Commands\Cronjobs as Cronjobs;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif(isset($_GET['id'])) {
|
} elseif(isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif(isset($_GET['id'])) {
|
} elseif(isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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') {
|
if ($action == 'logout') {
|
||||||
|
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
|
||||||
@@ -348,7 +353,7 @@ if ($page == 'overview') {
|
|||||||
$mail->MsgHTML($mail_html);
|
$mail->MsgHTML($mail_html);
|
||||||
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch(phpmailerException $e) {
|
} catch(\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
|
||||||
if ($page == 'log'
|
if ($page == 'log'
|
||||||
&& $userinfo['change_serversettings'] == '1'
|
&& $userinfo['change_serversettings'] == '1'
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
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'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif (isset($_GET['id'])) {
|
} elseif (isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (isset($_POST['subjectid'])) {
|
if (isset($_POST['subjectid'])) {
|
||||||
$subjectid = intval($_POST['subjectid']);
|
$subjectid = intval($_POST['subjectid']);
|
||||||
$mailbodyid = intval($_POST['mailbodyid']);
|
$mailbodyid = intval($_POST['mailbodyid']);
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
$id = intval($_POST['id']);
|
$id = intval($_POST['id']);
|
||||||
} elseif(isset($_GET['id'])) {
|
} elseif(isset($_GET['id'])) {
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
define('AREA', 'admin');
|
define('AREA', 'admin');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if ($page == 'overview') {
|
if ($page == 'overview') {
|
||||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ if (! defined('AREA')) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
|
||||||
// This file is being included in admin_index and customer_index
|
// This file is being included in admin_index and customer_index
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
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
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','domains')) {
|
if (Settings::IsInList('panel.customer_hide_options','domains')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -20,6 +20,12 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
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
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','email')) {
|
if (Settings::IsInList('panel.customer_hide_options','email')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -19,6 +19,12 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
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
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','extras')) {
|
if (Settings::IsInList('panel.customer_hide_options','extras')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
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
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
|
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
use Froxlor\Api\Commands\Customers as Customers;
|
||||||
|
|
||||||
if ($action == 'logout') {
|
if ($action == 'logout') {
|
||||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
|
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
|
||||||
|
|
||||||
@@ -286,7 +290,7 @@ if ($page == 'overview') {
|
|||||||
$mail->MsgHTML($mail_html);
|
$mail->MsgHTML($mail_html);
|
||||||
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch(phpmailerException $e) {
|
} catch(\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
// redirect if this customer page is hidden via settings
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
|
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
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
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
|
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.php');
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
define('AREA', 'customer');
|
define('AREA', 'customer');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
if (isset($_POST['id'])) {
|
if (isset($_POST['id'])) {
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ define('AREA', 'customer');
|
|||||||
$intrafficpage = 1;
|
$intrafficpage = 1;
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use Froxlor\Database as Database;
|
||||||
|
use Froxlor\Settings as Settings;
|
||||||
|
|
||||||
// redirect if this customer page is hidden via settings
|
// redirect if this customer page is hidden via settings
|
||||||
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
|
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
|
||||||
redirectTo('customer_index.php');
|
redirectTo('customer_index.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
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
define('AREA', 'login');
|
define('AREA', 'login');
|
||||||
require './lib/init.php';
|
require './lib/init.php';
|
||||||
|
|
||||||
|
use \Froxlor\Database;
|
||||||
|
use \Froxlor\Settings;
|
||||||
|
use \Froxlor\FroxlorLogger;
|
||||||
|
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$action = 'login';
|
$action = 'login';
|
||||||
}
|
}
|
||||||
@@ -285,7 +289,7 @@ if ($action == '2fa_entercode') {
|
|||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch (phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -514,7 +518,7 @@ if ($action == 'forgotpwd') {
|
|||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
|
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch (phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
|||||||
'company' => $company
|
'company' => $company
|
||||||
)));
|
)));
|
||||||
$this->mailer()->send();
|
$this->mailer()->send();
|
||||||
} catch (\phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
|||||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$this->mailer()->addAddress($email_full);
|
$this->mailer()->addAddress($email_full);
|
||||||
$this->mailer()->send();
|
$this->mailer()->send();
|
||||||
} catch (\phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -249,7 +249,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
|||||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$this->mailer()->addAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($customer));
|
$this->mailer()->addAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($customer));
|
||||||
$this->mailer()->send();
|
$this->mailer()->send();
|
||||||
} catch (\phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
|||||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$this->mailer()->addAddress($customer['email'], getCorrectUserSalutation($customer));
|
$this->mailer()->addAddress($customer['email'], getCorrectUserSalutation($customer));
|
||||||
$this->mailer()->send();
|
$this->mailer()->send();
|
||||||
} catch (\phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$this->mailer()->addAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
$this->mailer()->addAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
||||||
$this->mailer()->send();
|
$this->mailer()->send();
|
||||||
} catch (\phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
10
lib/ajax.php
10
lib/ajax.php
@@ -16,18 +16,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
// Load the user settings
|
// Load the user settings
|
||||||
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
|
||||||
if (! file_exists('./userdata.inc.php')) {
|
if (! file_exists('./userdata.inc.php')) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
require './userdata.inc.php';
|
require './userdata.inc.php';
|
||||||
require './tables.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.validate_ip.php';
|
||||||
require './functions/validate/function.validateDomain.php';
|
require './functions/validate/function.validateDomain.php';
|
||||||
require './classes/cURL/class.HttpClient.php';
|
|
||||||
|
|
||||||
if (isset($_POST['action'])) {
|
if (isset($_POST['action'])) {
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
@@ -39,7 +37,7 @@ if (isset($_POST['action'])) {
|
|||||||
|
|
||||||
if ($action == "newsfeed") {
|
if ($action == "newsfeed") {
|
||||||
if (isset($_GET['role']) && $_GET['role'] == "customer") {
|
if (isset($_GET['role']) && $_GET['role'] == "customer") {
|
||||||
$feed = Settings::Get("customer.news_feed_url");
|
$feed = \Froxlor\Settings::Get("customer.news_feed_url");
|
||||||
} else {
|
} else {
|
||||||
$feed = "https://inside.froxlor.org/news/";
|
$feed = "https://inside.froxlor.org/news/";
|
||||||
}
|
}
|
||||||
@@ -50,7 +48,7 @@ if ($action == "newsfeed") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists('curl_version')) {
|
if (function_exists('curl_version')) {
|
||||||
$output = HttpClient::urlGet($feed);
|
$output = \Froxlor\Http\HttpClient::urlGet($feed);
|
||||||
$news = simplexml_load_string(trim($output));
|
$news = simplexml_load_string(trim($output));
|
||||||
} else {
|
} else {
|
||||||
outputItem("Newsfeed not available due to missing php-curl extension", "Please install the php-curl extension in order to view our newsfeed.");
|
outputItem("Newsfeed not available due to missing php-curl extension", "Please install the php-curl extension in order to view our newsfeed.");
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Froxlor\Database;
|
||||||
|
use \Froxlor\Settings;
|
||||||
|
use \Froxlor\FroxlorLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is part of the Froxlor project.
|
* This file is part of the Froxlor project.
|
||||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||||
@@ -325,7 +329,7 @@ class ticket
|
|||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
|
$mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch (phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -357,7 +361,7 @@ class ticket
|
|||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
$mail->AddAddress($admin['email'], $admin['name']);
|
$mail->AddAddress($admin['email'], $admin['name']);
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch (phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<?php if (!defined('MASTER_CRONJOB')) die('You cannot access this file directly!');
|
<?php
|
||||||
|
|
||||||
|
if (! defined('MASTER_CRONJOB'))
|
||||||
|
die('You cannot access this file directly!');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is part of the Froxlor project.
|
* This file is part of the Froxlor project.
|
||||||
@@ -9,37 +12,32 @@
|
|||||||
* file that was distributed with this source code. You can also view the
|
* file that was distributed with this source code. You can also view the
|
||||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||||
*
|
*
|
||||||
* @copyright (c) the authors
|
* @copyright (c) the authors
|
||||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
* @package Cron
|
* @package Cron
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (@php_sapi_name() != 'cli'
|
if (@php_sapi_name() != 'cli' && @php_sapi_name() != 'cgi' && @php_sapi_name() != 'cgi-fcgi') {
|
||||||
&& @php_sapi_name() != 'cgi'
|
|
||||||
&& @php_sapi_name() != 'cgi-fcgi'
|
|
||||||
) {
|
|
||||||
die('This script will only work in the shell.');
|
die('This script will only work in the shell.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
// ensure that default timezone is set
|
// ensure that default timezone is set
|
||||||
if (function_exists("date_default_timezone_set")
|
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
|
||||||
&& function_exists("date_default_timezone_get")
|
|
||||||
) {
|
|
||||||
@date_default_timezone_set(@date_default_timezone_get());
|
@date_default_timezone_set(@date_default_timezone_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
$basename = basename($_SERVER['PHP_SELF'], '.php');
|
$basename = basename($_SERVER['PHP_SELF'], '.php');
|
||||||
$crontype = "";
|
$crontype = "";
|
||||||
if (isset($argv) && is_array($argv) && count($argv) > 1) {
|
if (isset($argv) && is_array($argv) && count($argv) > 1) {
|
||||||
for($x=1;$x < count($argv);$x++) {
|
for ($x = 1; $x < count($argv); $x ++) {
|
||||||
if (substr(strtolower($argv[$x]), 0, 2) == '--'
|
if (substr(strtolower($argv[$x]), 0, 2) == '--' && strlen($argv[$x]) > 3) {
|
||||||
&& strlen($argv[$x]) > 3
|
|
||||||
) {
|
|
||||||
$crontype = substr(strtolower($argv[$x]), 2);
|
$crontype = substr(strtolower($argv[$x]), 2);
|
||||||
$basename .= "-".$crontype;
|
$basename .= "-" . $crontype;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,14 +52,13 @@ $lockfile = $lockdir . $lockfName;
|
|||||||
// froxlor installation isn't in /var/www/froxlor
|
// froxlor installation isn't in /var/www/froxlor
|
||||||
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
define('FROXLOR_INSTALL_DIR', dirname(dirname(__FILE__)));
|
||||||
|
|
||||||
|
|
||||||
// create and open the lockfile!
|
// create and open the lockfile!
|
||||||
$keepLockFile = false;
|
$keepLockFile = false;
|
||||||
$debugHandler = fopen($lockfile, 'w');
|
$debugHandler = fopen($lockfile, 'w');
|
||||||
fwrite($debugHandler, 'Setting Lockfile to ' . $lockfile . "\n");
|
fwrite($debugHandler, 'Setting Lockfile to ' . $lockfile . "\n");
|
||||||
fwrite($debugHandler, 'Setting Froxlor installation path to ' . FROXLOR_INSTALL_DIR . "\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");
|
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");
|
fwrite($debugHandler, 'Userdatas included' . "\n");
|
||||||
|
|
||||||
// Legacy sql-root-information
|
// Legacy sql-root-information
|
||||||
if (isset($sql['root_user'])
|
if (isset($sql['root_user']) && isset($sql['root_password']) && (! isset($sql_root) || ! is_array($sql_root))) {
|
||||||
&& isset($sql['root_password'])
|
$sql_root = array(
|
||||||
&& (!isset($sql_root) || !is_array($sql_root))
|
0 => array(
|
||||||
) {
|
'caption' => 'Default',
|
||||||
$sql_root = array(0 => array('caption' => 'Default', 'host' => $sql['host'], 'user' => $sql['root_user'], 'password' => $sql['root_password']));
|
'host' => $sql['host'],
|
||||||
|
'user' => $sql['root_user'],
|
||||||
|
'password' => $sql['root_password']
|
||||||
|
)
|
||||||
|
);
|
||||||
unset($sql['root_user']);
|
unset($sql['root_user']);
|
||||||
unset($sql['root_password']);
|
unset($sql['root_password']);
|
||||||
}
|
}
|
||||||
@@ -82,14 +83,14 @@ if (isset($sql['root_user'])
|
|||||||
// Includes the Functions
|
// Includes the Functions
|
||||||
require FROXLOR_INSTALL_DIR . '/lib/functions.php';
|
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';
|
require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php';
|
||||||
fwrite($debugHandler, 'Table definitions included' . "\n");
|
fwrite($debugHandler, 'Table definitions included' . "\n");
|
||||||
|
|
||||||
// try database connection, it will throw
|
// try database connection, it will throw
|
||||||
// and exception itself if failed
|
// and exception itself if failed
|
||||||
try {
|
try {
|
||||||
Database::query("SELECT 1");
|
\Froxlor\Database\Database::query("SELECT 1");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Do not proceed further if no database connection could be established
|
// Do not proceed further if no database connection could be established
|
||||||
fclose($debugHandler);
|
fclose($debugHandler);
|
||||||
@@ -104,9 +105,7 @@ $lockDirHandle = opendir($lockdir);
|
|||||||
|
|
||||||
while ($fName = readdir($lockDirHandle)) {
|
while ($fName = readdir($lockDirHandle)) {
|
||||||
|
|
||||||
if ($lockFilename == substr($fName, 0, strlen($lockFilename))
|
if ($lockFilename == substr($fName, 0, strlen($lockFilename)) && $lockfName != $fName) {
|
||||||
&& $lockfName != $fName
|
|
||||||
) {
|
|
||||||
// Check if last run jailed out with an exception
|
// Check if last run jailed out with an exception
|
||||||
$croncontent = file($lockdir . $fName);
|
$croncontent = file($lockdir . $fName);
|
||||||
$lastline = $croncontent[(count($croncontent) - 1)];
|
$lastline = $croncontent[(count($croncontent) - 1)];
|
||||||
@@ -119,29 +118,28 @@ while ($fName = readdir($lockDirHandle)) {
|
|||||||
|
|
||||||
// Check if cron is running or has died.
|
// Check if cron is running or has died.
|
||||||
$check_pid = substr(strrchr($fName, "-"), 1);
|
$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) {
|
if ($check_pid_return == 1) {
|
||||||
// Result: Existing lockfile/pid isn't running
|
// Result: Existing lockfile/pid isn't running
|
||||||
// Most likely it has died
|
// 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, 'Previous cronjob didn\'t exit clean. PID: ' . $check_pid . "\n");
|
||||||
fwrite($debugHandler, 'Removing lockfile: ' . $lockdir . $fName . "\n");
|
fwrite($debugHandler, 'Removing lockfile: ' . $lockdir . $fName . "\n");
|
||||||
@unlink($lockdir . $fName);
|
@unlink($lockdir . $fName);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Result: A Cronscript with this pid
|
// Result: A Cronscript with this pid
|
||||||
// is still running
|
// is still running
|
||||||
// Action: remove my own Lock and die
|
// Action: remove my own Lock and die
|
||||||
//
|
//
|
||||||
// close the current lockfile
|
// close the current lockfile
|
||||||
fclose($debugHandler);
|
fclose($debugHandler);
|
||||||
|
|
||||||
// ... and delete it
|
// ... and delete it
|
||||||
unlink($lockfile);
|
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
|
* if using fcgid or fpm for froxlor-vhost itself, we have to check
|
||||||
* whether the permission of the files are still correct
|
* 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);
|
$_mypath = makeCorrectDir(FROXLOR_INSTALL_DIR);
|
||||||
|
|
||||||
if (((int)Settings::Get('system.mod_fcgid') == 1 && (int)Settings::Get('system.mod_fcgid_ownvhost') == 1)
|
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)) {
|
||||||
|| ((int)Settings::Get('phpfpm.enabled') == 1 && (int)Settings::Get('phpfpm.enabled_ownvhost') == 1)
|
$user = \Froxlor\Settings::Get('system.mod_fcgid_httpuser');
|
||||||
) {
|
$group = \Froxlor\Settings::Get('system.mod_fcgid_httpgroup');
|
||||||
$user = Settings::Get('system.mod_fcgid_httpuser');
|
|
||||||
$group = Settings::Get('system.mod_fcgid_httpgroup');
|
|
||||||
|
|
||||||
if (Settings::Get('phpfpm.enabled') == 1) {
|
if (\Froxlor\Settings::Get('phpfpm.enabled') == 1) {
|
||||||
$user = Settings::Get('phpfpm.vhost_httpuser');
|
$user = \Froxlor\Settings::Get('phpfpm.vhost_httpuser');
|
||||||
$group = Settings::Get('phpfpm.vhost_httpgroup');
|
$group = \Froxlor\Settings::Get('phpfpm.vhost_httpgroup');
|
||||||
}
|
}
|
||||||
// all the files and folders have to belong to the local user
|
// all the files and folders have to belong to the local user
|
||||||
// now because we also use fcgid for our own vhost
|
// now because we also use fcgid for our own vhost
|
||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
|
||||||
} else {
|
} else {
|
||||||
// back to webserver permission
|
// back to webserver permission
|
||||||
$user = Settings::Get('system.httpuser');
|
$user = \Froxlor\Settings::Get('system.httpuser');
|
||||||
$group = Settings::Get('system.httpgroup');
|
$group = \Froxlor\Settings::Get('system.httpgroup');
|
||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($_mypath));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize logging
|
// Initialize logging
|
||||||
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'));
|
$cronlog = \Froxlor\FroxlorLogger::getInstanceOf(array(
|
||||||
|
'loginname' => 'cronjob'
|
||||||
|
));
|
||||||
fwrite($debugHandler, 'Logger has been included' . "\n");
|
fwrite($debugHandler, 'Logger has been included' . "\n");
|
||||||
|
|
||||||
if (hasUpdates($version) || hasDbUpdates($dbversion)
|
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
|
||||||
) {
|
if (\Froxlor\Settings::Get('system.cron_allowautoupdate') == null || \Froxlor\Settings::Get('system.cron_allowautoupdate') == 0) {
|
||||||
if (Settings::Get('system.cron_allowautoupdate') == null
|
|
||||||
|| Settings::Get('system.cron_allowautoupdate') == 0
|
|
||||||
) {
|
|
||||||
/**
|
/**
|
||||||
* Do not proceed further if the Database version is not the same as the script version
|
* Do not proceed further if the Database version is not the same as the script version
|
||||||
*/
|
*/
|
||||||
fclose($debugHandler);
|
fclose($debugHandler);
|
||||||
unlink($lockfile);
|
unlink($lockfile);
|
||||||
$errormessage = "Version of file doesn't match version of database. Exiting...\n\n";
|
$errormessage = "Version of file doesn't match version of database. Exiting...\n\n";
|
||||||
$errormessage.= "Possible reason: Froxlor update\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 .= "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";
|
$errormessage .= "Solution: Please visit your Foxlor admin interface for further information.\n";
|
||||||
dieWithMail($errormessage);
|
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
|
* 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");
|
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
|
// including update procedures
|
||||||
define('_CRON_UPDATE', 1);
|
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
|
// 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');
|
$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");
|
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");
|
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
|
// Create a new idna converter
|
||||||
$idna_convert = new idna_convert_wrapper();
|
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
// check for cron.d-generation task and create it if necessary
|
// check for cron.d-generation task and create it if necessary
|
||||||
checkCrondConfigurationFile();
|
checkCrondConfigurationFile();
|
||||||
|
|
||||||
if (Settings::Get('logger.log_cron') == '1') {
|
if (\Froxlor\Settings::Get('logger.log_cron') == '1') {
|
||||||
$cronlog->setCronLog(0);
|
$cronlog->setCronLog(0);
|
||||||
fwrite($debugHandler, 'Logging for cron has been shutdown' . "\n");
|
fwrite($debugHandler, 'Logging for cron has been shutdown' . "\n");
|
||||||
}
|
}
|
||||||
@@ -31,8 +31,6 @@ if ($keepLockFile === true) {
|
|||||||
|
|
||||||
fclose($debugHandler);
|
fclose($debugHandler);
|
||||||
|
|
||||||
if ($keepLockFile === false
|
if ($keepLockFile === false && $cronscriptDebug === false) {
|
||||||
&& $cronscriptDebug === false
|
|
||||||
) {
|
|
||||||
unlink($lockfile);
|
unlink($lockfile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
* @since 0.9.33
|
* @since 0.9.33
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
use Froxlor\Settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cronjob function to end a cronjob in a critical condition
|
* Cronjob function to end a cronjob in a critical condition
|
||||||
@@ -27,11 +28,11 @@
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
|
function dieWithMail($message, $subject = "[froxlor] Cronjob error")
|
||||||
|
{
|
||||||
if (Settings::Get('system.send_cron_errors') == '1') {
|
if (Settings::Get('system.send_cron_errors') == '1') {
|
||||||
|
|
||||||
$_mail = new PHPMailer(true);
|
$_mail = new \PHPMailer\PHPMailer\PHPMailer(true);
|
||||||
$_mail->CharSet = "UTF-8";
|
$_mail->CharSet = "UTF-8";
|
||||||
|
|
||||||
if (Settings::Get('system.mail_use_smtp')) {
|
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');
|
$_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
|
// set return-to address and custom sender-name, see #76
|
||||||
$_mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
$_mail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
||||||
if (Settings::Get('panel.adminmail_return') != '') {
|
if (Settings::Get('panel.adminmail_return') != '') {
|
||||||
@@ -63,7 +64,7 @@ function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
|
|||||||
$_mail->MsgHTML(nl2br($message));
|
$_mail->MsgHTML(nl2br($message));
|
||||||
$_mail->AddAddress(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
$_mail->AddAddress(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
||||||
$_mail->Send();
|
$_mail->Send();
|
||||||
} catch (phpmailerException $e) {
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -79,5 +80,4 @@ function dieWithMail($message, $subject = "[froxlor] Cronjob error") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
die($message);
|
die($message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
use \Froxlor\Database;
|
use \Froxlor\Database;
|
||||||
use \Froxlor\Settings;
|
use \Froxlor\Settings;
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Main version variable
|
// Main version variable
|
||||||
$version = '0.10.0';
|
$version = \Froxlor\Froxlor::VERSION;
|
||||||
|
|
||||||
// Database version (YYYYMMDDC where C is a daily counter)
|
// Database version (YYYYMMDDC where C is a daily counter)
|
||||||
$dbversion = '201812180';
|
$dbversion = \Froxlor\Froxlor::DBVERSION;
|
||||||
|
|
||||||
// Distribution branding-tag (used for Debian etc.)
|
// Distribution branding-tag (used for Debian etc.)
|
||||||
$branding = '';
|
$branding = \Froxlor\Froxlor::BRANDING;
|
||||||
|
|||||||
@@ -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
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
* @package Cron
|
* @package Cron
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
use \Froxlor\Database;
|
||||||
|
use \Froxlor\Settings;
|
||||||
|
|
||||||
if ((int)Settings::Get('system.report_webmax') > 0)
|
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->MsgHTML(nl2br($mail_body));
|
||||||
$mail->AddAddress($row['email'], $row['name']);
|
$mail->AddAddress($row['email'], $row['name']);
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch(phpmailerException $e) {
|
} catch(\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -187,7 +189,7 @@ if ((int)Settings::Get('system.report_webmax') > 0)
|
|||||||
$mail->MsgHTML(nl2br($mail_body));
|
$mail->MsgHTML(nl2br($mail_body));
|
||||||
$mail->AddAddress($row['email'], $row['name']);
|
$mail->AddAddress($row['email'], $row['name']);
|
||||||
$mail->Send();
|
$mail->Send();
|
||||||
} catch(phpmailerException $e) {
|
} catch(\PHPMailer\PHPMailer\Exception $e) {
|
||||||
$mailerr_msg = $e->errorMessage();
|
$mailerr_msg = $e->errorMessage();
|
||||||
$_mailerror = true;
|
$_mailerror = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -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
|
// This file is being included in admin_domains and customer_domains
|
||||||
// and therefore does not need to require lib/init.php
|
// and therefore does not need to require lib/init.php
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user