do404() Called from /rd/vhosts/tele/telezor/lib/Action/Site.php:12
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* non recoverable Error - developer uses Code Incorrect Way
* throw \Error exception if ...
*/
function error_unless($boolean, string $message) {
if (! $boolean)
throw new \Error($message);
}
|
|
|
| return i('table.business')->row($business_id);
}
// Access specific template
function tpl($name) : string {
$id = TPL::id($name, false);
error_unless ($id, "no such template: $name"); // NO AutoCreate
// RDSite::tpl is broken !!!
return tpl(RDSite::siteTemplatesPrefixPages().$name);
}
// Access specific "sectioned" template
// Remember - {=@T.$section} = access template for a current page
| ViewHelper
|
|
| return tpl(RDSite::siteTemplatesPrefixPages().$name);
}
// Access specific "sectioned" template
// Remember - {=@T.$section} = access template for a current page
function tpls($name) : array {
return \TPL::parseSections($this->tpl($name));
}
|
| return $o(...$params);
|
| * "Class::Decorator Method"
*
*/
PUBLIC function call($obj_method, ...$params) {
$o = $this->resolve($obj_method);
return $o(...$params);
}
/**
* Return decorated Method(Class::method) as closure. $M = i('decorator')->call([$this, "method"]; $result = $M(...$args);
*
* @param $obj_method:
|
| return i('decorator')->call([$this->_, $method], ...$args);
|
| $wrap = $config['wrap'];
unset($config['wrap']);
$this->_ = is_string($wrap) ? new $wrap($config) : $wrap;
}
function __call($method, $args) {
return i('decorator')->call([$this->_, $method], ...$args);
}
function __get($prop) {
return $this->_->$prop;
}
function __set($prop, $value) {
| hb\core\i\DecoratorWrapper
|
|
| *
*/
class Action_Page extends Action_Site {
function _common() {
parent::_common();
$T = i("VH")->tpls("page-".$this->method);
$this['G.title'] = $T['title'];
$h1 = $T['h1'] ?? $T['title'];
$body = $T['body'];
$html = @$T['html'];
$this->s = "<h1>$h1</h1>".($body ? "<p>$body</p>" : "").$html;
|
| if ($c=$this->_common($method)) return $c;
|
| if (PHP_SAPI == 'cli')
$this->_forbidden("Can't call internal method");
}
// seems like a bug
if ($a=$this->_access($method)) return $this->$a($method); // common access handler
if ($c=$this->_common($method)) return $c;
$mex=1; // method exists
if (! method_exists($this, $method) ) {
$mex=0;
// missing method processing
Profiler::in("Action::missing method");
|
| $r = parent::_call($method, $url);
|
| }
public function offsetUnset($path) {
\DH::uset($this->_, $path);
}
function _call($method, $url) { # "w:$view-name"
$r = parent::_call($method, $url);
if (!CD("AJAX")) {
if ($r === null)
return "w:";
if ($r) {
if (is_array($r))
|
| $r = $A->_call($method, $path);
|
| Profiler::disable();
CD::set("AJAX", 1);
}
Profiler::in("${class}::$method", $p);
$A = new $class($p);
$r = $A->_call($method, $path);
Profiler::out();
//respect called action's desire to act as AJAX.
$is_ajax = CD("AJAX");
// AJAX methods - default - no templates
if ($is_ajax) {
|
| $template = self::action($url, $params); // PARAM by REF!
|
| self::$layout=$layout;
if ($r = strpos($url,"?"))
$url = substr($url, 0, $r);
$url = substr($url,1); // remove leading "/"
restore_msg($params); // modify params - restore messages passed by pass_msg
$template = self::action($url, $params); // PARAM by REF!
if (isset($_GET['TPL']) ) {
echo "<div style='padding-left: 3px; background: #eee'>";
vvv($params);
echo "</div>";
}
|
| Controller::dispatch($url, $_GET + $_POST, "_layout");
|
| echo " Called from ".@$dbtr[0]["file"].":".@$dbtr[0]["line"]."\n";
}
}
Profiler::disable(); // usually redirects break profiling
$url = NVL(CC("page404"),'/page/page404');
Controller::dispatch($url, $_GET + $_POST, "_layout");
exit;
}
/**
* redirect to global 410 page (status GONE) with logging to local file or log server
* @param int $status
|
|
|
| * Base class for Actions on Site
*
*/
class Action_Site extends \hb\core\view\Action {
function _missing_method() {
do404();
}
function _common() {
$this["G.layout"] = "layout";
//By default all pages are noindex, follow, noarchive
$this["G.robots"] = "noindex, nofollow, noarchive";
|
| $m=$this->_missing_method();
|
| $mex=1; // method exists
if (! method_exists($this, $method) ) {
$mex=0;
// missing method processing
Profiler::in("Action::missing method");
$m=$this->_missing_method();
Profiler::out($m);
if ($m) {
$method=$m;
if (method_exists($this, $method) )
$mex=1;
|
| $r = parent::_call($method, $url);
|
| }
public function offsetUnset($path) {
\DH::uset($this->_, $path);
}
function _call($method, $url) { # "w:$view-name"
$r = parent::_call($method, $url);
if (!CD("AJAX")) {
if ($r === null)
return "w:";
if ($r) {
if (is_array($r))
|
| $r = $A->_call($method, $path);
|
| Profiler::disable();
CD::set("AJAX", 1);
}
Profiler::in("${class}::$method", $p);
$A = new $class($p);
$r = $A->_call($method, $path);
Profiler::out();
//respect called action's desire to act as AJAX.
$is_ajax = CD("AJAX");
// AJAX methods - default - no templates
if ($is_ajax) {
|
| $template = self::action($url, $params); // PARAM by REF!
|
| self::$layout=$layout;
if ($r = strpos($url,"?"))
$url = substr($url, 0, $r);
$url = substr($url,1); // remove leading "/"
restore_msg($params); // modify params - restore messages passed by pass_msg
$template = self::action($url, $params); // PARAM by REF!
if (isset($_GET['TPL']) ) {
echo "<div style='padding-left: 3px; background: #eee'>";
vvv($params);
echo "</div>";
}
|
| Controller::dispatch($_SERVER["REDIRECT_URL"], $_GET + $_POST, "_layout");
|
| <?
Controller::dispatch($_SERVER["REDIRECT_URL"], $_GET + $_POST, "_layout");
exit; |
#0 vhosts/tele/telezor/lib/ViewHelper.php:27 error_unless() #1 vhosts/tele/telezor/lib/ViewHelper.php:35 ViewHelper->tpl() #2 homebase/hb/core/i/Decorator.php:92 ViewHelper->tpls() #3 homebase/hb/core/i/DecoratorWrapper.php:49 hb\core\i\Decorator->call() #4 vhosts/tele/telezor/Action/Page.php:22 hb\core\i\DecoratorWrapper->__call() #5 lib.framework/Action/Action.php:158 Action_Page->_common() #6 homebase/hb/core/view/Action.php:41 Action->_call() #7 lib.framework/Controller/Controller.php:213 hb\core\view\Action->_call() #8 lib.framework/Controller/Controller.php:137 Controller::action() #9 lib.framework/utils/web.php:106 Controller::dispatch() #10 vhosts/tele/telezor/lib/Action/Site.php:12 do404() #11 lib.framework/Action/Action.php:165 Action_Site->_missing_method() #12 homebase/hb/core/view/Action.php:41 Action->_call() #13 lib.framework/Controller/Controller.php:213 hb\core\view\Action->_call() #14 lib.framework/Controller/Controller.php:137 Controller::action() #15 vhosts/tele/telezor/www/index.php:2 Controller::dispatch() #16 {main}