| 1 |
<?php |
|---|
| 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 |
require_once('../includes/config/settings.php'); |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
function __autoload($class) { |
|---|
| 30 |
global $SETTINGS; |
|---|
| 31 |
if (is_file($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php')) { |
|---|
| 32 |
require_once($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php'); |
|---|
| 33 |
} elseif (is_file($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php')) { |
|---|
| 34 |
require_once($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php'); |
|---|
| 35 |
} else { die('Class ' . $class . ' not found.'); } |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
$WARNINGS = Array(); |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
require_once($SETTINGS['fspath'] . 'includes/config/version.php'); |
|---|
| 43 |
|
|---|
| 44 |
require_once($SETTINGS['fspath'] . 'includes/config/bots.php'); |
|---|
| 45 |
|
|---|
| 46 |
$F = new Format(); |
|---|
| 47 |
require($SETTINGS['fspath'] . 'includes/lang/' . $SETTINGS['language'] . '.php'); |
|---|
| 48 |
|
|---|
| 49 |
$C = new Connection(); |
|---|
| 50 |
Member::session(); |
|---|
| 51 |
if (isset($_SESSION['lang']) && $_SESSION['lang'] != '') { |
|---|
| 52 |
include($SETTINGS['fspath'] . 'includes/lang/' . $_SESSION['lang'] . '.php'); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
require($SETTINGS['fspath'] . 'includes/input.php'); |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
$_pref = '../'; |
|---|
| 59 |
$html = Page::start(); |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
if (Member::checkRights('Preview', 'r')) { |
|---|
| 63 |
|
|---|
| 64 |
// header |
|---|
| 65 |
$html->body->addChild('h2', $LANG['Preview']); |
|---|
| 66 |
$INPUT['user'] = base64_decode(strtr($INPUT['user'], '-_', '+/')); |
|---|
| 67 |
if (isset($INPUT['user']) && $INPUT['user'] != '') { |
|---|
| 68 |
|
|---|
| 69 |
// get user info |
|---|
| 70 |
$q = $C->prepare('SELECT memberid, membername AS poster FROM sb_members WHERE membername=:user'); |
|---|
| 71 |
$q->bindParam(':user', $INPUT['user'], PDO::PARAM_STR); |
|---|
| 72 |
$s = $q->execute(); |
|---|
| 73 |
if ($s && $row = $q->fetchObject()) { |
|---|
| 74 |
|
|---|
| 75 |
$row->postedbymember = $row->memberid; |
|---|
| 76 |
} else { |
|---|
| 77 |
|
|---|
| 78 |
$row->poster = $INPUT['user']; |
|---|
| 79 |
$row->postedbymember = 0; |
|---|
| 80 |
} |
|---|
| 81 |
$q = NULL; |
|---|
| 82 |
} else { |
|---|
| 83 |
|
|---|
| 84 |
$row = new stdClass(); |
|---|
| 85 |
$row->poster = $_SESSION['membername']; |
|---|
| 86 |
$row->postedbymember = 1; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
$row->post = $F->htmlentities(base64_decode(strtr($INPUT['post'], '-_', '+/')), TRUE); |
|---|
| 90 |
$row->postid = 0; |
|---|
| 91 |
|
|---|
| 92 |
$_now = new DateTime('now', new DateTimeZone('UTC')); |
|---|
| 93 |
$row->posttime = $_now->format('Y-m-d H:i:s'); |
|---|
| 94 |
|
|---|
| 95 |
$table = new Table(); |
|---|
| 96 |
$p = new Post(); |
|---|
| 97 |
$p->setPost($row); |
|---|
| 98 |
$p->add($table); |
|---|
| 99 |
$html->body->addElement($table->get()); |
|---|
| 100 |
|
|---|
| 101 |
$div = $html->body->addChild('div'); |
|---|
| 102 |
$div->addAttribute('align', 'center'); |
|---|
| 103 |
$a = $div->addChild('a', $LANG['Close_Window']); |
|---|
| 104 |
$a->addAttribute('href', 'javascript:self.close()'); |
|---|
| 105 |
} else { |
|---|
| 106 |
|
|---|
| 107 |
$div = $html->body->addChild('div', $LANG['error_permission_denied']); |
|---|
| 108 |
$div->addAttribute('class', 'message'); |
|---|
| 109 |
} |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
Page::send($html); |
|---|
| 113 |
|
|---|
| 114 |
?> |
|---|