Events Manager - Version 2.2

Version Description

Download this release

Release Info

Developer nutsmuggler
Plugin Icon 128x128 Events Manager
Version 2.2
Comparing to
See all releases

Code changes from version 2.1 to 2.2

dbem_calendar.php CHANGED
@@ -37,7 +37,7 @@ function dbem_get_calendar($args="") {
37
if(isset($_GET['calyear']) && $_GET['calyear'] != '') {
38
$year = dbem_sanitize_request($_GET['calyear']) ;
39
} else {
40
- if ($year == '')
41
$year = date('Y');
42
}
43
$date = mktime(0,0,0,$month, date('d'), $year);
@@ -280,7 +280,7 @@ function dbem_get_calendar($args="") {
280
}
281
}else{
282
//Only show events on the day that they start
283
- if( is_array($eventful_days[$event['event_start_date']]) ){
284
$eventful_days[$event['event_start_date']][] = $event;
285
} else {
286
$eventful_days[$event['event_start_date']] = array($event);
@@ -478,8 +478,8 @@ add_action('wp_head', 'dbem_ajaxize_calendar');
478
function dbem_filter_calendar_ajax() {
479
if(isset($_GET['ajaxCalendar']) && $_GET['ajaxCalendar'] == true) {
480
(isset($_GET['full']) && $_GET['full'] == 1) ? $full = 1 : $full = 0;
481
- $month = dbem_sanitize_request($_GET['month']);
482
- $year = dbem_sanitize_request($_GET['year']);
483
dbem_get_calendar('echo=1&full='.$full);
484
die();
485
}
37
if(isset($_GET['calyear']) && $_GET['calyear'] != '') {
38
$year = dbem_sanitize_request($_GET['calyear']) ;
39
} else {
40
+ if (!isset($year) || $year == '')
41
$year = date('Y');
42
}
43
$date = mktime(0,0,0,$month, date('d'), $year);
280
}
281
}else{
282
//Only show events on the day that they start
283
+ if( isset($eventful_days[$event['event_start_date']]) && is_array($eventful_days[$event['event_start_date']]) ){
284
$eventful_days[$event['event_start_date']][] = $event;
285
} else {
286
$eventful_days[$event['event_start_date']] = array($event);
478
function dbem_filter_calendar_ajax() {
479
if(isset($_GET['ajaxCalendar']) && $_GET['ajaxCalendar'] == true) {
480
(isset($_GET['full']) && $_GET['full'] == 1) ? $full = 1 : $full = 0;
481
+ // $month = dbem_sanitize_request($_GET['month']);
482
+ // $year = dbem_sanitize_request($_GET['year']);
483
dbem_get_calendar('echo=1&full='.$full);
484
die();
485
}
dbem_events.php CHANGED
@@ -112,22 +112,24 @@ function dbem_events_subpanel() {
112
113
if ($validation_result == "OK") {
114
// validation successful
115
-
116
- $related_location = dbem_get_identical_location ( $location );
117
- // print_r($related_location);
118
- if ($related_location) {
119
- $event ['location_id'] = $related_location ['location_id'];
120
- $recurrence ['location_id'] = $related_location ['location_id'];
121
} else {
122
123
- $new_location = dbem_insert_location ( $location );
124
- $event ['location_id'] = $new_location ['location_id'];
125
- $recurrence ['location_id'] = $new_location ['location_id'];
126
- //print_r($new_location);
127
-
128
129
}
130
-
131
if (! $event_ID && ! $recurrence_ID) {
132
// there isn't anything
133
if ($_POST ['repeated_event']) {
@@ -156,7 +158,7 @@ function dbem_events_subpanel() {
156
// unlink from recurrence in case it was generated by one
157
//$event ['recurrence_id'] = null;
158
if( isset($event ['recurrence_id']) ) unset($event ['recurrence_id']);
159
- $where ['event_id'] = $event_ID;
160
$result = $wpdb->update ( $event_table_name, $event, $where );
161
$feedback_message = "'" . $event ['event_name'] . "' " . __ ( 'updated', 'dbem' ) . "!";
162
}
@@ -269,7 +271,19 @@ function dbem_options_subpanel() {
269
<h2><?php
270
_e ( 'Event Manager Options', 'dbem' );
271
?></h2>
272
- <form id="dbem_options_form" method="post" action="options.php">
273
<h3><?php
274
_e ( 'Events page', 'dbem' );
275
?></h3>
@@ -304,8 +318,7 @@ function dbem_options_subpanel() {
304
dbem_options_input_text ( __ ( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __ ( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
305
306
?>
307
-
308
- </table>
309
310
<h3><?php
311
_e ( 'Locations format', 'dbem' );
@@ -433,7 +446,9 @@ function dbem_events_page_content() {
433
}
434
if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
435
// single event page
436
- $event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
437
$event = dbem_get_event ( $event_ID );
438
$single_event_format = get_option ( 'dbem_single_event_format' );
439
$page_body = dbem_replace_placeholders ( $single_event_format, $event, 'stop' );
@@ -532,6 +547,8 @@ function dbem_events_page_title($data) {
532
if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
533
// single event page
534
$event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
535
$event = dbem_get_event ( $event_ID );
536
$stored_page_title_format = get_option ( 'dbem_event_page_title_format' );
537
$page_title = dbem_replace_placeholders ( $stored_page_title_format, $event );
@@ -556,14 +573,16 @@ function dbem_filter_get_pages($data) {
556
$output = array ();
557
$events_page_id = get_option ( 'dbem_events_page' );
558
for($i = 0; $i < count ( $data ); ++ $i) {
559
- if ($data [$i]->ID == $events_page_id) {
560
- $list_events_page = get_option ( 'dbem_list_events_page' );
561
- if ($list_events_page) {
562
- $data [$i]->post_title = get_option ( 'dbem_events_page_title' ) . "&nbsp;";
563
$output [] = $data [$i];
564
- }
565
- } else {
566
- $output [] = $data [$i];
567
}
568
}
569
return $output;
@@ -987,7 +1006,7 @@ function dbem_events_table($events, $limit, $title) {
987
_e ( 'Bulk Actions' );
988
?></option>
989
<option value="deleteEvents"><?php
990
- _e ( 'Delete selected' );
991
?></option>
992
993
</select> <input type="submit" value="<?php
@@ -1168,7 +1187,8 @@ function dbem_events_table($events, $limit, $title) {
1168
}
1169
function dbem_event_form($event, $title, $element) {
1170
1171
- global $localised_date_formats;
1172
// change prefix according to event/recurrence
1173
$_GET ['action'] == "edit_recurrence" ? $pref = "recurrence_" : $pref = "event_";
1174
@@ -1242,11 +1262,12 @@ function dbem_event_form($event, $title, $element) {
1242
<?php
1243
/* Marcus Begin Edit */
1244
//This is an edit for WP 2.8 for styling fix
1245
- ?>
1246
<div id="poststuff" class="metabox-holder has-right-sidebar">
1247
<!-- SIDEBAR -->
1248
<div id="side-info-column" class='inner-sidebar'>
1249
- <div id='side-sortables'>
1250
<!-- recurrence postbox -->
1251
<div class="postbox ">
1252
<div class="handlediv" title="Fare clic per cambiare."><br />
@@ -1288,8 +1309,7 @@ function dbem_event_form($event, $title, $element) {
1288
<input id="recurrence-interval" name='recurrence_interval'
1289
size='2' value='<?php
1290
echo $event ['recurrence_interval'];
1291
- ?>'>
1292
- </input>
1293
<span class='interval-desc' id="interval-daily-singular">
1294
<?php _e ( 'day', 'dbem' )?>
1295
</span> <span class='interval-desc' id="interval-daily-plural">
@@ -1357,7 +1377,9 @@ function dbem_event_form($event, $title, $element) {
1357
}
1358
?>
1359
</div>
1360
- </div>
1361
<div class="postbox ">
1362
<div class="handlediv" title="Fare clic per cambiare."><br />
1363
</div>
@@ -1417,7 +1439,8 @@ function dbem_event_form($event, $title, $element) {
1417
<?php
1418
/* Marcus Begin Edit */
1419
//adding the category selection box
1420
- ?>
1421
<div class="postbox ">
1422
<div class="handlediv" title="Fare clic per cambiare."><br />
1423
</div>
@@ -1445,7 +1468,8 @@ function dbem_event_form($event, $title, $element) {
1445
</select>
1446
</p>
1447
</div>
1448
- </div>
1449
</div>
1450
<?php/* Marcus End Edit */ ?>
1451
</div>
@@ -1563,14 +1587,40 @@ function dbem_event_form($event, $title, $element) {
1563
?>
1564
</h3>
1565
<div class="inside">
1566
- <table id="dbem-location-data">
1567
<tr>
1568
- <th><?php
1569
- _e ( 'Name:' )?>
1570
&nbsp;</th>
1571
<td><input id="location-name" type="text" name="location_name"
1572
value="<?php
1573
echo $event ['location_name']?>" /></td>
1574
<?php
1575
$gmap_is_active = get_option ( 'dbem_gmap_is_active' );
1576
?>
@@ -1590,13 +1640,23 @@ function dbem_event_form($event, $title, $element) {
1590
<?php
1591
}
1592
; // end of IF_GMAP_ACTIVE ?>
1593
- </tr>
1594
<tr>
1595
- <td colspan='2'><p>
1596
- <?php
1597
- _e ( 'The name of the location where the event takes place. You can use the name of a venue, a square, etc', 'dbem' )?>
1598
- </p></td>
1599
</tr>
1600
<tr>
1601
<th><?php
1602
_e ( 'Address:' )?>
@@ -1626,6 +1686,7 @@ function dbem_event_form($event, $title, $element) {
1626
_e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?>
1627
</p></td>
1628
</tr>
1629
</table>
1630
</div>
1631
</div>
@@ -1646,6 +1707,7 @@ function dbem_event_form($event, $title, $element) {
1646
_e ( 'Details about the event', 'dbem' )?>
1647
</div>
1648
</div>
1649
<?php/* Marcus Begin Edit */ ?>
1650
<div id="event_attributes" class="postbox">
1651
<h3>
@@ -1658,6 +1720,7 @@ function dbem_event_form($event, $title, $element) {
1658
</div>
1659
</div>
1660
<?php/* Marcus End Edit */ ?>
1661
</div>
1662
<p class="submit">
1663
<input type="submit" name="events_update"
@@ -2039,10 +2102,17 @@ function dbem_admin_map_script() {
2039
}
2040
2041
$j(document).ready(function() {
2042
- eventLocation = $j("input#location-name").val();
2043
- eventTown = $j("input#location-town").val();
2044
eventAddress = $j("input#location-address").val();
2045
-
2046
loadMap(eventLocation, eventTown, eventAddress);
2047
2048
$j("input#location-name").blur(function(){
@@ -2251,7 +2321,7 @@ function dbem_favorite_menu($actions) {
2251
////////////////////////////////////
2252
// WP 2.7 options registration
2253
function dbem_options_register() {
2254
- $options = array ('dbem_events_page', 'dbem_display_calendar_in_events_page', 'dbem_use_event_end', 'dbem_event_list_item_format_header', 'dbem_event_list_item_format', 'dbem_event_list_item_format_footer', 'dbem_event_page_title_format', 'dbem_single_event_format', 'dbem_list_events_page', 'dbem_events_page_title', 'dbem_no_events_message', 'dbem_location_page_title_format', 'dbem_location_baloon_format', 'dbem_single_location_format', 'dbem_location_event_list_item_format', 'dbem_location_no_events_message', 'dbem_gmap_is_active', 'dbem_rss_main_title', 'dbem_rss_main_description', 'dbem_rss_title_format', 'dbem_rss_description_format', 'dbem_gmap_key', 'dbem_map_text_format', 'dbem_rsvp_mail_notify_is_active', 'dbem_contactperson_email_body', 'dbem_respondent_email_body', 'dbem_mail_sender_name', 'dbem_smtp_username', 'dbem_smtp_password', 'dbem_default_contact_person', 'dbem_mail_sender_address', 'dbem_mail_receiver_address', 'dbem_smtp_host', 'dbem_rsvp_mail_send_method', 'dbem_rsvp_mail_port', 'dbem_rsvp_mail_SMTPAuth', 'dbem_image_max_width', 'dbem_image_max_height', 'dbem_image_max_size','dbem_full_calendar_event_format');
2255
foreach ( $options as $opt ) {
2256
register_setting ( 'dbem-options', $opt, '' );
2257
}
112
113
if ($validation_result == "OK") {
114
// validation successful
115
+ if(isset($_POST['location-select-id']) && $_POST['location-select-id'] != "") {
116
+ $event ['location_id'] = $_POST['location-select-id'];
117
+ $recurrence ['location_id'] = $_POST['location-select-id'];
118
} else {
119
+ $related_location = dbem_get_identical_location ( $location );
120
+ // print_r($related_location);
121
+ if ($related_location) {
122
+ $event ['location_id'] = $related_location ['location_id'];
123
+ $recurrence ['location_id'] = $related_location ['location_id'];
124
+ } else {
125
126
+ $new_location = dbem_insert_location ( $location );
127
+ $event ['location_id'] = $new_location ['location_id'];
128
+ $recurrence ['location_id'] = $new_location ['location_id'];
129
+ //print_r($new_location);
130
131
+ }
132
}
133
if (! $event_ID && ! $recurrence_ID) {
134
// there isn't anything
135
if ($_POST ['repeated_event']) {
158
// unlink from recurrence in case it was generated by one
159
//$event ['recurrence_id'] = null;
160
if( isset($event ['recurrence_id']) ) unset($event ['recurrence_id']);
161
+ $where ['event_id'] = $event_ID;
162
$result = $wpdb->update ( $event_table_name, $event, $where );
163
$feedback_message = "'" . $event ['event_name'] . "' " . __ ( 'updated', 'dbem' ) . "!";
164
}
271
<h2><?php
272
_e ( 'Event Manager Options', 'dbem' );
273
?></h2>
274
+ <form id="dbem_options_form" method="post" action="options.php">
275
+ <h3><?php
276
+ _e ( 'General options', 'dbem' );
277
+ ?></h3>
278
+ <table class="form-table">
279
+ <?php
280
+ dbem_options_radio_binary ( __ ( 'Use dropdown for locations?' ), 'dbem_use_select_for_locations', __ ( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
281
+ dbem_options_radio_binary ( __ ( 'Use recurrence?' ), 'dbem_recurrence_enabled', __ ( 'Select yes to enable the recurrence features feature','dbem' ) );
282
+ dbem_options_radio_binary ( __ ( 'Use RSVP?' ), 'dbem_rsvp_enabled', __ ( 'Select yes to enable the recurrence features feature','dbem' ) );
283
+ dbem_options_radio_binary ( __ ( 'Use categories?' ), 'dbem_categories_enabled', __ ( 'Select yes to enable the category features','dbem' ) );
284
+ dbem_options_radio_binary ( __ ( 'Use attributes?' ), 'dbem_attributes_enabled', __ ( 'Select yes to enable the attributes feature','dbem' ) );
285
+ ?>
286
+ </table>
287
<h3><?php
288
_e ( 'Events page', 'dbem' );
289
?></h3>
318
dbem_options_input_text ( __ ( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __ ( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
319
320
?>
321
+ </table>
322
323
<h3><?php
324
_e ( 'Locations format', 'dbem' );
446
}
447
if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
448
// single event page
449
+ $event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
450
+ // measure against blind sql attack suggested by Danilo Massa
451
+ settype($event_ID, "int");
452
$event = dbem_get_event ( $event_ID );
453
$single_event_format = get_option ( 'dbem_single_event_format' );
454
$page_body = dbem_replace_placeholders ( $single_event_format, $event, 'stop' );
547
if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
548
// single event page
549
$event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
550
+ // measure against blind sql attack suggested by Danilo Massa
551
+ settype($event_ID, "int");
552
$event = dbem_get_event ( $event_ID );
553
$stored_page_title_format = get_option ( 'dbem_event_page_title_format' );
554
$page_title = dbem_replace_placeholders ( $stored_page_title_format, $event );
573
$output = array ();
574
$events_page_id = get_option ( 'dbem_events_page' );
575
for($i = 0; $i < count ( $data ); ++ $i) {
576
+ if(isset($data [$i])) {
577
+ if ($data [$i]->ID == $events_page_id) {
578
+ $list_events_page = get_option ( 'dbem_list_events_page' );
579
+ if ($list_events_page) {
580
+ $data [$i]->post_title = get_option ( 'dbem_events_page_title' ) . "&nbsp;";
581
+ $output [] = $data [$i];
582
+ }
583
+ } else {
584
$output [] = $data [$i];
585
+ }
586
}
587
}
588
return $output;
1006
_e ( 'Bulk Actions' );
1007
?></option>
1008
<option value="deleteEvents"><?php
1009
+ _e ( 'Delete selected','dbem' );
1010
?></option>
1011
1012
</select> <input type="submit" value="<?php
1187
}
1188
function dbem_event_form($event, $title, $element) {
1189
1190
+ global $localised_date_formats;
1191
+ $use_select_for_locations = get_option('dbem_use_select_for_locations');
1192
// change prefix according to event/recurrence
1193
$_GET ['action'] == "edit_recurrence" ? $pref = "recurrence_" : $pref = "event_";
1194
1262
<?php
1263
/* Marcus Begin Edit */
1264
//This is an edit for WP 2.8 for styling fix
1265
+ ?>
1266
<div id="poststuff" class="metabox-holder has-right-sidebar">
1267
<!-- SIDEBAR -->
1268
<div id="side-info-column" class='inner-sidebar'>
1269
+ <div id='side-sortables'>
1270
+ <? if(get_option('dbem_recurrence_enabled')) : ?>
1271
<!-- recurrence postbox -->
1272
<div class="postbox ">
1273
<div class="handlediv" title="Fare clic per cambiare."><br />
1309
<input id="recurrence-interval" name='recurrence_interval'
1310
size='2' value='<?php
1311
echo $event ['recurrence_interval'];
1312
+ ?>' />
1313
<span class='interval-desc' id="interval-daily-singular">
1314
<?php _e ( 'day', 'dbem' )?>
1315
</span> <span class='interval-desc' id="interval-daily-plural">
1377
}
1378
?>
1379
</div>
1380
+ </div>
1381
+ <? endif; ?>
1382
+ <?php if(get_option('dbem_rsvp_enabled')) : ?>
1383
<div class="postbox ">
1384
<div class="handlediv" title="Fare clic per cambiare."><br />
1385
</div>
1439
<?php
1440
/* Marcus Begin Edit */
1441
//adding the category selection box
1442
+ ?> <? endif; ?>
1443
+ <? if(get_option('dbem_categories_enabled')) :?>
1444
<div class="postbox ">
1445
<div class="handlediv" title="Fare clic per cambiare."><br />
1446
</div>
1468
</select>
1469
</p>
1470
</div>
1471
+ </div>
1472
+ <? endif; ?>
1473
</div>
1474
<?php/* Marcus End Edit */ ?>
1475
</div>
1587
?>
1588
</h3>
1589
<div class="inside">
1590
+ <table id="dbem-location-data">
1591
<tr>
1592
+ <?php if($use_select_for_locations) : ?>
1593
+ <?
1594
+ $locations = dbem_get_locations();
1595
+
1596
+
1597
+ ?>
1598
+ <th><?php _e('Location:','dbem') ?></th>
1599
+ <td>
1600
+ <select name="location-select-id" id='location-select-id' size="1">
1601
+ <?php foreach($locations as $location) :
1602
+ $selected = "";
1603
+ if(isset($event['location_id'])) {
1604
+ $location_id = $event['location_id'];
1605
+ if ($location_id == $location['location_id'])
1606
+ $selected = "selected='selected' ";
1607
+ }
1608
+
1609
+ ?>
1610
+ <option value="<?php echo $location['location_id'] ?>" <?php echo $selected ?>><?php echo $location['location_name'] ?></option>
1611
+ <?php endforeach; ?>
1612
+ </select>
1613
+ <input type='hidden' name='location-select-name' value='<?php echo $event['location_name']?>'/>
1614
+ <input type='hidden' name='location-select-town' value='<?php echo $event['location_town']?>'/>
1615
+ <input type='hidden' name='location-select-address' value='<?php echo $event['location_address']?>'/>
1616
+ </td>
1617
+ <?php else : ?>
1618
+ <th><?php _e ( 'Name:' )?>
1619
&nbsp;</th>
1620
<td><input id="location-name" type="text" name="location_name"
1621
value="<?php
1622
echo $event ['location_name']?>" /></td>
1623
+ <?php endif; ?>
1624
<?php
1625
$gmap_is_active = get_option ( 'dbem_gmap_is_active' );
1626
?>
1640
<?php
1641
}
1642
; // end of IF_GMAP_ACTIVE ?>
1643
+ </tr>
1644
+ <?php if(!$use_select_for_locations) : ?>
1645
<tr>
1646
+ <td colspan='2'>
1647
+ <p><?php
1648
+ _e ( 'The name of the location where the event takes place. You can use the name of a venue, a square, etc', 'dbem' )?></p>
1649
+ </td>
1650
+ </tr>
1651
+ <?php else: ?>
1652
+ <tr >
1653
+ <td colspan='2' rowspan='5' style='vertical-align: top'>
1654
+ <p><?php
1655
+ _e ( 'Select a location for your event', 'dbem' )?></p>
1656
+ </td>
1657
</tr>
1658
+ <?php endif; ?>
1659
+ <?php if(!$use_select_for_locations) : ?>
1660
<tr>
1661
<th><?php
1662
_e ( 'Address:' )?>
1686
_e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?>
1687
</p></td>
1688
</tr>
1689
+ <?php endif; ?>
1690
</table>
1691
</div>
1692
</div>
1707
_e ( 'Details about the event', 'dbem' )?>
1708
</div>
1709
</div>
1710
+ <?php if(get_option('dbem_attributes_enabled')) : ?>
1711
<?php/* Marcus Begin Edit */ ?>
1712
<div id="event_attributes" class="postbox">
1713
<h3>
1720
</div>
1721
</div>
1722
<?php/* Marcus End Edit */ ?>
1723
+ <?php endif; ?>
1724
</div>
1725
<p class="submit">
1726
<input type="submit" name="events_update"
2102
}
2103
2104
$j(document).ready(function() {
2105
+ <?php if(get_option('dbem_use_select_for_locations')) : ?>
2106
+ eventLocation = $j("input[name='location-select-name']").val();
2107
+ eventTown = $j("input[name='location-select-town']").val();
2108
+ eventAddress = $j("input[name='location-select-address']").val();
2109
+
2110
+ <?php else: ?>
2111
+ eventLocation = $j("input#location-name").val();
2112
+ eventTown = $j("input#location-town").val();
2113
eventAddress = $j("input#location-address").val();
2114
+ <?php endif; ?>
2115
+
2116
loadMap(eventLocation, eventTown, eventAddress);
2117
2118
$j("input#location-name").blur(function(){
2321
////////////////////////////////////
2322
// WP 2.7 options registration
2323
function dbem_options_register() {
2324
+ $options = array ('dbem_events_page', 'dbem_display_calendar_in_events_page', 'dbem_use_event_end', 'dbem_event_list_item_format_header', 'dbem_event_list_item_format', 'dbem_event_list_item_format_footer', 'dbem_event_page_title_format', 'dbem_single_event_format', 'dbem_list_events_page', 'dbem_events_page_title', 'dbem_no_events_message', 'dbem_location_page_title_format', 'dbem_location_baloon_format', 'dbem_single_location_format', 'dbem_location_event_list_item_format', 'dbem_location_no_events_message', 'dbem_gmap_is_active', 'dbem_rss_main_title', 'dbem_rss_main_description', 'dbem_rss_title_format', 'dbem_rss_description_format', 'dbem_gmap_key', 'dbem_map_text_format', 'dbem_rsvp_mail_notify_is_active', 'dbem_contactperson_email_body', 'dbem_respondent_email_body', 'dbem_mail_sender_name', 'dbem_smtp_username', 'dbem_smtp_password', 'dbem_default_contact_person', 'dbem_mail_sender_address', 'dbem_mail_receiver_address', 'dbem_smtp_host', 'dbem_rsvp_mail_send_method', 'dbem_rsvp_mail_port', 'dbem_rsvp_mail_SMTPAuth', 'dbem_image_max_width', 'dbem_image_max_height', 'dbem_image_max_size', 'dbem_full_calendar_event_format', 'dbem_use_select_for_locations', 'dbem_attributes_enabled', 'dbem_recurrence_enabled','dbem_rsvp_enabled','dbem_categories_enabled');
2325
foreach ( $options as $opt ) {
2326
register_setting ( 'dbem-options', $opt, '' );
2327
}
dbem_locations.php CHANGED
@@ -639,7 +639,8 @@ function dbem_locations_autocomplete() {
639
640
$j(document).ready(function() {
641
var gmap_enabled = <?php echo get_option('dbem_gmap_is_active'); ?>;
642
-
643
$j("input#location-name").autocomplete("../wp-content/plugins/events-manager/locations-search.php", {
644
width: 260,
645
selectFirst: false,
@@ -664,7 +665,21 @@ function dbem_locations_autocomplete() {
664
665
loadMap(eventLocation, eventTown, eventAddress)
666
}
667
- });
668
669
});
670
//]]>
639
640
$j(document).ready(function() {
641
var gmap_enabled = <?php echo get_option('dbem_gmap_is_active'); ?>;
642
+
643
+ <?php if(!get_option('dbem_use_select_for_locations')) :?>
644
$j("input#location-name").autocomplete("../wp-content/plugins/events-manager/locations-search.php", {
645
width: 260,
646
selectFirst: false,
665
666
loadMap(eventLocation, eventTown, eventAddress)
667
}
668
+ });
669
+ <?php else : ?>
670
+ $j('#location-select-id').change(function() {
671
+ $j.getJSON("/../wp-content/plugins/events-manager/locations-search.php",{id: $j(this).val()}, function(data){
672
+ eventLocation = data.name;
673
+ eventAddress = data.address;
674
+ eventTown = data.town;
675
+ $j("input[name='location-select-name']").val(eventLocation);
676
+ $j("input[name='location-select-address']").val(eventAddress);
677
+ $j("input[name='location-select-town']").val(eventTown);
678
+ loadMap(eventLocation, eventTown, eventAddress)
679
+
680
+ })
681
+ });
682
+ <?php endif; ?>
683
684
});
685
//]]>
dbem_rsvp.php CHANGED
@@ -67,21 +67,22 @@ function dbem_delete_booking_form() {
67
68
69
function dbem_catch_rsvp() {
70
- global $form_add_message;
71
- global $form_delete_message;
72
if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'add_booking') {
73
$result = dbem_book_seats();
74
$form_add_message = $result;
75
76
77
- }
78
79
if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'delete_booking') {
80
81
$bookerName = dbem_sanitize_request($_POST['bookerName']);
82
$bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
83
$booker = dbem_get_person_by_name_and_email($bookerName, $bookerEmail);
84
- if ($booker) {
85
$booker_id = $booker['person_id'];
86
$booking = dbem_get_booking_by_person_id($booker_id);
87
$result = dbem_delete_booking($booking['booking_id']);
@@ -89,7 +90,7 @@ function dbem_catch_rsvp() {
89
$result = __('There are no bookings associated to this name and e-mail', 'dbem');
90
}
91
$form_delete_message = $result;
92
- }
93
94
return $result;
95
@@ -309,9 +310,10 @@ function dbem_get_bookings_for($event_id) {
309
310
function dbem_intercept_bookings_delete() {
311
//dbem_email_rsvp_booking();
312
- $bookings = $_GET['bookings'];
313
314
- if ($bookings) {
315
foreach($bookings as $booking_id) {
316
dbem_delete_booking($booking_id);
317
}
67
68
69
function dbem_catch_rsvp() {
70
+ global $form_add_message;
71
+ global $form_delete_message;
72
+ $result = "";
73
if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'add_booking') {
74
$result = dbem_book_seats();
75
$form_add_message = $result;
76
77
78
+ }
79
80
if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'delete_booking') {
81
82
$bookerName = dbem_sanitize_request($_POST['bookerName']);
83
$bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
84
$booker = dbem_get_person_by_name_and_email($bookerName, $bookerEmail);
85
+ if ($booker) {
86
$booker_id = $booker['person_id'];
87
$booking = dbem_get_booking_by_person_id($booker_id);
88
$result = dbem_delete_booking($booking['booking_id']);
90
$result = __('There are no bookings associated to this name and e-mail', 'dbem');
91
}
92
$form_delete_message = $result;
93
+ }
94
95
return $result;
96
310
311
function dbem_intercept_bookings_delete() {
312
//dbem_email_rsvp_booking();
313
+ if(isset($_GET['bookings']))
314
+ $bookings = $_GET['bookings'];
315
316
+ if (isset($bookings)) {
317
foreach($bookings as $booking_id) {
318
dbem_delete_booking($booking_id);
319
}
events-manager.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
Plugin Name: Events Manager
4
- Version: 2.1
5
Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
6
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
Author: Davide Benini
@@ -59,7 +59,13 @@ define('DEFAULT_IMAGE_MAX_HEIGHT', 700);
59
define('DEFAULT_IMAGE_MAX_SIZE', 204800);
60
define('DEFAULT_FULL_CALENDAR_EVENT_FORMAT', '<li>#_LINKEDNAME</li>');
61
define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT', "#_NAME" );
62
- define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR', ", ");
63
// DEBUG constant for developing
64
// if you are hacking this plugin, set to TRUE, a log will show in admin pages
65
define('DEBUG', false);
@@ -423,7 +429,12 @@ function dbem_add_options() {
423
'dbem_full_calendar_event_format' => DEFAULT_FULL_CALENDAR_EVENT_FORMAT,
424
'dbem_small_calendar_event_title_format' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT,
425
'dbem_small_calendar_event_title_separator' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR,
426
- 'dbem_hello_to_user' => 1);
427
428
foreach($dbem_options as $key => $value)
429
dbem_add_option($key, $value);
@@ -450,9 +461,9 @@ function dbem_create_events_page(){
450
add_action('admin_menu','dbem_create_events_submenu');
451
function dbem_create_events_submenu () {
452
if(function_exists('add_submenu_page')) {
453
- add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),MIN_CAPABILITY,__FILE__,dbem_events_subpanel, '../wp-content/plugins/events-manager/images/calendar-16.png');
454
// Add a submenu to the custom top-level menu:
455
- $plugin_page = add_submenu_page(__FILE__, __('Edit'),__('Edit'),MIN_CAPABILITY,__FILE__,dbem_events_subpanel);
456
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
457
$plugin_page = add_submenu_page(__FILE__, __('Add new', 'dbem'), __('Add new','dbem'), MIN_CAPABILITY, 'new_event', "dbem_new_event_page");
458
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
@@ -461,7 +472,7 @@ function dbem_create_events_submenu () {
461
$plugin_page = add_submenu_page(__FILE__, __('People', 'dbem'), __('People', 'dbem'), MIN_CAPABILITY, 'people', "dbem_people_page");
462
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
463
//add_submenu_page(__FILE__, 'Test ', 'Test ', 8, 'test', 'dbem_recurrence_test');
464
- $plugin_page = add_submenu_page(__FILE__, __('Events Manager Settings','dbem'),__('Settings','dbem'), SETTING_CAPABILITY, "events-manager-options", dbem_options_subpanel);
465
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
466
}
467
}
1
<?php
2
/*
3
Plugin Name: Events Manager
4
+ Version: 2.2
5
Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
6
Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
Author: Davide Benini
59
define('DEFAULT_IMAGE_MAX_SIZE', 204800);
60
define('DEFAULT_FULL_CALENDAR_EVENT_FORMAT', '<li>#_LINKEDNAME</li>');
61
define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT', "#_NAME" );
62
+ define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR', ", ");
63
+ define('DEFAULT_USE_SELECT_FOR_LOCATIONS', false);
64
+ define('DEFAULT_ATTRIBUTES_ENABLED', false);
65
+ define('DEFAULT_RECURRENCE_ENABLED', false);
66
+ define('DEFAULT_RSVP_ENABLED', false);
67
+ define('DEFAULT_CATEGORIES_ENABLED', false);
68
+
69
// DEBUG constant for developing
70
// if you are hacking this plugin, set to TRUE, a log will show in admin pages
71
define('DEBUG', false);
429
'dbem_full_calendar_event_format' => DEFAULT_FULL_CALENDAR_EVENT_FORMAT,
430
'dbem_small_calendar_event_title_format' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT,
431
'dbem_small_calendar_event_title_separator' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR,
432
+ 'dbem_hello_to_user' => 1,
433
+ 'dbem_use_select_for_locations' => DEFAULT_USE_SELECT_FOR_LOCATIONS,
434
+ 'dbem_attributes_enabled', DEFAULT_ATTRIBUTES_ENABLED,
435
+ 'dbem_recurrence_enabled', DEFAULT_RECURRENCE_ENABLED,
436
+ 'dbem_rsvp_enabled', DEFAULT_RSVP_ENABLED,
437
+ 'dbem_categories_enabled', DEFAULT_CATEGORIES_ENABLED);
438
439
foreach($dbem_options as $key => $value)
440
dbem_add_option($key, $value);
461
add_action('admin_menu','dbem_create_events_submenu');
462
function dbem_create_events_submenu () {
463
if(function_exists('add_submenu_page')) {
464
+ add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel', '../wp-content/plugins/events-manager/images/calendar-16.png');
465
// Add a submenu to the custom top-level menu:
466
+ $plugin_page = add_submenu_page(__FILE__, __('Edit'),__('Edit'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel');
467
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
468
$plugin_page = add_submenu_page(__FILE__, __('Add new', 'dbem'), __('Add new','dbem'), MIN_CAPABILITY, 'new_event', "dbem_new_event_page");
469
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
472
$plugin_page = add_submenu_page(__FILE__, __('People', 'dbem'), __('People', 'dbem'), MIN_CAPABILITY, 'people', "dbem_people_page");
473
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
474
//add_submenu_page(__FILE__, 'Test ', 'Test ', 8, 'test', 'dbem_recurrence_test');
475
+ $plugin_page = add_submenu_page(__FILE__, __('Events Manager Settings','dbem'),__('Settings','dbem'), SETTING_CAPABILITY, "events-manager-options", 'dbem_options_subpanel');
476
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
477
}
478
}
locations-search.php CHANGED
@@ -1,29 +1,37 @@
1
<?php
2
require_once('../../../wp-load.php');
3
- $locations = dbem_get_locations();
4
- $return = array();
5
6
- foreach($locations as $item) {
7
- $record = array();
8
- $record['id'] = $item['location_id'];
9
- $record['name'] = $item['location_name'];
10
$record['address'] = $item['location_address'];
11
$record['town'] = $item['location_town'];
12
- $return[] = $record;
13
- }
14
15
- $q = strtolower($_GET["q"]);
16
- if (!$q) return;
17
18
- foreach($return as $row) {
19
20
- if (strpos(strtolower($row['name']), $q) !== false) {
21
- $location = array();
22
- $rows =array();
23
- foreach($row as $key => $value)
24
- $location[] = "'$key' : '".str_replace("'", "\'", $value)."'";
25
- echo ("{".implode(" , ", $location)." }\n");
26
- }
27
28
}
29
?>
1
<?php
2
require_once('../../../wp-load.php');
3
+ if(isset($_GET['id']) && $_GET['id'] != "") {
4
+ $location = dbem_get_location($_GET['id']);
5
+ echo '{"id":"'.$location['location_id'].'" , "name" : "'.$location['location_name'].'","town" : "'.$location['location_town'].'","address" : "'.$location['location_address'].'" }';
6
+
7
+ } else {
8
9
+ $locations = dbem_get_locations();
10
+ $return = array();
11
+
12
+ foreach($locations as $item) {
13
+ $record = array();
14
+ $record['id'] = $item['location_id'];
15
+ $record['name'] = $item['location_name'];
16
$record['address'] = $item['location_address'];
17
$record['town'] = $item['location_town'];
18
+ $return[] = $record;
19
+ }
20
21
+ $q = strtolower($_GET["q"]);
22
+ if (!$q) return;
23
24
+ foreach($return as $row) {
25
26
+ if (strpos(strtolower($row['name']), $q) !== false) {
27
+ $location = array();
28
+ $rows =array();
29
+ foreach($row as $key => $value)
30
+ $location[] = "'$key' : '".str_replace("'", "\'", $value)."'";
31
+ echo ("{".implode(" , ", $location)." }\n");
32
+ }
33
34
}
35
+
36
+ }
37
?>
marcus-extras.php CHANGED
@@ -24,7 +24,7 @@ add_action('admin_menu','dbem_add_to_events_submenu', 100);
24
function dbem_add_to_events_submenu () {
25
if(function_exists('add_submenu_page')) {
26
$file = dirname(__FILE__).DIRECTORY_SEPARATOR."events-manager.php";
27
- $plugin_page = add_submenu_page($file, __('Event Categories','dbem'),__('Categories','dbem'), SETTING_CAPABILITY, "events-manager-categories", dbem_categories_subpanel);
28
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
29
}
30
}
@@ -306,84 +306,82 @@ function dbem_attributes_form($event) {
306
<div class="wrap">
307
<h2>Attributes</h2>
308
<p>Add attributes here</p>
309
- <form method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
310
- <table class="form-table">
311
- <thead>
312
- <tr valign="top">
313
- <td><strong>Attribute Name</strong></td>
314
- <td><strong>Value</strong></td>
315
- </tr>
316
- </thead>
317
- <tbody id="mtm_body">
318
- <?php
319
- $count = 1;
320
- if( is_array($dbem_data) and count($dbem_data) > 0){
321
- foreach( $dbem_data as $name => $value){
322
- ?>
323
- <tr valign="top" id="mtm_<?php echo $count ?>">
324
- <td scope="row">
325
- <select name="mtm_<?php echo $count ?>_ref">
326
- <?php
327
- if( !in_array($name, $attributes) ){
328
- echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
329
- }
330
- foreach( $attributes as $attribute ){
331
- if( $attribute == $name ) {
332
- echo "<option selected='selected'>$attribute</option>";
333
- }else{
334
- echo "<option>$attribute</option>";
335
- }
336
- }
337
- ?>
338
- </select>
339
- <a href="#" rel="<?php echo $count ?>">Remove</a>
340
- </td>
341
- <td>
342
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
343
- </td>
344
- </tr>
345
- <?php
346
- $count++;
347
- }
348
- }else{
349
- if( count( $attributes ) > 0 ){
350
- ?>
351
- <tr valign="top" id="mtm_<?php echo $count ?>">
352
- <td scope="row">
353
- <select name="mtm_<?php echo $count ?>_ref">
354
- <?php
355
- foreach( $attributes as $attribute ){
356
echo "<option>$attribute</option>";
357
}
358
- ?>
359
- </select>
360
- <a href="#" rel="<?php echo $count ?>">Remove</a>
361
- </td>
362
- <td>
363
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
364
- </td>
365
- </tr>
366
- <?php
367
- }else{
368
- ?>
369
- <tr valign="top">
370
- <td scope="row" colspan='2'>
371
- <?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
372
- </td>
373
- </tr>
374
- <?php
375
-
376
- }
377
}
378
- ?>
379
- </tbody>
380
- <tfoot>
381
- <tr valign="top">
382
- <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
383
- </tr>
384
- </tfoot>
385
- </table>
386
- </form>
387
</div>
388
<?php
389
}
24
function dbem_add_to_events_submenu () {
25
if(function_exists('add_submenu_page')) {
26
$file = dirname(__FILE__).DIRECTORY_SEPARATOR."events-manager.php";
27
+ $plugin_page = add_submenu_page($file, __('Event Categories','dbem'),__('Categories','dbem'), SETTING_CAPABILITY, "events-manager-categories", 'dbem_categories_subpanel');
28
add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
29
}
30
}
306
<div class="wrap">
307
<h2>Attributes</h2>
308
<p>Add attributes here</p>
309
+ <table class="form-table">
310
+ <thead>
311
+ <tr valign="top">
312
+ <td><strong>Attribute Name</strong></td>
313
+ <td><strong>Value</strong></td>
314
+ </tr>
315
+ </thead>
316
+ <tfoot>
317
+ <tr valign="top">
318
+ <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
319
+ </tr>
320
+ </tfoot>
321
+ <tbody id="mtm_body">
322
+ <?php
323
+ $count = 1;
324
+ if( is_array($dbem_data) and count($dbem_data) > 0){
325
+ foreach( $dbem_data as $name => $value){
326
+ ?>
327
+ <tr valign="top" id="mtm_<?php echo $count ?>">
328
+ <td scope="row">
329
+ <select name="mtm_<?php echo $count ?>_ref">
330
+ <?php
331
+ if( !in_array($name, $attributes) ){
332
+ echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
333
+ }
334
+ foreach( $attributes as $attribute ){
335
+ if( $attribute == $name ) {
336
+ echo "<option selected='selected'>$attribute</option>";
337
+ }else{
338
echo "<option>$attribute</option>";
339
}
340
+ }
341
+ ?>
342
+ </select>
343
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
344
+ </td>
345
+ <td>
346
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
347
+ </td>
348
+ </tr>
349
+ <?php
350
+ $count++;
351
}
352
+ }else{
353
+ if( count( $attributes ) > 0 ){
354
+ ?>
355
+ <tr valign="top" id="mtm_<?php echo $count ?>">
356
+ <td scope="row">
357
+ <select name="mtm_<?php echo $count ?>_ref">
358
+ <?php
359
+ foreach( $attributes as $attribute ){
360
+ echo "<option>$attribute</option>";
361
+ }
362
+ ?>
363
+ </select>
364
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
365
+ </td>
366
+ <td>
367
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
368
+ </td>
369
+ </tr>
370
+ <?php
371
+ }else{
372
+ ?>
373
+ <tr valign="top">
374
+ <td scope="row" colspan='2'>
375
+ <?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
376
+ </td>
377
+ </tr>
378
+ <?php
379
+
380
+ }
381
+ }
382
+ ?>
383
+ </tbody>
384
+ </table>
385
</div>
386
<?php
387
}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://davidebenini.it
4
Tags: events, manager, calendar, gigs, concert, maps, geotagging
5
Requires at least: 2.7
6
Tested up to: 2.9.2
7
- Stable tag: 2.1
8
9
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
@@ -206,4 +206,9 @@ Bugfix: _RESPPHONE was not matched in emails
206
Bugfix: fixed security vulnerability, which could lead to sql inject attacks
207
Bugfix: locations with apostrophe were duplicated
208
Bugfix: bloginfo('wpurl') instead of bloginfo('url')
209
- Bugfix: now loading textdomain in the new (not deprecated) way
4
Tags: events, manager, calendar, gigs, concert, maps, geotagging
5
Requires at least: 2.7
6
Tested up to: 2.9.2
7
+ Stable tag: 2.2
8
9
Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
206
Bugfix: fixed security vulnerability, which could lead to sql inject attacks
207
Bugfix: locations with apostrophe were duplicated
208
Bugfix: bloginfo('wpurl') instead of bloginfo('url')
209
+ Bugfix: now loading textdomain in the new (not deprecated) way
210
+
211
+ 2.2
212
+ Adding a option to get events through a select
213
+ Closed many bugs causing a notices/warning visible only in debug mode
214
+ Closed a critical security hole discovered by Danilo Massa (to be released on May 10th)