Pagina 1 van 1

mod post icons

Geplaatst: 25 apr 2005, 14:26
door Diddie
This mod will allow to add an icon in front of each topic title.
en ik krijg deze foutmelding:
Parse error: syntax error, unexpected T_FUNCTION in C:\xampp\htdocs\phpBB2\includes\functions.php on line 28

en dat is deze code:

Code: Selecteer alles

<?php//-- mod : language settings -----------------------------------------------------------------------
//-- mod : mods settings ---------------------------------------------------------------------------
//-- mod : post icon
/***************************************************************************
 *                               functions.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: functions.php,v 1.133.2.34 2005/02/21 18:37:33 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/

//-- mod : post icon -------------------------------------------------------------------------------
//-- add
function get_icon_title($icon, $empty=0, $topic_type=-1, $admin=false)
{
	global $lang, $images, $phpEx, $phpbb_root_path;

	// get icons parameters
	include($phpbb_root_path . './includes/def_icons.' . $phpEx);

	// admin path
	$admin_path = ($admin) ? '../' : './';

	// alignment
	switch ($empty)
	{
		case 1:
			$align= 'middle';
			break;
		case 2:
			$align= 'bottom';
			break;
		default:
			$align = 'absbottom';
			break;
	}

	// find the icon
	$found = false;
	$icon_map = -1;
	for ($i=0; ($i < count($icones)) && !$found; $i++)
	{
		if ($icones[$i]['ind'] == $icon)
		{
			$found = true;
			$icon_map = $i;
		}
	}

	// icon not found : try a default value
	if (!$found || ($found && empty($icones[$icon_map]['img'])))
	{
		$change = true;
		switch($topic_type)
		{
			case POST_NORMAL:
				$icon = $icon_defined_special['POST_NORMAL']['icon'];
				break;
			case POST_STICKY:
				$icon = $icon_defined_special['POST_STICKY']['icon'];
				break;
			case POST_ANNOUNCE:
				$icon = $icon_defined_special['POST_ANNOUNCE']['icon'];
				break;
			case POST_GLOBAL_ANNOUNCE:
				$icon = $icon_defined_special['POST_GLOBAL_ANNOUNCE']['icon'];
				break;
			case POST_BIRTHDAY:
				$icon = $icon_defined_special['POST_BIRTHDAY']['icon'];
				break;
			case POST_CALENDAR:
				$icon = $icon_defined_special['POST_CALENDAR']['icon'];
				break;
			case POST_PICTURE:
				$icon = $icon_defined_special['POST_PICTURE']['icon'];
				break;
			case POST_ATTACHMENT:
				$icon = $icon_defined_special['POST_ATTACHEMENT']['icon'];
				break;
			default:
				$change=false;
				break;
		}

		// a default icon has been sat
		if ($change)
		{
			// find the icon
			$found = false;
			$icon_map = -1;
			for ($i=0; ($i < count($icones)) && !$found; $i++)
			{
				if ($icones[$i]['ind'] == $icon)
				{
					$found = true;
					$icon_map = $i;
				}
			}
		}
	}

	// build the icon image
	if (!$found || ($found && empty($icones[$icon_map]['img'])))
	{
		switch ($empty)
		{
			case 0:
				$res = '';
				break;
			case 1:
				$res = '<img width="20" align="' . $align . '" src="' . $admin_path . $images['spacer'] . '" alt="" border="0">';
				break;
			case 2:
				$res = isset($lang[ $icones[$icon_map]['alt'] ]) ? $lang[ $icones[$icon_map]['alt'] ] : $icones[$icon_map]['alt'];
				break;
		}
	}
	else
	{
		$res = '<img align="' . $align . '" src="' . ( isset($images[ $icones[$icon_map]['img'] ]) ? $admin_path . $images[ $icones[$icon_map]['img'] ] : $admin_path . $icones[$icon_map]['img'] ) . '" alt="' . ( isset($lang[ $icones[$icon_map]['alt'] ]) ? $lang[ $icones[$icon_map]['alt'] ] : $icones[$icon_map]['alt'] ) . '" border="0">';
	}

	return $res;
}
//-- fin mod : post icon
function get_db_stat($mode)
{
	global $db;

	switch( $mode )
	{
regel 27,28,29,30:

Code: Selecteer alles

//-- add
function get_icon_title($icon, $empty=0, $topic_type=-1, $admin=false)
{
	global $lang, $images, $phpEx, $phpbb_root_path;

Author Notes:
##
## You have to CHMOD to 666 includes/def_icons.php in order to be able to edit it
## in the ACP.
maar het forum draait op mijn eigen pc, hoe moet ik dit dan doen? (ik ben bezig aan een compleet nieuw forum, dus test ik het nu volledig op mijn pc)

ZVG Diddie!

Geplaatst: 25 apr 2005, 14:31
door Paul
het enige wat ik zou gauw zie is:

Code: Selecteer alles

<?php//-- mod : language settings
zet na php een enter.(Zodat het met de volgende regel een regel word :))

Geplaatst: 25 apr 2005, 14:43
door Diddie
ok, dat heb ik overal gedaan, die fout is nu weg, maar nu heb ik het volgende als ik iets wil posten:
Error in posting

DEBUG MODE

INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig, post_icon) VALUES (16, 1, 2, '', 1114436424, '7f000001', 1, 0, 1, 0, 2)
Line : 291
File : functions_post.php

en dat is dan het volgende:

Code: Selecteer alles

	$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
	//-- mod : post icon -------------------------------------------------------------------------------
// here we added
// , post_icon
// , $post_icon
//
// and
//  , post_icon = $post_icon
//-- modify
      $sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig, post_icon) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig, $post_icon)" : "UPDATE " . POSTS_TABLE . " SET post_username = '$post_username', enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig, post_icon = $post_icon" . $edited_sql . " WHERE post_id = $post_id";//-- fin mod : post icon	if (!$db->sql_query($sql, BEGIN_TRANSACTION))
	{
		message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
	}

	if ($mode != 'editpost')

Geplaatst: 25 apr 2005, 14:49
door Paul
1. Dat is volgens mij niet de hele fout :roll:
2. Heb je de sql gedaan?

Geplaatst: 25 apr 2005, 14:53
door Diddie
yep heb de sql gedaan, maar ik zal ff dit bestand nogmaals modden :wink:

Geplaatst: 25 apr 2005, 15:05
door Diddie
ok, ik ben hier, alles werkt in de previeuw, maar als ik het dan ook werkelijk post, dan zie ik de icons niet????

Geplaatst: 25 apr 2005, 15:08
door Paul
heb je viewtopic_body.tpl goed gemod? En viewtopic?

Geplaatst: 25 apr 2005, 15:11
door Diddie
die zijn goed gemod, ik kom er niet echt uit :?
het zal dan voor morgen zijn, eerst gaan werken.
toch al bedankt, ge doet da goe!