1
coopersita
Booklists crashes my notifications

When I add a notification in booklists 0.8 (books waiting for approval), my whole notification section crashes (white notifications page).

I get the following error message:

le="color: #000000"><?php Fatal error: Call to a member function on a non-object in /home/club/public_html/modules/booklists/include/notification.inc.php on line 37


I took a look at the code, but I can't find anything wrong:

le="color: #000000"><?php function mybooks_notify_iteminfo($category, $item_id) { global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'mybooks') { $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname('mybooks'); $config_handler =& xoops_gethandler('config'); $config =& $config_handler->getConfigsByCat(0,$module->getVar('mid')); } else { $module =& $xoopsModule; $config =& $xoopsModuleConfig; } //include_once XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/main.php'; if ($category=='global') { $item['name'] = ''; $item['url'] = ''; return $item; } global $xoopsDB; if ($category=='category') { // Assume we have a valid category id $sql = 'SELECT title FROM ' . $xoopsDB->prefix('mybooks_cat') . ' WHERE cid = '.$item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['title']; $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewcat.php?cid=' . $item_id; return $item; } if ($category=='link') { // Assume we have a valid link id $sql = 'SELECT cid,title FROM '.$xoopsDB->prefix('mybooks_links') . ' WHERE lid = ' . $item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['title']; $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/singlelink.php?cid=' . $result_array['cid'] . '&lid=' . $item_id; return $item; } }


If I turn off all my booklists notifications off, I get my notifications page back.

Has anyone encountered this in booklists?

Any ideas on how to correct it?

I tried upgrading to booklists 0.9, but then it all crashes. I don't want to uninstall and install again (I don't want to loose my books).

2
hervet
Re: Booklists crashes my notifications
  • 2004/11/29 18:32

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


hum... what is the line 37 ?

3
coopersita
Re: Booklists crashes my notifications

Here's with line numbers:

1<?php 2// $Id: menu.php, v.0.8 2004/02/18 3:35 csloh $ 3// $Id: notification.inc.php,v 1.2 2003/03/30 01:51:59 mvandam Exp $ 4// ------------------------------------------------------------------------ // 5// XOOPS - PHP Content Management System // 6// Copyright (c) 2000 XOOPS.org // 7// <https://xoops.org/> // 8// ------------------------------------------------------------------------ // 9// This program is free software; you can redistribute it and/or modify // 10// it under the terms of the GNU General Public License as published by // 11// the Free Software Foundation; either version 2 of the License, or // 12// (at your option) any later version. // 13// // 14// You may not change or alter any portion of this comment or credits // 15// of supporting developers from this source code or any supporting // 16// source code which is considered copyrighted (c) material of the // 17// original comment or credit authors. // 18// // 19// This program is distributed in the hope that it will be useful, // 20// but WITHOUT ANY WARRANTY; without even the implied warranty of // 21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 22// GNU General Public License for more details. // 23// // 24// You should have received a copy of the GNU General Public License // 25// along with this program; if not, write to the Free Software // 26// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 27// ------------------------------------------------------------------------ // 28 29function mybooks_notify_iteminfo($category, $item_id) 30{ 31 global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; 32 33 if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'mybooks') { 34 $module_handler =& xoops_gethandler('module'); 35 $module =& $module_handler->getByDirname('mybooks'); 36 $config_handler =& xoops_gethandler('config'); 37 $config =& $config_handler->getConfigsByCat(0,$module->getVar('mid')); 38 } else { 39 $module =& $xoopsModule; 40 $config =& $xoopsModuleConfig; } //include_once XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/main.php'; if ($category=='global') { $item['name'] = ''; $item['url'] = ''; return $item; } global $xoopsDB; if ($category=='category') { // Assume we have a valid category id $sql = 'SELECT title FROM ' . $xoopsDB->prefix('mybooks_cat') . ' WHERE cid = '.$item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['title']; $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewcat.php?cid=' . $item_id; return $item; } if ($category=='link') { // Assume we have a valid link id $sql = 'SELECT cid,title FROM '.$xoopsDB->prefix('mybooks_links') . ' WHERE lid = ' . $item_id; $result = $xoopsDB->query($sql); // TODO: error check $result_array = $xoopsDB->fetchArray($result); $item['name'] = $result_array['title']; $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/singlelink.php?cid=' . $result_array['cid'] . '&lid=' . $item_id; return $item; } } ?>


Allthough I'm not sure the line number is correct... Could it be the <?php at the beginning? If it's an include, does it really need it?

4
hervet
Re: Booklists crashes my notifications
  • 2004/11/29 18:56

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


use an editor and count the lines number one by one from the first line.

5
coopersita
Re: Booklists crashes my notifications

What I meant is that I don't know if the number 37 is accurate. The numbers I added to the lines are what the text editor show, but line 37 doesn't call for any include...

Booklists is based on mylinks. I compared notification.inc.php for both modules, and they are identical... the problem must be somewhere else.

6
coopersita
Re: Booklists crashes my notifications

No one else uses booklists?

7
ackbarr
Re: Booklists crashes my notifications

le="color: #000000"><?php 37 $config =& $config_handler->getConfigsByCat(0,$module->getVar('mid'));


should be:
le="color: #000000"><?php 37 $config =& $config_handler->getConfigsByCat(0,[color=008000][b]$xoopsModule[/b][/color]->getVar('mid'));

8
ackbarr
Re: Booklists crashes my notifications

nevermind - that's not the problem. is the directory name of the module 'mybooks' all lowercase?

9
coopersita
Re: Booklists crashes my notifications

Thanks so much. That was exactly it. The folder is called booklists, not mybooks.

I guess I downloaded a buggy version.

I changed the mybooks to booklists in that file and it now works.

10
csloh
Re: Booklists crashes my notifications [fixed]
  • 2004/12/10 6:01

  • csloh

  • Just popping in

  • Posts: 20

  • Since: 2003/12/17


Sorry guys, haven't been checking the forum (nor inbox) for sometimes.

That was my first attempt in cloning a module (from "MyLink") and oobviously I did not do a very clean job and had left some "link" uncorrected.

There is now a 0.9 version of booklists. I have double-checked and clean out the "wrong directory" codes, and it should work better. You can download it here.

Login

Donat-O-Meter

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