Changeset 548
- Timestamp:
- 06/09/08 13:19:25 (5 months ago)
- Files:
-
- 1 modified
-
trunk/plog-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plog-functions.php
r547 r548 1028 1028 // if adding arguments to mod_rewritten urls, then I need ? (question mark) before the arguments 1029 1029 // otherwise I want & 1030 $last = substr($url,-1);1031 1032 if ( $last == "/") {1030 //$last = substr($url,-1); 1031 1032 if (!strpos($url,"?")) { 1033 1033 //$url = substr($url,0,-1); 1034 1034 $separator = "?"; … … 1600 1600 1601 1601 // -1 is just for the case there are no collections at all 1602 $image_count = array(-1 => -1); 1602 $image_collection_count = array(-1 => -1); 1603 $image_album_count = array(); 1603 1604 $album_count = array(); 1604 1605 1605 1606 // 1. create a list of all albums with at least one photo 1606 $sql = "SELECT parent_collection, COUNT(*) AS imagecount1607 FROM `".TABLE_PREFIX."pictures` GROUP BY parent_collection ";1607 $sql = "SELECT parent_collection,parent_album,COUNT(*) AS imagecount 1608 FROM `".TABLE_PREFIX."pictures` GROUP BY parent_collection,parent_album"; 1608 1609 $result = run_query($sql); 1609 1610 while($row = mysql_fetch_assoc($result)) { 1610 $image_count[$row["parent_collection"]] = $row["imagecount"]; 1611 } 1612 1613 $imlist = join(",",array_keys($image_count)); 1611 $image_collection_count[$row["parent_collection"]] = $row["imagecount"]; 1612 $image_album_count[$row["parent_album"]] = $row["imagecount"]; 1613 } 1614 $imlist = join(",",array_keys($image_collection_count)); 1615 $albumlist = join(",",array_keys($image_album_count)); 1614 1616 1615 1617 $cond = ''; 1616 1618 1617 1619 if (empty($arr['all_collections'])) { 1618 $cond = " WHERE parent_id IN ($imlist) ";1620 $cond = " WHERE `parent_id` IN ($imlist) AND `id` IN ($albumlist) "; 1619 1621 } 1620 1622 … … 1640 1642 // override that with passing all_collections as an argument to 1641 1643 // this function 1642 if (empty($arr['all_collections'])) {1643 $cond = " WHERE idIN ($imlist) ";1644 if (empty($arr['all_collections'])) { 1645 $cond = " WHERE `id` IN ($imlist) "; 1644 1646 } 1645 1647 … … 2242 2244 function plogger_count_collections() { 2243 2245 2244 $numquery = "SELECT COUNT( *) AS `num_collections` FROM `".TABLE_PREFIX."collections`";2246 $numquery = "SELECT COUNT(DISTINCT `parent_collection`) AS `num_collections` FROM `".TABLE_PREFIX."pictures`"; 2245 2247 2246 2248 $numresult = run_query($numquery);
