| | Copyright: copyright (C) 2004 by Mike de Boer | | Description: zOOm Image Gallery, a multi-gallery component for | | Mambo based on RSGallery by Ronald Smit. It's the most | | feature-rich gallery component for Mambo! | | Filename: special.php | | Version: 2.1.1 | | | ----------------------------------------------------------------------- **/ // MOS Intruder Alerts defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /** There are three special image-display formats: 0: Top ten viewed images (most hits) 1: Ten last submitted images (last id's) 2: Ten last commented images 3: zOOm Search 4: Top rated **/ $images = array(); $galleries = array(); $type = $_REQUEST['type']; $i = 1; $zoom->_counter = 0; $tabcnt = 0; $startRow = 0; //Set the page no if(empty($_GET['PageNo'])){ if($startRow == 0){ $PageNo = $startRow + 1; } }else{ $PageNo = $_GET['PageNo']; $startRow = ($PageNo - 1) * $zoom->_pageSize; } //Set the counter start if($PageNo % $zoom->_pageSize == 0){ $CounterStart = $PageNo - ($zoom->_pageSize - 1); }else{ $CounterStart = $PageNo - ($PageNo % $zoom->_pageSize) + 1; } //Counter End $CounterEnd = $CounterStart + ($zoom->_pageSize - 1); if($type == 'quicksearch'){ $suchstring = trim(strtolower($sstring)); $database->setQuery("SELECT DISTINCT img.imgid AS id, img.catid AS gallery_id FROM #__zoomfiles AS img " . " LEFT JOIN #__zoom AS cats ON img.catid = cats.catid" . " WHERE cats.catpassword = '' " . " AND img.published = 1" . " AND LOWER(img.imgdescr) LIKE '%$suchstring%' " . " OR LOWER(img.imgname) LIKE '%$suchstring%' " . " OR LOWER(img.imgfilename) LIKE '%$suchstring%' " . " OR img.imgdate LIKE '%$suchstring'" . " OR LOWER(img.imgkeywords) LIKE '%$suchstring%'" . " OR LOWER(cats.catname) LIKE '%$suchstring%' " . " OR LOWER(cats.catdescr) LIKE '%$suchstring%' " . " OR LOWER(cats.catkeywords) LIKE '%$suchstring%'" . " ORDER BY id DESC"); // Displaying query-results: $zoom->_result = $database->query(); while($row1 = mysql_fetch_object($zoom->_result)){ $images[] = new image($row1->id); $galleries[] = $row1->gallery_id; } //Then search through pdf-documents... $database->setQuery("SELECT imgid, catid FROM #__zoomfiles WHERE imgfilename LIKE '%.pdf'"); $zoom->_result = $database->query(); while($row2 = mysql_fetch_object($zoom->_result)){ $pdf_doc = new image($row2->imgid); if($zoom->_toolbox->searchPdf($pdf_doc, $suchstring)){ $images[] = $pdf_doc; $galleries[] = $row2->catid; } } $startRow = 0; //Set the page no if(empty($_REQUEST['PageNo'])){ if($startRow == 0){ $PageNo = $startRow + 1; } }else{ $PageNo = $_REQUEST['PageNo']; $startRow = ($PageNo - 1) * $zoom->_pageSize; } //Total of record $RecordCount = sizeof($images);//Number of files in gallery $endRow = $startRow + $zoom->_pageSize -1; if ($endRow >= $RecordCount) $endRow = $RecordCount - 1; //Set Maximum Page $MaxPage = $RecordCount % $zoom->_pageSize; if($RecordCount % $zoom->_pageSize == 0){ if ($RecordCount != 0 && $zoom->_pageSize != 0) { $MaxPage = $RecordCount / $zoom->_pageSize; }else{ $MaxPage = 0; } }else{ $MaxPage = ceil($RecordCount / $zoom->_pageSize); } //Set the counter start $CounterStart = 1; //Counter End $CounterEnd = $MaxPage; ?>
<?php echo _ZOOM_MAINSCREEN;?>   > '.$suchstring.'"';?>
_counter++; $image = $images[$counter]; $zoom->setGallery($galleries[$counter]); $image->getInfo(); $imgKey = $zoom->_gallery->getImageKey($image->_id); if (!isset($zoom->_gallery->_password) && empty($zoom->_gallery->_password)) { echo "\t_tabclass[$tabcnt]."\">\n"; $size = getimagesize($zoom->_CONFIG['imagepath'].$zoom->_gallery->_dir."/".$image->_filename); if (!$zoom->_CONFIG['popUpImages']){ ?> \n" . "\t\t\t\n" . "\t\t\t\n" . "\t\t\n"); if($tabcnt >= 1){ $tabcnt = 0; }else{ $tabcnt++; } } } ?>
"; //Print First & Previous Link if necessary if($PageNo != 1) { $PrevStart = $PageNo - 1; echo ""._ZOOM_FIRST." : "; echo ""._ZOOM_PREVIOUS." << "; } $c = 0; //Print Page No for($c=$CounterStart;$c<=$CounterEnd;$c++){ if($c < $MaxPage){ if($c == $PageNo){ if($c % $RecordCount == 0){ print "$c "; }else{ print "$c | "; } }elseif($c % $RecordCount == 0){ echo "$c "; }else{ echo "$c | "; } }else{ if($PageNo == $MaxPage){ print "$c "; break; }else{ echo "$c "; } } } if($page < $MaxPage){ $NextPage = $PageNo + 1; echo ">> "._ZOOM_NEXT.""; echo " : "._ZOOM_LAST.""; } echo "
"; }
_gallery->_hideMsg){ echo ""._ZOOM_NOPICS.""; } ?>
  ".$zoom->_counter."   $zoom->_CONFIG['maxsize']){ echo $zoom->_CONFIG['maxsize'] + 50;}else{ echo $size[0] + 40;} ?>, height=$zoom->_CONFIG['maxsize']){ echo $zoom->_CONFIG['maxsize'] + 50;}else{ echo $size[1] + 100;} ?>,scrollbars=1').focus()"> _thumbnail."\" border=\"0\">\n" . "\t\t\t\t".$zoom->highlight($suchstring, $image->_filename)."
\n"); if ($zoom->_CONFIG['showHits']) echo "\t\t\t\thits = ".$image->_hits."
\n\t\t\t\t"; if($zoom->_CONFIG['ratingOn']){ if($image->_votenum!=0){ if($image->_votesum!=0){ $rating = round($image->_votesum / $image->_votenum); }else{ $rating = 0; } ?> (_votenum;?> _votenum==1) echo _ZOOM_VOTE.")
\n"; else echo _ZOOM_VOTES.")
\n"; }else{ echo _ZOOM_NOTRATED."
\n"; } } echo ("\t\t\t\t_gallery->_id."\">\n" . "\t\t\t\t\t".$zoom->highlight($suchstring, $zoom->_gallery->getCatVirtPath())."\n" . "\t\t\t
_CONFIG['showSearch'] && $zoom->_CONFIG['showKeywords']){ $zoom->createSubmitScript('browse'); } ?>
createKeywordsDropdown('sstring', '', 1); ?>