function haveAccess($session) { if (HttpSession::currentUser()->getOrganization()->access_level > 4 || $session->get("org_id") === HttpSession::currentUser()->company_id) { return true; } return false; }
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 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; } }
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 --'; } }
<?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 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; }
<!--[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'; 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); }
<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>
<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
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; }
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