$event_time = mktime($hour, $min, 0, $month, $day, $year);
 toilet_init($toilet_init_path);
 $db = toilet_open($toilet_db_path);
 $events = toilet_gtable($db, "events");
 $guests = toilet_gtable($db, "guests");
 $event = gtable_new_row($events);
 if ($event) {
     rowid_set_values($events, $event, array("name" => $name, "description" => $desc, "location" => $where));
     $hash = hash_id("event", "{$event}");
     rowid_set_values($events, $event, array("hash" => $hash));
     $redirect = "manage.php?event={$hash}";
     $guest = gtable_new_row($guests);
     if ($guest) {
         rowid_set_values($guests, $guest, array("event" => $event, "name" => $org, "email" => $email));
         rowid_set_values($events, $event, array("organizer" => $guest, "time" => $event_time));
         $hash = hash_id("guest", "{$guest}");
         rowid_set_values($guests, $guest, array("hash" => $hash));
         if ($reply == "N") {
             $heads = 0;
         } else {
             if ($heads < 1) {
                 $heads = 1;
             } else {
                 if ($heads > 50) {
                     $heads = 50;
                 }
             }
         }
         rowid_set_values($guests, $guest, array("reply" => $reply, "heads" => $heads, "comments" => $comments));
         $server = $HTTP_SERVER_VARS["SERVER_NAME"];
         email_manage_url(stripslashes($name), stripslashes($email), $server, "http://{$server}{$redirect}");
Ejemplo n.º 2
0
 /**
  * Generate hashed ID
  *
  * @return self
  */
 private function generateHashedID()
 {
     $this->propHashedId = hash_id($this->propId, $this->propOptions->toArray());
 }
Ejemplo n.º 3
0
 /**
  * Add row to the cart
  *
  * @param  string $id      Unique ID of the item
  * @param  string $name    Name of the item
  * @param  int    $qty     Item qty to add to the cart
  * @param  float  $price   Price of one item
  * @param  array  $options Array of additional options, such as 'size' or 'color'
  *
  * @throws InvalidPriceException
  * @throws InvalidProductException
  * @throws InvalidQuantityException
  *
  * @return self
  */
 private function addProduct($id, $name, $qty, $price, array $options = [])
 {
     $cart = $this->getContent();
     $hashedId = hash_id($id, $options);
     if ($cart->hasProduct($hashedId)) {
         $product = $cart->get($hashedId);
         $cart = $this->updateProduct($hashedId, ['qty' => $product->qty + $qty]);
     } else {
         $cart->addProduct(compact('id', 'name', 'qty', 'price', 'options'));
     }
     $this->updateCart($cart);
     return $this;
 }