<?php

define('_IN_JOHNCMS', 1);
require('../incfiles/core.php');
require('../incfiles/head.php');
$lng_profile = core::load_lng('profile');

if ($rights == 9) {
$al = isset($_REQUEST['al']) ? abs(intval($_REQUEST['al'])) : null;

echo '<div class="phdr"><b>' . $lng['photo_albums'] . '</b></div>';
$req = mysql_query("SELECT * FROM `album_cat` WHERE `id` ORDER BY `sort` ASC");
$total = mysql_num_rows($req);

if ($total) {
    $i = 0;
    while ($res = mysql_fetch_assoc($req)) {
        $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `album_files` WHERE `moder` = '1' AND `album_id` = '" . $res['id'] . "'"), 0);
        $new = mysql_result(mysql_query("SELECT COUNT(*) FROM `album_files` WHERE `moder` = '1' AND `album_id` = '" . $res['id'] . "' AND `time` > '" . (time() - 259200) . "'"), 0);
        echo ($i % 2 ? '<div class="menu">' : '<div class="menu">') .
'<img src="../images/folder.png" alt="*" />&#160;' .
'<a href="index.php?act=moder&amp;al=' . $res['id'] . '"><b>' . functions::checkout($res['name']) . '</b></a> <span class="count"><b>' . $count . '</b> / <font color="red"><b>+'.$new.'</b></font></span>';
            $menu = array(
                '<a href="index.php?act=sort&amp;mod=up&amp;al=' . $res['id'] . '">' . $lng['up'] . '</a>',
                '<a href="index.php?act=sort&amp;mod=down&amp;al=' . $res['id'] . '">' . $lng['down'] . '</a>',
                '<a href="index.php?act=edit&amp;al=' . $res['id'] . '">' . $lng['edit'] . '</a>',
                '<a href="index.php?act=delete&amp;al=' . $res['id'] . '">' . $lng['delete'] . '</a>'
            );
            echo '<div class="sub">' . functions::display_menu($menu) . '</div>';
        echo '</div>';
        ++$i;
    }
} else {
    echo '<div class="menu"><p>' . $lng['list_empty'] . '</p></div>';
}
echo '<div class="phdr">' . $lng['total'] . ': ' . $total . '</div>';
    echo '<div class="topmenu"><a href="index.php?act=edit">' . $lng_profile['album_create'] . '</a></div>';
}

require('../incfiles/end.php');
?>