本文整理汇总了PHP中Sentry::guest方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentry::guest方法的具体用法?PHP Sentry::guest怎么用?PHP Sentry::guest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentry
的用法示例。
在下文中一共展示了Sentry::guest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
});
Route::filter('after', function ($response) {
// Do stuff after every request to your application...
});
Route::filter('csrf', function () {
if (Request::forged()) {
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
return Redirect::to('/');
}
});
Route::filter('Sentry_auth', function () {
if (Sentry::guest()) {
return Redirect::to('/');
}
});
Route::filter('ip', function () {
// Create the Eloquent object Visit
$visit = new Track();
$browser = new Browser();
$visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country');
$visit->ip_address = Request::ip();
$visit->request = URI::current();
if (Auth::check()) {
$visit->user_id = Auth::user()->id;
}
// Browser stats
$visit->browser = $browser->getBrowser();
示例2: guest
public function guest()
{
return Sentry::guest();
}
示例3: post_post
public function post_post()
{
$data = json_decode(Input::get('json'));
$fields = array('post' => $data->inputarea, 'threadid' => $data->thread_id);
if (Sentry::guest()) {
return json_encode(array("success" => 0, "msg" => "üye olda gel"));
}
//filter falan ama sonra ..
$userid = Sentry::user()->id;
$userip = Request::ip();
$cThread = Thread::where('id', '=', $fields['threadid'])->first();
/*FLOOD PROTECTION*/
####################
/*$_messageTime = Post::where(function ($query) use ($cThread,$userid){
$query->where('thread_id','=',$cThread->id);
$query->where('user_id', '=',$userid);
})
->order_by('datetime','DESC')
->first(array('datetime'));
if($_messageTime){
$_timestamp = strtotime($_messageTime->datetime);
$_timeCalc = time()-10;
if($_timestamp >= $_timeCalc)
{
return json_encode(array("success" => 0,"msg" => "Cok hızlı giriyorsun babacan!"));
}
}*/
####################
/*FLOOD PROTECTION*/
// Check user has 10 post if he newbie member
if (Sentry::user()->user_type == 0) {
$fulled = false;
$post = Post::where('user_id', '=', Sentry::user()->id);
if ($post->count() >= 10) {
return json_encode(array("success" => 0, "msg" => "Çaylak Olarak Bu kadar Yazdıgınız Yeter.\nLütfen Bir adminin onaylamasını bekleyiniz."));
}
}
if (Sentry::user()->has_access('can_post') && $cThread->type == 0) {
if (Sentry::user()->user_type == 0) {
$post_type = 0;
} else {
$post_type = 1;
}
if (strlen(trim($fields['post'])) >= 5 || Sentry::user()->has_access('is_mod')) {
$max = Post::where('thread_id', '=', $fields['threadid'])->max('count');
$post = static::replace_at(BBCode2Html(strip_tags_attributes($fields['post'])), $fields['threadid']);
$postData = array('thread_id' => $fields['threadid'], 'entry' => $post, 'userip' => $userip, 'user_id' => $userid, 'datetime' => date("Y-m-d H:i:s"), 'count' => $max + 1, 'type' => $post_type);
/*
Update last message on thread table
*/
$cThread->last_message_at = date("Y-m-d H:i:s");
$cThread->save();
$id = DB::table('posts')->insert_get_id($postData);
$entry = Post::with('author')->where_id($id)->first();
$threadid = $fields['threadid'];
$count = Post::where(function ($query) use($threadid) {
$query->where('thread_id', '=', $threadid);
$query->where('type', '=', 1);
})->count();
// cache deki konuyu okumuş memberlari sil
DB::query('DELETE FROM xr_threadsmembers WHERE thread_id=?', array($threadid));
/*Page Function*/
$pagenum = ceil($count / static::$per_page);
//doing ajax callbacks
//create view
$view = array("id" => $entry->id, "count" => $entry->count, "entry" => $entry->entry, "author" => $entry->author->username, "date" => $entry->datetime, "page" => $pagenum);
return Response::json($view);
} else {
return json_encode(array("success" => 0, "msg" => "entry çok kısa babacan"));
}
} else {
return json_encode(array("success" => 0, "msg" => "yetki yok hocam"));
}
return json_encode(array("success" => 0, "msg" => "Undefined Error!"));
}