Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2875/modules/mx_pafiledb/pafiledb/includes Modified Files: functions.php functions_comment.php functions_field.php functions_pafiledb.php pafiledb_constants.php Added Files: functions_mx.php Log Message: finally upgrading this module/mod - merging phpBB mod, mxBB module (2.7.x and 2.8) -.permissions reviewed - pm notification added - and many many minor fixes all over the place Index: functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** functions.php 9 Jan 2005 21:44:14 -0000 1.12 --- functions.php 11 Apr 2005 17:55:40 -0000 1.13 *************** *** 168,172 **** global $phpbb_root_path, $lang, $phpEx, $board_config, $pafiledb_config, $userdata; // MX ! global $mx_root_path, $module_root_path, $is_block, $phpEx; @set_time_limit( 0 ); --- 168,172 ---- 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; @set_time_limit( 0 ); *************** *** 185,189 **** // if the file size is more than the allowed size another error message // ======================================================= ! if ( $userfile_size > $pafiledb_config['max_file_size'] && $userdata['user_level'] != ADMIN && $userdata['session_logged_in'] ) { $file_info['error'] = true; --- 185,189 ---- // if the file size is more than the allowed size another error message // ======================================================= ! if ( $userfile_size > $pafiledb_config['max_file_size'] && ( $pafiledb->modules[$pafiledb->module_name]->auth[$cat_id]['auth_mod'] || $userdata['user_level'] != ADMIN ) && $userdata['session_logged_in'] ) { $file_info['error'] = true; *************** *** 933,935 **** --- 933,1372 ---- } + // email admin + + function pa_notify( $action = 1, $message, $to_id, $from_id, $info = 'new' ) + { + global $lang, $board_config, $db, $module_root_path, $phpbb_root_path, $mx_root_path, $phpEx, $userdata; + + switch ( $info ) + { + case 'new': + $subject_tmp = $lang['PA_notify_subject_new']; + break; + + case 'edited': + $subject_tmp = $lang['PA_notify_subject_edited']; + break; + + case 'approved': + $subject_tmp = $lang['PA_notify_subject_approved']; + break; + + case 'unapproved': + $subject_tmp = $lang['PA_notify_subject_unapproved']; + break; + } + + if ( $action == 2 ) // Mail + { + $email_subject = $lang['PA_title'] . ' - ' . $subject_tmp; + $email_body = $lang['PA_notify_body'] . '\n\n\n' . $message; + + pa_mailer( $to_id, $email_body, $email_subject, $from_id ); + + } + else if ( $action == 1 ) // PM + { + $email_subject = $lang['PA_title'] . ' - ' . $subject_tmp; + $email_body = $lang['PA_notify_body'] . '\n\n\n' . $message; + + pa_insert_pm( $to_id, $email_body, $email_subject, $from_id ); + } + } + + // wgErics good old insert_pm function + function pa_insert_pm( + $to_id, + $message, + $subject, + $from_id, + $html_on = 0, + $bbcode_on = 1, + $smilies_on = 1) + { + global $db, $lang, $user_ip, $board_config, $userdata, $phpbb_root_path, $phpEx; + + if ( empty( $from_id ) ) + { + $from_id = $userdata['user_id']; + } + + //get varibles ready + $to_id = intval($to_id); + $from_id = intval($from_id); + $msg_time = time(); + $attach_sig = $userdata['user_attachsig']; + + // Why send PM to yourself??? + if ( $to_id == $from_id ) + { + return; + } + + //get to users info + $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active + FROM " . USERS_TABLE . " + WHERE user_id = '$to_id' + AND user_id <> " . ANONYMOUS; + if ( !($result = $db->sql_query($sql)) ) + { + $error = TRUE; + $error_msg = $lang['No_such_user']; + } + + $to_userdata = $db->sql_fetchrow($result); + + $privmsg_subject = trim(strip_tags($subject)); + if ( empty($privmsg_subject) ) + { + $error = TRUE; + $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_subject']; + } + + if ( !empty($message) ) + { + if ( !$error ) + { + if ( $bbcode_on ) + { + $bbcode_uid = make_bbcode_uid(); + } + + $privmsg_message = prepare_message($message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid); + $privmsg_message = str_replace('\\\n', '\n', $privmsg_message); + } + } + else + { + $error = TRUE; + $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message']; + } + + // + // See if recipient is at their inbox limit + // + $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time + FROM " . PRIVMSGS_TABLE . " + WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " + OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " + OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) + AND privmsgs_to_userid = " . $to_userdata['user_id']; + if ( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_MESSAGE, $lang['No_such_user']); + } + + $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : ''; + + if ( $inbox_info = $db->sql_fetchrow($result) ) + { + if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] ) + { + $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " + WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " + OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " + OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) + AND privmsgs_date = " . $inbox_info['oldest_post_time'] . " + AND privmsgs_to_userid = " . $to_userdata['user_id']; + if ( !$result = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql); + } + $old_privmsgs_id = $db->sql_fetchrow($result); + $old_privmsgs_id = $old_privmsgs_id['privmsgs_id']; + + $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " + WHERE privmsgs_id = $old_privmsgs_id"; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)'.$sql, '', __LINE__, __FILE__, $sql); + } + + $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . " + WHERE privmsgs_text_id = $old_privmsgs_id"; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql); + } + } + } + + $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) + VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $privmsg_subject) . "', " . $from_id . ", " . $to_userdata['user_id'] . ", $msg_time, '$user_ip', $html_on, $bbcode_on, $smilies_on, $attach_sig)"; + + if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) ) + { + message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info); + } + + $privmsg_sent_id = $db->sql_nextid(); + + $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) + VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')"; + + if ( !$db->sql_query($sql, END_TRANSACTION) ) + { + message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql); + } + + // + // Add to the users new pm counter + // + $sql = "UPDATE " . USERS_TABLE . " + SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . " + WHERE user_id = " . $to_userdata['user_id']; + if ( !$status = $db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql); + } + + if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] ) + { + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); + $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx; + $server_name = trim($board_config['server_name']); + $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; + + include($phpbb_root_path . 'includes/emailer.'.$phpEx); + $emailer = new emailer($board_config['smtp_delivery']); + + $emailer->from($board_config['board_email']); + $emailer->replyto($board_config['board_email']); + + $emailer->use_template('privmsg_notify', $to_userdata['user_lang']); + $emailer->email_address($to_userdata['user_email']); + $emailer->set_subject($lang['Notification_subject']); + + $emailer->assign_vars(array( + 'USERNAME' => $to_username, + 'SITENAME' => $board_config['sitename'], + 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', + + 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox') + ); + + $emailer->send(); + $emailer->reset(); + } + + return; + + $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); + + message_die(GENERAL_MESSAGE, $msg); + + } // insert_pm() + + function pa_mailer( + $to_id, + $message, + $subject, + $from_id, + $html_on = 0, + $bbcode_on = 1, + $smilies_on = 1) + { + global $db, $lang, $user_ip, $board_config, $userdata, $phpbb_root_path, $phpEx; + + if ( !$from_id ) + { + $from_id = $userdata['user_id']; + } + + //get varibles ready + $to_id = intval($to_id); + $from_id = intval($from_id); + $msg_time = time(); + $attach_sig = $userdata['user_attachsig']; + + //get to users info + $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active + FROM " . USERS_TABLE . " + WHERE user_id = '$to_id' + AND user_id <> " . ANONYMOUS; + if ( !($result = $db->sql_query($sql)) ) + { + $error = TRUE; + $error_msg = $lang['No_such_user']; + } + + $to_userdata = $db->sql_fetchrow($result); + + $privmsg_subject = trim(strip_tags($subject)); + if ( empty($privmsg_subject) ) + { + $error = TRUE; + $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_subject']; + } + + if ( !empty($message) ) + { + if ( !$error ) + { + if ( $bbcode_on ) + { + $bbcode_uid = make_bbcode_uid(); + } + + $privmsg_message = prepare_message($message, $html_on, $bbcode_on, $smilies_on, $bbcode_uid); + $privmsg_message = str_replace('\\\n', '\n', $privmsg_message); + + } + } + else + { + $error = TRUE; + $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message']; + } + + + $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); + $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx; + $server_name = trim($board_config['server_name']); + $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; + $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; + + include($phpbb_root_path . 'includes/emailer.'.$phpEx); + $emailer = new emailer($board_config['smtp_delivery']); + + $emailer->from( $board_config['board_email'] ); + $emailer->replyto( $board_config['board_email'] ); + + $emailer->email_address($to_userdata['user_email'] ); + $emailer->set_subject( $subject ); + $emailer->msg = $message; + + $emailer->send(); + $emailer->reset(); + } + + // Compose phpbb comment header + function pa_compose_pm( $pa_pm ) + { + global $lang, $phpEx, $pa_custom_field; + + $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("action=" . "file&file_id=" . $pa_pm['file_id']); + + $message = "[b]" . $lang['File'] . ":[/b] " . preg_replace( $search, $replace, $pa_pm['file_title'] ) . "\n"; + $message .= "[b]" . $lang['Submiter'] . ":[/b] " . $pa_pm['file_author'] . "\n"; + $message .= "[b]" . $lang['Desc'] . ":[/b] [i]" . preg_replace( $search, $replace, $pa_pm['file_desc'] ) . "[/i]\n\n"; + + $message .= "\n\n[b][url=" . $temp_url . "]" . $lang['PA_goto_file'] . "[/url][/b]"; + + + + $message_update_text = "[i]" . $lang['Edited_Article_info'] . $pa_pm['article_editor'] . "[/i]" . "\n\n"; + + return array( 'message' => $message, 'update_message' => $message_update_text ); + } + + function pa_get_pm_data( $file_id = 0 ) + { + global $db, $lang; + // ======================================================= + // file id is not set, give him/her a nice error message + // ======================================================= + switch ( SQL_LAYER ) + { + 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_COMMENTS_TABLE . " AS c + WHERE f.file_id = r.votes_file(+) + AND f.user_id = u.user_id(+) + AND f.file_id = c.file_id(+) + AND f.file_id = $file_id + GROUP BY f.file_id "; + break; + + 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 + 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 f.file_id = $file_id + GROUP BY f.file_id "; + break; + } + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + message_die( GENERAL_ERROR, 'Couldnt Query file info', '', __LINE__, __FILE__, $sql ); + } + // =================================================== + // file doesn't exist' + // =================================================== + if ( !$file_data = $db->sql_fetchrow( $result ) ) + { + message_die( GENERAL_MESSAGE, $lang['File_not_exist'] ); + } + $db->sql_freeresult( $result ); + + // File data + $pa_pm['file_id'] = $file_id; + $pa_pm['file_title'] = $file_data['file_name']; + $pa_pm['file_desc'] = $file_data['file_desc']; + + $pa_pm['file_category_id'] = $file_data['file_catid']; + + // File author + $pa_pm['file_author_id'] = $file_data['user_id']; + $pa_pm['file_author'] = ( $file_data['user_id'] != ANONYMOUS ) ? $file_data['username'] : $lang['Guest']; + + // File editor + $pa_pm['file_editor_id'] = $userdata['user_id']; + $pa_pm['file_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : $lang['Guest']; + + return $pa_pm; + + } + + function pa_get_admins( $get_all_userdata = false ) + { + global $db; + + $admin_type = ADMIN; + + $sql = "SELECT * + FROM " . USERS_TABLE . " + WHERE user_level = '$admin_type'"; + + if ( !( $result = $db->sql_query( $sql ) ) ) + { + mx_message_die( GENERAL_ERROR, "Could not obtain author data", '', __LINE__, __FILE__, $sql ); + } + + if ( $row = $db->sql_fetchrow( $result ) ) + { + if ( $get_all_userdata ) + { + $name = $row; + } + else + { + $name = $row['username']; + } + } + else + { + $name = ''; + } + + return $name; + } + ?> \ No newline at end of file --- NEW FILE: functions_mx.php --- <?php /** ------------------------------------------------------------------------ * subject : mx-portal, CMS & portal * begin : june, 2002 * copyright : (C) 2002-2005 MX-System * email : jon...@ho... * project site : www.mx-system.com * * description : * ------------------------------------------------------------------------- * * $Id: functions_mx.php,v 1.1 2005/04/11 17:55:41 jonohlsson Exp $ */ /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License', or * ('at your option) any later version. */ if ( !function_exists( mx_smilies_pass ) ) { function mx_smilies_pass($message) { global $board_config; $smilies_path = $board_config['smilies_path']; $board_config['smilies_path'] = PHPBB_URL . $board_config['smilies_path']; $message = smilies_pass($message); $board_config['smilies_path'] = $smilies_path; return $message; } } if ( !function_exists( mx_generate_smilies ) ) { function mx_generate_smilies($mode, $page_id) { global $board_config, $template, $phpEx; $smilies_path = $board_config['smilies_path']; $board_config['smilies_path'] = PHPBB_URL . $board_config['smilies_path']; generate_smilies($mode, $page_id); $board_config['smilies_path'] = $smilies_path; $template->assign_vars(array( 'U_MORE_SMILIES' => append_sid(PHPBB_URL . "posting.$phpEx?mode=smilies")) ); } } if ( !function_exists( mx_message_die ) ) { function mx_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') { global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path, $nav_links, $gen_simple_header, $images; global $userdata, $user_ip, $session_length; global $starttime; message_die($msg_code, $msg_text, $msg_title, $err_line, $err_file, $sql); } } if ( !function_exists( mx_auth_group_cache ) ) { // Validates if user belongs to group included in group_ids list // Also, adds all usergroups to userdata array function mx_auth_group_cache( $group_ids = '', $group_mod_mode = false ) { global $userdata, $db; if ( $group_ids == '' ) { return false; } $group_ids_array = explode(",", $group_ids); // Try to reuse usergroups result. if ( $group_mod_mode ) { $userdata_key = 'mx_usergroups_mod' . $userdata['user_id']; if ( empty( $userdata[$userdata_key] ) ) { // Check if user is group moderator.. $sql = "SELECT gr.group_id FROM " . GROUPS_TABLE . " gr, " . USER_GROUP_TABLE . " ugr WHERE gr.group_id = ugr.group_id AND gr.group_moderator = '" . $userdata['user_id'] . "' AND ugr.user_pending = '0' "; if ( !( $result = $db->sql_query( $sql ) ) ) { message_die( GENERAL_ERROR, "Could not query group rights information", '', '', '', '' ); } $group_row = $db->sql_fetchrowset( $result ); $userdata[$userdata_key_mod] = $group_row; } } else { $userdata_key = 'mx_usergroups' . $userdata['user_id']; if ( empty( $userdata[$userdata_key] ) ) { // Check if user is member of the proper group.. $sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id='" . $userdata['user_id'] . "' AND user_pending = 0"; if ( !( $result = $db->sql_query( $sql ) ) ) { message_die( GENERAL_ERROR, "Could not query group rights information", '', '', '', '' ); } $group_row = $db->sql_fetchrowset( $result ); $userdata[$userdata_key] = $group_row; } } for ( $i = 0; $i < count( $userdata[$userdata_key] ); $i++ ) { if ( in_array( $userdata[$userdata_key][$i]['group_id'], $group_ids_array ) ) { $is_member = true; return $is_member; } } return false; } } if ( !function_exists( mx_add_search_words ) ) { // Add search words for blocks function mx_add_search_words($mode, $post_id, $post_text, $post_title = '', $mx_mode = 'mx') { global $db, $phpbb_root_path, $board_config, $lang; // $search_match_table = SEARCH_MATCH_TABLE; // $search_word_table = SEARCH_WORD_TABLE; switch ( $mx_mode ) { case 'mx': $search_match_table = MX_MATCH_TABLE; $search_word_table = MX_WORD_TABLE; $db_key = 'block_id'; break; case 'kb': $search_match_table = KB_MATCH_TABLE; $search_word_table = KB_WORD_TABLE; $db_key = 'article_id'; break; } $stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_stopwords.txt"); $synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . "/search_synonyms.txt"); $search_raw_words = array(); $search_raw_words['text'] = split_words(clean_words('post', $post_text, $stopword_array, $synonym_array)); $search_raw_words['title'] = split_words(clean_words('post', $post_title, $stopword_array, $synonym_array)); @set_time_limit(0); $word = array(); $word_insert_sql = array(); while ( list($word_in, $search_matches) = @each($search_raw_words) ) { $word_insert_sql[$word_in] = ''; if ( !empty($search_matches) ) { for ($i = 0; $i < count($search_matches); $i++) { $search_matches[$i] = trim($search_matches[$i]); if( $search_matches[$i] != '' ) { $word[] = $search_matches[$i]; if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") ) { $word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != "" ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'"; } } } } } if ( count($word) ) { sort($word); $prev_word = ''; $word_text_sql = ''; $temp_word = array(); for($i = 0; $i < count($word); $i++) { if ( $word[$i] != $prev_word ) { $temp_word[] = $word[$i]; $word_text_sql .= ( ( $word_text_sql != '' ) ? ', ' : '' ) . "'" . $word[$i] . "'"; } $prev_word = $word[$i]; } $word = $temp_word; $check_words = array(); switch( SQL_LAYER ) { case 'postgresql': case 'msaccess': case 'mssql-odbc': case 'oracle': case 'db2': $sql = "SELECT word_id, word_text FROM " . $search_word_table . " WHERE word_text IN ($word_text_sql)"; if ( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not select words', '', __LINE__, __FILE__, $sql); } while ( $row = $db->sql_fetchrow($result) ) { $check_words[$row['word_text']] = $row['word_id']; } break; } $value_sql = ''; $match_word = array(); for ($i = 0; $i < count($word); $i++) { $new_match = true; if ( isset($check_words[$word[$i]]) ) { $new_match = false; } if ( $new_match ) { switch( SQL_LAYER ) { case 'mysql': case 'mysql4': $value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\', 0)'; break; case 'mssql': case 'mssql-odbc': $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0"; break; default: $sql = "INSERT INTO " . $search_word_table . " (word_text, word_common) VALUES ('" . $word[$i] . "', 0)"; if( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql); } break; } } } if ( $value_sql != '' ) { switch ( SQL_LAYER ) { case 'mysql': case 'mysql4': $sql = "INSERT IGNORE INTO " . $search_word_table . " (word_text, word_common) VALUES $value_sql"; break; case 'mssql': case 'mssql-odbc': $sql = "INSERT INTO " . $search_word_table . " (word_text, word_common) $value_sql"; break; } if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql); } } } while( list($word_in, $match_sql) = @each($word_insert_sql) ) { $title_match = ( $word_in == 'title' ) ? 1 : 0; if ( $match_sql != '' ) { $sql = "INSERT INTO " . $search_match_table . " ($db_key, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . $search_word_table . " WHERE word_text IN ($match_sql)"; if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new word matches', '', __LINE__, __FILE__, $sql); } } } if ($mode == 'single') { // remove_common('single', 4/10, $word); } return; } function mx_remove_search_post($post_id_sql, $mx_mode = 'mx') { global $db; // $search_match_table = SEARCH_MATCH_TABLE; // $search_word_table = SEARCH_WORD_TABLE; switch ( $mx_mode ) { case 'mx': $search_match_table = MX_MATCH_TABLE; $search_word_table = MX_WORD_TABLE; $db_key = 'block_id'; break; case 'kb': $search_match_table = KB_MATCH_TABLE; $search_word_table = KB_WORD_TABLE; $db_key = 'article_id'; break; } $words_removed = false; switch ( SQL_LAYER ) { case 'mysql': case 'mysql4': $sql = "SELECT word_id FROM " . $search_match_table . " WHERE $db_key IN ($post_id_sql) GROUP BY word_id"; if ( $result = $db->sql_query($sql) ) { $word_id_sql = ''; while ( $row = $db->sql_fetchrow($result) ) { $word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; } $sql = "SELECT word_id FROM " . $search_match_table . " WHERE word_id IN ($word_id_sql) GROUP BY word_id HAVING COUNT(word_id) = 1"; if ( $result = $db->sql_query($sql) ) { $word_id_sql = ''; while ( $row = $db->sql_fetchrow($result) ) { $word_id_sql .= ( $word_id_sql != '' ) ? ', ' . $row['word_id'] : $row['word_id']; } if ( $word_id_sql != '' ) { $sql = "DELETE FROM " . $search_word_table . " WHERE word_id IN ($word_id_sql)"; if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete word list entry', '', __LINE__, __FILE__, $sql); } $words_removed = $db->sql_affectedrows(); } } } break; default: $sql = "DELETE FROM " . $search_word_table . " WHERE word_id IN ( SELECT word_id FROM " . $search_match_table . " WHERE word_id IN ( SELECT word_id FROM " . $search_match_table . " WHERE $db_key IN ($post_id_sql) GROUP BY word_id ) GROUP BY word_id HAVING COUNT(word_id) = 1 )"; if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete old words from word table', '', __LINE__, __FILE__, $sql); } $words_removed = $db->sql_affectedrows(); break; } $sql = "DELETE FROM " . $search_match_table . " WHERE $db_key IN ($post_id_sql)"; if ( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql); } return $words_removed; } } if ( !function_exists(mx_do_install_upgrade) ) { // Generating output function mx_do_install_upgrade( $sql = '', $main_install = false ) { global $table_prefix, $mx_table_prefix, $userdata, $phpEx, $template, $lang, $db, $board_config, $HTTP_POST_VARS; $inst_error = false; $n = 0; $message = "<b>This is the result list of the SQL queries needed for the install/upgrade</b><br /><br />"; while ( $sql[$n] ) { if ( !$result = $db->sql_query( $sql[$n] ) ) { $message .= '<b><font color=#FF0000>[Error or Already added]</font></b> line: ' . ( $n + 1 ) . ' , ' . $sql[$n] . '<br />'; $inst_error = true; } else { $message .= '<b><font color=#0000fF>[Added/Updated]</font></b> line: ' . ( $n + 1 ) . ' , ' . $sql[$n] . '<br />'; } $n++; } $message .= '<br /> If you get some Errors, Already Added or Updated messages, relax, this is normal when updating modules'; if ( $main_install ) { if ( !$inst_error ) { $message .= '-> no db errors :-)<br /><br /><b>Portal installed successfully! </b><hr><br /><br />'; $message .= '1) Now, delete the /install and /contrib folders!!!<br /><br />'; $message .= '2) If you haven\'t already done a db backup, now is the time ;)<br /><br />'; $message .= '3) Then (after step 1), you HAVE to configure MX core and its modules from within the adminCP, simply \'upgrade\' MX portal Core and all modules in use!!!<br /><br />'; $message .= 'Click <a href=../admin/admin_mx_module.php>Here</a> to administer/upgrade the portal/modules. You will be promted for an admin username and pass. The upgrade process provide informative output...'; } else { $message .= '<br /><br /><b>Portal installed successfully (with some warnings)! </b><hr><br /><br />'; $message .= '1) Now, delete the /install and /contrib folders!!!<br /><br />'; $message .= '2) If you haven\'t already done a db backup, now is the time ;)<br /><br />'; $message .= '3) Now (after step 1), you HAVE to configure MX core and its modules from within the adminCP, simply \'upgrade\' MX portal Core and all modules in use!!!<br /><br />'; $message .= 'Click <a href=../admin/admin_mx_module.php>Here</a> to administer/upgrade the portal/modules. You will be promted for an admin username and pass. The upgrade process provide informative output...'; } } return $message; } } ?> Index: functions_field.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_field.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** functions_field.php 9 Jan 2005 21:44:14 -0000 1.3 --- functions_field.php 11 Apr 2005 17:55:41 -0000 1.4 *************** *** 410,416 **** { $return_array = $this->field_rowset[$field_id]; ! $return_array['data'] = implode( "\n", unserialize( stripslashes( $return_array['data'] ) ) ); return $return_array; } // =================================================== // file data in custom field operations --- 410,417 ---- { $return_array = $this->field_rowset[$field_id]; ! $return_array['data'] = !empty( $return_array['data'] ) ? implode( "\n", unserialize( stripslashes( $return_array['data'] ) ) ) : ''; return $return_array; } + // =================================================== // file data in custom field operations Index: pafiledb_constants.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/pafiledb_constants.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pafiledb_constants.php 6 Mar 2005 01:13:11 -0000 1.8 --- pafiledb_constants.php 11 Apr 2005 17:55:41 -0000 1.9 *************** *** 16,19 **** --- 16,35 ---- * (at your option) any later version. */ + + if ( !MXBB_MODULE ) + { + $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://'; + $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])); + $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : ''; + $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])); + $script_name = ($script_name == '') ? $script_name : '/' . $script_name; + + define( 'PORTAL_URL', $server_protocol . $server_name . $server_port . $script_name . '/' ); + define( 'PHPBB_URL', PORTAL_URL ); + + $mx_table_prefix = $table_prefix; + $is_block = false; // This also makes the script work for phpBB ;) + } + // define('PAFILEDB_DEBUG', 0); // Pafiledb Mod Debugging off define( 'PAFILEDB_DEBUG', 1 ); // Pafiledb Mod Debugging on *************** *** 39,42 **** --- 55,59 ---- define( 'PA_AUTH_COMMENT_EDIT', 10 ); define( 'PA_AUTH_COMMENT_DELETE', 11 ); + // Field Types define( 'INPUT', 0 ); *************** *** 48,66 **** define( 'ICONS_DIR', 'pafiledb/images/icons/' ); ! // tables ! /* - orig ! define('PA_CATEGORY_TABLE', $table_prefix.'pa_cat'); ! define('PA_COMMENTS_TABLE', $table_prefix.'pa_comments'); ! define('PA_CUSTOM_TABLE', $table_prefix.'pa_custom'); ! define('PA_CUSTOM_DATA_TABLE', $table_prefix.'pa_customdata'); ! define('PA_DOWNLOAD_INFO_TABLE', $table_prefix.'pa_download_info'); ! define('PA_FILES_TABLE', $table_prefix.'pa_files'); ! define('PA_LICENSE_TABLE', $table_prefix.'pa_license'); ! define('PA_CONFIG_TABLE', $table_prefix.'pa_config'); ! define('PA_VOTES_TABLE', $table_prefix.'pa_votes'); ! define('PA_AUTH_ACCESS_TABLE', $table_prefix.'pa_auth'); ! define('PA_MIRRORS_TABLE', $table_prefix.'pa_mirrors'); ! */ ! // MX define( 'PA_CATEGORY_TABLE', $mx_table_prefix . 'pa_cat' ); define( 'PA_COMMENTS_TABLE', $mx_table_prefix . 'pa_comments' ); --- 65,69 ---- define( 'ICONS_DIR', 'pafiledb/images/icons/' ); ! define( 'PA_CATEGORY_TABLE', $mx_table_prefix . 'pa_cat' ); define( 'PA_COMMENTS_TABLE', $mx_table_prefix . 'pa_comments' ); *************** *** 74,77 **** --- 77,81 ---- define( 'PA_AUTH_ACCESS_TABLE', $mx_table_prefix . 'pa_auth' ); define( 'PA_MIRRORS_TABLE', $mx_table_prefix . 'pa_mirrors' ); + // ********************************************************************** // Read language definition *************** *** 89,95 **** include( $module_root_path . 'language/' . $link_language . '/lang_admin_pafiledb.' . $phpEx ); } ! // ---------- ! // $current_template_images = $module_root_path . 'templates/subSilver/images' ; ! // ---------- if ( file_exists( $module_root_path . "templates/" . $theme['template_name'] . "/images" ) ) { --- 93,97 ---- include( $module_root_path . 'language/' . $link_language . '/lang_admin_pafiledb.' . $phpEx ); } ! if ( file_exists( $module_root_path . "templates/" . $theme['template_name'] . "/images" ) ) { *************** *** 116,121 **** $images['pa_file_new'] = "$current_template_images/icon_pa_new.gif"; ! $mxbb_footer_addup[] = 'mxBB pafileDB Module'; ! ! ?> \ No newline at end of file --- 118,130 ---- $images['pa_file_new'] = "$current_template_images/icon_pa_new.gif"; ! if ( !MXBB_MODULE || MXBB_27x ) ! { ! $kb_module_version = "Knowledge Base v. 2.0.x"; ! $kb_module_author = "Haplo"; ! $kb_module_orig_author = "wGEric"; ! } ! else ! { ! $mxbb_footer_addup[] = 'mxBB pafileDB Module'; ! } ?> \ No newline at end of file Index: functions_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_comment.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** functions_comment.php 9 Jan 2005 21:44:14 -0000 1.11 --- functions_comment.php 11 Apr 2005 17:55:41 -0000 1.12 *************** *** 37,41 **** // MX global $mx_root_path, $module_root_path, $is_block, $phpEx; ! // include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); // Define censored word matches --- 37,41 ---- // MX global $mx_root_path, $module_root_path, $is_block, $phpEx; ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); // Define censored word matches Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** functions_pafiledb.php 6 Mar 2005 01:13:11 -0000 1.15 --- functions_pafiledb.php 11 Apr 2005 17:55:41 -0000 1.16 *************** *** 495,500 **** global $db, $db, $lang, $userdata, $pafiledb_config; ! $a_sql = 'a.auth_view, a.auth_read, a.auth_view_file, a.auth_edit_file, a.auth_delete_file, a.auth_upload, a.auth_download, a.auth_rate, a.auth_email, a.auth_view_comment, a.auth_post_comment, a.auth_edit_comment, a.auth_delete_comment, a.auth_mod, a.auth_search, a.auth_stats, a.auth_toplist, a.auth_viewall'; ! $auth_fields = array( 'auth_view', 'auth_read', 'auth_view_file', 'auth_edit_file', 'auth_delete_file', 'auth_upload', 'auth_download', 'auth_rate', 'auth_email', 'auth_view_comment', 'auth_post_comment', 'auth_edit_comment', 'auth_delete_comment' ); $auth_fields_global = array( 'auth_search', 'auth_stats', 'auth_toplist', 'auth_viewall' ); --- 495,500 ---- global $db, $db, $lang, $userdata, $pafiledb_config; ! $a_sql = 'a.auth_view, a.auth_read, a.auth_view_file, a.auth_edit_file, a.auth_delete_file, a.auth_upload, a.auth_download, a.auth_rate, a.auth_email, a.auth_view_comment, a.auth_post_comment, a.auth_edit_comment, a.auth_delete_comment, a.auth_mod, a.auth_search, a.auth_stats, a.auth_toplist, a.auth_viewall, a.auth_approval'; ! $auth_fields = array( 'auth_view', 'auth_read', 'auth_view_file', 'auth_edit_file', 'auth_delete_file', 'auth_upload', 'auth_download', 'auth_rate', 'auth_email', 'auth_view_comment', 'auth_post_comment', 'auth_edit_comment', 'auth_delete_comment', 'auth_approval' ); $auth_fields_global = array( 'auth_search', 'auth_stats', 'auth_toplist', 'auth_viewall' ); *************** *** 1064,1069 **** { case 'oracle': ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, 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 f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c WHERE f1.file_id = r.votes_file(+) AND f1.user_id = u.user_id(+) --- 1064,1069 ---- { case 'oracle': ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, 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, cat.cat_allow_ratings, cat.cat_allow_comments ! FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c, " . PA_CATEGORY_TABLE . " AS cat WHERE f1.file_id = r.votes_file(+) AND f1.user_id = u.user_id(+) *************** *** 1071,1074 **** --- 1071,1075 ---- AND f1.file_pin = " . FILE_PINNED . " AND f1.file_approved = 1 + AND f1.file_catid = cat.cat_id $cat_where GROUP BY f1.file_id *************** *** 1077,1085 **** default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, 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 f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id WHERE f1.file_pin = " . FILE_PINNED . " AND f1.file_approved = 1 --- 1078,1087 ---- default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, 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, cat.cat_allow_ratings, cat.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id + LEFT JOIN " . PA_CATEGORY_TABLE . " AS cat ON f1.file_catid = cat.cat_id WHERE f1.file_pin = " . FILE_PINNED . " AND f1.file_approved = 1 *************** *** 1111,1116 **** { case 'oracle': ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) ! FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c WHERE f1.file_id = r.votes_file(+) AND f1.user_id = u.user_id(+) --- 1113,1118 ---- { case 'oracle': ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id), cat.cat_allow_ratings, cat.cat_allow_comments ! FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c, " . PA_CATEGORY_TABLE . " AS cat WHERE f1.file_id = r.votes_file(+) AND f1.user_id = u.user_id(+) *************** *** 1118,1121 **** --- 1120,1124 ---- AND f1.file_pin <> " . FILE_PINNED . " AND f1.file_approved = 1 + AND f1.file_catid = cat.cat_id $cat_where GROUP BY f1.file_id *************** *** 1124,1132 **** default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) FROM " . PA_FILES_TABLE . " AS f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id WHERE f1.file_pin <> " . FILE_PINNED . " AND f1.file_approved = 1 --- 1127,1136 ---- default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id), cat.cat_allow_ratings, cat.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f1.file_id = c.file_id + LEFT JOIN " . PA_CATEGORY_TABLE . " AS cat ON f1.file_catid = cat.cat_id WHERE f1.file_pin <> " . FILE_PINNED . " AND f1.file_approved = 1 *************** *** 1168,1172 **** $total_file = $row['total_file']; unset( $row ); ! for ( $i = 0; $i < count( $file_rowset ); $i++ ) { --- 1172,1186 ---- $total_file = $row['total_file']; unset( $row ); ! ! $pa_use_ratings = false; ! for ( $i = 0; $i < count( $file_rowset ); $i++ ) ! { ! if ( $file_rowset[$i]['cat_allow_ratings'] ) ! { ! $pa_use_ratings = true; ! break; ! } ! } ! for ( $i = 0; $i < count( $file_rowset ); $i++ ) { *************** *** 1227,1230 **** --- 1241,1245 ---- // Assign Vars // =================================================== + $pafiledb_template->assign_block_vars( "file_rows", array( 'L_NEW_FILE' => $lang['New_file'], *************** *** 1240,1244 **** 'FILE_DESC' => $file_rowset[$i]['file_desc'], 'DATE' => $date, ! 'RATING' => $rating, 'FILE_DLS' => $file_rowset[$i]['file_dls'], 'CAT_NAME' => $cat_name, --- 1255,1259 ---- 'FILE_DESC' => $file_rowset[$i]['file_desc'], 'DATE' => $date, ! 'RATING' => ( $file_rowset[$i]['cat_allow_ratings'] ? $rating : $lang['kb_no_ratings'] ), 'FILE_DLS' => $file_rowset[$i]['file_dls'], 'CAT_NAME' => $cat_name, *************** *** 1246,1249 **** --- 1261,1265 ---- 'U_CAT' => $cat_url, + 'SHOW_RATINGS' => ( $pa_use_ratings ? true : false ), /* - orig 'U_FILE' => append_sid('dload.'.$phpEx.'?action=file&file_id=' . $file_rowset[$i]['file_id'])) *************** *** 1253,1256 **** --- 1269,1273 ---- ); $filelist = true; + $pa_use_ratings = $file_rowset[$i]['cat_allow_ratings']; } *************** *** 1258,1262 **** { $action = ( empty( $cat_id ) ) ? 'viewall' : 'category&cat_id=' . $cat_id; ! $pafiledb_template->assign_vars( array( 'L_CATEGORY' => $lang['Category'], 'L_RATING' => $lang['DlRating'], 'L_DOWNLOADS' => $lang['Dls'], --- 1275,1280 ---- { $action = ( empty( $cat_id ) ) ? 'viewall' : 'category&cat_id=' . $cat_id; ! $pafiledb_template->assign_vars( array( ! 'L_CATEGORY' => $lang['Category'], 'L_RATING' => $lang['DlRating'], 'L_DOWNLOADS' => $lang['Dls'], *************** *** 1282,1289 **** 'SORT_ASC' => ( $sort_order == 'ASC' ) ? 'selected="selected"' : '', 'SORT_DESC' => ( $sort_order == 'DESC' ) ? 'selected="selected"' : '', - /* - orig - 'PAGINATION' => generate_pagination(append_sid("dload.$phpEx?action=$action&sort_method=$sort_method&sort_order=$sort_order"), $total_file, $pafiledb_config['settings_file_page'], $start), - */ - // MX 'PAGINATION' => generate_pagination( append_sid( pa_this_mxurl( "action=$action&sort_method=$sort_method&sort_order=$sort_order" ) ), $total_file, $pafiledb_config['settings_file_page'], $start ), 'PAGE_NUMBER' => sprintf( $lang['Page_of'], ( floor( $start / $pafiledb_config['settings_file_page'] ) + 1 ), ceil( $total_file / $pafiledb_config['settings_file_page'] ) ), --- 1300,1303 ---- *************** *** 1291,1299 **** 'ID' => $cat_id, 'START' => $start, - /* - orig - 'S_ACTION_SORT' => append_sid("dload.$phpEx?action=$action")) - */ - // MX 'S_ACTION_SORT' => append_sid( pa_this_mxurl( "action=$action" ) ) ) ); --- 1305,1310 ---- 'ID' => $cat_id, 'START' => $start, + 'SHOW_RATINGS' => ( $pa_use_ratings ) ? true : false, 'S_ACTION_SORT' => append_sid( pa_this_mxurl( "action=$action" ) ) ) ); *************** *** 1301,1305 **** else { ! $pafiledb_template->assign_vars( array( 'NO_FILE' => $show_file_message, 'L_NO_FILES' => $lang['No_files'], 'L_NO_FILES_CAT' => $lang['No_files_cat'] ) --- 1312,1325 ---- else { ! $pafiledb_template->assign_vars( array( ! 'L_CATEGORY' => $lang['Category'], ! 'L_RATING' => $lang['DlRating'], ! 'L_DOWNLOADS' => $lang['Dls'], ! 'L_DATE' => $lang['Date'], ! 'L_NAME' => $lang['Name'], ! 'L_FILE' => $lang['File'], ! 'L_UPDATE_TIME' => $lang['Update_time'], ! 'L_SCREENSHOTS' => $lang['Scrsht'], ! 'NO_FILE' => $show_file_message, 'L_NO_FILES' => $lang['No_files'], 'L_NO_FILES_CAT' => $lang['No_files_cat'] ) *************** *** 2020,2032 **** $file_pin = ( isset( $_POST['pin'] ) ) ? intval( $_POST['pin'] ) : 0; $file_ss_link = ( isset( $_POST['sshot_link'] ) ) ? intval( $_POST['sshot_link'] ) : 0; - // MX addon - // if ( $pafiledb_config['need_validation'] == 0 ) - // { - // $file_approved = 1; - // } - // else - // { - // $file_approved = ( isset($_POST['approved']) ) ? intval($_POST['approved']) : 0; - // } $file_dls = ( isset( $_POST['file_download'] ) ) ? intval( $_POST['file_download'] ) : 0; --- 2040,2043 ---- *************** *** 2137,2142 **** } } ! // MX addon ! if ( $pafiledb_config['need_validation'] == 0 ) { if ( !$file_id ) --- 2148,2153 ---- } } ! ! if ( $pafiledb->modules[$pafiledb->module_name]->auth[$cat_id]['auth_approval'] || ( $pafiledb->modules[$pafiledb->module_name]->auth[$cat_id]['auth_mod'] && $userdata['session_logged_in'] ) ) { if ( !$file_id ) *************** *** 2146,2163 **** else { ! $file_approved = isset( $file_data['file_approved'] ) ? $file_data['file_approved'] : 0; } ! }elseif ( $pafiledb_config['need_validation'] == 1 ) { ! if ( !$file_id ) ! { ! $file_approved = ( ( $pafiledb->modules[$pafiledb->module_name]->auth[$_REQUEST['cat_id']]['auth_mod'] || $userdata['user_level'] == ADMIN ) && $userdata['session_logged_in'] ) ? 1 : 0; ! } ! else ! { ! $file_approved = isset( $file_data['file_approved'] ) ? $file_data['file_approved'] : 0; ! } } ! if ( !$file_id ) { --- 2157,2168 ---- else { ! $file_approved = isset( $file_data['file_approved'] ) && !( $pafiledb->modules[$pafiledb->module_name]->auth[$cat_id]['auth_mod'] && $userdata['session_logged_in'] ) ? $file_data['file_approved'] : 1; } ! } ! else { ! $file_approved = 0; } ! if ( !$file_id ) { |