Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post FAP SUPPORT - SQL Error: 1064 
 
The background...

I have FAP 1.4.1 downloaded from this site (icyphoenix.com) fresh install (no upgrade from anything) brand new database.  Fresh install with no mods, running on phpBB 2.0.22 also a fresh install with many mods.

I have security set up so only users put into the "members" or "Administrators" groups can view the albums, regular users should (and do) get "permission denied."  

My problem is with the member usergroup access of personal albums. When a user in the members group accesses an album not created by an administrator they get the following SQL error. Administrators do not see this error at all, they can access all images. To add to the confusion, the album created by me, is accessable to the correct user groups, but albums created by users is not. I'm really confused at this.

Code: [Download] [Hide]
  1. Couldn't get total number of pictures for album categories and sub categories  
  2.  
  3. DEBUG MODE  
  4.  
  5. SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3  
  6.  
  7. SELECT COUNT(p.pic_id) AS count FROM phpbb_album_cat AS c LEFT JOIN phpbb_album AS p ON c.cat_id = p.pic_cat_id WHERE c.cat_id IN ()  
  8.  
  9. Line : 1052  
  10. File : album_hierarchy_sql.php  


The album_hierarchy_sql.php is in its original form and I'm at a loss as how to fix it.  I have the following snip of code from the album_hierarchy_sql.php that looks like it's the code erroring out.

Code: [Download] [Hide]
  1. // ------------------------------------------------------------------------  
  2. // Returns the number of pictures for current catgory and it subs  
  3. // ------------------------------------------------------------------------  
  4. function album_get_total_pics($cats)  
  5. {  
  6.     global $db;  
  7.  
  8.     $sql_where = " WHERE c.cat_id " . ( (is_array($cats)) ? "IN (". implode(",", $cats) .")" : "= " . $cats);  
  9.  
  10.     $sql = "SELECT COUNT(p.pic_id) AS count  
  11.             FROM " . ALBUM_CAT_TABLE . " AS c  
  12.             LEFT JOIN " . ALBUM_TABLE . " AS p ON c.cat_id = p.pic_cat_id " . $sql_where;  
  13.  
  14.     if (!$result = $db->sql_query($sql))  
  15.     {  
  16.         message_die(GENERAL_ERROR, "Couldn't get total number of pictures for album categories and sub categories", "", __LINE__, __FILE__, $sql);  
  17.     }  
  18.  
  19.     if ($db->sql_numrows($result) == 0)  
  20.     {  
  21.         return 0;  
  22.     }  
  23.  
  24.     $row = $db->sql_fetchrow($result);  
  25.     $db->sql_freeresult($result);  
  26.  
  27.     return intval($row['count']);  
  28. }  
  29.  


I've tripple checked the permissions outlined in the installation and can't find error there or anywhere else in the instructions.

I have a test account setup that is added to the members user group,


Username: test2
Password:  test2

Warning: The page (once fixed) contains adult oriented content.

h**p://***.tampabaylifestylers.com/phpBB2/album.php is the URL.

I've searched these forums several times over and have not found an existing thread where this is addressed.  If found a thread where the user had updated from another version but no solution was offered for a fresh install such as mine.  The solutions offered provided in that thread provided nothing to assist my situation although the error is the same.

Additional information: Verbose Debug Output

Code: [Download] [Hide]
  1. DEBUG :  
  2. ----------------------------------------------------  
  3. album_permissions : before album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission = NULL  
  4. ----------------------------------------------------  
  5. DEBUG :  
  6. ----------------------------------------------------  
  7. album_permissions : after album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission =  
  8. array = (  
  9.         ['view'] => 0,  
  10.         ['upload'] => 0,  
  11.         ['rate'] => 0,  
  12.         ['comment'] => 1,  
  13.         ['edit'] => 0,  
  14.         ['delete'] => 0,  
  15.         ['moderator'] => 0  
  16.     )  
  17.  
  18. ----------------------------------------------------  
  19. DEBUG :  
  20. ----------------------------------------------------  
  21. $album_config['personal_gallery'] = 0  
  22. ----------------------------------------------------  
  23. DEBUG :  
  24. ----------------------------------------------------  
  25. final : $album_permission =  
  26. array = (  
  27.         ['view'] => 0,  
  28.         ['upload'] => 0,  
  29.         ['rate'] => 0,  
  30.         ['comment'] => 1,  
  31.         ['edit'] => 0,  
  32.         ['delete'] => 0,  
  33.         ['moderator'] => 0,  
  34.         ['manage'] => 0  
  35.     )  
  36.  
  37. ----------------------------------------------------  
  38. DEBUG :  
  39. ----------------------------------------------------  
  40. album_read_tree : user id = 11, $album_data['auth'] =  
  41. array = (  
  42.         [6] => array = (  
  43.             ['view'] => 0,  
  44.             ['upload'] => 0,  
  45.             ['rate'] => 0,  
  46.             ['comment'] => 1,  
  47.             ['edit'] => 0,  
  48.             ['delete'] => 0,  
  49.             ['moderator'] => 0,  
  50.             ['manage'] => 0  
  51.         )  
  52.     )  
  53.  
  54. ----------------------------------------------------  
  55. DEBUG :  
  56. ----------------------------------------------------  
  57. album_read_tree : $cats =  
  58. array = ()  
  59.  
  60. ----------------------------------------------------  
  61. DEBUG :  
  62. ----------------------------------------------------  
  63. album_permissions : before album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission =  
  64. array = (  
  65.         ['view'] => 1,  
  66.         ['upload'] => 1  
  67.     )  
  68.  
  69. ----------------------------------------------------  
  70. DEBUG :  
  71. ----------------------------------------------------  
  72. album_permissions : after album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission =  
  73. array = (  
  74.         ['view'] => 1,  
  75.         ['upload'] => 1  
  76.     )  
  77.  
  78. ----------------------------------------------------  
  79. DEBUG :  
  80. ----------------------------------------------------  
  81. $album_config['personal_gallery'] = 0  
  82. ----------------------------------------------------  
  83. DEBUG :  
  84. ----------------------------------------------------  
  85. final : $album_permission =  
  86. array = (  
  87.         ['view'] => 1,  
  88.         ['upload'] => 1,  
  89.         ['manage'] => 0  
  90.     )  
  91.  
  92. ----------------------------------------------------  
  93.  


Code: [Download] [Hide]
  1. DEBUG :  
  2. ----------------------------------------------------  
  3. album_permissions : before album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission = NULL  
  4. ----------------------------------------------------  
  5. DEBUG :  
  6. ----------------------------------------------------  
  7. album_permissions : after album_user_access : 'Personal Gallery Of lgsbcs'(id=0), $album_permission =  
  8. array = (  
  9.         ['view'] => 0,  
  10.         ['upload'] => 0,  
  11.         ['rate'] => 0,  
  12.         ['comment'] => 1,  
  13.         ['edit'] => 0,  
  14.         ['delete'] => 0,  
  15.         ['moderator'] => 0  
  16.     )  
  17.  
  18. ----------------------------------------------------  
  19. DEBUG :  
  20. ----------------------------------------------------  
  21. $album_config['personal_gallery'] = 0  
  22. ----------------------------------------------------  
  23. DEBUG :  
  24. ----------------------------------------------------  
  25. final : $album_permission =  
  26. array = (  
  27.         ['view'] => 0,  
  28.         ['upload'] => 0,  
  29.         ['rate'] => 0,  
  30.         ['comment'] => 1,  
  31.         ['edit'] => 0,  
  32.         ['delete'] => 0,  
  33.         ['moderator'] => 0,  
  34.         ['manage'] => 0  
  35.     )  
  36.  
  37. ----------------------------------------------------  
  38. DEBUG :  
  39. ----------------------------------------------------  
  40. album_get_auth_keys =  
  41. array = ()  
  42.  
  43. ----------------------------------------------------  
  44. DEBUG :  
  45. ----------------------------------------------------  
  46. album_get_auth_keys =  
  47. array = ()  
  48.  
  49. ----------------------------------------------------  
  50. DEBUG :  
  51. ----------------------------------------------------  
  52. album_get_auth_keys =  
  53. array = ()  
  54.  
  55. ----------------------------------------------------  
  56. DEBUG :  
  57. ----------------------------------------------------  
  58. album_no_newest_pictures sql = 'SELECT c.cat_id, p.pic_id, COUNT(p.pic_id) AS pic_total FROM phpbb_album AS p, phpbb_album_cat AS c WHERE c.cat_id IN (6) AND p.pic_cat_id = c.cat_id AND p.pic_time >= 1199760236 GROUP BY c.cat_id'  
  59. ----------------------------------------------------  
  60. DEBUG :  
  61. ----------------------------------------------------  
  62. $pictotalrows =  
  63. array = (  
  64.         [6] => '8'  
  65.     )  
  66.  
  67. ----------------------------------------------------  
  68.  


Code: [Download] [Hide]
  1.  
  2. Could not get category comment count information  
  3.  
  4. DEBUG MODE  
  5.  
  6. SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3  
  7.  
  8. SELECT COUNT(comment_id) AS comment_count FROM phpbb_album_comment LEFT JOIN phpbb_album ON comment_pic_id = pic_id WHERE pic_cat_id IN ()  
  9.  
  10. Line : 1029  
  11. File : album_hierarchy_sql.php  
  12.  


Any help would be greatly appreciated.

--J
 



 
Edited by TheSteffen, Thu 07 Feb, 2008 20:10: changed [quote] to [code]
draynoSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: SQL Error: 1064 
 
Yes, I see the same problem and it seems to lie with the personal album permission block that assigns access levels/moderator for the group.

Testing showed that if I checked the Is Moderator box there was no error.
If the Is Moderator block was not check but the View box was then there was also no error.

This is definitely a bug and should be fixed, but using my suggestion above will hopefully solve your problem
 



 
ArtieSend private message  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events