Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2005, 07:57 PM
SilentK SilentK is offline
 
Join Date: Nov 2004
Location: Maryland
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Fatal error: Call to a member function on a non-object

I have a query that used to work before I installed 3.5 Now I get this error message whenever I load the page
Quote:
Fatal error: Call to a member function on a non-object in /./././htdocs/widget.php on line 5
This is the contents of widget.php

PHP Code:
<?php
chdir
('/./././htdocs/forums');
require 
'global.php';

$latestThreads $DB_site->query("
        SELECT *
        FROM " 
TABLE_PREFIX "thread AS thread
        WHERE thread.visible = 1 
        ORDER BY dateline DESC
        LIMIT 5  
       "
);
$num_rows $DB_site->num_rows($latestThreads);
while(
$row $DB_site->fetch_array($latestThreads) )
{
     echo(
'<a href="http://www.xblteams.com/forums/showthread.php?t=' $row[threadid] . '">' $row[title] . '</a><br />');


?>
That worked before 3.5. What changed? and what do I need to change to make it work?

Also I would like to get it so the links are formatted like this
Code:
<a href="javascript:widget.openURL('http://www.xblteams.com/forums/showthread.php?t=put thread id here')"></a>
I've tried
PHP Code:
 echo('<a href="javascript:widget.openURL('http://www.xblteams.com/forums/showthread.php?t=' . $row[threadid] . ' ')">' . $row[title] . '</a><br />'); 
but I get a parse error.
Thanks in advance.
Reply With Quote
  #2  
Old 06-16-2005, 08:05 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SilentK
That worked before 3.5. What changed? and what do I need to change to make it work?
$DB_site is now $db.

And you should use query_read/query_write instead of just query depending if you are reading from or writing to the database.

PHP Code:
echo('<a href="javascript:widget.openURL(\'http://www.xblteams.com/forums/showthread.php?t=' $row[threadid] . '\')">' htmlentities($row[title]) . '</a><br />'); 
should work.

The htmlspecialchars_uni() is necesarry, otherwise you create an XSS vulnerbilitie.
Reply With Quote
  #3  
Old 06-16-2005, 08:51 PM
SilentK SilentK is offline
 
Join Date: Nov 2004
Location: Maryland
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm that fixed the error and appears to be formatting the link correctly. What I am trying to do is create a widget for mac os 10.4 so far the only way I have found to get a widget to open up a link in safari is javascript:widget.openURL

From what I can tell the php file is doing it's job perfectly.
Here's an example of a link that it's pumping out.
Code:
<a href="javascript:widget.openURL('http://www.xblteams.com/forums/showthread.php?t=4257')">Call of Duty screenshots</a>
That should work because I have tested.
Code:
<a href="javascript:widget.openURL('http://www.xblteams.com/')">Xblteams.com</a>
Directly inside the widge and it works. I am guessing there must be an issue with the way I am loading the links into the widget.

here's the body of the widget
Code:
<body background="Default.png">
<table cellpadding="20">
<tr><td>
<IFRAME SRC="http://www.xblteams.com/widget.php" WIDTH=180 HEIGHT=240>
</IFRAME>
</td></tr></table>
</body>
From the testing I have done the iframe is causing the problem. The reason I think this is I created a file with just
Code:
<a href="javascript:widget.openURL('http://www.xblteams.com/')">Xblteams.com</a>
and loaded it via an Iframe and it didn't work either. By not working I mean when I click the link nothing happens.

Is there a better way to load the links in?
widgets support javascript, and html.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06669 seconds
  • Memory Usage 2,190KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete