|
From: FlorinCB <ory...@us...> - 2008-09-09 10:38:42
|
Update of /cvsroot/mxbb/mx_music/music_box/modules In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6810/music_box/modules Modified Files: music_comment.php music_comment_edit.php music_upload.php Log Message: emoticons added in comments Index: music_upload.php =================================================================== RCS file: /cvsroot/mxbb/mx_music/music_box/modules/music_upload.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** music_upload.php 7 Sep 2008 18:06:52 -0000 1.3 --- music_upload.php 9 Sep 2008 10:38:34 -0000 1.4 *************** *** 29,40 **** // for this Upload script, we prefer POST to GET // ------------------------------------ ! ! if( isset($HTTP_POST_VARS['cat_id']) ) ! { ! $cat_id = intval($HTTP_POST_VARS['cat_id']); ! } ! else if( isset($HTTP_GET_VARS['cat_id']) ) { ! $cat_id = intval($HTTP_GET_VARS['cat_id']); } else --- 29,35 ---- // for this Upload script, we prefer POST to GET // ------------------------------------ ! if (!$mx_request_vars->is_empty_request('cat_id')) { ! $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, 0); } else *************** *** 160,164 **** */ ! if( !isset($HTTP_POST_VARS['song_title']) ) // is it not submitted? { // -------------------------------- --- 155,159 ---- */ ! if( !isset($_POST['song_title']) ) // is it not submitted? { // -------------------------------- *************** *** 205,211 **** } - $template->set_filenames(array( ! 'body' => 'music_upload_body.tpl') ); --- 200,205 ---- } $template->set_filenames(array( ! 'upload_body' => 'music_upload_body.tpl') ); *************** *** 282,286 **** // Generate the page // ! $template->pparse('body'); if ( !$is_block ) --- 276,280 ---- // Generate the page // ! $template->pparse('upload_body'); if ( !$is_block ) *************** *** 295,309 **** // -------------------------------- ! $song_title = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_title']))); ! $song_url = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_url']))); ! $image_system = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['image_system']))); ! $song_desc = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['song_desc']), 0, $music_config['desc_length']))); ! $song_singer = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_singer']))); ! $song_username = (!$userdata['session_logged_in']) ? substr(str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_username']))), 0, 32) : str_replace("'", "''", $userdata['username']); if( empty($song_title) ) --- 289,303 ---- // -------------------------------- ! $song_title = str_replace("\'", "''", htmlspecialchars(trim($_POST['song_title']))); ! $song_url = str_replace("\'", "''", htmlspecialchars(trim($_POST['song_url']))); ! $image_system = str_replace("\'", "''", htmlspecialchars(trim($_POST['image_system']))); ! $song_desc = str_replace("\'", "''", htmlspecialchars(substr(trim($_POST['song_desc']), 0, $music_config['desc_length']))); ! $song_singer = str_replace("\'", "''", htmlspecialchars(trim($_POST['song_singer']))); ! $song_username = (!$userdata['session_logged_in']) ? substr(str_replace("\'", "''", htmlspecialchars(trim($_POST['song_username']))), 0, 32) : str_replace("'", "''", $userdata['username']); if( empty($song_title) ) *************** *** 333,339 **** // -------------------------------- ! $filetype = $HTTP_POST_FILES['song_file']['type']; ! $filesize = $HTTP_POST_FILES['song_file']['size']; ! $filetmp = $HTTP_POST_FILES['song_file']['tmp_name']; // -------------------------------- --- 327,333 ---- // -------------------------------- ! $filetype = $_FILES['song_file']['type']; ! $filesize = $_FILES['song_file']['size']; ! $filetmp = $_FILES['song_file']['tmp_name']; // -------------------------------- *************** *** 341,347 **** // -------------------------------- ! $imagetype = ( !empty($HTTP_POST_FILES['song_image']['type']) ) ? $HTTP_POST_FILES['song_image']['type'] : ''; ! $imagesize = ( !empty($HTTP_POST_FILES['song_image']['size']) ) ? $HTTP_POST_FILES['song_image']['size'] : 0; ! $imagetmp = ( !empty($HTTP_POST_FILES['song_image']['tmp_name']) ) ? $HTTP_POST_FILES['song_image']['tmp_name'] : ''; // -------------------------------- --- 335,341 ---- // -------------------------------- ! $imagetype = ( !empty($_FILES['song_image']['type']) ) ? $_FILES['song_image']['type'] : ''; ! $imagesize = ( !empty($_FILES['song_image']['size']) ) ? $_FILES['song_image']['size'] : 0; ! $imagetmp = ( !empty($_FILES['song_image']['tmp_name']) ) ? $_FILES['song_image']['tmp_name'] : ''; // -------------------------------- *************** *** 646,650 **** if( $image_system == '1' ) { ! if( !empty($HTTP_POST_FILES['song_image']['tmp_name']) ) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; --- 640,644 ---- if( $image_system == '1' ) { ! if( !empty($_FILES['song_image']['tmp_name']) ) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; *************** *** 675,679 **** if( $image_system == '1' ) { ! if( !empty($HTTP_POST_FILES['song_image']['size']) ) { $image_size = getimagesize($song_image_path . $song_imagename); --- 669,673 ---- if( $image_system == '1' ) { ! if( !empty($_FILES['song_image']['size']) ) { $image_size = getimagesize($song_image_path . $song_imagename); *************** *** 736,741 **** mx_message_die(GENERAL_MESSAGE, $message); } ! ! // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | --- 730,734 ---- mx_message_die(GENERAL_MESSAGE, $message); } ! print("Powered by Music Online 2.0 (c) 2003 Cf Manager"); //Fix for internal backend // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | Index: music_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_music/music_box/modules/music_comment.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** music_comment.php 9 Sep 2008 07:04:32 -0000 1.6 --- music_comment.php 9 Sep 2008 10:38:33 -0000 1.7 *************** *** 28,62 **** // Check the request // ------------------------------------ ! ! if( isset($HTTP_GET_VARS['song_id']) ) ! { ! $song_id = intval($HTTP_GET_VARS['song_id']); ! } ! else if( isset($HTTP_POST_VARS['song_id']) ) ! { ! $song_id = intval($HTTP_POST_VARS['song_id']); ! } ! else ! { ! if( isset($HTTP_GET_VARS['comment_id']) ) ! { ! $comment_id = intval($HTTP_GET_VARS['comment_id']); ! } ! else if( isset($HTTP_POST_VARS['comment_id']) ) ! { ! $comment_id = intval($HTTP_POST_VARS['comment_id']); ! } ! else ! { ! mx_message_die(GENERAL_ERROR, 'Bad request'); ! } ! } ! // ------------------------------------ // Get $song_id from $comment_id // ------------------------------------ ! ! if( isset($comment_id) ) { $sql = "SELECT comment_id, comment_song_id --- 28,38 ---- // Check the request // ------------------------------------ ! $song_id = $mx_request_vars->request('song_id', MX_TYPE_INT, 1); ! $comment_id = $mx_request_vars->request('comment_id', MX_TYPE_INT, false); // ------------------------------------ // Get $song_id from $comment_id // ------------------------------------ ! if(!$mx_request_vars->is_empty_request('comment_id')) { $sql = "SELECT comment_id, comment_song_id *************** *** 101,105 **** $total_comments = $thissong['comments_count']; ! $comments_per_page = $board_config['posts_per_page']; if( empty($thissong) ) --- 77,81 ---- $total_comments = $thissong['comments_count']; ! $comments_per_page = ($board_config['posts_per_page']) ? $board_config['posts_per_page'] : 25; if( empty($thissong) ) *************** *** 157,167 **** ! if( !isset($HTTP_POST_VARS['comment']) ) ! { ! /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Comments Screen ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ ! // ------------------------------------ // Get the comments thread --- 133,142 ---- ! /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Comments Screen ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + if(!isset($_POST['comment'])) + { // ------------------------------------ // Get the comments thread *************** *** 169,181 **** // ------------------------------------ ! if( !isset($comment_id) ) { ! if( isset($HTTP_GET_VARS['start']) ) { ! $start = intval($HTTP_GET_VARS['start']); } ! else if( isset($HTTP_POST_VARS['start']) ) { ! $start = intval($HTTP_POST_VARS['start']); } else --- 144,156 ---- // ------------------------------------ ! if(!is_numeric($comment_id)) { ! if( isset($_GET['start']) ) { ! $start = intval($_GET['start']); } ! else if( isset($_POST['start']) ) { ! $start = intval($_POST['start']); } else *************** *** 209,215 **** } ! if( isset($HTTP_GET_VARS['sort_order']) ) { ! switch ($HTTP_GET_VARS['sort_order']) { case 'ASC': --- 184,190 ---- } ! if( isset($_GET['sort_order']) ) { ! switch ($_GET['sort_order']) { case 'ASC': *************** *** 220,226 **** } } ! else if( isset($HTTP_POST_VARS['sort_order']) ) { ! switch ($HTTP_POST_VARS['sort_order']) { case 'ASC': --- 195,201 ---- } } ! else if( isset($_POST['sort_order']) ) { ! switch ($_POST['sort_order']) { case 'ASC': *************** *** 240,251 **** $limit_sql = ($start == 0) ? $comments_per_page : $start .','. $comments_per_page; ! $sql = "SELECT c.*, u.user_id, u.username FROM ". MUSIC_COMMENT_TABLE ." AS c - LEFT JOIN ". USERS_TABLE ." AS u ON c.comment_user_id = u.user_id WHERE c.comment_song_id = '$song_id' ORDER BY c.comment_id $sort_order LIMIT $limit_sql"; ! if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not obtain comments information from the database', '', __LINE__, __FILE__, $sql); --- 215,225 ---- $limit_sql = ($start == 0) ? $comments_per_page : $start .','. $comments_per_page; ! $sql = "SELECT c.*, c.comment_username as username, c.comment_user_id as user_id FROM ". MUSIC_COMMENT_TABLE ." AS c WHERE c.comment_song_id = '$song_id' ORDER BY c.comment_id $sort_order LIMIT $limit_sql"; ! if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, 'Could not obtain comments information from the database', '', __LINE__, __FILE__, $sql); *************** *** 265,275 **** if ($commentrow[$i]['comment_edit_count'] > 0) { ! $sql = "SELECT c.comment_id, c.comment_edit_user_id, u.user_id, u.username FROM ". MUSIC_COMMENT_TABLE ." AS c - LEFT JOIN ". USERS_TABLE ." AS u ON c.comment_edit_user_id = u.user_id WHERE c.comment_id = '".$commentrow[$i]['comment_id']."' LIMIT 1"; ! ! if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not obtain last edit information from the database', '', __LINE__, __FILE__, $sql); --- 239,247 ---- if ($commentrow[$i]['comment_edit_count'] > 0) { ! $sql = "SELECT c.*, c.comment_username as username, c.comment_edit_user_id as user_id FROM ". MUSIC_COMMENT_TABLE ." AS c WHERE c.comment_id = '".$commentrow[$i]['comment_id']."' LIMIT 1"; ! if( !$result = $db->sql_querylimit($sql, 1) ) { mx_message_die(GENERAL_ERROR, 'Could not obtain last edit information from the database', '', __LINE__, __FILE__, $sql); *************** *** 289,293 **** } ! $comment_user_ip = (@function_exists( 'decode_ip' )) ? music_decode_ip($commentrow[$i]['comment_user_ip']) : phpBB2::decode_ip($commentrow[$i]['comment_user_ip']); $template->assign_block_vars('commentrow', array( --- 261,270 ---- } ! $comment_user_ip = music_decode_ip($commentrow[$i]['comment_user_ip']); ! ! // Smilies ! $commentrow[$i]['comment_text'] = $mx_bbcode->smilies_pass($commentrow[$i]['comment_text']); ! $commentrow[$i]['comment_text'] = $mx_bbcode->make_clickable($commentrow[$i]['comment_text']); ! $commentrow[$i]['comment_text'] = nl2br($commentrow[$i]['comment_text']); $template->assign_block_vars('commentrow', array( *************** *** 327,331 **** $template->set_filenames(array( ! 'body' => 'music_comment_body.tpl') ); --- 304,308 ---- $template->set_filenames(array( ! 'comment_body' => 'music_comment_body.tpl') ); *************** *** 351,354 **** --- 328,333 ---- } } + + music_comment_sql_smilies($auth_data['comment']); $thissong_time = (@function_exists( 'create_date' )) ? create_date($board_config['default_dateformat'], $thissong['song_time'], $board_config['board_timezone']) : phpBB2::create_date($board_config['default_dateformat'], $thissong['song_time'], $board_config['board_timezone']); *************** *** 376,380 **** 'L_COMMENTS' => $lang['Comments'], ! 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'], 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], --- 355,359 ---- 'L_COMMENTS' => $lang['Comments'], ! 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'] ? $lang['Post_your_comment'] : 'Post your comment', 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], *************** *** 393,396 **** --- 372,377 ---- 'L_SUBMIT' => $lang['Submit'], + + 'U_MUSIC_SMILIES' => mx_append_sid(PHPBB_URL . "posting.$phpEx?mode=smilies"), 'S_MUSIC_ACTION' => mx_append_sid(this_mo_mxurl("music_mode=music_comment&song_id=$song_id")) *************** *** 401,405 **** // Generate the page // ! $template->pparse('body'); if ( !$is_block ) --- 382,386 ---- // Generate the page // ! $template->pparse('comment_body'); if ( !$is_block ) *************** *** 411,415 **** { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Comment Submited ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ --- 392,396 ---- { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Comment Submited ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ *************** *** 430,436 **** } ! $comment_text = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['comment']), 0, $music_config['desc_length']))); ! $comment_username = (!$userdata['session_logged_in']) ? str_replace("\'", "''", substr(htmlspecialchars(trim($HTTP_POST_VARS['comment_username'])), 0, 32)) : str_replace("'", "''", htmlspecialchars(trim($userdata['username']))); if( empty($comment_text) ) --- 411,417 ---- } ! $comment_text = str_replace("\'", "''", htmlspecialchars(substr(trim($_POST['comment']), 0, $music_config['desc_length']))); ! $comment_username = (!$userdata['session_logged_in']) ? str_replace("\'", "''", substr(htmlspecialchars(trim($_POST['comment_username'])), 0, 32)) : str_replace("'", "''", htmlspecialchars(trim($userdata['username']))); if( empty($comment_text) ) *************** *** 450,467 **** ! // -------------------------------- ! // Check username for guest posting ! // -------------------------------- if (!$userdata['session_logged_in']) { ! if ($comment_username != '') ! { ! $result = validate_username($comment_username); ! if ( $result['error'] ) { ! mx_message_die(GENERAL_MESSAGE, $result['error_msg']); } - } } --- 431,448 ---- ! // -------------------------------- ! // Check username for guest posting ! // -------------------------------- if (!$userdata['session_logged_in']) { ! if ($comment_username != '') { ! $result = validate_username($comment_username); ! if ( $result['error'] ) ! { ! mx_message_die(GENERAL_MESSAGE, $result['error_msg']); ! } } } *************** *** 472,478 **** $comment_time = time(); - $comment_user_id = $userdata['user_id']; - $comment_user_ip = $userdata['session_ip']; // -------------------------------- --- 453,473 ---- $comment_time = time(); + switch (PORTAL_BACKEND) + { + case 'internal': + + case 'phpbb2': + + $comment_user_id= $userdata['user_id']; + $comment_user_ip = $userdata['session_ip']; + break; + + case 'phpbb3': + + $comment_user_id= $mx_user->data['user_id']; + $comment_user_ip = music_encode_ip($mx_user->data['session_ip']); + break; + } // -------------------------------- *************** *** 480,484 **** // -------------------------------- $sql = "SELECT MAX(comment_id) AS max ! FROM ". MUSIC_COMMENT_TABLE; if( !$result = $db->sql_query($sql) ) --- 475,479 ---- // -------------------------------- $sql = "SELECT MAX(comment_id) AS max ! FROM ". MUSIC_COMMENT_TABLE; if( !$result = $db->sql_query($sql) ) *************** *** 497,501 **** $sql = "INSERT INTO ". MUSIC_COMMENT_TABLE ." (comment_id, comment_song_id, comment_user_id, comment_username, comment_user_ip, comment_time, comment_text) ! VALUES ('$comment_id', '$song_id', '$comment_user_id', '$comment_username', '$comment_user_ip', '$comment_time', '$comment_text')"; if( !$result = $db->sql_query($sql) ) { --- 492,496 ---- $sql = "INSERT INTO ". MUSIC_COMMENT_TABLE ." (comment_id, comment_song_id, comment_user_id, comment_username, comment_user_ip, comment_time, comment_text) ! VALUES ('$comment_id', '$song_id', '$comment_user_id', '$comment_username', '$comment_user_ip', '$comment_time', '$comment_text')"; if( !$result = $db->sql_query($sql) ) { *************** *** 504,513 **** ! // -------------------------------- ! // Complete... now send a message to user ! // -------------------------------- $template->assign_vars(array( ! 'META' => '<meta http-equiv="refresh" content="3;url=' . mx_append_sid(this_mo_mxurl("music_mode=music_comment&comment_id=$comment_id")) . '#'.$comment_id.'">') ); --- 499,508 ---- ! // -------------------------------- ! // Complete... now send a message to user ! // -------------------------------- $template->assign_vars(array( ! 'META' => '<meta http-equiv="refresh" content="3;url=' . mx_append_sid(this_mo_mxurl("music_mode=music_comment&comment_id=$comment_id")) . '#'.$comment_id.'">') ); *************** *** 516,521 **** mx_message_die(GENERAL_MESSAGE, $message); } ! ! // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | --- 511,515 ---- mx_message_die(GENERAL_MESSAGE, $message); } ! echo("Powered by Music Online 2.0 (c) 2003 Cf Manager"); //Fix for internal backend // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | Index: music_comment_edit.php =================================================================== RCS file: /cvsroot/mxbb/mx_music/music_box/modules/music_comment_edit.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** music_comment_edit.php 9 Sep 2008 07:04:33 -0000 1.5 --- music_comment_edit.php 9 Sep 2008 10:38:33 -0000 1.6 *************** *** 29,39 **** // ------------------------------------ ! if( isset($HTTP_GET_VARS['comment_id']) ) ! { ! $comment_id = intval($HTTP_GET_VARS['comment_id']); ! } ! else if( isset($HTTP_POST_VARS['comment_id']) ) { ! $comment_id = intval($HTTP_POST_VARS['comment_id']); } else --- 29,35 ---- // ------------------------------------ ! if(!$mx_request_vars->is_empty_request('comment_id')) { ! $comment_id = $mx_request_vars->request('comment_id', MX_TYPE_INT, 1); } else *************** *** 208,212 **** 'L_COMMENTS' => $lang['Comments'], ! 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'], 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], --- 204,208 ---- 'L_COMMENTS' => $lang['Comments'], ! 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'] ? $lang['Post_your_comment'] : 'Post your comment', 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], *************** *** 280,285 **** mx_message_die(GENERAL_MESSAGE, $message); } ! ! // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | --- 276,280 ---- mx_message_die(GENERAL_MESSAGE, $message); } ! echo("Powered by Music Online 2.0 (c) 2003 Cf Manager"); //Fix for internal backend // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | |