diff -r 6b96085291d7 -r fb7cd02b9848 web/wp-content/plugins/gigs-calendar/gigs.ajax.php
--- a/web/wp-content/plugins/gigs-calendar/gigs.ajax.php Tue Jan 05 09:48:24 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,845 +0,0 @@
-search("date >= CURDATE()", 'date');
- $v->search('deleted = 0', 'name');
- ?>
-
-

-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
- fetch() ) : $v = $g->getVenue(); $p = $g->getPerformances(); $post = get_post($g->postID);?>
- ">
- id; ?> |
- eventName; ?> |
- name; ?> |
- city . (!empty($v->state) ? ', ' . $v->state : '') ?> |
- date ?> |
-
- fetch() ) : ?>
- time) ?>
-
- |
-
-
- |
-
- ">
- |
- |
-
-
-
-
-
-
- venueID = $_POST['venueID'];
- $g->date = $_POST['date'];
- $g->notes = $_POST['notes'];
- $g->eventName = $_POST['eventName'];
- $g->tour_id = ( $_POST['tour_id'] == -1 ? null : $_POST['tour_id'] );
-
- if ( $g->save() ) {
- $g->setTags($_POST['tags']);
- if ( isset($_POST['performanceID']) ) {
- foreach ( $_POST['performanceID'] as $key => $pid ) {
- $p = new performance((empty($pid) ? null : $pid));
- $p->gigID = $g->id;
- $p->link = ($_POST['link'][$key] == 'http://') ? '' : $_POST['link'][$key];
- $p->shortNotes = $_POST['shortNotes'][$key];
- $p->ages = (empty($_POST['ages-custom'][$key]) ? $_POST['ages'][$key] : $_POST['ages-custom'][$key]);
- $p->time = ($_POST['tbd'][$key] == "1") ? null : date("H:i:s", strtotime($_POST['hour'][$key] . ':' . $_POST['minute'][$key] . ' ' . $_POST['meridiem'][$key]));
- $p->save();
- }
- }
-
- foreach ( $_POST['custom-key'] as $key => $field ) {
- if ( $_POST['custom-value'][$key] === "" ) {
- // If the value is empty, just ignore this field.
- continue;
- } else {
- if ( is_array($_POST['custom-value'][$key]) ) {
- foreach ( $_POST['custom-value'][$key] as $k => $v ) {
- if ( $v === "" ) {
- unset($_POST['custom-value'][$key][$k]);
- }
- }
- }
- add_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['custom-value'][$key]);
- }
- }
-
-
- echo '{success:true, gig:' . $g->toJSON() . '}';
- } else {
- echo '{success:false,error:"' . ($g->getError() == '' ? 'An unknown error has occurred' : 'DB Error: ' . addslashes($g->getError())) . '"}';
- }
- break;
- case 'getRow':
- $g = new gig($_POST['id']);
- $v = $g->getVenue();
- $p = $g->getPerformances();
- $post = get_post($g->postID);
- ?>
- ">
- id; ?> |
- eventName; ?> |
- name; ?> |
- city . (!empty($v->state) ? ', ' . $v->state : '') ?> |
- date ?> |
-
- fetch() ) : ?>
- time) ?>
-
- |
-
-
- |
-
- ">
- |
- |
-
- delete();
- echo '{"success": ' . ($result ? 'true' : 'false') . ',"action":"delete"' . ($result ? '' : ',"error":"db"') . '}';
- break;
- case 'edit':
- $g = new gig($_POST['id']);
- $p = $g->getPerformances();
- $v = $g->getVenue();
- ?>
-
-
-
- setTags($_POST['tags']);
-
- $g->date = $_POST['date'];
- $g->notes = $_POST['notes'];
- $g->eventName = $_POST['eventName'];
- $g->tour_id = ( $_POST['tour_id'] == -1 ? null : $_POST['tour_id'] );
-
- if ( isset($_POST['performanceID']) ) {
- foreach ( $_POST['performanceID'] as $key => $pid ) {
- $p = new performance((empty($pid) ? null : $pid));
- $p->gigID = $g->id;
- $p->link = ($_POST['link'][$key] == 'http://') ? '' : $_POST['link'][$key];
- $p->shortNotes = $_POST['shortNotes'][$key];
- $p->ages = (empty($_POST['ages-custom'][$key]) ? $_POST['ages'][$key] : $_POST['ages-custom'][$key]);
- $p->time = ($_POST['tbd'][$key] == "1") ? null : date("H:i:s", strtotime($_POST['hour'][$key] . ':' . $_POST['minute'][$key] . ' ' . $_POST['meridiem'][$key]));
- $p->save();
- }
- }
-
- $p = new performance();
- if ( isset($_POST['delete']) ) {
- foreach ( $_POST['delete'] as $pid ) {
- $p->get($pid);
- $p->delete();
- }
- }
-
- $g->save();
-
- if ( isset($_POST['deletecustom']) && is_array($_POST['deletecustom']) ) {
- foreach ( $_POST['deletecustom'] as $key => $delete ) {
- if ( $delete ) {
- delete_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['old-custom-value'][$key]);
- }
- }
- }
-
- if ( isset($_POST['custom-key']) && is_array($_POST['custom-key']) ) {
-
- foreach ( $_POST['custom-key'] as $key => $field ) {
- if ( is_array($_POST['custom-value'][$key]) ) {
- foreach ( $_POST['custom-value'][$key] as $k => $v ) {
- if ( $v === "" ) {
- unset($_POST['custom-value'][$key][$k]);
- }
- }
- }
- if ( empty($_POST['custom-value'][$key]) && empty($_POST['old-custom-value'][$key]) ) {
- // If both value fields are empty, just ignore this field.
- continue;
- } elseif ( $_POST['custom-value'][$key] === "" ) {
- // If the old value is not empty, but the new one is, delete this sucker.
- delete_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['old-custom-value'][$key]);
- } elseif ( $_POST['old-custom-value'][$key] === "" ) {
- // If the old value is empty, but the new one is not, create a new custom field.
- add_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['custom-value'][$key]);
- } elseif ( $_POST['old-custom-value'][$key] != $_POST['custom-value'][$key] && $_POST['old-custom-value'][$key] != serialize($_POST['custom-value'][$key]) ) {
- // If the old and new values are not equal, update the custom field.
- update_post_meta($g->postID, $_POST['custom-key'][$key], $_POST['custom-value'][$key], unserialize($_POST['old-custom-value'][$key]));
- }
- }
- }
-
- echo '{success:true, gig:' . $g->toJSON() . '}';
- break;
-
- case 'performance-form':
- if ( isset($_POST['id']) ) {
- pForm($_POST['id'], false);
- } else {
- pForm((int) $_POST['count'], true);
- }
- break;
-}
-
-
-function pForm($id, $new = true, $remove = true) {
- global $folder, $gcd, $options;
- $p = new performance();
- if ( $new ) {
- $count = 'c' . $id;
- } else {
- $p->get($id);
- $count = 'id' . $id;
- }
-
- $ages = $options['ages-list'];
-
- $time = explode(":", $p->time);
- $minutes = $time[1];
-
- if ( $options['time-12h'] ) {
- if ( $time[0] == 0 ) {
- $hour = "12";
- $meridiem = "AM";
- } elseif ( $time[0] == 12 ) {
- $hour = "12";
- $meridiem = "PM";
- } elseif ( $time[0] < 12 ) {
- $hour = $time[0];
- $meridiem = "AM";
- } else {
- $hour = $time[0] - 12;
- $meridiem = "PM";
- }
- } else {
- $hour = $time[0];
- }
- ?>
-
-
-