Update of /cvsroot/mxbb/mx_music/music_box/modules In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18200/modules Added Files: Tag: core28x index.htm music_cat.php music_comment.php music_comment_delete.php music_comment_edit.php music_delete.php music_download.php music_edit.php music_list.php music_media_cat.php music_modcp.php music_page.php music_pic_cat.php music_rate.php music_rss.php music_song.php music_stream.php music_upload.php Log Message: --- NEW FILE: music_upload.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_upload.php,v 1.1.2.1 2008/01/16 19:53:16 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } $music_root_path = $module_root_path . 'music_box/'; $song_image_path = MUSIC_IMAGE_PATH; /* +---------------------------------------------------------- | Common Check +---------------------------------------------------------- */ // ------------------------------------ // Check the request // 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 { mx_message_die(GENERAL_ERROR, 'No categories specified'); } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT c.*, COUNT(s.song_id) AS count FROM ". MUSIC_CAT_TABLE ." AS c LEFT JOIN ". MUSIC_TABLE ." AS s ON c.cat_id = s.song_cat_id WHERE c.cat_id = '$cat_id' GROUP BY c.cat_id LIMIT 1"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); $current_songs = $thiscat['count']; if (empty($thiscat)) { mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($cat_id, $thiscat, 0, 1, 0, 0, 0, 0); // UPLOAD if ($music_user_access['upload'] == 0) { if (!$userdata['session_logged_in']) { mx_redirect(append_sid($mx_root_path . "login.php?redirect=" . this_mo_loginurl("music_mode=music_upload&cat_id=$cat_id"), true)); } else { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } /* +---------------------------------------------------------- | Upload Quota Check +---------------------------------------------------------- */ // ------------------------------------ // Check music Configuration Quota // ------------------------------------ if ($music_config['max_songs'] >= 0) { // // $current_songs was set at "Get the current Category Info" // if( $current_songs >= $music_config['max_songs'] ) { mx_message_die(GENERAL_MESSAGE, $lang['Music_reached_quota']); } } // ------------------------------------ // Check User Limit // ------------------------------------ $check_user_limit = FALSE; if( ($userdata['user_level'] != ADMIN) and ($userdata['session_logged_in']) ) { if ($music_user_access['moderator']) { if ($music_config['mod_songs_limit'] >= 0) { $check_user_limit = 'mod_songs_limit'; } } else { if ($music_config['user_songs_limit'] >= 0) { $check_user_limit = 'user_songs_limit'; } } } // Do the check here if ($check_user_limit != FALSE) { $sql = "SELECT COUNT(song_id) AS count FROM ". MUSIC_TABLE ." WHERE song_user_id = '". $userdata['user_id'] ."' AND song_cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not count your song', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $own_songs = $row['count']; if( $own_songs >= $music_config[$check_user_limit] ) { mx_message_die(GENERAL_MESSAGE, $lang['User_reached_songs_quota']); } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ if( !isset($HTTP_POST_VARS['song_title']) ) // is it not submitted? { // -------------------------------- // Build categories select // -------------------------------- $sql = "SELECT * FROM " . MUSIC_CAT_TABLE ." ORDER BY cat_order ASC"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); } $catrows = array(); while( $row = $db->sql_fetchrow($result) ) { $thiscat_access = music_user_access($row['cat_id'], $row, 0, 1, 0, 0, 0, 0); // UPLOAD if ($thiscat_access['upload'] == 1) { $catrows[] = $row; } } $select_cat = '<select name="cat_id">'; for ($i = 0; $i < count($catrows); $i++) { $select_cat .= '<option value="'. $catrows[$i]['cat_id'] .'" '; $select_cat .= ($cat_id == $catrows[$i]['cat_id']) ? 'selected="selected"' : ''; $select_cat .= '>'. $catrows[$i]['cat_title'] .'</option>'; } $select_cat .= '</select>'; // // Start output of page // $page_title = $lang['Music']; if ( !$is_block ) { include($mx_root_path . 'includes/page_header.'.$phpEx); } $template->set_filenames(array( 'body' => 'music_upload_body.tpl') ); $template->assign_vars(array( 'U_VIEW_CAT' => append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")), 'CAT_TITLE' => $thiscat['cat_title'], 'L_UPLOAD_SONG' => $lang['Upload_Song'], 'L_USERNAME' => $lang['Username'], 'L_SONG_TITLE' => $lang['Song_Title'], 'L_SONG_URL' => $lang['Song_url'], 'L_SONG_DESC' => $lang['Song_Desc'], 'L_SINGER' => $lang['Singer'], 'L_PLAIN_TEXT_ONLY' => $lang['Plain_text_only'], 'L_MAX_LENGTH' => $lang['Max_length'], 'S_SONG_DESC_MAX_LENGTH' => $music_config['desc_length'], 'L_UPLOAD_SONG_FROM_MACHINE' => $lang['Upload_song_from_machine'], 'L_SONG_IMAGE' => $lang['Song_image'], 'L_SONG_IMAGE_DESC' => $lang['Song_image_desc'], 'L_NO_IMAGE' => $lang['No_image'], 'L_UPLOAD_IMAGE' => $lang['Upload_image'], 'L_UPLOAD_TO_CATEGORY' => $lang['Upload_to_Category'], 'SELECT_CAT' => $select_cat, 'L_MAX_FILESIZE' => $lang['Max_file_size'], 'S_MAX_FILESIZE' => $music_config['max_file_size'], // Media Center 'L_ALLOWED_FILE' => $lang['Allowed_file'], 'S_MP3' => ($music_config['mp3_allowed'] == 1) ? 'MP3,' : '', 'S_WAV' => ($music_config['wav_allowed'] == 1) ? 'WAV,' : '', 'S_WMA' => ($music_config['wma_allowed'] == 1) ? 'WMA,' : '', 'S_WMV' => ($music_config['wmv_allowed'] == 1) ? 'WMV,' : '', 'S_MIDI' => ($music_config['mid_allowed'] == 1) ? 'MIDI,' : '', 'S_RAM' => ($music_config['ram_allowed'] == 1) ? 'RAM,' : '', 'S_AU' => ($music_config['au_allowed'] == 1) ? 'AU,' : '', 'S_MPEG' => ($music_config['mpeg_allowed'] == 1) ? 'MPEG,' : '', 'S_AVI' => ($music_config['avi_allowed'] == 1) ? 'AVI,' : '', 'S_SWF' => ($music_config['swf_allowed'] == 1) ? 'SWF,' : '', 'S_QT' => ($music_config['qt_allowed'] == 1) ? 'QT,' : '', 'S_FLV' => ($music_config['flv_allowed'] == 1) ? 'FLV,' : '', 'S_IMG' => ($music_config['img_allowed'] == 1) ? 'IMG,' : '', 'S_RM' => ($music_config['rm_allowed'] == 1) ? 'RM,' : '', // Media Center 'L_UPLOAD_NO_TITLE' => $lang['Upload_no_title'], 'L_UPLOAD_NO_FILE' => $lang['Upload_no_file'], 'L_UPLOAD_BOTH_FILE' => $lang['Upload_both_file'], 'L_DESC_TOO_LONG' => $lang['Desc_too_long'], 'L_RESET' => $lang['Reset'], 'L_SUBMIT' => $lang['Submit'], 'NAV_SEP' => $lang['Nav_Separator'], 'NAV_DOT' => '•', 'MUSIC_VERSION' => '2' . $music_config['music_version'], 'L_INDEX' => '<<', 'U_INDEX' => append_sid($mx_root_path . "index.".$phpEx), 'L_MUSIC_INDEX' => $lang['Music'], 'L_MUSIC' => $lang['Music'], 'U_MUSIC' => append_sid(this_mo_mxurl()), 'U_MX_MUSIC' => append_sid(this_mo_portalurl()), 'S_MUSIC_ACTION' => append_sid(this_mo_mxurl("music_mode=music_upload&cat_id=$cat_id")), ) ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } } else { // -------------------------------- // Check posted info // -------------------------------- $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) ) { mx_message_die(GENERAL_ERROR, $lang['Missed_song_title']); } // -------------------------------- // Check username for guest posting // -------------------------------- if (!$userdata['session_logged_in']) { if ($song_username != '') { $result = validate_username($song_username); if ( $result['error'] ) { mx_message_die(GENERAL_MESSAGE, $result['error_msg']); } } } // -------------------------------- // Get File Upload Info // -------------------------------- $filetype = $HTTP_POST_FILES['song_file']['type']; $filesize = $HTTP_POST_FILES['song_file']['size']; $filetmp = $HTTP_POST_FILES['song_file']['tmp_name']; // -------------------------------- // Get Song Image Upload Info // -------------------------------- $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'] : ''; // -------------------------------- // Check image size // -------------------------------- if( $image_system == '1' ) { if( $imagesize > $music_config['max_image_size'] ) { mx_message_die(GENERAL_MESSAGE, $lang['Bad_upload_image_size']); } } // -------------------------------- // Check image type // -------------------------------- if( $image_system == '1' ) { switch ($imagetype) { case 'image/jpeg': case 'image/jpg': case 'image/pjpeg': $song_imagetype = '.jpg'; break; case 'image/gif': $song_imagetype = '.gif'; break; case 'image/png': case 'image/x-png': $song_imagetype = '.png'; break; default: mx_message_die(GENERAL_ERROR, $lang['Not_allowed_image_type']); } } // -------------------------------- // Prepare variables // -------------------------------- $song_time = time(); $song_user_id = $userdata['user_id']; $song_user_ip = $userdata['session_ip']; // -------------------------------- // Check file size // -------------------------------- if( empty($song_url) ) { if( ($filesize == 0) or ($filesize > $music_config['max_file_size']) ) { mx_message_die(GENERAL_MESSAGE, $lang['Bad_upload_file_size']); } } // -------------------------------- // Check file type // -------------------------------- if( empty($song_url) ) { switch ($filetype) { case 'audio/mpeg': case 'audio/x-mpeg': case 'audio/mp3': case 'audio/mpg': if ($music_config['mp3_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.mp3'; break; case 'audio/wav': if ($music_config['wav_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.wav'; break; case 'audio/x-ms-wma': if ($music_config['wma_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.wma'; break; // // Extra extensions // case 'video/x-ms-wmv': if ($music_config['wmv_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.wmv'; break; case 'video/mpeg': if ($music_config['mpeg_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.mpeg'; break; case 'video/avi': case 'video/x-msvideo': if ($music_config['avi_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.avi'; break; case 'application/x-shockwave-flash': if ($music_config['swf_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.swf'; break; case 'video/quicktime': if ($music_config['qt_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.qt'; break; case 'video/x-flv': case 'video/flv': case 'application/octet-stream': if ($music_config['flv_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.flv'; break; case 'audio/x-midi': case 'audio/mid': case 'audio/midi': if ($music_config['mid_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.mid'; break; case 'audio/x-pn-realaudio': if ($music_config['ram_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.ram'; break; case 'audio/basic': if ($music_config['au_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.au'; break; case 'audio/vnd.rn-realmedia': case 'application/vnd.rn-realmedia': case 'video/vnd.rn-realvideo': case 'application/vnd': if ($music_config['rm_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.rm'; break; case 'image/jpeg': case 'image/jpg': case 'image/pjpeg': if ($music_config['img_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.jpg'; break; case 'image/gif': if ($music_config['img_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.gif'; break; case 'image/png': case 'image/x-png': if ($music_config['img_allowed'] == 0) { mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type']); } $song_filetype = '.png'; break; // End extra default: mx_message_die(GENERAL_ERROR, $lang['Not_allowed_file_type'] . ': ' . $filetype); } } else { $song_filetype = substr($song_url, strlen($song_url) - 3, 3); if( empty($song_filetype) ) { $song_filetype = ''; } } // -------------------------------- // Generate filename // -------------------------------- srand((double)microtime()*1000000); // for older than version 4.2.0 of PHP do { $song_filename = md5(uniqid(rand())) . $song_filetype; } while( file_exists(MUSIC_UPLOAD_PATH . $song_filename) ); // -------------------------------- // Generate imagename // -------------------------------- if( $image_system == '1' ) { do { $song_imagename = md5(uniqid(rand())) . $song_imagetype; } while( file_exists($song_image_path . $song_imagename) ); } // -------------------------------- // Move this file to upload directory // -------------------------------- if( empty($song_url) ) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; if ( @$ini_val('open_basedir') != '' ) { if ( @phpversion() < '4.0.3' ) { mx_message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file<br /><br />Please contact your server admin', '', __LINE__, __FILE__); } $move_file = 'move_uploaded_file'; } else { $move_file = 'copy'; } $move_file($filetmp, MUSIC_UPLOAD_PATH . $song_filename); @chmod(MUSIC_UPLOAD_PATH . $song_filename, 0777); } // -------------------------------- // Move song image to directory // -------------------------------- if( $image_system == '1' ) { if( !empty($HTTP_POST_FILES['song_image']['tmp_name']) ) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; if ( @$ini_val('open_basedir') != '' ) { if ( @phpversion() < '4.0.3' ) { message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file<br /><br />Please contact your server admin', '', __LINE__, __FILE__); } $move_file = 'move_uploaded_file'; } else { $move_file = 'copy'; } $move_file($imagetmp, $song_image_path . $song_imagename); @chmod($song_image_path . $song_imagename, 0777); } } // -------------------------------- // Check its image size // -------------------------------- if( $image_system == '1' ) { if( !empty($HTTP_POST_FILES['song_image']['size']) ) { $image_size = getimagesize($song_image_path . $song_imagename); $image_width = $image_size[0]; $image_height = $image_size[1]; if ( ($image_width > $music_config['max_image_width']) or ($image_height > $music_config['max_image_height']) ) { @unlink($song_image_path . $song_imagename); message_die(GENERAL_ERROR, 'Your uploaded image size is too big'); } } } // -------------------------------- // Check song Approval // -------------------------------- $song_approval = ($thiscat['cat_approval'] == 0) ? 1 : 0; // -------------------------------- // Insert into DB // -------------------------------- $sql = "INSERT INTO ". MUSIC_TABLE ." (song_filename, song_filetype, song_imagename, song_title, song_url, song_desc, song_singer, song_user_id, song_user_ip, song_username, song_time, song_cat_id, song_approval) VALUES ('$song_filename', '$song_filetype', '$song_imagename', '$song_title', '$song_url', '$song_desc', '$song_singer', '$song_user_id', '$song_user_ip', '$song_username', '$song_time', '$cat_id', '$song_approval')"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not insert new entry', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Complete... now send a message to user // -------------------------------- if ($thiscat['cat_approval'] == 0) { $message = $lang['Music_upload_successful']; } else { $message = $lang['Music_upload_need_approval']; } if ($thiscat['cat_approval'] == 0) { $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . '">') ); } //$message .= $sql; $message .= "<br /><br />" . sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . "\">", "</a>"); $message .= "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_delete.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_delete.php,v 1.1.2.1 2008/01/16 19:53:12 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } $music_root_path = $module_root_path . 'music_box/'; // ------------------------------------ // 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 { mx_message_die(GENERAL_ERROR, 'No songs specified'); } // ------------------------------------ // Get this song info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_TABLE ." WHERE song_id = '$song_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query song information', '', __LINE__, __FILE__, $sql); } $thissong = $db->sql_fetchrow($result); $cat_id = $thissong['song_cat_id']; $user_id = $thissong['song_user_id']; $song_filename = $thissong['song_filename']; if( empty($thissong) ) { mx_message_die(GENERAL_ERROR, $lang['Song_not_exist']); } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_CAT_TABLE ." WHERE cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); if (empty($thiscat)) { mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($cat_id, $thiscat, 0, 0, 0, 0, 0, 1); // DELETE if ($music_user_access['delete'] == 0) { if (!$userdata['session_logged_in']) { mx_redirect(append_sid($mx_root_path . "login.php?redirect=" . this_mo_loginurl("music_mode=music_delete&song_id=$song_id"), true)); } else { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else { if( (!$music_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { if ($thissong['song_user_id'] != $userdata['user_id']) { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ if( !isset($HTTP_POST_VARS['confirm']) ) { // -------------------------------- // If user give up deleting... // -------------------------------- if( isset($HTTP_POST_VARS['cancel']) ) { mx_redirect(append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id"))); exit; } // // Start output of page // $page_title = $lang['Music']; if ( !$is_block ) { include($mx_root_path . 'includes/page_header.'.$phpEx); } $template->set_filenames(array( 'body' => 'confirm_body.tpl') ); $template->assign_vars(array( 'MESSAGE_TITLE' => $lang['Confirm'], 'MESSAGE_TEXT' => $lang['Music_delete_confirm'], 'L_NO' => $lang['No'], 'L_YES' => $lang['Yes'], 'S_CONFIRM_ACTION' => append_sid(this_mo_mxurl("music_mode=music_delete&song_id=$song_id")), ) ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } } else { // -------------------------------- // It's confirmed. First delete all comments // -------------------------------- $sql = "DELETE FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_song_id = '$song_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete related comments', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Delete all ratings // -------------------------------- $sql = "DELETE FROM ". MUSIC_RATE_TABLE ." WHERE rate_song_id = '$song_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete related ratings', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Delete File // -------------------------------- @unlink(MUSIC_UPLOAD_PATH . $thissong['song_filename']); // -------------------------------- // Delete DB entry // -------------------------------- $sql = "DELETE FROM ". MUSIC_TABLE ." WHERE song_id = '$song_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete DB entry', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Complete... now send a message to user // -------------------------------- $message = $lang['Songs_deleted_successfully']; $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . '">') ); $message .= "<br /><br />" . sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . "\">", "</a>"); $message .= "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_comment_edit.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_comment_edit.php,v 1.1.2.1 2008/01/16 19:53:12 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // ------------------------------------ // Check feature enabled // ------------------------------------ if( $music_config['comment'] == 0 ) { mx_message_die(GENERAL_MESSAGE, $lang['Not_Authorised']); } // ------------------------------------ // Check the request // ------------------------------------ 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, 'No comment_id specified'); } // ------------------------------------ // Get the comment info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query this comment information', '', __LINE__, __FILE__, $sql); } $thiscomment = $db->sql_fetchrow($result); if( empty($thiscomment) ) { mx_message_die(GENERAL_ERROR, 'This comment does not exist'); } // ------------------------------------ // Get $song_id from $comment_id // ------------------------------------ $sql = "SELECT comment_id, comment_song_id FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query comment and song information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $song_id = $row['comment_song_id']; // ------------------------------------ // Get this song info // ------------------------------------ $sql = "SELECT s.*, u.user_id, u.username, COUNT(c.comment_id) as comments_count FROM ". MUSIC_TABLE ." AS s LEFT JOIN ". USERS_TABLE ." AS u ON s.song_user_id = u.user_id LEFT JOIN ". MUSIC_COMMENT_TABLE ." AS c ON s.song_id = c.comment_song_id WHERE song_id = '$song_id' GROUP BY s.song_id LIMIT 1"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query song information', '', __LINE__, __FILE__, $sql); } $thissong = $db->sql_fetchrow($result); $cat_id = $thissong['song_cat_id']; $user_id = $thissong['song_user_id']; $total_comments = $thissong['comments_count']; $comments_per_page = $board_config['posts_per_page']; $song_filename = $thissong['song_filename']; if( empty($thissong) ) { mx_message_die(GENERAL_ERROR, $lang['Song_not_exist']); } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_CAT_TABLE ." WHERE cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); if (empty($thiscat)) { mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($thissong['song_cat_id'], $thiscat, 0, 0, 0, 1, 1, 0); if( ($music_user_access['comment'] == 0) or ($music_user_access['edit'] == 0) ) { if (!$userdata['session_logged_in']) { mx_redirect(append_sid($mx_root_path . "login.php?redirect=" . this_mo_loginurl("music_mode=music_comment_edit&comment_id=$comment_id"), true)); } else { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else { if( (!$music_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { if ($thiscomment['comment_user_id'] != $userdata['user_id']) { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ if( !isset($HTTP_POST_VARS['comment']) ) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Comments Screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ if( ($thissong['song_user_id'] == MUSIC_GUEST) or ($thissong['username'] == '') ) { $poster = ($thissong['song_username'] == '') ? $lang['Guest'] : $thissong['song_username']; } else { $poster = '<a href="'. append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $thissong['user_id']) .'">'. $thissong['username'] .'</a>'; } // // Start output of page // $page_title = $lang['Music']; if ( !$is_block ) { include($mx_root_path . 'includes/page_header.'.$phpEx); } $template->set_filenames(array( 'body' => 'music_comment_body.tpl') ); $template->assign_block_vars('switch_comment_post', array()); $template->assign_vars(array( 'CAT_TITLE' => $thiscat['cat_title'], 'U_VIEW_CAT' => append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")), 'U_SONG' => append_sid(this_mo_mxurl("music_mode=music_song&song_id=$song_id")), 'SONG_TITLE' => $thissong['song_title'], 'POSTER' => $poster, 'SONG_TIME' => create_date($board_config['default_dateformat'], $thissong['song_time'], $board_config['board_timezone']), 'SONG_VIEW' => $thissong['song_view_count'], 'SONG_COMMENTS' => $total_comments, 'S_MESSAGE' => $thiscomment['comment_text'], 'L_SONG_TITLE' => $lang['Song_Title'], 'L_POSTER' => $lang['Poster'], 'L_POSTED' => $lang['Posted'], 'L_VIEW' => $lang['View'], 'L_COMMENTS' => $lang['Comments'], 'L_POST_YOUR_COMMENT' => $lang['Post_your_comment'], 'L_MESSAGE' => $lang['Message'], 'L_USERNAME' => $lang['Username'], 'L_COMMENT_NO_TEXT' => $lang['Comment_no_text'], 'L_COMMENT_TOO_LONG' => $lang['Comment_too_long'], 'L_MAX_LENGTH' => $lang['Max_length'], 'S_MAX_LENGTH' => $music_config['desc_length'], 'L_SUBMIT' => $lang['Submit'], 'S_MUSIC_ACTION' => append_sid(this_mo_mxurl("music_mode=music_comment_edit&comment_id=$comment_id")) ) ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } } else { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Comment Submited ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ $comment_text = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['comment']), 0, $music_config['desc_length']))); if( empty($comment_text) ) { mx_message_die(GENERAL_ERROR, $lang['Comment_no_text']); } // -------------------------------- // Prepare variables // -------------------------------- $comment_edit_time = time(); $comment_edit_user_id = $userdata['user_id']; // -------------------------------- // Update the DB // -------------------------------- $sql = "UPDATE ". MUSIC_COMMENT_TABLE ." SET comment_text = '$comment_text', comment_edit_time = '$comment_edit_time', comment_edit_count = comment_edit_count + 1, comment_edit_user_id = '$comment_edit_user_id' WHERE comment_id = '$comment_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not update comment data', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Complete... now send a message to user // -------------------------------- $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_mo_mxurl("music_mode=music_comment&comment_id=$comment_id")) . '#'.$comment_id.'">') ); $message = $lang['Stored'] . "<br /><br />" . sprintf($lang['Click_view_message'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_comment&comment_id=$comment_id")) . "#$comment_id\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_pic_cat.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_pic_cat.php,v 1.1.2.1 2008/01/16 19:53:15 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ //mxBB if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // ------------------------------------ // Check the request // ------------------------------------ [...976 lines suppressed...] ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ // // That's all Folks! // -------------------- ?> --- NEW FILE: music_cat.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_cat.php,v 1.1.2.1 2008/01/16 19:53:11 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ //mxBB if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } $music_root_path = $module_root_path . 'music_box/'; // ------------------------------------ [...981 lines suppressed...] ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ // // That's all Folks! // -------------------- ?> --- NEW FILE: music_modcp.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_modcp.php,v 1.1.2.1 2008/01/16 19:53:14 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } $music_root_path = $module_root_path . 'music_box/'; [...1019 lines suppressed...] } $message = $lang['Songs_deleted_successfully'] .'<br /><br />'. sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . "\">", "</a>") .'<br /><br />'. sprintf($lang['Click_return_modcp'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_modcp&cat_id=$cat_id")) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } } else { mx_message_die(GENERAL_ERROR, 'Invalid_mode'); } } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_comment_delete.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_comment_delete.php,v 1.1.2.1 2008/01/16 19:53:12 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // ------------------------------------ // Check feature enabled // ------------------------------------ if( $music_config['comment'] == 0 ) { mx_message_die(GENERAL_MESSAGE, $lang['Not_Authorised']); } // ------------------------------------ // Check the request // ------------------------------------ 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, 'No comment_id specified'); } // ------------------------------------ // Get the comment info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query this comment information', '', __LINE__, __FILE__, $sql); } $thiscomment = $db->sql_fetchrow($result); if( empty($thiscomment) ) { mx_message_die(GENERAL_ERROR, 'This comment does not exist'); } // ------------------------------------ // Get $song_id from $comment_id // ------------------------------------ $sql = "SELECT comment_id, comment_song_id FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query comment and song information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); if( empty($row) ) { mx_message_die(GENERAL_ERROR, 'This comment does not exist'); } $song_id = $row['comment_song_id']; // ------------------------------------ // Get this song info // ------------------------------------ $sql = "SELECT s.*, u.user_id, u.username, COUNT(c.comment_id) as comments_count FROM ". MUSIC_TABLE ." AS s LEFT JOIN ". USERS_TABLE ." AS u ON s.song_user_id = u.user_id LEFT JOIN ". MUSIC_COMMENT_TABLE ." AS c ON s.song_id = c.comment_song_id WHERE song_id = '$song_id' GROUP BY s.song_id LIMIT 1"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query song information', '', __LINE__, __FILE__, $sql); } $thissong = $db->sql_fetchrow($result); $cat_id = $thissong['song_cat_id']; $user_id = $thissong['song_user_id']; $total_comments = $thissong['comments_count']; $comments_per_page = $board_config['posts_per_page']; $song_filename = $thissong['song_filename']; if( empty($thissong) ) { mx_message_die(GENERAL_ERROR, $lang['Song_not_exist']); } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_CAT_TABLE ." WHERE cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); if (empty($thiscat)) { mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($thissong['song_cat_id'], $thiscat, 0, 0, 0, 1, 0, 1); if( ($music_user_access['comment'] == 0) or ($music_user_access['delete'] == 0) ) { if (!$userdata['session_logged_in']) { mx_redirect(append_sid($mx_root_path . "login.php?redirect=" . this_mo_loginurl("music_mode=music_comment_delete&comment_id=$comment_id"), true)); } else { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else { if( (!$music_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { if ($thiscomment['comment_user_id'] != $userdata['user_id']) { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ if( !isset($HTTP_POST_VARS['confirm']) ) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Confirm Screen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ // -------------------------------- // If user give up deleting... // -------------------------------- if( isset($HTTP_POST_VARS['cancel']) ) { mx_redirect(append_sid(this_mo_mxurl("music_mode=music_comment&comment_id=$comment_id"))); exit; } // // Start output of page // $page_title = $lang['Music']; if ( !$is_block ) { include($mx_root_path . 'includes/page_header.'.$phpEx); } $template->set_filenames(array( 'body' => 'confirm_body.tpl') ); $template->assign_vars(array( 'MESSAGE_TITLE' => $lang['Confirm'], 'MESSAGE_TEXT' => $lang['Comment_delete_confirm'], 'L_NO' => $lang['No'], 'L_YES' => $lang['Yes'], 'S_CONFIRM_ACTION' => append_sid(this_mo_mxurl("music_mode=music_comment_delete&comment_id=$comment_id")), ) ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } } else { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do the deleting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ $sql = "DELETE FROM ". MUSIC_COMMENT_TABLE ." WHERE comment_id = '$comment_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not delete this comment', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Complete... now send a message to user // -------------------------------- $message = $lang['Deleted']; $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . '">') ); $message .= "<br /><br />" . sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . "\">", "</a>"); $message .= "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_edit.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_edit.php,v 1.1.2.1 2008/01/16 19:53:13 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } $music_root_path = $module_root_path . 'music_box/'; //Image Edit Added by OryNider $song_image_path = MUSIC_IMAGE_PATH; // ------------------------------------ // 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 { mx_message_die(GENERAL_ERROR, 'No songs specified'); } // ------------------------------------ // Get this song info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_TABLE ." WHERE song_id = '$song_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query song information', '', __LINE__, __FILE__, $sql); } $thissong = $db->sql_fetchrow($result); $cat_id = $thissong['song_cat_id']; $user_id = $thissong['song_user_id']; $song_filename = $thissong['song_filename']; if( empty($thissong) ) { mx_message_die(GENERAL_ERROR, $lang['Song_not_exist']); } //Image Edit Added by OryNider if( !empty($thissong['song_imagename']) ) { $old_pic_filename = $thissong['song_imagename']; $no_image = ( !empty($lang['No_change']) ? $lang['No_change'] : 'No Change' ); } else { $old_pic_filename = ''; $no_image = $lang['No_image']; } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_CAT_TABLE ." WHERE cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); if (empty($thiscat)) { mx_message_die(GENERAL_ERROR, $lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($cat_id, $thiscat, 0, 0, 0, 0, 1, 0); // EDIT if ($music_user_access['edit'] == 0) { if (!$userdata['session_logged_in']) { mx_redirect(append_sid($mx_root_path . "login.php?redirect=" . this_mo_loginurl("music_mode=music_edit&song_id=$song_id"), true)); } else { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } else { if( (!$music_user_access['moderator']) or ($userdata['user_level'] != ADMIN) ) { if ($thissong['song_user_id'] != $userdata['user_id']) { mx_message_die(GENERAL_ERROR, $lang['Not_Authorised']); } } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ if( !isset($HTTP_POST_VARS['song_title']) ) { // // Start output of page // $page_title = $lang['Music']; if ( !$is_block ) { include($mx_root_path . 'includes/page_header.'.$phpEx); } $template->set_filenames(array( 'body' => 'music_edit_body.tpl') ); $template->assign_vars(array( 'L_EDIT_SONG_INFO' => $lang['Edit_Song_Info'], 'CAT_TITLE' => $thiscat['cat_title'], 'U_VIEW_CAT' => append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")), 'L_SONG_TITLE' => $lang['Song_Title'], 'SONG_TITLE' => $thissong['song_title'], 'L_SONG_URL' => $lang['Song_url'], 'SONG_URL' => $thissong['song_url'], 'SONG_SINGER' => $thissong['song_singer'], 'SONG_DESC' => $thissong['song_desc'], 'L_SINGER' => $lang['Singer'], 'L_SONG_DESC' => $lang['Song_Desc'], 'L_PLAIN_TEXT_ONLY' => $lang['Plain_text_only'], 'L_MAX_LENGTH' => $lang['Max_length'], 'L_UPLOAD_NO_TITLE' => $lang['Upload_no_title'], 'L_DESC_TOO_LONG' => $lang['Desc_too_long'], 'S_SONG_DESC_MAX_LENGTH' => $music_config['desc_length'], 'L_RESET' => $lang['Reset'], 'L_SUBMIT' => $lang['Submit'], 'NAV_SEP' => $lang['Nav_Separator'], 'NAV_DOT' => '•', 'MUSIC_VERSION' => '2' . $music_config['music_version'], 'L_INDEX' => '<<', 'U_INDEX' => append_sid($mx_root_path . "index.".$phpEx), 'L_MUSIC_INDEX' => $lang['Music'], 'L_MUSIC' => $lang['Music'], 'U_MUSIC' => append_sid(this_mo_mxurl()), 'U_MX_MUSIC' => append_sid(this_mo_portalurl()), //Image Edit Added by OryNider 'L_SONG_IMAGE' => $lang['Song_image'], 'L_SONG_IMAGE_DESC' => $lang['Song_image_desc'], 'L_NO_IMAGE' => $no_image, 'L_UPLOAD_IMAGE' => $lang['Upload_image'], 'S_MUSIC_ACTION' => append_sid(this_mo_mxurl("music_mode=music_edit&song_id=$song_id")), ) ); // // Generate the page // $template->pparse('body'); if ( !$is_block ) { include($mx_root_path . 'includes/page_tail.'.$phpEx); } } else { // -------------------------------- // Check posted info // -------------------------------- $song_title = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_title']))); $song_url = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_url']))); //Image Edit Added by OryNider $image_system = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['image_system']))); $song_singer = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['song_singer']))); $song_desc = str_replace("\'", "''", htmlspecialchars(substr(trim($HTTP_POST_VARS['song_desc']), 0, $music_config['desc_length']))); if( empty($song_title) ) { mx_message_die(GENERAL_ERROR, $lang['Missed_song_title']); } if ( $thissong['song_url'] != '' ) { if( empty($song_url) ) { mx_message_die(GENERAL_ERROR, $lang['Missed_song_url']); } } else { if( $song_url != '' ) { mx_message_die(GENERAL_ERROR, 'Bad edit'); } } //Image Edit Added by OryNider // -------------------------------- // Get Song Image Upload Info // -------------------------------- $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'] : ''; //Image Edit Added by OryNider // -------------------------------- // Check image size // -------------------------------- if( $image_system == '1' ) { // -------------------------------- // Check image type // -------------------------------- switch ($imagetype) { case 'image/jpeg': case 'image/jpg': case 'image/pjpeg': $song_imagetype = '.jpg'; break; case 'image/gif': $song_imagetype = '.gif'; break; case 'image/png': case 'image/x-png': $song_imagetype = '.png'; break; default: mx_message_die(GENERAL_ERROR, $lang['Not_allowed_image_type'] . ': ' . $imagetype); } if( $imagesize > $music_config['max_image_size'] ) { mx_message_die(GENERAL_MESSAGE, $lang['Bad_upload_image_size']); } // -------------------------------- // If exits old image deleate it // -------------------------------- if( !empty($old_pic_filename) && file_exists($song_image_path . $old_pic_filename) ) { @unlink($song_image_path . $old_pic_filename); } // -------------------------------- // Generate imagename // -------------------------------- do { $song_imagename = md5(uniqid(rand())) . $song_imagetype; } while( file_exists($song_image_path . $song_imagename) ); // -------------------------------- // Move song image to directory // -------------------------------- if( !empty($HTTP_POST_FILES['song_image']['tmp_name']) ) { $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; if ( @$ini_val('open_basedir') != '' ) { if ( @phpversion() < '4.0.3' ) { mx_message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file<br /><br />Please contact your server admin', '', __LINE__, __FILE__); } $move_file = 'move_uploaded_file'; } else { $move_file = 'copy'; } $move_file($imagetmp, $song_image_path . $song_imagename); @chmod($song_image_path . $song_imagename, 0777); } // -------------------------------- // Check its image size // -------------------------------- if( !empty($HTTP_POST_FILES['song_image']['size']) ) { $image_size = getimagesize($song_image_path . $song_imagename); $image_width = $image_size[0]; $image_height = $image_size[1]; if ( ($image_width > $music_config['max_image_width']) or ($image_height > $music_config['max_image_height']) ) { @unlink($song_image_path . $song_imagename); mx_message_die(GENERAL_ERROR, 'Your uploaded image size is too big'); } } } else if( !empty($old_pic_filename) ) { $song_imagename = $old_pic_filename; } else { $song_imagename = ''; } //mx_message_die(GENERAL_ERROR, 'Could not update ' . 'song_imagename: ' . $song_imagename); // -------------------------------- // Update the DB // -------------------------------- //Image Edit Altered by OryNider $sql = "UPDATE ". MUSIC_TABLE ." SET song_imagename = '$song_imagename', song_title = '$song_title', song_url = '$song_url', song_singer = '$song_singer', song_desc = '$song_desc' WHERE song_id = '$song_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'Could not update song information', '', __LINE__, __FILE__, $sql); } // -------------------------------- // Complete... now send a message to user // -------------------------------- $message = $lang['Songs_updated_successfully']; $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . '">') ); $message .= "<br /><br />" . sprintf($lang['Click_return_category'], "<a href=\"" . append_sid(this_mo_mxurl("music_mode=music_cat&cat_id=$cat_id")) . "\">", "</a>"); $message .= "<br /><br />" . sprintf($lang['Click_return_music_index'], "<a href=\"" . append_sid(this_mo_mxurl()) . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); } // +------------------------------------------------------+ // | Powered by Music Online 2.0 (c) 2003 Cf Manager | // +------------------------------------------------------+ ?> --- NEW FILE: music_stream.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_stream.php,v 1.1.2.1 2008/01/16 19:53:16 orynider Exp $ * @copyright (c) 2003 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /********************************************************************** * MODIFICATIONS * --------------- * started : Saturday, February 28, 2007 * copyright : © OryNider * web : http://pubory.uv.ro/ * version : 2.0.4 * * Credits: * -Getting ip and port in settings by lsn (http://botland.org/) * ***********************************************************************/ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // // Let's include some stuff... // $phpEx = substr(strrchr(__FILE__, '.'), 1); if ( !defined('TEMPLATE_ROOT_PATH') ) { include_once($mx_root_path . 'common.' . $phpEx); // // Start session management // $mx_user->init($user_ip, PAGE_INDEX); // // End session management // } $music_root_path = $module_root_path . 'music_box/'; // // Get general music information // include_once($music_root_path . 'music_common.'.$phpEx); // ------------------------------------ // 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 { die('No songs specified'); } // ------------------------------------ // Get this song info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_TABLE ." WHERE song_id = '$song_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query song information', '', __LINE__, __FILE__, $sql); } $thissong = $db->sql_fetchrow($result); $cat_id = $thissong['song_cat_id']; $user_id = $thissong['song_user_id']; if ( $thissong['song_url'] == '' ) { $song_filetype = substr($thissong['song_filename'], strlen($thissong['song_filename']) - 3, 3); $song_filename = $thissong['song_filename']; } else { $song_filetype = substr($thissong['song_url'], strlen($thissong['song_url']) - 3, 3); $song_url = $thissong['song_url']; } // ------------------------------------ // Get the current Category Info // ------------------------------------ $sql = "SELECT * FROM ". MUSIC_CAT_TABLE ." WHERE cat_id = '$cat_id'"; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not query category information', '', __LINE__, __FILE__, $sql); } $thiscat = $db->sql_fetchrow($result); if (empty($thiscat)) { die($lang['Category_not_exist']); } // ------------------------------------ // Check the permissions // ------------------------------------ $music_user_access = music_user_access($cat_id, $thiscat, 1, 0, 0, 0, 0, 0); // VIEW if ($music_user_access['view'] == 0) { die($lang['Not_Authorised']); } // ------------------------------------ // Check hotlink // ------------------------------------ if( ($music_config['hotlink_prevent'] == 1) and (isset($HTTP_SERVER_VARS['HTTP_REFERER'])) ) { $check_referer = explode('?', $HTTP_SERVER_VARS['HTTP_REFERER']); $check_referer = trim($check_referer[0]); $good_referers = array(); if ($music_config['hotlink_allowed'] != '') { $good_referers = explode(',', $music_config['hotlink_allowed']); } $good_referers[] = $board_config['server_name'] . $board_config['script_path']; $errored = TRUE; for ($i = 0; $i < count($good_referers); $i++) { $good_referers[$i] = trim($good_referers[$i]); if( (strstr($check_referer, $good_referers[$i])) and ($good_referers[$i] != '') ) { $errored = FALSE; } } if ($errored) { die($lang['Not_Authorised']); } } /* +---------------------------------------------------------- | Main work here... +---------------------------------------------------------- */ // Settings by lsn $host = explode("//", $thissong['song_url']); $host = $host[1]; $host = explode(":", $host); $ip = $host[0]; // Shoutcast Ip or Host $port = explode("/", $host[1]); $port = $port[0]; // Shoutcast Port $mount = "/"; // Used for alternate path to "Streaming URL" -- leave as "/" for the default setup. $artist = "Shotcast Steam -via- Mx Music Center"; $title = "Radio Steam - Mx Music Center!"; $album = "Live"; if ( $port == '' ) { $port = '80'; } // Make socket connection $errno = "errno"; $errstr = "errstr"; $fp = fsockopen($ip, $port, $errno, $errstr, 30); // Establish response headers header("HTTP/1.0 200 OK"); header("Content-Type: audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3"); header("Content-Transfer-Encoding: binary"); // Content-Length is required for Internet Explorer: // - Set to a rediculous number // = I think the limit is somewhere around 420 MB header("Content-Length: 100000000"); header("Content-Disposition: attachment; filename=$title")."\n"; // Create send headers $out = "GET $mount HTTP/1.1\r\n"; $out .= "Host: $ip\r\n"; $out .= "Connection: Close\r\n\r\n"; // Write the returned data back to the resource fwrite($fp, $out); // Read resource while (!feof($fp)) { // Get data in 2048 chuncks $outData = fgets($fp, 2048); // Removing shoutcast headers. if (!stristr($outData, "icy") && !stristr($outData, "content")){ echo $outData; } } fclose($fp); // +------------------------------------------------------+ // | Powered by Mx Music Center 2.0.1 (c) 2007 OryNider| // +------------------------------------------------------+ ?> --- NEW FILE: music_rss.php --- <?php /** * * @package mxBB Portal Module - mx_music * @version $Id: music_rss.php,v 1.1.2.1 2008/01/16 19:53:15 orynider Exp $ * @copyright (c) 2007 [ory...@rd..., OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // MX if ( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // ------- // Begin Page specific functions // function make_xml_compatible($text, $bbcode_uid = '', $use_bbcode = 0) { global $board_config, $base_url; if($use_bbcode) { if($bbcode_uid != '') { $text = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($text, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $text); } else { $text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $text); } $text = m... [truncated message content] |