Esempio n. 1
0
<?php

use Scabbia\Extensions\Session\Session;
if (($notification = Session::getFlash('notification')) !== null) {
    ?>
    <div class="alert alert-<?php 
    echo $notification[0];
    ?>
">
        <i class="icon-<?php 
    echo $notification[1];
    ?>
"></i> <?php 
    echo implode('<br />', (array) $notification[2]);
    ?>
    </div>
<?php 
}
Esempio n. 2
0
 /**
  * @ignore
  */
 public static function check($uCode, $uCookieName = 'captcha')
 {
     // check the supplied code
     $tResult = Session::getFlash($uCookieName, "") === strtolower($uCode);
     // return the result
     return $tResult;
 }
Esempio n. 3
0
 /**
  * @ignore
  */
 public static function remove($uAction, $uSlug)
 {
     Auth::checkRedirect('editor');
     Session::set('notification', array('info', 'ok-sign', 'Category removed.'));
     Http::redirect('panel/categories');
 }
Esempio n. 4
0
 /**
  * @ignore
  */
 public function login()
 {
     if (Request::$method !== 'post') {
         Auth::clear();
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     // validations
     Validation::addRule('username')->isRequired()->errorMessage('Username shouldn\'t be blank.');
     // Validation::addRule('username')->isEmail()->errorMessage('Please consider your e-mail address once again.');
     Validation::addRule('password')->isRequired()->errorMessage('Password shouldn\'t be blank.');
     Validation::addRule('password')->lengthMinimum(4)->errorMessage('Password should be longer than 4 characters at least.');
     if (!Validation::validate($_POST)) {
         Session::set('notification', array('error', 'remove-sign', Validation::getErrorMessages(true)));
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     $username = Request::post('username');
     $password = Request::post('password');
     // user not found
     if (!Auth::login($username, $password)) {
         Session::set('notification', array('error', 'remove-sign', 'User not found'));
         $this->viewFile('{core}views/panel/login.php');
         return;
     }
     Http::redirect('panel');
 }
Esempio n. 5
0
 /**
  * Clears logged user information
  */
 public static function clear()
 {
     self::load();
     Session::remove(self::$sessionKey);
 }
Esempio n. 6
0
 /**
  * @ignore
  */
 public static function get($uQuery, $uUseCache = false, $uExtra = null)
 {
     if (self::$userId === self::NO_USER_ID) {
         return false;
     }
     if ($uExtra === null) {
         $uExtra = array();
     }
     if ($uUseCache && isset(self::$facebookData['cache'][$uQuery])) {
         $tObject = self::$facebookData['cache'][$uQuery];
     } else {
         try {
             $tObject = self::$api->api($uQuery, $uExtra);
             self::$facebookData['cache'][$uQuery] = $tObject;
             Session::set('facebookData', self::$facebookData);
         } catch (\FacebookApiException $tException) {
             return false;
         }
     }
     return new FacebookQueryObject($tObject);
 }