if ($value['parent_gal'] == $_SESSION['id'] and $value['gallery_id'] != 0) { if ($value['album'] == 0) { if ($currentGalleryCount > $galleryStartRecord and $currentGalleryCount <= $galleryPerPage * $_SESSION['galleryCurrentPage']) { $subGalleriesData[$key] = $value['gallery_id']; $_SESSION['galleriesData'][$key]['galleryIcon'] = galleryIcon($key); // Get gallery icon details for subs if they exist //print_r($_SESSION['galleriesData'][$key]['galleryIcon']); echo "<br>"; //$_SESSION['galleriesData'][$key]['name'] = ($galleryData['name_'.$galDefaultLang]) ? $galleryData['name_'.$galDefaultLang] : $galleryData['name']; // Get gallery icon details for subs if they exist } $currentGalleryCount++; $subGalleryCount++; } } } //print_k($subGalleriesData); $galleryPages->setTotalResults($subGalleryCount); // Set the total number of subgalleries if ($_SESSION['id'] == 0) { $currentGallery['gallery_id'] = 0; // Assign the current gallery details $currentGallery['description'] = $lang['chooseGallery']; } else { $currentGallery = $_SESSION['galleriesData'][$_SESSION['id']]; // Assign the current gallery details $currentGallery['description'] = $_SESSION['galleriesData'][$_SESSION['id']]['description']; $currentGallery['event_date_display'] = $customDate->showdate($_SESSION['galleriesData'][$_SESSION['id']]['event_date']); if (!$_SESSION['sessGallerySortBy']) { // If sessGallerySortBy isn't set then use the default $_SESSION['sessGallerySortBy'] = $currentGallery['dsorting'] ? $currentGallery['dsorting'] : $config['settings']['dsorting']; } if (!$_SESSION['sessGallerySortType']) {
$sql .= "ORDER BY {$dbinfo[pre]}media.{$_SESSION[searchForm][searchSortBy]} {$_SESSION[searchForm][searchSortType]}"; } $sql .= "\r\n\t\t\t\t\t\tLIMIT {$mediaStartRecord},{$mediaPerPage}\r\n\t\t\t\t\t"; //echo $sql; exit; //$mediaCount = mysqli_num_rows(mysqli_query($db,$sql)); // Get the total number of items //$mediaPages->setTotalResults($mediaCount); // Pass the total number of results to the $pages object //$sql.= " LIMIT {$mediaStartRecord},{$mediaPerPage}"; //} $media = new mediaList($sql); // Create a new mediaList object if ($returnRows = $media->getRows()) { if ($returnRows > $mediaPerPage * $config['searchResultLimit']) { $returnRows = $mediaPerPage * $config['searchResultLimit']; } // Limit the results to X pages $mediaPages->setTotalResults($returnRows); // Pass the total number of results to the $pages object $media->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details $mediaArray = $media->getMediaArray(); // Get the array of media $thumbMediaDetailsArray = $media->getDetailsFields('thumb'); // Get thumb details $smarty->assign('thumbMediaDetails', $thumbMediaDetailsArray); $smarty->assign('mediaRows', $returnRows); $smarty->assign('mediaArray', $mediaArray); } /* * Get paging info and pass it to smarty */ //$mediaPages->setTotalResults($returnRows); // Pass the total number of results to the $pages object
if ($page) { $mediaPages->setCurrentPage($page); } else { $mediaPages->setCurrentPage($_SESSION['mediaCurrentPage']); } // Use session current page $mediaStartRecord = $mediaPages->getStartRecord(); // Get the record the db should start at unset($_SESSION['id']); $mediaCount = mysqli_num_rows(mysqli_query($db, "\r\n\t\t\tSELECT {$dbinfo[pre]}media.umedia_id\r\n\t\t\tFROM {$dbinfo[pre]}media\r\n\t\t\tLEFT JOIN {$dbinfo[pre]}media_galleries \r\n\t\t\tON {$dbinfo[pre]}media.media_id = {$dbinfo[pre]}media_galleries.gmedia_id\r\n\t\t\tWHERE {$dbinfo[pre]}media_galleries.gallery_id IN ({$memberPermGalleriesForDB})\r\n\t\t\tAND {$dbinfo[pre]}media.active = 1 \r\n\t\t\tAND {$dbinfo[pre]}media.approval_status = 1 \r\n\t\t\tGROUP BY {$dbinfo[pre]}media.media_id\r\n\t\t")); // Get the total number of items if ($mediaCount > $mediaPerPage * 20) { $mediaCount = $mediaPerPage * 20; } // Limit the results to 20 pages $mediaPages->setTotalResults($mediaCount); // Pass the total number of results to the $pages object $sql = "\r\n\t\t\tSELECT SQL_CALC_FOUND_ROWS *\r\n\t\t\tFROM {$dbinfo[pre]}media\r\n\t\t\tLEFT JOIN {$dbinfo[pre]}media_galleries \r\n\t\t\tON {$dbinfo[pre]}media.media_id = {$dbinfo[pre]}media_galleries.gmedia_id\r\n\t\t\tWHERE {$dbinfo[pre]}media_galleries.gallery_id IN ({$memberPermGalleriesForDB})\r\n\t\t\tAND {$dbinfo[pre]}media.active = 1 \r\n\t\t\tAND {$dbinfo[pre]}media.approval_status = 1 \r\n\t\t\tGROUP BY {$dbinfo[pre]}media.media_id\r\n\t\t\tORDER BY {$dbinfo[pre]}media.date_added DESC\r\n\t\t\tLIMIT {$mediaStartRecord},{$mediaPerPage}\r\n\t\t"; $templateFile = 'newest.media.tpl'; if ($sql) { /* * Get all the media information and pass it to smarty */ $media = new mediaList($sql); // Create a new mediaList object if ($returnRows = $media->getRows()) { $media->setGalleryDetails($galleryID, $_SESSION['currentMode']); // Pass gallery details to media class $media->getMediaDetails(); // Run the getMediaDetails function to grab all the media file details $mediaArray = $media->getMediaArray();