@ 2014-04-29T09:31:21Z <?php
class SiteController extends Controller {
/**
* Declares class-based actions.
*/
public function actions() {
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha' => array(
'class' => 'CCaptchaAction',
'backColor' => 0xFFFFFF,
),
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page' => array(
'class' => 'CViewAction',
),
);
}
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex() {
if (Utility::isSessionValid()) {
$session = new CHttpSession;
$session->open();
$rid = $session['Person_ID'];
$csaServices2 = array();
$bdims_reg_tags = explode(",", BDIMS_REGISTRAR_TAGS);
//Check If the use if CSA / VLE
if (Utility::isAuthorizedCsa($rid)) {
$csaServices = Utility::getCsaServices();
foreach ($csaServices as $key => $values) {
foreach ($values as $k => $val) {
$val = (array) $val;
if (($val['is_csa_service'] == "2") && Utility::isAuthorizedVle($rid)) {
if ($val['service_provider_tag'] == 'bdims') {
if (!in_array($val['service_tag'], $bdims_reg_tags)) {
$csaServices2[$key][$k] = $val;
}
} else {
$csaServices2[$key][$k] = $val;
}
} elseif ($val['is_csa_service'] == "1") {
if ($val['service_provider_tag'] == 'bdims') {
if (!in_array($val['service_tag'], $bdims_reg_tags)) {
$csaServices2[$key][$k] = $val;
}
} else {
$csaServices2[$key][$k] = $val;
}
}
}
}
} else {
//Check If the user is BDIMS User
$userInfo = Utility::getHealthUserInfo($rid);
if ($userInfo != "1" && $userInfo != "2") {
//Check for other Auth users
throw new CHttpException(403, 'Access Denied. Please contact IVISS Administator.');
exit;
} else {
$csaServices = Utility::getCsaServices();
$bdims_info = Utility::getHealthUserInfo($rid);
if (($bdims_info != "1") && ($bdims_info != "2")) {
throw new CHttpException(403, 'Access Denied. Please contact IVISS Administator.');
exit;
}
foreach ($csaServices as $key => $values) {
foreach ($values as $k => $val) {
$val = (array) $val;
if ($val['service_provider_tag'] == 'bdims') {
if (($bdims_info == "2") && in_array($val['service_tag'], $bdims_reg_tags)) {
$csaServices2[$key][$k] = $val;
} elseif (($bdims_info == "1") && !in_array($val['service_tag'], $bdims_reg_tags)) {
$csaServices2[$key][$k] = $val;
}
}
}
}
}
}
$session['csaServices'] = $csaServices2;
unset($csaServices);
unset($csaServices2);
//$this->render('index', array('csaServices' => $csaServices2));
$htmlCode = $this->render('index', true);
$htmlCode = preg_replace('#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre)\b))*+)(?:<(?>textarea|pre)\b|\z))#', ' ', $htmlCode);
echo $htmlCode;
} else {
$loginUrl = Utility::getFullBaseUrl() . "/site/login";
$this->redirect($loginUrl);
}
}
/**
* This is the action to handle external exceptions.
*/
public function actionError() {
if ($error = Yii::app()->errorHandler->error) {
if (Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
}
/**
* Validates the Token
*
* @return boolean
*/
public function actionIstokenactive() {
$session = new CHttpSession;
$session->open();
if (empty($session['idm_token'])) {
echo "0";
} else {
$idm_token = $session['idm_token'];
$info = Utility::getTokenInfo($idm_token);
echo count($info);
}
}
/**
* Displays the contact page
*/
public function actionContact() {
throw new CHttpException(405, 'Method Discontinued. Please contact IVISS Administator.');
exit;
$model = new ContactForm;
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$name = '=?UTF-8?B?' . base64_encode($model->name) . '?=';
$subject = '=?UTF-8?B?' . base64_encode($model->subject) . '?=';
$headers = "From: $name <{$model->email}>\r\n" .
"Reply-To: {$model->email}\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=UTF-8";
mail(Yii::app()->params['adminEmail'], $subject, $model->body, $headers);
Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
/**
* Displays the login page
*/
public function actionLogin() {
if (Utility::isSessionValid()) {
$loginUrl = Utility::getFullBaseUrl();
$this->redirect($loginUrl);
exit;
}
if (isset($_POST['idm_token'])) {
$idm_token = $_POST['idm_token'];
$tokenInfo = Utility::getTokenInfo($idm_token);
if (!isset($tokenInfo['Person_ID']) || empty($tokenInfo['Person_ID'])) {
//Exception
throw new CHttpException(400, 'Invalid Request.');
}
$rid = $tokenInfo['Person_ID'];
$csaInfo = Utility::getCsaInfo($rid);
if (($csaInfo === false) && (Utility::isAuthorizedVle($rid) === false) && (Utility::isHealthUser($rid) === false)) {
//Exception
throw new CHttpException(403, 'Access Denied');
} else {
$session = new CHttpSession;
$session->open();
$session['Person_ID'] = $rid;
//$session['username'] = Utility::outputfilter(Utility::sanatizeParams($tokenInfo['Person']));
$session['username'] = Utility::sanatizeParams($tokenInfo['Person']);
$session['idm_token'] = $idm_token;
$session->regenerateID();
}
Utility::initLogin();
$this->redirect($this->createUrl('/'));
} else {
$service_provider_tag = "csaportal";
$HMAC_KEY = Utility::getHmacKeyFromLegitTag($service_provider_tag);
if ($HMAC_KEY === false) {
//Exception
throw new CHttpException(500, 'No HMAC Key Found');
} else {
$actionUrl = Utility::getUrlFromLegitTag('ldapserver');
$actionUrl = $actionUrl . "/auth/idmlevel2/";
$actionUrl = Utility::removeDoubleSlashesFromUrl($actionUrl);
$callback_url = Utility::getUrlFromLegitTag($service_provider_tag);
$callback_url = $callback_url . "/site/login";
$callback_failure_url = $callback_url;
$idm_data = ($callback_url . $callback_failure_url . $service_provider_tag);
$IDM_HMAC = hash_hmac('sha1', $idm_data, $HMAC_KEY);
$params = array();
$params['action_url'] = $actionUrl;
$params['callback_url'] = $callback_url;
$params['callback_failure_url'] = $callback_failure_url;
$params['service_provider_tag'] = "csaportal";
$params['idm_hmac'] = $IDM_HMAC;
// display the login form
//$htmlCode = $this->renderPartial('idmlogin', $params, true);
$htmlCode = $this->renderPartial('loginidm', $params, true);
$htmlCode = preg_replace('#(?ix)(?>[^\S ]\s*|\s{2,})(?=(?:(?:[^<]++|<(?!/?(?:textarea|pre)\b))*+)(?:<(?>textarea|pre)\b|\z))#', ' ', $htmlCode);
echo $htmlCode;
}
}
}
/**
* Logs out the current user and redirect to homepage.
*/
public function actionLogout() {
Yii::app()->user->logout();
$session = new CHttpSession;
$session->destroy();
unset(Yii::app()->request->cookies['ZDEDebuggerPresent']);
unset(Yii::app()->request->cookies['YII_CSRF_TOKEN']);
unset(Yii::app()->request->cookies['PHPSESSID']);
unset(Yii::app()->request->cookies['iviss_cookie']);
$loginUrl = Utility::getFullBaseUrl() . "/site/login";
$this->redirect($loginUrl);
}
}
<?php
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.27 0.007 0.036 12.46 5.4.26 0.006 0.042 12.46 5.4.25 0.009 0.035 12.46 5.4.24 0.007 0.035 12.46 5.4.23 0.005 0.038 12.45 5.4.22 0.007 0.035 12.45 5.4.21 0.007 0.036 12.46 5.4.20 0.005 0.039 12.45 5.4.19 0.005 0.041 12.45 5.4.18 0.005 0.042 12.45 5.4.17 0.008 0.034 12.46 5.4.16 0.003 0.039 12.45 5.4.15 0.007 0.041 12.45 5.4.14 0.003 0.042 12.14 5.4.13 0.005 0.036 12.12 5.4.12 0.006 0.035 12.08 5.4.11 0.005 0.037 12.08 5.4.10 0.011 0.038 12.08 5.4.9 0.008 0.036 12.08 5.4.8 0.010 0.036 12.08 5.4.7 0.006 0.035 12.07 5.4.6 0.011 0.045 12.07 5.4.5 0.012 0.036 12.08 5.4.4 0.005 0.038 12.07 5.4.3 0.004 0.046 12.07 5.4.2 0.007 0.053 12.05 5.4.1 0.005 0.048 12.07 5.4.0 0.004 0.036 11.56 5.3.28 0.007 0.037 12.71 5.3.27 0.006 0.040 12.73 5.3.26 0.005 0.041 12.73 5.3.25 0.008 0.037 12.73 5.3.24 0.003 0.042 12.73 5.3.23 0.007 0.038 12.73 5.3.22 0.004 0.039 12.69 5.3.21 0.004 0.043 12.70 5.3.20 0.011 0.034 12.69 5.3.19 0.006 0.045 12.69 5.3.18 0.006 0.037 12.69 5.3.17 0.006 0.038 12.69 5.3.16 0.005 0.040 12.69 5.3.15 0.003 0.043 12.69 5.3.14 0.006 0.038 12.68 5.3.13 0.006 0.039 12.67 5.3.12 0.004 0.044 12.68 5.3.11 0.005 0.041 12.67 5.3.10 0.008 0.039 12.16 5.3.9 0.009 0.035 12.14 5.3.8 0.015 0.046 12.12 5.3.7 0.007 0.038 12.12 5.3.6 0.007 0.038 12.11 5.3.5 0.006 0.038 12.05 5.3.4 0.006 0.038 12.05 5.3.3 0.006 0.038 12.02 5.3.2 0.003 0.041 11.80 5.3.1 0.008 0.045 11.77 5.3.0 0.006 0.041 11.75
preferences:dark mode live preview
141.06 ms | 1394 KiB | 7 Q