require_once('sklad.conf.php');
set_include_path(DIR_LIB.PATH_SEPARATOR.get_include_path());
-require_once('Sklad_LMS-fake.class.php');
+require_once('Sklad_Auth.class/common.php');
require_once('HTTP_Auth.class.php');
require_once('Locale.class.php');
require_once('Barcode.class.php');
*/
class Sklad_DB extends PDO {
function __construct() {
- $this->lms = new Sklad_LMS();
+ $this->auth = new Sklad_Auth();
parent::__construct(
DB_DSN, DB_USER, DB_PASS,
$row_quoted[$column] = '0';
break;
case $table.'_author':
- $row_quoted[$column] = $this->lms->get_authorized_user_id();
- //die($this->lms->get_authorized_user_id().'=USER');
+ $row_quoted[$column] = $this->auth->get_authorized_user_id();
+ //die($this->auth->get_authorized_user_id().'=USER');
break;
}
}
}
function check_auth() {
- new HTTP_Auth('SkladovejSystem', true, array($this->db->lms,'check_auth'));
+ new HTTP_Auth('SkladovejSystem', true, array($this->db->auth,'check_auth'));
}
function post_redirect_get($location, $message='', $error=false) {
//Sephirot:
if(!isset($PATH_CHUNKS[1])) $PATH_CHUNKS[1]='';
if($_SERVER['REQUEST_METHOD'] != 'POST' && $PATH_CHUNKS[1]!='barcode') //TODO: tyhle podminky naznacujou, ze je v navrhu nejaka drobna nedomyslenost...
- echo $this->html->header($PATH_INFO,$this->db->lms->get_authorized_user_id());
+ echo $this->html->header($PATH_INFO,$this->db->auth->get_authorized_user_id());
switch($PATH_CHUNKS[1]) { //TODO: Move some branches to plugins if possible
case 'test': //test
die('Tell me why you cry');
--- /dev/null
+<?php
+/*
+ * SkladovySystem - Storage management system compatible with LMS
+ * Copyright (C) 2011 Thomas Mudrunka
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+* Trida implementuje podpurne funkce spolecne pro vsechny implementace tridy Sklad_Auth
+*
+* @package Sklad_Auth_common
+* @author Tomas Mudrunka
+*/
+class Sklad_Auth_common {
+ function get_authorized_user_id($die=true) {
+ if(isset($this->authorized_user_id)) return $this->authorized_user_id;
+ if($die) die('No user authorized!!!');
+ return false;
+ }
+}
+
+require_once(BACKEND_AUTH.'.php');
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
-* Trida implementuje podpurne funkce spolecne pro vsechny implementace tridy Sklad_LMS
-*
-* @package Sklad_LMS_common
-* @author Tomas Mudrunka
-*/
-class Sklad_LMS_common {
- function get_authorized_user_id($die=true) {
- if(isset($this->authorized_user_id)) return $this->authorized_user_id;
- if($die) die('No user authorized!!!');
- return false;
- }
-}
-
/**
* Trida predstira spojeni s LMS a podvrhuje smysluplna data pro testovaci ucely
*
-* @package Sklad_LMS
+* @package Sklad_Auth
* @author Tomas Mudrunka
*/
-class Sklad_LMS extends Sklad_LMS_common { //FAKE!
+class Sklad_Auth extends Sklad_Auth_common { //FAKE!
function check_auth($user, $pass) {
$users = array( //You can specify multiple users in this array
DB_USER => DB_PASS
);
if(isset($GLOBALS['fake_lms_users'])) $users = $GLOBALS['fake_lms_users'] + $users;
- $this->authorized_user_id=23; //LMS user_id
+ $this->authorized_user_id=23; //Auth user_id
return (isset($users[$user]) && ($users[$user] == $pass));
}
}