Skip to content

Commit

Permalink
New Redesigned, Translatable Landing Page / New Auth Module (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcuenod authored Jun 15, 2016
1 parent e5e4580 commit 17f3f09
Show file tree
Hide file tree
Showing 39 changed files with 2,014 additions and 269 deletions.
28 changes: 28 additions & 0 deletions LangCodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @author: Cesar Hernandez
* getLanguage: This method return the name of the language according to the language code
*/
class LangCodes{
public function getLanguage($code){
$all_lang=array(
'fr_FR'=>'fr_FR',
'en_US'=>'en_US'//,
//'zh_CN'=>'zh_CN',
//'zh_TW'=>'zh_TW',
//'de_DE'=>'de_DE'
);
return $all_lang[$code];
}
public function getNameLang($code_lang){
$name_lang=array(
'fr_FR'=>'Français',
'en_US'=>'English'//,
//'zh_CN'=>'中文 (中国)',
//'zh_TW'=>'中文 (台灣)',
//'de_DE'=>'Deutsch'
);
return $name_lang[$code_lang];
}
}
?>
1 change: 1 addition & 0 deletions auth/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
admin/configuration.ini
.DS_Store
14 changes: 10 additions & 4 deletions auth/LangCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
class LangCodes{
public function getLanguage($code){
$all_lang=array(
'fr'=>'fr_FR',
'en'=>'en_US'
'fr_FR'=>'fr_FR',
'en_US'=>'en_US'//,
//'zh_CN'=>'zh_CN',
//'zh_TW'=>'zh_TW',
//'de_DE'=>'de_DE'
);
return $all_lang[$code];
}
public function getNameLang($code_lang){
$name_lang=array(
'fr'=>_('French'),
'en'=>_('English')
'fr_FR'=>'Français',
'en_US'=>'English'//,
//'zh_CN'=>'中文 (中国)',
//'zh_TW'=>'中文 (台灣)',
//'de_DE'=>'Deutsch'
);
return $name_lang[$code_lang];
}
Expand Down
36 changes: 21 additions & 15 deletions auth/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@
<title>CORAL Authentication</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/thickbox.css" type="text/css" media="screen" />
<link rel="SHORTCUT ICON" href="images/clownfishfavicon.ico" />
<link rel="SHORTCUT ICON" href="images/favicon.ico" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:100,400,300,600,700' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/plugins/jquery.js"></script>
<script type="text/javascript" src="js/plugins/thickbox.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/plugins/Gettext.js"></script>
<?php
// Add translation for the JavaScript files
global $http_lang;
$str = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
$str = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,5);
$default_l = $lang_name->getLanguage($str);
if($default_l==null || empty($default_l)){$default_l=$str;}
if(isset($_COOKIE["lang"])){
Expand All @@ -68,18 +70,20 @@

<br />

<div id="title-div">
<div id="img-title"><img src="images/authtitle.png" /></div>
<div id="text-title"><?php echo _("eRM Authentication"); ?></div>
<div class="clear"></div>
</div>

<div style="width:451px; height:91px;background-image:url('images/authtitle.gif');background-repeat:no-repeat;text-align:right;">
</div>

<div class='bordered' style='width:447px;margin-left:2px;'>
<div class='bordered' style='width:416px;'>

<br />
<div class='headerText' style='text-align: left;margin:0px 60px 3px 60px;'><?php echo _("Users")?></div>
<div class='headerText' style='text-align: left;margin:0 0 3px 60px;'><?php echo _("Users")?></div>
<div class='smallDarkRedText' style='margin-bottom:5px;'>* <?php echo _("Login ID must match the login ID set up in the modules")?></div>


<div style='text-align:left;margin:0px 60px 60px 60px;' id='div_users'>
<div style='text-align:left;margin:0px 60px 60px 38px;' id='div_users'>
<br />
<br />
<img src='images/circle.gif'> <span style='font-size:90%'><?php echo _("Processing...")?></span>
Expand All @@ -105,29 +109,29 @@
echo "<br>"._("Invalid translation route!");
}
// Get language of navigator
$defLang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
$defLang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,5);

// Show an ordered list
sort($lang);
for($i=0; $i<count($lang); $i++){
if(isset($_COOKIE["lang"])){
if($_COOKIE["lang"]==$lang[$i]){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang(substr($lang[$i],0,2))."</option>";
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,2))."</option>";
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}
}else{
if($defLang==substr($lang[$i],0,2)){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang(substr($lang[$i],0,2))."</option>";
if($defLang==substr($lang[$i],0,5)){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,2))."</option>";
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}
}
}
?>
</select>
</div>
<div class='smallerText' style='text-align:center; margin-top:13px;'><a href='index.php'><?php echo _("Login page")?></a></div>
<div class='smallerText' style='text-align:center; margin-top:13px;'><a href='index.php' id='login-link'><?php echo _("Login page")?></a></div>


</form>
Expand Down Expand Up @@ -169,8 +173,10 @@ function setLanguage(lang) {

if (isset($user) && $user->getOpenSession()){
header('Location: index.php?service=admin.php&invalid');
exit; //PREVENT SECURITY HOLE
}else{
header('Location: index.php?service=admin.php&admin');
exit; //PREVENT SECURITY HOLE
}
}

Expand Down
2 changes: 1 addition & 1 deletion auth/ajax_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</table>

<br />
<table class='noBorderTable' style='width:125px; margin:0 auto;'>
<table class='noBorderTable' style='width:125px;'>
<tr>
<td style='text-align:left;'><input type='button' value='<?php echo _("submit");?>' id ='submitUser' class='submitButton' /></td>
<td style='text-align:right;'><input type='button' value='<?php echo _("cancel");?>' onclick="window.parent.tb_remove(); return false;" class='submitButton' /></td>
Expand Down
2 changes: 1 addition & 1 deletion auth/ajax_htmldata.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

if (count($usersArray) > 0){
?>
<table class='linedDataTable' style='width:327px;'>
<table class='linedDataTable' style='width:340px;'>
<tr>
<th>Login ID</th>
<th>Admin?</th>
Expand Down
Loading

0 comments on commit 17f3f09

Please sign in to comment.