blob: 0d85b98983e708330f8a4f4f2cb4c6452f9da8eb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
$verboseDebug = true;
class Util
{
public static function traceError($message)
{
global $verboseDebug;
Header('Content-Type: text/plain; charset=utf-8');
echo "--------------------\nFlagrant system error:\n$message\n--------------------\n\n";
if (isset($verboseDebug) && $verboseDebug) {
debug_print_backtrace();
echo "\n\n";
$vars = get_defined_vars();
print_r($vars);
}
exit(0);
}
public static function redirect($location)
{
Session::save();
Header('Location: ' . $location);
exit(0);
}
public static function verifyToken()
{
if (Session::get('token') === false) return true;
if (isset($_REQUEST['token']) && Session::get('token') === $_REQUEST['token']) return true;
Message::addError('token');
return false;
}
function markup($string)
{
$string = htmlspecialchars($string);
$string = preg_replace('#(^|[\n \-_/\.])\*(.+?)\*($|[ \-_/\.\!\?,])#is', '$1<b>$2</b>$3', $string);
$string = preg_replace('#(^|[\n \-\*/\.])_(.+?)_($|[ \-\*/\.\!\?,])#is', '$1<u>$2</u>$3', $string);
$string = preg_replace('#(^|[\n \-_\*\.])/(.+?)/($|[ \-_\*\.\!\?,])#is', '$1<i>$2</i>$3', $string);
return nl2br($string);
}
}
|