Exemple #1
0
<?php

/**
 * Project:     ActionPHP (The MVC Framework) 
 * File:        action.php
 *
 * This framework is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @author XuLH <*****@*****.**>
 */
require dirname(__FILE__) . "/global.php";
$fastphp_actionkey = FastPHP_Rewrite::parseRequest();
//Create Action Class
fastphp_run_action($fastphp_actionkey);
Exemple #2
0
 /**
  * Controller层的调用入口函数,在scripts中调用
  */
 public function execute($method)
 {
     static $runCount = 0;
     $runCount++;
     // include smarty class
     require_once __ROOT_PATH . '/lib/includes/Smarty/Smarty.class.php';
     try {
         //取出当前实例的模块名,控制名
         $className = get_class($this);
         if (strlen($className) <= 6 || substr($className, -6) != "Action") {
             throw new Exception("class name({$className}) must end by 'Action'");
         }
         $actualName = substr($className, 0, -6);
         if ($pos = strpos($actualName, "_")) {
             $this->module = substr($actualName, 0, $pos);
             $this->action = substr($actualName, $pos + 1);
         } else {
             $this->action = $actualName;
         }
         $this->method = $method;
         //开始执行
         $this->beforeExecute();
         $this->request = new HttpRequest();
         $this->response = new HttpResponse();
         $this->smarty = new Smarty();
         $this->smarty->template_dir = __ROOT_PATH . "tpls/";
         $this->smarty->compile_dir = __FILES_PATH . "templates_c/";
         $this->smarty->plugins_dir[] = __ROOT_PATH . 'lib/smarty_plugins';
         $this->smarty->template_dir = __ROOT_PATH . "tpls/";
         //入力检查
         $this->check();
         //执行方法
         $this->service();
         //完成运行
         $this->afterExecute();
     } catch (Exception $e) {
         if ($this->occurException($e)) {
             global $fastphp_ErrorMessage;
             $msg = $e->getMessage() . "\n" . $e->getTraceAsString();
             $fastphp_ErrorMessage = $msg;
             logError($msg);
             if ($runCount <= 1) {
                 fastphp_run_action("NotFound.Exception");
             }
         }
     }
 }
Exemple #3
0
<?php

/**
 * Project:     ActionPHP (The MVC Framework) 
 * File:        notfound.php
 *
 * This framework is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @author XuLH <*****@*****.**>
 */
require dirname(__FILE__) . "/global.php";
//Create Action Class
fastphp_run_action("NotFound");