diff --git a/common.inc.php b/common.inc.php
index 5523b21..9bd5022 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -991,21 +991,21 @@ function getEmailRecipientsForRegistration($reg_id)
function output_page_text($textname)
{
global $config;
- $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='".$config['FAIRYEAR']."'");
+ $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='".$config['FAIRYEAR']."' AND lang='".$_SESSION['lang']."'");
if(mysql_num_rows($q))
$r=mysql_fetch_object($q);
else
{
//not defined, lets grab the default text
- $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='-1'");
+ $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='-1' AND lang='".$config['default_language']."'");
$r=mysql_fetch_object($q);
}
//if it looks like we have HTML content, dont do a nl2br, if there's no html, then do the nl2br
if(strlen($r->text)==strlen(strip_tags($r->text)))
- echo nl2br(i18n($r->text));
+ echo nl2br($r->text);
else
- echo i18n($r->text);
+ echo $r->text;
}
function generatePassword($pwlen=8)
diff --git a/config/pagetexts.php b/config/pagetexts.php
index b523d10..87c31c3 100644
--- a/config/pagetexts.php
+++ b/config/pagetexts.php
@@ -25,6 +25,12 @@
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'config');
+
+ //make sure storage folder exists
+ if(!file_exists("../data/userfiles"))
+ mkdir("../data/userfiles");
+
+
send_header("Page Texts",
array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php')
@@ -42,66 +48,94 @@
if($_POST['action']=="save")
{
- mysql_query("UPDATE pagetext SET lastupdate=NOW(), text='".mysql_escape_string(stripslashes($_POST['text']))."' WHERE textname='".$_POST['textname']."' AND year='".$config['FAIRYEAR']."'");
+ foreach($config['languages'] AS $lang=>$langname) {
+ $textvar="text_$lang";
+ $text=mysql_escape_string(stripslashes($_POST[$textvar]));
- echo happy(i18n("Page text successfully saved"));
+ mysql_query("UPDATE pagetext
+ SET
+ lastupdate=NOW(),
+ text='$text'
+ WHERE
+ textname='".mysql_escape_string($_POST['textname'])."'
+ AND year='".$config['FAIRYEAR']."'
+ AND lang='$lang'");
+ }
+ echo happy(i18n("Page texts successfully saved"));
}
if($_GET['textname'])
{
- $q=mysql_query("SELECT * FROM pagetext WHERE textname='".$_GET['textname']."' AND year='".$config['FAIRYEAR']."'");
+ $q=mysql_query("SELECT * FROM pagetext WHERE textname='".mysql_escape_string($_GET['textname'])."' AND year='".$config['FAIRYEAR']."'");
+ //needs to be at least one entry in any languages
if($r=mysql_fetch_object($q))
{
- if($r->lastupdate=="0000-00-00 00:00:00") $lastupdate="Never";
- else $lastupdate=$r->lastupdate;
- echo "$r->textname Last updated: $lastupdate
";
echo "