 |
|
|
|

| Autor |
Nachricht |
Thomson
Universal Genius

Anmeldungsdatum: 05.08.2002
Beiträge: 4726
Wohnort: a shibby place
|
Verfasst am:
So 14 Sep, 2003 14:16 |
  |
Mod Name: Most Commendet Pics@Album - Smartor Photoalbum V2
Mod Author: yabba
phpBB-Versions: 2.0.6
Mod-Description: Incorporates the Most commented Pics public pictures into your album index page.
Mod-Requirements: Album version 2 by Smartor ( http://smartor.is-root.com )
Discussion: http://www.phpbb2.de/viewtopic.php?t=6296
Code:
| Code: |
##############################################################
## MOD Title: Most commented Pics
## MOD Author: Original 'Recent Pics' Code by Smartor < smartor_xp@hotmail.com >
## Modified by yabbas.de
## MOD Description:
## Incorporates the Most commented Pics public pictures into your album index page.
##
## MOD Requirements: Album version 2 by Smartor ( http://smartor.is-root.com )
##
##
## Installation Level: easy
## Installation Time: 2 minutes
##
## Files To Edit: 2
## album.php
## templates/subSilver/album_index_body.tpl
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]-------------------------------------------------------
#
album.php
#
#-----[ FIND ]-------------------------------------------------------
#
/*
+----------------------------------------------------------
| Recent Public Pics
#
#-----[ BEFORE, ADD ]-------------------------------------------------------
#
/*
+----------------------------------------------------------
| commented Pics
| by yabba
+----------------------------------------------------------
*/
if ($allowed_cat != '')
{
$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, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments
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 comments DESC
LIMIT ". $album_config['cols_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query com rated pics information', '', __LINE__, __FILE__, $sql);
}
$comrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$comrow[] = $row;
}
if (count($comrow) > 0)
{
for ($i = 0; $i < count($comrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('com_pics', array());
for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
{
if( $j >= count($comrow) )
{
break;
}
if(!$comrow[$j]['rating'])
{
$comrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$comrow[$j]['rating'] = round($comrow[$j]['rating'], 2);
}
$template->assign_block_vars('com_pics.com_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $comrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $comrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $comrow[$j]['pic_id']),
'DESC' => $comrow[$j]['pic_desc']
)
);
if( ($comrow[$j]['user_id'] == ALBUM_GUEST) or ($comrow[$j]['username'] == '') )
{
$com_poster = ($comrow[$j]['pic_username'] == '') ? $lang['Guest'] : $comrow[$j]['pic_username'];
}
else
{
$com_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $comrow[$j]['user_id']) .'">'. $comrow[$j]['username'] .'</a>';
}
$template->assign_block_vars('com_pics.com_detail', array(
'c_TITLE' => $comrow[$j]['pic_title'],
'c_POSTER' => $com_poster,
'c_TIME' => create_date($board_config['default_dateformat'], $comrow[$j]['pic_time'], $board_config['board_timezone']),
'c_VIEW' => $comrow[$j]['pic_view_count'],
'c_RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid("album_rate.$phpEx?pic_id=". $comrow[$j]['pic_id']) . '">' . $lang['Rating'] . '</a>: ' . $comrow[$j]['rating'] . '<br />') : '',
'c_COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid("album_comment.$phpEx?pic_id=". $comrow[$j]['pic_id']) . '">' . $lang['Comments'] . '</a>: ' . $comrow[$j]['comments'] . '<br />') : '',
'c_IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($comrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($comrow[$j]['pic_user_ip']) .'</a><br />' : ''
)
);
}
}
}
else
{
//
// No Pics Found
//
$template->assign_block_vars('no_pics', array());
}
}
else
{
//
// No Cats Found
//
$template->assign_block_vars('no_pics', array());
}
#
#-----[ OPEN ]-------------------------------------------------------
#
templates/subSilver/album_index_body.tpl
#
#-----[ FIND ]-------------------------------------------------------
#
<!-- END recent_pics -->
</table>
#
#-----[ AFTER, ADD ]-------------------------------------------------------
#
<p />
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th height="25" colspan="{S_COLS}" nowrap="nowrap">Most commented Pics</th>
</tr>
<!-- BEGIN no_pics -->
<tr>
<td class="row1" align="center" colspan="{S_COLS}" height="50"><span class="gen">{L_NO_PICS}</span></td>
</tr>
<!-- END no_pics -->
<!-- BEGIN com_pics -->
<tr>
<!-- BEGIN com_col -->
<td class="row1" width="{S_COL_WIDTH}" align="center"><a href="{com_pics.com_col.U_PIC}" {TARGET_BLANK}><img src="{com_pics.com_col.THUMBNAIL}" border="0" alt="{com_pics.com_col.DESC}" title="{com_pics.com_col.DESC}" vspace="10" /></a></td>
<!-- END com_col -->
</tr>
<tr>
<!-- BEGIN com_detail -->
<td class="row2"><span class="gensmall">{L_PIC_TITLE}: {com_pics.com_detail.c_TITLE}<br />
{L_POSTER}: {com_pics.com_detail.c_POSTER}<br />{L_POSTED}: {com_pics.com_detail.c_TIME}<br />
{L_VIEW}: {com_pics.com_detail.c_VIEW}<br />{com_pics.com_detail.c_RATING}{com_pics.com_detail.c_COMMENTS}{com_pics.com_detail.c_IP}</span>
</td>
<!-- END com_detail -->
</tr>
<!-- END com_pics -->
</table>
|
Demo: http://www.yabbas.com/phpBB2/album.php |
_________________ There are only 10 types of people in the world: Those who understand binary, and those who don't... |
|
      |
 |
Google
|
Verfasst am:
|
 |
|
|
 |
|
|
|
|
|
Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen. Du kannst Dateien in diesem Forum posten Du kannst Dateien in diesem Forum herunterladen
|
|
| |