Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support of non-Latin characters #27

Merged
merged 3 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .Rhistory
Empty file.
12 changes: 6 additions & 6 deletions core/fileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function getstats($completed)
// template name is set and is < 30 characters
if(!isset($form["template-name"]) ||
strlen($form["template-name"]) > 30 /*||
$form["template-name"] != preg_replace('/[^A-Za-z0-9]+/','',$form["template-name"])*/)
$form["template-name"] != preg_replace('/[^\p{L}\p{N}]+/','',$form["template-name"])*/)
{
$errors .= "<li class='error-item'>";
$errors .= "Please input a valid template name (less than 30 characters)";
Expand Down Expand Up @@ -221,21 +221,21 @@ function getstats($completed)
// category name
if(!isset($form["tabs".$i."-catlabel-input"]) ||
strlen($form["tabs".$i."-catlabel-input"]) > 30 ||
$form["tabs".$i."-catlabel-input"] != preg_replace('/[^A-Za-z0-9\-\(\)\$\#\@\? ]+/', '', $form["tabs".$i."-catlabel-input"]))
$form["tabs".$i."-catlabel-input"] != preg_replace('/[^\p{L}\p{N}\-\(\)\$\#\@\? ]+/u', '', $form["tabs".$i."-catlabel-input"]))
{
$errors .= "<li class='error-item'>";
$errors .= "Please input a valid category label for Category " . $catnames[$i-1];
$errors .= " </li>";
}
else
{
// add category label
// add category label0
$newform["cat".$catnames[$i-1]]["label"] = $form["tabs".$i."-catlabel-input"];
}
// data label
if(!isset($form["tabs".$i."-datalabel-input"]) ||
strlen($form["tabs".$i."-datalabel-input"]) > 3 ||
$form["tabs".$i."-datalabel-input"] != preg_replace('/[^A-Za-z0-9]+/','',$form["tabs".$i."-datalabel-input"]))
$form["tabs".$i."-datalabel-input"] != preg_replace('/[^\p{L}\p{N}]+/u','',$form["tabs".$i."-datalabel-input"]))
{
$errors .= "<li class='error-item'>";
$errors .= "Please input a valid data label for Category " . $catnames[$i-1] . " (less than 3 alphanumeric characters)";
Expand Down Expand Up @@ -280,14 +280,14 @@ function getstats($completed)
if(array_key_exists("cat".$catnames[$i-1].$j."-txt", $form))
{
// check if has ".jpg", etc.
if( preg_match("/\.[A-Za-z]{2,4}/",$form["cat".$catnames[$i-1].$j."-txt"]))
if( preg_match("/\.[\p{L}]{2,4}/u",$form["cat".$catnames[$i-1].$j."-txt"]))
{
$errors .= "<li class='error-item'>";
$errors .= "The text input, '" . $form["cat".$catnames[$i-1].$j."-txt"];
$errors .= "' in Category " . $catnames[$i-1] . " appears to be a file name.";
$errors .= " </li>";
}
else if ( preg_match("/[^A-Za-z0-9\-\(\)\$\#\@\? ]+/", $form["cat".$catnames[$i-1].$j."-txt"]))
else if ( preg_match("/[^\p{L}\p{N}\-\(\)\$\#\@\? ]+/u", $form["cat".$catnames[$i-1].$j."-txt"]))
{
$errors .= "<li class='error-item'>";
$errors .= "The text input, '" . $form["cat".$catnames[$i-1].$j."-txt"];
Expand Down
1 change: 1 addition & 0 deletions core/survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<html>
<head>
<title><?php echo $IATname; ?> IAT Survey</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css"> @import "core/css/iat.css";</style>
<script type="text/javascript" src="core/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="core/js/IAT.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion createdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ ${#MYSQL} -lt "5" ]; then
exit 1
fi

Q1="CREATE DATABASE IF NOT EXISTS IAT555;"
Q1="CREATE DATABASE IF NOT EXISTS IAT555 CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
Q2="CREATE USER 'IATexp555'@'localhost' IDENTIFIED BY 'myIAT';"
Q3="GRANT ALL ON IAT555.* TO 'IATexp555'@'localhost';"
Q4="FLUSH PRIVILEGES;"
Expand Down
2 changes: 1 addition & 1 deletion experimenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>IAT Experimenter Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" href="core/css/overcast/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<link type="text/css" href="core/css/experimenter.css" rel="stylesheet" />
<script type="text/javascript" src="core/js/jquery-1.7.1.min.js"></script>
Expand Down
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<title>Online IAT</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" href="core/css/overcast/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<style type="text/css"> @import "core/css/iat.css";</style>
<script type="text/javascript" src="core/js/jquery-1.7.1.min.js"></script>
Expand Down