Passed
Push — master ( 2ecc51...c1b656 )
by Michael
04:26 queued 02:02
created
class/utility.php 2 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -5,149 +5,149 @@
 block discarded – undo
5 5
  */
6 6
 class EfqDirectoryUtility extends XoopsObject
7 7
 {
8
-    /**
9
-     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
10
-     *
11
-     * @param string $folder The full path of the directory to check
12
-     *
13
-     * @return void
14
-     */
15
-    public static function createFolder($folder)
16
-    {
17
-        //        try {
18
-        //            if (!mkdir($folder) && !is_dir($folder)) {
19
-        //                throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
20
-        //            } else {
21
-        //                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
22
-        //            }
23
-        //        }
24
-        //        catch (Exception $e) {
25
-        //            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
26
-        //        }
27
-        try {
28
-            if (!file_exists($folder)) {
29
-                if (!mkdir($folder) && !is_dir($folder)) {
30
-                    throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31
-                } else {
32
-                    file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
33
-                }
34
-            }
35
-        } catch (Exception $e) {
36
-            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
37
-        }
38
-    }
8
+	/**
9
+	 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
10
+	 *
11
+	 * @param string $folder The full path of the directory to check
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public static function createFolder($folder)
16
+	{
17
+		//        try {
18
+		//            if (!mkdir($folder) && !is_dir($folder)) {
19
+		//                throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
20
+		//            } else {
21
+		//                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
22
+		//            }
23
+		//        }
24
+		//        catch (Exception $e) {
25
+		//            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
26
+		//        }
27
+		try {
28
+			if (!file_exists($folder)) {
29
+				if (!mkdir($folder) && !is_dir($folder)) {
30
+					throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31
+				} else {
32
+					file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
33
+				}
34
+			}
35
+		} catch (Exception $e) {
36
+			echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
37
+		}
38
+	}
39 39
 
40
-    /**
41
-     * @param $file
42
-     * @param $folder
43
-     * @return bool
44
-     */
45
-    public static function copyFile($file, $folder)
46
-    {
47
-        return copy($file, $folder);
48
-        //        try {
49
-        //            if (!is_dir($folder)) {
50
-        //                throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder));
51
-        //            } else {
52
-        //                return copy($file, $folder);
53
-        //            }
54
-        //        } catch (Exception $e) {
55
-        //            echo 'Caught exception: ', $e->getMessage(), "\n", "<br>";
56
-        //        }
57
-        //        return false;
58
-    }
40
+	/**
41
+	 * @param $file
42
+	 * @param $folder
43
+	 * @return bool
44
+	 */
45
+	public static function copyFile($file, $folder)
46
+	{
47
+		return copy($file, $folder);
48
+		//        try {
49
+		//            if (!is_dir($folder)) {
50
+		//                throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder));
51
+		//            } else {
52
+		//                return copy($file, $folder);
53
+		//            }
54
+		//        } catch (Exception $e) {
55
+		//            echo 'Caught exception: ', $e->getMessage(), "\n", "<br>";
56
+		//        }
57
+		//        return false;
58
+	}
59 59
 
60
-    /**
61
-     * @param $src
62
-     * @param $dst
63
-     */
64
-    public static function recurseCopy($src, $dst)
65
-    {
66
-        $dir = opendir($src);
67
-        //    @mkdir($dst);
68
-        while (false !== ($file = readdir($dir))) {
69
-            if (($file !== '.') && ($file !== '..')) {
70
-                if (is_dir($src . '/' . $file)) {
71
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
72
-                } else {
73
-                    copy($src . '/' . $file, $dst . '/' . $file);
74
-                }
75
-            }
76
-        }
77
-        closedir($dir);
78
-    }
60
+	/**
61
+	 * @param $src
62
+	 * @param $dst
63
+	 */
64
+	public static function recurseCopy($src, $dst)
65
+	{
66
+		$dir = opendir($src);
67
+		//    @mkdir($dst);
68
+		while (false !== ($file = readdir($dir))) {
69
+			if (($file !== '.') && ($file !== '..')) {
70
+				if (is_dir($src . '/' . $file)) {
71
+					self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
72
+				} else {
73
+					copy($src . '/' . $file, $dst . '/' . $file);
74
+				}
75
+			}
76
+		}
77
+		closedir($dir);
78
+	}
79 79
 
80
-    /**
81
-     *
82
-     * Verifies XOOPS version meets minimum requirements for this module
83
-     * @static
84
-     * @param XoopsModule $module
85
-     * @param null|string $requiredVer
86
-     *
87
-     * @return bool true if meets requirements, false if not
88
-     */
89
-    public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
90
-    {
91
-        $moduleDirName = basename(dirname(__DIR__));
92
-        if (null === $module) {
93
-            $module = XoopsModule::getByDirname($moduleDirName);
94
-        }
95
-        xoops_loadLanguage('admin', $moduleDirName);
96
-        //check for minimum XOOPS version
97
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98
-        $currArray  = explode('.', $currentVer);
99
-        if (null === $requiredVer) {
100
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
101
-        }
102
-        $reqArray = explode('.', $requiredVer);
103
-        $success  = true;
104
-        foreach ($reqArray as $k => $v) {
105
-            if (isset($currArray[$k])) {
106
-                if ($currArray[$k] > $v) {
107
-                    break;
108
-                } elseif ($currArray[$k] == $v) {
109
-                    continue;
110
-                } else {
111
-                    $success = false;
112
-                    break;
113
-                }
114
-            } else {
115
-                if ((int)$v > 0) { // handles things like x.x.x.0_RC2
116
-                    $success = false;
117
-                    break;
118
-                }
119
-            }
120
-        }
80
+	/**
81
+	 *
82
+	 * Verifies XOOPS version meets minimum requirements for this module
83
+	 * @static
84
+	 * @param XoopsModule $module
85
+	 * @param null|string $requiredVer
86
+	 *
87
+	 * @return bool true if meets requirements, false if not
88
+	 */
89
+	public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null)
90
+	{
91
+		$moduleDirName = basename(dirname(__DIR__));
92
+		if (null === $module) {
93
+			$module = XoopsModule::getByDirname($moduleDirName);
94
+		}
95
+		xoops_loadLanguage('admin', $moduleDirName);
96
+		//check for minimum XOOPS version
97
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98
+		$currArray  = explode('.', $currentVer);
99
+		if (null === $requiredVer) {
100
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
101
+		}
102
+		$reqArray = explode('.', $requiredVer);
103
+		$success  = true;
104
+		foreach ($reqArray as $k => $v) {
105
+			if (isset($currArray[$k])) {
106
+				if ($currArray[$k] > $v) {
107
+					break;
108
+				} elseif ($currArray[$k] == $v) {
109
+					continue;
110
+				} else {
111
+					$success = false;
112
+					break;
113
+				}
114
+			} else {
115
+				if ((int)$v > 0) { // handles things like x.x.x.0_RC2
116
+					$success = false;
117
+					break;
118
+				}
119
+			}
120
+		}
121 121
 
122
-        if (!$success) {
123
-            $module->setErrors(sprintf(_AM_EFQDIR_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
124
-        }
122
+		if (!$success) {
123
+			$module->setErrors(sprintf(_AM_EFQDIR_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
124
+		}
125 125
 
126
-        return $success;
127
-    }
126
+		return $success;
127
+	}
128 128
 
129
-    /**
130
-     *
131
-     * Verifies PHP version meets minimum requirements for this module
132
-     * @static
133
-     * @param XoopsModule $module
134
-     *
135
-     * @return bool true if meets requirements, false if not
136
-     */
137
-    public static function checkVerPhp(XoopsModule $module)
138
-    {
139
-        xoops_loadLanguage('admin', $module->dirname());
140
-        // check for minimum PHP version
141
-        $success = true;
142
-        $verNum  = PHP_VERSION;
143
-        $reqVer  = $module->getInfo('min_php');
144
-        if (false !== $reqVer && '' !== $reqVer) {
145
-            if (version_compare($verNum, $reqVer, '<')) {
146
-                $module->setErrors(sprintf(_AM_EFQDIR_ERROR_BAD_PHP, $reqVer, $verNum));
147
-                $success = false;
148
-            }
149
-        }
129
+	/**
130
+	 *
131
+	 * Verifies PHP version meets minimum requirements for this module
132
+	 * @static
133
+	 * @param XoopsModule $module
134
+	 *
135
+	 * @return bool true if meets requirements, false if not
136
+	 */
137
+	public static function checkVerPhp(XoopsModule $module)
138
+	{
139
+		xoops_loadLanguage('admin', $module->dirname());
140
+		// check for minimum PHP version
141
+		$success = true;
142
+		$verNum  = PHP_VERSION;
143
+		$reqVer  = $module->getInfo('min_php');
144
+		if (false !== $reqVer && '' !== $reqVer) {
145
+			if (version_compare($verNum, $reqVer, '<')) {
146
+				$module->setErrors(sprintf(_AM_EFQDIR_ERROR_BAD_PHP, $reqVer, $verNum));
147
+				$success = false;
148
+			}
149
+		}
150 150
 
151
-        return $success;
152
-    }
151
+		return $success;
152
+	}
153 153
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 if (!mkdir($folder) && !is_dir($folder)) {
30 30
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31 31
                 } else {
32
-                    file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
32
+                    file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
33 33
                 }
34 34
             }
35 35
         } catch (Exception $e) {
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         //    @mkdir($dst);
68 68
         while (false !== ($file = readdir($dir))) {
69 69
             if (($file !== '.') && ($file !== '..')) {
70
-                if (is_dir($src . '/' . $file)) {
71
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
70
+                if (is_dir($src.'/'.$file)) {
71
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
72 72
                 } else {
73
-                    copy($src . '/' . $file, $dst . '/' . $file);
73
+                    copy($src.'/'.$file, $dst.'/'.$file);
74 74
                 }
75 75
             }
76 76
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98 98
         $currArray  = explode('.', $currentVer);
99 99
         if (null === $requiredVer) {
100
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
100
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
101 101
         }
102 102
         $reqArray = explode('.', $requiredVer);
103 103
         $success  = true;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     break;
113 113
                 }
114 114
             } else {
115
-                if ((int)$v > 0) { // handles things like x.x.x.0_RC2
115
+                if ((int) $v > 0) { // handles things like x.x.x.0_RC2
116 116
                     $success = false;
117 117
                     break;
118 118
                 }
Please login to merge, or discard this patch.
class/class.formimage.php 2 patches
Indentation   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -19,172 +19,172 @@
 block discarded – undo
19 19
  */
20 20
 class XoopsFormImage extends XoopsFormElement
21 21
 {
22
-    /**
23
-     * Options
24
-     * @var array
25
-     * @access private
26
-     */
27
-    public $_options  = array();
28
-    public $_multiple = false;
29
-    public $_size;
22
+	/**
23
+	 * Options
24
+	 * @var array
25
+	 * @access private
26
+	 */
27
+	public $_options  = array();
28
+	public $_multiple = false;
29
+	public $_size;
30 30
 
31
-    public $_height;
32
-    public $_width;
33
-    public $_src;
34
-    public $_value = array();
31
+	public $_height;
32
+	public $_width;
33
+	public $_src;
34
+	public $_value = array();
35 35
 
36
-    /**
37
-     * Constructor
38
-     *
39
-     * @param string     $caption  Caption
40
-     * @param string     $name     "name" attribute
41
-     * @param mixed      $value    Pre-selected value (or array of them).
42
-     * @param string     $src
43
-     * @param string     $height
44
-     * @param string     $width
45
-     * @param bool       $multiple Allow multiple selections?
46
-     * @param int|string $size     Size of the selection box
47
-     */
48
-    public function __construct($caption, $name, $value = null, $src = '', $height = '50', $width = '50', $multiple = false, $size = '1')
49
-    {
50
-        $this->setCaption($caption);
51
-        $this->setName($name);
52
-        $this->_multiple = $multiple;
53
-        $this->_size     = (int)$size;
54
-        if (isset($value)) {
55
-            $this->setValue($value);
56
-        }
57
-        $this->_height = $height;
58
-        $this->_width  = $width;
59
-        $this->_src    = $src;
60
-    }
36
+	/**
37
+	 * Constructor
38
+	 *
39
+	 * @param string     $caption  Caption
40
+	 * @param string     $name     "name" attribute
41
+	 * @param mixed      $value    Pre-selected value (or array of them).
42
+	 * @param string     $src
43
+	 * @param string     $height
44
+	 * @param string     $width
45
+	 * @param bool       $multiple Allow multiple selections?
46
+	 * @param int|string $size     Size of the selection box
47
+	 */
48
+	public function __construct($caption, $name, $value = null, $src = '', $height = '50', $width = '50', $multiple = false, $size = '1')
49
+	{
50
+		$this->setCaption($caption);
51
+		$this->setName($name);
52
+		$this->_multiple = $multiple;
53
+		$this->_size     = (int)$size;
54
+		if (isset($value)) {
55
+			$this->setValue($value);
56
+		}
57
+		$this->_height = $height;
58
+		$this->_width  = $width;
59
+		$this->_src    = $src;
60
+	}
61 61
 
62
-    /**
63
-     * @return string
64
-     */
65
-    public function getWidth()
66
-    {
67
-        return $this->_width;
68
-    }
62
+	/**
63
+	 * @return string
64
+	 */
65
+	public function getWidth()
66
+	{
67
+		return $this->_width;
68
+	}
69 69
 
70
-    /**
71
-     * @return string
72
-     */
73
-    public function getHeight()
74
-    {
75
-        return $this->_height;
76
-    }
70
+	/**
71
+	 * @return string
72
+	 */
73
+	public function getHeight()
74
+	{
75
+		return $this->_height;
76
+	}
77 77
 
78
-    /**
79
-     * @return string
80
-     */
81
-    public function getSrc()
82
-    {
83
-        return $this->_src;
84
-    }
78
+	/**
79
+	 * @return string
80
+	 */
81
+	public function getSrc()
82
+	{
83
+		return $this->_src;
84
+	}
85 85
 
86
-    /*
86
+	/*
87 87
     * Are multiple selections allowed?
88 88
     *
89 89
     * @return bool
90 90
     */
91
-    /**
92
-     * @return bool
93
-     */
94
-    public function isMultiple()
95
-    {
96
-        return $this->_multiple;
97
-    }
91
+	/**
92
+	 * @return bool
93
+	 */
94
+	public function isMultiple()
95
+	{
96
+		return $this->_multiple;
97
+	}
98 98
 
99
-    /**
100
-     * Get the size
101
-     *
102
-     * @return int
103
-     */
104
-    public function getSize()
105
-    {
106
-        return $this->_size;
107
-    }
99
+	/**
100
+	 * Get the size
101
+	 *
102
+	 * @return int
103
+	 */
104
+	public function getSize()
105
+	{
106
+		return $this->_size;
107
+	}
108 108
 
109
-    /**
110
-     * Get an array of pre-selected values
111
-     *
112
-     * @return array
113
-     */
114
-    public function getValue()
115
-    {
116
-        return $this->_value;
117
-    }
109
+	/**
110
+	 * Get an array of pre-selected values
111
+	 *
112
+	 * @return array
113
+	 */
114
+	public function getValue()
115
+	{
116
+		return $this->_value;
117
+	}
118 118
 
119
-    /**
120
-     * Set pre-selected values
121
-     *
122
-     * @param $value mixed
123
-     */
124
-    public function setValue($value)
125
-    {
126
-        if (is_array($value)) {
127
-            foreach ($value as $v) {
128
-                $this->_value[] = $v;
129
-            }
130
-        } else {
131
-            $this->_value[] = $value;
132
-        }
133
-    }
119
+	/**
120
+	 * Set pre-selected values
121
+	 *
122
+	 * @param $value mixed
123
+	 */
124
+	public function setValue($value)
125
+	{
126
+		if (is_array($value)) {
127
+			foreach ($value as $v) {
128
+				$this->_value[] = $v;
129
+			}
130
+		} else {
131
+			$this->_value[] = $value;
132
+		}
133
+	}
134 134
 
135
-    /**
136
-     * Add an option
137
-     *
138
-     * @param string $value "value" attribute
139
-     * @param string $name  "name" attribute
140
-     */
141
-    public function addOption($value, $name = '')
142
-    {
143
-        if ($name !== '') {
144
-            $this->_options[$value] = $name;
145
-        } else {
146
-            $this->_options[$value] = $value;
147
-        }
148
-    }
135
+	/**
136
+	 * Add an option
137
+	 *
138
+	 * @param string $value "value" attribute
139
+	 * @param string $name  "name" attribute
140
+	 */
141
+	public function addOption($value, $name = '')
142
+	{
143
+		if ($name !== '') {
144
+			$this->_options[$value] = $name;
145
+		} else {
146
+			$this->_options[$value] = $value;
147
+		}
148
+	}
149 149
 
150
-    /**
151
-     * Add multiple options
152
-     *
153
-     * @param array $options Associative array of value->name pairs
154
-     */
155
-    public function addOptionArray($options)
156
-    {
157
-        if (is_array($options)) {
158
-            foreach ($options as $k => $v) {
159
-                $this->addOption($k, $v);
160
-            }
161
-        }
162
-    }
150
+	/**
151
+	 * Add multiple options
152
+	 *
153
+	 * @param array $options Associative array of value->name pairs
154
+	 */
155
+	public function addOptionArray($options)
156
+	{
157
+		if (is_array($options)) {
158
+			foreach ($options as $k => $v) {
159
+				$this->addOption($k, $v);
160
+			}
161
+		}
162
+	}
163 163
 
164
-    /**
165
-     * Get all options
166
-     *
167
-     * @return array   Associative array of value->name pairs
168
-     */
169
-    public function getOptions()
170
-    {
171
-        return $this->_options;
172
-    }
164
+	/**
165
+	 * Get all options
166
+	 *
167
+	 * @return array   Associative array of value->name pairs
168
+	 */
169
+	public function getOptions()
170
+	{
171
+		return $this->_options;
172
+	}
173 173
 
174
-    /**
175
-     * Prepare HTML for output
176
-     *
177
-     * @return string  HTML
178
-     */
179
-    public function render()
180
-    {
181
-        if ($this->getSrc() !== '') {
182
-            $ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
183
-            $ret .= '>';
184
-        } else {
185
-            $ret = _MD_NOIMAGE;
186
-        }
174
+	/**
175
+	 * Prepare HTML for output
176
+	 *
177
+	 * @return string  HTML
178
+	 */
179
+	public function render()
180
+	{
181
+		if ($this->getSrc() !== '') {
182
+			$ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
183
+			$ret .= '>';
184
+		} else {
185
+			$ret = _MD_NOIMAGE;
186
+		}
187 187
 
188
-        return $ret;
189
-    }
188
+		return $ret;
189
+	}
190 190
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->setCaption($caption);
51 51
         $this->setName($name);
52 52
         $this->_multiple = $multiple;
53
-        $this->_size     = (int)$size;
53
+        $this->_size     = (int) $size;
54 54
         if (isset($value)) {
55 55
             $this->setValue($value);
56 56
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     public function render()
180 180
     {
181 181
         if ($this->getSrc() !== '') {
182
-            $ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
182
+            $ret = "<img src='".$this->getSrc().'\' width=\''.$this->getWidth().'\'  height=\''.$this->getHeight().'\'';
183 183
             $ret .= '>';
184 184
         } else {
185 185
             $ret = _MD_NOIMAGE;
Please login to merge, or discard this patch.
class/class.listing.php 2 patches
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -29,97 +29,97 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class efqListing extends XoopsObject
31 31
 {
32
-    public $_editrights = false;
33
-    public $_currentuser;
34
-    public $_value      = array();
35
-    public $_postdata   = array();
36
-    public $_datatypes  = array();
32
+	public $_editrights = false;
33
+	public $_currentuser;
34
+	public $_value      = array();
35
+	public $_postdata   = array();
36
+	public $_datatypes  = array();
37 37
 
38
-    /**
39
-     * Constructor
40
-     */
41
-    public function __construct()
42
-    {
43
-        // class constructor;
44
-        $this->setCurrentUser();
38
+	/**
39
+	 * Constructor
40
+	 */
41
+	public function __construct()
42
+	{
43
+		// class constructor;
44
+		$this->setCurrentUser();
45 45
 
46
-        $this->initVar('itemid', XOBJ_DTYPE_INT, 0, true);
47
-        $this->initVar('logourl', XOBJ_DTYPE_TXTBOX, null, false, 255);
48
-        $this->initVar('uid', XOBJ_DTYPE_INT, 0, true);
49
-        $this->initVar('status', XOBJ_DTYPE_INT, 0, true);
50
-        $this->initVar('created', XOBJ_DTYPE_INT, 0, true);
51
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 255);
52
-        $this->initVar('hits', XOBJ_DTYPE_INT, 0, true);
53
-        $this->initVar('rating', XOBJ_DTYPE_OTHER, 0.0, true);
54
-        $this->initVar('votes', XOBJ_DTYPE_INT, 0, true);
55
-        $this->initVar('typeid', XOBJ_DTYPE_INT, 0, true);
56
-        $this->initVar('dirid', XOBJ_DTYPE_INT, 0, true);
57
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
58
-    }
46
+		$this->initVar('itemid', XOBJ_DTYPE_INT, 0, true);
47
+		$this->initVar('logourl', XOBJ_DTYPE_TXTBOX, null, false, 255);
48
+		$this->initVar('uid', XOBJ_DTYPE_INT, 0, true);
49
+		$this->initVar('status', XOBJ_DTYPE_INT, 0, true);
50
+		$this->initVar('created', XOBJ_DTYPE_INT, 0, true);
51
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 255);
52
+		$this->initVar('hits', XOBJ_DTYPE_INT, 0, true);
53
+		$this->initVar('rating', XOBJ_DTYPE_OTHER, 0.0, true);
54
+		$this->initVar('votes', XOBJ_DTYPE_INT, 0, true);
55
+		$this->initVar('typeid', XOBJ_DTYPE_INT, 0, true);
56
+		$this->initVar('dirid', XOBJ_DTYPE_INT, 0, true);
57
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
58
+	}
59 59
 
60
-    /**
61
-     * Function setListingVars sets listing variables
62
-     * @author    EFQ Consultancy <[email protected]>
63
-     * @copyright EFQ Consultancy (c) 2007
64
-     * @version   1.0.0
65
-     *
66
-     * @param   array $listing Array with listing details
67
-     */
68
-    public function setListingVars($listing = array())
69
-    {
70
-        if (is_array($listing)) {
71
-            $this->setVar('itemid', $listing['itemid']);
72
-            $this->setVar('logourl', $listing['logourl']);
73
-            $this->setVar('uid', $listing['uid']);
74
-            $this->setVar('status', $listing['status']);
75
-            $this->setVar('created', $listing['created']);
76
-            $this->setVar('title', $listing['title']);
77
-            $this->setVar('hits', $listing['hits']);
78
-            $this->setVar('rating', $listing['rating']);
79
-            $this->setVar('votes', $listing['votes']);
80
-            $this->setVar('typeid', $listing['typeid']);
81
-            $this->setVar('dirid', $listing['dirid']);
82
-            $this->setVar('description', $listing['description']);
83
-        }
84
-    }
60
+	/**
61
+	 * Function setListingVars sets listing variables
62
+	 * @author    EFQ Consultancy <[email protected]>
63
+	 * @copyright EFQ Consultancy (c) 2007
64
+	 * @version   1.0.0
65
+	 *
66
+	 * @param   array $listing Array with listing details
67
+	 */
68
+	public function setListingVars($listing = array())
69
+	{
70
+		if (is_array($listing)) {
71
+			$this->setVar('itemid', $listing['itemid']);
72
+			$this->setVar('logourl', $listing['logourl']);
73
+			$this->setVar('uid', $listing['uid']);
74
+			$this->setVar('status', $listing['status']);
75
+			$this->setVar('created', $listing['created']);
76
+			$this->setVar('title', $listing['title']);
77
+			$this->setVar('hits', $listing['hits']);
78
+			$this->setVar('rating', $listing['rating']);
79
+			$this->setVar('votes', $listing['votes']);
80
+			$this->setVar('typeid', $listing['typeid']);
81
+			$this->setVar('dirid', $listing['dirid']);
82
+			$this->setVar('description', $listing['description']);
83
+		}
84
+	}
85 85
 
86
-    public function setDataTypes($arr = array())
87
-    {
88
-        $this->_datatypes = $arr;
89
-    }
86
+	public function setDataTypes($arr = array())
87
+	{
88
+		$this->_datatypes = $arr;
89
+	}
90 90
 
91
-    public function getDataTypes()
92
-    {
93
-        return $this->_datatypes;
94
-    }
91
+	public function getDataTypes()
92
+	{
93
+		return $this->_datatypes;
94
+	}
95 95
 
96
-    public function setCurrentUser()
97
-    {
98
-        global $xoopsUser;
99
-        $this->_currentuser = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
100
-    }
96
+	public function setCurrentUser()
97
+	{
98
+		global $xoopsUser;
99
+		$this->_currentuser = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
100
+	}
101 101
 
102
-    public function setEditRights($value = false)
103
-    {
104
-        $this->_editrights = $value;
105
-    }
102
+	public function setEditRights($value = false)
103
+	{
104
+		$this->_editrights = $value;
105
+	}
106 106
 
107
-    public function addPostDataArray($arr)
108
-    {
109
-        $this->_postdata[] = $arr;
110
-    }
107
+	public function addPostDataArray($arr)
108
+	{
109
+		$this->_postdata[] = $arr;
110
+	}
111 111
 
112
-    public function updateListing()
113
-    {
114
-        global $xoopsDB;
115
-        // Save array _postdata into database as update;
116
-    }
112
+	public function updateListing()
113
+	{
114
+		global $xoopsDB;
115
+		// Save array _postdata into database as update;
116
+	}
117 117
 
118
-    public function insertListing()
119
-    {
120
-        global $xoopsDB;
121
-        // Save array postdata into database as new record;
122
-    }
118
+	public function insertListing()
119
+	{
120
+		global $xoopsDB;
121
+		// Save array postdata into database as new record;
122
+	}
123 123
 }
124 124
 
125 125
 /**
@@ -133,160 +133,160 @@  discard block
 block discarded – undo
133 133
  */
134 134
 class efqListingHandler extends XoopsObjectHandler
135 135
 {
136
-    public function __construct()
137
-    {
138
-        //Instantiate class
139
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
140
-    }
136
+	public function __construct()
137
+	{
138
+		//Instantiate class
139
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
140
+	}
141 141
 
142
-    /**
143
-     * Function updateStatus updates status for listing
144
-     * @author    EFQ Consultancy <[email protected]>
145
-     * @copyright EFQ Consultancy (c) 2007
146
-     * @version   1.0.0
147
-     *
148
-     * @param   int      $itemid    - Default: 0 - Listing to be updated
149
-     * @param int|string $newstatus - Default: '1' - New status for listing
150
-     * @return bool true if update is succesful, false if unsuccesful
151
-     */
152
-    public function updateStatus($itemid = 0, $newstatus = '1')
153
-    {
154
-        $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' SET status = ' . $newstatus . ' WHERE itemid = ' . (int)$itemid . '';
155
-        if ($this->db->query($sql)) {
156
-            return true;
157
-        }
142
+	/**
143
+	 * Function updateStatus updates status for listing
144
+	 * @author    EFQ Consultancy <[email protected]>
145
+	 * @copyright EFQ Consultancy (c) 2007
146
+	 * @version   1.0.0
147
+	 *
148
+	 * @param   int      $itemid    - Default: 0 - Listing to be updated
149
+	 * @param int|string $newstatus - Default: '1' - New status for listing
150
+	 * @return bool true if update is succesful, false if unsuccesful
151
+	 */
152
+	public function updateStatus($itemid = 0, $newstatus = '1')
153
+	{
154
+		$sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' SET status = ' . $newstatus . ' WHERE itemid = ' . (int)$itemid . '';
155
+		if ($this->db->query($sql)) {
156
+			return true;
157
+		}
158 158
 
159
-        return false;
160
-    }
159
+		return false;
160
+	}
161 161
 
162
-    /**
163
-     * Function incrementHits increments hits for listing with 1
164
-     * @author    EFQ Consultancy <[email protected]>
165
-     * @copyright EFQ Consultancy (c) 2007
166
-     * @version   1.0.0
167
-     *
168
-     * @param   int $itemid - Default: 0 - Listing to be updated
169
-     *
170
-     * @return bool true if update is succesful, false if unsuccesful
171
-     */
172
-    public function incrementHits($itemid = 0)
173
-    {
174
-        $sql = sprintf('UPDATE %s SET hits = hits+1 WHERE itemid = %u AND STATUS = 2', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), (int)$itemid);
175
-        if ($this->db->queryF($sql)) {
176
-            return true;
177
-        }
162
+	/**
163
+	 * Function incrementHits increments hits for listing with 1
164
+	 * @author    EFQ Consultancy <[email protected]>
165
+	 * @copyright EFQ Consultancy (c) 2007
166
+	 * @version   1.0.0
167
+	 *
168
+	 * @param   int $itemid - Default: 0 - Listing to be updated
169
+	 *
170
+	 * @return bool true if update is succesful, false if unsuccesful
171
+	 */
172
+	public function incrementHits($itemid = 0)
173
+	{
174
+		$sql = sprintf('UPDATE %s SET hits = hits+1 WHERE itemid = %u AND STATUS = 2', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), (int)$itemid);
175
+		if ($this->db->queryF($sql)) {
176
+			return true;
177
+		}
178 178
 
179
-        return false;
180
-    }
179
+		return false;
180
+	}
181 181
 
182
-    /**
183
-     * Function getLinkedCatsArray gets categories linked to a listing.
184
-     * @author    EFQ Consultancy <[email protected]>
185
-     * @copyright EFQ Consultancy (c) 2007
186
-     * @version   1.0.0
187
-     *
188
-     * @param int|string $itemid - Default: '0' - Listing ID
189
-     * @param int|string $dirid  - Default: '0' - Directory ID
190
-     * @return array $arr Array with category ID's
191
-     */
192
-    public function getLinkedCatsArray($itemid = '0', $dirid = '0')
193
-    {
194
-        $sql     = 'SELECT c.cid, x.active FROM '
195
-                   . $this->db->prefix($module->getVar('dirname', 'n') . '_cat')
196
-                   . ' c, '
197
-                   . $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
198
-                   . ' x WHERE c.cid=x.cid AND x.itemid='
199
-                   . (int)$itemid
200
-                   . " AND c.dirid='"
201
-                   . (int)$dirid
202
-                   . '\' AND c.active=\'1\'';
203
-        $result  = $this->db->query($sql);
204
-        $numrows = $this->db->getRowsNum($result);
205
-        $arr     = array();
206
-        if ($numrows > 0) {
207
-            while (list($cid, $active) = $this->db->fetchRow($result)) {
208
-                $arr[] = $cid;
209
-            }
210
-        }
182
+	/**
183
+	 * Function getLinkedCatsArray gets categories linked to a listing.
184
+	 * @author    EFQ Consultancy <[email protected]>
185
+	 * @copyright EFQ Consultancy (c) 2007
186
+	 * @version   1.0.0
187
+	 *
188
+	 * @param int|string $itemid - Default: '0' - Listing ID
189
+	 * @param int|string $dirid  - Default: '0' - Directory ID
190
+	 * @return array $arr Array with category ID's
191
+	 */
192
+	public function getLinkedCatsArray($itemid = '0', $dirid = '0')
193
+	{
194
+		$sql     = 'SELECT c.cid, x.active FROM '
195
+				   . $this->db->prefix($module->getVar('dirname', 'n') . '_cat')
196
+				   . ' c, '
197
+				   . $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
198
+				   . ' x WHERE c.cid=x.cid AND x.itemid='
199
+				   . (int)$itemid
200
+				   . " AND c.dirid='"
201
+				   . (int)$dirid
202
+				   . '\' AND c.active=\'1\'';
203
+		$result  = $this->db->query($sql);
204
+		$numrows = $this->db->getRowsNum($result);
205
+		$arr     = array();
206
+		if ($numrows > 0) {
207
+			while (list($cid, $active) = $this->db->fetchRow($result)) {
208
+				$arr[] = $cid;
209
+			}
210
+		}
211 211
 
212
-        return $arr;
213
-    }
212
+		return $arr;
213
+	}
214 214
 
215
-    /**
216
-     * Function getListing gets listing from DB as an array.
217
-     *
218
-     * @author    EFQ Consultancy <[email protected]>
219
-     * @copyright EFQ Consultancy (c) 2007
220
-     * @version   1.0.0
221
-     *
222
-     * @param   int $itemid - Default: '0' - Listing ID
223
-     *
224
-     * @return array $arr Array with listing fields and values
225
-     */
226
-    public function getListing($itemid)
227
-    {
228
-        $sql    = 'SELECT i.*, t.description FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' i LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_item_text') . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' . (int)$itemid;
229
-        $result = $this->db->query($sql);
230
-        $arr    = array();
231
-        if (!$result) {
232
-            return $arr;
233
-        } else {
234
-            $numrows = $this->db->getRowsNum($result);
235
-            if ($numrows == 0) {
236
-                return $arr;
237
-            } else {
238
-                $arr = $this->db->fetchArray($result);
239
-            }
240
-        }
215
+	/**
216
+	 * Function getListing gets listing from DB as an array.
217
+	 *
218
+	 * @author    EFQ Consultancy <[email protected]>
219
+	 * @copyright EFQ Consultancy (c) 2007
220
+	 * @version   1.0.0
221
+	 *
222
+	 * @param   int $itemid - Default: '0' - Listing ID
223
+	 *
224
+	 * @return array $arr Array with listing fields and values
225
+	 */
226
+	public function getListing($itemid)
227
+	{
228
+		$sql    = 'SELECT i.*, t.description FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' i LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_item_text') . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' . (int)$itemid;
229
+		$result = $this->db->query($sql);
230
+		$arr    = array();
231
+		if (!$result) {
232
+			return $arr;
233
+		} else {
234
+			$numrows = $this->db->getRowsNum($result);
235
+			if ($numrows == 0) {
236
+				return $arr;
237
+			} else {
238
+				$arr = $this->db->fetchArray($result);
239
+			}
240
+		}
241 241
 
242
-        return $arr;
243
-    }
242
+		return $arr;
243
+	}
244 244
 
245
-    public function getDataTypes($itemid)
246
-    {
247
-        global $datafieldmanager;
248
-        $sql     = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle ';
249
-        $sql     .= 'FROM '
250
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
251
-                    . ' ic, '
252
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat')
253
-                    . ' xc, '
254
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_fieldtypes')
255
-                    . ' f, '
256
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes')
257
-                    . ' t ';
258
-        $sql     .= 'LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . (int)$itemid . ') ';
259
-        $sql     .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . (int)$itemid . ' ORDER BY t.seq ASC';
260
-        $result  = $this->db->query($sql);
261
-        $numrows = $this->db->getRowsNum($result);
262
-        //$arr = $this->db->fetchArray($result);
263
-        $arr = array();
264
-        while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $itemid, $value, $customtitle) = $this->db->fetchRow($result)) {
265
-            $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value);
266
-            if ($icon != '') {
267
-                $iconurl = "<img src=\"uploads/$icon\">";
268
-            } else {
269
-                $iconurl = '';
270
-            }
271
-            if ($custom != '0' && $customtitle != '') {
272
-                $title = $customtitle;
273
-            }
274
-            $arr[] = array(
275
-                'dtypeid'     => $dtypeid,
276
-                'title'       => $title,
277
-                'section'     => $section,
278
-                'icon'        => $iconurl,
279
-                'ftypeid'     => $ftypeid,
280
-                'fieldtype'   => $fieldtype,
281
-                'ext'         => $ext,
282
-                'options'     => $options,
283
-                'custom'      => $custom,
284
-                'itemid'      => $itemid,
285
-                'value'       => $fieldvalue,
286
-                'customtitle' => $customtitle
287
-            );
288
-        }
245
+	public function getDataTypes($itemid)
246
+	{
247
+		global $datafieldmanager;
248
+		$sql     = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle ';
249
+		$sql     .= 'FROM '
250
+					. $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
251
+					. ' ic, '
252
+					. $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat')
253
+					. ' xc, '
254
+					. $this->db->prefix($module->getVar('dirname', 'n') . '_fieldtypes')
255
+					. ' f, '
256
+					. $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes')
257
+					. ' t ';
258
+		$sql     .= 'LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . (int)$itemid . ') ';
259
+		$sql     .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . (int)$itemid . ' ORDER BY t.seq ASC';
260
+		$result  = $this->db->query($sql);
261
+		$numrows = $this->db->getRowsNum($result);
262
+		//$arr = $this->db->fetchArray($result);
263
+		$arr = array();
264
+		while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $itemid, $value, $customtitle) = $this->db->fetchRow($result)) {
265
+			$fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value);
266
+			if ($icon != '') {
267
+				$iconurl = "<img src=\"uploads/$icon\">";
268
+			} else {
269
+				$iconurl = '';
270
+			}
271
+			if ($custom != '0' && $customtitle != '') {
272
+				$title = $customtitle;
273
+			}
274
+			$arr[] = array(
275
+				'dtypeid'     => $dtypeid,
276
+				'title'       => $title,
277
+				'section'     => $section,
278
+				'icon'        => $iconurl,
279
+				'ftypeid'     => $ftypeid,
280
+				'fieldtype'   => $fieldtype,
281
+				'ext'         => $ext,
282
+				'options'     => $options,
283
+				'custom'      => $custom,
284
+				'itemid'      => $itemid,
285
+				'value'       => $fieldvalue,
286
+				'customtitle' => $customtitle
287
+			);
288
+		}
289 289
 
290
-        return $arr;
291
-    }
290
+		return $arr;
291
+	}
292 292
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function updateStatus($itemid = 0, $newstatus = '1')
153 153
     {
154
-        $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' SET status = ' . $newstatus . ' WHERE itemid = ' . (int)$itemid . '';
154
+        $sql = 'UPDATE '.$this->db->prefix($module->getVar('dirname', 'n').'_items').' SET status = '.$newstatus.' WHERE itemid = '.(int) $itemid.'';
155 155
         if ($this->db->query($sql)) {
156 156
             return true;
157 157
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function incrementHits($itemid = 0)
173 173
     {
174
-        $sql = sprintf('UPDATE %s SET hits = hits+1 WHERE itemid = %u AND STATUS = 2', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), (int)$itemid);
174
+        $sql = sprintf('UPDATE %s SET hits = hits+1 WHERE itemid = %u AND STATUS = 2', $this->db->prefix($module->getVar('dirname', 'n').'_items'), (int) $itemid);
175 175
         if ($this->db->queryF($sql)) {
176 176
             return true;
177 177
         }
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function getLinkedCatsArray($itemid = '0', $dirid = '0')
193 193
     {
194
-        $sql     = 'SELECT c.cid, x.active FROM '
195
-                   . $this->db->prefix($module->getVar('dirname', 'n') . '_cat')
194
+        $sql = 'SELECT c.cid, x.active FROM '
195
+                   . $this->db->prefix($module->getVar('dirname', 'n').'_cat')
196 196
                    . ' c, '
197
-                   . $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
197
+                   . $this->db->prefix($module->getVar('dirname', 'n').'_item_x_cat')
198 198
                    . ' x WHERE c.cid=x.cid AND x.itemid='
199
-                   . (int)$itemid
199
+                   . (int) $itemid
200 200
                    . " AND c.dirid='"
201
-                   . (int)$dirid
201
+                   . (int) $dirid
202 202
                    . '\' AND c.active=\'1\'';
203 203
         $result  = $this->db->query($sql);
204 204
         $numrows = $this->db->getRowsNum($result);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function getListing($itemid)
227 227
     {
228
-        $sql    = 'SELECT i.*, t.description FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' i LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_item_text') . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' . (int)$itemid;
228
+        $sql    = 'SELECT i.*, t.description FROM '.$this->db->prefix($module->getVar('dirname', 'n').'_items').' i LEFT JOIN '.$this->db->prefix($module->getVar('dirname', 'n').'_item_text').' t ON (i.itemid=t.itemid) WHERE i.itemid='.(int) $itemid;
229 229
         $result = $this->db->query($sql);
230 230
         $arr    = array();
231 231
         if (!$result) {
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
     public function getDataTypes($itemid)
246 246
     {
247 247
         global $datafieldmanager;
248
-        $sql     = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle ';
249
-        $sql     .= 'FROM '
250
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_item_x_cat')
248
+        $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle ';
249
+        $sql .= 'FROM '
250
+                    . $this->db->prefix($module->getVar('dirname', 'n').'_item_x_cat')
251 251
                     . ' ic, '
252
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat')
252
+                    . $this->db->prefix($module->getVar('dirname', 'n').'_dtypes_x_cat')
253 253
                     . ' xc, '
254
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_fieldtypes')
254
+                    . $this->db->prefix($module->getVar('dirname', 'n').'_fieldtypes')
255 255
                     . ' f, '
256
-                    . $this->db->prefix($module->getVar('dirname', 'n') . '_dtypes')
256
+                    . $this->db->prefix($module->getVar('dirname', 'n').'_dtypes')
257 257
                     . ' t ';
258
-        $sql     .= 'LEFT JOIN ' . $this->db->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . (int)$itemid . ') ';
259
-        $sql     .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . (int)$itemid . ' ORDER BY t.seq ASC';
258
+        $sql     .= 'LEFT JOIN '.$this->db->prefix($module->getVar('dirname', 'n').'_data').' d ON (t.dtypeid=d.dtypeid AND d.itemid='.(int) $itemid.') ';
259
+        $sql     .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=".(int) $itemid.' ORDER BY t.seq ASC';
260 260
         $result  = $this->db->query($sql);
261 261
         $numrows = $this->db->getRowsNum($result);
262 262
         //$arr = $this->db->fetchArray($result);
Please login to merge, or discard this patch.
class/class.image.php 2 patches
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class XoopsImage extends XoopsObject
30 30
 {
31
-    /**
32
-     * Constructor
33
-     **/
34
-    public function __construct()
35
-    {
36
-        parent::__construct();
37
-        $this->initVar('image_id', XOBJ_DTYPE_INT, null, false);
38
-        $this->initVar('image_name', XOBJ_DTYPE_OTHER, null, false, 30);
39
-        $this->initVar('image_nicename', XOBJ_DTYPE_TXTBOX, null, true, 100);
40
-        $this->initVar('image_mimetype', XOBJ_DTYPE_OTHER, null, false);
41
-        $this->initVar('image_created', XOBJ_DTYPE_INT, null, false);
42
-        $this->initVar('image_display', XOBJ_DTYPE_INT, 1, false);
43
-        $this->initVar('image_weight', XOBJ_DTYPE_INT, 0, false);
44
-        $this->initVar('image_body', XOBJ_DTYPE_SOURCE, null, true);
45
-        $this->initVar('imgcat_id', XOBJ_DTYPE_INT, 0, false);
46
-    }
31
+	/**
32
+	 * Constructor
33
+	 **/
34
+	public function __construct()
35
+	{
36
+		parent::__construct();
37
+		$this->initVar('image_id', XOBJ_DTYPE_INT, null, false);
38
+		$this->initVar('image_name', XOBJ_DTYPE_OTHER, null, false, 30);
39
+		$this->initVar('image_nicename', XOBJ_DTYPE_TXTBOX, null, true, 100);
40
+		$this->initVar('image_mimetype', XOBJ_DTYPE_OTHER, null, false);
41
+		$this->initVar('image_created', XOBJ_DTYPE_INT, null, false);
42
+		$this->initVar('image_display', XOBJ_DTYPE_INT, 1, false);
43
+		$this->initVar('image_weight', XOBJ_DTYPE_INT, 0, false);
44
+		$this->initVar('image_body', XOBJ_DTYPE_SOURCE, null, true);
45
+		$this->initVar('imgcat_id', XOBJ_DTYPE_INT, 0, false);
46
+	}
47 47
 }
48 48
 
49 49
 /**
@@ -59,57 +59,57 @@  discard block
 block discarded – undo
59 59
  */
60 60
 class XoopsImageHandler extends XoopsObjectHandler
61 61
 {
62
-    /**
63
-     * Create a new {@link XoopsImage}
64
-     *
65
-     * @param   boolean $isNew Flag the object as "new"
66
-     * @return  XoopsImage
67
-     **/
68
-    public function &create($isNew = true)
69
-    {
70
-        $image = new XoopsImage();
71
-        if ($isNew) {
72
-            $image->setNew();
73
-        }
74
-
75
-        return $image;
76
-    }
77
-
78
-    /**
79
-     * Write a {@link XoopsImage} object to the database
80
-     *
81
-     * @param XoopsObject $image
82
-     * @param string             $itemid
83
-     * @return bool
84
-     */
85
-    public function insert(XoopsObject $image, $itemid = '0')
86
-    {
87
-        global $image_name;
88
-        if ($itemid == '0') {
89
-            return false;
90
-        }
91
-        //if (strtolower(get_class($image)) != 'xoopsimage') {
92
-        //    return false;
93
-        //}
94
-        if (!$image->isDirty()) {
95
-            return true;
96
-        }
97
-        if (!$image->cleanVars()) {
98
-            return false;
99
-        }
100
-        foreach ($image->cleanVars as $k => $v) {
101
-            ${$k} = $v;
102
-        }
103
-        if ($image->isNew()) {
104
-            $image_id = $this->db->genId('image_image_id_seq');
105
-            $sql      = sprintf('INSERT INTO %s WHERE itemid=' . $itemid . ' (logourl) VALUES (%s)', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
106
-            if (!$result = $this->db->query($sql)) {
107
-                return false;
108
-            }
109
-            if (empty($image_id)) {
110
-                $image_id = $this->db->getInsertId();
111
-            }
112
-            /*             if (isset($image_body) && $image_body != '') {
62
+	/**
63
+	 * Create a new {@link XoopsImage}
64
+	 *
65
+	 * @param   boolean $isNew Flag the object as "new"
66
+	 * @return  XoopsImage
67
+	 **/
68
+	public function &create($isNew = true)
69
+	{
70
+		$image = new XoopsImage();
71
+		if ($isNew) {
72
+			$image->setNew();
73
+		}
74
+
75
+		return $image;
76
+	}
77
+
78
+	/**
79
+	 * Write a {@link XoopsImage} object to the database
80
+	 *
81
+	 * @param XoopsObject $image
82
+	 * @param string             $itemid
83
+	 * @return bool
84
+	 */
85
+	public function insert(XoopsObject $image, $itemid = '0')
86
+	{
87
+		global $image_name;
88
+		if ($itemid == '0') {
89
+			return false;
90
+		}
91
+		//if (strtolower(get_class($image)) != 'xoopsimage') {
92
+		//    return false;
93
+		//}
94
+		if (!$image->isDirty()) {
95
+			return true;
96
+		}
97
+		if (!$image->cleanVars()) {
98
+			return false;
99
+		}
100
+		foreach ($image->cleanVars as $k => $v) {
101
+			${$k} = $v;
102
+		}
103
+		if ($image->isNew()) {
104
+			$image_id = $this->db->genId('image_image_id_seq');
105
+			$sql      = sprintf('INSERT INTO %s WHERE itemid=' . $itemid . ' (logourl) VALUES (%s)', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
106
+			if (!$result = $this->db->query($sql)) {
107
+				return false;
108
+			}
109
+			if (empty($image_id)) {
110
+				$image_id = $this->db->getInsertId();
111
+			}
112
+			/*             if (isset($image_body) && $image_body != '') {
113 113
             $sql = sprintf("INSERT INTO %s (image_id, image_body) VALUES (%u, %s)", $this->db->prefix('imagebody'), $image_id, $this->db->quoteString($image_body));
114 114
             if (!$result = $this->db->query($sql)) {
115 115
             $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $image_id);
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
             return false;
119 119
             }
120 120
             } */
121
-            /* $image->assignVar('image_id', $image_id); */
122
-        } else {
123
-            $sql = sprintf('UPDATE %s SET image_name = %s WHERE itemid = %u', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
124
-            if (!$result = $this->db->query($sql)) {
125
-                return false;
126
-            }
127
-            /*             if (isset($image_body) && $image_body != '') {
121
+			/* $image->assignVar('image_id', $image_id); */
122
+		} else {
123
+			$sql = sprintf('UPDATE %s SET image_name = %s WHERE itemid = %u', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
124
+			if (!$result = $this->db->query($sql)) {
125
+				return false;
126
+			}
127
+			/*             if (isset($image_body) && $image_body != '') {
128 128
             $sql = sprintf("UPDATE %s SET image_body = %s WHERE image_id = %u", $this->db->prefix('imagebody'), $this->db->quoteString($image_body), $image_id);
129 129
             if (!$result = $this->db->query($sql)) {
130 130
             $this->db->query(sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $image_id));
@@ -132,114 +132,114 @@  discard block
 block discarded – undo
132 132
             return false;
133 133
             }
134 134
             } */
135
-        }
136
-
137
-        return true;
138
-    }
139
-
140
-    /**
141
-     * Delete an image from the database
142
-     *
143
-     * @param XoopsObject $image
144
-     * @return bool
145
-     */
146
-    public function delete(XoopsObject $image)
147
-    {
148
-        if (strtolower(get_class($image)) !== 'xoopsimage') {
149
-            return false;
150
-        }
151
-        $id  = $image->getVar('image_id');
152
-        $sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('image'), $id);
153
-        if (!$result = $this->db->query($sql)) {
154
-            return false;
155
-        }
156
-        $sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('imagebody'), $id);
157
-        $this->db->query($sql);
158
-
159
-        return true;
160
-    }
161
-
162
-    /**
163
-     * Load {@link XoopsImage}s from the database
164
-     *
165
-     * @param   $criteria  {@link CriteriaElement}
166
-     * @param   boolean $id_as_key Use the ID as key into the array
167
-     * @param   boolean $getbinary
168
-     * @return  array   Array of {@link XoopsImage} objects
169
-     **/
170
-    public function &getObjects(CriteriaElement $criteria = null, $id_as_key = false, $getbinary = false)
171
-    {
172
-        $ret   = array();
173
-        $limit = $start = 0;
174
-        if ($getbinary) {
175
-            $sql = 'SELECT i.*, b.image_body FROM ' . $this->db->prefix('image') . ' i LEFT JOIN ' . $this->db->prefix('imagebody') . ' b ON b.image_id=i.image_id';
176
-        } else {
177
-            $sql = 'SELECT * FROM ' . $this->db->prefix('image');
178
-        }
179
-        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
180
-            $sql   .= ' ' . $criteria->renderWhere();
181
-            $sort  = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort();
182
-            $sql   .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
183
-            $limit = $criteria->getLimit();
184
-            $start = $criteria->getStart();
185
-        }
186
-        $result = $this->db->query($sql, $limit, $start);
187
-        if (!$result) {
188
-            return $ret;
189
-        }
190
-        while ($myrow = $this->db->fetchArray($result)) {
191
-            $image = new XoopsImage();
192
-            $image->assignVars($myrow);
193
-            if (!$id_as_key) {
194
-                $ret[] =& $image;
195
-            } else {
196
-                $ret[$myrow['image_id']] =& $image;
197
-            }
198
-            unset($image);
199
-        }
200
-
201
-        return $ret;
202
-    }
203
-
204
-    /**
205
-     * Count some images
206
-     *
207
-     * @param   $criteria {@link CriteriaElement}
208
-     * @return  int
209
-     **/
210
-    public function getCount(CriteriaElement $criteria = null)
211
-    {
212
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('image');
213
-        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
214
-            $sql .= ' ' . $criteria->renderWhere();
215
-        }
216
-        if (!$result = $this->db->query($sql)) {
217
-            return 0;
218
-        }
219
-        list($count) = $this->db->fetchRow($result);
220
-
221
-        return $count;
222
-    }
223
-
224
-    /**
225
-     * Get a list of images
226
-     *
227
-     * @param   int  $imgcat_id
228
-     * @param   bool $image_display
229
-     * @return  array   Array of {@link XoopsImage} objects
230
-     **/
231
-    public function &getList($imgcat_id, $image_display = null)
232
-    {
233
-        $criteria = new CriteriaCompo(new Criteria('imgcat_id', (int)$imgcat_id));
234
-        if (isset($image_display)) {
235
-            $criteria->add(new Criteria('image_display', (int)$image_display));
236
-        }
237
-        $images = $this->getObjects($criteria, false, true);
238
-        $ret    = array();
239
-        foreach (array_keys($images) as $i) {
240
-            $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename');
241
-        }
242
-
243
-        return $ret;
244
-    }
135
+		}
136
+
137
+		return true;
138
+	}
139
+
140
+	/**
141
+	 * Delete an image from the database
142
+	 *
143
+	 * @param XoopsObject $image
144
+	 * @return bool
145
+	 */
146
+	public function delete(XoopsObject $image)
147
+	{
148
+		if (strtolower(get_class($image)) !== 'xoopsimage') {
149
+			return false;
150
+		}
151
+		$id  = $image->getVar('image_id');
152
+		$sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('image'), $id);
153
+		if (!$result = $this->db->query($sql)) {
154
+			return false;
155
+		}
156
+		$sql = sprintf('DELETE FROM %s WHERE image_id = %u', $this->db->prefix('imagebody'), $id);
157
+		$this->db->query($sql);
158
+
159
+		return true;
160
+	}
161
+
162
+	/**
163
+	 * Load {@link XoopsImage}s from the database
164
+	 *
165
+	 * @param   $criteria  {@link CriteriaElement}
166
+	 * @param   boolean $id_as_key Use the ID as key into the array
167
+	 * @param   boolean $getbinary
168
+	 * @return  array   Array of {@link XoopsImage} objects
169
+	 **/
170
+	public function &getObjects(CriteriaElement $criteria = null, $id_as_key = false, $getbinary = false)
171
+	{
172
+		$ret   = array();
173
+		$limit = $start = 0;
174
+		if ($getbinary) {
175
+			$sql = 'SELECT i.*, b.image_body FROM ' . $this->db->prefix('image') . ' i LEFT JOIN ' . $this->db->prefix('imagebody') . ' b ON b.image_id=i.image_id';
176
+		} else {
177
+			$sql = 'SELECT * FROM ' . $this->db->prefix('image');
178
+		}
179
+		if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
180
+			$sql   .= ' ' . $criteria->renderWhere();
181
+			$sort  = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort();
182
+			$sql   .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
183
+			$limit = $criteria->getLimit();
184
+			$start = $criteria->getStart();
185
+		}
186
+		$result = $this->db->query($sql, $limit, $start);
187
+		if (!$result) {
188
+			return $ret;
189
+		}
190
+		while ($myrow = $this->db->fetchArray($result)) {
191
+			$image = new XoopsImage();
192
+			$image->assignVars($myrow);
193
+			if (!$id_as_key) {
194
+				$ret[] =& $image;
195
+			} else {
196
+				$ret[$myrow['image_id']] =& $image;
197
+			}
198
+			unset($image);
199
+		}
200
+
201
+		return $ret;
202
+	}
203
+
204
+	/**
205
+	 * Count some images
206
+	 *
207
+	 * @param   $criteria {@link CriteriaElement}
208
+	 * @return  int
209
+	 **/
210
+	public function getCount(CriteriaElement $criteria = null)
211
+	{
212
+		$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('image');
213
+		if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
214
+			$sql .= ' ' . $criteria->renderWhere();
215
+		}
216
+		if (!$result = $this->db->query($sql)) {
217
+			return 0;
218
+		}
219
+		list($count) = $this->db->fetchRow($result);
220
+
221
+		return $count;
222
+	}
223
+
224
+	/**
225
+	 * Get a list of images
226
+	 *
227
+	 * @param   int  $imgcat_id
228
+	 * @param   bool $image_display
229
+	 * @return  array   Array of {@link XoopsImage} objects
230
+	 **/
231
+	public function &getList($imgcat_id, $image_display = null)
232
+	{
233
+		$criteria = new CriteriaCompo(new Criteria('imgcat_id', (int)$imgcat_id));
234
+		if (isset($image_display)) {
235
+			$criteria->add(new Criteria('image_display', (int)$image_display));
236
+		}
237
+		$images = $this->getObjects($criteria, false, true);
238
+		$ret    = array();
239
+		foreach (array_keys($images) as $i) {
240
+			$ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename');
241
+		}
242
+
243
+		return $ret;
244
+	}
245 245
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         }
103 103
         if ($image->isNew()) {
104 104
             $image_id = $this->db->genId('image_image_id_seq');
105
-            $sql      = sprintf('INSERT INTO %s WHERE itemid=' . $itemid . ' (logourl) VALUES (%s)', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
105
+            $sql      = sprintf('INSERT INTO %s WHERE itemid='.$itemid.' (logourl) VALUES (%s)', $this->db->prefix($module->getVar('dirname', 'n').'_items'), $this->db->quoteString($image_name));
106 106
             if (!$result = $this->db->query($sql)) {
107 107
                 return false;
108 108
             }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             } */
121 121
             /* $image->assignVar('image_id', $image_id); */
122 122
         } else {
123
-            $sql = sprintf('UPDATE %s SET image_name = %s WHERE itemid = %u', $this->db->prefix($module->getVar('dirname', 'n') . '_items'), $this->db->quoteString($image_name));
123
+            $sql = sprintf('UPDATE %s SET image_name = %s WHERE itemid = %u', $this->db->prefix($module->getVar('dirname', 'n').'_items'), $this->db->quoteString($image_name));
124 124
             if (!$result = $this->db->query($sql)) {
125 125
                 return false;
126 126
             }
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
         $ret   = array();
173 173
         $limit = $start = 0;
174 174
         if ($getbinary) {
175
-            $sql = 'SELECT i.*, b.image_body FROM ' . $this->db->prefix('image') . ' i LEFT JOIN ' . $this->db->prefix('imagebody') . ' b ON b.image_id=i.image_id';
175
+            $sql = 'SELECT i.*, b.image_body FROM '.$this->db->prefix('image').' i LEFT JOIN '.$this->db->prefix('imagebody').' b ON b.image_id=i.image_id';
176 176
         } else {
177
-            $sql = 'SELECT * FROM ' . $this->db->prefix('image');
177
+            $sql = 'SELECT * FROM '.$this->db->prefix('image');
178 178
         }
179 179
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
180
-            $sql   .= ' ' . $criteria->renderWhere();
180
+            $sql   .= ' '.$criteria->renderWhere();
181 181
             $sort  = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort();
182
-            $sql   .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
182
+            $sql   .= ' ORDER BY '.$sort.' '.$criteria->getOrder();
183 183
             $limit = $criteria->getLimit();
184 184
             $start = $criteria->getStart();
185 185
         }
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
             $image = new XoopsImage();
192 192
             $image->assignVars($myrow);
193 193
             if (!$id_as_key) {
194
-                $ret[] =& $image;
194
+                $ret[] = & $image;
195 195
             } else {
196
-                $ret[$myrow['image_id']] =& $image;
196
+                $ret[$myrow['image_id']] = & $image;
197 197
             }
198 198
             unset($image);
199 199
         }
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
      **/
210 210
     public function getCount(CriteriaElement $criteria = null)
211 211
     {
212
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('image');
212
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('image');
213 213
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
214
-            $sql .= ' ' . $criteria->renderWhere();
214
+            $sql .= ' '.$criteria->renderWhere();
215 215
         }
216 216
         if (!$result = $this->db->query($sql)) {
217 217
             return 0;
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
      **/
231 231
     public function &getList($imgcat_id, $image_display = null)
232 232
     {
233
-        $criteria = new CriteriaCompo(new Criteria('imgcat_id', (int)$imgcat_id));
233
+        $criteria = new CriteriaCompo(new Criteria('imgcat_id', (int) $imgcat_id));
234 234
         if (isset($image_display)) {
235
-            $criteria->add(new Criteria('image_display', (int)$image_display));
235
+            $criteria->add(new Criteria('image_display', (int) $image_display));
236 236
         }
237 237
         $images = $this->getObjects($criteria, false, true);
238 238
         $ret    = array();
Please login to merge, or discard this patch.
class/class.offer.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -44,29 +44,29 @@  discard block
 block discarded – undo
44 44
 class efqSubscriptionOffer extends XoopsObject
45 45
 {
46 46
 
47
-    /**
48
-     * efqSubscriptionOffer::efqSubscriptionOffer()
49
-     *
50
-     * @param bool $offer
51
-     * @internal param bool $itemtype
52
-     */
53
-    public function __construct($offer = false)
54
-    {
55
-        global $moddir;
56
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
57
-        $this->initVar('offerid', XOBJ_DTYPE_INT, 0, false);
58
-        $this->initVar('dirid', XOBJ_DTYPE_INT, 0, false);
59
-        $this->initVar('typeid', XOBJ_DTYPE_INT, 0, false);
60
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255);
61
-        $this->initVar('duration', XOBJ_DTYPE_INT, 0, true, 5);
62
-        $this->initVar('count', XOBJ_DTYPE_INT, 0, true, 5);
63
-        $this->initVar('price', XOBJ_DTYPE_CURRENCY, 0.00, true);
64
-        $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2);
65
-        $this->initVar('currency', XOBJ_DTYPE_TXTBOX, null, false, 10);
66
-        $this->initVar('descr', XOBJ_DTYPE_OTHER, 0);
67
-        $this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50);
68
-        $this->initVar('level', XOBJ_DTYPE_INT, null, false, 10);
69
-    }
47
+	/**
48
+	 * efqSubscriptionOffer::efqSubscriptionOffer()
49
+	 *
50
+	 * @param bool $offer
51
+	 * @internal param bool $itemtype
52
+	 */
53
+	public function __construct($offer = false)
54
+	{
55
+		global $moddir;
56
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
57
+		$this->initVar('offerid', XOBJ_DTYPE_INT, 0, false);
58
+		$this->initVar('dirid', XOBJ_DTYPE_INT, 0, false);
59
+		$this->initVar('typeid', XOBJ_DTYPE_INT, 0, false);
60
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255);
61
+		$this->initVar('duration', XOBJ_DTYPE_INT, 0, true, 5);
62
+		$this->initVar('count', XOBJ_DTYPE_INT, 0, true, 5);
63
+		$this->initVar('price', XOBJ_DTYPE_CURRENCY, 0.00, true);
64
+		$this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2);
65
+		$this->initVar('currency', XOBJ_DTYPE_TXTBOX, null, false, 10);
66
+		$this->initVar('descr', XOBJ_DTYPE_OTHER, 0);
67
+		$this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50);
68
+		$this->initVar('level', XOBJ_DTYPE_INT, null, false, 10);
69
+	}
70 70
 }
71 71
 
72 72
 /**
@@ -81,180 +81,180 @@  discard block
 block discarded – undo
81 81
 class efqSubscriptionOfferHandler extends xoopsObjectHandler
82 82
 {
83 83
 //    public $db; //Database reference
84
-    public $objOffer; // reference to object
84
+	public $objOffer; // reference to object
85 85
 
86
-    /**
87
-     * efqSubscriptionOfferHandler::efqItemTypeHandler()
88
-     *
89
-     * @param bool $offer
90
-     */
91
-    public function __construct($offer = false)
92
-    {
93
-        $this->db       = XoopsDatabaseFactory::getDatabaseConnection();
94
-        $this->objOffer = $offer;
95
-    }
86
+	/**
87
+	 * efqSubscriptionOfferHandler::efqItemTypeHandler()
88
+	 *
89
+	 * @param bool $offer
90
+	 */
91
+	public function __construct($offer = false)
92
+	{
93
+		$this->db       = XoopsDatabaseFactory::getDatabaseConnection();
94
+		$this->objOffer = $offer;
95
+	}
96 96
 
97
-    /**
98
-     * Function insertOffer inserts Subscripion offer into DB
99
-     * @author    EFQ Consultancy <[email protected]>
100
-     * @copyright EFQ Consultancy (c) 2008
101
-     * @version   1.0.0
102
-     *
103
-     * @param   efqSubscriptionOffer $obj object
104
-     *
105
-     * @param bool     $forceQuery
106
-     * @return bool true if insertion is succesful, false if unsuccesful
107
-     */
108
-    public function insertOffer($obj, $forceQuery = false)
109
-    {
110
-        $tablename    = 'efqdiralpha1_subscr_offers';
111
-        $keyName      = 'offerid';
112
-        $excludedVars = array('level', 'typename');
113
-        if ($obj instanceof efqSubscriptionOffer) {
114
-            // Variable part of this function ends. From this line you can copy
115
-            // this function for similar object handling functions.
116
-            $obj->cleanVars();
117
-            $cleanvars = $obj->cleanVars;
118
-        } else {
119
-            return false;
120
-        }
121
-        $countVars = count($cleanvars);
122
-        $i         = 1;
123
-        $strFields = '';
124
-        $strValues = '';
125
-        foreach ($cleanvars as $k => $v) {
126
-            if (!in_array($k, $excludedVars)) {
127
-                $strFields .= $k;
128
-                $strValues .= "'" . $v . "'";
129
-                if ($i < $countVars) {
130
-                    $strFields .= ', ';
131
-                    $strValues .= ', ';
132
-                }
133
-                $i++;
134
-            }
135
-        }
136
-        $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
137
-        if ($forceQuery) {
138
-            if ($this->db->queryF($sql)) {
139
-                $itemid = $this->db->getInsertId();
140
-                $obj->setVar($keyName, $itemid);
97
+	/**
98
+	 * Function insertOffer inserts Subscripion offer into DB
99
+	 * @author    EFQ Consultancy <[email protected]>
100
+	 * @copyright EFQ Consultancy (c) 2008
101
+	 * @version   1.0.0
102
+	 *
103
+	 * @param   efqSubscriptionOffer $obj object
104
+	 *
105
+	 * @param bool     $forceQuery
106
+	 * @return bool true if insertion is succesful, false if unsuccesful
107
+	 */
108
+	public function insertOffer($obj, $forceQuery = false)
109
+	{
110
+		$tablename    = 'efqdiralpha1_subscr_offers';
111
+		$keyName      = 'offerid';
112
+		$excludedVars = array('level', 'typename');
113
+		if ($obj instanceof efqSubscriptionOffer) {
114
+			// Variable part of this function ends. From this line you can copy
115
+			// this function for similar object handling functions.
116
+			$obj->cleanVars();
117
+			$cleanvars = $obj->cleanVars;
118
+		} else {
119
+			return false;
120
+		}
121
+		$countVars = count($cleanvars);
122
+		$i         = 1;
123
+		$strFields = '';
124
+		$strValues = '';
125
+		foreach ($cleanvars as $k => $v) {
126
+			if (!in_array($k, $excludedVars)) {
127
+				$strFields .= $k;
128
+				$strValues .= "'" . $v . "'";
129
+				if ($i < $countVars) {
130
+					$strFields .= ', ';
131
+					$strValues .= ', ';
132
+				}
133
+				$i++;
134
+			}
135
+		}
136
+		$sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
137
+		if ($forceQuery) {
138
+			if ($this->db->queryF($sql)) {
139
+				$itemid = $this->db->getInsertId();
140
+				$obj->setVar($keyName, $itemid);
141 141
 
142
-                return true;
143
-            }
144
-        } else {
145
-            if ($this->db->query($sql)) {
146
-                $itemid = $this->db->getInsertId();
147
-                $obj->setVar($keyName, $itemid);
142
+				return true;
143
+			}
144
+		} else {
145
+			if ($this->db->query($sql)) {
146
+				$itemid = $this->db->getInsertId();
147
+				$obj->setVar($keyName, $itemid);
148 148
 
149
-                return true;
150
-            }
151
-        }
149
+				return true;
150
+			}
151
+		}
152 152
 
153
-        return false;
154
-    }
153
+		return false;
154
+	}
155 155
 
156
-    /**
157
-     * Function updateOffer updates subscription offer
158
-     * @author    EFQ Consultancy <[email protected]>
159
-     * @copyright EFQ Consultancy (c) 2008
160
-     * @version   1.0.0
161
-     *
162
-     * @param      $obj
163
-     * @param bool $forceQuery
164
-     * @return bool true if update is succesful, false if unsuccesful
165
-     * @internal  param object $objOffer object of type listing
166
-     */
167
-    public function updateOffer($obj, $forceQuery = false)
168
-    {
169
-        $tablename    = 'efqdiralpha1_subscr_offers';
170
-        $keyName      = 'offerid';
171
-        $excludedVars = array('level', 'typename');
172
-        if ($obj instanceof efqSubscriptionOffer) {
173
-            // Variable part of this function ends. From this line you can copy
174
-            // this function for similar object handling functions.
175
-            $obj->cleanVars();
176
-            $cleanvars = $obj->cleanVars;
177
-            $keyValue  = $obj->getVar($keyName);
178
-        } else {
179
-            return false;
180
-        }
181
-        $countVars = count($cleanvars);
182
-        $i         = 1;
183
-        $strSet    = '';
184
-        $strValues = '';
185
-        foreach ($cleanvars as $k => $v) {
186
-            if (!in_array($k, $excludedVars)) {
187
-                if ($i < $countVars and $i > 1) {
188
-                    $strSet .= ', ';
189
-                }
190
-                $strSet .= $k . '=' . "'" . $v . "'";
191
-            }
192
-            $i++;
193
-        }
194
-        $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue);
195
-        if ($forceQuery) {
196
-            if ($this->db->queryF($sql)) {
197
-                return true;
198
-            }
199
-        } else {
200
-            if ($this->db->query($sql)) {
201
-                return true;
202
-            }
203
-        }
156
+	/**
157
+	 * Function updateOffer updates subscription offer
158
+	 * @author    EFQ Consultancy <[email protected]>
159
+	 * @copyright EFQ Consultancy (c) 2008
160
+	 * @version   1.0.0
161
+	 *
162
+	 * @param      $obj
163
+	 * @param bool $forceQuery
164
+	 * @return bool true if update is succesful, false if unsuccesful
165
+	 * @internal  param object $objOffer object of type listing
166
+	 */
167
+	public function updateOffer($obj, $forceQuery = false)
168
+	{
169
+		$tablename    = 'efqdiralpha1_subscr_offers';
170
+		$keyName      = 'offerid';
171
+		$excludedVars = array('level', 'typename');
172
+		if ($obj instanceof efqSubscriptionOffer) {
173
+			// Variable part of this function ends. From this line you can copy
174
+			// this function for similar object handling functions.
175
+			$obj->cleanVars();
176
+			$cleanvars = $obj->cleanVars;
177
+			$keyValue  = $obj->getVar($keyName);
178
+		} else {
179
+			return false;
180
+		}
181
+		$countVars = count($cleanvars);
182
+		$i         = 1;
183
+		$strSet    = '';
184
+		$strValues = '';
185
+		foreach ($cleanvars as $k => $v) {
186
+			if (!in_array($k, $excludedVars)) {
187
+				if ($i < $countVars and $i > 1) {
188
+					$strSet .= ', ';
189
+				}
190
+				$strSet .= $k . '=' . "'" . $v . "'";
191
+			}
192
+			$i++;
193
+		}
194
+		$sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue);
195
+		if ($forceQuery) {
196
+			if ($this->db->queryF($sql)) {
197
+				return true;
198
+			}
199
+		} else {
200
+			if ($this->db->query($sql)) {
201
+				return true;
202
+			}
203
+		}
204 204
 
205
-        return false;
206
-    }
205
+		return false;
206
+	}
207 207
 
208
-    /**
209
-     * efqSubscriptionOfferHandler::setOffer()
210
-     *
211
-     * Sets the object created by class efqSubscriptionOffer with data from query
212
-     *
213
-     * @param int $gpc_offerid
214
-     * @return bool true or false
215
-     */
216
-    public function setOffer($gpc_offerid = 0)
217
-    {
218
-        $sql     = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, '
219
-                   . 'o.price, o.activeyn, o.currency, o.descr, o.dirid, t.typename, t.level FROM '
220
-                   . $this->db->prefix('efqdiralpha1_itemtypes')
221
-                   . ' t, '
222
-                   . $this->db->prefix('efqdiralpha1_subscr_offers')
223
-                   . ' o	WHERE o.typeid=t.typeid AND o.offerid='
224
-                   . (int)$gpc_offerid
225
-                   . '';
226
-        $result  = $this->db->query($sql);
227
-        $numrows = $this->db->getRowsNum($result);
228
-        if ($numrows > 0) {
229
-            while (list($offerid, $offertitle, $typeid, $duration, $count, $price, $activeyn, $currency, $descr, $dirid, $typename, $level) = $this->db->fetchRow($result)) {
230
-                if (!$this->objOffer) {
231
-                    $this->objOffer = new efqSubscriptionOffer();
232
-                }
233
-                $this->objOffer->setVar('offerid', $offerid);
234
-                $this->objOffer->setVar('title', $offertitle);
235
-                $this->objOffer->setVar('typeid', $typeid);
236
-                $this->objOffer->setVar('duration', $duration);
237
-                $this->objOffer->setVar('count', $count);
238
-                $this->objOffer->setVar('price', $price);
239
-                $this->objOffer->setVar('activeyn', $activeyn);
240
-                $this->objOffer->setVar('currency', $currency);
241
-                $this->objOffer->setVar('descr', $descr);
242
-                $this->objOffer->setVar('dirid', $dirid);
243
-                $this->objOffer->setVar('typename', $typename);
244
-                $this->objOffer->setVar('level', $level);
245
-            }
246
-        } else {
247
-            return false;
248
-        }
208
+	/**
209
+	 * efqSubscriptionOfferHandler::setOffer()
210
+	 *
211
+	 * Sets the object created by class efqSubscriptionOffer with data from query
212
+	 *
213
+	 * @param int $gpc_offerid
214
+	 * @return bool true or false
215
+	 */
216
+	public function setOffer($gpc_offerid = 0)
217
+	{
218
+		$sql     = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, '
219
+				   . 'o.price, o.activeyn, o.currency, o.descr, o.dirid, t.typename, t.level FROM '
220
+				   . $this->db->prefix('efqdiralpha1_itemtypes')
221
+				   . ' t, '
222
+				   . $this->db->prefix('efqdiralpha1_subscr_offers')
223
+				   . ' o	WHERE o.typeid=t.typeid AND o.offerid='
224
+				   . (int)$gpc_offerid
225
+				   . '';
226
+		$result  = $this->db->query($sql);
227
+		$numrows = $this->db->getRowsNum($result);
228
+		if ($numrows > 0) {
229
+			while (list($offerid, $offertitle, $typeid, $duration, $count, $price, $activeyn, $currency, $descr, $dirid, $typename, $level) = $this->db->fetchRow($result)) {
230
+				if (!$this->objOffer) {
231
+					$this->objOffer = new efqSubscriptionOffer();
232
+				}
233
+				$this->objOffer->setVar('offerid', $offerid);
234
+				$this->objOffer->setVar('title', $offertitle);
235
+				$this->objOffer->setVar('typeid', $typeid);
236
+				$this->objOffer->setVar('duration', $duration);
237
+				$this->objOffer->setVar('count', $count);
238
+				$this->objOffer->setVar('price', $price);
239
+				$this->objOffer->setVar('activeyn', $activeyn);
240
+				$this->objOffer->setVar('currency', $currency);
241
+				$this->objOffer->setVar('descr', $descr);
242
+				$this->objOffer->setVar('dirid', $dirid);
243
+				$this->objOffer->setVar('typename', $typename);
244
+				$this->objOffer->setVar('level', $level);
245
+			}
246
+		} else {
247
+			return false;
248
+		}
249 249
 
250
-        return true;
251
-    }
250
+		return true;
251
+	}
252 252
 
253
-    /**
254
-     * @return bool
255
-     */
256
-    public function getOffer()
257
-    {
258
-        return $this->objOffer;
259
-    }
253
+	/**
254
+	 * @return bool
255
+	 */
256
+	public function getOffer()
257
+	{
258
+		return $this->objOffer;
259
+	}
260 260
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         foreach ($cleanvars as $k => $v) {
126 126
             if (!in_array($k, $excludedVars)) {
127 127
                 $strFields .= $k;
128
-                $strValues .= "'" . $v . "'";
128
+                $strValues .= "'".$v."'";
129 129
                 if ($i < $countVars) {
130 130
                     $strFields .= ', ';
131 131
                     $strValues .= ', ';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 if ($i < $countVars and $i > 1) {
188 188
                     $strSet .= ', ';
189 189
                 }
190
-                $strSet .= $k . '=' . "'" . $v . "'";
190
+                $strSet .= $k.'='."'".$v."'";
191 191
             }
192 192
             $i++;
193 193
         }
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function setOffer($gpc_offerid = 0)
217 217
     {
218
-        $sql     = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, '
218
+        $sql = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, '
219 219
                    . 'o.price, o.activeyn, o.currency, o.descr, o.dirid, t.typename, t.level FROM '
220 220
                    . $this->db->prefix('efqdiralpha1_itemtypes')
221 221
                    . ' t, '
222 222
                    . $this->db->prefix('efqdiralpha1_subscr_offers')
223 223
                    . ' o	WHERE o.typeid=t.typeid AND o.offerid='
224
-                   . (int)$gpc_offerid
224
+                   . (int) $gpc_offerid
225 225
                    . '';
226 226
         $result  = $this->db->query($sql);
227 227
         $numrows = $this->db->getRowsNum($result);
Please login to merge, or discard this patch.
class/class.datafieldmanager.php 2 patches
Indentation   +569 added lines, -569 removed lines patch added patch discarded remove patch
@@ -19,372 +19,372 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class efqDataFieldManager extends XoopsFormElement
21 21
 {
22
-    public $_options  = array();
23
-    public $_multiple = false;
24
-    public $_size;
22
+	public $_options  = array();
23
+	public $_multiple = false;
24
+	public $_size;
25 25
 
26
-    public $_height;
27
-    public $_width;
28
-    public $_src;
29
-    public $_value = array();
26
+	public $_height;
27
+	public $_width;
28
+	public $_src;
29
+	public $_value = array();
30 30
 
31
-    /**
32
-     * Constructor
33
-     */
34
-    public function __construct()
35
-    {
36
-    }
31
+	/**
32
+	 * Constructor
33
+	 */
34
+	public function __construct()
35
+	{
36
+	}
37 37
 
38
-    public function createField($title = '', $name = '', $fieldtype = '', $ext = '', $options = '', $value = '', $custom = '0', $customtitle = null)
39
-    {
40
-        global $form, $myts, $moddir;
41
-        if ($customtitle == null) {
42
-            $customtitle = '';
43
-        }
44
-        $multiple = false;
45
-        if ($ext != '') {
46
-            $ext_arr = explode('[|]', $ext);
47
-            foreach ($ext_arr as $ext_item) {
48
-                $ext_item_arr   = explode('[=]', $ext_item);
49
-                $ext_item_name  = $ext_item_arr[0];
50
-                $ext_item_value = $ext_item_arr[1];
38
+	public function createField($title = '', $name = '', $fieldtype = '', $ext = '', $options = '', $value = '', $custom = '0', $customtitle = null)
39
+	{
40
+		global $form, $myts, $moddir;
41
+		if ($customtitle == null) {
42
+			$customtitle = '';
43
+		}
44
+		$multiple = false;
45
+		if ($ext != '') {
46
+			$ext_arr = explode('[|]', $ext);
47
+			foreach ($ext_arr as $ext_item) {
48
+				$ext_item_arr   = explode('[=]', $ext_item);
49
+				$ext_item_name  = $ext_item_arr[0];
50
+				$ext_item_value = $ext_item_arr[1];
51 51
 
52
-                switch ($ext_item_name) {
53
-                    case 'cols':
54
-                        $cols = $ext_item_value;
55
-                        break;
56
-                    case 'rows':
57
-                        $rows = $ext_item_value;
58
-                        break;
59
-                    case 'size':
60
-                        $size = $ext_item_value;
61
-                        break;
62
-                    case 'maxsize':
63
-                        $maxsize = $ext_item_value;
64
-                        break;
65
-                    case 'multiple':
66
-                        $multiple = true;
67
-                        $size     = 5;
68
-                    case 'value':
69
-                        if ($ext_item_value != '' and $value == '') {
70
-                            $value = $ext_item_value;
71
-                        }
72
-                        break;
73
-                }
74
-            }
75
-        }
52
+				switch ($ext_item_name) {
53
+					case 'cols':
54
+						$cols = $ext_item_value;
55
+						break;
56
+					case 'rows':
57
+						$rows = $ext_item_value;
58
+						break;
59
+					case 'size':
60
+						$size = $ext_item_value;
61
+						break;
62
+					case 'maxsize':
63
+						$maxsize = $ext_item_value;
64
+						break;
65
+					case 'multiple':
66
+						$multiple = true;
67
+						$size     = 5;
68
+					case 'value':
69
+						if ($ext_item_value != '' and $value == '') {
70
+							$value = $ext_item_value;
71
+						}
72
+						break;
73
+				}
74
+			}
75
+		}
76 76
 
77
-        switch ($fieldtype) {
78
-            case 'textbox':
79
-                if ($custom == '1') {
80
-                    $form_text_tray = new XoopsFormElementTray($title, '', $name);
81
-                    $form_text_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
82
-                    $form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
83
-                    $form_text_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
84
-                    $form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $size, $maxsize, $value));
85
-                    $form_text_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
86
-                    $form->addElement($form_text_tray);
87
-                } else {
88
-                    $form->addElement(new XoopsFormText($title, $name, 50, 250, $myts->htmlSpecialChars($value)));
89
-                }
90
-                break;
91
-            case 'textarea':
92
-                if ($custom == '1') {
93
-                    $form_textarea_tray = new XoopsFormElementTray($title, '', $name);
94
-                    $form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
95
-                    $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
96
-                    $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
97
-                    $form_textarea_tray->addElement(new XoopsFormTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
98
-                    $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
99
-                    $form->addElement($form_textarea_tray);
100
-                } else {
101
-                    $form->addElement(new XoopsFormTextArea($title, $name, $value, $rows, $cols));
102
-                }
103
-                break;
104
-            case 'yesno':
105
-                $form->addElement(new XoopsFormRadioyn($title, $name, $value, _YES, _NO));
106
-                break;
107
-            case 'radio':
108
-                $options_arr = explode('[|]', $options);
109
-                $form_radio  = new XoopsFormRadio($title, $name, $value, 1);
110
-                foreach ($options_arr as $option) {
111
-                    $form_radio->addOption($option, $option);
112
-                }
113
-                $form->addElement($form_radio);
114
-                break;
115
-            case 'checkbox':
116
-                $options_arr   = explode('[|]', $options);
117
-                $form_checkbox = new XoopsFormCheckbox($title, $name, $value, 1);
118
-                foreach ($options_arr as $option) {
119
-                    $form_checkbox->addOption($option, $option);
120
-                }
121
-                $form->addElement($form_checkbox);
122
-                break;
123
-            case 'select':
124
-                $options_arr = explode('[|]', $options);
125
-                $value_arr   = explode('[|]', $value);
126
-                $form_select = new XoopsFormSelect($title, $name, $value, $size, $multiple);
127
-                $form_select->addOption('-', '----');
128
-                $form_select->setValue($value_arr);
129
-                foreach ($options_arr as $key => $option) {
130
-                    $form_select->addOption($option, $option);
131
-                }
132
-                $form->addElement($form_select);
133
-                break;
134
-            case 'dhtml':
135
-                if ($custom == '1') {
136
-                    $form_dhtmlarea_tray = new XoopsFormElementTray($title, '', $name);
137
-                    $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
138
-                    $form_dhtmlarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
139
-                    $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
140
-                    $form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
141
-                    $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
142
-                    $form->addElement($form_dhtmlarea_tray);
143
-                } else {
144
-                    $form->addElement(new XoopsFormDhtmlTextArea($title, $name, $value, $rows, $cols));
145
-                }
146
-                break;
147
-            case 'address':
148
-                //Query all address fields associated with the address type that belongs to the locid.
149
-                $addressfields = getAddressFields('0');
150
-                $addressvalues = getAddressValues($value);
151
-                $form->addElement(new XoopsFormLabel('', '<strong>' . $title . '</strong>'));
152
-                $fieldtitles = array(
153
-                    'address'  => _MD_DF_ADDRESS,
154
-                    'address2' => _MD_DF_ADDRESS2,
155
-                    'zip'      => _MD_DF_ZIP,
156
-                    'postcode' => _MD_DF_POSTCODE,
157
-                    'lat'      => _MD_DF_LAT,
158
-                    'lon'      => _MD_DF_LON,
159
-                    'phone'    => _MD_DF_PHONE,
160
-                    'fax'      => _MD_DF_FAX,
161
-                    'mobile'   => _MD_DF_MOBILE,
162
-                    'city'     => _MD_DF_CITY,
163
-                    'country'  => _MD_DF_COUNTRY,
164
-                    'typename' => _MD_DF_TYPENAME,
165
-                    'uselocyn' => _MD_DF_USELOCYN
166
-                );
167
-                foreach ($addressfields['addressfields'] as $field => $fieldvalue) {
168
-                    $storedvalue = $addressvalues["$field"];
169
-                    if ($fieldvalue == 1) {
170
-                        $title = $fieldtitles["$field"];
171
-                        $form->addElement(new XoopsFormText($title, $name . $field, 50, 250, $myts->htmlSpecialChars($storedvalue)));
172
-                    }
173
-                }
174
-                $form->addElement(new XoopsFormHidden('submitaddress', '1'));
175
-                $form->addElement(new XoopsFormHidden($name, $value));
176
-                $form->addElement(new XoopsFormHidden('addrid', $value));
177
-                break;
178
-            case 'rating':
179
-                $rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
180
-                $form_rating    = new XoopsFormSelect($title, $name, $value, 1);
181
-                $form_rating->addOption('0', '----');
182
-                foreach ($rating_options as $option) {
183
-                    $form_rating->addOption($option, $option);
184
-                }
185
-                $form->addElement($form_rating);
186
-                break;
187
-            case 'date':
188
-                $form->addElement(new XoopsFormText($title, $name, 10, 10, $value));
189
-                break;
190
-            case 'url':
191
-                if ($value != '') {
192
-                    $link = explode('|', $value);
193
-                } else {
194
-                    $link    = array();
195
-                    $link[0] = '';
196
-                    $link[1] = '';
197
-                }
198
-                $form_textarea_tray = new XoopsFormElementTray($title, '', $name);
199
-                $form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
200
-                $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_TITLE . '</b></td><td>', 'url_title' . $name, 50, 250, $link[1]));
201
-                $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
202
-                $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_LINK . '</b></td><td>', 'url_link' . $name, 50, 250, $link[0]));
203
-                $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
204
-                $form->addElement($form_textarea_tray);
205
-                break;
206
-            default:
207
-                echo $fieldtype . ' is an unknown field type.';
208
-                break;
209
-        }
210
-    }
77
+		switch ($fieldtype) {
78
+			case 'textbox':
79
+				if ($custom == '1') {
80
+					$form_text_tray = new XoopsFormElementTray($title, '', $name);
81
+					$form_text_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
82
+					$form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
83
+					$form_text_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
84
+					$form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $size, $maxsize, $value));
85
+					$form_text_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
86
+					$form->addElement($form_text_tray);
87
+				} else {
88
+					$form->addElement(new XoopsFormText($title, $name, 50, 250, $myts->htmlSpecialChars($value)));
89
+				}
90
+				break;
91
+			case 'textarea':
92
+				if ($custom == '1') {
93
+					$form_textarea_tray = new XoopsFormElementTray($title, '', $name);
94
+					$form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
95
+					$form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
96
+					$form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
97
+					$form_textarea_tray->addElement(new XoopsFormTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
98
+					$form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
99
+					$form->addElement($form_textarea_tray);
100
+				} else {
101
+					$form->addElement(new XoopsFormTextArea($title, $name, $value, $rows, $cols));
102
+				}
103
+				break;
104
+			case 'yesno':
105
+				$form->addElement(new XoopsFormRadioyn($title, $name, $value, _YES, _NO));
106
+				break;
107
+			case 'radio':
108
+				$options_arr = explode('[|]', $options);
109
+				$form_radio  = new XoopsFormRadio($title, $name, $value, 1);
110
+				foreach ($options_arr as $option) {
111
+					$form_radio->addOption($option, $option);
112
+				}
113
+				$form->addElement($form_radio);
114
+				break;
115
+			case 'checkbox':
116
+				$options_arr   = explode('[|]', $options);
117
+				$form_checkbox = new XoopsFormCheckbox($title, $name, $value, 1);
118
+				foreach ($options_arr as $option) {
119
+					$form_checkbox->addOption($option, $option);
120
+				}
121
+				$form->addElement($form_checkbox);
122
+				break;
123
+			case 'select':
124
+				$options_arr = explode('[|]', $options);
125
+				$value_arr   = explode('[|]', $value);
126
+				$form_select = new XoopsFormSelect($title, $name, $value, $size, $multiple);
127
+				$form_select->addOption('-', '----');
128
+				$form_select->setValue($value_arr);
129
+				foreach ($options_arr as $key => $option) {
130
+					$form_select->addOption($option, $option);
131
+				}
132
+				$form->addElement($form_select);
133
+				break;
134
+			case 'dhtml':
135
+				if ($custom == '1') {
136
+					$form_dhtmlarea_tray = new XoopsFormElementTray($title, '', $name);
137
+					$form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
138
+					$form_dhtmlarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
139
+					$form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
140
+					$form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
141
+					$form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
142
+					$form->addElement($form_dhtmlarea_tray);
143
+				} else {
144
+					$form->addElement(new XoopsFormDhtmlTextArea($title, $name, $value, $rows, $cols));
145
+				}
146
+				break;
147
+			case 'address':
148
+				//Query all address fields associated with the address type that belongs to the locid.
149
+				$addressfields = getAddressFields('0');
150
+				$addressvalues = getAddressValues($value);
151
+				$form->addElement(new XoopsFormLabel('', '<strong>' . $title . '</strong>'));
152
+				$fieldtitles = array(
153
+					'address'  => _MD_DF_ADDRESS,
154
+					'address2' => _MD_DF_ADDRESS2,
155
+					'zip'      => _MD_DF_ZIP,
156
+					'postcode' => _MD_DF_POSTCODE,
157
+					'lat'      => _MD_DF_LAT,
158
+					'lon'      => _MD_DF_LON,
159
+					'phone'    => _MD_DF_PHONE,
160
+					'fax'      => _MD_DF_FAX,
161
+					'mobile'   => _MD_DF_MOBILE,
162
+					'city'     => _MD_DF_CITY,
163
+					'country'  => _MD_DF_COUNTRY,
164
+					'typename' => _MD_DF_TYPENAME,
165
+					'uselocyn' => _MD_DF_USELOCYN
166
+				);
167
+				foreach ($addressfields['addressfields'] as $field => $fieldvalue) {
168
+					$storedvalue = $addressvalues["$field"];
169
+					if ($fieldvalue == 1) {
170
+						$title = $fieldtitles["$field"];
171
+						$form->addElement(new XoopsFormText($title, $name . $field, 50, 250, $myts->htmlSpecialChars($storedvalue)));
172
+					}
173
+				}
174
+				$form->addElement(new XoopsFormHidden('submitaddress', '1'));
175
+				$form->addElement(new XoopsFormHidden($name, $value));
176
+				$form->addElement(new XoopsFormHidden('addrid', $value));
177
+				break;
178
+			case 'rating':
179
+				$rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
180
+				$form_rating    = new XoopsFormSelect($title, $name, $value, 1);
181
+				$form_rating->addOption('0', '----');
182
+				foreach ($rating_options as $option) {
183
+					$form_rating->addOption($option, $option);
184
+				}
185
+				$form->addElement($form_rating);
186
+				break;
187
+			case 'date':
188
+				$form->addElement(new XoopsFormText($title, $name, 10, 10, $value));
189
+				break;
190
+			case 'url':
191
+				if ($value != '') {
192
+					$link = explode('|', $value);
193
+				} else {
194
+					$link    = array();
195
+					$link[0] = '';
196
+					$link[1] = '';
197
+				}
198
+				$form_textarea_tray = new XoopsFormElementTray($title, '', $name);
199
+				$form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
200
+				$form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_TITLE . '</b></td><td>', 'url_title' . $name, 50, 250, $link[1]));
201
+				$form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
202
+				$form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_LINK . '</b></td><td>', 'url_link' . $name, 50, 250, $link[0]));
203
+				$form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
204
+				$form->addElement($form_textarea_tray);
205
+				break;
206
+			default:
207
+				echo $fieldtype . ' is an unknown field type.';
208
+				break;
209
+		}
210
+	}
211 211
 
212
-    public function getFieldValue($fieldtype = '', $options = '', $value = 0)
213
-    {
214
-        global $form, $myts, $moddir;
215
-        switch ($fieldtype) {
216
-            case 'textbox':
217
-                return $myts->htmlSpecialChars($value);
218
-                break;
219
-            case 'yesno':
220
-                if ($value == '1') {
221
-                    return _YES;
222
-                } else {
223
-                    return _NO;
224
-                }
225
-                break;
226
-            case 'radio':
227
-                return $myts->htmlSpecialChars($value);
228
-                break;
229
-            case 'select':
230
-                return $myts->htmlSpecialChars($value);
231
-            case 'dhtml':
232
-                return $myts->displayTarea($value);
233
-            case 'rating':
234
-                $xoops_url = XOOPS_URL;
235
-                switch ($value) {
236
-                    case 1:
237
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_1.gif";
238
-                        break;
239
-                    case 2:
240
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_2.gif";
241
-                        break;
242
-                    case 3:
243
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_3.gif";
244
-                        break;
245
-                    case 4:
246
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_4.gif";
247
-                        break;
248
-                    case 5:
249
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_5.gif";
250
-                        break;
251
-                    case 6:
252
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_6.gif";
253
-                        break;
254
-                    case 7:
255
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_7.gif";
256
-                        break;
257
-                    case 8:
258
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_8.gif";
259
-                        break;
260
-                    case 9:
261
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_9.gif";
262
-                        break;
263
-                    case 10:
264
-                        $src = "$xoops_url/modules/$moddir/assets/images/rating_10.gif";
265
-                        break;
266
-                    default:
267
-                        $src = '';
268
-                }
269
-                $rating = "<img src=\"$src\">";
212
+	public function getFieldValue($fieldtype = '', $options = '', $value = 0)
213
+	{
214
+		global $form, $myts, $moddir;
215
+		switch ($fieldtype) {
216
+			case 'textbox':
217
+				return $myts->htmlSpecialChars($value);
218
+				break;
219
+			case 'yesno':
220
+				if ($value == '1') {
221
+					return _YES;
222
+				} else {
223
+					return _NO;
224
+				}
225
+				break;
226
+			case 'radio':
227
+				return $myts->htmlSpecialChars($value);
228
+				break;
229
+			case 'select':
230
+				return $myts->htmlSpecialChars($value);
231
+			case 'dhtml':
232
+				return $myts->displayTarea($value);
233
+			case 'rating':
234
+				$xoops_url = XOOPS_URL;
235
+				switch ($value) {
236
+					case 1:
237
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_1.gif";
238
+						break;
239
+					case 2:
240
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_2.gif";
241
+						break;
242
+					case 3:
243
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_3.gif";
244
+						break;
245
+					case 4:
246
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_4.gif";
247
+						break;
248
+					case 5:
249
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_5.gif";
250
+						break;
251
+					case 6:
252
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_6.gif";
253
+						break;
254
+					case 7:
255
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_7.gif";
256
+						break;
257
+					case 8:
258
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_8.gif";
259
+						break;
260
+					case 9:
261
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_9.gif";
262
+						break;
263
+					case 10:
264
+						$src = "$xoops_url/modules/$moddir/assets/images/rating_10.gif";
265
+						break;
266
+					default:
267
+						$src = '';
268
+				}
269
+				$rating = "<img src=\"$src\">";
270 270
 
271
-                return $rating;
272
-            case 'address':
273
-                $fieldtitles   = array(
274
-                    'address'  => _MD_DF_ADDRESS,
275
-                    'address2' => _MD_DF_ADDRESS2,
276
-                    'zip'      => _MD_DF_ZIP,
277
-                    'postcode' => _MD_DF_POSTCODE,
278
-                    'lat'      => _MD_DF_LAT,
279
-                    'lon'      => _MD_DF_LON,
280
-                    'phone'    => _MD_DF_PHONE,
281
-                    'fax'      => _MD_DF_FAX,
282
-                    'mobile'   => _MD_DF_MOBILE,
283
-                    'city'     => _MD_DF_CITY,
284
-                    'country'  => _MD_DF_COUNTRY
285
-                );
286
-                $addressfields = getAddressFields('0');
287
-                $addressvalues = getAddressValues($value);
288
-                $address       = '';
271
+				return $rating;
272
+			case 'address':
273
+				$fieldtitles   = array(
274
+					'address'  => _MD_DF_ADDRESS,
275
+					'address2' => _MD_DF_ADDRESS2,
276
+					'zip'      => _MD_DF_ZIP,
277
+					'postcode' => _MD_DF_POSTCODE,
278
+					'lat'      => _MD_DF_LAT,
279
+					'lon'      => _MD_DF_LON,
280
+					'phone'    => _MD_DF_PHONE,
281
+					'fax'      => _MD_DF_FAX,
282
+					'mobile'   => _MD_DF_MOBILE,
283
+					'city'     => _MD_DF_CITY,
284
+					'country'  => _MD_DF_COUNTRY
285
+				);
286
+				$addressfields = getAddressFields('0');
287
+				$addressvalues = getAddressValues($value);
288
+				$address       = '';
289 289
 
290
-                foreach ($addressfields['addressfields'] as $field => $fieldvalue) {
291
-                    $storedvalue = $addressvalues["$field"];
292
-                    if ($fieldvalue == '1' && $storedvalue != '') {
293
-                        $title = $fieldtitles["$field"];
290
+				foreach ($addressfields['addressfields'] as $field => $fieldvalue) {
291
+					$storedvalue = $addressvalues["$field"];
292
+					if ($fieldvalue == '1' && $storedvalue != '') {
293
+						$title = $fieldtitles["$field"];
294 294
 
295
-                        switch ($field) {
296
-                            case 'address':
297
-                                $street = $myts->htmlSpecialChars($storedvalue);
298
-                                break;
299
-                            case 'city':
300
-                                $city = $myts->htmlSpecialChars($storedvalue);
301
-                                break;
302
-                            case 'zip':
303
-                                $zip = $myts->htmlSpecialChars($storedvalue);
304
-                                break;
305
-                            case 'state':
306
-                                $state = $myts->htmlSpecialChars($storedvalue);
307
-                                break;
308
-                            case 'country':
309
-                                $country = $myts->htmlSpecialChars($storedvalue);
310
-                                break;
311
-                            default:
312
-                                break;
313
-                        }
314
-                        $address .= $myts->htmlSpecialChars($storedvalue) . '<br>';
315
-                    }
316
-                }
317
-                if (!isset($street)) {
318
-                    $street = '';
319
-                }
320
-                if (!isset($city)) {
321
-                    $city = '';
322
-                }
323
-                if (!isset($zip)) {
324
-                    $zip = '';
325
-                }
326
-                if (!isset($state)) {
327
-                    $state = '';
328
-                }
329
-                if (!isset($country)) {
330
-                    $country = '';
331
-                }
332
-                if ($country == 'United States') {
333
-                    $countrycode = 'us';
334
-                } elseif ($country == 'Canada') {
335
-                    $countrycode = 'ca';
336
-                }
337
-                if (isset($countrycode) && isset($city) && isset($street)) {
338
-                    $address .= '<form name=mapForm2 action="http://us.rd.yahoo.com/maps/home/submit_a/*-http://maps.yahoo.com/maps" target="_new" method=get>
295
+						switch ($field) {
296
+							case 'address':
297
+								$street = $myts->htmlSpecialChars($storedvalue);
298
+								break;
299
+							case 'city':
300
+								$city = $myts->htmlSpecialChars($storedvalue);
301
+								break;
302
+							case 'zip':
303
+								$zip = $myts->htmlSpecialChars($storedvalue);
304
+								break;
305
+							case 'state':
306
+								$state = $myts->htmlSpecialChars($storedvalue);
307
+								break;
308
+							case 'country':
309
+								$country = $myts->htmlSpecialChars($storedvalue);
310
+								break;
311
+							default:
312
+								break;
313
+						}
314
+						$address .= $myts->htmlSpecialChars($storedvalue) . '<br>';
315
+					}
316
+				}
317
+				if (!isset($street)) {
318
+					$street = '';
319
+				}
320
+				if (!isset($city)) {
321
+					$city = '';
322
+				}
323
+				if (!isset($zip)) {
324
+					$zip = '';
325
+				}
326
+				if (!isset($state)) {
327
+					$state = '';
328
+				}
329
+				if (!isset($country)) {
330
+					$country = '';
331
+				}
332
+				if ($country == 'United States') {
333
+					$countrycode = 'us';
334
+				} elseif ($country == 'Canada') {
335
+					$countrycode = 'ca';
336
+				}
337
+				if (isset($countrycode) && isset($city) && isset($street)) {
338
+					$address .= '<form name=mapForm2 action="http://us.rd.yahoo.com/maps/home/submit_a/*-http://maps.yahoo.com/maps" target="_new" method=get>
339 339
                     <input type="hidden" name="addr" value="' . $street . '">
340 340
                     <input type="hidden" name="csz" value="' . $city . ', ' . $state . ' ' . $zip . '">
341 341
                     <input type="hidden" name="country" value="' . $countrycode . '">
342 342
                     <input type=hidden name=srchtype value=a>
343 343
                     <input type=submit name="getmap" value="Yahoo Map">
344 344
                     </form>';
345
-                }
345
+				}
346 346
 
347
-                return $address;
348
-            case 'url':
349
-                $link = explode('|', $value);
347
+				return $address;
348
+			case 'url':
349
+				$link = explode('|', $value);
350 350
 
351
-                return '<a href="' . $myts->htmlSpecialChars($link[0]) . '" title="' . $myts->htmlSpecialChars($link[1]) . '">' . $myts->htmlSpecialChars($link[0]) . '</a>';
352
-                break;
353
-            default:
354
-                return $myts->htmlSpecialChars($value);
355
-                break;
356
-        }
357
-    }
351
+				return '<a href="' . $myts->htmlSpecialChars($link[0]) . '" title="' . $myts->htmlSpecialChars($link[1]) . '">' . $myts->htmlSpecialChars($link[0]) . '</a>';
352
+				break;
353
+			default:
354
+				return $myts->htmlSpecialChars($value);
355
+				break;
356
+		}
357
+	}
358 358
 
359
-    public function createSearchField($title = '', $name = '', $fieldtype = '', $ext = '', $options = '', $value = '', $custom = '0', $customtitle = null)
360
-    {
361
-        global $form, $myts;
359
+	public function createSearchField($title = '', $name = '', $fieldtype = '', $ext = '', $options = '', $value = '', $custom = '0', $customtitle = null)
360
+	{
361
+		global $form, $myts;
362 362
 
363
-        switch ($fieldtype) {
364
-            case 'textbox':
365
-                $this->createSearchField_text($title, $name, $value, $options);
366
-                break;
367
-            case 'textarea':
368
-                $this->createSearchField_text($title, $value, $options);
369
-                break;
370
-            case 'yesno':
371
-                $form->addElement(new XoopsFormRadioyn($title, $name, '', _YES, _NO));
372
-                break;
373
-            case 'radio':
374
-                $this->createSearchField_select($title, $name, $value, $options);
375
-                break;
376
-            case 'checkbox':
377
-                $this->createSearchField_checkbox($title, $name, $value, $options);
378
-                break;
379
-            case 'select':
380
-                $this->createSearchField_checkbox($title, $name, $value, $options);
381
-                break;
382
-            case 'dhtml':
383
-                $this->createSearchField_text($title, $name, $value, $options);
384
-                break;
385
-            case 'address':
386
-                //Query all address fields associated with the address type that belongs to the locid.
387
-                /* $addressfields = getAddressFields('0');
363
+		switch ($fieldtype) {
364
+			case 'textbox':
365
+				$this->createSearchField_text($title, $name, $value, $options);
366
+				break;
367
+			case 'textarea':
368
+				$this->createSearchField_text($title, $value, $options);
369
+				break;
370
+			case 'yesno':
371
+				$form->addElement(new XoopsFormRadioyn($title, $name, '', _YES, _NO));
372
+				break;
373
+			case 'radio':
374
+				$this->createSearchField_select($title, $name, $value, $options);
375
+				break;
376
+			case 'checkbox':
377
+				$this->createSearchField_checkbox($title, $name, $value, $options);
378
+				break;
379
+			case 'select':
380
+				$this->createSearchField_checkbox($title, $name, $value, $options);
381
+				break;
382
+			case 'dhtml':
383
+				$this->createSearchField_text($title, $name, $value, $options);
384
+				break;
385
+			case 'address':
386
+				//Query all address fields associated with the address type that belongs to the locid.
387
+				/* $addressfields = getAddressFields('0');
388 388
                 $fieldtitles = array('address' => _MD_DF_ADDRESS, 'address2' => _MD_DF_ADDRESS2, 'zip' => _MD_DF_ZIP, 'postcode' => _MD_DF_POSTCODE, 'lat' => _MD_DF_LAT, 'lon' => _MD_DF_LON, 'phone' => _MD_DF_PHONE, 'fax' => _MD_DF_FAX, 'mobile' => _MD_DF_MOBILE, 'city' => _MD_DF_CITY, 'country' => _MD_DF_COUNTRY, 'typename' => _MD_DF_TYPENAME);
389 389
                 $form->addElement(new XoopsFormLabel("", "<strong>".$title."</strong>"));
390 390
                 foreach ($addressfields['addressfields'] as $field => $fieldvalue) {
@@ -396,247 +396,247 @@  discard block
 block discarded – undo
396 396
                 $form->addElement(new XoopsFormHidden("submitaddress","1"));
397 397
                 $form->addElement(new XoopsFormHidden($name, $value));
398 398
                 $form->addElement(new XoopsFormHidden("addrid", $value)); */
399
-                break;
400
-            case 'rating':
401
-                $this->createSearchField_rating($title, $name, $value, $options);
402
-                break;
403
-            case 'date':
404
-                $this->createSearchField_text($title, $name, $value, $options);
405
-                break;
406
-            case 'url':
407
-                $this->createSearchField_text($title, $name, $value, $options);
408
-            default:
409
-                echo $fieldtype . ' geen bekend veldtype ';
410
-                break;
411
-        }
412
-    }
399
+				break;
400
+			case 'rating':
401
+				$this->createSearchField_rating($title, $name, $value, $options);
402
+				break;
403
+			case 'date':
404
+				$this->createSearchField_text($title, $name, $value, $options);
405
+				break;
406
+			case 'url':
407
+				$this->createSearchField_text($title, $name, $value, $options);
408
+			default:
409
+				echo $fieldtype . ' geen bekend veldtype ';
410
+				break;
411
+		}
412
+	}
413 413
 
414
-    public function createSearchField_text($title = '', $name = '', $value = '', $options = '')
415
-    {
416
-        global $form, $myts;
417
-        $options_arr_constr = array(
418
-            'equal'      => _MD_EQUAL_TO,
419
-            'notequal'   => _MD_NOT_EQUAL_TO,
420
-            'contains'   => _MD_CONTAINS,
421
-            'begins'     => _MD_BEGINSWITH,
422
-            'ends'       => _MD_ENDSWITH,
423
-            'notcontain' => _MD_NOTCONTAIN
424
-        );
425
-        $form_tray          = new XoopsFormElementTray($title, '', $name);
426
-        $form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
427
-        $form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
428
-        //$form_select->addOption('0', '----');
429
-        foreach ($options_arr_constr as $optionname => $option) {
430
-            $form_select_constr->addOption($optionname, $option);
431
-        }
432
-        $form_tray->addElement($form_select_constr);
433
-        $form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
434
-        $form_tray->addElement(new XoopsFormText('', $name, 50, 250, ''));
435
-        $form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
436
-        $form->addElement($form_tray);
437
-    }
414
+	public function createSearchField_text($title = '', $name = '', $value = '', $options = '')
415
+	{
416
+		global $form, $myts;
417
+		$options_arr_constr = array(
418
+			'equal'      => _MD_EQUAL_TO,
419
+			'notequal'   => _MD_NOT_EQUAL_TO,
420
+			'contains'   => _MD_CONTAINS,
421
+			'begins'     => _MD_BEGINSWITH,
422
+			'ends'       => _MD_ENDSWITH,
423
+			'notcontain' => _MD_NOTCONTAIN
424
+		);
425
+		$form_tray          = new XoopsFormElementTray($title, '', $name);
426
+		$form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
427
+		$form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
428
+		//$form_select->addOption('0', '----');
429
+		foreach ($options_arr_constr as $optionname => $option) {
430
+			$form_select_constr->addOption($optionname, $option);
431
+		}
432
+		$form_tray->addElement($form_select_constr);
433
+		$form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
434
+		$form_tray->addElement(new XoopsFormText('', $name, 50, 250, ''));
435
+		$form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
436
+		$form->addElement($form_tray);
437
+	}
438 438
 
439
-    public function createSearchField_checkbox($title = '', $name = '', $value = '', $options = '')
440
-    {
441
-        global $form, $myts;
442
-        $options_arr   = explode('[|]', $options);
443
-        $countoptions  = count($options_arr) + 1;
444
-        $form_checkbox = new XoopsFormCheckBox($title, $name, $value);
445
-        foreach ($options_arr as $optionname) {
446
-            $form_checkbox->addOption($optionname, $optionname);
447
-        }
448
-        $form->addElement($form_checkbox);
449
-    }
439
+	public function createSearchField_checkbox($title = '', $name = '', $value = '', $options = '')
440
+	{
441
+		global $form, $myts;
442
+		$options_arr   = explode('[|]', $options);
443
+		$countoptions  = count($options_arr) + 1;
444
+		$form_checkbox = new XoopsFormCheckBox($title, $name, $value);
445
+		foreach ($options_arr as $optionname) {
446
+			$form_checkbox->addOption($optionname, $optionname);
447
+		}
448
+		$form->addElement($form_checkbox);
449
+	}
450 450
 
451
-    public function createSearchField_select($title = '', $name = '', $value = '', $options = '')
452
-    {
453
-        global $form, $myts;
454
-        $options_arr        = explode('[|]', $options);
455
-        $options_arr_constr = array('equal' => _MD_EQUAL_TO, 'notequal' => _MD_NOT_EQUAL_TO);
456
-        $form_tray          = new XoopsFormElementTray($title, '', $name);
457
-        $form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
458
-        $form_select_constr = new XoopsFormSelect('', $name, $value, 1);
459
-        foreach ($options_arr_constr as $option) {
460
-            $form_select_constr->addOption($option, $option);
461
-        }
462
-        $form_tray->addElement($form_select_constr);
463
-        $form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
464
-        $countoptions = count($options_arr) + 1;
465
-        if ($countoptions >= 5) {
466
-            $selectformsize = 5;
467
-        } else {
468
-            $selectformsize = $countoptions;
469
-        }
470
-        $form_select = new XoopsFormSelect('', $name, $value, $selectformsize);
471
-        $form_select->setExtra(" multiple='multiple'");
472
-        $form_select->addOption('0', '----');
473
-        foreach ($options_arr as $option) {
474
-            $form_select->addOption($option, $option);
475
-        }
476
-        $form_tray->addElement($form_select);
477
-        $form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
478
-        $form->addElement($form_tray);
479
-    }
451
+	public function createSearchField_select($title = '', $name = '', $value = '', $options = '')
452
+	{
453
+		global $form, $myts;
454
+		$options_arr        = explode('[|]', $options);
455
+		$options_arr_constr = array('equal' => _MD_EQUAL_TO, 'notequal' => _MD_NOT_EQUAL_TO);
456
+		$form_tray          = new XoopsFormElementTray($title, '', $name);
457
+		$form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
458
+		$form_select_constr = new XoopsFormSelect('', $name, $value, 1);
459
+		foreach ($options_arr_constr as $option) {
460
+			$form_select_constr->addOption($option, $option);
461
+		}
462
+		$form_tray->addElement($form_select_constr);
463
+		$form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
464
+		$countoptions = count($options_arr) + 1;
465
+		if ($countoptions >= 5) {
466
+			$selectformsize = 5;
467
+		} else {
468
+			$selectformsize = $countoptions;
469
+		}
470
+		$form_select = new XoopsFormSelect('', $name, $value, $selectformsize);
471
+		$form_select->setExtra(" multiple='multiple'");
472
+		$form_select->addOption('0', '----');
473
+		foreach ($options_arr as $option) {
474
+			$form_select->addOption($option, $option);
475
+		}
476
+		$form_tray->addElement($form_select);
477
+		$form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
478
+		$form->addElement($form_tray);
479
+	}
480 480
 
481
-    public function createSearchField_rating2($title = '', $name = '', $value = '', $options = '')
482
-    {
483
-        global $form, $myts;
484
-        $options_arr    = explode('[|]', $options);
485
-        $rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
486
-        $form_rating    = new XoopsFormSelect($title, $name, $value, 1);
487
-        $form_rating->addOption('0', '----');
488
-        foreach ($rating_options as $option) {
489
-            $form_rating->addOption($option, $option);
490
-        }
491
-        $form->addElement($form_rating);
492
-    }
481
+	public function createSearchField_rating2($title = '', $name = '', $value = '', $options = '')
482
+	{
483
+		global $form, $myts;
484
+		$options_arr    = explode('[|]', $options);
485
+		$rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
486
+		$form_rating    = new XoopsFormSelect($title, $name, $value, 1);
487
+		$form_rating->addOption('0', '----');
488
+		foreach ($rating_options as $option) {
489
+			$form_rating->addOption($option, $option);
490
+		}
491
+		$form->addElement($form_rating);
492
+	}
493 493
 
494
-    public function createSearchField_rating($title = '', $name = '', $value = '', $options = '')
495
-    {
496
-        global $form, $myts;
497
-        $options_arr        = explode('[|]', $options);
498
-        $rating_options     = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
499
-        $options_arr_constr = array(
500
-            'equal'    => _MD_EQUAL_TO,
501
-            'notequal' => _MD_NOT_EQUAL_TO,
502
-            'smaller'  => _MD_SMALLER_THAN,
503
-            'bigger'   => _MD_GREATER_THAN
504
-        );
505
-        $form_tray          = new XoopsFormElementTray($title, '', $name);
506
-        $form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
507
-        $form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
508
-        foreach ($options_arr_constr as $optionname => $option) {
509
-            $form_select_constr->addOption($optionname, $option);
510
-        }
511
-        $form_tray->addElement($form_select_constr);
512
-        $form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
513
-        $countoptions = count($rating_options) + 1;
514
-        if ($countoptions >= 5) {
515
-            $selectformsize = 5;
516
-        } else {
517
-            $selectformsize = $rating_options;
518
-        }
519
-        $form_select = new XoopsFormSelect('', $name, $value, $selectformsize);
520
-        //$form_select->setExtra(" multiple='multiple'");
521
-        $form_select->addOption('0', '----');
522
-        foreach ($rating_options as $option) {
523
-            $form_select->addOption($option, $option);
524
-        }
525
-        $form_tray->addElement($form_select);
526
-        $form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
527
-        $form->addElement($form_tray);
528
-    }
494
+	public function createSearchField_rating($title = '', $name = '', $value = '', $options = '')
495
+	{
496
+		global $form, $myts;
497
+		$options_arr        = explode('[|]', $options);
498
+		$rating_options     = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
499
+		$options_arr_constr = array(
500
+			'equal'    => _MD_EQUAL_TO,
501
+			'notequal' => _MD_NOT_EQUAL_TO,
502
+			'smaller'  => _MD_SMALLER_THAN,
503
+			'bigger'   => _MD_GREATER_THAN
504
+		);
505
+		$form_tray          = new XoopsFormElementTray($title, '', $name);
506
+		$form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
507
+		$form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
508
+		foreach ($options_arr_constr as $optionname => $option) {
509
+			$form_select_constr->addOption($optionname, $option);
510
+		}
511
+		$form_tray->addElement($form_select_constr);
512
+		$form_tray->addElement(new XoopsFormLabel('', '</td><td>'));
513
+		$countoptions = count($rating_options) + 1;
514
+		if ($countoptions >= 5) {
515
+			$selectformsize = 5;
516
+		} else {
517
+			$selectformsize = $rating_options;
518
+		}
519
+		$form_select = new XoopsFormSelect('', $name, $value, $selectformsize);
520
+		//$form_select->setExtra(" multiple='multiple'");
521
+		$form_select->addOption('0', '----');
522
+		foreach ($rating_options as $option) {
523
+			$form_select->addOption($option, $option);
524
+		}
525
+		$form_tray->addElement($form_select);
526
+		$form_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
527
+		$form->addElement($form_tray);
528
+	}
529 529
 
530
-    public function getWidth()
531
-    {
532
-        return $this->_width;
533
-    }
530
+	public function getWidth()
531
+	{
532
+		return $this->_width;
533
+	}
534 534
 
535
-    public function getHeight()
536
-    {
537
-        return $this->_height;
538
-    }
535
+	public function getHeight()
536
+	{
537
+		return $this->_height;
538
+	}
539 539
 
540
-    public function getSrc()
541
-    {
542
-        return $this->_src;
543
-    }
540
+	public function getSrc()
541
+	{
542
+		return $this->_src;
543
+	}
544 544
 
545
-    /*
545
+	/*
546 546
     * Are multiple selections allowed?
547 547
     *
548 548
     * @return bool
549 549
     */
550
-    public function isMultiple()
551
-    {
552
-        return $this->_multiple;
553
-    }
550
+	public function isMultiple()
551
+	{
552
+		return $this->_multiple;
553
+	}
554 554
 
555
-    /**
556
-     * Get the size
557
-     *
558
-     * @return int
559
-     */
560
-    public function getSize()
561
-    {
562
-        return $this->_size;
563
-    }
555
+	/**
556
+	 * Get the size
557
+	 *
558
+	 * @return int
559
+	 */
560
+	public function getSize()
561
+	{
562
+		return $this->_size;
563
+	}
564 564
 
565
-    /**
566
-     * Get an array of pre-selected values
567
-     *
568
-     * @return array
569
-     */
570
-    public function getValue()
571
-    {
572
-        return $this->_value;
573
-    }
565
+	/**
566
+	 * Get an array of pre-selected values
567
+	 *
568
+	 * @return array
569
+	 */
570
+	public function getValue()
571
+	{
572
+		return $this->_value;
573
+	}
574 574
 
575
-    /**
576
-     * Set pre-selected values
577
-     *
578
-     * @param $value mixed
579
-     */
580
-    public function setValue($value)
581
-    {
582
-        if (is_array($value)) {
583
-            foreach ($value as $v) {
584
-                $this->_value[] = $v;
585
-            }
586
-        } else {
587
-            $this->_value[] = $value;
588
-        }
589
-    }
575
+	/**
576
+	 * Set pre-selected values
577
+	 *
578
+	 * @param $value mixed
579
+	 */
580
+	public function setValue($value)
581
+	{
582
+		if (is_array($value)) {
583
+			foreach ($value as $v) {
584
+				$this->_value[] = $v;
585
+			}
586
+		} else {
587
+			$this->_value[] = $value;
588
+		}
589
+	}
590 590
 
591
-    /**
592
-     * Add an option
593
-     *
594
-     * @param string $value "value" attribute
595
-     * @param string $name  "name" attribute
596
-     */
597
-    public function addOption($value, $name = '')
598
-    {
599
-        if ($name != '') {
600
-            $this->_options[$value] = $name;
601
-        } else {
602
-            $this->_options[$value] = $value;
603
-        }
604
-    }
591
+	/**
592
+	 * Add an option
593
+	 *
594
+	 * @param string $value "value" attribute
595
+	 * @param string $name  "name" attribute
596
+	 */
597
+	public function addOption($value, $name = '')
598
+	{
599
+		if ($name != '') {
600
+			$this->_options[$value] = $name;
601
+		} else {
602
+			$this->_options[$value] = $value;
603
+		}
604
+	}
605 605
 
606
-    /**
607
-     * Add multiple options
608
-     *
609
-     * @param array $options Associative array of value->name pairs
610
-     */
611
-    public function addOptionArray($options)
612
-    {
613
-        if (is_array($options)) {
614
-            foreach ($options as $k => $v) {
615
-                $this->addOption($k, $v);
616
-            }
617
-        }
618
-    }
606
+	/**
607
+	 * Add multiple options
608
+	 *
609
+	 * @param array $options Associative array of value->name pairs
610
+	 */
611
+	public function addOptionArray($options)
612
+	{
613
+		if (is_array($options)) {
614
+			foreach ($options as $k => $v) {
615
+				$this->addOption($k, $v);
616
+			}
617
+		}
618
+	}
619 619
 
620
-    /**
621
-     * Get all options
622
-     *
623
-     * @return array   Associative array of value->name pairs
624
-     */
625
-    public function getOptions()
626
-    {
627
-        return $this->_options;
628
-    }
620
+	/**
621
+	 * Get all options
622
+	 *
623
+	 * @return array   Associative array of value->name pairs
624
+	 */
625
+	public function getOptions()
626
+	{
627
+		return $this->_options;
628
+	}
629 629
 
630
-    /**
631
-     * Prepare HTML for output
632
-     *
633
-     * @return string  HTML
634
-     */
635
-    public function render()
636
-    {
637
-        $ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
638
-        $ret .= '>';
630
+	/**
631
+	 * Prepare HTML for output
632
+	 *
633
+	 * @return string  HTML
634
+	 */
635
+	public function render()
636
+	{
637
+		$ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
638
+		$ret .= '>';
639 639
 
640
-        return $ret;
641
-    }
640
+		return $ret;
641
+	}
642 642
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
                 if ($custom == '1') {
80 80
                     $form_text_tray = new XoopsFormElementTray($title, '', $name);
81 81
                     $form_text_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
82
-                    $form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
82
+                    $form_text_tray->addElement(new XoopsFormText('<b>'._MD_CUSTOM_TITLE.'</b></td><td>', 'custom'.$name, 50, 250, $customtitle));
83 83
                     $form_text_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
84
-                    $form_text_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $size, $maxsize, $value));
84
+                    $form_text_tray->addElement(new XoopsFormText('<b>'._MD_CUSTOM_VALUE.'</b></td><td>', $name, $size, $maxsize, $value));
85 85
                     $form_text_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
86 86
                     $form->addElement($form_text_tray);
87 87
                 } else {
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
                 if ($custom == '1') {
93 93
                     $form_textarea_tray = new XoopsFormElementTray($title, '', $name);
94 94
                     $form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
95
-                    $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
95
+                    $form_textarea_tray->addElement(new XoopsFormText('<b>'._MD_CUSTOM_TITLE.'</b></td><td>', 'custom'.$name, 50, 250, $customtitle));
96 96
                     $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
97
-                    $form_textarea_tray->addElement(new XoopsFormTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
97
+                    $form_textarea_tray->addElement(new XoopsFormTextArea('<b>'._MD_CUSTOM_VALUE.'</b></td><td>', $name, $value, $rows, $cols));
98 98
                     $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
99 99
                     $form->addElement($form_textarea_tray);
100 100
                 } else {
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
                 if ($custom == '1') {
136 136
                     $form_dhtmlarea_tray = new XoopsFormElementTray($title, '', $name);
137 137
                     $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
138
-                    $form_dhtmlarea_tray->addElement(new XoopsFormText('<b>' . _MD_CUSTOM_TITLE . '</b></td><td>', 'custom' . $name, 50, 250, $customtitle));
138
+                    $form_dhtmlarea_tray->addElement(new XoopsFormText('<b>'._MD_CUSTOM_TITLE.'</b></td><td>', 'custom'.$name, 50, 250, $customtitle));
139 139
                     $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
140
-                    $form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea('<b>' . _MD_CUSTOM_VALUE . '</b></td><td>', $name, $value, $rows, $cols));
140
+                    $form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea('<b>'._MD_CUSTOM_VALUE.'</b></td><td>', $name, $value, $rows, $cols));
141 141
                     $form_dhtmlarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
142 142
                     $form->addElement($form_dhtmlarea_tray);
143 143
                 } else {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 //Query all address fields associated with the address type that belongs to the locid.
149 149
                 $addressfields = getAddressFields('0');
150 150
                 $addressvalues = getAddressValues($value);
151
-                $form->addElement(new XoopsFormLabel('', '<strong>' . $title . '</strong>'));
151
+                $form->addElement(new XoopsFormLabel('', '<strong>'.$title.'</strong>'));
152 152
                 $fieldtitles = array(
153 153
                     'address'  => _MD_DF_ADDRESS,
154 154
                     'address2' => _MD_DF_ADDRESS2,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                     $storedvalue = $addressvalues["$field"];
169 169
                     if ($fieldvalue == 1) {
170 170
                         $title = $fieldtitles["$field"];
171
-                        $form->addElement(new XoopsFormText($title, $name . $field, 50, 250, $myts->htmlSpecialChars($storedvalue)));
171
+                        $form->addElement(new XoopsFormText($title, $name.$field, 50, 250, $myts->htmlSpecialChars($storedvalue)));
172 172
                     }
173 173
                 }
174 174
                 $form->addElement(new XoopsFormHidden('submitaddress', '1'));
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
                 }
198 198
                 $form_textarea_tray = new XoopsFormElementTray($title, '', $name);
199 199
                 $form_textarea_tray->addElement(new XoopsFormLabel('', '<table><tr><td>'));
200
-                $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_TITLE . '</b></td><td>', 'url_title' . $name, 50, 250, $link[1]));
200
+                $form_textarea_tray->addElement(new XoopsFormText('<b>'._MD_FIELDNAMES_URL_TITLE.'</b></td><td>', 'url_title'.$name, 50, 250, $link[1]));
201 201
                 $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr><tr><td>'));
202
-                $form_textarea_tray->addElement(new XoopsFormText('<b>' . _MD_FIELDNAMES_URL_LINK . '</b></td><td>', 'url_link' . $name, 50, 250, $link[0]));
202
+                $form_textarea_tray->addElement(new XoopsFormText('<b>'._MD_FIELDNAMES_URL_LINK.'</b></td><td>', 'url_link'.$name, 50, 250, $link[0]));
203 203
                 $form_textarea_tray->addElement(new XoopsFormLabel('', '</td></tr></table>'));
204 204
                 $form->addElement($form_textarea_tray);
205 205
                 break;
206 206
             default:
207
-                echo $fieldtype . ' is an unknown field type.';
207
+                echo $fieldtype.' is an unknown field type.';
208 208
                 break;
209 209
         }
210 210
     }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
                 return $rating;
272 272
             case 'address':
273
-                $fieldtitles   = array(
273
+                $fieldtitles = array(
274 274
                     'address'  => _MD_DF_ADDRESS,
275 275
                     'address2' => _MD_DF_ADDRESS2,
276 276
                     'zip'      => _MD_DF_ZIP,
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                             default:
312 312
                                 break;
313 313
                         }
314
-                        $address .= $myts->htmlSpecialChars($storedvalue) . '<br>';
314
+                        $address .= $myts->htmlSpecialChars($storedvalue).'<br>';
315 315
                     }
316 316
                 }
317 317
                 if (!isset($street)) {
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
                 }
337 337
                 if (isset($countrycode) && isset($city) && isset($street)) {
338 338
                     $address .= '<form name=mapForm2 action="http://us.rd.yahoo.com/maps/home/submit_a/*-http://maps.yahoo.com/maps" target="_new" method=get>
339
-                    <input type="hidden" name="addr" value="' . $street . '">
340
-                    <input type="hidden" name="csz" value="' . $city . ', ' . $state . ' ' . $zip . '">
341
-                    <input type="hidden" name="country" value="' . $countrycode . '">
339
+                    <input type="hidden" name="addr" value="' . $street.'">
340
+                    <input type="hidden" name="csz" value="' . $city.', '.$state.' '.$zip.'">
341
+                    <input type="hidden" name="country" value="' . $countrycode.'">
342 342
                     <input type=hidden name=srchtype value=a>
343 343
                     <input type=submit name="getmap" value="Yahoo Map">
344 344
                     </form>';
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             case 'url':
349 349
                 $link = explode('|', $value);
350 350
 
351
-                return '<a href="' . $myts->htmlSpecialChars($link[0]) . '" title="' . $myts->htmlSpecialChars($link[1]) . '">' . $myts->htmlSpecialChars($link[0]) . '</a>';
351
+                return '<a href="'.$myts->htmlSpecialChars($link[0]).'" title="'.$myts->htmlSpecialChars($link[1]).'">'.$myts->htmlSpecialChars($link[0]).'</a>';
352 352
                 break;
353 353
             default:
354 354
                 return $myts->htmlSpecialChars($value);
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             case 'url':
407 407
                 $this->createSearchField_text($title, $name, $value, $options);
408 408
             default:
409
-                echo $fieldtype . ' geen bekend veldtype ';
409
+                echo $fieldtype.' geen bekend veldtype ';
410 410
                 break;
411 411
         }
412 412
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         );
425 425
         $form_tray          = new XoopsFormElementTray($title, '', $name);
426 426
         $form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
427
-        $form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
427
+        $form_select_constr = new XoopsFormSelect('', $name.'constr', $value, 1);
428 428
         //$form_select->addOption('0', '----');
429 429
         foreach ($options_arr_constr as $optionname => $option) {
430 430
             $form_select_constr->addOption($optionname, $option);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         );
505 505
         $form_tray          = new XoopsFormElementTray($title, '', $name);
506 506
         $form_tray->addElement(new XoopsFormLabel('', '<table><tr><td width="150">'));
507
-        $form_select_constr = new XoopsFormSelect('', $name . 'constr', $value, 1);
507
+        $form_select_constr = new XoopsFormSelect('', $name.'constr', $value, 1);
508 508
         foreach ($options_arr_constr as $optionname => $option) {
509 509
             $form_select_constr->addOption($optionname, $option);
510 510
         }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
      */
635 635
     public function render()
636 636
     {
637
-        $ret = "<img src='" . $this->getSrc() . '\' width=\'' . $this->getWidth() . '\'  height=\'' . $this->getHeight() . '\'';
637
+        $ret = "<img src='".$this->getSrc().'\' width=\''.$this->getWidth().'\'  height=\''.$this->getHeight().'\'';
638 638
         $ret .= '>';
639 639
 
640 640
         return $ret;
Please login to merge, or discard this patch.
class/class.directory.php 2 patches
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -43,35 +43,35 @@  discard block
 block discarded – undo
43 43
  */
44 44
 class efqDirectory extends XoopsObject
45 45
 {
46
-    /**
47
-     * efqDirectory constructor.
48
-     * @param bool $directory
49
-     */
50
-    public function __construct($directory = false)
51
-    {
52
-        global $moddir;
53
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
54
-        $this->initVar('dirid', XOBJ_DTYPE_INT, null, false);
55
-        $this->initVar('postfix', XOBJ_DTYPE_TXTBOX);
56
-        $this->initVar('open', XOBJ_DTYPE_INT, 0, false);
57
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX);
58
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA);
59
-        $this->initVar('img', XOBJ_DTYPE_TXTBOX);
60
-        $this->initVar('allowreview', XOBJ_DTYPE_INT, 0, false);
46
+	/**
47
+	 * efqDirectory constructor.
48
+	 * @param bool $directory
49
+	 */
50
+	public function __construct($directory = false)
51
+	{
52
+		global $moddir;
53
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
54
+		$this->initVar('dirid', XOBJ_DTYPE_INT, null, false);
55
+		$this->initVar('postfix', XOBJ_DTYPE_TXTBOX);
56
+		$this->initVar('open', XOBJ_DTYPE_INT, 0, false);
57
+		$this->initVar('name', XOBJ_DTYPE_TXTBOX);
58
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA);
59
+		$this->initVar('img', XOBJ_DTYPE_TXTBOX);
60
+		$this->initVar('allowreview', XOBJ_DTYPE_INT, 0, false);
61 61
 
62
-        if ($directory !== false) {
63
-            if (is_array($directory)) {
64
-                $this->assignVars($directory);
65
-            } else {
66
-                $directoryHandler = xoops_getModuleHandler('directory', $moddir);
67
-                $objDirectory      = $directoryHandler->get($directory);
68
-                foreach ($objDirectory->vars as $k => $v) {
69
-                    $this->assignVar($k, $v['value']);
70
-                }
71
-                unset($objDirectory);
72
-            }
73
-        }
74
-    }
62
+		if ($directory !== false) {
63
+			if (is_array($directory)) {
64
+				$this->assignVars($directory);
65
+			} else {
66
+				$directoryHandler = xoops_getModuleHandler('directory', $moddir);
67
+				$objDirectory      = $directoryHandler->get($directory);
68
+				foreach ($objDirectory->vars as $k => $v) {
69
+					$this->assignVar($k, $v['value']);
70
+				}
71
+				unset($objDirectory);
72
+			}
73
+		}
74
+	}
75 75
 }
76 76
 
77 77
 /**
@@ -85,226 +85,226 @@  discard block
 block discarded – undo
85 85
  */
86 86
 class efqDirectoryHandler extends XoopsObjectHandler
87 87
 {
88
-    /**
89
-     * efqDirectoryHandler constructor.
90
-     */
91
-    public function __construct()
92
-    {
93
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
94
-    }
88
+	/**
89
+	 * efqDirectoryHandler constructor.
90
+	 */
91
+	public function __construct()
92
+	{
93
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
94
+	}
95 95
 
96
-    /**
97
-     * create instance of directory class or reset the existing instance.
98
-     *
99
-     * @param bool $isNew
100
-     * @return efqDirectory $directory
101
-     */
102
-    public function &create($isNew = true)
103
-    {
104
-        $directory = new efqDirectory();
105
-        if ($isNew) {
106
-            $directory->setNew();
107
-        }
96
+	/**
97
+	 * create instance of directory class or reset the existing instance.
98
+	 *
99
+	 * @param bool $isNew
100
+	 * @return efqDirectory $directory
101
+	 */
102
+	public function &create($isNew = true)
103
+	{
104
+		$directory = new efqDirectory();
105
+		if ($isNew) {
106
+			$directory->setNew();
107
+		}
108 108
 
109
-        return $directory;
110
-    }
109
+		return $directory;
110
+	}
111 111
 
112
-    /**
113
-     * retrieve a directory
114
-     *
115
-     * @param bool|int $dirid ID of the directory
116
-     * @return mixed reference to the <a href='psi_element://efqDirectory'>efqDirectory</a> object, FALSE if failed
117
-     *                        object, FALSE if failed
118
-     */
119
-    public function &get($dirid = false)
120
-    {
121
-        if ($dirid === false) {
122
-            return false;
123
-        }
124
-        $dirid = (int)$dirid;
125
-        if ($dirid > 0) {
126
-            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' WHERE dirid=' . $dirid;
127
-            if (!$result = $this->db->query($sql)) {
128
-                return false;
129
-            }
130
-            $directory =& $this->create(false);
131
-            $directory->assignVars($this->db->fetchArray($result));
112
+	/**
113
+	 * retrieve a directory
114
+	 *
115
+	 * @param bool|int $dirid ID of the directory
116
+	 * @return mixed reference to the <a href='psi_element://efqDirectory'>efqDirectory</a> object, FALSE if failed
117
+	 *                        object, FALSE if failed
118
+	 */
119
+	public function &get($dirid = false)
120
+	{
121
+		if ($dirid === false) {
122
+			return false;
123
+		}
124
+		$dirid = (int)$dirid;
125
+		if ($dirid > 0) {
126
+			$sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' WHERE dirid=' . $dirid;
127
+			if (!$result = $this->db->query($sql)) {
128
+				return false;
129
+			}
130
+			$directory =& $this->create(false);
131
+			$directory->assignVars($this->db->fetchArray($result));
132 132
 
133
-            return $directory;
134
-        }
133
+			return $directory;
134
+		}
135 135
 
136
-        return false;
137
-    }
136
+		return false;
137
+	}
138 138
 
139
-    /**
140
-     * retrieve all directories
141
-     *
142
-     * @return mixed reference to the {@link efqDirectory} object, FALSE if failed
143
-     */
144
-    public function &getAll()
145
-    {
146
-        $sql = 'SELECT dirid,postfix,open,name,descr,img FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
147
-        if (!$result = $this->db->query($sql)) {
148
-            return false;
149
-        }
150
-        while (list($dirid, $postfix, $open, $name, $descr, $img) = $this->db->fetchRow($result)) {
151
-            $arr[] = array(
152
-                'dirid'   => $dirid,
153
-                'postfix' => $postfix,
154
-                'open'    => $open,
155
-                'name'    => $name,
156
-                'descr'   => $descr,
157
-                'img'     => $img
158
-            );
159
-        }
139
+	/**
140
+	 * retrieve all directories
141
+	 *
142
+	 * @return mixed reference to the {@link efqDirectory} object, FALSE if failed
143
+	 */
144
+	public function &getAll()
145
+	{
146
+		$sql = 'SELECT dirid,postfix,open,name,descr,img FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
147
+		if (!$result = $this->db->query($sql)) {
148
+			return false;
149
+		}
150
+		while (list($dirid, $postfix, $open, $name, $descr, $img) = $this->db->fetchRow($result)) {
151
+			$arr[] = array(
152
+				'dirid'   => $dirid,
153
+				'postfix' => $postfix,
154
+				'open'    => $open,
155
+				'name'    => $name,
156
+				'descr'   => $descr,
157
+				'img'     => $img
158
+			);
159
+		}
160 160
 
161
-        return $arr;
162
-    }
161
+		return $arr;
162
+	}
163 163
 
164
-    /**
165
-     * retrieve all directory ID's
166
-     *
167
-     * @param array $idarray
168
-     * @return array|bool
169
-     */
170
-    public function &getAllDirectoryIds($idarray = array())
171
-    {
172
-        $sql = 'SELECT dirid FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
173
-        if (!$result = $this->db->query($sql)) {
174
-            return false;
175
-        }
176
-        while (list($r_id) = $this->db->fetchRow($result)) {
177
-            array_push($idarray, $r_id);
178
-        }
164
+	/**
165
+	 * retrieve all directory ID's
166
+	 *
167
+	 * @param array $idarray
168
+	 * @return array|bool
169
+	 */
170
+	public function &getAllDirectoryIds($idarray = array())
171
+	{
172
+		$sql = 'SELECT dirid FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
173
+		if (!$result = $this->db->query($sql)) {
174
+			return false;
175
+		}
176
+		while (list($r_id) = $this->db->fetchRow($result)) {
177
+			array_push($idarray, $r_id);
178
+		}
179 179
 
180
-        return $idarray;
181
-    }
180
+		return $idarray;
181
+	}
182 182
 
183
-    /**
184
-     * retrieve all directory ID's and titles as array
185
-     *
186
-     * @param array $arr
187
-     * @return array|bool
188
-     */
189
-    public function &getAllDirectoryTitles($arr = array())
190
-    {
191
-        $sql = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
192
-        if (!$result = $this->db->query($sql)) {
193
-            return false;
194
-        }
195
-        while (list($r_id, $r_title) = $this->db->fetchRow($result)) {
196
-            $result_arr[$r_id] = $r_title;
197
-            //array_push($arr, $result_arr);
198
-        }
183
+	/**
184
+	 * retrieve all directory ID's and titles as array
185
+	 *
186
+	 * @param array $arr
187
+	 * @return array|bool
188
+	 */
189
+	public function &getAllDirectoryTitles($arr = array())
190
+	{
191
+		$sql = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
192
+		if (!$result = $this->db->query($sql)) {
193
+			return false;
194
+		}
195
+		while (list($r_id, $r_title) = $this->db->fetchRow($result)) {
196
+			$result_arr[$r_id] = $r_title;
197
+			//array_push($arr, $result_arr);
198
+		}
199 199
 
200
-        return $result_arr;
201
-    }
200
+		return $result_arr;
201
+	}
202 202
 
203
-    /**
204
-     * count number of directories and if count == 1, set directory.
205
-     *
206
-     * @return mixed $result, FALSE if failed, 0 if count is 0.
207
-     */
208
-    public function countAll()
209
-    {
210
-        global $xoopsDB;
211
-        $block       = array();
212
-        $myts        = MyTextSanitizer::getInstance();
213
-        $dirid       = 0;
214
-        $result      = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix('efqdiralpha1_dir') . '');
215
-        $num_results = $xoopsDB->getRowsNum($result);
216
-        if (!$result) {
217
-            return false;
218
-        } elseif ($num_results == 0) {
219
-            return 0;
220
-        } elseif ($num_results == 1) {
221
-            $row   = $GLOBALS['xoopsDB']->fetchBoth($result);
222
-            $dirid = $row['dirid'];
203
+	/**
204
+	 * count number of directories and if count == 1, set directory.
205
+	 *
206
+	 * @return mixed $result, FALSE if failed, 0 if count is 0.
207
+	 */
208
+	public function countAll()
209
+	{
210
+		global $xoopsDB;
211
+		$block       = array();
212
+		$myts        = MyTextSanitizer::getInstance();
213
+		$dirid       = 0;
214
+		$result      = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix('efqdiralpha1_dir') . '');
215
+		$num_results = $xoopsDB->getRowsNum($result);
216
+		if (!$result) {
217
+			return false;
218
+		} elseif ($num_results == 0) {
219
+			return 0;
220
+		} elseif ($num_results == 1) {
221
+			$row   = $GLOBALS['xoopsDB']->fetchBoth($result);
222
+			$dirid = $row['dirid'];
223 223
 
224
-            return $dirid;
225
-        } else {
226
-            return false;
227
-        }
228
-    }
224
+			return $dirid;
225
+		} else {
226
+			return false;
227
+		}
228
+	}
229 229
 
230
-    /**
231
-     * retrieve all directory ID's and names
232
-     *
233
-     * @param bool $dashes
234
-     * @return array $array
235
-     */
236
-    public function directoryArray($dashes = false)
237
-    {
238
-        $sql     = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' ORDER BY name ASC';
239
-        $result  = $this->db->query($sql);
240
-        $numrows = $this->db->getRowsNum($result);
241
-        $result  = $this->db->query($sql);
242
-        if ($dashes !== false) {
243
-            $arr = array('0' => '---');
244
-        }
245
-        while (list($dirid, $dirname) = $this->db->fetchRow($result)) {
246
-            $arr[$dirid] = $dirname;
247
-        }
230
+	/**
231
+	 * retrieve all directory ID's and names
232
+	 *
233
+	 * @param bool $dashes
234
+	 * @return array $array
235
+	 */
236
+	public function directoryArray($dashes = false)
237
+	{
238
+		$sql     = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' ORDER BY name ASC';
239
+		$result  = $this->db->query($sql);
240
+		$numrows = $this->db->getRowsNum($result);
241
+		$result  = $this->db->query($sql);
242
+		if ($dashes !== false) {
243
+			$arr = array('0' => '---');
244
+		}
245
+		while (list($dirid, $dirname) = $this->db->fetchRow($result)) {
246
+			$arr[$dirid] = $dirname;
247
+		}
248 248
 
249
-        return $arr;
250
-    }
249
+		return $arr;
250
+	}
251 251
 
252
-    /**
253
-     * Function insertDirectory inserts new record into DB
254
-     * @author    EFQ Consultancy <[email protected]>
255
-     * @copyright EFQ Consultancy (c) 2008
256
-     * @version   1.0.0
257
-     *
258
-     * @param   efqDirectory $obj object
259
-     *
260
-     * @param bool     $forceQuery
261
-     * @return bool true if insertion is succesful, false if unsuccesful
262
-     */
263
-    public function insertDirectory($obj, $forceQuery = false)
264
-    {
265
-        $tablename    = 'efqdiralpha1_dir';
266
-        $keyName      = 'dirid';
267
-        $excludedVars = array();
268
-        if ($obj instanceof efqDirectory) {
269
-            // Variable part of this function ends. From this line you can copy
270
-            // this function for similar object handling functions.
271
-            $obj->cleanVars();
272
-            $cleanvars = $obj->cleanVars;
273
-        } else {
274
-            return false;
275
-        }
276
-        $countVars = count($cleanvars);
277
-        $i         = 1;
278
-        $strFields = '';
279
-        $strValues = '';
280
-        foreach ($cleanvars as $k => $v) {
281
-            if (!in_array($k, $excludedVars)) {
282
-                $strFields .= $k;
283
-                $strValues .= "'" . $v . "'";
284
-                if ($i < $countVars) {
285
-                    $strFields .= ', ';
286
-                    $strValues .= ', ';
287
-                }
288
-                $i++;
289
-            }
290
-        }
291
-        $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
292
-        if ($forceQuery) {
293
-            if ($this->db->queryF($sql)) {
294
-                $itemid = $this->db->getInsertId();
295
-                $obj->setVar($keyName, $itemid);
252
+	/**
253
+	 * Function insertDirectory inserts new record into DB
254
+	 * @author    EFQ Consultancy <[email protected]>
255
+	 * @copyright EFQ Consultancy (c) 2008
256
+	 * @version   1.0.0
257
+	 *
258
+	 * @param   efqDirectory $obj object
259
+	 *
260
+	 * @param bool     $forceQuery
261
+	 * @return bool true if insertion is succesful, false if unsuccesful
262
+	 */
263
+	public function insertDirectory($obj, $forceQuery = false)
264
+	{
265
+		$tablename    = 'efqdiralpha1_dir';
266
+		$keyName      = 'dirid';
267
+		$excludedVars = array();
268
+		if ($obj instanceof efqDirectory) {
269
+			// Variable part of this function ends. From this line you can copy
270
+			// this function for similar object handling functions.
271
+			$obj->cleanVars();
272
+			$cleanvars = $obj->cleanVars;
273
+		} else {
274
+			return false;
275
+		}
276
+		$countVars = count($cleanvars);
277
+		$i         = 1;
278
+		$strFields = '';
279
+		$strValues = '';
280
+		foreach ($cleanvars as $k => $v) {
281
+			if (!in_array($k, $excludedVars)) {
282
+				$strFields .= $k;
283
+				$strValues .= "'" . $v . "'";
284
+				if ($i < $countVars) {
285
+					$strFields .= ', ';
286
+					$strValues .= ', ';
287
+				}
288
+				$i++;
289
+			}
290
+		}
291
+		$sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
292
+		if ($forceQuery) {
293
+			if ($this->db->queryF($sql)) {
294
+				$itemid = $this->db->getInsertId();
295
+				$obj->setVar($keyName, $itemid);
296 296
 
297
-                return true;
298
-            }
299
-        } else {
300
-            if ($this->db->query($sql)) {
301
-                $itemid = $this->db->getInsertId();
302
-                $obj->setVar($keyName, $itemid);
297
+				return true;
298
+			}
299
+		} else {
300
+			if ($this->db->query($sql)) {
301
+				$itemid = $this->db->getInsertId();
302
+				$obj->setVar($keyName, $itemid);
303 303
 
304
-                return true;
305
-            }
306
-        }
304
+				return true;
305
+			}
306
+		}
307 307
 
308
-        return false;
309
-    }
308
+		return false;
309
+	}
310 310
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 $this->assignVars($directory);
65 65
             } else {
66 66
                 $directoryHandler = xoops_getModuleHandler('directory', $moddir);
67
-                $objDirectory      = $directoryHandler->get($directory);
67
+                $objDirectory = $directoryHandler->get($directory);
68 68
                 foreach ($objDirectory->vars as $k => $v) {
69 69
                     $this->assignVar($k, $v['value']);
70 70
                 }
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
         if ($dirid === false) {
122 122
             return false;
123 123
         }
124
-        $dirid = (int)$dirid;
124
+        $dirid = (int) $dirid;
125 125
         if ($dirid > 0) {
126
-            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' WHERE dirid=' . $dirid;
126
+            $sql = 'SELECT * FROM '.$this->db->prefix('efqdiralpha1_dir').' WHERE dirid='.$dirid;
127 127
             if (!$result = $this->db->query($sql)) {
128 128
                 return false;
129 129
             }
130
-            $directory =& $this->create(false);
130
+            $directory = & $this->create(false);
131 131
             $directory->assignVars($this->db->fetchArray($result));
132 132
 
133 133
             return $directory;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function &getAll()
145 145
     {
146
-        $sql = 'SELECT dirid,postfix,open,name,descr,img FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
146
+        $sql = 'SELECT dirid,postfix,open,name,descr,img FROM '.$this->db->prefix('efqdiralpha1_dir').'';
147 147
         if (!$result = $this->db->query($sql)) {
148 148
             return false;
149 149
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function &getAllDirectoryIds($idarray = array())
171 171
     {
172
-        $sql = 'SELECT dirid FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
172
+        $sql = 'SELECT dirid FROM '.$this->db->prefix('efqdiralpha1_dir').'';
173 173
         if (!$result = $this->db->query($sql)) {
174 174
             return false;
175 175
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function &getAllDirectoryTitles($arr = array())
190 190
     {
191
-        $sql = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . '';
191
+        $sql = 'SELECT dirid, name FROM '.$this->db->prefix('efqdiralpha1_dir').'';
192 192
         if (!$result = $this->db->query($sql)) {
193 193
             return false;
194 194
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $block       = array();
212 212
         $myts        = MyTextSanitizer::getInstance();
213 213
         $dirid       = 0;
214
-        $result      = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix('efqdiralpha1_dir') . '');
214
+        $result      = $xoopsDB->query('SELECT dirid FROM '.$xoopsDB->prefix('efqdiralpha1_dir').'');
215 215
         $num_results = $xoopsDB->getRowsNum($result);
216 216
         if (!$result) {
217 217
             return false;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function directoryArray($dashes = false)
237 237
     {
238
-        $sql     = 'SELECT dirid, name FROM ' . $this->db->prefix('efqdiralpha1_dir') . ' ORDER BY name ASC';
238
+        $sql     = 'SELECT dirid, name FROM '.$this->db->prefix('efqdiralpha1_dir').' ORDER BY name ASC';
239 239
         $result  = $this->db->query($sql);
240 240
         $numrows = $this->db->getRowsNum($result);
241 241
         $result  = $this->db->query($sql);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         foreach ($cleanvars as $k => $v) {
281 281
             if (!in_array($k, $excludedVars)) {
282 282
                 $strFields .= $k;
283
-                $strValues .= "'" . $v . "'";
283
+                $strValues .= "'".$v."'";
284 284
                 if ($i < $countVars) {
285 285
                     $strFields .= ', ';
286 286
                     $strValues .= ', ';
Please login to merge, or discard this patch.
class/class.gmap.php 2 patches
Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -44,109 +44,109 @@  discard block
 block discarded – undo
44 44
  */
45 45
 class efqGmap extends XoopsObject
46 46
 {
47
-    private $_lon; //longitude
48
-    private $_lat; //lattitude
49
-    private $_descr; //description
50
-    private $_key; //developer's key
51
-    private $_zoomlevel; //zoom level of google map
52
-    private $_jsPointsArray; //javascript assigning points to google map
53
-    private $_map; // generate output for showing the map on a web page
54
-    public $db;
55
-
56
-    /**
57
-     * efqGmap constructor.
58
-     * @param bool $gmap
59
-     */
60
-    public function __construct($gmap = false)
61
-    {
62
-        global $xoopsModuleConfig;
63
-        $key = $xoopsModuleConfig['gmapkey'];
64
-        $this->setKey($key);
65
-        $this->setPointsJS('');
66
-
67
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
68
-        $this->initVar('id', XOBJ_DTYPE_INT, null, false);
69
-        $this->initVar('dataid', XOBJ_DTYPE_INT, null, true);
70
-        $this->initVar('lat', XOBJ_DTYPE_TXTBOX, null, true);
71
-        $this->initVar('lon', XOBJ_DTYPE_TXTBOX, null, true);
72
-        $this->initVar('descr', XOBJ_DTYPE_TXTAREA);
73
-
74
-        if ($gmap !== false) {
75
-            if (is_array($gmap)) {
76
-                $this->assignVars($gmap);
77
-            } else {
78
-                $$gmapHandler = xoops_getModuleHandler('gmap', $moddir);
79
-                $objGmap       =& $$gmapHandler->get($directory);
80
-                foreach ($objGmap->vars as $k => $v) {
81
-                    $this->assignVar($k, $v['value']);
82
-                }
83
-                unset($objGmap);
84
-            }
85
-        }
86
-    }
47
+	private $_lon; //longitude
48
+	private $_lat; //lattitude
49
+	private $_descr; //description
50
+	private $_key; //developer's key
51
+	private $_zoomlevel; //zoom level of google map
52
+	private $_jsPointsArray; //javascript assigning points to google map
53
+	private $_map; // generate output for showing the map on a web page
54
+	public $db;
55
+
56
+	/**
57
+	 * efqGmap constructor.
58
+	 * @param bool $gmap
59
+	 */
60
+	public function __construct($gmap = false)
61
+	{
62
+		global $xoopsModuleConfig;
63
+		$key = $xoopsModuleConfig['gmapkey'];
64
+		$this->setKey($key);
65
+		$this->setPointsJS('');
66
+
67
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
68
+		$this->initVar('id', XOBJ_DTYPE_INT, null, false);
69
+		$this->initVar('dataid', XOBJ_DTYPE_INT, null, true);
70
+		$this->initVar('lat', XOBJ_DTYPE_TXTBOX, null, true);
71
+		$this->initVar('lon', XOBJ_DTYPE_TXTBOX, null, true);
72
+		$this->initVar('descr', XOBJ_DTYPE_TXTAREA);
73
+
74
+		if ($gmap !== false) {
75
+			if (is_array($gmap)) {
76
+				$this->assignVars($gmap);
77
+			} else {
78
+				$$gmapHandler = xoops_getModuleHandler('gmap', $moddir);
79
+				$objGmap       =& $$gmapHandler->get($directory);
80
+				foreach ($objGmap->vars as $k => $v) {
81
+					$this->assignVar($k, $v['value']);
82
+				}
83
+				unset($objGmap);
84
+			}
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * @param string $key
90
-     */
91
-    public function setKey($key = '')
92
-    {
93
-        $this->_key = $key;
94
-    }
88
+	/**
89
+	 * @param string $key
90
+	 */
91
+	public function setKey($key = '')
92
+	{
93
+		$this->_key = $key;
94
+	}
95 95
 
96
-    /**
97
-     * Set the value of the script that triggers the points to be added to the google map.
98
-     * @param $pointsJS
99
-     */
100
-    public function setPointsJS($pointsJS)
101
-    {
102
-        $this->_jsPointsArray = $pointsJS;
103
-        $this->_map           = '';
104
-    }
96
+	/**
97
+	 * Set the value of the script that triggers the points to be added to the google map.
98
+	 * @param $pointsJS
99
+	 */
100
+	public function setPointsJS($pointsJS)
101
+	{
102
+		$this->_jsPointsArray = $pointsJS;
103
+		$this->_map           = '';
104
+	}
105 105
 
106
-    /**
107
-     * Get the value of the script that triggers the points to be added to the google map.
108
-     */
109
-    public function getPointsJS()
110
-    {
111
-        return $this->_jsPointsArray;
112
-    }
106
+	/**
107
+	 * Get the value of the script that triggers the points to be added to the google map.
108
+	 */
109
+	public function getPointsJS()
110
+	{
111
+		return $this->_jsPointsArray;
112
+	}
113 113
 
114
-    /**
115
-     * @return mixed
116
-     */
117
-    public function showMap()
118
-    {
119
-        return $this->_map;
120
-    }
114
+	/**
115
+	 * @return mixed
116
+	 */
117
+	public function showMap()
118
+	{
119
+		return $this->_map;
120
+	}
121 121
 
122
-    public function generateMap()
123
-    {
124
-        $this->_map .= $this->printPlaceHolder();
125
-        $this->_map .= $this->printScript($this->_jsPointsArray, $this->_key);
126
-        $this->_map .= $this->printTrigger();
127
-    }
122
+	public function generateMap()
123
+	{
124
+		$this->_map .= $this->printPlaceHolder();
125
+		$this->_map .= $this->printScript($this->_jsPointsArray, $this->_key);
126
+		$this->_map .= $this->printTrigger();
127
+	}
128 128
 
129
-    /**
130
-     * @param int $width
131
-     * @param int $height
132
-     * @return string
133
-     */
134
-    public function printPlaceHolder($width = 700, $height = 500)
135
-    {
136
-        return '<div id="map" style="width:' . $width . 'px; height:' . $height . 'px"></div>';
137
-    }
129
+	/**
130
+	 * @param int $width
131
+	 * @param int $height
132
+	 * @return string
133
+	 */
134
+	public function printPlaceHolder($width = 700, $height = 500)
135
+	{
136
+		return '<div id="map" style="width:' . $width . 'px; height:' . $height . 'px"></div>';
137
+	}
138 138
 
139
-    /**
140
-     * @param string $jsPointsArray
141
-     * @param string $key
142
-     * @return string
143
-     */
144
-    public function printScript($jsPointsArray = '', $key = '')
145
-    {
146
-        global $icmsPreloadHandler;
147
-
148
-        $icmsPreloadHandler->addPreloadEvents('gmap.php');
149
-        $gmapScript = <<<EOH
139
+	/**
140
+	 * @param string $jsPointsArray
141
+	 * @param string $key
142
+	 * @return string
143
+	 */
144
+	public function printScript($jsPointsArray = '', $key = '')
145
+	{
146
+		global $icmsPreloadHandler;
147
+
148
+		$icmsPreloadHandler->addPreloadEvents('gmap.php');
149
+		$gmapScript = <<<EOH
150 150
 <script type="text/javascript">
151 151
 var mArray = Array();
152 152
 var map;
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
 </script>\n
208 208
 EOH;
209 209
 
210
-        return $gmapScript;
211
-    }
210
+		return $gmapScript;
211
+	}
212 212
 
213
-    /**
214
-     * Adds a script which triggers the other javascript code to execute
215
-     */
216
-    public function printTrigger()
217
-    {
218
-        $trigger = <<<EOH
213
+	/**
214
+	 * Adds a script which triggers the other javascript code to execute
215
+	 */
216
+	public function printTrigger()
217
+	{
218
+		$trigger = <<<EOH
219 219
 <script>		
220 220
 if (window.onload){
221 221
     var oldonload = window.onload;
@@ -230,32 +230,32 @@  discard block
 block discarded – undo
230 230
 }
231 231
 </script>\n
232 232
 EOH;
233
-    }
233
+	}
234 234
 
235
-    /**
236
-     * Function setData sets class from array.
237
-     * @author    EFQ Consultancy <[email protected]>
238
-     * @copyright EFQ Consultancy (c) 2008
239
-     * @version   1.0.0
240
-     *
241
-     * @param $arr
242
-     * @return bool true if insertion is succesful, false if unsuccesful
243
-     * @internal  param object $obj object
244
-     *
245
-     */
246
-    public function setData($arr)
247
-    {
248
-        if (is_array($arr)) {
249
-            $vars = $this->getVars();
250
-            foreach ($vars as $k => $v) {
251
-                $this->setVar($k, $arr[$k]);
252
-            }
253
-        } else {
254
-            return false;
255
-        }
256
-
257
-        return true;
258
-    }
235
+	/**
236
+	 * Function setData sets class from array.
237
+	 * @author    EFQ Consultancy <[email protected]>
238
+	 * @copyright EFQ Consultancy (c) 2008
239
+	 * @version   1.0.0
240
+	 *
241
+	 * @param $arr
242
+	 * @return bool true if insertion is succesful, false if unsuccesful
243
+	 * @internal  param object $obj object
244
+	 *
245
+	 */
246
+	public function setData($arr)
247
+	{
248
+		if (is_array($arr)) {
249
+			$vars = $this->getVars();
250
+			foreach ($vars as $k => $v) {
251
+				$this->setVar($k, $arr[$k]);
252
+			}
253
+		} else {
254
+			return false;
255
+		}
256
+
257
+		return true;
258
+	}
259 259
 }
260 260
 
261 261
 /**
@@ -271,208 +271,208 @@  discard block
 block discarded – undo
271 271
 {
272 272
 //    public $db;
273 273
 
274
-    /**
275
-     * efqGmapHandler constructor.
276
-     */
277
-    public function __construct()
278
-    {
279
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
280
-    }
274
+	/**
275
+	 * efqGmapHandler constructor.
276
+	 */
277
+	public function __construct()
278
+	{
279
+		$this->db = XoopsDatabaseFactory::getDatabaseConnection();
280
+	}
281 281
 
282
-    /**
283
-     * create instance of efqGmap class or reset the existing instance.
284
-     *
285
-     * @param bool $isNew
286
-     * @return efqGmap $efqGmap
287
-     */
288
-    public function &create($isNew = true)
289
-    {
290
-        $gmap = new efqGmap();
291
-        if ($isNew) {
292
-            $gmap->setNew();
293
-        }
294
-
295
-        return $gmap;
296
-    }
282
+	/**
283
+	 * create instance of efqGmap class or reset the existing instance.
284
+	 *
285
+	 * @param bool $isNew
286
+	 * @return efqGmap $efqGmap
287
+	 */
288
+	public function &create($isNew = true)
289
+	{
290
+		$gmap = new efqGmap();
291
+		if ($isNew) {
292
+			$gmap->setNew();
293
+		}
297 294
 
298
-    /**
299
-     * retrieve all points from the database
300
-     *
301
-     * @param $gmap
302
-     * @return mixed reference to the <a href='psi_element://efqGmap'>efqGmap</a> object, FALSE if failed
303
-     * object, FALSE if failed
304
-     * @internal param int $dirid ID of the directory
305
-     */
306
-    public function getPointsJS($gmap)
307
-    {
308
-        if (!is_object($gmap)) {
309
-            return false;
310
-        }
311
-        $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps');
312
-        if (!$result = $this->db->query($sql)) {
313
-            return false;
314
-        }
315
-        $gmap       =& $this->create(false);
316
-        $javaScript = '';
317
-        while ($row = $this->db->fetchArray($result)) {
318
-            //$row{'descr'} = addslashes($row{'descr'});
319
-            $row['descr'] = addslashes($row['descr']);
320
-            //$row{'descr'} = str_replace(';',',',$row{'descr'});
321
-            $row['descr'] = str_replace(';', ',', $row['descr']);
322
-            //$javaScript .= "mArray.push('{$row{'lat'}};{$row{'lon'}};{$row{'descr'}}')\n";
323
-            //echo $row['lat'];
324
-            $javaScript .= "mArray.push('{" . $row['lat'] . '};{' . $row['lon'] . '};{' . $row['descr'] . "}')\n";
325
-        }
326
-        $gmap->setPointsJS($javaScript);
327
-
328
-        return true;
329
-    }
295
+		return $gmap;
296
+	}
330 297
 
331
-    /**
332
-     * @param int $id
333
-     * @return array
334
-     */
335
-    public function getGmapById($id = 0)
336
-    {
337
-        $arr = array();
338
-        $sql = sprintf('SELECT * FROM %s WHERE id=%u', $this->db->prefix('efqdiralpha1_gmaps'), (int)$id);
339
-        $result = $this->db->query($sql) or $eh->show('0013');
340
-        while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) {
341
-            $arr = array('id' => $id, 'lat' => $lat, 'lon' => $lon, 'descr' => $descr, 'dataid' => $dataid);
342
-        }
343
-
344
-        return $arr;
345
-    }
298
+	/**
299
+	 * retrieve all points from the database
300
+	 *
301
+	 * @param $gmap
302
+	 * @return mixed reference to the <a href='psi_element://efqGmap'>efqGmap</a> object, FALSE if failed
303
+	 * object, FALSE if failed
304
+	 * @internal param int $dirid ID of the directory
305
+	 */
306
+	public function getPointsJS($gmap)
307
+	{
308
+		if (!is_object($gmap)) {
309
+			return false;
310
+		}
311
+		$sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps');
312
+		if (!$result = $this->db->query($sql)) {
313
+			return false;
314
+		}
315
+		$gmap       =& $this->create(false);
316
+		$javaScript = '';
317
+		while ($row = $this->db->fetchArray($result)) {
318
+			//$row{'descr'} = addslashes($row{'descr'});
319
+			$row['descr'] = addslashes($row['descr']);
320
+			//$row{'descr'} = str_replace(';',',',$row{'descr'});
321
+			$row['descr'] = str_replace(';', ',', $row['descr']);
322
+			//$javaScript .= "mArray.push('{$row{'lat'}};{$row{'lon'}};{$row{'descr'}}')\n";
323
+			//echo $row['lat'];
324
+			$javaScript .= "mArray.push('{" . $row['lat'] . '};{' . $row['lon'] . '};{' . $row['descr'] . "}')\n";
325
+		}
326
+		$gmap->setPointsJS($javaScript);
346 327
 
347
-    /**
348
-     * @param int $id
349
-     * @return bool|efqGmap
350
-     */
351
-    public function getByDataId($id = 0)
352
-    {
353
-        if ($id === false) {
354
-            return false;
355
-        }
356
-        $id = (int)$id;
357
-        echo $id;
358
-        if ($id > 0) {
359
-            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps') . ' WHERE dataid=' . (int)$id;
360
-            if (!$result = $this->db->query($sql)) {
361
-                return false;
362
-            }
363
-            $gmap =& $this->create(false);
364
-            $gmap->assignVars($this->db->fetchArray($result));
365
-
366
-            return $gmap;
367
-        }
368
-
369
-        return false;
370
-    }
328
+		return true;
329
+	}
371 330
 
372
-    /**
373
-     * Function insertGmap inserts google map data into DB
374
-     * @author    EFQ Consultancy <[email protected]>
375
-     * @copyright EFQ Consultancy (c) 2008
376
-     * @version   1.0.0
377
-     *
378
-     * @param   efqGmap $obj object
379
-     *
380
-     * @param bool     $forceQuery
381
-     * @return bool true if insertion is succesful, false if unsuccesful
382
-     */
383
-    public function insertGmap($obj, $forceQuery = false)
384
-    {
385
-        $tablename = 'efqdiralpha1_gmaps';
386
-        $keyName   = 'id';
387
-        if ($obj instanceof efqGmap) {
388
-            // Variable part of this function ends. From this line you can copy
389
-            // this function for similar object handling functions.
390
-            $obj->cleanVars();
391
-            $cleanvars = $obj->cleanVars;
392
-        } else {
393
-            return false;
394
-        }
395
-        $countVars = count($cleanvars);
396
-        $i         = 1;
397
-        $strFields = '';
398
-        $strValues = '';
399
-        foreach ($cleanvars as $k => $v) {
400
-            $strFields .= $k;
401
-            $strValues .= "'" . $v . "'";
402
-            if ($i < $countVars) {
403
-                $strFields .= ', ';
404
-                $strValues .= ', ';
405
-            }
406
-            $i++;
407
-        }
408
-        $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
409
-        if ($forceQuery) {
410
-            if ($this->db->queryF($sql)) {
411
-                $itemid = $this->db->getInsertId();
412
-                $obj->setVar($keyName, $itemid);
413
-
414
-                return true;
415
-            }
416
-        } else {
417
-            if ($this->db->query($sql)) {
418
-                $itemid = $this->db->getInsertId();
419
-                $obj->setVar($keyName, $itemid);
420
-
421
-                return true;
422
-            }
423
-        }
424
-
425
-        return false;
426
-    }
331
+	/**
332
+	 * @param int $id
333
+	 * @return array
334
+	 */
335
+	public function getGmapById($id = 0)
336
+	{
337
+		$arr = array();
338
+		$sql = sprintf('SELECT * FROM %s WHERE id=%u', $this->db->prefix('efqdiralpha1_gmaps'), (int)$id);
339
+		$result = $this->db->query($sql) or $eh->show('0013');
340
+		while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) {
341
+			$arr = array('id' => $id, 'lat' => $lat, 'lon' => $lon, 'descr' => $descr, 'dataid' => $dataid);
342
+		}
427 343
 
428
-    /**
429
-     * Function updateGmap updates google map data
430
-     * @author    EFQ Consultancy <[email protected]>
431
-     * @copyright EFQ Consultancy (c) 2008
432
-     * @version   1.0.0
433
-     *
434
-     * @param   efqGmap $obj object
435
-     *
436
-     * @param bool     $forceQuery
437
-     * @return bool true if update is succesful, false if unsuccesful
438
-     */
439
-    public function updateGmap($obj, $forceQuery = false)
440
-    {
441
-        $tablename = 'efqdiralpha1_gmaps';
442
-        $keyName   = 'id';
443
-        if ($obj instanceof efqGmap) {
444
-            // Variable part of this function ends. From this line you can copy
445
-            // this function for similar object handling functions.
446
-            $obj->cleanVars();
447
-            $cleanvars = $obj->cleanVars;
448
-            $keyValue  = $obj->getVar($keyName);
449
-        } else {
450
-            return false;
451
-        }
452
-        $countVars = count($cleanvars);
453
-        $i         = 1;
454
-        $strSet    = '';
455
-        $strValues = '';
456
-        foreach ($cleanvars as $k => $v) {
457
-            if ($k !== 'id') {
458
-                $strSet .= $k . '=' . "'" . $v . "'";
459
-                if ($i < $countVars) {
460
-                    $strSet .= ', ';
461
-                }
462
-            }
463
-            $i++;
464
-        }
465
-        $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue);
466
-        if ($forceQuery) {
467
-            if ($this->db->queryF($sql)) {
468
-                return true;
469
-            }
470
-        } else {
471
-            if ($this->db->query($sql)) {
472
-                return true;
473
-            }
474
-        }
475
-
476
-        return false;
477
-    }
344
+		return $arr;
345
+	}
346
+
347
+	/**
348
+	 * @param int $id
349
+	 * @return bool|efqGmap
350
+	 */
351
+	public function getByDataId($id = 0)
352
+	{
353
+		if ($id === false) {
354
+			return false;
355
+		}
356
+		$id = (int)$id;
357
+		echo $id;
358
+		if ($id > 0) {
359
+			$sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps') . ' WHERE dataid=' . (int)$id;
360
+			if (!$result = $this->db->query($sql)) {
361
+				return false;
362
+			}
363
+			$gmap =& $this->create(false);
364
+			$gmap->assignVars($this->db->fetchArray($result));
365
+
366
+			return $gmap;
367
+		}
368
+
369
+		return false;
370
+	}
371
+
372
+	/**
373
+	 * Function insertGmap inserts google map data into DB
374
+	 * @author    EFQ Consultancy <[email protected]>
375
+	 * @copyright EFQ Consultancy (c) 2008
376
+	 * @version   1.0.0
377
+	 *
378
+	 * @param   efqGmap $obj object
379
+	 *
380
+	 * @param bool     $forceQuery
381
+	 * @return bool true if insertion is succesful, false if unsuccesful
382
+	 */
383
+	public function insertGmap($obj, $forceQuery = false)
384
+	{
385
+		$tablename = 'efqdiralpha1_gmaps';
386
+		$keyName   = 'id';
387
+		if ($obj instanceof efqGmap) {
388
+			// Variable part of this function ends. From this line you can copy
389
+			// this function for similar object handling functions.
390
+			$obj->cleanVars();
391
+			$cleanvars = $obj->cleanVars;
392
+		} else {
393
+			return false;
394
+		}
395
+		$countVars = count($cleanvars);
396
+		$i         = 1;
397
+		$strFields = '';
398
+		$strValues = '';
399
+		foreach ($cleanvars as $k => $v) {
400
+			$strFields .= $k;
401
+			$strValues .= "'" . $v . "'";
402
+			if ($i < $countVars) {
403
+				$strFields .= ', ';
404
+				$strValues .= ', ';
405
+			}
406
+			$i++;
407
+		}
408
+		$sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues);
409
+		if ($forceQuery) {
410
+			if ($this->db->queryF($sql)) {
411
+				$itemid = $this->db->getInsertId();
412
+				$obj->setVar($keyName, $itemid);
413
+
414
+				return true;
415
+			}
416
+		} else {
417
+			if ($this->db->query($sql)) {
418
+				$itemid = $this->db->getInsertId();
419
+				$obj->setVar($keyName, $itemid);
420
+
421
+				return true;
422
+			}
423
+		}
424
+
425
+		return false;
426
+	}
427
+
428
+	/**
429
+	 * Function updateGmap updates google map data
430
+	 * @author    EFQ Consultancy <[email protected]>
431
+	 * @copyright EFQ Consultancy (c) 2008
432
+	 * @version   1.0.0
433
+	 *
434
+	 * @param   efqGmap $obj object
435
+	 *
436
+	 * @param bool     $forceQuery
437
+	 * @return bool true if update is succesful, false if unsuccesful
438
+	 */
439
+	public function updateGmap($obj, $forceQuery = false)
440
+	{
441
+		$tablename = 'efqdiralpha1_gmaps';
442
+		$keyName   = 'id';
443
+		if ($obj instanceof efqGmap) {
444
+			// Variable part of this function ends. From this line you can copy
445
+			// this function for similar object handling functions.
446
+			$obj->cleanVars();
447
+			$cleanvars = $obj->cleanVars;
448
+			$keyValue  = $obj->getVar($keyName);
449
+		} else {
450
+			return false;
451
+		}
452
+		$countVars = count($cleanvars);
453
+		$i         = 1;
454
+		$strSet    = '';
455
+		$strValues = '';
456
+		foreach ($cleanvars as $k => $v) {
457
+			if ($k !== 'id') {
458
+				$strSet .= $k . '=' . "'" . $v . "'";
459
+				if ($i < $countVars) {
460
+					$strSet .= ', ';
461
+				}
462
+			}
463
+			$i++;
464
+		}
465
+		$sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue);
466
+		if ($forceQuery) {
467
+			if ($this->db->queryF($sql)) {
468
+				return true;
469
+			}
470
+		} else {
471
+			if ($this->db->query($sql)) {
472
+				return true;
473
+			}
474
+		}
475
+
476
+		return false;
477
+	}
478 478
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 $this->assignVars($gmap);
77 77
             } else {
78 78
                 $$gmapHandler = xoops_getModuleHandler('gmap', $moddir);
79
-                $objGmap       =& $$gmapHandler->get($directory);
79
+                $objGmap = & $$gmapHandler->get($directory);
80 80
                 foreach ($objGmap->vars as $k => $v) {
81 81
                     $this->assignVar($k, $v['value']);
82 82
                 }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function printPlaceHolder($width = 700, $height = 500)
135 135
     {
136
-        return '<div id="map" style="width:' . $width . 'px; height:' . $height . 'px"></div>';
136
+        return '<div id="map" style="width:'.$width.'px; height:'.$height.'px"></div>';
137 137
     }
138 138
 
139 139
     /**
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
         if (!is_object($gmap)) {
309 309
             return false;
310 310
         }
311
-        $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps');
311
+        $sql = 'SELECT * FROM '.$this->db->prefix('efqdiralpha1_gmaps');
312 312
         if (!$result = $this->db->query($sql)) {
313 313
             return false;
314 314
         }
315
-        $gmap       =& $this->create(false);
315
+        $gmap       = & $this->create(false);
316 316
         $javaScript = '';
317 317
         while ($row = $this->db->fetchArray($result)) {
318 318
             //$row{'descr'} = addslashes($row{'descr'});
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             $row['descr'] = str_replace(';', ',', $row['descr']);
322 322
             //$javaScript .= "mArray.push('{$row{'lat'}};{$row{'lon'}};{$row{'descr'}}')\n";
323 323
             //echo $row['lat'];
324
-            $javaScript .= "mArray.push('{" . $row['lat'] . '};{' . $row['lon'] . '};{' . $row['descr'] . "}')\n";
324
+            $javaScript .= "mArray.push('{".$row['lat'].'};{'.$row['lon'].'};{'.$row['descr']."}')\n";
325 325
         }
326 326
         $gmap->setPointsJS($javaScript);
327 327
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     public function getGmapById($id = 0)
336 336
     {
337 337
         $arr = array();
338
-        $sql = sprintf('SELECT * FROM %s WHERE id=%u', $this->db->prefix('efqdiralpha1_gmaps'), (int)$id);
338
+        $sql = sprintf('SELECT * FROM %s WHERE id=%u', $this->db->prefix('efqdiralpha1_gmaps'), (int) $id);
339 339
         $result = $this->db->query($sql) or $eh->show('0013');
340 340
         while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) {
341 341
             $arr = array('id' => $id, 'lat' => $lat, 'lon' => $lon, 'descr' => $descr, 'dataid' => $dataid);
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
         if ($id === false) {
354 354
             return false;
355 355
         }
356
-        $id = (int)$id;
356
+        $id = (int) $id;
357 357
         echo $id;
358 358
         if ($id > 0) {
359
-            $sql = 'SELECT * FROM ' . $this->db->prefix('efqdiralpha1_gmaps') . ' WHERE dataid=' . (int)$id;
359
+            $sql = 'SELECT * FROM '.$this->db->prefix('efqdiralpha1_gmaps').' WHERE dataid='.(int) $id;
360 360
             if (!$result = $this->db->query($sql)) {
361 361
                 return false;
362 362
             }
363
-            $gmap =& $this->create(false);
363
+            $gmap = & $this->create(false);
364 364
             $gmap->assignVars($this->db->fetchArray($result));
365 365
 
366 366
             return $gmap;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         $strValues = '';
399 399
         foreach ($cleanvars as $k => $v) {
400 400
             $strFields .= $k;
401
-            $strValues .= "'" . $v . "'";
401
+            $strValues .= "'".$v."'";
402 402
             if ($i < $countVars) {
403 403
                 $strFields .= ', ';
404 404
                 $strValues .= ', ';
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $strValues = '';
456 456
         foreach ($cleanvars as $k => $v) {
457 457
             if ($k !== 'id') {
458
-                $strSet .= $k . '=' . "'" . $v . "'";
458
+                $strSet .= $k.'='."'".$v."'";
459 459
                 if ($i < $countVars) {
460 460
                     $strSet .= ', ';
461 461
                 }
Please login to merge, or discard this patch.
class/class.fieldtype.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class efqFieldType extends XoopsObject
31 31
 {
32
-    /**
33
-     * efqFieldType constructor.
34
-     */
35
-    public function __construct()
36
-    {
37
-    }
32
+	/**
33
+	 * efqFieldType constructor.
34
+	 */
35
+	public function __construct()
36
+	{
37
+	}
38 38
 }
39 39
 
40 40
 /**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class efqFieldTypeHandler extends XoopsObjectHandler
50 50
 {
51
-    /**
52
-     * efqFieldTypeHandler constructor.
53
-     */
54
-    public function __construct()
55
-    {
56
-    }
51
+	/**
52
+	 * efqFieldTypeHandler constructor.
53
+	 */
54
+	public function __construct()
55
+	{
56
+	}
57 57
 }
Please login to merge, or discard this patch.