From 0077cb99704fe863cf731fc5cab792af2ede96c2 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 17 Apr 2011 20:13:07 -0400 Subject: Backporting retarded amount of changes outside of version control --- admin/modules/functions.php | 211 +++++++++----------------------------------- 1 file changed, 41 insertions(+), 170 deletions(-) (limited to 'admin/modules/functions.php') diff --git a/admin/modules/functions.php b/admin/modules/functions.php index 3c44b5a..1d8d917 100644 --- a/admin/modules/functions.php +++ b/admin/modules/functions.php @@ -1,171 +1,42 @@ -. - */ - -function ListModules() -{ - global $db; - $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY `active` DESC, `weight` ASC, `position`"); - $blocks = $db->fetch($result); - - echo ""; - foreach($blocks as $block) - { - echo ""; - } - echo "
Existing Blocks
{$block['weight']} : {$block['dir_name']}EditDelete
"; -} - -function NewModule() -{ - global $db; - if(isset($_POST['processed'])) - { - //Secure our data to prevent injection attacks. - $weight = addslashes($_POST['weight']); - $dir_name = addslashes($_POST['dir_name']); - $position = addslashes($_POST['position']); - $active = addslashes($_POST['active']); - $title = addslashes($_POST['title']); - - if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) - { - echo "You must fill everything out before proceeding."; - return; - } - //Update the database with the new data. - $db->Query("INSERT INTO `bayonet_blocks` SET `weight` = '$weight', `dir_name` = '$dir_name', `title` = '$title', `position` = '$position', `active` = '$active'"); - //die, because we have completed what we wanted to do. - echo "New block, '$dir_name', at position '$weight' added.\n"; - return; - } - - ?> -
- - - - - - - -
Title
Weight
Position
Directory Name
Active -
-
- 'Yes',0 => 'No'); - foreach($options as $option => $value) - { - $selected = NULL; - if($active == $option) - { - $selected = "selected"; - } - echo "\n"; - } - - -} - -function EditModule($module_id) -{ - global $db; - if(isset($_POST['processed'])) - { - //Secure our data to prevent injection attacks. - $weight = (int) addslashes($_POST['weight']); - $dir_name = addslashes($_POST['dir_name']); - $position = (int) addslashes($_POST['position']); - $active = addslashes($_POST['active']); - $title = addslashes($_POST['title']); - - if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) - { - echo "You must fill everything out before proceeding."; - return; - } - - //Update the database with the new data. - $db->Query("UPDATE bayonet_blocks SET weight = '$weight', dir_name = '$dir_name', position = '$position', active = '$active' WHERE block_id = '$block_id'"); - //$isActive = $active ? "IS" : "IS NOT"; - echo "Block, '$dir_name', at position '$weight' has been edited.\n"; - PageRedirect(3, "?op=blocks"); - //die, because we have completed what we wanted to do. - return; - } - - //Grab the page from the database according to the $page_id passed to the function. - $result = $db->Query("SELECT weight,dir_name,position,active,title FROM bayonet_blocks WHERE block_id = '$block_id'"); - $block = $db->Fetch($result) - - ?> -
- - - - - - - - -
Title
Weight
Position
Directory Name
Active - -
-
- Query("SELECT dir_name FROM bayonet_blocks WHERE block_id = '$block_id'"); - $block = $db->Fetch($result); - - if(isset($_POST['proceed'])) - { - echo "Block '{$block['dir_name']}', was deleted."; - $db->Query("DELETE FROM bayonet_blocks WHERE block_id = '$block_id' LIMIT 1"); - return; - } - if(isset($_POST['cancel'])) - { - echo "User cancelled deletion of page: '{$block['dir_name']}'"; - return; - } - - ?> -
- - - -
Are you SURE you want to delete the block titled: ''?
   
-
- . + */ + +function ListModules(){ + + global $db; + $result = $db->Query("SELECT dir_name, weight, status FROM bayonet_modules ORDER BY status DESC, weight ASC"); + $modules = $db->Fetch($result); + + OpenTable("50%"); + echo "Directory NameWeightStatus"; + foreach($modules as $module){ + echo "".$module['dir_name']."".$module['weight']."".$module['status'].""; + } + CloseTable(); +} + +function EditModule($module_id){ + +} + +function DeleteModule($module_id){ + +} + ?> \ No newline at end of file -- cgit