Пример #1
0
 public function action_delete()
 {
     if (Auth::is_admin_signed_in() === true) {
         $product_id = $this->request->param('id');
         $token = $this->request->param('id2');
         if (!Security::check($token)) {
             $this->request->redirect('acp/products');
         }
         if (empty($product_id)) {
             $this->request->redirect('acp/products');
         }
         $products = new Model_Product();
         $delete_product = $products->delete_product($product_id);
         if (!$delete_product) {
             throw new Exception("Error with deleting product!");
         }
         $this->request->redirect('acp/products');
     } else {
         $this->request->redirect('acp');
     }
 }