diff options
author | jhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6> | 2009-12-27 10:44:57 -0500 |
---|---|---|
committer | jhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6> | 2009-12-27 10:44:57 -0500 |
commit | d526decc4884710ae7fafe7aa5171e7f59b24292 (patch) | |
tree | 12c07f3ef6ab9bf5a4f278a7b00720996c41667d /admin/newsreel | |
parent | 07253dc75c69cf585ad39a218f3f2cf97b773987 (diff) | |
download | bayonetcms-d526decc4884710ae7fafe7aa5171e7f59b24292.tar.gz |
MySQL -> MySQLi
Fixed memory leaks after Fetching arrays
Removed all while loops that interfaced with $db->Fetch()
Rewrote RSS module
Fixed syntax error in donations module
Fixed link structure for news module
Reverting to old page display method
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@402 c5b2fb0a-d05d-0410-98c8-828840a80ff6
Diffstat (limited to 'admin/newsreel')
-rw-r--r-- | admin/newsreel/functions.php | 47 | ||||
-rw-r--r-- | admin/newsreel/updateDB.php | 3 |
2 files changed, 30 insertions, 20 deletions
diff --git a/admin/newsreel/functions.php b/admin/newsreel/functions.php index 8423b9b..9dece93 100644 --- a/admin/newsreel/functions.php +++ b/admin/newsreel/functions.php @@ -58,22 +58,24 @@ $(document).ready(function(){ function EditOrder(){
global $db;
-
- echo "<div id=\"contentLeft\">
+ ?>
+ <div id="contentLeft">
<table>
<tr>
<th>News Reel Order</th>
- <td id=\"updateStatus\"></td>
+ <td id="updateStatus"></td>
</tr>
</table>
- <ul>";
-
+ <ul>
+ <?php
$result = $db->Query("SELECT `title`, `slide_id`, `src` FROM `bayonet_newsreel` WHERE `visible` = 1 ORDER BY `weight` ASC");
- while(($row = $db->fetch($result))!= false){
- echo "<li id=\"recordsArray_{$row['slide_id']}\">";
- PrintSlide($row);
- echo "<br /><a href=\"?op=newsreel&disable={$row['slide_id']}\"><input type=\"button\" value=\"Disable\" /></a></li>";
- }
+ $row = $db->Fetch($result);
+
+ foreach($row as $slide){
+ echo "<li id=\"recordsArray_{$slide['slide_id']}\">";
+ PrintSlide($slide);
+ echo "<br /><a href=\"?op=newsreel&disable={$slide['slide_id']}\"><input type=\"button\" value=\"Disable\" /></a></li>";
+ }
?>
</ul>
Click and drag on a slide to change the order. Wait for confirmation indicating the changes have been saved.
@@ -99,6 +101,11 @@ $(document).ready(function(){ global $db;
echo "Disable: ".$slide_id;
+ $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `slide_id` = '$slide_id' LIMIT 1");
+ $row = $db->Fetch($result);
+ foreach($row as $slide){
+ $oldWeight = $slide['weight'];
+ }
$db->Query("UPDATE `bayonet_newsreel` SET `visible` = 0, `weight` = 0 WHERE `slide_id` = '$slide_id' LIMIT 1");
PageRedirect(0,"?op=newsreel");
}
@@ -107,12 +114,13 @@ $(document).ready(function(){ global $db;
echo "<h3>Disabled Slides</h3>";
- $result = $db->query("SELECT `slide_id`, `title`, `src` FROM `bayonet_newsreel` WHERE `visible` = 0 ORDER BY `slide_id` DESC");
- while(($row = $db->fetch($result))!= false){
-
- echo PrintSlide($row);
- echo "<br /><a href=\"?op=newsreel&enable={$row['slide_id']}\"><input type=\"button\" value=\"Enable\" /></a><br /><br />";
- }
+ $result = $db->Query("SELECT `slide_id`, `title`, `src` FROM `bayonet_newsreel` WHERE `visible` = 0 ORDER BY `slide_id` DESC");
+ $row = $db->Fetch($result);
+
+ foreach($row as $slide){
+ echo PrintSlide($slide);
+ echo "<br /><a href=\"?op=newsreel&enable={$slide['slide_id']}\"><input type=\"button\" value=\"Enable\" /></a><br /><br />";
+ }
}
function PrintSlide($slide){
@@ -125,9 +133,12 @@ $(document).ready(function(){ function GetLastPosition(){
global $db;
- $result = $db->query("SELECT `weight` FROM `bayonet_newsreel` ORDER BY `weight` DESC LIMIT 1");
+ $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `visible` = 1 ORDER BY `weight` DESC LIMIT 1");
$row = $db->Fetch($result);
- return $row['weight'];
+ foreach($row as $slide){
+ $weight = $slide['weight'];
+ }
+ return $weight;
}
diff --git a/admin/newsreel/updateDB.php b/admin/newsreel/updateDB.php index 904e578..f4031a2 100644 --- a/admin/newsreel/updateDB.php +++ b/admin/newsreel/updateDB.php @@ -3,7 +3,7 @@ include '../../includes/debug.php';
include '../../includes/config.php';
include '../../includes/sql.class.php';
-include '../functions.php';
+include '../../includes/functions.php';
$action = $_POST['action'];
$updateRecordsArray = $_POST['recordsArray'];
@@ -22,7 +22,6 @@ if ($action == "updateReelOrder"){ foreach ($updateRecordsArray as $recordIDValue) {
$db->Query("UPDATE `bayonet_newsreel` SET `weight` = '$listingCounter' WHERE `slide_id` = '$recordIDValue'");
- //mysql_query($query) or die('Error, insert query failed');
$listingCounter = $listingCounter + 1;
}
echo "<img src=\"images/accepted.png\" />";
|