public function __construct()
{
if (empty(self::$locale)) {
$locale = fusion_get_locale('', LOCALE . LOCALESET . "admin/errors.php");
$locale += fusion_get_locale('', LOCALE . LOCALESET . "errors.php");
self::$locale += $locale;
}
$this->error_status = filter_input(INPUT_POST, 'error_status', FILTER_VALIDATE_INT, array('min_range' => 0, 'max_range' => 2));
$this->posted_error_id = filter_input(INPUT_POST, 'error_id', FILTER_VALIDATE_INT);
$this->delete_status = filter_input(INPUT_POST, 'delete_status', FILTER_VALIDATE_INT, array('min_range' => 0, 'max_range' => 2));
$this->rowstart = filter_input(INPUT_GET, 'rowstart', FILTER_VALIDATE_INT) ?: 0;
$this->error_id = filter_input(INPUT_GET, 'error_id', FILTER_VALIDATE_INT);
if (isnum($this->error_status) && $this->posted_error_id) {
dbquery("UPDATE " . DB_ERRORS . " SET error_status='" . $this->error_status . "' WHERE error_id='" . $this->posted_error_id . "'");
redirect(FUSION_REQUEST);
}
if (isset($_POST['delete_entries']) && isnum($this->delete_status)) {
dbquery("DELETE FROM " . DB_ERRORS . " WHERE error_status='" . $_POST['delete_status'] . "'");
$source_redirection_path = preg_replace("~" . fusion_get_settings("site_path") . "~", "", FUSION_REQUEST, 1);
redirect(fusion_get_settings("siteurl") . $source_redirection_path);
}
$result = dbquery("SELECT * FROM " . DB_ERRORS . " ORDER BY error_timestamp DESC LIMIT " . $this->rowstart . ",20");
while ($data = dbarray($result)) {
$this->errors[$data['error_id']] = $data;
}
$this->rows = $this->errors ? dbcount('(error_id)', DB_ERRORS) : 0;
}