/** * Draws a 'standard' page of type: * root, genre, artist, album, disk, generic * A frontend doesn't have to support all (or any) of these pagetypes, * but should understand they exist. * * @author Ben Dodson <*****@*****.**> * @version 11/3/04 * @since 5/13/04 */ function standardPage($node, $maindiv = false) { global $hierarchy, $include_path, $gzip_handler, $cms_type; // If they have a 'loose' hierarchy, use the genre page for now. $me = $this->name; $display = new jzDisplay(); // THIS **HAS** to go before any database calls // or else CMS's break!! if ($node->getName() != "") { $title = implode(" :: ", $node->getPath()); if ($maindiv === false) { $display->preHeader($title, $this->width, $this->align); $this->pageTop($title); } } else { switch ($hierarchy[0]) { case "genre": $title = word("Genres"); break; case "artist": $title = word("Artists"); break; case "album": $title = word("Albums"); break; } if ($maindiv === false) { $display->preHeader($title, $this->width, $this->align); $this->pageTop($title); } } if ($maindiv) { if ($gzip_handler == "true" && $cms_type != "mambo" && $cms_type != "cpgnuke") { @ob_start('ob_gzhandler'); } } // Once preheader is done, we can call to the database. $type = $node->getPType(); if (!validateLevel($type)) { $level = $node->getLevel(); if ($level == 0) { $type = "root"; } else { $type = $hierarchy[$level - 1]; } } // Disks are really albums: if ($type == "disk") { $type = "album"; } $pageInclude = $include_path . "frontend/frontends/{$me}/{$type}.php"; // if it doesn't exist, check the 'default' config for it. if (!is_file($pageInclude)) { $pageInclude = $include_path . "frontend/frontends/classic/{$type}.php"; if (!is_file($pageInclude)) { $pageInclude = $include_path . "frontend/frontends/{$me}/generic.php"; } if (!is_file($pageInclude)) { $pageInclude = $include_path . "frontend/frontends/classic/generic.php"; } // maybe don't do this-just crash. if (!is_file($pageInclude)) { die("Invalid level '{$type}' in your hierarchy."); } } require_once $pageInclude; // each of those php files has a drawPage() function // that takes a node as input. // It draws the page from the given node. // The root node is passed for the home page. drawPage($node); if ($maindiv === false && $this->standardFooter) { $this->footer($node); } }
$hierarchy = $_POST['customhierarchy']; } else { if (strlen($_POST['customhierarchy']) > 1) { die("If you want a custom layout, please select 'custom'."); } else { $hierarchy = $_POST['hierarchy']; } } $hierarchy = explode('/', $hierarchy); $mhierarchy = array(); $j = 0; for ($i = 0; $i < sizeof($hierarchy); $i++) { if ($hierarchy[$i] != "") { $mhierarchy[$j] = $hierarchy[$i]; $j++; if (!validateLevel($mhierarchy[$j - 1])) { die("Invalid level '" . $mhierarchy[$j - 1] . "' in your layout."); } } } if ($mhierarchy[sizeof($mhierarchy) - 1] != "track") { die("Your hierarchy must end with 'track'. Please try again."); } $_POST['hierarchy'] = implode("/", $mhierarchy); ?> <h1><?php echo $word_backend_setup; ?> </h1> <p> <?php
require_once 'security/validation.php'; require_once 'security/rbac.php'; ?> <?php if (!authenticate(1)) { die("没有权限"); } ?> <?php //PDO_Class_Wrapper version if ($_SERVER["REQUEST_METHOD"] == "POST") { $email = validateEmail(htmlspecialchars($_POST["email"])); $password = validatePassword(htmlspecialchars($_POST["password"])); $level = validateLevel(htmlspecialchars($_POST["level"])); $passwordMD5 = md5($password); $aWhere = array('email =' => $email); $admins = $db->select('admin', '', $aWhere)->results(); if (count($admins) > 0) { die("该账号已被使用"); } $aData = array("email" => $email, "password" => $passwordMD5, "level" => $level); $adminId = $db->insert('admin', $aData)->getLastInsertId(); if ($adminId > 0) { echo "添加成功"; echo '<br><a href="controller.php">返回管理页面</a>'; } else { die("添加失败"); } }