Ejemplo n.º 1
0
 public function control($next)
 {
     $u = new User();
     if ($u->isLoggedIn()) {
         Session::flash("msg", '<li><span class="msg-warning">Warning: </span> You cannot login twice, please <a href="' . Url::route('logout') . '">Logout</a> first and try again!</li>');
         goBack();
     } else {
         return $next();
     }
 }
Ejemplo n.º 2
0
 public function control($next)
 {
     $u = new User();
     if ($u->isLoggedIn()) {
         return $next();
     } else {
         Session::flash("msg", '<li><span class="msg-warning">Warning: </span> Humm!... you want to cheat, please <a href="' . Url::route('login') . '">login</a> first and go back later!</li>');
         goBack();
     }
 }
Ejemplo n.º 3
0
use App\Models\GoogleModel;
use Carbon\Carbon;
use Facebook\Facebook;
return ['config' => ['cache' => path('resources.cache'), 'debug' => true], 'static_functions' => ['Url', 'Session', 'Token'], 'callable_functions' => ['social' => function ($c) {
    switch ($c) {
        case 'f':
            $url = new Facebook();
            return $url->getLoginUrl();
        case 'g':
            $client = new Google_Client();
            $auth = new GoogleModel($client);
            return $auth->getAuthUrl();
    }
}, 'is_loggedin' => function () {
    $u = new User();
    return $u->isLoggedIn();
}, 'time' => function ($time) {
    $t = new Carbon($time);
    return $t->toRfc850String();
}, 'readable_time' => function ($time) {
    $t = new Carbon($time);
    return $t->diffForHumans();
}, 'strip' => function ($string) {
    // strip tags to avoid breaking any html
    $string = strip_tags($string);
    if (strlen($string) > 500) {
        // truncate string
        $stringCut = substr($string, 0, 500);
        // make sure it ends in a word so assassinate doesn't become ass...
        $string = substr($stringCut, 0, strrpos($stringCut, ' '));
    }