|
From: Jon O. <jon...@us...> - 2006-06-30 21:11:01
|
Update of /cvsroot/mxbb/mx_smartor/album_mod In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv9308/modules/mx_smartor/album_mod Modified Files: album_common.php album_constants.php album_functions.php album_hierarchy_auth.php album_hierarchy_debug.php album_hierarchy_functions.php album_hierarchy_sql.php clown_album_functions.php Log Message: This module is really messy. I have done some general code cleanup and security scrutiny. Still, much to do... Index: album_constants.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_constants.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** album_constants.php 5 Apr 2006 23:03:48 -0000 1.8 --- album_constants.php 30 Jun 2006 21:10:55 -0000 1.9 *************** *** 9,12 **** --- 9,16 ---- */ + // +------------------------------------------------------+ + // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | + // +------------------------------------------------------+ + if ( !defined( 'IN_PORTAL' ) ) { *************** *** 98,102 **** include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_hierarchy_album.' . $phpEx ); ! } if (is_object($mx_page)) --- 102,106 ---- include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_hierarchy_album.' . $phpEx ); ! } if (is_object($mx_page)) *************** *** 110,116 **** // ------------------------------------------------------------------------- $mx_user->extend(MX_LANG_NONE); ! $mx_page->add_copyright( 'mxBB Smartor Album Module' ); } - ?> \ No newline at end of file --- 114,119 ---- // ------------------------------------------------------------------------- $mx_user->extend(MX_LANG_NONE); ! $mx_page->add_copyright( 'mxBB Smartor Album Module' ); } ?> \ No newline at end of file Index: album_hierarchy_auth.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_hierarchy_auth.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** album_hierarchy_auth.php 5 Apr 2006 23:03:48 -0000 1.3 --- album_hierarchy_auth.php 30 Jun 2006 21:10:55 -0000 1.4 *************** *** 8,17 **** * */ ! ! if ( !defined( 'IN_PHPBB' ) ) { die( 'Hacking attempt' ); } ! // Album Data Structur description // indexes : --- 8,17 ---- * */ ! ! if ( !defined( 'IN_PORTAL' ) ) { die( 'Hacking attempt' ); } ! // Album Data Structur description // indexes : *************** *** 32,36 **** function album_create_user_auth( $user_id ) { ! global $album_data; // read the user auth if requiered if ( empty ( $album_data['auth'] ) ) --- 32,36 ---- function album_create_user_auth( $user_id ) { ! global $album_data; // read the user auth if requiered if ( empty ( $album_data['auth'] ) ) *************** *** 41,45 **** { $cat = $album_data['data'][$idx]; ! $cat_id = $cat['cat_id']; // check all access rights for current user // $album_user_access = album_user_access($cat_id, $cat, 1, 1, 1, 1, 1, 1); --- 41,45 ---- { $cat = $album_data['data'][$idx]; ! $cat_id = $cat['cat_id']; // check all access rights for current user // $album_user_access = album_user_access($cat_id, $cat, 1, 1, 1, 1, 1, 1); *************** *** 80,84 **** $keys = array (); ! $last_i = -1; // add the level if ( ( $max < ALBUM_ROOT_CATEGORY + 1 ) || ( $level < $max ) || --- 80,84 ---- $keys = array (); ! $last_i = -1; // add the level if ( ( $max < ALBUM_ROOT_CATEGORY + 1 ) || ( $level < $max ) || *************** *** 86,92 **** { if ( $cur_cat_id == ALBUM_ROOT_CATEGORY || album_check_permission( $album_data['auth'][$cur_cat_id], $auth_key ) || $all ) ! { // if child of cat, align the level on the parent one ! $orig_level = $level; // store this level $last_i ++; --- 86,92 ---- { if ( $cur_cat_id == ALBUM_ROOT_CATEGORY || album_check_permission( $album_data['auth'][$cur_cat_id], $auth_key ) || $all ) ! { // if child of cat, align the level on the parent one ! $orig_level = $level; // store this level $last_i ++; *************** *** 96,105 **** $keys['real_level'][$last_i] = $orig_level; $keys['level'][$last_i] = $level; ! $keys['idx'][$last_i] = ( isset ( $album_data['keys'][$cur_cat_id] ) ? $album_data['keys'][$cur_cat_id] : ALBUM_ROOT_CATEGORY ); // get sub-levels for ( $i = 0; $i < count( $album_data['sub'][$cur_cat_id] ); $i ++ ) { $subkeys = array (); ! $subkeys = album_get_auth_keys( $album_data['sub'][$cur_cat_id][$i], $auth_key, $all, $orig_level + 1, $max ); // add sub-levels for ( $j = 0; $j < count( $subkeys['id'] ); $j ++ ) --- 96,105 ---- $keys['real_level'][$last_i] = $orig_level; $keys['level'][$last_i] = $level; ! $keys['idx'][$last_i] = ( isset ( $album_data['keys'][$cur_cat_id] ) ? $album_data['keys'][$cur_cat_id] : ALBUM_ROOT_CATEGORY ); // get sub-levels for ( $i = 0; $i < count( $album_data['sub'][$cur_cat_id] ); $i ++ ) { $subkeys = array (); ! $subkeys = album_get_auth_keys( $album_data['sub'][$cur_cat_id][$i], $auth_key, $all, $orig_level + 1, $max ); // add sub-levels for ( $j = 0; $j < count( $subkeys['id'] ); $j ++ ) *************** *** 149,153 **** $comment_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_COMMENT ); $edit_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_EDIT ); ! $delete_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_DELETE ); // ------------------------------------------------------------------------ // if we are checkinfg the personal gallery cateogry management permission --- 149,153 ---- $comment_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_COMMENT ); $edit_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_EDIT ); ! $delete_check = ( int ) checkFlag( $permission_checks, ALBUM_AUTH_DELETE ); // ------------------------------------------------------------------------ // if we are checkinfg the personal gallery cateogry management permission *************** *** 158,162 **** $view_check = 1; $upload_check = 1; ! } // ------------------------------------------------------------------------ // did we pass some category data or not ? --- 158,162 ---- $view_check = 1; $upload_check = 1; ! } // ------------------------------------------------------------------------ // did we pass some category data or not ? *************** *** 171,180 **** { mx_message_die( GENERAL_ERROR, 'Could not query Album Category information for authentication' , '' , __LINE__, __FILE__, $sql ); ! } // ------------------------------------------------------------------------ // did we find the category or not ? // ------------------------------------------------------------------------ if ( $db->sql_numrows( $result ) == 0 ) ! { // ------------------------------------------------------------------------ // is it a personal gallery ? --- 171,180 ---- { mx_message_die( GENERAL_ERROR, 'Could not query Album Category information for authentication' , '' , __LINE__, __FILE__, $sql ); ! } // ------------------------------------------------------------------------ // did we find the category or not ? // ------------------------------------------------------------------------ if ( $db->sql_numrows( $result ) == 0 ) ! { // ------------------------------------------------------------------------ // is it a personal gallery ? *************** *** 197,201 **** else { ! $thiscat = $catdata; // ------------------------------------------------------------------------ // it is the root category of a non existing personal gallery --- 197,201 ---- else { ! $thiscat = $catdata; // ------------------------------------------------------------------------ // it is the root category of a non existing personal gallery *************** *** 205,209 **** $album_permission = personal_gallery_access( 1, 1 ); //$view_check, $upload_check); } ! } // ------------------------------------------------------------------------ // if we set our $thiscat and not our permission array then we must --- 205,209 ---- $album_permission = personal_gallery_access( 1, 1 ); //$view_check, $upload_check); } ! } // ------------------------------------------------------------------------ // if we set our $thiscat and not our permission array then we must *************** *** 223,227 **** { album_debug( 'album_permissions : after album_user_access : %s(id=%d), $album_permission = %s', $thiscat['cat_title'], $thiscat['cat_id'], $album_permission ); ! } // ------------------------------------------------------------------------ // as default nobody can manage the galleries (personal galleries that is) --- 223,227 ---- { album_debug( 'album_permissions : after album_user_access : %s(id=%d), $album_permission = %s', $thiscat['cat_title'], $thiscat['cat_id'], $album_permission ); ! } // ------------------------------------------------------------------------ // as default nobody can manage the galleries (personal galleries that is) *************** *** 229,233 **** // to manage the categories in the public galleries, only in the ACP // ------------------------------------------------------------------------ ! $album_permission['manage'] = 0; // ------------------------------------------------------------------------ // $album_permission should now hold our permission stuff for either a personal --- 229,233 ---- // to manage the categories in the public galleries, only in the ACP // ------------------------------------------------------------------------ ! $album_permission['manage'] = 0; // ------------------------------------------------------------------------ // $album_permission should now hold our permission stuff for either a personal *************** *** 244,253 **** switch ( $album_config['personal_gallery'] ) { ! case ALBUM_USER: // ------------------------------------------------------------------------ // are we checking a non existing personal gallery ? // ------------------------------------------------------------------------ if ( empty( $thiscat ) || $thiscat['cat_id'] == 0 || $cat_id == ALBUM_ROOT_CATEGORY ) ! { // ------------------------------------------------------------------------ // if the admin has set the creation of personal galleries to 'registered users' --- 244,253 ---- switch ( $album_config['personal_gallery'] ) { ! case ALBUM_USER: // ------------------------------------------------------------------------ // are we checking a non existing personal gallery ? // ------------------------------------------------------------------------ if ( empty( $thiscat ) || $thiscat['cat_id'] == 0 || $cat_id == ALBUM_ROOT_CATEGORY ) ! { // ------------------------------------------------------------------------ // if the admin has set the creation of personal galleries to 'registered users' *************** *** 257,261 **** { $album_permission['upload'] = 0; ! } // ------------------------------------------------------------------------ // set the other permissions to the same value of the upload --- 257,261 ---- { $album_permission['upload'] = 0; ! } // ------------------------------------------------------------------------ // set the other permissions to the same value of the upload *************** *** 268,272 **** } break; ! case ALBUM_ADMIN: // ------------------------------------------------------------------------ // Only admins can upload images to users personal gallery --- 268,272 ---- } break; ! case ALBUM_ADMIN: // ------------------------------------------------------------------------ // Only admins can upload images to users personal gallery *************** *** 277,283 **** } break; ! default: // NOTHING; ! } // ------------------------------------------------------------------------ // we need to check the upload permission again to full fill all the --- 277,283 ---- } break; ! default: // NOTHING; ! } // ------------------------------------------------------------------------ // we need to check the upload permission again to full fill all the *************** *** 286,290 **** switch ( $thiscat['cat_upload_level'] ) { ! case ALBUM_PRIVATE: // ------------------------------------------------------------------------ // make sure the owner of the personal gallery can upload to his personal gallery --- 286,290 ---- switch ( $thiscat['cat_upload_level'] ) { ! case ALBUM_PRIVATE: // ------------------------------------------------------------------------ // make sure the owner of the personal gallery can upload to his personal gallery *************** *** 304,310 **** } break; ! default: // NOTHING; ! } // ------------------------------------------------------------------------ // Check if we can moderate the personal gallery AND also check if we can --- 304,310 ---- } break; ! default: // NOTHING; ! } // ------------------------------------------------------------------------ // Check if we can moderate the personal gallery AND also check if we can *************** *** 321,325 **** $album_permission['manage'] = 1; } ! } // ------------------------------------------------------------------------ // If $moderator_check was called and this user is a MODERATOR the user --- 321,325 ---- $album_permission['manage'] = 1; } ! } // ------------------------------------------------------------------------ // If $moderator_check was called and this user is a MODERATOR the user *************** *** 358,365 **** // ------------------------------------------------------------------------ function album_check_permission( $auth_data, $access_check, $or_check = false ) ! { // NOTE : ALBUM_AUTH_CREATE_PERSONAL and ALBUM_AUTH_UPLOAD are synomous for each other // and thus only the ALBUM_AUTH_UPLOAD is present here ! $access_type = array ( ALBUM_AUTH_VIEW => 'view', ALBUM_AUTH_UPLOAD => 'upload', --- 358,365 ---- // ------------------------------------------------------------------------ function album_check_permission( $auth_data, $access_check, $or_check = false ) ! { // NOTE : ALBUM_AUTH_CREATE_PERSONAL and ALBUM_AUTH_UPLOAD are synomous for each other // and thus only the ALBUM_AUTH_UPLOAD is present here ! $access_type = array ( ALBUM_AUTH_VIEW => 'view', ALBUM_AUTH_UPLOAD => 'upload', *************** *** 369,373 **** ALBUM_AUTH_DELETE => 'delete', ALBUM_AUTH_MODERATOR => 'moderator', ! ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES => 'manage' ); --- 369,373 ---- ALBUM_AUTH_DELETE => 'delete', ALBUM_AUTH_MODERATOR => 'moderator', ! ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES => 'manage' ); *************** *** 379,386 **** '5' => ALBUM_AUTH_DELETE, '6' => ALBUM_AUTH_MODERATOR, ! '7' => ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES ); ! $access_to_check = array (); // build up the array of checks to perform for ( $idx = 0; $idx < count( $access_index ); $idx ++ ) --- 379,386 ---- '5' => ALBUM_AUTH_DELETE, '6' => ALBUM_AUTH_MODERATOR, ! '7' => ALBUM_AUTH_MANAGE_PERSONAL_CATEGORIES ); ! $access_to_check = array (); // build up the array of checks to perform for ( $idx = 0; $idx < count( $access_index ); $idx ++ ) *************** *** 392,404 **** } ! $result = 0; // now check every check in the acess_check array for ( $idx = 0; $idx < count( $access_to_check ); $idx ++ ) ! { // $access_string should hold strings like 'view', 'upload' and so on $access_string = $access_type[$access_to_check[$idx]]; if ( $auth_data[$access_string] == 1 ) { ! $result += $access_to_check[$idx]; // simulate that all check got verified successfully if ( $or_check == true ) --- 392,404 ---- } ! $result = 0; // now check every check in the acess_check array for ( $idx = 0; $idx < count( $access_to_check ); $idx ++ ) ! { // $access_string should hold strings like 'view', 'upload' and so on $access_string = $access_type[$access_to_check[$idx]]; if ( $auth_data[$access_string] == 1 ) { ! $result += $access_to_check[$idx]; // simulate that all check got verified successfully if ( $or_check == true ) *************** *** 408,412 **** } } ! } // $result now holds to total sum of check // which should be qual to the value of --- 408,412 ---- } } ! } // $result now holds to total sum of check // which should be qual to the value of *************** *** 423,427 **** if ( $cat_id != ALBUM_ROOT_CATEGORY && ( !isset ( $album_data ) || !is_array( $album_data ) || count( $album_data ) == 0 ) ) ! { // $auth_data = //album_user_access($cat_id, 0, 1, 1, 1, 1, 1, 1); $auth_data = album_permissions( 0, $cat_id, 0, ALBUM_AUTH_ALL ); --- 423,427 ---- if ( $cat_id != ALBUM_ROOT_CATEGORY && ( !isset ( $album_data ) || !is_array( $album_data ) || count( $album_data ) == 0 ) ) ! { // $auth_data = //album_user_access($cat_id, 0, 1, 1, 1, 1, 1, 1); $auth_data = album_permissions( 0, $cat_id, 0, ALBUM_AUTH_ALL ); *************** *** 471,475 **** $auth_list .= ( $auth_data[$auth_key[$i]] == 1 ) ? $lang['Album_' . $auth_key[$i] . '_can'] : $lang['Album_' . $auth_key[$i] . '_cannot']; $auth_list .= '<br />'; ! } // ------------------------------------------------------------------------ // add Moderator Control Panel here --- 471,475 ---- $auth_list .= ( $auth_data[$auth_key[$i]] == 1 ) ? $lang['Album_' . $auth_key[$i] . '_can'] : $lang['Album_' . $auth_key[$i] . '_cannot']; $auth_list .= '<br />'; ! } // ------------------------------------------------------------------------ // add Moderator Control Panel here *************** *** 479,483 **** $auth_list .= sprintf( $lang['Album_moderate_can'], '<a href="' . append_sid( album_append_uid( this_smartor_mxurl( "smartor_mode=album_modcp&cat_id=$cat_id" ) ) ) . '">', '</a>' ); $auth_list .= '<br />'; ! } // ------------------------------------------------------------------------ // if admin has allowed user to manage his sub categories AND also have --- 479,483 ---- $auth_list .= sprintf( $lang['Album_moderate_can'], '<a href="' . append_sid( album_append_uid( this_smartor_mxurl( "smartor_mode=album_modcp&cat_id=$cat_id" ) ) ) . '">', '</a>' ); $auth_list .= '<br />'; ! } // ------------------------------------------------------------------------ // if admin has allowed user to manage his sub categories AND also have *************** *** 497,500 **** return $auth_list; } - ?> \ No newline at end of file --- 497,499 ---- Index: album_hierarchy_sql.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_hierarchy_sql.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** album_hierarchy_sql.php 5 Apr 2006 23:03:48 -0000 1.4 --- album_hierarchy_sql.php 30 Jun 2006 21:10:55 -0000 1.5 *************** *** 8,13 **** * */ ! ! if ( !defined( 'IN_PHPBB' ) ) { die( 'Hacking attempt' ); --- 8,13 ---- * */ ! [...1023 lines suppressed...] $template->assign_block_vars( 'random_pics_block', array() ); $template->assign_block_vars( 'random_pics_block.no_pics', array() ); } } - ?> \ No newline at end of file --- 1453,1463 ---- if ( empty( $cats ) ) ! { ! // // No Cats Found ! // $template->assign_block_vars( 'random_pics_block', array() ); $template->assign_block_vars( 'random_pics_block.no_pics', array() ); } } ?> \ No newline at end of file Index: album_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_functions.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** album_functions.php 5 Apr 2006 23:03:48 -0000 1.5 --- album_functions.php 30 Jun 2006 21:10:55 -0000 1.6 *************** *** 8,17 **** * */ ! // ------------------------------------ // All common functions are here! // ------------------------------------ // You cannot call this file directly from your browser ! if ( !defined( 'IN_PORTAL' ) ) { --- 8,21 ---- * */ ! ! // +------------------------------------------------------+ ! // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | ! // +------------------------------------------------------+ ! // ------------------------------------ // All common functions are here! // ------------------------------------ // You cannot call this file directly from your browser ! // if ( !defined( 'IN_PORTAL' ) ) { *************** *** 27,42 **** // ... but $passed_auth will make it worked very much faster (because this function is often // called in a loop) ! function album_user_access( $cat_id, $passed_auth = 0, $view_check, $upload_check, $rate_check, $comment_check, $edit_check, $delete_check ) { ! global $db, $album_config, $userdata; // -------------------------------- // Force to check moderator status // -------------------------------- ! $moderator_check = 1; // -------------------------------- // Here the array which this function would return. Now we initiate it! // -------------------------------- ! $album_user_access = array( 'view' => 0, 'upload' => 0, 'rate' => 0, --- 31,47 ---- // ... but $passed_auth will make it worked very much faster (because this function is often // called in a loop) ! // function album_user_access( $cat_id, $passed_auth = 0, $view_check, $upload_check, $rate_check, $comment_check, $edit_check, $delete_check ) { ! global $db, $album_config, $userdata; // -------------------------------- // Force to check moderator status // -------------------------------- ! $moderator_check = 1; // -------------------------------- // Here the array which this function would return. Now we initiate it! // -------------------------------- ! $album_user_access = array( ! 'view' => 0, 'upload' => 0, 'rate' => 0, *************** *** 44,53 **** 'edit' => 0, 'delete' => 0, ! 'moderator' => 0 ! ); ! $album_user_access_keys = array_keys( $album_user_access ); ! // END initiation $album_user_access ! // -------------------------------- // Check $cat_id --- 49,58 ---- 'edit' => 0, 'delete' => 0, ! 'moderator' => 0 ! ); ! $album_user_access_keys = array_keys( $album_user_access ); ! // END initiation $album_user_access ! // -------------------------------- // Check $cat_id *************** *** 84,96 **** } else if ($cat_id < 0) ! */ ! if ( $cat_id <= ALBUM_ROOT_CATEGORY && !is_array( $passed_auth ) ) ! // --- Album Category Hierarchy : end ! { ! mx_message_die( GENERAL_ERROR, 'Bad cat_id arguments for function album_user_access()' ); ! } ! // END check $cat_id ! // -------------------------------- // If the current user is an ADMIN (ALBUM_ADMIN == ADMIN) --- 89,102 ---- } else if ($cat_id < 0) ! */ ! ! if ( $cat_id <= ALBUM_ROOT_CATEGORY && !is_array( $passed_auth ) ) ! // --- Album Category Hierarchy : end ! { ! mx_message_die( GENERAL_ERROR, 'Bad cat_id arguments for function album_user_access()' ); ! } ! // END check $cat_id ! // -------------------------------- // If the current user is an ADMIN (ALBUM_ADMIN == ADMIN) *************** *** 101,113 **** { $album_user_access[$album_user_access_keys[$i]] = 1; // Authorised All ! } ! // Function EXIT here - return $album_user_access; ! } ! // END check ADMIN ! // -------------------------------- // if this is a GUEST, we will ignore some checking --- 107,118 ---- { $album_user_access[$album_user_access_keys[$i]] = 1; // Authorised All ! } ! // Function EXIT here return $album_user_access; ! } ! // END check ADMIN ! // -------------------------------- // if this is a GUEST, we will ignore some checking *************** *** 118,125 **** $delete_check = 0; $moderator_check = 0; ! } ! // END check GUEST ! // -------------------------------- // check if RATE or COMMENT are turned off by Album Config, so we can ignore them --- 123,130 ---- $delete_check = 0; $moderator_check = 0; ! } ! // END check GUEST ! // -------------------------------- // check if RATE or COMMENT are turned off by Album Config, so we can ignore them *************** *** 132,139 **** { $comment_check = 0; ! } ! // END Check RATE & COMMENT ! // -------------------------------- // The array that list all access type this function will look for (except MODERATOR) --- 137,144 ---- { $comment_check = 0; ! } ! // END Check RATE & COMMENT ! // -------------------------------- // The array that list all access type this function will look for (except MODERATOR) *************** *** 169,189 **** { $access_type[] = 'delete'; ! } ! // END generating array $access_type ! // -------------------------------- // If everything is empty // -------------------------------- if ( empty( $access_type ) and ( !$moderator_check ) ) ! { ! // Function EXIT here ! return $album_user_access; ! } ! // END check empty ! // -------------------------------- // Generate the SQL query based on $access_type and $moderator_check --- 174,194 ---- { $access_type[] = 'delete'; ! } ! // END generating array $access_type ! // -------------------------------- // If everything is empty // -------------------------------- if ( empty( $access_type ) and ( !$moderator_check ) ) ! { ! // // Function EXIT here ! // return $album_user_access; ! } ! // END check empty ! // -------------------------------- // Generate the SQL query based on $access_type and $moderator_check *************** *** 208,215 **** $sql .= " FROM " . ALBUM_CAT_TABLE . " ! WHERE cat_id = '$cat_id'"; ! // END SQL query generating ! // -------------------------------- // Query the $sql then Fetchrow if $passed_auth == 0 --- 213,220 ---- $sql .= " FROM " . ALBUM_CAT_TABLE . " ! WHERE cat_id = '$cat_id'"; ! // END SQL query generating ! // -------------------------------- // Query the $sql then Fetchrow if $passed_auth == 0 *************** *** 227,234 **** { $thiscat = $passed_auth; ! } ! // END Query and Fetchrow ! // -------------------------------- // Maybe the access level is not PRIVATE or the groups list is empty --- 232,239 ---- { $thiscat = $passed_auth; ! } ! // END Query and Fetchrow ! // -------------------------------- // Maybe the access level is not PRIVATE or the groups list is empty *************** *** 258,266 **** break; ! case ALBUM_MOD: // this will be checked later break; ! case ALBUM_ADMIN: // ADMIN already returned before at the checking code // at the top of this function. So this user cannot be authorised --- 263,271 ---- break; ! case ALBUM_MOD: // this will be checked later break; ! case ALBUM_ADMIN: // ADMIN already returned before at the checking code // at the top of this function. So this user cannot be authorised *************** *** 271,294 **** $album_user_access[$access_type[$i]] = 0; } ! } ! // END Check Access Level ! // -------------------------------- // We can return now if $groups_access is empty AND $moderator_check == 0 // -------------------------------- if ( ( $moderator_check == 1 ) and ( $thiscat['cat_moderator_groups'] != '' ) ) ! { // We can merge them now $groups_access[] = 'moderator'; } if ( empty( $groups_access ) ) ! { ! // Function EXIT here ! return $album_user_access; ! } // -------------------------------- // Now we have the list of usergroups have PRIVATE/MODERATOR access --- 276,302 ---- $album_user_access[$access_type[$i]] = 0; } ! } ! // END Check Access Level ! // -------------------------------- // We can return now if $groups_access is empty AND $moderator_check == 0 // -------------------------------- if ( ( $moderator_check == 1 ) and ( $thiscat['cat_moderator_groups'] != '' ) ) ! { ! // // We can merge them now + // $groups_access[] = 'moderator'; } if ( empty( $groups_access ) ) ! { ! // // Function EXIT here ! // return $album_user_access; ! } ! // -------------------------------- // Now we have the list of usergroups have PRIVATE/MODERATOR access *************** *** 313,320 **** $album_user_access[$groups_access[$i]] = 1; } ! } ! // END check PRIVATE/MODERATOR groups ! // -------------------------------- // If $moderator_check was called and this user is a MODERATOR he --- 321,328 ---- $album_user_access[$groups_access[$i]] = 1; } ! } ! // END check PRIVATE/MODERATOR groups ! // -------------------------------- // If $moderator_check was called and this user is a MODERATOR he *************** *** 330,337 **** } } ! } ! // END Moderator ! // -------------------------------- // Return result... --- 338,345 ---- } } ! } ! // END Moderator ! // -------------------------------- // Return result... *************** *** 347,355 **** function personal_gallery_access( $check_view, $check_upload ) { ! global $db, $userdata, $album_config; // This array will contain the result ! $personal_gallery_access = array( 'view' => 0, ! 'upload' => 0, ! ); // -------------------------------- // Who can create personal gallery? --- 355,364 ---- function personal_gallery_access( $check_view, $check_upload ) { ! global $db, $userdata, $album_config; // This array will contain the result ! $personal_gallery_access = array( ! 'view' => 0, ! 'upload' => 0, ! ); // -------------------------------- // Who can create personal gallery? *************** *** 396,400 **** break; } ! } // -------------------------------- // Who can view other personal gallery? --- 405,409 ---- break; } ! } // -------------------------------- // Who can view other personal gallery? *************** *** 449,462 **** function init_personal_gallery_cat( $user_id = 0 ) ! { // --- Album Category Hierarchy : begin // --- version : 1.1.0beta6 // --- added : ,$album_config ! global $userdata, $db, $lang, $album_config; // --- Album Category Hierarchy : end if ( $user_id == 0 ) { $user_id = $userdata['user_id']; ! } // --- Album Category Heirarchy : begin // --- version : 1.1.0beta6 --- 458,471 ---- function init_personal_gallery_cat( $user_id = 0 ) ! { // --- Album Category Hierarchy : begin // --- version : 1.1.0beta6 // --- added : ,$album_config ! global $userdata, $db, $lang, $album_config; // --- Album Category Hierarchy : end if ( $user_id == 0 ) { $user_id = $userdata['user_id']; ! } // --- Album Category Heirarchy : begin // --- version : 1.1.0beta6 *************** *** 470,474 **** FROM " . ALBUM_TABLE . ", " . ALBUM_CAT_TABLE . " WHERE pic_cat_id = cat_id ! AND cat_user_id = " . $user_id; // --- Album Category Heirarchy : end if ( !( $result = $db->sql_query( $sql ) ) ) --- 479,483 ---- FROM " . ALBUM_TABLE . ", " . ALBUM_CAT_TABLE . " WHERE pic_cat_id = cat_id ! AND cat_user_id = " . $user_id; // --- Album Category Heirarchy : end if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 500,512 **** } ! $thiscat = array( 'cat_id' => 0, 'cat_title' => sprintf( $lang['Personal_Gallery_Of_User'], $username ), 'cat_desc' => '', 'cat_order' => 0, ! 'count' => $count, // --- Album Category Heirarchy : begin // --- version : 1.1.0beta6 'personal' => 1, ! 'cat_user_id' => $user_id, // --- Album Category Heirarchy : end 'cat_view_level' => $album_config['personal_gallery_view'], --- 509,522 ---- } ! $thiscat = array( ! 'cat_id' => 0, 'cat_title' => sprintf( $lang['Personal_Gallery_Of_User'], $username ), 'cat_desc' => '', 'cat_order' => 0, ! 'count' => $count, // --- Album Category Heirarchy : begin // --- version : 1.1.0beta6 'personal' => 1, ! 'cat_user_id' => $user_id, // --- Album Category Heirarchy : end 'cat_view_level' => $album_config['personal_gallery_view'], *************** *** 524,529 **** 'cat_delete_groups' => $album_config['personal_gallery_private'], 'cat_moderator_groups' => '', ! 'cat_approval' => 0 ! ); return $thiscat; --- 534,539 ---- 'cat_delete_groups' => $album_config['personal_gallery_private'], 'cat_moderator_groups' => '', ! 'cat_approval' => 0 ! ); return $thiscat; *************** *** 570,576 **** return $mxurl; } - // +------------------------------------------------------+ - // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | - // +------------------------------------------------------+ - ?> \ No newline at end of file --- 580,582 ---- Index: album_common.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_common.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** album_common.php 5 Apr 2006 23:03:48 -0000 1.13 --- album_common.php 30 Jun 2006 21:10:55 -0000 1.14 *************** *** 21,26 **** include_once( $album_root_path . 'album_constants.' . $phpEx ); // Get Album Config ! $sql = "SELECT * FROM " . ALBUM_CONFIG_TABLE; --- 21,27 ---- include_once( $album_root_path . 'album_constants.' . $phpEx ); + // // Get Album Config ! // $sql = "SELECT * FROM " . ALBUM_CONFIG_TABLE; *************** *** 73,87 **** // Set ALBUM Version ! $template->assign_vars( array( 'ALBUM_VERSION' => '2' . $album_config['album_version'], ! 'ALBUM_VERSION_INFO' => 'This script (Smartor Album v. 2.0.0 :: mxBB Portal Module 2004, with Volodymyr (CLowN) Skoryks SP1 addon, IdleVoid\'s Album Category Hierarchy mod) is modified by <a href="http://www.mx-system.com">mxBB Team</a> ', ! 'PAFILEDB_SEARCH_ACTION' => append_sid( album_append_uid( this_smartor_mxurl() ) ), ! 'PAFILEDB_SEARCH_HIDDEN' => '<input type="hidden" name="smartor_mode" value="album_search"><input type="hidden" name="page" value="' . $page_id . '">', ! 'L_INDEX' => '<<', ! 'U_INDEX' => append_sid( $mx_root_path . "index." . $phpEx ), ! 'L_ALBUM' => $lang['Album'], ! 'L_TITLE' => $title, ! 'U_ALBUM' => append_sid( album_append_uid( this_smartor_mxurl() ) ) ! ) ! ); ! ?> \ No newline at end of file --- 74,87 ---- // Set ALBUM Version ! $template->assign_vars( array( ! 'ALBUM_VERSION' => '2' . $album_config['album_version'], ! 'ALBUM_VERSION_INFO' => 'This script (Smartor Album v. 2.0.0 :: mxBB Portal Module 2004, with Volodymyr (CLowN) Skoryks SP1 addon, IdleVoid\'s Album Category Hierarchy mod) is modified by <a href="http://www.mx-system.com">mxBB Team</a> ', ! 'PAFILEDB_SEARCH_ACTION' => append_sid( album_append_uid( this_smartor_mxurl() ) ), ! 'PAFILEDB_SEARCH_HIDDEN' => '<input type="hidden" name="smartor_mode" value="album_search"><input type="hidden" name="page" value="' . $page_id . '">', ! 'L_INDEX' => '<<', ! 'U_INDEX' => append_sid( $mx_root_path . "index." . $phpEx ), ! 'L_ALBUM' => $lang['Album'], ! 'L_TITLE' => $title, ! 'U_ALBUM' => append_sid( album_append_uid( this_smartor_mxurl() ) ) ! )); ?> \ No newline at end of file Index: album_hierarchy_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_hierarchy_functions.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** album_hierarchy_functions.php 5 Apr 2006 23:03:48 -0000 1.4 --- album_hierarchy_functions.php 30 Jun 2006 21:10:55 -0000 1.5 *************** *** 8,13 **** * */ ! ! if ( !defined( 'IN_PHPBB' ) ) { die( 'Hacking attempt' ); --- 8,13 ---- * */ ! [...1381 lines suppressed...] } if ( $album_config['show_index_last_comment'] == 1 && $indexes[$i] == 5 ) { ! $template->assign_vars( array( ! 'COL5' => $rowClass, ! 'LAST_COMMENT_OVER_COLOR' => $overColor, ! 'LAST_COMMENT_OUT_COLOR' => $outColor ! )); } if ( $album_config['show_index_last_pic'] == 1 && $indexes[$i] == 6 ) { ! $template->assign_vars( array( ! 'COL6' => $rowClass, ! 'LAST_PIC_OVER_COLOR' => $overColor, ! 'LAST_PIC_OUT_COLOR' => $outColor ! )); } $toggle = !$toggle; Index: clown_album_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/clown_album_functions.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** clown_album_functions.php 18 Jun 2006 10:47:56 -0000 1.6 --- clown_album_functions.php 30 Jun 2006 21:10:55 -0000 1.7 *************** *** 21,210 **** if ( $album_sp_config['rate_type'] == 0 ) // display only images { ! if ( !$rating ) ! return $lang['Not_rated']; ! else { ! $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) ! { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; ! } ! ! return ( $r ); } } ! else if ( $album_sp_config['rate_type'] == 1 ) // display just text { ! if ( !$rating ) ! return $lang['Not_rated']; ! else ! return ( round( $rating, 2 ) ); ! } ! else // display both images and text ! { ! if ( !$rating ) ! return $lang['Not_rated']; ! else ! { ! $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) ! { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; ! } ! } ! ! return ( round( $rating, 2 ) . ' ' . $r ); ! } } ! // to have smilies window popup ! function smartor_generate_smilies( $mode, $page_id ) ! { ! global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; ! global $user_ip, $session_length, $starttime; ! global $userdata; ! // MX ! global $is_block; ! $inline_columns = $board_config['smilie_columns']; ! $inline_rows = $board_config['smilie_rows']; ! $window_columns = $board_config['smilie_window_columns']; - if ( $mode == 'window' ) - { - $userdata = session_pagestart( $user_ip, $page_id ); - init_userprefs( $userdata ); ! $gen_simple_header = true; ! $page_title = "Smilies"; ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } ! $template->set_filenames( array( 'smiliesbody' => 'album_posting_smilies.tpl' ) ); ! } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ! ORDER BY smilies_id"; ! if ( $result = $db->sql_query( $sql ) ) ! { ! $num_smilies = 0; ! $rowset = array(); ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! if ( empty( $rowset[$row['smile_url']] ) ) ! { ! $rowset[$row['smile_url']]['code'] = str_replace( "'", "\\'", str_replace( '\\', '\\\\', $row['code'] ) ); ! $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; ! $num_smilies++; ! } ! } ! if ( $num_smilies ) ! { ! $smilies_count = ( $mode == 'inline' ) ? min( ( ( $inline_columns * $inline_rows ) - 1 ), $num_smilies ) : $num_smilies; ! $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1; ! $s_colspan = 0; ! $row = 0; ! $col = 0; ! while ( list( $smile_url, $data ) = @each( $rowset ) ) ! { ! if ( !$col ) ! { ! $template->assign_block_vars( 'smilies_row', array() ); ! } ! $template->assign_block_vars( 'smilies_row.smilies_col', array( 'SMILEY_CODE' => $data['code'], ! 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ! ); ! $s_colspan = max( $s_colspan, $col + 1 ); ! if ( $col == $smilies_split_row ) ! { ! if ( $mode == 'inline' && $row == $inline_rows - 1 ) ! { ! break; ! } ! $col = 0; ! $row++; ! } ! else ! { ! $col++; ! } ! } ! if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns ) ! { ! $template->assign_block_vars( 'switch_smilies_extra', array() ); ! $template->assign_vars( array( 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ! ); ! } ! $template->assign_vars( array( 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ! ); ! } ! } ! if ( $mode == 'window' ) { ! $template->pparse( 'smiliesbody' ); ! ! if ( !$is_block ) { ! include( $mx_root_path . 'includes/page_tail.' . $phpEx ); } } } ! function CanRated ( $picID, $userID ) { ! // PRE: deside if user can rate things on hot or not ! global $db, $album_sp_config, $userdata; ! if ( ! $userdata['session_logged_in'] && $album_sp_config['hon_rate_users'] == 1 ) ! { ! $alowed = true; ! } ! else if ( $userdata['session_logged_in'] && $album_sp_config['hon_rate_times'] == 0 ) ! { ! $sql = "SELECT * ! FROM " . ALBUM_RATE_TABLE . " ! WHERE rate_pic_id = $picID ! AND rate_user_id = $userID ! LIMIT 1"; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not query rating information', '', __LINE__, __FILE__, $sql ); ! } ! if ( $db->sql_numrows( $result ) > 0 ) ! { ! $alowed = false; ! } ! else ! { ! $alowed = true; ! } ! } ! else ! { ! $alowed = true; ! } ! return ( $alowed ); ! } ! ?> \ No newline at end of file --- 21,221 ---- if ( $album_sp_config['rate_type'] == 0 ) // display only images + { + if ( !$rating ) { ! return $lang['Not_rated']; ! } ! else ! { ! $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; } + return ( $r ); } ! } ! else if ( $album_sp_config['rate_type'] == 1 ) // display just text ! { ! if ( !$rating ) ! { ! return $lang['Not_rated']; ! } ! else ! { ! return ( round( $rating, 2 ) ); ! } ! } ! else // display both images and text ! { ! if ( !$rating ) ! { ! return $lang['Not_rated']; ! } ! else ! { ! $r = ""; ! for ( $temp = 1; $temp <= $rating; $temp++ ) { ! $r .= "<img src='" . $module_root_path . "album_mod/rank.gif' style='$css_style'/> "; } ! } ! return ( round( $rating, 2 ) . ' ' . $r ); ! } ! } ! // to have smilies window popup ! function smartor_generate_smilies( $mode, $page_id ) ! { ! global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $mx_root_path; ! global $user_ip, $session_length, $starttime; ! global $userdata; ! global $is_block; ! $inline_columns = $board_config['smilie_columns']; ! $inline_rows = $board_config['smilie_rows']; ! $window_columns = $board_config['smilie_window_columns']; ! if ( $mode == 'window' ) ! { ! $userdata = session_pagestart( $user_ip, $page_id ); ! init_userprefs( $userdata ); ! $gen_simple_header = true; ! $page_title = "Smilies"; ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } ! $template->set_filenames( array( 'smiliesbody' => 'album_posting_smilies.tpl' ) ); ! } ! $sql = "SELECT emoticon, code, smile_url ! FROM " . SMILIES_TABLE . " ! ORDER BY smilies_id"; ! if ( $result = $db->sql_query( $sql ) ) ! { ! $num_smilies = 0; ! $rowset = array(); ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! if ( empty( $rowset[$row['smile_url']] ) ) ! { ! $rowset[$row['smile_url']]['code'] = str_replace( "'", "\\'", str_replace( '\\', '\\\\', $row['code'] ) ); ! $rowset[$row['smile_url']]['emoticon'] = $row['emoticon']; ! $num_smilies++; ! } ! } ! if ( $num_smilies ) ! { ! $smilies_count = ( $mode == 'inline' ) ? min( ( ( $inline_columns * $inline_rows ) - 1 ), $num_smilies ) : $num_smilies; ! $smilies_split_row = ( $mode == 'inline' ) ? $inline_columns - 1 : $window_columns - 1; ! $s_colspan = 0; ! $row = 0; ! $col = 0; ! while ( list( $smile_url, $data ) = @each( $rowset ) ) ! { ! if ( !$col ) ! { ! $template->assign_block_vars( 'smilies_row', array() ); ! } ! $template->assign_block_vars( 'smilies_row.smilies_col', array( ! 'SMILEY_CODE' => $data['code'], ! 'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ! ); ! $s_colspan = max( $s_colspan, $col + 1 ); ! if ( $col == $smilies_split_row ) { ! if ( $mode == 'inline' && $row == $inline_rows - 1 ) { ! break; } + $col = 0; + $row++; + } + else + { + $col++; } } ! if ( $mode == 'inline' && $num_smilies > $inline_rows * $inline_columns ) { ! $template->assign_block_vars( 'switch_smilies_extra', array() ); ! $template->assign_vars( array( ! 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ! ); ! } ! $template->assign_vars( array( ! 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ! ); ! } ! } ! if ( $mode == 'window' ) ! { ! $template->pparse( 'smiliesbody' ); ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_tail.' . $phpEx ); ! } ! } ! } ! function CanRated ( $picID, $userID ) ! { ! // PRE: deside if user can rate things on hot or not ! global $db, $album_sp_config, $userdata; ! ! if ( ! $userdata['session_logged_in'] && $album_sp_config['hon_rate_users'] == 1 ) ! { ! $alowed = true; ! } ! else if ( $userdata['session_logged_in'] && $album_sp_config['hon_rate_times'] == 0 ) ! { ! $sql = "SELECT * ! FROM " . ALBUM_RATE_TABLE . " ! WHERE rate_pic_id = $picID ! AND rate_user_id = $userID ! LIMIT 1"; ! ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not query rating information', '', __LINE__, __FILE__, $sql ); ! } ! ! if ( $db->sql_numrows( $result ) > 0 ) ! { ! $alowed = false; ! } ! else ! { ! $alowed = true; ! } ! } ! else ! { ! $alowed = true; ! } ! ! return ( $alowed ); ! } ! ?> \ No newline at end of file Index: album_hierarchy_debug.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/album_hierarchy_debug.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** album_hierarchy_debug.php 5 Apr 2006 23:03:48 -0000 1.3 --- album_hierarchy_debug.php 30 Jun 2006 21:10:55 -0000 1.4 *************** *** 8,16 **** * */ ! ! if ( !defined( 'IN_PHPBB' ) ) { die( 'Hacking attempt' ); ! } // ----------------------------------------------- // Debug helper functions --- 8,16 ---- * */ ! ! if ( !defined( 'IN_PORTAL' ) ) { die( 'Hacking attempt' ); ! } // ----------------------------------------------- // Debug helper functions *************** *** 42,46 **** if ( $album_config['album_debug_mode'] == 1 || album_is_debug_enabled() == true ) ! { // simulate the $file and $line parameters for album_debugEx $tmparray = array( 0 => '', 1 => '' ); --- 42,46 ---- if ( $album_config['album_debug_mode'] == 1 || album_is_debug_enabled() == true ) ! { // simulate the $file and $line parameters for album_debugEx $tmparray = array( 0 => '', 1 => '' ); *************** *** 180,183 **** } } - ?> \ No newline at end of file --- 180,182 ---- |