示例#1
0
 public function __construct()
 {
     self::$paymentLog = R::dispense('payment_log');
     if (!isset($_GET['amount']) || !isset($_GET['title']) || !isset($_GET['auth']) || !isset($_GET['country']) || !isset($_GET['currency']) || !isset($_GET['function'])) {
         self::error(99);
     }
     $this->amount = $_GET['amount'];
     $this->title = $_GET['title'];
     $this->auth = $_GET['auth'];
     $this->country = $_GET['country'];
     $this->currency = $_GET['currency'];
     $this->function = $_GET['function'];
     $call = 'action_' . ucfirst($this->function);
     self::$paymentLog->amount = $this->amount;
     self::$paymentLog->title = $this->title;
     self::$paymentLog->auth = $this->auth;
     self::$paymentLog->country = $this->country;
     self::$paymentLog->currency = $this->currency;
     self::$paymentLog->function = $this->function;
     // check if valid ip
     $this->checkIP();
     // loadup prices
     $this->prices = Config::getConfig('premium_price');
     // valid callback function?
     if (!method_exists($this, $call)) {
         self::error(1);
     }
     // valid item?
     $parts = explode("_", $this->title);
     if (count($parts) != 3) {
         self::error(2);
     }
     if ($parts[0] != "pa" || !is_numeric($parts[1]) || !is_numeric($parts[2])) {
         self::error(3);
     }
     $this->premiumPoints = $parts[1];
     $this->userID = $parts[2];
     if (!isset($this->prices[$this->premiumPoints])) {
         self::error(4);
     }
     $this->{$call}();
 }