mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-24 10:30:05 +02:00
Add feedback phpInfo
This commit is contained in:
parent
3dee6888d6
commit
22a2b7cd0b
@ -68,24 +68,6 @@ class Diagnostics extends Wizard
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
// TODO:XXX
|
||||
/*
|
||||
// Check Acl.
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access diagnostic info'
|
||||
);
|
||||
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => 'noaccess']);
|
||||
}
|
||||
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
$this->ajaxController = $page;
|
||||
$this->pdf = $pdf;
|
||||
}
|
||||
@ -1637,14 +1619,25 @@ class Diagnostics extends Wizard
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
$return = '<div id="'.$id.'" class="element-self-monitoring">';
|
||||
$return .= $this->getChart(
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'pdf-report';
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bolder;';
|
||||
$table->autosize = 1;
|
||||
|
||||
$table->head = [];
|
||||
$table->head[0] = $params['nameModule'];
|
||||
|
||||
$table->data = [];
|
||||
$table->data[0] = $this->getChart(
|
||||
$params['idAgent'],
|
||||
$params['nameModule'],
|
||||
true,
|
||||
false
|
||||
);
|
||||
$return .= '</div>';
|
||||
|
||||
$return = html_print_table($table, true);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$return = $e->getMessage();
|
||||
@ -1796,6 +1789,72 @@ class Diagnostics extends Wizard
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print Diagnostics Form feedback.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function formFeedback(): void
|
||||
{
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'modal_form_feedback',
|
||||
'onsubmit' => 'return false;',
|
||||
'class' => 'modal',
|
||||
];
|
||||
|
||||
$inputs = [];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('What happened').'?',
|
||||
'id' => 'div-what-happened',
|
||||
'class' => 'flex-row',
|
||||
'arguments' => [
|
||||
'name' => 'what-happened',
|
||||
'type' => 'textarea',
|
||||
'value' => '',
|
||||
'return' => true,
|
||||
'rows' => 1,
|
||||
'columns' => 1,
|
||||
'size' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Your email'),
|
||||
'class' => 'flex-row-baseline',
|
||||
'arguments' => [
|
||||
'name' => 'email',
|
||||
'id' => 'email',
|
||||
'type' => 'email',
|
||||
'size' => 40,
|
||||
'required' => 'required',
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Include installation data'),
|
||||
'class' => 'flex-row-vcenter',
|
||||
'arguments' => [
|
||||
'name' => 'include_installation_data',
|
||||
'id' => 'include_installation_data',
|
||||
'type' => 'switch',
|
||||
'value' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
exit(
|
||||
$this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create cron task form feedback.
|
||||
*
|
||||
@ -1812,17 +1871,21 @@ class Diagnostics extends Wizard
|
||||
$text = get_parameter('what-happened', '');
|
||||
$attachment = get_parameter_switch('include_installation_data', 0);
|
||||
$email_from = get_parameter_switch('email', '');
|
||||
$title = __('Hello Feedback-Men');
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
$product_name = io_safe_output(get_product_name());
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') !== 1) {
|
||||
// TODO: MAIL TO ADMIN.
|
||||
$email = get_mail_admin();
|
||||
$email = 'daniel.barbero@artica.es';
|
||||
$product_name = io_safe_output(get_product_name());
|
||||
$name_admin = get_name_admin();
|
||||
|
||||
$subject = __('Feedback').' '.$product_name.' '.$config['pandora_uid'];
|
||||
|
||||
$title = __('Hello').' '.$name_admin;
|
||||
}
|
||||
|
||||
$p1 = __(
|
||||
'User %s is reporting an issue in its %s experience',
|
||||
$email_from,
|
||||
@ -1897,7 +1960,6 @@ class Diagnostics extends Wizard
|
||||
);
|
||||
|
||||
$text = preg_replace($patterns, $substitutions, $html_template);
|
||||
}
|
||||
|
||||
$idUserTask = db_get_value(
|
||||
'id',
|
||||
@ -1942,8 +2004,8 @@ class Diagnostics extends Wizard
|
||||
__('Success'),
|
||||
],
|
||||
'text' => [
|
||||
ui_print_error_message(__('Mal'), '', true),
|
||||
ui_print_success_message(__('bien'), '', true),
|
||||
ui_print_error_message(__('Invalid cron task'), '', true),
|
||||
ui_print_success_message(__('Cron task generated'), '', true),
|
||||
],
|
||||
];
|
||||
|
||||
@ -2002,72 +2064,6 @@ class Diagnostics extends Wizard
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print Diagnostics Form feedback.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function formFeedback(): void
|
||||
{
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'modal_form_feedback',
|
||||
'onsubmit' => 'return false;',
|
||||
'class' => 'modal',
|
||||
];
|
||||
|
||||
$inputs = [];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('What happened').'?',
|
||||
'id' => 'div-what-happened',
|
||||
'class' => 'flex-row',
|
||||
'arguments' => [
|
||||
'name' => 'what-happened',
|
||||
'type' => 'textarea',
|
||||
'value' => '',
|
||||
'return' => true,
|
||||
'rows' => 1,
|
||||
'columns' => 1,
|
||||
'size' => 25,
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Your email'),
|
||||
'class' => 'flex-row-baseline',
|
||||
'arguments' => [
|
||||
'name' => 'email',
|
||||
'id' => 'email',
|
||||
'type' => 'email',
|
||||
'size' => 40,
|
||||
'required' => 'required',
|
||||
],
|
||||
];
|
||||
|
||||
$inputs[] = [
|
||||
'label' => __('Include installation data'),
|
||||
'class' => 'flex-row-vcenter',
|
||||
'arguments' => [
|
||||
'name' => 'include_installation_data',
|
||||
'id' => 'include_installation_data',
|
||||
'type' => 'switch',
|
||||
'value' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
exit(
|
||||
$this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send Csv md5 files.
|
||||
*
|
||||
@ -2131,4 +2127,51 @@ class Diagnostics extends Wizard
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send PHP info in report.
|
||||
*
|
||||
* @param string $filename Download dir report.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function phpInfoReports(string $filename)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$this->pdf = true;
|
||||
|
||||
// Extract info PHP.
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$php_info = ob_get_clean();
|
||||
|
||||
enterprise_include_once('/include/class/Pdf.class.php');
|
||||
$mpdf = new Pdf([]);
|
||||
|
||||
// ADD Metadata.
|
||||
$product_name = io_safe_output(get_product_name());
|
||||
$mpdf->setMetadata(
|
||||
__('PHP Info'),
|
||||
$product_name.' Enteprise',
|
||||
$product_name,
|
||||
__(
|
||||
'Automated %s report for user defined report',
|
||||
$product_name
|
||||
)
|
||||
);
|
||||
|
||||
// ADD Header.
|
||||
$mpdf->setHeaderHTML(__('PHP Info'));
|
||||
|
||||
// ADD content to report.
|
||||
$mpdf->addHTML($php_info);
|
||||
|
||||
// ADD Footer.
|
||||
$mpdf->setFooterHTML();
|
||||
|
||||
// Write html filename.
|
||||
$mpdf->writePDFfile($filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
58
pandora_console/include/templates/feedback_send_mail.html
Normal file
58
pandora_console/include/templates/feedback_send_mail.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||
<title>Feedback</title>
|
||||
<style>
|
||||
* {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
h3 {
|
||||
padding: 30px;
|
||||
background-color: #81b92e;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
p,
|
||||
h5 {
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h5 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
p.msg-user {
|
||||
padding: 20px;
|
||||
white-space: pre;
|
||||
background-color: #e2e2e2;
|
||||
border: 3px dashed grey;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
p.legal {
|
||||
font-size: 10px;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>__title__</h3>
|
||||
<br />
|
||||
<p>__p1__</p>
|
||||
<p class="msg-user">__p2__</p>
|
||||
<p>__attachment__</p>
|
||||
<p>__p3__</p>
|
||||
<br />
|
||||
<h5>__legal__</h5>
|
||||
<p class="legal">__legal1__</p>
|
||||
<p class="legal">__legal2__</p>
|
||||
<p class="legal">__legal3__</p>
|
||||
<p class="legal">__legal4__</p>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user