From 2cf4ac26fdde5da6a6845d6c0dd1bb485fee2706 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Dec 2015 12:26:41 -0800 Subject: log API improvements and queue optimisation for singleton networks --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1da56d07e..a3e35f63c 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H'); -define ( 'STD_VERSION', '1.0' ); +define ( 'STD_VERSION', '1.0.1' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 761afd029d97703f2f7609d546b7b5f3d257c601 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 Jan 2016 13:53:49 -0800 Subject: version roll --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index a3e35f63c..4c2cff09b 100755 --- a/boot.php +++ b/boot.php @@ -47,8 +47,8 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H'); -define ( 'STD_VERSION', '1.0.1' ); +define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); +define ( 'STD_VERSION', '1.1' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 100412267ad5d193d2131e3fa89090846267b72d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 7 Jan 2016 12:47:46 -0800 Subject: extra security headers, revert or fix if functionality is blocked --- boot.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4c2cff09b..152fb426b 100755 --- a/boot.php +++ b/boot.php @@ -874,6 +874,11 @@ class App { } } + function get_scheme() { + return $this->scheme; + } + + function get_hostname() { return $this->hostname; } @@ -2121,6 +2126,16 @@ function construct_page(&$a) { $profile = $a->profile; header("Content-type: text/html; charset=utf-8"); + if($a->get_scheme() === 'https') + header("Strict-Transport-Security: max-age=31536000"); + + header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"); + + if($a->config['system']['x_security_headers']) { + header("X-Frame-Options: SAMEORIGIN"); + header("X-Xss-Protection: 1; mode=block;"); + header("X-Content-Type-Options: nosniff"); + } require_once(theme_include( ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php' ) -- cgit v1.2.3 From 3c8818417798aaa5791f8581059883ad6431a0eb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 7 Jan 2016 14:06:51 -0800 Subject: optional support for public key pinning --- boot.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 152fb426b..f58709384 100755 --- a/boot.php +++ b/boot.php @@ -2126,6 +2126,9 @@ function construct_page(&$a) { $profile = $a->profile; header("Content-type: text/html; charset=utf-8"); + + // security headers - see https://securityheaders.io + if($a->get_scheme() === 'https') header("Strict-Transport-Security: max-age=31536000"); @@ -2137,6 +2140,10 @@ function construct_page(&$a) { header("X-Content-Type-Options: nosniff"); } + if($a->config['system']['public_key_pins']) { + header("Public-Key-Pins: " . $a->config['system']['public_key_pins']); + } + require_once(theme_include( ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php' ) ); -- cgit v1.2.3 From baedd253090e1129dfea8284ee6dc29649286b3b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 Jan 2016 15:43:08 -0800 Subject: 'auto channel creation' - if the corresponding config variable is set, create a channel when an account is created. Plugins can provide the necessary channel details (probably from an extended registration form). If no details are provided, a social (mostly public) channel will be created using the LHS of the email address and you will be directed to your channel page (unless email verification is required, in which case this step will be delayed until successful validation and login). If the reddress is already assigned a random name(1000-9999) reddress will be assigned. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f58709384..599514d20 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.1' ); +define ( 'STD_VERSION', '1.1.1' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 64753effd1cd47c43846e5bc8653180acd7c4bc9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 17:25:27 -0800 Subject: cover photo fetch and widget --- boot.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 599514d20..d184969d1 100755 --- a/boot.php +++ b/boot.php @@ -245,6 +245,21 @@ define ( 'PHOTO_COVER', 0x0010 ); define ( 'PHOTO_ADULT', 0x0008 ); define ( 'PHOTO_FLAG_OS', 0x4000 ); + +define ( 'PHOTO_RES_ORIG', 0 ); +define ( 'PHOTO_RES_1024', 1 ); // rectangular 1024 max width or height, floating height if not (4:3) +define ( 'PHOTO_RES_640', 2 ); // to accomodate SMBC vertical comic strips without scrunching the width +define ( 'PHOTO_RES_320', 3 ); // accordingly + +define ( 'PHOTO_RES_PROFILE_300', 4 ); // square 300 px +define ( 'PHOTO_RES_PROFILE_80', 5 ); // square 80 px +define ( 'PHOTO_RES_PROFILE_48', 6 ); // square 48 px + +define ( 'PHOTO_RES_COVER_1200', 7 ); // 1200w x 435h (2.75:1) +define ( 'PHOTO_RES_COVER_850', 8 ); // 850w x 310h +define ( 'PHOTO_RES_COVER_425', 9 ); // 425w x 160h + + /** * Menu types */ -- cgit v1.2.3 From f888548e0e722933e5b03b49fd5e19dd6e55743e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 20:51:59 -0800 Subject: issue with plugin loadable layouts --- boot.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d184969d1..fd309451f 100755 --- a/boot.php +++ b/boot.php @@ -2004,12 +2004,14 @@ function load_pdl(&$a) { $arr = array('module' => $a->module, 'layout' => ''); call_hooks('load_pdl',$arr); - $s = $arr['layout']; + $layout = $arr['layout']; $n = 'mod_' . $a->module . '.pdl' ; $u = comanche_get_channel_id(); if($u) $s = get_pconfig($u, 'system', $n); + if(! $s) + $s = $layout; if((! $s) && (($p = theme_include($n)) != '')) $s = @file_get_contents($p); -- cgit v1.2.3 From 63ee0daac51b8c04123479f2ac91e1762492896f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Jan 2016 10:42:44 +0100 Subject: provide more contact infos and update some protocol type definitions --- boot.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index fd309451f..da1ba2ac5 100755 --- a/boot.php +++ b/boot.php @@ -271,11 +271,11 @@ define ( 'MENU_BOOKMARK', 0x0002 ); * Network and protocol family types */ -define ( 'NETWORK_DFRN', 'dfrn'); // Friendica, Mistpark, other DFRN implementations -define ( 'NETWORK_ZOT', 'zot!'); // Zot! +define ( 'NETWORK_DFRN', 'friendica-over-diaspora'); // Friendica, Mistpark, other DFRN implementations +define ( 'NETWORK_ZOT', 'zot'); // Zot! define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-social, other OStatus implementations -define ( 'NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol -define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora +define ( 'NETWORK_FEED', 'rss'); // RSS/Atom feeds with no known "post/notify" protocol +define ( 'NETWORK_DIASPORA', 'diaspora'); // Diaspora define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP define ( 'NETWORK_MAIL2', 'mai2'); // extended IMAP/POP define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API -- cgit v1.2.3 From fe77ab4d71ed86d8c29a43ae2bc579a0db8b84b1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 15 Jan 2016 11:59:19 -0800 Subject: minor version roll --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index fd309451f..dd83ed6e2 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.1.1' ); +define ( 'STD_VERSION', '1.1.2' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 10ed334e8c81d1db4a506716b78ece13dc69266c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 17 Jan 2016 16:29:32 -0800 Subject: various issues from the forums --- boot.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b5a68b149..f6e35cf4e 100755 --- a/boot.php +++ b/boot.php @@ -998,7 +998,7 @@ class App { '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), - '$generator' => PLATFORM_NAME . ' ' . RED_VERSION, + '$generator' => get_platform_name() . ((get_project_version()) ? ' ' . get_project_version() : ''), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), @@ -2338,3 +2338,26 @@ function check_cron_broken() { set_config('system','lastpollcheck',datetime_convert()); return; } + + +function get_platform_name() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['platform_name']) + return $a->config['system']['platform_name']; + return PLATFORM_NAME; +} + +function get_project_version() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) + return ''; + return RED_VERSION; +} + +function get_update_version() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) + return ''; + return DB_UPDATE_VERSION; +} + -- cgit v1.2.3 From be83855acf2db7f4f55d4cb30878c67d53ca69b6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 17 Jan 2016 16:50:37 -0800 Subject: generalise the site icon --- boot.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f6e35cf4e..143d7de46 100755 --- a/boot.php +++ b/boot.php @@ -2361,3 +2361,18 @@ function get_update_version() { return DB_UPDATE_VERSION; } + +function get_notify_icon() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['email_notify_icon_url']) + return $a->config['system']['email_notify_icon_url']; + return z_root() . '/images/hz-white-32.png'; +} + +function get_site_icon() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['site_icon_url']) + return $a->config['system']['site_icon_url']; + return z_root() . '/images/hz-32.png'; +} + -- cgit v1.2.3 From c15e3de63759602bac87a57142a73db1166bc5ec Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Jan 2016 15:21:03 -0800 Subject: hook changed, up the std_version --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 143d7de46..4db0e56a5 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.1.2' ); +define ( 'STD_VERSION', '1.1.3' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From dff2cdc650cd3e0fc706640c01492fce2d9640f7 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Thu, 21 Jan 2016 21:39:43 -0500 Subject: Added more ActivityStreams schema support to boot.php for games --- boot.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b5a68b149..57d239bec 100755 --- a/boot.php +++ b/boot.php @@ -497,6 +497,11 @@ define ( 'ACTIVITY_POST', NAMESPACE_ACTIVITY_SCHEMA . 'post' ); define ( 'ACTIVITY_UPDATE', NAMESPACE_ACTIVITY_SCHEMA . 'update' ); define ( 'ACTIVITY_TAG', NAMESPACE_ACTIVITY_SCHEMA . 'tag' ); define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' ); +define ( 'ACTIVITY_CREATE', NAMESPACE_ACTIVITY_SCHEMA . 'create' ); +define ( 'ACTIVITY_WIN', NAMESPACE_ACTIVITY_SCHEMA . 'win' ); +define ( 'ACTIVITY_LOSE', NAMESPACE_ACTIVITY_SCHEMA . 'lose' ); +define ( 'ACTIVITY_TIE', NAMESPACE_ACTIVITY_SCHEMA . 'tie' ); +define ( 'ACTIVITY_COMPLETE', NAMESPACE_ACTIVITY_SCHEMA . 'complete' ); define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' ); define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' ); @@ -509,6 +514,7 @@ define ( 'ACTIVITY_OBJ_P_PHOTO', NAMESPACE_ACTIVITY_SCHEMA . 'profile-photo' ); define ( 'ACTIVITY_OBJ_ALBUM', NAMESPACE_ACTIVITY_SCHEMA . 'photo-album' ); define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' ); define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' ); +define ( 'ACTIVITY_OBJ_GAME', NAMESPACE_ACTIVITY_SCHEMA . 'game' ); define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_ZOT . '/activity/tagterm' ); define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_ZOT . '/activity/profile' ); define ( 'ACTIVITY_OBJ_THING', NAMESPACE_ZOT . '/activity/thing' ); -- cgit v1.2.3 From 7b73a689e1b8bc7de96b30f8080d6a7fb479e7ae Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 23 Jan 2016 16:25:38 -0800 Subject: provide option to use exec in proc_run --- boot.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index bb4bc977d..9d80eedb4 100755 --- a/boot.php +++ b/boot.php @@ -1723,8 +1723,12 @@ function proc_run($cmd){ $cmd = "cmd /c start \"title\" /D \"$cwd\" /b $cmdline"; proc_close(proc_open($cmd, array(), $foo)); } - else - proc_close(proc_open($cmdline ." &", array(), $foo)); + else { + if(get_config('system','proc_run_use_exec')) + exec($cmdline . ' > /dev/null &'); + else + proc_close(proc_open($cmdline ." &", array(), $foo)); + } } /** -- cgit v1.2.3 From 0db2fe6e39cca8eda1d2f53b3715a67e1bce4c5c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 13:53:18 -0800 Subject: remote delegation issue when already logged in with different account on same site. --- boot.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9d80eedb4..d6c02ecc0 100755 --- a/boot.php +++ b/boot.php @@ -1553,6 +1553,10 @@ function goaway($s) { * @return int|bool account_id or false */ function get_account_id() { + + if(intval($_SESSION['account_id'])) + return intval($_SESSION['account_id']); + if(get_app()->account) return intval(get_app()->account['account_id']); -- cgit v1.2.3 From baed7d339ee0d5139fe1c93691a4225796e7e08c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 15:20:25 -0800 Subject: make exec the default for proc_run - use system.use_proc_open to use proc_open. Also prohibit delegated channels from manually invoking new_channel under the delegated account. --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d6c02ecc0..b80b76a8a 100755 --- a/boot.php +++ b/boot.php @@ -1728,10 +1728,10 @@ function proc_run($cmd){ proc_close(proc_open($cmd, array(), $foo)); } else { - if(get_config('system','proc_run_use_exec')) - exec($cmdline . ' > /dev/null &'); - else + if(get_config('system','use_proc_open')) proc_close(proc_open($cmdline ." &", array(), $foo)); + else + exec($cmdline . ' > /dev/null &'); } } -- cgit v1.2.3 From d83b907cdcb4d7a7638b2be9a8024a43f6012827 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 23:44:15 -0800 Subject: rename collections to privacy groups --- boot.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b80b76a8a..76baba361 100755 --- a/boot.php +++ b/boot.php @@ -575,6 +575,9 @@ define ( 'ITEM_TYPE_WEBPAGE', 3 ); define ( 'ITEM_TYPE_BUG', 4 ); define ( 'ITEM_TYPE_DOC', 5 ); +define ( 'ITEM_IS_STICKY', 1000 ); + + define ( 'DBTYPE_MYSQL', 0 ); define ( 'DBTYPE_POSTGRES', 1 ); -- cgit v1.2.3 From c214692f661488df30eaf00ca85da94a5ecc1e14 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Jan 2016 17:06:13 -0800 Subject: add peer filtering to all .well-known services --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 76baba361..4b49cacb5 100755 --- a/boot.php +++ b/boot.php @@ -863,7 +863,7 @@ class App { && array_key_exists('baseurl',$this->config['system']) && strlen($this->config['system']['baseurl'])) { $url = $this->config['system']['baseurl']; - + $url = trim($url,'\\/'); return $url; } @@ -881,6 +881,7 @@ class App { && array_key_exists('baseurl',$this->config['system']) && strlen($this->config['system']['baseurl'])) { $url = $this->config['system']['baseurl']; + $url = trim($url,'\\/'); } $parsed = @parse_url($url); -- cgit v1.2.3 From a341c889b751055e90eba9b7a14da5b7cd0e8032 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 Jan 2016 15:55:27 -0800 Subject: add oembed provider for photos --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4b49cacb5..8b5e75326 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.1.3' ); +define ( 'STD_VERSION', '1.1.4' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From b0e098bb686800734a07984d9a470d893de231cd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 Jan 2016 19:16:32 -0800 Subject: rev update --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 8b5e75326..238935da3 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.1.4' ); +define ( 'STD_VERSION', '1.2' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 425089524373137e11d3691e7efdce0fb89281c8 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 4 Feb 2016 20:38:22 -0800 Subject: make strict transport security header optional --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 238935da3..cb595e0ef 100755 --- a/boot.php +++ b/boot.php @@ -2164,7 +2164,7 @@ function construct_page(&$a) { // security headers - see https://securityheaders.io - if($a->get_scheme() === 'https') + if($a->get_scheme() === 'https' && $a->config['system']['transport_security_header']) header("Strict-Transport-Security: max-age=31536000"); header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"); -- cgit v1.2.3 From b4e3cd000f9919ce459d32e21e5ca121338a6c24 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 5 Feb 2016 00:06:35 -0800 Subject: rev update --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cb595e0ef..1628dd0fd 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2' ); +define ( 'STD_VERSION', '1.2.1' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From d8e6fd5df0713ef4f52277944d15fd8230deec81 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 7 Feb 2016 18:11:10 -0800 Subject: provide get_server_role() to abstract different roles and capabilities --- boot.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1628dd0fd..1f214c400 100755 --- a/boot.php +++ b/boot.php @@ -2394,3 +2394,9 @@ function get_site_icon() { return z_root() . '/images/hz-32.png'; } + +function get_server_role() { + if(UNO) + return 'basic'; + return 'advanced'; +} -- cgit v1.2.3 From a14b87baf25e8a4747318efa7a7b52ad04966af7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 14:48:11 -0800 Subject: make yet another recommended security header optional - this time because of piwik. Personally I think if you want to track people you really don't understand this project and its history, but whatever.... --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1f214c400..ce26f3a09 100755 --- a/boot.php +++ b/boot.php @@ -2167,7 +2167,8 @@ function construct_page(&$a) { if($a->get_scheme() === 'https' && $a->config['system']['transport_security_header']) header("Strict-Transport-Security: max-age=31536000"); - header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"); + if($a->config['system']['content_security_policy']) + header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"); if($a->config['system']['x_security_headers']) { header("X-Frame-Options: SAMEORIGIN"); -- cgit v1.2.3 From 315ce6d880855444c0cea683810b9b2fbd80c0d3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 18:16:42 -0800 Subject: lots more zcard tweaks --- boot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index ce26f3a09..cc46cf870 100755 --- a/boot.php +++ b/boot.php @@ -650,7 +650,6 @@ class App { private $perms = null; // observer permissions private $widgets = array(); // widgets for this page - public $groups; public $language; public $module_loaded = false; -- cgit v1.2.3 From d31d3df4eafcc3e80f120fc4b23ced2e2ed4969d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 10 Feb 2016 19:12:28 -0800 Subject: hook changes to support pubsubhubbub --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cc46cf870..cbc8f633a 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2.1' ); +define ( 'STD_VERSION', '1.2.2' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1161 ); -- cgit v1.2.3 From 564a5ea4d5fd3ea3d7f1dc3211821db93f1cf660 Mon Sep 17 00:00:00 2001 From: royalterra Date: Thu, 11 Feb 2016 22:21:03 +0000 Subject: Update boot.php Failback Server blablanet.es This HUB is running us fallback many months us fallback server --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cbc8f633a..9729939e1 100755 --- a/boot.php +++ b/boot.php @@ -85,6 +85,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://hubzilla.zottel.net', 'https://hub.pixelbits.de', 'https://my.federated.social', + 'https://blablanet.es', 'https://hubzilla.nl' ); -- cgit v1.2.3 From 689a6dc0854650249d32d0b396141902008b5538 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Feb 2016 11:12:47 +0100 Subject: https://blablanet.es/siteinfo/json reports itself as directory_mode DIRECTORY_MODE_PRIMARY. AFAIK this should not be the case as we can only have one primary per realm. --- boot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9729939e1..cbc8f633a 100755 --- a/boot.php +++ b/boot.php @@ -85,7 +85,6 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://hubzilla.zottel.net', 'https://hub.pixelbits.de', 'https://my.federated.social', - 'https://blablanet.es', 'https://hubzilla.nl' ); -- cgit v1.2.3 From ddefe3b3aca89f6933c200229b3c6647bf6f2f4b Mon Sep 17 00:00:00 2001 From: royalterra Date: Sat, 13 Feb 2016 15:16:09 +0000 Subject: add https://blablanet.es faillback server {"version":"2016-02-12.1307H","version_tag":"1.2.2","server_role":"advanced","commit":"dd2d123","url":"https:\/\/blablanet.es","plugins":["b2tbtn","bookmarker","chess","dfedfix","diaspora","diaspost","dirstats","donar","jappixmini","libertree","ljpost","mailhost","mchat","metatag","noticias","pgpkey","pumpio","sendzid","smiley_pack","smileybutton","statistics","statistics_json","status","statusnet","twitter","wholikesme","wppost","xmpp","xmppac"],"register_policy":"REGISTER_OPEN","invitation_only":0,"directory_mode":"DIRECTORY_MODE_SECONDARY","language":"es","rss_connections":1,"expiration":0,"default_service_restrictions":false,"locked_features":[],"admin":[{"name":"BlaBlanet-ES","address":"blablanet-es@blablanet.es","channel":"https:\/\/blablanet.es\/channel\/blablanet-es"}],"site_name":"BlablaNet Espa\u00f1a donde est\u00e1n tus amigos, Tu Red Social","platform":"BlaBlaNet","dbdriver":"mysqli","lastpoll":"2016-02-13 14:39:07","info":"","channels_total":29,"channels_active_halfyear":26,"channels_active_monthly":11,"local_posts":6600,"hide_in_statistics":0} --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cbc8f633a..9728f1168 100755 --- a/boot.php +++ b/boot.php @@ -85,7 +85,8 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://hubzilla.zottel.net', 'https://hub.pixelbits.de', 'https://my.federated.social', - 'https://hubzilla.nl' + 'https://hubzilla.nl', + 'https://blablanet.es' ); -- cgit v1.2.3 From ddbe3c7426a551420bb6ead09984333e956b3a58 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 17 Feb 2016 12:32:12 +0100 Subject: make always preload images before rendering the page a display setting --- boot.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9728f1168..1471aa781 100755 --- a/boot.php +++ b/boot.php @@ -992,6 +992,10 @@ class App { if ($user_scalable === false) $user_scalable = 1; + $preload_images = ((local_channel()) ? get_pconfig(local_channel(),'system','preload_images') : 0); + if ($preload_images === false) + $preload_images = 0; + $interval = ((local_channel()) ? get_pconfig(local_channel(),'system','update_interval') : 80000); if($interval < 10000) $interval = 80000; @@ -1005,6 +1009,7 @@ class App { */ $tpl = get_markup_template('head.tpl'); $this->page['htmlhead'] = replace_macros($tpl, array( + '$preload_images' => $preload_images, '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), -- cgit v1.2.3 From 4da7fcb41dd97669305551914964df57ffc22ee7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 17 Feb 2016 16:24:26 -0800 Subject: schema updates for iconfig --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1471aa781..b5b4aad4a 100755 --- a/boot.php +++ b/boot.php @@ -51,7 +51,7 @@ define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); define ( 'STD_VERSION', '1.2.2' ); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1161 ); +define ( 'DB_UPDATE_VERSION', 1162 ); /** -- cgit v1.2.3 From 879bc7192713b1411865058fad69b9ff5fdf860a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 17 Feb 2016 17:29:06 -0800 Subject: this qualifies as an interface change --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b5b4aad4a..905f05ef6 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2.2' ); +define ( 'STD_VERSION', '1.2.3' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1162 ); -- cgit v1.2.3 From 76bf892f9f52c0deee313a89929185e332877f85 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 18 Feb 2016 00:20:08 -0800 Subject: iconfig - add sharing variable --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 905f05ef6..20f07c452 100755 --- a/boot.php +++ b/boot.php @@ -51,7 +51,7 @@ define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); define ( 'STD_VERSION', '1.2.3' ); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1162 ); +define ( 'DB_UPDATE_VERSION', 1163 ); /** -- cgit v1.2.3 From 342fda94e4162634eeb67c18c1d284e7d78f217f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 18 Feb 2016 15:24:58 -0800 Subject: Provide Zotlabs\Project and System class for querying details about the project/version info. Move these out of /boot.php --- boot.php | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 20f07c452..29f1788b6 100755 --- a/boot.php +++ b/boot.php @@ -45,6 +45,7 @@ require_once('include/Contact.php'); require_once('include/account.php'); require_once('include/AccessList.php'); +require_once('Zotlabs/Project/System.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); @@ -1013,7 +1014,7 @@ class App { '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), - '$generator' => get_platform_name() . ((get_project_version()) ? ' ' . get_project_version() : ''), + '$generator' => Zotlabs\Project\System::get_platform_name() . ((Zotlabs\Project\System::get_project_version()) ? ' ' . Zotlabs\Project\System::get_project_version() : ''), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), @@ -2364,45 +2365,3 @@ function check_cron_broken() { } -function get_platform_name() { - $a = get_app(); - if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['platform_name']) - return $a->config['system']['platform_name']; - return PLATFORM_NAME; -} - -function get_project_version() { - $a = get_app(); - if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) - return ''; - return RED_VERSION; -} - -function get_update_version() { - $a = get_app(); - if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) - return ''; - return DB_UPDATE_VERSION; -} - - -function get_notify_icon() { - $a = get_app(); - if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['email_notify_icon_url']) - return $a->config['system']['email_notify_icon_url']; - return z_root() . '/images/hz-white-32.png'; -} - -function get_site_icon() { - $a = get_app(); - if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['site_icon_url']) - return $a->config['system']['site_icon_url']; - return z_root() . '/images/hz-32.png'; -} - - -function get_server_role() { - if(UNO) - return 'basic'; - return 'advanced'; -} -- cgit v1.2.3 From 5a7b994e59306519574ce7aaa004f08d7d47ee05 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 18 Feb 2016 19:32:06 -0800 Subject: siteinfo regression with Zotlabs\Project - add an autoloader --- boot.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 29f1788b6..4f58c4139 100755 --- a/boot.php +++ b/boot.php @@ -45,7 +45,6 @@ require_once('include/Contact.php'); require_once('include/account.php'); require_once('include/AccessList.php'); -require_once('Zotlabs/Project/System.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); @@ -625,6 +624,21 @@ function startup() { } } + +class ZotlabsAutoloader { + static public function loader($className) { + $filename = str_replace('\\', '/', $className) . ".php"; + if (file_exists($filename)) { + include($filename); + if (class_exists($className)) { + return TRUE; + } + } + return FALSE; + } +} + + /** * class: App * @@ -855,6 +869,9 @@ class App { $this->register_template_engine($k); } } + + spl_autoload_register('ZotlabsAutoloader::loader'); + } function get_baseurl($ssl = false) { -- cgit v1.2.3 From 1db3409f36f408bfc49816e1fab3df4b53b8f19e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 19 Feb 2016 16:19:15 -0800 Subject: add router class --- boot.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4f58c4139..2dc542d28 100755 --- a/boot.php +++ b/boot.php @@ -1420,6 +1420,9 @@ function check_config(&$a) { } load_hooks(); + + check_cron_broken(); + } -- cgit v1.2.3 From a9711895cf254a0ca34b1e3f7c8e75bb832e6973 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 20 Feb 2016 19:39:54 +1100 Subject: move accesslist class to namespace --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2dc542d28..03d81b360 100755 --- a/boot.php +++ b/boot.php @@ -43,7 +43,7 @@ require_once('include/taxonomy.php'); require_once('include/identity.php'); require_once('include/Contact.php'); require_once('include/account.php'); -require_once('include/AccessList.php'); + define ( 'PLATFORM_NAME', 'hubzilla' ); -- cgit v1.2.3 From dfbe2eaf9856140de84f4d891fd442cdd6872545 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 20 Feb 2016 00:49:37 -0800 Subject: Revert "move accesslist class to namespace" This reverts commit a9711895cf254a0ca34b1e3f7c8e75bb832e6973. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 03d81b360..2dc542d28 100755 --- a/boot.php +++ b/boot.php @@ -43,7 +43,7 @@ require_once('include/taxonomy.php'); require_once('include/identity.php'); require_once('include/Contact.php'); require_once('include/account.php'); - +require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -- cgit v1.2.3 From f1564b4cff5a584d37b12000f68014df49e683d9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 21 Feb 2016 16:49:49 -0800 Subject: retry the move of AccessList to composer format (one or more third-party plugins will likely break as a result) --- boot.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2dc542d28..f1c7d8951 100755 --- a/boot.php +++ b/boot.php @@ -43,12 +43,11 @@ require_once('include/taxonomy.php'); require_once('include/identity.php'); require_once('include/Contact.php'); require_once('include/account.php'); -require_once('include/AccessList.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2.3' ); +define ( 'STD_VERSION', '1.2.4' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1163 ); -- cgit v1.2.3 From 6300f47cdcd921141b8f98b71d373d53aa3d80f2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 24 Feb 2016 16:59:50 -0800 Subject: schema change to support channel move (a completely different operation than channel clone) --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f1c7d8951..7610f16d8 100755 --- a/boot.php +++ b/boot.php @@ -50,7 +50,7 @@ define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); define ( 'STD_VERSION', '1.2.4' ); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1163 ); +define ( 'DB_UPDATE_VERSION', 1164 ); /** -- cgit v1.2.3 From be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 29 Feb 2016 19:31:52 -0800 Subject: abconfig --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 7610f16d8..2a3a3d062 100755 --- a/boot.php +++ b/boot.php @@ -47,10 +47,10 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2.4' ); +define ( 'STD_VERSION', '1.2.5' ); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1164 ); +define ( 'DB_UPDATE_VERSION', 1165 ); /** -- cgit v1.2.3 From d5db25808a0847e09ee3735faeac3552c722e0ae Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Mar 2016 15:03:53 -0800 Subject: Facebook scraper "OpenGraph" support; modules will need to set the required fields (type, image, url) as well as any desired optional or type specific fields. We will set the title during pagebuild. --- boot.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2a3a3d062..3581b94ee 100755 --- a/boot.php +++ b/boot.php @@ -753,6 +753,7 @@ class App { private $baseurl; + private $OG; /** * App constructor. @@ -767,6 +768,7 @@ class App { $this->query_string = ''; + startup(); set_include_path( @@ -871,6 +873,9 @@ class App { spl_autoload_register('ZotlabsAutoloader::loader'); + $this->OG = new Zotlabs\Web\OpenGraph(); + + } function get_baseurl($ssl = false) { @@ -1019,6 +1024,7 @@ class App { if(! x($this->page,'title')) $this->page['title'] = $this->config['system']['sitename']; + $this->OG->set('og:title',$this->page['title']); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it @@ -1031,6 +1037,7 @@ class App { '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), '$generator' => Zotlabs\Project\System::get_platform_name() . ((Zotlabs\Project\System::get_project_version()) ? ' ' . Zotlabs\Project\System::get_project_version() : ''), + '$metas' => $this->OG->get(), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), -- cgit v1.2.3 From 76467b5a35111c44ff539146ab0810118b42dc70 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Mar 2016 15:11:11 -0800 Subject: allow modules/addons to override the og:title field --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 3581b94ee..46f716365 100755 --- a/boot.php +++ b/boot.php @@ -874,8 +874,6 @@ class App { spl_autoload_register('ZotlabsAutoloader::loader'); $this->OG = new Zotlabs\Web\OpenGraph(); - - } function get_baseurl($ssl = false) { @@ -1024,7 +1022,9 @@ class App { if(! x($this->page,'title')) $this->page['title'] = $this->config['system']['sitename']; - $this->OG->set('og:title',$this->page['title']); + + if(! $this->OG->get_field('og:title')) + $this->OG->set('og:title',$this->page['title']); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it -- cgit v1.2.3 From 1258f9bb2114bd4a909f623a7519ba446bf8da0d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 8 Mar 2016 16:06:58 -0800 Subject: turn 'OpenGraph' into a more general purpose HTTP meta facility for setting any meta header --- boot.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 46f716365..c89ffc9ad 100755 --- a/boot.php +++ b/boot.php @@ -753,7 +753,7 @@ class App { private $baseurl; - private $OG; + private $meta; /** * App constructor. @@ -873,7 +873,7 @@ class App { spl_autoload_register('ZotlabsAutoloader::loader'); - $this->OG = new Zotlabs\Web\OpenGraph(); + $this->meta= new Zotlabs\Web\HttpMeta(); } function get_baseurl($ssl = false) { @@ -1023,8 +1023,8 @@ class App { if(! x($this->page,'title')) $this->page['title'] = $this->config['system']['sitename']; - if(! $this->OG->get_field('og:title')) - $this->OG->set('og:title',$this->page['title']); + if(! $this->meta->get_field('og:title')) + $this->meta->set('og:title',$this->page['title']); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it @@ -1037,7 +1037,7 @@ class App { '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), '$generator' => Zotlabs\Project\System::get_platform_name() . ((Zotlabs\Project\System::get_project_version()) ? ' ' . Zotlabs\Project\System::get_project_version() : ''), - '$metas' => $this->OG->get(), + '$metas' => $this->meta->get(), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), -- cgit v1.2.3 From cf4dc2caa82c9d03ac667feed5f5671510e0e00a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 8 Mar 2016 16:21:35 -0800 Subject: move "generator" to HttpMeta --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index c89ffc9ad..37374ef4c 100755 --- a/boot.php +++ b/boot.php @@ -1026,6 +1026,8 @@ class App { if(! $this->meta->get_field('og:title')) $this->meta->set('og:title',$this->page['title']); + $this->meta->set('generator', Zotlabs\Project\System::get_platform_name()); + /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it * being first @@ -1036,7 +1038,6 @@ class App { '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), - '$generator' => Zotlabs\Project\System::get_platform_name() . ((Zotlabs\Project\System::get_project_version()) ? ' ' . Zotlabs\Project\System::get_project_version() : ''), '$metas' => $this->meta->get(), '$update_interval' => $interval, '$icon' => head_get_icon(), -- cgit v1.2.3 From 14e55e8bd60939d6a41bd9434cd265daaadd4197 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 9 Mar 2016 13:06:24 +0100 Subject: should have probably done that on tag release --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 37374ef4c..1b593402b 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.2.5' ); +define ( 'STD_VERSION', '1.3.0' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1165 ); -- cgit v1.2.3 From b6ae2bff01f8a4dfc057ef2971b3d988b1028b3e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 17 Mar 2016 18:42:32 -0700 Subject: change rev --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1b593402b..feed4fc8e 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.3.0' ); +define ( 'STD_VERSION', '1.3.1' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1165 ); -- cgit v1.2.3 From 77094f8d2bffa70c9e95518b9883f8752304102c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 19 Mar 2016 16:17:19 -0700 Subject: make the admin side menu extensible and provide a hook for a channel "move" operation that federation plugins might use to re-establish connections after a channel move. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index feed4fc8e..4aba36400 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.3.1' ); +define ( 'STD_VERSION', '1.3.2' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1165 ); -- cgit v1.2.3 From 51a840f46a71800c5ce8111dacc2c4e1bbbe0b1a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 21 Mar 2016 22:02:18 -0700 Subject: update network_to_name (reserve DFRN for future use) --- boot.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4aba36400..4dcd4bc15 100755 --- a/boot.php +++ b/boot.php @@ -271,9 +271,11 @@ define ( 'MENU_BOOKMARK', 0x0002 ); * Network and protocol family types */ -define ( 'NETWORK_DFRN', 'friendica-over-diaspora'); // Friendica, Mistpark, other DFRN implementations +define ( 'NETWORK_FRND', 'friendica-over-diaspora'); // Friendica, Mistpark, other DFRN implementations +define ( 'NETWORK_DFRN', 'dfrn'); // Friendica, Mistpark, other DFRN implementations define ( 'NETWORK_ZOT', 'zot'); // Zot! define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-social, other OStatus implementations +define ( 'NETWORK_GNUSOCIAL', 'gnusoc'); // status.net, identi.ca, GNU-social, other OStatus implementations define ( 'NETWORK_FEED', 'rss'); // RSS/Atom feeds with no known "post/notify" protocol define ( 'NETWORK_DIASPORA', 'diaspora'); // Diaspora define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP -- cgit v1.2.3 From 4148211086ff53dfb6fb4e969fd067389bcfef29 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 18:37:37 -0700 Subject: change primary directory --- boot.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4dcd4bc15..e52950b86 100755 --- a/boot.php +++ b/boot.php @@ -76,10 +76,9 @@ define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub // point to go out and find the rest of the world. define ( 'DIRECTORY_REALM', 'RED_GLOBAL'); -define ( 'DIRECTORY_FALLBACK_MASTER', 'https://zothub.com'); +define ( 'DIRECTORY_FALLBACK_MASTER', 'https://hubzilla.site'); $DIRECTORY_FALLBACK_SERVERS = array( - 'https://zothub.com', 'https://hubzilla.site', 'https://hubzilla.zottel.net', 'https://hub.pixelbits.de', -- cgit v1.2.3 From 1cd3b4182595b838a535dd6b6990251db05d49e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 22:13:24 -0700 Subject: deprecate $a->get_baseurl() --- boot.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index e52950b86..9b127aa8f 100755 --- a/boot.php +++ b/boot.php @@ -1206,7 +1206,7 @@ function clean_urls() { function z_path() { global $a; - $base = $a->get_baseurl(); + $base = z_root(); if(! clean_urls()) $base .= '/?q='; @@ -1293,7 +1293,7 @@ function check_config(&$a) { // This will actually set the url to the one stored in .htconfig, and ignore what // we're passing - unless we are installing and it has never been set. - $a->set_baseurl($a->get_baseurl()); + $a->set_baseurl(z_root()); // Make sure each site has a system channel. This is now created on install // so we just need to keep this around a couple of weeks until the hubs that @@ -1355,12 +1355,12 @@ function check_config(&$a) { $email_tpl = get_intltext_template("update_fail_eml.tpl"); $email_msg = replace_macros($email_tpl, array( '$sitename' => $a->config['system']['sitename'], - '$siteurl' => $a->get_baseurl(), + '$siteurl' => z_root(), '$update' => $x, '$error' => sprintf( t('Update %s failed. See error logs.'), $x) )); - $subject = email_header_encode(sprintf(t('Update Error at %s'), $a->get_baseurl())); + $subject = email_header_encode(sprintf(t('Update Error at %s'), z_root())); mail($a->config['system']['admin_email'], $subject, $email_msg, 'From: Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n" @@ -1535,7 +1535,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { 'link' => (($register) ? $reglink : 'pubsites') ); - $dest_url = $a->get_baseurl(true) . '/' . $a->query_string; + $dest_url = z_root() . '/' . $a->query_string; if(local_channel()) { $tpl = get_markup_template("logout.tpl"); @@ -2177,10 +2177,10 @@ function construct_page(&$a) { if($a->is_mobile || $a->is_tablet) { if(isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) { - $link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL(); + $link = z_root() . '/toggle_mobile?f=&address=' . curPageURL(); } else { - $link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL(); + $link = z_root() . '/toggle_mobile?f=&off=1&address=' . curPageURL(); } if ((isset($_SESSION) && $_SESSION['mobile_theme'] !='' && $_SESSION['mobile_theme'] !='---' ) || (isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme']))) { @@ -2338,7 +2338,7 @@ function cert_bad_email() { $email_tpl = get_intltext_template("cert_bad_eml.tpl"); $email_msg = replace_macros($email_tpl, array( '$sitename' => $a->config['system']['sitename'], - '$siteurl' => $a->get_baseurl(), + '$siteurl' => z_root(), '$error' => t('Website SSL certificate is not valid. Please correct.') )); @@ -2378,7 +2378,7 @@ function check_cron_broken() { $email_tpl = get_intltext_template("cron_bad_eml.tpl"); $email_msg = replace_macros($email_tpl, array( '$sitename' => $a->config['system']['sitename'], - '$siteurl' => $a->get_baseurl(), + '$siteurl' => z_root(), '$error' => t('Cron/Scheduled tasks not running.'), '$lastdate' => (($d)? $d : t('never')) )); -- cgit v1.2.3 From 256c228efd249f2ce93405db8e36f52030aa4876 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 13:00:04 -0700 Subject: initial conversion to static app class --- boot.php | 402 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 202 insertions(+), 200 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9b127aa8f..bf30031bc 100755 --- a/boot.php +++ b/boot.php @@ -653,61 +653,63 @@ class ZotlabsAutoloader { */ class App { - public $install = false; // true if we are installing the software - - public $account = null; // account record of the logged-in account - public $channel = null; // channel record of the current channel of the logged-in account - public $observer = null; // xchan record of the page observer - public $profile_uid = 0; // If applicable, the channel_id of the "page owner" - public $poi = null; // "person of interest", generally a referenced connection - private $oauth_key = null; // consumer_id of oauth request, if used - public $layout = array(); // Comanche parsed template - public $pdl = null; // Comanche page description - private $perms = null; // observer permissions - private $widgets = array(); // widgets for this page - - public $groups; - public $language; - public $module_loaded = false; - public $query_string; - public $config; // config cache - public $page; - public $profile; - public $user; - public $cid; - public $contact; - public $contacts; - public $content; - public $data = array(); - public $error = false; - public $cmd; - public $argv; - public $argc; - public $module; - public $pager; - public $strings; - public $hooks; - public $timezone; - public $interactive = true; - public $plugins; - private $apps = array(); - public $identities; - public $css_sources = array(); - public $js_sources = array(); - public $theme_info = array(); - public $is_sys = false; - public $nav_sel; - - public $category; + public static $install = false; // true if we are installing the software + + public static $account = null; // account record of the logged-in account + public static $channel = null; // channel record of the current channel of the logged-in account + public static $observer = null; // xchan record of the page observer + public static $profile_uid = 0; // If applicable, the channel_id of the "page owner" + public static $poi = null; // "person of interest", generally a referenced connection + private static $oauth_key = null; // consumer_id of oauth request, if used + public static $layout = array(); // Comanche parsed template + public static $pdl = null; // Comanche page description + private static $perms = null; // observer permissions + private static $widgets = array(); // widgets for this page + + public static $groups; + public static $language; + public static $module_loaded = false; + public static $query_string; + public static $config; // config cache + public static $page; + public static $profile; + public static $user; + public static $cid; + public static $contact; + public static $contacts; + public static $content; + public static $data = array(); + public static $error = false; + public static $cmd; + public static $argv; + public static $argc; + public static $module; + public static $pager; + public static $strings; + public static $hooks; + public static $timezone; + public static $interactive = true; + public static $plugins; + private static $apps = array(); + public static $identities; + public static $css_sources = array(); + public static $js_sources = array(); + public static $theme_info = array(); + public static $is_sys = false; + public static $nav_sel; + public static $is_mobile = false; + public static $is_tablet = false; + + public static $category; // Allow themes to control internal parameters // by changing App values in theme.php - public $sourcename = ''; - public $videowidth = 425; - public $videoheight = 350; - public $force_max_items = 0; - public $theme_thread_allow = true; + public static $sourcename = ''; + public static $videowidth = 425; + public static $videoheight = 350; + public static $force_max_items = 0; + public static $theme_thread_allow = true; /** * @brief An array for all theme-controllable parameters @@ -715,7 +717,7 @@ class App { * Mostly unimplemented yet. Only options 'template_engine' and * beyond are used. */ - private $theme = array( + private static $theme = array( 'sourcename' => '', 'videowidth' => 425, 'videoheight' => 350, @@ -728,33 +730,33 @@ class App { /** * @brief An array of registered template engines ('name'=>'class name') */ - public $template_engines = array(); + public static $template_engines = array(); /** * @brief An array of instanced template engines ('name'=>'instance') */ - public $template_engine_instance = array(); + public static $template_engine_instance = array(); - private $ldelim = array( + private static $ldelim = array( 'internal' => '', 'smarty3' => '{{' ); - private $rdelim = array( + private static $rdelim = array( 'internal' => '', 'smarty3' => '}}' ); // These represent the URL which was used to access the page - private $scheme; - private $hostname; - private $path; + private static $scheme; + private static $hostname; + private static $path; // This is our standardised URL - regardless of what was used // to access the page - private $baseurl; + private static $baseurl; - private $meta; + private static $meta; /** * App constructor. @@ -763,11 +765,11 @@ class App { // we'll reset this after we read our config file date_default_timezone_set('UTC'); - $this->config = array('system'=>array()); - $this->page = array(); - $this->pager= array(); + self::$config = array('system'=>array()); + self::$page = array(); + self::$pager= array(); - $this->query_string = ''; + self::$query_string = ''; startup(); @@ -778,64 +780,64 @@ class App { . 'library/langdet' . PATH_SEPARATOR . '.' ); - $this->scheme = 'http'; + self::$scheme = 'http'; if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS']) - $this->scheme = 'https'; + self::$scheme = 'https'; elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) - $this->scheme = 'https'; + self::$scheme = 'https'; if(x($_SERVER,'SERVER_NAME')) { - $this->hostname = $_SERVER['SERVER_NAME']; + self::$hostname = $_SERVER['SERVER_NAME']; if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) - $this->hostname .= ':' . $_SERVER['SERVER_PORT']; + self::$hostname .= ':' . $_SERVER['SERVER_PORT']; /** * Figure out if we are running at the top of a domain * or in a sub-directory and adjust accordingly */ $path = trim(dirname($_SERVER['SCRIPT_NAME']),'/\\'); - if(isset($path) && strlen($path) && ($path != $this->path)) - $this->path = $path; + if(isset($path) && strlen($path) && ($path != self::$path)) + self::$path = $path; } - set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path()); + set_include_path("include/self::$hostname" . PATH_SEPARATOR . get_include_path()); if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") { - $this->query_string = substr($_SERVER['QUERY_STRING'], 2); + self::$query_string = substr($_SERVER['QUERY_STRING'], 2); // removing trailing / - maybe a nginx problem - if (substr($this->query_string, 0, 1) == "/") - $this->query_string = substr($this->query_string, 1); + if (substr(self::$query_string, 0, 1) == "/") + self::$query_string = substr(self::$query_string, 1); } if(x($_GET,'q')) - $this->cmd = trim($_GET['q'],'/\\'); + self::$cmd = trim($_GET['q'],'/\\'); // unix style "homedir" - if(substr($this->cmd, 0, 1) === '~') - $this->cmd = 'channel/' . substr($this->cmd, 1); + if(substr(self::$cmd, 0, 1) === '~') + self::$cmd = 'channel/' . substr(self::$cmd, 1); /* * Break the URL path into C style argc/argv style arguments for our - * modules. Given "http://example.com/module/arg1/arg2", $this->argc - * will be 3 (integer) and $this->argv will contain: + * modules. Given "http://example.com/module/arg1/arg2", self::$argc + * will be 3 (integer) and self::$argv will contain: * [0] => 'module' * [1] => 'arg1' * [2] => 'arg2' * * There will always be one argument. If provided a naked domain - * URL, $this->argv[0] is set to "home". + * URL, self::$argv[0] is set to "home". */ - $this->argv = explode('/', $this->cmd); - $this->argc = count($this->argv); - if ((array_key_exists('0', $this->argv)) && strlen($this->argv[0])) { - $this->module = str_replace(".", "_", $this->argv[0]); - $this->module = str_replace("-", "_", $this->module); + self::$argv = explode('/', self::$cmd); + self::$argc = count(self::$argv); + if ((array_key_exists('0', self::$argv)) && strlen(self::$argv[0])) { + self::$module = str_replace(".", "_", self::$argv[0]); + self::$module = str_replace("-", "_", self::$module); } else { - $this->argc = 1; - $this->argv = array('home'); - $this->module = 'home'; + self::$argc = 1; + self::$argv = array('home'); + self::$module = 'home'; } /* @@ -843,22 +845,22 @@ class App { * pagination */ - $this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1); - $this->pager['itemspage'] = 60; - $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; + self::$pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1); + self::$pager['itemspage'] = 60; + self::$pager['start'] = (self::$pager['page'] * self::$pager['itemspage']) - self::$pager['itemspage']; + if(self::$pager['start'] < 0) + self::$pager['start'] = 0; + self::$pager['total'] = 0; /* * Detect mobile devices */ $mobile_detect = new Mobile_Detect(); - $this->is_mobile = $mobile_detect->isMobile(); - $this->is_tablet = $mobile_detect->isTablet(); + self::$is_mobile = $mobile_detect->isMobile(); + self::$is_tablet = $mobile_detect->isTablet(); - $this->head_set_icon('/images/hz-32.png'); + self::head_set_icon('/images/hz-32.png'); BaseObject::set_app($this); @@ -868,146 +870,146 @@ class App { $dc = get_declared_classes(); foreach ($dc as $k) { if (in_array("ITemplateEngine", class_implements($k))){ - $this->register_template_engine($k); + self::register_template_engine($k); } } spl_autoload_register('ZotlabsAutoloader::loader'); - $this->meta= new Zotlabs\Web\HttpMeta(); + self::$meta= new Zotlabs\Web\HttpMeta(); } - function get_baseurl($ssl = false) { - if(is_array($this->config) - && array_key_exists('system',$this->config) - && is_array($this->config['system']) - && array_key_exists('baseurl',$this->config['system']) - && strlen($this->config['system']['baseurl'])) { - $url = $this->config['system']['baseurl']; + public static function get_baseurl($ssl = false) { + if(is_array(self::$config) + && array_key_exists('system',self::$config) + && is_array(self::$config['system']) + && array_key_exists('baseurl',self::$config['system']) + && strlen(self::$config['system']['baseurl'])) { + $url = self::$config['system']['baseurl']; $url = trim($url,'\\/'); return $url; } - $scheme = $this->scheme; + $scheme = self::$scheme; - $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); + self::$baseurl = $scheme . "://" . self::$hostname . ((isset(self::$path) && strlen(self::$path)) ? '/' . self::$path : '' ); - return $this->baseurl; + return self::$baseurl; } - function set_baseurl($url) { - if(is_array($this->config) - && array_key_exists('system',$this->config) - && is_array($this->config['system']) - && array_key_exists('baseurl',$this->config['system']) - && strlen($this->config['system']['baseurl'])) { - $url = $this->config['system']['baseurl']; + public static function set_baseurl($url) { + if(is_array(self::$config) + && array_key_exists('system',self::$config) + && is_array(self::$config['system']) + && array_key_exists('baseurl',self::$config['system']) + && strlen(self::$config['system']['baseurl'])) { + $url = self::$config['system']['baseurl']; $url = trim($url,'\\/'); } $parsed = @parse_url($url); - $this->baseurl = $url; + self::$baseurl = $url; if($parsed) { - $this->scheme = $parsed['scheme']; + self::$scheme = $parsed['scheme']; - $this->hostname = $parsed['host']; + self::$hostname = $parsed['host']; if(x($parsed,'port')) - $this->hostname .= ':' . $parsed['port']; + self::$hostname .= ':' . $parsed['port']; if(x($parsed,'path')) - $this->path = trim($parsed['path'],'\\/'); + self::$path = trim($parsed['path'],'\\/'); } } - function get_scheme() { - return $this->scheme; + public static function get_scheme() { + return self::$scheme; } - function get_hostname() { - return $this->hostname; + public static function get_hostname() { + return self::$hostname; } - function set_hostname($h) { - $this->hostname = $h; + public static function set_hostname($h) { + self::$hostname = $h; } - function set_path($p) { - $this->path = trim(trim($p), '/'); + public static function set_path($p) { + self::$path = trim(trim($p), '/'); } - function get_path() { - return $this->path; + public static function get_path() { + return self::$path; } - function set_account($acct) { - $this->account = $acct; + public static function set_account($acct) { + self::$account = $acct; } - function get_account() { - return $this->account; + public static function get_account() { + return self::$account; } - function set_channel($channel) { - $this->channel = $channel; + public static function set_channel($channel) { + self::$channel = $channel; } - function get_channel() { - return $this->channel; + public static function get_channel() { + return self::$channel; } - function set_observer($xchan) { - $this->observer = $xchan; + public static function set_observer($xchan) { + self::$observer = $xchan; } - function get_observer() { - return $this->observer; + public static function get_observer() { + return self::$observer; } - function set_perms($perms) { - $this->perms = $perms; + public static function set_perms($perms) { + self::$perms = $perms; } - function get_perms() { - return $this->perms; + public static function get_perms() { + return self::$perms; } - function set_oauth_key($consumer_id) { - $this->oauth_key = $consumer_id; + public static function set_oauth_key($consumer_id) { + self::$oauth_key = $consumer_id; } - function get_oauth_key() { - return $this->oauth_key; + public static function get_oauth_key() { + return self::$oauth_key; } - function get_apps() { - return $this->apps; + public static function get_apps() { + return self::$apps; } - function set_apps($arr) { - $this->apps = $arr; + public static function set_apps($arr) { + self::$apps = $arr; } - function set_groups($g) { - $this->groups = $g; + public static function set_groups($g) { + self::$groups = $g; } - function get_groups() { - return $this->groups; + public static function get_groups() { + return self::$groups; } - function set_pager_total($n) { - $this->pager['total'] = intval($n); + public static function set_pager_total($n) { + self::$pager['total'] = intval($n); } - function set_pager_itemspage($n) { - $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0); - $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage']; + public static function set_pager_itemspage($n) { + self::$pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0); + self::$pager['start'] = (self::$pager['page'] * self::$pager['itemspage']) - self::$pager['itemspage']; } - function build_pagehead() { + public static function build_pagehead() { $user_scalable = ((local_channel()) ? get_pconfig(local_channel(),'system','user_scalable') : 1); if ($user_scalable === false) @@ -1021,36 +1023,36 @@ class App { if($interval < 10000) $interval = 80000; - if(! x($this->page,'title')) - $this->page['title'] = $this->config['system']['sitename']; + if(! x(self::$page,'title')) + self::$page['title'] = self::$config['system']['sitename']; - if(! $this->meta->get_field('og:title')) - $this->meta->set('og:title',$this->page['title']); + if(! self::$meta->get_field('og:title')) + self::$meta->set('og:title',self::$page['title']); - $this->meta->set('generator', Zotlabs\Project\System::get_platform_name()); + self::$meta->set('generator', Zotlabs\Project\System::get_platform_name()); /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it * being first */ $tpl = get_markup_template('head.tpl'); - $this->page['htmlhead'] = replace_macros($tpl, array( + self::$page['htmlhead'] = replace_macros($tpl, array( '$preload_images' => $preload_images, '$user_scalable' => $user_scalable, - '$baseurl' => $this->get_baseurl(), + '$baseurl' => self::get_baseurl(), '$local_channel' => local_channel(), - '$metas' => $this->meta->get(), + '$metas' => self::$meta->get(), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), '$head_js' => head_get_js(), '$js_strings' => js_strings(), '$zid' => get_my_address(), - '$channel_id' => $this->profile['uid'], - )) . $this->page['htmlhead']; + '$channel_id' => self::$profile['uid'], + )) . self::$page['htmlhead']; // always put main.js at the end - $this->page['htmlhead'] .= head_get_main_js(); + self::$page['htmlhead'] .= head_get_main_js(); } /** @@ -1059,7 +1061,7 @@ class App { * @param string $class * @param string $name */ - function register_template_engine($class, $name = '') { + public static function register_template_engine($class, $name = '') { if ($name === ""){ $v = get_class_vars( $class ); if(x($v, "name")) $name = $v['name']; @@ -1068,7 +1070,7 @@ class App { echo "template engine $class cannot be registered without a name.\n"; killme(); } - $this->template_engines[$name] = $class; + self::$template_engines[$name] = $class; } /** @@ -1079,23 +1081,23 @@ class App { * * @return object Template Engine instance */ - function template_engine($name = ''){ + public static function template_engine($name = ''){ if ($name !== "") { $template_engine = $name; } else { $template_engine = 'smarty3'; - if (x($this->theme, 'template_engine')) { - $template_engine = $this->theme['template_engine']; + if (x(self::$theme, 'template_engine')) { + $template_engine = self::$theme['template_engine']; } } - if (isset($this->template_engines[$template_engine])){ - if(isset($this->template_engine_instance[$template_engine])){ - return $this->template_engine_instance[$template_engine]; + if (isset(self::$template_engines[$template_engine])){ + if(isset(self::$template_engine_instance[$template_engine])){ + return self::$template_engine_instance[$template_engine]; } else { - $class = $this->template_engines[$template_engine]; + $class = self::$template_engines[$template_engine]; $obj = new $class; - $this->template_engine_instance[$template_engine] = $obj; + self::$template_engine_instance[$template_engine] = $obj; return $obj; } } @@ -1108,28 +1110,28 @@ class App { * * @return string */ - function get_template_engine() { - return $this->theme['template_engine']; + public static function get_template_engine() { + return self::$theme['template_engine']; } - function set_template_engine($engine = 'smarty3') { - $this->theme['template_engine'] = $engine; + public static function set_template_engine($engine = 'smarty3') { + self::$theme['template_engine'] = $engine; } - function get_template_ldelim($engine = 'smarty3') { - return $this->ldelim[$engine]; + public static function get_template_ldelim($engine = 'smarty3') { + return self::$ldelim[$engine]; } - function get_template_rdelim($engine = 'smarty3') { - return $this->rdelim[$engine]; + public static function get_template_rdelim($engine = 'smarty3') { + return self::$rdelim[$engine]; } - function head_set_icon($icon) { - $this->data['pageicon'] = $icon; + public static function head_set_icon($icon) { + self::$data['pageicon'] = $icon; } - function head_get_icon() { - $icon = $this->data['pageicon']; + public static function head_get_icon() { + $icon = self::$data['pageicon']; if(! strpos($icon,'://')) $icon = z_root() . $icon; return $icon; -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- boot.php | 178 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 89 insertions(+), 89 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index bf30031bc..a96ff2660 100755 --- a/boot.php +++ b/boot.php @@ -92,7 +92,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( * * Image storage quality. Lower numbers save space at cost of image detail. * For ease of upgrade, please do not change here. Change jpeg quality with - * $a->config['system']['jpeg_quality'] = n; + * App::$config['system']['jpeg_quality'] = n; * in .htconfig.php, where n is netween 1 and 100, and with very poor results * below about 50 * @@ -100,7 +100,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( define ( 'JPEG_QUALITY', 100 ); /** - * $a->config['system']['png_quality'] from 0 (uncompressed) to 9 + * App::$config['system']['png_quality'] from 0 (uncompressed) to 9 */ define ( 'PNG_QUALITY', 8 ); @@ -135,7 +135,7 @@ define ( 'STORAGE_DEFAULT_PERMISSIONS', 0770 ); * this length (on the longest side, the other side will be scaled appropriately). * Modify this value using * - * $a->config['system']['max_image_length'] = n; + * App::$config['system']['max_image_length'] = n; * * in .htconfig.php * @@ -1200,7 +1200,7 @@ function system_unavailable() { function clean_urls() { global $a; - // if($a->config['system']['clean_urls']) + // if(App::$config['system']['clean_urls']) return true; // return false; } @@ -1224,7 +1224,7 @@ function z_path() { */ function z_root() { global $a; - return $a->get_baseurl(); + return App::get_baseurl(); } /** @@ -1295,7 +1295,7 @@ function check_config(&$a) { // This will actually set the url to the one stored in .htconfig, and ignore what // we're passing - unless we are installing and it has never been set. - $a->set_baseurl(z_root()); + App::set_baseurl(z_root()); // Make sure each site has a system channel. This is now created on install // so we just need to keep this around a couple of weeks until the hubs that @@ -1356,7 +1356,7 @@ function check_config(&$a) { $email_tpl = get_intltext_template("update_fail_eml.tpl"); $email_msg = replace_macros($email_tpl, array( - '$sitename' => $a->config['system']['sitename'], + '$sitename' => App::$config['system']['sitename'], '$siteurl' => z_root(), '$update' => $x, '$error' => sprintf( t('Update %s failed. See error logs.'), $x) @@ -1364,7 +1364,7 @@ function check_config(&$a) { $subject = email_header_encode(sprintf(t('Update Error at %s'), z_root())); - mail($a->config['system']['admin_email'], $subject, $email_msg, + mail(App::$config['system']['admin_email'], $subject, $email_msg, 'From: Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -1384,7 +1384,7 @@ function check_config(&$a) { * * Synchronise plugins: * - * $a->config['system']['addon'] contains a comma-separated list of names + * App::$config['system']['addon'] contains a comma-separated list of names * of plugins/addons which are used on this system. * Go through the database list of already installed addons, and if we have * an entry, but it isn't in the config list, call the unload procedure @@ -1406,7 +1406,7 @@ function check_config(&$a) { if($plugins) $plugins_arr = explode(',', str_replace(' ', '', $plugins)); - $a->plugins = $plugins_arr; + App::$plugins = $plugins_arr; $installed_arr = array(); @@ -1520,7 +1520,7 @@ function fix_system_urls($oldurl, $newurl) { // wrapper for adding a login box. If $register == true provide a registration -// link. This will most always depend on the value of $a->config['system']['register_policy']. +// link. This will most always depend on the value of App::$config['system']['register_policy']. // returns the complete html for inserting into the page function login($register = false, $form_id = 'main-login', $hiddens=false) { @@ -1537,15 +1537,15 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { 'link' => (($register) ? $reglink : 'pubsites') ); - $dest_url = z_root() . '/' . $a->query_string; + $dest_url = z_root() . '/' . App::$query_string; if(local_channel()) { $tpl = get_markup_template("logout.tpl"); } else { $tpl = get_markup_template("login.tpl"); - if(strlen($a->query_string)) - $_SESSION['login_return_url'] = $a->query_string; + if(strlen(App::$query_string)) + $_SESSION['login_return_url'] = App::$query_string; } $o .= replace_macros($tpl,array( @@ -1597,8 +1597,8 @@ function get_account_id() { if(intval($_SESSION['account_id'])) return intval($_SESSION['account_id']); - if(get_app()->account) - return intval(get_app()->account['account_id']); + if(App::$account) + return intval(App::$account['account_id']); return false; } @@ -1681,7 +1681,7 @@ function notice($s) { if(in_array($s,$_SESSION['sysmsg'])) return; - if($a->interactive) { + if(App::$interactive) { $_SESSION['sysmsg'][] = $s; } @@ -1697,7 +1697,7 @@ function notice($s) { function info($s) { $a = get_app(); if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); - if($a->interactive) + if(App::$interactive) $_SESSION['sysmsg_info'][] = $s; } @@ -1755,7 +1755,7 @@ function proc_run($cmd){ return; if(count($args) && $args[0] === 'php') - $args[0] = ((x($a->config,'system')) && (x($a->config['system'],'php_path')) && (strlen($a->config['system']['php_path'])) ? $a->config['system']['php_path'] : 'php'); + $args[0] = ((x(App::$config,'system')) && (x(App::$config['system'],'php_path')) && (strlen(App::$config['system']['php_path'])) ? App::$config['system']['php_path'] : 'php'); for($x = 0; $x < count($args); $x++) $args[$x] = escapeshellarg($args[$x]); @@ -1793,29 +1793,29 @@ function current_theme(){ // Find the theme that belongs to the channel whose stuff we are looking at - if($a->profile_uid && $a->profile_uid != local_channel()) { + if(App::$profile_uid && App::$profile_uid != local_channel()) { $r = q("select channel_theme from channel where channel_id = %d limit 1", - intval($a->profile_uid) + intval(App::$profile_uid) ); if($r) $page_theme = $r[0]['channel_theme']; } - if(array_key_exists('theme', $a->layout) && $a->layout['theme']) - $page_theme = $a->layout['theme']; + if(array_key_exists('theme', App::$layout) && App::$layout['theme']) + $page_theme = App::$layout['theme']; // Allow folks to over-rule channel themes and always use their own on their own site. // The default is for channel themes to take precedence over your own on pages belonging // to that channel. - if($page_theme && local_channel() && local_channel() != $a->profile_url) { + if($page_theme && local_channel() && local_channel() != App::$profile_url) { if(get_pconfig(local_channel(),'system','always_my_theme')) $page_theme = null; } - $is_mobile = $a->is_mobile || $a->is_tablet; + $is_mobile = App::$is_mobile || App::$is_tablet; - $standard_system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); + $standard_system_theme = ((isset(App::$config['system']['theme'])) ? App::$config['system']['theme'] : ''); $standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme); if($is_mobile) { @@ -1824,7 +1824,7 @@ function current_theme(){ $theme_name = $standard_theme_name; } else { - $system_theme = ((isset($a->config['system']['mobile_theme'])) ? $a->config['system']['mobile_theme'] : ''); + $system_theme = ((isset(App::$config['system']['mobile_theme'])) ? App::$config['system']['mobile_theme'] : ''); $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile_theme')) ? $_SESSION['mobile_theme'] : $system_theme); if($theme_name === '' || $theme_name === '---' ) { @@ -1875,8 +1875,8 @@ function current_theme_url($installing = false) { $t = current_theme(); $opts = ''; - $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : ''); - $opts .= ((x($a->layout,'schema')) ? '&schema=' . $a->layout['schema'] : ''); + $opts = ((App::$profile_uid) ? '?f=&puid=' . App::$profile_uid : ''); + $opts .= ((x(App::$layout,'schema')) ? '&schema=' . App::$layout['schema'] : ''); if(file_exists('view/theme/' . $t . '/php/style.php')) return('view/theme/' . $t . '/php/style.pcss' . $opts); @@ -1897,8 +1897,8 @@ function is_site_admin() { return false; if((intval($_SESSION['authenticated'])) - && (is_array($a->account)) - && ($a->account['account_roles'] & ACCOUNT_ROLE_ADMIN)) + && (is_array(App::$account)) + && (App::$account['account_roles'] & ACCOUNT_ROLE_ADMIN)) return true; return false; @@ -1914,8 +1914,8 @@ function is_site_admin() { function is_developer() { $a = get_app(); if((intval($_SESSION['authenticated'])) - && (is_array($a->account)) - && ($a->account['account_roles'] & ACCOUNT_ROLE_DEVELOPER)) + && (is_array(App::$account)) + && (App::$account['account_roles'] & ACCOUNT_ROLE_DEVELOPER)) return true; return false; @@ -1927,7 +1927,7 @@ function load_contact_links($uid) { $ret = array(); - if(! $uid || x($a->contacts,'empty')) + if(! $uid || x(App::$contacts,'empty')) return; // logger('load_contact_links'); @@ -1943,7 +1943,7 @@ function load_contact_links($uid) { else $ret['empty'] = true; - $a->contacts = $ret; + App::$contacts = $ret; } @@ -1980,12 +1980,12 @@ function build_querystring($params, $name = null) { // much better way of dealing with c-style args function argc() { - return get_app()->argc; + return App::$argc; } function argv($x) { - if(array_key_exists($x,get_app()->argv)) - return get_app()->argv[$x]; + if(array_key_exists($x,App::$argv)) + return App::$argv[$x]; return ''; } @@ -2000,7 +2000,7 @@ function dba_timer() { * @return string Empty if no observer, otherwise xchan_hash from observer */ function get_observer_hash() { - $observer = get_app()->get_observer(); + $observer = App::get_observer(); if(is_array($observer)) return $observer['xchan_hash']; @@ -2039,7 +2039,7 @@ function curPageURL() { */ function get_custom_nav(&$a, $navname) { if (! $navname) - return $a->page['nav']; + return App::$page['nav']; // load custom nav menu by name here } @@ -2054,13 +2054,13 @@ function get_custom_nav(&$a, $navname) { function load_pdl(&$a) { require_once('include/comanche.php'); - if (! count($a->layout)) { + if (! count(App::$layout)) { - $arr = array('module' => $a->module, 'layout' => ''); + $arr = array('module' => App::$module, 'layout' => ''); call_hooks('load_pdl',$arr); $layout = $arr['layout']; - $n = 'mod_' . $a->module . '.pdl' ; + $n = 'mod_' . App::$module . '.pdl' ; $u = comanche_get_channel_id(); if($u) $s = get_pconfig($u, 'system', $n); @@ -2071,7 +2071,7 @@ function load_pdl(&$a) { $s = @file_get_contents($p); if($s) { comanche_parser($a, $s); - $a->pdl = $s; + App::$pdl = $s; } } @@ -2081,8 +2081,8 @@ function load_pdl(&$a) { function exec_pdl(&$a) { require_once('include/comanche.php'); - if($a->pdl) { - comanche_parser($a, $a->pdl,1); + if(App::$pdl) { + comanche_parser($a, App::$pdl,1); } } @@ -2098,64 +2098,64 @@ function construct_page(&$a) { exec_pdl($a); - $comanche = ((count($a->layout)) ? true : false); + $comanche = ((count(App::$layout)) ? true : false); require_once(theme_include('theme_init.php')); $installing = false; - if ($a->module == 'setup') { + if (App::$module == 'setup') { $installing = true; } else { nav($a); } if ($comanche) { - if ($a->layout['nav']) { - $a->page['nav'] = get_custom_nav($a, $a->layout['nav']); + if (App::$layout['nav']) { + App::$page['nav'] = get_custom_nav($a, App::$layout['nav']); } } if (($p = theme_include(current_theme() . '.js')) != '') head_add_js($p); - if (($p = theme_include('mod_' . $a->module . '.php')) != '') + if (($p = theme_include('mod_' . App::$module . '.php')) != '') require_once($p); require_once('include/js_strings.php'); - if (x($a->page, 'template_style')) - head_add_css($a->page['template_style'] . '.css'); + if (x(App::$page, 'template_style')) + head_add_css(App::$page['template_style'] . '.css'); else - head_add_css(((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.css'); + head_add_css(((x(App::$page, 'template')) ? App::$page['template'] : 'default' ) . '.css'); - head_add_css('mod_' . $a->module . '.css'); + head_add_css('mod_' . App::$module . '.css'); head_add_css(current_theme_url($installing)); - head_add_js('mod_' . $a->module . '.js'); + head_add_js('mod_' . App::$module . '.js'); - $a->build_pagehead(); + App::build_pagehead(); - if($a->page['pdl_content']) { - $a->page['content'] = comanche_region($a,$a->page['content']); + if(App::$page['pdl_content']) { + App::$page['content'] = comanche_region($a,App::$page['content']); } // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'. // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave - // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section'] - // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page + // App::$page['nav'] empty and put the default content from App::$page['nav'] and App::$page['section'] + // into a new region called App::$data['content']. It is presumed that the chosen layout file for this comanche page // has a '' element instead of a '
'. // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the // layout completely with a new layout definition, or replace/remove existing content. if($comanche) { - $arr = array('module' => $a->module, 'layout' => $a->layout); + $arr = array('module' => App::$module, 'layout' => App::$layout); call_hooks('construct_page', $arr); - $a->layout = $arr['layout']; + App::$layout = $arr['layout']; - foreach($a->layout as $k => $v) { + foreach(App::$layout as $k => $v) { if((strpos($k, 'region_') === 0) && strlen($v)) { if(strpos($v, '$region_') !== false) { $v = preg_replace_callback('/\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v); @@ -2163,21 +2163,21 @@ function construct_page(&$a) { // And a couple of convenience macros if(strpos($v, '$htmlhead') !== false) { - $v = str_replace('$htmlhead', $a->page['htmlhead'], $v); + $v = str_replace('$htmlhead', App::$page['htmlhead'], $v); } if(strpos($v, '$nav') !== false) { - $v = str_replace('$nav', $a->page['nav'], $v); + $v = str_replace('$nav', App::$page['nav'], $v); } if(strpos($v, '$content') !== false) { - $v = str_replace('$content', $a->page['content'], $v); + $v = str_replace('$content', App::$page['content'], $v); } - $a->page[substr($k, 7)] = $v; + App::$page[substr($k, 7)] = $v; } } } - if($a->is_mobile || $a->is_tablet) { + if(App::$is_mobile || App::$is_tablet) { if(isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) { $link = z_root() . '/toggle_mobile?f=&address=' . curPageURL(); } @@ -2185,39 +2185,39 @@ function construct_page(&$a) { $link = z_root() . '/toggle_mobile?f=&off=1&address=' . curPageURL(); } if ((isset($_SESSION) && $_SESSION['mobile_theme'] !='' && $_SESSION['mobile_theme'] !='---' ) || - (isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme']))) { - $a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array( + (isset(App::$config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme']))) { + App::$page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array( '$toggle_link' => $link, '$toggle_text' => t('toggle mobile') )); } } - $page = $a->page; - $profile = $a->profile; + $page = App::$page; + $profile = App::$profile; header("Content-type: text/html; charset=utf-8"); // security headers - see https://securityheaders.io - if($a->get_scheme() === 'https' && $a->config['system']['transport_security_header']) + if(App::get_scheme() === 'https' && App::$config['system']['transport_security_header']) header("Strict-Transport-Security: max-age=31536000"); - if($a->config['system']['content_security_policy']) + if(App::$config['system']['content_security_policy']) header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"); - if($a->config['system']['x_security_headers']) { + if(App::$config['system']['x_security_headers']) { header("X-Frame-Options: SAMEORIGIN"); header("X-Xss-Protection: 1; mode=block;"); header("X-Content-Type-Options: nosniff"); } - if($a->config['system']['public_key_pins']) { - header("Public-Key-Pins: " . $a->config['system']['public_key_pins']); + if(App::$config['system']['public_key_pins']) { + header("Public-Key-Pins: " . App::$config['system']['public_key_pins']); } require_once(theme_include( - ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php' ) + ((x(App::$page, 'template')) ? App::$page['template'] : 'default' ) . '.php' ) ); } @@ -2238,7 +2238,7 @@ function appdirpath() { function head_set_icon($icon) { global $a; - $a->data['pageicon'] = $icon; + App::$data['pageicon'] = $icon; // logger('head_set_icon: ' . $icon); } @@ -2250,7 +2250,7 @@ function head_set_icon($icon) { function head_get_icon() { global $a; - $icon = $a->data['pageicon']; + $icon = App::$data['pageicon']; if(! strpos($icon, '://')) $icon = z_root() . $icon; @@ -2339,14 +2339,14 @@ function cert_bad_email() { $email_tpl = get_intltext_template("cert_bad_eml.tpl"); $email_msg = replace_macros($email_tpl, array( - '$sitename' => $a->config['system']['sitename'], + '$sitename' => App::$config['system']['sitename'], '$siteurl' => z_root(), '$error' => t('Website SSL certificate is not valid. Please correct.') )); - $subject = email_header_encode(sprintf(t('[hubzilla] Website SSL error for %s'), $a->get_hostname())); - mail($a->config['system']['admin_email'], $subject, $email_msg, - 'From: Administrator' . '@' . $a->get_hostname() . "\n" + $subject = email_header_encode(sprintf(t('[hubzilla] Website SSL error for %s'), App::get_hostname())); + mail(App::$config['system']['admin_email'], $subject, $email_msg, + 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); } @@ -2379,15 +2379,15 @@ function check_cron_broken() { $email_tpl = get_intltext_template("cron_bad_eml.tpl"); $email_msg = replace_macros($email_tpl, array( - '$sitename' => $a->config['system']['sitename'], + '$sitename' => App::$config['system']['sitename'], '$siteurl' => z_root(), '$error' => t('Cron/Scheduled tasks not running.'), '$lastdate' => (($d)? $d : t('never')) )); - $subject = email_header_encode(sprintf(t('[hubzilla] Cron tasks not running on %s'), $a->get_hostname())); - mail($a->config['system']['admin_email'], $subject, $email_msg, - 'From: Administrator' . '@' . $a->get_hostname() . "\n" + $subject = email_header_encode(sprintf(t('[hubzilla] Cron tasks not running on %s'), App::get_hostname())); + mail(App::$config['system']['admin_email'], $subject, $email_msg, + 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); set_config('system','lastpollcheck',datetime_convert()); -- cgit v1.2.3 From bbfe4de3107a1eb8293f4ee6b620f7e27bf26dbf Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 18:57:44 -0700 Subject: increment std_version --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index a96ff2660..41c994ddc 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.3.2' ); +define ( 'STD_VERSION', '1.3.3' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1165 ); -- cgit v1.2.3 From 0cda43145629586e6110e83fa2356e1c4ee4811a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 20:15:47 -0700 Subject: create miniApp to convert existing settings files to the static App class --- boot.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 41c994ddc..07c427e10 100755 --- a/boot.php +++ b/boot.php @@ -639,6 +639,29 @@ class ZotlabsAutoloader { } +/** + * class miniApp + * + * this is a transient structure which is needed to convert the $a->config settings + * from older (existing) htconfig files which used a global App ($a) into the updated App structure + * which is now static (although currently constructed at startup). We are only converting + * 'system' config settings. + */ + + +class miniApp { + public $config = array('system' => array()); + + public function convert() { + if($this->config['system']) { + foreach($this->config['system'] as $k => $v) + App::$config['system'][$k] = $v; + } + } +} + + + /** * class: App * -- cgit v1.2.3 From 44283dbbbb30d434f1153df7e09b62f54b22887d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 20:24:30 -0700 Subject: change the App constructor --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 07c427e10..f480dd46d 100755 --- a/boot.php +++ b/boot.php @@ -784,7 +784,7 @@ class App { /** * App constructor. */ - function __construct() { + function init() { // we'll reset this after we read our config file date_default_timezone_set('UTC'); -- cgit v1.2.3 From 9d47de65d94ef42f120b7814b8d8bf451fd638ea Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 23:41:20 -0700 Subject: undeclared static vars --- boot.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f480dd46d..467f889fc 100755 --- a/boot.php +++ b/boot.php @@ -691,6 +691,8 @@ class App { public static $groups; public static $language; + public static $langsave; + public static $plugins_admin; public static $module_loaded = false; public static $query_string; public static $config; // config cache -- cgit v1.2.3 From 8f006a98c43f369ef06b33dd8b8cd08c85057141 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 1 Apr 2016 00:54:23 -0700 Subject: primary hub change --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 467f889fc..71fc9b909 100755 --- a/boot.php +++ b/boot.php @@ -76,7 +76,7 @@ define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub // point to go out and find the rest of the world. define ( 'DIRECTORY_REALM', 'RED_GLOBAL'); -define ( 'DIRECTORY_FALLBACK_MASTER', 'https://hubzilla.site'); +define ( 'DIRECTORY_FALLBACK_MASTER', 'https://hub.pixelbits.de'); $DIRECTORY_FALLBACK_SERVERS = array( 'https://hubzilla.site', -- cgit v1.2.3 From e16da7a1668665d5729478a0ffcd960047dbc201 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 1 Apr 2016 03:27:21 -0700 Subject: unreferenced app member --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 71fc9b909..cc916c600 100755 --- a/boot.php +++ b/boot.php @@ -1833,7 +1833,7 @@ function current_theme(){ // The default is for channel themes to take precedence over your own on pages belonging // to that channel. - if($page_theme && local_channel() && local_channel() != App::$profile_url) { + if($page_theme && local_channel() && App::$profile_uid && local_channel() != App::$profile_uid) { if(get_pconfig(local_channel(),'system','always_my_theme')) $page_theme = null; } -- cgit v1.2.3 From 8b3c099a123d710ba341b3e2513bb5cf04ff5b84 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 2 Apr 2016 21:06:41 -0700 Subject: use constant --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cc916c600..c4d8ec13a 100755 --- a/boot.php +++ b/boot.php @@ -454,7 +454,7 @@ define ( 'TERM_OBJ_APP', 7 ); /** * various namespaces we may need to parse */ - +define ( 'PROTOCOL_ZOT', 'http://purl.org/zot/protocol' ); define ( 'NAMESPACE_ZOT', 'http://purl.org/zot' ); define ( 'NAMESPACE_DFRN' , 'http://purl.org/macgirvin/dfrn/1.0' ); define ( 'NAMESPACE_THREAD' , 'http://purl.org/syndication/thread/1.0' ); -- cgit v1.2.3 From a703835b5cdbe737be98374a51363426083fee8f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Apr 2016 17:38:17 -0700 Subject: Bug: "remember me" doesn't --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index c4d8ec13a..a357d7ecb 100755 --- a/boot.php +++ b/boot.php @@ -1580,7 +1580,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { '$form_id' => $form_id, '$lname' => array('username', t('Email') , '', ''), '$lpassword' => array('password', t('Password'), '', ''), - '$remember' => array('remember', t('Remember me'), '', '',array(t('No'),t('Yes'))), + '$remember_me' => array('remember_me', t('Remember me'), '', '',array(t('No'),t('Yes'))), '$hiddens' => $hiddens, '$register' => $reg, '$lostpass' => t('Forgot your password?'), -- cgit v1.2.3 From 54aa998b520f0f8932be3f5e358b926fadd1b77a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 Apr 2016 22:13:56 -0700 Subject: undeclared static property App::$stringsave (push_lang() and pop_lang()) --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cc916c600..e913dbc96 100755 --- a/boot.php +++ b/boot.php @@ -711,6 +711,7 @@ class App { public static $module; public static $pager; public static $strings; + public static $stringsave; // used in push_lang() and pop_lang() public static $hooks; public static $timezone; public static $interactive = true; -- cgit v1.2.3 From abfbe9c9375c7505e0422b8adc1d9d5426d7df1a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 Apr 2016 16:56:08 -0700 Subject: a few issues: block public not blocking mod_cal, typo in sql for one clone file sync operation, fix_system_urls not catching cached contact photos, extend sessionhandler expiration when remember_me is enabled as the stored session is expiring long before the browser session. --- boot.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 386a419dc..b6febde4e 100755 --- a/boot.php +++ b/boot.php @@ -1542,6 +1542,24 @@ function fix_system_urls($oldurl, $newurl) { proc_run('php', 'include/notifier.php', 'refresh_all', $c[0]['channel_id']); } } + + // now replace any remote xchans whose photos are stored locally (which will be most if not all remote xchans) + + $r = q("select * from xchan where xchan_photo_l like '%s'", + dbesc($oldurl . '%') + ); + + if($r) { + foreach($r as $rr) { + $x = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s' where xchan_hash = '%s'", + dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_l'])), + dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_m'])), + dbesc(str_replace($oldurl,$newurl,$rr['xchan_photo_s'])), + dbesc($rr['xchan_hash']) + ); + } + } + } -- cgit v1.2.3 From 0fe495727429dea14e4876c74ceb03fb71b58c29 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 Apr 2016 17:42:32 -0700 Subject: when setting the session handler as an object using the auto register shutdown flag, explicitly calling session_write_close() should no longer be required. It shouldn't cause any issues if it is called twice, but the session driver interface has been known to sometimes act in unexpected ways and there are lots of "subtleties" which can often be difficult to debug. The mentioned flag implies PHP 5.4 minimum but I believe we require that anyway. --- boot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b6febde4e..40c49df82 100755 --- a/boot.php +++ b/boot.php @@ -1616,7 +1616,6 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { * @brief Used to end the current process, after saving session state. */ function killme() { - session_write_close(); exit; } -- cgit v1.2.3 From 0269825bc09c2e41a46992cc0bb6415a1e39e0c7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 Apr 2016 21:56:16 -0700 Subject: localise the opensearch link --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 40c49df82..682eafd59 100755 --- a/boot.php +++ b/boot.php @@ -1069,6 +1069,7 @@ class App { '$local_channel' => local_channel(), '$metas' => self::$meta->get(), '$update_interval' => $interval, + 'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Project\System::get_site_name(), t('$Projectname','opensearch')), '$icon' => head_get_icon(), '$head_css' => head_get_css(), '$head_js' => head_get_js(), -- cgit v1.2.3 From 91cc36514306e827c126ceed6c17486c85f5544c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 Apr 2016 22:55:26 -0700 Subject: reverse the logic of the jsenabled setting so that sessions without js are performance penalised instead of regular sessions. --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 682eafd59..e9fe29696 100755 --- a/boot.php +++ b/boot.php @@ -1065,6 +1065,7 @@ class App { self::$page['htmlhead'] = replace_macros($tpl, array( '$preload_images' => $preload_images, '$user_scalable' => $user_scalable, + '$query' => urlencode(self::$query_string), '$baseurl' => self::get_baseurl(), '$local_channel' => local_channel(), '$metas' => self::$meta->get(), -- cgit v1.2.3 From a29c0371f1f3cceb9a9af3a62e5ed67886869c40 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Apr 2016 20:11:36 -0700 Subject: commit 1.4 --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index e9fe29696..ef620e3ec 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ require_once('include/account.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc'))); -define ( 'STD_VERSION', '1.3.3' ); +define ( 'STD_VERSION', '1.4' ); define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1165 ); -- cgit v1.2.3