/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return new RedirectResponse(url('/home'));
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->guard->check()) {
         return $next($request);
     }
     return $request->ajax() ? response('Unauthorized.', 401) : redirect()->guest('auth/login');
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->auth->check()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('authenticate/signin');
         }
     }
     return $next($request);
 }
Ejemplo n.º 4
0
 public function handle($request, Closure $next)
 {
     $accountable = true;
     if ($request->header('X-TOR', false) || is_hidden_service()) {
         // Consider a user unaccountable if there's a custom X-TOR header,
         // or if the hostname is our hidden service name.
         $accountable = false;
     } elseif (!env('APP_DEBUG', false) && env('APP_URL_HS', false) && (new Geolocation())->getCountryCode() == "tor") {
         throw new TorClearnet();
     }
     $this->auth->user()->setAccountable($accountable);
     return $next($request);
 }
Ejemplo n.º 5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             $this->logger->error('Authentication failed: Ajax request?!', array('url' => $request->path()));
             return response('Unauthorized.', 401);
         } else {
             $request->session()->flash('intended_url', $request->path());
             return redirect('login');
         }
     }
     return $next($request);
 }
Ejemplo n.º 6
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         $authorize = $this->isPublicRequest($request);
         if (!$authorize) {
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {
                 return redirect()->guest(route('login'));
             }
         }
     }
     return $next($request);
 }
Ejemplo n.º 7
0
 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function github($hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->socialite->driver('github')->redirect();
     }
     $user = $this->users->findOrCreate($this->socialite->driver('github')->user(), 'github');
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
Ejemplo n.º 8
0
 /**
  * Constructs a player.
  * 
  * @param mixed $id The identifier for the player, such as a name.
  * @param number $partialPlayPercentage The weight percentage to give this player when calculating a new rank.
  * @param number $partialUpdatePercentage Indicated how much of a skill update a player should receive where 0 represents no update and 1.0 represents 100% of the update.
  */
 public function __construct($id, $partialPlayPercentage = self::DEFAULT_PARTIAL_PLAY_PERCENTAGE, $partialUpdatePercentage = self::DEFAULT_PARTIAL_UPDATE_PERCENTAGE)
 {
     // If they don't want to give a player an id, that's ok...
     Guard::argumentInRangeInclusive($partialPlayPercentage, 0.0, 1.0, "partialPlayPercentage");
     Guard::argumentInRangeInclusive($partialUpdatePercentage, 0, 1.0, "partialUpdatePercentage");
     $this->_Id = $id;
     $this->_PartialPlayPercentage = $partialPlayPercentage;
     $this->_PartialUpdatePercentage = $partialUpdatePercentage;
 }
Ejemplo n.º 9
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user = $this->auth->getUser();
     $confirmed = $user->confirmed;
     if (isset($confirmed) && $confirmed == "0") {
         // If the user has not had an activation token set
         $confirmation_code = $user->confirmation_code;
         if (empty($confirmation_code)) {
             // generate a confirmation code
             $key = \Config::get('app.key');
             $confirmation_code = hash_hmac('sha256', str_random(40), $key);
             $user->confirmation_code = $confirmation_code;
             $user->save();
             \Mail::send('emails.activate', ['token' => $confirmation_code, 'name' => $user->name], function ($message) use($user) {
                 $message->to($user->getEmailForPasswordReset(), $user->name)->subject('Activate your Notify account');
             });
         }
         return redirect()->guest('/activate');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $authenticated = false;
     try {
         // get the api token
         $api_token = $request->headers->get('X-Tokenly-Auth-Api-Token');
         if (!$api_token) {
             $api_token = $request->input('apitoken');
         }
         if (!strlen($api_token)) {
             throw new AuthorizationException("Missing API Token");
         }
         // load the user
         $user = $this->user_repository->findByAPIToken($api_token);
         if (!$user) {
             throw new AuthorizationException("Invalid API Token", "Failed to find user for token {$api_token}");
         }
         // populate Guard with the $user
         $this->auth->setUser($user);
         $authenticated = true;
     } catch (AuthorizationException $e) {
         // unauthorized
         $this->event_log->logError('error.auth.unauthenticated', $e, ['remoteIp' => $request->getClientIp()]);
         $error_message = $e->getAuthorizationErrorString();
         $error_code = $e->getCode();
         if (!$error_message) {
             $error_message = 'Authorization denied.';
         }
     } catch (Exception $e) {
         // something else went wrong
         $this->event_log->logError('error.auth.unexpected', $e);
         $error_message = 'An unexpected error occurred';
         $error_code = 500;
     }
     if (!$authenticated) {
         $response = new JsonResponse(['message' => $error_message, 'errors' => [$error_message]], $error_code);
         return $response;
     }
     return $next($request);
 }
Ejemplo n.º 11
0
 public static function encrypt($input, $key)
 {
     $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
     $input = Guard::pkcs5_pad($input, $size);
     $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
     $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
     mcrypt_generic_init($td, $key, $iv);
     $data = mcrypt_generic($td, $input);
     mcrypt_generic_deinit($td);
     mcrypt_module_close($td);
     $data = base64_encode($data);
     return $data;
 }
Ejemplo n.º 12
0
 public function run()
 {
     // Castle Entrance Guards
     $castleEntrance = Map::where('location_name', 'castle_entrance')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $castleEntrance->id]);
     // Barracks Guards
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $barracks->id]);
     // North West Tower Guard
     $northWestTower = Map::where('location_name', 'northwest_tower')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $northWestTower->id]);
     // Outer Receiving Guard
     $outerReceiving = Map::where('location_name', 'outer_receiving')->firstOrFail();
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
     Guard::create(['initial_health' => 10, 'map_id' => $outerReceiving->id]);
 }
Ejemplo n.º 13
0
 /**
  * Method  _sendHttpRequest
  * 发送http请求
  *
  * @author yangyang3
  * @static
  *
  * @param       $method
  * @param       $url
  * @param null  $data
  * @param array $header
  *
  * @return mixed
  */
 private static function _sendHttpRequest($method, $url, $data = null, $header = array())
 {
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
     curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, self::$_connect_timeout);
     curl_setopt($curl, CURLOPT_TIMEOUT, self::$_timeout);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_ENCODING, '');
     curl_setopt($curl, CURLOPT_HEADER, false);
     $method = strtoupper($method);
     if ('GET' === $method) {
         if ($data !== null) {
             if (strpos($url, '?')) {
                 $url .= '&';
             } else {
                 $url .= '?';
             }
             $url .= http_build_query($data);
         }
     } elseif ('POST' === $method) {
         curl_setopt($curl, CURLOPT_POST, true);
         if (!empty($data)) {
             if (is_string($data)) {
                 curl_setopt($curl, CURLOPT_POSTFIELDS, "data=" . $data);
             } else {
                 curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
             }
         }
     }
     if (null !== $header) {
         curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     }
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLINFO_HEADER_OUT, true);
     $response = curl_exec($curl);
     self::$_http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     curl_close($curl);
     return $response;
 }
Ejemplo n.º 14
0
 /**
  * __construct Inital AppController
  */
 public function __construct()
 {
     Guard::csrfFilter('post');
 }
Ejemplo n.º 15
0
<?php

if (defined("AJAX") && AJAX == true) {
    define("BASE_PATH", $_POST['system']['path'] . "assistants/");
    define("SYSTEM", $_POST['system']['path']);
    define("SYSTEM_URL", $_POST['system']['url']);
    require_once BASE_PATH . "utf8.php";
    require_once BASE_PATH . "config.inc.php";
    require_once BASE_PATH . "clerk.php";
    require_once BASE_PATH . "guard.php";
    require_once BASE_PATH . "office.php";
    require_once BASE_PATH . "manager.php";
    $clerk = new Clerk(true);
    $guard = new Guard();
    $manager = new Manager();
    if (!$guard->validate_user_extern($clerk, $_COOKIE["secretary_username"], $_COOKIE["secretary_password"])) {
        die("Back off!");
    }
    loadPlugins();
    $_POST = $clerk->clean($_POST);
    $actions = explode(",", $_POST['action']);
    foreach ($actions as $func) {
        if (function_exists($func)) {
            $func();
        }
    }
} else {
    // Include assistants
    require_once SYSTEM . "assistants/utf8.php";
    require_once SYSTEM . "assistants/config.inc.php";
    require_once SYSTEM . "assistants/clerk.php";
Ejemplo n.º 16
0
//分配的api_id
$api_id = 2;
//分配的hash_key
$api_hash_key = "765490aaf9999502fdb64ed556af9c3c";
$data['unique_id'] = rand(500, 1500);
$data['title'] = '标题' . str_repeat(chr(rand(33, 126)), rand(2, 10));
$data['content'] = '正文, 原则上不要超过255字符, 如果需要超过, 请在开发时联系审核平台' . str_repeat(chr(rand(33, 126)), rand(2, 10));
$data['customer_id'] = '1917673145';
//本条内容对应发布人的微博uid
$data['auth'] = 'all';
//对应审核权限, 默认为all
$data['ext'][] = array('ext_key', 'value-' . str_repeat(chr(rand(33, 126)), rand(2, 10)), 'text');
$data['ext'][] = array('key1', 'http://www.baidu.com', 'url');
$data['ext'][] = array('thumb', 'http://ww2.sinaimg.cn/large/750c4fd8jw1evdpj818puj20d409uac2.jpg', 'pic');
$data['ext'][] = array('key2', 'http://www.baidu.com', 'preview');
$data['ext'][] = array('info', '应该按设置出现在附加信息栏' . str_repeat(chr(rand(33, 126)), rand(2, 10)), 'text');
$data['ext'][] = array('info1', '继续出现' . str_repeat(chr(rand(33, 126)), rand(2, 10)), 'text');
$data['ext'][] = array('info2', 'http://www.baidu.com', 'url');
$data['ext'][] = array('the_pic', 'http://ww2.sinaimg.cn/large/9b7f515djw1ev9bxkyyuij20d409umy6.jpg', 'pic');
$data['ext'][] = array('info123', 'http://www.baidu.com', 'preview');
//初始化
Guard::init($url, $api_id, $api_hash_key, $server_ip, $retry_count);
//将数据post到审核服务器api
$ret = Guard::send($data);
//取得返回值
if ($ret['status'] == Guard::STATUS_SUCCESS) {
    echo "\n<hr/>send successful! 发送成功!<hr/>\n";
} else {
    echo "\n<hr/>error: 出现错误:<hr/><pre>\n";
    var_dump($ret);
}
Ejemplo n.º 17
0
 public function start()
 {
     // if(Auth::user()) {
     // }
     Auth::logout();
     $game = new User();
     $game->player_location_id = 1;
     $game->health = 10;
     $game->stealth = 10;
     $game->access_x = 0;
     $game->save();
     Auth::login($game);
     $id = Auth::user();
     $id = $id->id;
     $guard1 = new Guard();
     $guard1->guard_id = 1;
     $guard1->user_id = $id;
     $guard1->health = 10;
     $guard1->map_id = 6;
     $guard1->save();
     $guard2 = new Guard();
     $guard2->guard_id = 2;
     $guard2->user_id = $id;
     $guard2->health = 10;
     $guard2->map_id = 6;
     $guard2->save();
     $guard3 = new Guard();
     $guard3->guard_id = 3;
     $guard3->user_id = $id;
     $guard3->health = 10;
     $guard3->map_id = 8;
     $guard3->save();
     $guard4 = new Guard();
     $guard4->guard_id = 4;
     $guard4->user_id = $id;
     $guard4->health = 10;
     $guard4->map_id = 8;
     $guard4->save();
     $guard5 = new Guard();
     $guard5->guard_id = 5;
     $guard5->user_id = $id;
     $guard5->health = 10;
     $guard5->map_id = 8;
     $guard5->save();
     $guard6 = new Guard();
     $guard6->guard_id = 6;
     $guard6->user_id = $id;
     $guard6->health = 10;
     $guard6->map_id = 12;
     $guard6->save();
     $guard7 = new Guard();
     $guard7->guard_id = 7;
     $guard7->user_id = $id;
     $guard7->health = 10;
     $guard7->map_id = 19;
     $guard7->save();
     $guard8 = new Guard();
     $guard8->guard_id = 8;
     $guard8->user_id = $id;
     $guard8->health = 10;
     $guard8->map_id = 19;
     $guard8->save();
     return Response::json($game);
 }
Ejemplo n.º 18
0
 public function handle($request, Closure $next)
 {
     $accountable = !$request->header('X-TOR', false);
     $this->auth->user()->setAccountable($accountable);
     return $next($request);
 }
Ejemplo n.º 19
0
 function csrf_token()
 {
     return Guard::csrf_token();
 }
Ejemplo n.º 20
0
        } else {
            $use_online_theme = "false";
        }
        echo $use_online_theme;
        echo "<::>";
        if ($online_theme && $request == "elements" && $version == $verApp) {
            for ($i = 0; $i < count($online_elements); $i++) {
                echo $online_elements[$i] . "<:i:>";
            }
        }
        echo "<::>";
        for ($i = 0; $i < count($blocked_processes); $i++) {
            echo $blocked_processes[$i] . "<:i:>";
        }
        echo "<::>";
        echo Guard::encrypt(JGuard::stir_string($HideAESKey), $AESKey);
        echo "<::>";
        echo sha1(handle_md5(md5($debugKey)));
        echo "<::>";
        echo parse_boolean($use_mods_delete) . "<:g:>" . parse_boolean($use_send_report) . "<:g:>" . parse_boolean($use_jar_check) . "<:g:>" . parse_boolean($use_mod_check) . "<:g:>" . parse_boolean($stop_dirty_drogram) . "<:g:>" . parse_boolean($use_mod_check_timer) . "<:g:>" . $time_for_mods_check . "<:g:>" . parse_boolean($use_process_check) . "<:g:>" . parse_boolean($show_all_processes) . "<:g:>" . parse_boolean($use_process_check_timer) . "<:g:>" . $time_for_process_check;
        // [10]
    }
}
/* POST-операции */
@($action = $_POST["action"]);
@($client = $_POST["client"]);
@($upd_files = $_POST["updateFiles"]);
if ($action == "updateSize") {
    if ($client == null || $upd_files == null) {
        die(0);
    }
Ejemplo n.º 21
0
    $check_f = array();
    get_checked_files_list(null, $check_f);
    if (count($check_f) == 0) {
        $check_f[] = "nocheckfs";
    }
    if ($upload_images && $skins_url == null && $cloaks_url == null) {
        $use_upload_images = 'true';
    } else {
        $use_upload_images = 'false';
    }
    if ($access_to_upload_cloak) {
        $can_upload_cloak = 'true';
    } else {
        $can_upload_cloak = 'false';
    }
    echo "<br>" . "<::>" . $programName . $appForm . "<::>" . $md5_natives . "<::>" . $md5_ass . "<::>" . $md5_lib . "<::>" . $sha1_md5forge . "<::>" . $sha1_md5lloader . "<::>" . handle_md5(md5($md5_program)) . "<::>" . $first_hwid_auth . "<::>" . "<br>" . implode("<:f:>", $configs) . "<::>" . $getLogin . "<br>" . "<::>" . implode("<:f:>", $check_f) . "<::>" . $use_upload_images . "<::>" . $can_upload_cloak . "<::>" . Guard::encrypt(JGuard::stir_string($uuid), $HideAESKey);
    $md5_seskey = $seskey;
    $new_ses_id = $md5_seskey;
    $db->query("UPDATE {$db_table} SET {$db_colSesId}='{$new_ses_id}', {$db_colAuthId}='{$seskey}', {$db_colUUID}='{$uuid}' WHERE {$db_colUser}='{$injLogin}'") or die("Error");
} else {
    if ($action == "report") {
        if ($getLogin == null || $files == null || $authSes == null) {
            die("BadParams");
        }
        $mq = $db->query("SELECT {$db_colUser} FROM {$db_table} WHERE {$db_colUser}='{$getLogin}' AND {$db_colAuthId}='{$authSes}'") or die("Error");
        if ($mq->num_rows == 1) {
            $file = "../files/admin/" . $report_file;
            $find_files_array = explode("<:f:>", $files);
            for ($i = 0; $i < count($find_files_array); $i++) {
                $find_files = $find_files . " * " . $find_files_array[$i] . "\n";
            }