Update Query

This commit is contained in:
Timothy Warren 2012-08-09 20:36:27 +00:00
parent 49a7c4f634
commit 9b06f58638
9 changed files with 34 additions and 21 deletions

View File

@ -28,7 +28,7 @@ abstract class Controller extends \miniMVC\Controller {
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load_model('meta\model'); $this->load_model('meta\Model');
$this->page->build_header(); $this->page->build_header();
} }

View File

@ -18,7 +18,7 @@
* *
* @package meta * @package meta
*/ */
class welcome extends miniMVC\Controller { class welcome extends \miniMVC\Controller {
/** /**
* Initialize the constructor * Initialize the constructor

View File

@ -20,7 +20,7 @@ namespace meta;
* *
* @package meta * @package meta
*/ */
class model extends \miniMVC\Model { class Model extends \miniMVC\Model {
/** /**
* Reference to database connection * Reference to database connection
@ -43,7 +43,7 @@ class model extends \miniMVC\Model {
{ {
parent::__construct(); parent::__construct();
$this->session =& \miniMVC\Session::get_instance(); //$this->session =& \miniMVC\Session::get_instance();
$this->db =& \miniMVC\db::get_instance(); $this->db =& \miniMVC\db::get_instance();
} }

2
app/views/errors/error_php_exception.php Executable file → Normal file
View File

@ -1,5 +1,5 @@
<div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;"> <div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;">
<h4>An uncaught exception was thrown.</h4> <h4>An uncaught <?= get_class($exception) ?> was thrown.</h4>
<p>Message: <?= $message; ?></p> <p>Message: <?= $message; ?></p>

View File

@ -31,7 +31,7 @@ namespace miniMVC;
* *
* @param string * @param string
*/ */
function _autoload($name) function autoload($name)
{ {
if ($name == '') return; if ($name == '') return;
@ -60,7 +60,7 @@ function _autoload($name)
} }
// Start the autoloader // Start the autoloader
spl_autoload_register('miniMVC\_autoload'); spl_autoload_register('miniMVC\autoload');
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ! Error handling / messages // ! Error handling / messages
@ -298,7 +298,10 @@ if ( ! function_exists('do_include'))
function init() function init()
{ {
// Catch fatal errors, don't show them // Catch fatal errors, don't show them
register_shutdown_function('miniMVC\shutdown'); if (function_exists('error_get_last'))
{
register_shutdown_function('miniMVC\shutdown');
}
//Set error handlers //Set error handlers
set_error_handler('miniMVC\on_error'); set_error_handler('miniMVC\on_error');
@ -307,9 +310,6 @@ function init()
// Load Database classes // Load Database classes
require_once(MM_SYS_PATH . 'db/autoload.php'); require_once(MM_SYS_PATH . 'db/autoload.php');
// Load the page class
$GLOBALS['page'] = new \miniMVC\Page();
// Map to the appropriate module/controller/function // Map to the appropriate module/controller/function
route(); route();
} }
@ -367,6 +367,7 @@ function route()
$pi = $_SERVER['PATH_INFO']; $pi = $_SERVER['PATH_INFO'];
$ru = $_SERVER['REQUEST_URI']; $ru = $_SERVER['REQUEST_URI'];
$sn = $_SERVER['SCRIPT_NAME']; $sn = $_SERVER['SCRIPT_NAME'];
$qs = $_SERVER['QUERY_STRING'];
// Make sure the home page works when in a sub_directory // Make sure the home page works when in a sub_directory
if (strlen($sn) > strlen($ru)) if (strlen($sn) > strlen($ru))
@ -460,6 +461,7 @@ function route()
} }
run($module, $controller, $func); run($module, $controller, $func);
return; return;
} }
@ -480,21 +482,29 @@ function run($module, $controller, $func, $args = array())
if (is_file($path)) if (is_file($path))
{ {
require_once($path); require_once($path);
// Get the list of valid methods for that controller // Get the list of valid methods for that controller
$methods = controller_methods($controller); $methods = controller_methods($controller);
if (in_array($func, $methods)) if (in_array($func, $methods))
{ {
// Define the name of the current module for file loading // Define the name of the current module for file loading
if ( ! defined('MM_MOD')) if ( ! defined('MM_MOD'))
{ {
define('MM_MOD', $module); define('MM_MOD', $module);
} }
if (class_exists($controller))
{
$class = new $controller();
}
$class = new $controller(); //show_error(to_string(get_declared_classes()));
return call_user_func_array(array(&$class, $func), $args); return call_user_func_array(array($class, $func), $args);
} }
show_404();
} }
// Function doesn't exist...404 // Function doesn't exist...404

View File

@ -38,7 +38,10 @@ class Controller {
public function __construct() public function __construct()
{ {
// Create the page object // Create the page object
$this->page = $GLOBALS['page']; if (is_null($this->page))
{
$this->page = new Page();
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@ -151,8 +151,7 @@ class Page {
if ( ! empty($this->buffer)) if ( ! empty($this->buffer))
{ {
// @todo Figure out how to adjust content compression for 5.4.4 ob_start('ob_gzhandler');
ob_start();
echo $this->buffer; echo $this->buffer;
@ -695,15 +694,15 @@ class Page {
public function flush_headers() public function flush_headers()
{ {
// Set headers // Set headers
foreach ($this->headers as $key => &$val) foreach ($this->headers as $key => $val)
{ {
if ( ! isset($val)) if ( ! isset($val))
{ {
@header($key); header($key);
} }
else else
{ {
@header("{$key}: {$val}"); header("{$key}: {$val}");
} }
} }

2
sys/db

@ -1 +1 @@
Subproject commit 1e71b225c533bada107f439106c9216982b62daa Subproject commit 90c676019652341836edd7bf71dfc70979341810

1
test.php Normal file
View File

@ -0,0 +1 @@
<?php phpinfo();