From 473703c19fa6462813a941c49cf2989950c5835e Mon Sep 17 00:00:00 2001
From: Botanic <devnull@localhost>
Date: Sun, 16 Jun 2013 22:57:09 -0700
Subject: [PATCH] cleaned up formatting and added custom.css

---
 .../ryzom_ams/ams_lib/autoload/helpers.php    | 38 +++++------
 .../server/ryzom_ams/ams_lib/autoload/sql.php | 13 ++--
 .../ryzom_ams/ams_lib/autoload/users.php      | 25 ++++---
 .../server/ryzom_ams/ams_lib/libinclude.php   |  4 +-
 .../ryzom_ams/www/html/autoload/register.php  |  8 +--
 .../server/ryzom_ams/www/html/css/custom.css  | 17 +++++
 .../ryzom_ams/www/html/inc/add_user.php       | 14 ++--
 .../server/ryzom_ams/www/html/index_old.php   | 12 ++--
 .../server/ryzom_ams/www/html/js/charisma.js  |  2 +-
 .../ryzom_ams/www/html/templates/home.tpl     | 66 +++++++++----------
 .../ryzom_ams/www/html/templates/layout.tpl   | 16 +++--
 11 files changed, 116 insertions(+), 99 deletions(-)
 create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/css/custom.css

diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php
index 091a07c64..182f014cf 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php
@@ -1,7 +1,7 @@
 <?php
 class Helpers{
 
-    static public function loadTemplate( $template, $vars = array (), $forcelibrender = false )
+     static public function loadTemplate( $template, $vars = array (), $forcelibrender = false )
     {
          global $AMS_LIB;
          global $SITEBASE;
@@ -44,35 +44,35 @@ class Helpers{
          foreach ( $variables[$template] as $key => $value ){
              $smarty -> assign( $key, $value );
              }
-	 if($vars['permission'] == 1){
-		$inherited = "layout_admin.tpl";
-	 }else{
-	 	$inherited = "layout_user.tpl";
-	 }
-	//extends:' . $inherited .'|register.tpl
-         $smarty -> display( $template.'.tpl' );
+         if( $vars['permission'] == 1 ){
+             $inherited = "layout_admin.tpl";
+             }else{
+             $inherited = "layout_user.tpl";
+             }
+         // extends:' . $inherited .'|register.tpl
+        $smarty -> display( $template . '.tpl' );
          }
 
      static public function create_folders(){
          global $AMS_LIB;
          global $SITEBASE;
-        $arr = array( $AMS_LIB . '/ingame_templates/',
-                     $AMS_LIB . '/configs',
-                     $AMS_LIB . '/cache',
-                     $SITEBASE . '/cache/',
-                     $SITEBASE . '/templates/',
-                     $SITEBASE . '/templates_c/',
-                     $SITEBASE . '/configs'
-                     );
-        foreach ( $arr as & $value ){
+         $arr = array( $AMS_LIB . '/ingame_templates/',
+             $AMS_LIB . '/configs',
+             $AMS_LIB . '/cache',
+             $SITEBASE . '/cache/',
+             $SITEBASE . '/templates/',
+             $SITEBASE . '/templates_c/',
+             $SITEBASE . '/configs'
+             );
+         foreach ( $arr as & $value ){
              if ( !file_exists( $value ) ){
                  mkdir( $value );
                  }
-            }
+             }
 
          }
 
-    static public function check_if_game_client()
+     static public function check_if_game_client()
     {
          // if HTTP_USER_AGENT is not set then its ryzom core
         if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php
index f64122f7c..609ed8740 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php
@@ -1,11 +1,10 @@
 <?php
 class Sql{
-    
-    public function db_query( $query, $values = array() )
+
+     public function db_query( $query, $values = array() )
     {
          echo "tst";
-        }
-    
-}
-    
-    
\ No newline at end of file
+         }
+
+    }
+
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php
index d492ad109..ffac7bc8d 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php
@@ -1,6 +1,6 @@
 <?php
 class Users{
-    
+
      public function add_user(){
          // check if values exist
         if ( isset( $_POST["Username"] ) and isset( $_POST["Password"] ) and isset( $_POST["Email"] ) )
@@ -18,7 +18,7 @@ class Users{
              }
          // if all are good then create user
         if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ( isset( $_POST["TaC"] ) ) ){
-             $edit = array( 
+             $edit = array(
                 'name' => $_POST["Username"],
                  'pass' => $_POST["Password"],
                  'mail' => $_POST["Email"],
@@ -31,7 +31,7 @@ class Users{
              header( 'Location: email_sent.php' );
              exit;
              }else{
-             $pageElements = array( 
+             $pageElements = array(
                 'GAME_NAME' => variable_get( 'ryzommanage_game-name', '' ),
                  'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ),
                  'USERNAME' => $user,
@@ -44,7 +44,7 @@ class Users{
                  }else{
                  $pageElements['USERNAME_ERROR'] = 'FALSE';
                  }
-            
+
              if ( $pass != "success" ){
                  $pageElements['PASSWORD_ERROR'] = 'TRUE';
                  }else{
@@ -68,10 +68,10 @@ class Users{
              return $pageElements;
              }
          }
-    
+
     /**
      * Function checkUser
-     * 
+     *
      * @takes $username
      * @return string Info: Returns a string based on if the username is valid, if valid then "success" is returned
      */
@@ -84,7 +84,7 @@ class Users{
                  return "Username must be 5 or more characters.";
                  }elseif ( !preg_match( '/^[a-z0-9\.]*$/', $username ) ){
                  return "Username can only contain numbers and letters.";
-                 }elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array( 
+                 }elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array(
                         ':name' => $username
                          ) ) -> fetchField() ){
                  return "Username " . $username . " is in use.";
@@ -98,7 +98,7 @@ class Users{
          }
     /**
      * Function checkPassword
-     * 
+     *
      * @takes $pass
      * @return string Info: Returns a string based on if the password is valid, if valid then "success" is returned
      */
@@ -117,7 +117,7 @@ class Users{
          }
     /**
      * Function confirmPassword
-     * 
+     *
      * @takes $pass
      * @return string Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
      */
@@ -132,16 +132,16 @@ class Users{
          }
     /**
      * Function checkEmail
-     * 
+     *
      * @takes $email
-     * @return 
+     * @return
      */
      public function checkEmail( $email )
     {
          if ( isset( $email ) ){
              if ( !validEmail( $email ) ){
                  return "Email address is not valid.";
-                 }elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array( 
+                 }elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
                         ':mail' => $email
                          ) ) -> fetchField() ){
                  return "Email is in use.";
@@ -230,4 +230,3 @@ class Users{
          }
      }
 
- 
\ No newline at end of file
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
index 86e7d3dbf..0d8606488 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
@@ -3,6 +3,6 @@
 // Base include file for library functions for AMS
 // ***********************************************
 function __autoload( $className ){
-     require_once 'autoload/' . strtolower ($className) . '.php';
-    }
+     require_once 'autoload/' . strtolower ( $className ) . '.php';
+     }
 
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/autoload/register.php b/code/ryzom/tools/server/ryzom_ams/www/html/autoload/register.php
index 3821ccc3d..668b6a7a5 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/autoload/register.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/autoload/register.php
@@ -16,7 +16,7 @@ if ( isset( $_POST["Username"] ) and isset( $_POST["Password"] ) and isset( $_PO
      }
  // if all are good then create user
 if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ( isset( $_POST["TaC"] ) ) ){
-     $edit = array( 
+     $edit = array(
         'name' => $_POST["Username"],
          'pass' => $_POST["Password"],
          'mail' => $_POST["Email"],
@@ -29,7 +29,7 @@ if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success"
      header( 'Location: email_sent.php' );
      exit;
      }else{
-     $pageElements = array( 
+     $pageElements = array(
         'GAME_NAME' => $GAME_NAME,
          'WELCOME_MESSAGE' => $WELCOME_MESSAGE,
          'USERNAME' => $user,
@@ -42,7 +42,7 @@ if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success"
          }else{
          $pageElements['USERNAME_ERROR'] = 'FALSE';
          }
-    
+
      if ( $pass != "success" ){
          $pageElements['PASSWORD_ERROR'] = 'TRUE';
          }else{
@@ -64,7 +64,7 @@ if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success"
          $pageElements['TAC_ERROR'] = 'TRUE';
          }
      if ( helpers :: check_if_game_client() ){
-        helpers :: loadtemplate( '../../ams_lib/ingame_templates/register.phtml', $pageElements );
+         helpers :: loadtemplate( '../../ams_lib/ingame_templates/register.phtml', $pageElements );
          }else{
          helpers :: loadtemplate( 'templates/register.phtml', $pageElements );
          }
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/css/custom.css b/code/ryzom/tools/server/ryzom_ams/www/html/css/custom.css
new file mode 100644
index 000000000..fe0debbf4
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/css/custom.css
@@ -0,0 +1,17 @@
+.login-header
+{
+	height:190px;
+}
+
+.brand img
+{
+	height:100%;
+	margin-bottom:-18px;
+	margin-top:-15px;
+	width:100%;
+}
+
+#for-is-ajax
+{
+	display:none;
+}
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php
index 4010619f7..41284659e 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php
@@ -1,12 +1,12 @@
 <?php
 function add_user(){
-    
-    // add user locally here
+
+     // add user locally here
     $return = users :: add_user();
-    return $return;
-    }
+     return $return;
+     }
 
 function checkUser(){
-    
-    
-    }
+
+
+     }
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index_old.php b/code/ryzom/tools/server/ryzom_ams/www/html/index_old.php
index 62d4ffabf..5b867439f 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/index_old.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/index_old.php
@@ -6,18 +6,18 @@ require( '../../ams_lib/libinclude.php' );
 if ( isset( $_POST["function"] ) ){
      require( "inc/" . $_POST["function"] . ".php" );
      $return = $_POST["function"]();
-    }
+     }
 
 function loadpage ( $page ){
      require_once( 'autoload/' . $page . '.php' );
-    }
+     }
 
 $page = 'home';
 if ( isset( $_GET["page"] ) ){
      $page = $_GET["page"];
-    }
-    
-//temporary set permission to 1 which = admin mode
-$return =  array('permission' => 1, 'no_visible_elements' => 'TRUE');
+     }
+
+// temporary set permission to 1 which = admin mode
+$return = array( 'permission' => 1, 'no_visible_elements' => 'TRUE' );
 
 helpers :: loadTemplate( $page , $return );
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/js/charisma.js b/code/ryzom/tools/server/ryzom_ams/www/html/js/charisma.js
index 6445ef69a..579174176 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/js/charisma.js
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/js/charisma.js
@@ -1,7 +1,7 @@
 $(document).ready(function(){
 	//themes, change CSS with JS
 	//default theme(CSS) is cerulean, change it if needed
-	var current_theme = $.cookie('current_theme')==null ? 'spacelab' :$.cookie('current_theme');
+	var current_theme = $.cookie('current_theme')==null ? 'cerulean' :$.cookie('current_theme');
 	switch_theme(current_theme);
 	
 	$('#themes a[data-value="'+current_theme+'"]').find('i').addClass('icon-ok');
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl
index adbb04939..ae7cabbfa 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl
@@ -11,7 +11,7 @@
 					<span class="icon-bar"></span>
 				</a>
 				<a class="brand" href="index.php"> <img alt="Charisma Logo" src="img/mainlogo.png"></a>
-				
+
 				<!-- theme selector starts -->
 				<div class="btn-group pull-right theme-container">
 					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@@ -31,7 +31,7 @@
 					</ul>
 				</div>
 				<!-- theme selector ends -->
-				
+
 				<!-- user dropdown starts -->
 				<div class="btn-group pull-right">
 					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@@ -45,7 +45,7 @@
 					</ul>
 				</div>
 				<!-- user dropdown ends -->
-				
+
 
 			</div>
 		</div>
@@ -53,7 +53,7 @@
 	<!-- topbar ends -->
 		<div class="container-fluid">
 		<div class="row-fluid">
-				
+
 			<!-- left menu starts -->
 			<div class="span2 main-menu-span">
 				<div class="well nav-collapse sidebar-nav">
@@ -67,17 +67,17 @@
 				</div><!--/.well -->
 			</div><!--/span-->
 			<!-- left menu ends -->
-			
+
 			<noscript>
 				<div class="alert alert-block span10">
 					<h4 class="alert-heading">Warning!</h4>
 					<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> enabled to use this site.</p>
 				</div>
 			</noscript>
-			
+
 			<div id="content" class="span10">
 			<!-- content starts -->
-			
+
 
 			<div class="sortable row-fluid ui-sortable">
 				<a data-original-title="6 new members." data-rel="tooltip" class="well span3 top-block" href="#">
@@ -100,7 +100,7 @@
 					<div>$13320</div>
 					<span class="notification yellow">$34</span>
 				</a>
-				
+
 				<a data-original-title="12 new messages." data-rel="tooltip" class="well span3 top-block" href="#">
 					<span class="icon32 icon-color icon-envelope-closed"></span>
 					<div>Messages</div>
@@ -108,7 +108,7 @@
 					<span class="notification red">12</span>
 				</a>
 			</div>
-			
+
 			<div class="row-fluid">
 				<div class="box span12">
 					<div class="box-header well">
@@ -123,15 +123,15 @@
 						<h1>Charisma <small>free, premium quality, responsive, multiple skin admin template.</small></h1>
 						<p>Its a live demo of the template. I have created Charisma to ease the repeat work I have to do on my projects. Now I re-use Charisma as a base for my admin panel work and I am sharing it with you :)</p>
 						<p><b>All pages in the menu are functional, take a look at all, please share this with your followers.</b></p>
-						
+
 						<div class="clearfix"></div>
 					</div>
 				</div>
 			</div>
-					
+
 			<div class="row-fluid sortable ui-sortable">
 
-						
+
 				<div class="box span4">
 					<div class="box-header well" data-original-title="">
 						<h2><i class="icon-user"></i> Member Activity</h2>
@@ -149,7 +149,7 @@
 										<strong>Name:</strong> <a href="#">Usman
 									</a><br>
 									<strong>Since:</strong> 17/05/2012<br>
-									<strong>Status:</strong> <span class="label label-success">Approved</span>                                  
+									<strong>Status:</strong> <span class="label label-success">Approved</span>
 								</li>
 								<li>
 									<a href="#">
@@ -157,7 +157,7 @@
 										<strong>Name:</strong> <a href="#">Sheikh Heera
 									</a><br>
 									<strong>Since:</strong> 17/05/2012<br>
-									<strong>Status:</strong> <span class="label label-warning">Pending</span>                                 
+									<strong>Status:</strong> <span class="label label-warning">Pending</span>
 								</li>
 								<li>
 									<a href="#">
@@ -165,7 +165,7 @@
 										<strong>Name:</strong> <a href="#">Abdullah
 									</a><br>
 									<strong>Since:</strong> 25/05/2012<br>
-									<strong>Status:</strong> <span class="label label-important">Banned</span>                                  
+									<strong>Status:</strong> <span class="label label-important">Banned</span>
 								</li>
 								<li>
 									<a href="#">
@@ -173,13 +173,13 @@
 										<strong>Name:</strong> <a href="#">Saruar Ahmed
 									</a><br>
 									<strong>Since:</strong> 17/05/2012<br>
-									<strong>Status:</strong> <span class="label label-info">Updates</span>                                  
+									<strong>Status:</strong> <span class="label label-info">Updates</span>
 								</li>
 							</ul>
 						</div>
 					</div>
 				</div><!--/span-->
-						
+
 				<div class="box span8">
 					<div class="box-header well" data-original-title="">
 						<h2><i class="icon-list-alt"></i> Realtime Traffic</h2>
@@ -241,7 +241,7 @@
 						</p>
 					</div>
 				</div><!--/span-->
-					
+
 				<div class="box span4">
 					<div class="box-header well" data-original-title="">
 						<h2><i class="icon-list"></i> Buttons</h2>
@@ -278,10 +278,10 @@
 								<li><a href="#"><i class="icon-tint"></i> Separated link</a></li>
 							</ul>
 						</div>
-						
+
 					</div>
 				</div><!--/span-->
-					
+
 				<div class="box span4">
 					<div class="box-header well" data-original-title="">
 						<h2><i class="icon-list"></i> Weekly Stat</h2>
@@ -295,9 +295,9 @@
 						<ul class="dashboard-list">
 							<li>
 								<a href="#">
-									<i class="icon-arrow-up"></i>                               
+									<i class="icon-arrow-up"></i>
 									<span class="green">92</span>
-									New Comments                                    
+									New Comments
 								</a>
 							</li>
 						  <li>
@@ -311,21 +311,21 @@
 							<a href="#">
 							  <i class="icon-minus"></i>
 							  <span class="blue">36</span>
-							  New Articles                                    
+							  New Articles
 							</a>
 						  </li>
 						  <li>
 							<a href="#">
 							  <i class="icon-comment"></i>
 							  <span class="yellow">45</span>
-							  User reviews                                    
+							  User reviews
 							</a>
 						  </li>
 						  <li>
 							<a href="#">
-							  <i class="icon-arrow-up"></i>                               
+							  <i class="icon-arrow-up"></i>
 							  <span class="green">112</span>
-							  New Comments                                    
+							  New Comments
 							</a>
 						  </li>
 						  <li>
@@ -339,28 +339,28 @@
 							<a href="#">
 							  <i class="icon-minus"></i>
 							  <span class="blue">93</span>
-							  New Articles                                    
+							  New Articles
 							</a>
 						  </li>
 						  <li>
 							<a href="#">
 							  <i class="icon-comment"></i>
 							  <span class="yellow">254</span>
-							  User reviews                                    
+							  User reviews
 							</a>
 						  </li>
 						</ul>
 					</div>
 				</div><!--/span-->
 			</div><!--/row-->
-				  
 
-		  
-       
+
+
+
 					<!-- content ends -->
 			</div><!--/#content.span10-->
 				</div><!--/fluid-row-->
-				
+
 		<hr>
 
 		<div class="modal hide fade" id="myModal">
@@ -380,7 +380,7 @@
 		<footer>
 			<p class="pull-right">Powered by: <a href="http://usman.it/free-responsive-admin-template">Charisma</a></p>
 		</footer>
-		
+
 	</div><!--/.fluid-container-->
 
 {/block}
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl
index 3cda0b11b..56c8fe732 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl
@@ -51,7 +51,9 @@
 
 	<!-- The fav icon -->
 	<!--<link rel="shortcut icon" href="img/favicon.ico">-->
-		
+
+	<!--custom css file-->
+	<link href="css/custom.css" rel="stylesheet">
 </head>
 
 <body>
@@ -66,7 +68,7 @@
 					<span class="icon-bar"></span>
 				</a>
 				<a href="index.html"> <img src="img/ryzomtop.png" height="65" style="padding-left:26px;"/></a>
-				
+
 				<!-- theme selector starts -->
 				<div class="btn-group pull-right theme-container" >
 					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@@ -86,7 +88,7 @@
 					</ul>
 				</div>
 				<!-- theme selector ends -->
-				
+
 				<!-- user dropdown starts -->
 				<div class="btn-group pull-right" >
 					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@@ -117,14 +119,14 @@
 				</div><!--/.well -->
 			</div><!--/span-->
 			<!-- left menu ends -->
-			
+
 			<noscript>
 				<div class="alert alert-block span10">
 					<h4 class="alert-heading">Warning!</h4>
 					<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> enabled to use this site.</p>
 				</div>
 			</noscript>
-			
+
 			<div id="content" class="span10">
 			<!-- content starts -->
 			{/if}
@@ -231,7 +233,7 @@
 	<script src="js/jquery.history.js"></script>
 	<!-- application script for Charisma demo -->
 	<script src="js/charisma.js"></script>
-	
-	
+
+
 </body>
 </html>