示例#1
0
 public function testErrorCollectingAndReporting()
 {
     $n = new Notification();
     $this->assertTrue($n->isOk());
     $this->assertEquals("", $n->report());
     $n->error("An error!");
     $this->assertFalse($n->isOk());
     $n->error("Some %s occured at %s!", "FOO", "BAR");
     $this->assertFalse($n->isOk());
     $n->error("Error: %s at line %d occued because %s!", "SNAFU", 5, "FOOBAR");
     $this->assertEquals("An error!" . PHP_EOL . "Some FOO occured at BAR!" . PHP_EOL . "Error: SNAFU at line 5 occued because FOOBAR!", $n->report());
 }
示例#2
0
 /**
  * Handle the file upload. Returns the array on success, or false
  * on failure.
  *
  * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
  * @param String $path where to upload file
  * @return array|bool
  */
 public function handle(UploadedFile $file, $path = 'uploads')
 {
     $input = array();
     $fileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
     // Detect and transform Croppa pattern to avoid problem with Croppa::delete()
     $fileName = preg_replace('#([0-9_]+)x([0-9_]+)#', "\$1-\$2", $fileName);
     $input['path'] = $path;
     $input['extension'] = '.' . $file->getClientOriginalExtension();
     $input['filesize'] = $file->getClientSize();
     $input['mimetype'] = $file->getClientMimeType();
     $input['filename'] = $fileName . $input['extension'];
     $fileTypes = Config::get('file.types');
     $input['type'] = $fileTypes[strtolower($file->getClientOriginalExtension())];
     $filecounter = 1;
     while (file_exists($input['path'] . '/' . $input['filename'])) {
         $input['filename'] = $fileName . '_' . $filecounter++ . $input['extension'];
     }
     try {
         $file->move($input['path'], $input['filename']);
         list($input['width'], $input['height']) = getimagesize($input['path'] . '/' . $input['filename']);
         return $input;
     } catch (FileException $e) {
         Notification::error($e->getmessage());
         return false;
     }
 }
 /**
  * Start the creation of a new gocardless payment
  *   Details get posted into this method and the redirected to gocardless
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     User::findWithPermission($userId);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'stripeToken', 'ref']);
     $stripeToken = $requestData['stripeToken'];
     $amount = $requestData['amount'];
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     try {
         $charge = Stripe_Charge::create(array("amount" => $amount, "currency" => "gbp", "card" => $stripeToken, "description" => $reason));
     } catch (\Exception $e) {
         \Log::error($e);
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'There was an error confirming your payment'], 400);
         }
         \Notification::error("There was an error confirming your payment");
         return \Redirect::to($returnPath);
     }
     //Replace the amount with the one from the charge, this prevents issues with variable tempering
     $amount = $charge->amount / 100;
     //Stripe don't provide us with the fee so this should be OK
     $fee = $amount * 0.024 + 0.2;
     $this->paymentRepository->recordPayment($reason, $userId, 'stripe', $charge->id, $amount, 'paid', $fee, $ref);
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
 /**
  * Start the creation of a new balance payment
  *   Details get posted into this method
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($user->id);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'ref']);
     $amount = $requestData['amount'] * 1 / 100;
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     //Can the users balance go below 0
     $minimumBalance = $this->bbCredit->acceptableNegativeBalance($reason);
     //What is the users balance
     $userBalance = $this->bbCredit->getBalance();
     //With this payment will the users balance go to low?
     if ($userBalance - $amount < $minimumBalance) {
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'You don\'t have the money for this'], 400);
         }
         \Notification::error("You don't have the money for this");
         return \Redirect::to($returnPath);
     }
     //Everything looks gooc, create the payment
     $this->paymentRepository->recordPayment($reason, $userId, 'balance', '', $amount, 'paid', 0, $ref);
     //Update the users cached balance
     $this->bbCredit->recalculate();
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
示例#5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param Email $email
  * @param $token
  * @return \Illuminate\Http\Response
  */
 public function activate(Email $email, $token)
 {
     if ($email->activate($token, auth()->user())) {
         \Notification::success(trans('email::email.activation_success'));
     } else {
         \Notification::error(trans('email::email.activation_failed'));
     }
     return redirect($this->redirectPath());
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store()
 {
     $input = \Input::only('email', 'password');
     $this->loginForm->validate($input);
     if (Auth::attempt($input, true)) {
         return redirect()->intended('account/' . \Auth::id());
     }
     \Notification::error("Invalid login details");
     return redirect()->back()->withInput();
 }
示例#7
0
 public function isSWF($setNotification = true)
 {
     $imageFileType = $this->getExtension();
     if ($imageFileType != "swf") {
         if ($setNotification) {
             Notification::error(1, 'Only Flash files are allowed.');
         }
         return false;
     }
     return true;
 }
示例#8
0
 public static function file($file)
 {
     $skinPath = self::dir(true) . $file;
     $globalPath = self::dir() . $file;
     if (file_exists($skinPath)) {
         return include $skinPath;
     } elseif (file_exists($globalPath)) {
         return include $globalPath;
     } else {
         Notification::error(1, 'file "' . $file . '" Not found! ', 'Template');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param $roleId
  * @param $userId
  * @return Response
  */
 public function destroy($roleId, $userId)
 {
     $role = Role::findOrFail($roleId);
     //don't let people remove the admin permission if they are a trustee
     $user = User::findOrFail($userId);
     if ($user->active && $user->director && $role->name == 'admin') {
         \Notification::error("You cannot remove a trustee from the admin group");
         return \Redirect::back();
     }
     $role->users()->detach($userId);
     return \Redirect::back();
 }
 public static function online($user_id, $plan_id)
 {
     $input = ['plan_id' => $plan_id, 'validity' => 1, 'validity_unit' => 'Day', 'count' => 1];
     try {
         DB::transaction(function () use($input, $user_id) {
             $pins = Voucher::generate($input);
             return self::now(current($pins), $user_id, 'online');
         });
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         Notification::error($e->getMessage());
     }
 }
 public function post_index()
 {
     //POST LOGIN
     $credentials = array('cms' => true, 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => false);
     //CHECK CREDENTIALS
     if (Auth::attempt($credentials)) {
         //SUCCESS NOTIFICATION
         return Redirect::to_action('cms::dashboard');
     } else {
         //ERROR NOTIFICATION
         Notification::error(LL('cms::alert.login_error', CMSLANG));
         //BACK TO LOGIN
         return Redirect::to_action('cms::login')->with_input('only', array('username'));
     }
 }
 public function postEdit()
 {
     if (!Input::has('id')) {
         Notification::error('Parameter Missing.');
         return Redirect::route(self::HOME);
     }
     $input = Input::all();
     try {
         $router = Router::findOrFail($input['id']);
         $router->fill($input);
         $this->flash($router->save());
         return Redirect::route(self::HOME);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         App::abort(404);
     }
 }
 /**
  * Remove cash from the users balance
  *
  * @param $userId
  * @return mixed
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\InvalidDataException
  */
 public function destroy($userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($userId);
     $amount = \Request::get('amount');
     $returnPath = \Request::get('return_path');
     $ref = \Request::get('ref');
     $minimumBalance = $this->bbCredit->acceptableNegativeBalance('withdrawal');
     if ($user->cash_balance + $minimumBalance * 100 < $amount * 100) {
         \Notification::error("Not enough money");
         return \Redirect::to($returnPath);
     }
     $this->paymentRepository->recordPayment('withdrawal', $userId, 'balance', '', $amount, 'paid', 0, $ref);
     $this->bbCredit->recalculate();
     \Notification::success("Payment recorded");
     return \Redirect::to($returnPath);
 }
示例#14
0
 public function post_delete()
 {
     if (Input::has('user_id')) {
         $uid = Input::get('user_id');
         $user = CmsUser::find($uid);
         //CHECK IF USER EXISTS
         if (empty($user)) {
             Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 2500);
             return Redirect::to_action('cms::user');
         } else {
             $user->delete();
             Notification::success(LL('cms::alert.delete_user_success', CMSLANG, array('user' => $user->username)), 1500);
             return Redirect::to_action('cms::user');
         }
     } else {
         Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 1500);
         return Redirect::to_action('cms::user');
     }
 }
示例#15
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof FormValidationException) {
         if ($request->wantsJson()) {
             return \Response::json($e->getErrors(), 422);
         }
         \Notification::error("Something wasn't right, please check the form for errors", $e->getErrors());
         return redirect()->back()->withInput();
     }
     if ($e instanceof ValidationException) {
         if ($request->wantsJson()) {
             return \Response::json($e->getMessage(), 422);
         }
         \Notification::error($e->getMessage());
         return redirect()->back()->withInput();
     }
     if ($e instanceof NotImplementedException) {
         \Notification::error("NotImplementedException: " . $e->getMessage());
         \Log::warning($e);
         return redirect()->back()->withInput();
     }
     if ($e instanceof AuthenticationException) {
         if ($request->wantsJson()) {
             return \Response::json(['error' => $e->getMessage()], 403);
         }
         $userString = \Auth::guest() ? "A guest" : \Auth::user()->name;
         \Log::warning($userString . " tried to access something they weren't supposed to.");
         return \Response::view('errors.403', [], 403);
     }
     if ($e instanceof ModelNotFoundException) {
         $e = new HttpException(404, $e->getMessage());
     }
     if (config('app.debug') && $this->shouldReport($e) && !$request->wantsJson()) {
         return $this->renderExceptionWithWhoops($e);
     }
     if ($request->wantsJson()) {
         if ($this->isHttpException($e)) {
             return \Response::json(['error' => $e->getMessage()], $e->getStatusCode());
         }
     }
     return parent::render($request, $e);
 }
 public function post_delete()
 {
     if (Input::has('role_id')) {
         $rid = Input::get('role_id');
         $page = CmsPage::where_role_id($rid)->first();
         //CHECK IF ROLE STILL IN USE
         if (!empty($page)) {
             Notification::error(LL('cms::alert.delete_role_stillinuse_error', CMSLANG, array('page' => $page->name)), 2500);
             return Redirect::to_action('cms::role');
         } else {
             $role = CmsRole::find($rid);
             $role->delete();
             Notification::success(LL('cms::alert.delete_role_success', CMSLANG, array('role' => $role->name)), 1500);
             return Redirect::to_action('cms::role');
         }
     } else {
         Notification::error(LL('cms::alert.delete_role_error', CMSLANG), 1500);
         return Redirect::to_action('cms::page');
     }
 }
 public function post_delete()
 {
     if (Input::has('download_id')) {
         $did = Input::get('download_id');
         $download = CmsDownload::find($did);
         //CHECK IF DOWNLOAD EXISTS
         if (!empty($download)) {
             //DELETE FROM DB
             $download->files()->delete();
             $download->delete();
             Notification::success(LL('cms::alert.delete_download_success', CMSLANG, array('download' => $download->name)), 1500);
             return Redirect::to_action('cms::download');
         } else {
             Notification::error(LL('cms::alert.delete_download_error', CMSLANG), 2500);
             return Redirect::to_action('cms::download');
         }
     } else {
         Notification::error(LL('cms::alert.delete_download_error', CMSLANG), 1500);
         return Redirect::to_action('cms::download');
     }
 }
 public function post_delete()
 {
     if (Input::has('gallery_id')) {
         $gid = Input::get('gallery_id');
         $gallery = CmsGallery::find($gid);
         //CHECK IF GALLERY EXISTS
         if (!empty($gallery)) {
             //DELETE FROM DB
             $gallery->files()->delete();
             $gallery->delete();
             Notification::success(LL('cms::alert.delete_gallery_success', CMSLANG, array('gallery' => $gallery->name)), 1500);
             return Redirect::to_action('cms::gallery');
         } else {
             Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 2500);
             return Redirect::to_action('cms::gallery');
         }
     } else {
         Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 1500);
         return Redirect::to_action('cms::gallery');
     }
 }
 /**
  * This is a basic method for recording a payment transfer between two people
  * This should not exist and the normal balance payment controller should be used
  * If any more work is needed here please take the time and move it over!
  *
  * @param Request $request
  * @param integer $userId
  *
  * @return mixed
  * @throws ValidationException
  * @throws AuthenticationException
  */
 public function recordTransfer(Request $request, $userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($user->id);
     $amount = $request->get('amount');
     $targetUserId = $request->get('target_user_id');
     $targetUser = $this->userRepository->getById($targetUserId);
     if ($targetUserId === $userId) {
         throw new ValidationException('Your\'e trying to send money to yourself, no!');
     }
     //What is the users balance
     $userBalance = $this->bbCredit->getBalance();
     //With this payment will the users balance go to low?
     if ($userBalance - $amount < 0) {
         \Notification::error("You don't have the money for this");
         return \Redirect::route('account.balance.index', $user->id);
     }
     $this->paymentRepository->recordBalanceTransfer($user->id, $targetUser->id, $amount);
     \Notification::success("Transfer made");
     return \Redirect::route('account.balance.index', $user->id);
 }
示例#20
0
文件: Widget.php 项目: ashmna/MedDocs
 public static function show($widgetName, $package = '')
 {
     $globalDir = Config::getGlobalDir();
     $skinRootDir = Config::getSkinRootDir();
     $package = trim($package, '//');
     $widgetName = trim($widgetName, '//');
     if (!empty($package)) {
         $widgetName = DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . $widgetName;
     } else {
         $widgetName = DIRECTORY_SEPARATOR . $widgetName;
     }
     $path = $globalDir . DIRECTORY_SEPARATOR . 'widgets' . $widgetName . '.php';
     $skinPath = $skinRootDir . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'widgets' . $widgetName . '.php';
     if (file_exists($skinPath)) {
         include $skinPath;
     } elseif (file_exists($path)) {
         include $path;
     } else {
         Notification::error(1, $widgetName . ' Not found! ', 'Widget');
     }
 }
 public function post_delete()
 {
     if (Input::has('tag_id')) {
         $tid = Input::get('tag_id');
         $tag = CmsTag::find($tid);
         //CHECK IF TAG EXISTS
         if (!empty($tag)) {
             $lang = $tag->lang;
             //DELETE FROM DB
             $tag->blogs()->delete();
             $tag->delete();
             Notification::success(LL('cms::alert.delete_tag_success', CMSLANG, array('tag' => $tag->name)), 1500);
             return Redirect::to_action('cms::tag', array($lang));
         } else {
             Notification::error(LL('cms::alert.delete_tag_error', CMSLANG), 2500);
             return Redirect::to_action('cms::tag', array($lang));
         }
     } else {
         Notification::error(LL('cms::alert.delete_gallery_error', CMSLANG), 1500);
         return Redirect::to_action('cms::tag', array($lang));
     }
 }
 /**
  * Handle a POST request to reset a user's password.
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|null
  */
 public function postReset(Request $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $validator = app('Illuminate\\Contracts\\Validation\\Factory')->make($credentials, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|min:8']);
     if ($validator->fails()) {
         throw new FormValidationException('Error', $validator->errors());
     }
     //We aren't using a confirm password box so this can be faked
     $credentials['password_confirmation'] = $credentials['password'];
     $response = Password::reset($credentials, function ($user, $password) {
         $user->password = $password;
         $user->save();
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             \Notification::success("Your password has been changed");
             return redirect()->home();
         default:
             \Notification::error(trans($response));
             return redirect()->back()->withInput();
     }
 }
示例#23
0
 public function post_delete()
 {
     if (Input::has('blog_id')) {
         $bid = Input::get('blog_id');
         $blog = CmsBlog::find($bid);
         //CHECK IF BLOG EXISTS
         if (!empty($blog)) {
             //OK, DELETE
             $blog->pages()->delete();
             $blog->delete();
             Notification::success(LL('cms::alert.delete_blog_success', CMSLANG, array('blog' => $blog->name)), 2500);
             return Redirect::to_action('cms::blog', array($blog->lang));
         } else {
             Notification::error(LL('cms::alert.delete_blog_error', CMSLANG), 2500);
             return Redirect::to_action('cms::blog', array(LANG));
         }
     } else {
         Notification::error(LL('cms::alert.delete_blog_error', CMSLANG), 2500);
         return Redirect::to_action('cms::blog', array(LANG));
     }
 }
 public function confirmEmail($id, $hash)
 {
     $user = User::find($id);
     if ($user && $user->hash == $hash) {
         $user->emailConfirmed();
         \Notification::success('Email address confirmed, thank you');
         return \Redirect::route('account.show', $user->id);
     }
     \Notification::error('Error confirming email address');
     return \Redirect::route('home');
 }
 public function post_delete()
 {
     if (Input::has('banner_id')) {
         $bid = Input::get('banner_id');
         $banner = CmsBanner::find($bid);
         //CHECK IF BANNER EXISTS
         if (!empty($banner)) {
             //DELETE FROM DB
             $banner->files()->delete();
             $banner->delete();
             Notification::success(LL('cms::alert.delete_banner_success', CMSLANG, array('banner' => $banner->name)), 1500);
             return Redirect::to_action('cms::banner');
         } else {
             Notification::error(LL('cms::alert.delete_banner_error', CMSLANG), 2500);
             return Redirect::to_action('cms::banner');
         }
     } else {
         Notification::error(LL('cms::alert.delete_banner_error', CMSLANG), 1500);
         return Redirect::to_action('cms::banner');
     }
 }
示例#26
0
 public function post_clone_element()
 {
     if (Input::has('page_id') and Input::has('element_id') and Input::has('newpage_id')) {
         $pid = Input::get('page_id');
         $nid = Input::get('newpage_id');
         $eid = Input::get('element_id');
         $now = date('Y-m-d H:i:s');
         if (Input::has('to_clone')) {
             //CREATE NEW ELEMENT
             //GET ELEMENT MODEL
             $element = CmsElement::find($eid);
             $new_element_attr = array('author_id' => AUTHORID, 'name' => $element->name, 'label' => $element->label, 'text' => $element->text, 'zone' => $element->zone, 'lang' => LANG, 'is_valid' => 0);
             $new_element = new CmsElement($new_element_attr);
             $page = CmsPage::find($nid);
             $page->elements()->insert($new_element);
         } else {
             //GET ELEMENT MODEL
             $element = CmsElement::find($eid);
             $clone_array = array('cmselement_id' => $eid, 'cmspage_id' => $nid, 'created_at' => $now, 'updated_at' => $now);
             DB::table('elements_pages')->insert($clone_array);
         }
         Notification::success(LL('cms::alert.clone_element_success', CMSLANG, array('element' => $element->name)), 1500);
         return Redirect::to_action('cms::page', array(LANG));
     } else {
         Notification::error(LL('cms::alert.clone_element_error', CMSLANG), 1500);
         return Redirect::to_action('cms::page', array(LANG));
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Illuminate\Http\RedirectResponse
  */
 public function destroy($userId, $id = null)
 {
     /**
      * TODO: Check for and cancel pending sub charges
      */
     $user = User::findWithPermission($userId);
     if ($user->payment_method == 'gocardless') {
         try {
             $subscription = $this->goCardless->cancelSubscription($user->subscription_id);
             if ($subscription->status == 'cancelled') {
                 $user->cancelSubscription();
                 \Notification::success('Your subscription has been cancelled');
                 return \Redirect::back();
             }
         } catch (\GoCardless_ApiException $e) {
             if ($e->getCode() == 404) {
                 $user->cancelSubscription();
                 \Notification::success('Your subscription has been cancelled');
                 return \Redirect::back();
             }
         }
     } elseif ($user->payment_method == 'gocardless-variable') {
         $status = $this->goCardless->cancelPreAuth($user->subscription_id);
         if ($status) {
             $user->subscription_id = null;
             $user->payment_method = '';
             $user->save();
             $user->setLeaving();
             $this->subscriptionChargeRepository->cancelOutstandingCharges($userId);
             \Notification::success('Your direct debit has been cancelled');
             return \Redirect::back();
         }
     }
     \Notification::error('Sorry, we were unable to cancel your subscription, please get in contact');
     return \Redirect::back();
 }
示例#28
0
        return \Redirect::guest('admin')->with('error', 'Please Login to enter Dashboard');
    } else {
        if (!\Auth::user()->can('login')) {
            \Notification::error('You can not access here');
            return \Redirect::back()->with('error', 'You can not access here');
        }
    }
});
Route::filter('checkLogined', function () {
    if (\Auth::check()) {
        if (!\Auth::user()->can('login')) {
            \Notification::error('You can not access here');
            return \Redirect::route('getLogin')->with('error', 'You can not access here');
        } else {
            \Notification::success('You are logined !');
            return \Redirect::route('dashboard')->with('success', 'You are logined !');
        }
    }
});
Route::filter('issetAlbum', function () {
    if (!\Album::first()) {
        \Notification::error('Please create album first !');
        return \Redirect::route('admin.album.index');
    }
});
Route::filter('issetCate', function () {
    if (!\Category::first()) {
        \Notification::error('Please create Category first !');
        return \Redirect::route('admin.category.index');
    }
});
示例#29
0
 public function checklogin()
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $rememberUser = Input::get('rememberUser');
     //echo $rememberUser;
     if (Auth::attempt(array('username' => $username, 'password' => $password), true)) {
         Session::put('username', $username);
         return Redirect::route('home.index');
     } else {
         Notification::error('The page was saved.');
         return "hello";
     }
 }
 public function post_delete()
 {
     if (Input::has('file_id')) {
         $fid = Input::get('file_id');
         $file = CmsFile::find($fid);
         //CHECK IF FILE EXISTS
         if (!empty($file)) {
             $path = MEDIA_PATH($file->path);
             //DELETE MAIN FILE
             if (file_exists($path)) {
                 unlink($path);
             }
             //LOOP ALL THUMBS AND DELETE
             foreach (Config::get('cms::theme.thumb') as $option) {
                 $thumb = MEDIA_NAME($path, $option['suffix']);
                 if (file_exists($thumb)) {
                     unlink($thumb);
                 }
             }
             //DELETE FROM DB
             $file->pages()->delete();
             $file->filetexts()->delete();
             $file->delete();
             Notification::success(LL('cms::alert.delete_file_success', CMSLANG, array('file' => $file->name)), 1500);
             return Redirect::to_action('cms::file');
         } else {
             Notification::error(LL('cms::alert.delete_file_error', CMSLANG), 2500);
             return Redirect::to_action('cms::file');
         }
     } else {
         Notification::error(LL('cms::alert.delete_file_error', CMSLANG), 1500);
         return Redirect::to_action('cms::file');
     }
 }