Credit:
DaMysterious from http://damysterious.xs4all.nl/portal_premod/
AND
Imladris from http://www.phpbb2.dk
Demo: http://www.studmed.dk - See the block "Filbase"
OPEN
portal.php
FIND
Code: Select all
if ($portal_config['portal_change_style'])
{
include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
}
Code: Select all
include($phpbb_root_path . 'portal/block/filebase.'.$phpEx);
styles/prosilver/template/portal/portal_body.html
FIND
Code: Select all
<!-- IF S_DISPLAY_NEWS -->
<!-- IF S_NEWS_COMPACT -->
<!-- INCLUDE portal/block/news_compact.html -->
<!-- ELSE -->
<!-- INCLUDE portal/block/news.html -->
<!-- ENDIF -->
<!-- ENDIF -->
Code: Select all
<!-- INCLUDE portal/block/filebase.html -->
portal/block/filebase.php
INSERT
Code: Select all
<?php
/*
*
* Filebase Portal Block by Imladris for phpBB3Portal, based on plus XL 4.0 block.
*
*/
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
die('Hacking attempt');
exit;
}
/**
*/
$limit = 5; // number of files allowed to show, set in portal's ACP
$start = request_var('start', 0);
// Language file (see documentation related to language files)
$user->add_lang('filebase');
/**
* All of your coding will be here, setting up vars, database selects, inserts, etc...
*/
if ($auth->acl_get('u_view_filebase'))
{
$sql = "SELECT name, type, size, downloads, id
FROM " . FILEBASE_TABLE . "
WHERE id = id AND approved = '1'
ORDER BY id DESC";
$result = $db->sql_query($sql);
$num_files = sizeof($db->sql_fetchrowset($result));
$result = $db->sql_query_limit($sql, $limit, $start);
while($row = $db->sql_fetchrow($result))
{
// NEW MOD
$name = '<a href="filebase.php?d=1&id='.$row['id'].'">'.$row['name'].'</a>';
// END NEW MOD
$template->assign_block_vars('search', array(
'NAME' => $name, // replaced
'TYPE' => $row['type'],
'SIZE' => round(($row['size']/1024), 2)." ".$user->lang['KB'],
'DOWNLOADS' => $row['downloads'],
'U_FILE' => 'filebase.php?&f='.$row['id'].'',
));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'SEARCH' => 1,
));
$template->assign_block_vars('filebase', array(
'PAGINATION' => generate_pagination('portal.php', $num_files, $limit, $start ),
'PAGE_NUMBER' => on_page($num_files, $limit, $start),
'TOTAL_FILES' => $num_files,
'TOTAL_SIZE' => round(($row['size']/1024), 2)." ".$user->lang['KB'],
'S_HAS_FILES' => $row['downloads'] ? true : false,
// 'L_TOTAL_FILES_COUNT' => $user->lang['TOTAL_FILES_COUNT'],
));
}
$template->assign_vars(array(
'U_FILEBASE' => append_sid("{$phpbb_root_path}filebase.$phpEx"),
));
$template->assign_vars(array(
'S_DISPLAY_FILEBASE' => true,
));
?>
styles/prosilver/template/portal/block/filebase.html
INSERT
Code: Select all
<div class="forabg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header"><dl><dt><!-- IF U_VIEWONLINE --><a href="{U_FILEBASE}">Filebase</a><!-- ELSE -->HVEM VAR HER<!-- ENDIF --></dt></dl></li>
</ul>
<ul class="topiclist forums">
<li><dl>
<dd class="posts_portal" style="border-left:0px">
<table class="tablebg" cellspacing="1" width="100%">
<tr>
<th><div align="left">{L_FILENAME}</div></th>
<th><div align="center">{L_FILETYPE}</div></th>
<th><div align="center">{L_FILESIZE}</div></th>
<th><div align="center">{L_FILEDOWNLOADS}</div></th>
</tr>
<!-- BEGIN search -->
<tr>
<td><div style="font-size: 10px;">{search.NAME}</div></td>
<td><div align="center">{search.TYPE}</div></td>
<td><div align="center">{search.SIZE}</div></td>
<td><div align="center">{search.DOWNLOADS}</div></td>
</tr>
<!-- END search -->
</table>
<!-- BEGIN filebase -->
<!-- IF filebase.PAGINATION -->
<div class="pagination" style="margin: 0px 0px 5px 0px;">
{filebase.L_TOTAL_FILES_COUNT} {filebase.TOTAL_FILES}
<!-- IF filebase.PAGE_NUMBER --><!-- IF filebase.PAGINATION --> • <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{filebase.PAGE_NUMBER}</a> • <span>{filebase.PAGINATION}</span><!-- ELSE --> • {filebase.PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
<!-- END filebase -->
</dd>
</dl></li>
</ul>
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br />