Example #1
0
 /**
  * Standard stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function __newpop3()
 {
     if (get_option('is_on_pop3_buy') == '0') {
         return new ocp_tempcode();
     }
     $title = get_page_title('TITLE_NEWPOP3');
     $member_id = get_member();
     $pointsleft = available_points($member_id);
     // the number of points this member has left
     $time = time();
     // So we don't need to call these big ugly names, again...
     $prefix = post_param('prefix');
     $_suffix = post_param('suffix');
     $password = trim(post_param('password'));
     $suffix = 'pop3_' . $_suffix;
     $suffix_price = get_price($suffix);
     pointstore_handle_error_already_has('pop3');
     // If the price is more than we can afford...
     if ($suffix_price > $pointsleft && !has_specific_permission(get_member(), 'give_points_self')) {
         return warn_screen($title, do_lang_tempcode('NOT_ENOUGH_POINTS', escape_html($_suffix)));
     }
     pointstore_handle_error_taken($prefix, $_suffix);
     // Add us to the database
     $sale_id = $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => $time, 'memberid' => get_member(), 'purchasetype' => 'pop3', 'details' => $prefix, 'details2' => '@' . $_suffix), true);
     $mail_server = get_option('mail_server');
     $pop3_url = get_option('pop_url');
     $initial_quota = intval(get_option('initial_quota'));
     $login = $prefix . '@' . $_suffix;
     $email = $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member());
     // Mail off the order form
     $encoded_reason = do_lang('TITLE_NEWPOP3');
     $message_raw = do_template('POINTSTORE_POP3_MAIL', array('_GUID' => '19022c49d0bdde39735245850d04fca7', 'EMAIL' => $email, 'ENCODED_REASON' => $encoded_reason, 'LOGIN' => $login, 'QUOTA' => integer_format($initial_quota), 'MAIL_SERVER' => $mail_server, 'PASSWORD' => $password, 'PREFIX' => $prefix, 'SUFFIX' => $_suffix, 'POP3_URL' => $pop3_url, 'SUFFIX_PRICE' => integer_format($suffix_price)));
     require_code('notifications');
     dispatch_notification('pointstore_request_pop3', 'pop3_' . strval($sale_id), do_lang('MAIL_REQUEST_POP3', NULL, NULL, NULL, get_site_default_lang()), $message_raw->evaluate(get_site_default_lang(), false), NULL, NULL, 3, true);
     $text = do_lang_tempcode('ORDER_POP3_DONE', escape_html($prefix . '@' . $_suffix));
     return inform_screen($title, $text);
 }
Example #2
0
 /**
  * Standard stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function __newforwarding()
 {
     if (get_option('is_on_forw_buy') == '0') {
         return new ocp_tempcode();
     }
     $title = get_page_title('TITLE_NEWFORWARDING');
     $member_id = get_member();
     $pointsleft = available_points($member_id);
     // the number of points this member has left
     $time = time();
     // So we don't need to call these big ugly names, again...
     $prefix = post_param('prefix');
     $_suffix = post_param('suffix');
     $email = post_param('email');
     $suffix = 'forw_' . $_suffix;
     $suffix_price = get_price($suffix);
     pointstore_handle_error_already_has('forwarding');
     // If the price is more than we can afford...
     if ($suffix_price > $pointsleft && !has_specific_permission(get_member(), 'give_points_self')) {
         return warn_screen($title, do_lang_tempcode('NOT_ENOUGH_POINTS', escape_html($_suffix)));
     }
     pointstore_handle_error_taken($prefix, $_suffix);
     // Add us to the database
     $sale_id = $GLOBALS['SITE_DB']->query_insert('sales', array('date_and_time' => $time, 'memberid' => get_member(), 'purchasetype' => 'forwarding', 'details' => $prefix, 'details2' => '@' . $_suffix), true);
     $forw_url = get_option('forw_url');
     // Mail off the order form
     $encoded_reason = do_lang('TITLE_NEWFORWARDING');
     $message_raw = do_template('POINTSTORE_FORWARDER_MAIL', array('_GUID' => 'a09dba8b440baa5cd48d462ebfafd15f', 'ENCODED_REASON' => $encoded_reason, 'EMAIL' => $email, 'PREFIX' => $prefix, 'SUFFIX' => $_suffix, 'FORW_URL' => $forw_url, 'SUFFIX_PRICE' => integer_format($suffix_price)));
     require_code('notifications');
     dispatch_notification('pointstore_request_forwarding', 'forw_' . strval($sale_id), do_lang('MAIL_REQUEST_FORWARDING', NULL, NULL, NULL, get_site_default_lang()), $message_raw->evaluate(get_site_default_lang(), false), NULL, NULL, 3, true);
     $text = do_lang_tempcode('ORDER_FORWARDER_DONE', $email, escape_html($prefix . '@' . $_suffix));
     $url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
     return redirect_screen($title, $url, $text);
 }