|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
// ID: class.datatype.php 30-apr-2007 13:39:01 efqconsultancy |
|
4
|
|
|
// ------------------------------------------------------------------------ // |
|
5
|
|
|
// EFQ Directory // |
|
6
|
|
|
// Copyright (c) 2006 EFQ Consultancy // |
|
7
|
|
|
// <http://www.efqdirectory.com/> // |
|
8
|
|
|
// ------------------------------------------------------------------------ // |
|
9
|
|
|
// This program is free software; you can redistribute it and/or modify // |
|
10
|
|
|
// it under the terms of the GNU General Public License as published by // |
|
11
|
|
|
// the Free Software Foundation; either version 2 of the License, or // |
|
12
|
|
|
// (at your option) any later version. // |
|
13
|
|
|
// // |
|
14
|
|
|
// You may not change or alter any portion of this comment or credits // |
|
15
|
|
|
// of supporting developers from this source code or any supporting // |
|
16
|
|
|
// source code which is considered copyrighted (c) material of the // |
|
17
|
|
|
// original comment or credit authors. // |
|
18
|
|
|
// // |
|
19
|
|
|
// This program is distributed in the hope that it will be useful, // |
|
20
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
21
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
22
|
|
|
// GNU General Public License for more details. // |
|
23
|
|
|
// // |
|
24
|
|
|
// You should have received a copy of the GNU General Public License // |
|
25
|
|
|
// along with this program; if not, write to the Free Software // |
|
26
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|
27
|
|
|
// ------------------------------------------------------------------------ // |
|
28
|
|
|
// Part of the efqDirectory module provided by: wtravel // |
|
29
|
|
|
// e-mail: [email protected] // |
|
30
|
|
|
// Purpose: Create a business directory for xoops. // |
|
31
|
|
|
// Based upon the mylinks and the mxDirectory modules // |
|
32
|
|
|
// ------------------------------------------------------------------------- // |
|
33
|
|
|
*/ |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Class efqSubscriptionOffer |
|
37
|
|
|
* Manages operations for subscription offers |
|
38
|
|
|
* |
|
39
|
|
|
* @package efqDirectory |
|
40
|
|
|
* @author EFQ Consultancy <[email protected]> |
|
41
|
|
|
* @copyright EFQ Consultancy (c) 2008 |
|
42
|
|
|
* @version 1.1.0 |
|
43
|
|
|
*/ |
|
44
|
|
View Code Duplication |
class efqDataType extends XoopsObject |
|
|
|
|
|
|
45
|
|
|
{ |
|
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('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
|
|
|
|
|
58
|
|
|
$this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
|
|
|
|
|
59
|
|
|
$this->initVar('section', XOBJ_DTYPE_INT, 0, false); |
|
60
|
|
|
$this->initVar('fieldtypeid', XOBJ_DTYPE_INT, 0, false); |
|
61
|
|
|
$this->initVar('uid', XOBJ_DTYPE_INT, 0, true, 5); |
|
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); |
|
66
|
|
|
$this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2); |
|
67
|
|
|
$this->initVar('custom', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
68
|
|
|
$this->initVar('icons', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Class efqFieldTypeHandler |
|
74
|
|
|
* Manages database operations for field types |
|
75
|
|
|
* |
|
76
|
|
|
* @package efqDirectory |
|
77
|
|
|
* @author EFQ Consultancy <[email protected]> |
|
78
|
|
|
* @copyright EFQ Consultancy (c) 2007 |
|
79
|
|
|
* @version 1.1.0 |
|
80
|
|
|
*/ |
|
81
|
|
|
class efqDataTypeHandler extends XoopsObjectHandler |
|
|
|
|
|
|
82
|
|
|
{ |
|
83
|
|
|
// public $db; //Database reference |
|
|
|
|
|
|
84
|
|
|
public $objDataType; // reference to object |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* efqSubscriptionOfferHandler::efqItemTypeHandler() |
|
88
|
|
|
* |
|
89
|
|
|
* @param bool $obj |
|
90
|
|
|
*/ |
|
91
|
|
|
public function __construct($obj = false) |
|
92
|
|
|
{ |
|
93
|
|
|
$this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
94
|
|
|
$this->objDataType = $obj; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Function insertOffer inserts record into DB |
|
99
|
|
|
* @author EFQ Consultancy <[email protected]> |
|
100
|
|
|
* @copyright EFQ Consultancy (c) 2008 |
|
101
|
|
|
* @version 1.0.0 |
|
102
|
|
|
* |
|
103
|
|
|
* @param efqDataType $obj object |
|
104
|
|
|
* |
|
105
|
|
|
* @param bool $forceQuery |
|
106
|
|
|
* @return bool true if insertion is succesful, false if unsuccesful |
|
107
|
|
|
*/ |
|
108
|
|
View Code Duplication |
public function insertDataType($obj, $forceQuery = false) |
|
|
|
|
|
|
109
|
|
|
{ |
|
110
|
|
|
$tablename = 'efqdiralpha1_dtypes'; |
|
111
|
|
|
$keyName = 'dtypeid'; |
|
112
|
|
|
$excludedVars = array(); |
|
113
|
|
|
if ($obj instanceof efqDataType) { |
|
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
|
|
|
|
|
142
|
|
|
return true; |
|
143
|
|
|
} |
|
144
|
|
|
} else { |
|
145
|
|
|
if ($this->db->query($sql)) { |
|
146
|
|
|
$itemid = $this->db->getInsertId(); |
|
147
|
|
|
$obj->setVar($keyName, $itemid); |
|
148
|
|
|
|
|
149
|
|
|
return true; |
|
150
|
|
|
} |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
return false; |
|
154
|
|
|
} |
|
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 |
|
166
|
|
|
* |
|
167
|
|
|
*/ |
|
168
|
|
View Code Duplication |
public function updateDataType($obj, $forceQuery = false) |
|
|
|
|
|
|
169
|
|
|
{ |
|
170
|
|
|
$tablename = 'efqdiralpha1_dtypes'; |
|
171
|
|
|
$keyName = 'dtypeid'; |
|
172
|
|
|
$excludedVars = array(); |
|
173
|
|
|
if ($obj instanceof efqDataType) { |
|
174
|
|
|
// Variable part of this function ends. From this line you can copy |
|
175
|
|
|
// this function for similar object handling functions. |
|
176
|
|
|
$obj->cleanVars(); |
|
177
|
|
|
$cleanvars = $obj->cleanVars; |
|
178
|
|
|
$keyValue = $obj->getVar($keyName); |
|
179
|
|
|
} else { |
|
180
|
|
|
return false; |
|
181
|
|
|
} |
|
182
|
|
|
$countVars = count($cleanvars); |
|
183
|
|
|
$i = 1; |
|
184
|
|
|
$strSet = ''; |
|
185
|
|
|
$strValues = ''; |
|
|
|
|
|
|
186
|
|
|
foreach ($cleanvars as $k => $v) { |
|
187
|
|
|
if (!in_array($k, $excludedVars)) { |
|
188
|
|
|
if ($i < $countVars and $i > 1) { |
|
189
|
|
|
$strSet .= ', '; |
|
190
|
|
|
} |
|
191
|
|
|
$strSet .= $k . '=' . "'" . $v . "'"; |
|
192
|
|
|
} |
|
193
|
|
|
$i++; |
|
194
|
|
|
} |
|
195
|
|
|
$sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
196
|
|
|
if ($forceQuery) { |
|
197
|
|
|
if ($this->db->queryF($sql)) { |
|
198
|
|
|
return true; |
|
199
|
|
|
} |
|
200
|
|
|
} else { |
|
201
|
|
|
if ($this->db->query($sql)) { |
|
202
|
|
|
return true; |
|
203
|
|
|
} |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
return false; |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* function setDataType() |
|
211
|
|
|
* |
|
212
|
|
|
* Sets the object created by class efqDataType with data from query |
|
213
|
|
|
* |
|
214
|
|
|
* @param int $gpc_dtypeid |
|
215
|
|
|
* @return bool true or false |
|
216
|
|
|
*/ |
|
217
|
|
|
public function setDataType($gpc_dtypeid = 0) |
|
218
|
|
|
{ |
|
219
|
|
|
$sql = 'SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=' . (int)$gpc_dtypeid; |
|
220
|
|
|
$result = $this->db->query($sql); |
|
221
|
|
|
$numrows = $this->db->getRowsNum($result); |
|
222
|
|
View Code Duplication |
if ($numrows > 0) { |
|
|
|
|
|
|
223
|
|
|
while (list($dtypeid, $title, $section, $fieldtypeid, $uid, $defaultyn, $activeyn, $options, $custom, $icon) = $this->db->fetchRow($result)) { |
|
224
|
|
|
if (!$this->objDataType) { |
|
225
|
|
|
$this->objDataType = new efqDataType(); |
|
226
|
|
|
} |
|
227
|
|
|
$this->objDataType->setVar('dtypeid', $dtypeid); |
|
228
|
|
|
$this->objDataType->setVar('title', $title); |
|
229
|
|
|
$this->objDataType->setVar('section', $section); |
|
230
|
|
|
$this->objDataType->setVar('fieldtypeid', $fieldtypeid); |
|
231
|
|
|
$this->objDataType->setVar('uid', $uid); |
|
232
|
|
|
$this->objDataType->setVar('defaultyn', $defaultyn); |
|
233
|
|
|
$this->objDataType->setVar('created', $created); |
|
|
|
|
|
|
234
|
|
|
$this->objDataType->setVar('seq', $seq); |
|
|
|
|
|
|
235
|
|
|
$this->objDataType->setVar('options', $options); |
|
236
|
|
|
$this->objDataType->setVar('activeyn', $activeyn); |
|
237
|
|
|
$this->objDataType->setVar('custom', $custom); |
|
238
|
|
|
$this->objDataType->setVar('icon', $icon); |
|
239
|
|
|
} |
|
240
|
|
|
} else { |
|
241
|
|
|
return false; |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
return true; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @return bool |
|
249
|
|
|
*/ |
|
250
|
|
|
public function getDataType() |
|
251
|
|
|
{ |
|
252
|
|
|
return $this->objDataType; |
|
253
|
|
|
} |
|
254
|
|
|
} |
|
255
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths