1
zeroram
Call to a member function on a non-object in.... search.php on line 141
  • 2004/7/19 22:17

  • zeroram

  • Friend of XOOPS

  • Posts: 326

  • Since: 2004/6/30


Am trying to use the search feature on Xdirectory with the multilanguage hack

but i get this ERROR

Fatal error: Call to a member function on a non-object in /home/username/public_html/search.php on line 141

here is a part of the code

// Hack by marcan : only return results of modules for which user has access permission
$groups = ( $xoopsUser ) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler = & xoops_gethandler( 'groupperm' );
//End of hack by marcan

$module_handler =& xoops_gethandler('module');
foreach ($mids as $mid) {
$mid = intval($mid);
$module =& $module_handler->get($mid);
if ( $gperm_handler -> checkRight('module_read', $mid, $groups)) {
LINE 141 $results =& $module->search($queries, $andor, 5, 0);
echo "<h4>".$myts->makeTboxData4Show($module->getVar('name'))."</h4>";
$count = count($results);
if (!is_array($results) || $count == 0) {
echo "<p>"._SR_NOMATCH."</p>";
} else {
for ($i = 0; $i < $count; $i++) {
if (isset($results[$i]['image']) && $results[$i]['image'] != "") {
echo "<img src='modules/".$module->getVar('dirname')."/".$results[$i]['image']."' alt='".$myts->makeTboxData4Show($module->getVar('name'))."' />&nbsp;";
} else {
echo "<img src='images/icons/posticon2.gif' alt='".$myts->makeTboxData4Show($module->getVar('name'))."' width='26' height='26' />&nbsp;";
}
echo "<b><a href='modules/".$module->getVar('dirname')."/".$results[$i]['link']."'>".$myts->makeTboxData4Show($results[$i]['title'])."</a></b><br />\n";
echo "<small>";
$results[$i]['uid'] = intval($results[$i]['uid']);
if ( !empty($results[$i]['uid']) ) {
$uname = XoopsUser::getUnameFromId($results[$i]['uid']);
echo "&nbsp;&nbsp;<a href='".XOOPS_URL."/userinfo.php?uid=".$results[$i]['uid']."'>".$uname."</a>\n";
}
echo $results[$i]['time'] ? " (". formatTimestamp(intval($results[$i]['time'])).")" : "";
echo "</small><br />\n";
}
if ( $count == 5 ) {
$search_url = XOOPS_URL.'/search.php?query='.urlencode(stripslashes(implode(' ', $queries)));
$search_url .= "&mid=$mid&action=showall&andor=$andor";
echo '<br /><a href="'.$search_url.'">'._SR_SHOWALLR.'</a></p>';
}
}
}
unset($results);
unset($module);
}
include "include/searchform.php";
$search_form->display();
break;
case "showall":
case 'showallbyuser':
include XOOPS_ROOT_PATH."/header.php";
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->get($mid);
$results =& $module->search($queries, $andor, 20, $start, $uid);
$count = count($results);
if (is_array($results) && $count > 0) {
$next_results =& $module->search($queries, $andor, 1, $start + 20, $uid);
$next_count = count($next_results);
$has_next = false;
if (is_array($next_results) && $next_count == 1) {
$has_next = true;
}
echo "<h4>"._SR_SEARCHRESULTS."</h4>\n";
if ($action == 'showall') {
echo _SR_KEYWORDS.':';
if ($andor != 'exact') {
foreach ($queries as $q) {
echo ' <b>'.htmlspecialchars(stripslashes($q)).'</b>';
}
} else {
echo ' "<b>'.htmlspecialchars(stripslashes($queries[0])).'</b>"';
}
echo '<br />';


Login

Who's Online

86 user(s) are online (57 user(s) are browsing Support Forums)


Members: 0


Guests: 86


more...

Donat-O-Meter

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

Latest GitHub Commits