portal album

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
jeroendegier
Berichten: 77
Lid geworden op: 07 feb 2007, 17:49

portal album

Bericht door jeroendegier » 14 mar 2007, 01:40

ik heb deze mod geinstalleerd en nu zecht ie dat er een fout inzit in portal.php
in de dik gedrukte lijn maar ik heb hem gewoon geplakt dat aan de code kan geen fout zitten....

// Start add - Photo Album Block
$album_root_path = $phpbb_root_path . 'album_mod/';
include_once($album_root_path . 'album_common.'.$phpEx);


Code: Selecteer alles

##############################################################
## MOD Title:		Photo Album Block Add-on
## MOD Author:		kooky < [nospam]kooky@altern.org > (n/a) http://kooky06.free.fr/board/
## MOD Description:	This mod will show last or random pics on your portal (or index)
##			It uses album's permissions, approval options (and many more).
##			You can choose to add one or some pics and allow only one category
##			to be displayed on portal (multi-cats support) with an Admin Panel.
## MOD Version:		1.0.1
##
## MOD Require:		Photo Album Addon v2.0.53
##			Smartor < smartor_xp@hotmail.com > (Hoang Ngoc Tu) http://smartor.is-root.com
##			Any phpBB Portal (ezPortal, GFportal, ...)
##
## Installation Level:	Easy
## Installation Time:	5 minutes
## Files to Edit:	4
##			portal.php
##			language/lang_english/lang_admin.php
##			language/lang_english/lang_main.php
##			templates/subSilver/portal_body.tpl
## Included Files:	2
##			admin_album_block.php
##			album_block_body.tpl
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## 1. Copyright and special thanks!
## -----------
## 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.
##
## i would like to thanks Smartor for his great work on Photo Album Addon.
## This mod was designed for ezPortal and can be easily use
## on any phpBB page.
##
## If you want to add this Mod to any database, please don't add
## my e-mail address to a topic, just point to my website (see above).
## (for spamming prevention)
##
## 2. Feature list
## -----------
## Admin Photo CP to manage:
## - Change the number of pics displays
## - Allow only one or more categories
## - Show both public & personal pics
## - Use randomization
##
## Also available few cool stuffs in contrib directory.
##	o Add Photo Album Block on index.
##	o Display Photo Album Block horizontally.
##	o Add to Photo Album Block a scrolling effect
##
## 3. Compatibility / EasyMOD
## -----------
## This MOD is compatible with phpBB 2.0.3 - 2.0.13
##
## It is also compatible with EasyMOD of Nuttzy and can be
## installed by it but is not yet certified EMC (EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## 4. Official last version link
## -----------
## Contact with email address quoted above without [nospam]
## Check this official link for latest updates...
## http://kooky06.free.fr/board/
##
##############################################################
## MOD History:
##
## 2005/02/05 - Version 1.0.1
##	- Added Multi-categories support
##	- Confirmed on phpBB 2.0.11
##
## 2004/08/16 - Version 1.0.0
##	- Easy Mod compliant (EMC)
##	- Improved code
##	- Removed some useless lines
##	- Added Pics dimensions/size
##	- Added username color (if ADMIN or MOD)
##	- Added Photo Album Block's own Admin Panel
##
## 2004/05/15 - Version 0.9.2
##	- Allow to display block vertically or horizontally (see contrib dir)
##
## 2003/11/15 - Version 0.9.1
##	- Added personal gallery viewing
##
## 2003/11/15 - Version 0.9.0
##	- initial BETA release phpBB2
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
# If you use a beta release of EasyMOD, this instructions will be executed!
# Please read author notes to update your database.
#
INSERT INTO `phpbb_album_config` (config_name, config_value) VALUES ('cat_id', '0');
INSERT INTO `phpbb_album_config` (config_name, config_value) VALUES ('pics_all', '0');
INSERT INTO `phpbb_album_config` (config_name, config_value) VALUES ('pics_number', '1');
INSERT INTO `phpbb_album_config` (config_name, config_value) VALUES ('pics_sort', '0');

#
#-----[ COPY ]------------------------------------------
#
copy root/admin/admin_album_block.php to admin/admin_album_block.php
copy root/templates/subSilver/admin/album_block_body.tpl to templates/subSilver/admin/album_block_body.tpl

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start add  - Photo Album Block
$lang['Photo_block'] = 'Photo Album Block';
$lang['Album_block_config'] = 'Photo Album Block Configuration';
$lang['Album_block_config_explain'] = 'Here, you can change the general settings of your Photo Album Block.';
$lang['Click_return_album_block_config'] = 'Click %sHere%s to return to the Photo Album Block Configuration';
$lang['Pics_cat_id'] = 'Pics category';
$lang['Pics_cat_id_explain'] = 'ID from a category of the Photo Album.<br />0 means all categories, use comma to separate your categories, eg: 2,3.';
$lang['Pics_number'] = 'Number of pics';
$lang['Pics_number_explain'] = 'Show the number of pics you want to view on your portal.';
$lang['Pics_all'] = 'Enable personal gallery viewing';
$lang['Pics_sort'] = 'Show randomly your pics';
// End add  - Photo Album Block

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start add  - Photo Album Block
$lang['Newest_pics'] = 'Newest Pics';
$lang['Random_pics'] = 'Random Pics';
$lang['Dimension'] = 'Dimensions';
$lang['Size'] = 'Size';
$lang['Kb'] = 'Kb';
// End add  - Photo Album Block

#
#-----[ OPEN ]------------------------------------------
#
portal.php

#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
	'WELCOME_TEXT' => $CFG['welcome_text'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start add  - Photo Album Block
$album_root_path = $phpbb_root_path . 'album_mod/';
include_once($album_root_path . 'album_common.'.$phpEx);

// Build Categories Index
$sql = "SELECT c.*
		FROM ". ALBUM_CAT_TABLE ." AS c
			LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id
		WHERE cat_id <> 0
		GROUP BY cat_id
		ORDER BY cat_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}
$catrows = array();

while( $row = $db->sql_fetchrow($result) )
{
	$album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW
	if ($album_user_access['view'] == 1)
	{
		$catrows[] = $row;
	}
}
if ( $album_config['pics_all'] == '1' )
{
	$allowed_cat = '0'; // For Recent Public Pics below
}
else
{
	$allowed_cat = ''; 
}

//
// $catrows now stores all categories which this user can view. Dump them out!
//
for ($i = 0; $i < count($catrows); $i++)
{
	// Build allowed category-list (for recent pics after here)
	$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];

	// Check Pic Approval
	if ( ($catrows[$i]['cat_approval'] == ALBUM_ADMIN) || ($catrows[$i]['cat_approval'] == ALBUM_MOD) )
	{
		$pic_approval_sql = 'AND p.pic_approval = 1'; // Pic Approval ON
	}
	else
	{
		$pic_approval_sql = ''; // Pic Approval OFF
	}
}

// Recent Public Pics
if ( $album_config['pics_all'] == '1' )
{
	$pics_allowed = '0';
}
else
{
	$pics_allowed = '';
}

if ( $allowed_cat != $pics_allowed )
{
	$category_id = $album_config['cat_id'];

	if ( $album_config['pics_sort'] == '1' )
	{
		if ( $category_id != 0 )
		{
			$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
				FROM ". ALBUM_TABLE ." AS p
					LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
					LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
					LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
					LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
				WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
				GROUP BY p.pic_id
				ORDER BY RAND()
				LIMIT ". $album_config['pics_number'];
		}
		else
		{
			$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
				FROM ". ALBUM_TABLE ." AS p
					LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
					LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
					LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
					LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
				WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
				GROUP BY p.pic_id
				ORDER BY RAND()
				LIMIT ". $album_config['pics_number'];
			}
	}
	else if ( $album_config['pics_sort'] == '0' )
	{
		if ( $category_id != 0 )
		{
			$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
				FROM ". ALBUM_TABLE ." AS p
					LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
					LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
					LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
					LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
				WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) AND pic_cat_id IN ($category_id)
				GROUP BY p.pic_id
				ORDER BY pic_time DESC
				LIMIT ". $album_config['pics_number'];
		}
		else
		{
			$sql = "SELECT u.user_level, p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, u.user_level, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, p.pic_filename AS picfilename
				FROM ". ALBUM_TABLE ." AS p
					LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
					LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
					LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
					LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
				WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
				GROUP BY p.pic_id
				ORDER BY pic_time DESC
				LIMIT ". $album_config['pics_number'];
		}
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql);
	}
	$recentrow = array();

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

	if (count($recentrow) > 0)
	{
		for ($i = 0; $i < count($recentrow); $i += $album_config['cols_per_page'])
		{
			$template->assign_block_vars('recent_pics', array());

			for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
			{
				if ( $j >= count($recentrow) )
				{
					break;
				}

				if (!$recentrow[$j]['rating'])
				{
					$recentrow[$j]['rating'] = $lang['Not_rated'];
				}
				else
				{
					$recentrow[$j]['rating'] = round($recentrow[$j]['rating'], 2);
				}

				// Display pics horizontally
				$template->assign_block_vars('recent_pics.recent_col', array(
					'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
					'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
					'DESC' => $recentrow[$j]['pic_desc'])
				);

				if ( ($recentrow[$j]['user_id'] == ALBUM_GUEST) or ($recentrow[$j]['username'] == '') )
				{
					$recent_poster = ($recentrow[$j]['pic_username'] == '') ? $lang['Guest'] : $recentrow[$j]['pic_username'];
				}
				else
				{
					// Start add - Username Color Mod
					switch ( $recentrow[$j]['user_level'] )
					{
						case ADMIN:
							$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
							$style_color = ' style="color:# ' . $theme['fontcolor3'] . '"';
							break;
						case MOD:
							$poster_name = '<strong>' . $recentrow[$j]['username'] . '</strong>';
							$style_color = ' style="color:# ' . $theme['fontcolor2'] . '"';
							break;
						default:
							$poster_name = $recentrow[$j]['username'];
							$style_color = '';
							break;
					}
					// End add - Username Color Mod
					$recent_poster = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $recentrow[$j]['user_id']) . '"' . $style_color . '>' . $poster_name . '</a>';
				}

				// Start add - Pics Dimension/Size Add-on
				$pic_dimension = getimagesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename']);
				$pic_width = $pic_dimension[0];
				$pic_height = $pic_dimension[1];

				$pic_size = round(((filesize(ALBUM_UPLOAD_PATH . $recentrow[$j]['picfilename'])) / 1024), 2) . ' ' . $lang['Kb'];
				// End add - Pics Dimension/Size Add-on

				// Display pics vertically
				$template->assign_block_vars('recent_pics.recent_detail', array(
					'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $recentrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
					'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $recentrow[$j]['pic_id']),
					'DESC' => $recentrow[$j]['pic_desc'],
					'TITLE' => $recentrow[$j]['pic_title'],
					'POSTER' => $recent_poster,
					'TIME' => create_date($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']),
					// New entries - Pics Dimension/Size Add-on
					'DIMENSION' => $pic_width . ' x ' . $pic_height,
					'SIZE' => $pic_size,
					'VIEW' => $recentrow[$j]['pic_view_count'],
					'RATING' => ($album_config['rate'] == 1) ? ( $lang['Rating'] . ': <a href="' . append_sid("album_rate.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['rating'] . '</a><br />') : '',
					'COMMENTS' => ($album_config['comment'] == 1) ? ( $lang['Comments'] . ': <a href="' . append_sid("album_comment.$phpEx?pic_id=". $recentrow[$j]['pic_id']) . '">' . $recentrow[$j]['comments'] . '</a>') : '')
				);
			}
		}
	}
	else
	{
		// No Pics Found
		$template->assign_block_vars('no_pics', array());
	}
}
else
{
	// No Cats Found
	$template->assign_block_vars('no_pics', array());
}
// End add  - Photo Album Block
#
#-----[ FIND ]------------------------------------------
#
	'L_VOTE_BUTTON' => $lang['Vote'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
	// Start add - Photo Album Block
	'S_COLS' => $album_config['cols_per_page'],
	'S_COL_WIDTH' => ( 100/$album_config['cols_per_page'] ) . '%',
	'TARGET_BLANK' => ( $album_config['fullpic_popup'] ) ? ' target="_blank"' : '',
	'U_ALBUM' => append_sid('album.'.$phpEx),
	'L_ALBUM' => $lang['Album'],
	'L_NEWEST_PICS' => ( $album_config['pics_sort'] == '0' ) ? $lang['Newest_pics'] : $lang['Random_pics'],
	'L_NO_PICS' => $lang['No_Pics'],
	'L_PIC_TITLE' => $lang['Pic_Title'],
	'L_POSTER' => $lang['Poster'],
	'L_POSTED' => $lang['Posted'],
	'L_DIMENSION' => $lang['Dimension'],
	'L_SIZE' => $lang['Size'],
	'L_VIEW' => $lang['View'],
	// End add - Photo Album Block
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/portal_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<a href="{U_INDEX}">{L_FORUM}</a><br />
#
#-----[ AFTER, ADD ]------------------------------------------
#
				<a href="{U_ALBUM}">{L_ALBUM}</a><br />
#
#-----[ FIND ]------------------------------------------
#
</form>
<!-- END switch_user_logged_out -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
				<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
					<tr>
						<th class="thTop" height="25" nowrap="nowrap">{L_NEWEST_PICS}</th>
					</tr>
					<!-- BEGIN no_pics -->
					<tr>
						<td class="row1" align="center" height="50"><span class="gen">{L_NO_PICS}</span></td>
					</tr>
					<!-- END no_pics -->
					<!-- BEGIN recent_pics -->
					<!-- BEGIN recent_detail -->
					<tr>
						<td class="row1" width="{S_COL_WIDTH}" align="center"><a href="{recent_pics.recent_detail.U_PIC}"{TARGET_BLANK}><img src="{recent_pics.recent_detail.THUMBNAIL}" border="0" alt="{recent_pics.recent_detail.DESC}" title="{recent_pics.recent_detail.DESC}" vspace="10" /></a></td>
					</tr>
					<tr>
						<td class="row2" align="center">
							<span class="gensmall">
							{L_PIC_TITLE}: {recent_pics.recent_detail.TITLE}<br />
							{L_POSTER}: {recent_pics.recent_detail.POSTER}<br />
							{L_POSTED}: {recent_pics.recent_detail.TIME}<br />
							{L_DIMENSION}: {recent_pics.recent_detail.DIMENSION}<br />
							{L_SIZE}: {recent_pics.recent_detail.SIZE}<br />
							{L_VIEW}: {recent_pics.recent_detail.VIEW}<br />
							{recent_pics.recent_detail.RATING}{recent_pics.recent_detail.COMMENTS}<br />
							</span>
						</td>
					</tr>
					<!-- END recent_detail -->
					<!-- END recent_pics -->
					<tr>
						<td class="row3" height="25" align="center"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]</span></td>
					</tr>
				</table>
				<br />
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Gebruikersavatar
Ramon Fincken
Berichten: 2552
Lid geworden op: 27 nov 2005, 23:15
Locatie: Diemen
Contacteer:

Bericht door Ramon Fincken » 14 mar 2007, 08:49

erm... als je portal.php eens plaatst ipv de MOD install instructies alleen?
( laat die maar staan in dit geval )
Freelance webdevelopment, including phpbb2 scripting!

Website founder van: phpBBinstallers.net phpBBantispam.com
Mods: zie op http://www.phpbb.com Blog in wording: RamonFincken.com

Gesloten