Commits

Dennis T Kaplan committed 85b042b

clean up

  • Participants
  • Parent commits f77493d

Comments (0)

Files changed (3)

 Citadel PHP
 ===========
 
-Running on production website at https://portal.riky.net 
+Running on production website at <https://portal.riky.net> 
 
 ________________________________________________________
 
-function setCookie(name,value,days) {
-    if (days) {
-            var date = new Date();
-            date.setTime(date.getTime()+(days*24*60*60*1000));
-            var expires = "; expires="+date.toGMTString();
-    }
-    else var expires = "";
-    document.cookie = name+"="+value+expires+"; path=/";
-}
-
-function getCookie(name) {
-    var nameEQ = name + "=";
-    var ca = document.cookie.split(';');
-    for(var i=0;i < ca.length;i++) {
-            var c = ca[i];
-            while (c.charAt(0)==' ') c = c.substring(1,c.length);
-            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
-    }
-    return null;
-}
-
-function delCookie(name) {
-    setCookie(name,"",-1);
-}
 
 window.onload = function(){
     checkAuth();
-    // setInterval(function(){checkAuth()}, 10000); 
+    setInterval(function(){checkAuth()}, 10000); 
+};
+window.onblur = function(){userLogout();};
+
+/****************
+<script type="text/javascript" src="js/json2.js"></script>
+<script type="text/javascript" src="js/l10n.min.js"></script>
+<script type="text/javascript" src="js/underscore.js"></script>
+<script type="text/javascript" src="js/localizations.js"></script>
+var localize = function(string, fallback) {
+    var localized = string.toLocaleString();
+    return (localized === string) ? fallback : localized;
 };
 
-window.onblur = function() {
-    userLogout();
+var t = function(string){
+    var e = document.getElementById(string);
+    if( e ){
+        e = e.firstChild;
+        e.nodeValue = localize('%'+string, e.nodeValue);
+    }
 }
+    //String.toLocaleString("localizations.json");
+    //String.locale = "tr";
+    //String.locale = "en";
+    //t('login');
+    //t('changePassword');
+    //document.documentElement.lang = String.locale || document.documentElement.lang;
+*****************/
 
 function checkAuth(){
     var c = getCookie('citadelAuth');
     if(c != 1){
-        var content = document.getElementById("content");
-        content.innerHTML = document.getElementById("template_Login").innerHTML;
+        var z = document.getElementById("divLogin");
+        if(!z){
+            var e = document.getElementById("content");
+            e.innerHTML = document.getElementById("template_Login").innerHTML;
+        }
+    }else{
+        var z = document.getElementById("divUser");
+        if(!z){
+            var e = document.getElementById("content");
+            e.innerHTML = document.getElementById("template_User").innerHTML;        
+        }
     }
 }
 
 function userLogout(){
-    setCookie('citadelAuth',0,-1);
+    delCookie('citadelAuth');
     delCookie('PHPSESSID');
     checkAuth();
 }
 
 function Ajax(params){
-        var xmlhttp = new XMLHttpRequest();
-        xmlhttp.onreadystatechange=function() {
-            if (xmlhttp.readyState==4 && xmlhttp.status==200) {
-                if(xmlhttp.responseText != ''){
-                    Messanger(xmlhttp.responseText);                    
-                }else{
-                    Messanger('',-1);                    
-                }
+    var ajax = new XMLHttpRequest();
+    ajax.onreadystatechange=function(){
+        if( ajax.readyState==4 && ajax.status==200 ){
+            if( ajax.responseText != '' ){
+                Messanger(ajax.responseText);                    
+            }else{
+                Messanger('',-1);                    
             }
         }
-        xmlhttp.open("POST", "ajax.php", true);
-        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-        xmlhttp.setRequestHeader("Content-length", params.length);
-        xmlhttp.setRequestHeader("Connection", "close");
-        xmlhttp.send(params);    
+    };
+    ajax.open("POST", "ajax.php", true);
+    ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+    ajax.setRequestHeader("Content-length", params.length);
+    ajax.setRequestHeader("Connection", "close");
+    ajax.send(params);    
 }
 
+var l = function (string) {
+    return string.toLocaleString();
+};
 
 function userLogin(){
     var f = document.getElementById("FormLogin");
     }
     return r;
 }
+
+function setCookie(name,value,days) {
+    var expires = "";
+    if( days ){
+        var date = new Date();
+        date.setTime(date.getTime()+(days*24*60*60*1000));
+        var expires = "; expires="+date.toGMTString();
+    } 
+    document.cookie = name+"="+value+expires+"; path=/";
+}
+
+function getCookie(name) {
+    var nameEQ = name + "=";
+    var ca = document.cookie.split(';');
+    for(var i=0;i < ca.length;i++) {
+        var c = ca[i];
+        while (c.charAt(0)==' ') 
+            c = c.substring(1,c.length);
+        if (c.indexOf(nameEQ) == 0) 
+            return c.substring(nameEQ.length,c.length);
+    }
+    return null;
+}
+
+function delCookie(name) {
+    setCookie(name,"",-1);
+}
+
+function isString(x) {
+  return (typeof x === 'string');
+}
 <!DOCTYPE html>
-<html>
+<html lang="en" dir="ltr">
 <head>
 <title>Citadel</title>
-<meta name="generator" content="Citadel PHP">
-<meta http-equiv="content-language" content="en">
 <meta charset="UTF-8">
-<link rel="icon" href="http://www.riky.net/static/ico/favicon.ico" type="image/x-icon">
-<link href="citadel.css" rel="stylesheet"/>
-
-<script id="template_Login" type="text/template">
-    <div class="panel">
-        <form id="FormLogin" method="post"><label>Login</label>
-            <input id="name" type="text" name="user" required placeholder="Username">
-            <input id="pass" type="password" name="pass" required placeholder="Password">
-            <input id="email" type="email" name="email" placeholder="eMail">
-            <input type="button" value="Submit" id="PostLogin" onclick="userLogin()">
-        </form>
-    </div>
-</script>
-
-<script id="template_User" type="text/template">
-    <div class="panel">
-        <form id="FormPassword" method="post"><label>Change Password</label>
-            <input id="pass1" type="password" name="pass1" autocomplete="off" required placeholder="New Password">
-            <input id="pass2" type="password" name="pass2" autocomplete="off" required placeholder="Confirm">
-            <input type="button" value="Submit" onclick="userPassword()">
-        </form>
-    </div>
-</script>
-<script src="citadel.js"></script>
+<meta name="generator" content="Citadel PHP">
+<link rel="icon" type="image/x-icon" href="http://www.riky.net/static/ico/favicon.ico">
+<link rel="stylesheet" type="text/css" href="citadel.css">
+<script type="text/javascript" src="citadel.js"></script>
 </head>
 <body>
     <div id="messanger"></div>
-	<div id="logo"></div>
+    <div id="logo"></div>
     <div id="content"></div>
-
     <div id="feed">
         <div class="panel">
             <div class="panel-heading">
         </script>
     </div>
 <br>
-
+<script id="template_Login" type="text/template">
+    <div id="divLogin" class="panel">
+        <form id="FormLogin" method="post"><label id="login">Login</label>
+            <input id="name" type="text" name="user" required placeholder="Username">
+            <input id="pass" type="password" name="pass" required placeholder="Password">
+            <input id="email" type="email" name="email" placeholder="eMail">
+            <input type="button" value="▶" id="PostLogin" onclick="userLogin()">
+        </form>
+    </div>
+</script>
+<script id="template_User" type="text/template">
+    <div id="divUser" class="panel">
+        <form id="FormPassword" method="post"><label id="changePassword">Change Password</label>
+            <input id="pass1" type="password" name="pass1" autocomplete="off" required placeholder="New Password">
+            <input id="pass2" type="password" name="pass2" autocomplete="off" required placeholder="Confirm">
+            <input type="button" value="▶" onclick="userPassword()">
+        </form>
+    </div>
+</script>
 </body>
 </html>