Ejemplo n.º 1
0
 /**
  * Checks for and sets global messages for admins
  *
  * @return void
  */
 public static function globals()
 {
     if (Auth::roles()->admin) {
         $global = array();
         // If there are one or more flagged pastes, show an alert
         if (Paste::where('flagged', 1)->count() > 0) {
             $global[] = sprintf(Lang::get('global.alert_flags'), URL::to('flagged'));
         }
         // Save the global messages to session
         Session::put('messages.global', $global);
     }
 }
Ejemplo n.º 2
0
 /**
  * Flood control for Sticky Notes.
  * This disallowes a user to create pastes in less than 5 second intervals.
  *
  * @access private
  * @return bool
  */
 private function runNoflood()
 {
     $posted = Session::get('form.posted');
     $threshold = Site::config('antispam')->floodThreshold;
     if (time() - $posted >= $threshold) {
         Session::put('form.posted', time());
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 3
0
 /**
  * Sets the error handler based on category
  *
  * @static
  * @param  string  $category
  * @return void
  */
 private static function setHandler($category)
 {
     App::error(function ($e, $c) use($category) {
         switch ($category) {
             case 'dbTest':
                 $error = sprintf(Lang::get('setup.test_fail'), $e->getMessage());
                 Session::flash('messages.error', $error);
                 return Redirect::to('setup/install');
             case 'mainProcess':
                 Session::put('setup.error', $e->getMessage());
                 return '-1||' . Lang::get('setup.error_occurred');
         }
     });
 }