mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Unset debug cookies if SQL_DEBUG disabled (#1114)
This commit is contained in:
parent
ee306e1418
commit
a13af7914e
2 changed files with 18 additions and 5 deletions
|
@ -61,11 +61,15 @@ if ($show_dbg_info) {
|
|||
$stat .= " | " . $lang['LIMIT'] . " $l[0] $l[1] $l[2]";
|
||||
}
|
||||
|
||||
$stat .= ' ] |';
|
||||
$stat .= !empty($_COOKIE['sql_log']) ? ' [ <a href="#" class="med" onclick="$p(\'sqlLog\').className=\'sqlLog sqlLogWrapped\'; return false;">wrap</a> · <a href="#sqlLog" class="med" onclick="$(\'#sqlLog\').css({ height: $(window).height()-50 }); return false;">max</a> ] |' : '';
|
||||
$stat .= ' <label title="' . $lang['SHOW_LOG'] . '"><input type="checkbox" onclick="setCookie(\'sql_log\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log']) ? HTML_CHECKED : '') . ' />' . $lang['SHOW_LOG'] . '</label> |
|
||||
<label title="' . $lang['CUT_LOG'] . '"><input type="checkbox" onclick="setCookie(\'sql_log_full\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log_full']) ? HTML_CHECKED : '') . ' />' . $lang['CUT_LOG'] . '</label> |
|
||||
<label title="' . $lang['EXPLAINED_LOG'] . '"><input type="checkbox" onclick="setCookie(\'explain\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['explain']) ? HTML_CHECKED : '') . ' />' . $lang['EXPLAINED_LOG'] . '</label>';
|
||||
$stat .= ' ]';
|
||||
|
||||
if (SQL_DEBUG) {
|
||||
$stat .= ' |';
|
||||
$stat .= !empty($_COOKIE['sql_log']) ? ' [ <a href="#" class="med" onclick="$p(\'sqlLog\').className=\'sqlLog sqlLogWrapped\'; return false;">wrap</a> · <a href="#sqlLog" class="med" onclick="$(\'#sqlLog\').css({ height: $(window).height()-50 }); return false;">max</a> ] |' : '';
|
||||
$stat .= ' <label title="' . $lang['SHOW_LOG'] . '"><input type="checkbox" onclick="setCookie(\'sql_log\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log']) ? HTML_CHECKED : '') . ' />' . $lang['SHOW_LOG'] . '</label> |
|
||||
<label title="' . $lang['CUT_LOG'] . '"><input type="checkbox" onclick="setCookie(\'sql_log_full\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log_full']) ? HTML_CHECKED : '') . ' />' . $lang['CUT_LOG'] . '</label> |
|
||||
<label title="' . $lang['EXPLAINED_LOG'] . '"><input type="checkbox" onclick="setCookie(\'explain\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['explain']) ? HTML_CHECKED : '') . ' />' . $lang['EXPLAINED_LOG'] . '</label>';
|
||||
}
|
||||
|
||||
echo '<div style="margin: 6px; font-size:10px; color: #444444; letter-spacing: -1px; text-align: center;">' . $stat . '</div>';
|
||||
}
|
||||
|
|
|
@ -491,6 +491,15 @@ class User
|
|||
if ($c_sdata_curr !== $c_sdata_resv) {
|
||||
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
|
||||
}
|
||||
|
||||
// Unset sql debug cookies
|
||||
if (!SQL_DEBUG || !APP_DEBUG) {
|
||||
foreach (array('explain', 'sql_log', 'sql_log_full') as $cookie) {
|
||||
if (isset($_COOKIE[$cookie])) {
|
||||
bb_setcookie($cookie, '', COOKIE_EXPIRED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue