Esempio n. 1
0
/** REQUIRE SETTINGS */
include 'settings.php';
include IDIR . '/site/db.php';
/** CONNECT TO DB */
if ($db->connect_errno) {
    header('Location: index.php');
    die;
}
$db->set_charset(DB_CHARSET);
/** */
spl_autoload_register(function ($cn) {
    include IDIR . '/' . str_replace('\\', '/', $cn) . '.php';
});
/** */
include (new \main\load())->language['location'];
if (!$GLOBALS['me'] || !\query\payments::plan_exists($_GET['plan'], array('user_view' => ''))) {
    header('Location: index.php');
    die;
}
$plan = \query\payments::plan_infos($_GET['plan']);
try {
    $gateway = isset($_GET['gateway']) ? $_GET['gateway'] : '';
    $payment = new \payment\main($gateway);
    $thegateway = $payment->gateway_name;
    $payment->description = 'Purchase plan';
    $payment->items[] = array($plan->name, $plan->description, 1, $plan->price);
    echo '<!DOCTYPE html>

  <html>
      <head>
Esempio n. 2
0
</div>';
        break;
        /** EDIT PLAN */
    /** EDIT PLAN */
    case 'plan_edit':
        if (!$GLOBALS['me']->is_admin) {
            die;
        }
        $csrf = \site\utils::str_random(10);
        echo '<div class="title">

<h2>' . $LANG['pmts_editplan_title'] . '</h2>

<div style="float:right; margin: 0 2px 0 0;">';
        if (isset($_GET['id']) && ($plan_exists = \query\payments::plan_exists($_GET['id']))) {
            $info = \query\payments::plan_infos($_GET['id']);
            echo '<div class="options">
<a href="#" class="btn">' . $LANG['options'] . '</a>
<ul>
<li><a href="?route=payments.php&amp;action=plan_view&amp;type=delete&amp;id=' . $_GET['id'] . '&amp;token=' . $csrf . '" data-delete-msg="' . $LANG['delete_msg'] . '">' . $LANG['delete'] . '</a></li>
</ul>
</div>';
        }
        echo '<a href="?route=payments.php&amp;action=plan_view" class="btn">' . $LANG['payments_plan_view'] . '</a>
</div>';
        if (!empty($LANG['pmts_editplan_subtitle'])) {
            echo '<span>' . $LANG['pmts_editplan_subtitle'] . '</span>';
        }
        echo '</div>';
        if ($plan_exists) {
Esempio n. 3
0
 public static function delete_payment_plan_image($id)
 {
     global $db;
     if (!$GLOBALS['me']->is_admin) {
         return false;
     }
     $id = (array) $id;
     $stmt = $db->stmt_init();
     $stmt->prepare("UPDATE " . DB_TABLE_PREFIX . "p_plans SET image = '' WHERE id = ?");
     foreach ($id as $ID) {
         if (\query\payments::plan_exists($ID)) {
             $plan = \query\payments::plan_infos($ID);
             $stmt->bind_param("i", $ID);
             $stmt->execute();
             if (!empty($plan->image)) {
                 @unlink(DIR . '/' . $plan->image);
             }
         }
     }
     @$stmt->close();
     return true;
 }