From: Neil S. <sir...@us...> - 2003-08-13 02:53:02
|
CVSROOT : /cvsroot/publicdnsadmin Module : publicdnsadmin Commit time: 2003-08-13 02:47:23 UTC Modified files: index.php login.php docs/CHANGELOG docs/TODO lib/config.php-dist lib/header.php Added files: language/index.html language/index.php language/lang-english.php Log message: Author: SiRVulcaN <sir...@si...> Log message: - Added in first stage of multilanguage support. ---------------------- diff included ---------------------- Index: publicdnsadmin/docs/CHANGELOG diff -u publicdnsadmin/docs/CHANGELOG:1.32 publicdnsadmin/docs/CHANGELOG:1.33 --- publicdnsadmin/docs/CHANGELOG:1.32 Tue Aug 12 15:44:25 2003 +++ publicdnsadmin/docs/CHANGELOG Tue Aug 12 19:47:13 2003 @@ -17,3 +17,4 @@ - Copied index.html as index.php just in case. - Added index.(html|php) in images/docs/lib SiRVulcaN <sir...@si...> - 13/08/2003 - Fixed up some hardcoded addresses in signup.php and forgotten_pass.php + - Added in first stage of multilanguage support. Index: publicdnsadmin/docs/TODO diff -u publicdnsadmin/docs/TODO:1.15 publicdnsadmin/docs/TODO:1.16 --- publicdnsadmin/docs/TODO:1.15 Tue Aug 12 02:06:52 2003 +++ publicdnsadmin/docs/TODO Tue Aug 12 19:47:13 2003 @@ -7,6 +7,6 @@ - ERR_TYPE, ie ERR_INVPASS (invalid pass) - TYPE as in "general", "error", "critical" etc, each type has diff types of output styles - multilanguage, use a code based system like the error codes which read off a file, lang.XX.php, then combine errors into the language file - -- language table (language codes) "1" "English", users choose the code in config for default lang - - users can choose to use another lang when opening the main page + > First Stage Complete. + - Adjust all files to use _VARS from the language files instead of the sentences/words. - install.php - databases + configuration Index: publicdnsadmin/index.php diff -u publicdnsadmin/index.php:1.8 publicdnsadmin/index.php:1.9 --- publicdnsadmin/index.php:1.8 Sat Jul 19 06:46:31 2003 +++ publicdnsadmin/index.php Tue Aug 12 19:47:13 2003 @@ -154,6 +154,29 @@ <td><b>Password:</b></td> <td><input type="password" name="password" size="25" maxlength="15" value=""></td> </tr> +<tr><td> +<? +echo "<b>Language:</b></td><td><select name='language'>"; +$handle=opendir('language'); +while ($file = readdir($handle)) { + if (ereg("^lang\-(.+)\.php", $file, $matches)) { + $langFound = $matches[1]; + $languageslist .= "$langFound "; + } +} +closedir($handle); +$languageslist = explode(" ", $languageslist); +sort($languageslist); +for ($i=0; $i < sizeof($languageslist); $i++) { + if($languageslist[$i]!="") { + echo "<option name='language' value='$languageslist[$i]' "; + if($languageslist[$i]==$language) echo "selected"; + echo ">".ucfirst($languageslist[$i])."\n"; + } +} +echo "</select></td>" +?> +</tr> <? if ($SHOW_GFXUSRCHK && $LOGIN_GFXCHECK) { ?> Index: publicdnsadmin/language/index.html diff -u /dev/null publicdnsadmin/language/index.html:1.1 --- /dev/null Tue Aug 12 19:47:23 2003 +++ publicdnsadmin/language/index.html Tue Aug 12 19:47:13 2003 @@ -0,0 +1,9 @@ +<html> + <head> + <title>Access Denied</title> + <meta http-equiv="REFRESH" content="0; url=../index.php"> + </head> + <body> + you shouldnt be here :) + </body> +</html> Index: publicdnsadmin/language/index.php diff -u /dev/null publicdnsadmin/language/index.php:1.1 --- /dev/null Tue Aug 12 19:47:23 2003 +++ publicdnsadmin/language/index.php Tue Aug 12 19:47:13 2003 @@ -0,0 +1,9 @@ +<html> + <head> + <title>Access Denied</title> + <meta http-equiv="REFRESH" content="0; url=../index.php"> + </head> + <body> + you shouldnt be here :) + </body> +</html> Index: publicdnsadmin/language/lang-english.php diff -u /dev/null publicdnsadmin/language/lang-english.php:1.1 --- /dev/null Tue Aug 12 19:47:23 2003 +++ publicdnsadmin/language/lang-english.php Tue Aug 12 19:47:13 2003 @@ -0,0 +1,237 @@ +<? + +/***************************************************************************/ +/* Public DNS Administator (English Language File) */ +/* Translator: PublicDNSAdmin Team <http://publicdnsadmin.sourceforge.net> */ +/* */ +/* Distributed under the GPL license, see LICENSE for */ +/* more information */ +/* */ +/* ======================================================================= */ +/* */ +/* If you made a translation, please send it to sir...@si... */ +/* */ +/* You need to change the second quoted phrase, not the capital one! */ +/* */ +/* If you need to use double quotes (") remember to add a backslash (\), */ +/* so your entry will look like: This is \"double quoted\" text. */ +/* And, if you use HTML code, please double check it. */ +/* */ +/***************************************************************************/ + + +define("_OCCURANCES","Any occurences of \$DOMAIN in the fields below will be replaced with the actual domain name when the template is used on a new domain"); +define("_REGGEDAS","You are now registered as"); +define("_EMAILDETAILS","a email has been sent containing your details"); +define("_REGGEDWITH","You are now registered with PublicDNSAdmin"); +define("_BRUSERNAME","<br><br>Username:"); +define("_BRPASSWORD","<Br>Password:"); +define("_PASSWORDFOR","Your password for"); +define("_IS","is"); +define("_LOGINANDCHANGE","Please login and change it ASAP.<br><br>DNS Administrator"); +define("_EACHDOMAIN","NOTE: Each Domain must use "); +define("_AND","and"); +define("_FORITSNS","its nameservers, signup will be denied if the domains dont match to"); +define("_MYDOMAINS","My domains"); +define("_CRITERIA","Criteria"); +define("_SEARCH","Search"); +define("_UNKNOWN","Unknown"); +define("_DELZONE","Delete zone"); +define("_WHOISDOM","WHOIS Domain"); +define("_NOZONES","No zones available"); +define("_INVLOGINGFX","Login failed: invalid username/password/gfx code"); +define("_INVLOGIN","Login failed: invalid username/password"); +define("_LOGGEDOUT","You have been logged out"); +define("_USERNAME","Username"); +define("_PASSWORD","Password"); +define("_SECCHECK","Security Check"); +define("_RESET","Reset"); +define("_LOGIN","Login"); +define("_RECORD","Record"); +define("_TYPE","Type"); +define("_PRIO","Prio"); +define("_CONTENT","Content"); +define("_TTL","TTL"); +define("_TEMPLATENOTFND","Template not found"); +define("_DELTEMPLATE","Delete template"); +define("_ALLRECDEL","and all records was successfully deleted"); +define("_WISHTODELTEMPLATE","Are you sure you wish to delete the template"); +define("_YES","Yes"); +define("_NO","No"); +define("_EDITTEMPLATE","Edit template"); +define("_NEWRECORD","new record"); +define("_DELMULTIRECORDS","delete multiple records"); +define("_DELRECORD","delete record"); +define("_EDITRECORD","edit record"); +define("_EDITDOMAIN","Edit domain"); +define("_USERADMIN","User administration"); +define("_USERLIST","user list"); +define("_NEWUSER","new user"); +define("_EDITUSER","edit user"); +define("_DELETEDOM","Delete domain"); +define("_THEDOMAIN","The domain"); +define("_ANDALLRECSDEL","and all records was successfully deleted"); +define("_WISHTODELTHEDOM","Are you sure you wish to delete the domain"); +define("_NOPERMSDOMAIN","You don't have permission to delete this domain"); +define("_DELETEUSER","Delete user"); +define("_FTUSERDONTEXIST","Fatal Error, User Does Not Exist Most Likely"); +define("_ANDALLDOMRECDEL","and all their domains/records were successfully deleted"); +define("_WISHTODEL","Are you sure you wish to delete"); +define("_EDITSETTINGS","Edit Settings"); +define("_RECSUCESDEL","The record was successfully deleted"); +define("_PROCEED","Proceed"); +define("_NEWTEMPLATE","New template"); +define("_NEWRECORD","New record"); +define("_NAME","Name"); +define("_CREATE","Create"); +define("_FORGOTTENPASS","Forgotten Pass"); +define("_INVUSEROREMAIL","Invalid username or email address"); +define("_EMAILADDRESS","Email Address"); +define("_ONEINRECORDS","The one we have in records"); +define("_EMAILSENT","Email Has Been Sent"); +define("_WISHTODELTHISREC","Are you sure you wish to delete the record"); +define("_NOPERMSDELREC","You don't have permission to delete this record"); +define("_NOPERMSEDITDOM","You don't have permission to edit this domain"); +define("_ZONEUSERS","Zone users"); +define("_NOUSERSACCDOM","No users have access to this domain"); +define("_ZONENOTFND","Zone not found"); +define("_STATISTICS","Statistics"); +define("_DOMAINSHOSTED","Domains Hosted"); +define("_TOTALRECORDS","Total Records"); +define("_TOTALUSERS","Total Users"); +define("_EDITDOMAIN","Edit domain"); +define("_SHOWZONE","Show zone users"); +define("_GRANTUSERACC","Grant user access"); +define("_PRIORITY","Priority"); +define("_TTL","TTL"); +define("_DEL","Del"); +define("_TEMPRECNOTFND","Template/record not found"); +define("_ALLRECNOTDEL","Some records could not be deleted, please check make sure you have permission to access/delete them"); +define("_SOME","Some"); +define("_ALL","All"); +define("_SELECTTEMPDEL","selected template records were successfully deleted"); +define("_TOPLEVELDOMNOTSUP","Sorry but this top level domain is not \(yet\) supported"); +define("_CONNECTINGTO","Connecting to "); +define("_TIMEDOUT","Timed-out connecting to"); +define("_PORT","port"); +define("_WHOISSERVER","Whois Server"); +define("_NOMATCH","NOT FOUND: No match for"); +define("_AMBIGUOUS","Ambiguous query, multiple matches for"); +define("_DEFERRED","Deferred to specific whois server"); +define("_DOMIDNOTFND","Domain id not found"); +define("_ALREADYHASUSERNAME","You Already Have A Username"); +define("_SIGNUPSDISABLED","New user signups are disabled, see an Administrator for further info"); +define("_DIDNTAGREETERMS","You Didnt Agree To The Terms and Conditions"); +define("_PASSWORDSDONTMATCH","The Passwords Entered Dont Match"); +define("_INVPASSWORD","Invalid password. May only contain characters a to z, dash, and numbers"); +define("_INVUSERNAME","Invalid username. Can only contain characters a to z and dash"); +define("_INVEMAILADDY","Invalid Email Address"); +define("_INVGFXCODE","Invalid GFX Code"); +define("_USERNAMEXISTS","Username Already Exists"); +define("_NAMESERVERSDONTPOINT","Nameservers Do Not Point To"); +define("_OR","or"); +define("_DOMAINEXISTS","The following domains already exists"); +define("_NEWACCOUNTCREATED","New PublicDNSAdmin Account Created"); +define("_DOMAINSADDEDIN","The following domains have been added in your account"); +define("_SOMEDOMAINSINVALID","One or more of the domains were invalid"); +define("_REQUESTEDPASS","Requested PublicDNSAdmin Password"); +define("_CONFIRM","Confirm"); +define("_CONFIRMPASSWORD","Confirm password"); +define("_REALNAME","Real Name"); +define("_COMPANY","Company"); +define("_DOMAINS","Domains"); +define("_DOMAIN","Domain"); +define("_TEMPLATE","Template"); +define("_CREATE","Create"); +define("_PERMISSIONS","Permissions"); +define("_SUPERUSER","Superuser"); +define("_NEWDOMAINS","New domains"); +define("_NEWTEMPLAYES","New templates"); +define("_EDITOWNDOMS","Edit own domains"); +define("_EDITOTHERDOMS","Edit other domains"); +define("_EDITTEMPS","Edit templates"); +define("_DELOWNDOMS","Delete own domains"); +define("_DELOTHERDOMS","Delete other domains"); +define("_DELTEMPS","Delete templates"); +define("_SIGNUPCOMPLETE","PublicDNSAdmin Signup Complete"); +define("_SUCESSSIGNEDUP","has successfully signed up for DNS hosting"); +define("_DOYOUAGREE","Do You Agree To The"); +define("_TERMSANDCOND","Terms And Conditions"); +define("_DELETEUSER","Delete User"); +define("_NOUSERSFND","No users found"); +define("_GRANTZONEACCESS","Grant zone access"); +define("_THEUSER","The user"); +define("_GRANTEDACCESS","was granted access to the domain"); +define("_USERNOTFND","User not found"); +define("_NOTEMPNAMEDEFINED","No template name defined"); +define("_TEMPLATEEXISTS","Another template with the same name already exists"); +define("_TEMPLATEUPDATED","The template was updated"); +define("_MYTEMPLATES","My templates"); +define("_DELTEMPLATE","Delete template"); +define("_NOTEMPLATESAVAL","No templates available"); +define("_INVALIDPOINTTYPE","Invalid pointer type"); +define("_INVALIDPOINTCONT","Invalid content for pointer type"); +define("_INVALIDPOINTREC","Invalid record data for pointer type"); +define("_NOPERMSEDITDOM","You don't have permission to edit this domain"); +define("_ZONERECNOTFND","Zone/record not found"); +define("_BULKREG","Bulk registration"); +define("_ONEDOMPERLINE","Type in one domain on each line"); +define("_NOTEMPSAVAIL","No templates are available. Please create a template"); +define("_BACKUPCREATED","The backup was successfully created. Click here to download"); +define("_TEMPRECNOTFND","Template/record not found"); +define("_DOMAINSEARCH","Domain search"); +define("_REVOKEZONEACC","Revoke zone access"); +define("_ACCTODOM","Access to the domain"); +define("_WASREMOVED","was removed from"); +define("_SUREYOUWANTTOREV","Are you sure you want to revoke access to"); +define("_FROM","from"); +define("_SELECTUSERNODOMACC","The selected user does not have access to this domain"); +define("_USERNOTFND","User not found"); +define("_PAGEDISABLED","Page is disabled"); +define("_GDLIBUNAVAIL","GD Library not present"); +define("_GRANTZONEACC","Grant zone access"); +define("_GRANT","Grant"); +define("_ZONE","Zone"); +define("_USER","User"); +define("_CANTEDITASUPERUSER","You don't have the permission to edit a superuser"); +define("_PASSESDONTMATCH","The passwords did not match"); +define("_FIELDSMISSING","Some fields were missing. You must enter both name and e-mail"); +define("_SETTINGSUPDATED","Settings Successfully Updated"); +define("_IDSDONTMATCH","ID's do not match, dont try and cheat the system"); +define("_DOMAINSINVALID","One or more of the domains were invalid"); +define("_DOMAINSEXIST","The following domains already exists"); +define("_DOMAINSADDED","The following domains was added"); +define("_TEMPLATEUNAVAIL","The specified template does not exist"); +define("_NODOMAINS","No domain names entered"); +define("_MISSINGINVDOM","Missing or invalid domain name"); +define("_ZONECREATED","The zone was successfully created. Click"); +define("_HERE","here"); +define("_TOEDIT","to edit"); +define("_FIELDSMISSINGFILL","Some fields were missing. You must fill out the username, name, email and password-fields"); +define("_USERCREATED","The user was successfully created"); +define("_TEMPLATECREATED","The template was successfully created"); +define("_DOSNOTRESOLVE","does not resolve to"); +define("_LICENSEDUNDER","Licensed Under"); +define("_REPORTBUGS","Report Bugs To"); +define("_DBUNAVAIL","Unable to connect to database"); +define("_ACCESSDENIED","Access denied"); +define("_NOPERMSFORTASK","You don't have permission to perform the chosen task"); +define("_MYDOMAINS","My domains"); +define("_MYTEMPLATES","My templates"); +define("_NEWDOMAIN","New domain"); +define("_NEWTEMPLATE","New template"); +define("_DBBACKUP","DB backup"); +define("_SETTINGS","Settings"); +define("_NS1STATS","NS1 stats"); +define("_NS2STATS","NS2 stats"); +define("_LOGOUT","Log out"); +define("_LOGIN","Login"); +define("_SIGNUP","Signup"); +define("_FORGOTPASS","Forgotten Pass"); +define("_STATISTICS","Statistics"); +define("_TERMS","Terms"); +define("_CONTACT","Contact"); +define("_CONFIGTERMSAVAIL","config.php and/or terms.php cannot be accessed, please make sure they exist and are readable by the webserver"); +define("_LANGUAGE","Language"); + +?> Index: publicdnsadmin/lib/config.php-dist diff -u publicdnsadmin/lib/config.php-dist:1.11 publicdnsadmin/lib/config.php-dist:1.12 --- publicdnsadmin/lib/config.php-dist:1.11 Sat Jul 19 06:46:31 2003 +++ publicdnsadmin/lib/config.php-dist Tue Aug 12 19:47:13 2003 @@ -7,7 +7,7 @@ Distributed under the GPL license, see LICENSE for more information - $Id: config.php-dist,v 1.11 2003/07/19 13:46:31 sirvulcan Exp $ + $Id: config.php-dist,v 1.12 2003/08/13 02:47:13 sirvulcan Exp $ */ /* @@ -50,6 +50,9 @@ /* Restrict new user signups, admins can still add users via the interface when logged in */ $allow_newusers = 1; + +/* Default interface language (must exist in language/ dir, lang-NAME.php */ +$default_lang = "english"; /* NS Server Addresses / Access Data, You Need Webserver Enabled On PowerDNS */ $ns1addy = "ns1.server.com"; Index: publicdnsadmin/lib/header.php diff -u publicdnsadmin/lib/header.php:1.17 publicdnsadmin/lib/header.php:1.18 --- publicdnsadmin/lib/header.php:1.17 Tue Aug 12 02:06:52 2003 +++ publicdnsadmin/lib/header.php Tue Aug 12 19:47:13 2003 @@ -7,7 +7,7 @@ Distributed under the GPL license, see LICENSE for more information - $Id: header.php,v 1.17 2003/08/12 09:06:52 sirvulcan Exp $ + $Id: header.php,v 1.18 2003/08/13 02:47:13 sirvulcan Exp $ */ ?> @@ -26,6 +26,28 @@ <script language="javascript" src="functions.jss"></script> </head> <body> + +<? +$language = $_SESSION[_LANGUAGE]; +if ($language == NULL) { + $language = $default_lang; +} + +$curpath = realpath("."); +require("$curpath/lib/config.php"); +if ((file_exists("$curpath/language/lang-" . $language . ".php")) && (is_readable("$curpath/language/lang-" . $language . ".php"))) { + require("$curpath/language/lang-" . $language . ".php"); +} else { + /* Default to the default lang if the choosen lang doesnt exist */ + $language = $default_lang; + if ((file_exists("$curpath/language/lang-" . $language . ".php")) && (is_readable("$curpath/language/lang-" . $language . ".php"))) { + require("$curpath/language/lang-" . $default_lang . ".php"); + } else { + die("Default Language File Choosen Doesnt Exist Or Is Unreadable By The Webserver"); + } +} + +?> <table border="0" cellspacing="1" cellpadding="5" width="100%" height="95%"> <tr> Index: publicdnsadmin/login.php diff -u publicdnsadmin/login.php:1.3 publicdnsadmin/login.php:1.4 --- publicdnsadmin/login.php:1.3 Wed Jun 18 03:26:58 2003 +++ publicdnsadmin/login.php Tue Aug 12 19:47:13 2003 @@ -35,6 +35,7 @@ if (!$dbh->isError($result) && $result->numRows()) { $row = $result->fetchRow(); $_SESSION["_UID"] = $row["id"]; + $_SESSION["_LANGUAGE"] = $language; $login_ok = 1; } } @@ -44,6 +45,7 @@ if (!$dbh->isError($result) && $result->numRows()) { $row = $result->fetchRow(); $_SESSION["_UID"] = $row["id"]; + $_SESSION["_LANGUAGE"] = $language; $login_ok = 1; } } ----------------------- End of diff ----------------------- |