Code: Alles auswählen
posting.php
#
#-----[ FIND ]------------------------------------------
#
$quiz->insert_answer_request($topic_id, $userdata['user_id']);
--> DELETE (OR COMMENT THE LINE [Two Slashes in the Beginning of the Line)
#
#-----[ FIND ]------------------------------------------
#
// BEGIN Quiz Hack
if ( $auth_answer )
{
list($answer_field, $js) = $quiz->generate_answer_box($topic_id, $userdata['user_id'], $answer);
$template->assign_block_vars('switch_quiz_answer', array(
'L_ANSWER' => $lang['Answer'],
'ANSWER' => $answer_field)
);
$template->assign_block_vars('switch_quiz_answer_js', array(
'JS' => $js)
);
}
// END Quiz Hack
#
#-----[ REPLACE WITH ]------------------------------------------
#
// BEGIN Quiz Hack
if ( $auth_answer )
{
$sql = "SELECT * FROM " . QUIZ_CONFIG_TABLE;
if ( $result = $db->sql_query($sql) )
{
while ( $row = $db->sql_fetchrow($result) )
{
$quiz_config[$row['config_name']] = $row['config_value'];
}
}
else
{
message_die(GENERAL_ERROR, 'Could not query quiz_config information', '', __LINE__, __FILE__, $sql);;
}
//
// Is the User allowed to view the Quiz Answer Box?
//
$sql = "SELECT *
FROM " . TOPIC_VIEW_TABLE . "
WHERE " . $userdata['user_id'] ." = user_id AND topic_id = '$topic_id'";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in topic_view12", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) ) {
$is_ok = $row['is_ok'];
$topic_view_time = $row['view_time'];
}
}
if((!$is_ok) && ( time() < ($topic_view_time + $quiz_config['var_secs'] + 10)) )
{
$_needed_time = time() - $topic_view_time;
list($answer_field, $js) = $quiz->generate_answer_box($topic_id, $userdata['user_id'], $answer);
$template->assign_block_vars('switch_quiz_answer', array(
'L_ANSWER' => $lang['Answer'],
'ANSWER' => $answer_field)
);
$template->assign_block_vars('switch_quiz_answer_js', array(
'JS' => $js)
);
}
else
{
$sql = "SELECT topic_title
FROM " . TOPICS_TABLE . "
WHERE topic_id = '$topic_id'";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query topic title from topic table", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) ) {
preg_match("/#([0-9]*)/i",$row['topic_title'],$_matches);
$_quiz_id = $_matches[1];
}
}
//
// Getting the Admin-ID
//
$sql = "SELECT user_id
FROM ". USERS_TABLE ."
WHERE `user_level` = 1 ORDER BY 'user_ id' LIMIT 1";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query user information for error", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
$_admin_id = $row['user_id'];
}
$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (0, '" . str_replace("\'", "''", "Quiz #".$_quiz_id." - Ein User versucht zu betrügen ") ."', " . $userdata['user_id'] . ", $_admin_id, ".time().", '$user_ip', 0, 1, 1, 0)";
if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
}
$privmsg_sent_id = $db->sql_nextid();
$_needed_time = time() - $topic_view_time;
$_schummelei = ($is_ok) ? "versucht über den Zurück-Button zu betrügen" : "$_needed_time Sek. benötigt um auf den OK-Button zu drücken";
$_message = "Bei der Quizfrage: <a href=\"viewtopic.php?t=".$topic_id."\">#".$_quiz_id."</a> hat der User ".$userdata['username']." ".$_schummelei;
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $_message) . "')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql);
}
}
//
// Insert into DB, that User cannot click two times on OK-Button
//
$sql = "UPDATE " . TOPIC_VIEW_TABLE . " SET is_ok = 1
WHERE " . $userdata['user_id'] ." = user_id AND topic_id = '$topic_id'";
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not update topic view table", "", __LINE__, __FILE__, $sql);
}
}
// END Quiz Hack