|
From: Jon O. <jon...@us...> - 2005-03-30 09:28:24
|
Update of /cvsroot/mxbb/kb_076_mxaddon/root/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11032/modules/kb_076_mxaddon/root/includes Modified Files: functions_kb.php functions_kb_mx.php kb_post.php Log Message: fixed username for anonymos users Index: kb_post.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/kb_post.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kb_post.php 29 Mar 2005 21:39:31 -0000 1.3 --- kb_post.php 30 Mar 2005 09:28:12 -0000 1.4 *************** *** 108,113 **** $author_id = $userdata['user_id'] > 0 ? intval ( $userdata['user_id'] ) : '-1'; $type_id = intval ( $HTTP_POST_VARS['type_id'] ); ! $username = phpbb_clean_username( $HTTP_POST_VARS['username'] ); // Check message if ( !empty( $article_text ) ) --- 108,136 ---- $author_id = $userdata['user_id'] > 0 ? intval ( $userdata['user_id'] ) : '-1'; $type_id = intval ( $HTTP_POST_VARS['type_id'] ); ! ! $username = $HTTP_POST_VARS['username']; ! // Check username ! if (!empty($username)) ! { ! $username = phpbb_clean_username($username); ! ! if (!$userdata['session_logged_in'] || ($userdata['session_logged_in'] && $username != $userdata['username'])) ! { ! include($phpbb_root_path . 'includes/functions_validate.'.$phpEx); + $result = validate_username($username); + if ($result['error']) + { + $error_msg = (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg']; + + mx_message_die(GENERAL_MESSAGE, $error_msg ); + } + } + else + { + $username = ''; + } + } + // Check message if ( !empty( $article_text ) ) *************** *** 182,187 **** article_title = '$article_title', article_description = '$article_description', ! article_date = '$date', ! article_author_id = '$author_id', article_body = '$article_text', article_type = '$type_id', --- 205,209 ---- article_title = '$article_title', article_description = '$article_description', ! article_date = '$date', article_body = '$article_text', article_type = '$type_id', *************** *** 241,245 **** $kb_comment = array(); ! // Populate the kb_comment variable $kb_comment = kb_get_data($row, $userdata, $kb_post_mode); --- 263,267 ---- $kb_comment = array(); ! // Populate the kb_comment variable $kb_comment = kb_get_data($row, $userdata, $kb_post_mode); *************** *** 285,288 **** --- 307,311 ---- mx_message_die( GENERAL_MESSAGE, $message ); + } Index: functions_kb_mx.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/functions_kb_mx.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** functions_kb_mx.php 29 Mar 2005 21:39:31 -0000 1.2 --- functions_kb_mx.php 30 Mar 2005 09:28:12 -0000 1.3 *************** *** 57,61 **** global $starttime; ! message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = ''); } --- 57,61 ---- global $starttime; ! message_die($msg_code, $msg_text, $msg_title, $err_line, $err_file, $sql); } Index: functions_kb.php =================================================================== RCS file: /cvsroot/mxbb/kb_076_mxaddon/root/includes/functions_kb.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** functions_kb.php 29 Mar 2005 21:39:30 -0000 1.4 --- functions_kb.php 30 Mar 2005 09:28:12 -0000 1.5 *************** *** 1131,1135 **** $smilies_on = 1 ) { ! global $db, $board_config, $user_ip, $kb_config; // initialise some variables $topic_vote = 0; --- 1131,1135 ---- $smilies_on = 1 ) { ! global $db, $board_config, $user_ip, $kb_config, $lang, $userdata; // initialise some variables $topic_vote = 0; *************** *** 1149,1152 **** --- 1149,1153 ---- $message_update_text = prepare_message(trim($message_update_text), $html_on, $bbcode_on, $smilies_on, $bbcode_uid); $subject = addslashes(unprepare_message(trim($subject))); + $username = addslashes(unprepare_message(trim($user_name))); $username = phpbb_clean_username( $username ); *************** *** 1698,1707 **** // Article author $kb_comment['article_author_id'] = $row['article_author_id']; ! $kb_comment['article_author'] = $row['article_author_id'] != -1 ? $kb_author_data['username'] : ( ( $row['username'] == '' ) ? $lang['Guest'] : $row['username'] ) ; $kb_comment['article_author_sig'] = $kb_author_data['user_attachsig']; // Article editor $kb_comment['article_editor_id'] = $userdata['user_id']; ! $kb_comment['article_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : ( ( $username == '' ) ? $lang['Guest'] : $username ); $kb_comment['article_editor_sig'] = $userdata['user_attachsig']; --- 1699,1708 ---- // Article author $kb_comment['article_author_id'] = $row['article_author_id']; ! $kb_comment['article_author'] = $kb_post_mode == 'add' ? ( $row['article_author_id'] != -1 ? $kb_author_data['username'] : ( ( $row['username'] == '' ) ? $lang['Guest'] : $row['username'] ) ) : $row['username']; $kb_comment['article_author_sig'] = $kb_author_data['user_attachsig']; // Article editor $kb_comment['article_editor_id'] = $userdata['user_id']; ! $kb_comment['article_editor'] = ( $userdata['user_id'] != '-1' ) ? $userdata['username'] : ( ( $username == '' ) ? $lang['Guest'] : stripslashes($username) ); $kb_comment['article_editor_sig'] = $userdata['user_attachsig']; *************** *** 1732,1736 **** // Compose phpBB post header ! $temp_url = PORTAL_URL . "modules/mx_kb/kb.$phpEx?mode=" . "article&k=" . $kb_comment['article_id']; $message = "[b]" . $lang['Article_title'] . ":[/b] " . preg_replace( $search, $replace, $kb_comment['article_title'] ) . "\n"; --- 1733,1737 ---- // Compose phpBB post header ! $temp_url = PORTAL_URL . this_kb_mxurl("mode=" . "article&k=" . $kb_comment['article_id']); $message = "[b]" . $lang['Article_title'] . ":[/b] " . preg_replace( $search, $replace, $kb_comment['article_title'] ) . "\n"; |