|
From: OryNider <ory...@us...> - 2007-09-17 07:19:44
|
Update of /cvsroot/mxbb/mx_radiocast/admin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv960/admin Modified Files: admin_radio_auth.php admin_radio_cat.php admin_radio_cfg.php admin_radio_ext.php Log Message: This will add subcategories to mx radiocast.. Index: admin_radio_ext.php =================================================================== RCS file: /cvsroot/mxbb/mx_radiocast/admin/admin_radio_ext.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_radio_ext.php 6 Jun 2007 23:03:47 -0000 1.1 --- admin_radio_ext.php 17 Sep 2007 07:19:37 -0000 1.2 *************** *** 93,97 **** if ( isset( $HTTP_POST_VARS['submit'] ) ) { ! $message = $lang['radiocast_config_updated'] . "<br /><br />" . sprintf( $lang['Click_return_radiocast_config'], "<a href=\"" . append_sid( "admin_radio_ext.$phpEx" ) . "\">", "</a>" ) . "<br /><br />" . sprintf( $lang['Click_return_admin_index'], "<a href=\"" . append_sid( $mx_root_path . "admin/index.$phpEx?pane=right" ) . "\">", "</a>" ); mx_message_die( GENERAL_MESSAGE, $message ); } --- 93,97 ---- if ( isset( $HTTP_POST_VARS['submit'] ) ) { ! $message = $lang['radiocast_config_updated'] . "<br /><br />" . sprintf( $lang['Click_return_radiocast_config'], "<a href=\"" . append_sid( "admin_radio_ext.$phpEx" ) . "\">", "</a>" ) . "<br /><br />" . sprintf( $lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>" ); mx_message_die( GENERAL_MESSAGE, $message ); } Index: admin_radio_cat.php =================================================================== RCS file: /cvsroot/mxbb/mx_radiocast/admin/admin_radio_cat.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_radio_cat.php 6 Jun 2007 23:03:46 -0000 1.1 --- admin_radio_cat.php 17 Sep 2007 07:19:36 -0000 1.2 *************** *** 21,26 **** // Let's set the root dir for phpBB // ! $module_root_path = '../'; ! $mx_root_path = '../../../'; $radiocast_root_path = $module_root_path . 'radiocast_mod/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); --- 21,26 ---- // Let's set the root dir for phpBB // ! $module_root_path = './../'; ! $mx_root_path = './../../../'; $radiocast_root_path = $module_root_path . 'radiocast_mod/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); *************** *** 29,33 **** // ! // Get general radiocast information // include($radiocast_root_path . 'radiocast_common.'.$phpEx); --- 29,33 ---- // ! // Get general music information // include($radiocast_root_path . 'radiocast_common.'.$phpEx); *************** *** 104,107 **** --- 104,108 ---- 'L_DELETE' => $lang['Delete'], 'S_MODE' => 'new', + 'L_CREATE_RADIOCAST' => !empty($lang['Create_radiocast']) ? $lang['Create_radiocast'] : 'Create radiocast', 'L_CREATE_CATEGORY' => $lang['Create_category']) ); *************** *** 109,116 **** $sql = "SELECT * FROM ". RADIOCAST_CAT_TABLE ." ORDER BY cat_order ASC"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query radiocast Categories information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) --- 110,118 ---- $sql = "SELECT * FROM ". RADIOCAST_CAT_TABLE ." + WHERE cat_parent = 0 ORDER BY cat_order ASC"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query music Categories information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) *************** *** 121,128 **** --- 123,145 ---- for( $i = 0; $i < count($catrow); $i++ ) { + if ($catrow[$i]['cat_type'] != 0) + { + $colspan = 1; + $add_sc = "<td class=\"" . (($i % 2) ? 'row1' : 'row2') . "\" align=\"center\">" . + "<form action=\"" . append_sid("admin_radio_cat.$phpEx") . "\" method=\"post\"><input type=\"hidden\" value=\"new\" name=\"mode\" /><input type=\"hidden\" value=\"" . $catrow[$i]['cat_id'] . "\" name=\"cat_parent\"><input name=\"submit\" type=\"submit\" value=\"" . $lang['Create_sub_radio'] . "\" class=\"liteoption\">" . + "</form></td>"; + } + else + { + $colspan = 2; + $add_sc = ""; + } + $template->assign_block_vars('catrow', array( 'COLOR' => ($i % 2) ? 'row1' : 'row2', 'TITLE' => $catrow[$i]['cat_title'], 'DESC' => $catrow[$i]['cat_desc'], + 'COLSPAN' => $colspan, + 'ADD_SC' => $add_sc, 'S_MOVE_UP' => append_sid("admin_radio_cat.$phpEx?action=move&move=-15&cat_id=" . $catrow[$i]['cat_id']), 'S_MOVE_DOWN' => append_sid("admin_radio_cat.$phpEx?action=move&move=15&cat_id=" . $catrow[$i]['cat_id']), *************** *** 131,134 **** --- 148,182 ---- ) ); + + if ($catrow[$i]['cat_type'] != 0) + { + // this is a parent category + $sc_sql = "SELECT * + FROM ". RADIOCAST_CAT_TABLE ." + WHERE cat_parent = " . $catrow[$i]['cat_id'] . " + GROUP BY cat_id + ORDER BY cat_order ASC"; + + if ( !($sc_result = $db->sql_query($sc_sql)) ) + { + mx_mx_message_die(GENERAL_ERROR, 'Could not query sub categories', '', __LINE__, __FILE__, $sc_sql); + } + + while ($subcatrow = $db->sql_fetchrow($sc_result)) + { + $template->assign_block_vars('catrow', array( + 'COLSPAN' => 2, + 'ADD_SC' => '', + 'COLOR' => ($i % 2) ? 'row1' : 'row2', + 'TITLE' => " " . $subcatrow['cat_title'], + 'DESC' => " " . preg_replace("#\n#", "<br> ", $subcatrow['cat_desc']), + 'S_MOVE_UP' => append_sid("admin_radio_cat.$phpEx?action=move&move=-15&cat_parent=" . $catrow[$i]['cat_id'] . "&cat_id=" . $subcatrow['cat_id']), + 'S_MOVE_UP' => append_sid("admin_radio_cat.$phpEx?action=move&move=15&cat_parent=" . $catrow[$i]['cat_id'] . "&cat_id=" . $subcatrow['cat_id']), + 'S_EDIT_ACTION' => append_sid("admin_radio_cat.$phpEx?action=edit&cat_id=" . $subcatrow['cat_id']), + 'S_DELETE_ACTION' => append_sid("admin_radio_cat.$phpEx?action=delete&cat_id=" . $subcatrow['cat_id']) + ) + ); + } + } } *************** *** 148,152 **** if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query radiocast Categories information', '', __LINE__, __FILE__, $sql); } if( $db->sql_numrows($result) == 0 ) --- 196,200 ---- if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query music Categories information', '', __LINE__, __FILE__, $sql); } if( $db->sql_numrows($result) == 0 ) *************** *** 247,251 **** if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query radiocast Categories information', '', __LINE__, __FILE__, $sql); } --- 295,299 ---- if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query music Categories information', '', __LINE__, __FILE__, $sql); } *************** *** 268,272 **** } ! $select_to = '<select name="target"><option value="0">'. $lang['Delete_all_STATIONS'] .'</option>'; for ($i = 0; $i < count($catrow); $i++) { --- 316,320 ---- } ! $select_to = '<select name="target"><option value="0">'. $lang['Delete_all_stations'] .'</option>'; for ($i = 0; $i < count($catrow); $i++) { *************** *** 310,314 **** // Return a message... ! $message = $lang['Category_changed_order'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); --- 358,362 ---- // Return a message... ! $message = $lang['Category_changed_order'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); *************** *** 316,322 **** } } ! else ! { ! if( $HTTP_POST_VARS['mode'] == 'new' ) { if( !isset($HTTP_POST_VARS['cat_title']) ) --- 364,370 ---- } } ! else ! { ! if(( $HTTP_POST_VARS['mode'] == 'new' ) || ($HTTP_POST_VARS['mode'] == 'newcat')) { if( !isset($HTTP_POST_VARS['cat_title']) ) *************** *** 326,329 **** --- 374,391 ---- ); + if ( !isset($HTTP_POST_VARS['cat_parent']) ) + { + $cat_parent = ""; + } + else + { + $cat_parent = "<input type=\"hidden\" value=\"" . $HTTP_POST_VARS['cat_parent'] . "\" name=\"cat_parent\">"; + } + + if ($HTTP_POST_VARS['mode'] == 'newcat') + { + $cat_type = "<input type=\"hidden\" value=\"1\" name=\"cat_type\">"; + } + $template->assign_vars(array( 'L_RADIOCAST_CAT_TITLE' => $lang['RadioCast_Categories_Title'], *************** *** 364,367 **** --- 426,432 ---- 'S_ADMIN' => RADIOCAST_ADMIN, + 'CAT_PARENT' => $cat_parent, + 'CAT_TYPE' => $cat_type, + 'L_PANEL_TITLE' => $lang['Create_category']) ); *************** *** 374,377 **** --- 439,460 ---- { // Get posting variables + + if ( !isset($HTTP_POST_VARS['cat_parent']) ) + { + $cat_parent = 0; + } + else + { + $cat_parent = intval($HTTP_POST_VARS['cat_parent']); + } + if ( !isset($HTTP_POST_VARS['cat_type']) ) + { + $cat_type = 0; + } + else + { + $cat_type = 1; + } + $cat_title = str_replace("\'", "''", htmlspecialchars(trim($HTTP_POST_VARS['cat_title']))); $cat_desc = str_replace("\'", "''", trim($HTTP_POST_VARS['cat_desc'])); *************** *** 390,394 **** if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query radiocast Categories information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); --- 473,477 ---- if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query music Categories information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); *************** *** 397,409 **** // Here we insert a new row into the db ! $sql = "INSERT INTO ". RADIOCAST_CAT_TABLE ." (cat_title, cat_desc, cat_order, cat_view_level, cat_upload_level, cat_rate_level, cat_comment_level, cat_edit_level, cat_delete_level, cat_approval) ! VALUES ('$cat_title', '$cat_desc', '$cat_order', '$view_level', '$upload_level', '$rate_level', '$comment_level', '$edit_level', '$delete_level', '$cat_approval')"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not create new radiocast Category', '', __LINE__, __FILE__, $sql); } // Return a message... ! $message = $lang['New_category_created'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); --- 480,492 ---- // Here we insert a new row into the db ! $sql = "INSERT INTO ". RADIOCAST_CAT_TABLE ." (cat_title, cat_desc, cat_order, cat_view_level, cat_upload_level, cat_rate_level, cat_comment_level, cat_edit_level, cat_delete_level, cat_approval, cat_parent, cat_type) ! VALUES ('$cat_title', '$cat_desc', '$cat_order', '$view_level', '$upload_level', '$rate_level', '$comment_level', '$edit_level', '$delete_level', '$cat_approval', $cat_parent, $cat_type)"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not create new music Category', '', __LINE__, __FILE__, $sql); } // Return a message... ! $message = $lang['New_category_created'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); *************** *** 430,438 **** if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not update this radiocast Category', '', __LINE__, __FILE__, $sql); } // Return a message... ! $message = $lang['Category_updated'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); --- 513,521 ---- if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not update this music Category', '', __LINE__, __FILE__, $sql); } // Return a message... ! $message = $lang['Category_updated'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); *************** *** 445,476 **** if( $target == 0 ) // Delete All { ! // Get file information of all STATIONS in this category ! $sql = "SELECT station_id, station_filename, station_cat_id FROM ". RADIOCAST_TABLE ." ! WHERE station_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query radiocast information', '', __LINE__, __FILE__, $sql); } ! $stationrow = array(); while( $row = $db ->sql_fetchrow($result) ) { ! $stationrow[] = $row; ! $station_id_row[] = $row['station_id']; } ! if( count($stationrow) != 0 ) // if this category is not empty { ! // Delete all physical station ! for ($i = 0; $i < count($stationrow); $i++) { ! @unlink('../' . RADIOCAST_UPLOAD_PATH . $stationrow[$i]['station_filename']); } ! $station_id_sql = '(' . implode(',', $station_id_row) . ')'; // Delete all related ratings $sql = "DELETE FROM ". RADIOCAST_RATE_TABLE ." ! WHERE rate_station_id IN ". $station_id_sql; if(!$result = $db->sql_query($sql)) { --- 528,559 ---- if( $target == 0 ) // Delete All { ! // Get file information of all stations in this category ! $sql = "SELECT song_id, song_filename, song_cat_id FROM ". RADIOCAST_TABLE ." ! WHERE song_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not query music information', '', __LINE__, __FILE__, $sql); } ! $songrow = array(); while( $row = $db ->sql_fetchrow($result) ) { ! $songrow[] = $row; ! $song_id_row[] = $row['song_id']; } ! if( count($songrow) != 0 ) // if this category is not empty { ! // Delete all physical song ! for ($i = 0; $i < count($songrow); $i++) { ! @unlink('../' . RADIOCAST_UPLOAD_PATH . $songrow[$i]['song_filename']); } ! $song_id_sql = '(' . implode(',', $song_id_row) . ')'; // Delete all related ratings $sql = "DELETE FROM ". RADIOCAST_RATE_TABLE ." ! WHERE rate_song_id IN ". $song_id_sql; if(!$result = $db->sql_query($sql)) { *************** *** 480,484 **** // Delete all related comments $sql = "DELETE FROM ". RADIOCAST_COMMENT_TABLE ." ! WHERE comment_station_id IN ". $station_id_sql; if(!$result = $db->sql_query($sql)) { --- 563,567 ---- // Delete all related comments $sql = "DELETE FROM ". RADIOCAST_COMMENT_TABLE ." ! WHERE comment_song_id IN ". $song_id_sql; if(!$result = $db->sql_query($sql)) { *************** *** 486,495 **** } ! // Delete station entries in db $sql = "DELETE FROM ". RADIOCAST_TABLE ." ! WHERE station_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not delete station entries in the DB', '', __LINE__, __FILE__, $sql); } } --- 569,578 ---- } ! // Delete song entries in db $sql = "DELETE FROM ". RADIOCAST_TABLE ." ! WHERE song_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { ! mx_message_die(GENERAL_ERROR, 'Could not delete song entries in the DB', '', __LINE__, __FILE__, $sql); } } *************** *** 507,511 **** // Return a message... ! $message = $lang['Category_deleted'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); --- 590,594 ---- // Return a message... ! $message = $lang['Category_deleted'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); *************** *** 514,519 **** { $sql = "UPDATE ". RADIOCAST_TABLE ." ! SET station_cat_id = '$target' ! WHERE station_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { --- 597,602 ---- { $sql = "UPDATE ". RADIOCAST_TABLE ." ! SET song_cat_id = '$target' ! WHERE song_cat_id = '$cat_id'"; if(!$result = $db->sql_query($sql)) { *************** *** 533,537 **** // Return a message... ! $message = $lang['Category_deleted'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); --- 616,620 ---- // Return a message... ! $message = $lang['Category_deleted'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_category'], "<a href=\"" . append_sid("admin_radio_cat.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); mx_message_die(GENERAL_MESSAGE, $message); Index: admin_radio_auth.php =================================================================== RCS file: /cvsroot/mxbb/mx_radiocast/admin/admin_radio_auth.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_radio_auth.php 6 Jun 2007 23:03:45 -0000 1.1 --- admin_radio_auth.php 17 Sep 2007 07:19:36 -0000 1.2 *************** *** 206,210 **** // okay, return a message... ! $message = $lang['RadioCast_Auth_successfully'] . '<br /><br />' . sprintf($lang['Click_return_radiocast_auth'], '<a href="' . append_sid("admin_radio_auth.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'); mx_message_die(GENERAL_MESSAGE, $message); --- 206,210 ---- // okay, return a message... ! $message = $lang['RadioCast_Auth_successfully'] . '<br /><br />' . sprintf($lang['Click_return_radiocast_auth'], '<a href="' . append_sid("admin_radio_auth.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . '">', '</a>'); mx_message_die(GENERAL_MESSAGE, $message); Index: admin_radio_cfg.php =================================================================== RCS file: /cvsroot/mxbb/mx_radiocast/admin/admin_radio_cfg.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_radio_cfg.php 6 Jun 2007 23:03:46 -0000 1.1 --- admin_radio_cfg.php 17 Sep 2007 07:19:36 -0000 1.2 *************** *** 85,89 **** if( isset($HTTP_POST_VARS['submit']) ) { ! $message = $lang['RadioCast_config_updated'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_config'], "<a href=\"" . append_sid("admin_radio_cfg.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); --- 85,89 ---- if( isset($HTTP_POST_VARS['submit']) ) { ! $message = $lang['RadioCast_config_updated'] . "<br /><br />" . sprintf($lang['Click_return_radiocast_config'], "<a href=\"" . append_sid("admin_radio_cfg.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid($mx_root_path . "admin/index.$phpEx?pane=right") . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); |