|
From: Jon O. <jon...@us...> - 2005-12-08 15:15:53
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5653/modules/mx_pafiledb/pafiledb/modules Modified Files: pa_category.php pa_download.php pa_email.php pa_file.php pa_license.php pa_main.php pa_mcp.php pa_post_comment.php pa_quickdl.php pa_rate.php pa_search.php pa_stats.php pa_toplist.php pa_user_upload.php pa_viewall.php Log Message: in progress commit for mx_pafiledb Index: pa_viewall.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_viewall.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pa_viewall.php 24 Oct 2005 20:16:56 -0000 1.11 --- pa_viewall.php 8 Dec 2005 15:15:13 -0000 1.12 *************** *** 99,122 **** } ! $pafiledb_template->assign_vars( array( 'L_VIEWALL' => $lang['Viewall'], ! /* - orig ! 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), ! */ ! // MX 'L_INDEX' => "<<", - /* - orig - 'U_INDEX' => append_sid('index.'.$phpEx), - 'U_DOWNLOAD' => append_sid('dload.'.$phpEx), - */ - // MX 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD' => append_sid( pa_this_mxurl() ), ! 'DOWNLOAD' => $pafiledb_config['settings_dbname'] ) ); $this->display_files( $sort_method, $sort_order, $start, true ); $this->display( $lang['Download'], 'pa_viewall_body.tpl' ); } --- 99,118 ---- } ! $pafiledb_template->assign_vars( array( ! 'L_VIEWALL' => $lang['Viewall'], 'L_INDEX' => "<<", 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD' => append_sid( pa_this_mxurl() ), ! 'DOWNLOAD' => $pafiledb_config['module_name'] ) ); $this->display_files( $sort_method, $sort_order, $start, true ); + // =================================================== + // assign var for navigation + // =================================================== + $this->display( $lang['Download'], 'pa_viewall_body.tpl' ); } Index: pa_download.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_download.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pa_download.php 24 Oct 2005 20:16:56 -0000 1.12 --- pa_download.php 8 Dec 2005 15:15:13 -0000 1.13 *************** *** 35,39 **** global $_REQUEST, $lang, $db, $pafiledb_user, $pafiledb_config, $board_config, $phpEx, $userdata; global $phpbb_root_path, $_SERVER, $pafiledb_functions; - // MX global $mx_script_name, $module_root_path; --- 35,38 ---- *************** *** 73,80 **** if ( !$userdata['session_logged_in'] ) { - /* - orig - redirect(append_sid("login.$phpEx?redirect=dload.$phpEx?action=download&file_id=$file_id", true)); - */ - // MX // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=download&file_id=" . $file_id), true)); } --- 72,75 ---- *************** *** 105,114 **** } - /* - orig $good_referers[] = $board_config['server_name']; - */ - // MX - $good_referers[] = $board_config['server_name']; - // $good_referers[] = $board_config['server_name'] . '/' . $mx_script_name; $errored = true; --- 100,104 ---- *************** *** 152,162 **** global $template, $db, $theme, $gen_simple_header, $starttime; - $this->generate_category_nav( $file_data['file_catid'] ); - $pafiledb_template->assign_vars( array( - /* - orig - 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), - */ - // MX 'L_INDEX' => "<<", 'L_MIRRORS' => $lang['Mirrors'], --- 142,146 ---- *************** *** 164,184 **** 'L_DOWNLOAD' => $lang['Download_file'], - /* - orig - 'U_INDEX' => append_sid('index.'.$phpEx), - 'U_DOWNLOAD_HOME' => append_sid('dload.'.$phpEx), - */ - // MX 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['settings_dbname'] ) ); $pafiledb_template->assign_block_vars( 'mirror_row', array( - /* - orig - 'U_DOWNLOAD' => append_sid('dload.php?action=download&file_id=' . $file_id . '&mirror_id=-1'), - */ - // MX 'U_DOWNLOAD' => append_sid( $pa_this_mxurl( 'action=download&file_id=' . $file_id . '&mirror_id=-1' ) ), 'MIRROR_LOCATION' => $board_config['sitename'] ) --- 148,159 ---- 'L_DOWNLOAD' => $lang['Download_file'], 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['module_name'] ) ); $pafiledb_template->assign_block_vars( 'mirror_row', array( 'U_DOWNLOAD' => append_sid( $pa_this_mxurl( 'action=download&file_id=' . $file_id . '&mirror_id=-1' ) ), 'MIRROR_LOCATION' => $board_config['sitename'] ) *************** *** 188,195 **** { $pafiledb_template->assign_block_vars( 'mirror_row', array( - /* - orig - 'U_DOWNLOAD' => append_sid('dload.php?action=download&file_id=' . $file_id . '&mirror_id=' . $mir_id), - */ - // MX 'U_DOWNLOAD' => append_sid( pa_this_mxurl( 'action=download&file_id=' . $file_id . '&mirror_id=' . $mir_id ) ), 'MIRROR_LOCATION' => $mirror_data['mirror_location'] ) --- 163,166 ---- *************** *** 197,206 **** } ! /* - orig ! include($phpbb_root_path . 'includes/page_header.'.$phpEx); ! $this->display($lang['Download'], 'pa_mirrors_body.tpl'); ! include_once($phpbb_root_path . 'includes/page_tail.'.$phpEx); ! */ ! // MX include( $mx_root_path . 'includes/page_header.' . $phpEx ); $this->display( $lang['Download'], 'pa_mirrors_body.tpl' ); --- 168,176 ---- } ! // =================================================== ! // assign var for navigation ! // =================================================== ! $this->generate_navigation( $file_data['file_catid'] ); ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); $this->display( $lang['Download'], 'pa_mirrors_body.tpl' ); *************** *** 401,405 **** function pa_redirect( $file_url ) { ! global $cache, $db; if ( isset( $db ) ) { --- 371,375 ---- function pa_redirect( $file_url ) { ! global $pafiledb_cache, $db; if ( isset( $db ) ) { *************** *** 407,413 **** } ! if ( isset( $cache ) ) { ! $cache->unload(); } // Redirect via an HTML form for PITA webservers --- 377,383 ---- } ! if ( isset( $pafiledb_cache ) ) { ! $pafiledb_cache->unload(); } // Redirect via an HTML form for PITA webservers Index: pa_post_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_post_comment.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pa_post_comment.php 24 Oct 2005 20:16:56 -0000 1.11 --- pa_post_comment.php 8 Dec 2005 15:15:13 -0000 1.12 *************** *** 23,43 **** function main( $action ) { ! global $pafiledb_template, $lang, $board_config, $phpEx, $pafiledb_config, $db, $images, $userdata; ! global $_REQUEST, $_POST, $phpbb_root_path, $bbcode_tpl; global $html_entities_match, $html_entities_replace, $unhtml_specialchars_match, $unhtml_specialchars_replace; ! /* - orig ! include($phpbb_root_path . 'includes/bbcode.'.$phpEx); ! */ ! // BUGFIX ! global $pafiledb_functions; ! // MX ! global $mx_root_path, $module_root_path, $is_block, $phpEx; ! // MX FIX include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! if ( isset( $_REQUEST['file_id'] ) ) { ! $file_id = intval( $_REQUEST['file_id'] ); } else --- 23,45 ---- function main( $action ) { ! global $pafiledb_template, $pafiledb_functions, $lang, $board_config, $phpEx, $pafiledb_config, $db, $images, $userdata, $_POST; global $html_entities_match, $html_entities_replace, $unhtml_specialchars_match, $unhtml_specialchars_replace; ! global $mx_root_path, $module_root_path, $phpbb_root_path, $is_block, $phpEx, $mx_request_vars; ! ! // ! // Includes ! // include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); ! // ! // Request vars ! // ! $cid = $mx_request_vars->request('cid', MX_TYPE_INT, ''); ! ! if ( $mx_request_vars->is_request('item_id') && $mx_request_vars->is_request('cat_id') ) { ! $item_id = $mx_request_vars->request('item_id', MX_TYPE_INT, 0); ! $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, 0); } else *************** *** 46,58 **** } ! if ( isset( $_REQUEST['cid'] ) ) ! { ! $cid = intval( $_REQUEST['cid'] ); ! } ! ! $delete = ( isset( $_REQUEST['delete'] ) ) ? intval( $_REQUEST['delete'] ) : ''; ! ! $submit = ( isset( $_POST['submit'] ) ) ? true : 0; ! $preview = ( isset( $_POST['preview'] ) ) ? true : 0; $subject = ( !empty( $_POST['subject'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['subject'] ) ) ) : ''; --- 48,54 ---- } ! $delete = $mx_request_vars->request('delete', MX_TYPE_NO_TAGS, ''); ! $submit = $mx_request_vars->is_request('submit'); ! $preview = $mx_request_vars->is_request('preview'); $subject = ( !empty( $_POST['subject'] ) ) ? htmlspecialchars( trim( stripslashes( $_POST['subject'] ) ) ) : ''; *************** *** 61,65 **** $sql = "SELECT file_name, file_catid FROM " . PA_FILES_TABLE . " ! WHERE file_id = '" . $file_id . "'"; if ( !( $result = $db->sql_query( $sql ) ) ) --- 57,61 ---- $sql = "SELECT file_name, file_catid FROM " . PA_FILES_TABLE . " ! WHERE file_id = '" . $item_id . "'"; if ( !( $result = $db->sql_query( $sql ) ) ) *************** *** 79,87 **** if ( !$userdata['session_logged_in'] ) { ! /* - orig ! redirect(append_sid("login.$phpEx?redirect=dload.$phpEx?action=post_comment&file_id=" . $file_id, true)); ! */ ! // MX ! // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=post_comment&file_id=" . $file_id), true)); } --- 75,79 ---- if ( !$userdata['session_logged_in'] ) { ! // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=post_comment&item_id=" . $item_id), true)); } *************** *** 90,98 **** } ! $html_on = ( $userdata['user_allowhtml'] && $pafiledb_config['allow_html'] ) ? true : 0; ! $bbcode_on = ( $userdata['user_allowbbcode'] && $pafiledb_config['allow_bbcode'] ) ? true : 0; ! $smilies_on = ( $userdata['user_allowsmile'] && $pafiledb_config['allow_smilies'] ) ? true : 0; // ======================================================= ! // MX Addon // ======================================================= if ( $delete == 'do' ) --- 82,93 ---- } ! $html_on = ( $pafiledb_config['allow_comment_html'] ) ? true : 0; ! $bbcode_on = ( $pafiledb_config['allow_comment_bbcode'] ) ? true : 0; ! $smilies_on = ( $pafiledb_config['allow_comment_smilies'] ) ? true : 0; ! $links_on = ( $pafiledb_config['allow_comment_links'] ) ? true : 0; ! $images_on = ( $pafiledb_config['allow_comment_images'] ) ? true : 0; ! // ======================================================= ! // Delete // ======================================================= if ( $delete == 'do' ) *************** *** 100,104 **** $sql = 'SELECT * FROM ' . PA_FILES_TABLE . " ! WHERE file_id = $file_id"; if ( !( $result = $db->sql_query( $sql ) ) ) { --- 95,100 ---- $sql = 'SELECT * FROM ' . PA_FILES_TABLE . " ! WHERE file_id = $item_id"; ! if ( !( $result = $db->sql_query( $sql ) ) ) { *************** *** 109,122 **** if ( ( $this->auth[$file_info['file_catid']]['auth_delete_comment'] && $file_info['user_id'] == $userdata['user_id'] ) || $this->auth[$file_info['file_catid']]['auth_mod'] ) { ! $sql = 'DELETE FROM ' . PA_COMMENTS_TABLE . " ! WHERE comments_id = $cid"; ! ! if ( !( $db->sql_query( $sql ) ) ) { ! mx_message_die( GENERAL_ERROR, 'Couldnt delete comment', '', __LINE__, __FILE__, $sql ); } $this->_pafiledb(); ! $message = $lang['Comment_deleted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=$file_id" ) ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } --- 105,128 ---- if ( ( $this->auth[$file_info['file_catid']]['auth_delete_comment'] && $file_info['user_id'] == $userdata['user_id'] ) || $this->auth[$file_info['file_catid']]['auth_mod'] ) { ! if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) ! { ! $sql = 'DELETE FROM ' . PA_COMMENTS_TABLE . " ! WHERE comments_id = $cid"; ! ! if ( !( $db->sql_query( $sql ) ) ) ! { ! mx_message_die( GENERAL_ERROR, 'Couldnt delete comment', '', __LINE__, __FILE__, $sql ); ! } ! } ! else { ! include( $module_root_path . 'pafiledb/includes/functions_comment.' . $phpEx ); ! $pafiledb_comments = new pafiledb_comments(); ! $pafiledb_comments->init( $file_info, 'phpbb' ); ! $pafiledb_comments->post('delete', $cid); } $this->_pafiledb(); ! $message = $lang['Comment_deleted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=$item_id" ) ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } *************** *** 128,242 **** } if ( !$submit ) { // Generate smilies listing for page output ! /* - orig ! pa_generate_smilies('inline', PAGE_POSTING); ! */ ! // BUGFIX $pafiledb_functions->pa_generate_smilies( 'inline', PAGE_POSTING ); - $html_status = ( $userdata['user_allowhtml'] && $pafiledb_config['allow_html'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; - $bbcode_status = ( $userdata['user_allowbbcode'] && $pafiledb_config['allow_bbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; - $smilies_status = ( $userdata['user_allowsmile'] && $pafiledb_config['allow_smilies'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; - $links_status = ( $pafiledb_config['allow_comment_links'] ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; - $images_status = ( $pafiledb_config['allow_comment_images'] ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; - $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> - <input type="hidden" name="file_id" value="' . $file_id . '"> - <input type="hidden" name="comment" value="post">'; // Output the data to the template ! ! $this->generate_category_nav( $file_data['file_catid'] ); ! ! $pafiledb_template->assign_vars( array( 'HTML_STATUS' => $html_status, ! 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), ! 'SMILIES_STATUS' => $smilies_status, ! 'LINKS_STATUS' => $links_status, ! 'IMAGES_STATUS' => $images_status, ! 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['settings_dbname'], ! 'MESSAGE_LENGTH' => $pafiledb_config['max_comment_chars'], ! ! 'L_COMMENT_ADD' => $lang['Comment_add'], ! 'L_COMMENT' => $lang['Message_body'], ! 'L_COMMENT_TITLE' => $lang['Subject'], ! 'L_OPTIONS' => $lang['Options'], ! 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $pafiledb_config['max_comment_chars'] ), ! 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! /* - orig ! 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), ! */ ! // MX ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! /* - orig ! 'U_INDEX' => append_sid('index.'.$phpEx), ! 'U_DOWNLOAD_HOME' => append_sid('dload.'.$phpEx), ! 'U_FILE_NAME' => append_sid('dload.php?action=file&file_id=' . $file_id), ! 'S_POST_ACTION' => append_sid('dload.'.$phpEx), ! */ ! // MX ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), ! 'U_FILE_NAME' => append_sid( pa_this_mxurl( 'action=file&file_id=' . $file_id ) ), ! 'S_POST_ACTION' => append_sid( pa_this_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ! ); // Show preview stuff if user clicked preview ! if ( $preview ) { --- 134,320 ---- } + // ======================================================= + // Main + // ======================================================= if ( !$submit ) { + // + // Instatiate text tools + // + $mx_pa_text_tools = new mx_pa_text_tools(); + + // // Generate smilies listing for page output ! // $pafiledb_functions->pa_generate_smilies( 'inline', PAGE_POSTING ); + $html_status = ( $html_on ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF']; + $bbcode_status = ( $bbcode_on ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF']; + $smilies_status = ( $smilies_on ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF']; + $links_status = ( $links_on ) ? $lang['Links_are_ON'] : $lang['Links_are_OFF']; + $images_status = ( $images_on ) ? $lang['Images_are_ON'] : $lang['Images_are_OFF']; + + if ( $mx_request_vars->is_get('cid') ) + { + if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) + { + // + // Query internal comment to edit + // + $sql = 'SELECT c.*, u.* + FROM ' . PA_COMMENTS_TABLE . ' AS c + LEFT JOIN ' . USERS_TABLE . " AS u ON c.poster_id = u.user_id + WHERE c.file_id = '" . $item_id . "' + AND c.comments_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'comments_title'; + $comment_arg_message = 'comments_text'; + $comment_arg_bbcode_uid = 'comment_bbcode_uid'; + } + else + { + // + // Query internal comment to edit + // Note: cid = post_id + // + $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid + FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt + WHERE pt.post_id = p.post_id + AND u.user_id = p.poster_id + AND p.post_id = '" . $mx_request_vars->request('cid', MX_TYPE_INT, '') . "'"; + + $comment_arg_title = 'post_subject'; + $comment_arg_message = 'post_text'; + $comment_arg_bbcode_uid = 'bbcode_uid'; + + } + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt select comments', '', __LINE__, __FILE__, $sql ); + } + + $comment_row = $db->sql_fetchrow( $result ); + + // + // Edit comment + // + $comment_title = stripslashes($comment_row[$comment_arg_title]); + $comment_body = $comment_row[$comment_arg_message]; + + if ( $comment_row[$comment_arg_bbcode_uid] != '' ) + { + $comment_body = preg_replace('/\:(([a-z0-9]:)?)' . $comment_row[$comment_arg_bbcode_uid] . '/s', '', $comment_body); + } + + $comment_body = str_replace('<', '<', $comment_body); + $comment_body = str_replace('>', '>', $comment_body); + $comment_body = str_replace('<br />', "\n", $comment_body); + + $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> + <input type="hidden" name="cat_id" value="' . $cat_id . '"> + <input type="hidden" name="item_id" value="' . $item_id . '"> + <input type="hidden" name="cid" value="' . $mx_request_vars->request('cid', MX_TYPE_INT, '') . '"> + <input type="hidden" name="comment" value="post">'; + } + else + { + // + // New comment + // + $comment_title = ''; + $comment_body = ''; + + $hidden_form_fields = '<input type="hidden" name="action" value="post_comment"> + <input type="hidden" name="cat_id" value="' . $cat_id . '"> + <input type="hidden" name="item_id" value="' . $item_id . '"> + <input type="hidden" name="comment" value="post">'; + } + // // Output the data to the template ! // ! $pafiledb_template->assign_vars( array( ! 'HTML_STATUS' => $html_status, ! 'BBCODE_STATUS' => sprintf( $bbcode_status, '<a href="' . append_sid( "faq.$phpEx?mode=bbcode" ) . '" target="_phpbbcode">', '</a>' ), ! 'SMILIES_STATUS' => $smilies_status, ! 'LINKS_STATUS' => $links_status, ! 'IMAGES_STATUS' => $images_status, ! 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['module_name'], ! 'MESSAGE_LENGTH' => $pafiledb_config['max_comment_chars'], ! ! 'TITLE' => $comment_title, ! 'COMMENT' => $comment_body, ! 'L_COMMENT_ADD' => $lang['Comment_add'], ! 'L_COMMENT' => $lang['Message_body'], ! 'L_COMMENT_TITLE' => $lang['Subject'], ! 'L_OPTIONS' => $lang['Options'], ! 'L_COMMENT_EXPLAIN' => sprintf( $lang['Comment_explain'], $pafiledb_config['max_comment_chars'] ), ! 'L_PREVIEW' => $lang['Preview'], ! 'L_SUBMIT' => $lang['Submit'], ! 'L_DOWNLOAD' => $lang['Download'], ! 'L_INDEX' => "<<", ! 'L_CHECK_MSG_LENGTH' => $lang['Check_message_length'], ! 'L_MSG_LENGTH_1' => $lang['Msg_length_1'], ! 'L_MSG_LENGTH_2' => $lang['Msg_length_2'], ! 'L_MSG_LENGTH_3' => $lang['Msg_length_3'], ! 'L_MSG_LENGTH_4' => $lang['Msg_length_4'], ! 'L_MSG_LENGTH_5' => $lang['Msg_length_5'], ! 'L_MSG_LENGTH_6' => $lang['Msg_length_6'], ! 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], ! 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], ! 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], ! 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], ! 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], ! 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], ! 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], ! 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], ! 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], ! 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], ! 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], ! 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], ! 'L_EMPTY_MESSAGE' => $lang['Empty_message'], ! 'L_FONT_COLOR' => $lang['Font_color'], ! 'L_COLOR_DEFAULT' => $lang['color_default'], ! 'L_COLOR_DARK_RED' => $lang['color_dark_red'], ! 'L_COLOR_RED' => $lang['color_red'], ! 'L_COLOR_ORANGE' => $lang['color_orange'], ! 'L_COLOR_BROWN' => $lang['color_brown'], ! 'L_COLOR_YELLOW' => $lang['color_yellow'], ! 'L_COLOR_GREEN' => $lang['color_green'], ! 'L_COLOR_OLIVE' => $lang['color_olive'], ! 'L_COLOR_CYAN' => $lang['color_cyan'], ! 'L_COLOR_BLUE' => $lang['color_blue'], ! 'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'], ! 'L_COLOR_INDIGO' => $lang['color_indigo'], ! 'L_COLOR_VIOLET' => $lang['color_violet'], ! 'L_COLOR_WHITE' => $lang['color_white'], ! 'L_COLOR_BLACK' => $lang['color_black'], ! 'L_FONT_SIZE' => $lang['Font_size'], ! 'L_FONT_TINY' => $lang['font_tiny'], ! 'L_FONT_SMALL' => $lang['font_small'], ! 'L_FONT_NORMAL' => $lang['font_normal'], ! 'L_FONT_LARGE' => $lang['font_large'], ! 'L_FONT_HUGE' => $lang['font_huge'], ! 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], ! 'L_STYLES_TIP' => $lang['Styles_tip'], ! 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), ! 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), ! 'U_FILE_NAME' => append_sid( pa_this_mxurl( 'action=file&item_id=' . $item_id ) ), ! 'S_POST_ACTION' => append_sid( pa_this_mxurl() ), ! 'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields ) ! ); + // // Show preview stuff if user clicked preview ! // if ( $preview ) { *************** *** 252,262 **** if ( !$html_on ) { ! // $comments_text = comment_suite($comments_text); $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); } if ( $bbcode_on ) { ! // $comments_text = comment_suite($comments_text); $comments_text = bbencode_second_pass( $comments_text, $comment_bbcode_uid ); // : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $comments_text); } --- 330,354 ---- if ( !$html_on ) { ! // ! // ! // $comments_text = preg_replace( '#(<)([\/]?.*?)(>)#is', "<\\2>", $comments_text ); } + // Now we run comment suite before checking for smilies + // so admins can add them in messages if they like + // and so smilies are not counted as images in sigs. + // this is done here again incase above conditions are + // not met. + if (!$pafiledb_config['allow_comment_images'] || !$pafiledb_config['allow_comment_links']) + { + $comments_text = $mx_kb_text_tools->remove_images_links( $comments_text, $pafiledb_config['allow_comment_images'], $pafiledb_config['no_comment_image_message'], $pafiledb_config['allow_comment_links'], $pafiledb_config['no_comment_link_message'] ); + } + if ( $bbcode_on ) { ! // ! // ! // $comments_text = bbencode_second_pass( $comments_text, $comment_bbcode_uid ); // : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $comments_text); } *************** *** 268,282 **** } ! // Now we run comment suite before checking for smilies ! // so admins can add them in messages if they like ! // and so smilies are not counted as images in sigs. ! // this is done here again incase above conditions are ! // not met. ! ! // $comments_text = comment_suite($comments_text); $comments_text = make_clickable( $comments_text ); // Parse smilies ! if ( $smilies_on ) { --- 360,371 ---- } ! // ! // Make Clickable ! // $comments_text = make_clickable( $comments_text ); + // // Parse smilies ! // if ( $smilies_on ) { *************** *** 286,308 **** $comments_text = str_replace( "\n", '<br />', $comments_text ); ! $pafiledb_template->assign_vars( array( 'PREVIEW' => true, ! 'COMMENT' => stripslashes( $_POST['message'] ), ! 'SUBJECT' => stripslashes( $_POST['subject'] ), ! 'PRE_COMMENT' => $comments_text ) ! ); } } if ( $submit ) { $length = strlen( $_POST['message'] ); ! $comments_text = str_replace( '<br />', "\n", $_POST['message'] ); $comment_bbcode_uid = make_bbcode_uid(); ! $comments_text = prepare_message( $comments_text, $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ); $comments_text = bbencode_first_pass( $comments_text, $comment_bbcode_uid ); ! ! $poster_id = intval( $userdata['user_id'] ); ! $title = stripslashes( $_POST['subject'] ); ! $time = time(); if ( $length > $pafiledb_config['max_comment_chars'] ) { --- 375,404 ---- $comments_text = str_replace( "\n", '<br />', $comments_text ); ! $pafiledb_template->assign_vars( array( ! 'PREVIEW' => true, ! 'COMMENT' => stripslashes( $_POST['message'] ), ! 'SUBJECT' => stripslashes( $_POST['subject'] ), ! 'PRE_COMMENT' => $comments_text ) ! ); } } + // ======================================================= + // Submit + // ======================================================= if ( $submit ) { + // + // vars + // $length = strlen( $_POST['message'] ); ! ! $title = ( !empty( $_POST['subject'] ) ) ? htmlspecialchars( trim ( $_POST['subject'] ) ) : ''; ! $comment_bbcode_uid = make_bbcode_uid(); ! $comments_text = str_replace( '<br />', "\n", $_POST['message'] ); ! $comments_text = prepare_message( trim($comments_text), $html_on, $bbcode_on, $smilies_on, $comment_bbcode_uid ); $comments_text = bbencode_first_pass( $comments_text, $comment_bbcode_uid ); ! if ( $length > $pafiledb_config['max_comment_chars'] ) { *************** *** 310,315 **** } ! $sql = "INSERT INTO " . PA_COMMENTS_TABLE . "(file_id, comments_text, comments_title, comments_time, comment_bbcode_uid, poster_id) ! VALUES('$file_id','" . str_replace( "\'", "''", $comments_text ) . "','" . str_replace( "\'", "''", $title ) . "','$time', '$comment_bbcode_uid','$poster_id')"; if ( !( $db->sql_query( $sql ) ) ) { --- 406,461 ---- } ! if ( $mx_request_vars->is_request('cid') ) ! { ! if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) ! { ! $sql = "UPDATE " . PA_COMMENTS_TABLE . " ! SET comments_text = '" . str_replace( "\'", "''", $comments_text ) . "', ! comments_title = '" . str_replace( "\'", "''", $title ) . "', ! comment_bbcode_uid = '" . $comment_bbcode_uid . "' ! WHERE comments_id = " . $mx_request_vars->request('cid', MX_TYPE_INT, 0) . " ! AND file_id = ". $item_id; ! } ! else ! { ! include( $module_root_path . 'pafiledb/includes/functions_comment.' . $phpEx ); ! $pafiledb_comments = new pafiledb_comments(); ! $pafiledb_comments->init( $item_id ); ! ! $pafiledb_comments->post( 'update', $cid, $title, $comments_text, $userdata['user_id'], $userdata['username'], 0, '', '', $comment_bbcode_uid); ! //$pafiledb_comments->insert_phpbb_post( $title, $comments_text, $forum_id, $userdata['user_id'], $userdata['username'], 0, $topic_id, $cid, '', '', $comment_bbcode_uid ); ! } ! ! } ! else ! { ! if ( $this->comments[$file_data['file_catid']]['internal_comments'] ) ! { ! $time = time(); ! $poster_id = intval( $userdata['user_id'] ); ! $sql = "INSERT INTO " . PA_COMMENTS_TABLE . "(file_id, comments_text, comments_title, comments_time, comment_bbcode_uid, poster_id) ! VALUES('$item_id','" . str_replace( "\'", "''", $comments_text ) . "','" . str_replace( "\'", "''", $title ) . "','$time', '$comment_bbcode_uid','$poster_id')"; ! } ! else ! { ! include( $module_root_path . 'pafiledb/includes/functions_comment.' . $phpEx ); ! $pafiledb_comments = new pafiledb_comments(); ! $pafiledb_comments->init( $item_id ); ! ! $pafiledb_comments->post( 'insert', '', $title, $comments_text, $userdata['user_id'], $userdata['username'], 0, '', '', $comment_bbcode_uid); ! //$pafiledb_comments->insert_phpbb_post( $title, $comments_text, $forum_id, $userdata['user_id'], $userdata['username'], 0, $topic_id, '', '', '', $comment_bbcode_uid ); ! ! } ! ! } ! ! // ! // Notification ! // ! ! ! // ! // Done ! // if ( !( $db->sql_query( $sql ) ) ) { *************** *** 317,329 **** } ! /* - orig ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.php?action=file&file_id=' . $file_id) . '">', '</a>'); ! */ ! // MX ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( 'action=file&file_id=' . $file_id ) ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } $this->display( $lang['Download'], 'pa_comment_posting.tpl' ); } } --- 463,478 ---- } ! $message = $lang['Comment_posted'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( 'action=file&file_id=' . $item_id ) ) . '">', '</a>' ); mx_message_die( GENERAL_MESSAGE, $message ); } + + // =================================================== + // assign var for navigation + // =================================================== + $this->generate_navigation( $file_data['file_catid'] ); + $this->display( $lang['Download'], 'pa_comment_posting.tpl' ); } + } Index: pa_user_upload.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_user_upload.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pa_user_upload.php 24 Oct 2005 20:16:56 -0000 1.13 --- pa_user_upload.php 8 Dec 2005 15:15:13 -0000 1.14 *************** *** 35,47 **** global $_REQUEST, $_POST, $pafiledb_config, $phpbb_root_path; global $pafiledb_template, $db, $lang, $userdata, $user_ip, $phpEx, $pafiledb_functions; - // MX global $mx_root_path, $module_root_path, $is_block, $phpEx; // ======================================================= // Get Vars // ======================================================= - /* - orig - include($phpbb_root_path . 'pafiledb/includes/functions_field.'.$phpEx); - */ - // MX include( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); --- 35,43 ---- global $_REQUEST, $_POST, $pafiledb_config, $phpbb_root_path; global $pafiledb_template, $db, $lang, $userdata, $user_ip, $phpEx, $pafiledb_functions; global $mx_root_path, $module_root_path, $is_block, $phpEx; + // ======================================================= // Get Vars // ======================================================= include( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); *************** *** 54,58 **** $mirrors = ( isset( $_POST['mirrors'] ) ) ? true : 0; ! $dropmenu = ( !$cat_id ) ? $this->jumpmenu_option( 0, 0, '', true, true ) : $this->jumpmenu_option( 0, 0, array( $cat_id => 1 ), true, true ); if ( !empty( $cat_id ) ) --- 50,54 ---- $mirrors = ( isset( $_POST['mirrors'] ) ) ? true : 0; ! $dropmenu = ( !$cat_id ) ? $this->generate_jumpbox( 0, 0, '', true, true ) : $this-generate_jumpboxn( 0, 0, array( $cat_id => 1 ), true, true ); if ( !empty( $cat_id ) ) *************** *** 62,69 **** if ( !$userdata['session_logged_in'] ) { - /* - orig - redirect(append_sid("login.$phpEx?redirect=dload.$phpEx?action=user_upload&cat_id=" . $cat_id, true)); - */ - // MX // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=user_upload&cat_id=" . $cat_id), true)); } --- 58,61 ---- *************** *** 79,86 **** if ( !$userdata['session_logged_in'] ) { - /* - orig - redirect(append_sid("login.$phpEx?redirect=dload.$phpEx?action=user_upload", true)); - */ - // MX // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=user_upload"), true)); } --- 71,74 ---- *************** *** 140,157 **** $pa_pm = array(); // Populate the pa_pm variable $pa_pm = pa_get_pm_data( $temp_id ); // Compose post header $pa_message_tmp = pa_compose_pm( $pa_pm ); $pa_message = $pa_message_tmp['message']; $pa_update_message = $pa_message_tmp['update_message']; // PM notify $pa_admins = pa_get_admins( true ); for ($i = 0; $i < count($pa_admins) || $i < 10; $i++) { ! pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'new' ); } } --- 128,151 ---- $pa_pm = array(); + // // Populate the pa_pm variable + // $pa_pm = pa_get_pm_data( $temp_id ); + // // Compose post header + // $pa_message_tmp = pa_compose_pm( $pa_pm ); $pa_message = $pa_message_tmp['message']; $pa_update_message = $pa_message_tmp['update_message']; + // // PM notify + // $pa_admins = pa_get_admins( true ); for ($i = 0; $i < count($pa_admins) || $i < 10; $i++) { ! pa_notify( $pafiledb_config['notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'new' ); } } *************** *** 164,181 **** $pa_pm = array(); // Populate the pa_pm variable $pa_pm = pa_get_pm_data( $file_id ); // Compose post header $pa_message_tmp = pa_compose_pm( $pa_pm ); $pa_message = $pa_message_tmp['message']; $pa_update_message = $pa_message_tmp['update_message']; // PM notify $pa_admins = pa_get_admins( true); for ($i = 0; $i < count($pa_admins) || $i < 10; $i++) { ! pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'edited' ); } --- 158,181 ---- $pa_pm = array(); + // // Populate the pa_pm variable + // $pa_pm = pa_get_pm_data( $file_id ); + // // Compose post header + // $pa_message_tmp = pa_compose_pm( $pa_pm ); $pa_message = $pa_message_tmp['message']; $pa_update_message = $pa_message_tmp['update_message']; + // // PM notify + // $pa_admins = pa_get_admins( true); for ($i = 0; $i < count($pa_admins) || $i < 10; $i++) { ! pa_notify( $pafiledb_config['notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'edited' ); } *************** *** 183,190 **** } - /* - orig - $message = $lang['Fileadded'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid("dload.php?action=user_upload") . '">', '</a>'); - */ - // MX mx_message_die( GENERAL_MESSAGE, $message ); } --- 183,186 ---- *************** *** 203,207 **** $file_website = ''; $file_posticons = $pafiledb_functions->post_icons(); ! $file_cat_list = ( !$cat_id ) ? $this->jumpmenu_option( 0, 0, '', true ) : $this->jumpmenu_option( 0, 0, array( $cat_id => 1 ), true, true ); $file_license = $pafiledb_functions->license_list(); $pin_checked_yes = ''; --- 199,203 ---- $file_website = ''; $file_posticons = $pafiledb_functions->post_icons(); ! $file_cat_list = ( !$cat_id ) ? $this->generate_jumpbox( 0, 0, '', true ) : $this-generate_jumpbox( 0, 0, array( $cat_id => 1 ), true, true ); $file_license = $pafiledb_functions->license_list(); $pin_checked_yes = ''; *************** *** 243,247 **** $file_website = $file_info['file_docsurl']; $file_posticons = $pafiledb_functions->post_icons( $file_info['file_posticon'] ); ! $file_cat_list = $this->jumpmenu_option( 0, 0, array( $file_info['file_catid'] => 1 ), true ); $file_license = $pafiledb_functions->license_list( $file_info['file_license'] ); $pin_checked_yes = ( $file_info['file_pin'] ) ? ' checked' : ''; --- 239,243 ---- $file_website = $file_info['file_docsurl']; $file_posticons = $pafiledb_functions->post_icons( $file_info['file_posticon'] ); ! $file_cat_list = $this->generate_jumpbox( 0, 0, array( $file_info['file_catid'] => 1 ), true ); $file_license = $pafiledb_functions->license_list( $file_info['file_license'] ); $pin_checked_yes = ( $file_info['file_pin'] ) ? ' checked' : ''; *************** *** 266,276 **** $pafiledb_template->assign_vars( array( - /* - orig - 'S_ADD_FILE_ACTION' => append_sid("dload.$phpEx"), - */ - // MX 'S_ADD_FILE_ACTION' => append_sid( pa_this_mxurl() ), ! 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'FILESIZE' => intval( $pafiledb_config['max_file_size'] ), 'FILE_NAME' => $file_name, --- 262,268 ---- $pafiledb_template->assign_vars( array( 'S_ADD_FILE_ACTION' => append_sid( pa_this_mxurl() ), ! 'DOWNLOAD' => $pafiledb_config['module_name'], 'FILESIZE' => intval( $pafiledb_config['max_file_size'] ), 'FILE_NAME' => $file_name, *************** *** 292,299 **** 'PIN_CHECKED_NO' => $pin_checked_no, - /* - orig - 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), - */ - // MX 'L_INDEX' => "<<", 'L_UPLOAD' => $lang['User_upload'], --- 284,287 ---- *************** *** 345,353 **** 'S_HIDDEN_FIELDS' => $s_hidden_fields, - /* - orig - 'U_INDEX' => append_sid('index.'.$phpEx), - 'U_DOWNLOAD' => append_sid('dload.'.$phpEx)) - */ - // MX 'MODE' => $mode, 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), --- 333,336 ---- *************** *** 360,362 **** } ! ?> \ No newline at end of file --- 343,345 ---- } ! ?> \ No newline at end of file Index: pa_file.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_file.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pa_file.php 24 Oct 2005 20:16:56 -0000 1.14 --- pa_file.php 8 Dec 2005 15:15:13 -0000 1.15 *************** *** 28,31 **** --- 28,32 ---- Please read the license included with this script for more information. */ + class pafiledb_file extends pafiledb_public { *************** *** 33,48 **** { global $pafiledb_template, $lang, $board_config, $phpEx, $pafiledb_config, $db, $images; ! global $_REQUEST, $phpbb_root_path, $userdata, $db, $pafiledb_functions; ! // MX ! global $mx_root_path, $module_root_path, $is_block, $phpEx; ! if ( isset( $_REQUEST['file_id'] ) ) ! { ! $file_id = intval( $_REQUEST['file_id'] ); ! } ! else { mx_message_die( GENERAL_MESSAGE, $lang['File_not_exist'] ); ! } // ======================================================= // file id is not set, give him/her a nice error message --- 34,50 ---- { global $pafiledb_template, $lang, $board_config, $phpEx, $pafiledb_config, $db, $images; ! global $phpbb_root_path, $userdata, $db, $pafiledb_functions; ! global $mx_root_path, $module_root_path, $is_block, $phpEx, $mx_request_vars; ! // ======================================================= ! // Request vars ! // ======================================================= ! $file_id = $mx_request_vars->request('file_id', MX_TYPE_INT, ''); ! ! if ( empty( $file_id ) ) { mx_message_die( GENERAL_MESSAGE, $lang['File_not_exist'] ); ! } ! // ======================================================= // file id is not set, give him/her a nice error message *************** *** 79,82 **** --- 81,85 ---- mx_message_die( GENERAL_ERROR, 'Couldnt Query file info', '', __LINE__, __FILE__, $sql ); } + // =================================================== // file doesn't exist' *************** *** 87,90 **** --- 90,94 ---- } $db->sql_freeresult( $result ); + // =================================================== // Pafiledb auth for viewing file *************** *** 92,262 **** if ( ( !$this->auth[$file_data['file_catid']]['auth_view_file'] ) ) { ! // if ( !$userdata['session_logged_in'] ) ! // { ! /* - orig ! redirect(append_sid("login.$phpEx?redirect=dload.$phpEx?action=file&file_id=" . $file_id, true)); ! */ ! // MX ! // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=file&file_id=" . $file_id), true)); ! // } $message = sprintf( $lang['Sorry_auth_view'], $this->auth[$file_data['file_catid']]['auth_view_file_type'] ); mx_message_die( GENERAL_MESSAGE, $message ); } - // - // - // User authorisation levels output - // - $pa_auth_can = '<br />' . ( ( $this->auth[$file_data['file_catid']]['auth_upload'] ) ? $lang['PA_Rules_upload_can'] : $lang['PA_Rules_upload_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_view_file'] ) ? $lang['PA_Rules_view_file_can'] : $lang['PA_Rules_view_file_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_edit_file'] ) ? $lang['PA_Rules_edit_file_can'] : $lang['PA_Rules_edit_file_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_delete_file'] ) ? $lang['PA_Rules_delete_file_can'] : $lang['PA_Rules_delete_file_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_view_comment'] ) ? $lang['PA_Rules_view_comment_can'] : $lang['PA_Rules_view_comment_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_post_comment'] ) ? $lang['PA_Rules_post_comment_can'] : $lang['PA_Rules_post_comment_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_rate'] ) ? $lang['PA_Rules_rate_can'] : $lang['PA_Rules_rate_cannot'] ) . '<br />'; - $pa_auth_can .= ( ( $this->auth[$file_data['file_catid']]['auth_download'] ) ? $lang['PA_Rules_download_can'] : $lang['PA_Rules_download_cannot'] ) . '<br />'; - - if ( $this->auth[$file_data['file_catid']]['auth_mod'] ) - { - $pa_auth_can .= $lang['PA_Rules_moderate_can']; - } - - $this->generate_category_nav( $file_data['file_catid'] ); - $pafiledb_template->assign_vars( array( - /* - orig - 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), - */ - // MX 'L_INDEX' => "<<", - - 'S_AUTH_LIST' => $pa_auth_can, - /* - orig - 'U_INDEX' => append_sid('index.'.$phpEx), - 'U_DOWNLOAD_HOME' => append_sid('dload.'.$phpEx), - */ - // MX 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['settings_dbname'] ) ! ); // =================================================== // Prepare file info to display them // =================================================== $file_time = create_date( $board_config['default_dateformat'], $file_data['file_time'], $board_config['board_timezone'] ); - $file_last_download = ( $file_data['file_last'] ) ? create_date( $board_config['default_dateformat'], $file_data['file_last'], $board_config['board_timezone'] ) : $lang['never']; - $file_update_time = ( $file_data['file_update_time'] ) ? create_date( $board_config['default_dateformat'], $file_data['file_update_time'], $board_config['board_timezone'] ) : $lang['never']; - $file_author = trim( $file_data['file_creator'] ); - $file_version = trim( $file_data['file_version'] ); - $file_screenshot_url = trim( $file_data['file_ssurl'] ); - $file_website_url = trim( $file_data['file_docsurl'] ); - - $file_rating = ( $file_data['rating'] != 0 ) ? round( $file_data['rating'], 2 ) . ' / 10' : $lang['Not_rated']; - - /* - orig - $file_download_link = ($file_data['file_license'] > 0) ? append_sid('dload.php?action=license&license_id=' . $file_data['file_license'] . '&file_id=' . $file_id) : append_sid('dload.php?action=download&file_id=' . $file_id); - */ - // MX $file_download_link = ( $file_data['file_license'] > 0 ) ? append_sid( pa_this_mxurl( 'action=license&license_id=' . $file_data['file_license'] . '&file_id=' . $file_id ) ) : append_sid( pa_this_mxurl( 'action=download&file_id=' . $file_id, 1 ) ); - $file_size = $pafiledb_functions->get_file_size( $file_id, $file_data ); - /* - orig - $file_poster = ( $file_data['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid('profile.'.$phpEx.'?mode=viewprofile&' . POST_USERS_URL . '=' . $file_data['user_id']) . '">' : ''; - */ - // MX $file_poster = ( $file_data['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid( $phpbb_root_path . 'profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $file_data['user_id'] ) . '">' : ''; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? $file_data['username'] : $lang['Guest']; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? '</a>' : ''; ! if ( $file_data['cat_allow_ratings'] ) ! { ! $pafiledb_template->assign_block_vars( 'show_ratings', array( ) ); ! } ! ! $pafiledb_template->assign_vars( array( 'L_CLICK_HERE' => $lang['Click_here'], ! 'L_AUTHOR' => $lang['Creator'], ! 'L_VERSION' => $lang['Version'], ! 'L_SCREENSHOT' => $lang['Scrsht'], ! 'L_WEBSITE' => $lang['Docs'], ! 'L_FILE' => $lang['File'], ! 'L_DESC' => $lang['Desc'], ! 'L_VOTES' => $lang['Votes'], ! 'L_DATE' => $lang['Date'], ! 'L_UPDATE_TIME' => $lang['Update_time'], ! 'L_LASTTDL' => $lang['Lastdl'], ! 'L_DLS' => $lang['Dls'], ! 'L_RATING' => $lang['DlRating'], ! 'L_SIZE' => $lang['File_size'], ! 'L_EDIT' => $lang['Editfile'], ! 'L_DELETE' => $lang['Deletefile'], ! 'L_DOWNLOAD' => $lang['Downloadfile'], ! 'L_RATE' => $lang['Rate'], ! 'L_EMAIL' => $lang['Emailfile'], ! 'L_SUBMITED_BY' => $lang['Submiter'], ! ! 'SHOW_AUTHOR' => ( !empty( $file_author ) ) ? true : false, ! 'SHOW_VERSION' => ( !empty( $file_version ) ) ? true : false, ! 'SHOW_SCREENSHOT' => ( !empty( $file_screenshot_url ) ) ? true : false, ! 'SHOW_WEBSITE' => ( !empty( $file_website_url ) ) ? true : false, ! 'SS_AS_LINK' => ( $file_data['file_sshot_link'] ) ? true : false, ! 'FILE_NAME' => $file_data['file_name'], ! 'FILE_LONGDESC' => nl2br( $file_data['file_longdesc'] ), ! 'FILE_SUBMITED_BY' => $file_poster, ! 'FILE_AUTHOR' => $file_author, ! /* - orig ! 'FILE_VERSION' => $file_author, ! */ ! // BUGFIX ! 'FILE_VERSION' => $file_version, ! 'FILE_SCREENSHOT' => $file_screenshot_url, ! 'FILE_WEBSITE' => $file_website_url, ! 'AUTH_EDIT' => ( ( $this->auth[$file_data['file_catid']]['auth_edit_file'] && $file_data['user_id'] == $userdata['user_id'] ) || $this->auth[$file_data['file_catid']]['auth_mod'] ) ? true : false, ! 'AUTH_DELETE' => ( ( $this->auth[$file_data['file_catid']]['auth_delete_file'] && $file_data['user_id'] == $userdata['user_id'] ) || $this->auth[$file_data['file_catid']]['auth_mod'] ) ? true : false, ! 'AUTH_DOWNLOAD' => ( $this->auth[$file_data['file_catid']]['auth_download'] ) ? true : false, ! 'AUTH_RATE' => ( $this->auth[$file_data['file_catid']]['auth_rate'] && $file_data['cat_allow_ratings'] ) ? true : false, ! 'AUTH_EMAIL' => ( $this->auth[$file_data['file_catid']]['auth_email'] ) ? true : false, ! 'INCLUDE_COMMENTS' => ( $this->auth[$file_data['file_catid']]['auth_view_comment'] && $file_data['cat_allow_comments'] ) ? true : false, ! 'DELETE_IMG' => $phpbb_root_path . $images['icon_delpost'], ! 'EDIT_IMG' => $phpbb_root_path . $images['icon_edit'], ! 'DOWNLOAD_IMG' => $images['pa_download'], ! 'RATE_IMG' => $images['pa_rate'], ! 'EMAIL_IMG' => $images['pa_email'], ! 'FILE_VOTES' => $file_data['total_votes'], ! 'TIME' => $file_time, ! 'UPDATE_TIME' => ( $file_data['file_update_time'] != $file_data['file_time'] ) ? $file_update_time : $lang['never'], ! 'RATING' => $file_rating, ! 'FILE_DLS' => intval( $file_data['file_dls'] ), ! 'FILE_SIZE' => $file_size, ! 'LAST' => $file_last_download, ! 'U_DOWNLOAD' => $file_download_link, ! /* - orig ! 'U_RATE' => append_sid('dload.php?action=rate&file_id=' . $file_id), ! 'U_EMAIL' => append_sid('dload.php?action=email&file_id=' . $file_id)) ! */ ! // MX ! 'U_DELETE' => append_sid( pa_this_mxurl( 'action=user_upload&do=delete&file_id=' . $file_id ) ), ! 'U_EDIT' => append_sid( pa_this_mxurl( 'action=user_upload&file_id=' . $file_id ) ), ! 'U_RATE' => append_sid( pa_this_mxurl( 'action=rate&file_id=' . $file_id ) ), ! 'U_EMAIL' => append_sid( pa_this_mxurl( 'action=email&file_id=' . $file_id ) ) ) ! ); - /* - orig - include($phpbb_root_path . 'pafiledb/includes/functions_field.'.$phpEx); - */ - // MX include( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); $custom_field = new custom_field(); --- 96,190 ---- if ( ( !$this->auth[$file_data['file_catid']]['auth_view_file'] ) ) { ! /* ! if ( !$userdata['session_logged_in'] ) ! { ! mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=".pa_this_mxurl("action=file&file_id=" . $file_id), true)); ! } ! */ $message = sprintf( $lang['Sorry_auth_view'], $this->auth[$file_data['file_catid']]['auth_view_file_type'] ); mx_message_die( GENERAL_MESSAGE, $message ); } $pafiledb_template->assign_vars( array( 'L_INDEX' => "<<", 'U_INDEX' => append_sid( $mx_root_path . 'index.' . $phpEx ), 'U_DOWNLOAD_HOME' => append_sid( pa_this_mxurl() ), 'FILE_NAME' => $file_data['file_name'], ! 'DOWNLOAD' => $pafiledb_config['module_name'] ) ! ); ! // =================================================== // Prepare file info to display them // =================================================== $file_time = create_date( $board_config['default_dateformat'], $file_data['file_time'], $board_config['board_timezone'] ); $file_last_download = ( $file_data['file_last'] ) ? create_date( $board_config['default_dateformat'], $file_data['file_last'], $board_config['board_timezone'] ) : $lang['never']; $file_update_time = ( $file_data['file_update_time'] ) ? create_date( $board_config['default_dateformat'], $file_data['file_update_time'], $board_config['board_timezone'] ) : $lang['never']; $file_author = trim( $file_data['file_creator'] ); $file_version = trim( $file_data['file_version'] ); $file_screenshot_url = trim( $file_data['file_ssurl'] ); $file_website_url = trim( $file_data['file_docsurl'] ); $file_download_link = ( $file_data['file_license'] > 0 ) ? append_sid( pa_this_mxurl( 'action=license&license_id=' . $file_data['file_license'] . '&file_id=' . $file_id ) ) : append_sid( pa_this_mxurl( 'action=download&file_id=' . $file_id, 1 ) ); $file_size = $pafiledb_functions->get_file_size( $file_id, $file_data ); $file_poster = ( $file_data['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid( $phpbb_root_path . 'profile.' . $phpEx . '?mode=viewprofile&' . POST_USERS_URL . '=' . $file_data['user_id'] ) . '">' : ''; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? $file_data['username'] : $lang['Guest']; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? '</a>' : ''; ! $pafiledb_template->assign_vars( array( ! 'L_CLICK_HERE' => $lang['Click_here'], ! 'L_AUTHOR' => $lang['Creator'], ! 'L_VERSION' => $lang['Version'], ! 'L_SCREENSHOT' => $lang['Scrsht'], ! 'L_WEBSITE' => $lang['Docs'], ! 'L_FILE' => $lang['File'], ! 'L_DESC' => $lang['Desc'], ! 'L_DATE' => $lang['Date'], ! 'L_UPDATE_TIME' => $lang['Update_time'], ! 'L_LASTTDL' => $lang['Lastdl'], ! 'L_DLS' => $lang['Dls'], ! 'L_SIZE' => $lang['File_size'], ! 'L_EDIT' => $lang['Editfile'], ! 'L_DELETE' => $lang['Deletefile'], ! 'L_DOWNLOAD' => $lang['Downloadfile'], ! 'L_EMAIL' => $lang['Emailfile'], ! 'L_SUBMITED_BY' => $lang['Submiter'], ! 'SHOW_AUTHOR' => ( !empty( $file_author ) ) ? true : false, ! 'SHOW_VERSION' => ( !empty( $file_version ) ) ? true : false, ! 'SHOW_SCREENSHOT' => ( !empty( $file_screenshot_url ) ) ? true : false, ! 'SHOW_WEBSITE' => ( !empty( $file_website_url ) ) ? true : false, ! 'SS_AS_LINK' => ( $file_data['file_sshot_link'] ) ? true : false, ! 'FILE_NAME' => $file_data['file_name'], ! 'FILE_LONGDESC' => nl2br( $file_data['file_longdesc'] ), ! 'FILE_SUBMITED_BY' => $file_poster, ! 'FILE_AUTHOR' => $file_author, ! 'FILE_VERSION' => $file_version, ! 'FILE_SCREENSHOT' => $file_screenshot_url, ! 'FILE_WEBSITE' => $file_website_url, ! 'AUTH_EDIT' => ( ( $this->auth[$file_data['file_catid']]['auth_edit_file'] && $file_data['user_id'] == $userdata['user_id'] ) || $this->auth[$file_data['file_catid']]['auth_mod'] ) ? true : false, ! 'AUTH_DELETE' => ( ( $this->auth[$file_data['file_catid']]['auth_delete_file'] && $file_data['user_id'] == $userdata['user_id'] ) || $this->auth[$file_data['file_catid']]['auth_mod'] ) ? true : false, ! 'AUTH_DOWNLOAD' => ( $this->auth[$file_data['file_catid']]['auth_download'] ) ? true : false, ! 'AUTH_EMAIL' => ( $this->auth[$file_data['file_catid']]['auth_email'] ) ? true : false, ! ! 'DELETE_IMG' => $phpbb_root_path . $images['icon_delpost'], ! 'EDIT_IMG' => $phpbb_root_path . $images['icon_edit'], ! 'DOWNLOAD_IMG' => $images['pa_download'], ! 'EMAIL_IMG' => $images['pa_email'], ! 'TIME' => $file_time, ! 'UPDATE_TIME' => ( $file_data['file_update_time'] != $file_data['file_time'] ) ? $file_update_time : $lang['never'], ! 'FILE_DLS' => intval( $file_data['file_dls'] ), ! 'FILE_SIZE' => $file_size, ! 'LAST' => $file_last_download, ! 'U_DOWNLOAD' => $file_download_link, ! 'U_DELETE' => append_sid( pa_this_mxurl( 'action=user_upload&do=delete&file_id=' . $file_id ) ), ! 'U_EDIT' => append_sid( pa_this_mxurl( 'action=user_upload&file_id=' . $file_id ) ), ! 'U_EMAIL' => append_sid( pa_this_mxurl( 'action=email&file_id=' . $file_id ) ) ) ! ); include( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); $custom_field = new custom_field(); *************** *** 264,276 **** $custom_field->display_data( $file_id ); ! if ( $this->auth[$file_data['file_catid']]['auth_view_comment'] && $file_data['cat_allow_comments'] ) { ! /* - orig ! include($phpbb_root_path . 'pafiledb/includes/functions_comment.'.$phpEx); !... [truncated message content] |