define('WEB_EXPRESS_VERSION', '3.0 BETA');
# global functions
# this prints out booleans, nulls, and empty strings
# will be called inside cake's debug() on cake/basics.php
function debug2($var)
{
if(is_null($var) || is_bool($var))
{
var_dump($var);
}
else if( is_string($var) )
{
if( '' == trim($var) )
{
var_dump($var);
}
}
}
function json_d($data=null)
{
return json_decode($data, true);
}
function json_e($data=null)
{
return json_encode($data);
}
function json_get_contents($file)
{
return file_exists($file) ? json_d(file_get_contents($file)) : null;
}
function json_put_contents($file, $data)
{
$json_data = json_e($data);
file_put_contents($file, $json_data);
return $json_data;
}
# dirty function for reading/writing homepage route file
# better put it here than litter in several places
function cms_get_homepage_route()
{
return json_get_contents(CONFIGS."homepage.conf");
}
function cms_set_homepage_route($data)
{
return json_put_contents(CONFIGS."homepage.conf", $data);
}
# for rss feeds
Router::parseExtensions('rss');
# home
//Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'slug'=>'home'));
# check for custom homepage on app/config/homepage.txt
# if not, default to pages/display/home
$app_homepage = cms_get_homepage_route();
$app_homepage = isset($app_homepage['controller']) ? $app_homepage : array('controller'=>'pages', 'action'=>'display', 'slug'=>'home');
Router::connect('/', $app_homepage);
# index redirects
Router::connect('/admin', array('controller' => 'index', 'action'=>'adminredirect'));
//Router::connect('/events', array('controller' => 'events', 'action'=>'index'));
//Router::connect('/store', array('controller' => 'products', 'action'=>'index'));
//Router::connect('/listings', array('controller' => 'listings', 'action'=>'index'));
# routing for the rest of content (the trailing * will make named parameters work)
# these words are also listed on page model's beforeSave to make sure it doesn't get used as slug
Router::connect('/pages/:slug/*', array('controller' => 'pages', 'action'=>'display'));
Router::connect('/albums/:slug/*', array('controller' => 'albums', 'action'=>'display'));
Router::connect('/forms/:slug/*', array('controller' => 'forms', 'action'=>'display'));
Router::connect('/files/:slug/*', array('controller' => 'uploads', 'action'=>'display'));
Router::connect('/events/:slug/*', array('controller' => 'events', 'action'=>'display'));
Router::connect('/store/:action/*', array('controller' => 'products'));
Router::connect('/teststore/:action/*', array('controller' => 'teststore'));
Router::connect('/listings/:action/*', array('controller' => 'listings'));
//Router::connect('/blogs/*', array('controller'=>'blogs', 'action'=>'display'));
Router::connect('/blogs/:blog_slug', array('controller'=>'blogs', 'action'=>'home'));
Router::connect('/blogs/:blog_slug/index/*', array('controller'=>'blogs', 'action'=>'home'));
Router::connect('/blogs/:blog_slug/feed', array('controller'=>'blogs', 'action'=>'feed'));
Router::connect('/blogs/:blog_slug/:post_slug/*', array('controller'=>'blogs', 'action'=>'display_post'));
# basic routing for pages
Router::connect('/:slug', array('controller' =>'pages', 'action'=>'display'));
class IndexController extends AppController {
var $name = 'Index';
var $uses = array('User');
function index()
{
$page = ClassRegistry::init('Page');
$content = $page->findBySlug('home');
$this->set('content', $content);
}
# welcome page used by the admin
function welcome()
{
$this->layout = 'plain';
}
# router cannot access admin_index directly
# admin routing works better for admin/index
function adminredirect()
{
$this->redirect('/admin/index');
}
function admin_index()
{
//
}
}
class DATABASE_CONFIG {
var $default = array(
"driver" => "mysql",
"persistent" => false,
"host" => "localhost",
"login" => "promptings_user",
"password" => "Pathfinders27",
"database" => "promptings",
"mysql_path" => "",
"prefix" => ""
);
}
Warning (2): get_object_vars() expects parameter 1 to be object, null given [CORE/cake/libs/model/connection_manager.php, line 197]
Code |
Context$_this = ConnectionManager
ConnectionManager::$config = NULL
ConnectionManager::$_dataSources = array
ConnectionManager::$_connectionsEnum = array
ConnectionManager::$_log = NULL
get_object_vars - [internal], line ??
ConnectionManager::enumConnectionObjects() - CORE/cake/libs/model/connection_manager.php, line 197
ConnectionManager::getDataSource() - CORE/cake/libs/model/connection_manager.php, line 101
Model::setDataSource() - CORE/cake/libs/model/model.php, line 2638
Model::__construct() - CORE/cake/libs/model/model.php, line 406
ClassRegistry::init() - CORE/cake/libs/class_registry.php, line 140
Util::setting() - APP/vendors/util.php, line 177
AppController::beforeFilter() - APP/app_controller.php, line 303
AppError::_outputMessage() - APP/app_error.php, line 5
ErrorHandler::missingController() - CORE/cake/libs/error.php, line 174
Object::dispatchMethod() - CORE/cake/libs/object.php, line 118
ErrorHandler::__construct() - CORE/cake/libs/error.php, line 118
Object::cakeError() - CORE/cake/libs/object.php, line 201
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 136
[main] - APP/webroot/index.php, line 93
if(isset($page_title)) {print h($page_title. " | ");} else {print "";} print h($website_title); ?>
= $this->element('default_head') ?>
= $this->element('default_subnav') ?>
Missing Database Connection
Error:
ConnectionManager requires a database connection
Error:
Confirm you have created the file : app/config/database.php.
Notice:
If you want to customize this error message, create app/views/errors/missing_connection.ctp.
= $this->element('default_footer') ?>
= $this->element('default_analytics') ?>