Changeset 559 for trunk/plog-includes/plog-functions.php
- Timestamp:
- 07/15/08 14:08:55 (4 months ago)
- Files:
-
- 1 modified
-
trunk/plog-includes/plog-functions.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plog-includes/plog-functions.php
r557 r559 6 6 } 7 7 8 function generate_breadcrumb($collections = 'Collections', $sep = ' » ' , $translate = true){8 function generate_breadcrumb($collections = 'Collections', $sep = ' » '){ 9 9 global $config; 10 10 11 11 $id = $GLOBALS['plogger_id']; 12 12 13 if ($translate === true){14 $collections = plog_tr(SmartStripSlashes($collections));15 }16 13 $collections_link = '<a href="'.generate_url("collections").'">' . $collections . '</a>'; 17 14 $collections_name = '<strong>' . $collections . '</strong>'; … … 22 19 $collection_name = '<strong>' . SmartStripSlashes($row['name']) . '</strong>'; 23 20 24 $breadcrumbs = $collections_link . $sep . $collection_name; 21 if ($config['truncate_breadcrumb'] == "collection"){ 22 $breadcrumbs = $collection_name; 23 } else { 24 $breadcrumbs = $collections_link . $sep . $collection_name; 25 } 25 26 26 27 // Does this ever happen? Collection level + slideshow mode ends in SQL error 27 if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= $sep . '<strong>' . plog_tr('Slideshow');28 //if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= $sep . '<strong>' . plog_tr('Slideshow'); 28 29 29 30 break; … … 37 38 $collection_link = '<a accesskey="/" href="' . generate_url("collection", $row['id']) . '">' . SmartStripSlashes($row['name']) . '</a>'; 38 39 39 if ($GLOBALS['plogger_mode'] == "slideshow") { 40 $breadcrumbs = $collections_link . $sep . $collection_link . $sep . $album_link . $sep . '<strong>' . plog_tr('Slideshow') . '</strong>'; 40 if ($config['truncate_breadcrumb'] == "album"){ 41 $breadcrumbs = $album_name; 42 } else if ($config['truncate_breadcrumb'] == "collection"){ 43 $breadcrumbs = $collection_link . $sep . $album_name; 41 44 } else { 42 45 $breadcrumbs = $collections_link . $sep . $collection_link . $sep . $album_name; 46 } 47 48 if ($GLOBALS['plogger_mode'] == "slideshow") { 49 $breadcrumbs = str_replace($album_name, $album_link . $sep . '<strong>' . plog_tr('Slideshow') . '</strong>', $breadcrumbs); 43 50 } 44 51 … … 48 55 $picture_name = '<span id="image_name"><strong>' . SmartStripSlashes(get_caption_filename($row)) . '</strong></span>'; 49 56 50 $row = get_album_by_id($row[ "parent_album"]);57 $row = get_album_by_id($row['parent_album']); 51 58 $album_link = '<a accesskey="/" href="' . generate_url("album", $row['id']) . '">' . SmartStripSlashes($row['name']) . '</a>'; 52 59 53 $row = get_collection_by_id($row[ "parent_id"]);60 $row = get_collection_by_id($row['parent_id']); 54 61 $collection_link = '<a accesskey="/" href="' . generate_url("collection", $row['id']) . '">' . SmartStripSlashes($row['name']) . '</a>'; 55 62 56 $breadcrumbs = $collections_link . $sep . $collection_link . $sep . $album_link . $sep . $picture_name; 63 if ($config['truncate_breadcrumb'] == "album"){ 64 $breadcrumbs = $album_link . $sep . $picture_name; 65 } else if ($config['truncate_breadcrumb'] == "collection") { 66 $breadcrumbs = $collection_link . $sep . $album_link . $sep . $picture_name; 67 } else { 68 $breadcrumbs = $collections_link . $sep . $collection_link . $sep . $album_link . $sep . $picture_name; 69 } 57 70 58 71 // Does this ever happen? Picture level + slideshow adds 'Slideshow' to breadcrumbs only 59 if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= $sep . '<strong>' . plog_tr('Slideshow');72 //if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= $sep . '<strong>' . plog_tr('Slideshow'); 60 73 61 74 break; 62 75 case 'search': 63 $breadcrumbs = $collections_link . $sep . '<strong>'.plog_tr('Search').'</strong>' . $sep . plog_tr('You searched for') . ' <strong>'.htmlspecialchars(SmartStripSlashes($_GET['searchterms'])).'</strong>.'; 76 if ($config['truncate_breadcrumb'] == "album"){ 77 $row = get_album_by_id($id); 78 $album_link = '<a accesskey="/" href="' . generate_url("album", $row['id']) . '">' . SmartStripSlashes($row['name']) . '</a>'; 79 $breadcrumbs = $album_link . $sep . '<strong>'.plog_tr('Search').'</strong>' . $sep . plog_tr('You searched for') . ' <strong>'.htmlspecialchars(SmartStripSlashes($_GET['searchterms'])).'</strong>.'; 80 } else if ($config['truncate_breadcrumb'] == "collection") { 81 $row = get_collection_by_id($id); 82 $collection_link = '<a accesskey="/" href="' . generate_url("collection", $row['id']) . '">' . SmartStripSlashes($row['name']) . '</a>'; 83 $breadcrumbs = $collection_link . $sep . '<strong>'.plog_tr('Search').'</strong>' . $sep . plog_tr('You searched for') . ' <strong>'.htmlspecialchars(SmartStripSlashes($_GET['searchterms'])).'</strong>.'; 84 } else { 85 $breadcrumbs = $collections_link . $sep . '<strong>'.plog_tr('Search').'</strong>' . $sep . plog_tr('You searched for') . ' <strong>'.htmlspecialchars(SmartStripSlashes($_GET['searchterms'])).'</strong>.'; 86 } 64 87 break; 65 88 default: … … 503 526 } 504 527 } 528 529 function get_active_collections_albums() { 530 $return = array( 531 "collections" => '', 532 "albums" => ''); 533 534 $sql = "SELECT parent_collection,parent_album,COUNT(*) AS imagecount 535 FROM `".TABLE_PREFIX."pictures` GROUP BY parent_collection,parent_album"; 536 $result = run_query($sql); 537 while($row = mysql_fetch_assoc($result)) { 538 $image_collection_count[$row["parent_collection"]] = $row["imagecount"]; 539 $image_album_count[$row["parent_album"]] = $row["imagecount"]; 540 } 541 $return['collections'] = array_keys($image_collection_count); 542 $return['albums'] = array_keys($image_album_count); 543 return $return; 544 } 505 545 506 546 function generate_thumb($path, $prefix, $type = THUMB_SMALL) {
