Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22598/modules/mx_pafiledb/pafiledb/includes Modified Files: functions.php functions_admin.php functions_comment.php functions_pafiledb.php pafiledb_constants.php Log Message: Finalizing module Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** functions.php 7 Jun 2006 20:29:52 -0000 1.22 --- functions.php 17 Jun 2006 20:13:22 -0000 1.23 *************** *** 114,119 **** include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! $pafiledb_template->set_filenames( array( 'smiliesbody' => 'posting_smilies.tpl' ) ! ); } --- 114,118 ---- include( $mx_root_path . 'includes/page_header.' . $phpEx ); ! $pafiledb_template->set_filenames( array( 'smiliesbody' => 'posting_smilies.tpl' ) ); } *************** *** 152,159 **** $pafiledb_template->assign_block_vars( 'smilies_row.smilies_col', array( ! 'SMILEY_CODE' => $data['code'], ! 'SMILEY_IMG' => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ) ! ); $s_colspan = max( $s_colspan, $col + 1 ); --- 151,158 ---- $pafiledb_template->assign_block_vars( 'smilies_row.smilies_col', array( ! 'SMILEY_CODE' => $data['code'], ! 'SMILEY_IMG' => $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url, ! 'SMILEY_DESC' => $data['emoticon'] ! )); $s_colspan = max( $s_colspan, $col + 1 ); *************** *** 179,191 **** $pafiledb_template->assign_vars( array( ! 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ) ! ); } ! $pafiledb_template->assign_vars( array( 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ) ! ); } } --- 178,191 ---- $pafiledb_template->assign_vars( array( ! 'L_MORE_SMILIES' => $lang['More_emoticons'], ! 'U_MORE_SMILIES' => append_sid( $phpbb_root_path . "posting.$phpEx?mode=smilies" ) ! )); } ! $pafiledb_template->assign_vars( array( ! 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan ! )); } } *************** *** 298,302 **** { global $pafiledb_config; - // MX global $mx_root_path, $module_root_path, $is_block, $phpEx; --- 298,301 ---- *************** *** 336,340 **** { global $phpbb_root_path, $lang, $phpEx, $board_config, $pafiledb_config, $userdata; - // MX global $pafiledb, $cat_id, $mx_root_path, $module_root_path, $is_block, $phpEx; --- 335,338 ---- *************** *** 636,640 **** /** ! * mx_kb_user_info * * This class is used to determin Browser and operating system info of the user --- 634,638 ---- /** ! * pafiledb_user_info * * This class is used to determin Browser and operating system info of the user *************** *** 861,865 **** /** ! * mx_pafiledb_text_tools * * Description --- 859,863 ---- /** ! * mx_pa_text_tools * * Description *************** *** 869,873 **** * */ - class mx_pa_text_tools { --- 867,870 ---- *************** *** 1173,1178 **** } } ! $return_data = array($mytext, $do_trunc); ! return $return_data; } } --- 1170,1175 ---- } } ! //$return_data = array($mytext, $do_trunc); ! return $mytext; } } *************** *** 1188,1191 **** --- 1185,1194 ---- define('MX_DELETED_NOTIFICATION' , 14); + // + // Includes + // + include_once( $phpbb_root_path . 'includes/bbcode.'.$phpEx); + include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); + /** * mx_pa_notification. *************** *** 1237,1247 **** function init( $item_id = 0) { ! global $db, $lang, $pafiledb_custom_field; ! ! // ! // Includes ! // ! include_once( $phpbb_root_path . 'includes/bbcode.'.$phpEx); ! include_once( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); // ======================================================= --- 1240,1244 ---- function init( $item_id = 0) { ! global $db, $lang, $mx_pa_custom_field, $module_root_path, $phpbb_root_path, $phpEx, $mx_pafiledb, $userdata; // ======================================================= *************** *** 1256,1260 **** { include_once( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); ! $this->custom_field = new pafiledb_custom_field(); $this->custom_field->init(); } --- 1253,1257 ---- { include_once( $module_root_path . 'pafiledb/includes/functions_field.' . $phpEx ); ! $this->custom_field = new custom_field(); $this->custom_field->init(); } *************** *** 1266,1289 **** // $this->langs['item_not_exist'] = $lang['File_not_exist']; ! $this->langs['module_title'] = $lang['KB_title']; ! $this->langs['notify_subject_new'] = $lang['KB_notify_subject_new']; ! $this->langs['notify_subject_edited'] = $lang['KB_notify_subject_edited']; ! $this->langs['notify_subject_approved'] = $lang['KB_notify_subject_approved']; ! $this->langs['notify_subject_unapproved'] = $lang['KB_notify_subject_unapproved']; ! $this->langs['notify_subject_deleted'] = $lang['KB_notify_subject_deleted']; ! $this->langs['notify_new_body'] = $lang['KB_notify_new_body']; ! $this->langs['notify_edited_body'] = $lang['KB_notify_edited_body']; ! $this->langs['notify_approved_body'] = $lang['KB_notify_approved_body']; ! $this->langs['notify_unapproved_body'] = $lang['KB_notify_unapproved_body']; ! $this->langs['notify_deleted_body'] = $lang['KB_notify_deleted_body']; ! $this->langs['item_title'] = $lang['Article_title']; ! $this->langs['author'] = $lang['Author']; ! $this->langs['item_description'] = $lang['Article_description']; ! $this->langs['item_type'] = $lang['Article_type']; $this->langs['category'] = $lang['Category']; ! $this->langs['read_full_item'] = $lang['Read_full_article']; $this->langs['edited_item_info'] = $lang['Edited_Article_info']; --- 1263,1286 ---- // $this->langs['item_not_exist'] = $lang['File_not_exist']; ! $this->langs['module_title'] = $lang['PA_title']; ! $this->langs['notify_subject_new'] = $lang['PA_notify_subject_new']; ! $this->langs['notify_subject_edited'] = $lang['PA_notify_subject_edited']; ! $this->langs['notify_subject_approved'] = $lang['PA_notify_subject_approved']; ! $this->langs['notify_subject_unapproved'] = $lang['PA_notify_subject_unapproved']; ! $this->langs['notify_subject_deleted'] = $lang['PA_notify_subject_deleted']; ! $this->langs['notify_new_body'] = $lang['PA_notify_new_body']; ! $this->langs['notify_edited_body'] = $lang['PA_notify_edited_body']; ! $this->langs['notify_approved_body'] = $lang['PA_notify_approved_body']; ! $this->langs['notify_unapproved_body'] = $lang['PA_notify_unapproved_body']; ! $this->langs['notify_deleted_body'] = $lang['PA_notify_deleted_body']; ! $this->langs['item_title'] = $lang['File']; ! $this->langs['author'] = $lang['Creator']; ! $this->langs['item_description'] = $lang['Desc']; ! $this->langs['item_type'] = ''; $this->langs['category'] = $lang['Category']; ! $this->langs['read_full_item'] = $lang['PA_goto']; $this->langs['edited_item_info'] = $lang['Edited_Article_info']; *************** *** 1292,1296 **** case 'oracle': $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORIES_TABLE . " AS c, " . PA_COMMENTS_TABLE . " AS cm WHERE f.file_id = r.votes_file(+) AND f.user_id = u.user_id(+) --- 1289,1293 ---- case 'oracle': $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORY_TABLE . " AS c, " . PA_COMMENTS_TABLE . " AS cm WHERE f.file_id = r.votes_file(+) AND f.user_id = u.user_id(+) *************** *** 1303,1311 **** default: $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_CATEGORIES_TABLE . " AS c LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f.file_id = c.file_id ! WHERE c.cat_id = a.file_catid AND f.file_id = '" . $item_id . "' GROUP BY f.file_id "; --- 1300,1308 ---- default: $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_CATEGORY_TABLE . " AS cat LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f.file_id = c.file_id ! WHERE cat.cat_id = f.file_catid AND f.file_id = '" . $item_id . "' GROUP BY f.file_id "; *************** *** 1373,1377 **** * @param unknown_type $smilies_on */ ! function notify( $mode = MX_PM_MODE, $action = MX_NEW_NOTIFICATION, $to_id, $from_id = '', $subject = '', $message = '', $html_on = 0, $bbcode_on = 1, $smilies_on = 1 ) { global $lang, $board_config, $pafiledb_config, $db, $module_root_path, $phpbb_root_path, $mx_root_path, $phpEx, $userdata; --- 1370,1374 ---- * @param unknown_type $smilies_on */ ! function notify( $mode = MX_PM_MODE, $action = MX_NEW_NOTIFICATION, $to_id = 0, $from_id = '', $subject = '', $message = '', $html_on = 1, $bbcode_on = 1, $smilies_on = 1 ) { global $lang, $board_config, $pafiledb_config, $db, $module_root_path, $phpbb_root_path, $mx_root_path, $phpEx, $userdata; *************** *** 1407,1494 **** $this->smilies_on = $smilies_on; ! // ! // Compose Subject ! // ! if (empty($subject)) ! { ! // ! // Auto generated subject ! // ! switch ( $action ) ! { ! case MX_NEW_NOTIFICATION: ! $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_new']; ! break; ! ! case MX_EDITED_NOTIFICATION: ! $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_edited']; ! break; ! ! case MX_APPROVED_NOTIFICATION: ! $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_approved']; ! break; ! ! case MX_UNAPPROVED_NOTIFICATION: ! $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_unapproved']; ! break; ! ! case MX_DELETED_NOTIFICATION: ! $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_deleted']; ! break; ! ! default: ! mx_message_die(GENERAL_ERROR, 'Bad notify action'); ! } ! } ! else ! { ! // ! // Custom subject ! // ! $this->subject = $subject; ! } // ! // Compose Message // ! if (empty($message)) { - // - // Auto generated message - // $this->_compose_auto_note($action); - - switch ( $action ) - { - case MX_NEW_NOTIFICATION: - $this->message = $this->langs['notify_new_body'] . '\n\n' . $this->auto_message; - break; - - case MX_EDITED_NOTIFICATION: - $this->message = $this->langs['notify_edited_body'] . '\n\n' . $this->auto_message_update . '\n' . $this->auto_message; - break; - - case MX_APPROVED_NOTIFICATION: - $this->message = $this->langs['notify_approved_body'] . '\n\n' . $this->auto_message; - break; - - case MX_UNAPPROVED_NOTIFICATION: - $this->message = $this->langs['notify_unapproved_body'] . '\n\n' . $this->auto_message; - break; - - case MX_DELETED_NOTIFICATION: - $this->message = $this->langs['notify_deleted_body'] . '\n\n' . $this->auto_message; - break; - - default: - mx_message_die(GENERAL_ERROR, 'Bad notify action'); - } - } - else - { - // - // Custom message - // - $this->message = $message; } --- 1404,1416 ---- $this->smilies_on = $smilies_on; ! $this->subject = $subject; ! $this->message = $message; // ! // Compose Subject // ! if (empty($this->subject) || empty($this->message)) { $this->_compose_auto_note($action); } *************** *** 1499,1503 **** { $this->to_id = $id; - $mx_kb->debug($this->to_id, '', false); // --- 1421,1424 ---- *************** *** 1574,1578 **** } ! $privmsg_message = prepare_message($this->message, $this->html_on, $this->bbcode_on, $this->smilies_on, $bbcode_uid); $privmsg_message = str_replace('\\\n', '\n', $privmsg_message); } --- 1495,1499 ---- } ! $privmsg_message = prepare_message(addslashes($this->message), $this->html_on, $this->bbcode_on, $this->smilies_on, $bbcode_uid); $privmsg_message = str_replace('\\\n', '\n', $privmsg_message); } *************** *** 1805,1828 **** global $lang, $phpEx; - $search = array ( "'&(quot|#34);'i", // Replace HTML entities - "'&(amp|#38);'i", - "'&(lt|#60);'i", - "'&(gt|#62);'i" - ); - - $replace = array ( "\"", - "&", - "<", - ">" - ); - // // Compose phpBB post header // ! $temp_url = PORTAL_URL . pa_this_mxurl("mode=" . "article&k=" . $this->data['item_id'], false, true); ! $this->auto_message = "[b]" . $this->langs['item_title'] . ":[/b] " . preg_replace( $search, $replace, $this->data['item_title'] ) . "\n"; $this->auto_message .= "[b]" . $this->langs['author'] . ":[/b] " . $this->data['item_author'] . "\n"; ! $this->auto_message .= "[b]" . $this->langs['item_description'] . ":[/b] [i]" . preg_replace( $search, $replace, $this->data['item_desc'] ) . "[/i]\n\n"; //$this->auto_message .= "[b]" . $this->langs['category'] . ":[/b] " . $this->data['item_category_name'] . "\n"; --- 1726,1737 ---- global $lang, $phpEx; // // Compose phpBB post header // ! $temp_url = PORTAL_URL . pa_this_mxurl("action=" . "file&file_id=" . $this->data['item_id'], false, true); ! $this->auto_message = "[b]" . $this->langs['item_title'] . ":[/b] " . $this->data['item_title'] . "\n"; $this->auto_message .= "[b]" . $this->langs['author'] . ":[/b] " . $this->data['item_author'] . "\n"; ! $this->auto_message .= "[b]" . $this->langs['item_description'] . ":[/b] [i]" . $this->data['item_desc'] . "[/i]\n\n"; //$this->auto_message .= "[b]" . $this->langs['category'] . ":[/b] " . $this->data['item_category_name'] . "\n"; *************** *** 1840,1843 **** --- 1749,1786 ---- // $this->auto_message_update = "[i]" . $this->langs['edited_item_info'] . $this->data['item_editor'] . "[/i]" . "\n\n"; + + // + // Auto generated subject amd message + // + switch ( $action ) + { + case MX_NEW_NOTIFICATION: + $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_new']; + $this->message = $this->langs['notify_new_body'] . "\n\n" . $this->auto_message; + break; + + case MX_EDITED_NOTIFICATION: + $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_edited']; + $this->message = $this->langs['notify_edited_body'] . "\n\n" . $this->auto_message_update . $this->auto_message; + break; + + case MX_APPROVED_NOTIFICATION: + $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_approved']; + $this->message = $this->langs['notify_approved_body'] . "\n\n" . $this->auto_message; + break; + + case MX_UNAPPROVED_NOTIFICATION: + $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_unapproved']; + $this->message = $this->langs['notify_unapproved_body'] . "\n\n" . $this->auto_message; + break; + + case MX_DELETED_NOTIFICATION: + $this->subject = $this->langs['module_title'] . ' - ' . $this->langs['notify_subject_deleted']; + $this->message = $this->langs['notify_deleted_body'] . "\n\n" . $this->auto_message; + break; + + default: + mx_message_die(GENERAL_ERROR, 'Bad notify action'); + } } *************** *** 1921,1924 **** --- 1864,1871 ---- } + // ------------------------------------ + // Functions + // ------------------------------------ + /** * Enter description here... *************** *** 2064,2066 **** --- 2011,2246 ---- return $formated_url; } + + /** + * Enter description here... + * + * @param unknown_type $args + * @param unknown_type $force_standalone_mode + * @param unknown_type $non_html_amp + * @return unknown + */ + function pa_this_mxurl( $args = '', $force_standalone_mode = false, $non_html_amp = false ) + { + global $mx_root_path, $module_root_path, $page_id, $phpEx, $is_block; + + if ( $force_standalone_mode || !$is_block ) + { + $mxurl = $module_root_path . 'dload.' . $phpEx . ( $args == '' ? '' : '?' . $args ); + } + else + { + $mxurl = $mx_root_path . 'index.' . $phpEx; + + if ( is_numeric( $page_id ) ) + { + $mxurl .= '?page=' . $page_id . ( $args == '' ? '' : ( $non_html_amp ? '&' : '&' ) . $args ); + } + else + { + $mxurl .= ( $args == '' ? '' : '?' . $args ); + } + } + return $mxurl; + } + + /** + * Enter description here... + * + * @param unknown_type $args + * @param unknown_type $force_standalone_mode + * @param unknown_type $page_id + * @return unknown + */ + function pa_this_mxurl_list( $args = '', $force_standalone_mode = false, $page_id = 1 ) + { + global $mx_root_path, $module_root_path, $phpEx, $is_block; + + if ( $force_standalone_mode || !$is_block ) + { + $mxurl = $module_root_path . 'dload.' . $phpEx . ( $args == '' ? '' : '?' . $args ); + } + else + { + $mxurl = $mx_root_path . 'index.' . $phpEx; + if ( is_numeric( $page_id ) ) + { + $mxurl .= '?page=' . $page_id . ( $args == '' ? '' : '&' . $args ); + } + else + { + $mxurl .= ( $args == '' ? '' : '?' . $args ); + } + } + return $mxurl; + } + + /** + * Enter description here... + * + * @param unknown_type $rating + * @return unknown + */ + function paImageRating( $rating ) + { + global $db, $album_sp_config, $module_root_path; + + if ( !$rating ) + return( "<i>Not Rated</i>" ); + else + return ( round( $rating, 2 ) ); + } + + // ========================================================================= + // this function Borrowed from Acyd Burn attachment mod, (thanks Acyd for this great mod) + // ========================================================================= + function send_file_to_browser( $real_filename, $mimetype, $physical_filename, $upload_dir ) + { + global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS, $lang, $db, $pafiledb_functions; + + if ( $upload_dir == '' ) + { + $filename = $physical_filename; + } + else + { + $filename = $upload_dir . $physical_filename; + } + + $gotit = false; + + if ( @!file_exists( @$pafiledb_functions->pafiledb_realpath( $filename ) ) ) + { + mx_message_die( GENERAL_ERROR, $lang['Error_no_download'] . '<br /><br /><b>404 File Not Found:</b> The File <i>' . $filename . '</i> does not exist.' ); + } + else + { + $gotit = true; + $size = @filesize( $filename ); + if ( $size > ( 1048575 * 6 ) ) + { + return false; + } + } + + // Determine the Browser the User is using, because of some nasty incompatibilities. + // Most of the methods used in this function are from phpMyAdmin. :) + + $user_agent = ( !empty( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : ( ( !empty( $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ) ) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : '' ); + + if ( ereg( 'Opera(/| )([0-9].[0-9]{1,2})', $user_agent, $log_version ) ) + { + $browser_version = $log_version[2]; + $browser_agent = 'opera'; + } + else if ( ereg( 'MSIE ([0-9].[0-9]{1,2})', $user_agent, $log_version ) ) + { + $browser_version = $log_version[1]; + $browser_agent = 'ie'; + } + else if ( ereg( 'OmniWeb/([0-9].[0-9]{1,2})', $user_agent, $log_version ) ) + { + $browser_version = $log_version[1]; + $browser_agent = 'omniweb'; + } + else if ( ereg( '(Konqueror/)(.*)(;)', $user_agent, $log_version ) ) + { + $browser_version = $log_version[2]; + $browser_agent = 'konqueror'; + } + else if ( ereg( 'Mozilla/([0-9].[0-9]{1,2})', $user_agent, $log_version ) && ereg( 'Safari/([0-9]*)', $user_agent, $log_version2 ) ) + { + $browser_version = $log_version[1] . '.' . $log_version2[1]; + $browser_agent = 'safari'; + } + else if ( ereg( 'Mozilla/([0-9].[0-9]{1,2})', $user_agent, $log_version ) ) + { + $browser_version = $log_version[1]; + $browser_agent = 'mozilla'; + } + else + { + $browser_version = 0; + $browser_agent = 'other'; + } + + // Correct the Mime Type, if it's an octetstream + + if ( ( $mimetype == 'application/octet-stream' ) || ( $mimetype == 'application/octetstream' ) ) + { + if ( ( $browser_agent == 'ie' ) || ( $browser_agent == 'opera' ) ) + { + $mimetype = 'application/octetstream'; + } + else + { + $mimetype = 'application/octet-stream'; + } + } + + @ob_end_clean(); + @ini_set( 'zlib.output_compression', 'Off' ); + header( 'Pragma: public' ); + header( 'Content-Transfer-Encoding: none' ); + + // Send out the Headers + + if ( $browser_agent == 'ie' ) + { + header( 'Content-Type: ' . $mimetype . '; name="' . $real_filename . '"' ); + header( 'Content-Disposition: inline; filename="' . $real_filename . '"' ); + } + else + { + header( 'Content-Type: ' . $mimetype . '; name="' . $real_filename . '"' ); + header( 'Content-Disposition: attachment; filename=' . $real_filename ); + } + + // Now send the File Contents to the Browser + + if ( $gotit ) + { + if ( $size ) + { + header( "Content-length: $size" ); + } + + $result = @readfile( $filename ); + + if ( !$result ) + { + return true; + } + } + else + { + return false; + } + + @flush(); + exit(); + } + + function pa_redirect( $file_url ) + { + global $pafiledb_cache, $db; + if ( isset( $db ) ) + { + $db->sql_close(); + } + + if ( isset( $pafiledb_cache ) ) + { + $pafiledb_cache->unload(); + } + // Redirect via an HTML form for PITA webservers + if ( @preg_match( '/Microsoft|WebSTAR|Xitami/', getenv( 'SERVER_SOFTWARE' ) ) ) + { + header( 'Refresh: 0; URL=' . $file_url ); + echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $file_url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $file_url . '">HERE</a> to be redirected</div></body></html>'; + exit; + } + // Behave as per HTTP/1.1 spec for others + Header( "Location: $file_url" ); + exit(); + } ?> \ No newline at end of file Index: pafiledb_constants.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/pafiledb_constants.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pafiledb_constants.php 7 Jun 2006 20:29:52 -0000 1.17 --- pafiledb_constants.php 17 Jun 2006 20:13:22 -0000 1.18 *************** *** 72,76 **** define( 'PA_MIRRORS_TABLE', $mx_table_prefix . 'pa_mirrors' ); - if ( !MXBB_MODULE || MXBB_27x ) { --- 72,75 ---- Index: functions_admin.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_admin.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_admin.php 7 Jun 2006 20:29:52 -0000 1.3 --- functions_admin.php 17 Jun 2006 20:13:22 -0000 1.4 *************** *** 23,31 **** foreach( $pafiledb->subcat_rowset[$cat_parent] as $sub_cat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( 'CATEGORY_NAME' => $cat_data['cat_name'], ! 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] ) ? false : true, ! 'PRE' => $pre, ! 'U_CAT' => append_sid( "admin_pa_catauth.$phpEx?cat_parent=$sub_cat_id" ) ) ! ); for( $j = 0; $j < count( $cat_auth_fields ); $j++ ) --- 23,32 ---- foreach( $pafiledb->subcat_rowset[$cat_parent] as $sub_cat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( ! 'CATEGORY_NAME' => $cat_data['cat_name'], ! 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] ) ? false : true, ! 'PRE' => $pre, ! 'U_CAT' => append_sid( "admin_pa_catauth.$phpEx?cat_parent=$sub_cat_id" ) ! )); for( $j = 0; $j < count( $cat_auth_fields ); $j++ ) *************** *** 40,45 **** $custom_auth[$j] .= '</select> '; ! $pafiledb_template->assign_block_vars( 'cat_row.cat_auth_data', array( 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] ) ! ); } admin_display_cat_auth( $sub_cat_id, $depth + 1 ); --- 41,45 ---- $custom_auth[$j] .= '</select> '; ! $pafiledb_template->assign_block_vars( 'cat_row.cat_auth_data', array( 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j] ) ); } admin_display_cat_auth( $sub_cat_id, $depth + 1 ); *************** *** 59,75 **** foreach( $pafiledb->subcat_rowset[$cat_parent] as $sub_cat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( 'CAT_NAME' => $cat_data['cat_name'], ! 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] ) ? false : true, ! 'PRE' => $pre, ! ! 'U_CAT' => append_sid( "admin_pa_catauth.$phpEx?cat_id=$sub_cat_id" ), ! ! 'S_MOD_SELECT' => $optionlist_mod[$sub_cat_id] ) ! ); for( $j = 0; $j < count( $cat_auth_fields ); $j++ ) { ! $pafiledb_template->assign_block_vars( 'cat_row.aclvalues', array( 'S_ACL_SELECT' => $optionlist_acl_adv[$sub_cat_id][$j] ) ! ); } admin_display_cat_auth_ug( $sub_cat_id, $depth + 1 ); --- 59,73 ---- foreach( $pafiledb->subcat_rowset[$cat_parent] as $sub_cat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( ! 'CAT_NAME' => $cat_data['cat_name'], ! 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] ) ? false : true, ! 'PRE' => $pre, ! 'U_CAT' => append_sid( "admin_pa_catauth.$phpEx?cat_id=$sub_cat_id" ), ! 'S_MOD_SELECT' => $optionlist_mod[$sub_cat_id] ! )); for( $j = 0; $j < count( $cat_auth_fields ); $j++ ) { ! $pafiledb_template->assign_block_vars( 'cat_row.aclvalues', array( 'S_ACL_SELECT' => $optionlist_acl_adv[$sub_cat_id][$j] ) ); } admin_display_cat_auth_ug( $sub_cat_id, $depth + 1 ); *************** *** 89,102 **** foreach( $pafiledb->subcat_rowset[$cat_parent] as $subcat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] == PA_CAT_ALLOW_FILE ) ? false : true, ! 'U_CAT' => append_sid( 'admin_pa_category.php?cat_id=' . $subcat_id ), ! 'U_CAT_EDIT' => append_sid( "admin_pa_category.$phpEx?mode=edit&cat_id=$subcat_id" ), ! 'U_CAT_DELETE' => append_sid( "admin_pa_category.$phpEx?mode=delete&cat_id=$subcat_id" ), ! 'U_CAT_MOVE_UP' => append_sid( "admin_pa_category.$phpEx?mode=cat_order&move=-15&cat_id_other=$subcat_id" ), ! 'U_CAT_MOVE_DOWN' => append_sid( "admin_pa_category.$phpEx?mode=cat_order&move=15&cat_id_other=$subcat_id" ), ! 'U_CAT_RESYNC' => append_sid( "admin_pa_category.$phpEx?mode=sync&cat_id_other=$subcat_id" ), ! 'CAT_NAME' => $cat_data['cat_name'], ! 'PRE' => $pre ) ! ); admin_cat_main( $subcat_id, $depth + 1 ); } --- 87,101 ---- foreach( $pafiledb->subcat_rowset[$cat_parent] as $subcat_id => $cat_data ) { ! $pafiledb_template->assign_block_vars( 'cat_row', array( ! 'IS_HIGHER_CAT' => ( $cat_data['cat_allow_file'] == PA_CAT_ALLOW_FILE ) ? false : true, ! 'U_CAT' => append_sid( 'admin_pa_category.php?cat_id=' . $subcat_id ), ! 'U_CAT_EDIT' => append_sid( "admin_pa_category.$phpEx?mode=edit&cat_id=$subcat_id" ), ! 'U_CAT_DELETE' => append_sid( "admin_pa_category.$phpEx?mode=delete&cat_id=$subcat_id" ), ! 'U_CAT_MOVE_UP' => append_sid( "admin_pa_category.$phpEx?mode=cat_order&move=-15&cat_id_other=$subcat_id" ), ! 'U_CAT_MOVE_DOWN' => append_sid( "admin_pa_category.$phpEx?mode=cat_order&move=15&cat_id_other=$subcat_id" ), ! 'U_CAT_RESYNC' => append_sid( "admin_pa_category.$phpEx?mode=sync&cat_id_other=$subcat_id" ), ! 'CAT_NAME' => $cat_data['cat_name'], ! 'PRE' => $pre ! )); admin_cat_main( $subcat_id, $depth + 1 ); } *************** *** 106,112 **** } ! function get_forums( $sel_id = 0 ) { ! global $db; $sql = "SELECT forum_id, forum_name --- 105,119 ---- } ! /** ! * Enter description here... ! * ! * @param unknown_type $sel_id ! * @param unknown_type $use_default_option ! * @param unknown_type $select_name ! * @return unknown ! */ ! function get_forums( $sel_id = 0, $use_default_option = false, $select_name = 'forum_id' ) { ! global $db, $lang; $sql = "SELECT forum_id, forum_name *************** *** 118,126 **** } ! $forumlist = '<select name="forum_id">'; if ( $sel_id == 0 ) { ! $forumlist .= '<option value="0" selected > Select a Forum !</option>'; } --- 125,139 ---- } ! $forumlist = '<select name="'.$select_name.'">'; if ( $sel_id == 0 ) { ! $forumlist .= '<option value="0" selected >'.$lang['Select_topic_id'].'</option>'; ! } ! ! if ( $use_default_option ) ! { ! $status = $sel_id == "-1" ? "selected" : ""; ! $forumlist .= '<option value="-1" '.$status.' >::'.$lang['Use_default'].'::</option>'; } Index: functions_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_comment.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** functions_comment.php 7 Jun 2006 20:29:52 -0000 1.19 --- functions_comment.php 17 Jun 2006 20:13:22 -0000 1.20 *************** *** 89,94 **** // // This is specific for pafileDB ! // ! $this->forum_id = $pafiledb->modules[$pafiledb->module_name]->cat_rowset[$this->cat_id]['comments_forum_id']; $this->auth['auth_view'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_view_comment']; --- 89,93 ---- // // This is specific for pafileDB ! $this->forum_id = $pafiledb->modules[$pafiledb->module_name]->comments[$this->cat_id]['comments_forum_id']; $this->auth['auth_view'] = $pafiledb->modules[$pafiledb->module_name]->auth[$this->cat_id]['auth_view_comment']; *************** *** 180,184 **** // Get all comments // ! $this->get_internal_comments(); $ranksrow = array(); --- 179,183 ---- // Get all comments // ! $result = $this->get_internal_comments(); $ranksrow = array(); *************** *** 418,422 **** // Get all comments // ! $this->get_phpbb_comments(); $ranksrow = array(); --- 417,421 ---- // Get all comments // ! $result = $this->get_phpbb_comments(); $ranksrow = array(); *************** *** 726,729 **** --- 725,730 ---- )); } + + return $result; } *************** *** 773,776 **** --- 774,779 ---- )); } + + return $result; } *************** *** 1324,1327 **** --- 1327,1355 ---- * Enter description here... * + * @param unknown_type $topic_id + */ + function delete_phpbb_topic($topic_id) + { + global $board_config, $lang, $db, $phpbb_root_path, $phpEx; + global $userdata, $user_ip; + + $sql = "SELECT * + FROM " . POSTS_TABLE . " + WHERE topic_id = '$topic_id'"; + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, "Could not obtain topic data", '', __LINE__, __FILE__, $sql ); + } + + while( $row = $db->sql_fetchrow( $result ) ) + { + $this->delete_phpbb_post($row['forum_id'], $row['topic_id'], $row['post_id']); + } + } + + /** + * Enter description here... + * */ function validate_topic_id() *************** *** 1381,1384 **** --- 1409,1417 ---- switch ($mode) { + case 'delete_all': + $return_data = $this->delete_phpbb_topic($this->topic_id ); + $this->validate_topic_id(); + break; + case 'delete': $return_data = $this->delete_phpbb_post($this->forum_id, $this->topic_id, $cid ); Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** functions_pafiledb.php 7 Jun 2006 20:29:52 -0000 1.27 --- functions_pafiledb.php 17 Jun 2006 20:13:22 -0000 1.28 *************** *** 147,155 **** $this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] = $cat_rowset[$i]['internal_comments'] == -1 ? ($pafiledb_config['internal_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['internal_comments'] == 1 ? true : false ); // phpBB or internal comments $this->comments[$cat_rowset[$i]['cat_id']]['autogenerate_comments'] = $cat_rowset[$i]['autogenerate_comments'] == -1 ? ($pafiledb_config['autogenerate_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['autogenerate_comments'] == 1 ? true : false ); // autocreate comments when updated ! $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id'] = $cat_rowset[$i]['comments_forum_id'] == -1 ? ($pafiledb_config['comments_forum_id'] == 1 ? true : false ) : ( $cat_rowset[$i]['comments_forum_id'] == 1 ? true : false ); // phpBB target forum (only used for phpBB comments) if (!$this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] && intval($this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']) < 1) { ! // mx_message_die(GENERAL_ERROR, 'Init Failure, phpBB comments with no target forum_id :('); } --- 147,155 ---- $this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] = $cat_rowset[$i]['internal_comments'] == -1 ? ($pafiledb_config['internal_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['internal_comments'] == 1 ? true : false ); // phpBB or internal comments $this->comments[$cat_rowset[$i]['cat_id']]['autogenerate_comments'] = $cat_rowset[$i]['autogenerate_comments'] == -1 ? ($pafiledb_config['autogenerate_comments'] == 1 ? true : false ) : ( $cat_rowset[$i]['autogenerate_comments'] == 1 ? true : false ); // autocreate comments when updated ! $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id'] = $cat_rowset[$i]['comments_forum_id'] < 1 ? ( intval($pafiledb_config['comments_forum_id']) ) : ( intval($cat_rowset[$i]['comments_forum_id']) ); // phpBB target forum (only used for phpBB comments) if (!$this->comments[$cat_rowset[$i]['cat_id']]['internal_comments'] && intval($this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']) < 1) { ! mx_message_die(GENERAL_ERROR, 'Init Failure, phpBB comments with no target forum_id :( <br> Category: ' . $cat_rowset[$i]['cat_name'] . ' Forum_id: ' . $this->comments[$cat_rowset[$i]['cat_id']]['comments_forum_id']); } *************** *** 1480,1484 **** $cat_internal_comments = ( isset( $_POST['internal_comments'] ) ) ? intval( $_POST['internal_comments'] ) : 0; $cat_autogenerate_comments = ( isset( $_POST['autogenerate_comments'] ) ) ? intval( $_POST['autogenerate_comments'] ) : 0; ! $comments_forum_id = intval( $_POST['forum_id'] ); $cat_show_pretext = ( isset( $_POST['show_pretext'] ) ) ? intval( $_POST['show_pretext'] ) : 0; --- 1480,1484 ---- $cat_internal_comments = ( isset( $_POST['internal_comments'] ) ) ? intval( $_POST['internal_comments'] ) : 0; $cat_autogenerate_comments = ( isset( $_POST['autogenerate_comments'] ) ) ? intval( $_POST['autogenerate_comments'] ) : 0; ! $comments_forum_id = intval( $_POST['comments_forum_id'] ); $cat_show_pretext = ( isset( $_POST['show_pretext'] ) ) ? intval( $_POST['show_pretext'] ) : 0; *************** *** 1902,1916 **** $cat_id = ( isset( $_REQUEST['cat_id'] ) ) ? intval( $_REQUEST['cat_id'] ) : 0; ! $file_name = ( isset( $_POST['name'] ) ) ? htmlspecialchars( $_POST['name'] ) : ''; ! $file_long_desc = ( isset( $_POST['long_desc'] ) ) ? $_POST['long_desc'] : ''; ! $file_short_desc = ( isset( $_POST['short_desc'] ) ) ? $_POST['short_desc'] : ( ( !empty( $_POST['long_desc'] ) ) ? substr( $_POST['long_desc'], 0, 50 ) . '...' : '' ); ! $file_author = ( isset( $_POST['author'] ) ) ? htmlspecialchars( $_POST['author'] ) : ( ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '' ); ! $file_version = ( isset( $_POST['version'] ) ) ? htmlspecialchars( $_POST['version'] ) : ''; ! $file_website = ( isset( $_POST['website'] ) ) ? htmlspecialchars( $_POST['website'] ) : ''; if ( !empty( $file_website ) ) { --- 1902,1916 ---- $cat_id = ( isset( $_REQUEST['cat_id'] ) ) ? intval( $_REQUEST['cat_id'] ) : 0; ! $file_name = ( isset( $_POST['name'] ) ) ? addslashes( htmlspecialchars( $_POST['name'] ) ) : ''; ! $file_long_desc = ( isset( $_POST['long_desc'] ) ) ? addslashes( htmlspecialchars( $_POST['long_desc'] ) ) : ''; ! $file_short_desc = ( isset( $_POST['short_desc'] ) ) ? addslashes( htmlspecialchars( $_POST['short_desc'] ) ) : ( ( !empty( $_POST['long_desc'] ) ) ? substr( addslashes( htmlspecialchars( $_POST['long_desc'] ) ), 0, 50 ) . '...' : '' ); ! $file_author = ( isset( $_POST['author'] ) ) ? addslashes( htmlspecialchars( $_POST['author'] ) ) : ( ( $userdata['user_id'] != ANONYMOUS ) ? $userdata['username'] : '' ); ! $file_version = ( isset( $_POST['version'] ) ) ? addslashes( htmlspecialchars( $_POST['version'] ) ) : ''; ! $file_website = ( isset( $_POST['website'] ) ) ? addslashes( htmlspecialchars( $_POST['website'] ) ) : ''; if ( !empty( $file_website ) ) { *************** *** 2096,2099 **** --- 2096,2189 ---- * * @param unknown_type $file_id + * @param unknown_type $cat_id + * @param unknown_type $mode_notification + */ + function update_add_file_notify( $file_id = false, $mode_notification = 'edit' ) + { + global $db; + + if ( in_array( $mode_notification, array( 'add', 'edit', 'do_approve', 'do_unapprove', 'delete' ) ) ) + { + if (!$file_id) + { + die('bad update_add_file_notify arg'); + } + + if (is_array( $file_id ) && !empty( $file_id )) + { + $fileIdsArray = $file_id; + } + else + { + $fileIdsArray[] = $file_id; + } + + foreach($fileIdsArray as $fileId) + { + $sql = "SELECT file_catid + FROM " . PA_FILES_TABLE . " + WHERE file_id = '" . $fileId . "'"; + + if ( !$result = $db->sql_query( $sql ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldn\'t get file info', '', __LINE__, __FILE__, $sql ); + } + + $row = $db->sql_fetchrow( $result ); + $catId = $row['file_catid']; + + // + // Notification + // + if ( $this->notification[$catId]['activated'] > 0 ) // -1, 0, 1, 2 + { + // + // Instatiate notification + // + $mx_pa_notification = new mx_pa_notification(); + $mx_pa_notification->init( $fileId ); + + // + // Now send notification + // + $mx_notification_mode = $this->notification[$catId]['activated'] == 1 ? MX_PM_MODE : MX_MAIL_MODE; + + switch ( $mode_notification ) + { + case 'add': + $mx_notification_action = MX_NEW_NOTIFICATION; + break; + case 'edit': + $mx_notification_action = MX_EDITED_NOTIFICATION; + break; + case 'do_approve': + $mx_notification_action = MX_APPROVED_NOTIFICATION; + break; + case 'do_unapprove': + $mx_notification_action = MX_UNAPPROVED_NOTIFICATION; + break; + case 'delete': + $mx_notification_action = MX_DELETED_NOTIFICATION; + break; + } + + $html_entities_match = array('#&(?!(\#[0-9]+;))#', '#<#', '#>#', '#"#'); + $html_entities_replace = array('&', '<', '>', '"'); + + $mx_pa_notification->notify( $mx_notification_mode, $mx_notification_action ); + + if ( $this->notification[$cat_id]['notify_group'] > 0 ) + { + $mx_pa_notification->notify( $mx_notification_mode, $mx_notification_action, - intval($this->notification[$catId]['notify_group']) ); + } + } + } + } + } + + /** + * Enter description here... + * + * @param unknown_type $file_id * @param unknown_type $file_upload * @param unknown_type $file_remote_url *************** *** 2386,2389 **** --- 2476,2617 ---- * Enter description here... * + * @param unknown_type $article_data + * @param unknown_type $item_id + * @param unknown_type $cid + * @param unknown_type $subject + * @param unknown_type $message + * @param unknown_type $html_on + * @param unknown_type $bbcode_on + * @param unknown_type $smilies_on + */ + function update_add_comment($file_data = '', $item_id, $cid, $subject = '', $message = '', $html_on = false, $bbcode_on = true, $smilies_on = false) + { + global $pafiledb_template, $pafiledb_functions, $lang, $board_config, $phpEx, $pafiledb_config, $db, $images, $userdata; + 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; + + // + // Ensure we have article_data defined + // + if (!is_array($article_data) && !empty($item_id) && $item_id > 0) + { + $sql = "SELECT * + FROM " . PA_FILES_TABLE . " + WHERE file_id = '" . $item_id . "'"; + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt select download', '', __LINE__, __FILE__, $sql ); + } + + if ( !$article_data = $db->sql_fetchrow( $result ) ) + { + mx_message_die( GENERAL_MESSAGE, $lang['Article_not_exsist'] ); + } + + $db->sql_freeresult( $result ); + } + + // + // vars (can both be POSTed or send through the function) + // + $update_comment = $cid > 0 ? true : false; + $subject = !empty($subject) ? $subject : $_POST['subject']; + $message = !empty($message) ? $message : $_POST['message']; + + $length = strlen( $message ); + $title = ( !empty( $subject ) ) ? htmlspecialchars( trim ( $subject ) ) : ''; + + // + // Formatting + // + $comment_bbcode_uid = make_bbcode_uid(); + $comments_text = str_replace( '<br />', "\n", $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'] ) + { + mx_message_die( GENERAL_ERROR, 'Your comment is too long!<br/>The maximum length allowed in characters is ' . $pafiledb_config['max_comment_chars'] . '' ); + } + + if ( $update_comment ) + { + 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 = " . $cid . " + AND file_id = ". $item_id; + + if ( !( $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt update comments', '', __LINE__, __FILE__, $sql ); + } + } + else + { + include( $module_root_path . 'pafiledb/includes/functions_comment.' . $phpEx ); + $pafiledb_comments = new pafiledb_comments(); + $pafiledb_comments->init( $item_id ); + + $return_data = $pafiledb_comments->post( 'update', $cid, $title, $comments_text, $userdata['user_id'], $userdata['username'], 0, '', '', $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')"; + + if ( !( $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt insert comments', '', __LINE__, __FILE__, $sql ); + } + } + else + { + include( $module_root_path . 'pafiledb/includes/functions_comment.' . $phpEx ); + $pafiledb_comments = new pafiledb_comments(); + $pafiledb_comments->init( $item_id ); + + $return_data = $pafiledb_comments->post( 'insert', '', $title, $comments_text, $userdata['user_id'], $userdata['username'], 0, '', '', $comment_bbcode_uid); + } + } + + if ( !$this->comments[$file_data['file_catid']]['internal_comments'] ) + { + + // + // Update the item data itself + // + if ($file_data['topic_id'] == 0 ) + { + // + // Update item with new topic_id + // + $sql = "UPDATE " . PA_FILES_TABLE . " + SET topic_id = '" . $return_data['topic_id'] . "' + WHERE file_id = ". $item_id; + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, 'Couldnt update item', '', __LINE__, __FILE__, $sql ); + } + + $db->sql_freeresult( $result ); + } + } + } + + /** + * Enter description here... + * * @param unknown_type $cat_id */ |