Biete 100,-€ für Modifikationen am Recent MOD, natürlich Vor

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Biete 100,-€ für Modifikationen am Recent MOD, natürlich Vor

Beitrag von Gutschy »

Hi,

ich hab da eine gute Geschäftsidee wie ich finde und dafür hab ich das Board (2.0.16) unter anderem um den Recent MOD erweitert.

http://www.phpbb.de/moddb/mod.php?id=48

## Hack Titel: Recent Topics (erweiterte Variante)

## Hack Version: 1.2.2 (phpBB 2.0.x)

## Autor: Acid

Dieser Mod ist vom 'Look & Feel' genau das was ich mir vorstelle, nun möchte ich ihn noch ein bisschen Modifiziert haben, eigentlich keine große Sache für jemanden der das Board kennt. Ich selber hab ein bischen Grundkenntnisse in PHP und SQL, aber die reichen noch lange nicht um sowas umzusetzen.

Die recent.php soll zum einen noch ein paar ein paar Zusatzfelder zum jeweiligen Topic anzeigen und zum anderen sich in der Anzeige der Daten an einem Datumsfeld aus den Zusatsfeldern orientieren und das in die Zukunft. Das ganze wird unter anderem ein Veranstaltungsboard. Kurz: Zeige mir alle Termine der nächsten Woche auf. Und das wählbar für verschiedene Zeiträume. Ausserdem soll die recent.php noch als Startseite erreichbar sein die per Default alle Termine für die nächsten 7 Tage anzeigt. Aber ich glaube das lässt sich am Apache einstellen falls ich mich nicht irre.

Die Tabelle aus der gelesen werden soll:

CREATE TABLE `phpbb_posts_text` (
`post_id` mediumint( unsigned NOT NULL default '0',
`bbcode_uid` varchar(10) NOT NULL default '',
`post_subject` varchar(60) default NULL,
`post_datum` varchar(60) default NULL,
`post_ort` varchar(40) default NULL,
`post_strasse` varchar(40) default NULL,
`post_beschreibung` varchar(40) default NULL,
`post_tel` varchar(20) default NULL,
`post_text` text,
PRIMARY KEY (`post_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Die Felder die noch Angezeigt werden sollen, vielleicht mal Datum, Ort und Beschreibung.

Wenn sich dafür jemand bereit erklärt kann er mich per PN erreichen, ich werde dann versuchen mir von seinen Fähigkeiten ein Bild zu machen und mich dann bei ihm melden. Bevor ich das Geld überweise möchte ich noch eine Demo sehen. Dieser MOD sollte allen Ansprüchen genügen die hier an MODs gestellt werden. Und dafür sollte er auch veröffentlicht werden. Sozusagen mein Beitrag zu Community. Immerhin läuft auf meinem Rechner Freeware im Wert von mehreren Tausend €uro :D da kann man mal einen Hunie springen lassen, obwohl ich der letzte Mensch mit viel Kohle bin.

Ich hoffe mit diesem Angebot nicht gegen die Board Philosophie zu verstoßen und falls doch, vielleicht kann es ja stehenbleiben bis es ein paar Leute gelesen haben. :grin:

So far so good.

Gutschy 8)
na dann.
shwepsi
Mitglied
Beiträge: 1697
Registriert: 02.06.2003 14:37
Wohnort: NRW - immer dem Monitorleuchten folgen...
Kontaktdaten:

Beitrag von shwepsi »

Ich würde gerne, bin aber ordentlich beschäftigt, darum:

Schau mal in die Signatur von Mario Siebert
http://www.phpbb.de/viewtopic.php?p=522643#522643
Die Weisheit verfolgte mich sekundenlang...
Aber sie überholte mich und war fortan nicht mehr gesehen !!!
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Beitrag von Gutschy »

Super, könnte vielleicht mein Mann sein.

Besten Dank shwepsi!

:grin:
na dann.
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Beitrag von Gutschy »

*schieb*
na dann.
shwepsi
Mitglied
Beiträge: 1697
Registriert: 02.06.2003 14:37
Wohnort: NRW - immer dem Monitorleuchten folgen...
Kontaktdaten:

Beitrag von shwepsi »

schau mal zu 'Topic-Bumping' in KB:16

und warum sich derzeit so wenige melden? schau mal in die News, Eintrag #1 Mod-Wettbewerb.

Derzeit werden wohl relativ alle beschäftigt sein.

Wenn ich meine Mods fertig habe schaue ich gerne, aber das wird wohl für alle inkl. des umstellen der Foren bis MINDESTENS ende Oktober dauern.

Schau aber einfach mal in die funktionen
falls du mir die gibst die die Einträge heraussucht (Tip: time() und date() sind ein guter suchpunkt), kann ich dir die 2, 3 Zeilen modifizieren, kp. Habe nur wenig Zeit und einen Mod zu durchforsten ....
also: wenn du das schaffst mache ich die anzeige der NÄCHSTEN X Tage statt der letzten X Tage
Die Weisheit verfolgte mich sekundenlang...
Aber sie überholte mich und war fortan nicht mehr gesehen !!!
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Beitrag von Gutschy »

Hi Schwepsi,

na gut. Topic Bumping, werde ich mir merken, nur alle 24 Stunden. :wink:

Hmm, der Mod Wettbewerb, gut aber ich dachte 100,- Euro sind kein schlechtes Geld und es ist wirklich nicht viel Arbeit.

Aber besten Dank für deinen Vorschlag mein Zeitraum Problem zu lösen, hier mal die meiner Meinung nach relevanten Codzeilen, am Ende noch ein Kommentar von mir.

Code: Alles auswählen


$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name

	        FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p

		LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id

		LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id

		LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id

		LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster

	        WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";

$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit";

switch( $mode )

{

	case 'today':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_today']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0";

		$l_mode = $lang['Recent_title_today'];

		break;



	case 'yesterday':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_yesterday']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_time,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1";

		$l_mode = $lang['Recent_title_yesterday'];

		break;



	case 'last24':

		$sql   = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 86400". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_last24']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400";

		$l_mode = $lang['Recent_title_last24'];

		break;



	case 'lastweek':

		$sql  = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 691200". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_lastweek']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 691200";

		$l_mode = $lang['Recent_title_lastweek'];

		break;



	case 'lastXdays':

		$sql    = $sql_start ."UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * $amount_days". $sql_end;

		$template->assign_vars(array('STATUS' => sprintf($lang['Recent_lastXdays'], $amount_days)));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 * $amount_days";

		$l_mode = sprintf($lang['Recent_title_lastXdays'], $amount_days);

		break;
Das Feld aus dem gelesen wird ist statt 'p.post_time', `post_datum` aus der Tabelle 'phpbb_posts_text'. Könntest du die passende Tabelle 'phpbb_posts_text' noch in die SQL_start Anweisung am Anfang eintragen, ich erkenne zwar das da ein Alias benutzt wird um den Tabellen Namen zu sparen, aber die Syntax ist wohl noch zu hoch für mich.

Wenn dannoch in der LEFT OUTER JOIN Abfrage das Feld 'post_datum' aus der Tabelle 'phpbb_posts_text' von dir eingetragen würde könnte ich glaub ich den ganzen Rest alleine hinkriegen, wenn ich viel Glück. Aber erst mal eins nach dem anderen.


Gutschy :P
na dann.
shwepsi
Mitglied
Beiträge: 1697
Registriert: 02.06.2003 14:37
Wohnort: NRW - immer dem Monitorleuchten folgen...
Kontaktdaten:

Beitrag von shwepsi »

ersetze

Code: Alles auswählen

p.post_time
durch

Code: Alles auswählen

p.post_datum
und ersetze durch das sollte reichen, abgesehen von den Änderungen in der Lang file

wer das auch immer programmiert hat, danke für diese Struktur, da fällt es einfach *gg*

auch wenn es nicht übersichtlich ist
Die Weisheit verfolgte mich sekundenlang...
Aber sie überholte mich und war fortan nicht mehr gesehen !!!
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Beitrag von Gutschy »

Hi Schwepsi,

leider ist da ein Fehler, er findet die entsprechende Spalte nicht. In deinen Angaben wird wohl nicht auf die entsprechende Tabelle verwiesen 'phpbb_posts_text'. Leider blick ich die SELECT Anweisung nur ganz ungefähr. Weiter unten noch mal der Code nach deinen Anweisungen umgeschrieben.

FEHLERMELDUNG:

could not obtain main information.

DEBUG MODE

SQL Error : 1054 Unknown column 'p.post_datum' in 'field list'

SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_datum, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name FROM phpbb_topics t, phpbb_posts p LEFT OUTER JOIN phpbb_posts p2 ON p2.post_id = t.topic_first_post_id LEFT OUTER JOIN phpbb_forums f ON p.forum_id = f.forum_id LEFT OUTER JOIN phpbb_users u ON p.poster_id = u.user_id LEFT OUTER JOIN phpbb_users u2 ON u2.user_id = t.topic_poster WHERE t.forum_id NOT IN ('start') AND t.forum_id IN (2,3) AND p.post_id = t.topic_last_post_id AND FROM_UNIXTIME(p.post_datum,'%Y%m%d') + FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0 ORDER BY t.topic_last_post_id DESC LIMIT 0, 10
Line : 127
File : recent.php

Code: Alles auswählen

$where_forums = ( $special_forums == '0' ) ? 't.forum_id NOT IN ('. $except_forums .')' : 't.forum_id NOT IN ('. $except_forums .') AND t.forum_id IN ('. $forum_ids .')';

$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_datum, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name

	        FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p

		LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id

		LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id

		LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id

		LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster

	        WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";

$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit";



switch( $mode )

{

	case 'today':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_datum,'%Y%m%d') + FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_today']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_datum,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0";

		$l_mode = $lang['Recent_title_today'];

		break;



	case 'yesterday':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_datum,'%Y%m%d') + FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_yesterday']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_datum,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1";

		$l_mode = $lang['Recent_title_yesterday'];

		break;



	case 'last24':

		$sql   = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_last24']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_datum < 86400";

		$l_mode = $lang['Recent_title_last24'];

		break;



	case 'lastweek':

		$sql  = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 691200". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_lastweek']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_datum < 691200";

		$l_mode = $lang['Recent_title_lastweek'];

		break;



	case 'lastXdays':

		$sql    = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400 * $amount_days". $sql_end;

		$template->assign_vars(array('STATUS' => sprintf($lang['Recent_lastXdays'], $amount_days)));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400 * $amount_days";

		$l_mode = sprintf($lang['Recent_title_lastXdays'], $amount_days);

		break;

na dann.
shwepsi
Mitglied
Beiträge: 1697
Registriert: 02.06.2003 14:37
Wohnort: NRW - immer dem Monitorleuchten folgen...
Kontaktdaten:

Beitrag von shwepsi »

befindet sich das Feld in einer anderen Tabelle?
Die Weisheit verfolgte mich sekundenlang...
Aber sie überholte mich und war fortan nicht mehr gesehen !!!
Gutschy
Mitglied
Beiträge: 125
Registriert: 13.06.2005 23:48

Beitrag von Gutschy »

Gutschy hat geschrieben:Hi Schwepsi,
leider ist da ein Fehler, er findet die entsprechende Spalte nicht. In deinen Angaben wird wohl nicht auf die entsprechende Tabelle verwiesen 'phpbb_posts_text'. Leider blick ich die SELECT Anweisung nur ganz ungefähr. Weiter unten noch mal der Code nach deinen Anweisungen umgeschrieben.
Genau es ist eine andere Tabelle (phpbb_posts_text) und ich kann nicht mal in der SQL Anweisung erkennen welche Tabellen überhaupt angesprochen werden.

Für Spaß mal die ganze recent.php aus der der Code Teil kommt.

Code: Alles auswählen

<?php

// ############         Edit below         ########################################

$topic_length = '40';	// length of topic title

$topic_limit = '10';	// limit of displayed topics per page

$special_forums = '1';	// specify forums ('0' = no; '1' = yes)

$forum_ids = '2,3';		// IDs of forums; separate them with a comma

$set_mode = 'today';	// set default mode ('today', 'yesterday', 'last24', 'lastweek', 'lastXdays')

$set_days = '3';		// set default days (used for lastXdays mode)

// ############         Edit above         ########################################



define('IN_PHPBB', true);

$phpbb_root_path = './';

include($phpbb_root_path .'extension.inc');

include($phpbb_root_path .'common.'.$phpEx);



$userdata = session_pagestart($user_ip, PAGE_RECENT);

init_userprefs($userdata);



$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;



if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )

{

	$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];

}

else

{

	$mode = $set_mode;

}



if( isset($HTTP_GET_VARS['amount_days']) || isset($HTTP_POST_VARS['amount_days']) )

{

	$amount_days = ( isset($HTTP_GET_VARS['amount_days']) ) ? $HTTP_GET_VARS['amount_days'] : $HTTP_POST_VARS['amount_days'];

}

else

{

	$amount_days = $set_days;

}



$page_title = $lang['Recent_topics'];

include($phpbb_root_path .'includes/page_header.'.$phpEx);



$sql_auth = "SELECT * FROM ". FORUMS_TABLE;

if( !$result_auth = $db->sql_query($sql_auth) )

{

	message_die(GENERAL_ERROR, 'could not query forums information.', '', __LINE__, __FILE__, $sql_auth);

}

$forums = array();

while( $row_auth = $db->sql_fetchrow($result_auth) )

{

	$forums[] = $row_auth;

}

$db->sql_freeresult($result_auth);



$is_auth_ary = array();

$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);



$except_forums = '\'start\'';

for( $f = 0; $f < count($forums); $f++ )

{

	if( (!$is_auth_ary[$forums[$f]['forum_id']]['auth_read']) || (!$is_auth_ary[$forums[$f]['forum_id']]['auth_view']) )

	{

		if( $except_forums == '\'start\'' )

		{

			$except_forums = $forums[$f]['forum_id'];

		}

		else

		{

			$except_forums .= ','. $forums[$f]['forum_id'];

		}

	}

}



$where_forums = ( $special_forums == '0' ) ? 't.forum_id NOT IN ('. $except_forums .')' : 't.forum_id NOT IN ('. $except_forums .') AND t.forum_id IN ('. $forum_ids .')';

$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_datum, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name

	        FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p

		LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id

		LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id

		LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id

		LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster

	        WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";

$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit";



switch( $mode )

{

	case 'today':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_datum,'%Y%m%d') + FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_today']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_datum,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = 0";

		$l_mode = $lang['Recent_title_today'];

		break;



	case 'yesterday':

		$sql = $sql_start ."FROM_UNIXTIME(p.post_datum,'%Y%m%d') + FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_yesterday']));

		$where_count = "$where_forums AND FROM_UNIXTIME(p.post_datum,'%Y%m%d') - FROM_UNIXTIME(unix_timestamp(NOW()),'%Y%m%d') = -1";

		$l_mode = $lang['Recent_title_yesterday'];

		break;



	case 'last24':

		$sql   = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_last24']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_datum < 86400";

		$l_mode = $lang['Recent_title_last24'];

		break;



	case 'lastweek':

		$sql  = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 691200". $sql_end;

		$template->assign_vars(array('STATUS' => $lang['Recent_lastweek']));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) - p.post_datum < 691200";

		$l_mode = $lang['Recent_title_lastweek'];

		break;



	case 'lastXdays':

		$sql    = $sql_start ."UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400 * $amount_days". $sql_end;

		$template->assign_vars(array('STATUS' => sprintf($lang['Recent_lastXdays'], $amount_days)));

		$where_count = "$where_forums AND UNIX_TIMESTAMP(NOW()) + p.post_datum < 86400 * $amount_days";

		$l_mode = sprintf($lang['Recent_title_lastXdays'], $amount_days);

		break;



	default:

		$message = $lang['Recent_wrong_mode'] .'<br /><br />'. sprintf($lang['Recent_click_return'], '<a href="'. append_sid("recent.$phpEx") .'">', '</a>') .'<br />'. sprintf($lang['Click_return_index'], '<a href="'. append_sid("index.$phpEx") .'">', '</a>');

		message_die(GENERAL_MESSAGE, $message);

		break;

}

if( !$result = $db->sql_query($sql) )

{

	message_die(GENERAL_ERROR, 'could not obtain main information.', '', __LINE__, __FILE__, $sql);

}

$line = array();

while( $row = $db->sql_fetchrow($result) )

{

	$line[] = $row;

}

$db->sql_freeresult($result);

		

$template->set_filenames(array('body' => 'recent_body.tpl'));



$orig_word = array();

$replacement_word = array();

obtain_word_list($orig_word, $replacement_word);



$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) : array();

$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) : array();

for( $i = 0; $i < count($line); $i++ )

{

	$forum_id = $line[$i]['forum_id'];

	$forum_url = append_sid("viewforum.$phpEx?". POST_FORUM_URL ."=$forum_id");

	$topic_id = $line[$i]['topic_id'];

	$topic_url = append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id");



	$word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title'];

	$topic_title = ( strlen($line[$i]['topic_title']) < $topic_length ) ? $word_censor : substr(stripslashes($word_censor), 0, $topic_length) .'...';



	$topic_type =  ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';

	$topic_type .= ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';

	$topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';

	$topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';



	$views = $line[$i]['topic_views'];

	$replies = $line[$i]['topic_replies'];

	if( ( $replies + 1 ) > $board_config['posts_per_page'] )

	{

		$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );

		$goto_page = ' [ ';

		$times = '1';

		for( $j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'] )

		{

			$goto_page .= '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=". $topic_id ."&start=$j") .'">'. $times .'</a>';

			if( $times == '1' && $total_pages > '4' )

			{

				$goto_page .= ' ... ';

				$times = $total_pages - 3;

				$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];

			}

			else if( $times < $total_pages )

			{

				$goto_page .= ', ';

			}

			$times++;

		}

		$goto_page .= ' ] ';

	}

	else

	{

		$goto_page = '';

	}



	if( $line[$i]['topic_status'] == TOPIC_LOCKED )

	{

		$folder = $images['folder_locked'];

		$folder_new = $images['folder_locked_new'];

	}

	else if( $line[$i]['topic_type'] == POST_ANNOUNCE )

	{

		$folder = $images['folder_announce'];

		$folder_new = $images['folder_announce_new'];

	}

	else if( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )

	{

		$folder = $images['folder_global_announce'];

		$folder_new = $images['folder_global_announce_new'];

	}

	else if( $line[$i]['topic_type'] == POST_STICKY )

	{

		$folder = $images['folder_sticky'];

		$folder_new = $images['folder_sticky_new'];

	}

	else

	{

		if( $replies >= $board_config['hot_threshold'] )

		{

			$folder = $images['folder_hot'];

			$folder_new = $images['folder_hot_new'];

		}

		else

		{

			$folder = $images['folder'];

			$folder_new = $images['folder_new'];

		}

	}



	$newest_img = '';

	if( $userdata['session_logged_in'] )

	{

		if( $line[$i]['post_time'] > $userdata['user_lastvisit'] ) 

		{

			if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )

			{

				$unread_topics = true;

				if( !empty($tracking_topics[$topic_id]) )

				{

					if( $tracking_topics[$topic_id] >= $line[$i]['post_time'] )

					{

						$unread_topics = false;

					}

				}

				if( !empty($tracking_forums[$forum_id]) )

				{

					if( $tracking_forums[$forum_id] >= $line[$i]['post_time'] )

					{

						$unread_topics = false;

					}

				}

				if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all']) )

				{

					if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f_all'] >= $line[$i]['post_time'] )

					{

						$unread_topics = false;

					}

				}



				if( $unread_topics )

				{

					$folder_image = $folder_new;

					$folder_alt = $lang['New_posts'];

					$newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&view=newest") .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';

				}

				else

				{

					$folder_image = $folder;

					$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

					$newest_img = '';

				}

			}

			else

			{

				$folder_image = $folder_new;

				$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['New_posts'];

				$newest_img = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id&view=newest") .'"><img src="'. $images['icon_newest_reply'] .'" alt="'. $lang['View_newest_post'] .'" title="'. $lang['View_newest_post'] .'" border="0" /></a> ';

			}

		}

		else 

		{

			$folder_image = $folder;

			$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

			$newest_img = '';

		}

	}

	else

	{

		$folder_image = $folder;

		$folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

		$newest_img = '';

	}

			

	$first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);

	$first_author = ( $line[$i]['first_poster_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $line[$i]['first_poster_id']) .'">'. $line[$i]['first_poster'] .'</a>' : ( ($line[$i]['first_poster_name'] != '' ) ? $line[$i]['first_poster_name'] : $lang['Guest'] );

	$last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);

	$last_author = ( $line[$i]['last_poster_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $line[$i]['last_poster_id']) .'">'. $line[$i]['last_poster'] .'</a>' : ( ($line[$i]['last_poster_name'] != '' ) ? $line[$i]['last_poster_name'] : $lang['Guest'] );

	$last_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL .'='. $line[$i]['topic_last_post_id']) .'#'. $line[$i]['topic_last_post_id'] .'"><img src="'. $images['icon_latest_reply'] .'" alt="'. $lang['View_latest_post'] .'" title="'. $lang['View_latest_post'] .'" border="0" /></a>';



	$template->assign_block_vars('recent', array(

		'ROW_CLASS' => ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'],

		'TOPIC_TITLE' => $topic_title,

		'TOPIC_TYPE' => $topic_type,

		'GOTO_PAGE' => $goto_page,

		'L_VIEWS' => $lang['Views'],

		'VIEWS' => $views,

		'L_REPLIES' => $lang['Replies'],

		'REPLIES' => $replies,

		'NEWEST_IMG' => $newest_img,

		'TOPIC_FOLDER_IMG' => $folder_image,

		'TOPIC_FOLDER_ALT' => $folder_alt,

		'FIRST_TIME' => sprintf($lang['Recent_first'], $first_time),

		'FIRST_AUTHOR' => sprintf($lang['Recent_first_poster'], $first_author),

		'LAST_TIME' => $last_time,

		'LAST_AUTHOR' => $last_author,

		'LAST_URL' => $last_url,

		'FORUM_NAME' => $line[$i]['forum_name'],

		'U_VIEW_FORUM' => $forum_url,

		'U_VIEW_TOPIC' => $topic_url,

	));

}



$sql = "SELECT count(t.topic_id) AS total_topics FROM ". TOPICS_TABLE ." t , ". POSTS_TABLE ." p

           WHERE $where_count AND p.post_id = t.topic_last_post_id";

if( !($result = $db->sql_query($sql)) )

{

	message_die(GENERAL_ERROR, 'error getting total topics.', '', __LINE__, __FILE__, $sql);

}

if( $total = $db->sql_fetchrow($result) )

{

	$total_topics = $total['total_topics'];

	$pagination = generate_pagination("recent.$phpEx?amount_days=$amount_days&mode=$mode", $total_topics, $topic_limit, $start) .'&nbsp;';

}



if( $total_topics == '0' )

{

	$template->assign_block_vars('switch_no_topics', array());

}



$template->assign_vars(array(

	'L_RECENT_TITLE' => ( $total_topics == '1' ) ? sprintf($lang['Recent_title_one'], $total_topics, $l_mode) : sprintf($lang['Recent_title_more'], $total_topics, $l_mode),

	'L_TODAY' => $lang['Recent_today'],

	'L_YESTERDAY' => $lang['Recent_yesterday'],

	'L_LAST24' => $lang['Recent_last24'],

	'L_LASTWEEK' => $lang['Recent_lastweek'],

	'L_LAST' => $lang['Recent_last'],

	'L_DAYS' => $lang['Recent_days'],

	'L_SELECT_MODE' => $lang['Recent_select_mode'],

	'L_SHOWING_POSTS' => $lang['Recent_showing_posts'],

	'L_NO_TOPICS' => $lang['Recent_no_topics'],

	'AMOUNT_DAYS' => $amount_days,

	'FORM_ACTION' => append_sid("recent.$phpEx"),

	'PAGINATION' => ( $total_topics != '0' ) ? $pagination : '',

	'PAGE_NUMBER' => ( $total_topics != '0' ) ? sprintf($lang['Page_of'], ( floor( $start / $topic_limit ) + 1 ), ceil( $total_topics / $topic_limit )) : '',

));



$template->pparse('body');

include($phpbb_root_path .'includes/page_tail.'.$phpEx);

?>
[/b]
na dann.
Antworten

Zurück zu „phpBB 2.0: Mod Support“