Rename admin to passwd, and index to admin
authorJoey Schulze <joey@infodrom.org>
Sun, 23 Dec 2018 15:36:32 +0000 (16:36 +0100)
committerJoey Schulze <joey@infodrom.org>
Tue, 25 Dec 2018 09:16:07 +0000 (10:16 +0100)
class/ajax.class.php
html/admin/index.php
html/admin/musiikki.js
templates/admin.phtml
templates/index.phtml [deleted file]
templates/passwd.phtml [new file with mode: 0644]

index 8a6f673..2c873ef 100644 (file)
@@ -86,12 +86,12 @@ class AJAX {
        return $ok;
     }
 
-    public static function getadminAction()
+    public static function getpasswdAction()
     {
        return array();
     }
 
-    public static function adminAction()
+    public static function passwdAction()
     {
        if (!strlen($_POST['password'])) return false;
 
index 1317ab9..13333c0 100644 (file)
@@ -2,7 +2,7 @@
 require_once(__DIR__.'/../../class/autoloader.class.php');
 
 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
-    $template = new Template('index');
+    $template = new Template('admin');
     echo $template->render([]);
 } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
     $method = $_POST['action'] . 'Action';
index 38f2ddf..1006d99 100644 (file)
@@ -86,9 +86,9 @@ function submit_rescan() {
     return false;
 }
 
-function submit_admin() {
+function submit_passwd() {
     $.post('index.php',
-          'action=admin&' + $('div.w3-container#admin form').serialize());
+          'action=passwd&' + $('div.w3-container#passwd form').serialize());
     response('Admin-Passwort neu gesetzt.<br>Sie müssen sich erneut anmelden.');
 
     return false;
index ab1b134..36ef6c3 100644 (file)
@@ -1,12 +1,59 @@
-<!-- Admin -->
-<div class="w3-container" id="admin" style="margin-top:75px" style="display:none;">
-  <h1 class="w3-xxxlarge w3-text-blue"><b>Admin.</b></h1>
-  <hr style="width:50px;border:5px solid blue" class="w3-round">
-  <form>
-    <div class="w3-section">
-      <label>Passwort</label>
-      <input class="w3-input w3-border" name="password" requiblue="" type="text">
-    </div>
-    <button type="submit" class="w3-button w3-block w3-padding-large w3-blue w3-margin-bottom" onclick="return submit_admin()">Speichern</button>
-  </form>
+<!DOCTYPE html>
+<!-- Source: https://www.w3schools.com/w3css/tryw3css_templates_interior_design.htm -->
+<html class="ui-mobile">
+<head>
+<title><?=Config::main()->get('title')?></title>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<?=Utilities::formatCSS('w3.css')?>
+<?=Utilities::formatCSS('musiikki.css')?>
+<link rel="shortcut icon" href="<?php echo Config::main()->get('favicon')?>">
+<?=Utilities::formatScript('jquery-1.10.2.min.js')?>
+<?=Utilities::formatScript('musiikki.js')?>
+</head>
+
+<body>
+
+<!-- Sidebar/menu -->
+<nav class="w3-sidebar w3-blue w3-collapse w3-top w3-large w3-padding" style="z-index: 3; width: 300px; font-weight: bold; display: none;" id="mySidebar"><br>
+  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
+  <div class="w3-container">
+    <h3 class="w3-padding-64"><b><?=Config::main()->get('title')?></b></h3>
+  </div>
+  <div class="w3-bar-block" style="padding-top:5px;">
+    <a href="/admin/" onclick="open_page('home')" class="w3-bar-item w3-button w3-hover-white">Home</a>
+    <a href="#" onclick="open_page('datetime')" class="w3-bar-item w3-button w3-hover-white">Date/Time</a>
+    <a href="#" onclick="open_page('wifi')" class="w3-bar-item w3-button w3-hover-white">WiFi</a>
+    <a href="#" onclick="open_page('shares')" class="w3-bar-item w3-button w3-hover-white">Shares</a>
+    <a href="#" onclick="open_page('rescan')" class="w3-bar-item w3-button w3-hover-white">Rescan</a>
+    <a href="#" onclick="open_page('passwd')" class="w3-bar-item w3-button w3-hover-white">Admin</a>
+    <a href="#" onclick="open_page('halt')" class="w3-bar-item w3-button w3-hover-white">Shutdown</a>
+  </div>
+</nav>
+
+<!-- Top menu on small screens -->
+<header class="w3-container w3-top w3-hide-large w3-blue w3-xlarge w3-padding">
+  <a href="javascript:void(0)" class="w3-button w3-blue w3-margin-right" onclick="w3_open()" title="Menu"><b>=</b></a>
+   <span><?=Config::main()->get('title')?></span>
+</header>
+
+<!-- Overlay effect when opening sidebar on small screens -->
+<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor: pointer; display: none;" title="close side menu" id="myOverlay"></div>
+
+<!-- !PAGE CONTENT! -->
+<div class="w3-main" style="margin-left:340px;margin-right:40px">
+
+<?php echo Template::html('home'); ?>
+<?php echo Template::html('datetime'); ?>
+<?php echo Template::html('wifi'); ?>
+<?php echo Template::html('shares'); ?>
+<?php echo Template::html('passwd'); ?>
+<?php echo Template::html('rescan'); ?>
+<?php echo Template::html('halt'); ?>
+<?php echo Template::html('response'); ?>
+
+<!-- End page content -->
 </div>
+
+</body>
+</html>
diff --git a/templates/index.phtml b/templates/index.phtml
deleted file mode 100644 (file)
index ae6faf9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!-- Source: https://www.w3schools.com/w3css/tryw3css_templates_interior_design.htm -->
-<html class="ui-mobile">
-<head>
-<title><?=Config::main()->get('title')?></title>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<?=Utilities::formatCSS('w3.css')?>
-<?=Utilities::formatCSS('musiikki.css')?>
-<link rel="shortcut icon" href="<?php echo Config::main()->get('favicon')?>">
-<?=Utilities::formatScript('jquery-1.10.2.min.js')?>
-<?=Utilities::formatScript('musiikki.js')?>
-</head>
-
-<body>
-
-<!-- Sidebar/menu -->
-<nav class="w3-sidebar w3-blue w3-collapse w3-top w3-large w3-padding" style="z-index: 3; width: 300px; font-weight: bold; display: none;" id="mySidebar"><br>
-  <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-hide-large w3-display-topleft" style="width:100%;font-size:22px">Close Menu</a>
-  <div class="w3-container">
-    <h3 class="w3-padding-64"><b><?=Config::main()->get('title')?></b></h3>
-  </div>
-  <div class="w3-bar-block" style="padding-top:5px;">
-    <a href="/admin/" onclick="open_page('home')" class="w3-bar-item w3-button w3-hover-white">Home</a>
-    <a href="#" onclick="open_page('datetime')" class="w3-bar-item w3-button w3-hover-white">Date/Time</a> 
-    <a href="#" onclick="open_page('wifi')" class="w3-bar-item w3-button w3-hover-white">WiFi</a> 
-    <a href="#" onclick="open_page('shares')" class="w3-bar-item w3-button w3-hover-white">Shares</a> 
-    <a href="#" onclick="open_page('rescan')" class="w3-bar-item w3-button w3-hover-white">Rescan</a>
-    <a href="#" onclick="open_page('admin')" class="w3-bar-item w3-button w3-hover-white">Admin</a>
-    <a href="#" onclick="open_page('halt')" class="w3-bar-item w3-button w3-hover-white">Shutdown</a> 
-  </div>
-</nav>
-
-<!-- Top menu on small screens -->
-<header class="w3-container w3-top w3-hide-large w3-blue w3-xlarge w3-padding">
-  <a href="javascript:void(0)" class="w3-button w3-blue w3-margin-right" onclick="w3_open()" title="Menu"><b>=</b></a>
-   <span><?=Config::main()->get('title')?></span>
-</header>
-
-<!-- Overlay effect when opening sidebar on small screens -->
-<div class="w3-overlay w3-hide-large" onclick="w3_close()" style="cursor: pointer; display: none;" title="close side menu" id="myOverlay"></div>
-
-<!-- !PAGE CONTENT! -->
-<div class="w3-main" style="margin-left:340px;margin-right:40px">
-
-<?php echo Template::html('home'); ?>
-<?php echo Template::html('datetime'); ?>
-<?php echo Template::html('wifi'); ?>
-<?php echo Template::html('shares'); ?>
-<?php echo Template::html('admin'); ?>
-<?php echo Template::html('rescan'); ?>
-<?php echo Template::html('halt'); ?>
-<?php echo Template::html('response'); ?>
-
-<!-- End page content -->
-</div>
-
-</body>
-</html>
diff --git a/templates/passwd.phtml b/templates/passwd.phtml
new file mode 100644 (file)
index 0000000..f456f01
--- /dev/null
@@ -0,0 +1,12 @@
+<!-- Admin -->
+<div class="w3-container" id="passwd" style="margin-top:75px" style="display:none;">
+  <h1 class="w3-xxxlarge w3-text-blue"><b>Admin.</b></h1>
+  <hr style="width:50px;border:5px solid blue" class="w3-round">
+  <form>
+    <div class="w3-section">
+      <label>Passwort</label>
+      <input class="w3-input w3-border" name="password" requiblue="" type="text">
+    </div>
+    <button type="submit" class="w3-button w3-block w3-padding-large w3-blue w3-margin-bottom" onclick="return submit_passwd()">Speichern</button>
+  </form>
+</div>