function get_cat_list(&$cat_data, &$statistics) { global $db, $CONFIG, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST; global $HIDE_USER_CAT; global $cat; // Build the category list $cat_data = array(); $album_set_array = array(); $HIDE_USER_CAT = 1; get_subcat_data($cat, $cat_data, $album_set_array, 0); // Add the albums in the current category to the album set if ($cat) { if ($cat == USER_GAL_CAT) { foreach (get_albums_data() as $row) { if ($row['category'] < FIRST_USER_CAT) { continue; } $album_set_array[] = $row['aid']; } } else { foreach (get_albums_data() as $row) { if ($row['category'] != $cat) { continue; } $album_set_array[] = $row['aid']; } } } if (count($album_set_array) && $cat) { $set = ''; foreach ($album_set_array as $album) { $set .= $album . ','; } $set = substr($set, 0, -1); $current_album_set = "aid IN ({$set}) "; } elseif ($cat) { $current_album_set = "aid IN (-1) "; } // Gather gallery statistics if ($cat == 0) { $album_count = count(get_albums_data()); $picture_count = cpg_tablecount($CONFIG['TABLE_PICTURES'], 'count(*)', __FILE__, __LINE__); $comment_count = cpg_tablecount($CONFIG['TABLE_COMMENTS'], 'count(*)', __FILE__, __LINE__); $cat_count = count(get_categories_data()); $hit_count = cpg_tablecount($CONFIG['TABLE_PICTURES'], 'sum(hits)', __FILE__, __LINE__); if (count($cat_data)) { $statistics = strtr(STAT1, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[cat]' => $cat_count, '[comments]' => $comment_count, '[views]' => $hit_count)); } else { $STATS_IN_ALB_LIST = true; $statistics = strtr(STAT3, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[comments]' => $comment_count, '[views]' => $hit_count)); } } elseif ($cat >= FIRST_USER_CAT && $current_album_set) { $album_count = cpg_tablecount($CONFIG['TABLE_ALBUMS'] . " WHERE {$current_album_set}", 'count(*)', __FILE__, __LINE__); $picture_count = cpg_tablecount($CONFIG['TABLE_PICTURES'] . " WHERE {$current_album_set}", 'count(*)', __FILE__, __LINE__); $hit_count = cpg_tablecount($CONFIG['TABLE_PICTURES'] . " WHERE {$current_album_set}", 'sum(hits)', __FILE__, __LINE__); $statistics = strtr(STAT2, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[views]' => $hit_count)); } else { $statistics = ''; } }
$nb_com_del = 0; if (isset($_POST['cid_array'])) { $cid_array = $_POST['cid_array']; $cid_set = ''; foreach ($cid_array as $cid) { $cid_set .= $cid_set == '' ? '(' . $cid : ', ' . $cid; } $cid_set .= ')'; $db->sql_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE msg_id IN {$cid_set}", false, __FILE__, __LINE__); $nb_com_del = $db->sql_affectedrows(); } /*$result = $db->sql_query("SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']}",false, __FILE__, __LINE__); $nbEnr = $db->sql_fetchrow($result); $comment_count = $nbEnr[0]; */ $comment_count = cpg_tablecount($CONFIG['TABLE_COMMENTS'], "count(*)", __FILE__, __LINE__); if (!$comment_count) { cpg_die(INFO, NO_COMMENT, __FILE__, __LINE__); } $start = isset($_GET['start']) ? $_GET['start'] : 0; $start = intval($start); $count = isset($_GET['count']) ? $_GET['count'] : 25; $count = intval($count); $next_target = URL::index('&file=reviewcom&start=' . ($start + $count) . '&count=' . $count); $prev_target = URL::index('&file=reviewcom&start=' . max(0, $start - $count) . '&count=' . $count); $s50 = $count == 50 ? 'selected' : ''; $s75 = $count == 75 ? 'selected' : ''; $s100 = $count == 100 ? 'selected' : ''; if ($start + $count < $comment_count) { $next_link = "<a href=\"{$next_target}\"><b>" . R_SEE_NEXT . "</b></a> - "; } else {
$cpgtitle[0] = $cpgdir; } $content .= '<div style="text-align:center;"><strong>' . $cpgtitle[0] . '</strong></div> <b>•</b> ' . ALBUMS . ': ' . cpg_tablecount($cpgprefix . "albums", 'count(*)', __FILE__) . '<br /> <b>•</b> ' . PICTURES . ': ' . cpg_tablecount($cpgprefix . 'pictures', 'count(*) ', __FILE__) . '<br />'; $num = cpg_tablecount($cpgprefix . 'pictures', 'sum(hits)', __FILE__); if (!is_numeric($num)) { $num = 0; } $content .= '<strong><big> ·</big></strong> ' . PIC_VIEWS . ': ' . $num . '<br />'; $num = cpg_tablecount($cpgprefix . 'pictures', 'sum(votes)', __FILE__); if (!is_numeric($num)) { $num = 0; } $content .= '<strong><big> ·</big></strong> ' . PIC_VOTES . ': ' . $num . '<br /> <strong><big> ·</big></strong> ' . PIC_COMMENTS . ': ' . cpg_tablecount($cpgprefix . 'comments', 'count(*)', __FILE__) . '<br />'; if (GALLERY_ADMIN_MODE) { $num = $db->sql_ufetchrow("SELECT count(*) FROM " . $cpgprefix . "pictures WHERE approved=0", SQL_NUM); $categ = $module_name != $cpgdir ? '0' : $cat; $content .= '<b>•</b> <a href="' . URL::index("{$cpgdir}&file=editpics&mode=upload_approval") . '">' . UPL_APP_LNK . '</a>: ' . $num[0] . '<br /> <b>•</b> <a href="' . URL::index("{$cpgdir}&file=searchnew") . '">' . SEARCHNEW_LNK . '</a><br /> <b>•</b> <a href="' . URL::index("{$cpgdir}&file=reviewcom") . '">' . COMMENTS_LNK . '</a><br /> <b>•</b> <a href="' . URL::index("{$first_install_M_DIR}&file=groupmgr") . '">' . GROUPS_LNK . '</a><br /> <b>•</b> <a href="' . URL::index("{$first_install_M_DIR}&file=usermgr") . '">' . USERS_LNK . '</a><br /> <b>•</b> <a href="' . URL::index("{$cpgdir}&file=albmgr&cat={$categ}") . '">' . ALBUMS_LNK . '</a><br /> <b>•</b> <a href="' . URL::index("{$cpgdir}&file=catmgr") . '">' . CATEGORIES_LNK . '</a><br />'; if (is_admin()) { $content .= '<b>•</b> <a href="' . URL::admin("{$cpgdir}") . '">' . CONFIG_LNK . '</a>'; } } else { if (USER_ADMIN_MODE) {