- Bake pluralized all controller names, fixed.

- vendor() function to load a vendor library
- uses() is simple again
- config() treats database config differently (needs to because database config is a class, not a great idea after all)
- moved DBO layers into their own subfolder in /libs -- there's too many of them already
- AdoDB and Pear::DB support much better, although needs testing
- fixes in Flay URL parsing
- Model::findAll() uses the new DBO::selectLimit() method for wider database compatibility
- changed Template::_page_title into _pageTitle
- /public/index.php cleaned up

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@245 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
pies 2005-06-12 20:50:12 +00:00
parent 39132f9bcf
commit 01b0d81dd2
15 changed files with 904 additions and 670 deletions

View file

@ -203,7 +203,7 @@ class %sTest extends TestCase {
* @uses Bake::actions Adds one action for each run. * @uses Bake::actions Adds one action for each run.
*/ */
function newView ($controller, $name) { function newView ($controller, $name) {
$controller = Inflector::pluralize($controller); // $controller = Inflector::pluralize($controller);
$dir = Inflector::underscore($controller); $dir = Inflector::underscore($controller);
$path = $dir.DS.strtolower($name).".thtml"; $path = $dir.DS.strtolower($name).".thtml";
$this->createDir(VIEWS.$dir); $this->createDir(VIEWS.$dir);
@ -227,7 +227,7 @@ class %sTest extends TestCase {
* @uses Bake::actions Adds one action for each run. * @uses Bake::actions Adds one action for each run.
*/ */
function newController ($name, $actions=array()) { function newController ($name, $actions=array()) {
$name = Inflector::pluralize($name); // $name = Inflector::pluralize($name);
$this->makeController($name, $actions); $this->makeController($name, $actions);
$this->makeControllerTest($name); $this->makeControllerTest($name);
$this->makeHelper($name); $this->makeHelper($name);

View file

@ -100,7 +100,11 @@ function listClasses($path)
function config () { function config () {
$args = func_get_args(); $args = func_get_args();
foreach ($args as $arg) { foreach ($args as $arg) {
if (file_exists(CONFIGS.$arg.'.php')) { if (('database' == $arg) && file_exists(CONFIGS.$arg.'.php'))
{
include_once(CONFIGS.$arg.'.php');
}
elseif (file_exists(CONFIGS.$arg.'.php')) {
include (CONFIGS.$arg.'.php'); include (CONFIGS.$arg.'.php');
if (count($args) == 1) return true; if (count($args) == 1) return true;
} }
@ -124,19 +128,20 @@ function config () {
*/ */
function uses () function uses ()
{ {
global $loaded;
if (!is_array($loaded))
$loaded = array();
$args = func_get_args(); $args = func_get_args();
foreach ($args as $arg) foreach ($args as $arg)
{ {
if (0 == in_array($arg, $loaded)) require_once(LIBS.strtolower($arg).'.php');
{ }
require_once(LIBS.strtolower($arg).'.php'); }
$loaded[] = $arg;
}
function vendor($name)
{
$args = func_get_args();
foreach ($args as $arg)
{
require_once(VENDORS.$arg.'.php');
} }
} }

View file

@ -88,6 +88,14 @@ class DBO extends Object {
*/ */
var $connected=FALSE; var $connected=FALSE;
/**
* Connection configuration.
*
* @var array
* @access public
*/
var $config=FALSE;
/** /**
* Enter description here... * Enter description here...
* *
@ -186,50 +194,6 @@ class DBO extends Object {
*/ */
var $_queriesLogMax=200; var $_queriesLogMax=200;
// specific for each database, implemented in db drivers
function connect ($config) {
die('Please implement DBO::connect() first.');
}
function disconnect () {
die('Please implement DBO::disconnect() first.');
}
function execute ($sql) {
die('Please implement DBO::execute() first.');
}
function fetchRow ($result) {
die('Please implement DBO::fetchRow() first.');
}
function tablesList() {
die('Please implement DBO::tables() first.');
}
function fields ($table_name) {
die('Please implement DBO::fields() first.');
}
function prepareField ($data) {
die('Please implement DBO::prepareField() first.');
}
function lastError ($result) {
die('Please implement DBO::lastError() first.');
}
function lastAffected () {
die('Please implement DBO::lastAffected() first.');
}
function lastNumRows ($result) {
die('Please implement DBO::lastNumRows() first.');
}
function lastInsertId () {
die('Please implement DBO::lastInsertId() first.');
}
/** /**
* Constructor. Sets the level of debug for dbo (fullDebug or debug). * Constructor. Sets the level of debug for dbo (fullDebug or debug).

View file

@ -1,173 +1,205 @@
<?PHP <?PHP
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// + $Id$ // + $Id$
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + // // + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + // // + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + // // + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + // // + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + // // + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Licensed under The MIT License + // // + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + // // + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + // // + See: http://www.opensource.org/licenses/mit-license.php + //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/** /**
* AdoDB layer for DBO. * AdoDB layer for DBO.
* *
* @filesource * @filesource
* @author Cake Authors/Developers * @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers * @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 0.2.9 * @since Cake v 0.2.9
* @version $Revision$ * @version $Revision$
* @modifiedby $LastChangedBy$ * @modifiedby $LastChangedBy$
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Include AdoDB files. * Include AdoDB files.
*/ */
require_once(VENDORS.'adodb/adodb.inc.php'); require_once(VENDORS.'adodb/adodb.inc.php');
/** /**
* AdoDB layer for DBO. * AdoDB layer for DBO.
* *
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 0.2.9 * @since Cake v 0.2.9
*/ */
class DBO_AdoDB extends DBO { class DBO_AdoDB extends DBO
{
/**
* Connects to the database using options in the given configuration array. /**
* * ADOConnection object with which we connect.
* @param array $config Configuration array for connecting *
*/ * @var ADOConnection The connection object.
function connect ($config) { */
if($this->config = $config) { var $_adodb = null;
if(isset($this->config['driver'])) {
$this->_adodb = NewADOConnection($this->config['driver']); /**
* Connects to the database using options in the given configuration array.
$adodb =& $this->_adodb; *
$this->connected = $adodb->Connect($this->config['host'],$this->config['login'],$this->config['password'],$this->config['database']); * @param array $config Configuration array for connecting
} */
} function connect ($config)
{
if(!$this->connected) $this->config = $config;
die('Could not connect to DB.');
} $this->_adodb = NewADOConnection($config['driver']);
$adodb =& $this->_adodb;
/** $this->connected = $adodb->Connect($config['host'], $config['login'], $config['password'], $config['database']);
* Disconnects from database.
* if(!$this->connected)
* @return boolean True if the database could be disconnected, else false die('Could not connect to DB.');
*/ }
function disconnect () {
return $this->_adodb->close(); /**
} * Disconnects from database.
*
/** * @return boolean True if the database could be disconnected, else false
* Executes given SQL statement. */
* function disconnect ()
* @param string $sql SQL statement {
* @return resource Result resource identifier return $this->_adodb->close();
*/ }
function execute ($sql) {
return $this->_adodb->execute($sql); /**
} * Executes given SQL statement.
*
/** * @param string $sql SQL statement
* Returns a row from given resultset as an array . * @return resource Result resource identifier
* */
* @param unknown_type $res Resultset function execute ($sql)
* @return array The fetched row as an array {
*/ return $this->_adodb->execute($sql);
function fetchRow ($res) { }
return $res->FetchRow();
} /**
* Returns a row from given resultset as an array .
/** *
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits. * @param unknown_type $res Resultset
* * @return array The fetched row as an array
* @return array Array of tablenames in the database */
*/ function fetchRow ($res)
function tablesList() { {
$tables = $this->_adodb->MetaTables('TABLES'); return $res->FetchRow();
}
if (!sizeof($tables)>0) {
trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE); /**
exit; * Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
} *
return $tables; * @return array Array of tablenames in the database
} */
function tablesList()
/** {
* Returns an array of the fields in given table name. $tables = $this->_adodb->MetaTables('TABLES');
*
* @param string $table_name Name of database table to inspect if (!sizeof($tables)>0) {
* @return array Fields in table. Keys are name and type trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE);
*/ exit;
function fields ($table_name) { }
$data = $this->_adodb->MetaColumns($table_name); return $tables;
$fields = false; }
foreach ($data as $item) /**
$fields[] = array('name'=>$item->name, 'type'=>$item->type); * Returns an array of the fields in given table name.
*
return $fields; * @param string $table_name Name of database table to inspect
} * @return array Fields in table. Keys are name and type
*/
/** function fields ($table_name)
* Returns a quoted and escaped string of $data for use in an SQL statement. {
* $data = $this->_adodb->MetaColumns($table_name);
* @param string $data String to be prepared for use in an SQL statement $fields = false;
* @return string Quoted and escaped
* foreach ($data as $item)
* :TODO: To be implemented. $fields[] = array('name'=>$item->name, 'type'=>$item->type);
*/
function prepareValue ($data) { die('Please implement DBO::prepare() first.'); } return $fields;
}
/**
* Returns a formatted error message from previous database operation. /**
* * Returns a quoted and escaped string of $data for use in an SQL statement.
* @return string Error message *
*/ * @param string $data String to be prepared for use in an SQL statement
function lastError () { * @return string Quoted and escaped
return $this->_adodb->ErrorMsg(); *
} * :TODO: To be implemented.
*/
/** function prepareValue ($data)
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false. {
* return $this->_adodb->Quote($data);
* @return int Number of affected rows }
*/
function lastAffected () {
return $this->_adodb->Affected_Rows(); /**
} * Returns a limit statement in the correct format for the particular database.
*
/** * @param int $limit Limit of results returned
* Returns number of rows in previous resultset. If no previous resultset exists, * @param int $offset Offset from which to start results
* this returns false. * @return string SQL limit/offset statement
* */
* @return int Number of rows function selectLimit ($limit, $offset=null)
*/ {
function lastNumRows () { return "LIMIT {$limit}".($offset? "{$offset}": null);
return $this->_result? $this->_result->RecordCount(): false; // please change to whatever select your database accepts
} // adodb doesn't allow us to get the correct limit string out of it
}
/**
* Returns the ID generated from the previous INSERT operation. /**
* * Returns a formatted error message from previous database operation.
* @return int *
* * @return string Error message
* :TODO: To be implemented. */
*/ function lastError ()
function lastInsertId () { die('Please implement DBO::lastInsertId() first.'); } {
} return $this->_adodb->ErrorMsg();
}
/**
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
*
* @return int Number of affected rows
*/
function lastAffected ()
{
return $this->_adodb->Affected_Rows();
}
/**
* Returns number of rows in previous resultset. If no previous resultset exists,
* this returns false.
*
* @return int Number of rows
*/
function lastNumRows ()
{
return $this->_result? $this->_result->RecordCount(): false;
}
/**
* Returns the ID generated from the previous INSERT operation.
*
* @return int
*
* :TODO: To be implemented.
*/
function lastInsertId () { die('Please implement DBO::lastInsertId() first.'); }
}
?> ?>

85
libs/dbo/dbo_generic.php Normal file
View file

@ -0,0 +1,85 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Generic layer for DBO.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
class DBO_generic extends DBO
{
function connect ($config)
{
}
function disconnect ()
{
}
function execute ($sql)
{
}
function fetchRow ($result)
{
}
function tablesList()
{
}
function fields ($table_name)
{
}
function prepareValue ($data)
{
}
function lastError ($result)
{
}
function lastAffected ()
{
}
function lastNumRows ($result)
{
}
function lastInsertId ()
{
}
function selectLimit ($limit, $offset)
{
}
}
?>

View file

@ -1,186 +1,199 @@
<?PHP <?PHP
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// + $Id$ // + $Id$
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + // // + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005 Cake Authors/Developers + // // + Copyright: (c) 2005 Cake Authors/Developers + //
// + + // // + + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + // // + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + // // + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + // // + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// + + // // + + //
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Licensed under The MIT License + // // + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + // // + Redistributions of files must retain the above copyright notice. + //
// + You may not use this file except in compliance with the License. + // // + You may not use this file except in compliance with the License. + //
// + + // // + + //
// + You may obtain a copy of the License at: + // // + You may obtain a copy of the License at: + //
// + License page: http://www.opensource.org/licenses/mit-license.php + // // + License page: http://www.opensource.org/licenses/mit-license.php + //
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/** /**
* MySQL layer for DBO * MySQL layer for DBO
* *
* @filesource * @filesource
* @author Cake Authors/Developers * @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers * @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 0.2.9 * @since Cake v 0.2.9
* @version $Revision$ * @version $Revision$
* @modifiedby $LastChangedBy$ * @modifiedby $LastChangedBy$
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Include DBO. * Include DBO.
*/ */
uses('dbo'); uses('dbo');
/** /**
* MySQL layer for DBO. * MySQL layer for DBO.
* *
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 0.2.9 * @since Cake v 0.2.9
*/ */
class DBO_MySQL extends DBO { class DBO_MySQL extends DBO {
/** /**
* Connects to the database using options in the given configuration array. * Connects to the database using options in the given configuration array.
* *
* @param array $config Configuration array for connecting * @param array $config Configuration array for connecting
* @return boolean True if the database could be connected, else false * @return boolean True if the database could be connected, else false
*/ */
function connect ($config) { function connect ($config) {
if($config) { if($config) {
$this->config = $config; $this->config = $config;
$this->_conn = mysql_pconnect($config['host'],$config['login'],$config['password']); $this->_conn = mysql_pconnect($config['host'],$config['login'],$config['password']);
} }
$this->connected = $this->_conn? true: false; $this->connected = $this->_conn? true: false;
if($this->connected) if($this->connected)
Return mysql_select_db($config['database'], $this->_conn); Return mysql_select_db($config['database'], $this->_conn);
else else
die('Could not connect to DB.'); die('Could not connect to DB.');
} }
/** /**
* Disconnects from database. * Disconnects from database.
* *
* @return boolean True if the database could be disconnected, else false * @return boolean True if the database could be disconnected, else false
*/ */
function disconnect () { function disconnect () {
return mysql_close(); return mysql_close();
} }
/** /**
* Executes given SQL statement. * Executes given SQL statement.
* *
* @param string $sql SQL statement * @param string $sql SQL statement
* @return resource MySQL result resource identifier * @return resource MySQL result resource identifier
*/ */
function execute ($sql) { function execute ($sql) {
return mysql_query($sql); return mysql_query($sql);
} }
/** /**
* Returns a row from given resultset as an array . * Returns a row from given resultset as an array .
* *
* @param unknown_type $res Resultset * @param unknown_type $res Resultset
* @return array The fetched row as an array * @return array The fetched row as an array
*/ */
function fetchRow ($res, $assoc=false) { function fetchRow ($res, $assoc=false) {
return mysql_fetch_array($res, $assoc? MYSQL_ASSOC: MYSQL_BOTH); return mysql_fetch_array($res, $assoc? MYSQL_ASSOC: MYSQL_BOTH);
} }
/** /**
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits. * Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
* *
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function tablesList () { function tablesList () {
$result = mysql_list_tables($this->config['database']); $result = mysql_list_tables($this->config['database']);
if (!$result) { if (!$result) {
trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE); trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE);
exit; exit;
} }
else { else {
$tables = array(); $tables = array();
while ($line = mysql_fetch_array($result)) { while ($line = mysql_fetch_array($result)) {
$tables[] = $line[0]; $tables[] = $line[0];
} }
return $tables; return $tables;
} }
} }
/** /**
* Returns an array of the fields in given table name. * Returns an array of the fields in given table name.
* *
* @param string $table_name Name of database table to inspect * @param string $table_name Name of database table to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
function fields ($table_name) { function fields ($table_name) {
$data = $this->all("DESC {$table_name}"); $data = $this->all("DESC {$table_name}");
$fields = false; $fields = false;
foreach ($data as $item) foreach ($data as $item)
$fields[] = array('name'=>$item['Field'], 'type'=>$item['Type']); $fields[] = array('name'=>$item['Field'], 'type'=>$item['Type']);
return $fields; return $fields;
} }
/** /**
* Returns a quoted and escaped string of $data for use in an SQL statement. * Returns a quoted and escaped string of $data for use in an SQL statement.
* *
* @param string $data String to be prepared for use in an SQL statement * @param string $data String to be prepared for use in an SQL statement
* @return string Quoted and escaped * @return string Quoted and escaped
*/ */
function prepareValue ($data) { function prepareValue ($data) {
return "'".mysql_real_escape_string($data)."'"; return "'".mysql_real_escape_string($data)."'";
} }
/**
* Returns a formatted error message from previous database operation. /**
* * Returns a limit statement in the correct format for the particular database.
* @return string Error message with error number *
*/ * @param int $limit Limit of results returned
function lastError () { * @param int $offset Offset from which to start results
return mysql_errno()? mysql_errno().': '.mysql_error(): null; * @return string SQL limit/offset statement
} */
function selectLimit ($limit, $offset=null)
/** {
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false. return "LIMIT {$limit}".($offset? "{$offset}": null);
* }
* @return int Number of affected rows
*/ /**
function lastAffected () { * Returns a formatted error message from previous database operation.
return $this->_result? mysql_affected_rows(): false; *
} * @return string Error message with error number
*/
/** function lastError () {
* Returns number of rows in previous resultset. If no previous resultset exists, return mysql_errno()? mysql_errno().': '.mysql_error(): null;
* this returns false. }
*
* @return int Number of rows /**
*/ * Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
function lastNumRows () { *
return $this->_result? @mysql_num_rows($this->_result): false; * @return int Number of affected rows
} */
function lastAffected () {
/** return $this->_result? mysql_affected_rows(): false;
* Returns the ID generated from the previous INSERT operation. }
*
* @return int /**
*/ * Returns number of rows in previous resultset. If no previous resultset exists,
function lastInsertId() { * this returns false.
return mysql_insert_id(); *
} * @return int Number of rows
*/
} function lastNumRows () {
return $this->_result? @mysql_num_rows($this->_result): false;
}
/**
* Returns the ID generated from the previous INSERT operation.
*
* @return int
*/
function lastInsertId() {
return mysql_insert_id();
}
}
?> ?>

View file

@ -3,20 +3,14 @@
// + $Id$ // + $Id$
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + // // + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005 Cake Authors/Developers + // // + Copyright: (c) 2005, Cake Authors/Developers + //
// + + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + // // + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + // // + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + // // + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// + + //
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Licensed under The MIT License + // // + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + // // + Redistributions of files must retain the above copyright notice. + //
// + You may not use this file except in compliance with the License. + // // + See: http://www.opensource.org/licenses/mit-license.php + //
// + + //
// + You may obtain a copy of the License at: + //
// + License page: http://www.opensource.org/licenses/mit-license.php + //
// +------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/** /**
@ -36,9 +30,12 @@
*/ */
/** /**
* Include DBO. * Include required libraries.
*/ */
uses('dbo'); uses('dbo');
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . PEAR);
vendor('Pear/DB');
/** /**
* Pear::DB layer for DBO. * Pear::DB layer for DBO.
@ -47,7 +44,15 @@ uses('dbo');
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 0.2.9 * @since Cake v 0.2.9
*/ */
class DBO_Pear extends DBO { class DBO_Pear extends DBO
{
/**
* PEAR::DB object with which we connect.
*
* @var DB The connection object.
*/
var $_pear = null;
/** /**
* Connects to the database using options in the given configuration array. * Connects to the database using options in the given configuration array.
@ -55,8 +60,22 @@ class DBO_Pear extends DBO {
* @param array $config Configuration array for connecting * @param array $config Configuration array for connecting
* @return unknown * @return unknown
*/ */
function connect ($config) { function connect ($config)
die('Please implement DBO::connect() first.'); {
$this->config = $config;
$dsn = $config['driver'].'://'.$config['login'].':'.$config['password'].'@'.$config['host'].'/'.$config['database'];
$options = array(
'debug' => DEBUG-1,
'portability' => DB_PORTABILITY_ALL,
);
$this->_pear =& DB::connect($dsn, $options);
if (PEAR::isError($this->_pear))
{
die('Could not connect to the database.');
}
} }
/** /**
@ -64,7 +83,8 @@ class DBO_Pear extends DBO {
* *
* @return boolean True if the database could be disconnected, else false * @return boolean True if the database could be disconnected, else false
*/ */
function disconnect () { function disconnect ()
{
die('Please implement DBO::disconnect() first.'); die('Please implement DBO::disconnect() first.');
} }
@ -74,7 +94,8 @@ class DBO_Pear extends DBO {
* @param string $sql SQL statement * @param string $sql SQL statement
* @return resource Result resource identifier * @return resource Result resource identifier
*/ */
function execute ($sql) { function execute ($sql)
{
return $this->_pear->query($sql); return $this->_pear->query($sql);
} }
@ -84,31 +105,59 @@ class DBO_Pear extends DBO {
* @param unknown_type $res Resultset * @param unknown_type $res Resultset
* @return array The fetched row as an array * @return array The fetched row as an array
*/ */
function fetchRow ($result) { function fetchRow ($result)
{
return $result->fetchRow(DB_FETCHMODE_ASSOC); return $result->fetchRow(DB_FETCHMODE_ASSOC);
} }
/** /**
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits. * Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
* :WARNING: :TODO: POSTGRESQL & MYSQL ONLY! Pear::DB doesn't support universal table listing.
* *
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function tablesList () { // POSTGRESQL ONLY! PEAR:DB DOESN'T SUPPORT LISTING TABLES function tablesList ()
$sql = "SELECT a.relname AS name {
FROM pg_class a, pg_user b $driver = $this->config['driver'];
WHERE ( relkind = 'r') and relname !~ '^pg_' AND relname !~ '^sql_' $tables = array();
AND relname !~ '^xin[vx][0-9]+' AND b.usesysid = a.relowner
AND NOT (EXISTS (SELECT viewname FROM pg_views WHERE viewname=a.relname));"; if ('postgres' == $driver)
{
$sql = "SELECT a.relname AS name
FROM pg_class a, pg_user b
WHERE ( relkind = 'r') and relname !~ '^pg_' AND relname !~ '^sql_'
AND relname !~ '^xin[vx][0-9]+' AND b.usesysid = a.relowner
AND NOT (EXISTS (SELECT viewname FROM pg_views WHERE viewname=a.relname));";
$result = $this->all($sql); $result = $this->all($sql);
foreach ($result as $item)
{
$tables[] = $item['name'];
}
}
elseif ('mysql' == $driver)
{
$result = array();
if (!$result) { $result = mysql_list_tables($this->config['database']);
while ($item = mysql_fetch_array($result))
{
$tables[] = $item[0];
}
}
else
{
die('Please implement DBO_Pear::tablesList() for your database driver.');
}
if (!$result)
{
trigger_error(ERROR_NO_TABLE_LIST, E_USER_ERROR); trigger_error(ERROR_NO_TABLE_LIST, E_USER_ERROR);
exit; exit;
} }
else { else
$tables = array(); {
foreach ($result as $item) $tables[] = $item['name'];
return $tables; return $tables;
} }
} }
@ -119,7 +168,8 @@ class DBO_Pear extends DBO {
* @param string $table_name Name of database table to inspect * @param string $table_name Name of database table to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
function fields ($table_name) { function fields ($table_name)
{
$data = $this->_pear->tableInfo($table_name); $data = $this->_pear->tableInfo($table_name);
$fields = false; $fields = false;
@ -135,16 +185,31 @@ class DBO_Pear extends DBO {
* @param string $data String to be prepared for use in an SQL statement * @param string $data String to be prepared for use in an SQL statement
* @return string Quoted and escaped * @return string Quoted and escaped
*/ */
function prepareValue ($data) { function prepareValue ($data)
{
return $this->_pear->quoteSmart($data); return $this->_pear->quoteSmart($data);
} }
/**
* Returns a limit statement in the correct format for the particular database.
*
* @param int $limit Limit of results returned
* @param int $offset Offset from which to start results
* @return string SQL limit/offset statement
*/
function selectLimit ($limit, $offset='0')
{
return $this->_pear->modifyLimitQuery('', $offset, $limit);
}
/** /**
* Returns a formatted error message from previous database operation. * Returns a formatted error message from previous database operation.
* *
* @return string Error message * @return string Error message
*/ */
function lastError ($result=null) { function lastError ($result=null)
{
if (!$result) $result = $this->_result; if (!$result) $result = $this->_result;
return PEAR::isError($result)? $result->getMessage(): null; return PEAR::isError($result)? $result->getMessage(): null;
@ -155,7 +220,8 @@ class DBO_Pear extends DBO {
* *
* @return int Number of affected rows * @return int Number of affected rows
*/ */
function lastAffected () { function lastAffected ()
{
return $this->_pear->affectedRows(); return $this->_pear->affectedRows();
} }
@ -165,7 +231,8 @@ class DBO_Pear extends DBO {
* *
* @return int Number of rows * @return int Number of rows
*/ */
function lastNumRows ($result) { function lastNumRows ($result)
{
if (method_exists($result, 'numRows')) if (method_exists($result, 'numRows'))
return $result->numRows(); return $result->numRows();
else else
@ -178,11 +245,11 @@ class DBO_Pear extends DBO {
* @param string $table Name of the database table * @param string $table Name of the database table
* @return int * @return int
*/ */
function lastInsertId ($table) { function lastInsertId ($table)
{
return $this->field('id', "SELECT MAX(id) FROM {$table}"); return $this->field('id', "SELECT MAX(id) FROM {$table}");
} }
} }
?> ?>

View file

@ -1,192 +1,205 @@
<?PHP <?PHP
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// + $Id$ // + $Id$
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + // // + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + // // + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + // // + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + // // + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + // // + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ // // +------------------------------------------------------------------+ //
// + Licensed under The MIT License + // // + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + // // + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + // // + See: http://www.opensource.org/licenses/mit-license.php + //
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/** /**
* PostgreSQL layer for DBO. * PostgreSQL layer for DBO.
* *
* @filesource * @filesource
* @author Cake Authors/Developers * @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers * @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers * @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 1.0.0.114 * @since Cake v 1.0.0.114
* @version $Revision$ * @version $Revision$
* @modifiedby $LastChangedBy$ * @modifiedby $LastChangedBy$
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Include DBO. * Include DBO.
*/ */
uses('dbo'); uses('dbo');
/** /**
* PostgreSQL layer for DBO. * PostgreSQL layer for DBO.
* *
* @package cake * @package cake
* @subpackage cake.libs * @subpackage cake.libs
* @since Cake v 1.0.0.114 * @since Cake v 1.0.0.114
*/ */
class DBO_Postgres extends DBO { class DBO_Postgres extends DBO {
/** /**
* Connects to the database using options in the given configuration array. * Connects to the database using options in the given configuration array.
* *
* @param array $config Configuration array for connecting * @param array $config Configuration array for connecting
* @return True if successfully connected. * @return True if successfully connected.
*/ */
function connect ($config) { function connect ($config) {
if($config) { if($config) {
$this->config = $config; $this->config = $config;
$this->_conn = pg_pconnect("host={$config['host']} dbname={$config['database']} user={$config['login']} password={$config['password']}"); $this->_conn = pg_pconnect("host={$config['host']} dbname={$config['database']} user={$config['login']} password={$config['password']}");
} }
$this->connected = $this->_conn? true: false; $this->connected = $this->_conn? true: false;
if($this->connected) if($this->connected)
return true; return true;
else else
die('Could not connect to DB.'); die('Could not connect to DB.');
} }
/** /**
* Disconnects from database. * Disconnects from database.
* *
* @return boolean True if the database could be disconnected, else false * @return boolean True if the database could be disconnected, else false
*/ */
function disconnect () { function disconnect () {
return pg_close($this->_conn); return pg_close($this->_conn);
} }
/** /**
* Executes given SQL statement. * Executes given SQL statement.
* *
* @param string $sql SQL statement * @param string $sql SQL statement
* @return resource Result resource identifier * @return resource Result resource identifier
*/ */
function execute ($sql) { function execute ($sql) {
return pg_query($this->_conn, $sql); return pg_query($this->_conn, $sql);
} }
/** /**
* Returns a row from given resultset. * Returns a row from given resultset.
* *
* @param unknown_type $res * @param unknown_type $res
* @return unknown * @return unknown
*/ */
function fetchRow ($res) { function fetchRow ($res) {
return pg_fetch_array($res); return pg_fetch_array($res);
} }
/** /**
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits. * Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
* *
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function tablesList () { function tablesList () {
$sql = "SELECT a.relname AS name $sql = "SELECT a.relname AS name
FROM pg_class a, pg_user b FROM pg_class a, pg_user b
WHERE ( relkind = 'r') and relname !~ '^pg_' AND relname !~ '^sql_' WHERE ( relkind = 'r') and relname !~ '^pg_' AND relname !~ '^sql_'
AND relname !~ '^xin[vx][0-9]+' AND b.usesysid = a.relowner AND relname !~ '^xin[vx][0-9]+' AND b.usesysid = a.relowner
AND NOT (EXISTS (SELECT viewname FROM pg_views WHERE viewname=a.relname));"; AND NOT (EXISTS (SELECT viewname FROM pg_views WHERE viewname=a.relname));";
$result = $this->all($sql); $result = $this->all($sql);
if (!$result) { if (!$result) {
trigger_error(ERROR_NO_TABLE_LIST, E_USER_ERROR); trigger_error(ERROR_NO_TABLE_LIST, E_USER_ERROR);
exit; exit;
} }
else { else {
$tables = array(); $tables = array();
foreach ($result as $item) $tables[] = $item['name']; foreach ($result as $item) $tables[] = $item['name'];
return $tables; return $tables;
} }
} }
/** /**
* Returns an array of the fields in given table name. * Returns an array of the fields in given table name.
* *
* @param string $table_name Name of database table to inspect * @param string $table_name Name of database table to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
function fields ($table_name) { function fields ($table_name) {
$sql = "SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{$table_name}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid"; $sql = "SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{$table_name}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid";
$fields = false; $fields = false;
foreach ($this->all($sql) as $field) { foreach ($this->all($sql) as $field) {
$fields[] = array( $fields[] = array(
'name' => $field['attname'], 'name' => $field['attname'],
'type' => $field['typname']); 'type' => $field['typname']);
} }
return $fields; return $fields;
} }
/** /**
* Returns a quoted and escaped string of $data for use in an SQL statement. * Returns a quoted and escaped string of $data for use in an SQL statement.
* *
* @param string $data String to be prepared for use in an SQL statement * @param string $data String to be prepared for use in an SQL statement
* @return string Quoted and escaped * @return string Quoted and escaped
*/ */
function prepareValue ($data) { function prepareValue ($data) {
return "'".pg_escape_string($data)."'"; return "'".pg_escape_string($data)."'";
} }
/**
* Returns a formatted error message from previous database operation. /**
* * Returns a limit statement in the correct format for the particular database.
* @return string Error message *
*/ * @param int $limit Limit of results returned
function lastError () { * @param int $offset Offset from which to start results
return pg_last_error()? pg_last_error(): null; * @return string SQL limit/offset statement
} */
function selectLimit ($limit, $offset=null)
/** {
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false. return "LIMIT {$limit}".($offset? " OFFSET {$offset}": null);
* }
* @return int Number of affected rows
*/ /**
function lastAffected () { * Returns a formatted error message from previous database operation.
return $this->_result? pg_affected_rows($this->_result): false; *
} * @return string Error message
*/
/** function lastError () {
* Returns number of rows in previous resultset. If no previous resultset exists, return pg_last_error()? pg_last_error(): null;
* this returns false. }
*
* @return int Number of rows /**
*/ * Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
function lastNumRows () { *
return $this->_result? pg_num_rows($this->_result): false; * @return int Number of affected rows
} */
function lastAffected () {
/** return $this->_result? pg_affected_rows($this->_result): false;
* Returns the ID generated from the previous INSERT operation. }
*
* @param string $table Name of the database table /**
* @param string $field Name of the ID database field. Defaults to "id" * Returns number of rows in previous resultset. If no previous resultset exists,
* @return unknown * this returns false.
*/ *
function lastInsertId ($table, $field='id') { * @return int Number of rows
$sql = "SELECT CURRVAL('{$table}_{$field}_seq') AS max"; */
$res = $this->rawQuery($sql); function lastNumRows () {
$data = $this->fetchRow($res); return $this->_result? pg_num_rows($this->_result): false;
return $data['max']; }
}
} /**
* Returns the ID generated from the previous INSERT operation.
*
* @param string $table Name of the database table
* @param string $field Name of the ID database field. Defaults to "id"
* @return unknown
*/
function lastInsertId ($table, $field='id') {
$sql = "SELECT CURRVAL('{$table}_{$field}_seq') AS max";
$res = $this->rawQuery($sql);
$data = $this->fetchRow($res);
return $data['max'];
}
}
?> ?>

View file

@ -142,6 +142,19 @@ $this->_conn
return "'".sqlite_escape_string($data)."'"; return "'".sqlite_escape_string($data)."'";
} }
/**
* Returns a limit statement in the correct format for the particular database.
*
* @param int $limit Limit of results returned
* @param int $offset Offset from which to start results
* @return string SQL limit/offset statement
*/
function selectLimit ($limit, $offset=null)
{
// :TODO: Please verify this with SQLite, untested.
return "LIMIT {$limit}".($offset? " OFFSET {$offset}": null);
}
/** /**
* Returns a formatted error message from previous database operation. * Returns a formatted error message from previous database operation.
* *

View file

@ -32,7 +32,7 @@
* Enter description here... * Enter description here...
* *
*/ */
uses('object'); uses('object', 'dbo');
config('database'); config('database');
/** /**
@ -56,20 +56,27 @@ class DboFactory extends Object {
$config = DATABASE_CONFIG::$activeConfig(); $config = DATABASE_CONFIG::$activeConfig();
// special case for AdoDB -- driver name in the form of 'adodb_drivername' // special case for AdoDB -- driver name in the form of 'adodb-drivername'
if (preg_match('#^adodb_(.*)$#i', $config['driver'], $res)) { if (preg_match('#^adodb[\-_](.*)$#i', $config['driver'], $res)) {
uses('DBO_AdoDB'); uses('dbo/dbo_adodb');
$config['driver'] = $res[1]; $config['driver'] = $res[1];
$conn = new DBO_AdoDB($config); $conn = new DBO_AdoDB($config);
return $conn; return $conn;
} }
// special case for PEAR:DB -- driver name in the form of 'pear-drivername'
elseif (preg_match('#^pear[\-_](.*)$#i', $config['driver'], $res)) {
uses('dbo/dbo_pear');
$config['driver'] = $res[1];
$conn = new DBO_Pear($config);
return $conn;
}
// regular, Cake-native db drivers // regular, Cake-native db drivers
else { else {
$db_driver_class = 'DBO_'.$config['driver']; $db_driver_class = 'DBO_'.$config['driver'];
$db_driver_fn = LIBS.strtolower($db_driver_class.'.php'); $db_driver_fn = LIBS.strtolower('dbo'.DS.$db_driver_class.'.php');
if (file_exists($db_driver_fn)) { if (file_exists($db_driver_fn)) {
uses(strtolower($db_driver_class)); uses(strtolower('dbo'.DS.$db_driver_class));
return new $db_driver_class ($config); return new $db_driver_class ($config);
} }
else { else {

View file

@ -160,14 +160,42 @@ class Flay extends Object
// re-parse links // re-parse links
if (count($links)) { if (count($links)) {
for ($ii=0; $ii<count($links); $ii++) { for ($ii=0; $ii<count($links); $ii++) {
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $links[$ii])) if (preg_match("#^(http|https|ftp|nntp)://#", $links[$ii]))
$with = "<img src=\"{$links[$ii]}\" alt=\"\" />"; {
elseif (preg_match('#^([^\]\ ]+)(?: ([^\]]+))?$#', $links[$ii], $regs)) $prefix = null;
$with = "<a href=\"{$regs[1]}\" target=\"_blank\">".(isset($regs[2])? $regs[2]: $regs[1])."</a>"; }
else
{
$prefix = 'http://';
}
if (preg_match('#^[^\ ]+\.(jpg|jpeg|gif|png)$#', $links[$ii]))
{
$with = "<img src=\"{$prefix}{$links[$ii]}\" alt=\"\" />";
}
elseif (preg_match('#^([^\]\ ]+)(?:\ ([^\]]+))?$#', $links[$ii], $regs))
{
if (isset($regs[2]))
{
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $regs[2]))
$body = "<img src=\"{$prefix}{$regs[2]}\" alt=\"\" />";
else
$body = $regs[2];
}
else
{
$body = $links[$ii];
}
$with = "<a href=\"{$prefix}{$regs[1]}\" target=\"_blank\">{$body}</a>";
}
else else
$with = $links[$ii]; {
$with = $prefix.$links[$ii];
}
$line = str_replace("%LINK{$ii}%", $with, $line); $line = str_replace("%LINK{$ii}%", $with, $line);
} }

View file

@ -575,17 +575,20 @@ class Model extends Object
$whers = count($whers)? '('.join(' AND ', $whers).')': null; $whers = count($whers)? '('.join(' AND ', $whers).')': null;
$conditions .= ($conditions && $whers? ' AND ': null).$whers; $conditions .= ($conditions && $whers? ' AND ': null).$whers;
$offset_str = $page > 1? " OFFSET ".$page*$limit: ""; $offset = $page > 1? $page*$limit: 0;
$limit_str = $limit? " LIMIT {$limit}": ""; $limit = $limit? $limit: '-1';
$data = $this->db->all( $limit_str = $this->db->selectLimit($limit, $offset);
$sql =
"SELECT " "SELECT "
.join(', ', $f) .join(', ', $f)
." FROM {$this->table} {$joins}" ." FROM {$this->table} {$joins}"
.($conditions? " WHERE {$conditions}":null) .($conditions? " WHERE {$conditions}":null)
.($order? " ORDER BY {$order}": null) .($order? " ORDER BY {$order}": null)
.$limit_str .$limit_str;
.$offset_str);
$data = $this->db->all($sql);
return $data; return $data;
} }

View file

@ -92,7 +92,7 @@ class Template extends Object {
* @var boolean * @var boolean
* @access private * @access private
*/ */
var $_page_title = false; var $pageTitle = false;
/** /**
* Choose the layout to be used when rendering. * Choose the layout to be used when rendering.
@ -120,7 +120,7 @@ class Template extends Object {
* @param string $pageTitle Text for the title * @param string $pageTitle Text for the title
*/ */
function setTitle ($pageTitle) { function setTitle ($pageTitle) {
$this->_page_title = $pageTitle; $this->pageTitle = $pageTitle;
} }
/** /**
@ -200,7 +200,7 @@ class Template extends Object {
$layout_fn = $this->_getLayoutFn(); $layout_fn = $this->_getLayoutFn();
$data_for_layout = array_merge($this->_view_vars, array( $data_for_layout = array_merge($this->_view_vars, array(
'title_for_layout'=>$this->_page_title !== false? $this->_page_title: Inflector::humanize($this->viewpath), 'title_for_layout'=>$this->pageTitle !== false? $this->pageTitle: Inflector::humanize($this->viewpath),
'content_for_layout'=>$content_for_layout)); 'content_for_layout'=>$content_for_layout));
if (is_file($layout_fn)) { if (is_file($layout_fn)) {
@ -270,7 +270,7 @@ class Template extends Object {
extract($___data_for_view, EXTR_SKIP); # load all view variables extract($___data_for_view, EXTR_SKIP); # load all view variables
$BASE = $this->base; $BASE = $this->base;
$params = &$this->params; $params = &$this->params;
$page_title = $this->_page_title; $page_title = $this->pageTitle;
ob_start(); # start caching output (eval outputs directly so we need to cache) ob_start(); # start caching output (eval outputs directly so we need to cache)
# include the template # include the template

View file

@ -12,11 +12,11 @@ text-align:center;
} }
H2 { H2 {
font-size:1.8em; font-size:1.7em;
} }
H3 { H3 {
font-size:1.5em; font-size:1.4em;
} }
P { P {

View file

@ -44,24 +44,28 @@ if (!defined('ROOT'))
/** /**
* Configuration, directory layout and standard libraries * Configuration, directory layout and standard libraries
*/ */
require (ROOT.'config/core.php'); require_once (ROOT.'config/core.php');
require (ROOT.'config/paths.php'); require_once (ROOT.'config/paths.php');
require (ROOT.'libs/log.php'); require_once (ROOT.'libs/log.php');
require (ROOT.'libs/object.php'); require_once (ROOT.'libs/object.php');
require (ROOT.'libs/neat_array.php'); require_once (ROOT.'libs/neat_array.php');
require (ROOT.'libs/inflector.php'); require_once (ROOT.'libs/inflector.php');
require (ROOT.'libs/basics.php'); require_once (ROOT.'libs/basics.php');
require (ROOT.'libs/folder.php');
DEBUG? error_reporting(E_ALL): error_reporting(0); DEBUG? error_reporting(E_ALL): error_reporting(0);
$TIME_START = getMicrotime(); $TIME_START = getMicrotime();
uses ('dispatcher', 'dbo_factory'); uses('folder');
uses('dispatcher');
uses('dbo_factory');
config ('tags', 'database'); config ('tags', 'database');
$DB = DboFactory::make('devel'); if (class_exists('DATABASE_CONFIG'))
{
$DB = DboFactory::make('devel');
}
loadModels (); loadModels ();