Commit c925c30ece4f590d79dc0ff18e141e38a042738e

Authored by Megan Watson
1 parent 918bc16f

KTS-3389

"Sql limit statement should not use parameters"
Fixed. Changed the limit statements to specify the limit and not use parameters (LIMIT ?,?)

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8529 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/browse/PartialQuery.inc.php
... ... @@ -6,51 +6,51 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
37 37 */
38 38  
39 39 /* Partial Query
40   - *
  40 + *
41 41 * Each of the different partial queries handles generating a document and folder
42 42 * list. Also handles sorting.
43 43 *
44 44 */
45   -
46   -// FIXME API how to handle indicating which other rows need joining
  45 +
  46 +// FIXME API how to handle indicating which other rows need joining
47 47  
48 48 require_once(KT_LIB_DIR . '/util/ktutil.inc');
49 49 require_once(KT_LIB_DIR . '/database/dbutil.inc');
50 50 require_once(KT_LIB_DIR . '/search/searchutil.inc.php');
51   -
52   -define('XXX_HARDCODE_SIMPLE_FOLDER_SEARCH', true);
53   -
  51 +
  52 +define('XXX_HARDCODE_SIMPLE_FOLDER_SEARCH', true);
  53 +
54 54 // Abstract base class.
55 55 class PartialQuery {
56 56 var $sPermissionName = 'ktcore.permissions.read';
... ... @@ -62,29 +62,29 @@ class PartialQuery {
62 62 // no batching. just use count.
63 63 function getFolderCount() { return 0; }
64 64 function getDocumentCount() { return 0; }
65   -
  65 +
66 66 /* Generating the items for the collection requires generating the core of the
67   - * query, and then adding the columns and tables that are needed to make the
68   - * the sorting work. naturally, this could be somewhat complex, so in order
  67 + * query, and then adding the columns and tables that are needed to make the
  68 + * the sorting work. naturally, this could be somewhat complex, so in order
69 69 * to make everything clear, a number of "namespaces" are reserved in the simple
70 70 * case. The SearchQuery needs a number of others, and those are discussed there.
71   - *
  71 + *
72 72 * the sort column should be joined as "sort_col."
73 73 * the documents column is joined as "D."
74 74 * the folders column is joined as "F."
75 75 *
76   - * In order to allow the additional table-joins, etc, the "$sJoinClause, $aJoinParams"
  76 + * In order to allow the additional table-joins, etc, the "$sJoinClause, $aJoinParams"
77 77 * should be passed through. This should _completely_ handle the join, and should depend only
78 78 * on columns that are known to be there.
79 79 *
80   - * Browse currently has no way to specify additional constraints. For that,
  80 + * Browse currently has no way to specify additional constraints. For that,
81 81 * use SearchQuery or create a new PartialQuery object.
82 82 *
83   - * The abstraction is not complete, and some amount of understanding about the specific
84   - * query being _created_ is required. Once this is done, minimal changes in the view
  83 + * The abstraction is not complete, and some amount of understanding about the specific
  84 + * query being _created_ is required. Once this is done, minimal changes in the view
85 85 * object should be required.
86   - */
87   -
  86 + */
  87 +
88 88 // with batching.
89 89 function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
90 90 function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
... ... @@ -106,7 +106,7 @@ class BrowseQuery extends PartialQuery{
106 106 $this->oUser = null;
107 107 }
108 108 }
109   -
  109 +
110 110 function _getDocumentQuery($aOptions = null) {
111 111 $res = KTSearchUtil::permissionToSQL($this->oUser, $this->sPermissionName);
112 112 if (PEAR::isError($res)) {
... ... @@ -176,16 +176,16 @@ class BrowseQuery extends PartialQuery{
176 176 if (strpos($sWhere,'WHERE') == 0)
177 177 {
178 178 $sWhere .= ' WHERE ';
179   - }
180   - else
  179 + }
  180 + else
181 181 $sWhere .= ' AND ';
182   -
  182 +
183 183 $sWhere .= 'F.id NOT IN (' . implode(',',$this->exclude_folders) . ')';
184 184 // print $sWhere;
185 185 }
186   -
187   -
188   -
  186 +
  187 +
  188 +
189 189 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id');
190 190  
191 191 $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . " AS F $sPermissionJoin $sWhere ";
... ... @@ -194,19 +194,19 @@ class BrowseQuery extends PartialQuery{
194 194 $aParams[] = $this->folder_id;
195 195 return array($sQuery, $aParams);
196 196 }
197   -
198   - function getFolderCount() {
  197 +
  198 + function getFolderCount() {
199 199 $aOptions = array(
200 200 'select' => 'count(F.id) AS cnt',
201 201 );
202 202 $aQuery = $this->_getFolderQuery($aOptions);
203 203 if (PEAR::isError($aQuery)) { return 0; }
204   -
  204 +
205 205 $iRet = DBUtil::getOneResultKey($aQuery, 'cnt');
206 206 return $iRet;
207 207 }
208   -
209   - function getDocumentCount() {
  208 +
  209 + function getDocumentCount() {
210 210 $aOptions = array(
211 211 'select' => 'count(D.id) AS cnt',
212 212 );
... ... @@ -215,72 +215,66 @@ class BrowseQuery extends PartialQuery{
215 215 $iRet = DBUtil::getOneResultKey($aQuery, 'cnt');
216 216 return $iRet;
217 217 }
218   -
219   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  218 +
  219 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
220 220 $res = $this->_getFolderQuery();
221 221 if (PEAR::isError($res)) { return array(); }
222 222 list($sQuery, $aParams) = $res;
223 223 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
  224 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
224 225  
225   - $sQuery .= ' LIMIT ?, ?';
226   - $aParams[] = $iBatchStart;
227   - $aParams[] = $iBatchSize;
228   -
229 226 $q = array($sQuery, $aParams);
230   -
231   - $res = DBUtil::getResultArray($q);
232   -
  227 +
  228 + $res = DBUtil::getResultArray($q);
  229 +
233 230 return $res;
234 231 }
235   -
236   - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  232 +
  233 + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
237 234 $this->sDocumentJoinClause = $sJoinClause;
238 235 $this->aDocumentJoinParams = $aJoinParams;
239 236 $res = $this->_getDocumentQuery();
240   - if (PEAR::isError($res)) { return array(); } // no permissions
  237 + if (PEAR::isError($res)) { return array(); } // no permissions
241 238 list($sQuery, $aParams) = $res;
242 239 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
  240 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
243 241  
244   - $sQuery .= ' LIMIT ?, ?';
245   - $aParams[] = $iBatchStart;
246   - $aParams[] = $iBatchSize;
247   -
248 242 $q = array($sQuery, $aParams);
249   -
250   - $res = DBUtil::getResultArray($q);
251   -
252   -
253   -
  243 +
  244 + $res = DBUtil::getResultArray($q);
  245 +
  246 +
  247 +
254 248 return $res;
255 249 }
256 250 }
257 251  
258 252 // testing class - puts docs/folders into testdocs, testfolders.
259 253 class TestQuery extends PartialQuery{
260   -
  254 +
261 255 var $testdocs;
262 256 var $testfolders;
263 257  
264   - function TestQuery() {
  258 + function TestQuery() {
265 259 $this->testdocs = array(array('id' => 2), array('id' => 3),
266 260 );
267 261 $this->testfolders = array(array('id' => 3),);
268 262 }
269   -
  263 +
270 264 function getFolderCount() { count($this->testfolders); }
271 265 function getDocumentCount() { count($this->testdocs); }
272   -
  266 +
273 267 // with batching.
274   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) {
  268 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) {
275 269 return array_slice($this->testfolders, $iBatchStart, $iBatchSize);
276 270 }
277   -
278   - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) {
  271 +
  272 + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) {
279 273 return array_slice($this->testdocs, $iBatchStart, $iBatchSize);
280 274 }
281 275 }
282 276  
283   -class SimpleSearchQuery extends PartialQuery {
  277 +class SimpleSearchQuery extends PartialQuery {
284 278 // FIXME cache permission lookups, etc.
285 279 var $searchable_text;
286 280  
... ... @@ -297,10 +291,10 @@ class SimpleSearchQuery extends PartialQuery {
297 291 return $res;
298 292 }
299 293 list($sPermissionString, $aPermissionParams, $sPermissionJoin) = $res;
300   -
  294 +
301 295 $temp = str_replace('%', '', $this->searchable_text);
302 296 $keywords = explode(' ', $temp);
303   -
  297 +
304 298 for($i=0; $i<count($keywords); $i++){
305 299 if($keywords[$i] == ' ' or $keywords[$i] == ''){
306 300 continue;
... ... @@ -309,7 +303,7 @@ class SimpleSearchQuery extends PartialQuery {
309 303 }
310 304 }
311 305 $keywords = $keywords_temp;
312   -
  306 +
313 307 if(count($keywords) > 1){
314 308 for($i=0; $i<count($keywords); $i++){
315 309 $keywords[$i] = '%'.$keywords[$i].'%';
... ... @@ -321,7 +315,7 @@ class SimpleSearchQuery extends PartialQuery {
321 315 }else{
322 316 $aPotentialWhereString = 'FST.folder_text LIKE ? ';
323 317 }
324   -
  318 +
325 319 $aPotentialWhere = array($sPermissionString, $aPotentialWhereString);
326 320 $aWhere = array();
327 321 foreach ($aPotentialWhere as $sWhere) {
... ... @@ -340,24 +334,24 @@ class SimpleSearchQuery extends PartialQuery {
340 334  
341 335 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id');
342 336  
343   - $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . ' AS F
344   - LEFT JOIN ' . KTUtil::getTableName('folder_searchable_text') . " AS FST ON (F.id = FST.folder_id)
  337 + $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . ' AS F
  338 + LEFT JOIN ' . KTUtil::getTableName('folder_searchable_text') . " AS FST ON (F.id = FST.folder_id)
345 339 $sPermissionJoin $sWhere ";
346 340 if(count($keywords) > 1){
347 341 $aParams = $keywords;
348 342 }else{
349 343 $aParams = array($this->searchable_text);
350 344 }
351   -
  345 +
352 346 $aParams = kt_array_merge($aPermissionParams, $aParams);
353   -
  347 +
354 348 return array($sQuery, $aParams);
355 349 }
356   -
357   - function getFolderCount() {
  350 +
  351 + function getFolderCount() {
358 352 // use hack to get folders, if included.
359 353 if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return 0; }
360   -
  354 +
361 355 $aOptions = array(
362 356 'select' => 'count(F.id) AS cnt',
363 357 );
... ... @@ -367,22 +361,19 @@ class SimpleSearchQuery extends PartialQuery {
367 361 return $iRet;
368 362 }
369 363  
370   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  364 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
371 365 if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return array(); }
372   -
  366 +
373 367 $res = $this->_getFolderQuery();
374 368 if (PEAR::isError($res)) { return array(); }
375 369 list($sQuery, $aParams) = $res;
376 370 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
  371 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
377 372  
378   - $sQuery .= ' LIMIT ?, ?';
379   - $aParams[] = $iBatchStart;
380   - $aParams[] = $iBatchSize;
381   -
382 373 $q = array($sQuery, $aParams);
383   -
384   - $res = DBUtil::getResultArray($q);
385   -
  374 +
  375 + $res = DBUtil::getResultArray($q);
  376 +
386 377 return $res;
387 378 }
388 379  
... ... @@ -401,8 +392,8 @@ class SimpleSearchQuery extends PartialQuery {
401 392 $oUser = User::get($_SESSION['userID']);
402 393 return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions);
403 394 }
404   -
405   - function getDocumentCount() {
  395 +
  396 + function getDocumentCount() {
406 397 $aOptions = array(
407 398 'select' => 'count(DISTINCT D.id) AS cnt',
408 399 );
... ... @@ -411,13 +402,13 @@ class SimpleSearchQuery extends PartialQuery {
411 402 $iRet = DBUtil::getOneResultKey($aQuery, 'cnt');
412 403 return $iRet;
413 404 }
414   -
415   -
  405 +
  406 +
416 407 // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing
417 408 // later.
418 409 //
419 410 // we also leak like ---- here, since getting the score is ... fiddly. and expensive.
420   - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  411 + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
421 412 $this->sDocumentJoinClause = $sJoinClause;
422 413 $this->aDocumentJoinParams = $aJoinParams;
423 414 $aOptions = array(
... ... @@ -428,14 +419,11 @@ class SimpleSearchQuery extends PartialQuery {
428 419 if (PEAR::isError($res)) { return array(); }
429 420 list($sQuery, $aParams) = $res;
430 421 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
431   - $sQuery .= ' LIMIT ?, ?';
432   -
433   - $aParams[] = $iBatchStart;
434   - $aParams[] = $iBatchSize;
  422 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
435 423  
436 424 $q = array($sQuery, $aParams);
437 425  
438   - $res = DBUtil::getResultArray($q);
  426 + $res = DBUtil::getResultArray($q);
439 427  
440 428 return $res;
441 429 }
... ... @@ -443,7 +431,7 @@ class SimpleSearchQuery extends PartialQuery {
443 431  
444 432 class TypeBrowseQuery extends SimpleSearchQuery {
445 433 var $iDocType;
446   -
  434 +
447 435 function TypeBrowseQuery($oDocType) {
448 436 $this->iDocType = $oDocType->getId();
449 437 }
... ... @@ -463,17 +451,17 @@ class TypeBrowseQuery extends SimpleSearchQuery {
463 451 $oUser = User::get($_SESSION['userID']);
464 452 return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions);
465 453 }
466   -
  454 +
467 455 // don't do folder searching
468 456 function getFolderCount() { return 0; }
469   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
  457 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
470 458 }
471 459  
472 460 class ValueBrowseQuery extends SimpleSearchQuery {
473 461 var $sFieldNamespace;
474 462 var $sValueName;
475   -
476   - function ValueBrowseQuery($oField, $oValue) {
  463 +
  464 + function ValueBrowseQuery($oField, $oValue) {
477 465 $this->sFieldNamespace = $oField->getNamespace();
478 466 $this->sValueName = $oValue->getName();
479 467 }
... ... @@ -493,24 +481,24 @@ class ValueBrowseQuery extends SimpleSearchQuery {
493 481 $oUser = User::get($_SESSION['userID']);
494 482 return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions);
495 483 }
496   -
  484 +
497 485 // don't do folder searching
498 486 function getFolderCount() { return 0; }
499   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
  487 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); }
500 488 }
501 489  
502   -class BooleanSearchQuery extends PartialQuery {
  490 +class BooleanSearchQuery extends PartialQuery {
503 491 // FIXME cache permission lookups, etc.
504 492 var $datavars;
505 493  
506 494 function BooleanSearchQuery($datavars) { $this->datavars = $datavars; }
507   -
508   - function getFolderCount() {
  495 +
  496 + function getFolderCount() {
509 497 // never any folders, given the current fulltext environ.
510 498 return 0;
511 499 }
512 500  
513   - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  501 + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
514 502 return array();
515 503 }
516 504  
... ... @@ -518,8 +506,8 @@ class BooleanSearchQuery extends PartialQuery {
518 506 $oUser = User::get($_SESSION['userID']);
519 507 return KTSearchUtil::criteriaToQuery($this->datavars, $oUser, 'ktcore.permissions.read', $aOptions);
520 508 }
521   -
522   - function getDocumentCount() {
  509 +
  510 + function getDocumentCount() {
523 511 $aOptions = array(
524 512 'select' => 'count(DISTINCT D.id) AS cnt',
525 513 );
... ... @@ -528,13 +516,13 @@ class BooleanSearchQuery extends PartialQuery {
528 516 $iRet = DBUtil::getOneResultKey($aQuery, 'cnt');
529 517 return $iRet;
530 518 }
531   -
532   -
  519 +
  520 +
533 521 // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing
534 522 // later.
535 523 //
536 524 // we also leak like ---- here, since getting the score is ... fiddly. and expensive.
537   - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
  525 + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) {
538 526 $this->sDocumentJoinClause = $sJoinClause;
539 527 $this->aDocumentJoinParams = $aJoinParams;
540 528 $aOptions = array(
... ... @@ -545,14 +533,11 @@ class BooleanSearchQuery extends PartialQuery {
545 533 if (PEAR::isError($res)) { return array(); }
546 534 list($sQuery, $aParams) = $res;
547 535 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
548   - $sQuery .= ' LIMIT ?, ?';
  536 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
549 537  
550   - $aParams[] = $iBatchStart;
551   - $aParams[] = $iBatchSize;
552   -
553 538 $q = array($sQuery, $aParams);
554   - $res = DBUtil::getResultArray($q);
555   -
  539 + $res = DBUtil::getResultArray($q);
  540 +
556 541 return $res;
557 542 }
558 543 }
... ...
lib/ktentity.inc
... ... @@ -8,31 +8,31 @@
8 8 * Document Management Made Simple
9 9 * Copyright (C) 2008 KnowledgeTree Inc.
10 10 * Portions copyright The Jam Warehouse Software (Pty) Limited
11   - *
  11 + *
12 12 * This program is free software; you can redistribute it and/or modify it under
13 13 * the terms of the GNU General Public License version 3 as published by the
14 14 * Free Software Foundation.
15   - *
  15 + *
16 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 19 * details.
20   - *
  20 + *
21 21 * You should have received a copy of the GNU General Public License
22 22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23   - *
24   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 + *
  24 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
25 25 * California 94120-7775, or email info@knowledgetree.com.
26   - *
  26 + *
27 27 * The interactive user interfaces in modified source and object code versions
28 28 * of this program must display Appropriate Legal Notices, as required under
29 29 * Section 5 of the GNU General Public License version 3.
30   - *
  30 + *
31 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 32 * these Appropriate Legal Notices must retain the display of the "Powered by
33   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 34 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
35   - * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * must display the words "Powered by KnowledgeTree" and retain the original
36 36 * copyright notice.
37 37 * Contributor( s): ______________________________________
38 38 */
... ... @@ -456,12 +456,9 @@ class KTEntityUtil {
456 456 $iLimit = $aOptions['limit'];
457 457  
458 458 if ($iOffset) {
459   - $aWhereClause[0] .= " LIMIT ?, ?";
460   - $aWhereClause[1][] = $iOffset;
461   - $aWhereClause[1][] = $iLimit;
  459 + $aWhereClause[0] .= " LIMIT $iOffset, $iLimit";
462 460 } else {
463   - $aWhereClause[0] .= " LIMIT ?";
464   - $aWhereClause[1][] = $iLimit;
  461 + $aWhereClause[0] .= " LIMIT $iLimit";
465 462 }
466 463 }
467 464  
... ...
plugins/tagcloud/TagCloudUtil.inc.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -234,10 +234,7 @@ class TagQuery extends PartialQuery
234 234 if (PEAR::isError($res)) { return array(); }
235 235 list($sQuery, $aParams) = $res;
236 236 $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' ';
237   - $sQuery .= ' LIMIT ?, ?';
238   -
239   - $aParams[] = $iBatchStart;
240   - $aParams[] = $iBatchSize;
  237 + $sQuery .= " LIMIT $iBatchStart, $iBatchSize";
241 238  
242 239 $q = array($sQuery, $aParams);
243 240 $res = DBUtil::getResultArray($q);
... ...