diff --git a/admin/artists.php b/admin/artists.php index 2deb16a..29f5e0c 100644 --- a/admin/artists.php +++ b/admin/artists.php @@ -3,76 +3,76 @@ function gigpress_artists() { global $wpdb; - + if(isset($_POST['gpaction']) && $_POST['gpaction'] == "add") { require_once('handlers.php'); - $result = gigpress_add_artist(); + $result = gigpress_add_artist(); } - + if(isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once('handlers.php'); $result = gigpress_update_artist(); } - + if(isset($_GET['gpaction']) && $_GET['gpaction'] == "delete") { require_once('handlers.php'); - gigpress_delete_artist(); + gigpress_delete_artist(); } if(isset($_GET['gpaction']) && $_GET['gpaction'] == "import-tours") { require_once('handlers.php'); - gigpress_map_tours_to_artists(); + gigpress_map_tours_to_artists(); } - - $url_args = (isset($_GET['gp-page'])) ? '&gp-page=' . sanitize_text_field($_GET['gp-page']) : ''; - + + $url_args = (isset($_GET['gp-page'])) ? '&gp-page=' . sanitize_text_field($_GET['gp-page']) : ''; + ?>
![]() |
+ ![]() |
artist_id; ?> | artist_url)) echo ''; echo wptexturize($artist->artist_name); if(!empty($artist->artist_url)) echo '';?> | @@ -177,8 +177,8 @@ function gigpress_artists() { - - - + + + gigpress_db_in($_POST['artist_name']), @@ -45,8 +45,8 @@ function gigpress_prepare_show_fields($context = 'new') { 'artist_url' => gigpress_db_in($_POST['artist_url'], FALSE) ); $insert_artist = $wpdb->insert(GIGPRESS_ARTISTS, $artist); - - if($insert_artist) { + + if($insert_artist) { $show['show_artist_id'] = $wpdb->insert_id; } else { $errors[] = __("We had trouble creating your new artist. Sorry.", "gigpress"); @@ -54,14 +54,14 @@ function gigpress_prepare_show_fields($context = 'new') { } else { $show['show_artist_id'] = gigpress_db_in($_POST['show_artist_id']); } - + // Create a new venue if($_POST['show_venue_id'] == 'new') { - + $venue = gigpress_prepare_venue_fields(); $insert_venue = $wpdb->insert(GIGPRESS_VENUES, $venue); - - if($insert_venue) { + + if($insert_venue) { $show['show_venue_id'] = $wpdb->insert_id; } else { $errors[] = __("We had trouble creating your new venue. Sorry.", "gigpress"); @@ -70,27 +70,27 @@ function gigpress_prepare_show_fields($context = 'new') { } else { $show['show_venue_id'] = gigpress_db_in($_POST['show_venue_id']); } - + // Create a new tour if($_POST['show_tour_id'] == 'new') { - + $tour = array('tour_name' => gigpress_db_in($_POST['tour_name'])); - + $insert_tour = $wpdb->insert(GIGPRESS_TOURS, $tour); - - if($insert_tour) { + + if($insert_tour) { $show['show_tour_id'] = $wpdb->insert_id; } else { $errors[] = __("We had trouble creating your new tour. Sorry.", "gigpress"); } } else { $show['show_tour_id'] = gigpress_db_in($_POST['show_tour_id']); - } - + } + // Create a new related post if($_POST['show_related'] == "new") { - + // Find the variables we need for token replacement $artist = $wpdb->get_var( $wpdb->prepare("SELECT artist_name FROM " . GIGPRESS_ARTISTS . " WHERE artist_id = '%d'", $show['show_artist_id']) @@ -98,7 +98,7 @@ function gigpress_prepare_show_fields($context = 'new') { $venue = $wpdb->get_results( $wpdb->prepare("SELECT venue_name, venue_city FROM " . GIGPRESS_VENUES . " WHERE venue_id = '%d'", $show['show_venue_id']), ARRAY_A); - + // Prepare the post title $token_title = (isset($_POST['show_related_title'])) ? stripslashes(strip_tags(trim($_POST['show_related_title']))) : $gpo['default_title']; $find = array('%date%', '%long_date%', '%artist%', '%venue%', '%city%'); @@ -109,9 +109,9 @@ function gigpress_prepare_show_fields($context = 'new') { gigpress_db_in($venue[0]['venue_name']), gigpress_db_in($venue[0]['venue_city']) ); - + $post_date = ($_POST['show_related_date'] == 'show') ? $show['show_date'] . ' ' . $show['show_time'] : ''; - + $related_post = array( 'post_title' => str_replace($find, $replace, $token_title), 'post_category' => array($gpo['related_category']), @@ -119,7 +119,7 @@ function gigpress_prepare_show_fields($context = 'new') { 'post_status' => "publish", 'post_content' => '' ); - + $insert = wp_insert_post($related_post); if ( $insert == 0 ) { @@ -130,7 +130,7 @@ function gigpress_prepare_show_fields($context = 'new') { { $show['show_related'] = $insert; } - + $gpo['default_title'] = $token_title; $gpo['related_date'] = gigpress_db_in($_POST['show_related_date']); } @@ -138,7 +138,7 @@ function gigpress_prepare_show_fields($context = 'new') { { $show['show_related'] = absint($_POST['show_related']); } - + if($context == 'new') { // Sticky stuff for the next entry @@ -150,9 +150,9 @@ function gigpress_prepare_show_fields($context = 'new') { $gpo['default_tour'] = $show['show_tour_id']; update_option('gigpress_settings', $gpo); } - + // Not doing anything with $errors I suppose? Was I on crack when I wrote this? - + return $show; } @@ -162,9 +162,9 @@ function gigpress_prepare_venue_fields() { $venue = array( 'venue_name' => gigpress_db_in($_POST['venue_name']), 'venue_address' => gigpress_db_in($_POST['venue_address']), - 'venue_city' => gigpress_db_in($_POST['venue_city']), - 'venue_state' => gigpress_db_in($_POST['venue_state']), - 'venue_postal_code' => gigpress_db_in($_POST['venue_postal_code']), + 'venue_city' => gigpress_db_in($_POST['venue_city']), + 'venue_state' => gigpress_db_in($_POST['venue_state']), + 'venue_postal_code' => gigpress_db_in($_POST['venue_postal_code']), 'venue_country' => gigpress_db_in($_POST['venue_country']), 'venue_url' => gigpress_db_in($_POST['venue_url'], FALSE), 'venue_phone' => gigpress_db_in($_POST['venue_phone']) @@ -175,9 +175,9 @@ function gigpress_prepare_venue_fields() { function gigpress_error_checking($context) { - + $errors = array(); - + switch($context) { case 'show': if(empty($_POST['show_venue_id'])) @@ -195,7 +195,7 @@ function gigpress_error_checking($context) { if(!checkdate($_POST['gp_mm'], $_POST['gp_dd'], $_POST['gp_yy'])) $errors['show_date'] = __("That's not a valid date.", "gigpress"); if(isset($_POST['show_multi']) && !checkdate($_POST['exp_mm'], $_POST['exp_dd'], $_POST['exp_yy'])) - $errors['expire_date'] = __("That's not a valid end date.", "gigpress"); + $errors['expire_date'] = __("That's not a valid end date.", "gigpress"); break; case 'artist': if(empty($_POST['artist_name'])) @@ -204,7 +204,7 @@ function gigpress_error_checking($context) { case 'tour': if(empty($_POST['tour_name'])) $errors['tour_name'] = __("You must enter a tour name.", "gigpress"); - break; + break; case 'venue': if(empty($_POST['venue_name'])) $errors['venue_name'] = __("You must enter a venue name.", "gigpress"); @@ -220,34 +220,34 @@ function gigpress_error_checking($context) { function gigpress_add_show() { global $wpdb; - + $wpdb->show_errors(); check_admin_referer('gigpress-action'); - + $errors = gigpress_error_checking('show'); - + if($errors) { echo(' |