[Phpfreechat-svn] SF.net SVN: phpfreechat: [471] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ne...@us...> - 2006-04-25 10:15:48
|
Revision: 471 Author: nemako Date: 2006-04-25 03:15:32 -0700 (Tue, 25 Apr 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=471&view=rev Log Message: ----------- Change in the admin interface. Add language choose. Modified Paths: -------------- trunk/admin/inc.conf.php trunk/admin/index.php trunk/i18n/en_US/admin.php trunk/i18n/fr_FR/admin.php trunk/src/pfci18n.class.php Modified: trunk/admin/inc.conf.php =================================================================== --- trunk/admin/inc.conf.php 2006-04-25 07:51:34 UTC (rev 470) +++ trunk/admin/inc.conf.php 2006-04-25 10:15:32 UTC (rev 471) @@ -1,4 +1,4 @@ <?php session_start(); -$lang = isset($_GET["lang"]) ? $_GET["lang"] : (isset($_SESSION["lang"]) ? $_SESSION["lang"] : "en_US" ); $_SESSION["lang"] = $lang; +$lang = isset($_POST["lang"]) ? $_POST["lang"] : (isset($_SESSION["lang"]) ? $_SESSION["lang"] : "en_US" ); $_SESSION["lang"] = $lang; ?> \ No newline at end of file Modified: trunk/admin/index.php =================================================================== --- trunk/admin/index.php 2006-04-25 07:51:34 UTC (rev 470) +++ trunk/admin/index.php 2006-04-25 10:15:32 UTC (rev 471) @@ -4,7 +4,6 @@ require_once("inc.conf.php"); pfcI18N::Init($lang,"admin"); - # version class require_once("version.class.php"); $version = new version(); @@ -18,41 +17,63 @@ <div class="content"> <h2><?php echo _pfc("Administration"); ?></h2> -<?php -if ($version->getPFCOfficialCurrentVersion()==0){ -?> - <div><h3><?php echo _pfc("Internet connection is not possible"); ?></h3> + <div><h3><?php echo _pfc("Available Languages"); ?></h3> <ul> - <li><?php echo _pfc("PFC version"); ?> : <?php echo $version->getLocalVersion(); ?></li> + <li><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> + <select name="lang"> + <?php + $available_admin_lang = pfcI18N::GetAcceptedAdminLanguage(); + for($i=0;$i<count($available_admin_lang);$i++) { + if ($lang==$available_admin_lang[$i]) + $selected ="selected=\"selected\""; + else + $selected =""; + echo "<option value=\"$available_admin_lang[$i]\" $selected>$available_admin_lang[$i]</option>"; + } + ?> + </select> + <input type="submit" name="submit" value="Ok"/> + </form> + </li> </ul> </div> -<?php -} -elseif (($version->getLocalVersion())==($version->getPFCOfficialCurrentVersion())){ -?> - <div class="ok"><h3><img src="style/check_on.png" alt="<?php echo _pfc("PFC is update"); ?>"> <?php echo _pfc("PFC is update"); ?></h3> + <div><h3><?php echo _pfc("PFC version verification"); ?></h3> + <?php + if ($version->getPFCOfficialCurrentVersion()==0){ + ?> <ul> + <li><?php echo _pfc("Internet connection is not possible"); ?></li> <li><?php echo _pfc("PFC version"); ?> : <?php echo $version->getLocalVersion(); ?></li> </ul> </div> -<?php -} -else{ -?> - <div class="ko"><h3><img src="style/check_off.png" alt="<?php echo _pfc("PFC is not update"); ?>"> <?php echo _pfc("PFC is not update"); ?></h3> + <?php + } + elseif (($version->getLocalVersion())==($version->getPFCOfficialCurrentVersion())){ + ?> <ul> + <li><span style="color:#339933;"><img src="style/check_on.png" alt="<?php echo _pfc("PFC is update"); ?>"> <?php echo _pfc("PFC is update"); ?></span></li> + <li><?php echo _pfc("PFC version"); ?> : <?php echo $version->getLocalVersion(); ?></li> + </ul> + + <?php + } + else{ + ?> + <ul> + <li><span style="color:#FF0000;"><img src="style/check_off.png" alt="<?php echo _pfc("PFC is not update"); ?>"> <?php echo _pfc("PFC is not update"); ?></span></li> <li><?php echo _pfc("Your version"); ?> : <?php echo $version->getLocalVersion(); ?></li> <li><?php echo _pfc("The last official version"); ?> : <?php echo $version->getPFCOfficialCurrentVersion(); ?></li> <li><?php echo _pfc("Download the last version %s here %s.","<a href=\"http://sourceforge.net/project/showfiles.php?group_id=158880\">","</a>"); ?></li> </ul> - </div> <?php } -?> +?> + </div> + </div> <?php Modified: trunk/i18n/en_US/admin.php =================================================================== --- trunk/i18n/en_US/admin.php 2006-04-25 07:51:34 UTC (rev 470) +++ trunk/i18n/en_US/admin.php 2006-04-25 10:15:32 UTC (rev 471) @@ -26,15 +26,19 @@ * @author Nemako <fr...@ne...> */ +$GLOBALS["i18n"]["lang"] = "English"; + // admin/index.php $GLOBALS["i18n"]["Administration"] = "Administration"; +$GLOBALS["i18n"]["Available Languages"] = "Available Languages"; +$GLOBALS["i18n"]["PFC version verification"] = "PFC version verification"; $GLOBALS["i18n"]["Internet connection is not possible"] = "Internet connection is not possible"; $GLOBALS["i18n"]["PFC is update"] = "PFC is update"; $GLOBALS["i18n"]["PFC version"] = "PFC version"; $GLOBALS["i18n"]["The last official version"] = "The last official version"; $GLOBALS["i18n"]["PFC is not update"] = "PFC is not update"; $GLOBALS["i18n"]["Your version"] = "Your version"; -$GLOBALS["i18n"]["Download the last version %s here %s."] = "Télécharger la dernière version %s ici %s."; +$GLOBALS["i18n"]["Download the last version %s here %s."] = "Download the last version %s here %s."; // admin/user.php Modified: trunk/i18n/fr_FR/admin.php =================================================================== --- trunk/i18n/fr_FR/admin.php 2006-04-25 07:51:34 UTC (rev 470) +++ trunk/i18n/fr_FR/admin.php 2006-04-25 10:15:32 UTC (rev 471) @@ -26,10 +26,14 @@ * @author Stephane Gully <ste...@gm...> */ +$GLOBALS["i18n"]["lang"] = "Français"; + // admin/index.php $GLOBALS["i18n"]["Administration"] = "Administration"; +$GLOBALS["i18n"]["Available Languages"] = "Langues disponibles"; +$GLOBALS["i18n"]["PFC version verification"] = "Verification de la version de PFC"; $GLOBALS["i18n"]["Internet connection is not possible"] = "La connexion à Internet n'est pas possible"; -$GLOBALS["i18n"]["PFC is update"] = "PFC est pas à jour"; +$GLOBALS["i18n"]["PFC is update"] = "PFC est à jour"; $GLOBALS["i18n"]["PFC version"] = "version de PFC"; $GLOBALS["i18n"]["The last official version"] = "La dernière version officielle"; $GLOBALS["i18n"]["PFC is not update"] = "PFC n'est pas à jour"; Modified: trunk/src/pfci18n.class.php =================================================================== --- trunk/src/pfci18n.class.php 2006-04-25 07:51:34 UTC (rev 470) +++ trunk/src/pfci18n.class.php 2006-04-25 10:15:32 UTC (rev 471) @@ -35,8 +35,12 @@ { function Init($language,$type='main') { + if ($type=="admin") + if (!in_array($language, pfcI18N::GetAcceptedAdminLanguage())) + $language = pfcI18N::GetDefaultLanguage(); if (!in_array($language, pfcI18N::GetAcceptedLanguage())) $language = pfcI18N::GetDefaultLanguage(); + if ($type=="admin") require_once(dirname(__FILE__)."/../i18n/".$language."/admin.php"); else @@ -90,6 +94,27 @@ } return $GLOBALS["accepted_languages"]; } + + /** + * Return the language list supported bye i18n system + * (content of the i18n directory) + */ + function GetAcceptedAdminLanguage() + { + if (isset($GLOBALS["accepted_admin_languages"])) + return $GLOBALS["accepted_admin_languages"]; // restore the cached languages list + $GLOBALS["accepted_admin_languages"] = array(); + $dir_handle = opendir(dirname(__FILE__)."/../i18n"); + while (false !== ($file = readdir($dir_handle))) + { + // skip . and .. generic files + // skip also .svn directory + if ($file == "." || $file == ".." || preg_match("/^\..*/", $file)) continue; + if (file_exists(dirname(__FILE__)."/../i18n/".$file."/admin.php")) + $GLOBALS["accepted_admin_languages"][] = $file; + } + return $GLOBALS["accepted_admin_languages"]; + } /** * Parse the source-code and update the i18n ressources files This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |