Esempio n. 1
0
 public function removeProductFromUserWishLists(User $user, $productId)
 {
     if (!$user->loaded()) {
         return;
     }
     $this->pixie->db->query('delete')->table($this->pixie->orm->get('wishListItem')->table, 'wli')->join(array('tbl_products', 'p'), array('wli.product_id', 'p.productID'))->join(array('tbl_wish_list', 'wl'), array('wl.id', 'wli.wish_list_id'))->where('wl.user_id', '=', $user->id())->where('p.productID', '=', $productId)->execute();
 }
Esempio n. 2
0
 public function isInUserWishList(User $user = null)
 {
     if ($user === null || !$user->loaded() || !$this->loaded()) {
         return false;
     }
     $num = $this->pixie->db->query('count')->table('tbl_products', 'p')->join(array('tbl_wish_list_item', 'wli'), array('wli.product_id', 'p.productID'))->join(array('tbl_wish_list', 'wl'), array('wl.id', 'wli.wish_list_id'))->where('wl.user_id', '=', $user->id())->where('p.productID', '=', $this->id())->execute();
     return $num > 0;
 }
Esempio n. 3
0
 /**
  * @param User $user
  * @return null|string
  */
 private function getTempPassword($user)
 {
     $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
     $password = "";
     for ($i = 0; $i < 32; $i++) {
         $password .= $arr[rand(0, count($arr) - 1)];
     }
     $user->recover_passw = md5($password);
     $user->save();
     if ($user->loaded()) {
         return $password;
     }
     return null;
 }