1
playsome
xcgal hack make searches return album title instead of picture info
  • 2011/6/11 17:59

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello all,

I have a small hack that might be usefull to someone hopefully. This hack to xcgal include/search.php will, when a users uses xoops search or for example mysearch to search your site, return the an album title and link to that albums thumbnail rather than return the picture info.

The reason for this hack is that on a site i manage, i have a custom lightbox and intermediate pictures turned off when searching i noticed that picture thumbnails where showing but where not clickable in anyway so I thought that returning the album title and link to the album thumbnails page would be much better.

So heres the code i have commented out unneeded code rather than deleting it, i have tested it on xoops core search and mysearch module and it seems to work fine, any feedback would be appreciated.

<?php
// $Id: search.php,v 1.1 2005/08/30 06:27:31 mcleines Exp $
//modified by playsome on 11 June 2011
//Search now returns album name instead of picture information
//usefull if you use a lightbox and have intermediate pictures turned off

function xcgal_search($queryarray$andor$limit$offset$userid){
    global 
$xoopsDB;
    
//$xcgalCon = search_album_set();
    
$sql "SELECT aid, title FROM ".$xoopsDB->prefix("xcgal_albums");
    
/*if ( $userid != 0 ) {
        $sql .= " AND owner_id=".$userid." $ALBUM_SET_SEARCH";
    }*/
    // because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    
if ( is_array($queryarray) && $count count($queryarray) ) {
        
$sql .= " WHERE ((title LIKE '%$queryarray[0]%')";
        for(
$i=1;$i<$count;$i++){
            
$sql .= $andor ";
            
$sql .= "(title LIKE '%$queryarray[$i]%')";
        }
        
$sql .= ") ";
    }
//end if
    
$sql .= "ORDER BY title DESC";
    
$result $xoopsDB->query($sql,$limit,$offset);
    
$ret = array();
    
$i 0;
     while(
$myrow $xoopsDB->fetchArray($result)){
         
/*if ($xcgalCon['search_thumb'] == 1 ) $ret[$i]['image'] = $xcgalCon['fullpath'].str_replace("%2F","/",rawurlencode($myrow['filepath'].$xcgalCon['thumb_pfx'].$myrow['filename']));*/
         
$ret[$i]['image'] = "images/xcgal.gif";
        
$ret[$i]['link'] = "thumbnails.php?album=".$myrow['aid']."";//link to the album id
        
$ret[$i]['title'] = $myrow['title'];
        
$i++;
    }
    return 
$ret;
}

/*function search_album_set()
{
    global $ALBUM_SET_SEARCH, $xoopsDB, $xoopsUser;
    if (is_object ($xoopsUser)){
        $usergroups= $xoopsUser->getgroups();
        $usergroup= implode(",",$usergroups);
        $buid= $xoopsUser->uid();
    } else {
        $usergroup= XOOPS_GROUP_ANONYMOUS;
        $buid = 0;
    }
    $user_cat = 10000;
    $module_handler= & xoops_gethandler('module');
    $xcgalModule = $module_handler->getByDirname('xcgal');
    $config_handler =& xoops_gethandler('config');
    $xcgalCon =& $config_handler->getConfigsByCat(0, $xcgalModule->mid());
    if(is_object($xoopsUser) && $xoopsUser->isAdmin($xcgalModule->mid())) $ALBUM_SET_SEARCH= "";
    else {
    $result = $xoopsDB->query("SELECT aid FROM ".$xoopsDB->prefix("xcgal_albums")." WHERE visibility NOT IN ($usergroup, 0,".($user_cat + $buid).")");
    if (($xoopsDB->getRowsNum($result))) {
        $set ='';
        while($album=$xoopsDB->fetchArray($result)){
            $set .= $album['aid'].',';
        } // while
        $ALBUM_SET_SEARCH .= 'AND aid NOT IN ('.substr($set, 0, -1).') ';
    }
    $xoopsDB->freeRecordSet($result);
    }
    return $xcgalCon;
}*/
?>

2
JCash
Re: xcgal hack make searches return album title instead of picture info
  • 2011/6/11 21:01

  • JCash

  • Just popping in

  • Posts: 66

  • Since: 2011/2/22


hi

I don't if you're talking about the same module but there is a hack for a long time here : http://www.tenthstone.com/2008/09/xcgal-search-patch/

Login

Username:
Password:

Lost Password? Register now!

Who's Online

74 user(s) are online (51 user(s) are browsing Support Forums)


Members: 0


Guests: 74


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits