2016-03-28 16:29:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file view/theme/frio/php/frio_boot.php
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2017-04-30 06:01:26 +02:00
|
|
|
* @brief This file contains functions for page construction
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
*/
|
|
|
|
|
2017-04-30 06:07:00 +02:00
|
|
|
use Friendica\App;
|
2016-03-28 16:29:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Load page template in dependence of the template mode
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @todo Check if this is really needed.
|
|
|
|
*/
|
2017-01-09 13:06:08 +01:00
|
|
|
function load_page(App $a) {
|
2017-06-08 04:00:59 +02:00
|
|
|
if(isset($_GET["mode"]) && ($_GET["mode"] == "minimal")) {
|
2016-03-28 16:29:05 +02:00
|
|
|
require "view/theme/frio/minimal.php";
|
2017-06-08 04:00:59 +02:00
|
|
|
} elseif((isset($_GET["mode"]) && ($_GET["mode"] == "none"))) {
|
2016-05-15 13:41:37 +02:00
|
|
|
require "view/theme/frio/none.php";
|
2016-03-28 16:29:05 +02:00
|
|
|
} else {
|
|
|
|
$template = 'view/theme/' . current_theme() . '/'
|
|
|
|
. ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
|
|
|
|
if(file_exists($template))
|
|
|
|
require_once($template);
|
|
|
|
else
|
|
|
|
require_once(str_replace('theme/' . current_theme() . '/', '', $template));
|
|
|
|
}
|
|
|
|
|
2017-01-09 13:06:08 +01:00
|
|
|
|
2016-03-28 16:29:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Check if page is a modal page
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* This function checks if $_REQUEST['pagename'] is
|
|
|
|
* a defined in a $modalpages
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function is_modal() {
|
|
|
|
$is_modal = false;
|
|
|
|
$modalpages = get_modalpage_list();
|
|
|
|
|
|
|
|
foreach ($modalpages as $r => $value) {
|
|
|
|
if(strpos($_REQUEST['pagename'],$value) !== false) {
|
|
|
|
$is_modal = true;
|
|
|
|
}
|
|
|
|
}
|
2017-01-09 13:06:08 +01:00
|
|
|
|
2016-03-28 16:29:05 +02:00
|
|
|
return $is_modal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Array with modalpages
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* The array contains the page names of the pages
|
|
|
|
* which should displayed as modals
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @return array Pagenames as path
|
|
|
|
*/
|
|
|
|
function get_modalpage_list() {
|
|
|
|
//Arry of pages wich getting bootstrap modal dialogs
|
|
|
|
$modalpages = array('poke/',
|
|
|
|
'message/new',
|
|
|
|
'settings/oauth/add',
|
|
|
|
'events/new',
|
|
|
|
// 'fbrowser/image/'
|
|
|
|
);
|
|
|
|
|
|
|
|
return $modalpages;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Array with standard pages
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* The array contains the page names of the pages
|
|
|
|
* which should displayed as standard-page
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @return array Pagenames as path
|
|
|
|
*/
|
|
|
|
function get_standard_page_list() {
|
|
|
|
//Arry of pages wich getting the standard page template
|
|
|
|
$standardpages = array(//'profile',
|
|
|
|
// 'fbrowser/image/'
|
|
|
|
);
|
|
|
|
|
|
|
|
return $standardpages;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Check if page is standard page
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* This function checks if $_REQUEST['pagename'] is
|
|
|
|
* a defined $standardpages
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @param string $pagetitle Title of the actual page
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function is_standard_page($pagetitle) {
|
|
|
|
$is_standard_page = false;
|
|
|
|
$standardpages = get_standard_page_list();
|
|
|
|
|
|
|
|
foreach ($standardpages as $r => $value) {
|
|
|
|
if(strpos($pagetitle,$value) !== false) {
|
|
|
|
$is_standard_page = true;
|
|
|
|
}
|
|
|
|
}
|
2017-01-09 13:06:08 +01:00
|
|
|
|
2016-03-28 16:29:05 +02:00
|
|
|
return $is_standard_page;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @brief Get the typ of the page
|
2017-01-09 13:06:08 +01:00
|
|
|
*
|
2016-03-28 16:29:05 +02:00
|
|
|
* @param type $pagetitle
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function get_page_type($pagetitle) {
|
|
|
|
$page_type = "";
|
|
|
|
|
|
|
|
if(is_modal())
|
|
|
|
$page_type = "modal";
|
|
|
|
|
|
|
|
if(is_standard_page($pagetitle))
|
|
|
|
$page_type = "standard_page";
|
|
|
|
|
|
|
|
if($page_type)
|
|
|
|
return $page_type;
|
|
|
|
|
|
|
|
}
|