Seite 1 von 1

Topics Order Hack von Saerdnaer

Verfasst: 01.11.2003 12:36
von MiXa
hallo ich versuche gerade den Topics Order Hack von Saerdnaer in ein phpbb plus 1.2 einzubauen

scheitere aber an der rot markierten stelle, da ich diese bei mir im code nirgends finden kann

irgendwo unten im grünen bereich scheint es m.E. zu klemmen

kann mir da vielleicht jemand helfen :roll:

#
#-----[ FIND ]------------------------------------------
#
ORDER BY t.topic_last_post_id DESC ";
#
#-----[ REPLACE WITH ]------------------------------------------
#
ORDER BY $order_by ";
#
#-----[ FIND ]------------------------------------------
#
ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
#
#-----[ REPLACE WITH ]------------------------------------------
#
ORDER BY t.topic_type DESC, $order_by


//
// All GLOBAL announcement data, this keeps GLOBAL announcements
// on each viewforum page ...
//


$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, p.post_edit_time


FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
WHERE t.topic_poster = u.user_id
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id
AND t.topic_type = " . POST_GLOBAL_ANNOUNCE . "
ORDER BY t.topic_last_post_id DESC ";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}

$topic_rowset = array();
$total_announcements = 0;
while( $row = $db->sql_fetchrow($result) )
{
$topic_rowset[] = $row;
$total_announcements++;
}

$db->sql_freeresult($result);
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
WHERE t.forum_id = $forum_id
AND t.topic_poster = u.user_id
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id
AND t.topic_type = " . POST_ANNOUNCE . "
ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
$topic_rowset[] = $row;
$total_announcements++;
}

$db->sql_freeresult($result);

//
// Grab all the basic data (all topics except announcements)
// for this forum
//


$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, p2.post_edit_time FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2


WHERE t.forum_id = $forum_id
AND t.topic_poster = u.user_id
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id
AND t.topic_type <> " . POST_ANNOUNCE . "
AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . "
$limit_topics_time
ORDER BY t.topic_type DESC, $order_by
LIMIT $start, ".$board_config['topics_per_page'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

$total_topics = 0;
while( $row = $db->sql_fetchrow($result) )
{
$topic_rowset[] = $row;
$total_topics++;
}

$db->sql_freeresult($result);

//
// Total topics ...
//
$total_topics += $total_announcements;

//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

//
// Post URL generation for templating vars
//
$template->assign_vars(array(
'L_DISPLAY_TOPICS' => $lang['Display_topics'],

'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"),

'S_SELECT_TOPIC_DAYS' => $select_topic_days,
'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start"))
);

Verfasst: 01.11.2003 19:36
von Acid
Der zitierte Teil stammt aus deiner aktuellen viewforum.php oder?
hmm.. der erste(, rote) Teil is darin zu finden. Und der andere(, blaue) Teil wurde bereits wie benötigt geändert !? :o :roll:

Verfasst: 01.11.2003 20:18
von MiXa
meine akutelle viewforum.php
blaue ist bereits geändert
rote würde ich gerne ändern

keine ahnung von php :o aber meiner logik nach soweit ich das verstehe :D

der rote teil der darin zu finden ist

- beim ersten sortiert er die

All GLOBAL announcement data, this keeps GLOBAL announcements on each viewforum page ...

- beim zweiten sortiert er die

All announcement data, this keeps announcements on each viewforum page ...


beim eigentlichen teil wo es mir darauf ankommt ist es aber nicht vorhanden

-> Grab all the basic data (all topics except announcements) for this forum

(wenn ich es - bei den announcement sachen einbaue - passiert auch nichts)


m.E. fehlt also im entscheidenden teil "ORDER BY t.topic_last_post_id DESC ";" welches ich durch "ORDER BY $order_by ";" ersetzen soll


wie gesagt kann kein php - habe aber versucht es so gut ich es hinbekomme nachzuvollziehen :roll:

Verfasst: 01.11.2003 20:31
von MiXa
habs noch mal mit der vom original phpbb 2.0.6 verglichen

müßte m.E. beim 2. mal wo es vorkommt ersetzt werden

haut aber leider trotzdem irgendwie nicht hin

Verfasst: 01.11.2003 23:18
von Acid
hmm..

Code: Alles auswählen

ORDER BY t.topic_last_post_id DESC "; 
..das lässt sich in einer originalen viewforum.php nur einmal finden, sowie auch in dem von dir zitierten Codebereich deiner viewforum.php (das was ich oben violett markiert habe).

Verfasst: 02.11.2003 10:37
von MiXa
ist doch zweimal drin - habe es oben mal orange gekennzeichnet

wenn ich es mit dem original vergleiche müßte es aber das zweite sein, welches ausgetauscht werden müßte - das erste kommt denke ich mal vom global announcement mod

läuft aber irgendwie leider trotzdem nicht :-(

(wollte jetzt mal versuchen 1.0.1 einzubauen - ob die geht)

Verfasst: 02.11.2003 12:45
von Acid
Sag ich ja.. in einer originalen viewforum.php kommt´s einmal vor (im obigen Code das 2. Auftreten). Das 1. Auftreten ist vom Global-Hack, wie du schon erkannt hast.

Und wenn du mal beide Stellen anpasst ?