1

(2 replies, posted in PunBB 1.2 troubleshooting)

Hi again,

Things getting worse.

There files that run more then one function , like cache.php, there i need bug fix for each function.

I have search for known bug, found some semiliar problems but not exact and no one admit it's a bug.

My question is what is different between user scripts and admin scripts?
Is there a point of failure know to anybody?

Help will be appreciated, very very much,

Assaf

2

(2 replies, posted in PunBB 1.2 troubleshooting)

Hello,

I have a strange problem with Mysqli only under admin_* scripts.

AS far as i know regular user scripts running with no errors.

I have error on simple selects statement returning no result causing the script to report error with no error.

example:

//debug var dump($db) to see if i have a connection

object(DBLayer)#6 (5) { ["prefix"]=>  string(0) "" ["link_id"]=>  object(mysqli)#7 (0) { } ["query_result"]=>  NULL ["saved_queries"]=>  array(0) { } ["num_queries"]=>  int(0) }

An error was encountered
File: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wibizz\htdocs\app\plugins\forums\admin_forums.php
Line: 47

PunBB reported: Unable to create forum

Database reported:


As you can see no error is reported query return bool(false)

The only fix i found was:

/**
  * *fix without it the query fails
  */

    unset($db);
    $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect);

I can't even release the result or the link because i get error : Can't fetch mysqli ....

It's going to terrible if i need to add this bug fix to all admin_* files

Any idea?

Thanks,

Assaf

Well i know that it is not implanted yet.
You have asked for improvements didn't you,
So here is my first one PUN_WEBROOT wink

Now for more questions smile

How come i get an error on that query

SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM categories AS c INNER JOIN forums AS f ON c.id=f.cat_id LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position

defined in serach.php line 708

when running inside the script the var_dump result in bool false hence the error message.

But when running on my mysql client i get 2 rows?

mysql> use punbb;
Database changed
mysql> SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url
FROM categories AS c INNER JOIN forums AS f ON c.id=f.cat_id LEFT JOIN forum_pe
rms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL O
R fp.read_forum=1) AND f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.
disp_position;
+-----+----------+-----+------------+--------------+
| cid | cat_name | fid | forum_name | redirect_url |
+-----+----------+-----+------------+--------------+
|   1 | test     |   1 | wibizz     | NULL         |
|   2 | assaf    |   2 | New forum  | NULL         |
+-----+----------+-----+------------+--------------+
2 rows in set (0.00 sec)

PUN_WEBROOT?

PUN_WEBROOT can be used if the server document root is different then the installation of punbb.
Usually when Apache redirect you according to RewriteRules to places outside document_root

Hope it's clear,
Assaf

ok thanks,

last question (i hope) before diving into code
Does the css link on top of the page is relative to the PUN_ROOT or something like PUN_WEBROOT?
If it's not i think it would be a good practice to support not native punbb platforms by helping them find relevant files like css,js and images used by punbb

p.s i do have another question smile
How do i enable root member and moderators after installation?
Or in another way how the system recognize a user to be admin/moderator? because i'm using diffrent login system which updates punbb users tables

Assaf

Smartys: you the man !!

Now i have found new problems sad

First because i'm in another page (within cake) i want only what comes between  <body> ans </body> tags.
Do i need to change the templates directly?
Can you please tell me were to find them?

Second does the script terminates in exit() or die() after displaying the templates?
The cake page doesnt load and the way cake works its loads the view (templates) after finishing execution in the controller (the index function above)

Thanks again Smartys,

Assaf

here is sample code

class ForumsController extends AppController
{

    function index(){
        define('PUN_ROOT', dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'webroot'.DIRECTORY_SEPARATOR.'forum'.DIRECTORY_SEPARATOR);
        require PUN_ROOT.'include'.DIRECTORY_SEPARATOR.'common.php';
    }

}


here is a crude debug report after manualy hacking the global $db

please note in the end how the array lose their data becuase the checked againt $pun_config which is null
becuase declared global $pun_config

smarty:you can delete this post after reading becuase its take lot of space and i don't know how clear it is for readers smile

pun user  -> var_dump()
array(11) { ["id"]=> string(2) "24" ["user_name"]=> string(4) "test" ["email_address"]=> string(18) "sufinoon@gmail.com" ["full_name"]=> string(3) "ass" ["password"]=> string(32) "e10adc3949ba59abbe56e057f20f883e" ["show_name"]=> string(1) "0" ["created"]=> string(19) "2007-05-15 09:45:12" ["user_profile_id"]=> string(2) "16" ["email_authenticated"]=> string(1) "1" ["email_token"]=> NULL ["email_token_expires"]=> NULL }
hihiobject(DBLayer)#13 (5) { ["prefix"]=> string(0) "" ["link_id"]=> object(mysqli)#14 (0) { } ["query_result"]=> NULL ["saved_queries"]=> array(0) { } ["num_queries"]=> int(0) }
in the middle (common.php line 116)


before check cookie (common.php line 140)

var_dump($db) ->
object(DBLayer)#13 (5) { ["prefix"]=> string(0) "" ["link_id"]=> object(mysqli)#14 (0) { } ["query_result"]=> NULL ["saved_queries"]=> array(0) { } ["num_queries"]=> int(0) }

******
* in check user *
********** (functions.php line 37)

NULL -> var_dump($db);
*****
default users
**** (functions.php line 143)


pun_config (functions.php line 157)

NULL  -> var_dump($pun_config);
in set_default_user (functions.php line 166)

array(56) { ["id"]=> string(1) "1" ["group_id"]=> string(1) "3" ["username"]=> string(5) "Guest" ["password"]=> string(5) "Guest" ["email"]=> string(0) "" ["title"]=> NULL ["realname"]=> string(0) "" ["url"]=> NULL ["jabber"]=> NULL ["icq"]=> NULL ["msn"]=> NULL ["aim"]=> NULL ["yahoo"]=> NULL ["location"]=> NULL ["use_avatar"]=> string(1) "0" ["signature"]=> NULL ["disp_topics"]=> NULL ["disp_posts"]=> NULL ["email_setting"]=> string(1) "1" ["save_pass"]=> string(1) "1" ["notify_with_post"]=> string(1) "0" ["show_smilies"]=> string(1) "1" ["show_img"]=> string(1) "1" ["show_img_sig"]=> string(1) "1" ["show_avatars"]=> string(1) "1" ["show_sig"]=> string(1) "1" ["timezone"]=> string(1) "0" ["language"]=> string(7) "English" ["style"]=> string(6) "Oxygen" ["num_posts"]=> string(1) "0" ["last_post"]=> NULL ["registered"]=> string(1) "0" ["registration_ip"]=> string(7) "0.0.0.0" ["last_visit"]=> string(1) "0" ["admin_note"]=> NULL ["activate_string"]=> NULL ["activate_key"]=> NULL ["g_id"]=> string(1) "3" ["g_title"]=> string(5) "Guest" ["g_user_title"]=> NULL ["g_read_board"]=> string(1) "1" ["g_post_replies"]=> string(1) "0" ["g_post_topics"]=> string(1) "0" ["g_post_polls"]=> string(1) "0" ["g_edit_posts"]=> string(1) "0" ["g_delete_posts"]=> string(1) "0" ["g_delete_topics"]=> string(1) "0" ["g_set_title"]=> string(1) "0" ["g_search"]=> string(1) "1" ["g_search_users"]=> string(1) "1" ["g_edit_subjects_interval"]=> string(1) "0" ["g_post_flood"]=> string(1) "0" ["g_search_flood"]=> string(1) "0" ["g_pm"]=> string(1) "1" ["g_pm_limit"]=> string(2) "20" ["logged"]=> string(10) "1179213445" }

**********
AFTER defaukt init
************

(functions.php line 197)

array(57) { ["id"]=> string(1) "1" ["group_id"]=> string(1) "3" ["username"]=> string(5) "Guest" ["password"]=> string(5) "Guest" ["email"]=> string(0) "" ["title"]=> NULL ["realname"]=> string(0) "" ["url"]=> NULL ["jabber"]=> NULL ["icq"]=> NULL ["msn"]=> NULL ["aim"]=> NULL ["yahoo"]=> NULL ["location"]=> NULL ["use_avatar"]=> string(1) "0" ["signature"]=> NULL ["disp_topics"]=> NULL ["disp_posts"]=> NULL ["email_setting"]=> string(1) "1" ["save_pass"]=> string(1) "1" ["notify_with_post"]=> string(1) "0" ["show_smilies"]=> string(1) "1" ["show_img"]=> string(1) "1" ["show_img_sig"]=> string(1) "1" ["show_avatars"]=> string(1) "1" ["show_sig"]=> string(1) "1" ["timezone"]=> NULL ["language"]=> NULL ["style"]=> NULL ["num_posts"]=> string(1) "0" ["last_post"]=> NULL ["registered"]=> string(1) "0" ["registration_ip"]=> string(7) "0.0.0.0" ["last_visit"]=> string(1) "0" ["admin_note"]=> NULL ["activate_string"]=> NULL ["activate_key"]=> NULL ["g_id"]=> string(1) "3" ["g_title"]=> string(5) "Guest" ["g_user_title"]=> NULL ["g_read_board"]=> string(1) "1" ["g_post_replies"]=> string(1) "0" ["g_post_topics"]=> string(1) "0" ["g_post_polls"]=> string(1) "0" ["g_edit_posts"]=> string(1) "0" ["g_delete_posts"]=> string(1) "0" ["g_delete_topics"]=> string(1) "0" ["g_set_title"]=> string(1) "0" ["g_search"]=> string(1) "1" ["g_search_users"]=> string(1) "1" ["g_edit_subjects_interval"]=> string(1) "0" ["g_post_flood"]=> string(1) "0" ["g_search_flood"]=> string(1) "0" ["g_pm"]=> string(1) "1" ["g_pm_limit"]=> string(2) "20" ["logged"]=> string(10) "1179213445" ["is_guest"]=> bool(true) }
after check cookie (common.php line 145)

array(57) { ["id"]=> string(1) "1" ["group_id"]=> string(1) "3" ["username"]=> string(5) "Guest" ["password"]=> string(5) "Guest" ["email"]=> string(0) "" ["title"]=> NULL ["realname"]=> string(0) "" ["url"]=> NULL ["jabber"]=> NULL ["icq"]=> NULL ["msn"]=> NULL ["aim"]=> NULL ["yahoo"]=> NULL ["location"]=> NULL ["use_avatar"]=> string(1) "0" ["signature"]=> NULL ["disp_topics"]=> NULL ["disp_posts"]=> NULL ["email_setting"]=> string(1) "1" ["save_pass"]=> string(1) "1" ["notify_with_post"]=> string(1) "0" ["show_smilies"]=> string(1) "1" ["show_img"]=> string(1) "1" ["show_img_sig"]=> string(1) "1" ["show_avatars"]=> string(1) "1" ["show_sig"]=> string(1) "1" ["timezone"]=> NULL ["language"]=> NULL ["style"]=> NULL ["num_posts"]=> string(1) "0" ["last_post"]=> NULL ["registered"]=> string(1) "0" ["registration_ip"]=> string(7) "0.0.0.0" ["last_visit"]=> string(1) "0" ["admin_note"]=> NULL ["activate_string"]=> NULL ["activate_key"]=> NULL ["g_id"]=> string(1) "3" ["g_title"]=> string(5) "Guest" ["g_user_title"]=> NULL ["g_read_board"]=> string(1) "1" ["g_post_replies"]=> string(1) "0" ["g_post_topics"]=> string(1) "0" ["g_post_polls"]=> string(1) "0" ["g_edit_posts"]=> string(1) "0" ["g_delete_posts"]=> string(1) "0" ["g_delete_topics"]=> string(1) "0" ["g_set_title"]=> string(1) "0" ["g_search"]=> string(1) "1" ["g_search_users"]=> string(1) "1" ["g_edit_subjects_interval"]=> string(1) "0" ["g_post_flood"]=> string(1) "0" ["g_search_flood"]=> string(1) "0" ["g_pm"]=> string(1) "1" ["g_pm_limit"]=> string(2) "20" ["logged"]=> string(10) "1179213445" ["is_guest"]=> bool(true) }
in !isset (common.php line 150)

array(57) { ["id"]=> string(1) "1" ["group_id"]=> string(1) "3" ["username"]=> string(5) "Guest" ["password"]=> string(5) "Guest" ["email"]=> string(0) "" ["title"]=> NULL ["realname"]=> string(0) "" ["url"]=> NULL ["jabber"]=> NULL ["icq"]=> NULL ["msn"]=> NULL ["aim"]=> NULL ["yahoo"]=> NULL ["location"]=> NULL ["use_avatar"]=> string(1) "0" ["signature"]=> NULL ["disp_topics"]=> NULL ["disp_posts"]=> NULL ["email_setting"]=> string(1) "1" ["save_pass"]=> string(1) "1" ["notify_with_post"]=> string(1) "0" ["show_smilies"]=> string(1) "1" ["show_img"]=> string(1) "1" ["show_img_sig"]=> string(1) "1" ["show_avatars"]=> string(1) "1" ["show_sig"]=> string(1) "1" ["timezone"]=> NULL ["language"]=> NULL ["style"]=> NULL ["num_posts"]=> string(1) "0" ["last_post"]=> NULL ["registered"]=> string(1) "0" ["registration_ip"]=> string(7) "0.0.0.0" ["last_visit"]=> string(1) "0" ["admin_note"]=> NULL ["activate_string"]=> NULL ["activate_key"]=> NULL ["g_id"]=> string(1) "3" ["g_title"]=> string(5) "Guest" ["g_user_title"]=> NULL ["g_read_board"]=> string(1) "1" ["g_post_replies"]=> string(1) "0" ["g_post_topics"]=> string(1) "0" ["g_post_polls"]=> string(1) "0" ["g_edit_posts"]=> string(1) "0" ["g_delete_posts"]=> string(1) "0" ["g_delete_topics"]=> string(1) "0" ["g_set_title"]=> string(1) "0" ["g_search"]=> string(1) "1" ["g_search_users"]=> string(1) "1" ["g_edit_subjects_interval"]=> string(1) "0" ["g_post_flood"]=> string(1) "0" ["g_search_flood"]=> string(1) "0" ["g_pm"]=> string(1) "1" ["g_pm_limit"]=> string(2) "20" ["logged"]=> string(10) "1179213445" ["is_guest"]=> bool(true) }
Attempt to load the common language file (common.php line 155)

There is no valid language pack '' installed. Please reinstall a language of that name.

Hi,

I'm trying to import punbb into cakephp.

I have defined PUN_ROOT and included the file include/common.php

But a php fatal error jumps at me

Fatal error: Call to a member function query() on a non-object in ..../include/functions.php on line 125

I have var_dump($db) before line 120 on common.php
and its show me an object reference, but inside check_cookie() i get NULL.

For some odd reason the global $db doesn't work (also other global like $pun_user,$pun_config ....).
When overriding cakephp and running index.php or defining PUN_ROOT inside common.php and running it i get no error

Any idea why?

Thanks,

Assaf

Hi,

I'm trying to import punbb into cakephp.

I have defined PUN_ROOT and included the file include/common.php

But a php fatal error jumps at me

Fatal error: Call to a member function query() on a non-object in ..../include/functions.php on line 125

I have var_dump($db) before line 120 on common.php
and its show me an object reference, but inside check_cookie() i get NULL.

For some odd reason the global $db doesn't work (also other global like $pun_user,$pun_config ....).
When overriding cakephp and running index.php or defining PUN_ROOT inside common.php and running it i get no error

Any idea why?

Thanks,

Assaf