Example #1
0
        // if this is user's event, go to login page
        return array(CONTROLLER_STATUS_REDIRECT, "auth.login_form?return_url=" . urlencode(Registry::get('config.current_url')));
    }
    if ($_data['type'] == 'U') {
        if (!empty($_data['user_id']) && $auth['user_id'] == $_data['user_id']) {
            define('EVENT_OWNER', true);
        } else {
            return array(CONTROLLER_STATUS_REDIRECT, "events.access_key");
        }
    } elseif (!empty($_data['user_id']) && $auth['user_id'] == $_data['user_id']) {
        define('EVENT_OWNER', true);
    }
}
if ($mode == 'delete_event') {
    if (defined('EVENT_OWNER')) {
        fn_event_delete($_REQUEST['event_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "events.search");
} elseif ($mode == 'unsubscribe') {
    db_query("DELETE FROM ?:giftreg_event_subscribers WHERE event_id = ?i AND email = ?s", $_REQUEST['event_id'], $_REQUEST['email']);
    fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_event_unsubscribe'));
    return array(CONTROLLER_STATUS_REDIRECT, "events.search");
} elseif ($mode == 'view') {
    $event_data = db_get_row("SELECT * FROM ?:giftreg_events WHERE event_id = ?i", $_REQUEST['event_id']);
    fn_add_breadcrumb($event_data['title']);
    $event_data['fields'] = db_get_hash_single_array("SELECT * FROM ?:giftreg_event_fields WHERE ?:giftreg_event_fields.event_id = ?i", array('field_id', 'value'), $_REQUEST['event_id']);
    $event_data['products'] = fn_get_event_product($_REQUEST['event_id'], Registry::get('settings.Appearance.products_per_page'), empty($_REQUEST['page']) ? 1 : $_REQUEST['page']);
    foreach ($event_data['products'] as $k => &$product) {
        $product['extra'] = unserialize($product['extra']);
        $product_options = $product['extra'];
        $product['product_options_ids'] = $product_options;
Example #2
0
//
// $Id: events.post.php 10450 2010-08-18 11:18:13Z alexions $
//
if (!defined('AREA')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Delete events
    if ($mode == 'delete_events') {
        foreach ($_REQUEST['event_ids'] as $v) {
            if (AREA == 'C') {
                if (empty($auth['user_id'])) {
                    continue;
                }
            }
            fn_event_delete($v, AREA == 'C' ? $auth['user_id'] : 0);
        }
        $suffix = '.search';
    }
    // Send notifications
    if ($mode == 'send_notifications') {
        if (!empty($_REQUEST['event_recipients'])) {
            $event_data = db_get_row("SELECT event_id, title, status, type, owner FROM ?:giftreg_events WHERE event_id = ?i", $_REQUEST['event_id']);
            $a_key = '';
            if ($event_data['type'] == 'U') {
                // If the event is private - get ekey for it
                $a_key = db_get_field("SELECT ekey FROM ?:ekeys WHERE object_id = ?i AND object_type = 'G'", $event_data['event_id']);
            }
            $emails = db_get_array("SELECT email, name FROM ?:giftreg_event_subscribers WHERE event_id = ?i AND email IN (?a)", $_REQUEST['event_id'], $_REQUEST['event_recipients']);
            $view_mail->assign('access_key', $a_key);
            $view_mail->assign('event', $event_data);