} } } } } } else { if (($payment_direct_token = $payment->execute_direct_payment()) && isset($_SESSION['payment_direct_token']) && ($_SESSION['payment_direct_token'] = $payment_direct_token)) { unset($_SESSION['payment_direct_token']); try { $answer = $payment->execute_payment(); echo '<div class="success">' . $LANG['payments_msg_confirmed'] . '</div>'; /* Action after purchase, add credits or something ... */ // add user credits $delivered = \user\update::add_credits($GLOBALS['me']->ID, $plan->credits); // update transaction // state, userID, paid, delivered, transactionID \query\payments::update_payment(array($answer['state'], $GLOBALS['me']->ID, 1, $delivered, $answer['id'])); } catch (Exception $e) { echo '<div class="error">' . $e->getMessage() . '</div>'; } } } $csrf = $_SESSION['payment_csrf'] = \site\utils::str_random(10); echo '<div class="table">'; echo '<section> <h2>' . $LANG['payments_title_infos'] . '</h2> <ul class="table2">
public static function submit_store($id, $post) { global $db, $LANG; $post = array_map('trim', $post); if (!isset($post['name']) || trim($post['name']) == '') { throw new \Exception($LANG['submit_store_writename']); } else { if (!isset($post['url']) || !preg_match('/(^http(s)?:\\/\\/)([a-zA-Z0-9-]{3,100}).([a-zA-Z]{2,12})/', $post['url'])) { throw new \Exception($LANG['submit_store_wrongweb']); } else { if (!isset($post['description']) || strlen($post['description']) < 10) { throw new \Exception($LANG['submit_store_writedesc']); } else { if ($GLOBALS['me']->Credits < ($cost = (int) \query\main::get_option('price_store'))) { throw new \Exception(sprintf($LANG['msg_notenoughpoints'], $cost, $GLOBALS['me']->Credits)); } $logo = \site\images::upload($_FILES['submit_store_form_logo'], 'logo_', array('path' => '', 'max_size' => 400, 'max_width' => 600, 'max_height' => 400, 'current' => '')); $stmt = $db->stmt_init(); $stmt->prepare("INSERT INTO " . DB_TABLE_PREFIX . "stores (user, category, name, link, description, tags, image, visible, lastupdate_by, lastupdate, date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())"); $tags = isset($post['tags']) ? $post['tags'] : ''; // autovalidate this store? $valid = \query\main::get_option('store_validate'); $stmt->bind_param("iisssssii", $GLOBALS['me']->ID, $post['category'], $post['name'], $post['url'], $post['description'], $tags, $logo, $valid, $GLOBALS['me']->ID); $execute = $stmt->execute(); $stmt->close(); if ($execute) { // deduct credits \user\update::add_credits($GLOBALS['me']->ID, -$cost); return (object) array('image' => $logo); } throw new \Exception($LANG['msg_error']); } } } }