瀏覽代碼

Code cleanup.

Nate Jones 10 年之前
父節點
當前提交
7512d37442
共有 3 個文件被更改,包括 156 次插入187 次删除
  1. 155 170
      core/menu/menu_item_list.php
  2. 1 3
      core/users/index.php
  3. 0 14
      core/users/users.php

+ 155 - 170
core/menu/menu_item_list.php

@@ -179,183 +179,168 @@ require_once "resources/header.php";
 $order_by = $_GET["order_by"];
 $order = $_GET["order"];
 
-	echo "<div align='center'>";
-	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
-
-	echo "<tr class='border'>\n";
-	echo "	<td align=\"left\">\n";
-
-	$sql = "select * from v_menu_items ";
-	$sql .= "where menu_uuid = '".$menu_uuid."' ";
-	$sql .= "and menu_item_parent_uuid is null ";
-	if (strlen($order_by)> 0) {
-		$sql .= "order by $order_by $order ";
-	}
-	else {
-		$sql .= "order by menu_item_order asc ";
-	}
-	$prep_statement = $db->prepare(check_sql($sql));
-	$prep_statement->execute();
-	$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
-	$result_count = count($result);
+$sql = "select * from v_menu_items ";
+$sql .= "where menu_uuid = '".$menu_uuid."' ";
+$sql .= "and menu_item_parent_uuid is null ";
+if (strlen($order_by)> 0) {
+	$sql .= "order by $order_by $order ";
+}
+else {
+	$sql .= "order by menu_item_order asc ";
+}
+$prep_statement = $db->prepare(check_sql($sql));
+$prep_statement->execute();
+$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+$result_count = count($result);
 
-	$c = 0;
-	$row_style["0"] = "row_style0";
-	$row_style["1"] = "row_style0";
+$c = 0;
+$row_style["0"] = "row_style0";
+$row_style["1"] = "row_style0";
 
-	echo "<div align='left'>\n";
-	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 
-	if ($result_count == 0) {
-		//no results
-		echo "<tr><td>&nbsp;</td></tr>";
+if ($result_count == 0) {
+	//no results
+	echo "<tr><td>&nbsp;</td></tr>";
+}
+else {
+	echo "<tr>";
+	echo "<th align='left' nowrap>".$text['label-title']."</th>";
+	echo "<th align='left' nowrap>".$text['label-groups']."</th>";
+	echo "<th align='left'nowrap>".$text['label-category']."</th>";
+	echo "<th nowrap style='text-align: center;'>".$text['label-protected']."</th>";
+	echo "<th nowrap width='70' style='text-align: center;'>".$text['label-menu_order']."</th>";
+	echo "<td class='list_control_icons'>";
+	if (permission_exists('menu_add')) {
+		echo "<a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
 	}
-	else {
-		echo "<tr>";
-		echo "<th align='left' nowrap>".$text['label-title']."</th>";
-		echo "<th align='left' nowrap>".$text['label-groups']."</th>";
-		echo "<th align='left'nowrap>".$text['label-category']."</th>";
-		echo "<th nowrap style='text-align: center;'>".$text['label-protected']."</th>";
-		echo "<th nowrap width='70' style='text-align: center;'>".$text['label-menu_order']."</th>";
-		echo "<td class='list_control_icons'>";
-		if (permission_exists('menu_add')) {
-			echo "<a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
-		}
-		echo "</td>\n";
-		echo "</tr>";
-
-		foreach($result as $row) {
-			//set the db values as php variables
-				$menu_item_uuid = $row['menu_item_uuid'];
-				$menu_item_category = $row['menu_item_category'];
-				$menu_item_title = $row['menu_item_title'];
-				$menu_item_link = $row['menu_item_link'];
-				$menu_item_protected = $row['menu_item_protected'];
-
-			//get the groups that have been assigned to the menu
-				$sql = "select group_name from v_menu_item_groups ";
-				$sql .= "where menu_uuid = '$menu_uuid' ";
-				$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
-				$sub_prep_statement = $db->prepare(check_sql($sql));
-				$sub_prep_statement->execute();
-				$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
-				$group_list = "";
-				$x = 0;
-				foreach ($sub_result as &$sub_row) {
-					if ($x == 0) {
-						$group_list = $sub_row["group_name"];
-					}
-					else {
-						$group_list .= ", ".$sub_row["group_name"];
-					}
-					$x++;
-				}
-				unset ($sub_prep_statement);
-
-			//add the type link based on the typd of the menu
-				switch ($menu_item_category) {
-					case "internal":
-						$menu_item_title = "<a href='".PROJECT_PATH . $menu_item_link."'>$menu_item_title</a>";
-						break;
-					case "external":
-						if (substr($menu_item_link, 0,1) == "/") {
-							$menu_item_link = PROJECT_PATH . $menu_item_link;
-						}
-						$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
-						break;
-					case "email":
-						$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
-						break;
-				}
-
-			//display the content of the list
-				$tr_link = (permission_exists('menu_edit')) ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."'" : null;
-				echo "<tr style='".$row_style[$c]."' ".$tr_link.">\n";
-				echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_title."&nbsp;</td>";
-				echo "<td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>";
-				//echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_link."&nbsp;</td>";
-				echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category."&nbsp;</td>";
-				//echo "<td valign='top' class='".$row_style[$c]."'>".$row[menu_item_description]."</td>";
-				//echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_parent_uuid']."&nbsp;</td>";
-				//echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_order']."&nbsp;</td>";
-
-				if ($menu_item_protected == "true") {
-					echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> &nbsp;</td>";
+	echo "</td>\n";
+	echo "</tr>";
+
+	foreach($result as $row) {
+		//set the db values as php variables
+			$menu_item_uuid = $row['menu_item_uuid'];
+			$menu_item_category = $row['menu_item_category'];
+			$menu_item_title = $row['menu_item_title'];
+			$menu_item_link = $row['menu_item_link'];
+			$menu_item_protected = $row['menu_item_protected'];
+
+		//get the groups that have been assigned to the menu
+			$sql = "select group_name from v_menu_item_groups ";
+			$sql .= "where menu_uuid = '$menu_uuid' ";
+			$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
+			$sub_prep_statement = $db->prepare(check_sql($sql));
+			$sub_prep_statement->execute();
+			$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
+			$group_list = "";
+			$x = 0;
+			foreach ($sub_result as &$sub_row) {
+				if ($x == 0) {
+					$group_list = $sub_row["group_name"];
 				}
 				else {
-					echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." &nbsp;</td>";
-				}
-
-				echo "<td valign='top' nowrap class='".$row_style[$c]."' style='text-align: center;'>";
-				echo "  ".$row[menu_item_order]."&nbsp;";
-				echo "</td>";
-
-				//echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
-				//if (permission_exists('menu_edit')) {
-				//	echo "  <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". ".$text['button-move_up']."'>";
-				//	echo "  <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". ".$text['button-move_down']."'>";
-				//}
-				//echo "</td>";
-
-				echo "   <td class='list_control_icons'>";
-				if (permission_exists('menu_edit')) {
-					echo "<a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
-				}
-				if (permission_exists('menu_delete')) {
-					echo "<a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' onclick=\"return confirm('".$text['confirm-delete']."')\" alt='".$text['button-delete']."'>$v_link_label_delete</a>";
-				}
-				echo "   </td>\n";
-				echo "</tr>";
-
-			//update the menu order
-				if ($row[menu_item_order] != $tmp_menu_item_order) {
-					$sql  = "update v_menu_items set ";
-					$sql .= "menu_item_title = '".$row['menu_item_title']."', ";
-					$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
-					$sql .= "where menu_uuid = '".$menu_uuid."' ";
-					$sql .= "and menu_item_uuid = '".$row[menu_item_uuid]."' ";
-					//$db->exec(check_sql($sql));
-				}
-				$tmp_menu_item_order++;
-
-			//check for sub menus
-				$menu_item_level = 0;
-				if (strlen($row['menu_item_uuid']) > 0) {
-					$c = build_db_child_menu_list($db, $menu_item_level, $row['menu_item_uuid'], $c);
+					$group_list .= ", ".$sub_row["group_name"];
 				}
+				$x++;
+			}
+			unset ($sub_prep_statement);
+
+		//add the type link based on the typd of the menu
+			switch ($menu_item_category) {
+				case "internal":
+					$menu_item_title = "<a href='".PROJECT_PATH . $menu_item_link."'>$menu_item_title</a>";
+					break;
+				case "external":
+					if (substr($menu_item_link, 0,1) == "/") {
+						$menu_item_link = PROJECT_PATH . $menu_item_link;
+					}
+					$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
+					break;
+				case "email":
+					$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
+					break;
+			}
+
+		//display the content of the list
+			$tr_link = (permission_exists('menu_edit')) ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."'" : null;
+			echo "<tr style='".$row_style[$c]."' ".$tr_link.">\n";
+			echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_title."&nbsp;</td>";
+			echo "<td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>";
+			//echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_link."&nbsp;</td>";
+			echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category."&nbsp;</td>";
+			//echo "<td valign='top' class='".$row_style[$c]."'>".$row[menu_item_description]."</td>";
+			//echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_parent_uuid']."&nbsp;</td>";
+			//echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_order']."&nbsp;</td>";
+
+			if ($menu_item_protected == "true") {
+				echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> &nbsp;</td>";
+			}
+			else {
+				echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." &nbsp;</td>";
+			}
+
+			echo "<td valign='top' nowrap class='".$row_style[$c]."' style='text-align: center;'>";
+			echo "  ".$row[menu_item_order]."&nbsp;";
+			echo "</td>";
+
+			//echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
+			//if (permission_exists('menu_edit')) {
+			//	echo "  <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". ".$text['button-move_up']."'>";
+			//	echo "  <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". ".$text['button-move_down']."'>";
+			//}
+			//echo "</td>";
+
+			echo "   <td class='list_control_icons'>";
+			if (permission_exists('menu_edit')) {
+				echo "<a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
+			}
+			if (permission_exists('menu_delete')) {
+				echo "<a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' onclick=\"return confirm('".$text['confirm-delete']."')\" alt='".$text['button-delete']."'>$v_link_label_delete</a>";
+			}
+			echo "   </td>\n";
+			echo "</tr>";
+
+		//update the menu order
+			if ($row[menu_item_order] != $tmp_menu_item_order) {
+				$sql  = "update v_menu_items set ";
+				$sql .= "menu_item_title = '".$row['menu_item_title']."', ";
+				$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
+				$sql .= "where menu_uuid = '".$menu_uuid."' ";
+				$sql .= "and menu_item_uuid = '".$row[menu_item_uuid]."' ";
+				//$db->exec(check_sql($sql));
+			}
+			$tmp_menu_item_order++;
+
+		//check for sub menus
+			$menu_item_level = 0;
+			if (strlen($row['menu_item_uuid']) > 0) {
+				$c = build_db_child_menu_list($db, $menu_item_level, $row['menu_item_uuid'], $c);
+			}
+
+		if ($c==0) { $c=1; } else { $c=0; }
+	} //end foreach
+	unset($sql, $result, $row_count);
+
+} //end if results
+
+echo "<tr>\n";
+echo "<td colspan='6' align='left'>\n";
+echo "	<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
+echo "	<tr>\n";
+echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
+echo "		<td width='33.3%' align='center' nowrap>&nbsp;</td>\n";
+echo "		<td width='33.3%' align='right'>\n";
+if (permission_exists('menu_add') && $action == "update") {
+	echo "			<a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
+}
+echo "		</td>\n";
+echo "	</tr>\n";
+echo "	</table>\n";
 
-			if ($c==0) { $c=1; } else { $c=0; }
-		} //end foreach
-		unset($sql, $result, $row_count);
-
-	} //end if results
-
-	echo "<tr>\n";
-	echo "<td colspan='6' align='left'>\n";
-	echo "	<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
-	echo "	<tr>\n";
-	echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
-	echo "		<td width='33.3%' align='center' nowrap>&nbsp;</td>\n";
-	echo "		<td width='33.3%' align='right'>\n";
-	if (permission_exists('menu_add') && $action == "update") {
-		echo "			<a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
-	}
-	echo "		</td>\n";
-	echo "	</tr>\n";
-	echo "	</table>\n";
-
-	echo "</td>\n";
-	echo "</tr>\n";
-	echo "</table>\n";
-	echo "</div>\n";
-	echo "<br><br>";
-
-	echo "  </td>\n";
-	echo "</tr>\n";
-	echo "</table>\n";
-	echo "</div>";
-
-	echo "<br><br>";
-	require_once "resources/footer.php";
+echo "</td>\n";
+echo "</tr>\n";
+echo "</table>\n";
+echo "<br><br>";
 
+require_once "resources/footer.php";
 ?>

+ 1 - 3
core/users/index.php

@@ -43,10 +43,9 @@ else {
 	$document['title'] = $text['title-user_manager'];
 
 //show the user list
-	echo "<div align='center'>";
 	echo "	<table width='100%' border='0'>";
 	echo "		<tr>";
-	echo "		<td align='left' width='100%'>";
+	echo "			<td align='left' width='100%'>";
 	require_once "users.php";
 	echo "				<br />";
 	echo "				<br />";
@@ -54,7 +53,6 @@ else {
 	echo "			</td>";
 	echo "		</tr>";
 	echo "	</table>";
-	echo "</div>";
 
 //include the footer
 	include "resources/footer.php";

+ 0 - 14
core/users/users.php

@@ -42,11 +42,6 @@ $order = $_GET["order"];
 $field_name = $_REQUEST["field_name"];
 $field_value = $_REQUEST["field_value"];
 
-echo "<div align='center'>";
-echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
-echo "<tr class='border'>\n";
-echo "	<td align=\"center\">\n";
-
 //page title and description
 	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 	echo "<form method='post' action=''>";
@@ -145,7 +140,6 @@ echo "	<td align=\"center\">\n";
 	$row_style["1"] = "row_style1";
 
 //show the data
-	echo "<div align='center'>\n";
 	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 
 	echo "<tr>\n";
@@ -224,14 +218,6 @@ echo "	<td align=\"center\">\n";
 	echo "</tr>\n";
 
 	echo "</table>";
-	echo "</div>";
-	echo "<br><br>";
 	echo "<br><br>";
 
-echo "</td>";
-echo "</tr>";
-echo "</table>";
-echo "</div>";
-echo "<br><br>";
-
 ?>