Code: Alles auswählen
################################################################################
##
## Mod Title: ezPortal Box - Album stats
## Mod Author: AmigaLink <webmaster@amigalink.de> (Markus Schmidt) http://www.essenmitfreude.info
## MOD Description: Album statistic box for the ezPortal.
##
## Mod Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5 minutes
##
## Files To Edit: 4
## portal.php
## language/lang_english/lang_main.php
## language/lang_german/lang_main.php
## templates/subSilver/portal_body.tpl
##
################################################################################
##
## The following sites also contain the latest version of this MOD:
##
## http://www.AmigaLink.de
## http://www.phpBBhacks.com
##
## Full support for this MOD can be obtained at:
##
## http://www.AmigaLink.de
##
################################################################################
##
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property Rights are retained by the hack author(s)
## listed above.
##
################################################################################
#
#----------[ OPEN ]-------------------------------------
#
portal.php
#
#----------[ FIND ]-------------------------------------
#
// Generate the page
$template->pparse('body');
#
#----------[ BEFORE, ADD ]------------------------------
#
// Album stats block
// Last Pic Data
$sql = "SELECT pic_id, pic_title, pic_time, pic_desc, pic_username, pic_user_id FROM " . ALBUM_TABLE . "
WHERE pic_approval = 1
AND pic_lock = 0 # Don't show if picture locked
ORDER BY pic_time DESC
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain last pic data', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$last_pic_id = $row['pic_id'];
$last_pic_title = '<a href="album_showpage.php?pic_id='.$last_pic_id.'">'.$row['pic_title'].'</a>';
$last_pic = '<a href="album_showpage.php?pic_id='.$last_pic_id.'"><img src="album_thumbnail.php?pic_id='.$last_pic_id.'" alt="'.$row['pic_desc'].'" title="'.$row['pic_desc'].'"></a>';
$last_pic_time = $row['pic_time'];
$last_pic_poster = '<a href="profile.php?mode=viewprofile&u='.$row['pic_user_id'].'">'.$row['pic_username'].'</a>';
$last_pic_poster_id = $row['pic_user_id'];
// Total Pics and Views
$sql = "SELECT count(*) AS total_pics, SUM(pic_view_count) AS total_view FROM " . ALBUM_TABLE . "
WHERE pic_approval = 1";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain image count ', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$TotalImages = $row['total_pics'];
$pic_view_count = $row['total_view'];
// Total Ratings
$sql = "SELECT count(*) AS total_rates, SUM(rate_point) AS rate_points FROM " . ALBUM_RATE_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain image rating count ', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$total_rates = $row['total_rates'];
$rate_points = $row['rate_points'];
// Total Comments
$sql = "SELECT count(*) AS total_comments FROM " . ALBUM_COMMENT_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain image comment count ', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$total_comments = $row['total_comments'];
$template->assign_vars(array(
'ALBUM_STATS' => $lang['Title_album-stats'],
'TOTAL_IMAGES' => sprintf($lang['total_pics'], $TotalImages),
'TOTAL_PICVIEW' => sprintf($lang['viewed'], $pic_view_count),
'TOTAL_RATES' => sprintf($lang['votes'], $total_rates),
'TOTAL_RATEPOINT' => sprintf($lang['vote_points'], $rate_points),
'TOTAL_COMMENTS' => sprintf($lang['comments'], $total_comments),
'LAST_PIC' => $last_pic,
'LAST_PIC_ID' => $last_pic_id,
'LAST_PIC_TITLE' => sprintf($lang['newest_pic'], $last_pic_title),
'LAST_PIC_POSTER' => sprintf($lang['posted_by'], $last_pic_poster),
'LAST_PIC_TIME' => sprintf($lang['posted_at'], (create_date($lang['DATE_FORMAT'], $last_pic_time, $board_config['board_timezone'])))
));
// Album stats block
#
#----------[ OPEN ]-------------------------------------
#
language/lang_english/lang_main.php
#
#----------[ FIND ]-------------------------------------
#
?>
#
#----------[ BEFORE, ADD ]------------------------------
#
$lang['Title_album-stats'] = 'Album statistics';
$lang['total_pics'] = 'We have <b>%s</b> pics in the Album. ';
$lang['viewed'] = 'These were <b>%s</b> times regarded, ';
$lang['votes'] = 'to have <b>%s</b> ratings ';
$lang['vote_points'] = 'with a sum total of <b>%s</b> points. ';
$lang['comments'] = 'In addition <b>%s</b> comments were written.';
$lang['newest_pic'] = 'The newest pic is <b>%s</b> ';
$lang['posted_at'] = 'and is posted at %s ';
$lang['posted_by'] = 'by <b>%s</b>.';
#
#----------[ OPEN ]-------------------------------------
#
language/lang_german/lang_main.php
#
#----------[ FIND ]-------------------------------------
#
?>
#
#----------[ BEFORE, ADD ]------------------------------
#
$lang['Title_album-stats'] = 'Album Statistik';
$lang['total_pics'] = 'Wir haben <b>%s</b> Bilder im Album. ';
$lang['viewed'] = 'Diese wurden bisher <b>%s</b> mal angesehen ';
$lang['votes'] = 'und <b>%s</b> mal, ';
$lang['vote_points'] = 'mit insgesammt <b>%s</b> Punkten, bewertet. ';
$lang['comments'] = 'Ausserdem wurden <b>%s</b> Kommentare verfasst.';
$lang['newest_pic'] = 'Das neuste Bild heißt <b>%s</b> ';
$lang['posted_at'] = 'und wurde am %s ';
$lang['posted_by'] = 'von <b>%s</b> gepostet.';
#
#----------[ OPEN ]-------------------------------------
#
templates/subSilver/portal_body.tpl
#
#----------[ FIND ]-------------------------------------
#
# Whatever you want.
#
#----------[ AFTER, ADD ]-------------------------------
#
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="cat" height="25"><span class="genmed"><b>{ALBUM_STATS}</b></span></td>
</tr>
<tr>
<td class="row1"><span class="gensmall">{TOTAL_IMAGES}{TOTAL_PICVIEW}{TOTAL_RATES}{TOTAL_RATEPOINT}{TOTAL_COMMENTS}</span></td>
</tr>
<tr>
<td class="row1"><span class="gensmall">{LAST_PIC_TITLE}{LAST_PIC_TIME}{LAST_PIC_POSTER}</span></td>
</tr>
<tr>
<td align="center">
<table border="1"><tr><td>{LAST_PIC}</td></tr></table>
</td>
<tr>
</table>
<br />
#
#----------[ SAVE AND CLOSE ALL FILES ]-----------------
#
# EoM
viel zu ändern ist auch nicht ,das ist schon das 2 mal das ich es eingebaut habe ,hatte es nochmal ausgebaut (orginal datein) aber wieder funzt es nicht !!!