|
|||
|
Hey guys,
Here's a crazy one: This is the first application I've ever developed with the Zend Framework. I'm having a problem with the Zend Controller escaping my $_POST array. I know that it is something within the controller doing it because if I put a line in my bootstrap file to print out a variable from the array, the results are not escaped. I'm not too sure how to diagnose exactly what is doing this. Here's what my bootstrap looks like: Code:
//Start the stopwatch
global $stopwatch;
$stopwatch = microtime(true);
//Set error reporting
error_reporting( E_ALL | E_STRICT );
//Always set your timezone when working with dates!
date_default_timezone_set('America/New_York');
//Magic quotes suck
ini_set('magic_quotes_gpc', 'Off');
ini_set('magic_quotes_runtime', 'Off');
ini_set('magic_quotes_sybase', 'Off');
//Setup Zend autoloading
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
//Setup a variable to point to the application directory
$appDir = dirname(dirname(__FILE__)) . '/application';
//Add the models directory to the include path
set_include_path(
$appDir . '/models'
. PATH_SEPARATOR
. get_include_path()
);
//Register our configuration file
$config = new Zend_Config_Ini("$appDir/etc/config.ini", 'main');
Zend_Registry::set('config', $config);
//Set error reporting output to the browser from the config
ini_set('display_errors', $config->display->errors);
//Setup and register our logger
try {
$writer = new Zend_Log_Writer_Stream($config->log->path);
$logger = new Zend_Log($writer);
Zend_Registry::set('logger', $logger);
} catch (Zend_Exception $e) {
print "<!-- LOG ERROR -->\n\n";
}
//Setup the database and register it
try {
$db = Zend_Db::factory(
$config->database->adapter,
$config->database->params->toArray()
);
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$db->query('SET NAMES utf8');
} catch (Zend_Db_Adapter_Exception $e) {
$logger->alert('RDBMS connect failure.');
die("MySQL Connection Error- RDBMS connect failure. This would be the appropriate time for an \"uguu\"...");
} catch (Zend_Exception $e) {
$logger->alert('Zend exception in RDBMS connect.');
die("MySQL Connection Error- Zend Exception. We're all gonna die!");
}
Zend_Registry::set('database', $db);
//============================================================
//Front end controller setup
//Instantiate the front router
$cntrl = Zend_Controller_Front::getInstance();
//Set the controller to throw exceptions
$cntrl->throwExceptions(true);
//Get our router instance
$router = $cntrl->getRouter();
//Create new routes
//Static routes
$route = new Zend_Controller_Router_Route_Static(
'faq',
array('controller' => 'index', 'action' => 'faq')
);
$router->addRoute('faq', $route);
$route = new Zend_Controller_Router_Route_Static(
'about',
array('controller' => 'index', 'action' => 'about')
);
$router->addRoute('about', $route);
//Dispatch the controller
try {
$cntrl->run($appDir . '/controllers');
} catch (Zend_Exception $e) {
include('404.phtml');
exit();
}
Thanks in advance for your help! -- 3dB |
![]() |
| Thread Tools | |
| Display Modes | |
|
|