Prvni verze systemu vymenitelnych backendu
authorThomas Mudrunka <tomas@mudrunka.cz>
Fri, 23 Sep 2011 17:56:40 +0000 (19:56 +0200)
committerThomas Mudrunka <tomas@mudrunka.cz>
Fri, 23 Sep 2011 17:56:40 +0000 (19:56 +0200)
index.php
lib/Sklad_Auth.class/common.php [new file with mode: 0755]
lib/Sklad_Auth.class/internal.php [moved from lib/Sklad_LMS-fake.class.php with 71% similarity]

index c23213f7dd8574d5e27b4b4af8eea77e55c852a7..7bde575b2316de018ac7681e3cc5214319f8d7db 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -20,7 +20,7 @@
 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');
@@ -421,7 +421,7 @@ EOF;
 */
 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,
@@ -607,8 +607,8 @@ class Sklad_DB extends PDO {
                                                        $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;
                                        }
                                }
@@ -747,7 +747,7 @@ class Sklad_UI {
        }
 
        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) {
@@ -843,7 +843,7 @@ class Sklad_UI {
                //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');
diff --git a/lib/Sklad_Auth.class/common.php b/lib/Sklad_Auth.class/common.php
new file mode 100755 (executable)
index 0000000..eff35d2
--- /dev/null
@@ -0,0 +1,34 @@
+<?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');
similarity index 71%
rename from lib/Sklad_LMS-fake.class.php
rename to lib/Sklad_Auth.class/internal.php
index cc84e12ec164d8a3869940b7ee04ba64d06bc6df..1ef39d2a5651689087791cbfcc235c8d98dfb367 100755 (executable)
  * 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));
        }
 }
This page took 0.157092 seconds and 4 git commands to generate.