auto-format all files; add table-definitions to test-bootstrap file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
@@ -26,16 +25,14 @@ use Froxlor\Settings as Settings;
|
||||
if (isset($_POST['subjectid'])) {
|
||||
$subjectid = intval($_POST['subjectid']);
|
||||
$mailbodyid = intval($_POST['mailbodyid']);
|
||||
|
||||
} elseif(isset($_GET['subjectid'])) {
|
||||
} elseif (isset($_GET['subjectid'])) {
|
||||
$subjectid = intval($_GET['subjectid']);
|
||||
$mailbodyid = intval($_GET['mailbodyid']);
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
|
||||
} elseif(isset($_GET['id'])) {
|
||||
} elseif (isset($_GET['id'])) {
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
@@ -48,11 +45,8 @@ $available_templates = array(
|
||||
);
|
||||
|
||||
// only show templates of features that are enabled #1191
|
||||
if ((int)Settings::Get('system.report_enable') == 1) {
|
||||
array_push($available_templates,
|
||||
'trafficmaxpercent',
|
||||
'diskmaxpercent'
|
||||
);
|
||||
if ((int) Settings::Get('system.report_enable') == 1) {
|
||||
array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent');
|
||||
}
|
||||
|
||||
$file_templates = array(
|
||||
@@ -60,7 +54,7 @@ $file_templates = array(
|
||||
);
|
||||
|
||||
if ($action == '') {
|
||||
//email templates
|
||||
// email templates
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
|
||||
|
||||
if (Settings::Get('panel.sendalternativemail') == 1) {
|
||||
@@ -71,9 +65,10 @@ if ($action == '') {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='mails'
|
||||
ORDER BY `language`, `varname`"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
|
||||
ORDER BY `language`, `varname`");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$parts = array();
|
||||
@@ -98,9 +93,11 @@ if ($action == '') {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language`= :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language_name
|
||||
));
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$templates_done[] = str_replace('_subject', '', $row['varname']);
|
||||
@@ -111,14 +108,15 @@ if ($action == '') {
|
||||
}
|
||||
}
|
||||
|
||||
//filetemplates
|
||||
// filetemplates
|
||||
$filetemplates = '';
|
||||
$filetemplateadd = false;
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
if (Database::num_rows() != count($file_templates)) {
|
||||
$filetemplateadd = true;
|
||||
@@ -128,84 +126,87 @@ if ($action == '') {
|
||||
eval("\$filetemplates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_filetemplate") . "\";");
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
|
||||
|
||||
} elseif($action == 'delete'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0
|
||||
) {
|
||||
//email templates
|
||||
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
|
||||
// email templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $subjectid));
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $subjectid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['varname'] != '') {
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid
|
||||
AND (`id` = :ida OR `id` = :idb)"
|
||||
);
|
||||
AND (`id` = :ida OR `id` = :idb)");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'ida' => $subjectid,
|
||||
'idb' => $mailbodyid
|
||||
));
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
|
||||
ask_yesno('admin_template_reallydelete', $filename, array(
|
||||
'subjectid' => $subjectid,
|
||||
'mailbodyid' => $mailbodyid,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
|
||||
}
|
||||
}
|
||||
|
||||
} elseif($action == 'deletef'
|
||||
&& $id != 0
|
||||
) {
|
||||
//file templates
|
||||
} elseif ($action == 'deletef' && $id != 0) {
|
||||
// file templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
|
||||
$row = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
|
||||
ask_yesno('admin_template_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $lng['admin']['templates'][$row['varname']]);
|
||||
}
|
||||
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
}
|
||||
|
||||
} elseif($action == 'add') {
|
||||
} elseif ($action == 'add') {
|
||||
|
||||
if (Settings::Get('panel.sendalternativemail') == 1) {
|
||||
$available_templates[] = 'pop_success_alternative';
|
||||
}
|
||||
|
||||
if (isset($_POST['prepare'])
|
||||
&& $_POST['prepare'] == 'prepare'
|
||||
) {
|
||||
//email templates
|
||||
if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') {
|
||||
// email templates
|
||||
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = validate($_POST['template'], 'template');
|
||||
|
||||
@@ -224,18 +225,15 @@ if ($action == '') {
|
||||
|
||||
$lng = $lng_bak;
|
||||
|
||||
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php';
|
||||
$template_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_add.php';
|
||||
$template_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_add_data);
|
||||
|
||||
$title = $template_add_data['template_add']['title'];
|
||||
$image = $template_add_data['template_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";");
|
||||
|
||||
} elseif(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
//email templates
|
||||
} elseif (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// email templates
|
||||
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
@@ -244,18 +242,19 @@ if ($action == '') {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language));
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language
|
||||
));
|
||||
|
||||
while($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
$templates = array_diff($available_templates, $templates);
|
||||
if (array_search($template, $templates) === false) {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
|
||||
} else {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
@@ -263,14 +262,13 @@ if ($action == '') {
|
||||
`language` = :lang,
|
||||
`templategroup` = 'mails',
|
||||
`varname` = :var,
|
||||
`value` = :value"
|
||||
);
|
||||
`value` = :value");
|
||||
|
||||
// mail-subject
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language,
|
||||
'var' => $template.'_subject',
|
||||
'var' => $template . '_subject',
|
||||
'value' => $subject
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
@@ -279,19 +277,19 @@ if ($action == '') {
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language,
|
||||
'var' => $template.'_mailbody',
|
||||
'var' => $template . '_mailbody',
|
||||
'value' => $mailbody
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
} elseif(isset($_POST['filesend'])
|
||||
&& $_POST['filesend'] == 'filesend'
|
||||
) {
|
||||
//file templates
|
||||
} elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
|
||||
// file templates
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
|
||||
@@ -301,8 +299,7 @@ if ($action == '') {
|
||||
`language` = '',
|
||||
`templategroup` = 'files',
|
||||
`varname` = :var,
|
||||
`value` = :value"
|
||||
);
|
||||
`value` = :value");
|
||||
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
@@ -312,11 +309,13 @@ if ($action == '') {
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} elseif (! isset($_GET['files'])) {
|
||||
|
||||
} elseif(!isset($_GET['files'])) {
|
||||
|
||||
//email templates
|
||||
// email templates
|
||||
$add = false;
|
||||
$language_options = '';
|
||||
$template_options = '';
|
||||
@@ -326,9 +325,11 @@ if ($action == '') {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language_name
|
||||
));
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
@@ -336,12 +337,12 @@ if ($action == '') {
|
||||
|
||||
if (count(array_diff($available_templates, $templates)) > 0) {
|
||||
$add = true;
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true, true);
|
||||
$language_options .= makeoption($language_name, $language_file, $userinfo['language'], true, true);
|
||||
|
||||
$templates = array_diff($available_templates, $templates);
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
|
||||
$template_options .= makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -351,18 +352,17 @@ if ($action == '') {
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
|
||||
}
|
||||
|
||||
} else {
|
||||
//filetemplates
|
||||
// filetemplates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
if (Database::num_rows() == count($file_templates)) {
|
||||
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
|
||||
|
||||
} else {
|
||||
|
||||
$templatesdefined = array();
|
||||
@@ -373,10 +373,10 @@ if ($action == '') {
|
||||
}
|
||||
|
||||
foreach (array_diff($file_templates, $templatesdefined) as $template) {
|
||||
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
|
||||
$free_templates .= makeoption($lng['admin']['templates'][$template], $template, '', true);
|
||||
}
|
||||
|
||||
$filetemplate_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_add.php';
|
||||
$filetemplate_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_add.php';
|
||||
$filetemplate_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_add_data);
|
||||
|
||||
$title = $filetemplate_add_data['filetemplate_add']['title'];
|
||||
@@ -385,32 +385,27 @@ if ($action == '') {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_add") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
} elseif($action == 'edit'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0
|
||||
) {
|
||||
//email templates
|
||||
} elseif ($action == 'edit' && $subjectid != 0 && $mailbodyid != 0) {
|
||||
// email templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :subjectid"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'subjectid' => $subjectid));
|
||||
WHERE `adminid` = :adminid AND `id` = :subjectid");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'subjectid' => $subjectid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['varname'] != '') {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`value` = :value
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
// subject
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'value' => $subject,
|
||||
@@ -425,8 +420,10 @@ if ($action == '') {
|
||||
));
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
@@ -435,11 +432,12 @@ if ($action == '') {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname`, `value`
|
||||
FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $mailbodyid));
|
||||
WHERE `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'id' => $mailbodyid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
$template_name = str_replace('_mailbody', '', $result['varname']);
|
||||
|
||||
// don't escape the already escaped language-string so save up before htmlentities()
|
||||
@@ -447,7 +445,7 @@ if ($action == '') {
|
||||
$result = htmlentities_array($result);
|
||||
$mailbody = $result['value'];
|
||||
|
||||
$template_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_edit.php';
|
||||
$template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php';
|
||||
$template_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_edit_data);
|
||||
|
||||
$title = $template_edit_data['template_edit']['title'];
|
||||
@@ -456,31 +454,27 @@ if ($action == '') {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
} elseif($action == 'editf'
|
||||
&& $id != 0
|
||||
) {
|
||||
//file templates
|
||||
} elseif ($action == 'editf' && $id != 0) {
|
||||
// file templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if(Database::num_rows() > 0) {
|
||||
if (Database::num_rows() > 0) {
|
||||
|
||||
$row = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
//filetemplates
|
||||
if (isset($_POST['filesend'])
|
||||
&& $_POST['filesend'] == 'filesend'
|
||||
) {
|
||||
// filetemplates
|
||||
if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`value` = :value
|
||||
WHERE `adminid` = :adminid AND `id` = :id"
|
||||
);
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'value' => $filecontent,
|
||||
'adminid' => $userinfo['adminid'],
|
||||
@@ -488,12 +482,14 @@ if ($action == '') {
|
||||
));
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$row = htmlentities_array($row);
|
||||
|
||||
$filetemplate_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
|
||||
$filetemplate_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
|
||||
$filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
|
||||
|
||||
$title = $filetemplate_edit_data['filetemplate_edit']['title'];
|
||||
@@ -501,7 +497,6 @@ if ($action == '') {
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";");
|
||||
}
|
||||
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user