function haveAccess($session) { if (HttpSession::currentUser()->getOrganization()->access_level > 4 || $session->get("org_id") === HttpSession::currentUser()->company_id) { return true; } return false; }
public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
function haveViewAccess($project) { if (HttpSession::currentUser()->getOrganization()->access_level == 2 || HttpSession::currentUser()->getOrganization()->access_level > 4 || HttpSession::currentUser()->company_id === $project->get("org_id")) { return true; } return false; }
function HttpServletSession(&$servletcontext) { parent::HttpSession(); if (ServletContext::validClass($servletcontext)) { $this->context =& $servletcontext; } }
public static function create($id = "HttpSession") { if ($id == "HttpSession") { return HttpSession::getInstance(); } $messenger = MessengerFactory::create(); $messenger->say('Null Filter'); }
public static function create($id = "Paginator") { if ($id == "Paginator") { return new Paginator(HttpSession::getInstance()); } $messenger = MessengerFactory::create(); $messenger->say('Null Paginator'); }
/** * Called whenever someone wants to check current block height. * * @param object $parent The object that's calling the module * @param array $data Data * @param array $extra Extra data such as regexps * * @return none */ public function getCurrentCount($parent, $data, $extra) { extract($extra); switch ($extra['regexp']['curr']) { case 'btc': $http = new HttpSession('blockexplorer.com', 80); $http->setMaxLength(1024); $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31'); $http->getPage(array($this, 'outputData'), array_merge($extra, array('curr' => 'BTC')), '/q/getblockcount'); break; case 'ltc': $http = new HttpSession('litecoinscout.com', 80); $http->setMaxLength(1024); $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31'); $http->getPage(array($this, 'outputData'), array_merge($extra, array('curr' => 'LTC')), '/chain/Litecoin/q/getblockcount'); break; } }
function oauth_session_exists() { //if ((is_array($_SESSION)) && (array_key_exists('oauth', $_SESSION)) && !is_null(HttpSession::currentUser())) { if (is_array($_SESSION) && !is_null(HttpSession::currentUser())) { return TRUE; } else { return FALSE; } }
public static function getInstance() { if (null == self::$_instance) { //读取session配置 $config = new Yaf_Config_Ini(APPLICATION_PATH . '/conf/session.ini', CURRENT_ENV); //获取当前session使用方式 $handler_name = 'Session_' . ucfirst($config->handler->name) . 'Handler'; self::$_instance = new $handler_name($config); } return self::$_instance; }
/** * Store data * * @access private */ function storeData($entityName) { $_entityName = $entityName; $_httpRequest =& HttpRequest::instance(); $_session =& HttpSession::instance(); $_tagged = $_session->getAttribute('TAGGED'); $_index = $_session->getAttribute('INDEX'); $_create = $_index < 0; $_next = false; if ($_httpRequest->getAttribute('accept')) { $_httpRequest->removeAttribute('accept'); $_new = $_httpRequest->getAttribute('ENTITY'); foreach ($_session->getAttribute('ENTITY') as $_key => $_value) { $_old[$_key] = $_value; } $_equal = true; foreach ($_new as $_key => $_value) { if ($_value !== $_old[$_key]) { $_updated[$_key] = $_value; $_equal = false; } else { $_updated[$_key] = $_old[$_key]; } } if (!$_equal) { $_dao =& CopixDAOFactory::create($_entityName); if ($_create) { $_entity =& CopixDAOFactory::createRecord($_entityName); foreach ($_updated as $_key => $_value) { $_entity->{$_key} = $_value; } $_dao->insert($_entity); $_connection =& CopixDbFactory::getConnection(); $_tagged[] = $_connection->lastId(); } else { // update $_dlname = 'get' . $_entityName . 'DataList'; $_dataList = $this->{$_dlname}(); $_idLabel = $_dataList['id']['var']; $_entity = $_dao->get($_updated[$_idLabel]); foreach ($_updated as $_key => $_value) { $_entity->{$_key} = $_value; } $_dao->update($_entity); } } ++$_index; // next one ? $_next = $_create || $_index < sizeOf($_tagged); } elseif ($_httpRequest->getAttribute('cancel')) { $_httpRequest->removeAttribute('cancel'); ++$_index; // next one ? $_next = !$_create && $_index < sizeOf($_tagged); } else { // always return to the list } if ($_next) { $_session->setAttribute('INDEX', $_index); $_httpRequest->removeAttribute('ENTITY'); $_forward = $_create ? 'create' : 'update'; $_httpRequest->setAttribute($_forward, $_forward); // $_httpRequest->setAttribute('TAGGED', $_tagged); // TODO: la méthode CopixUrl::getUrl ne gère pas correctement les tableaux, d'où : foreach ($_tagged as $_key => $_Id) { $_httpRequest->setAttribute('TAGGED[' . $_key . ']', $_Id); } $_requestUrl = new ProjectUrl('manage' . $_entityName . 'Data', null, 'workflow', $_httpRequest->toArray()); } else { $_requestUrl = new ProjectUrl('show' . $_entityName . 'List', null, 'workflow'); } return new CopixActionReturn(COPIX_AR_REDIRECT, $_requestUrl->getUrl(false)); }
/** * 设置HTTP会话管理类 * @param \tfc\ap\HttpSession $session * @return void */ public static function setSession(HttpSession $session = null) { if ($session === null) { $session = new HttpSession(); } $session->open(); self::$_session = $session; }
<?php require_once './global.inc.php'; verify_oauth_session_exists(); if (HttpSession::currentUser()->getOrganization()->access_level < 4) { echo "Access denied"; die; } ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <?php require_once './head.inc.php'; ?> <body> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <?php require_once './nav.inc.php'; ?> <div class="container clearfix"> <div id="bannerArea" class="clearfix"> <div id="bannerLeft">
public function reattach() { $this->session->initialize(NULL); $copy = new HttpSession(); $copy->initialize($this->session->getId()); $this->assertFalse($copy->isNew()); }
/** * Retrieve an HttpSession object. * @access public * @return HttpSession */ function &getSession() { return HttpSession::instance(); }
public function save($isNewUser = false) { //create a new database object. $db = new DB(); //if the user is already registered and we're //just updating their info. if (!$isNewUser) { //set the data array $data = array("name" => "'{$this->name}'", "linkedin_id" => "'{$this->linkedin_id}'", "pic_url" => "'{$this->pic_url}'", "company_id" => "{$this->company_id}", "profile_url" => "'{$this->profile_url}'", "api_url" => "'{$this->api_url}'", "linkedin_token" => "'{$this->linkedin_token}'", "linkedin_token_exp" => "'{$this->linkedin_token_exp}'"); //update the row in the database $db->update($data, 'users', 'id = ' . $this->id); } else { //if the user is being registered for the first time. $data = array("name" => "'{$this->name}'", "linkedin_id" => "'{$this->linkedin_id}'", "pic_url" => "'{$this->pic_url}'", "company_id" => "{$this->company_id}", "profile_url" => "'{$this->profile_url}'", "api_url" => "'{$this->api_url}'", "linkedin_token" => "'{$this->linkedin_token}'", "linkedin_token_exp" => "'{$this->linkedin_token_exp}'"); $this->id = $db->insert($data, 'users'); } if (HttpSession::currentUser()->id == $this->id) { HttpSession::setUser($this); //if this is the loggedin user, lets set the session } return true; }
<br/><br/> <h4>STEP 2: Register by entering the recieved key</h4> <form action="" method="POST" id="confirm"> Registration Key: <input type="text" name="regkey" size="50px" placeholder="Sent to you by Email" required> Your Student Id: <input type="text" name="studentid" size="20px" placeholder="(eg. 110005F)" required><br/> <button type="submit" style="margin-top:5px;">Complete Registration</button> </form> <?php if (isset($_POST['regkey'])) { $key = $_POST['regkey']; $studentid = $_POST['studentid']; if (HttpSession::currentUser()->isAlumniRegComplete($key, $studentid)) { // update linkedin information $student = Student::getByUserId(HttpSession::currentUser()->id); $student->extractFromLinkedin(); echo "<p style='color: #7E1313;font-size: 14px;'> You are successfully registered as a student of CSE department. \n\t\t\t\t\t\t\t We will continuously extract your details from the linkedin profile, therefore please keep your \n\t\t\t\t\t\t\t Linkedin profile uptodate.</p>"; } else { echo "<p style='color: #7E1313;font-size: 14px;'> Invalid key. Registration aborted.</p>"; } } ?> </div> </div> </div> <?php
<?php require_once './global.inc.php'; verify_oauth_session_exists(); $id = $_GET['id']; $project = Project::fetch($id); if (HttpSession::currentUser()->getOrganization()->access_level > 4 || $project->get("org_id") === HttpSession::currentUser()->company_id) { $batchIds = array_map(function ($batch) { return $batch['id']; }, $project->getBatches()); $project->batch = $batchIds; echo json_encode($project); }
/** * Returns the session * * @return \http\HttpSession */ public function getSession() { if ($this->session === null) { $this->session = HttpSession::getInstance(); } return $this->session; }
echo "ga(‘set’, ‘&uid’, {{" . $user->id . "}});"; } } ?> </script> <div id="header"> <div class="container clearfix"> <div id="logo"> <a href="./index.php"><img src="img/logo.jpg" /></a> </div> <div id="nav"> <ul class="clearfix"> <?php if (oauth_session_exists()) { $user = HttpSession::currentUser(); if ($user && is_object($user)) { ?> <li class="<?php if ($pageName == 'students') { echo 'active'; } ?> "><a href="./students.php">Students</a></li> <li class="<?php if ($pageName == 'sessions') { echo 'active'; } ?> "><a href="./sessions.php">Sessions</a></li> <li class="<?php
public static function fetchAll($filterStr, $sortStr) { $filters = array("past" => "date < now()", "future" => "date IS NULL OR date > now()", "my" => "org_id = " . HttpSession::currentUser()->getOrganization()->id, "open" => "org_id IS NULL"); $where = isset($filters[$filterStr]) ? $filters[$filterStr] : $filters["future"]; $sorters = array("date" => "date DESC", "duration" => "duration DESC", "updated" => "updated DESC", "title" => "title asc"); $orderBy = isset($sorters[$sortStr]) ? $sorters[$sortStr] : $sorters["updated"]; $db = new DB(); $results = $db->select2("*", "sessions", $where, "", $orderBy); $sessions = array(); foreach ($results as $result) { array_push($sessions, new Session($result)); } return $sessions; }
<b>Amount: </b>Rs.<span id="sp-dialog-amount"></span> </p> <p id="sp-dialog-desc"></p> </div> <div style="display: none" id="sp-confirm-dialog" title="Confirm"> <form id="sp-apply-form" method="post" action="sponsorships.take.php"> <fieldset> <input type="hidden" name="sp_id" id="sp-id" /> <p id="company-name"> <label for="org_id">Company </label> <select name="org_id" id="org_id" > <?php $companyTools = new CompanyTools(); $companies = $companyTools->getAllCompanies(); foreach ($companies as $company) { if (HttpSession::currentUser()->getOrganization()->access_level > 4 || HttpSession::currentUser()->company_id === $company->id) { echo '<option value="' . $company->id . '">' . $company->name . '</option>'; } } ?> </select> </p> <p class="contact-person"> <label for="contact_name">Contact Person</label> <input type="text" maxlength="50" name="contact_name" id="contact_name"> </p> <p class="contact-person"> <label for="contact_phone">Phone</label> <input type="text" maxlength="10" size="12" name="contact_phone" id="contact_phone"> </p>
function getHtmlForStudentTechnologies($student) { if (HttpSession::currentUser()->getOrganization()->access_level > 1) { $technologies = $student->getCompetentTechnologies(); $html = ""; $count = 0; foreach ($technologies as $key => $value) { if ($count == count($technologies)) { $html = $html . " " . $value[0]->name; //. " " . "(" . $value[1] . ")"; break; } $html = $html . " " . $value[0]->name . ", "; // . "(" . $value[1] . "),"; $count++; } return $html; } else { return '-- student competency information is available only to the corporate users --'; } }
<!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <?php require_once './nav.inc.php'; ?> <div class="container clearfix"> <div id="bannerArea" class="clearfix signInArea"> <p style="font-size: 30px">Welcome to the CSE Partner Portal</p> <div style="padding-bottom: 30px;color: #888;">You have signed-in as <?php if (HttpSession::currentUser()) { $org = HttpSession::currentUser()->getOrganization(); if ($org->access_level == 1) { echo "a Public User \n <br/><div style='color:rgb(177, 8, 8); margin-top:10px; font-size:15px'>\n <b>IMPORTANT NOTE:</b> Some functionality of this portal is only available to corporate users. \n If your organization would like to obtain a corporate partnership, \n please contact the CSE Office (0112640381) for details. "; } else { if ($org->access_level == 2) { echo "a Student"; } else { if ($org->access_level == 3) { echo "a <i>'Corporate Account'</i> under <i>'" . $org->name . "'</i>"; } else { if ($org->access_level == 4) { echo "a <i>'Premium Corporate Account'</i> under <i>'" . $org->name . "'</i>"; } else { if ($org->access_level == 5) { echo "an Admin User"; }
<?php require_once './global.inc.php'; if (oauth_session_exists()) { HttpSession::logout(); } header('Location: ./');
/** * Initiates a mtgox currency conversion * * @param array $vars Array with extra stuff * * @return non */ public function mtgoxCurrency($extra) { if ($this->cache['btc']['time'] + 120 >= time()) { // return $this->replyMtgox(null,$this->cache['btc']['obj'],$extra); } $http = new HttpSession('epg.io', 80); // Local private sandbox for BTC-E Bitcoin $http->setMaxLength(4096); $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22'); $http->getPage(array($this, 'replyMtgox'), $extra, '/sandbox/btce'); }