Exemplo n.º 1
0
 public function init_flow_handle(Flow $flow)
 {
     if (Mobile::is_mobile()) {
         $vars = $flow->vars();
         mb_convert_variables('utf-8', 'utf-8,SJIS-win', $vars);
         $flow->vars($vars);
     }
 }
 public function init_flow_handle(Flow $flow)
 {
     $map = $flow->handled_map();
     $ref = new ReflectionMethod($map['class'], $map['method']);
     $doc = $ref->getDocComment();
     if (stripos($doc, '@login_required') !== false) {
         $flow->a('user', 'require', true, true);
     }
 }
Exemplo n.º 3
0
 function run()
 {
     global $Templates, $DB, $Controller;
     $_REQUEST->setType('item', 'numeric');
     $PERPAGE = 5;
     if ($_REQUEST['item']) {
         $obj = $Controller->{$_REQUEST['item']};
         $content = $obj->display(false, true, true, true);
     } else {
         $QUEUE = $this->ID;
         $COUNT = (int) $DB->flow->count(array('queue~' => $QUEUE), 'id');
         $pagination = Pagination::getRange($PERPAGE, $COUNT);
         $Objects = Flow::retrieve('News', $PERPAGE, false, false, false, $pagination['range']['start']);
         $content = '';
         $first = true;
         foreach ($Objects as $obj) {
             $content .= '<li' . ($first ? '' : ' class="cols"') . '>' . $obj->display(false, $first, true) . '</li>';
             $first = false;
         }
         $content = '<ul>' . $content . '</ul>' . $pagination['links'];
     }
     $r = '<h1>FlowView</h1>' . Design::row(array(Design::column('<div class="padded">' . $content . '</div>', 8, true, true, true), Design::column('Möjlighet att följa nyheterna via RSS kommer... ', 4, false, true, true)), true);
     $this->setContent('main', $r);
     $this->setContent('menu', $this->submenu());
     $Templates->yweb('empty')->render();
 }
Exemplo n.º 4
0
 public function run()
 {
     $dispatcher = Flow::app()->getComponent('url_router');
     $action_name = $dispatcher->getAction();
     $method_name = $dispatcher->getMethod();
     $action_name = ucfirst($action_name) . "Controller";
     // 检测是否存在
     if (empty(FLow::$classMap[$action_name])) {
         if (DEV_MODE) {
             header("HTTP/1.1 404 Not Found");
             throw new Exception("Controller {$action_name} Not Found");
         } else {
             header("HTTP/1.1 404 Not Found");
             die;
         }
     }
     $action = Flow::app()->createComponent(array('class' => $action_name, 'view' => Flow::app()->view_engine, 'request' => Flow::app()->getComponent('request')));
     $action->beforeController();
     $method_name = "action" . $method_name;
     // 检测方法
     if (!method_exists($action, $method_name)) {
         if (DEV_MODE) {
             header("HTTP/1.1 404 Not Found");
             throw new Exception("Controller {$action_name} has No {$method_name} Method");
         } else {
             header("HTTP/1.1 404 Not Found");
             die;
         }
     }
     // 执行方法
     $action->{$method_name}();
 }
Exemplo n.º 5
0
 public function test_getTableName()
 {
     $func = function () use($a) {
         echo 'Hello world!';
     };
     $this->assertEquals(BILLING_DB_PMDB . '.flow', Flow::getTableName());
 }
Exemplo n.º 6
0
 /**
  * 负责分发错误到日志记录
  */
 public static function errorHandler($errno, $errstr, $errfile, $errline, $obj)
 {
     restore_error_handler();
     restore_exception_handler();
     // 处理@符号的情况
     if (!(error_reporting() !== 0 && $errno)) {
         return;
     }
     switch ($errno) {
         case E_NOTICE:
         case E_USER_NOTICE:
             $errors = "Notice";
             break;
         case E_WARNING:
         case E_USER_WARNING:
             $errors = "Warning";
             break;
         case E_ERROR:
         case E_USER_ERROR:
             $errors = "Fatal Error";
             break;
         default:
             $errors = "Unknown";
             break;
     }
     Flow::Log()->clear();
     Flow::Log()->error(sprintf("%s in %s on line %d", $errstr, $errfile, $errline));
     self::dieErrorLogs();
     return false;
 }
Exemplo n.º 7
0
 /**
  * 两种加载模式
  * @param $class_name
  * @throws Exception
  */
 public static function autoLoadHandler($class_name)
 {
     if (isset(Flow::$classMap[$class_name])) {
         include Flow::$classMap[$class_name];
         return;
     }
     if (strpos($class_name, "_") !== false) {
         $paths = explode("_", $class_name);
         if (isset($paths[0])) {
             if ($paths[0] == "F") {
                 $paths[0] = "system";
             }
             $paths[0] = Flow::getPathOfAlias($paths[0]);
             $lastp = $paths[count($paths) - 1];
             unset($paths[count($paths) - 1]);
             foreach ($paths as $i => $path_seg) {
                 if ($i != 0) {
                     $paths[$i] = strtolower($path_seg);
                 }
             }
             $file_path = implode(DIRECTORY_SEPARATOR, $paths) . DIRECTORY_SEPARATOR . $lastp . ".php";
             if (DEV_MODE) {
                 if (!file_exists($file_path)) {
                     throw new Exception("Class {$class_name} LoadError" . PHP_EOL . "File {$file_path} Not Existed");
                 }
             }
             include $file_path;
         }
     }
 }
Exemplo n.º 8
0
 /**
  * パッケージのメディアへのURLを定義する
  * @param string $url パッケージのメディアと認識されるURL
  */
 public static final function config_package_media_url($url)
 {
     if (substr($url, 0, 1) == "/") {
         $url = substr($url, 1);
     }
     if (substr($url, -1) == "/") {
         $url = substr($url, 0, -1);
     }
     self::$package_media_url = $url;
 }
Exemplo n.º 9
0
 public function actionIndex()
 {
     FLow::app()->request->getText("a");
     $entry_acm = Flow::app()->acf->table("entry");
     $comicnodes = $entry_acm->where("cat='cartoon'")->order("publish_date desc, `dsr_score` desc")->limit("30")->findall();
     $movienodes = $entry_acm->where("cat='movie'")->order("publish_date desc, `dsr_score` desc")->limit("30")->findall();
     $this->assign("comicnodes", $comicnodes);
     $this->assign("movienodes", $movienodes);
     $this->display();
 }
Exemplo n.º 10
0
 public function stopAnalyze()
 {
     $flow = new Flow($this);
     $this->flows[] = $flow;
     $flow->flow();
     $fieldSets = [];
     foreach ($this->flows as $flow) {
         $fields = $flow->getFields();
         foreach ($fieldSets as $fieldSet) {
             if ($fieldSet == $fields) {
                 continue 2;
             }
         }
         $fieldSets[] = $fields;
     }
     $this->fields = $fieldSets;
     echo "\rFinished analyzing {$this->name} (memory: " . round(memory_get_usage() / 1024, 2) . " KB)\n";
     unset($this->instr);
     gc_collect_cycles();
     echo "Freed resources (memory: " . round(memory_get_usage() / 1024, 2) . " KB)\n";
 }
Exemplo n.º 11
0
 public function flow_verify(Flow $flow)
 {
     if (!$flow->isSessions("_onetimeticket") || $flow->inVars("_onetimeticket") !== $flow->inSessions("_onetimeticket")) {
         $flow->vars("_onetimeticket", $flow->inSessions("_onetimeticket"));
         throw new Exception("invalid ticket");
     }
 }
Exemplo n.º 12
0
 /**
  * This is the callback function for ALL flows that the flow module responds to.
  * All flow processing starts here.
  *
  * Request Params supported:
  * _fid - the id of the flow
  * _faction - the name of the action that the user is taking
  *
  */
 function requestAction()
 {
     $url = parse_url($this->getRequest()->getRequestUri());
     $uri = $url['path'];
     $flowFile = $this->getFlowFile();
     // Pull the flowId out of the request
     $flowId = $this->_getParam('_fid');
     $action = $this->_getParam('_faction');
     $flow = null;
     $session = new Zend_Session_Namespace('flow');
     // If the flowId exists on the request then try to continue the existing flow
     if (!empty($flowId)) {
         $flow = unserialize($session->{$flowId});
         $this->flow = $flow;
     }
     // If no existing flow then create a new one and stick it in the session
     if (empty($flow)) {
         $flow = new Flow($flowFile, $uri, $this, $this->_request->getControllerName());
         $this->flow = $flow;
         $flow->process("__INIT__");
     }
     // Have to always set the controller, because we serialize it but the next request will have a
     // Different one
     $flow->controller = $this;
     $flowId = $flow->id;
     // If the user actually tried to do something other than refresh the page
     if (!empty($action)) {
         // Process the action
         $flow->process($action);
         // Store the result in the session
         $session->{$flowId} = serialize($flow);
         // Redirect so that the user can refresh, without warnings from the browser
         $this->_helper->redirector->gotoUrl($uri . "?_fid={$flow->id}");
     }
     // Otherwise, we will just render using the same state info.
     // Store the result in the session
     $session->{$flowId} = serialize($flow);
     $flow->render();
     $session->{$flowId} = serialize($flow);
 }
Exemplo n.º 13
0
    function run()
    {
        global $Templates, $CONFIG, $DB, $Controller;
        $_REQUEST->setType('flash', 'any');
        if ($_REQUEST->valid('flash')) {
            Flash::create($_REQUEST['flash'] . '_flash_1', $_REQUEST['flash']);
        }
        $_REQUEST->setType('addToConfig', 'any');
        if ($_REQUEST->valid('addToConfig')) {
            $CONFIG->Frontpage->setType('NewsItems', 'text');
            $CONFIG->Frontpage->setDescription('NewsItems', 'Number of news items displayed');
            $CONFIG->Frontpage->NewsItems = 5;
        }
        $content = '';
        $newsNum = $CONFIG->Frontpage->NewsItems;
        if (!is_numeric($newsNum) || $newsNum < 1 || $newsNum > 30) {
            $newsNum = 5;
        }
        $newsNum = 3;
        /* Retrive news objects */
        if ($newsNum > 0) {
            $newsObj = Flow::retrieve('News', $newsNum, false, false, false, 0, true);
        }
        /* <<< New flowing design >>> */
        foreach ($newsObj as $news) {
            $content .= $news->display('new');
        }
        $mlForm = new Form('mailListForm');
        $ml = $mlForm->quick(null, __('Send'), new Input('Email', 'mlmail'));
        $r = '<div id="intro">
        	<div class="lcol"><img src="' . $Templates->current->webdir . 'images/intro/IMG_0817.jpg" width="400" alt="Lihkoren" /></div>
	        <div class="rcol"><p>Link&ouml;pings Students&aring;ngarf&ouml;rening Lihk&ouml;ren &auml;r en mansk&ouml;r som verkar vid Link&ouml;pings universitet, under ledning av director musices Hans Lundgren. K&ouml;ren bildades 1972 av studenter vid d&aring;varande Link&ouml;pings H&ouml;gskola.
Lihk&ouml;ren uttalas som det smakar. K&ouml;ren framf&ouml;r fr&auml;mst nordisk och europeisk musik, delvis fr&aring;n den traditionella mansk&ouml;rsrepertoaren men &auml;ven nyskriven musik. Glimten i &ouml;gat och den goda kontakten med publiken pr&auml;glar konserterna.<br>V&auml;l m&ouml;tt.</p></div>
			<img src="' . $Templates->current->webdir . 'images/rand_top.png" alt="pagesplit" class="pagesplit" />
		</div>
		<div id="fbottom">
			<div class="lcol">
				<div class="lbox coming"><h1 class="icn-hdr"><span class="icn icn-coming"></span>' . __('Kommande h&auml;ndelser') . '</h1>
					<p>Kommande h&auml;ndelser i kalendern.</p>
				</div>
				<div class="lbox maillist"><h1 class="icn-hdr"><span class="icn icn-mail"></span>' . __('Nyhetsbrev') . '</h1>
					<p class="pre">Vill du f&aring; information om kommande konserter och andra arrangemang med Lihk&ouml;ren?</p>
					' . $ml . '
					<p>Du kommer d&aring; att f&aring; ett e-brev som du m&aring;ste svara p&aring; f&ouml;r att bekr&auml;fta att du vill att informationen ska skickas till dig</p>
				</div>
			</div>
        	<div class="rbox news"><h1 class="icn-hdr"><span class="icn icn-news"></span>' . __('Nyheter') . '</h1>' . $content . '<a href="/flowView?q=News">' . __('View all news') . '</a></div>
        </div>';
        /*         dump($Templates->current->webdir); */
        $this->setContent('main', $r);
        $Templates->render();
    }
Exemplo n.º 14
0
 /**
  * Flowのモジュール
  * @param Flow $flow
  */
 public function flow_verify(Flow $flow)
 {
     if (!$flow->is_sessions("_onetimeticket") || $flow->in_vars("_onetimeticket") !== $flow->in_sessions("_onetimeticket")) {
         $flow->vars("_onetimeticket", $flow->in_sessions("_onetimeticket"));
         return false;
     }
     return true;
 }
Exemplo n.º 15
0
 /**
  * 汇报到log里面
  */
 private function _reportLogger()
 {
     foreach ($this->_stat_entries as $stat_name => $stat_entry) {
         $log_row = "[{$stat_name}]";
         if (isset($stat_entry['end_time_ms'])) {
             $stat_entry['cost'] = $stat_entry['end_time_ms'] - $stat_entry['start_time_ms'];
             unset($stat_entry['end_time_ms']);
             unset($stat_entry['start_time_ms']);
         }
         foreach ($stat_entry as $entry_key => $entry_val) {
             $log_row .= "{$entry_key} {$entry_val} ";
         }
         Flow::Log()->debug($log_row);
     }
 }
Exemplo n.º 16
0
 private function _routeRequest()
 {
     $action = isset(Flow::$cfg['default_controller']) ? Flow::$cfg['default_controller'] : "index";
     $method = 'index';
     $base_path = Flow::app()->basePath;
     $uri = $_SERVER['REQUEST_URI'];
     if (strpos($uri, $base_path) === 0) {
         $uri = substr($uri, strlen($base_path));
     }
     // 如果有pattern 用pattern的匹配
     if (!empty($this->rewrite_rules)) {
         foreach ($this->rewrite_rules as $url_pattern => $dest) {
             $uri = preg_replace($url_pattern, $dest, $uri);
             break;
         }
     }
     $uri_parsed = parse_url($uri);
     if (empty($uri_parsed['path'])) {
         $uri_parsed['path'] = '/';
     }
     // 按斜杠分拆
     $params = explode("/", trim($uri_parsed['path'], "/\\"));
     if (!empty($params[0])) {
         $action = $params[0];
         if (strpos($action, '.') !== false) {
             $action = 'Main';
         }
     }
     if (!empty($params[1])) {
         $method = $params[1];
     }
     if (!empty($_GET['action'])) {
         $action = $_GET['action'];
     }
     if (!empty($_GET['method'])) {
         $method = $_GET['method'];
     }
     // 多余的参数设置到请求里面
     foreach ($params as $i => $j) {
         if ($i % 2 == 1 && $i != 0) {
             if ($params[$i - 1] != "") {
                 $_GET[$params[$i - 1]] = $params[$i];
             }
         }
     }
     $this->action = $action;
     $this->method = $method;
 }
Exemplo n.º 17
0
/**
 * 包含数据模型
 * @param $modleName 模型的名字 结尾需要是.class.php
 */
function M($modelName)
{
    global $m;
    isset($m) ? $m : ($m = array());
    if (!array_key_exists($modelName, $m)) {
        $t = (include_once APP_BASE . "/models/" . $modelName . ".class.php");
        if (!$t) {
            throw new FlowException("模型" . $modelName . "载入失败, 没有文件 " . APP_BASE . "/module/" . $modelName . ".class.php");
        } else {
            Flow::Log()->i("模型" . $modelName . "载入成功");
        }
        $m[$modelName] = new $modelName($modelName);
    }
    //$m->setFormName($modleName);
    return $m[$modelName];
}
Exemplo n.º 18
0
 public function send($from, $to, $subject, $content)
 {
     $from = strip($from);
     if (is_array($to)) {
         $to = implode(";", $to);
     }
     $to = strip($to);
     $headers = 'MIME-Version: 1.0' . "\n";
     $headers .= 'Content-Type: text/html; charset=gbk' . "\n";
     //$headers .= "To: $to \n";
     $headers .= 'From: ' . $from . "\n";
     $subject = "=?gbk?B?" . base64_encode($subject) . "?=";
     $result = mail($to, $subject, $content, $headers);
     if ($result) {
         return true;
     } else {
         Flow::Log()->w($result);
         return false;
     }
 }
Exemplo n.º 19
0
 /**
  * 依据配置文件数组创建一个类
  * array('class'=>'xxxxx','import'=>'lib.go', 'a'=>'b')
  * 其他将被注入到参数中
  *
  * @param $config
  * @return mixed
  * @throws Exception
  */
 public function createComponent($config)
 {
     if (!is_array($config)) {
         return $config;
     }
     if (empty($config['class'])) {
         return $config;
     }
     if (!empty($config['import'])) {
         foreach ($config['import'] as $imt) {
             Flow::import($imt);
         }
     }
     $class_name = $config['class'];
     $comp = new $class_name();
     unset($config['class']);
     unset($config['import']);
     foreach ($config as $key => $val) {
         $comp->{$key} = $this->createComponent($val);
     }
     $comp->init();
     return $comp;
 }
Exemplo n.º 20
0
<?php

/**
 * Copyright 2013 princehaku
 *
 *  FileName : index.php
 *  Created on : 13-3-19 , 下午7:01
 *  Author     : zhongwei.bzw
 */
define("DEV_MODE", true);
define("APP_PATH", dirname(__FILE__));
define("FLOW_PATH", dirname(dirname(dirname(__FILE__))) . "/flowphp/");
include FLOW_PATH . "flow.php";
$flow = new Flow();
$flow->run('cli');
Exemplo n.º 21
0
$cards = $cardObj->create();
$cards = $cardObj->shuffle($cards);
$groups = $cardObj->Dealer(count($players), $cards);
// suit
$suit = $cardObj->suit();
echo json_encode($groups) . '<br>';
//$groups = json_decode('[[14,3,47,6,20,33,17,51,9,11,29],[21,13,7,5,34,8,40,10,30,12,31],[32,16,43,28,45,42,15,36,26,25],[23,38,52,22,39,27,2,44,24,49],[35,41,48,4,37,1,19,46,50,18]]');
// testing
foreach ($groups as $key => $val) {
    echo '[' . $players[$key] . '] &emsp;';
    sort($val);
    $cardObj->watch_card($val);
}
echo '<hr>';
// 遊戲開始
$flow = new Flow();
$tab = new Table();
$flow::$members = count($players);
// 第一手
$card = $flow->fire($groups);
$tab->add($card);
echo $players[$flow->now_player()] . ' : ' . $suit[$card] . '<br>';
for ($i = 0; $i < 55; $i++) {
    $flow->move_next();
    $card = $flow->run($tab->get_on_table());
    if (!$card) {
        echo '[' . $i . '] ' . $players[$flow->now_player()] . ' : PASS ! <br>';
        continue;
        // 沒牌了
    }
    if ($card > 0) {
Exemplo n.º 22
0
        $messages = array();
        //		foreach(R(new TwitterAPI())->friends_timeline() as $message) $messages[] = Message::parse($message);
        foreach (R(new WassrAPI())->friends_timeline() as $message) {
            $messages[] = Message::parse($message);
        }
        $messages = omerge($messages, "key");
        rosort($messages, "created_at");
        return $messages;
    }
    public static function update($text)
    {
        R(new TwitterAPI())->update($text);
        R(new WassrAPI())->update($text);
    }
}
$flow = new Flow();
if ($flow->isPost() && $flow->isVars("text")) {
    Message::update($flow->inVars("text"));
    $flow->redirect_self();
}
$flow->vars("messages", Message::friends_timeline());
//$flow->output(__FILE__);
exit;
?>
<rt:template>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form method="post">
Exemplo n.º 23
0
Arquivo: test.php Projeto: hisaboh/w2t
<?php

include_once dirname(__FILE__) . "/__settings__.php";
application_settings(__FILE__, null, dirname(dirname(__FILE__)));
import("core.Log");
import("core.Flow");
import("core.File");
import("ext.Test");
import("ext.Setup");
header_output_text();
$flow = new Flow();
if ($flow->isVars("class")) {
    test($flow->inVars("class"), $flow->inVars("method"), $flow->inVars("block"));
} else {
    if (!$flow->isVars("full")) {
        Test::exec_type(Test::FAIL);
    }
    tests(root_path());
}
Exemplo n.º 24
0
 protected function _beforeQuery($sql)
 {
     Flow::Log()->debug("[SQL] " . $sql);
     return;
 }
Exemplo n.º 25
0
 public function actionIndex()
 {
     header('Location:' . Flow::app()->basePath . '/test/b');
     $this->display();
 }
Exemplo n.º 26
0
 public static function updateApplication($id)
 {
     $detail = Claims_App::find($id);
     $detail->status = Flow::next();
     $detail->save();
 }
Exemplo n.º 27
0
Arquivo: Crud.php Projeto: hisaboh/w2t
 public function handler(array $urlconf = array())
 {
     if (empty($urlconf)) {
         $urlconf = array("^/(.+?)/create[/]*\$" => "method=do_create", "^/(.+?)/update[/]*\$" => "method=do_update", "^/(.+?)/detail[/]*\$" => "method=do_detail", "^/(.+?)/drop[/]*\$" => "method=do_drop", "^/(.+?)[/]*\$" => "method=do_find", "" => "method=models");
     }
     parent::handler($urlconf);
     return $this;
 }
Exemplo n.º 28
0
 function flowList()
 {
     $r = array();
     $flows = Flow::flows();
     foreach ($flows as $f) {
         $r[] = '<span class="fixed-width">' . $f . '</span><div class="tools">' . icon('small/pencil', __('Edit flow'), url(array('edit' => $f->ID))) . icon('small/feed', __('View flow'), $f->link) . '</div>';
     }
     return listify($r);
 }
Exemplo n.º 29
0
Arquivo: Flow.php Projeto: hisaboh/w2t
 /**
  * URLのパターンからTemplateを切り替える
  * @param array $urlconf
  */
 public function handler(array $urlconf = array())
 {
     $params = array();
     foreach ($urlconf as $pattern => $conf) {
         if (is_int($pattern)) {
             $pattern = $conf;
             $conf = null;
         }
         if (preg_match("/" . str_replace(array("\\/", "/", "__SLASH__"), array("__SLASH__", "\\/", "\\/"), $pattern) . "/", $this->args(), $params)) {
             if ($conf !== null) {
                 if (is_array($conf)) {
                     if (isset($conf["class"])) {
                         $this->class = $conf["class"];
                     }
                     if (isset($conf["method"])) {
                         $this->method = $conf["method"];
                     }
                     if (isset($conf["template"])) {
                         $this->template = $conf["template"];
                     }
                     if (isset($conf["name"])) {
                         $this->name = $conf["name"];
                     }
                 } else {
                     $this->dict($conf);
                 }
             }
             self::$match_pattern = empty($this->name) ? $params[0] : $this->name;
             if (!empty($this->class)) {
                 if (false !== strrpos($this->class, ".") || !class_exists($this->class)) {
                     $this->class = Rhaco::import($this->class);
                 }
                 if (empty($this->method) && !empty($pattern)) {
                     $method_patterns = array();
                     $patterns = explode("/", $pattern);
                     if ($patterns[0] == "^") {
                         array_shift($patterns);
                     }
                     foreach ($patterns as $p) {
                         if (!preg_match("/[\\w_]/", $p)) {
                             break;
                         }
                         $method_patterns[] = $p;
                     }
                     if (!empty($method_patterns)) {
                         $this->method = implode("_", $method_patterns);
                     }
                 }
             }
             if (empty($this->method) && !empty($this->template)) {
                 $obj = new self();
                 $obj->copy_module($this, true);
                 $obj->template($this->template);
             } else {
                 $method = empty($this->method) ? "index" : $this->method;
                 if (!method_exists($this->class, $method)) {
                     throw new Exception("Not found " . $this->class . "::" . $method);
                 }
                 array_shift($params);
                 try {
                     $class = $this->class;
                     $action = new $class();
                     $action->copy_module($this, true);
                     if ($action instanceof self) {
                         $action->handled();
                     }
                     $obj = call_user_func_array(array($action, $method), $params);
                 } catch (Exception $e) {
                     Log::debug($e);
                     $on_error = Rhaco::def("core.Flow@on_error");
                     if ($on_error === null) {
                         throw $e;
                     }
                     if (isset($on_error[0])) {
                         Http::status_header((int) $on_error[0]);
                     }
                     if (isset($on_error[2])) {
                         Http::redirect($on_error[2]);
                     }
                     if (isset($on_error[1])) {
                         $template = new Template();
                         $template->output($on_error[1]);
                     }
                     exit;
                 }
             }
             if ($obj instanceof self) {
                 $obj = $obj->templ();
             }
             if (!$obj instanceof Template) {
                 throw new Exception("Forbidden " . $this->args());
             }
             $obj->path($this->path());
             $obj->url($this->url());
             $this->templ = $obj;
             if (!$this->isTemplate()) {
                 $this->template($obj->filename());
             }
             if (!$this->isTemplate()) {
                 $cs = explode(".", $this->class);
                 $class = array_pop($cs);
                 $class = implode("/", $cs) . (!empty($cs) ? "/" : "") . strtolower($class[0]) . substr($class, 1);
                 $this->template($class . "/" . $method . ".html");
             }
             return $this;
         }
     }
     throw new Exception("no match pattern");
 }
Exemplo n.º 30
0
/**
 * application xmlを実行する
 * @param string $path xmlファイルのパス
 */
function app($path = null)
{
    if ($path === null) {
        list($debug) = debug_backtrace(false);
        $path = $debug["file"];
    }
    Flow::load($path);
}