Code: Alles auswählen
##############################################################
## Title: Photo Album Addon Block for Smartor's ezPortal v2.x
## MOD Version: 1.0.1
## Author: Kooky < kooky06@hotmail.com > - http://planetsport.nasov.net
##
## Description: This file explains you how to create a block for Photo Album Addon on
## ezPortal for a recent or a randomize pic
##
## Required Photo Album Addon v2.x Smartor < smartor_xp@hotmail.com > - http://smartor.is-root.com
##
## Installation Level: easy
## Installation Time: 5-10 Minutes
## Files To Edit: 3
## portal.php
## templates/subSilver/portal_body.tpl
## language/lang_english/lang_main.php
##
## Included Files: N/A
##
##
## History:
## 0.9.0. - initial BETA release
## 1.0.0. - fixed approval issue
## 1.0.1. - fixed locked issue
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## Authors Notes:
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## and the Database
##############################################################
#
#-----[ OPEN ]---------------------------------------------
#
portal.php
#
#-----[ FIND ]----------------------------------------
#
//
// END - Avatar On Index MOD
//
#
#-----[ AFTER ADD ]-----------------------------------
#
//
// Get Newest Pic
//
$Display = 'Recent'; // Replace 'Recent' with 'Random'
$CategoryID = 0; // Replace 0 with a category ID. Otherwise, keep it as it is Example: http://www.yourdomain.com/phpBB2/album_cat.php?cat_id=3
// Category ID is 3
if ($Display == 'Random')
{
if ($CategoryID != 0)
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_approval, u.username
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id = $CategoryID
ORDER BY RAND()
LIMIT 0,1";
}
else {
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_lock, p.pic_approval, u.username
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
WHERE pic_approval = 1 AND pic_lock = 0
ORDER BY RAND()
LIMIT 0,1";
}
}
else if ($Display == 'Recent')
{
if ($CategoryID != 0)
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_approval, u.username
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id = $CategoryID
ORDER BY pic_time DESC
LIMIT 0,1";
}
else
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_lock, p.pic_approval, u.username
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
WHERE pic_approval = 1 AND pic_lock = 0
ORDER BY pic_time DESC
LIMIT 0,1";
}
}
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}
$picrow = $db->sql_fetchrow($result);
$pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow['pic_user_id']) .'">'. $picrow['pic_username'] .'</a>';
//
// END: Get Newest Pic
//
#
#-----[ FIND ]----------------------------------------
#
'L_VOTE_BUTTON' => $lang['Vote'],
#
#-----[ AFTER ADD ]-----------------------------------
#
// Photo Album
'L_NEWEST_PIC' => $lang['Newest_pic'],
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TITLE' => $picrow['pic_title'],
'PIC_POSTER' => $pic_poster,
'U_PIC_LINK' => append_sid('album_comment.' . $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
'PIC_DESCR' => $picrow['pic_desc'],
'L_PIC_TITLE' => $lang['Pic_Title'],
'L_POSTER' => $lang['Poster'],
'L_POSTED' => $lang['Posted'],
#
#-----[ 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 ]----------------------------------------
#
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="catHead" height="25"><span class="genmed">{L_LOGIN}</span></td>
</tr>
<tr>
<td class="row1"><span class="gensmall" style="line-height=150%">
<input type="hidden" name="redirect" value="{U_PORTAL}" />
{L_USERNAME}:<br /><input class="post" type="text" name="username" size="15" /><br />
{L_PASSWORD}:<br /><input class="post" type="password" name="password" size="15" /><br />
<input class="text" type="checkbox" name="autologin" />&{L_REMEMBER_ME}<br/>
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /><br /><br /><a href="{U_SEND_PASSWORD}" class="gensmall">{L_SEND_PASSWORD}</a><br /><br />{L_REGISTER_NEW_ACCOUNT}<br />&</span></td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
#
#-----[ AFTER ADD ]-----------------------------------
#
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th>{L_NEWEST_PIC}</span></th>
</tr>
<tr>
<td class="row1"><span class="gensmall" style="line-height:150%"><center><a href="{U_PIC_LINK}"><img src="{PIC_IMAGE}" border="0" alt="{PIC_DESCR}"></a><br /></center>
<table width="100%" align="center" border="0" cellpadding="2" cellspacing="1">
<tr>
<td width="25%" align="left"><span class="gensmall">{L_POSTER}: {PIC_POSTER}</span></td>
</tr>
<tr>
<td valign="top" align="left"><span class="gensmall">{L_PIC_TITLE}: {PIC_TITLE}</span></td>
</tr>
<tr>
<td align="left"><span class="gensmall">{L_POSTED}: {PIC_TIME}</span></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td align="center"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]<br />&</span></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]----------------------------------------
#
$lang['No_poll'] = 'No poll at the moment';
#
#-----[ AFTER ADD ]-----------------------------------
#
//
// Photo Album
//
$lang['Newest_pic'] = 'Newest Pic';
$lang['Pic_Title']= 'Pic Title';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
# EoM
Code: Alles auswählen
$CategoryID = 1,2,3; // Replace 0 with a category ID. Otherwise, keep it as it is
Danke