2010-01-27 08:54:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
|
|
|
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the COPYING
|
|
|
|
* file that was distributed with this source code. You can also view the
|
|
|
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
*
|
|
|
|
* @copyright (c) the authors
|
|
|
|
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
|
|
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
|
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
* @package Panel
|
2011-05-04 09:59:20 +00:00
|
|
|
*
|
2010-01-27 08:54:31 +00:00
|
|
|
*/
|
|
|
|
define('AREA', 'customer');
|
2013-11-18 11:53:33 +00:00
|
|
|
require './lib/init.php';
|
2010-01-27 08:54:31 +00:00
|
|
|
|
2018-12-19 15:57:03 +00:00
|
|
|
use Froxlor\Database\Database;
|
|
|
|
use Froxlor\Settings;
|
2018-12-18 12:45:05 +00:00
|
|
|
use Froxlor\Api\Commands\Customers as Customers;
|
|
|
|
|
2013-04-27 07:26:48 +00:00
|
|
|
if ($action == 'logout') {
|
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
|
2010-01-27 08:54:31 +00:00
|
|
|
|
2018-12-21 11:24:07 +00:00
|
|
|
$params = array(
|
|
|
|
"customerid" => $userinfo['customerid']
|
|
|
|
);
|
2013-12-15 11:24:32 +00:00
|
|
|
if (Settings::Get('session.allow_multiple_login') == '1') {
|
2013-10-31 10:51:01 +00:00
|
|
|
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
|
|
|
WHERE `userid` = :customerid
|
|
|
|
AND `adminsession` = '0'
|
2018-12-21 11:24:07 +00:00
|
|
|
AND `hash` = :hash");
|
2013-10-31 10:51:01 +00:00
|
|
|
$params["hash"] = $s;
|
|
|
|
} else {
|
|
|
|
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
|
|
|
WHERE `userid` = :customerid
|
2018-12-21 11:24:07 +00:00
|
|
|
AND `adminsession` = '0'");
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
2013-10-31 10:51:01 +00:00
|
|
|
Database::pexecute($stmt, $params);
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo('index.php');
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
|
|
|
|
2013-04-27 07:26:48 +00:00
|
|
|
if ($page == 'overview') {
|
2010-01-27 08:54:31 +00:00
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2013-10-31 10:51:01 +00:00
|
|
|
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
|
|
|
WHERE `customerid` = :customerid
|
|
|
|
AND `parentdomainid` = '0'
|
2013-11-28 12:07:53 +00:00
|
|
|
AND `id` <> :standardsubdomain
|
|
|
|
");
|
2018-12-21 11:24:07 +00:00
|
|
|
Database::pexecute($domain_stmt, array(
|
|
|
|
"customerid" => $userinfo['customerid'],
|
|
|
|
"standardsubdomain" => $userinfo['standardsubdomain']
|
|
|
|
));
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2010-01-27 08:54:31 +00:00
|
|
|
$domains = '';
|
|
|
|
$domainArray = array();
|
|
|
|
|
2013-10-31 10:51:01 +00:00
|
|
|
while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) {
|
2010-01-27 08:54:31 +00:00
|
|
|
$domainArray[] = $idna_convert->decode($row['domain']);
|
|
|
|
}
|
|
|
|
|
|
|
|
natsort($domainArray);
|
2013-03-10 07:52:56 +00:00
|
|
|
$domains = implode(',<br />', $domainArray);
|
2013-11-28 12:07:53 +00:00
|
|
|
|
|
|
|
// standard-subdomain
|
|
|
|
$stdsubdomain = '';
|
|
|
|
if ($userinfo['standardsubdomain'] != '0') {
|
|
|
|
$std_domain_stmt = Database::prepare("
|
|
|
|
SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
|
|
|
WHERE `customerid` = :customerid
|
|
|
|
AND `id` = :standardsubdomain
|
|
|
|
");
|
2018-12-21 11:24:07 +00:00
|
|
|
$std_domain = Database::pexecute_first($std_domain_stmt, array(
|
|
|
|
"customerid" => $userinfo['customerid'],
|
|
|
|
"standardsubdomain" => $userinfo['standardsubdomain']
|
|
|
|
));
|
2013-11-28 12:07:53 +00:00
|
|
|
$stdsubdomain = $std_domain['domain'];
|
|
|
|
}
|
|
|
|
|
2010-01-27 08:54:31 +00:00
|
|
|
$userinfo['email'] = $idna_convert->decode($userinfo['email']);
|
|
|
|
$yesterday = time() - (60 * 60 * 24);
|
|
|
|
$month = date('M Y', $yesterday);
|
|
|
|
|
2016-09-19 09:42:08 +00:00
|
|
|
// get disk-space usages for web, mysql and mail
|
2018-12-21 11:24:07 +00:00
|
|
|
$usages_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
|
|
|
|
$usages = Database::pexecute_first($usages_stmt, array(
|
|
|
|
'cid' => $userinfo['customerid']
|
|
|
|
));
|
2016-09-19 09:42:08 +00:00
|
|
|
|
2013-12-15 11:24:32 +00:00
|
|
|
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
|
2016-09-19 09:42:08 +00:00
|
|
|
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places'));
|
|
|
|
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places'));
|
|
|
|
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
|
|
|
|
|
2013-12-15 11:24:32 +00:00
|
|
|
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
|
|
|
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
2018-12-19 18:42:50 +00:00
|
|
|
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
2010-01-27 08:54:31 +00:00
|
|
|
|
2015-01-15 21:19:28 +00:00
|
|
|
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
|
|
|
|
2013-10-27 17:42:40 +00:00
|
|
|
$services_enabled = "";
|
|
|
|
$se = array();
|
2018-12-21 11:24:07 +00:00
|
|
|
if ($userinfo['imap'] == '1')
|
|
|
|
$se[] = "IMAP";
|
|
|
|
if ($userinfo['pop3'] == '1')
|
|
|
|
$se[] = "POP3";
|
|
|
|
if ($userinfo['phpenabled'] == '1')
|
|
|
|
$se[] = "PHP";
|
|
|
|
if ($userinfo['perlenabled'] == '1')
|
|
|
|
$se[] = "Perl/CGI";
|
2013-10-27 17:42:40 +00:00
|
|
|
$services_enabled = implode(", ", $se);
|
|
|
|
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
|
2013-04-27 07:26:48 +00:00
|
|
|
} elseif ($page == 'change_password') {
|
|
|
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
2010-01-27 08:54:31 +00:00
|
|
|
$old_password = validate($_POST['old_password'], 'old password');
|
2018-12-21 11:24:07 +00:00
|
|
|
if (! validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
|
|
|
|
2011-11-12 08:55:26 +00:00
|
|
|
$new_password = validatePassword($_POST['new_password'], 'new password');
|
|
|
|
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
2010-01-27 08:54:31 +00:00
|
|
|
|
2013-04-27 07:26:48 +00:00
|
|
|
if ($old_password == '') {
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::standard_error(array(
|
|
|
|
'stringisempty',
|
|
|
|
'oldpassword'
|
|
|
|
));
|
2013-12-15 11:24:32 +00:00
|
|
|
} elseif ($new_password == '') {
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::standard_error(array(
|
|
|
|
'stringisempty',
|
|
|
|
'newpassword'
|
|
|
|
));
|
2013-12-15 11:24:32 +00:00
|
|
|
} elseif ($new_password_confirm == '') {
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::standard_error(array(
|
|
|
|
'stringisempty',
|
|
|
|
'newpasswordconfirm'
|
|
|
|
));
|
2013-12-15 11:24:32 +00:00
|
|
|
} elseif ($new_password != $new_password_confirm) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
|
2013-04-27 07:26:48 +00:00
|
|
|
} else {
|
2013-10-31 10:51:01 +00:00
|
|
|
// Update user password
|
2018-02-23 11:48:17 +00:00
|
|
|
try {
|
2018-12-21 11:24:07 +00:00
|
|
|
Customers::getLocal($userinfo, array(
|
|
|
|
'id' => $userinfo['customerid'],
|
|
|
|
'new_customer_password' => $new_password
|
|
|
|
))->update();
|
2018-02-23 11:48:17 +00:00
|
|
|
} catch (Exception $e) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
2018-02-23 11:48:17 +00:00
|
|
|
}
|
2010-01-27 08:54:31 +00:00
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
|
|
|
|
|
2013-10-31 10:51:01 +00:00
|
|
|
// Update ftp password
|
|
|
|
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') {
|
2018-12-20 07:33:32 +00:00
|
|
|
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($new_password);
|
2013-10-31 10:51:01 +00:00
|
|
|
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
|
|
|
|
SET `password` = :password
|
|
|
|
WHERE `customerid` = :customerid
|
2018-12-21 11:24:07 +00:00
|
|
|
AND `username` = :username");
|
2013-10-31 10:51:01 +00:00
|
|
|
$params = array(
|
|
|
|
"password" => $cryptPassword,
|
|
|
|
"customerid" => $userinfo['customerid'],
|
|
|
|
"username" => $userinfo['loginname']
|
|
|
|
);
|
|
|
|
Database::pexecute($stmt, $params);
|
2010-01-27 08:54:31 +00:00
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
|
|
|
|
}
|
|
|
|
|
2013-10-31 10:51:01 +00:00
|
|
|
// Update webalizer password
|
|
|
|
if (isset($_POST['change_webalizer']) && $_POST['change_webalizer'] == 'true') {
|
2013-04-27 07:26:48 +00:00
|
|
|
if (CRYPT_STD_DES == 1) {
|
2010-01-27 08:54:31 +00:00
|
|
|
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
|
|
|
$new_webalizer_password = crypt($new_password, $saltfordescrypt);
|
2013-04-27 07:26:48 +00:00
|
|
|
} else {
|
2010-01-27 08:54:31 +00:00
|
|
|
$new_webalizer_password = crypt($new_password);
|
|
|
|
}
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2013-10-31 10:51:01 +00:00
|
|
|
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
|
|
|
|
SET `password` = :password
|
|
|
|
WHERE `customerid` = :customerid
|
2018-12-21 11:24:07 +00:00
|
|
|
AND `username` = :username");
|
2013-10-31 10:51:01 +00:00
|
|
|
$params = array(
|
|
|
|
"password" => $new_webalizer_password,
|
|
|
|
"customerid" => $userinfo['customerid'],
|
|
|
|
"username" => $userinfo['loginname']
|
|
|
|
);
|
|
|
|
Database::pexecute($stmt, $params);
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
2013-04-27 07:26:48 +00:00
|
|
|
} else {
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";");
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
2013-04-27 07:26:48 +00:00
|
|
|
} elseif ($page == 'change_language') {
|
|
|
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
2010-01-27 08:54:31 +00:00
|
|
|
$def_language = validate($_POST['def_language'], 'default language');
|
2013-04-27 07:26:48 +00:00
|
|
|
if (isset($languages[$def_language])) {
|
2018-02-23 11:48:17 +00:00
|
|
|
try {
|
2018-12-21 11:24:07 +00:00
|
|
|
Customers::getLocal($userinfo, array(
|
|
|
|
'id' => $userinfo['customerid'],
|
|
|
|
'def_language' => $def_language
|
|
|
|
))->update();
|
2018-02-23 11:48:17 +00:00
|
|
|
} catch (Exception $e) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
2018-02-23 11:48:17 +00:00
|
|
|
}
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2018-02-23 11:48:17 +00:00
|
|
|
// also update current session
|
2013-10-31 10:51:01 +00:00
|
|
|
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
|
|
|
SET `language` = :lang
|
2018-12-21 11:24:07 +00:00
|
|
|
WHERE `hash` = :hash");
|
|
|
|
Database::pexecute($stmt, array(
|
|
|
|
"lang" => $def_language,
|
|
|
|
"hash" => $s
|
|
|
|
));
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
2018-02-23 11:48:17 +00:00
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2013-04-27 07:26:48 +00:00
|
|
|
} else {
|
2013-12-15 11:24:32 +00:00
|
|
|
$default_lang = Settings::Get('panel.standardlanguage');
|
2013-12-04 17:32:46 +00:00
|
|
|
if ($userinfo['def_language'] != '') {
|
2010-08-05 06:32:40 +00:00
|
|
|
$default_lang = $userinfo['def_language'];
|
|
|
|
}
|
|
|
|
|
2013-04-27 07:26:48 +00:00
|
|
|
$language_options = '';
|
2017-10-31 12:03:06 +00:00
|
|
|
foreach ($languages as $language_file => $language_name) {
|
2013-04-27 07:26:48 +00:00
|
|
|
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
|
2010-01-27 08:54:31 +00:00
|
|
|
}
|
2013-04-27 07:26:48 +00:00
|
|
|
} elseif ($page == 'change_theme') {
|
|
|
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
2011-02-08 11:53:24 +00:00
|
|
|
$theme = validate($_POST['theme'], 'theme');
|
2018-02-23 11:48:17 +00:00
|
|
|
try {
|
2018-12-21 11:24:07 +00:00
|
|
|
Customers::getLocal($userinfo, array(
|
|
|
|
'id' => $userinfo['customerid'],
|
|
|
|
'theme' => $theme
|
|
|
|
))->update();
|
2018-02-23 11:48:17 +00:00
|
|
|
} catch (Exception $e) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
2018-02-23 11:48:17 +00:00
|
|
|
}
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2018-02-23 11:48:17 +00:00
|
|
|
// also update current session
|
2013-10-31 10:51:01 +00:00
|
|
|
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
|
|
|
SET `theme` = :theme
|
2018-12-21 11:24:07 +00:00
|
|
|
WHERE `hash` = :hash");
|
|
|
|
Database::pexecute($stmt, array(
|
|
|
|
"theme" => $theme,
|
|
|
|
"hash" => $s
|
|
|
|
));
|
2013-12-04 17:32:46 +00:00
|
|
|
|
2011-02-08 11:53:24 +00:00
|
|
|
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2013-04-27 07:26:48 +00:00
|
|
|
} else {
|
2013-12-15 11:24:32 +00:00
|
|
|
$default_theme = Settings::Get('panel.default_theme');
|
2013-04-27 07:26:48 +00:00
|
|
|
if ($userinfo['theme'] != '') {
|
2011-02-08 11:53:24 +00:00
|
|
|
$default_theme = $userinfo['theme'];
|
|
|
|
}
|
|
|
|
|
2013-04-27 07:26:48 +00:00
|
|
|
$theme_options = '';
|
2011-02-08 11:53:24 +00:00
|
|
|
$themes_avail = getThemes();
|
2013-12-29 16:35:03 +00:00
|
|
|
foreach ($themes_avail as $t => $d) {
|
2018-12-21 11:24:07 +00:00
|
|
|
$theme_options .= makeoption($d, $t, $default_theme, true);
|
2011-02-08 11:53:24 +00:00
|
|
|
}
|
|
|
|
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";");
|
2011-02-08 11:53:24 +00:00
|
|
|
}
|
2013-12-15 11:24:32 +00:00
|
|
|
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
|
2013-12-02 19:26:39 +00:00
|
|
|
|
|
|
|
// only show this if we really have an exception to report
|
2013-12-15 11:24:32 +00:00
|
|
|
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
|
2013-12-02 19:26:39 +00:00
|
|
|
|
|
|
|
$errid = $_GET['errorid'];
|
|
|
|
// read error file
|
2018-12-21 11:24:07 +00:00
|
|
|
$err_dir = \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR . "/logs/");
|
|
|
|
$err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
|
2013-12-02 19:26:39 +00:00
|
|
|
|
|
|
|
if (file_exists($err_file)) {
|
|
|
|
|
|
|
|
$error_content = file_get_contents($err_file);
|
|
|
|
$error = explode("|", $error_content);
|
|
|
|
|
|
|
|
$_error = array(
|
|
|
|
'code' => str_replace("\n", "", substr($error[1], 5)),
|
|
|
|
'message' => str_replace("\n", "", substr($error[2], 4)),
|
|
|
|
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))),
|
|
|
|
'line' => str_replace("\n", "", substr($error[4], 5)),
|
|
|
|
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
|
|
|
|
);
|
|
|
|
|
|
|
|
// build mail-content
|
|
|
|
$mail_body = "Dear froxlor-team,\n\n";
|
|
|
|
$mail_body .= "the following error has been reported by a user:\n\n";
|
|
|
|
$mail_body .= "-------------------------------------------------------------\n";
|
2018-12-21 11:24:07 +00:00
|
|
|
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
|
|
|
|
$mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
|
|
|
|
$mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
|
2013-12-02 19:26:39 +00:00
|
|
|
$mail_body .= "-------------------------------------------------------------\n\n";
|
2018-12-21 11:24:07 +00:00
|
|
|
$mail_body .= "Froxlor-version: " . $version . "\n";
|
|
|
|
$mail_body .= "DB-version: " . $dbversion . "\n\n";
|
2013-12-02 19:26:39 +00:00
|
|
|
$mail_body .= "End of report";
|
|
|
|
$mail_html = str_replace("\n", "<br />", $mail_body);
|
|
|
|
|
|
|
|
// send actual report to dev-team
|
2018-12-21 11:24:07 +00:00
|
|
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
2013-12-02 19:26:39 +00:00
|
|
|
// send mail and say thanks
|
|
|
|
$_mailerror = false;
|
|
|
|
try {
|
|
|
|
$mail->Subject = '[Froxlor] Error report by user';
|
|
|
|
$mail->AltBody = $mail_body;
|
|
|
|
$mail->MsgHTML($mail_html);
|
|
|
|
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
|
|
|
$mail->Send();
|
2018-12-21 11:24:07 +00:00
|
|
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
2013-12-02 19:26:39 +00:00
|
|
|
$mailerr_msg = $e->errorMessage();
|
|
|
|
$_mailerror = true;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$mailerr_msg = $e->getMessage();
|
|
|
|
$_mailerror = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_mailerror) {
|
|
|
|
// error when reporting an error...LOLFUQ
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
|
2013-12-02 19:26:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// finally remove error from fs
|
|
|
|
@unlink($err_file);
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2013-12-02 19:26:39 +00:00
|
|
|
}
|
|
|
|
// show a nice summary of the error-report
|
|
|
|
// before actually sending anything
|
2018-12-21 10:22:03 +00:00
|
|
|
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
|
2013-12-02 19:26:39 +00:00
|
|
|
} else {
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2013-12-02 19:26:39 +00:00
|
|
|
}
|
|
|
|
} else {
|
2018-12-21 11:24:07 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
|
|
|
's' => $s
|
|
|
|
));
|
2013-12-02 19:26:39 +00:00
|
|
|
}
|
2018-12-21 11:24:07 +00:00
|
|
|
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
|
2018-03-04 11:40:47 +00:00
|
|
|
require_once __DIR__ . '/api_keys.php';
|
2018-12-21 11:24:07 +00:00
|
|
|
} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
|
2018-02-22 12:41:28 +00:00
|
|
|
require_once __DIR__ . '/apihelp.php';
|
|
|
|
}
|