aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-10-20 16:47:58 -0700
committerfriendica <info@friendica.com>2014-10-20 16:47:58 -0700
commitcb15c73dae51c7001fa7277ef4d324645f72c5c3 (patch)
tree3e886a2884d6a6be6481ffcdce918d99c3594f5b
parentc909b8be060cb04479eba79232030e3da25410c6 (diff)
downloadvolse-hubzilla-cb15c73dae51c7001fa7277ef4d324645f72c5c3.tar.gz
volse-hubzilla-cb15c73dae51c7001fa7277ef4d324645f72c5c3.tar.bz2
volse-hubzilla-cb15c73dae51c7001fa7277ef4d324645f72c5c3.zip
move all theme initialisation to one place - just after calling module_init. Revert if there are serious issues, but please note the issues in as much detail as possible so we can work through them.
-rwxr-xr-xboot.php16
-rw-r--r--include/RedDAV/RedBrowser.php1
-rwxr-xr-xindex.php40
-rw-r--r--mod/page.php22
-rw-r--r--version.inc2
5 files changed, 62 insertions, 19 deletions
diff --git a/boot.php b/boot.php
index 14d0a61a5..abbf48636 100755
--- a/boot.php
+++ b/boot.php
@@ -1880,13 +1880,9 @@ function get_custom_nav(&$a,$navname) {
}
-function construct_page(&$a) {
-
+function load_pdl(&$a) {
require_once('include/comanche.php');
- // in case a page has overloaded a module, see if we already have a layout defined
- // otherwise, if a pdl file exists for this module, use it
-
if(! count($a->layout)) {
$n = 'mod_' . $a->module . '.pdl' ;
$u = comanche_get_channel_id();
@@ -1898,12 +1894,20 @@ function construct_page(&$a) {
comanche_parser($a,$s);
}
- $comanche = ((count($a->layout)) ? true : false);
+}
+
+
+
+function construct_page(&$a) {
+
/**
* Build the page - now that we have all the components
*/
+
+ $comanche = ((count($a->layout)) ? true : false);
+
require_once(theme_include('theme_init.php'));
$installing = false;
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index 6ec5c978d..21ea76aed 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -259,6 +259,7 @@ class RedBrowser extends DAV\Browser\Plugin {
$html .= $output;
get_app()->page['content'] = $html;
+ load_pdl(get_app());
construct_page(get_app());
}
diff --git a/index.php b/index.php
index 6c18cbcb8..3e5207f2b 100755
--- a/index.php
+++ b/index.php
@@ -242,14 +242,6 @@ if(strlen($a->module)) {
}
}
-/**
- * load current theme info
- */
-$theme_info_file = "view/theme/".current_theme()."/php/theme.php";
-if (file_exists($theme_info_file)){
- require_once($theme_info_file);
-}
-
/* initialise content region */
@@ -281,12 +273,44 @@ if($a->module_loaded) {
$a->page['page_title'] = $a->module;
$placeholder = '';
+ /**
+ * No theme has been specified when calling the module_init functions
+ * For this reason, please restrict the use of templates to those which
+ * do not provide any presentation details - as themes will not be able
+ * to over-ride them.
+ */
+
if(function_exists($a->module . '_init')) {
call_hooks($a->module . '_mod_init', $placeholder);
$func = $a->module . '_init';
$func($a);
}
+ /**
+ * Do all theme initialiasion here before calling any additional module functions.
+ * The module_init function may have changed the theme.
+ * Additionally any page with a Comanche template may alter the theme.
+ * So we'll check for those now.
+ */
+
+
+ /**
+ * In case a page has overloaded a module, see if we already have a layout defined
+ * otherwise, if a PDL file exists for this module, use it
+ * The member may have also created a customised PDL that's stored in the config
+ */
+
+ load_pdl($a);
+
+ /**
+ * load current theme info
+ */
+
+ $theme_info_file = "view/theme/".current_theme()."/php/theme.php";
+ if (file_exists($theme_info_file)){
+ require_once($theme_info_file);
+ }
+
if(function_exists(str_replace('-','_',current_theme()) . '_init')) {
$func = str_replace('-','_',current_theme()) . '_init';
$func($a);
diff --git a/mod/page.php b/mod/page.php
index b3f53a227..e8f17ebda 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -14,13 +14,11 @@ function page_init(&$a) {
if($a->profile['profile_uid'])
head_set_icon($a->profile['thumb']);
-}
-
+ // load the item here in the init function because we need to extract
+ // the page layout and initialise the correct theme.
-function page_content(&$a) {
-
$observer = $a->get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
@@ -97,11 +95,27 @@ function page_content(&$a) {
}
}
+ $a->data['webpage'] = $r;
+
+
+
+}
+
+
+
+
+function page_content(&$a) {
+
+ $r = $a->data['webpage'];
+ if(! $r)
+ return;
// logger('layout: ' . print_r($a->layout,true));
// Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so...
+ // I recommend we now get rid of this bit - it's quite a hack to work around... - mike
+
if ($perms['write_pages']) {
$chan = $a->channel['channel_id'];
$who = $channel_address;
diff --git a/version.inc b/version.inc
index 89d0ecd1c..5a2540b37 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-10-19.833
+2014-10-20.834