public $query_string = '';
public $config = [];
public $page = [];
- public $pager = [];
- public $page_offset;
public $profile;
public $profile_uid;
public $user;
$this->module = 'home';
}
- // See if there is any page number information, and initialise pagination
- $this->pager['page'] = !empty($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
- $this->pager['itemspage'] = 50;
- $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
-
- if ($this->pager['start'] < 0) {
- $this->pager['start'] = 0;
- }
- $this->pager['total'] = 0;
-
// Detect mobile devices
$mobile_detect = new MobileDetect();
$this->is_mobile = $mobile_detect->isMobile();
return $this->urlPath;
}
- public function setPagerTotal($n)
- {
- $this->pager['total'] = intval($n);
- }
-
- public function setPagerItemsPage($n)
- {
- $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);
- $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
- }
-
- public function setPagerPage($n)
- {
- $this->pager['page'] = $n;
- $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
- }
-
/**
* Initializes App->page['htmlhead'].
*
$touch_icon = 'images/friendica-128.png';
}
- // get data wich is needed for infinite scroll on the network page
- $infinite_scroll = infinite_scroll_data($this->module);
-
Core\Addon::callHooks('head', $this->page['htmlhead']);
$tpl = get_markup_template('head.tpl');
'$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon,
- '$infinite_scroll' => $infinite_scroll,
'$block_public' => intval(Core\Config::get('system', 'block_public')),
'$stylesheets' => $this->stylesheets,
]) . $this->page['htmlhead'];
$redirectTo = $this->getBaseURL($ssl) . '/' . ltrim($toUrl, '/');
Core\System::externalRedirect($redirectTo);
}
+
+ /**
+ * Automatically redirects to relative or absolute URL
+ * Should only be used if it isn't clear if the URL is either internal or external
+ *
+ * @param string $toUrl The target URL
+ *
+ */
+ public function redirect($toUrl)
+ {
+ if (filter_var($toUrl, FILTER_VALIDATE_URL)) {
+ Core\System::externalRedirect($toUrl);
+ } else {
+ $this->internalRedirect($toUrl);
+ }
+ }
}