434 $q = $db->sql_query('SELECT post_id, post_title, post_title_clean, post_timestamp, post_published FROM ' . table_prefix . 'blog_posts WHERE post_author = ' . $session->user_id . ' ORDER BY post_timestamp DESC;'); |
434 $q = $db->sql_query('SELECT post_id, post_title, post_title_clean, post_timestamp, post_published FROM ' . table_prefix . 'blog_posts WHERE post_author = ' . $session->user_id . ' ORDER BY post_timestamp DESC;'); |
435 if ( !$q ) |
435 if ( !$q ) |
436 $db->_die(); |
436 $db->_die(); |
437 |
437 |
438 echo '<div class="tblholder"> |
438 echo '<div class="tblholder"> |
439 <table border="0" cellspacing="1" cellpadding="4">'; |
439 <table border="0" cellspacing="1" cellpadding="4" id="nuggie_postlist">'; |
440 |
440 |
441 echo '<tr> |
441 echo '<tr> |
442 <th style="width: 1px;">#</th> |
442 <th style="width: 1px;">#</th> |
443 <th style="width: 80%;">Post title</th> |
443 <th style="width: 80%;">Post title</th> |
444 <th>Published</th> |
444 <th>Published</th> |
445 <th>Time</th> |
445 <th>Time</th> |
446 <th colspan="2"></th> |
446 <th colspan="2"></th> |
447 </tr>'; |
447 </tr>'; |
448 |
448 |
449 while ( $row = $db->fetchrow() ) |
449 if ( $row = $db->fetchrow() ) |
450 { |
450 { |
451 echo '<tr>'; |
451 do |
452 |
452 { |
453 $uri = makeUrlNS('Blog', $session->username . date('/Y/n/j/', $row['post_timestamp']) . $row['post_title_clean'], false, true); |
453 echo '<tr>'; |
454 |
454 |
455 echo '<td class="row2" style="text-align: center;">' . $row['post_id'] . '</td>'; |
455 $uri = makeUrlNS('Blog', $session->username . date('/Y/n/j/', $row['post_timestamp']) . $row['post_title_clean'], false, true); |
456 echo '<td class="row1">' . "<a href=\"$uri\">" . htmlspecialchars($row['post_title']) . '</a></td>'; |
456 |
457 $cls = ( $row['post_published'] == 1 ) ? 'row3_green' : 'row3_red'; |
457 echo '<td class="row2" style="text-align: center;">' . $row['post_id'] . '</td>'; |
458 echo '<td class="' . $cls . ' nuggie_publishbtn" onclick="ajaxNuggieTogglePublished(' . $row['post_id'] . ', this);" nuggie:published="' . $row['post_published'] . '" style="text-align: center;">' . ( ( $row['post_published'] == 1 ) ? '<b>Yes</b>' : 'No' ) . '</td>'; |
458 echo '<td class="row1">' . "<a href=\"$uri\">" . htmlspecialchars($row['post_title']) . '</a></td>'; |
459 echo '<td class="row3" style="white-space: nowrap;">' . ( function_exists('enano_date') ? enano_date('Y-m-d', $row['post_timestamp']) : date('Y-m-d h:i', $row['post_timestamp']) ) . '</td>'; |
459 $cls = ( $row['post_published'] == 1 ) ? 'row3_green' : 'row3_red'; |
460 echo '<td class="row1" style="white-space: nowrap;"><button class="nuggie_edit" name="action" value="edit;id=' . $row['post_id'] . '">Edit</button> <button class="nuggie_delete" name="action" onclick="return ajaxNuggieDeletePost(' . $row['post_id'] . ', this.parentNode.parentNode);" value="delete;id=' . $row['post_id'] . '">Delete</button></td>'; |
460 echo '<td class="' . $cls . ' nuggie_publishbtn" onclick="ajaxNuggieTogglePublished(' . $row['post_id'] . ', this);" nuggie:published="' . $row['post_published'] . '" style="text-align: center;">' . ( ( $row['post_published'] == 1 ) ? '<b>Yes</b>' : 'No' ) . '</td>'; |
461 |
461 echo '<td class="row3" style="white-space: nowrap;">' . ( function_exists('enano_date') ? enano_date('Y-m-d', $row['post_timestamp']) : date('Y-m-d h:i', $row['post_timestamp']) ) . '</td>'; |
462 echo '</tr>'; |
462 echo '<td class="row1" style="white-space: nowrap;"><button class="nuggie_edit" name="action" value="edit;id=' . $row['post_id'] . '">Edit</button> <button class="nuggie_delete" name="action" onclick="return ajaxNuggieDeletePost(' . $row['post_id'] . ', this.parentNode.parentNode);" value="delete;id=' . $row['post_id'] . '">Delete</button></td>'; |
|
463 |
|
464 echo '</tr>'; |
|
465 } while ( $row = $db->fetchrow() ); |
|
466 } |
|
467 else |
|
468 { |
|
469 echo '<tr><td class="row3" colspan="6" style="text-align: center;">No posts.</td></tr>'; |
463 } |
470 } |
464 |
471 |
465 echo ' </table> |
472 echo ' </table> |
466 </div>'; |
473 </div>'; |
467 |
474 |