Ich versteh nicht wo der fehler ist....
ich hab nur diesen mod eingebaut und kaum tauchen die ganzen fehler auf....
Quiz_addon
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
//
// End auth check
//
#
#-----[ AFTER ADD ]------------------------------------------
#
// update topic view information
$user_id=$userdata['user_id'];
$sql='UPDATE '.TOPIC_VIEW_TABLE.' SET topic_id="'.$topic_id.'", view_time="'.time().'", view_count=view_count+1 WHERE topic_id='.$topic_id.' AND user_id='.$user_id;
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$sql = 'INSERT IGNORE INTO '.TOPIC_VIEW_TABLE.' (topic_id, user_id, view_time,view_count)
VALUES ('.$topic_id.', "'.$user_id.'", "'.time().'","1")';
if ( !($db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error create user view topic information ', '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ FIND ]------------------------------------------
#
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
#
#-----[ BEFORE ADD ]------------------------------------------
#
//
// Update the topic view counter
//
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
}
#
#-----[ FIND - Older Versions]------------------------------------------
#
$forum_id = $forum_topic_data['forum_id'];
#-----[ OR - Newer Versions]------------------------------------------
$forum_id = intval($forum_topic_data['forum_id']);
#
#-----[ AFTER ADD ]------------------------------------------
#
$topic_id = intval($forum_topic_data['topic_id']);
#
#-----[ FIND ]------------------------------------------
#
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$userdata = session_pagestart($user_ip, $forum_id, $topic_id);
init_userprefs($userdata);
#
#-----[ FIND ]------------------------------------------
#
$edit_img = '';
$edit = '';
}
#
#-----[ AFTER ADD ]------------------------------------------
#
$topic_view_img = ($userdata['session_logged_in']) ?
'<a href="' . append_sid("topic_view_users.$phpEx?".POST_TOPIC_URL."=$topic_id") . '"><img src="' . $images['icon_view'] . '" alt="' . $lang['Topic_view_users'] . '" title="' . $lang['Topic_view_users'] . '" border="0" /></a>':'';
#
#-----[ FIND ]------------------------------------------
#
'IP_IMG' => $ip_img,
#
#-----[ AFTER ADD ]------------------------------------------
#
'TOPIC_VIEW_IMG' => $topic_view_img,
#
und dann noch mal:
Code: Alles auswählen
#
#-----[ OPEN ]-----
#
viewtopic.php
#
#-----[ FIND ]-----
#
//
// End session management
//
#
#-----[ AFTER ADD ]-----
#
$sql = "SELECT topic_id, view_count
FROM " . TOPIC_VIEW_TABLE . "
WHERE " . $userdata['user_id'] . " = user_id ";
if(!$result = $db->sql_query($sql))
message_die(CRITICAL_ERROR, "Could not query config information in topic_view", "", __LINE__, __FILE__, $sql);
else
{
while( $row = $db->sql_fetchrow($result) )
{
$maus_name = $row['topic_id'];
$maus_value = $row['view_count'];
$default_maus[$maus_name] = $maus_value;
$new[$maus_name] = ( isset($HTTP_POST_VARS[$maus_name]) ) ? $HTTP_POST_VARS[$maus_name] : $default_maus[$maus_name];
}
}
$sql = "SELECT view_count
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) )
$quiz_topic_id = $row['view_count'];
}
#
#-----[ FIND ]-----
#
$reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id");
#
#-----[ REPLACE WITH ]-----
#
if ($forum_topic_data['topic_quiz'] != 1 )
{ $reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id"); }
#
#-----[ FIND ]-----
#
//
// If we've got a hightlight set pass it on to pagination,
// I get annoyed when I lose my highlight after the first page.
//
#
#-----[ BEFORE, ADD ]-----
#
#
# "var secs" bestimmt das Zeitlimit. Kann nach belieben engestellt werden
#
if (($default_maus[$topic_id] == "") && ($forum_topic_data['topic_quiz'] == "1"))
{
$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);;
}
$quiz_countdown =
"<SCRIPT language=javascript>
<!--
var secs = ".intval($quiz_config['var_secs'])."
var wait = secs * 1000;
document.sform.submitbtn.disabled=false;
for(i=1;i<=secs;i++) {
window.setTimeout(\"update(\" + i + \")\", i * 1000);
}
window.setTimeout(\"timer()\", wait);
function update(num) {
if(num == (wait/1000)) {
document.sform.submitbtn.value = \"Go\";
}
else {
printnr = (wait/1000)-num;
document.sform.submitbtn.value = \"Go (\" + printnr + \")\";
}
}
function timer() {
document.sform.submitbtn.disabled=true;
}
//-->
</SCRIPT>";
}
#
#-----[ FIND ]-----
#
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
#
#-----[ AFTER ADD ]-----
#
'QUIZ_COUNTDOWN' => $quiz_countdown,
#
#-----[ FIND ]-----
#
// BEGIN Quiz Hack
$quiz_img = '';
$quiz_txt = '';
if ( !empty($forum_topic_data['topic_quiz']) )
{
if ( $postrow[$i]['post_id'] == $forum_topic_data['topic_first_post_id'] )
{
if ( !isset($quiz) )
{
include($phpbb_root_path . 'includes/quiz.'.$phpEx);
}
$message = $quiz->insert_block(QUIZ_QUESTION, $message, $topic_id);
}
else if ( !empty($postrow[$i]['quiz_answer']) )
{
if ( !isset($quiz) )
{
include($phpbb_root_path . 'includes/quiz.'.$phpEx);
}
$message = $quiz->insert_block(QUIZ_ANSWER, $message, $topic_id, $postrow[$i]);
}
#
#-----[ REPLACE WITH ]-----
#
// BEGIN Quiz Hack
$quiz_img = '';
$quiz_txt = '';
if ( !empty($forum_topic_data['topic_quiz']) )
{
if ( $postrow[$i]['post_id'] == $forum_topic_data['topic_first_post_id'] )
{
if ( !isset($quiz) )
{
include($phpbb_root_path . 'includes/quiz.'.$phpEx);
}
$message = $quiz->insert_block(QUIZ_QUESTION, $message, $topic_id, $quiz_topic_id );
}
else if ( !empty($postrow[$i]['quiz_answer']) )
{
if ( !isset($quiz) )
{
include($phpbb_root_path . 'includes/quiz.'.$phpEx);
}
$message = $quiz->insert_block(QUIZ_ANSWER, $message, $topic_id, $quiz_topic_id, $postrow[$i]);
}
#
#-----[ FIND ]------------------------------------------
#
if ( $is_auth['auth_mod'] )
{
switch ( $forum_topic_data['topic_quiz'] )
{
case '1':
#
#-----[ AFTER ADD ]------------------------------------------
#
case '2':
#
#-----[ FIND ]------------------------------------------
#
$quiz_txt = '<a href="' . $temp_url . '">' . $lang['Quiz_answer_manual_ok'] . '</a>';
}
break;
case '2':
if ( $postrow[$i]['post_id'] == $forum_topic_data['topic_first_post_id'] )
{
#
#-----[ REPLACE WITH ]------------------------------------------
#
$quiz_txt = '<a href="' . $temp_url . '">' . $lang['Quiz_answer_manual_ok'] . '</a>';
}
case '2':
if ( $postrow[$i]['post_id'] == $forum_topic_data['topic_first_post_id'] )
{
#
Das ist die anweisung für viewtopic.php! Bitte, helft mir... ich krieg gleich ne kriese... weil nix mehr funktioniert... *heul* :o(