Quick Search:

View

Revision:

Diff

Diff from 1497 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/includes/classes/database.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
15
3   $Id: database.php 1497 2007-03-29 13:40:05Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
1290
8   Copyright (c) 2007 osCommerce
hpdl
1
9
hpdl
1497
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License v2 (1991)
12   as published by the Free Software Foundation.
hpdl
1
13 */
14
15   class osC_Database {
16     var $is_connected = false,
17         $link,
hpdl
280
18         $error_reporting = true,
19         $error = false,
hpdl
1
20         $error_number,
hpdl
280
21         $error_query,
hpdl
1
22         $server,
23         $username,
24         $password,
25         $debug = false,
26         $number_of_queries = 0,
hpdl
1290
27         $time_of_queries = 0,
28         $nextID = null,
29         $logging_transaction = false,
30         $logging_transaction_action = false;
hpdl
1
31
hpdl
1036
32     function &connect($server, $username, $password, $type = DB_DATABASE_CLASS) {
hpdl
1
33       require('database/' . $type . '.php');
34
35       $class = 'osC_Database_' . $type;
hpdl
322
36       $object = new $class($server, $username, $password);
hpdl
1
37
hpdl
322
38       return $object;
hpdl
1
39     }
40
41     function setConnected($boolean) {
42       if ($boolean === true) {
43         $this->is_connected = true;
44       } else {
45         $this->is_connected = false;
46       }
47     }
48
49     function isConnected() {
50       if ($this->is_connected === true) {
51         return true;
52       } else {
53         return false;
54       }
55     }
56
57     function &query($query) {
58       $osC_Database_Result =& new osC_Database_Result($this);
59       $osC_Database_Result->setQuery($query);
60
61       return $osC_Database_Result;
62     }
63
hpdl
234
64     function setError($error, $error_number = '', $query = '') {
hpdl
1
65       global $messageStack;
66
67       if ($this->error_reporting === true) {
68         $this->error = $error;
69         $this->error_number = $error_number;
hpdl
280
70         $this->error_query = $query;
hpdl
1
71
72         if (isset($messageStack)) {
hpdl
280
73           $messageStack->add('debug', $this->getError());
hpdl
1
74         }
75       }
76     }
77
78     function isError() {
79       if ($this->error === false) {
80         return false;
81       } else {
82         return true;
83       }
84     }
85
hpdl
280
86     function getError() {
hpdl
1
87       if ($this->isError()) {
88         $error = '';
89
90         if (!empty($this->error_number)) {
91           $error .= $this->error_number . ': ';
92         }
93
94         $error .= $this->error;
95
hpdl
280
96         if (!empty($this->error_query)) {
97           $error .= '; ' . htmlentities($this->error_query);
hpdl
234
98         }
99
hpdl
1
100         return $error;
101       } else {
102         return false;
103       }
104     }
105
106     function setErrorReporting($boolean) {
107       if ($boolean === true) {
108         $this->error_reporting = true;
109       } else {
110         $this->error_reporting = false;
111       }
112     }
113
114     function setDebug($boolean) {
115       if ($boolean === true) {
116         $this->debug = true;
117       } else {
118         $this->debug = false;
119       }
120     }
121
122     function importSQL($sql_file, $database, $table_prefix = -1) {
123       if ($this->selectDatabase($database)) {
124         if (file_exists($sql_file)) {
125           $fd = fopen($sql_file, 'rb');
126           $import_queries = fread($fd, filesize($sql_file));
127           fclose($fd);
128         } else {
129           $this->setError(sprintf(ERROR_SQL_FILE_NONEXISTENT, $sql_file));
130
131           return false;
132         }
133
134         if (!get_cfg_var('safe_mode')) {
135           @set_time_limit(0);
136         }
137
138         $sql_queries = array();
139         $sql_length = strlen($import_queries);
140         $pos = strpos($import_queries, ';');
141
142         for ($i=$pos; $i<$sql_length; $i++) {
143 // remove comments
144           if ($import_queries[0] == '#') {
145             $import_queries = ltrim(substr($import_queries, strpos($import_queries, "\n")));
146             $sql_length = strlen($import_queries);
147             $i = strpos($import_queries, ';')-1;
148             continue;
149           }
150
151           if ($import_queries[($i+1)] == "\n") {
hpdl
660
152             $next = '';
153
hpdl
1
154             for ($j=($i+2); $j<$sql_length; $j++) {
155               if (!empty($import_queries[$j])) {
156                 $next = substr($import_queries, $j, 6);
157
158                 if ($next[0] == '#') {
159 // find out where the break position is so we can remove this line (#comment line)
160                   for ($k=$j; $k<$sql_length; $k++) {
161                     if ($import_queries[$k] == "\n") {
162                       break;
163                     }
164                   }
165
166                   $query = substr($import_queries, 0, $i+1);
167
168                   $import_queries = substr($import_queries, $k);
169
170 // join the query before the comment appeared, with the rest of the dump
171                   $import_queries = $query . $import_queries;
172                   $sql_length = strlen($import_queries);
173                   $i = strpos($import_queries, ';')-1;
174                   continue 2;
175                 }
176
177                 break;
178               }
179             }
180
181             if (empty($next)) { // get the last insert query
182               $next = 'insert';
183             }
184
185             if ((strtoupper($next) == 'DROP T') || (strtoupper($next) == 'CREATE') || (strtoupper($next) == 'INSERT')) {
186               $next = '';
187
188               $sql_query = substr($import_queries, 0, $i);
189
190               if ($table_prefix !== -1) {
191                 if (strtoupper(substr($sql_query, 0, 25)) == 'DROP TABLE IF EXISTS OSC_') {
192                   $sql_query = 'DROP TABLE IF EXISTS ' . $table_prefix . substr($sql_query, 25);
193                 } elseif (strtoupper(substr($sql_query, 0, 17)) == 'CREATE TABLE OSC_') {
194                   $sql_query = 'CREATE TABLE ' . $table_prefix . substr($sql_query, 17);
195                 } elseif (strtoupper(substr($sql_query, 0, 16)) == 'INSERT INTO OSC_') {
196                   $sql_query = 'INSERT INTO ' . $table_prefix . substr($sql_query, 16);
197                 }
198               }
199
hpdl
280
200               $sql_queries[] = trim($sql_query);
hpdl
1
201
202               $import_queries = ltrim(substr($import_queries, $i+1));
203               $sql_length = strlen($import_queries);
204               $i = strpos($import_queries, ';')-1;
205             }
206           }
207         }
208
209         for ($i=0, $n=sizeof($sql_queries); $i<$n; $i++) {
210           $this->simpleQuery($sql_queries[$i]);
hpdl
280
211
212           if ($this->isError()) {
213             break;
214           }
hpdl
1
215         }
216       }
217
218       if ($this->isError()) {
219         return false;
220       } else {
221         return true;
222       }
223     }
224
225     function hasCreatePermission($database) {
226       $db_created = false;
227
228       if (empty($database)) {
229         $this->setError(ERROR_DB_NO_DATABASE_SELECTED);
230
231         return false;
232       }
233
234       $this->setErrorReporting(false);
235
236       if ($this->selectDatabase($database) === false) {
237         $this->setErrorReporting(true);
238
239         if ($this->simpleQuery('create database ' . $database)) {
240           $db_created = true;
241         }
242       }
243
244       $this->setErrorReporting(true);
245
246       if ($this->isError() === false) {
247         if ($this->selectDatabase($database)) {
248           if ($this->simpleQuery('create table osCommerceTestTable1536f ( temp_id int )')) {
249             if ($db_created === true) {
250               $this->simpleQuery('drop database ' . $database);
251             } else {
252               $this->simpleQuery('drop table osCommerceTestTable1536f');
253             }
254           }
255         }
256       }
257
258       if ($this->isError()) {
259         return false;
260       } else {
261         return true;
262       }
263     }
264
265     function numberOfQueries() {
266       return $this->number_of_queries;
267     }
268
269     function timeOfQueries() {
270       return $this->time_of_queries;
271     }
272
273     function getMicroTime() {
274       list($usec, $sec) = explode(' ', microtime());
275
276       return ((float)$usec + (float)$sec);
277     }
278   }
279
280   class osC_Database_Result {
281     var $db_class,
282         $sql_query,
283         $query_handler,
284         $result,
285         $rows,
286         $affected_rows,
287         $cache_key,
288         $cache_expire,
289         $cache_data,
290         $cache_read = false,
291         $debug = false,
292         $batch_query = false,
293         $batch_number,
294         $batch_rows,
295         $batch_size,
296         $batch_to,
297         $batch_from,
hpdl
1290
298         $batch_select_field,
299         $logging = false,
300         $logging_module,
hpdl
1293
301         $logging_module_id,
hpdl
1290
302         $logging_fields = array(),
303         $logging_changed = array();
hpdl
1
304
305     function osC_Database_Result(&$db_class) {
306       $this->db_class =& $db_class;
307     }
308
309     function setQuery($query) {
310       $this->sql_query = $query;
311     }
312
313     function appendQuery($query) {
314       $this->sql_query .= ' ' . $query;
315     }
316
317     function getQuery() {
318       return $this->sql_query;
319     }
320
321     function setDebug($boolean) {
322       if ($boolean === true) {
323         $this->debug = true;
324       } else {
325         $this->debug = false;
326       }
327     }
328
329     function valueMixed($column, $type = 'string') {
330       if (!isset($this->result)) {
331         $this->next();
332       }
333
334       switch ($type) {
335         case 'protected':
hpdl
725
336           return osc_output_string_protected($this->result[$column]);
hpdl
1
337           break;
338         case 'int':
339           return (int)$this->result[$column];
340           break;
341         case 'decimal':
342           return (float)$this->result[$column];
343           break;
344         case 'string':
345         default:
346           return $this->result[$column];
347       }
348     }
349
350     function value($column) {
351       return $this->valueMixed($column, 'string');
352     }
353
354     function valueProtected($column) {
355       return $this->valueMixed($column, 'protected');
356     }
357
358     function valueInt($column) {
359       return $this->valueMixed($column, 'int');
360     }
361
362     function valueDecimal($column) {
363       return $this->valueMixed($column, 'decimal');
364     }
365
hpdl
1290
366     function bindValueMixed($place_holder, $value, $type = 'string', $log = true) {
367       if ($log === true) {
368         $this->logging_fields[substr($place_holder, 1)] = $value;
369       }
370
hpdl
1
371       switch ($type) {
372         case 'int':
373           $value = intval($value);
374           break;
hpdl
219
375         case 'float':
376           $value = floatval($value);
377           break;
hpdl
1
378         case 'raw':
379           break;
380         case 'string':
381         default:
hpdl
1118
382           $value = "'" . $this->db_class->parseString(trim($value)) . "'";
hpdl
1
383       }
384
385       $this->bindReplace($place_holder, $value);
386     }
387
388     function bindReplace($place_holder, $value) {
389       $pos = strpos($this->sql_query, $place_holder);
390
391       if ($pos !== false) {
392         $length = strlen($place_holder);
393         $character_after_place_holder = substr($this->sql_query, $pos+$length, 1);
394
395         if (($character_after_place_holder === false) || ereg('[ ,)"]', $character_after_place_holder)) {
396           $this->sql_query = substr_replace($this->sql_query, $value, $pos, $length);
397         }
398       }
399     }
400
401     function bindValue($place_holder, $value) {
402       $this->bindValueMixed($place_holder, $value, 'string');
403     }
404
405     function bindInt($place_holder, $value) {
406       $this->bindValueMixed($place_holder, $value, 'int');
407     }
408
hpdl
219
409     function bindFloat($place_holder, $value) {
410       $this->bindValueMixed($place_holder, $value, 'float');
411     }
412
hpdl
1
413     function bindRaw($place_holder, $value) {
414       $this->bindValueMixed($place_holder, $value, 'raw');
415     }
416
417     function bindTable($place_holder, $value) {
hpdl
1290
418       $this->bindValueMixed($place_holder, $value, 'raw', false);
hpdl
1
419     }
420
421     function next() {
422       if ($this->cache_read === true) {
423         list(, $this->result) = each($this->cache_data);
424       } else {
425         if (!isset($this->query_handler)) {
426           $this->execute();
427         }
428
429         $this->result = $this->db_class->next($this->query_handler);
430
431         if (isset($this->cache_key)) {
432           $this->cache_data[] = $this->result;
433         }
434       }
435
436       return $this->result;
437     }
438
439     function freeResult() {
440       global $osC_Cache;
441
442       if ($this->cache_read === false) {
443         if (eregi('^SELECT', $this->sql_query)) {
444           $this->db_class->freeResult($this->query_handler);
445         }
446
447         if (isset($this->cache_key)) {
448           $osC_Cache->write($this->cache_key, $this->cache_data);
449         }
450       }
451
452       unset($this);
453     }
454
455     function numberOfRows() {
456       if (!isset($this->rows)) {
457         if (!isset($this->query_handler)) {
458           $this->execute();
459         }
460
461         if (isset($this->cache_key) && ($this->cache_read === true)) {
462           $this->rows = sizeof($this->cache_data);
463         } else {
464           $this->rows = $this->db_class->numberOfRows($this->query_handler);
465         }
466       }
467
468       return $this->rows;
469     }
470
471     function affectedRows() {
472       if (!isset($this->affected_rows)) {
473         if (!isset($this->query_handler)) {
474           $this->execute();
475         }
476
477         $this->affected_rows = $this->db_class->affectedRows();
478       }
479
480       return $this->affected_rows;
481     }
482
483     function execute() {
484       global $osC_Cache;
485
486       if (isset($this->cache_key)) {
487         if ($osC_Cache->read($this->cache_key, $this->cache_expire)) {
488           $this->cache_data = $osC_Cache->cached_data;
489
490           $this->cache_read = true;
491         }
492       }
493
494       if ($this->cache_read === false) {
hpdl
1290
495         if ($this->logging === true) {
496           $this->logging_action = substr($this->sql_query, 0, strpos($this->sql_query, ' '));
497
498           if ($this->logging_action == 'update') {
499             $db = split(' ', $this->sql_query, 3);
500             $this->logging_database = $db[1];
501
502             $test = $this->db_class->simpleQuery('select ' . implode(', ', array_keys($this->logging_fields)) . ' from ' . $this->logging_database . substr($this->sql_query, osc_strrpos_string($this->sql_query, ' where ')));
503
504             while ($result = $this->db_class->next($test)) {
505               foreach ($this->logging_fields as $key => $value) {
506                 if ($result[$key] != $value) {
507                   $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => $result[$key], 'new' => $value);
508                 }
509               }
510             }
511           } elseif ($this->logging_action == 'insert') {
512             $db = split(' ', $this->sql_query, 4);
513             $this->logging_database = $db[2];
514
515             foreach ($this->logging_fields as $key => $value) {
516               $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => '', 'new' => $value);
517             }
518           } elseif ($this->logging_action == 'delete') {
519             $db = split(' ', $this->sql_query, 4);
520             $this->logging_database = $db[2];
521
522             $del = $this->db_class->simpleQuery('select * from ' . $this->logging_database . ' ' . $db[3]);
523             while ($result = $this->db_class->next($del)) {
524               foreach ($result as $key => $value) {
525                 $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => $value, 'new' => '');
526               }
527             }
528           }
529         }
530
hpdl
1
531         $this->query_handler = $this->db_class->simpleQuery($this->sql_query, $this->debug);
532
hpdl
1290
533         if ($this->logging === true) {
534           if ($this->db_class->logging_transaction_action === false) {
535             $this->db_class->logging_transaction_action = $this->logging_action;
536           }
537
538           if ($this->affectedRows($this->query_handler) > 0) {
539             if (!empty($this->logging_changed)) {
hpdl
1293
540               if ( ($this->logging_action == 'insert') && !is_numeric($this->logging_module_id) ) {
hpdl
1290
541                 $this->logging_module_id = $this->db_class->nextID();
542                 $this->setNextID($this->logging_module_id);
543               }
544
545               if ( class_exists('osC_AdministratorsLog') ) {
546                 osC_AdministratorsLog::insert($this->logging_module, $this->db_class->logging_transaction_action, $this->logging_module_id, $this->logging_action, $this->logging_changed, $this->db_class->logging_transaction);
547               }
548             }
549           }
550         }
551
hpdl
1
552         if ($this->batch_query === true) {
hpdl
1384
553           $this->batch_size = $this->db_class->getBatchSize($this->sql_query, $this->batch_select_field);
hpdl
1
554
555           $this->batch_to = ($this->batch_rows * $this->batch_number);
556           if ($this->batch_to > $this->batch_size) {
557             $this->batch_to = $this->batch_size;
558           }
559
560           $this->batch_from = ($this->batch_rows * ($this->batch_number - 1));
561           if ($this->batch_to == 0) {
562             $this->batch_from = 0;
563           } else {
564             $this->batch_from++;
565           }
566         }
567
568         return $this->query_handler;
569       }
570     }
571
572     function executeRandom() {
573       return $this->query_handler = $this->db_class->randomQuery($this->sql_query);
574     }
575
576     function executeRandomMulti() {
577       return $this->query_handler = $this->db_class->randomQueryMulti($this->sql_query);
578     }
579
580     function setCache($key, $expire = 0) {
581       $this->cache_key = $key;
582       $this->cache_expire = $expire;
583     }
584
hpdl
1293
585     function setLogging($module, $id = null) {
hpdl
1290
586       $this->logging = true;
587       $this->logging_module = $module;
588       $this->logging_module_id = $id;
589     }
590
591     function setNextID($id) {
592       $this->db_class->nextID = $id;
593     }
594
hpdl
1
595     function toArray() {
596       if (!isset($this->result)) {
597         $this->next();
598       }
599
600       return $this->result;
601     }
602
hpdl
220
603     function prepareSearch($keywords, $columns, $embedded = false) {
604       if ($embedded === true) {
605         $this->sql_query .= ' and ';
606       }
607
608       $keywords_array = explode(' ', $keywords);
609
610       if ($this->db_class->use_fulltext === true) {
611         if ($this->db_class->use_fulltext_boolean === true) {
612           $keywords = '';
613
614           foreach ($keywords_array as $keyword) {
615             if ((substr($keyword, 0, 1) != '-') && (substr($keyword, 0, 1) != '+')) {
616               $keywords .= '+';
617             }
hpdl
234
618
hpdl
220
619             $keywords .= $keyword . ' ';
620           }
621
622           $keywords = substr($keywords, 0, -1);
623         }
624
625         $this->sql_query .= $this->db_class->prepareSearch($columns);
626         $this->bindValue(':keywords', $keywords);
627       } else {
628         foreach ($keywords_array as $keyword) {
629           $this->sql_query .= $this->db_class->prepareSearch($columns);
630
631           foreach ($columns as $column) {
632             $this->bindValue(':keyword', '%' . $keyword . '%');
633           }
634
635           $this->sql_query .= ' and ';
636         }
637
638         $this->sql_query = substr($this->sql_query, 0, -5);
639       }
640     }
641
hpdl
56
642     function setBatchLimit($batch_number = 1, $maximum_rows = 20, $select_field = '') {
hpdl
1
643       $this->batch_query = true;
hpdl
55
644       $this->batch_number = (is_numeric($batch_number) ? $batch_number : 1);
hpdl
1
645       $this->batch_rows = $maximum_rows;
646       $this->batch_select_field = (empty($select_field) ? '*' : $select_field);
647
hpdl
444
648       $from = max(($this->batch_number * $maximum_rows) - $maximum_rows, 0);
hpdl
1
649
650       $this->sql_query = $this->db_class->setBatchLimit($this->sql_query, $from, $maximum_rows);
651
652     }
653
hpdl
298
654     function getBatchSize() {
hpdl
1384
655       return $this->batch_size;
656     }
hpdl
1
657
hpdl
1384
658     function isBatchQuery() {
659       if ($this->batch_query === true) {
660         return true;
hpdl
1
661       }
662
hpdl
1384
663       return false;
hpdl
1
664     }
665
hpdl
1384
666     function getBatchTotalPages($text) {
hpdl
1
667       return sprintf($text, $this->batch_from, $this->batch_to, $this->batch_size);
668     }
669
hpdl
1384
670     function getBatchPageLinks($batch_keyword = 'page', $parameters = '', $with_pull_down_menu = true) {
671       $string = $this->getBatchPreviousPageLink($batch_keyword, $parameters);
672
673       if ( $with_pull_down_menu === true ) {
674         $string .= $this->getBatchPagesPullDownMenu($batch_keyword, $parameters);
675       }
676
677       $string .= $this->getBatchNextPageLink($batch_keyword, $parameters);
678
679       return $string;
680     }
681
682     function getBatchPagesPullDownMenu($batch_keyword = 'page', $parameters = '') {
hpdl
387
683       global $osC_Language;
684
hpdl
1
685       $number_of_pages = ceil($this->batch_size / $this->batch_rows);
686
hpdl
1384
687       if ( $number_of_pages > 1 ) {
hpdl
1
688         $pages_array = array();
hpdl
1384
689
690         for ( $i = 1; $i <= $number_of_pages; $i++ ) {
691           $pages_array[] = array('id' => $i,
692                                  'text' => $i);
hpdl
1
693         }
694
695         $hidden_parameter = '';
hpdl
1026
696
hpdl
1384
697         if ( !empty($parameters) ) {
hpdl
685
698           $parameters = explode('&', $parameters);
hpdl
1026
699
hpdl
1384
700           foreach ( $parameters as $parameter ) {
hpdl
1026
701             $keys = explode('=', $parameter, 2);
hpdl
1
702
hpdl
1384
703             if ( $keys[0] != $batch_keyword ) {
hpdl
1026
704               $hidden_parameter .= osc_draw_hidden_field($keys[0], (isset($keys[1]) ? $keys[1] : ''));
hpdl
1
705             }
706           }
707         }
708
hpdl
1384
709         $string = '<form action="' . osc_href_link(basename($_SERVER['SCRIPT_FILENAME'])) . '" action="get">' . $hidden_parameter .
710                   sprintf($osC_Language->get('result_set_current_page'), osc_draw_pull_down_menu($batch_keyword, $pages_array, $this->batch_number, 'onchange="this.form.submit();"'), $number_of_pages) .
711                   osc_draw_hidden_session_id_field() . '</form>';
712       } else {
713         $string = sprintf($osC_Language->get('result_set_current_page'), 1, 1);
714       }
hpdl
1299
715
hpdl
1384
716       return $string;
717     }
hpdl
1
718
hpdl
1384
719     function getBatchPreviousPageLink($batch_keyword = 'page', $parameters = '') {
720       global $osC_Language;
hpdl
1
721
hpdl
1384
722       $get_parameter = '';
hpdl
1
723
hpdl
1384
724       if ( !empty($parameters) ) {
725         $parameters = explode('&', $parameters);
726
727         foreach ( $parameters as $parameter ) {
728           $keys = explode('=', $parameter, 2);
729
730           if ( $keys[0] != $batch_keyword ) {
731             $get_parameter .= $keys[0] . (isset($keys[1]) ? '=' . $keys[1] : '') . '&';
732           }
hpdl
1
733         }
hpdl
1384
734       }
hpdl
1
735
hpdl
1384
736       if ( defined('OSC_IN_ADMIN') && ( OSC_IN_ADMIN === true ) ) {
737         $back_string = osc_icon('nav_back.png');
738         $back_grey_string = osc_icon('nav_back_grey.png');
hpdl
1
739       } else {
hpdl
1384
740         $back_string = $osC_Language->get('result_set_previous_page');
741         $back_grey_string = $osC_Language->get('result_set_previous_page');
hpdl
1
742       }
743
hpdl
1384
744       if ( $this->batch_number > 1 ) {
745         $string = osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $get_parameter . $batch_keyword . '=' . ($this->batch_number - 1)), $back_string);
746       } else {
747         $string = $back_grey_string;
748       }
749
750       $string .= '&nbsp;';
751
752       return $string;
hpdl
1
753     }
754
hpdl
1384
755     function getBatchNextPageLink($batch_keyword = 'page', $parameters = '') {
756       global $osC_Language;
757
758       $number_of_pages = ceil($this->batch_size / $this->batch_rows);
759
760       $get_parameter = '';
761
762       if ( !empty($parameters) ) {
763         $parameters = explode('&', $parameters);
764
765         foreach ( $parameters as $parameter ) {
766           $keys = explode('=', $parameter, 2);
767
768           if ( $keys[0] != $batch_keyword ) {
769             $get_parameter .= $keys[0] . (isset($keys[1]) ? '=' . $keys[1] : '') . '&';
770           }
771         }
hpdl
1
772       }
773
hpdl
1384
774       if ( defined('OSC_IN_ADMIN') && ( OSC_IN_ADMIN === true ) ) {
775         $forward_string = osc_icon('nav_forward.png');
776         $forward_grey_string = osc_icon('nav_forward_grey.png');
777       } else {
778         $forward_string = $osC_Language->get('result_set_next_page');
779         $forward_grey_string = $osC_Language->get('result_set_next_page');
780       }
781
782       $string = '&nbsp;';
783
784       if ( ( $this->batch_number < $number_of_pages ) && ( $number_of_pages != 1 ) ) {
785         $string .= osc_link_object(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), $get_parameter . $batch_keyword . '=' . ($this->batch_number + 1)), $forward_string);
786       } else {
787         $string .= $forward_grey_string;
788       }
789
790       return $string;
hpdl
1
791     }
792   }
793 ?>