ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
index.php File Reference

Go to the source code of this file.

Functions

 valid_http_lang ()
 mozilla ($txt)

Variables

 if (!defined('UPLOAD_ERR_CANT_WRITE')) define('UPLOAD_ERR_CANT_WRITE'
const MOZILLA = (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko/') !== false)

Function Documentation

mozilla (   $txt)

Definition at line 67 of file index.php.

References MOZILLA.

{
return MOZILLA ? '' : $txt;
}
/* the default 'variables_order' isn't good for us. As we can't change it
at runtime, we do this little 'hack' to give _GET precendence */
if (isset($_GET['lang'])) {
$_REQUEST['lang'] = &$_GET['lang'];
} elseif (isset($_POST['lang'])) {
$_REQUEST['lang'] = &$_POST['lang'];
}
/* Check for valid language and include the local file */
if (!isset($_GET['langchooser']) &&
(
(isset($_REQUEST['lang']) && isset($valid_langs[(string)$_REQUEST['lang']])) ||
!empty($_REQUEST['url'])
)
) {
if (empty($lang)) {
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en';
} else {
$redir = true;
}
if (empty($_COOKIE['lang']) || $lang != $_COOKIE['lang']) {
setcookie('lang', $lang, time()+60*60*24*90, '/', 'validator.aborla.net');
}
output_add_rewrite_var('lang', $lang);
require './local/en.inc'; // fallback for not translated messages
if ($lang != 'en')
require "./local/$lang.inc"; //load localized messages
common_header();
if (isset($redir)) {
echo '<p id="redir">We have automatically choosen the "' . $valid_langs[$lang] .
'" language for you. <a href="/?langchooser">Click here to change</a>.</p>';
}
/*************** LANGUAGE CHOOSER ***************/
} else {
require "./local/en.inc";
common_header();
echo "<p>Choose a language, please:</p>\n" .
"<form method=\"get\" action=\"index.php\">\n" .
"<p><select name=\"lang\">\n";
foreach($valid_langs as $k => $v) {
echo "<option value=\"$k\">$v</option>\n";
}
echo "</select></p>\n<p><input type=\"submit\" value=\" Submit \" /></p>\n</form>\n";
die(common_footer());
}
/*********** END OF LANGUAGE CHOOSER ************/
/**************** DOCUMENTATION ****************/
if (isset($_GET['docs'])) {
// docs
echo "<h2>$message[5]</h2>\n".
"<p>$message[99]</p><p>&nbsp;</p>\n";
// explanation of each option
echo "<h2>$message[0]</h2>";
foreach($opts as $v) {
echo "<p><strong>$v[name]</strong>: $v[explain]</p>\n";
}
die(common_footer());
}
/***************** END OF DOCS ****************/
/***************** FIRST PAGE *****************/
if (empty($_REQUEST['url']) && (!isset($_FILES['file']) || $_FILES['file']['error'] == UPLOAD_ERR_NO_FILE)) {
echo '<form method="post" action="index.php" enctype="multipart/form-data"><p>' . $message[3].
'<input type="hidden" name="MAX_FILE_SIZE" value="' . validator::FILE_LIMIT . '" />' .
': <input type="text" name="url" size="50" value="http://" /><br />'.
$message[19] . ': <input name="file" type="file" /></p>';
$aditional = "$message[8]:\n" . mozilla("<label title=\"$message[1]\">\n") .
"<input type=\"radio\" name=\"errors\" checked=\"checked\" value=\"along\" /> $message[6]\n" .
"<input type=\"radio\" name=\"errors\" value=\"alone\" /> $message[7]\n" .
mozilla("</label>\n") .
"<br />$message[9]:\n" . mozilla("<label title=\"$message[2]\">\n") .
"<input type=\"radio\" name=\"repair\" checked=\"checked\" value=\"full\" /> $message[10]\n" .
"<input type=\"radio\" name=\"repair\" value=\"diff\" /> $message[11]\n" .
"<input type=\"radio\" name=\"repair\" value=\"none\" /> $message[12]\n" .
mozilla("</label>\n") . "<br />\n";
echo validator::html_opts($aditional);
echo <<< HTML
<p><input type="submit" value=" $message[4] " /></p>
</form>
<p><a href="index.php?docs">$message[5]</a></p>
HTML;
die(common_footer());
}
/************ END OF FIRST PAGE **************/
/****************** START OF THE VALIDATOR ITSELF *******************/
$validator = new validator($_REQUEST);
/* File upload */
if(isset($_FILES['file']) && $_FILES['file']['error'] != UPLOAD_ERR_NO_FILE) {
switch($_FILES['file']['error']) {
case UPLOAD_ERR_OK:
$result = $validator->parse_string(file_get_contents($_FILES['file']['tmp_name']));
break;
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$result = false;
$int_error = $validator->_error(8, validator::FILE_LIMIT);
break;
case UPLOAD_ERR_PARTIAL:
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
$result = false;
$int_error = $validator->_error(9);
break;
}
/* URL validator */
} else {
valid_http_lang ( )

Definition at line 40 of file index.php.

References $lang.

{
global $valid_langs;
if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
return false;
$langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ($langs as $lang) {
list($lang) = explode(';', $lang);
list($lang) = explode('-', $lang);
$lang = trim($lang);
if (isset($valid_langs[$lang]))
return $lang;
}
return false;
}

Variable Documentation

if(!defined('UPLOAD_ERR_CANT_WRITE')) define('UPLOAD_ERR_CANT_WRITE'

Definition at line 35 of file index.php.

const MOZILLA = (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko/') !== false)

Definition at line 65 of file index.php.

Referenced by mozilla().