Changeset 1437
- Timestamp:
- 12/06/07 20:15:37 (9 months ago)
- Location:
- trunk/system
- Files:
-
- 5 modified
-
helpers/arr.php (modified) (3 diffs)
-
helpers/date.php (modified) (1 diff)
-
helpers/form.php (modified) (2 diffs)
-
libraries/ORM.php (modified) (3 diffs)
-
libraries/drivers/Database_Mysql.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/helpers/arr.php
r1333 r1437 24 24 * The transformed array 25 25 */ 26 function rotate($source_array, $keep_keys = TRUE)26 public function rotate($source_array, $keep_keys = TRUE) 27 27 { 28 28 $new_array = array(); … … 50 50 * The value of the requested array key 51 51 */ 52 function remove($key, & $array)52 public function remove($key, & $array) 53 53 { 54 54 if ( ! isset($array[$key])) … … 60 60 return $val; 61 61 } 62 } 62 63 /** 64 * Because PHP does not have this function. 65 * 66 * @param array array to unshift 67 * @param string key to unshift 68 * @param mixed value to unshift 69 * @return array 70 */ 71 public function unshift_assoc( array & $array, $key, $val) 72 { 73 $array = array_reverse($array, TRUE); 74 $array[$key] = $val; 75 $array = array_reverse($array, TRUE); 76 77 return $array; 78 } 79 80 } // End arr -
trunk/system/helpers/date.php
r1333 r1437 298 298 { 299 299 // Default values 300 $time1 = max(0, (int) $time );300 $time1 = max(0, (int) $time1); 301 301 $time2 = ($time2 === FALSE) ? time() : max(0, (int) $time2); 302 302 -
trunk/system/helpers/form.php
r1333 r1437 141 141 142 142 // Form elements should have the same id as name 143 if ( ! isset($data['id']) )143 if ( ! isset($data['id']) AND strpos($data['name'], '[') === FALSE) 144 144 { 145 145 $data['id'] = $data['name']; … … 444 444 } 445 445 446 $data = array 447 ( 448 'for' => $data 449 ); 446 $data = empty($data) ? array() : array('for' => $data); 450 447 } 451 448 -
trunk/system/libraries/ORM.php
r1419 r1437 229 229 230 230 // Find requested objects 231 return isset($all) ? $this-> find_all() : $this->find();231 return isset($all) ? $this->load_result(TRUE) : $this->find(); 232 232 } 233 233 … … 259 259 } 260 260 261 return $model-> find_all();261 return $model->load_result(TRUE); 262 262 } 263 263 … … 619 619 $class = get_class($this); 620 620 621 $result = $result->result_array(); 622 621 623 $array = array(); 622 foreach($result ->result_array()as $row)624 foreach($result as $row) 623 625 { 624 626 // Add object to the array -
trunk/system/libraries/drivers/Database_Mysql.php
r1389 r1437 393 393 } 394 394 395 while ($row = $fetch($this->result, $type)) 396 { 397 $rows[] = $row; 398 } 399 400 return $rows; 395 if (mysql_num_rows($this->result)) 396 { 397 // Reset the pointer location to make sure things work properly 398 mysql_data_seek($this->result, 0); 399 400 while ($row = $fetch($this->result, $type)) 401 { 402 $rows[] = $row; 403 } 404 } 405 406 return isset($rows) ? $rows : array(); 401 407 } 402 408 … … 476 482 { 477 483 // Check to see if the requested offset exists. 478 if ( !$this->offsetExists($offset))484 if ( ! $this->offsetExists($offset)) 479 485 return FALSE; 480 486
