Changeset 9 in ExiteCMS8
- Timestamp:
- 01/10/11 23:18:59 (17 months ago)
- Location:
- trunk/fuel/core
- Files:
-
- 21 edited
-
bootstrap.php (modified) (2 diffs)
-
classes/autoloader.php (modified) (3 diffs)
-
classes/cookie.php (modified) (3 diffs)
-
classes/database/exception.php (modified) (1 diff)
-
classes/database/mysql.php (modified) (12 diffs)
-
classes/database/mysql/result.php (modified) (1 diff)
-
classes/database/pdo.php (modified) (5 diffs)
-
classes/database/query.php (modified) (3 diffs)
-
classes/database/query/builder.php (modified) (1 diff)
-
classes/database/query/builder/delete.php (modified) (2 diffs)
-
classes/database/query/builder/insert.php (modified) (3 diffs)
-
classes/database/query/builder/join.php (modified) (1 diff)
-
classes/database/query/builder/select.php (modified) (3 diffs)
-
classes/database/query/builder/update.php (modified) (2 diffs)
-
classes/database/query/builder/where.php (modified) (1 diff)
-
classes/database/result.php (modified) (1 diff)
-
classes/database/result/cached.php (modified) (1 diff)
-
classes/db.php (modified) (9 diffs)
-
classes/html.php (modified) (2 diffs)
-
classes/security.php (modified) (1 diff)
-
classes/session/driver.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fuel/core/bootstrap.php
r6 r9 76 76 'Fuel\\Core\\Database_Exception' => COREPATH.'classes/database/exception.php', 77 77 'Fuel\\Core\\Database_Expression' => COREPATH.'classes/database/expression.php', 78 'Fuel\\Core\\Database_Pdo' => COREPATH.'classes/database/pdo.php', 78 79 'Fuel\\Core\\Database_Query' => COREPATH.'classes/database/query.php', 79 80 'Fuel\\Core\\Database_Query_Builder' => COREPATH.'classes/database/query/builder.php', … … 85 86 'Fuel\\Core\\Database_Query_Builder_Join' => COREPATH.'classes/database/query/builder/join.php', 86 87 'Fuel\\Core\\Database_Result' => COREPATH.'classes/database/result.php', 88 'Fuel\\Core\\Database_Result_Cached' => COREPATH.'classes/database/result/cached.php', 87 89 'Fuel\\Core\\Database_Mysql' => COREPATH.'classes/database/mysql.php', 88 90 'Fuel\\Core\\Database_MySQL_Result' => COREPATH.'classes/database/mysql/result.php', -
trunk/fuel/core/classes/autoloader.php
r2 r9 350 350 } 351 351 } 352 353 // Prevent failed load from keeping other classes from initializing 354 if (static::$auto_initialize == $class) 355 { 356 static::$auto_initialize = null; 357 } 358 352 359 return false; 353 360 } … … 363 370 if (static::$auto_initialize === $class) 364 371 { 372 static::$auto_initialize = null; 365 373 if (is_callable($class.'::_init')) 366 374 { … … 368 376 } 369 377 } 370 static::$auto_initialize = null;371 378 } 372 379 } -
trunk/fuel/core/classes/cookie.php
r2 r9 80 80 * @param string value of cookie 81 81 * @param integer lifetime in seconds 82 * @param string path of the cookie 83 * @param string domain of the cookie 82 84 * @return boolean 83 85 */ 84 public static function set($name, $value, $expiration = null )86 public static function set($name, $value, $expiration = null, $path = null, $domain = null) 85 87 { 86 88 // If nothing is provided, use the standard amount of time … … 89 91 $expiration = time() + 86500; 90 92 } 91 92 93 // If it's set, add the current time so we have an offset 93 94 else … … 96 97 } 97 98 98 return setcookie($name, $value, $expiration, static::$path, static::$domain, static::$secure, static::$httponly); 99 // use the class defaults for path and domain if not provided 100 if (empty($path)) 101 { 102 $path = static::$path; 103 } 104 105 if (empty($domain)) 106 { 107 $domain = static::$domain; 108 } 109 110 return setcookie($name, $value, $expiration, $path, $domain, static::$secure, static::$httponly); 99 111 } 100 112 -
trunk/fuel/core/classes/database/exception.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Exception extends Exception {}14 class Database_Exception extends \Exception {} -
trunk/fuel/core/classes/database/mysql.php
r2 r9 14 14 15 15 16 class Database_MySQL extends Database {16 class Database_MySQL extends \Database { 17 17 18 18 // Database in use by each connection … … 36 36 return; 37 37 38 if ( Database_MySQL::$_set_names === NULL)38 if (static::$_set_names === NULL) 39 39 { 40 40 // Determine if we can use mysql_set_charset(), which is only 41 41 // available on PHP 5.2.3+ when compiled against MySQL 5.0+ 42 Database_MySQL::$_set_names = ! function_exists('mysql_set_charset');42 static::$_set_names = ! function_exists('mysql_set_charset'); 43 43 } 44 44 … … 73 73 $this->_connection = NULL; 74 74 75 throw new Database_Exception(mysql_error(), mysql_errno());75 throw new \Database_Exception(mysql_error(), mysql_errno()); 76 76 } 77 77 … … 99 99 { 100 100 // Unable to select database 101 throw new Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection));102 } 103 104 Database_MySQL::$_current_databases[$this->_connection_id] = $database;101 throw new \Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection)); 102 } 103 104 static::$_current_databases[$this->_connection_id] = $database; 105 105 } 106 106 … … 135 135 $this->_connection or $this->connect(); 136 136 137 if ( Database_MySQL::$_set_names === TRUE)137 if (static::$_set_names === TRUE) 138 138 { 139 139 // PHP is compiled against MySQL 4.x … … 148 148 if ($status === FALSE) 149 149 { 150 throw new Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection));150 throw new \Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection)); 151 151 } 152 152 } … … 163 163 } 164 164 165 if ( ! empty($this->_config['connection']['persistent']) AND $this->_config['connection']['database'] !== Database_MySQL::$_current_databases[$this->_connection_id])165 if ( ! empty($this->_config['connection']['persistent']) AND $this->_config['connection']['database'] !== static::$_current_databases[$this->_connection_id]) 166 166 { 167 167 // Select database on persistent connections … … 178 178 } 179 179 180 throw new Database_Exception(mysql_error($this->_connection).' [ '.$sql.' ]',180 throw new \Database_Exception(mysql_error($this->_connection).' [ '.$sql.' ]', 181 181 mysql_errno($this->_connection)); 182 182 } … … 190 190 $this->last_query = $sql; 191 191 192 if ($type === Database::SELECT)192 if ($type === \Database::SELECT) 193 193 { 194 194 // Return an iterator of results 195 return new Database_MySQL_Result($result, $sql, $as_object);196 } 197 elseif ($type === Database::INSERT)195 return new \Database_MySQL_Result($result, $sql, $as_object); 196 } 197 elseif ($type === \Database::INSERT) 198 198 { 199 199 // Return a list of insert id and rows created … … 262 262 { 263 263 // Search for table names 264 $result = $this->query( Database::SELECT, 'SHOW TABLES LIKE '.$this->quote($like), FALSE);264 $result = $this->query(\Database::SELECT, 'SHOW TABLES LIKE '.$this->quote($like), FALSE); 265 265 } 266 266 else 267 267 { 268 268 // Find all table names 269 $result = $this->query( Database::SELECT, 'SHOW TABLES', FALSE);269 $result = $this->query(\Database::SELECT, 'SHOW TABLES', FALSE); 270 270 } 271 271 … … 287 287 { 288 288 // Search for column names 289 $result = $this->query( Database::SELECT, 'SHOW FULL COLUMNS FROM '.$table.' LIKE '.$this->quote($like), FALSE);289 $result = $this->query(\Database::SELECT, 'SHOW FULL COLUMNS FROM '.$table.' LIKE '.$this->quote($like), FALSE); 290 290 } 291 291 else 292 292 { 293 293 // Find all column names 294 $result = $this->query( Database::SELECT, 'SHOW FULL COLUMNS FROM '.$table, FALSE);294 $result = $this->query(\Database::SELECT, 'SHOW FULL COLUMNS FROM '.$table, FALSE); 295 295 } 296 296 … … 370 370 if (($value = mysql_real_escape_string((string) $value, $this->_connection)) === FALSE) 371 371 { 372 throw new Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection));372 throw new \Database_Exception(mysql_error($this->_connection), mysql_errno($this->_connection)); 373 373 } 374 374 -
trunk/fuel/core/classes/database/mysql/result.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_MySQL_Result extends Database_Result {14 class Database_MySQL_Result extends \Database_Result { 15 15 16 16 protected $_internal_row = 0; -
trunk/fuel/core/classes/database/pdo.php
r2 r9 13 13 14 14 15 class Database_PDO extends Database {15 class Database_PDO extends \Database { 16 16 17 17 // PDO uses no quoting for identifiers … … 68 68 catch (\PDOException $e) 69 69 { 70 throw new Database_Exception($e->getMessage(), $e->getCode(), $e);70 throw new \Database_Exception($e->getMessage(), $e->getCode(), $e); 71 71 } 72 72 … … 119 119 120 120 // Convert the exception in a database exception 121 throw new Database_Exception($e->getMessage().' with query: "'.$sql.'"');121 throw new \Database_Exception($e->getMessage().' with query: "'.$sql.'"'); 122 122 } 123 123 … … 130 130 $this->last_query = $sql; 131 131 132 if ($type === Database::SELECT)132 if ($type === \Database::SELECT) 133 133 { 134 134 // Convert the result into an array, as PDOStatement::rowCount is not reliable … … 149 149 150 150 // Return an iterator of results 151 return new Database_Result_Cached($result, $sql, $as_object);151 return new \Database_Result_Cached($result, $sql, $as_object); 152 152 } 153 elseif ($type === Database::INSERT)153 elseif ($type === \Database::INSERT) 154 154 { 155 155 // Return a list of insert id and rows created -
trunk/fuel/core/classes/database/query.php
r2 r9 54 54 { 55 55 // Return the SQL string 56 return $this->compile( Database::instance());56 return $this->compile(\Database::instance()); 57 57 } 58 58 catch (Exception $e) … … 191 191 { 192 192 // Get the database instance 193 $db = Database::instance($db);193 $db = \Database::instance($db); 194 194 } 195 195 … … 213 213 { 214 214 case 'SELECT': 215 $this->_type = Database::SELECT;215 $this->_type = \Database::SELECT; 216 216 break; 217 217 case 'INSERT': 218 218 case 'CREATE': 219 $this->_type = Database::INSERT;219 $this->_type = \Database::INSERT; 220 220 break; 221 221 } -
trunk/fuel/core/classes/database/query/builder.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 abstract class Database_Query_Builder extends Database_Query {14 abstract class Database_Query_Builder extends \Database_Query { 15 15 16 16 /** -
trunk/fuel/core/classes/database/query/builder/delete.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Query_Builder_Delete extends Database_Query_Builder_Where {14 class Database_Query_Builder_Delete extends \Database_Query_Builder_Where { 15 15 16 16 // DELETE FROM ... … … 32 32 33 33 // Start the query with no SQL 34 return parent::__construct('', Database::DELETE);34 return parent::__construct('', \Database::DELETE); 35 35 } 36 36 -
trunk/fuel/core/classes/database/query/builder/insert.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Query_Builder_Insert extends Database_Query_Builder {14 class Database_Query_Builder_Insert extends \Database_Query_Builder { 15 15 16 16 // INSERT INTO ... … … 45 45 46 46 // Start the query with no SQL 47 return parent::__construct('', Database::INSERT);47 return parent::__construct('', \Database::INSERT); 48 48 } 49 49 … … 118 118 public function select(Database_Query $query) 119 119 { 120 if ($query->type() !== Database::SELECT)120 if ($query->type() !== \Database::SELECT) 121 121 { 122 122 throw new \Exception('Only SELECT queries can be combined with INSERT queries'); -
trunk/fuel/core/classes/database/query/builder/join.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Query_Builder_Join extends Database_Query_Builder {14 class Database_Query_Builder_Join extends \Database_Query_Builder { 15 15 16 16 // Type of JOIN -
trunk/fuel/core/classes/database/query/builder/select.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Query_Builder_Select extends Database_Query_Builder_Where {14 class Database_Query_Builder_Select extends \Database_Query_Builder_Where { 15 15 16 16 // SELECT ... … … 53 53 54 54 // Start the query with no actual SQL statement 55 parent::__construct( Database::SELECT, '');55 parent::__construct(\Database::SELECT, ''); 56 56 } 57 57 … … 123 123 public function join($table, $type = NULL) 124 124 { 125 $this->_join[] = $this->_last_join = new Database_Query_Builder_Join($table, $type);125 $this->_join[] = $this->_last_join = new \Database_Query_Builder_Join($table, $type); 126 126 127 127 return $this; -
trunk/fuel/core/classes/database/query/builder/update.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Query_Builder_Update extends Database_Query_Builder_Where {14 class Database_Query_Builder_Update extends \Database_Query_Builder_Where { 15 15 16 16 // UPDATE ... … … 35 35 36 36 // Start the query with no SQL 37 return parent::__construct('', Database::UPDATE);37 return parent::__construct('', \Database::UPDATE); 38 38 } 39 39 -
trunk/fuel/core/classes/database/query/builder/where.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 abstract class Database_Query_Builder_Where extends Database_Query_Builder {14 abstract class Database_Query_Builder_Where extends \Database_Query_Builder { 15 15 16 16 // WHERE ... -
trunk/fuel/core/classes/database/result.php
r2 r9 71 71 public function cached() 72 72 { 73 return new Database_Result_Cached($this->as_array(), $this->_query, $this->_as_object);73 return new \Database_Result_Cached($this->as_array(), $this->_query, $this->_as_object); 74 74 } 75 75 -
trunk/fuel/core/classes/database/result/cached.php
r2 r9 12 12 namespace Fuel\Core; 13 13 14 class Database_Result_Cached extends Database_Result {14 class Database_Result_Cached extends \Database_Result { 15 15 16 16 public function __construct(array $result, $sql, $as_object = NULL) -
trunk/fuel/core/classes/db.php
r2 r9 39 39 public static function query($sql, $type = null) 40 40 { 41 return new Database_Query($sql, $type);41 return new \Database_Query($sql, $type); 42 42 } 43 43 … … 58 58 public static function select($columns = NULL) 59 59 { 60 return new Database_Query_Builder_Select(func_get_args());60 return new \Database_Query_Builder_Select(func_get_args()); 61 61 } 62 62 … … 72 72 public static function select_array(array $columns = NULL) 73 73 { 74 return new Database_Query_Builder_Select($columns);74 return new \Database_Query_Builder_Select($columns); 75 75 } 76 76 … … 87 87 public static function insert($table = NULL, array $columns = NULL) 88 88 { 89 return new Database_Query_Builder_Insert($table, $columns);89 return new \Database_Query_Builder_Insert($table, $columns); 90 90 } 91 91 … … 101 101 public static function update($table = NULL) 102 102 { 103 return new Database_Query_Builder_Update($table);103 return new \Database_Query_Builder_Update($table); 104 104 } 105 105 … … 115 115 public static function delete($table = NULL) 116 116 { 117 return new Database_Query_Builder_Delete($table);117 return new \Database_Query_Builder_Delete($table); 118 118 } 119 119 … … 129 129 public static function expr($string) 130 130 { 131 return new Database_Expression($string);131 return new \Database_Expression($string); 132 132 } 133 133 … … 149 149 return $string; 150 150 } 151 return Database::instance($db)->quote_identifier($string);151 return \Database::instance($db)->quote_identifier($string); 152 152 } 153 153 … … 161 161 public static function escape($string, $db = null) 162 162 { 163 return Database::instance($db)->escape($string);163 return \Database::instance($db)->escape($string); 164 164 } 165 165 -
trunk/fuel/core/classes/html.php
r2 r9 55 55 public static function anchor($href, $text, $attributes = array()) 56 56 { 57 if ( ! preg_match('#^ \w+://# i', $href))57 if ( ! preg_match('#^(\w+://|javascript:)# i', $href)) 58 58 { 59 59 $href = \Uri::create($href); … … 73 73 public static function prep_url($url, $schema = 'http') 74 74 { 75 if ( ! preg_match('#^ \w+://# i', $url))75 if ( ! preg_match('#^(\w+://|javascript:)# i', $url)) 76 76 { 77 77 $url = $schema.'://'.$url; -
trunk/fuel/core/classes/security.php
r2 r9 84 84 85 85 return $value; 86 } 87 88 public static function htmlentities($value) 89 { 90 die('here'); 86 91 } 87 92 -
trunk/fuel/core/classes/session/driver.php
r2 r9 503 503 if ($this->config['expire_on_close']) 504 504 { 505 return \Cookie::set($this->config['cookie_name'], $payload, 0 );505 return \Cookie::set($this->config['cookie_name'], $payload, 0, $this->config['cookie_path'], $this->config['cookie_domain']); 506 506 } 507 507 else 508 508 { 509 return \Cookie::set($this->config['cookie_name'], $payload, $this->config['expiration_time'] );509 return \Cookie::set($this->config['cookie_name'], $payload, $this->config['expiration_time'], $this->config['cookie_path'], $this->config['cookie_domain']); 510 510 } 511 511 }
Note: See TracChangeset
for help on using the changeset viewer.
