From a2f49382e65274d80a9a008e7e602bb5eced48da Mon Sep 17 00:00:00 2001 From: paintballrefjosh Date: Sat, 21 Jan 2017 20:28:47 -0600 Subject: [PATCH 1/2] Optimized news administration and display Fixed issue where old news content was displayed in the editing fields after saving the updates. Changed news posted_by from using a username to a user ID. This is handy if a username ever gets changed the news feeds will update appropriately. --- inc/account/account.register.php | 2 +- inc/admin/template_files/admin.news.php | 6 ++++-- templates/blizzlike/frontpage/frontpage.index.php | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/account/account.register.php b/inc/account/account.register.php index 2b3815e..25dcf30 100644 --- a/inc/account/account.register.php +++ b/inc/account/account.register.php @@ -153,7 +153,7 @@ function Register() // @$Enter is the main input arrays into the SDL $Enter = $Account->register( array( - 'username' => $_POST['r_login'], + 'username' => strtoupper($_POST['r_login']), 'sha_pass_hash' => $Account->sha_password($_POST['r_login'],$_POST['r_pass']), 'sha_pass_hash2' => $Account->sha_password($_POST['r_login'],$_POST['r_cpass']), 'email' => $_POST['r_email'], diff --git a/inc/admin/template_files/admin.news.php b/inc/admin/template_files/admin.news.php index bfbc052..3d0c5f8 100644 --- a/inc/admin/template_files/admin.news.php +++ b/inc/admin/template_files/admin.news.php @@ -19,7 +19,7 @@ { if(isset($_POST['subject'])) { - addNews($_POST['subject'],$_POST['message'],$user['username']); + addNews($_POST['subject'],$_POST['message'],$user['id']); } ?>
@@ -63,7 +63,6 @@ { if(isset($_GET['id'])) { - $content = $DB->selectRow("SELECT * FROM `mw_news` WHERE `id`='".$_GET['id']."'"); if(isset($_POST['delete'])) { delNews($_POST['id']); @@ -72,6 +71,9 @@ { editNews($_POST['id'],$_POST['editmessage']); } + + $content = $DB->selectRow("SELECT * FROM `mw_news` WHERE `id`='".$_GET['id']."'"); + ?>

Main Menu / News / Edit News

diff --git a/templates/blizzlike/frontpage/frontpage.index.php b/templates/blizzlike/frontpage/frontpage.index.php index a58c83a..69c116a 100644 --- a/templates/blizzlike/frontpage/frontpage.index.php +++ b/templates/blizzlike/frontpage/frontpage.index.php @@ -48,6 +48,9 @@ { $hl='alt'; } + + $posted_by = $DB->selectRow("SELECT username FROM account WHERE id = '".$topic['posted_by']."'"); + ?>