Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
f2e68b90
Commit
f2e68b90
authored
Dec 10, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) refactor crash_reporter.php
parent
7a39df6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
45 deletions
+44
-45
crash_reporter.php
src/www/crash_reporter.php
+44
-45
No files found.
src/www/crash_reporter.php
View file @
f2e68b90
...
@@ -32,8 +32,6 @@ require_once("guiconfig.inc");
...
@@ -32,8 +32,6 @@ require_once("guiconfig.inc");
function
upload_crash_report
(
$files
,
$agent
)
function
upload_crash_report
(
$files
,
$agent
)
{
{
global
$g
;
$post
=
array
();
$post
=
array
();
$counter
=
0
;
$counter
=
0
;
...
@@ -113,7 +111,7 @@ if (isset($_POST['Submit'])) {
...
@@ -113,7 +111,7 @@ if (isset($_POST['Submit'])) {
upload_crash_report
(
$files_to_upload
,
$user_agent
);
upload_crash_report
(
$files_to_upload
,
$user_agent
);
foreach
(
$files_to_upload
as
$file_to_upload
)
{
foreach
(
$files_to_upload
as
$file_to_upload
)
{
@
unlink
(
$file_to_upload
);
@
unlink
(
$file_to_upload
);
}
}
}
elseif
(
$_POST
[
'Submit'
]
==
'no'
)
{
}
elseif
(
$_POST
[
'Submit'
]
==
'no'
)
{
$files_to_upload
=
glob
(
'/var/crash/*'
);
$files_to_upload
=
glob
(
'/var/crash/*'
);
foreach
(
$files_to_upload
as
$file_to_upload
)
{
foreach
(
$files_to_upload
as
$file_to_upload
)
{
...
@@ -121,8 +119,8 @@ if (isset($_POST['Submit'])) {
...
@@ -121,8 +119,8 @@ if (isset($_POST['Submit'])) {
}
}
@
unlink
(
'/tmp/PHP_errors.log'
);
@
unlink
(
'/tmp/PHP_errors.log'
);
}
elseif
(
$_POST
[
'Submit'
]
==
'new'
)
{
}
elseif
(
$_POST
[
'Submit'
]
==
'new'
)
{
/* force a crash report generation */
/* force a crash report generation */
$has_crashed
=
true
;
$has_crashed
=
true
;
}
}
}
else
{
}
else
{
/* if there is no user activity probe for a crash report */
/* if there is no user activity probe for a crash report */
...
@@ -149,6 +147,14 @@ if ($has_crashed) {
...
@@ -149,6 +147,14 @@ if ($has_crashed) {
}
}
}
}
$message
=
gettext
(
'Luckily we have not detected a programming bug.'
);
if
(
isset
(
$_POST
[
'Submit'
]))
{
if
(
$_POST
[
'Submit'
]
==
'yes'
)
{
$message
=
gettext
(
'Thank you for submitting this crash report.'
);
}
elseif
(
$_POST
[
'Submit'
]
==
'no'
)
{
$message
=
gettext
(
'Please consider submitting a crash report if the error persists.'
);
}
}
?>
?>
<body>
<body>
...
@@ -156,50 +162,43 @@ if ($has_crashed) {
...
@@ -156,50 +162,43 @@ if ($has_crashed) {
<?php
include
(
"fbegin.inc"
);
?>
<?php
include
(
"fbegin.inc"
);
?>
<section
class=
"page-content-main"
>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"row"
>
<section
class=
"col-xs-12"
>
<section
class=
"col-xs-12"
>
<div
class=
"content-box"
>
<div
class=
"content-box"
>
<form
action=
"/crash_reporter.php"
method=
"post"
>
<form
action=
"/crash_reporter.php"
method=
"post"
>
<div
class=
"col-xs-12"
>
<div
class=
"col-xs-12"
>
<?php
<?php
if
(
$has_crashed
)
:?>
<
br
/><
button
name
=
"Submit"
type
=
"submit"
class
="
btn
btn
-
default
pull
-
right
" value="
no
"><?=gettext('Dismiss this report');?></button>
<button name="
Submit
" type="
submit
" class="
btn
btn
-
primary
pull
-
right
" style="
margin
-
right
:
8
px
;
" value="
yes
"><?=gettext('Submit this report');?></button>
<p><strong><?=gettext("
Unfortunately
we
have
detected
at
least
one
programming
bug
.
");?></strong></p>
<p><?=gettext("
Would
you
like
to
submit
this
crash
report
to
the
developers
?
");?></p>
<hr><p><?=gettext('You can help us further by adding your contact information and a problem description. ' .
'Please note that providing your contact information greatly improves the chances of bugs being fixed.');?></p>
<p><input type="
text
" placeholder="
<?=
gettext
(
'your@email.com'
);
?>
" name="Email" value="
<?=
$email
;
?>
">
</p>
<p><textarea
rows=
"5"
placeholder=
"
<?=
gettext
(
'A short problem description or steps to reproduce.'
);
?>
"
name=
"Desc"
></textarea></p>
<hr><p>
<?=
gettext
(
"Please double-check the following contents to ensure you are comfortable submitting the following information."
);
?>
</p>
<?php
foreach
(
$crash_reports
as
$report
=>
$content
)
:?>
<
p
>
<?=
$report
;
?>
:
<br/>
<pre>
<?=
$content
;
?>
</pre>
</p>
<?php
endforeach
;
else
:?>
if
(
$has_crashed
)
{
<
br
/><
button
name
=
"Submit"
type
=
"submit"
class
="
btn
btn
-
primary
pull
-
right
" value="
new
"><?=gettext('Report an issue');?></button>
echo
"<br/><button name=
\"
Submit
\"
type=
\"
submit
\"
class=
\"
btn btn-default pull-right
\"
value=
\"
no
\"
>"
.
gettext
(
'Dismiss this report'
)
.
"</button>"
;
<p><strong><?=
$message
;?></strong></p><br/>
echo
"<button name=
\"
Submit
\"
type=
\"
submit
\"
class=
\"
btn btn-primary pull-right
\"
style=
\"
margin-right: 8px;
\"
value=
\"
yes
\"
>"
.
gettext
(
'Submit this report'
)
.
"</button>"
;
<?php
echo
"<p><strong>"
.
gettext
(
"Unfortunately we have detected at least one programming bug."
)
.
"</strong></p>"
;
endif;?>
echo
"<p>"
.
gettext
(
"Would you like to submit this crash report to the developers?"
)
.
"</p>"
;
</div>
echo
'<hr><p>'
.
gettext
(
'You can help us further by adding your contact information and a problem description. '
.
</form>
'Please note that providing your contact information greatly improves the chances of bugs being fixed.'
)
.
'</p>'
;
echo
sprintf
(
'<p><input type="text" placeholder="%s" name="Email" value="%s"></p>'
,
gettext
(
'your@email.com'
),
$email
);
echo
sprintf
(
'<p><textarea rows="5" placeholder="%s" name="Desc"></textarea></p>'
,
gettext
(
'A short problem description or steps to reproduce.'
));
echo
"<hr><p>"
.
gettext
(
"Please double-check the following contents to ensure you are comfortable submitting the following information."
)
.
"</p>"
;
foreach
(
$crash_reports
as
$report
=>
$content
)
{
echo
"<p>
{
$report
}
:<br/><pre>
{
$content
}
</pre></p>"
;
}
}
else
{
$message
=
gettext
(
'Luckily we have not detected a programming bug.'
);
if
(
isset
(
$_POST
[
'Submit'
]))
{
if
(
$_POST
[
'Submit'
]
==
'yes'
)
{
$message
=
gettext
(
'Thank you for submitting this crash report.'
);
}
elseif
(
$_POST
[
'Submit'
]
==
'no'
)
{
$message
=
gettext
(
'Please consider submitting a crash report if the error persists.'
);
}
}
echo
'<br/><button name="Submit" type="submit" class="btn btn-primary pull-right" value="new">'
.
gettext
(
'Report an issue'
)
.
'</button>'
;
echo
'<p><strong>'
.
$message
.
'</strong></p><br/>'
;
}
?>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
</div>
</div>
</div>
</section>
</section>
<?php include("
foot
.
inc
");
<?php include("
foot
.
inc
");
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment