diff --git a/config/index.php b/config/index.php index 16bfbe0..7398846 100644 --- a/config/index.php +++ b/config/index.php @@ -3,8 +3,8 @@ This file is part of the 'Science Fair In A Box' project SFIAB Website: http://www.sfiab.ca - Copyright (C) 2005 Sci-Tech Ontario Inc - Copyright (C) 2005 James Grant + Copyright (C) 2005-2006 Sci-Tech Ontario Inc + Copyright (C) 2005-2006 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -39,6 +39,9 @@ echo "".i18n("Project Safety Questions")."
"; echo "".i18n("Images (Fair Logo)")."
"; echo "
"; + echo "".i18n("Language Pack Installer")." (".i18n("install new language translations").")
"; + echo "".i18n("New Version Checker")." (".i18n("check if you're using the latest version").")
"; + echo "
"; echo "".i18n("Rollover Fair Year")."
"; send_footer(); diff --git a/config/languagepacks.php b/config/languagepacks.php new file mode 100644 index 0000000..1cb0914 --- /dev/null +++ b/config/languagepacks.php @@ -0,0 +1,131 @@ + + Copyright (C) 2006 James Grant + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +<< ".i18n("Back to Configuration")."
"; + + echo i18n("Checking for language packs will access a remote server, if you wish to continue click the 'Check for available language packs' link below"); + echo "
"; + echo "
"; + echo "".i18n("Check for available language packs")."
"; + + function loadLanguagePacks() + { + $ret=array(); + if($packs=file("http://www.sfiab.ca/languages/langpacklist.txt")) + { + $num=count($packs); + //format of each line is: + //lang:filename:lastupdate + if(count($packs)) + { + foreach($packs AS $p) + { + list($langpack,$filename,$lastupdate)=split("\t",trim($p)); + $ret[$langpack]=array("lang"=>$langpack,"filename"=>$filename,"lastupdate"=>$lastupdate); + } + } + } + else + { + echo error(i18n("There was an error connecting to the language pack server")); + } + return $ret; + + } + + if($_GET['action']=="check") + { + $packs=loadLanguagePacks(); + + $num=count($packs); + echo i18n("Found %1 available language pack(s)",array($num)); + //format of each line is: + //lang:filename:lastupdate + if(count($packs)) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach($packs AS $p) + { + echo ""; + echo ""; + echo ""; + } + echo "
".i18n("Language")."".i18n("Filename")."".i18n("Last Update")."".i18n("Install")."
{$p['lang']}{$p['filename']}{$p['lastupdate']}"; + echo "".i18n("Install").""; + echo "
"; + } + } + + if($_GET['action']=="install" && $_GET['install']) + { + $packs=loadLanguagePacks(); + $loaded=0; + if($packs[$_GET['install']]) + { + $lines=file("http://www.sfiab.ca/languages/{$packs[$_GET['install']]['filename']}"); + $totallines=count($lines); + $numtranslations=round($totallines/2); + echo i18n("There are %1 translations in this language pack... processing...",array($numtranslations)); + if(count($lines)) + { + foreach($lines AS $line) + { + $line=trim($line); + + if(substr($line,0,6)=="UPDATE" || substr($line,0,6)=="INSERT") + { + mysql_query($line); + $a=mysql_affected_rows(); + $loaded+=$a; + } + else + echo notice("Ignoring invalid language pack line: %1",array($l)); + } + if($loaded==0) + echo notice(i18n("You already have all of the translations in this language pack")); + else + echo happy(i18n("Successfully loaded %1 new translations",array($loaded))); + } + else + { + echo error(i18n("Error downloading language pack")); + } + } + else + { + echo error(i18n("Invalid language pack to install")); + } + } + + send_footer(); +?> diff --git a/config/versionchecker.php b/config/versionchecker.php new file mode 100644 index 0000000..7d2dfa5 --- /dev/null +++ b/config/versionchecker.php @@ -0,0 +1,72 @@ + + Copyright (C) 2006 James Grant + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +<< ".i18n("Back to Configuration")."
"; + + echo i18n("Checking for new versions will access a remote server, if you wish to continue click the 'Check for new versions' link below"); + echo "
"; + echo "
"; + echo i18n("Your currently installed version: %1",array($config['version'])); + echo "
"; + + + function loadVersions() + { + $ret=array(); + if($v=file("http://www.sfiab.ca/version.txt")) + { + list($version,$date)=split("\t",trim($v[0])); + $ret['version']=$version; + $ret['date']=$date; + } + else + echo error(i18n("There was an error connecting to the version checker server")); + return $ret; + } + + if($_GET['action']=="check") + { + $v=loadVersions(); + echo i18n("Newest version available: %1 (%2)",array($v['version'],$v['date'])); + echo "
"; + echo "
"; + if($v['version']==$config['version']) + { + echo happy(i18n("Your current version (%1) is up-to-date",array($config['version']))); + } + else + { + echo error(i18n("There is a new version available!
Newest version: %1 Released on %2",array($v['version'],$v['date']))); + echo i18n("The newest version can be downloaded from http://www.sfiab.ca/download.php"); + } + + } + else + echo "".i18n("Check for new versions")."
"; + + send_footer(); +?>