add language flags + js for activating them

This commit is contained in:
Quitta 2013-06-28 18:10:02 +02:00
parent 197457c356
commit 6df401280a
8 changed files with 48 additions and 11 deletions

View file

@ -69,7 +69,7 @@ class Users{
* @takes $username * @takes $username
* @return string Info: Returns a string based on if the username is valid, if valid then "success" is returned * @return string Info: Returns a string based on if the username is valid, if valid then "success" is returned
*/ */
public function checkUser( $username ) private function checkUser( $username )
{ {
if ( isset( $username ) ){ if ( isset( $username ) ){
if ( strlen( $username ) > 12 ){ if ( strlen( $username ) > 12 ){
@ -89,6 +89,31 @@ class Users{
return "fail"; return "fail";
} }
/**
* Function checkUserAlreadyExists
*
* @takes $username
* @return string Info: Returns true or false if the user is in the lib+shard db.
*
private function checkUserAlreadyExists( $username )
{
global $cfg;
$dbl = new DBLayer($cfg['db']['lib']);
$dbs = new DBLayer($cfg['db']['shard']);
try{
if ($this->dbl->execute("SELECT * FROM user WHERE Login = :name",array('name' => $username))->rowCount()){
return true;
}
if ($this->dbs->execute("SELECT * FROM user WHERE Login = :name",array('name' => $username))->rowCount()){
return true;
}
return false;
}catch (PDOException $e) {
//in case one of them is offline let it be hanled lateron with the
return true;
}
}*/
/** /**
* Function checkPassword * Function checkPassword
@ -96,7 +121,7 @@ class Users{
* @takes $pass * @takes $pass
* @return string Info: Returns a string based on if the password is valid, if valid then "success" is returned * @return string Info: Returns a string based on if the password is valid, if valid then "success" is returned
*/ */
public function checkPassword( $pass ) private function checkPassword( $pass )
{ {
if ( isset( $pass ) ){ if ( isset( $pass ) ){
if ( strlen( $pass ) > 20 ){ if ( strlen( $pass ) > 20 ){
@ -119,7 +144,7 @@ class Users{
* @takes $pass * @takes $pass
* @return string Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"] * @return string Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
*/ */
public function confirmPassword($pass_result) private function confirmPassword($pass_result)
{ {
if ( ( $_POST["Password"] ) != ( $_POST["ConfirmPass"] ) ){ if ( ( $_POST["Password"] ) != ( $_POST["ConfirmPass"] ) ){
return "Passwords do not match."; return "Passwords do not match.";
@ -140,7 +165,7 @@ class Users{
* @takes $email * @takes $email
* @return * @return
*/ */
public function checkEmail( $email ) private function checkEmail( $email )
{ {
if ( isset( $email ) ){ if ( isset( $email ) ){
if ( !Users::validEmail( $email ) ){ if ( !Users::validEmail( $email ) ){
@ -164,7 +189,7 @@ class Users{
* @takes $email * @takes $email
* @return true or false depending on if its a valid email format. * @return true or false depending on if its a valid email format.
*/ */
public function validEmail( $email ){ private function validEmail( $email ){
$isValid = true; $isValid = true;
$atIndex = strrpos( $email, "@" ); $atIndex = strrpos( $email, "@" );
if ( is_bool( $atIndex ) && !$atIndex ){ if ( is_bool( $atIndex ) && !$atIndex ){
@ -256,7 +281,7 @@ class Users{
* @takes $array with name,pass and mail * @takes $array with name,pass and mail
* @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline. * @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline.
*/ */
function createUser($values){ public function createUser($values){
try { try {
//make connection with and put into shard db //make connection with and put into shard db
global $cfg; global $cfg;
@ -277,8 +302,7 @@ class Users{
} }
} }
} }
} }

View file

@ -4,6 +4,7 @@
[home] [home]
[userlist] [userlist]
userlist_info = "welcome to the userlist"
[login] [login]
login_info = "Please login with your Username and Password." login_info = "Please login with your Username and Password."

View file

@ -4,6 +4,7 @@
[home] [home]
[userlist] [userlist]
userlist_info = "bienvenue sur le userlist page!"
[login] [login]
login_info = "S'il vous plait vous connecter avec votre nom d'utilisateur et mot de passe." login_info = "S'il vous plait vous connecter avec votre nom d'utilisateur et mot de passe."

View file

@ -19,3 +19,10 @@
.navbar { .navbar {
border-bottom: 0px; border-bottom: 0px;
} }
.flags {
display: block;
position:relative;
left:290px;
top:28px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

View file

@ -101,10 +101,14 @@
<li><a href="index.php?page=logout">Logout</a></li> <li><a href="index.php?page=logout">Logout</a></li>
</ul> </ul>
</div> </div>
<div class="btn-group pull-right">
<div class="flags">
<img src="img/en.png" onclick="document.cookie='language=en';document.location.reload(true);"/>
<img src="img/fr.png" onclick="document.cookie='language=fr';document.location.reload(true);"/>
</div>
</div>
{/if} {/if}
<!-- user dropdown ends --> <!-- user dropdown ends -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -3,7 +3,7 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="box span12"> <div class="box span12">
<div class="box-header well"> <div class="box-header well">
<h2><i class="icon-info-sign"></i>User List</h2> <h2><i class="icon-info-sign"></i>{$userlist_info}</h2>
<div class="box-icon"> <div class="box-icon">
<a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a> <a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a> <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>