Location: PHPKode > projects > PhpMyForum > phpmyforum_4_1_1/attachments.php
<?php
define('PMF_INCLUDE', 1);
require('head.php');
require($_cfg['MAIN'].'/lib/post.inc.php');
access('attachments');


#
#
### mehrere Seiten ?
$anz = $_db->fetch_first('SELECT COUNT(f.`post_id`) AS `num`
                          FROM `'.$_cfg['DB_PREFIX'].'attachment` AS f,
                               `'.$_cfg['DB_PREFIX'].'post` AS p,
                               `'.$_cfg['DB_PREFIX'].'topic` AS t
                          WHERE f.`post_id` = p.`id`
                            AND p.`topic_id` = t.`id`
                            AND t.`board_id` IN ('.get_aviable_boards('attachment_download').')');
// wenn keine Page übergeben wurde
$_GET['page'] = (!empty($_GET['page']) && is_numeric($_GET['page'])) ? $_GET['page'] : 1;
// für LIMIT
if ($anz['num'] > $_config['ANZ_ATTACHMENTS']) {
    $p = $_GET['page']-1;
    $L_AB = $_config['ANZ_ATTACHMENTS']*$p;
}
// für LIMIT
$L_AB = ($L_AB > 0) ? $L_AB : 0;


#
#
### Seiten Navigation
$navi = navi($_GET['page'], $anz['num'], $_config['ANZ_ATTACHMENTS'], 'attachments.php?');


#
#
### Liste ausgeben
$result = $_db->query('SELECT a.*, t.`id` AS `topic_id`, t.`name` AS `topic_name`
                       FROM `'.$_cfg['DB_PREFIX'].'attachment` AS a,
                            `'.$_cfg['DB_PREFIX'].'post` AS p,
                            `'.$_cfg['DB_PREFIX'].'topic` AS t
                       WHERE a.`post_id` = p.`id`
                         AND p.`topic_id` = t.`id`
                         AND t.`board_id` IN ('.get_aviable_boards('attachment_download').')
                       LIMIT '.$L_AB.', '.$_config['ANZ_ATTACHMENTS']);
$attachment_lines = '';
while($Daten = $_db->fetch_array($result)) {
    $Daten['traffic'] = format_size($Daten['size']*$Daten['views']);
    $Daten['size'] = format_size($Daten['size']);
    
    $attachment_lines .= eval ('return ("'.$_style->get('attachments_line').'");');
}

eval ('echo "'.$_style->get('attachments').'";');
footer();
?>
Return current item: PhpMyForum