📄 search.php
字号:
# No longer needed as we have 'resource_column' on fields that populates the main resource table for certain # columns /* $showrefs=array(); for ($n=$offset;(($n<count($result)) && ($n<($offset+$page_size)));$n++) { $showrefs[]=$result[$n]["ref"]; } $resdata=get_resource_field_data_batch($showrefs); */ # Pre-fetch resource types for the list view /* if ($display=="list") {*/ $rtypes=array(); $types=get_resource_types(); for ($n=0;$n<count($types);$n++) {$rtypes[$types[$n]["ref"]]=$types[$n]["name"];}/* } */ # loop and display the results for ($n=$offset;(($n<count($result)) && ($n<($offset+$per_page)));$n++) { $ref=$result[$n]["ref"]; $url="view.php?ref=" . $ref . "&search=" . urlencode($search) . "&order_by=" . urlencode($order_by) . "&offset=" . urlencode($offset) . "&archive=" . $archive; ?> <? if ($display=="thumbs") { #Thumbnails view ?> <? if (!hook("renderresultthumb")) { ?> <!--Resource Panel--> <div class="ResourcePanelShell" id="ResourceShell<?=$ref?>"> <div class="ResourcePanel"> <? if (!hook("renderimagethumb")) { ?> <table border="0" class="ResourceAlign<? if (in_array($result[$n]["resource_type"],$videotypes)) { ?> IconVideo<? } ?>"><tr><td> <a href="<?=$url?>" <? if (!$infobox) { ?>title="<?=str_replace(array("\"","'"),"",htmlspecialchars($result[$n]["title"]))?>"<? } ?>><? if ($result[$n]["has_image"]==1) { ?><img width="<?=$result[$n]["thumb_width"]?>" height="<?=$result[$n]["thumb_height"]?>" src="<?=get_resource_path($ref,"thm",false,$result[$n]["preview_extension"],-1,1,checkperm("w"))?>" class="ImageBorder" <? if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?=$ref?>);" onMouseOut="InfoBoxSetResource(0);"<? } ?> /><? } else { ?><img border=0 src="gfx/type<?=$result[$n]["resource_type"]?>.gif" <? if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?=$ref?>);" onMouseOut="InfoBoxSetResource(0);"<? } ?> /><? } ?></a> </td> </tr></table><? } ?> <!-- END HOOK Renderimagethumb--> <? if (!hook("rendertitlethumb")) { ?> <div class="ResourcePanelInfo"><a href="<?=$url?>" <? if (!$infobox) { ?>title="<?=str_replace(array("\"","'"),"",htmlspecialchars($result[$n]["title"]))?>"<? } ?>><?=highlightkeywords(htmlspecialchars(tidy_trim($result[$n]["title"],22)),$search)?></a> </div><? } ?> <!-- END HOOK Rendertitlethumb --> <div class="ResourcePanelCountry"><? if (!$allow_reorder) { # Do not display the country if reordering (to create more room) ?><?=highlightkeywords(tidy_trim(TidyList(i18n_get_translated($result[$n]["country"])),14),$search)?><? } ?> </div> <span class="IconPreview"><a href="preview.php?from=search&ref=<?=$ref?>&ext=<?=$result[$n]["preview_extension"]?>&search=<?=urlencode($search)?>&offset=<?=$offset?>&order_by=<?=$order_by?>&archive=<?=$archive?>" <? if (!$infobox) { ?>title="<?=$lang["fullscreenpreview"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="22" height="12" /></a></span> <span class="IconCollect"><a href="collections.php?add=<?=$ref?>&nc=<?=time()?>&search=<?=urlencode($search)?>" target="collections" <? if (!$infobox) { ?>title="<?=$lang["addtocurrentcollection"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="22" height="12" /></a></span> <span class="IconEmail"><a href="resource_email.php?ref=<?=$ref?>" <? if (!$infobox) { ?>title="<?=$lang["emailresource"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="16" height="12" /></a></span> <? if ($result[$n]["rating"]>0) { ?><div class="IconStar"></div><? } ?> <? if ($collection_reorder_caption && $allow_reorder) { ?> <span class="IconComment"><a href="collection_comment.php?ref=<?=$ref?>&collection=<?=substr($search,11)?>" <? if (!$infobox) { ?>title="<?=$lang["addorviewcomments"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="14" height="12" /></a></span> <div class="IconReorder" onMouseDown="InfoBoxWaiting=false;"> </div> <? } ?> <div class="clearer"></div> </div> <div class="PanelShadow"></div> </div> <? if ($allow_reorder) { # Javascript drag/drop enabling. ?> <script type="text/javascript"> new Draggable('ResourceShell<?=$ref?>',{handle: 'IconReorder', revert: true}); Droppables.add('ResourceShell<?=$ref?>',{accept: 'ResourcePanelShell', onDrop: function(element) {ReorderResources(element.id,<?=$ref?>);}, hoverclass: 'ReorderHover'}); </script> <? } ?> <? } ?> <? } elseif ($display == "smallthumbs") { #Small Thumbs view ?><div class="ResourcePanelShellSmall" id="ResourceShell<?=$ref?>"> <div class="ResourcePanelSmall"> <table border="0" class="ResourceAlignSmall"><tr><td> <a href="<?=$url?>" <? if (!$infobox) { ?>title="<?=str_replace(array("\"","'"),"",htmlspecialchars($result[$n]["title"]))?>"<? } ?>><? if ($result[$n]["has_image"]==1) { ?><img src="<?=get_resource_path($ref,"col",false,$result[$n]["preview_extension"],-1,1,checkperm("w"))?>" class="ImageBorder" <? if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?=$ref?>);" onMouseOut="InfoBoxSetResource(0);"<? } ?> /><? } else { ?><img border=0 src="gfx/type<?=$result[$n]["resource_type"]?>_col.gif" <? if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?=$ref?>);" onMouseOut="InfoBoxSetResource(0);"<? } ?> /><? } ?></a> </td> </tr></table> <div class="ResourcePanelCountry"><span class="IconPreview"><a href="preview.php?from=search&ref=<?=$ref?>&ext=<?=$result[$n]["preview_extension"]?>&search=<?=urlencode($search)?>&offset=<?=$offset?>&order_by=<?=$order_by?>&archive=<?=$archive?>" <? if (!$infobox) { ?>title="<?=$lang["fullscreenpreview"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="22" height="12" /></a></span><span class="IconCollect"><a href="collections.php?add=<?=$ref?>&nc=<?=time()?>&search=<?=urlencode($search)?>" target="collections" <? if (!$infobox) { ?>title="<?=$lang["addtocurrentcollection"]?>"<? } ?>><img src="gfx/interface/sp.gif" alt="" width="22" height="12" /></a></span></div><div class="clearer"></div></div> <div class="PanelShadow"></div></div> <? } else if ($display=="list") { # List view ?> <!--List Item--> <tr <? if ($infobox) { ?>onMouseOver="InfoBoxSetResource(<?=$ref?>);" onMouseOut="InfoBoxSetResource(0);"<? } ?>> <td nowrap><div class="ListTitle"><a href="<?=$url?>"><?=highlightkeywords(tidy_trim($result[$n]["title"],45) . ((strlen(trim($result[$n]["country"]))>1)?(", " . tidy_trim(TidyList(i18n_get_translated($result[$n]["country"])),25)):""),$search) ?></a></div></td> <td><? if ($result[$n]["rating"]>0) { ?><div class="IconStar"> </div><? } else { ?> <? } ?></td> <td><?=$result[$n]["ref"]?></td> <td><? if (array_key_exists($result[$n]["resource_type"],$rtypes)) { ?><?=i18n_get_translated($rtypes[$result[$n]["resource_type"]])?><? } ?></td> <td><?=nicedate($result[$n]["creation_date"],false,true)?></td> <td ><div class="ListTools"><a href="<?=$url?>">> <?=$lang["action-view"]?></a> <a href="collections.php?add=<?=$ref?>&nc=<?=time()?>&search=<?=urlencode($search)?>" target="collections">> <?=$lang["action-addtocollection"]?></a> <a href="resource_email.php?ref=<?=$ref?>">> <?=$lang["action-email"]?></a></div></td> </tr> <? } hook("customdisplaymode"); } if ($display=="list") { ?> </table> </div> <? } ?> <!--Key to Panel--> <div class="BottomInpageKey"> <?=$lang["key"]?>: <? if ($orderbyrating) { ?> <div class="KeyStar"><?=$lang["verybestresources"]?></div> <? } ?> <? if ($allow_reorder) { ?> <div class="KeyReorder"><?=$lang["reorderresources"]?></div> <div class="KeyComment"><?=$lang["addorviewcomments"]?></div> <? } ?> <div class="KeyEmail"><?=$lang["emailresource"]?></div> <div class="KeyCollect"><?=$lang["addtocurrentcollection"]?></div> <div class="KeyPreview"><?=$lang["fullscreenpreview"]?></div> </div> <? } else { ?> <div class="BasicsBox"> <div class="NoFind"> <p><?=$lang["searchnomatches"]?></p> <? if ($result!="") { ?> <p><?=$lang["try"]?>: <a href="search.php?search=<?=urlencode(strip_tags($result))?>"><?=stripslashes($result)?></a></p> <? } else { ?> <p><? if (strpos($search,"country:")!==false) { ?><p><?=$lang["tryselectingallcountries"]?> <? } elseif (strpos($search,"year:")!==false) { ?><p><?=$lang["tryselectinganyyear"]?> <? } elseif (strpos($search,"month:")!==false) { ?><p><?=$lang["tryselectinganymonth"]?> <? } else {?><?=$lang["trybeinglessspecific"]?><? } ?> <?=$lang["enteringfewerkeywords"]?></p> <? } ?> </div> </div> <? } ?> <!--Bottom Navigation - Archive, Saved Search plus Collection--> <div class="BottomInpageNav"> <? if (($archive==0) && (strpos($search,"!")===false) && $archive_search) { $arcresults=do_search($search,$restypes,$order_by,2,0); if (is_array($arcresults)) {$arcresults=count($arcresults);} else {$arcresults=0;} if ($arcresults>0) { ?> <div class="InpageNavLeftBlock"><a href="search.php?search=<?=urlencode($search)?>&archive=2">> <?=$lang["view"]?> <span class="Selected"><?=number_format($arcresults)?></span> <?=($arcresults==1)?$lang["match"]:$lang["matches"]?> <?=$lang["inthearchive"]?></a></div> <? } else { ?> <div class="InpageNavLeftBlock">> <?=$lang["nomatchesinthearchive"]?></div> <? } } ?> <? if (strpos($search,"!")===false) { ?> <div class="InpageNavLeftBlock"><a href="collections.php?addsearch=<?=urlencode($search)?>&restypes=<?=urlencode($restypes)?>&archive=<?=$archive?>" target="collections">> <?=$lang["savethissearchtocollection"]?></a></div> <div class="InpageNavLeftBlock"><a href="collections.php?addsearch=<?=urlencode($search)?>&restypes=<?=urlencode($restypes)?>&archive=<?=$archive?>&mode=resources" target="collections">> <?=$lang["savesearchitemstocollection"]?></a></div> <? } ?> <? hook("resultsbottomtoolbar"); ?> <? $url="search.php?search=" . urlencode($search) . "&order_by=" . urlencode($order_by) . "&archive=" . $archive; if (isset($draw_pager)) {pager(false);} ?> </div> <? } else { ?> <div class="BasicsBox"> <div class="NoFind"> <p><?=$lang["mustspecifyonekeyword"]?></p> </div> </div> <? }# Add the infobox.?><div id="InfoBox"><div id="InfoBoxInner"> </div></div><?include "include/footer.php";?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -