예제 #1
0
<?php

include 'config.php';
include dirname(__FILE__) . '/../../A/autoload.php';
#include 'A/Session.php';
#include 'A/Rule/Captcha.php';
$session = new A_Session();
$session->start();
#echo "session_id=" . session_id() . '<br/>';
$captcha = new A_Rule_Captcha('captcha', 'CAPTCHA', null, $session, null);
$captcha->generateCode(5);
#dump($captcha);
#dump($session);
#echo "<br/>Code=" . $captcha->getCode();
#exit;
$image = new A_Rule_Captcha_Image($captcha);
#dump($session);
#echo "<br/>Code=" . $captcha->getCode();
#exit;
$image->out();
예제 #2
0
$ConfigArray = array('BASE' => 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . '/', 'PATH' => dirname($_SERVER['SCRIPT_FILENAME']) . '/', 'APP' => dirname($_SERVER['SCRIPT_FILENAME']) . '/application/', 'LIB' => dirname($_SERVER['SCRIPT_FILENAME']) . '/library', 'ERROR' => E_ALL | E_STRICT);
// Error reporting and include path
error_reporting($ConfigArray['ERROR']);
set_include_path($ConfigArray['LIB'] . PATH_SEPARATOR . get_include_path());
// init autoload
require dirname(__FILE__) . '/../../A/autoload.php';
$Locator = new A_Locator();
$Locator->autoload();
// create config object from array
$Config = new A_Collection($ConfigArray);
// create HTTP objects
$Request = new A_Http_Request();
$Response = new A_Http_Response();
// Start Sessions
$Session = new A_Session();
$Session->start();
$UserSession = new A_User_Session($Session);
// create registry/loader and add common objects
$Locator->set('Config', $Config);
$Locator->set('Request', $Request);
$Locator->set('Response', $Response);
$Locator->set('Session', $Session);
$Locator->set('UserSession', $UserSession);
// create router and have it modify request
$map = array('' => array(0 => array('name' => 'controller', 'default' => 'home'), 1 => array('name' => 'action', 'default' => 'index')));
$Pathinfo = new A_Http_Pathinfo($map, false);
$Pathinfo->run($Request);
// create mapper with base application path and default action
$Mapper = new A_Controller_Mapper($ConfigArray['APP'], array('', 'home', 'index'));
// create and run FC with error action
$Controller = new A_Controller_Front($Mapper, array('', 'error', 'index'));