/** * Register a user for an event. * * @param integer $num_attendees Number of attendees, default 1 * @param integer $uid User ID to register, 0 for current user * @return integer Message code, zero for success */ public function Register($num_attendees = 1, $tick_type = 0, $uid = 0) { global $_TABLES, $_USER, $_EV_CONF, $LANG_EVLIST; if ($_EV_CONF['enable_rsvp'] != 1) { return 0; } // Make sure that registrations are enabled and that the current user // has access to this event. If $uid > 0, then this is an admin // registering another user, don't check access if ($this->Event->options['use_rsvp'] == 0 || $uid == 0 && !$this->Event->hasAccess(2)) { LGLIB_storeMessage($LANG_EVLIST['messages'][20]); return 20; } elseif ($this->Event->options['use_rsvp'] == 1) { // Registering for entire event, all repeats $rp_id = 0; } else { // Registering for a single occurance $rp_id = $this->rp_id; } if (!isset($this->Event->options['tickets'][$tick_type])) { LGLIB_storeMessage($LANG_EVLIST['messages'][24]); return 24; } $uid = $uid == 0 ? (int) $_USER['uid'] : (int) $uid; $num_attendees = (int) $num_attendees; $fee = (double) $this->Event->options['tickets'][$tick_type]['fee']; // Check that the current user isn't already registered // TODO: Allow registrations up to max count, or to waitlist //if ($this->isRegistered()) { // return 21; //} // Check that the event isn't already full, or that // waitlisting is disabled $total_reg = $this->TotalRegistrations(); $new_total = $total_reg + $num_attendees; if ($this->Event->options['max_rsvp'] > 0 && $this->Event->options['max_rsvp'] <= $new_total) { if ($this->Event->options['rsvp_waitlist'] == 0 || $fee > 0) { // Event is full, no waiting list. Can't waitlist paid tickets. LGLIB_storeMessage($LANG_EVLIST['messages'][22]); return 22; } else { // Set message indicating the waiting list and continue to register $waitlist = $new_total - $this->Event->options['max_rsvp']; if ($waitlist == $num_attendees) { // All tickets are waitlisted $str = $LANG_EVLIST['all']; } else { $str = $waitlist; } LGLIB_storeMessage($LANG_EVLIST['messages']['22'] . ' ' . sprintf($LANG_EVLIST['messages'][27], $str)); } } if ($fee > 0) { // add tickes to the shopping cart. Tickets will be created // when paid. $this->AddToCart($tick_type, $num_attendees); LGLIB_storeMessage($LANG_EVLIST['messages']['24']); $status = LGLIB_invokeService('paypal', 'getURL', array('type' => 'checkout'), $url, $msg); if ($status == PLG_RET_OK) { LGLIB_storeMessage(sprintf($LANG_EVLIST['messages']['26'], $url), '', true); } } else { LGLIB_storeMessage($LANG_EVLIST['messages'][24]); } // for free tickets, just create the ticket records USES_evlist_class_tickettype(); USES_evlist_class_ticket(); $TickType = new evTicketType($tick_type); if ($TickType->event_pass) { $t_rp_id = 0; } else { $t_rp_id = $this->rp_id; } for ($i = 0; $i < $num_attendees; $i++) { evTicket::Create($this->Event->id, $tick_type, $t_rp_id, $fee, $uid); } /*if ($fee < .01) { DB_query("INSERT INTO {$_TABLES['evlist_rsvp']} SET ev_id = '{$this->Event->id}', rp_id = '{$rp_id}', uid = '{$uid}', num_attendees = '{$num_attendees}', dt_reg = " . time()); if (DB_error()) return 23; } else { $this->AddToCart($tick_type, $num_attendees); }*/ return 0; }
$Ev = new evRepeat($rp_id); $msg = $Ev->Register($_POST['tick_count'], $_POST['tick_type']); //if ($msg == 0) $msg = 24; // Set "success" message. //LGLIB_storeMessage($LANG_EVLIST['messages'][$msg]); echo COM_refresh(EVLIST_URL . '/event.php?eid=' . $rp_id); break; case 'cancelreg': if ($rp_id < 1 || COM_isAnonUser()) { // Anonymous users can't register break; } USES_evlist_class_repeat(); $Ev = new evRepeat($rp_id); $status = $Ev->CancelRegistration(0, $_POST['num_cancel']); $msg = $status == true ? 25 : 23; LGLIB_storeMessage($LANG_EVLIST['messages'][$msg]); echo COM_refresh(EVLIST_URL . '/event.php?eid=' . $rp_id); break; case 'cancel': echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php'); break; } switch ($view) { case 'edit': $admin = isset($_GET['admin']) ? true : false; switch ($actionval) { case 'repeat': case 'futurerepeat': if (isset($_REQUEST['rp_id'])) { USES_evlist_class_repeat(); $rp_id = (int) $_GET['rp_id'];
break; case 'detail': // deprecated, should be displayed via detail.php USES_paypal_class_product(); $P = new Product($id); $content .= $P->Detail(); $menu_opt = $LANG_PP['product_list']; $page_title = $LANG_PP['product_detail']; break; case 'cart': case 'viewcart': $menu_opt = $LANG_PP['viewcart']; if ($ppGCart->hasItems()) { $content .= $ppGCart->View(); } else { LGLIB_storeMessage($LANG_PP['cart_empty']); COM_refresh(PAYPAL_URL . '/index.php'); exit; } break; case 'checkoutcart': // Need to create an order or save the cart, so IPN class // can access the data. For now, use the cart. /*USES_paypal_class_order(); if (empty($_SESSION[PP_CART_VAR]['invoice'])) { $Ord = new ppOrder(); $Ord->CreateFromCart($ppGCart); } else { $Ord = new ppOrder($_SESSION[PP_CART_VAR]['invoice']); }*/ $ppGCart->Save();
// Anonymous users can't register break; } USES_evlist_class_repeat(); $Ev = new evRepeat($rp_id); $status = $Ev->CancelRegistration(0, $_POST['num_cancel']); if ($status) { // success LGLIB_storeMessage($LANG_EVLIST['messages'][25]); // See if there are any other ticket and let the user know $cnt = $Ev->isRegistered(); if ($cnt > 0) { LGLIB_storeMessage(sprintf($LANG_EVLIST['messages'][28], $cnt)); } } else { LGLIB_storeMessage($LANG_EVLIST['messages'][23]); } echo COM_refresh(EVLIST_URL . '/event.php?eid=' . $rp_id); break; case 'cancel': echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php'); break; case 'tickdelete_x': // Delete one or more tickets, if admin or owner USES_evlist_class_repeat(); $rp = new evRepeat($_GET['rp_id']); if ($rp->isAdmin) { if (is_array($_POST['delrsvp'])) { USES_evlist_class_ticket(); evTicket::Delete($_POST['delrsvp']); }
<?php /** * IPN processor for Authorize.Net notifications. * * @author Lee Garner <*****@*****.**> * @copyright Copyright (c) 2011 Lee Garner <*****@*****.**> * @package paypal * @version 0.5.3 * @license http://opensource.org/licenses/gpl-2.0.php * GNU Public License v2 or later * @filesource */ /** Import core glFusion functions */ require_once '../../lib-common.php'; USES_paypal_functions(); USES_paypal_class_ipn('authorizenetsim'); if ($_PP_CONF['debug_ipn'] == 1) { // Get the complete IPN message prior to any processing COM_errorLog(var_export($_POST, true)); } $ipn = new AuthorizeNetIPN($_POST); if ($ipn->Process()) { $redirect_url = 'http://dogbert.leegarner.com/dev/paypal/index.php?thanks'; } else { LGLIB_storeMessage($LANG_PP['pmt_error']); $redirect_url = 'http://dogbert.leegarner.com/dev/paypal/index.php'; } echo "<html><head><script language=\"javascript\">\n <!--\n window.location=\"{$redirect_url}\";\n //-->\n </script>\n </head><body><noscript><meta http-equiv=\"refresh\" content=\"1;url={$redirect_url}\"></noscript></body></html>";