@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | { |
49 | 49 | global $moddir; |
50 | 50 | $this->db = Database::getInstance(); |
51 | - $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, null, false); |
|
52 | - $this->initVar('dirid', XOBJ_DTYPE_INT, null, false); |
|
53 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
54 | - $this->initVar('fieldtype', XOBJ_DTYPE_TXTBOX); |
|
55 | - $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
|
56 | - $this->initVar('ext', XOBJ_DTYPE_TXTBOX); |
|
51 | + $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, null, false); |
|
52 | + $this->initVar('dirid', XOBJ_DTYPE_INT, null, false); |
|
53 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
54 | + $this->initVar('fieldtype', XOBJ_DTYPE_TXTBOX); |
|
55 | + $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
|
56 | + $this->initVar('ext', XOBJ_DTYPE_TXTBOX); |
|
57 | 57 | $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, false); |
58 | 58 | |
59 | 59 | if ($fieldtype != false) { |
60 | 60 | if (is_array($fieldtype)) { |
61 | - $this->assignVars($fieldtype); |
|
62 | - } else { |
|
61 | + $this->assignVars($fieldtype); |
|
62 | + } else { |
|
63 | 63 | $fieldtype_handler = new efqFieldTypeHandler($this->db); |
64 | - $objFieldtype =& $fieldtype_handler->get($fieldtype); |
|
65 | - foreach ($objFieldtype->vars as $k => $v) { |
|
66 | - $this->assignVar($k, $v['value']); |
|
67 | - } |
|
68 | - unset($objFieldtype); |
|
69 | - } |
|
70 | - } |
|
64 | + $objFieldtype =& $fieldtype_handler->get($fieldtype); |
|
65 | + foreach ($objFieldtype->vars as $k => $v) { |
|
66 | + $this->assignVar($k, $v['value']); |
|
67 | + } |
|
68 | + unset($objFieldtype); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -201,37 +201,37 @@ discard block |
||
201 | 201 | $sql = "DELETE * FROM ".$this->db->prefix("efqdiralpha1_fieldtypes")." WHERE typeid='".intval($this->getVar("typeid"))."'"; |
202 | 202 | if ($force) { |
203 | 203 | if (!$result = $this->db->queryF($sql)) { |
204 | - return false; |
|
205 | - } |
|
204 | + return false; |
|
205 | + } |
|
206 | 206 | } else { |
207 | 207 | if (!$result = $this->db->query($sql)) { |
208 | - return false; |
|
209 | - } |
|
208 | + return false; |
|
209 | + } |
|
210 | 210 | } |
211 | - return true; |
|
211 | + return true; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
215 | - * retrieve all field types for a directory |
|
216 | - * |
|
217 | - * @param int $dirid ID of the directory |
|
218 | - * @return array $arr or boolean false |
|
219 | - */ |
|
215 | + * retrieve all field types for a directory |
|
216 | + * |
|
217 | + * @param int $dirid ID of the directory |
|
218 | + * @return array $arr or boolean false |
|
219 | + */ |
|
220 | 220 | function getByDir($dirid=0) |
221 | 221 | { |
222 | 222 | //Get all fieldtypes for the selected directory |
223 | 223 | $sql = "SELECT typeid,title,fieldtype,descr,ext,activeyn FROM ".$this->db->prefix("efqdiralpha1_fieldtypes")." WHERE dirid=".intval($dirid).""; |
224 | - if (!$result = $this->db->query($sql)) { |
|
225 | - return false; |
|
226 | - } |
|
227 | - $result = $this->db->query($sql); |
|
224 | + if (!$result = $this->db->query($sql)) { |
|
225 | + return false; |
|
226 | + } |
|
227 | + $result = $this->db->query($sql); |
|
228 | 228 | $numrows = $this->db->getRowsNum($result); |
229 | 229 | $result = $this->db->query($sql); |
230 | 230 | $arr = array(); |
231 | - while ( list($typeid,$title,$fieldtype,$descr,$ext,$activeyn) = $this->db->fetchRow($result) ) { |
|
231 | + while ( list($typeid,$title,$fieldtype,$descr,$ext,$activeyn) = $this->db->fetchRow($result) ) { |
|
232 | 232 | $arr[$typeid] = array('typeid' => $typeid,'title' => $title,'fieldtype' => $fieldtype,'descr' => $descr, 'ext' => $ext, 'activeyn' => $activeyn); |
233 | 233 | } |
234 | - return $arr; |
|
234 | + return $arr; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 |
@@ -74,54 +74,54 @@ discard block |
||
74 | 74 | class XoopsImageHandler extends XoopsObjectHandler |
75 | 75 | { |
76 | 76 | |
77 | - /** |
|
78 | - * Create a new {@link XoopsImage} |
|
79 | - * |
|
80 | - * @param boolean $isNew Flag the object as "new" |
|
81 | - * @return object |
|
82 | - **/ |
|
83 | - function &create($isNew = true) |
|
84 | - { |
|
85 | - $image = new XoopsImage(); |
|
86 | - if ($isNew) { |
|
87 | - $image->setNew(); |
|
88 | - } |
|
89 | - return $image; |
|
90 | - } |
|
77 | + /** |
|
78 | + * Create a new {@link XoopsImage} |
|
79 | + * |
|
80 | + * @param boolean $isNew Flag the object as "new" |
|
81 | + * @return object |
|
82 | + **/ |
|
83 | + function &create($isNew = true) |
|
84 | + { |
|
85 | + $image = new XoopsImage(); |
|
86 | + if ($isNew) { |
|
87 | + $image->setNew(); |
|
88 | + } |
|
89 | + return $image; |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Write a {@link XoopsImage} object to the database |
|
94 | - * |
|
95 | - * @param object &$image {@link XoopsImage} |
|
96 | - * @return bool |
|
97 | - **/ |
|
98 | - function insert(&$image, $itemid='0') |
|
99 | - { |
|
100 | - global $image_name; |
|
101 | - if ($itemid == '0') { |
|
92 | + /** |
|
93 | + * Write a {@link XoopsImage} object to the database |
|
94 | + * |
|
95 | + * @param object &$image {@link XoopsImage} |
|
96 | + * @return bool |
|
97 | + **/ |
|
98 | + function insert(&$image, $itemid='0') |
|
99 | + { |
|
100 | + global $image_name; |
|
101 | + if ($itemid == '0') { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | //if (strtolower(get_class($image)) != 'xoopsimage') { |
105 | - // return false; |
|
106 | - //} |
|
107 | - if (!$image->isDirty()) { |
|
108 | - return true; |
|
109 | - } |
|
110 | - if (!$image->cleanVars()) { |
|
111 | - return false; |
|
112 | - } |
|
113 | - foreach ($image->cleanVars as $k => $v) { |
|
114 | - ${$k} = $v; |
|
115 | - } |
|
116 | - if ($image->isNew()) { |
|
117 | - $image_id = $this->db->genId('image_image_id_seq'); |
|
118 | - $sql = sprintf("INSERT INTO %s WHERE itemid=".$itemid." (logourl) VALUES (%s)", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
119 | - if (!$result = $this->db->query($sql)) { |
|
120 | - return false; |
|
121 | - } |
|
122 | - if (empty($image_id)) { |
|
123 | - $image_id = $this->db->getInsertId(); |
|
124 | - } |
|
105 | + // return false; |
|
106 | + //} |
|
107 | + if (!$image->isDirty()) { |
|
108 | + return true; |
|
109 | + } |
|
110 | + if (!$image->cleanVars()) { |
|
111 | + return false; |
|
112 | + } |
|
113 | + foreach ($image->cleanVars as $k => $v) { |
|
114 | + ${$k} = $v; |
|
115 | + } |
|
116 | + if ($image->isNew()) { |
|
117 | + $image_id = $this->db->genId('image_image_id_seq'); |
|
118 | + $sql = sprintf("INSERT INTO %s WHERE itemid=".$itemid." (logourl) VALUES (%s)", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
119 | + if (!$result = $this->db->query($sql)) { |
|
120 | + return false; |
|
121 | + } |
|
122 | + if (empty($image_id)) { |
|
123 | + $image_id = $this->db->getInsertId(); |
|
124 | + } |
|
125 | 125 | /* if (isset($image_body) && $image_body != '') { |
126 | 126 | $sql = sprintf("INSERT INTO %s (image_id, image_body) VALUES (%u, %s)", $this->db->prefix('imagebody'), $image_id, $this->db->quoteString($image_body)); |
127 | 127 | if (!$result = $this->db->query($sql)) { |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | } */ |
133 | - /* $image->assignVar('image_id', $image_id); */ |
|
134 | - } else { |
|
135 | - $sql = sprintf("UPDATE %s SET image_name = %s WHERE itemid = %u", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
136 | - if (!$result = $this->db->query($sql)) { |
|
137 | - return false; |
|
138 | - } |
|
133 | + /* $image->assignVar('image_id', $image_id); */ |
|
134 | + } else { |
|
135 | + $sql = sprintf("UPDATE %s SET image_name = %s WHERE itemid = %u", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
136 | + if (!$result = $this->db->query($sql)) { |
|
137 | + return false; |
|
138 | + } |
|
139 | 139 | /* if (isset($image_body) && $image_body != '') { |
140 | 140 | $sql = sprintf("UPDATE %s SET image_body = %s WHERE image_id = %u", $this->db->prefix('imagebody'), $this->db->quoteString($image_body), $image_id); |
141 | 141 | if (!$result = $this->db->query($sql)) { |
@@ -143,110 +143,110 @@ discard block |
||
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | } */ |
146 | - } |
|
147 | - return true; |
|
148 | - } |
|
146 | + } |
|
147 | + return true; |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Delete an image from the database |
|
152 | - * |
|
153 | - * @param object &$image {@link XoopsImage} |
|
154 | - * @return bool |
|
155 | - **/ |
|
156 | - function delete(&$image) |
|
157 | - { |
|
158 | - if (strtolower(get_class($image)) != 'xoopsimage') { |
|
159 | - return false; |
|
160 | - } |
|
161 | - $id = $image->getVar('image_id'); |
|
162 | - $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $id); |
|
163 | - if (!$result = $this->db->query($sql)) { |
|
164 | - return false; |
|
165 | - } |
|
166 | - $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('imagebody'), $id); |
|
167 | - $this->db->query($sql); |
|
168 | - return true; |
|
169 | - } |
|
150 | + /** |
|
151 | + * Delete an image from the database |
|
152 | + * |
|
153 | + * @param object &$image {@link XoopsImage} |
|
154 | + * @return bool |
|
155 | + **/ |
|
156 | + function delete(&$image) |
|
157 | + { |
|
158 | + if (strtolower(get_class($image)) != 'xoopsimage') { |
|
159 | + return false; |
|
160 | + } |
|
161 | + $id = $image->getVar('image_id'); |
|
162 | + $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $id); |
|
163 | + if (!$result = $this->db->query($sql)) { |
|
164 | + return false; |
|
165 | + } |
|
166 | + $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('imagebody'), $id); |
|
167 | + $this->db->query($sql); |
|
168 | + return true; |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * Load {@link XoopsImage}s from the database |
|
173 | - * |
|
174 | - * @param object $criteria {@link CriteriaElement} |
|
175 | - * @param boolean $id_as_key Use the ID as key into the array |
|
176 | - * @param boolean $getbinary |
|
177 | - * @return array Array of {@link XoopsImage} objects |
|
178 | - **/ |
|
179 | - function &getObjects($criteria = null, $id_as_key = false, $getbinary = false) |
|
180 | - { |
|
181 | - $ret = array(); |
|
182 | - $limit = $start = 0; |
|
183 | - if ($getbinary) { |
|
184 | - $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'; |
|
185 | - } else { |
|
186 | - $sql = 'SELECT * FROM '.$this->db->prefix('image'); |
|
187 | - } |
|
188 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
189 | - $sql .= ' '.$criteria->renderWhere(); |
|
190 | - $sort = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort(); |
|
191 | - $sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder(); |
|
192 | - $limit = $criteria->getLimit(); |
|
193 | - $start = $criteria->getStart(); |
|
194 | - } |
|
195 | - $result = $this->db->query($sql, $limit, $start); |
|
196 | - if (!$result) { |
|
197 | - return $ret; |
|
198 | - } |
|
199 | - while ($myrow = $this->db->fetchArray($result)) { |
|
200 | - $image = new XoopsImage(); |
|
201 | - $image->assignVars($myrow); |
|
202 | - if (!$id_as_key) { |
|
203 | - $ret[] =& $image; |
|
204 | - } else { |
|
205 | - $ret[$myrow['image_id']] =& $image; |
|
206 | - } |
|
207 | - unset($image); |
|
208 | - } |
|
209 | - return $ret; |
|
210 | - } |
|
171 | + /** |
|
172 | + * Load {@link XoopsImage}s from the database |
|
173 | + * |
|
174 | + * @param object $criteria {@link CriteriaElement} |
|
175 | + * @param boolean $id_as_key Use the ID as key into the array |
|
176 | + * @param boolean $getbinary |
|
177 | + * @return array Array of {@link XoopsImage} objects |
|
178 | + **/ |
|
179 | + function &getObjects($criteria = null, $id_as_key = false, $getbinary = false) |
|
180 | + { |
|
181 | + $ret = array(); |
|
182 | + $limit = $start = 0; |
|
183 | + if ($getbinary) { |
|
184 | + $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'; |
|
185 | + } else { |
|
186 | + $sql = 'SELECT * FROM '.$this->db->prefix('image'); |
|
187 | + } |
|
188 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
189 | + $sql .= ' '.$criteria->renderWhere(); |
|
190 | + $sort = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort(); |
|
191 | + $sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder(); |
|
192 | + $limit = $criteria->getLimit(); |
|
193 | + $start = $criteria->getStart(); |
|
194 | + } |
|
195 | + $result = $this->db->query($sql, $limit, $start); |
|
196 | + if (!$result) { |
|
197 | + return $ret; |
|
198 | + } |
|
199 | + while ($myrow = $this->db->fetchArray($result)) { |
|
200 | + $image = new XoopsImage(); |
|
201 | + $image->assignVars($myrow); |
|
202 | + if (!$id_as_key) { |
|
203 | + $ret[] =& $image; |
|
204 | + } else { |
|
205 | + $ret[$myrow['image_id']] =& $image; |
|
206 | + } |
|
207 | + unset($image); |
|
208 | + } |
|
209 | + return $ret; |
|
210 | + } |
|
211 | 211 | |
212 | - /** |
|
213 | - * Count some images |
|
214 | - * |
|
215 | - * @param object $criteria {@link CriteriaElement} |
|
216 | - * @return int |
|
217 | - **/ |
|
218 | - function getCount($criteria = null) |
|
219 | - { |
|
220 | - $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('image'); |
|
221 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
222 | - $sql .= ' '.$criteria->renderWhere(); |
|
223 | - } |
|
224 | - if (!$result =& $this->db->query($sql)) { |
|
225 | - return 0; |
|
226 | - } |
|
227 | - list($count) = $this->db->fetchRow($result); |
|
228 | - return $count; |
|
229 | - } |
|
212 | + /** |
|
213 | + * Count some images |
|
214 | + * |
|
215 | + * @param object $criteria {@link CriteriaElement} |
|
216 | + * @return int |
|
217 | + **/ |
|
218 | + function getCount($criteria = null) |
|
219 | + { |
|
220 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('image'); |
|
221 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
222 | + $sql .= ' '.$criteria->renderWhere(); |
|
223 | + } |
|
224 | + if (!$result =& $this->db->query($sql)) { |
|
225 | + return 0; |
|
226 | + } |
|
227 | + list($count) = $this->db->fetchRow($result); |
|
228 | + return $count; |
|
229 | + } |
|
230 | 230 | |
231 | - /** |
|
232 | - * Get a list of images |
|
233 | - * |
|
234 | - * @param int $imgcat_id |
|
235 | - * @param bool $image_display |
|
236 | - * @return array Array of {@link XoopsImage} objects |
|
237 | - **/ |
|
238 | - function &getList($imgcat_id, $image_display = null) |
|
239 | - { |
|
240 | - $criteria = new CriteriaCompo(new Criteria('imgcat_id', intval($imgcat_id))); |
|
241 | - if (isset($image_display)) { |
|
242 | - $criteria->add(new Criteria('image_display', intval($image_display))); |
|
243 | - } |
|
244 | - $images =& $this->getObjects($criteria, false, true); |
|
245 | - $ret = array(); |
|
246 | - foreach (array_keys($images) as $i) { |
|
247 | - $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename'); |
|
248 | - } |
|
249 | - return $ret; |
|
250 | - } |
|
231 | + /** |
|
232 | + * Get a list of images |
|
233 | + * |
|
234 | + * @param int $imgcat_id |
|
235 | + * @param bool $image_display |
|
236 | + * @return array Array of {@link XoopsImage} objects |
|
237 | + **/ |
|
238 | + function &getList($imgcat_id, $image_display = null) |
|
239 | + { |
|
240 | + $criteria = new CriteriaCompo(new Criteria('imgcat_id', intval($imgcat_id))); |
|
241 | + if (isset($image_display)) { |
|
242 | + $criteria->add(new Criteria('image_display', intval($image_display))); |
|
243 | + } |
|
244 | + $images =& $this->getObjects($criteria, false, true); |
|
245 | + $ret = array(); |
|
246 | + foreach (array_keys($images) as $i) { |
|
247 | + $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename'); |
|
248 | + } |
|
249 | + return $ret; |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | \ No newline at end of file |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
57 | - $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
57 | + $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
59 | 59 | $this->initVar('section', XOBJ_DTYPE_INT, 0, false); |
60 | 60 | $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, 0, false); |
61 | 61 | $this->initVar('uid', XOBJ_DTYPE_INT, 0, true, 5); |
62 | 62 | $this->initVar('defaultyn', XOBJ_DTYPE_INT, 0, true, 2); |
63 | - $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
64 | - $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
65 | - $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
63 | + $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
64 | + $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
65 | + $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
66 | 66 | $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2); |
67 | 67 | $this->initVar('custom', XOBJ_DTYPE_TXTBOX, null, false, 10); |
68 | 68 | $this->initVar('icons', XOBJ_DTYPE_TXTBOX, null, false, 50); |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | */ |
207 | 207 | function setDataType($gpc_dtypeid=0) { |
208 | 208 | $sql = "SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=".intval($gpc_dtypeid); |
209 | - $result = $this->db->query($sql); |
|
210 | - $numrows = $this->db->getRowsNum($result); |
|
211 | - if ( $numrows > 0 ) { |
|
212 | - while (list($dtypeid,$title,$section,$fieldtypeid,$uid,$defaultyn, $activeyn, |
|
213 | - $options,$custom,$icon) = $this->db->fetchRow($result)) { |
|
209 | + $result = $this->db->query($sql); |
|
210 | + $numrows = $this->db->getRowsNum($result); |
|
211 | + if ( $numrows > 0 ) { |
|
212 | + while (list($dtypeid,$title,$section,$fieldtypeid,$uid,$defaultyn, $activeyn, |
|
213 | + $options,$custom,$icon) = $this->db->fetchRow($result)) { |
|
214 | 214 | if (! $this->objDataType ) { |
215 | 215 | $this->objDataType = new efqDataType(); |
216 | 216 | } |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $this->objDataType->setVar('activeyn', $activeyn); |
227 | 227 | $this->objDataType->setVar('custom', $custom); |
228 | 228 | $this->objDataType->setVar('icon', $icon); |
229 | - } |
|
230 | - } else { |
|
229 | + } |
|
230 | + } else { |
|
231 | 231 | return false; |
232 | 232 | } |
233 | 233 | return true; |
@@ -37,41 +37,41 @@ discard block |
||
37 | 37 | $this->image = $myts->makeTboxData4Save($_POST['image']); |
38 | 38 | $this->itemid = intval($_POST['itemid']); |
39 | 39 | $this->publish = strtotime($_POST['publish']['date']) + $_POST['publish']['time']; |
40 | - if (isset($_POST['expire_enable']) && ($_POST['expire_enable'] == 1)) { |
|
41 | - $this->expire = strtotime($_POST['expire']['date']) + $_POST['expire']['time']; |
|
42 | - } else { |
|
43 | - $this->expire = 0; |
|
44 | - } |
|
45 | - $this->lbr = $_POST['lbr']; |
|
46 | - $this->heading = $myts->makeTboxData4Save($_POST['heading']); |
|
47 | - if (!isset($_POST['couponid'])) { |
|
48 | - $this->_new = true; |
|
49 | - $this->message = _MD_COUPONADDED; |
|
50 | - if ($this->insert()) { |
|
51 | - return true; |
|
52 | - } else { |
|
53 | - return false; |
|
54 | - } |
|
55 | - } else { |
|
56 | - $this->message = _MD_COUPONUPDATED; |
|
57 | - $this->couponid = intval($_POST['couponid']); |
|
58 | - if ($this->update()) { |
|
59 | - return true; |
|
60 | - } else { |
|
61 | - return false; |
|
62 | - } |
|
63 | - } |
|
40 | + if (isset($_POST['expire_enable']) && ($_POST['expire_enable'] == 1)) { |
|
41 | + $this->expire = strtotime($_POST['expire']['date']) + $_POST['expire']['time']; |
|
42 | + } else { |
|
43 | + $this->expire = 0; |
|
44 | + } |
|
45 | + $this->lbr = $_POST['lbr']; |
|
46 | + $this->heading = $myts->makeTboxData4Save($_POST['heading']); |
|
47 | + if (!isset($_POST['couponid'])) { |
|
48 | + $this->_new = true; |
|
49 | + $this->message = _MD_COUPONADDED; |
|
50 | + if ($this->insert()) { |
|
51 | + return true; |
|
52 | + } else { |
|
53 | + return false; |
|
54 | + } |
|
55 | + } else { |
|
56 | + $this->message = _MD_COUPONUPDATED; |
|
57 | + $this->couponid = intval($_POST['couponid']); |
|
58 | + if ($this->update()) { |
|
59 | + return true; |
|
60 | + } else { |
|
61 | + return false; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | function insert() { |
67 | 67 | $sql = "INSERT INTO ".$this->db->prefix("efqdiralpha1_coupon")." |
68 | 68 | (itemid, description, image, publish, expire, heading, lbr) VALUES |
69 | 69 | (".$this->itemid.", ".$this->db->quoteString($this->descr).", ".$this->db->quoteString($this->image).", ".$this->publish.", ".$this->expire.", ".$this->db->quoteString($this->heading).", ".$this->lbr.")"; |
70 | - if ($this->db->query($sql)) { |
|
71 | - $this->couponid = $this->db->getInsertId(); |
|
72 | - return true; |
|
73 | - } |
|
74 | - return false; |
|
70 | + if ($this->db->query($sql)) { |
|
71 | + $this->couponid = $this->db->getInsertId(); |
|
72 | + return true; |
|
73 | + } |
|
74 | + return false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | function update() { |
@@ -88,34 +88,34 @@ discard block |
||
88 | 88 | |
89 | 89 | function get($couponid=false) { |
90 | 90 | if ($couponid == false) { |
91 | - //echo 'couponid is false'; |
|
92 | - return false; |
|
93 | - } |
|
94 | - //$couponid = intval($couponid); |
|
95 | - if ($couponid > 0) { |
|
96 | - $sql = "SELECT itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".$couponid; |
|
97 | - //echo $sql; |
|
98 | - if (!$result = $this->db->query($sql)) { |
|
99 | - return false; |
|
100 | - } |
|
101 | - while(list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
102 | - $this->itemid = $itemid; |
|
103 | - $this->descr = $descr; |
|
104 | - $this->image = $image; |
|
105 | - $this->publish = $publish; |
|
106 | - $this->expire = $expire; |
|
107 | - $this->heading = $heading; |
|
108 | - $this->lbr = $lbr; |
|
109 | - } |
|
110 | - return true; |
|
111 | - } |
|
112 | - return false; |
|
91 | + //echo 'couponid is false'; |
|
92 | + return false; |
|
93 | + } |
|
94 | + //$couponid = intval($couponid); |
|
95 | + if ($couponid > 0) { |
|
96 | + $sql = "SELECT itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".$couponid; |
|
97 | + //echo $sql; |
|
98 | + if (!$result = $this->db->query($sql)) { |
|
99 | + return false; |
|
100 | + } |
|
101 | + while(list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
102 | + $this->itemid = $itemid; |
|
103 | + $this->descr = $descr; |
|
104 | + $this->image = $image; |
|
105 | + $this->publish = $publish; |
|
106 | + $this->expire = $expire; |
|
107 | + $this->heading = $heading; |
|
108 | + $this->lbr = $lbr; |
|
109 | + } |
|
110 | + return true; |
|
111 | + } |
|
112 | + return false; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | function delete($couponid) { |
116 | 116 | $sql = "DELETE FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".intval($couponid); |
117 | - $this->db->query($sql); |
|
118 | - return true; |
|
117 | + $this->db->query($sql); |
|
118 | + return true; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /* Returns number of coupons for a listing |
@@ -124,43 +124,43 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return |
126 | 126 | */ |
127 | - function getCountByLink($itemid=0) { |
|
128 | - $ret = 0; |
|
129 | - $now = time(); |
|
127 | + function getCountByLink($itemid=0) { |
|
128 | + $ret = 0; |
|
129 | + $now = time(); |
|
130 | 130 | $sql = "SELECT count(*) FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid.' AND publish < '.$now.' AND (expire = 0 OR expire > '.$now.')'; |
131 | 131 | //echo $sql; |
132 | - if (!$result = $this->db->query($sql)) { |
|
133 | - return false; |
|
134 | - } |
|
135 | - list($ret) = $this->db->fetchRow($result); |
|
136 | - return $ret; |
|
137 | - } |
|
132 | + if (!$result = $this->db->query($sql)) { |
|
133 | + return false; |
|
134 | + } |
|
135 | + list($ret) = $this->db->fetchRow($result); |
|
136 | + return $ret; |
|
137 | + } |
|
138 | 138 | |
139 | - function getByItem($itemid=0) { |
|
140 | - if ($itemid == false) { |
|
141 | - //echo 'couponid is false'; |
|
142 | - return false; |
|
143 | - } |
|
144 | - //$couponid = intval($couponid); |
|
145 | - if ($itemid > 0) { |
|
146 | - $sql = "SELECT couponid, itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid; |
|
147 | - //echo $sql; |
|
148 | - if (!$result = $this->db->query($sql)) { |
|
149 | - return false; |
|
150 | - } |
|
151 | - while(list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
152 | - if ($publish == 0) { |
|
153 | - $publish = time(); |
|
154 | - } |
|
155 | - if ($expire > 0) { |
|
156 | - $expire = formatTimestamp($expire, 's'); |
|
157 | - } |
|
158 | - $publish = formatTimestamp($publish, 's'); |
|
159 | - $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr ); |
|
160 | - } |
|
161 | - return $ret; |
|
162 | - } |
|
163 | - return false; |
|
164 | - } |
|
139 | + function getByItem($itemid=0) { |
|
140 | + if ($itemid == false) { |
|
141 | + //echo 'couponid is false'; |
|
142 | + return false; |
|
143 | + } |
|
144 | + //$couponid = intval($couponid); |
|
145 | + if ($itemid > 0) { |
|
146 | + $sql = "SELECT couponid, itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid; |
|
147 | + //echo $sql; |
|
148 | + if (!$result = $this->db->query($sql)) { |
|
149 | + return false; |
|
150 | + } |
|
151 | + while(list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
152 | + if ($publish == 0) { |
|
153 | + $publish = time(); |
|
154 | + } |
|
155 | + if ($expire > 0) { |
|
156 | + $expire = formatTimestamp($expire, 's'); |
|
157 | + } |
|
158 | + $publish = formatTimestamp($publish, 's'); |
|
159 | + $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr ); |
|
160 | + } |
|
161 | + return $ret; |
|
162 | + } |
|
163 | + return false; |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | \ No newline at end of file |
@@ -52,21 +52,21 @@ |
||
52 | 52 | class efqFormRadio extends XoopsFormElement { |
53 | 53 | |
54 | 54 | /** |
55 | - * Array of Options |
|
55 | + * Array of Options |
|
56 | 56 | * @var array |
57 | 57 | * @access private |
58 | 58 | */ |
59 | 59 | var $_options = array(); |
60 | 60 | |
61 | 61 | /** |
62 | - * Pre-selected value |
|
62 | + * Pre-selected value |
|
63 | 63 | * @var string |
64 | 64 | * @access private |
65 | 65 | */ |
66 | 66 | var $_value; |
67 | 67 | |
68 | 68 | /** |
69 | - * Pre-selected value |
|
69 | + * Pre-selected value |
|
70 | 70 | * @var string |
71 | 71 | * @access private |
72 | 72 | */ |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * Get the size |
567 | 567 | * |
568 | - * @return int |
|
568 | + * @return int |
|
569 | 569 | */ |
570 | 570 | function getSize(){ |
571 | 571 | return $this->_size; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * Get an array of pre-selected values |
576 | 576 | * |
577 | - * @return array |
|
577 | + * @return array |
|
578 | 578 | */ |
579 | 579 | function getValue(){ |
580 | 580 | return $this->_value; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | /** |
584 | 584 | * Set pre-selected values |
585 | 585 | * |
586 | - * @param $value mixed |
|
586 | + * @param $value mixed |
|
587 | 587 | */ |
588 | 588 | function setValue($value){ |
589 | 589 | if (is_array($value)) { |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | |
598 | 598 | /** |
599 | 599 | * Add an option |
600 | - * |
|
600 | + * |
|
601 | 601 | * @param string $value "value" attribute |
602 | - * @param string $name "name" attribute |
|
602 | + * @param string $name "name" attribute |
|
603 | 603 | */ |
604 | 604 | function addOption($value, $name=""){ |
605 | 605 | if ( $name != "" ) { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | /** |
613 | 613 | * Add multiple options |
614 | 614 | * |
615 | - * @param array $options Associative array of value->name pairs |
|
615 | + * @param array $options Associative array of value->name pairs |
|
616 | 616 | */ |
617 | 617 | function addOptionArray($options){ |
618 | 618 | if ( is_array($options) ) { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | /** |
626 | 626 | * Get all options |
627 | 627 | * |
628 | - * @return array Associative array of value->name pairs |
|
628 | + * @return array Associative array of value->name pairs |
|
629 | 629 | */ |
630 | 630 | function getOptions(){ |
631 | 631 | return $this->_options; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | /** |
636 | 636 | * Prepare HTML for output |
637 | 637 | * |
638 | - * @return string HTML |
|
638 | + * @return string HTML |
|
639 | 639 | */ |
640 | 640 | function render(){ |
641 | 641 | $ret = "<img src='".$this->getSrc()."' width='".$this->getWidth()."' height='".$this->getHeight()."'"; |
@@ -65,24 +65,24 @@ discard block |
||
65 | 65 | $this->setPointsJS(''); |
66 | 66 | |
67 | 67 | $this->db = Database::getInstance(); |
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); |
|
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 | 71 | $this->initVar('lon', XOBJ_DTYPE_TXTBOX, null, true); |
72 | 72 | $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
73 | 73 | |
74 | 74 | if ($gmap != false) { |
75 | 75 | if (is_array($gmap)) { |
76 | - $this->assignVars($gmap); |
|
77 | - } else { |
|
76 | + $this->assignVars($gmap); |
|
77 | + } else { |
|
78 | 78 | $$gmap_handler = xoops_getmodulehandler('gmap', $moddir); |
79 | - $objGmap =& $$gmap_handler->get($directory); |
|
80 | - foreach ($objGmap->vars as $k => $v) { |
|
81 | - $this->assignVar($k, $v['value']); |
|
82 | - } |
|
83 | - unset($objGmap); |
|
84 | - } |
|
85 | - } |
|
79 | + $objGmap =& $$gmap_handler->get($directory); |
|
80 | + foreach ($objGmap->vars as $k => $v) { |
|
81 | + $this->assignVar($k, $v['value']); |
|
82 | + } |
|
83 | + unset($objGmap); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | function setKey($key='') |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | - * Set the value of the script that triggers the points to be added to the google map. |
|
95 | - */ |
|
94 | + * Set the value of the script that triggers the points to be added to the google map. |
|
95 | + */ |
|
96 | 96 | function setPointsJS($pointsJS) |
97 | 97 | { |
98 | 98 | $this->_jsPointsArray = $pointsJS; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Get the value of the script that triggers the points to be added to the google map. |
|
104 | - */ |
|
103 | + * Get the value of the script that triggers the points to be added to the google map. |
|
104 | + */ |
|
105 | 105 | function getPointsJS() |
106 | 106 | { |
107 | 107 | return $this->_jsPointsArray; |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Adds a script which triggers the other javascript code to execute |
|
199 | - */ |
|
198 | + * Adds a script which triggers the other javascript code to execute |
|
199 | + */ |
|
200 | 200 | function printTrigger() |
201 | 201 | { |
202 | 202 | $trigger = <<<EOH |
@@ -262,34 +262,34 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
265 | - * create instance of efqGmap class or reset the existing instance. |
|
266 | - * |
|
267 | - * @return object $efqGmap |
|
268 | - */ |
|
265 | + * create instance of efqGmap class or reset the existing instance. |
|
266 | + * |
|
267 | + * @return object $efqGmap |
|
268 | + */ |
|
269 | 269 | function &create($isNew = true) |
270 | - { |
|
271 | - $gmap = new efqGmap(); |
|
272 | - if ($isNew) { |
|
273 | - $gmap->setNew(); |
|
274 | - } |
|
275 | - return $gmap; |
|
276 | - } |
|
270 | + { |
|
271 | + $gmap = new efqGmap(); |
|
272 | + if ($isNew) { |
|
273 | + $gmap->setNew(); |
|
274 | + } |
|
275 | + return $gmap; |
|
276 | + } |
|
277 | 277 | |
278 | 278 | /** |
279 | - * retrieve all points from the database |
|
280 | - * |
|
281 | - * @param int $dirid ID of the directory |
|
282 | - * @return mixed reference to the {@link efqGmap} object, FALSE if failed |
|
283 | - */ |
|
279 | + * retrieve all points from the database |
|
280 | + * |
|
281 | + * @param int $dirid ID of the directory |
|
282 | + * @return mixed reference to the {@link efqGmap} object, FALSE if failed |
|
283 | + */ |
|
284 | 284 | function getPointsJS($gmap) { |
285 | 285 | if (!is_object($gmap)) { |
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps"); |
289 | 289 | if (!$result = $this->db->query($sql)) { |
290 | - return false; |
|
291 | - } |
|
292 | - $gmap =& $this->create(false); |
|
290 | + return false; |
|
291 | + } |
|
292 | + $gmap =& $this->create(false); |
|
293 | 293 | $javaScript = ''; |
294 | 294 | while ($row = $this->db->fetchArray($result)) { |
295 | 295 | //$row{'descr'} = addslashes($row{'descr'}); |
@@ -309,31 +309,31 @@ discard block |
||
309 | 309 | $arr = array(); |
310 | 310 | $sql = sprintf('SELECT * FROM %s WHERE id=%u', |
311 | 311 | $this->db->prefix("efqdiralpha1_gmaps"), intval($id)); |
312 | - $result = $this->db->query($sql) or $eh->show("0013"); |
|
313 | - while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) |
|
312 | + $result = $this->db->query($sql) or $eh->show("0013"); |
|
313 | + while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) |
|
314 | 314 | { |
315 | 315 | $arr = array('id'=>$id, 'lat'=>$lat, 'lon'=>$lon, 'descr'=>$descr, 'dataid'=>$dataid); |
316 | 316 | } |
317 | - return $arr; |
|
317 | + return $arr; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | function getByDataId($id=0) |
321 | 321 | { |
322 | 322 | if ($id == false) { |
323 | - return false; |
|
324 | - } |
|
325 | - $id = intval($id); |
|
326 | - echo $id; |
|
327 | - if ($id > 0) { |
|
328 | - $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps").' WHERE dataid='.intval($id); |
|
329 | - if (!$result = $this->db->query($sql)) { |
|
330 | - return false; |
|
331 | - } |
|
332 | - $gmap =& $this->create(false); |
|
333 | - $gmap->assignVars($this->db->fetchArray($result)); |
|
334 | - return $gmap; |
|
335 | - } |
|
336 | - return false; |
|
323 | + return false; |
|
324 | + } |
|
325 | + $id = intval($id); |
|
326 | + echo $id; |
|
327 | + if ($id > 0) { |
|
328 | + $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps").' WHERE dataid='.intval($id); |
|
329 | + if (!$result = $this->db->query($sql)) { |
|
330 | + return false; |
|
331 | + } |
|
332 | + $gmap =& $this->create(false); |
|
333 | + $gmap->assignVars($this->db->fetchArray($result)); |
|
334 | + return $gmap; |
|
335 | + } |
|
336 | + return false; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * create instance of directory class or reset the existing instance. |
|
144 | - * |
|
145 | - * @return object $directory |
|
146 | - */ |
|
143 | + * create instance of directory class or reset the existing instance. |
|
144 | + * |
|
145 | + * @return object $directory |
|
146 | + */ |
|
147 | 147 | function &create($isNew = true) |
148 | - { |
|
149 | - $subscription = new efqSubscription(); |
|
150 | - if ($isNew) { |
|
151 | - $subscription->setNew(); |
|
152 | - } |
|
153 | - return $subscription; |
|
154 | - } |
|
148 | + { |
|
149 | + $subscription = new efqSubscription(); |
|
150 | + if ($isNew) { |
|
151 | + $subscription->setNew(); |
|
152 | + } |
|
153 | + return $subscription; |
|
154 | + } |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Function delete: Delete subscription order |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | function countSubscriptionsForType($typeid=0) { |
407 | 407 | $sql = "SELECT COUNT(itemid) FROM ".$this->db->prefix("efqdiralpha1_items")." WHERE typeid=".intval($typeid).""; |
408 | 408 | if (!$result = $this->db->query($sql)) { |
409 | - return false; |
|
410 | - } |
|
411 | - list($ret) = $this->db->fetchRow($result); |
|
412 | - return $ret; |
|
409 | + return false; |
|
410 | + } |
|
411 | + list($ret) = $this->db->fetchRow($result); |
|
412 | + return $ret; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | function getOffers($dirid=0) { |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
57 | - $this->initVar('typeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | - $this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
59 | - $this->initVar('level', XOBJ_DTYPE_INT, 0, true, 4); |
|
57 | + $this->initVar('typeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | + $this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
59 | + $this->initVar('level', XOBJ_DTYPE_INT, 0, true, 4); |
|
60 | 60 | $this->initVar('dirid', XOBJ_DTYPE_INT, 0, true, 5); |
61 | 61 | |
62 | 62 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | function set($typeid=0) { |
200 | 200 | $sql = "SELECT typeid,typename,level,dirid FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE typeid=".intval($typeid).""; |
201 | - $result = $this->db->query($sql); |
|
202 | - $numrows = $this->db->getRowsNum($result); |
|
203 | - if ( $numrows > 0 ) { |
|
204 | - while (list($typeid, $typename, $level, $dirid) = $this->db->fetchRow($result)) { |
|
201 | + $result = $this->db->query($sql); |
|
202 | + $numrows = $this->db->getRowsNum($result); |
|
203 | + if ( $numrows > 0 ) { |
|
204 | + while (list($typeid, $typename, $level, $dirid) = $this->db->fetchRow($result)) { |
|
205 | 205 | if (! $this->objItemType) { |
206 | 206 | $this->objItemType = new efqSubscriptionOffer(); |
207 | 207 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $this->objItemType->setVar('typename', $typename); |
210 | 210 | $this->objItemType->setVar('level', $level); |
211 | 211 | $this->objItemType->setVar('dirid', $dirid); |
212 | - } |
|
213 | - } else { |
|
212 | + } |
|
213 | + } else { |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | return true; |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | function getByDir($dirid=0) { |
230 | 230 | $arr = array(); |
231 | 231 | $sql = "SELECT typeid,typename,level FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE dirid=".intval($dirid).""; |
232 | - if (!$result = $this->db->query($sql)) { |
|
233 | - return false; |
|
234 | - } |
|
232 | + if (!$result = $this->db->query($sql)) { |
|
233 | + return false; |
|
234 | + } |
|
235 | 235 | $numrows = $this->db->getRowsNum($result); |
236 | - while ( list($typeid,$typename,$level) = $this->db->fetchRow($result) ) { |
|
236 | + while ( list($typeid,$typename,$level) = $this->db->fetchRow($result) ) { |
|
237 | 237 | $arr[$typeid] = array('typeid' => $typeid,'typename' => $typename,'level' => $level); |
238 | 238 | } |
239 | - return $arr; |
|
239 | + return $arr; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |