function beforeFilter()
 {
     //
     // Zmena jazyka
     //
     if (isset($_GET['language'])) {
         switch ($_GET['language']) {
             case 'sk':
                 $this->Session->write('Config.language', 'sk');
                 break;
             case 'en':
                 $this->Session->write('Config.language', 'en');
                 break;
         }
     }
     // default language
     if (!$this->Session->read('Config.language')) {
         $this->Session->write('Config.language', 'sk');
     }
     //
     // overi ci je pripojena databaza !!!
     //
     ob_start();
     $db =& ConnectionManager::getDataSource('default');
     if (empty($db->connection)) {
         $php_errors = @ob_get_clean();
         $this->viewPath = 'errors';
         $this->set('host', $db->config['host']);
         $this->set('user', $db->config['login']);
         $this->set('php_errors', $php_errors);
         $this->render('db_connection_failed', 'error');
         exit;
     }
     ob_end_clean();
     //
     // inicializuje session a login
     //
     $this->Login->init();
     //
     // overi uzivatel ma pravo na vybranu stranku
     //
     foreach ($this->required_clearances as $c) {
         if (!$this->Login->check($c)) {
             //
             // TODO (aby pouzivatel po prihlaseni pokracoval na povodnej stranke):
             // - uloz do session momentalnu adresu
             // - a po uspresnom prihlaseni na nu sprav redirect
             //
             $this->My->setInfo(__("ERROR_ACCESS_DENIED", true));
             //
             // presmeruje view do adresara login a vyrenderuje akciu index (pre prihlasenie)
             $this->set("body", $this->requestAction('/login/index', array('return')));
             $this->viewPath = 'login';
             $this->render('access_denied');
             exit;
         }
     }
 }
Exemplo n.º 2
0
 /**
  * over ci ma naozaj prihlasi
  */
 function testLogin()
 {
     // odhlas ak nahodou je pri
     $this->auth->init();
     // over ze nie je prihlaseny
     $this->assertFalse($this->auth->isLogged());
     // presunie sa do login_history
     $this->assertTrue($this->auth->login('test', 'test'));
     $this->assertTrue($this->auth->login('test', 'test'));
     // users online
     $this->assertTrue($this->auth->isOnlineUsername('test'));
     $this->assertFalse($this->auth->isOnlineUsername('test2'));
     $this->assertFalse($this->auth->isOnlineUsername('testnonexists'));
     $this->assertTrue($this->auth->isOnline(1));
     $this->assertFalse($this->auth->isOnline(845546465));
     // last history
     $lastLogged = $this->auth->lastLogged();
     $this->assertEqual($lastLogged['ip'], $this->auth->Ip());
     // zo session
     $this->assertNotNull($this->auth->fullname());
     $this->assertNotNull($this->auth->username());
     $this->assertNotNull($this->auth->user_id());
     // logout
     $this->assertTrue($this->auth->logout());
     // over odhlasenie
     $this->assertFalse($this->auth->isLogged());
 }
Exemplo n.º 3
0
 function login()
 {
     // Check if we're running under Zikula
     if ($this->_controller->Session->read('PNSVrand')) {
         // Hide login/logout menu items
         $this->_controller->Session->write('Zuluru.external_login', true);
     }
     // Check if we're logged in to Zikula
     $uid = $this->_controller->Session->read('PNSVuid');
     if ($uid) {
         // Parameter to Auth->login must be a string
         $this->_controller->Auth->login($uid . '');
         $this->_controller->Session->write('Zuluru.zikula_session', $uid);
     }
     parent::login();
 }
Exemplo n.º 4
0
 function login()
 {
     $user = $this->_controller->Session->read('__default.user');
     // Check if we're running under Joomla
     if ($user) {
         // Hide login/logout menu items
         $this->_controller->Session->write('Zuluru.external_login', true);
         // Check if we're logged in to Joomla
         if ($user->id) {
             // Parameter to Auth->login must be a string
             $this->_controller->Auth->login($user->id . '');
             $this->_controller->Session->write('Zuluru.joomla_session', $user->id);
         }
     }
     parent::login();
 }
Exemplo n.º 5
0
 function login()
 {
     // Check if we're running under Drupal
     $prefix = ini_get('session.cookie_secure') ? 'SSESS' : 'SESS';
     $session_name = Configure::read('security.auth_session');
     $session_name = $prefix . substr(hash('sha256', $session_name), 0, 32);
     // Hide login/logout menu items
     $this->_controller->Session->write('Zuluru.external_login', true);
     if (!empty($_COOKIE[$session_name])) {
         $user = $this->_controller->Auth->authenticate->find('first', array('conditions' => array('Session.sid' => $_COOKIE[$session_name]), 'contain' => array('Session', 'Person' => 'Group')));
         // Check if we're logged in to Drupal
         if ($user && !empty($user['Session']['uid'])) {
             // Parameter to Auth->login must be a string
             $this->_controller->Auth->login($user['Session']['uid'] . '');
             $this->_controller->Session->write('Zuluru.drupal_session', $_COOKIE[$session_name]);
         }
     }
     parent::login();
 }
Exemplo n.º 6
0
?>
</div>

										</div>


										<div class="col-sm-10"  >

											<div class='content'><!-- begin content -->

											        <section class='example'>

											             <div class='gridly gridly-1'   ismultiple="true" >

											             		<?php 
echo empty($arrResults['photo']) ? '' : LoginComponent::generateStrImg($arrResults['photo']);
?>

											            </div>

											      </section>
										    </div> <!-- end content -->

										</div>

									</div>




Exemplo n.º 7
0
						<?php 
$userAuthority = array(9);
//explode( ',', $_SESSION[COOKIE_FIELDS]['auth']);
$booleSuper = true;
//$_SESSION[COOKIE_FIELDS]['level'] == USER_LEVEL_SUPERADMN;
$strSelf = strval(trim($_SERVER['PHP_SELF'], '/'));
// 当前页
foreach ($arrSecondLeftMenu as $strCurrentUrl => $arrSecondLeftUrl) {
    if (in_array($strSelf, $arrSecondLeftUrl)) {
        $strSelf = $strCurrentUrl;
    }
}
// D( $_SESSION[COOKIE_FIELDS]['level']);
foreach ($arrLeftMenu as $key => $value) {
    $arrBoole = is_array($value);
    $isUserAuthority = $arrBoole ? LoginComponent::isUserAuthority($userAuthority, $value) : LoginComponent::isUserAuthority($userAuthority, $key);
    // 管理用户权限
    $isUserAuthority = true;
    //  暂时不搞 了。。。。唉 。头晕。。
    // $_SESSION[COOKIE_FIELDS]['auth'] =============================================================================9 暂时用9替代
    // $userAuthBoole =  Utility::checkAuthNumber( $_SESSION[COOKIE_FIELDS]['auth'],   $value );
    $userAuthBoole = Utility::checkAuthNumber(9, $value);
    if (!$userAuthBoole && !$booleSuper) {
        continue;
    }
    if ($isUserAuthority || 9 == USER_LEVEL_SUPERADMN) {
        $strActive = $strSelf == $value || ($arrBoole ? in_array($strSelf, $value) : false) ? $arrBoole ? 'active open' : 'active' : '';
        echo " <li class='{$strActive}'> ";
        echo $arrBoole ? "<a href='#'  class='dropdown-toggle' >" : "<a href='{$value}' >";
        $strIcon = array_key_exists($key, $arrLeftIcon) ? $arrLeftIcon[$key] : ' icon-lock ';
        echo " <i class='{$strIcon}' ></i> ";
Exemplo n.º 8
0
error_reporting(E_ALL);
// 关闭所有错误提示
session_start();
//开启session
header("Content-Type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
// 引入核心 文件
include '../webroot/config/config.php';
include 'Core_Lib_Page.php';
include 'loginComponent.php';
// include 'controller/CommonController.php'; // 公共控制器
// if($_SERVER['PHP_SELF'] != '/index.php')
// {
// }
LoginComponent::checkLogin();
//检查是否登录  在成功登陆后要记得打开
// 打印变量  调试
function D($var = '')
{
    echo '<pre>';
    if (is_array($var)) {
        print_r($var);
    } else {
        var_dump($var);
    }
    echo '</pre>';
    echo "<hr />";
}
// 加载控制器
function C($classController)
Exemplo n.º 9
0
    $extern_url = $_GET["who"];
    $p = new PosComponentPage();
    $p->addComponent(new Titlecomponent($_GET["extern_login"] . "&nbsp;desea utilizar tu cuenta de Caffeina POS. ", 2));
    if (!SesionController::isLoggedIn()) {
        $login = new LoginComponent();
        $login->setLoginApiCall("api/sesion/iniciar/");
        $login->setExternLoginUrl($_GET["extern_login"]);
        $p->addComponent($login);
    } else {
        $p->addComponent('<div class="POS Boton">No permitir</div>');
        $p->addComponent('<div style="margin-right:0px" class="POS Boton OK" onclick="window.location = \'' . $_GET["extern_login"] . '?au=\' + Ext.util.Cookies.get(\'at\')" >Permitir</div>');
    }
    //var_dump(SesionController::Actual());
    $p->render();
    die;
}
if (isset($_GET["cs"]) && $_GET["cs"] == 1) {
    SesionController::Cerrar();
}
//antes de crear el componente de login,
//vamos a revisar si el usuario tiene una
//sesion iniciada, y lo adentramos
if (SesionController::isLoggedIn()) {
    die(header("Location: g/"));
}
$page = new PosComponentPage("Iniciar sesion");
$page->addComponent("<style>\n\t\t.devsitePage .nav > .content{\n\t\t\tbackground:white;\t\n\t\t}\n\t\t.devsitePage .menu a.logo {\n\t\t\tborder-right: 0px;\n\t\t\tpadding: 0px;\n\t\t}\n\t\t.devsitePage .bodyText{\n\t\t\tmargin-left: 0px;\n\t\t}</style>");
$login = new LoginComponent();
$login->setLoginApiCall("api/sesion/iniciar/");
$page->addComponent($login);
$page->render();