Broken code
101 protected function _select_db($database)
102 {
103 if ( ! mysql_select_db($database, $this->_connection))
104 {
105 // Unable to select database
106 throw new Database_Exception(':error',
107 array(':error' => mysql_error($this->_connection)),
108 mysql_errno($this->_connection));
109 }
110
111 Database_MySQL::$_current_databases[$this->_connection_id] = $database;
Stack trace
MODPATH/database/classes/Kohana/Database/MySQL.php [ 73 ] » Kohana_Database_MySQL->_select_db()
0 |
string(10) "bitmonitor" |
68 }
69
70 // \xFF is a better delimiter, but the PHP driver uses underscore
71 $this->_connection_id = sha1($hostname.'_'.$username.'_'.$password);
72
73 $this->_select_db($database);
74
75 if ( ! empty($this->_config['charset']))
76 {
77 // Set the character set
78 $this->set_charset($this->_config['charset']);
MODPATH/database/classes/Kohana/Database/MySQL.php [ 429 ] » Kohana_Database_MySQL->connect()
424 }
425
426 public function escape($value)
427 {
428 // Make sure the database is connected
429 $this->_connection or $this->connect();
430
431 if (($value = mysql_real_escape_string( (string) $value, $this->_connection)) === FALSE)
432 {
433 throw new Database_Exception(':error',
434 array(':error' => mysql_error($this->_connection)),
MODPATH/database/classes/Kohana/Database.php [ 478 ] » Kohana_Database_MySQL->escape()
0 |
string(2) "PL" |
473 {
474 // Convert to non-locale aware float to prevent possible commas
475 return sprintf('%F', $value);
476 }
477
478 return $this->escape($value);
479 }
480
481 /**
482 * Quote a database column name and add the table prefix if needed.
483 *
MODPATH/database/classes/Kohana/Database/Query/Builder.php [ 116 ] » Kohana_Database->quote()
0 |
string(2) "PL" |
111 $value = $min.' AND '.$max;
112 }
113 elseif ((is_string($value) AND array_key_exists($value, $this->_parameters)) === FALSE)
114 {
115 // Quote the value, it is not a parameter
116 $value = $db->quote($value);
117 }
118
119 if ($column)
120 {
121 if (is_array($column))
MODPATH/database/classes/Kohana/Database/Query/Builder/Select.php [ 372 ] » Kohana_Database_Query_Builder->_compile_conditions()
0 |
object Database_MySQL(6) |
1 |
array(2) ( 0 => array(1) ( "AND" => array(3) ( 0 => string(8) "language" 1 => string(1) "=" 2 => string(2) "PL" ) ) 1 => array(1) ( "AND" => array(3) ( 0 => string(8) "isActive" 1 => string(1) "=" 2 => integer 1 ) ) ) |
367 }
368
369 if ( ! empty($this->_where))
370 {
371 // Add selection conditions
372 $query .= ' WHERE '.$this->_compile_conditions($db, $this->_where);
373 }
374
375 if ( ! empty($this->_group_by))
376 {
377 // Add grouping
MODPATH/database/classes/Kohana/Database/Query.php [ 234 ] » Kohana_Database_Query_Builder_Select->compile()
0 |
object Database_MySQL(6) |
229 {
230 $object_params = $this->_object_params;
231 }
232
233 // Compile the SQL query
234 $sql = $this->compile($db);
235
236 if ($this->_lifetime !== NULL AND $this->_type === Database::SELECT)
237 {
238 // Set the cache key based on the database instance name and SQL
239 $cache_key = 'Database::query("'.$db.'", "'.$sql.'")';
APPPATH/classes/Model/Slogan.php [ 35 ] » Kohana_Database_Query->execute()
30 * @param $language
31 */
32 public function __construct($language) {
33 $language = strtoupper($language);
34
35 $this->slogans = DB::select()->from("slogan")->where("language", "=", $language)->and_where("isActive","=",1)->execute()->as_array();
36 $this->randomize();
37 }
38
39 /**
40 * Get random slogan from fetched slogans
APPPATH/classes/Controller/Home.php [ 15 ] » Model_Slogan->__construct()
0 |
string(2) "pl" |
10 class Controller_Home extends Controller {
11
12 public function action_index() {
13 $version = new Version();
14
15 $slogan = new Model_Slogan(I18n::getCurrentLanguage());
16
17 $view = View::factory('controllers/home/index')
18 ->set('header_slogan', $slogan->getTitle())
19 ->set('header_subslogan', $slogan->getSubTitle())
20 ->set('build', $version->getBuild())
SYSPATH/classes/Kohana/Controller.php [ 84 ] » Controller_Home->action_index()
79 array(':uri' => $this->request->uri())
80 )->request($this->request);
81 }
82
83 // Execute the action itself
84 $this->{$action}();
85
86 // Execute the "after action" method
87 $this->after();
88
89 // Return the response
{PHP internal call} » Kohana_Controller->execute()
SYSPATH/classes/Kohana/Request/Client/Internal.php [ 97 ] » ReflectionMethod->invoke()
0 |
object Controller_Home(4) |
92
93 // Create a new instance of the controller
94 $controller = $class->newInstance($request, $response);
95
96 // Run the controller's execute() method
97 $response = $class->getMethod('execute')->invoke($controller);
98
99 if ( ! $response instanceof Response)
100 {
101 // Controller failed to return a Response.
102 throw new Kohana_Exception('Controller failed to return a Response');
SYSPATH/classes/Kohana/Request/Client.php [ 114 ] » Kohana_Request_Client_Internal->execute_request()
0 |
object Request(19) |
1 |
object Response(5) |
109 $orig_response = $response = Response::factory(array('_protocol' => $request->protocol()));
110
111 if (($cache = $this->cache()) instanceof HTTP_Cache)
112 return $cache->execute($this, $request, $response);
113
114 $response = $this->execute_request($request, $response);
115
116 // Execute response callbacks
117 foreach ($this->header_callbacks() as $header => $callback)
118 {
119 if ($response->headers($header))
SYSPATH/classes/Kohana/Request.php [ 997 ] » Kohana_Request_Client->execute()
0 |
object Request(19) |
992 throw new Request_Exception('Unable to execute :uri without a Kohana_Request_Client', array(
993 ':uri' => $this->_uri,
994 ));
995 }
996
997 return $this->_client->execute($this);
998 }
999
1000 /**
1001 * Returns whether this request is the initial request Kohana received.
1002 * Can be used to test for sub requests.
DOCROOT/index.php [ 119 ] » Kohana_Request->execute()
114 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
115 * If no source is specified, the URI will be automatically detected.
116 */
117
118 echo Request::factory(TRUE, array(), FALSE)
119 ->execute()
120 ->send_headers(TRUE)
121 ->body();
122 }