Purge openid-php
Purge openid-php

file:a/.gitignore -> file:b/.gitignore
   
/labs/tiles/12 /labs/tiles/12
/labs/tiles/13 /labs/tiles/13
/labs/tiles/14 /labs/tiles/14
/labs/tiles/15 /labs/tiles/15
/labs/tiles/16 /labs/tiles/16
/labs/tiles/17 /labs/tiles/17
/labs/tiles/19 /labs/tiles/19
  /nbproject/private/
cp /root/aws.php /tmp/ cp /root/aws.php /tmp/
mkdir /var/www/lib/staticmaplite/cache mkdir /var/www/lib/staticmaplite/cache
chcon -h system_u:object_r:httpd_sys_content_t /var/www chcon -h system_u:object_r:httpd_sys_content_t /var/www
chcon -R -h root:object_r:httpd_sys_content_t /var/www/* chcon -R -h root:object_r:httpd_sys_content_t /var/www/*
   
chcon -R -t httpd_sys_content_rw_t /var/www/lib/staticmaplite/cache chcon -R -t httpd_sys_content_rw_t /var/www/lib/staticmaplite/cache
chmod -R 777 /var/www/lib/staticmaplite/cache chmod -R 777 /var/www/lib/staticmaplite/cache
   
chcon -R -t httpd_sys_content_rw_t /var/www/labs/tiles chcon -R -t httpd_sys_content_rw_t /var/www/labs/tiles
chmod -R 777 /var/www/labs/tiles chmod -R 777 /var/www/labs/tiles
   
  mkdir /var/www/lib/openid-php/oid_store
chcon -R -t httpd_sys_content_rw_t /var/www/lib/openid-php/oid_store chcon -R -t httpd_sys_content_rw_t /var/www/lib/openid-php/oid_store
chmod -R 777 /var/www/lib/openid-php/oid_store chmod -R 777 /var/www/lib/openid-php/oid_store
   
wget http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \ wget http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip \
-O /var/www/cbrfeed.zip -O /var/www/cbrfeed.zip
<?php <?php
function getScheme() require $basePath.'lib/openid.php';
{ $openid = new LightOpenID($_SERVER['HTTP_HOST']);
$scheme = 'http';  
if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {  
$scheme .= 's';  
}  
return $scheme;  
}  
   
function getTrustRoot()  
{  
return sprintf("%s://%s:%s%s/",  
getScheme(), $_SERVER['SERVER_NAME'],  
$_SERVER['SERVER_PORT'],  
dirname($_SERVER['PHP_SELF']));  
}  
   
   
// Includes required files  
set_include_path(get_include_path() . PATH_SEPARATOR . $labsPath."lib/openid-php/");  
require_once "Auth/OpenID/Consumer.php";  
require_once "Auth/OpenID/FileStore.php";  
require_once "Auth/OpenID/AX.php";  
   
   
   
function login() function login()
{ {
// Just tested this with/for Google, needs trying with others ... global $openid;
$oid_identifier = 'https://www.google.com/accounts/o8/id'; if(!$openid->mode) {
// Create file storage area for OpenID data $openid->required = array('contact/email');
$store = new Auth_OpenID_FileStore('lib/openid-php/oid_store'); $openid->identity = 'https://www.google.com/accounts/o8/id';
// Create OpenID consumer header('Location: ' . $openid->authUrl());
$consumer = new Auth_OpenID_Consumer($store); }
// Create an authentication request to the OpenID provider  
$auth = $consumer -> begin($oid_identifier);  
   
// Create attribute request object  
// See http://code.google.com/apis/accounts/docs/OpenID.html#Parameters for parameters  
// Usage: make($type_uri, $count=1, $required=false, $alias=null)  
$attribute[] = Auth_OpenID_AX_AttrInfo :: make('http://axschema.org/contact/email', 2, 1, 'email');  
$attribute[] = Auth_OpenID_AX_AttrInfo :: make('http://axschema.org/namePerson/first', 1, 1, 'firstname');  
$attribute[] = Auth_OpenID_AX_AttrInfo :: make('http://axschema.org/namePerson/last', 1, 1, 'lastname');  
   
// Create AX fetch request  
$ax = new Auth_OpenID_AX_FetchRequest;  
   
// Add attributes to AX fetch request  
foreach($attribute as $attr) {  
$ax -> add($attr);  
}  
   
// Add AX fetch request to authentication request  
$auth -> addExtension($ax);  
$_SESSION['returnURL'] = curPageURL();  
// Redirect to OpenID provider for authentication  
$url = $auth -> redirectURL(getTrustRoot(), $_SESSION['returnURL']);  
header('Location: ' . $url);  
} }
   
   
function auth() function auth()
   
{ {
if ($_SESSION['authed'] == true) return true; if ($_SESSION['authed'] == true) return true;
  global $openid;
// Create file storage area for OpenID data  
$store = new Auth_OpenID_FileStore('lib/openid-php/oid_store'); if($openid->mode) {
// Create OpenID consumer $attr = $openid->getAttributes();
$consumer = new Auth_OpenID_Consumer($store); if ($attr["contact/email"] != "maxious@gmail.com") {
// Create an authentication request to the OpenID provider  
$response = $consumer -> complete($_SESSION['returnURL']);  
   
if ($response -> status == Auth_OpenID_SUCCESS) {  
// Get registration informations  
$ax = new Auth_OpenID_AX_FetchResponse();  
$obj = $ax -> fromSuccessResponse($response);  
$email = $obj -> data['http://axschema.org/contact/email'][0];  
var_dump($email);  
if ($email != "maxious@gmail.com") {  
die("Access Denied"); die("Access Denied");
} else { } else {
$_SESSION['authed'] = true; $_SESSION['authed'] = true;
} }
} else { } else {
login(); login();
} }
} }
if ($_REQUEST['janrain_nonce']) auth();  
?> ?>
<?php <?php
// Copyright 2009 Google Inc. All Rights Reserved. // Copyright 2009 Google Inc. All Rights Reserved.
$GA_ACCOUNT = "MO-22173039-1"; $GA_ACCOUNT = "MO-22173039-1";
$GA_PIXEL = "/lib/ga.php"; $GA_PIXEL = "/lib/ga.php";
function googleAnalyticsGetImageUrl() function googleAnalyticsGetImageUrl()
{ {
global $GA_ACCOUNT, $GA_PIXEL; global $GA_ACCOUNT, $GA_PIXEL;
//if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return ""; //if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return "";
$url = ""; $url = "";
$url.= $GA_PIXEL . "?"; $url.= $GA_PIXEL . "?";
$url.= "utmac=" . $GA_ACCOUNT; $url.= "utmac=" . $GA_ACCOUNT;
$url.= "&utmn=" . rand(0, 0x7fffffff); $url.= "&utmn=" . rand(0, 0x7fffffff);
$referer = $_SERVER["HTTP_REFERER"]; $referer = $_SERVER["HTTP_REFERER"];
$query = $_SERVER["QUERY_STRING"]; $query = $_SERVER["QUERY_STRING"];
$path = $_SERVER["REQUEST_URI"]; $path = $_SERVER["REQUEST_URI"];
if (empty($referer)) { if (empty($referer)) {
$referer = "-"; $referer = "-";
} }
$url.= "&utmr=" . urlencode($referer); $url.= "&utmr=" . urlencode($referer);
if (!empty($path)) { if (!empty($path)) {
$url.= "&utmp=" . urlencode($path); $url.= "&utmp=" . urlencode($path);
} }
$url.= "&guid=ON"; $url.= "&guid=ON";
return str_replace("&", "&amp;", $url); return str_replace("&", "&amp;", $url);
} }
function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false)
{ {
global $labsPath,$serviceAlertsEnabled; global $labsPath,$serviceAlertsEnabled;
echo ' echo '
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>' . $pageTitle . '</title> <title>' . $pageTitle . '</title>
<meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />
<link rel="dns-prefetch" href="//code.jquery.com"> <link rel="dns-prefetch" href="//code.jquery.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com"> <link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" />'; <link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" />';
if (isDebugServer()) { if (isDebugServer()) {
$jqmcss = $labsPath . 'css/jquery.mobile-1.0b2.css'; $jqmcss = $labsPath . 'css/jquery.mobile-1.0b2.css';
$jqjs = $labsPath . 'js/jquery-1.6.2.min.js'; $jqjs = $labsPath . 'js/jquery-1.6.2.min.js';
$jqmjs = $labsPath . 'js/jquery.mobile-1.0b2.js'; $jqmjs = $labsPath . 'js/jquery.mobile-1.0b2.js';
} }
else { else {
$jqmcss = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css"; $jqmcss = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css";
$jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";
$jqmjs = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"; $jqmjs = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js";
} }
echo '<link rel="stylesheet" href="' . $jqmcss . '" /> echo '<link rel="stylesheet" href="' . $jqmcss . '" />
<script src="'.$jqjs.'"></script> <script src="'.$jqjs.'"></script>