escapeString($_POST['name']); $uid = $_POST['uid']; $sql = ""; if (isset($_POST['content']) and ($type === "Section" or $type === "Component")) { $content = $conn->escapeString($_POST['content']); $sql = "UPDATE $type SET name='$name', content='$content' WHERE UID='$uid'"; } else if (isset($_POST['sections']) and $type === "Page") { $css = $_POST['css']; $sections = $_POST['sections']; $sql = "UPDATE Page SET name='$name', sections='$sections', CSS='$css' WHERE UID='$uid'"; } else if ($type === "Menu") { $value = $conn->escapeString($_POST['value']); $valuetype = $_POST['type']; $sql = "UPDATE Menu SET name='$name', valuetype='$valuetype', value='$value' WHERE UID='$uid'"; } if ($conn->query($sql)) { echo ""; } else { echo ""; } } else if (isset($_POST['css'])) { $file = fopen("../stylesheets/StyleSheet.css", "w"); fwrite($file, $_POST['css']); fclose($file); } //View building script: if ($type !== "CSS") { $query = $conn->query("SELECT * FROM $type WHERE UID='$uid'"); $row = $query->fetchArray(); $name = isset($row['name']) ? $row['name'] : $row['User']; } $inputs = array(); switch ($type) { case "Section": case "Component": $content = $row['content']; $inputs = array("
"); break; case "Page": $sections = $row['sections']; $css = $row['CSS']; $inputs = array( "
Page setions
", "
Add section
", "
" ); break; case "CSS": $name = "StyleSheet.css"; $filename = "../stylesheets/$name"; $readfile = fopen($filename, "r"); $css = fread($readfile, filesize($filename)); $inputs = array( "
" ); break; case "Menu": $itemtype = $row['valuetype']; $isPage = ""; $isLink = ""; if ($itemtype == "page") { $isPage = "selected"; } else { $isLink = "selected"; } $page_options = ""; $pagequery = $conn->query("SELECT * FROM Page ORDER BY ListId"); while ($pagerow = $pagequery->fetchArray()) { $page_name = $pagerow['name']; $page_selected = ""; if ($row['value'] == $page_name) { $page_selected = "selected"; } $page_options .= ""; } $menu_value = $row['value']; $inputs = array("
Menuitem type:
", "
Value:
" . "
Link:
", ""); break; case "Users": ob_start(); include "pages/edit/user.php"; $inputs = array(ob_get_clean()); break; } ?>

name:

"; } ?>
".$row['CSS'].""; echo "
"; if ($type === "Page") { $sections = json_decode($row['sections']); if ($sections === NULL) $sections = explode(',', $row['sections']); $app = new App(true); foreach ($sections as $section) { $app->addSection($section); } } else if ($type === "Section") { echo $row['content']; } echo '
'; ?>