Exemplo n.º 1
0
}
if (isset($_REQUEST['answer_question_id'])) {
    $answer_question_id = intval($_REQUEST['answer_question_id']);
} else {
    $answer_question_id = 0;
}
if (!isset($answer_keyboard_key) or empty($answer_keyboard_key)) {
    $answer_keyboard_key = '';
} else {
    $answer_keyboard_key = intval($answer_keyboard_key);
}
if (isset($_REQUEST['answer_description'])) {
    $answer_description = utrim($_REQUEST['answer_description']);
    if (function_exists('normalizer_normalize')) {
        // normalize UTF-8 string based on settings
        $answer_description = F_utf8_normalizer($answer_description, K_UTF8_NORMALIZATION_MODE);
    }
}
if (isset($_REQUEST['answer_explanation'])) {
    $answer_explanation = utrim($_REQUEST['answer_explanation']);
} else {
    $answer_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if ($answer_id > 0) {
    $sql = 'SELECT subject_module_id,question_subject_id,answer_question_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_ANSWERS . '
		WHERE subject_id=question_subject_id
			AND question_id=answer_question_id
Exemplo n.º 2
0
 /**
  * Sets the end element handler function for the XML parser parser.end_element_handler.
  * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
  * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
  * @private
  */
 private function endElementHandler($parser, $name)
 {
     global $l, $db;
     require_once '../config/tce_config.php';
     $name = strtolower($name);
     switch ($name) {
         case 'module':
             $this->addModule();
             $this->level = '';
             break;
         case 'subject':
             $this->addSubject();
             $this->level = 'module';
             break;
         case 'question':
             $this->addQuestion();
             $this->level = 'subject';
             break;
         case 'answer':
             $this->addAnswer();
             $this->level = 'question';
             break;
         default:
             $elname = $this->level . '_' . $name;
             if ($this->current_element == $elname) {
                 // convert XML special chars
                 $this->level_data[$this->level][$this->current_element] = F_xml_to_text(utrim($this->current_data));
                 if ($this->current_element == 'question_description' or $this->current_element == 'answer_description') {
                     // normalize UTF-8 string based on settings
                     $this->level_data[$this->level][$this->current_element] = F_utf8_normalizer($this->level_data[$this->level][$this->current_element], K_UTF8_NORMALIZATION_MODE);
                 }
                 // escape for SQL
                 $this->level_data[$this->level][$this->current_element] = F_escape_sql($db, $this->level_data[$this->level][$this->current_element], false);
             }
             break;
     }
 }
Exemplo n.º 3
0
}
if (!isset($_REQUEST['question_inline_answers']) or empty($_REQUEST['question_inline_answers'])) {
    $question_inline_answers = false;
} else {
    $question_inline_answers = F_getBoolean($_REQUEST['question_inline_answers']);
}
if (!isset($_REQUEST['question_auto_next']) or empty($_REQUEST['question_auto_next'])) {
    $question_auto_next = false;
} else {
    $question_auto_next = F_getBoolean($_REQUEST['question_auto_next']);
}
if (isset($_REQUEST['question_description'])) {
    $question_description = utrim($_REQUEST['question_description']);
    if (function_exists('normalizer_normalize')) {
        // normalize UTF-8 string based on settings
        $question_description = F_utf8_normalizer($question_description, K_UTF8_NORMALIZATION_MODE);
    }
}
if (isset($_REQUEST['question_explanation'])) {
    $question_explanation = utrim($_REQUEST['question_explanation']);
} else {
    $question_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if ($question_id > 0) {
    $sql = 'SELECT subject_module_id, question_subject_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . '
		WHERE subject_id=question_subject_id
			AND question_id=' . $question_id . '