phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sitemgr/inc/class.Modules_SO.inc.php, 1.4


From: nomail
Subject: [Phpgroupware-cvs] sitemgr/inc/class.Modules_SO.inc.php, 1.4
Date: Wed, 21 Jul 2004 01:22:53 +0200

Update of /sitemgr/inc
Modified Files:
        Branch: 
          class.Modules_SO.inc.php

date: 2004/07/20 23:22:53;  author: skwashd;  state: Exp;  lines: +51 -29

Log Message:
merge from 16
=====================================================================
Index: sitemgr/inc/class.Modules_SO.inc.php
diff -u sitemgr/inc/class.Modules_SO.inc.php:1.3 
sitemgr/inc/class.Modules_SO.inc.php:1.4
--- sitemgr/inc/class.Modules_SO.inc.php:1.3    Tue Mar  4 17:26:43 2003
+++ sitemgr/inc/class.Modules_SO.inc.php        Tue Jul 20 23:22:53 2004
@@ -13,31 +13,43 @@
                {
                        
$this->deletemoduleproperties($module_id,$contentarea,$cat_id);
                        $s = $this->db->db_addslashes(serialize($data));
-                       $sql = "INSERT INTO phpgw_sitemgr_properties 
(area,cat_id,module_id,properties) VALUES 
('$contentarea',$cat_id,'$module_id','$s')";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query('INSERT INTO phpgw_sitemgr_properties 
(area,cat_id,module_id,properties)'
+                                       . " VALUES ('" . 
$this->db->db_addslashes($contentarea) . "',"
+                                       . intval($cat_id) . ','
+                                       . intval($module_id) . ','
+                                       . "'$s')", __LINE__, __FILE__);
                }
 
                function deletemoduleproperties($module_id,$contentarea,$cat_id)
                {
-                       $sql = "DELETE FROM phpgw_sitemgr_properties WHERE 
area='$contentarea' AND cat_id = $cat_id AND module_id = $module_id";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query('DELETE FROM phpgw_sitemgr_properties'
+                                       . " WHERE area='" . 
$this->db->db_addslashes($contentarea) . "'"
+                                       . ' AND cat_id = ' . intval($cat_id)
+                                       . ' AND module_id = ' . 
intval($module_id), __LINE__, __FILE__);
                }
 
                function 
getmoduleproperties($module_id,$contentarea,$cat_id,$modulename)
                {
                        if ($module_id)
                        {
-                               $sql = "SELECT properties FROM 
phpgw_sitemgr_properties WHERE area='$contentarea' AND cat_id = $cat_id AND 
module_id = $module_id";
+                               $sql = 'SELECT properties FROM 
phpgw_sitemgr_properties'
+                                       . " WHERE area='" . 
$this->db->db_addslashes($contentarea) . "'"
+                                       . ' AND cat_id = ' . intval($cat_id)
+                                       . ' AND module_id = ' . 
intval($module_id);
                        }
                        else
                        {
-                               "SELECT properties FROM 
phpgw_sitemgr_properties AS t1 LEFT JOIN phpgw_sitemgr_modules AS t2 ON 
t1.module_id=t2.module_id WHERE area='$contentarea' AND cat_id = $cat_id AND 
module_name = '$modulename'";
+                               $sql = 'SELECT properties FROM 
phpgw_sitemgr_properties AS t1'
+                                       . ' LEFT JOIN phpgw_sitemgr_modules AS 
t2 ON t1.module_id=t2.module_id'
+                                       . " WHERE area='" . 
$this->db->db_addslashes($contentarea) . "'"
+                                       . ' AND cat_id = ' . intval($cat_id)
+                                       . " AND module_name = '" . 
$this->db->db_addslashes($modulename) . "'";
                        }
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        if ($this->db->next_record())
                        {
-                               return 
unserialize(stripslashes($this->db->f('properties')));
+                               return unserialize($this->db->f('properties', 
True));
                        }
                        else
                        {
@@ -48,18 +60,23 @@
                function registermodule($modulename,$description)
                {
                        $description = $this->db->db_addslashes($description);
-                       $sql = "SELECT count(*) FROM phpgw_sitemgr_modules 
where module_name='$modulename'";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query('SELECT COUNT(*) FROM 
phpgw_sitemgr_modules'
+                                       . " WHERE module_name='" . 
$this->db->db_addslashes($modulename) . "'"
+                               , __LINE__, __FILE__);
                        $this->db->next_record();
                        if ($this->db->f(0) == 0)
                        {
-                               $sql = "INSERT INTO phpgw_sitemgr_modules 
(module_name,description) VALUES ('$modulename','$description')";
-                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->query('INSERT INTO 
phpgw_sitemgr_modules (module_name,description)'
+                                               . " VALUES ('" . 
$this->db->db_addslashes($modulename) ."',"
+                                               . "'" . 
$this->db->db_addslashes($description) ."')"
+                                       , __LINE__, __FILE__);
                        }
                        else
                        {
-                               $sql = "UPDATE phpgw_sitemgr_modules SET 
description = '$description' WHERE module_name='$modulename'";
-                               $this->db->query($sql,__LINE__,__FILE__);
+                               $this->db->query('UPDATE phpgw_sitemgr_modules'
+                                               . " SET description = '" . 
$this->db->db_addslashes($description) . "'"
+                                               . " WHERE module_name='" . 
$this->db->db_addslashes($modulename) . "'"
+                                       , __LINE__, __FILE__);
                        }
                }
 
@@ -71,8 +88,9 @@
 
                function getmoduleid($modulename)
                {
-                       $sql = "SELECT module_id FROM phpgw_sitemgr_modules 
WHERE module_name = '$modulename'";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query('SELECT module_id FROM 
phpgw_sitemgr_modules'
+                                       . " WHERE module_name = '" . 
$this->db->db_addslashes($modulename) . "'"
+                               ,__LINE__,__FILE__);
                        if ($this->db->next_record())
                        {
                                return $this->db->f('module_id');
@@ -81,8 +99,8 @@
 
                function getmodule($module_id)
                {
-                       $sql = "SELECT * FROM phpgw_sitemgr_modules WHERE 
module_id = $module_id";
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query('SELECT * FROM phpgw_sitemgr_modules'
+                                       . ' WHERE module_id = ' . 
intval($module_id), __LINE__, __FILE__);
                        if ($this->db->next_record())
                        {
                                $result['id'] = $this->db->f('module_id');
@@ -108,16 +126,16 @@
 
                function savemodulepermissions($contentarea,$cat_id,$modules)
                {
-                       if (!$cat_id)
-                       {
-                               $cat_id = 0;
-                       }
-                       $sql = "DELETE FROM phpgw_sitemgr_active_modules WHERE 
area='$contentarea' AND cat_id = $cat_id";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while (list(,$module_id) = @each($modules))
-                       {
-                               $sql = "INSERT INTO 
phpgw_sitemgr_active_modules (area,cat_id,module_id) VALUES 
('$contentarea',$cat_id,'$module_id')";
-                               $this->db->query($sql,__LINE__,__FILE__);
+                       $cat_id = ($cat_id ? intval($cat_id) : 0);
+
+                       $this->db->query('DELETE FROM 
phpgw_sitemgr_active_modules'
+                                       . " WHERE area='" . 
$this->db->db_addslashes($contentarea) . "'"
+                                       . " AND cat_id = $cat_id", __LINE__, 
__FILE__);
+                       foreach($modules as $module)
+                       {
+                               $this->db->query('INSERT INTO 
phpgw_sitemgr_active_modules (area,cat_id,module_id)'
+                                               . " VALUES ('" . 
$this->db->db_addslashes($contentarea) . "',"
+                                               . $cat_id . ',' . 
intval($module) . ')', __LINE__, __FILE__);
                        }
                }
 
@@ -128,7 +146,11 @@
                        {
                                $cat_id = 0;
                        }
-                       $sql = "SELECT * from phpgw_sitemgr_modules AS t1 LEFT 
JOIN phpgw_sitemgr_active_modules AS t2 ON t1.module_id=t2.module_id WHERE 
area='$contentarea' AND cat_id = $cat_id";
+                       $sql = 'SELECT * from phpgw_sitemgr_modules AS t1'
+                               . ' LEFT JOIN phpgw_sitemgr_active_modules AS 
t2 ON t1.module_id=t2.module_id '
+                               . " WHERE area='" . 
$this->db->db_addslashes($contentarea) . "'"
+                               . ' AND cat_id = ' . intval($cat_id);
                        return $this->constructmodulearray($sql);
                }
-       }
\ No newline at end of file
+       }
+?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]