Browse Source

Fix pending posts display in management panel

Resolves #219.
sqlitefix
Trevor Slocum 1 year ago
parent
commit
586c0ae939
  1. 2
      inc/database/flatfile.php
  2. 2
      inc/database/mysql.php
  3. 2
      inc/database/mysqli.php
  4. 2
      inc/database/pdo.php
  5. 2
      inc/database/sqlite.php
  6. 2
      inc/database/sqlite3.php
  7. 16
      inc/html.php

2
inc/database/flatfile.php

@ -398,7 +398,7 @@ function postsByHex($hex) {
}
function latestPosts($moderated = true) {
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, NULL, 10, new OrderBy(POST_TIMESTAMP, DESCENDING, INTEGER_COMPARISON));
$rows = $GLOBALS['db']->selectWhere(POSTS_FILE, new SimpleWhereClause(POST_MODERATED, $moderated ? '>' : '=', 0, INTEGER_COMPARISON), 10, new OrderBy(POST_TIMESTAMP, DESCENDING, INTEGER_COMPARISON));
return convertPostsToSQLStyle($rows);
}

2
inc/database/mysql.php

@ -243,7 +243,7 @@ function postsByHex($hex) {
function latestPosts($moderated = true) {
$posts = array();
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `moderated` = " . ($moderated ? '1' : '0') . " ORDER BY `timestamp` DESC LIMIT 10");
$result = mysql_query("SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `moderated` " . ($moderated ? '>' : '=') . " 0 ORDER BY `timestamp` DESC LIMIT 10");
if ($result) {
while ($post = mysql_fetch_assoc($result)) {
$posts[] = $post;

2
inc/database/mysqli.php

@ -279,7 +279,7 @@ function postsByHex($hex) {
function latestPosts($moderated = true) {
global $link;
$posts = array();
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `moderated` = " . ($moderated ? '1' : '0') . " ORDER BY `timestamp` DESC LIMIT 10");
$result = mysqli_query($link, "SELECT * FROM `" . TINYIB_DBPOSTS . "` WHERE `moderated` " . ($moderated ? '>' : '=') . " 0 ORDER BY `timestamp` DESC LIMIT 10");
if ($result) {
while ($post = mysqli_fetch_assoc($result)) {
$posts[] = $post;

2
inc/database/pdo.php

@ -226,7 +226,7 @@ function postsByHex($hex) {
function latestPosts($moderated = true) {
$posts = array();
$results = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE moderated = ? ORDER BY timestamp DESC LIMIT 10", array($moderated ? '1' : '0'));
$results = pdoQuery("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE moderated " . ($moderated ? '>' : '=') . " 0 ORDER BY timestamp DESC LIMIT 10");
while ($row = $results->fetch(PDO::FETCH_ASSOC)) {
$posts[] = $row;
}

2
inc/database/sqlite.php

@ -215,7 +215,7 @@ function postsByHex($hex) {
function latestPosts($moderated = true) {
$posts = array();
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBPOSTS . " ORDER BY timestamp DESC LIMIT 10"), SQLITE_ASSOC);
$result = sqlite_fetch_all(sqlite_query($GLOBALS["db"], "SELECT * FROM " . TINYIB_DBPOSTS . " WHERE `moderated` " . ($moderated ? '>' : '=') . " 0 ORDER BY timestamp DESC LIMIT 10"), SQLITE_ASSOC);
foreach ($result as $post) {
$posts[] = $post;
}

2
inc/database/sqlite3.php

@ -249,7 +249,7 @@ function postsByHex($hex) {
function latestPosts($moderated = true) {
global $db;
$posts = array();
$result = $db->query("SELECT * FROM " . TINYIB_DBPOSTS . " ORDER BY timestamp DESC LIMIT 10");
$result = $db->query("SELECT * FROM " . TINYIB_DBPOSTS . " WHERE `moderated` " . ($moderated ? '>' : '=') . " 0 ORDER BY timestamp DESC LIMIT 10");
while ($post = $result->fetchArray()) {
$posts[] = $post;
}

16
inc/html.php

@ -148,8 +148,8 @@ function buildPostForm($parent, $staff_post = false) {
$maxlen_message = TINYIB_MAXMESSAGE;
}
if ($staff_post) {
$txt_options = __('Options');
$txt_raw_html = __('Raw HTML');
$txt_enable = __('Enable');
$txt_raw_html_info_1 = __('Text entered in the Message field will be posted as is with no formatting applied.');
$txt_raw_html_info_2 = __('Line-breaks must be specified with "<br>".');
@ -161,12 +161,14 @@ function buildPostForm($parent, $staff_post = false) {
$input_extra = <<<EOF
<tr>
<td class="postblock">
$txt_options
$txt_raw_html
</td>
<td>
<label><input type="checkbox" name="raw" value="1" accesskey="r">&nbsp;$txt_raw_html</label><br>
&nbsp; <small>$txt_raw_html_info_1</small><br>
&nbsp; <small>$txt_raw_html_info_2</small>
<label>
<input type="checkbox" name="raw" value="1" accesskey="r">&nbsp;$txt_enable<br>
&nbsp; <small>$txt_raw_html_info_1</small><br>
&nbsp; <small>$txt_raw_html_info_2</small>
</label>
</td>
</tr>
<tr>
@ -879,7 +881,9 @@ function adminBar() {
$output .= '<a href="?manage&staffpost">' . __('Staff Post') . '</a>] [';
if ($isadmin) {
$output .= '<a href="?manage&rebuildall">' . __('Rebuild All') . '</a>] [';
$output .= '<a href="?manage&reports">' . __('Reports') . '</a>] [';
if (TINYIB_REPORT) {
$output .= '<a href="?manage&reports">' . __('Reports') . '</a>] [';
}
}
if ($isadmin && installedViaGit()) {
$output .= '<a href="?manage&update">' . __('Update') . '</a>] [';

Loading…
Cancel
Save