- Timestamp:
- Mar 21, 2024 4:49:53 AM (5 weeks ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r810 r812 232 232 // Use the unicode modifier like this: preg_replace('/[^0-9]/' . $app->getParam('preg_u'), '', $str); 233 233 'preg_u' => '', 234 235 // Prettify json when testing. 236 'json_options' => JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES, 234 237 ); 235 238 -
trunk/lib/PageNumbers.inc.php
r768 r812 64 64 public $right_dbl_arrow; 65 65 public $right_dbl_arrow_disabled; 66 public $url_base; 67 public $prefs; 66 68 67 69 /** … … 91 93 } 92 94 95 private function _validNumber($num) 96 { 97 if (!isset($num) || '' == $num) { 98 return false; 99 } 100 return preg_match('/^\d+$/', $num); 101 } 102 93 103 /** 94 104 * Set the number of items per page. … … 100 110 // (3) Set to default value if provided and valid. 101 111 // (4) Keep as Class default of 25. 102 if ( is_numeric($per_page) && $per_page > 0) {112 if ($this->_validNumber($per_page) && $per_page > 0) { 103 113 $this->_per_page = $per_page; 104 114 if ($save_value) { … … 107 117 } else if ($save_value && $this->prefs->exists('items_per_page')) { 108 118 $this->_per_page = (int)$this->prefs->get('items_per_page'); 109 } else if ( is_numeric($default) && $default > 0) {119 } else if ($this->_validNumber($default) && $default > 0) { 110 120 $this->_per_page = $default; 111 121 } … … 121 131 // (2) By saved preference, if available. 122 132 // (3) Don't change from what was provided at class instantiation. 123 if ( is_numeric($page_number)) {133 if ($this->_validNumber($page_number)) { 124 134 if ($page_number < 1) { 125 135 // FIXME: How to go back around to the last page? Hmmm. Set to 1 for now. … … 142 152 public function setTotalItems($total_items) 143 153 { 144 if ( is_numeric($total_items) && $total_items > 0) {154 if ($this->_validNumber($total_items) && $total_items > 0) { 145 155 $this->total_items = $total_items; 146 156 } else { … … 218 228 $db =& DB::getInstance(); 219 229 220 if ( is_numeric($this->first_item) && is_numeric($this->_per_page)) {230 if ($this->_validNumber($this->first_item) && $this->_validNumber($this->_per_page)) { 221 231 return ' LIMIT ' . $db->escapeString($this->first_item) . ', ' . $db->escapeString($this->_per_page) . ' '; 222 232 } else { -
trunk/lib/SortOrder.inc.php
r717 r812 46 46 public $default_order; 47 47 public $base_url; 48 public $prefs; 48 49 49 50 /** -
trunk/polyfill/mysql.inc.php
r806 r812 833 833 public function mysql_real_escape_string($string, $link = false) 834 834 { 835 if ('' == $string) {835 if ('' == (string)$string) { 836 836 return ''; 837 837 } … … 1216 1216 throw new MySQL2PDOException($this->_params[$link]['errno'] .': ' . $this->_params[$link]['error']); 1217 1217 } else { 1218 throw new MySQL2PDOException('No db at 1218 throw new MySQL2PDOException('No db at instance #' . ($link - 1)); 1219 1219 } 1220 1220 }
Note: See TracChangeset
for help on using the changeset viewer.