Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 08:28 am EST

Geeklog Forums

Last question today, I swear...


Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
Since the upgrade, hacks stored in lib-custom are not being recognized. I get the following error in blocks referencing custom php:

Error in PHP Block. Function, phpblock_mostPopular, does not exist.

Is there anything I need to do to get it to recognize lib-custom again?
Luhme summa dat GL.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Is your lib-custom.php still there? Just asking in case you overwrote it with the one that ships with Geeklog ...

bye, Dirk
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
Yeah, I just downloaded a fresh copy to verify.
Luhme summa dat GL.
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
I reuploaded my lib-custom, and now it says:

Resource ID #225

But is still not returning the desired data.
Luhme summa dat GL.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by DubiousChrisJ: Resource ID #225

That's what you get when you echo out the result of a database query and usually indicates a bug in the script in question.

Since I don't know what's in your lib-custom.php I can't really be any more specific ...

bye, Dirk
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
This is the script in question:

Text Formatted Code
function phpblock_mostPopular () {
    global $_TABLES;
    $result = DB_query("SELECT sid,title,hits FROM {$_TABLES["stories"]} WHERE (draft_flag = 0) AND (date <= NOW()) AND (Hits > 0)" . COM_getPermSQL ('AND') . " ORDER BY Hits desc LIMIT 10");
    return $result;
 

Luhme summa dat GL.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Yep, as I said above. This isn't going to work and never did.

What you get back from that database query is a MySQL resource identifying the results of the query - but not the actual results yet. You need at least a DB_fetchArray($result); to actually request the data. And then do something sensible with the result (which is an array).

I'd say there's quite a bit of code missing from that function ...

bye, Dirk
 Quote

Status: offline

DubiousChrisJ

Forum User
Regular Poster
Registered: 05/10/05
Posts: 114
Hmmm...so maybe, part of the code did get overwritten...it was working before. I will seach the archives here and see if I can find the thread where I worked with the other guy to come up with it. Thanks, Dirk!
Luhme summa dat GL.
 Quote

All times are EST. The time is now 08:28 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content