Joomla/SMF and coppermine bridge error on random files and user albums Joomla/SMF and coppermine bridge error on random files and user albums
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Joomla/SMF and coppermine bridge error on random files and user albums

Started by darkpollo, March 14, 2006, 07:25:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

darkpollo

I have got Joomla 1.07 and SMF last version bridge. Also i have the cpg 1.4.4 with the modpack by Stramm.

I have got this error when i make the bridge with SMF:

While executing query "SELECT c.msg_id, c.msg_author, c.msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, c.author_id, c.author_md5_id, c.msg_raw_ip, c.msg_hdr_ip, c.pid, u.avatar AS avatar_url FROM cpg_comments AS c INNER JOIN `motos_smf1`.smf_members AS u ON c.author_id=u.ID_MEMBER WHERE pid='98' ORDER BY c.msg_id ASC" on Resource id #21

mySQL error: No database selected


And the debug info:
USER:
------------------
Array
(
    [ID] => bdf7c4978aadd20e747ccf0cb77f6c36
    [am] => 1
    [lang] => english
    [liv] => Array
        (
            [0] => 60
            [1] => 94
            [2] => 71
            [3] => 74
            [4] => 98
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 4
    [user_name] => darkpollo
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg_filetypes; (0s)
    [1] => SELECT * FROM cpg_bridge (0s)
    [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg_usergroups WHERE group_id in (1) (0s)
    [3] => SELECT group_name FROM  cpg_usergroups WHERE group_id= 1 (0s)
    [4] => SELECT user_favpics FROM cpg_favpics WHERE user_id = 4 (0s)
    [5] => SELECT count(*) FROM  cpg_pms WHERE owner=4 (0s)
    [6] => SELECT count(*) FROM  cpg_pms WHERE owner=4 AND showed='0' (0s)
    [7] => SELECT count(*) FROM  cpg_buddy WHERE user_id=4 (0s)
    [8] => SELECT count(*) FROM  cpg_buddy_req WHERE buddy_to=4 (0s)
    [9] => DELETE FROM cpg_banned WHERE expiry < '2006-03-14 19:15:47' (0s)
    [10] => SELECT * FROM cpg_banned WHERE (ip_addr='81.34.6.28' OR ip_addr='81.34.6.28' OR user_id=4) AND brute_force=0 (0s)
    [11] => SELECT aid from cpg_pictures WHERE pid='98'  LIMIT 1 (0s)
    [12] => SELECT title,keyword from cpg_albums WHERE aid='1' (0s)
    [13] => SELECT COUNT(*) from cpg_pictures WHERE ((aid='1'  ) OR (keywords like '%sport%'  ))   (0s)
    [14] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, keywords, votes, pic_rating, title, caption,hits,owner_id,owner_name from cpg_pictures WHERE ((aid='1'  ) OR (keywords like '%sport%'  ))   ORDER BY filename ASC  (0s)
    [15] => SELECT title,keyword from cpg_albums WHERE aid='1' (0s)
    [16] => SELECT COUNT(*) from cpg_pictures WHERE ((aid='1'  ) OR (keywords like '%sport%'  ))   (0s)
    [17] => SELECT * from cpg_pictures WHERE ((aid='1'  ) OR (keywords like '%sport%'  ))   ORDER BY filename ASC  LIMIT 2 ,1 (0s)
    [18] => SELECT title, comments, votes, category, aid FROM cpg_albums WHERE aid='1' LIMIT 1 (0s)
    [19] => SELECT name, parent FROM cpg_categories WHERE cid = '13' (0s)
    [20] => SELECT c.msg_id, c.msg_author, c.msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, c.author_id, c.author_md5_id, c.msg_raw_ip, c.msg_hdr_ip, c.pid, u.avatar AS avatar_url FROM cpg_comments AS c INNER JOIN `motos_smf1`.smf_members AS u ON c.author_id=u.ID_MEMBER WHERE pid='98' ORDER BY c.msg_id ASC (0s)
    [21] => SELECT COUNT(*) FROM cpg_pictures WHERE approved = 'NO' (0s)
)

==========================
GET :
------------------
Array
(
    [album] => random
    [cat] => 0
    [pos] => -98
    [splayimage_php?album] => random
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.4.2 - OK
------------------
mySQL version: 4.1.13-standard
------------------
Coppermine version: 1.4.4(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support:
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 2
Client API version 4.1.13
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.2.1.2
Linked Version 1.2.1.2
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | dl,passthru,proc_open,proc_close,shell_exec,system | dl,passthru,proc_open,proc_close,shell_exec,system
file_uploads | On | On
include_path | .:/usr/lib/php | .:/usr/lib/php
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i  | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | 60 | 60
upload_max_filesize | 2M | 2M
post_max_size | 8M | 8M
==========================
Page generated in 0.139 seconds - 22 queries in 0 seconds - Album set : ; Meta set: ;


Thank you for your help.

maybe i need to remove the modpack?
I would like to use it but i only need the minithumbnails and the watermark. I dont need the buddies  and the MP, as i have got the SMF to talk :D


darkpollo

I have update the modpack and nothing.

The version of SMF is smf 1.1 rc2

I have tried this and nothing:
http://forum.coppermine-gallery.net/index.php?topic=24842.msg114300#msg114300

Still testing...

darkpollo

I have just read this:
Quote5.2.5 Keep Coppermine and bbs tables in the same database

It is recommended that you use the same database for your board and Coppermine (in fact it is even mandatory!).

I have got both on diferent databases (fantastico instalation updated) but i give both SQL users access to both databases, is it enough?

Thanks.

Nibbler

This error is related to the mod. They don't need to be in the same db, you are reading an old version of the manual.

darkpollo

Thanks. But the mod says that can be installed in a bridge cpg...

So... how could i fix it?

Stramm

uninstall the mod (overwrite with orig files) and see what happens. I can't reproduce that error and just did a testinstall with smf 1.1-rc2 and cpg 1.4.4... both using different dbs

and I can't check on your site cause there's htpasswd protection

I'd look for the culprit in the fantastico install. So I bet upgrading to (orig, not fantastico) coppermine 1.4.4 and then reinstalling the modpack would solve your problem

darkpollo

Quote from: Stramm on March 15, 2006, 01:31:30 AM
uninstall the mod (overwrite with orig files) and see what happens. I can't reproduce that error and just did a testinstall with smf 1.1-rc2 and cpg 1.4.4... both using different dbs

and I can't check on your site cause there's htpasswd protection

I'd look for the culprit in the fantastico install. So I bet upgrading to (orig, not fantastico) coppermine 1.4.4 and then reinstalling the modpack would solve your problem


I have already upgrade to orig cpg 1.4.4 and also i reinstall the modpack yesterday and nothing.
I made some changes into the cpg, i will try uninstalling the mod... and use a new install of cpg 1.4.4
When i remove the bridge eveything works perfect.

Attach my modified function.inc.php.

Thanks


darkpollo

Well, im really close. ;D

I have uploaded again all the original file from cpg 1.4.4. --> the page works perfect with the bridge.
So, i will upload again the modpack.
Later i will upload one by one each modified file to set where is the problem. I will tell you afterwards.

darkpollo

Well, The problem is on the modpack v2. I dont know why, but im sure is there, i have upload the files and now the error is back.

So... how could i fix it?


darkpollo

More testing:
I have upload all the modpack files except three:

themes.inc.php
functions.inc.php
init.inc.php

Everything works. Start to test those files:

I upload only init.inc.php, problem, it need the function and themes to work.
I upload only functions.inc.php, another critical, but diferent, need also init and themes.

But! i upload the theme.inc.php file. I have got the same ERROR as i upload the three files.  I think the problem is in that file, but i dont know how the modpack and cpg works to fix it...

What do you think?

Stramm

I think you're wrong and can stop testing...
the problem is in udb.base.inc and there in the function get_comments

a quick fix would be to look for
$result = $cpg_udb->get_comments($pid, $comment_sort_order);
in themes.inc.php and replace it with
    $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id $comment_sort_order");

no support for avatars in comments then
if that's a problem for you and you want to have the avatars next to the comments then 2 more lil changes are necessary

few lines below find
if ($CONFIG['enable_avatar']){
        ($row['avatar_url'] != "") ? $avatar_url= "<img src='".AVATAR_PATH.$row["avatar_url"]."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";

and replace with
if ($CONFIG['enable_avatar']){
$result2 = $cpg_udb->get_avatar($row['author_id']);
$avatar_url= preg_replace('/\/\//','/',AVATAR_PATH.$result2["avatar_url"]);
        ($result2['avatar_url'] != "") ? $avatar_url= "<img src='".$avatar_url."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";


now open bridge/udb.base.inc and right before the }
?>
at the end add
function get_avatar($id)
{
global $CONFIG;
$sql = "SELECT {$this->field['avatar_url']} AS avatar_url FROM {$this->usertable} WHERE {$this->field['user_id']}='$id'";
$result = cpg_db_query($sql, $this->link_id);
$user_data = mysql_fetch_array($result);
mysql_free_result($result);

return $user_data;
}

darkpollo

 ;D ;D ;D ;D

Great, working now!! :D

Thank you very much...


Now i have noticed there is another error on login, but this is another thread...

QuoteI think you're wrong and can stop testing...
the problem is in udb.base.inc and there in the function get_comments
I weren´t worng at all, at least i needed to change the themes.inc.php  :D

Anyway, could be a problem with avatars config in the bridge tool??

Stramm

the problem is that I haven't had two different database users in mind when I did the mod. You could just use the same users mysql for smf and cpg.

darkpollo

Uf, that will be start again... i think i dont need the avatars  ;D

See you. I will stop of spamming here now  ::) :P  ;)

And thank you again.

imrich

I had this error also.

I'm using SMF 1.1.1
Coppermine 1.4.10

v1.4.10 modpack v1 (stable)

SMF and Coppermine are in the same database

I do have joomla but Coppermine is not bridged to joomla (SMF is bridged to joomla though).

The first of these mods solved the problem (critical error)

Quote from: Stramm on March 15, 2006, 01:02:56 PM

a quick fix would be to look for
$result = $cpg_udb->get_comments($pid, $comment_sort_order);
in themes.inc.php and replace it with
    $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id $comment_sort_order");

so to get the complete fix I made the following change:
Quote
no support for avatars in comments then
if that's a problem for you and you want to have the avatars next to the comments then 2 more lil changes are necessary

few lines below find
if ($CONFIG['enable_avatar']){
        ($row['avatar_url'] != "") ? $avatar_url= "<img src='".AVATAR_PATH.$row["avatar_url"]."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";

and replace with
if ($CONFIG['enable_avatar']){
$result2 = $cpg_udb->get_avatar($row['author_id']);
$avatar_url= preg_replace('/\/\//','/',AVATAR_PATH.$result2["avatar_url"]);
        ($result2['avatar_url'] != "") ? $avatar_url= "<img src='".$avatar_url."' class='image' style='float: left; margin-right: 5px;' alt='' />" : $avatar_url = '';
}
else $avatar_url="";


but when I tried to do this, it appeared that the current version of the modpack already has this function in it so I did not do this:

Quote
now open bridge/udb.base.inc and right before the }
?>
at the end add
function get_avatar($id)
{
global $CONFIG;
$sql = "SELECT {$this->field['avatar_url']} AS avatar_url FROM {$this->usertable} WHERE {$this->field['user_id']}='$id'";
$result = cpg_db_query($sql, $this->link_id);
$user_data = mysql_fetch_array($result);
mysql_free_result($result);

return $user_data;
}


So, is this the correct things to be doing? Since part of this was done, I'm concerned that this may not be entirely true anymore.

Stramm

-please post in the proper board (modpack) and not in a closed thread (start your own thread)
-give as much detail as possible (see http://forum.coppermine-gallery.net/index.php?topic=24032.0 )

if you use the latest modpack (1.4.10) then none of these 'mods' should be necessary, therefore see the link above and do as suggested. Enabvle debug mode and post the exact error message (but not the debug output)

Joachim Müller