Seite 2 von 2

Verfasst: 23.09.2006 14:24
von Maria77
SubForen Mod und index.php hört sich gut an.
Und weiter? :D

Verfasst: 23.09.2006 15:58
von Miriam
Leider hat sich gerade eben.... *wirklich* meine Kristallkugel verabschiedet. Jetzt kann ich nicht mehr erkennen, wie die gemachten Codeänderungen deinerseits waren.
Im Portal funzt es ja... im Index nicht. Vergleiche mal den Code. 8)

Verfasst: 24.09.2006 11:39
von Maria77
Nun, ich hatte ehrlich gesagt, gehofft, dass mir jemand, der Ahnung von PHP hat, sagen kann, wo in dem ganz Code ich ungefähr die Stelle suchen muß, wo festgelegt wird, wer die Titel der letzten Beiträge in welchem Forum lesen darf.

Die Stellen, die beim Subforen Mod geändert wurden, habe ich in index.php und portal.php bereits verglichen und ich konnte dort keine Unterschiede finden.

Verfasst: 24.09.2006 13:24
von Miriam
Nun, ich hatte ehrlich gesagt, gehofft, dass mir jemand, der Ahnung von PHP hat, sagen kann, wo in dem ganz Code ich ungefähr die Stelle suchen muß, wo festgelegt wird, wer die Titel der letzten Beiträge in welchem Forum lesen darf.
Soweit ich es in meiner Kristallkugel ersehen kann (und weil ich so gut php_code raten kann), liegt die Ursache in der Variablen $last_post... da solltest Du also meiner Meinung nach den Hebel ansetzen.....

Verfasst: 24.09.2006 14:34
von Maria77
Die ganz ursprünglichen Zeilen sind:

Code: Alles auswählen

if ( $forum_data[$j]['forum_last_post_id'] )
							{
								$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

								$last_post = $last_post_time . '<br />';

								$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
								
								$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
							}
Dabei wird dann aber der Titel des letzten Beitrags nicht angezeigt. Durch folgende Modifikation erscheint dieser dann:

Code: Alles auswählen

if ( $forum_data[$j]['forum_last_post_id'] )
	{
		$topic_title = $forum_data[$j]['topic_title'];
		$topic_title2 = $forum_data[$j]['topic_title'];
		
		//
		// Censor topic title
		//
		if ( count($orig_word) )
		{
			$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
			$topic_title2 = preg_replace($orig_word, $replacement_word, $topic_title2);
		}
										
		if (strlen($topic_title)>27) {
			$topic_title = substr($topic_title,0,24) . '...';
		}

		$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
		$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
		$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
		$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
	}
Der Sub Foren-Mod ändert obige Zeilen aber folgendermaßen:

Code: Alles auswählen

if (strlen($forum_data[$j]['topic_title'])>=25)
								{
									$forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'],0,25). "...";
								}

								$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
								$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '">'.$forum_data[$j]['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

								$last_post .= '<br /> '; 
								$last_post .= ' '.$last_post_time;								
								$last_post .= '<br /> '; 
								$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
Nach dieser Änderung wird dann allen, ob nun Zugangsberechtigung zu dem entsprechenden Forum oder nicht, angezeigt, wie der Titel des letzten Beitrags lautet.
Wie bekomme ich nun diese beiden Modifikationen mit einander vereinbart?

Verfasst: 24.09.2006 16:18
von Vatex
habe den subforum mod nicht, hoffe es funktioniert

Code: Alles auswählen

if (strlen($forum_data[$j]['topic_title'])>=25)
                        {
                           $forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'],0,25). "...";
                        }

                        $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']); 

$is_auth_last_post = array();

$is_auth_last_post = auth(AUTH_READ, AUTH_ACL, $userdata, $forum_data[$j]);

if ( !$is_auth_last_post['auth_read'] )
{

$last_post = $last_post_time . '<br />';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';

$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

}else{

$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '">'.$forum_data[$j]['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';

$last_post .= '<br /> ';

$last_post .= ' '.$last_post_time;

$last_post .= '<br /> ';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
}

Verfasst: 24.09.2006 16:57
von Maria77
Hab es direkt ausprobiert. :wink:

Es kommt folgende Fehlermeldung:

Parse error: parse error, unexpected T_ELSE in /var/www/virtual/domrep2005.de/htdocs/phpBB2/index.php on line 709

Das ist die Zeile, die dann nach Deiner Änderung folgt. Diese lautet:

Code: Alles auswählen

else
                                                        {
                                                                $last_post = $lang['No_Posts'];
                                                        }

Verfasst: 24.09.2006 17:06
von Vatex
einfach ein } an die Änderung bzw vor das else machen, dann sollte es gehen

Verfasst: 24.09.2006 18:14
von Maria77
Es funktioniert!
Gigantisch!
Vielen lieben Dank!

Verfasst: 24.09.2006 18:51
von Miriam
Nach nur 4,5 Monaten eine Lösung.... Das nenn' ich mal flink :D