Ejemplo n.º 1
0
function _eme_install()
{
    eme_add_options();
    $db_version = get_option('eme_version');
    if ($db_version == EME_DB_VERSION) {
        return;
    }
    if ($db_version > 0 && $db_version < 20) {
        eme_rename_tables();
    }
    if ($db_version > 0 && $db_version < 49) {
        delete_option('eme_events_admin_limit');
    }
    if ($db_version > 0 && $db_version < 55) {
        $smtp_port = get_option('eme_rsvp_mail_port');
        delete_option('eme_rsvp_mail_port');
        update_option('eme_smtp_port', $smtp_port);
    }
    if ($db_version < 70) {
        delete_option('eme_google_checkout_type');
        delete_option('eme_google_merchant_id');
        delete_option('eme_google_merchant_key');
        delete_option('eme_google_cost');
    }
    // make sure the captcha doesn't cause problems
    if (!function_exists('imagecreatetruecolor')) {
        update_option('eme_captcha_for_booking', 0);
    }
    // always reset the drop data option
    update_option('eme_uninstall_drop_data', 0);
    // always reset the donation option
    update_option('eme_donation_done', 0);
    // Create events page if necessary
    $events_page_id = get_option('eme_events_page');
    if ($events_page_id != "") {
        if (!get_page($events_page_id)) {
            eme_create_events_page();
        }
    } else {
        eme_create_events_page();
    }
    eme_create_tables();
    // SEO rewrite rules
    eme_flushRules();
    // now set the version correct
    update_option('eme_version', EME_DB_VERSION);
}
Ejemplo n.º 2
0
function eme_actions_init()
{
    // first the no cache headers
    nocache_headers();
    eme_load_textdomain();
    // now, first update the DB if needed
    $db_version = get_option('eme_version');
    if ($db_version && $db_version != EME_DB_VERSION) {
        // add possible new options
        eme_add_options();
        // update the DB tables
        // to do: check if the DB update succeeded ...
        eme_create_tables();
        // now set the version correct
        update_option('eme_version', EME_DB_VERSION);
        // let the admin side know if the update succeeded
        update_option('eme_update_done', 1);
    }
    // now first all ajax ops: exit needed
    if (isset($_GET['eme_ical']) && $_GET['eme_ical'] == 'public_single' && isset($_GET['event_id'])) {
        header("Content-type: text/calendar; charset=utf-8");
        header("Content-Disposition: inline; filename=eme_single.ics");
        eme_ical_single();
        exit;
    }
    if (isset($_GET['eme_ical']) && $_GET['eme_ical'] == 'public') {
        header("Content-type: text/calendar; charset=utf-8");
        header("Content-Disposition: inline; filename=eme_public.ics");
        eme_ical();
        exit;
    }
    if (isset($_POST['eme_ajaxCalendar']) && $_POST['eme_ajaxCalendar'] == true) {
        header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
        eme_filter_calendar_ajax();
        exit;
    }
    if (isset($_GET['eme_rss']) && $_GET['eme_rss'] == 'main') {
        header("Content-type: text/xml");
        eme_rss();
        exit;
    }
    if (isset($_POST['eme_ajax_action']) && $_POST['eme_ajax_action'] == 'client_clock_submit') {
        eme_client_clock_callback();
        exit;
    }
    if (isset($_GET['eme_admin_action']) && $_GET['eme_admin_action'] == 'booking_data' && is_admin() && isset($_GET['event_id'])) {
        header("Content-type: application/json; charset=utf-8");
        echo '{"bookedSeats":' . eme_get_booked_seats(intval($_GET['event_id'])) . ',"availableSeats":' . eme_get_available_seats(intval($_GET['event_id'])) . '}';
        exit;
    }
    if (isset($_GET['eme_admin_action']) && $_GET['eme_admin_action'] == 'autocomplete_locations' && is_admin()) {
        eme_locations_search_ajax();
        exit;
    }
    if (isset($_GET['eme_admin_action']) && $_GET['eme_admin_action'] == 'autocomplete_people' && is_admin()) {
        eme_people_search_ajax();
        exit;
    }
    if (isset($_GET['eme_admin_action']) && $_GET['eme_admin_action'] == 'booking_printable' && is_admin() && isset($_GET['event_id'])) {
        eme_printable_booking_report(intval($_GET['event_id']));
        exit;
    }
    if (isset($_GET['eme_admin_action']) && $_GET['eme_admin_action'] == 'booking_csv' && is_admin() && isset($_GET['event_id'])) {
        eme_csv_booking_report(intval($_GET['event_id']));
        exit;
    }
    if (is_admin() && current_user_can(get_option('eme_cap_registrations')) && isset($_REQUEST['eme_admin_action']) && $_REQUEST['eme_admin_action'] == 'remove_booking' && isset($_REQUEST['booking_id'])) {
        $booking_id = intval($_REQUEST['booking_id']);
        $booking = eme_get_booking($booking_id);
        // delete the booking before the mail is sent, so free spaces are correct
        eme_delete_booking($booking_id);
        if (get_option('eme_deny_mail_event_edit')) {
            eme_email_rsvp_booking($booking, "denyRegistration");
        }
        // delete the booking answers after the mail is sent, so the answers can still be used in the mail
        eme_delete_answers($booking_id);
        exit;
    }
    if (isset($_GET['query']) && $_GET['query'] == 'GlobalMapData') {
        $eventful = isset($_GET['eventful']) ? $_GET['eventful'] : false;
        $map_id = isset($_GET['map_id']) ? $_GET['map_id'] : 0;
        $eventful = $eventful === "true" || $eventful === "1" ? true : $eventful;
        $eventful = $eventful === "false" || $eventful === "0" ? false : $eventful;
        eme_global_map_json((bool) $eventful, $_GET['scope'], $_GET['category'], $map_id);
        exit;
    }
    if (isset($_GET['eme_eventAction']) && ($_GET['eme_eventAction'] == "paypal_notification" || $_GET['eme_eventAction'] == "paypal_ipn")) {
        eme_paypal_notification();
        exit;
    }
    if (isset($_GET['eme_eventAction']) && ($_GET['eme_eventAction'] == "2co_notification" || $_GET['eme_eventAction'] == "2co_ins")) {
        eme_2co_notification();
        exit;
    }
    if (isset($_GET['eme_eventAction']) && $_GET['eme_eventAction'] == "webmoney_notification") {
        eme_webmoney_notification();
        exit;
    }
    if (isset($_GET['eme_eventAction']) && $_GET['eme_eventAction'] == "mollie_notification") {
        eme_mollie_notification();
        exit;
    }
    if (isset($_POST['eme_eventAction']) && ($_POST['eme_eventAction'] == "fdgg_notification" || $_POST['eme_eventAction'] == "fdgg_ipn")) {
        eme_fdgg_notification();
        exit;
    }
    if (isset($_GET['eme_eventAction']) && $_GET['eme_eventAction'] == "worldpay_notification") {
        eme_worldpay_notification();
        exit;
    }
    if (isset($_GET['eme_eventAction']) && $_GET['eme_eventAction'] == "sagepay_notification") {
        eme_sagepay_notification();
        // sagepay doesn't use a notification url, but sends the status along as part of the return url, so we just check
        // the status and set payed or not, but then we continue regular flow of events
    }
}