예제 #1
0
파일: Email.php 프로젝트: rudraks/boot
 public function send($message = null)
 {
     if (is_null($message) && !is_null($this->template)) {
         call_user_func(rx_function("rx_set_smarty_paths"), $this->model);
         $this->message = $this->model->fetch($this->template . ".tpl");
     }
     return $this->sendEmail();
 }
예제 #2
0
function rx_interceptor_page($user, $info, $handlerName)
{
    $user->validate();
    include_once RUDRA . "/core/handler/AbstractHandler.php";
    $handlerInfo = ClassUtil::getHandler($handlerName);
    if ($handlerInfo != NULL) {
        global $temp;
        include_once $handlerInfo["filePath"];
        $className = $handlerInfo["className"];
        $tempClass = new ReflectionClass($className);
        if ($tempClass->isInstantiable()) {
            $temp = $tempClass->newInstance();
        }
        if ($temp != NULL) {
            if ($tempClass->hasMethod("invokeHandler")) {
                $tpl = new Smarty();
                call_user_func(rx_function("rx_set_smarty_paths"), $tpl);
                $tpl->debugging = RX_SMARTY_DEBUG;
                $header = new Header($tpl);
                $page = new Page();
                $view = call_method_by_class($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'header' => $header, 'page' => $page, 'dataModel' => $page->data, 'data' => new RequestData(get_request_param("data"))), $handlerInfo["requestParams"]);
                if (!isset($view)) {
                    $view = $handlerName;
                }
                $tpl->assign('user', $user);
                $tpl->assign('page', $page);
                $tpl->assign('header', $header);
                $tpl->assign('CONTEXT_PATH', CONTEXT_PATH);
                $tpl->assign('RESOURCE_PATH', RESOURCE_PATH);
                $tpl->assign('METAS', $header->metas);
                $tpl->assign('TITLE', $header->title);
                $view_path = $view . TEMP_EXT;
                if (!file_exists($view_path)) {
                    $tpl->setTemplateDir(RUDRA . "/core/view");
                    //$view_path = get_include_path () . RUDRA . "/core/view/".$view.TEMP_EXT;
                    //$view_path = get_include_path () . RUDRA . "../view/".$view.TEMP_EXT;
                }
                $tpl->assign('BODY_FILES', $view_path);
                $tpl->assign('page_json', json_encode($page->data->data));
                $tpl->display(RUDRA . "/core/view/full.tpl");
                Browser::log("header", $header->css, $header->scripts);
                Browser::printlogs();
            }
        }
    }
}
예제 #3
0
function rx_interceptor_template($user, $info, $handlerName)
{
    $user->validate();
    include_once RUDRA . "/core/handler/AbstractHandler.php";
    $handlerInfo = ClassUtil::getHandler($handlerName);
    if ($handlerInfo != NULL) {
        global $temp;
        include_once $handlerInfo["filePath"];
        $className = $handlerInfo["className"];
        $tempClass = new ReflectionClass($className);
        if ($tempClass->isInstantiable()) {
            $temp = $tempClass->newInstance();
        }
        if ($temp != NULL) {
            if ($tempClass->hasMethod("invokeHandler")) {
                $tpl = new Smarty();
                call_user_func(rx_function("rx_set_smarty_paths"), $tpl);
                $tpl->debugging = RX_SMARTY_DEBUG;
                $page = new Page();
                $view = call_method_by_class($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'page' => $page, 'dataModel' => $page->data, 'data' => new RequestData(get_request_param("data"))), $handlerInfo["requestParams"]);
                if (!isset($view)) {
                    $view = $handlerName;
                }
                $tpl->assign('user', $user);
                $tpl->assign('CONTEXT_PATH', CONTEXT_PATH);
                $tpl->assign('RESOURCE_PATH', RESOURCE_PATH);
                if (isset($tpl->repeatData)) {
                    foreach ($tpl->repeatData as $key => $value) {
                        $tpl->assign($value['key'], $value['value']);
                        $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT'));
                    }
                } else {
                    $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT'));
                }
                echo TEMP_DELIMITER;
                Browser::printlogs();
                echo TEMP_DELIMITER . json_encode($page->data->data);
                Browser::printlogs();
            }
        }
    }
}
예제 #4
0
function rx_interceptor_template($user, $controllerInfo, $params, $controllerExecute)
{
    $tpl = new Smarty();
    $params["model"] = $tpl;
    $view = $controllerExecute($params);
    call_user_func(rx_function("rx_set_smarty_paths"), $tpl);
    $tpl->debugging = RX_SMARTY_DEBUG;
    $tpl->assign('user', $user);
    $tpl->assign('CONTEXT_PATH', CONTEXT_PATH);
    $tpl->assign('RESOURCE_PATH', RESOURCE_PATH);
    if (empty($view)) {
        echo "!!Empty Template!!";
        return;
    }
    if (isset($tpl->repeatData)) {
        foreach ($tpl->repeatData as $key => $value) {
            $tpl->assign($value['key'], $value['value']);
            $tpl->display($view . Config::get('TEMP_EXT'));
        }
    } else {
        $tpl->display($view . Config::get('TEMP_EXT'));
    }
}
예제 #5
0
function rx_interceptor_page($user, $controllerInfo, $params, $controllerExecute)
{
    ?>
    <html>
    <?

    $tpl = new Smarty ();
    $params["model"] = $tpl;
    $header = new \app\model\Header ($tpl);
    call_user_func(rx_function("rx_set_smarty_paths"), ($tpl));
    $view = $controllerExecute($params);

    $tpl->debugging = RX_SMARTY_DEBUG;

    $tpl->assign('user', $user);
    $tpl->assign('header', $header);

    $tpl->assign('CONTEXT_PATH', CONTEXT_PATH);

    $tpl->assign('METAS', $header->metas);
    $tpl->assign('TITLE', $header->title);

    ?>
    <head></head>
<body>

    <?

    $tpl->display($view_path = $view . TEMP_EXT);

    ?></body><?

    Browser::log("header", $header->css, $header->scripts);
    Browser::printlogs();

    ?></html><?
}
예제 #6
0
 /** Default RudraX Plug
  *
  * @RequestMapping(url="cache.manifest",type=data,cache = false)
  *
  */
 function manifest($mdfile)
 {
     header('Content-type: text/cache-manifest');
     header('Cache-Control: no-cache');
     include_once RUDRA . "/smarty/Smarty.class.php";
     $tpl = new Smarty();
     call_user_func(rx_function("rx_set_smarty_paths"), $tpl);
     $tpl->display(get_include_path() . RUDRA . "/core/view/manifest.tpl");
     //readfile("../".RUDRA."/core/offline/cache.manifest");
 }
예제 #7
0
 public function invoke(User $user, $handlerName)
 {
     return call_user_func(rx_function("rx_page_interceptor"), $user, $handler);
 }
예제 #8
0
 public function _dataInterceptor_($info, $controllerOutput)
 {
     return call_user_func(rx_function("rx_interceptor_data"), $this->user, $info, $controllerOutput);
 }
예제 #9
0
파일: ClassUtil.php 프로젝트: rudraks/boot
 public static function scan()
 {
     self::init(true);
     call_user_func(rx_function("rx_scan_classes"));
 }
예제 #10
0
파일: RudraX.php 프로젝트: rudraks/boot
 public static function read($glob_config, $file, $file2 = null)
 {
     $debug = isset($glob_config["RX_MODE_DEBUG"]) && $glob_config["RX_MODE_DEBUG"] == TRUE;
     $debug_build = isset($_REQUEST["RX_MODE_BUILD"]) && $_REQUEST["RX_MODE_BUILD"] == TRUE;
     self::$cache = new RxCache("config", true);
     $reloadCache = FALSE;
     header("FLAGS:" . self::$cache->isEmpty() . "-" . $glob_config["RX_MODE_DEBUG"] . "-" . $debug);
     if (self::$cache->isEmpty()) {
         $reloadCache = TRUE;
     } else {
         $_glob_config = self::$cache->get("GLOBAL");
         if ($_glob_config["RX_MODE_DEBUG"] != $debug || isset($_GET['ModPagespeed'])) {
             $reloadCache = TRUE;
         }
     }
     $RELOAD_VERSION = self::$cache->get("RELOAD_VERSION");
     if ($debug_build || $debug || $reloadCache) {
         FileUtil::build_check();
         define("FIRST_RELOAD", TRUE);
         $RELOAD_VERSION = microtime(true);
         RxCache::clean();
         self::$cache->set("RELOAD_VERSION", $RELOAD_VERSION);
         $DEFAULT_CONFIG = parse_ini_file("_project.properties", TRUE);
         $localConfig = array();
         if (file_exists($file)) {
             $localConfig = parse_ini_file($file, TRUE);
         }
         $localConfig = array_replace_recursive($DEFAULT_CONFIG, $localConfig);
         if ($file2 != null && file_exists($file2)) {
             $localConfig = array_replace_recursive($localConfig, parse_ini_file($file2, TRUE));
         }
         self::$cache->merge($localConfig);
         self::$cache->set('GLOBAL', array_merge($DEFAULT_CONFIG['GLOBAL'], $localConfig['GLOBAL'], $glob_config));
         $reloadMode = isset($_GET['ModPagespeed']) ? $_GET['ModPagespeed'] : NULL;
         call_user_func(rx_function("rx_reload_cache"), $reloadMode);
         self::$cache->save();
         Browser::header("RX_MODE_BUILD");
     } else {
         define("FIRST_RELOAD", FALSE);
     }
     define("RELOAD_VERSION", $RELOAD_VERSION);
     return self::$cache->getArray();
 }
예제 #11
0
 public function _interceptor_($info, $params)
 {
     if (!isset($info["type"])) {
         $info["type"] = "data";
     }
     if (isset($info["type"])) {
         $controller = $this;
         return call_user_func(rx_function("rx_interceptor_" . $info["type"]), $this->user, $info, $params, function ($newParams) use($controller, $info, $params) {
             try {
                 $dontPrevent = true;
                 if (method_exists($controller, "_before_controller_")) {
                     $dontPrevent = !!call_method_by_object($controller, "_before_controller_", $newParams, $info["requestParams"]);
                 }
                 $returned = null;
                 if ($dontPrevent) {
                     $returned = call_method_by_object($controller, $info["method"], $newParams, $info["requestParams"]);
                     if (method_exists($controller, "_post_controller_")) {
                         $returned = call_method_by_object($controller, "_post_controller_", $newParams, $info["requestParams"]);
                     }
                     return $returned;
                 }
             } catch (\Exception $e) {
                 if (function_exists("controller_exception_handler")) {
                     controller_exception_handler($e);
                 } else {
                     print_line("<div style='display:none'>**============**");
                     print_line("Controller Exception:" . $e->getMessage());
                     print_line("**--------------**");
                     print_line($e->getTraceAsString());
                     print_line("**============**</div>");
                 }
             }
             return "empty";
         });
     }
 }