コード例 #1
0
 public function register(Application $app)
 {
     //shared firewall service
     $app['firewall'] = $app->share(function ($app) {
         $f = new Firewall($app['dispatcher']);
         $f->addSubscriber($app['firewall.configurator']);
         return $f;
     });
     //configuration service - can be used by other extensions
     //in Application::boot to register other config handlers
     $app['firewall.configurator'] = $app->share(function ($c) {
         $s = new ConfigSubscriber($app->getParameter('firewall.rules', array()));
         $s->addConfigHandler(new IpBlacklistHandler());
         $s->addConfigHandler(new IpWhitelisttHandler());
     });
 }
コード例 #2
0
ファイル: Route.php プロジェクト: Kalth/structure-of-forum
 public function getCtrl()
 {
     $aHttpVars = ['get' => Firewall::secureGet($this->routes[$this->page]), 'post' => Firewall::securePost($this->routes[$this->page]), 'files' => Firewall::secureGet($this->routes[$this->page])];
     unset($_POST, $_GET, $_FILES);
     $ctrlName = $this->routes[$this->page]['controller'];
     $ctrlName = ucwords($ctrlName) . 'Controller';
     return new $ctrlName($this->page, $aHttpVars);
 }
コード例 #3
0
ファイル: Router.php プロジェクト: jonathanbak/smb
 /**
  * 자동 라우팅 처리 start
  * @throws ConfigureException
  * @throws DirectoryException
  */
 protected function autoload()
 {
     System::config();
     $siteConfig = Configure::site();
     $siteNamespace = $siteConfig['namespace'] . "\\";
     Autoloader::setPsr4(array($siteNamespace => array(Directory::sitePath('controller')), $siteNamespace . "Model\\" => array(Directory::sitePath('model'))));
     //방화벽 가동
     Firewall::ruleStart();
     //실제 작업 시작
     $this->execute();
 }
コード例 #4
0
 public function insert()
 {
     try {
         // instancia registro
         $oPeriodo = Sessao::getObject("oPeriodo");
         $this->model->setData($oPeriodo->getData());
         $this->model->setApropriar($_POST["chkApropriar"]);
         $this->model->setHora(date("H:i:s"));
         $this->model->setFlag($_POST["optFlag"]);
         // instancia profissional
         $oProf = Sessao::getObject("oProf");
         // ve se pode clicar
         $fw = new Firewall();
         if ($fw->podeClicar($oProf, $this->model)) {
             // registra o ponto
             $this->model->insert($oProf, $this->model);
         } else {
             $this->view->setValue("MSG", "Não pode clicar.");
         }
         $this->show();
     } catch (Exception $e) {
         $this->view->setValue("MSG", $e->getTraceAsString());
     }
 }
コード例 #5
0
ファイル: init.php プロジェクト: bqx619/zn_douphp
if (!file_exists(ROOT_PATH . "data/system.dou")) {
    header("Location: " . ROOT_URL . "install/index.php\n");
    exit;
}
require_once ROOT_PATH . 'data/config.php';
// 伪静态下config.php会在route.php中第一次被调用
require ROOT_PATH . 'include/smarty/Smarty.class.php';
require ROOT_PATH . 'include/mysql.class.php';
require ROOT_PATH . 'include/common.class.php';
require ROOT_PATH . M_PATH . '/include/action.class.php';
require ROOT_PATH . 'include/check.class.php';
require ROOT_PATH . 'include/firewall.class.php';
// 实例化类
$dou = new Action($dbhost, $dbuser, $dbpass, $dbname, $prefix, DOU_CHARSET);
$check = new Check();
$firewall = new Firewall();
// 定义DOU_SHELL
define('DOU_SHELL', $dou->get_one("SELECT value FROM " . $dou->table('config') . " WHERE name = 'hash_code'"));
define('DOU_ID', 'mobile_' . substr(md5(DOU_SHELL . 'mobile'), 0, 5));
// 读取站点信息
$_CFG = $dou->get_config();
if (!defined('EXIT_INIT')) {
    // 设置页面缓存和编码
    header('Cache-control: private');
    header('Content-type: text/html; charset=' . DOU_CHARSET);
    // 判断是否关闭手机版
    if ($_CFG['mobile_closed']) {
        $dou->dou_header(ROOT_URL);
    }
    // 豆壳防火墙
    $firewall->dou_firewall();
コード例 #6
0
ファイル: index.php プロジェクト: mehulsbhatt/MindaPHP
require 'config/loader.php';
// Load the config parameters
require 'config/config.php';
// Load the routes
require 'config/router.php';
// Register shortcut functions
function e($string)
{
    echo htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
function d()
{
    return call_user_func_array('Debugger::debug', func_get_args());
}
// Start the firewall
Firewall::start();
// Start the session
Session::start();
// Analyze the PHP code
if (Debugger::$enabled) {
    Analyzer::execute();
}
// Load the action into body
ob_start();
if (Router::getTemplateAction()) {
    require Router::getTemplateAction();
}
if (ob_get_contents()) {
    ob_end_flush();
    trigger_error('MindaPHP template action"' . Router::getTemplateAction() . '" should not send output. Error raised ', E_USER_WARNING);
} else {