Esempio n. 1
0
 /**
  * The authenticate action has to be triggered through an HTTP POST Request, only if the user agent
  * comes directly from the index (login form) action.
  *
  * @param string $username The username provided through the login form.
  * @param string $password The password provided through the login form.
  * @param string $ref The action where the user-agent has to be redirect if the authentication process is a success.
  */
 public function authenticate($username, $password, $ref, $openid)
 {
     if (!empty($openid)) {
         $oid = new Openid();
         $oid->try_auth($openid);
         exit;
     }
     Auth::login($username, $password);
     if (Auth::isAuth()) {
         // Authentication process succeeded.
         // We log the connection if necessary.
         // FIXME Use a real log library to log messages.
         if (LOGS_USERS) {
             $this->logConnection();
         }
         // Redirection in the portal.
         DefaultFC::redirection($ref);
         exit;
     } else {
         # log user to the anonymous account
         //$_SESSION['isError'] = true;
         //$_SESSION['message'] = __("Wrong login or password. Please try again.");
         Auth::login('anonymous', 'anonymous');
         DefaultFC::redirection('wall/index');
         DefaultFC::redirection('users/index');
         exit;
     }
 }
Esempio n. 2
0
 /**
  * The index action is the default action of this Wall Module. It prepares the widget
  * wall of the user and render the view according to its preferences.
  *
  * If the current user is not authenticated, it will be redirected to the users/index
  * action that will allows you to acces the login form of the application.
  *
  */
 public function index($continuePurchase = false, $langage = null, $forcebrowser = false)
 {
     # Try to force users to use firefox
     //		if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){
     //			$forcebrowser = true;
     //		}
     //		if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){
     //			require(DefaultFC::getView('compatibility.tpl'));
     //			die();
     //		}else{
     //			$_SESSION['forcebrowser'] = true;
     //		}
     if (Auth::isAuth()) {
         // Determine if the 'category widget' is installed.
         if (Widgets::isInstalled('categoryList')) {
             $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories');
         }
         // Determine if the 'tag cloud widget' is installed.
         if (Widgets::isInstalled('tagCloud')) {
             $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud');
         }
         // Determine if the view must allow the user to manage widgets.
         $widgetManagement = false;
         if (Auth::isAdmin() || Auth::isGod()) {
             $widgetManagement = true;
         }
         // Determine if the view must show the list of installed widgets or
         // a link to the PALETTE Service Browser.
         $useServiceBrowser = USE_SERVICE_BROWSER;
         $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null;
         require DefaultFC::getView('index.tpl');
     } else {
         DefaultFC::redirection('users/index?ref=wall');
     }
 }
Esempio n. 3
0
	/**
	 * Affiche la page par défaut du site
	 * @see BaseController::index()
	 */
	public function index() {
		$this->loadView("main/vHeader",array("infoUser"=>Auth::getInfoUser()));
		$message = null;
		if (isset($_SESSION['logStatus'])){
			switch ($_SESSION['logStatus']) {
				case 'fail':
					$message=new DisplayedMessage("ERREUR : Couple identifiant/mot de passe inconnu.", "danger");
					break;
				case 'disconnected':
					$message=new DisplayedMessage("Vous avez été correctement déconnecté. <b>Au revoir...</b>", "success");
					break;
				case 'success':
					$message=new DisplayedMessage("Bienvenue ".Auth::getUser()->getLogin().".", "success");
					break;
				default:
					$message = null;
					break;
			}
			$_SESSION['logStatus'] = null;
		}

		if(Auth::isAuth()){
			$notifs = DAO::getAll("Notification", "idUser = "******"main/vDefault", array("notifs" => $notifs, "message" => $message));
		}else{
			$this->loadView("main/vLogin");
		}
		$this->loadView("main/vFooter");
	}
Esempio n. 4
0
 function index()
 {
     if (Auth::isAuth() == false) {
         View::make('auth/login.php');
     } else {
         View::make('auth/logout.php');
     }
 }
Esempio n. 5
0
 /**
  * Affiche la page par défaut du site
  * @see BaseController::index()
  */
 public function index()
 {
     if (Auth::isAuth()) {
         $this->loadView("main/vHeader", array("infoUser" => Auth::getInfoUser()));
         $this->loadView("main/vFooter");
         $this->loadView("main/vDefault");
         Jquery::getOn("click", ".btAjax", "sample/ajaxSample", "#response");
         echo Jquery::compile();
     } else {
         $this->loadView("main/vHeader", array("infoUser" => Auth::getInfoUser()));
         $this->loadView("main/frm_log");
         $this->loadView("main/vFooter");
         Jquery::getOn("click", ".btAjax", "sample/ajaxSample", "#response");
         echo Jquery::compile();
     }
 }
 public function subscribe()
 {
     $keys = array_keys($_GET);
     $widgetId = $keys[0];
     if (!isset($widgetId)) {
         throw new BadArgumentException(MwwException::CONTROLLER, 'You must provide a widget identifier to subscribe to a widget.');
     }
     if (!Auth::isAuth()) {
         // forward to the login script.
         DefaultFC::redirection('users/index?ref=subscribe');
         exit;
     }
     // No failure for authentication and parameters. We just carry on !
     UserInterface::subscribe(Auth::getUserId(), $widgetId);
     DefaultFC::redirection('wall/index');
 }
Esempio n. 7
0
 private static function over()
 {
     //ak niesom prihlaseny tak ma prihlas
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return False;
     }
     //zistim si cislo pozadovaneho testu
     $testid = 0;
     if (isset($_GET['testid'])) {
         $testid = intval($_GET['testid']);
     }
     //overim ci exituje taky test pre mna
     $query = DB::query('SELECT * from `ucitelia`
          LEFT JOIN `tests` ON ucitelia.ucitelid=tests.ucitel
          LEFT JOIN `predmety` ON predmety.predmetid=tests.predmetid
      WHERE `trieda`=' . Auth::$userData['trieda']['id'] . " AND `testid`=" . $testid);
     //ak nie
     if ($query->num_rows == 0) {
         //idem s5 na zoznam testov
         Viewer::addMessage("Takýto dotazník neexistuje alebo naň nemáš právo!", Viewer::ERROR);
         TestList::init();
         Viewer::setPage(Viewer::TEST_LIST);
         return False;
     }
     //ulozim si udaje o teste
     self::$testData = $query->fetch_array();
     //zistim si groupid testu
     Utils::log(print_r(self::$testData, true));
     $groupid = self::$testData['groupid'];
     //overim ci tento test neije vyplneny
     //ak grupy
     //$queryans = DB::query('SELECT * from `answered` WHERE `groupid`='.$groupid." AND `userid`=".Auth::$userData['id']['id']);
     $queryans = DB::query('SELECT * from `answered` WHERE `testid`=' . $testid . " AND `userid`=" . Auth::$userData['id']['id']);
     if ($queryans->num_rows != 0) {
         Viewer::addMessage("Tento dotazník si už vyplnil/a!", Viewer::ERROR);
         TestList::init();
         Viewer::setPage(Viewer::TEST_LIST);
         return False;
     }
     return True;
 }
Esempio n. 8
0
 public static function init()
 {
     if (self::$initialized == True) {
         return;
     }
     self::$initialized = True;
     //ak niesom prihlaseny tak ma hod na login
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return;
     }
     //ak nie som admin (ale som prihlaseny), tak ma hod na TestList
     /*
     if(!Auth::isAdmin()) {
       Viewer::addMessage("Na zobrazenie tejto stránky musíš byť adminstrátor !", Viewer::ERROR);
       TestList::init();
       Viewer::setPage(Viewer::TEST_LIST);
       return;
     }
     */
     //vytiahnem predmety
     $query = DB::query("SELECT * FROM `predmety` ORDER BY nazov");
     while ($row = $query->fetch_array()) {
         self::$predmety[] = $row;
     }
     //vytiahnem triedy
     $query = DB::query("SELECT * FROM `triedy` WHERE blocked=0 ORDER BY id");
     while ($row = $query->fetch_array()) {
         self::$triedy[] = $row;
         self::$triedy_predmety[$row['name']] = array();
     }
     //vytiahnem ucitelov
     $query = DB::query("SELECT * FROM `ucitelia`");
     while ($row = $query->fetch_array()) {
         self::$ucitelia[] = $row;
     }
     //vytiahnem vsetky testy
     $query = DB::query("SELECT * FROM tests\n         JOIN ucitelia ON ucitelia.ucitelid=tests.ucitel\n         JOIN triedy ON triedy.id=tests.trieda\n         JOIN predmety ON predmety.predmetid=tests.predmetid\n         WHERE blocked=0 AND removed=0");
     while ($row = $query->fetch_array()) {
         self::$triedy_predmety[$row['name']][] = $row;
     }
 }
 /**
  * This action is triggered through a POST HTTP Request in order to modifiy
  * the name of an existing category.
  * 
  * @param integer $categoryId The numeric identifier of the category the user wants to modify the name.
  * @param string $catregoryName The new name of the category the user wants to modify the name.
  */
 public function edit($categoryId, $categoryName)
 {
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     try {
         Categories::modify($categoryId, $categoryName);
         // Ok no exception thrown !
         $_SESSION['isError'] = false;
         $_SESSION['message'] = sprintf(__("The category '%s' has been successfuly updated."), $categoryName);
         DefaultFC::redirection('adminCategories/index');
     } catch (CategoryException $e) {
         // An error occured. Normally, the category name already exists.
         $_SESSION['isError'] = true;
         if ($e->getCode() == CategoryException::ALREADY_EXISTS) {
             $_SESSION['message'] = sprintf(__("The category '%s' already exists."), $categoryName);
         } else {
             $_SESSION['message'] = __("Please provide a category name.");
         }
         DefaultFC::redirection('adminCategories/index');
     }
 }
Esempio n. 10
0
        "mails"=>[
            "smtp"=> "smtp.gmail.com",
            "smtpAuth" => true,
            "username"=> "*****@*****.**",
            "password"=> "GmailPassword",
            "port" => 587,
            "secure"=>"tls"
        ],
        "cookies"=>[
        	"user"=>[
        		"lifetime"=>time()+60*60*24*7
        	]
        ],
        "test"=>false,
		"onStartup"=>function($action){
			if(!Auth::isAuth() && $action[0]!=="UserAuth" && @$action[1]!=="disconnect"){
				if(array_key_exists("autoConnect", $_COOKIE)){
					$_SESSION["action"]=$action;
					$ctrl=new UserAuth();
					$ctrl->initialize();
					$ctrl->signin_with_hybridauth(array($_COOKIE["autoConnect"]));
					$ctrl->finalize();
					die();
				}else if(array_key_exists("user", $_COOKIE)){
					$user = DAO::getOne("User", $_COOKIE['user']);
					$_SESSION["user"] = $user;
					$_SESSION['KCFINDER'] = array(
							'disabled' => true
					);
					$_SESSION['logStatus'] = 'success';
				}
Esempio n. 11
0
 */
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);
if (isset($_GET['id'])) {
    $linkid = $_GET['id'];
} else {
    $linkid = 0;
}
require __DIR__ . '/../functions/auth.php';
require __DIR__ . '/../functions/Link.php';
require __DIR__ . '/ip2locationlite.class.php';
//LOAD THE CLASS
$ipLite = new ip2location_lite();
$ipLite->setKey('ae923f3e42d55c11ae0d9b6dcdba688847e96da84503d36b78f5deca0a47b0e6');
$auth = new Auth();
if ($auth->isAuth()) {
    $link = new Link();
    $iplinks = $link->getDownList($linkid);
    foreach ($iplinks as &$iplink) {
        $location = $ipLite->getCity(long2ip($iplink['ip']));
        $error = $ipLite->getError();
        $iplink['error'] = $error;
        $iplink['location'] = $location;
        $iplink['ip'] = long2ip($iplink['ip']);
        //array(11) {
        // ["statusCode"]=> string(2) "OK"
        // ["statusMessage"]=> string(0) ""
        // ["ipAddress"]=> string(14) "109.200.117.62"
        // ["countryCode"]=> string(2) "RU"
        // ["countryName"]=> string(18) "Russian Federation"
        // ["regionName"]=> string(10) "Sverdlovsk"
Esempio n. 12
0
 public function i18n($messages)
 {
     if (!Auth::isAuth()) {
         throw new ServiceException(MwwException::ACTION, 'I18N', ServiceException::SERV_AUTH);
     }
     $translations = array();
     $messages = json_decode(html_entity_decode($messages, ENT_QUOTES, 'UTF-8'));
     foreach ($messages as $msg) {
         $translations[] = array('original' => $msg, 'translated' => __($msg));
     }
     echo json_encode($translations);
 }
Esempio n. 13
0
 public static function run()
 {
     if (isset($_GET['mode'])) {
         $mode = $_GET['mode'];
     } else {
         $mode = "";
     }
     $request = True;
     //najskôr vyriadime požiadavku
     if ($mode == self::MODE_LOGIN && isset($_POST['password'])) {
         Auth::login($_POST['password']);
     } else {
         if ($mode == self::MODE_SUBMIT_TEST) {
             if (Auth::isAuth()) {
                 Test::submit();
             } else {
                 Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
             }
         } else {
             if ($mode == self::MODE_LOGOUT) {
                 if (Auth::isAuth()) {
                     Auth::logout();
                 } else {
                     Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                 }
             } else {
                 if ($mode == self::MODE_DEL_PREDMET) {
                     if (Auth::isAdmin()) {
                         Admin::delPredmet();
                     } else {
                         Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                     }
                 } else {
                     if ($mode == self::MODE_ADD_CLASS) {
                         if (Auth::isAdmin()) {
                             Admin::addClass();
                         } else {
                             Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                         }
                     } else {
                         if ($mode == self::MODE_DEL_CLASS) {
                             if (Auth::isAdmin()) {
                                 Admin::delClass();
                             } else {
                                 Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                             }
                         } else {
                             if ($mode == self::MODE_ADD_PREDMET) {
                                 if (Auth::isAuth()) {
                                     Admin::addPredmet();
                                 } else {
                                     Viewer::addMessage("Na túto akciu nemáš prístup !", Viewer::ERROR);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //a idem spracovť stránku
     //ak som prihlásený a chcem sa znova prihlásiť tak mi to nepojde
     if (self::$page == self::LOGIN && Auth::isAuth()) {
         Viewer::setPage(self::TEST_LIST);
     }
     if (self::$page == self::TEST_LIST) {
         TestList::init();
     } else {
         if (self::$page == self::TEST) {
             Test::init();
         } else {
             if (self::$page == self::STATS) {
                 Stats::init();
             } else {
                 if (self::$page == self::ADMIN) {
                     Admin::init();
                 }
             }
         }
     }
 }
Esempio n. 14
0
 public static function init()
 {
     if (self::$initialized == True) {
         return;
     }
     self::$initialized = True;
     //ak niesom prihlaseny tak ma hod na login
     if (!Auth::isAuth()) {
         Viewer::addMessage("Na zobrazenie tejto stránky musíš byť prihlásený/á !", Viewer::ERROR);
         Viewer::setPage(Viewer::LOGIN);
         return;
     }
     //nacitam z DB vsetky dotazniky ktore su pre mna
     $query = DB::query('SELECT * from `ucitelia`
          LEFT JOIN `tests` ON ucitelia.ucitelid=tests.ucitel
          LEFT JOIN `predmety` ON predmety.predmetid=tests.predmetid
      WHERE `trieda`=' . Auth::$userData['trieda']['id']);
     //ak ich je 0
     //if($query->num_rows==0)
     //    Viewer::addMessage("Prepáč, ale teraz niesu pre teba k dispozícii žiadne dotazníky !",Viewer::ERROR);
     //ulozim si ich
     while ($query->num_rows > 0 && ($row = $query->fetch_array())) {
         self::$allTests[] = $row;
     }
     //tuto treba odfiltrovat zodpovedane testy
     //nacitam ich zoznam z DB
     $query = DB::query("SELECT * from `answered` where `userid`=" . Auth::$userData['id']['id']);
     $answered = array();
     while ($query->num_rows > 0 && ($row = $query->fetch_array())) {
         $answered[] = $row;
     }
     //oznacim zodpovedane
     foreach (self::$allTests as &$test) {
         if (isset($test['answered'])) {
             continue;
         }
         $found = False;
         foreach ($answered as $answer) {
             if ($answer['testid'] == $test['testid']) {
                 $found = True;
             }
         }
         // ak je zodpovedany, zodpovedane su aj vsetky s rovnakym groupid
         if ($found) {
             foreach (self::$allTests as &$test2) {
                 //zapnutie skupin  - prepisanie testid na groupid
                 if (strcmp($test['testid'], $test2['testid']) == 0) {
                     $test2['answered'] = True;
                 }
             }
         } else {
             $test['answered'] = False;
         }
     }
     //Utils::log(print_r(self::$allTests,true));
     //skontrolujeme kolko dotaznikov este zostava
     $counter = 0;
     foreach (self::$allTests as &$test) {
         if ($test['answered'] == False) {
             $counter++;
         }
     }
     if ($counter == 0 && count(self::$allTests) > 0) {
         Viewer::addMessage("Ďakujeme za vyplnenie všetkých dotazníkov !", Viewer::OK);
     } else {
         Viewer::addMessage("Ešte ti zostáva " . $counter . " dotazníkov.", Viewer::WARNING);
     }
     //Utils::log(print_r(self::$allTests,true));
     //Utils::log(print_r(self::$allTests,true));
 }
 public static function anonymousUserToRegisteredUser($anonymous_username, $username, $password, $confirm_password)
 {
     $username_alreadyExist = self::getUserIdByLogin($username) !== null;
     # TODO: Check user password here to display message for end user
     if (!$username_alreadyExist && $password == $confirm_password) {
         $db = DbUtil::accessFactory();
         $anonymousId = self::getUserIdByLogin($anonymous_username);
         if ($anonymousId !== null) {
             $password = md5($password);
             if ($db->execute("UPDATE `portal`.`users` SET `username` = '{$username}', `is_anonymous` = 0, `password` = '{$password}' WHERE `users`.`id` = {$anonymousId};")) {
                 if (Auth::isAuth()) {
                     $_SESSION['username'] = $username;
                     //$_SESSION['userid'] = self::getUserIdByLogin($username); # Remove this Is the same...
                 }
                 return true;
             } else {
                 throw new DBException(MwwException::MODEL, 'Unable to create (Transform)  user');
             }
         }
     }
     return false;
 }
Esempio n. 16
0
 public function deleteAction($userId)
 {
     if (Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         UsersManagement::deleteUser($userId);
         $_SESSION['isError'] = false;
         $_SESSION['message'] = __('The user has been successfuly removed from the portal.');
         DefaultFC::redirection('adminUsers/index');
     } else {
         redirect('users/index');
     }
 }
Esempio n. 17
0
 public function view($id = NULL)
 {
     if (Auth::isAuth()) {
         $message = $this->getInstance($id);
         $this->loadView("message/viewMessage", array("message" => $message));
     }
 }
Esempio n. 18
0
	public function isValid() {
		return Auth::isAuth();
	}
Esempio n. 19
0
 public function finish_auth()
 {
     $always_trust = false;
     if (isset($_GET['pal_trust'])) {
         $always_trust = true;
         // we hide this parameter from the openid library
         unset($_GET['pal_trust']);
         $_SERVER['QUERY_STRING'] = str_replace('&pal_trust=true', '', $_SERVER['QUERY_STRING']);
     }
     $db = DbUtil::accessFactory();
     $store = new WMySqlStore($db);
     $store->createTables();
     $consumer =& new Auth_OpenID_Consumer($store);
     $url = HttpRequest::getPathUrl();
     $nb = strlen($url);
     $base_url = '';
     if ($nb == 0 || $url[$nb - 1] != "/") {
         $base_url = "http://" . $_SERVER['HTTP_HOST'] . $url . "/";
     } else {
         $base_url = "http://" . $_SERVER['HTTP_HOST'] . $url;
     }
     $return_url = $base_url . 'index.php/openid/finish_auth';
     // Complete the authentication process using the server's
     // response.
     $response = $consumer->complete($return_url);
     $success = false;
     // Check the response status.
     if ($response->status == Auth_OpenID_CANCEL) {
         // This means the authentication was cancelled.
         $msg = __('Verification cancelled.');
     } else {
         if ($response->status == Auth_OpenID_FAILURE) {
             // Authentication failed; display the error message.
             $msg = __("OpenID authentication failed: ") . $response->message;
         } else {
             if ($response->status == Auth_OpenID_SUCCESS) {
                 $success = true;
                 // This means the authentication succeeded; extract the
                 // identity URL and Simple Registration data (if it was
                 // returned).
                 $openid = $response->getDisplayIdentifier();
                 Auth::loginByOpenid($openid);
                 if (!Auth::isAuth()) {
                     $success = false;
                     $msg = __('Account not found.');
                 }
             }
         }
     }
     if ($success) {
         // for openid sso
         if (OPENID_SSO_MODE) {
             if ($always_trust) {
                 setcookie('default_openid', $openid, time() + 60 * 60 * 24 * 30 * 12, HttpRequest::getPathUrl());
             }
         }
         // Authentication process succeeded.
         // FIXME: log this connection
         // Redirection in the portal.
         DefaultFC::redirection('wall/index');
         exit;
     } else {
         $_SESSION['isError'] = true;
         $_SESSION['message'] = $msg;
         DefaultFC::redirection('users/index');
         exit;
     }
 }
Esempio n. 20
0
 /**
  * The Delete action of the Admin module should be triggered through an HTTP POST request in order to
  * uninstall a widget that was installed in the widget repository.
  *
  * @param string $widget The identifier of the widget that must uninstalled from the widget repository.
  */
 public function delete($widget)
 {
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     // Action
     Widgets::uninstall($widget);
     $_SESSION['isError'] = false;
     $_SESSION['message'] = __("The widget has been deleted successfully.");
     DefaultFC::redirection('admin/index');
 }
Esempio n. 21
0
File: go.php Progetto: Ristee/link
 */
require __DIR__ . '/functions/Link.php';
require __DIR__ . '/functions/auth.php';
if (isset($_GET['url'])) {
    $url = $_GET['url'];
} else {
    $url = 'index.php';
}
if (isset($_POST['pass'])) {
    $password = htmlspecialchars(trim($_POST['pass']));
} else {
    $password = '';
}
$link = new Link();
$id = $link->getIdByUrl($url);
$wrongPass = 0;
if ($link->getPass($id)) {
    if ($link->checkPass($id, $password)) {
        $golink = $link->getGoLink($url);
    } else {
        $golink = "./wrong.php?url={$url}";
        $wrongPass = 1;
    }
} else {
    $golink = $link->getGoLink($url);
}
$auth = new Auth();
if ($id > 0 && !$auth->isAuth() && !$wrongPass) {
    $link->addDownload($id);
}
header('Location: ' . $golink);
Esempio n. 22
0
<?php

session_start();
define('_REQ', TRUE);
header("Content-Type: text/html; charset=utf-8");
require_once 'defines.php';
require_once _DIR . 'config.php';
require_once _ENGINE . 'db.php';
$Db = new DataBase($_CONF);
require_once _ENGINE . 'Auth.class.php';
$Auth = new Auth($Db);
if ($_POST['login'] && $_POST['password']) {
    $Auth->start($_POST['login'], $_POST['password']);
}
if ($Auth->isAuth()) {
    $User = $Auth->getUser();
    require_once _TEMPLATE . 'admin.php';
} else {
    require_once _ADMIN . 'auth.php';
}
Esempio n. 23
0
# "myWiWall" is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with "myWiWall"; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****
header('Content-type: text/html; charset=UTF-8');
require_once dirname(__FILE__) . '/includes/common.php';
# Manage the current language selected
$lang = $GLOBALS['lang'];
# Not really used because the anonymous account is always used
if (Auth::isAuth()) {
    $lang = Auth::getLanguage();
    # Special case to add synchro for changing temporary langue via the top control panel
    $re = new HttpRequest();
    $module = $re->getModule();
    $action = $re->getAction();
    if ($module == 'wall' && $action == 'index') {
        $args = $re->getArgs();
        if (isset($args['langage'])) {
            $availableLanguages = Util::getAvailableLanguages();
            if ($args['langage'] !== null && in_array($args['langage'], array_keys($availableLanguages))) {
                $_SESSION['globalLangage'] = $lang = $args['langage'];
            }
        }
    }
}
Esempio n. 24
0
<?php 
	$uAuth = Auth::isAuth();
?>

<!DOCTYPE html>
<html>
<head>
<base href="<?php echo $config["siteUrl"]?>">
<title>Helpdesk</title>

<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="assets/js/bootstrap-clockpicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap-clockpicker.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
<link rel="icon" href="assets/img/helpdesk.png">
<link rel="stylesheet" type="text/css" href="assets/css/styles.css">
</head>
<meta charset="UTF-8">
<body>
	<?php if($uAuth): ?>
		<nav class="navbar navbar-default navbar-inverse" id="mainNav">
			<div class="container">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed"
						data-toggle="collapse" data-target="#mainNav">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>