From: Thomas Mudrunka Date: Fri, 23 Sep 2011 15:17:12 +0000 (+0200) Subject: Priprava na budouci spravu pristupovych prav pomoci rozdeleni uzivatelu do skupin X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=382324d309a6b80a9d22270e016fb05cfa8d51b5;p=mirrors%2FSokoMan.git Priprava na budouci spravu pristupovych prav pomoci rozdeleni uzivatelu do skupin --- diff --git a/index.php b/index.php index 9e4a67d..c23213f 100755 --- a/index.php +++ b/index.php @@ -433,6 +433,10 @@ class Sklad_DB extends PDO { return preg_replace('(^.|.$)', '', $this->quote($str)); //TODO HACK } + function quote_identifier($str) { + return '`'.$this->escape($str).'`'; //TODO HACK + } + function build_query_select($class, $id=false, $limit=false, $offset=0, $where=false, $search=false, $history=false, $order=false, $suffix_id='_id') { //Configuration $join = array( @@ -450,9 +454,9 @@ class Sklad_DB extends PDO { $class = $this->escape($class); //SELECT - $sql="SELECT * FROM $class\n"; + $sql="SELECT * FROM `$class`\n"; //JOIN - if(isset($join[$class])) foreach($join[$class] as $j) $sql .= "LEFT JOIN $j USING($j$suffix_id)\n"; + if(isset($join[$class])) foreach($join[$class] as $j) $sql .= "LEFT JOIN `$j` USING($j$suffix_id)\n"; //WHERE/REGEXP if($search) { $search = $this->quote($search); diff --git a/install.sql b/install.sql index 75a4636..9a6eb03 100644 --- a/install.sql +++ b/install.sql @@ -40,6 +40,31 @@ INSERT INTO `category` VALUES (1,'picovinky'),(2,'Tezka technika, Traktory, etc. /*!40000 ALTER TABLE `category` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `group` +-- + +DROP TABLE IF EXISTS `group`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `group` ( + `group_id` int(11) NOT NULL auto_increment, + `group_key` char(23) collate utf8_czech_ci NOT NULL, + `group_value` char(23) collate utf8_czech_ci NOT NULL, + PRIMARY KEY (`group_id`,`group_key`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping data for table `group` +-- + +LOCK TABLES `group` WRITE; +/*!40000 ALTER TABLE `group` DISABLE KEYS */; +INSERT INTO `group` VALUES (0,'default','rw'),(0,'name','admin'),(2,'name','employee'); +/*!40000 ALTER TABLE `group` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `item` -- @@ -258,4 +283,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2011-08-26 0:30:05 +-- Dump completed on 2011-09-23 15:16:52