diff --git a/admin/award_awards.php b/admin/award_awards.php index d03b6f9..9caf118 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -31,6 +31,11 @@ $id = intval($_GET['id']); $q=mysql_query("SELECT * FROM award_awards WHERE id='$id'"); $ret = mysql_fetch_assoc($q); + //json_encode NEEDS UTF8 DATA, but we store it in the database as ISO :( + foreach($ret AS $k=>$v) { + $ret[$k]=iconv("ISO-8859-1","UTF-8",$v); + } + //echo iconv("ISO-8859-1","UTF-8",json_encode($ret)); echo json_encode($ret); exit; @@ -57,18 +62,18 @@ $q = "UPDATE award_awards SET award_types_id='".intval($_POST['award_types_id'])."', - presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."', + presenter='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['presenter'])))."', excludefromac='".(($_POST['excludefromac'] == 1) ? 1 : 0)."', cwsfaward='".(($_POST['cwsfaward'] == 1) ? 1 : 0)."', self_nominate='".(($_POST['self_nominate'] == 'yes') ? 'yes' : 'no')."', schedule_judges='".(($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no')."', - description='".mysql_escape_string(stripslashes($_POST['description']))."' "; + description='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['description'])))."' "; if(array_key_exists('name', $_POST)) { /* These values may be disabled, if they name key exists, assume * they aren't disabled and save them too */ - $q .= ",name='".mysql_escape_string(stripslashes($_POST['name']))."', - criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."', + $q .= ",name='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['name'])))."', + criteria='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['criteria'])))."', sponsors_id='".intval($_POST['sponsors_id'])."' "; } $q .= "WHERE id='$id'"; @@ -157,6 +162,9 @@ $q = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='$id' ORDER BY `order`"); } while($r=mysql_fetch_assoc($q)) { + foreach($r AS $k=>$v) { + $r[$k]=iconv("ISO-8859-1","UTF-8",$v); + } $ret[] = $r; } echo json_encode($ret); @@ -165,6 +173,9 @@ $id = intval($_GET['id']); $q = mysql_query("SELECT * FROM award_prizes WHERE id='$id'"); $ret=mysql_fetch_assoc($q); + foreach($ret AS $k=>$v) { + $ret[$k]=iconv("ISO-8859-1","UTF-8",$v); + } echo json_encode($ret); exit; @@ -183,7 +194,7 @@ case 'prize_save': $id = intval($_POST['id']); $q="UPDATE award_prizes SET - prize='".mysql_escape_string(stripslashes($_POST['prize']))."', + prize='".mysql_escape_string(stripslashes(iconv("UTF-8","ISO-8859-1",$_POST['prize'])))."', cash='".intval($_POST['cash'])."', scholarship='".intval($_POST['scholarship'])."', value='".intval($_POST['value'])."', diff --git a/admin/gettranslation.php b/admin/gettranslation.php index 9987b23..954c962 100644 --- a/admin/gettranslation.php +++ b/admin/gettranslation.php @@ -28,10 +28,9 @@ user_auth_required('committee', 'admin'); $ret=array(); foreach($config['languages'] AS $l=>$ln) { if($l==$config['default_language']) continue; - - $q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='".md5($_GET['str'])."'"); + $q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='".md5(iconv("ISO-8859-1","UTF-8",$_GET['str']))."'"); if($r=mysql_fetch_object($q)) - $ret[$l]=$r->val; + $ret[$l]=iconv("ISO-8859-1","UTF-8",$r->val); else $ret[$l]=""; } diff --git a/admin/settranslation.php b/admin/settranslation.php index a2220dc..c3fe921 100644 --- a/admin/settranslation.php +++ b/admin/settranslation.php @@ -25,7 +25,6 @@ include "../common.inc.php"; require_once("../user.inc.php"); user_auth_required('committee', 'admin'); -print_r($_POST); foreach($config['languages'] AS $l=>$ln) { if($l==$config['default_language']) continue; @@ -35,13 +34,14 @@ foreach($config['languages'] AS $l=>$ln) { if($_POST['translate_'.$l]) { $q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='$m'"); if(mysql_num_rows($q)) - mysql_query("UPDATE translations SET val='".mysql_real_escape_string(stripslashes($_POST['translate_'.$l]))."' WHERE lang='$l' AND strmd5='$m'"); + mysql_query("UPDATE translations SET val='".mysql_real_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_'.$l])))."' WHERE lang='$l' AND strmd5='$m'"); else - mysql_query("INSERT INTO translations (lang,strmd5,str,val) VALUES ('$l','$m','".mysql_real_escape_string(stripslashes($_POST['translate_str_hidden']))."','".mysql_escape_string(stripslashes($_POST['translate_'.$l]))."')"); + mysql_query("INSERT INTO translations (lang,strmd5,str,val) VALUES ('$l','$m','".mysql_real_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_str_hidden'])))."','".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_'.$l])))."')"); } else { mysql_query("DELETE FROM translations WHERE lang='$l' AND strmd5='$m'"); } } +echo "ok"; ?>