public function defaultAction() { $memcache = new Memcache(); $memcache->flush(); $usuario = new Usuario(); $daoUsuario = DAOFactory::getUsuarioDAO(); /** @var $user User */ $user = UserService::getCurrentUser(); if (isset($user)) { $usuarioBD = $daoUsuario->queryByGoogle($user->getUserId()); if (!$usuarioBD) { // No existe el usuario $usuario->google = $user->getUserId(); $usuario->correo = $user->getEmail(); $usuario->nombre = $user->getNickname(); $daoUsuario->insert($usuario); } else { $usuario = $usuarioBD; } $_SESSION['logoutUrl'] = UserService::createLogoutUrl('/index/closeSession'); $_SESSION['usuario'] = $usuario; include 'vod/index.php'; } else { $this->login(); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $user = UserService::getCurrentUser(); if (!isset($user)) { return redirect(UserService::createLoginUrl('/')); } return $next($request); }
public function index(Request $request) { $credential = $this->credentialStore->findByEmail($this->user->email); $gmailWatch = $this->watchStore->findByEmailAndService($this->user->email, 'gmail'); if ($gmailWatch) { $gmailWatchExpiration = $gmailWatch->expiration; } else { $gmailWatchExpiration = null; } return view('dashboard', ['isDev' => $this->app->isDev(), 'user' => $this->user, 'logoutUrl' => UserService::createLogoutURL('/'), 'authorized' => isset($credential), 'watchingGmail' => isset($gmailWatch), 'gmailWatchExpiration' => $gmailWatchExpiration, 'message' => $request->session()->get('message')]); }
public function __construct(Application $app, User $user = null) { $this->user = $user; if (is_null($user)) { $this->loginUrl = UserService::createLoginUrl($app['auth.onlogin.callback.url']); $this->logged = false; } else { $this->logged = true; $this->logoutUrl = UserService::createLogoutUrl($app['auth.onlogout.callback.url']); } }
public function index() { $user = UserService::getCurrentUser(); if (isset($user)) { echo 'Welcome, ' . $user->getNickname(); if (UserService::isCurrentUserAdmin()) { $data = array('title' => 'Admin Section', 'hello' => 'Hello admin...', 'content' => 'You are accessing the backend now'); $this->render("admin.html", $data); } else { header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI'])); } } }
public function redirect_to_login() { header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI'])); exit; }
$user = UserService::getCurrentUser(); if ($user) { ?> <span class="username"><?php echo $user->getNickname(); ?> </span> <a href="<?php echo UserService::createLogoutURL('', "google.com"); ?> ">log out</a> <?php } else { ?> <a href="<?php echo UserService::createLoginURL(''); ?> ">log in</a> <?php } ?> | <a href="reset.do">Reset Session</a> | Shift-Enter for newline | Ctrl-Up/Down for history | <a href="http://code.google.com/appengine/"> <img id="logo" src="/static/appengine_button_noborder.gif" width="120px" height="30px" /></a> </p> <script type="text/javascript"> document.getElementById('statement').focus(); </script>
public function doDelete() { $user = Auth::user(); Auth::logout(); Session::flush(); $user->delete(); return Redirect::to(UserService::createLogoutUrl('/')); }
<body> <?php use google\appengine\api\users\User; use google\appengine\api\users\UserService; use google\appengine\api\cloud_storage\CloudStorageTools; require_once __DIR__ . '/../rest/models/userModel.php'; require_once __DIR__ . '/../rest/models/eventModel.php'; require_once __DIR__ . '/../rest/models/guestModel.php'; $session_token = md5('admin_session'); $session_path = __DIR__ . '/../../media/sessions'; if (isset($_SERVER['SERVER_SOFTWARE']) && strstr(strtolower($_SERVER['SERVER_SOFTWARE']), 'engine')) { require_once 'google/appengine/api/users/User.php'; require_once 'google/appengine/api/users/UserService.php'; require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php'; $mail = UserService::getCurrentUser()->getNickname(); $session_token = md5($mail); $user = new userModel(); $u = $user->find_one_by_email(strtolower($mail)); if (isset($u['id'])) { Bootstrap::$main->session('user', $u); Bootstrap::$main->user = $u; Bootstrap::$main->session('time_delta', $u['delta']); echo '<h1><a href="/admin/">' . $u['firstname'] . ' ' . $u['lastname'] . '</a></h1>'; } $session_path = 'gs://' . CloudStorageTools::getDefaultGoogleStorageBucketName() . '/sessions'; } else { echo "<h1>Witaj</h1>"; @mkdir($session_path, 0755); } $session_file = "{$session_path}/{$session_token}.sess";
<?php require_once 'vendor/autoload.php'; require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php'; use google\appengine\api\users\User; use google\appengine\api\users\UserService; session_start(); define('BASE_URL', 'http://localhost:8080'); define('USER', ''); define('PASS', ''); define('HOST', ''); define('DB', ''); //Csv Fileupload gsbucket options $options = ['gs_bucket_name' => 'shaffer-skiper.appspot.com']; $user = UserService::getCurrentUser(); $loginUrl = UserService::createLoginURL($_SERVER['REQUEST_URI']); $logoutUrl = UserService::createLogoutUrl('/');
/** * @dataProvider isCurrentUserAdminDataProvider */ public function testIsCurrentUserAdmin($env_var_name) { putenv($env_var_name . '=0'); $this->assertFalse(UserService::isCurrentUserAdmin()); putenv($env_var_name . '=1'); $this->assertTrue(UserService::isCurrentUserAdmin()); // Clear the environment variable. putenv($env_var_name); }
public function register(Application $app) { $app['gae.auth'] = $app->protect(function () use($app) { return new Auth($app, UserService::getCurrentUser()); }); }
require_once __DIR__ . '/../lib/Doctrine/Doctrine.php'; spl_autoload_register(array('Doctrine', 'autoload')); use google\appengine\api\users\User; use google\appengine\api\users\UserService; use google\appengine\api\cloud_storage\CloudStorageTools; if (isset($_SERVER['REMOTE_ADDR'])) { $title = 'Migration'; $menu = 'migrate'; include __DIR__ . '/../base.php'; include __DIR__ . '/../head.php'; } if (isset($_SERVER['HTTP_HOST'])) { if (isset($_SERVER['SERVER_SOFTWARE']) && strstr(strtolower($_SERVER['SERVER_SOFTWARE']), 'engine')) { require_once 'google/appengine/api/users/User.php'; require_once 'google/appengine/api/users/UserService.php'; $google_user = UserService::getCurrentUser(); $config_file = str_replace('~', '-', $_SERVER['APPLICATION_ID']); } else { $config_file = strtolower($_SERVER['HTTP_HOST']); } } else { $config_file = 'local'; if (isset($argv[1])) { $_REQUEST['ver'] = $argv[1]; } } $f = __DIR__ . '/../../rest/config/application.json'; if (isset($_SERVER['REMOTE_ADDR'])) { echo "Configuration from {$f}<br/>"; } $config = json_decode(file_get_contents($f), true);
<?php require_once 'google/appengine/api/users/UserService.php'; use google\appengine\api\users\UserService; $email = UserService::getCurrentUser()->email; $domain = explode("@", $email)[1]; if ($domain == "google.com") { ?> <!DOCTYPE html> <html> <head> <title>Administration tools - Measuring Value Application</title> <link rel="stylesheet" type="text/css" href="/styles/main.css"> <link rel="stylesheet" type="text/css" href="/styles/adm.css"> <link rel="stylesheet" type="text/css" href="/styles/startup.css"> <link rel="stylesheet" type="text/css" href="/styles/flipper.css"> <script src="/scripts/lib/jquery-2.1.1.min.js"></script> <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="/scripts/lib/jquery.velocity.min.js"></script> <script src="/scripts/settings.js"></script> <!-- libraries --> <script src="/scripts/lib/flipper.js"></script> <script src="/scripts/lib/sandbox.js"></script> <script src="/scripts/lib/stripe.js"></script> <!-- utilities for managing google drive actions --> <script src="/scripts/utils/serve_json.js"></script> <!-- object Result -->
public function getSessionUserStamp(){ $user = UserService::getCurrentUser(); $UserStamp=$user->getEmail(); return $UserStamp; }
<?php use google\appengine\api\users\User; use google\appengine\api\users\UserService; # Looks for current Google account session $user = UserService::getCurrentUser(); $username = ""; if ($user) { $username = '******' . htmlspecialchars($user->getNickname()); } else { header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI'])); } // display main welcome page echo '<!DOCTYPE html>'; echo '<html lang=en>'; echo '<meta charset=utf-8>'; echo "<head><title>RealCode - Coding Collaboration | Isreal Consulting (Proprietary)</title>"; echo "<!--[if lt IE 9]>\n<script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'>\n</script>\n<![endif]-->"; echo "<link rel='stylesheet' type='text/css' href='stylesheet-main.css'>"; echo '</head>'; echo '<body>'; echo '<header>'; echo ' <h1>RealCode - Coding Collaboration | Isreal Consulting (Proprietary)</h1> </header>'; echo "<nav>\n<ul>\n <li><a href='main.php'>Home</a></li>\n <li><a href='#'>Login</a></li>\n <li><a href='README.md'>Readme</a></li>\n</ul>\n</nav>"; echo '<section>'; echo "<h1>NOTICE</h1>\n\n<article>\n<h2>Private & Proprietary Sytem</h2>\n<p>This system is private and owned by Isreal Consulting. Unauthorized access is prohibited. Violators will be prosecuted.</p>\n</article>"; echo "Welcome, " . $username; echo "<article>\n<h2>For Support</h2>\n<p>Visit the Isreal Consulting Support site:<br />\n<a href='http://cs.isrealconsulting.com'>support.isrealconsulting.com</a></p>"; echo '</article>'; echo '</section>';
if ($conn->query("CREATE DATABASE IF NOT EXISTS {$db}") === FALSE) { die("Could not create database: {$conn->error} [{$conn->errno}]"); } if ($conn->select_db($db) === FALSE) { die("Could not select database: {$conn->error} [{$conn->errno}]"); } if ($conn->query($greeting_schema) === FALSE) { die("Could not create tables: {$conn->error} [{$conn->errno}]"); } $user = UserService::getCurrentUser(); if ($user) { $url = UserService::createLogoutURL('', "google.com"); $url_linktext = "Logout"; $author = $user->getNickname(); } else { $url = UserService::createLoginURL(''); $url_linktext = "Login"; $author = ""; } if (isset($_POST['content'])) { $stmt = $conn->prepare("INSERT INTO greeting (author, content) VALUES (?, ?)"); if ($stmt->bind_param('ss', $author, $_POST['content']) === FALSE) { die("Could not bind prepared statement"); } if ($stmt->execute() === FALSE) { die("Could not execute prepared statement"); } $stmt->close(); header("Location: /"); exit; }
<?php use google\appengine\api\users\User; use google\appengine\api\users\UserService; require_once __DIR__ . '/google.php'; $config = (include __DIR__ . '/ini.php'); require_once 'google/appengine/api/users/User.php'; require_once 'google/appengine/api/users/UserService.php'; $user = UserService::getCurrentUser(); $mail = $user ? $user->getNickname() : ''; $mail = explode('@', $mail); if (!$config['iframe_src']) { if ($mail[0]) { $config['iframe_src'] = 'http://' . $mail[0] . '.webkameleon.com'; } } if (!$config['iframe_src']) { die; } $host = $config['iframe_src']; $iframe_src = $host . $_SERVER['REQUEST_URI']; ?> <html> <head> <style> body { border: 0; padding: 0; margin: 0; overflow: hidden; }
public function testIsCurrentUserAdmin() { putenv('USER_IS_ADMIN=0'); $this->assertFalse(UserService::isCurrentUserAdmin()); putenv('USER_IS_ADMIN=1'); $this->assertTrue(UserService::isCurrentUserAdmin()); }
<?php use google\appengine\api\users\User; use google\appengine\api\users\UserService; $user = UserService::getCurrentUser(); session_start(); if ($_SESSION["loggedIn"] != true) { if (isset($user)) { echo sprintf('Your current Google account, %s, does not have access to this application (<a href="%s">sign out</a>)', $user->getNickname(), UserService::createLogoutUrl('/')); } exit; } else { if (isset($user)) { if ($user->getNickname()) { $mailTim = '<EMAIL_RESIDENT_1>'; } $mailJetse = '<EMAIL_RESIDENT_2>'; $mailMees = '<EMAIL_RESIDENT_3>'; if (strcmp(htmlspecialchars($user->getNickname()), $mailTim) == 0) { $nameString = "Tim"; } else { if (strcmp(htmlspecialchars($user->getNickname()), $mailJetse) == 0) { $nameString = "Jetse"; } else { if (strcmp(htmlspecialchars($user->getNickname()), $mailMees) == 0) { $nameString = "Mees"; } } } } }
"level": 0 }'); } ?> </div> <div id="sidebar"> sidebar content here <br/> </div> <div id="footer"> (c) 2015 a tree about me - amrita gupta & saumya gurbani </div> </div> <div class="addnode_panel"> <br/><br/> <a class="addnode-btn" href="#">+</a> </div> <div class="logout_panel"> <br/><br/> <a class="logout-btn" href="<?php echo UserService::createLogoutUrl($_SERVER['REQUEST_URI']); ?> "><i>x</i></a> </div> </body> </html>