Update of /cvsroot/mxbb/mx_smartor/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9232/includes Modified Files: album_cat.php album_cat_sort.php album_comment.php album_comment_delete.php album_comment_edit.php album_delete.php album_edit.php album_hotornot.php album_memberlist.php album_modcp.php album_page.php album_personal.php album_personal_cat_admin.php album_personal_index.php album_pic.php album_picm.php album_rate.php album_search.php album_showpage.php album_thumbnail.php album_upload.php Added Files: album_allpics.php album_download.php album_jupload.php album_nuffload.php album_nuffload_pbar.php album_otf.php album_otf_thumbnail.php album_pclzip_lib.php album_pic_nuffed.php album_rdf.php album_rss.php Log Message: Index: album_personal.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/includes/album_personal.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** album_personal.php 30 Jun 2006 21:10:56 -0000 1.6 --- album_personal.php 7 Jun 2007 20:13:29 -0000 1.7 *************** *** 4,362 **** * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! // +-------------------------------------------------------------+ ! // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | ! // | with Volodymyr (CLowN) Skoryk's Service Pack 1 © 2003-2004 | ! // +-------------------------------------------------------------+ ! if ( !defined( 'IN_PORTAL' ) ) { ! die( 'Hacking attempt' ); } ! // ------------------------------------------------------------------------ ! // This file is only included in the album.php and album_cat.php, it should ! // be stored in the album_mod folder ! // ------------------------------------------------------------------------ ! // ------------------------------------------------------------------------ ! // $album_user_id, $cat_id and $moderators_list are as default set ! // in album.php and in album_cat.php files in the main folder. ! // ------------------------------------------------------------------------ ! // ------------------------------------------------------------------------ ! // Get the name of this user ! // ------------------------------------------------------------------------ ! $username = album_get_user_name( $album_user_id ); ! if ( empty( $username ) ) { ! mx_message_die( GENERAL_MESSAGE, $lang['No_user_id_specified'] ); } ! $moderators_list = empty( $moderators_list ) ? $username : ',' . $username; ! // check if personal gallery root category exists ! if ( ALBUM_ROOT_CATEGORY == ( $check_cat_id = album_get_personal_root_id( $album_user_id ) ) ) { ! // if it doesn't then create the 'fake' category so we can authenticate it ! $thiscat = init_personal_gallery_cat( $album_user_id ); ! $cat_id = $check_cat_id; } ! else { ! if ( empty( $cat_id ) || $cat_id == 0 ) ! { ! $cat_id = $check_cat_id; ! } ! $thiscat = $album_data['data'][ $album_data['keys'][$cat_id] ]; } - // ------------------------------------------------------------------------ - // Check view permissions - // ------------------------------------------------------------------------ - $auth_data = album_permissions( $album_user_id, $cat_id, ALBUM_AUTH_ALL, $thiscat ); ! if ( !album_check_permission( $auth_data, ALBUM_AUTH_VIEW ) ) { ! if ( !$userdata['session_logged_in'] ) { ! redirect( append_sid( "login.$phpEx?redirect=album.$phpEx&user_id=$album_user_id" ) ); } else { ! mx_message_die( GENERAL_MESSAGE, $lang['Not_Authorised'] ); } } ! // END check permissions ! // ------------------------------------------------------------------------ ! // Check personal gallery creation/upload permission ! // ------------------------------------------------------------------------ ! if ( !album_check_permission( $auth_data, ALBUM_AUTH_UPLOAD ) && count( $album_data['data'] ) <= 1 ) { ! if ( $album_user_id == $userdata['user_id'] ) { ! mx_message_die( GENERAL_MESSAGE, $lang['Not_allowed_to_create_personal_gallery'] ); } } // End check own gallery ! // ------------------------------------------------------------------------ ! // Check we are the root of the personal gallery and if it have ! // children or parents ! // ------------------------------------------------------------------------ ! // if $cat_id is equal to the non existing root category id, then it wasn't supplied to the call of the page ! // try to get the personal gallery root category instead (if it doesn't exists it returns ALBUM_ROOT_CATEGORY ! if ( $cat_id == ALBUM_ROOT_CATEGORY ) { ! $cat_id = album_get_personal_root_id( $album_user_id ); } ! ! $is_root_cat = ( ( $cat_id == album_get_personal_root_id( $album_user_id ) || $cat_id == ALBUM_ROOT_CATEGORY ) ? true : false ); ! $has_sub_cats = album_has_sub_cats( $cat_id ); ! $has_parent_cats = album_has_parent_cats( $cat_id ); ! // ------------------------------------------------------------------------ ! // Setup the correct link page ! // ------------------------------------------------------------------------ ! if ( $is_root_cat ) { ! $album_page_url = 'smartor_mode=album_cat'; } else { ! $album_page_url = 'smartor_mode=album_cat'; } ! if ( !$is_block ) { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); } ! ! $template->set_filenames( array( 'body' => 'album_cat_body.tpl' ) ); ! ! $auth_list = album_build_auth_list( $album_user_id, $cat_id, $auth_data ); ! // ------------------------------------------------------------------------ ! // Setup the correct variables and string acording to if we are showing all ! // the pictures or a category, this is infact the 'main' difference betwwen ! // these tho 'view modes'.. the rest is done in 'album_build_picture_table' ! // ------------------------------------------------------------------------ ! if ( $album_view_mode != ALBUM_VIEW_ALL ) { ! $album_nav_cat_desc = album_make_nav_tree( $cat_id, this_smartor_mxurl(), 'nav', $album_user_id ); ! if ( !empty( $album_nav_cat_desc ) ) { ! $album_nav_cat_desc = ALBUM_NAV_ARROW . $album_nav_cat_desc; } - - $cat_ids = $cat_id; - - $image_toggle_button = $images['all_pic_view_mode']; - $view_mode_url = append_sid( album_append_uid( this_smartor_mxurl( "$album_page_url&cat_id=" . intval( $cat_id ) . "&mode=" . ALBUM_VIEW_ALL ) ) ); - // $view_mode_url = append_sid(album_append_uid(this_smartor_mxurl("$album_page_url?cat_id=$cat_id&viewmode=" . ALBUM_VIEW_ALL))); - $view_mode_text = $lang['Show_all_pic_view_mode']; } else { ! $album_nav_cat_desc = album_make_nav_tree( album_get_personal_root_id( $album_user_id ), this_smartor_mxurl( $album_page_url ), 'nav', $album_user_id ); ! if ( !empty( $album_nav_cat_desc ) ) { ! $album_nav_cat_desc = ALBUM_NAV_ARROW . $album_nav_cat_desc; } ! ! if ( album_get_personal_root_id( $album_user_id ) != $cat_id ) { ! $allowed_cat = $cat_id; ! $tmp_array = array(); ! album_get_sub_cat_ids( album_get_personal_root_id( $album_user_id ), $tmp_array, ALBUM_AUTH_VIEW, true ); ! ! reset( $tmp_array ); ! while ( list( $key, $id ) = each( $tmp_array ) ) ! { ! if ( $id != $cat_id ) ! { ! $allowed_cat .= ',' . $id; ! } ! } } ! $cat_ids = $allowed_cat; - $image_toggle_button = $images['normal_pic_view_mode']; - $view_mode_url = append_sid( album_append_uid( this_smartor_mxurl( "$album_page_url&cat_id=" . intval( $cat_id ) ) ) ); - $view_mode_text = $lang['Show_selected_pic_view_mode']; - } - // ------------------------------------------------------------------------ - // Count Pics of the root category of personal gallery, - // - $cat_ids is set in the above IF statement - // ------------------------------------------------------------------------ - $sql = 'SELECT COUNT(p.pic_id) AS count - FROM ' . ALBUM_TABLE . ' AS p, ' . ALBUM_CAT_TABLE . ' AS c - WHERE c.cat_user_id = ' . $album_user_id . ' - AND c.cat_id IN (' . $cat_ids . ') - AND p.pic_cat_id = c.cat_id'; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not count pics !!', '', __LINE__, __FILE__, $sql ); } ! $row = $db->sql_fetchrow( $result ); ! $db->sql_freeresult( $result ); $total_pics = $row['count']; - // ------------------------------------------------------------------------ - // Build up the page - // ------------------------------------------------------------------------ - // I will try to explain how this SHOULD work. Only some testing and studying - // of the code will tell if really does do what it should. ! // NOTE : this might be change alittle AFTER this has been written so don't ! // take it for granted that it does work this way a 100% ! // But feel free to tell me if this(the description) need updating or ! // if the code needs fixing. ! // $cat_id : is the currently selected category ! // $allowed_cat: is a list of all the allowed categories that the current user ! // is allowed to view ! // £cat_ids : is synomous with $allowed_cat OR $cat_id, depending on the view mode ! // 0: Begin of 'work flow' ! // 1: Check if there are any pictures for the selected catery OR for the selected ! // categories (when in 'simple view' mode - see $allowed_cat above) ! // - No: No pictures found, go to step 2 ! // - Yes: One or more pictures found, go to step 5 ! // 2: Do another check to see if the use got any pictures in all of her ! // personal gallery categories, that the current user is allowed to view ! // - No: No pictures found, goto step 3 ! // - Yes: One or more pictures found, goto step 4 - // 3: The personal gallery does not have _ANY_pictures at all OR does not have _ANY_ - // at all the current user can view. Goto step 8 ! // 4: Only display the recent pictures of all the categories in this personal gallery ! // Goto step 10 ! // 5: Check if we are in simple view mode ! // - No: goto step 6 ! // - Yes: goto step 7 ! // 6: We are not in simple view mode, so display the pictures in the category and ! // if enabled; the recent pictures of the this category and it's sub categories. ! // Goto step 10 ! // 7: We are in simple mode, so only display the ALL the pictures of the personal gallery ! // which can be view by the currently logged in user. ! // Goto step 10 ! // 8: Check if personal gallery got sub categories (which can be viewed by current user) ! // - Yes: Display no picture message, since ther really are't any pictures to display ! // - No: Display message to logged in user that the gallery doesn't exists. ! // Goto step 10 ! // 9: Display message to logged in user that the gallery doesn't exists. ! // Goto step 10 ! // 10: End of 'work flow' ! // ------------------------------------------------------------------------ ! if ( $row['count'] == 0 ) ! { ! if ( !strstr( $album_nav_cat_desc, sprintf( $lang['Personal_Gallery_Of_User'], $username ) ) ) ! { ! // $album_nav_cat_desc .= ALBUM_NAV_ARROW . '<a href="'. append_sid(album_append_uid("album.$phpEx?cat_id$cat_id")) .'" class="nav">'.sprintf($lang['Personal_Gallery_Of_User'], $username)."</a>"; ! $album_nav_cat_desc .= ALBUM_NAV_ARROW . '<a href="' . this_smartor_mxurl( "user_id=$album_user_id" ) . '" class="nav">' . sprintf( $lang['Personal_Gallery_Of_User'], $username ) . "</a>"; ! } ! // ------------------------------------------------------------------------ ! // check if there is _any_ pictures at all in the personal gallery of this user. ! // but ONLY if we aren't in simple view mode (then we have already indirectly done the check) ! // ------------------------------------------------------------------------ ! if ( $album_view_mode != ALBUM_VIEW_ALL && !empty( $allowed_cat ) ) ! { ! $sql = 'SELECT COUNT(p.pic_id) AS count ! FROM ' . ALBUM_TABLE . ' AS p, ' . ALBUM_CAT_TABLE . ' AS c ! WHERE c.cat_user_id = ' . $album_user_id . ' ! AND c.cat_id IN (' . $allowed_cat . ') ! AND p.pic_cat_id = c.cat_id'; ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Could not count pics !!', '', __LINE__, __FILE__, $sql ); ! } ! $row = $db->sql_fetchrow( $result ); ! $db->sql_freeresult( $result ); ! $total_pics = $row['count']; ! } ! if ( $album_config['personal_show_recent_instead_of_nopics'] == 1 && $row['count'] > 0 ) ! { ! album_build_recent_pics( $allowed_cat ); ! } ! else ! { ! $template->assign_block_vars( 'index_pics_block', array() ); ! $template->assign_block_vars( 'index_pics_block.no_pics', array() ); } ! if ( $is_root_cat && ( !$has_sub_cats ) ) ! { ! $no_picture_message = sprintf( $lang['Personal_gallery_not_created'], $username ); ! } ! else ! { ! $no_picture_message = $lang['No_Pics']; ! } } else { ! album_build_picture_table( $album_user_id, $cat_ids, $thiscat, $auth_data, $start, $sort_method, $sort_order, $total_pics ); ! ! if ( $album_config['personal_show_recent_in_subcats'] == 1 && $album_view_mode != ALBUM_VIEW_ALL ) ! { ! album_build_recent_pics( $allowed_cat ); ! } } ! // ------------------------------------------------------------------------ ! // Check if we should show the upload picture image/icon ! // ------------------------------------------------------------------------ ! if ( album_check_permission( $auth_data, ALBUM_AUTH_UPLOAD ) == true ) { ! $template->assign_block_vars( 'enable_picture_upload', array() ); } ! // ------------------------------------------------------------------------ ! // Check if we should show the view toggle button ! // ------------------------------------------------------------------------ ! if ( $album_config['show_all_in_personal_gallery'] == 1 ) { ! $template->assign_block_vars( 'enable_view_toggle', array() ); } - $template->assign_block_vars( 'personal_gallery_header', array() ); - // ------------------------------------------------------------------------ - // Do our template info... - // ------------------------------------------------------------------------ - $template->assign_vars( array( - 'L_ALBUM' => $lang['Album'], ! 'U_VIEW_CAT' => append_sid( album_append_uid( this_smartor_mxurl() ) ), ! // 'U_VIEW_CAT' => append_sid(album_append_uid(this_smartor_mxurl("$album_page_url?cat_id=$cat_id"))), ! 'CAT_TITLE' => ( $is_root_cat || $album_view_mode == ALBUM_VIEW_ALL ) ? sprintf( $lang['Personal_Gallery_Of_User'], $username ) : $thiscat['cat_title'], ! 'ALBUM_NAVIGATION_ARROW' => ALBUM_NAV_ARROW, ! 'NAV_CAT_DESC' => $album_nav_cat_desc, - 'L_PERSONAL_GALLERY_EXPLAIN' => $lang['Personal_Gallery_Explain'], ! 'L_MODERATORS' => $lang['Moderators'], ! 'MODERATORS' => $moderators_list, ! 'U_UPLOAD_PIC' => append_sid( album_append_uid( this_smartor_mxurl( "smartor_mode=album_upload&cat_id=" . intval( $cat_id ) ) ) ), ! // 'U_UPLOAD_PIC' => append_sid(album_append_uid(this_smartor_mxurl("smartor_mode=album_upload&cat_id=$cat_id"))), ! 'UPLOAD_PIC_IMG' => $images['upload_pic'], 'L_UPLOAD_PIC' => $lang['Upload_Pic'], ! 'U_TOGGLE_VIEW_ALL' => $view_mode_url, ! 'TOGGLE_VIEW_ALL_IMG' => $image_toggle_button, ! 'L_TOGGLE_VIEW_ALL' => $view_mode_text, - 'L_CATEGORY' => sprintf( $lang['Personal_Gallery_Of_User'], $username ), - 'L_NO_PICS' => $no_picture_message, - 'L_RECENT_PUBLIC_PICS' => sprintf( $lang['Recent_Personal_Pics'], $username ), 'S_COLS' => $album_config['cols_per_page'], ! 'S_COL_WIDTH' => ( 100 / $album_config['cols_per_page'] ) . '%', 'L_VIEW' => $lang['View'], - 'L_PIC_CAT' => $lang['Pic_Cat'], - 'L_POSTER' => $lang['Poster'], 'L_POSTED' => $lang['Posted'], ! 'ALBUM_JUMPBOX' => $album_jumpbox, ! // 'S_ALBUM_ACTION' => append_sid(album_append_uid(this_smartor_mxurl("$album_page_url?cat_id=" . intval($cat_id)))), ! 'S_ALBUM_ACTION' => append_sid( album_append_uid( this_smartor_mxurl( "$album_page_url?cat_id=$cat_id" ) ) ), ! 'TARGET_BLANK' => ( $album_config['fullpic_popup'] ) ? 'target="_blank"' : '', 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], --- 4,408 ---- * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2003 [sma...@ho..., Smartor] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ + + /*************************************************************************** + * MODIFICATIONS + * --------------- + * started : Saturday, September 06 12:09 pm + * copyright : © 2003 Volodymyr (CLowN) Skoryk + * email : bla...@ya... + * + * MODIFICATIONS: + * -fixed link to go to album_showpage.php + * + * + ***************************************************************************/ ! // MX ! if ( !defined('IN_PORTAL') ) ! { ! die("Hacking attempt"); ! } ! // ------------------------------------ ! // Check the request ! // ------------------------------------ ! if( isset($HTTP_POST_VARS['user_id']) ) { ! $user_id = intval($HTTP_POST_VARS['user_id']); } ! else if( isset($HTTP_GET_VARS['user_id']) ) { ! $user_id = intval($HTTP_GET_VARS['user_id']); } + else + { + $user_id = $userdata['user_id']; + } + // + // END check request + // ! ! // ------------------------------------ ! // Check $user_id ! // ------------------------------------ ! ! if( ($user_id < 1) and (!$userdata['session_logged_in']) ) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); ! redirect(append_sid($phpbb_root_path ."login.$phpEx?redirect=album.php?smartor_mode=album_personal")); } ! ! ! // ------------------------------------ ! // Get the username of this gallery's owner ! // ------------------------------------ ! ! $sql = "SELECT username ! FROM ". USERS_TABLE ." ! WHERE user_id = $user_id"; ! ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not get the username of this category owner', '', __LINE__, __FILE__, $sql); } ! $row = $db->sql_fetchrow($result); ! ! $username = $row['username']; ! ! if( empty($username) ) { ! mx_message_die(GENERAL_ERROR, 'Sorry, this user does not exist'); ! } ! ! ! // ------------------------------------ ! // Check Permissions ! // ------------------------------------ ! $personal_gallery_access = personal_gallery_access(1,1); ! ! if( $personal_gallery_access['view'] == 0 ) ! { ! if (!$userdata['session_logged_in']) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); ! redirect(append_sid($phpbb_root_path ."login.$phpEx?redirect=album.php?smartor_mode=album_personal&user_id=$user_id")); } else { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } ! // // END check permissions + // ! ! // ------------------------------------ ! // Check own gallery ! // ------------------------------------ ! ! if ($user_id == $userdata['user_id']) { ! if( $personal_gallery_access['upload'] == 0 ) { ! mx_message_die(GENERAL_MESSAGE, $lang['Not_allowed_to_create_personal_gallery']); } } + // // End check own gallery + // ! ! // ------------------------------------ ! // Build the thumbnail page ! // ------------------------------------ ! ! if( isset($HTTP_GET_VARS['start']) ) { ! $start = intval($HTTP_GET_VARS['start']); } ! else if( isset($HTTP_POST_VARS['start']) ) { ! $start = intval($HTTP_POST_VARS['start']); } else { ! $start = 0; } ! if( isset($HTTP_GET_VARS['sort_method']) ) { ! switch ($HTTP_GET_VARS['sort_method']) ! { ! case 'pic_title': ! $sort_method = 'pic_title'; ! break; ! case 'pic_view_count': ! $sort_method = 'pic_view_count'; ! break; ! case 'rating': ! $sort_method = 'rating'; ! break; ! case 'comments': ! $sort_method = 'comments'; ! break; ! case 'new_comment': ! $sort_method = 'new_comment'; ! break; ! default: ! $sort_method = $album_config['sort_method']; ! } } ! else if( isset($HTTP_POST_VARS['sort_method']) ) { ! switch ($HTTP_POST_VARS['sort_method']) { ! case 'pic_title': ! $sort_method = 'pic_title'; ! break; ! case 'pic_view_count': ! $sort_method = 'pic_view_count'; ! break; ! case 'rating': ! $sort_method = 'rating'; ! break; ! case 'comments': ! $sort_method = 'comments'; ! break; ! case 'new_comment': ! $sort_method = 'new_comment'; ! break; ! default: ! $sort_method = $album_config['sort_method']; } } else { ! $sort_method = $album_config['sort_method']; ! } ! ! if( isset($HTTP_GET_VARS['sort_order']) ) ! { ! switch ($HTTP_GET_VARS['sort_order']) { ! case 'ASC': ! $sort_order = 'ASC'; ! break; ! case 'DESC': ! $sort_order = 'DESC'; ! break; ! default: ! $sort_order = $album_config['sort_order']; } ! } ! else if( isset($HTTP_POST_VARS['sort_order']) ) ! { ! switch ($HTTP_POST_VARS['sort_order']) { ! case 'ASC': ! $sort_order = 'ASC'; ! break; ! case 'DESC': ! $sort_order = 'DESC'; ! break; ! default: ! $sort_order = $album_config['sort_order']; } + } + else + { + $sort_order = $album_config['sort_order']; + } ! $pics_per_page = $album_config['rows_per_page'] * $album_config['cols_per_page']; ! // ------------------------------------ ! // Count Pics ! // ------------------------------------ ! ! $sql = "SELECT COUNT(pic_id) AS count ! FROM ". ALBUM_TABLE ." ! WHERE pic_cat_id = ". PERSONAL_GALLERY ." ! AND pic_user_id = $user_id"; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not count pics', '', __LINE__, __FILE__, $sql); } ! $row = $db->sql_fetchrow($result); $total_pics = $row['count']; ! // ------------------------------------ ! // Build up ! // ------------------------------------ ! if ($total_pics > 0) ! { ! $limit_sql = ($start == 0) ? $pics_per_page : $start .','. $pics_per_page; ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_time, p.pic_view_count, p.pic_lock, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, MAX(c.comment_id) as new_comment ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id ! WHERE p.pic_cat_id = ". PERSONAL_GALLERY ." ! AND p.pic_user_id = $user_id ! GROUP BY p.pic_id ! ORDER BY $sort_method $sort_order ! LIMIT $limit_sql"; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query pics information', '', __LINE__, __FILE__, $sql); ! } ! $picrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $picrow[] = $row; ! } ! // -------------------------------- ! // Thumbnails table ! // -------------------------------- ! for ($i = 0; $i < count($picrow); $i += $album_config['cols_per_page']) ! { ! $template->assign_block_vars('picrow', array()); ! for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++) ! { ! if( $j >= count($picrow) ) ! { ! break; ! } ! $template->assign_block_vars('picrow.piccol', array( ! 'U_PIC' => ($album_config['fullpic_popup']) ? append_sid(this_smartor_mxurl("smartor_mode=album_pic&pic_id=". $picrow[$j]['pic_id'])) : append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=". $picrow[$j]['pic_id'])), ! 'THUMBNAIL' => append_sid(this_smartor_mxurl("smartor_mode=album_thumbnail&pic_id=". $picrow[$j]['pic_id'], TRUE)), ! 'DESC' => $picrow[$j]['pic_desc'] ! ) ! ); ! ! $image_rating = ImageRating($picrow[$j]['rating']); ! ! $template->assign_block_vars('picrow.pic_detail', array( ! 'TITLE' => $picrow[$j]['pic_title'], ! 'TIME' => create_date($board_config['default_dateformat'], $picrow[$j]['pic_time'], $board_config['board_timezone']), ! 'VIEW' => $picrow[$j]['pic_view_count'], ! 'RATING' => ($album_config['rate'] == 1) ? ( $lang['Rating'] . ': ' . $image_rating . '<br />') : '', ! 'COMMENTS' => ($album_config['comment'] == 1) ? ( $lang['Comments'] . ': ' . $picrow[$j]['comments'] . '<br />') : '', ! 'EDIT' => ( ($userdata['user_level'] == ADMIN) or ($userdata['user_id'] == $picrow[$j]['pic_user_id']) ) ? '<a href="'. append_sid(this_smartor_mxurl("smartor_mode=album_edit&pic_id=". $picrow[$j]['pic_id'])) . '">' . $lang['Edit_pic'] . '</a>' : '', ! 'DELETE' => ( ($userdata['user_level'] == ADMIN) or ($userdata['user_id'] == $picrow[$j]['pic_user_id']) ) ? '<a href="'. append_sid(this_smartor_mxurl("smartor_mode=album_delete&pic_id=". $picrow[$j]['pic_id'])) . '">' . $lang['Delete_pic'] . '</a>' : '', ! 'LOCK' => ($userdata['user_level'] == ADMIN) ? '<a href="'. append_sid(this_smartor_mxurl("smartor_mode=album_modcp&mode=". (($picrow[$j]['pic_lock'] == 0) ? 'lock' : 'unlock') ."&pic_id=". $picrow[$j]['pic_id'])) .'">'. (($picrow[$j]['pic_lock'] == 0) ? $lang['Lock'] : $lang['Unlock']) .'</a>' : '', ! 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($picrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($picrow[$j]['pic_user_ip']) .'</a><br />' : '' ! ) ! ); ! } } ! ! // -------------------------------- ! // Pagination ! // -------------------------------- ! ! $template->assign_vars(array( ! 'PAGINATION' => generate_pagination(append_sid(this_smartor_mxurl("smartor_mode=album_personal&user_id=$user_id&sort_method=$sort_method&sort_order=$sort_order")), $total_pics, $pics_per_page, $start), ! 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $pics_per_page ) + 1 ), ceil( $total_pics / $pics_per_page )) ! ) ! ); } else { ! $template->assign_block_vars('no_pics', array()); } ! ! ! /* ! +---------------------------------------------------------- ! | Main page... ! +---------------------------------------------------------- ! */ ! ! // ------------------------------------ ! // additional sorting options ! // ------------------------------------ ! ! $sort_rating_option = ''; ! $sort_comments_option = ''; ! if( $album_config['rate'] == 1 ) { ! $sort_rating_option = '<option value="rating" '; ! $sort_rating_option .= ($sort_method == 'rating') ? 'selected="selected"' : ''; ! $sort_rating_option .= '>' . $lang['Rating'] .'</option>'; } ! if( $album_config['comment'] == 1 ) { ! $sort_comments_option = '<option value="comments" '; ! $sort_comments_option .= ($sort_method == 'comments') ? 'selected="selected"' : ''; ! $sort_comments_option .= '>' . $lang['Comments'] .'</option>'; ! ! $sort_new_comment_option = '<option value="new_comment" '; ! $sort_new_comment_option .= ($sort_method == 'new_comment') ? 'selected="selected"' : ''; ! $sort_new_comment_option .= '>' . $lang['New_Comment'] .'</option>'; } ! // ! // Start output of page ! // ! $page_title = $lang['Album']; ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_header.'.$phpEx); ! } ! $template->set_filenames(array( ! 'body' => 'album_personal_body.tpl') ! ); ! if( $user_id == $userdata['user_id'] ) ! { ! $template->assign_block_vars('your_personal_gallery', array()); ! } ! ! $template->assign_vars(array( ! 'U_UPLOAD_PIC' => append_sid(this_smartor_mxurl("smartor_mode=album_upload&cat_id=". PERSONAL_GALLERY)), ! 'UPLOAD_PIC_IMG' => $mx_images['upload_pic'], 'L_UPLOAD_PIC' => $lang['Upload_Pic'], ! 'L_PERSONAL_GALLERY_NOT_CREATED' => sprintf($lang['Personal_gallery_not_created'], $username), ! ! 'TARGET_BLANK' => ($album_config['fullpic_popup']) ? 'target="_blank"' : '', 'S_COLS' => $album_config['cols_per_page'], ! 'S_COL_WIDTH' => (100/$album_config['cols_per_page']) . '%', 'L_VIEW' => $lang['View'], 'L_POSTED' => $lang['Posted'], ! 'U_PERSONAL_GALLERY' => append_sid(this_smartor_mxurl("smartor_mode=album_personal&user_id=$user_id")), ! 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], ! 'L_PERSONAL_GALLERY_EXPLAIN' => $lang['Personal_Gallery_Explain'], ! 'L_PERSONAL_GALLERY_OF_USER' => sprintf($lang['Personal_Gallery_Of_User'], $username), 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], *************** *** 367,386 **** 'L_PIC_TITLE' => $lang['Pic_Title'], ! 'SORT_TIME' => ( $sort_method == 'pic_time' ) ? 'selected="selected"' : '', ! 'SORT_PIC_TITLE' => ( $sort_method == 'pic_title' ) ? 'selected="selected"' : '', ! 'SORT_VIEW' => ( $sort_method == 'pic_view_count' ) ? 'selected="selected"' : '', 'SORT_RATING_OPTION' => $sort_rating_option, 'SORT_COMMENTS_OPTION' => $sort_comments_option, 'SORT_NEW_COMMENT_OPTION' => $sort_new_comment_option, - 'SORT_USERNAME_OPTION' => $sort_username_option, 'L_ASC' => $lang['Sort_Ascending'], 'L_DESC' => $lang['Sort_Descending'], ! 'SORT_ASC' => ( $sort_order == 'ASC' ) ? 'selected="selected"' : '', ! 'SORT_DESC' => ( $sort_order == 'DESC' ) ? 'selected="selected"' : '', ! ! 'S_AUTH_LIST' => $auth_list ) ); ?> \ No newline at end of file --- 413,448 ---- 'L_PIC_TITLE' => $lang['Pic_Title'], ! 'SORT_TIME' => ($sort_method == 'pic_time') ? 'selected="selected"' : '', ! 'SORT_PIC_TITLE' => ($sort_method == 'pic_title') ? 'selected="selected"' : '', ! 'SORT_VIEW' => ($sort_method == 'pic_view_count') ? 'selected="selected"' : '', 'SORT_RATING_OPTION' => $sort_rating_option, 'SORT_COMMENTS_OPTION' => $sort_comments_option, 'SORT_NEW_COMMENT_OPTION' => $sort_new_comment_option, 'L_ASC' => $lang['Sort_Ascending'], 'L_DESC' => $lang['Sort_Descending'], ! 'SORT_ASC' => ($sort_order == 'ASC') ? 'selected="selected"' : '', ! 'SORT_DESC' => ($sort_order == 'DESC') ? 'selected="selected"' : '') ); + + + // + // Generate the page + // + $template->pparse('body'); + + if ( !$is_block ) + { + include($mx_root_path . 'includes/page_tail.'.$phpEx); + } + + + + // +--------------------------------------------------------+ + // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | + // | with Volodymyr (CLowN) Skoryk's Service Pack 1 © 2003 | + // +--------------------------------------------------------+ + ?> \ No newline at end of file Index: album_edit.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/includes/album_edit.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** album_edit.php 30 Jun 2006 21:10:55 -0000 1.6 --- album_edit.php 7 Jun 2007 20:13:29 -0000 1.7 *************** *** 4,37 **** * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! // +------------------------------------------------------+ ! // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | ! // +------------------------------------------------------+ ! ! if ( !defined( 'IN_PORTAL' ) ) { ! die( "Hacking attempt" ); } // ------------------------------------ // Check the request // ------------------------------------ ! if ( isset( $HTTP_GET_VARS['pic_id'] ) ) { ! $pic_id = intval( $HTTP_GET_VARS['pic_id'] ); } ! else if ( isset( $HTTP_POST_VARS['pic_id'] ) ) { ! $pic_id = intval( $HTTP_POST_VARS['pic_id'] ); } else { ! mx_message_die( GENERAL_ERROR, 'No pics specified' ); } ! /* // ------------------------------------ // Get this pic info --- 4,36 ---- * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2003 [sma...@ho..., Smartor] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! // MX ! if ( !defined('IN_PORTAL') ) { ! die("Hacking attempt"); } + // ------------------------------------ // Check the request // ------------------------------------ ! ! if( isset($HTTP_GET_VARS['pic_id']) ) { ! $pic_id = intval($HTTP_GET_VARS['pic_id']); } ! else if( isset($HTTP_POST_VARS['pic_id']) ) { ! $pic_id = intval($HTTP_POST_VARS['pic_id']); } else { ! mx_message_die(GENERAL_ERROR, 'No pics specified'); } ! // ------------------------------------ // Get this pic info *************** *** 91,149 **** $album_user_access = album_user_access($cat_id, $thiscat, 0, 0, 0, 0, 1, 0); // EDIT - */ - // --- Album Category Hierarchy : begin - // --- version : 1.1.0 - // ------------------------------------ - // Get this pic info and current Category Info - // ------------------------------------ - $sql = "SELECT p.*, c.* - FROM " . ALBUM_TABLE . " AS p, " . ALBUM_CAT_TABLE . " AS c - WHERE p.pic_id = '$pic_id' - AND c.cat_id = p.pic_cat_id"; - - if ( !( $result = $db->sql_query( $sql ) ) ) - { - mx_message_die( GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql ); - } - $thispic = $db->sql_fetchrow( $result ); ! $cat_id = $thispic['cat_id']; ! $album_user_id = $thispic['cat_user_id']; ! ! $pic_filename = $thispic['pic_filename']; ! $pic_thumbnail = $thispic['pic_thumbnail']; ! ! if ( empty( $thispic ) ) ! { ! mx_message_die( GENERAL_ERROR, $lang['Pic_not_exist'] ); ! } ! // ------------------------------------ ! // Check the permissions ! // ------------------------------------ ! $album_user_access = album_permissions( $album_user_id, $cat_id, ALBUM_AUTH_EDIT, $thispic ); ! // --- Album Category Hierarchy : end ! if ( $album_user_access['edit'] == 0 ) { ! if ( !$userdata['session_logged_in'] ) { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); ! redirect( append_sid( $phpbb_root_path . "login.$phpEx?redirect=album.php?smartor_mode=album_edit&pic_id=$pic_id" ) ); } else { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); } } else ! { ! if ( ( !$album_user_access['moderator'] ) or ( $userdata['user_level'] != ADMIN ) ) { ! if ( $thispic['pic_user_id'] != $userdata['user_id'] ) { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); } } } /* +---------------------------------------------------------- --- 90,118 ---- $album_user_access = album_user_access($cat_id, $thiscat, 0, 0, 0, 0, 1, 0); // EDIT ! if ($album_user_access['edit'] == 0) { ! if (!$userdata['session_logged_in']) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); ! redirect(append_sid($phpbb_root_path ."login.$phpEx?redirect=album.php?smartor_mode=album_edit&pic_id=$pic_id")); } else { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else ! { ! if( (!$album_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { ! if ($thispic['pic_user_id'] != $userdata['user_id']) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } + /* +---------------------------------------------------------- *************** *** 152,173 **** */ ! if ( !isset( $HTTP_POST_VARS['pic_title'] ) ) { ! // Start output of page ! $page_title = $lang['Album']; ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } - $template->set_filenames( array( 'body' => 'album_edit_body.tpl' ) ); ! $template->assign_vars( array( 'L_EDIT_PIC_INFO' => $lang['Edit_Pic_Info'], 'CAT_TITLE' => $thiscat['cat_title'], ! 'U_VIEW_CAT' => append_sid( this_smartor_mxurl( "smartor_mode=album_cat&cat_id=$cat_id" ) ), 'L_PIC_TITLE' => $lang['Pic_Title'], --- 121,145 ---- */ ! if( !isset($HTTP_POST_VARS['pic_title']) ) { ! // // Start output of page ! // $page_title = $lang['Album']; ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_header.'.$phpEx); ! } ! $template->set_filenames(array( ! 'body' => 'album_edit_body.tpl') ! ); ! ! $template->assign_vars(array( 'L_EDIT_PIC_INFO' => $lang['Edit_Pic_Info'], 'CAT_TITLE' => $thiscat['cat_title'], ! 'U_VIEW_CAT' => ($cat_id != PERSONAL_GALLERY) ? append_sid(this_smartor_mxurl("smartor_mode=album_cat&cat_id=$cat_id")) : append_sid(this_smartor_mxurl("smartor_mode=album_personal&user_id=$user_id")), 'L_PIC_TITLE' => $lang['Pic_Title'], *************** *** 186,200 **** 'L_SUBMIT' => $lang['Submit'], ! 'S_ALBUM_ACTION' => append_sid( this_smartor_mxurl( "smartor_mode=album_edit&pic_id=$pic_id" ) ), ! )); // Generate the page ! $template->pparse( 'body' ); - if ( !$is_block ) - { - include( $mx_root_path . 'includes/page_tail.' . $phpEx ); - } } else --- 158,175 ---- 'L_SUBMIT' => $lang['Submit'], ! 'S_ALBUM_ACTION' => append_sid(this_smartor_mxurl("smartor_mode=album_edit&pic_id=$pic_id")), ! ) ! ); + // // Generate the page + // + $template->pparse('body'); ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_tail.'.$phpEx); ! } } else *************** *** 203,243 **** // Check posted info // -------------------------------- - $pic_title = str_replace( "\'", "''", htmlspecialchars( trim( $HTTP_POST_VARS['pic_title'] ) ) ); ! $pic_desc = str_replace( "\'", "''", htmlspecialchars( substr( trim( $HTTP_POST_VARS['pic_desc'] ), 0, $album_config['desc_length'] ) ) ); ! if ( empty( $pic_title ) ) { ! mx_message_die( GENERAL_ERROR, $lang['Missed_pic_title'] ); } // -------------------------------- // Update the DB // -------------------------------- ! $sql = "UPDATE " . ALBUM_TABLE . " SET pic_title = '$pic_title', pic_desc= '$pic_desc' WHERE pic_id = '$pic_id'"; ! if ( !$result = $db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not update pic information', '', __LINE__, __FILE__, $sql ); } // -------------------------------- // Complete... now send a message to user // -------------------------------- - $message = $lang['Pics_updated_successfully']; ! $template->assign_vars( array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid( this_smartor_mxurl( "smartor_mode=album_cat&cat_id=$cat_id" ) ) . '">' ) ); ! if ( $album_user_id == ALBUM_PUBLIC_GALLERY ) { ! $message .= "<br /><br />" . sprintf( $lang['Click_return_category'], "<a href=\"" . append_sid( album_append_uid( this_smartor_mxurl( "smartor_mode=album_cat&cat_id=$cat_id" ) ) ) . "\">", "</a>" ); } else { ! $message .= "<br /><br />" . sprintf( $lang['Click_return_personal_gallery'], "<a href=\"" . append_sid( album_append_uid( this_smartor_mxurl() ) ) . "\">", "</a>" ); } ! $message .= "<br /><br />" . sprintf( $lang['Click_return_album_index'], "<a href=\"" . append_sid( this_smartor_mxurl() ) . "\">", "</a>" ); - mx_message_die( GENERAL_MESSAGE, $message ); } ?> \ No newline at end of file --- 178,244 ---- // Check posted info // -------------------------------- ! $pic_title = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['pic_title']))); ! //Added by GH ! $pic_title = addslashes($pic_title); ! ! $pic_desc = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['pic_desc']), 0, $album_config['desc_length']))); ! ! //Added by GH ! $pic_desc = addslashes($pic_desc); ! ! if( empty($pic_title) ) { ! mx_message_die(GENERAL_ERROR, $lang['Missed_pic_title']); } + + // -------------------------------- // Update the DB // -------------------------------- ! ! $sql = "UPDATE ". ALBUM_TABLE ." SET pic_title = '$pic_title', pic_desc= '$pic_desc' WHERE pic_id = '$pic_id'"; ! if( !$result = $db->sql_query($sql) ) { ! mx_message_die(GENERAL_ERROR, 'Could not update pic information', '', __LINE__, __FILE__, $sql); } + + // -------------------------------- // Complete... now send a message to user // -------------------------------- ! $message = $lang['Pics_updated_successfully']; ! if ($cat_id != PERSONAL_GALLERY) { ! $template->assign_vars(array( ! 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_smartor_mxurl("smartor_mode=album_cat&cat_id=$cat_id")) . '">') ! ); ! ! $message .= "<br /><br />" . sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_smartor_mxurl("smartor_mode=album_cat&cat_id=$cat_id")) . "\">", "</a>"); } else { ! $template->assign_vars(array( ! 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_smartor_mxurl("smartor_mode=album_personal")) . '">') ! ); ! ! $message .= "<br /><br />" . sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid(this_smartor_mxurl("smartor_mode=album_personal")) . "\">", "</a>"); } ! $message .= "<br /><br />" . sprintf($lang['Click_return_album_index'], "<a href=\"" . append_sid(this_smartor_mxurl()) . "\">", "</a>"); ! ! mx_message_die(GENERAL_MESSAGE, $message); } + + + // +------------------------------------------------------+ + // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | + // +------------------------------------------------------+ + ?> \ No newline at end of file Index: album_comment_edit.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/includes/album_comment_edit.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** album_comment_edit.php 30 Jun 2006 21:10:55 -0000 1.6 --- album_comment_edit.php 7 Jun 2007 20:13:28 -0000 1.7 *************** *** 4,99 **** * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2002-2006 [Smartor, Volodymyr (CLowN) Skoryk, IdleVoid, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ ! // +------------------------------------------------------+ ! // | Powered by Photo Album 2.x.x (c) 2002-2003 Smartor | ! // +------------------------------------------------------+ ! ! if ( !defined( 'IN_PORTAL' ) ) { ! die( "Hacking attempt" ); } // ------------------------------------ // Check feature enabled // ------------------------------------ ! if ( $album_config['comment'] == 0 ) { ! mx_message_die( GENERAL_MESSAGE, $lang['Not_Authorised'] ); } // ------------------------------------ // Check the request // ------------------------------------ ! if ( isset( $HTTP_GET_VARS['comment_id'] ) ) { ! $comment_id = intval( $HTTP_GET_VARS['comment_id'] ); } ! else if ( isset( $HTTP_POST_VARS['comment_id'] ) ) { ! $comment_id = intval( $HTTP_POST_VARS['comment_id'] ); } else { ! mx_message_die( GENERAL_ERROR, 'No comment_id specified' ); } // ------------------------------------ // Get the comment info // ------------------------------------ $sql = "SELECT * ! FROM " . ALBUM_COMMENT_TABLE . " WHERE comment_id = '$comment_id'"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not query this comment information', '', __LINE__, __FILE__, $sql ); } ! $thiscomment = $db->sql_fetchrow( $result ); ! if ( empty( $thiscomment ) ) { ! mx_message_die( GENERAL_ERROR, 'This comment does not exist' ); } // ------------------------------------ // Get $pic_id from $comment_id // ------------------------------------ $sql = "SELECT comment_id, comment_pic_id ! FROM " . ALBUM_COMMENT_TABLE . " WHERE comment_id = '$comment_id'"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not query comment and pic information', '', __LINE__, __FILE__, $sql ); } ! $row = $db->sql_fetchrow( $result ); $pic_id = $row['comment_pic_id']; ! // --- Album Category Hierarchy : begin ! // --- version : 1.1.0 // ------------------------------------ ! // Get this pic info and current category info // ------------------------------------ ! // NOTE: we don't do a left join here against the category table ! // since ALL pictures belong to some category, if not then it's database error ! $sql = "SELECT p.*, cat.*, u.user_id, u.username, COUNT(c.comment_id) as comments_count ! FROM " . ALBUM_CAT_TABLE . " AS cat, " . ALBUM_TABLE . " AS p ! LEFT JOIN " . USERS_TABLE . " AS u ON p.pic_user_id = u.user_id ! LEFT JOIN " . ALBUM_COMMENT_TABLE . " AS c ON p.pic_id = c.comment_pic_id WHERE pic_id = '$pic_id' - AND cat.cat_id = p.pic_cat_id GROUP BY p.pic_id LIMIT 1"; ! ! if ( !( $result = $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql ); } ! $thispic = $db->sql_fetchrow( $result ); $cat_id = $thispic['pic_cat_id']; ! $album_user_id = $thispic['cat_user_id']; $total_comments = $thispic['comments_count']; --- 4,116 ---- * @package mxBB Portal Module - mx_smartor * @version $Id$ ! * @copyright (c) 2003 [sma...@ho..., Smartor] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ + + /*************************************************************************** + * MODIFICATIONS + * --------------- + * started : Saturday, September 06 12:07 pm + * copyright : © 2003 Volodymyr (CLowN) Skoryk + * email : bla...@ya... + * + * MODIFICATIONS: + * -fixed links to go to album_showpage.php + * + * + ***************************************************************************/ ! // MX ! if ( !defined('IN_PORTAL') ) { ! die("Hacking attempt"); } + // ------------------------------------ // Check feature enabled // ------------------------------------ ! ! if( $album_config['comment'] == 0 ) { ! mx_message_die(GENERAL_MESSAGE, $lang['Not_Authorised']); } + + // ------------------------------------ // Check the request // ------------------------------------ ! ! if( isset($HTTP_GET_VARS['comment_id']) ) { ! $comment_id = intval($HTTP_GET_VARS['comment_id']); } ! else if( isset($HTTP_POST_VARS['comment_id']) ) { ! $comment_id = intval($HTTP_POST_VARS['comment_id']); } else { ! mx_message_die(GENERAL_ERROR, 'No comment_id specified'); } + + // ------------------------------------ // Get the comment info // ------------------------------------ $sql = "SELECT * ! FROM ". ALBUM_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query this comment information', '', __LINE__, __FILE__, $sql); } ! $thiscomment = $db->sql_fetchrow($result); ! if( empty($thiscomment) ) { ! mx_message_die(GENERAL_ERROR, 'This comment does not exist'); } + + // ------------------------------------ // Get $pic_id from $comment_id // ------------------------------------ + $sql = "SELECT comment_id, comment_pic_id ! FROM ". ALBUM_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query comment and pic information', '', __LINE__, __FILE__, $sql); } ! $row = $db->sql_fetchrow($result); $pic_id = $row['comment_pic_id']; ! ! // ------------------------------------ ! // Get this pic info // ------------------------------------ ! ! $sql = "SELECT p.*, u.user_id, u.username, COUNT(c.comment_id) as comments_count ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id WHERE pic_id = '$pic_id' GROUP BY p.pic_id LIMIT 1"; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql); } ! $thispic = $db->sql_fetchrow($result); $cat_id = $thispic['pic_cat_id']; ! $user_id = $thispic['pic_user_id']; $total_comments = $thispic['comments_count']; *************** *** 103,114 **** $pic_thumbnail = $thispic['pic_thumbnail']; ! if ( empty( $thispic ) ) { ! mx_message_die( GENERAL_ERROR, $lang['Pic_not_exist'] ); } // ------------------------------------ // Get the current Category Info // ------------------------------------ ! /* if ($cat_id != PERSONAL_GALLERY) { --- 120,133 ---- $pic_thumbnail = $thispic['pic_thumbnail']; ! if( empty($thispic) ) { ! mx_message_die(GENERAL_ERROR, $lang['Pic_not_exist']); } + + // ------------------------------------ // Get the current Category Info // ------------------------------------ ! if ($cat_id != PERSONAL_GALLERY) { *************** *** 132,169 **** mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } ! */ ! // ------------------------------------ ! // Check the permissions ! // ------------------------------------ ! $album_user_access = album_permissions( $album_user_id, $cat_id, ALBUM_AUTH_COMMENT | ALBUM_AUTH_EDIT, $thispic ); ! // --- Album Category Hierarchy : end // ------------------------------------ // Check the permissions // ------------------------------------ - $album_user_access = album_user_access( $thispic['pic_cat_id'], $thiscat, 0, 0, 0, 1, 1, 0 ); ! if ( ( $album_user_access['comment'] == 0 ) or ( $album_user_access['edit'] == 0 ) ) { ! if ( !$userdata['session_logged_in'] ) { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); ! redirect( append_sid( $phpbb_root_path . "login.$phpEx?redirect=album.php?smartor_mode=album_comment_edit&comment_id=$comment_id" ) ); } else { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); } } else ! { ! if ( ( !$album_user_access['moderator'] ) or ( $userdata['user_level'] != ADMIN ) ) { ! if ( $thiscomment['comment_user_id'] != $userdata['user_id'] ) { ! mx_message_die( GENERAL_ERROR, $lang['Not_Authorised'] ); } } } /* +---------------------------------------------------------- --- 151,186 ---- mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } ! ! // ------------------------------------ // Check the permissions // ------------------------------------ ! $album_user_access = album_user_access($thispic['pic_cat_id'], $thiscat, 0, 0, 0, 1, 1, 0); ! ! if( ($album_user_access['comment'] == 0) or ($album_user_access['edit'] == 0) ) { ! if (!$userdata['session_logged_in']) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); ! redirect(append_sid($phpbb_root_path ."login.$phpEx?redirect=album.php?smartor_mode=album_comment_edit&comment_id=$comment_id")); } else { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else ! { ! if( (!$album_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { ! if ($thiscomment['comment_user_id'] != $userdata['user_id']) { ! mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } + /* +---------------------------------------------------------- *************** *** 172,176 **** */ ! if ( !isset( $HTTP_POST_VARS['comment'] ) ) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- 189,194 ---- */ ! ! if( !isset($HTTP_POST_VARS['comment']) ) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *************** *** 178,245 **** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ! if ( ( $thispic['pic_user_id'] == ALBUM_GUEST ) or ( $thispic['username'] == '' ) ) { ! $poster = ( $thispic['pic_username'] == '' ) ? $lang['Guest'] : $thispic['pic_username']; } else { ! $poster = '<a href="' . append_sid( $phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $thispic['user_id'] ) . '">' . $thispic['username'] . '</a>'; } // Start output of page ! $page_title = $lang['Album']; ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! } - $template->set_filenames( array( 'body' => 'album_comment_body.tpl' ) ); ! $template->assign_block_vars( 'switch_comment_post', array() ); ! // --- Album Category Hierarchy : begin ! // --- version : 1.1.0 ! if ( defined( 'ALBUM_SP_CONFIG_TABLE' ) ) ! { ! $image_rating = ImageRating( $thispic['rating'] ); ! // begin shows smilies ! $max_smilies = 20; ! $sql = 'SELECT emoticon, code, smile_url ! FROM ' . SMILIES_TABLE . ' GROUP BY smile_url ORDER BY smilies_id LIMIT ' . $max_smilies; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Couldn't retrieve smilies list", '', __LINE__, __FILE__, $sql ); ! } ! $smilies_count = $db->sql_numrows( $result ); ! $smilies_data = $db->sql_fetchrowset( $result ); ! for ( $i = 1; $i < $smilies_count + 1; $i++ ) ! { ! $template->assign_block_vars( 'switch_comment_post.smilies', array( ! 'CODE' => $smilies_data[$i - 1]['code'], ! 'URL' => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smilies_data[$i - 1]['smile_url'], ! 'DESC' => $smilies_data[$i - 1]['emoticon'] ! ) ); ! if ( is_integer( $i / 5 ) ) ! $template->assign_block_vars( 'switch_comment_post.smilies.new_col', array() ); ! } ! } ! // --- changed $thiscat to $thispic ! $template->assign_vars( array( ! 'CAT_TITLE' => $thispic['cat_title'], ! 'U_VIEW_CAT' => append_sid( album_append_uid( this_smartor_mxurl( "smartor_mode=album_cat&cat_id=$cat_id" ) ) ), ! // --- Album Category Hierarchy : end ! 'U_THUMBNAIL' => append_sid( this_smartor_mxurl( "smartor_mode=album_thumbnail&pic_id=$pic_id" ) ), ! 'U_PIC' => append_sid( this_smartor_mxurl( "smartor_mode=album_thumbnail&pic_id=$pic_id", true ) ), 'PIC_TITLE' => $thispic['pic_title'], ! 'PIC_DESC' => nl2br( $thispic['pic_desc'] ), 'POSTER' => $poster, ! 'PIC_TIME' => create_date( $board_config['default_dateformat'], $thispic['pic_time'], $board_config['board_timezone'] ), 'PIC_VIEW' => $thispic['pic_view_count'], 'PIC_COMMENTS' => $total_comments, --- 196,266 ---- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ! if( ($thispic['pic_user_id'] == ALBUM_GUEST) or ($thispic['username'] == '') ) { ! $poster = ($thispic['pic_username'] == '') ? $lang['Guest'] : $thispic['pic_username']; } else { ! $poster = '<a href="'. append_sid($phpbb_root_path ."profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $thispic['user_id']) .'">'. $thispic['username'] .'</a>'; } + // // Start output of page ! // $page_title = $lang['Album']; ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_header.'.$phpEx); ! } ! $template->set_filenames(array( ! 'body' => 'album_comment_body.tpl') ! ); ! $template->assign_block_vars('switch_comment_post', array()); ! ! $image_rating = ImageRating($thispic['rating']); ! ! //begin shows smilies ! $max_smilies = 20; ! ! $sql = 'SELECT emoticon, code, smile_url ! FROM ' . SMILIES_TABLE . ' GROUP BY smile_url ORDER BY smilies_id LIMIT ' . $max_smilies; ! if (!$result = $db->sql_query($sql)) ! { ! mx_message_die(GENERAL_ERROR, "Couldn't retrieve smilies list", '', __LINE__, __FILE__, $sql); ! } ! $smilies_count = $db->sql_numrows($result); ! $smilies_data = $db->sql_fetchrowset($result); ! ! for ($i = 1; $i < $smilies_count+1; $i++) ! { ! $template->assign_block_vars('switch_comment_post.smilies', array( ! 'CODE' => $smilies_data[$i - 1]['code'], ! 'URL' => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smilies_data[$i - 1]['smile_url'], ! 'DESC' => $smilies_data[$i - 1]['emoticon'] ! )); ! ! if ( is_integer($i / 5) ) ! $template->assign_block_vars('switch_comment_post.smilies.new_col', array()); ! } ! ! $template->assign_vars(array( ! 'CAT_TITLE' => $thiscat['cat_title'], ! 'U_VIEW_CAT' => ($cat_id != PERSONAL_GALLERY) ? append_sid(this_smartor_mxurl("smartor_mode=album_cat&cat_id=$cat_id")) : append_sid(this_smartor_mxurl("smartor_mode=album_personal&user_id=$user_id")), ! ! 'U_THUMBNAIL' => append_sid(this_smartor_mxurl("smartor_mode=album_thumbnail&pic_id=$pic_id")), ! 'U_PIC' => append_sid(this_smartor_mxurl("smartor_mode=album_thumbnail&pic_id=$pic_id", TRUE)), 'PIC_TITLE' => $thispic['pic_title'], ! 'PIC_DESC' => nl2br($thispic['pic_desc']), 'POSTER' => $poster, ! 'PIC_TIME' => create_date($board_config['default_dateformat'], $thispic['pic_time'], $board_config['board_timezone']), 'PIC_VIEW' => $thispic['pic_view_count'], 'PIC_COMMENTS' => $total_comments, *************** *** 263,277 **** 'L_SUBMIT' => $lang['Submit'], ! 'S_ALBUM_ACTION' => append_sid( this_smartor_mxurl( "smartor_mode=album_comment_edit&comment_id=$comment_id" ) ) ! )); // Generate the page ! $template->pparse( 'body' ); - if ( !$is_block ) - { - include( $mx_root_path . 'includes/page_tail.' . $phpEx ); - } } else --- 284,301 ---- 'L_SUBMIT' => $lang['Submit'], ! 'S_ALBUM_ACTION' => append_sid(this_smartor_mxurl("smartor_mode=album_comment_edit&comment_id=$comment_id")) ! ) ! ); + // // Generate the page + // + $template->pparse('body'); ! if ( !$is_block ) ! { ! include($mx_root_path . 'includes/page_tail.'.$phpEx); ! } } else *************** *** 281,314 **** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ! $comment_text = str_replace( "\'", "''", htmlspecialchars( substr( trim( $HTTP_POST_VARS['comment'] ), 0, $album_config['desc_length'] ) ) ); ! if ( empty( $comment_text ) ) { ! mx_message_die( GENERAL_ERROR, $lang['Comment_no_text'] ); } // -------------------------------- // Prepare variables // -------------------------------- $comment_edit_time = time(); $comment_edit_user_id = $userdata['user_id']; // -------------------------------- // Update the DB // -------------------------------- ! $sql = "UPDATE " . ALBUM_COMMENT_TABLE . " SET comment_text = '$comment_text', comment_edit_time = '$comment_edit_time', comment_edit_count = comment_edit_count + 1, comment_edit_user_id = '$comment_edit_user_id' WHERE comment_id = '$comment_id'"; ! if ( !$result = $db->sql_query( $sql ) ) { ! mx_message_die( GENERAL_ERROR, 'Could not update comment data', '', __LINE__, __FILE__, $sql ); } // -------------------------------- // Complete... now send a message to user // -------------------------------- - $template->assign_vars( array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid( this_smartor_mxurl( "smartor_mode=album_showpage&comment_id=$comment_id" ) ) . '#' . $comment_id . '">' ) ); ! $message = $lang['Stored'] . "<br /><br />" . sprintf( $lang['Click_view_message'], "<a href=\"" . append_sid( this_smartor_mxurl( "smartor_mode=album_showpage&comment_id=$comment_id" ) ) . "#$comment_id\">", "</a>" ) . "<br /><br />" . sprintf( $lang['Click_return_album_index'], "<a href=\"" . append_sid( album_append_uid( this_smartor_mxurl() ) ) . "\">", "</a>" ); ! mx_message_die( GENERAL_MESSAGE, $message ); } ?> \ No newline at end of file --- 305,356 ---- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ! $comment_text = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['comment']), 0, $album_config['desc_length']))); ! if( empty($comment_text) ) { ! mx_message_die(GENERAL_ERROR, $lang['Comment_no_text']); } + + // -------------------------------- // Prepare variables // -------------------------------- + $comment_edit_time = time(); $comment_edit_user_id = $userdata['user_id']; + + // -------------------------------- // Update the DB // -------------------------------- ! ! $sql = "UPDATE ". ALBUM_COMMENT_TABLE ." SET comment_text = '$comment_text', comment_edit_time = '$comment_edit_time', comment_edit_count = comment_edit_count + 1, comment_edit_user_id = '$comment_edit_user_id' WHERE comment_id = '$comment_id'"; ! if( !$result = $db->sql_query($sql) ) ... [truncated message content] |