From 87f5544f1f41aa67b03ee6b8810e235a4ee909bd Mon Sep 17 00:00:00 2001 From: Paolo Tacconi Date: Tue, 29 Jul 2014 09:06:04 +0200 Subject: Chatroom lines are deleted after MAX_CHATROOM_HOURS or the chat becomes slow to load --- boot.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index af395f30b..d5afbb855 100755 --- a/boot.php +++ b/boot.php @@ -358,6 +358,11 @@ define ( 'MAX_LIKERS', 10); define ( 'ZCURL_TIMEOUT' , (-1)); +/** + * Hours before chat lines are deleted + */ + +define ( 'MAX_CHATROOM_HOURS' , 36); /** * email notification options -- cgit v1.2.3 From 35ed18967a61e9871becbe6676603ce8e43eeec3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 29 Jul 2014 20:13:01 -0700 Subject: block channel removal for 48 hours after changing the account password, since the password is required to remove a channel. Somebody looking at an open session on somebody else's computer can simply change the password and then proceed to maliciously remove the channel. This change gives the owner 2 days to discover that something is wrong and recover his/her password and potentially save their channel from getting erased by the vandal. This is most likely to happen if a relationship has gone bad, or something incriminating was found in your private messages when you left your computer briefly unattended. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d5afbb855..83bf97508 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1118 ); +define ( 'DB_UPDATE_VERSION', 1119 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 85032a1fa37868699ecbcf791dba7c37ee5a4337 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 2 Aug 2014 14:56:17 -0700 Subject: db tables for extensible profile fields --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 83bf97508..beff28a46 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1119 ); +define ( 'DB_UPDATE_VERSION', 1120 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 70449755202327bd6ac06cbbae04ba6098f43a1e Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 6 Aug 2014 17:00:25 -0700 Subject: item table upgrade for storing post visibility --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index beff28a46..f7c16c646 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1120 ); +define ( 'DB_UPDATE_VERSION', 1121 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From bc85f7d6e3f43bee3a0362276d215dab6c72e12d Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 13 Aug 2014 15:32:15 +0200 Subject: provide an expert option to opt out from user zoom on mobile devices --- boot.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f7c16c646..a6ce76ada 100755 --- a/boot.php +++ b/boot.php @@ -980,6 +980,10 @@ class App { function build_pagehead() { + $user_scalable = ((local_user()) ? get_pconfig(local_user(),'system','user_scalable') : 1); + if ($user_scalable === false) + $user_scalable = 1; + $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 40000); if($interval < 10000) $interval = 40000; @@ -993,6 +997,7 @@ class App { */ $tpl = get_markup_template('head.tpl'); $this->page['htmlhead'] = replace_macros($tpl, array( + '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_user' => local_user(), '$generator' => RED_PLATFORM . ' ' . RED_VERSION, -- cgit v1.2.3 From 20bdcb037f29824bcb0c8307526c0e95baa7b360 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 16 Aug 2014 16:10:35 -0700 Subject: provide backend storage and declaration of directory realm --- boot.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index a6ce76ada..502783409 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1121 ); +define ( 'DB_UPDATE_VERSION', 1122 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -2040,3 +2040,8 @@ function head_get_icon() { return $icon; } +function get_directory_realm() { + if($x = get_config('system','directory_realm')) + return $x; + return DIRECTORY_REALM; +} \ No newline at end of file -- cgit v1.2.3 From 4a76925787672ede57e0d36c890ffb08b6d32ed4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 17 Aug 2014 19:06:56 -0700 Subject: some more work on realms --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 502783409..267999d07 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1122 ); +define ( 'DB_UPDATE_VERSION', 1123 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From af45b34ee044966210e6101585fe362acf1ca098 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 20 Aug 2014 20:49:03 -0700 Subject: verified that chatroom expire is working, so doing away with the second function to do the same thing. If you have a problem with chatroom expiration, check that it was created with cr_expire set to 120 (minutes). Chatrooms created during the first couple of days of the chat feature didn't have this. You can set the DB value manually. --- boot.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 267999d07..f8bd29f37 100755 --- a/boot.php +++ b/boot.php @@ -358,11 +358,6 @@ define ( 'MAX_LIKERS', 10); define ( 'ZCURL_TIMEOUT' , (-1)); -/** - * Hours before chat lines are deleted - */ - -define ( 'MAX_CHATROOM_HOURS' , 36); /** * email notification options -- cgit v1.2.3 From 9196c9eef091e7f4a41fbc9452521d6ca2de55a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 22 Aug 2014 21:37:08 -0700 Subject: We really can't do this without a hubloc. I was hoping we could, but notifier is setup to take hublocs, not xchans. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f8bd29f37..a6e5fc0b4 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1123 ); +define ( 'DB_UPDATE_VERSION', 1124 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 8c6067b411ee7f69b3df1341a8696ec1e5811601 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 26 Aug 2014 20:51:59 -0700 Subject: more hard work --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index a6e5fc0b4..04534f80a 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1124 ); +define ( 'DB_UPDATE_VERSION', 1125 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From e179dca446b4e604b7486e79d694d39679d1209f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 26 Aug 2014 22:37:04 -0700 Subject: place to store multiple choice and select items for extensible profiles --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 04534f80a..f19b1f117 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1125 ); +define ( 'DB_UPDATE_VERSION', 1126 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From eb27bea794d5aff547be9722f7c058678b8cbb1d Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 27 Aug 2014 19:15:34 -0700 Subject: mind numbing drudgery continued... --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f19b1f117..89d09b0d9 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1126 ); +define ( 'DB_UPDATE_VERSION', 1127 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 53b5cf7f507df53d3e382b6714caacf9551ed6db Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 28 Aug 2014 16:56:13 -0700 Subject: Ability to close comments at a certain date/time - needed for loom.io emulation (and many other uses) --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 89d09b0d9..2e12e60f9 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1127 ); +define ( 'DB_UPDATE_VERSION', 1128 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 2a37d99958d5591d5b9ccfc9bc615ee0588a6036 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 31 Aug 2014 22:15:00 -0700 Subject: get out the sunnies --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2e12e60f9..344a2a7ca 100755 --- a/boot.php +++ b/boot.php @@ -304,7 +304,7 @@ define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008); define ( 'ABOOK_FLAG_PENDING' , 0x0010); define ( 'ABOOK_FLAG_UNCONNECTED', 0x0020); define ( 'ABOOK_FLAG_SELF' , 0x0080); - +define ( 'ABOOK_FLAG_FEED' , 0x0100); define ( 'MAIL_DELETED', 0x0001); -- cgit v1.2.3 From e8ef515b6136ee79ff17e1c143a15e29691d3d81 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 3 Sep 2014 05:09:43 -0700 Subject: store diaspora meta info in the item table. It has to go there or it will kill us with complex joins. We can phase out the sign table once this all checks out. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 344a2a7ca..cb70b898b 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1128 ); +define ( 'DB_UPDATE_VERSION', 1129 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 844087bc71f333719c1e08d807874f3ae3a7053e Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 3 Sep 2014 19:07:14 -0700 Subject: implement service class for feed polling frequenecy, fixed a service class bug, moved service class stuff from plugin to account.php where it belongs and load that by default instead of on demand --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index cb70b898b..0c2cfafbf 100755 --- a/boot.php +++ b/boot.php @@ -41,6 +41,7 @@ require_once('include/features.php'); require_once('include/taxonomy.php'); require_once('include/identity.php'); require_once('include/Contact.php'); +require_once('include/account.php'); define ( 'RED_PLATFORM', 'Red Matrix' ); -- cgit v1.2.3 From 9d03f635119b69c9ed1865b77ae397488d1dd599 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 7 Sep 2014 20:05:38 -0700 Subject: set the default items-per-page for the entire app to 60 --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 0c2cfafbf..941d6f6f3 100755 --- a/boot.php +++ b/boot.php @@ -807,7 +807,7 @@ class App { */ $this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1); - $this->pager['itemspage'] = 50; + $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; -- cgit v1.2.3 From c6d07feff575862b5db8d05e02be6375e51034c7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 8 Sep 2014 20:35:15 -0700 Subject: This is long overdue - use a symblic constant NULL_DATE instead of the easily mis-typed sequence '0000-00-00 00:00:00' --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 941d6f6f3..4223a57f3 100755 --- a/boot.php +++ b/boot.php @@ -50,9 +50,9 @@ define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1129 ); -define ( 'EOL', '
' . "\r\n" ); -define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); - +define ( 'EOL', '
' . "\r\n" ); +define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); +define ( 'NULL_DATE', '0000-00-00 00:00:00' ); define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' ); define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000 -- cgit v1.2.3 From 3a10956b20170a64de0a150c36bb24c46297ce42 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 11 Sep 2014 17:27:49 -0700 Subject: correct item author for feeds with multiple or different authors --- boot.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4223a57f3..7dd52069f 100755 --- a/boot.php +++ b/boot.php @@ -450,6 +450,8 @@ define ( 'NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates- define ( 'NAMESPACE_OSTATUS', 'http://ostatus.org/schema/1.0' ); define ( 'NAMESPACE_STATUSNET', 'http://status.net/schema/api/1/' ); define ( 'NAMESPACE_ATOM1', 'http://www.w3.org/2005/Atom' ); +define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' ); + /** * activity stream defines */ -- cgit v1.2.3 From e8901b2ffe77a98cfe45f7741e684ec3c291f8f9 Mon Sep 17 00:00:00 2001 From: marijus Date: Sat, 13 Sep 2014 19:45:26 +0200 Subject: remove this hub from fallback servers --- boot.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 7dd52069f..b8457467e 100755 --- a/boot.php +++ b/boot.php @@ -73,7 +73,6 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://zotid.net', 'https://redmatrix.nl', 'https://whogotzot.com', - 'https://red.mariovavti.com', 'https://red.zottel.red', 'https://red.pixelbits.de' ); @@ -2042,4 +2041,4 @@ function get_directory_realm() { if($x = get_config('system','directory_realm')) return $x; return DIRECTORY_REALM; -} \ No newline at end of file +} -- cgit v1.2.3 From ea8a01791e521a9ae4ea211e1b2e152b27a0486c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 14 Sep 2014 22:43:56 -0700 Subject: allow the site to designate an admin channel that's visible to the outside world (via siteinfo/json). Otherwise we'll use the default channel of any accounts that have the account admin role. --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b8457467e..339a1f052 100755 --- a/boot.php +++ b/boot.php @@ -216,8 +216,9 @@ define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for director define ( 'PAGE_PREMIUM', 0x0010 ); define ( 'PAGE_ADULT', 0x0020 ); define ( 'PAGE_CENSORED', 0x0040 ); // Site admin has blocked this channel from appearing in casual search results and site feeds - define ( 'PAGE_SYSTEM', 0x1000 ); +define ( 'PAGE_HUBADMIN', 0x2000 ); // set this to indicate a preferred admin channel rather than the + // default channel of any accounts with the admin role. define ( 'PAGE_REMOVED', 0x8000 ); -- cgit v1.2.3 From 6c0133be1f945215ae5b21c4e6da0fda2817a0a3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 15 Sep 2014 22:23:07 -0700 Subject: change platform name to redmatrix (lowercase, one word) for use in meta tags and stuff, move yet another oauth1 library to library instead of having it in plugins where we'll end up with a white screen if we re-use it in another plugin; which I plan to do. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 339a1f052..5118038d3 100755 --- a/boot.php +++ b/boot.php @@ -44,7 +44,7 @@ require_once('include/Contact.php'); require_once('include/account.php'); -define ( 'RED_PLATFORM', 'Red Matrix' ); +define ( 'RED_PLATFORM', 'redmatrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -- cgit v1.2.3 From fc93ee89a9d30d15a9dde4638f018303739f8d9d Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Thu, 18 Sep 2014 18:09:54 +0100 Subject: If a short ping causes lots of issues, and anyone who has been here a while tends to have a longer ping, we should probably have a longer ping --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 5118038d3..d412e82e4 100755 --- a/boot.php +++ b/boot.php @@ -982,9 +982,9 @@ class App { if ($user_scalable === false) $user_scalable = 1; - $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 40000); + $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 80000); if($interval < 10000) - $interval = 40000; + $interval = 80000; if(! x($this->page,'title')) $this->page['title'] = $this->config['system']['sitename']; -- cgit v1.2.3 From f203d2a3b0955211b00743d2cc6c3a8a1347bbdd Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 23 Sep 2014 20:36:10 -0700 Subject: diaspora private mail seems to work now - but there's an obfuscation leak via the conversation structure that needs to be dealt with. --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d412e82e4..dc94f202e 100755 --- a/boot.php +++ b/boot.php @@ -553,6 +553,7 @@ define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled define ( 'ITEM_OBSCURED', 0x1000); // bit-mangled to protect from casual browsing by site admin define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was successful define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to. +define ( 'ITEM_RSS', 0x8000); // Item comes from a feed. Use this to decide whether to link the title // Don't make us evaluate this same item again. /** * -- cgit v1.2.3 From f8468b4c3aeeb51f485c6bb7107f5b64a9643c85 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 29 Sep 2014 23:36:41 -0700 Subject: allow custom role permissions and fix site timezone. --- boot.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index dc94f202e..563ed0fe1 100755 --- a/boot.php +++ b/boot.php @@ -716,10 +716,8 @@ class App { function __construct() { - global $default_timezone; - $this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC'); - - date_default_timezone_set($this->timezone); + // we'll reset this after we read our config file + date_default_timezone_set('UTC'); $this->config = array('system'=>array()); $this->page = array(); -- cgit v1.2.3 From 2db7d88e285f2deb6d75d961bccfa396cd4eaae6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 14 Oct 2014 18:02:34 -0700 Subject: this is the reason Diaspora forum tagging was broken --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 563ed0fe1..1824e792f 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ define ( 'RED_PLATFORM', 'redmatrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1129 ); +define ( 'DB_UPDATE_VERSION', 1130 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 7bbe700f3f170cc4527131165a9b9ab1f99e5cd1 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 16 Oct 2014 16:19:19 -0700 Subject: mark signature forgeries --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1824e792f..14d0a61a5 100755 --- a/boot.php +++ b/boot.php @@ -555,6 +555,7 @@ define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was success define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to. define ( 'ITEM_RSS', 0x8000); // Item comes from a feed. Use this to decide whether to link the title // Don't make us evaluate this same item again. + /** * * Reverse the effect of magic_quotes_gpc if it is enabled. -- cgit v1.2.3 From cb15c73dae51c7001fa7277ef4d324645f72c5c3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 20 Oct 2014 16:47:58 -0700 Subject: move all theme initialisation to one place - just after calling module_init. Revert if there are serious issues, but please note the issues in as much detail as possible so we can work through them. --- boot.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 14d0a61a5..abbf48636 100755 --- a/boot.php +++ b/boot.php @@ -1880,13 +1880,9 @@ function get_custom_nav(&$a,$navname) { } -function construct_page(&$a) { - +function load_pdl(&$a) { require_once('include/comanche.php'); - // in case a page has overloaded a module, see if we already have a layout defined - // otherwise, if a pdl file exists for this module, use it - if(! count($a->layout)) { $n = 'mod_' . $a->module . '.pdl' ; $u = comanche_get_channel_id(); @@ -1898,12 +1894,20 @@ function construct_page(&$a) { comanche_parser($a,$s); } - $comanche = ((count($a->layout)) ? true : false); +} + + + +function construct_page(&$a) { + /** * Build the page - now that we have all the components */ + + $comanche = ((count($a->layout)) ? true : false); + require_once(theme_include('theme_init.php')); $installing = false; -- cgit v1.2.3 From c33efc2b000355bb363681ee7f454cea8feaa5c0 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 2 Nov 2014 15:31:04 +0000 Subject: Remove pixelbits from directory fallback - blocked public searches provide no results. --- boot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index abbf48636..dae58eccf 100755 --- a/boot.php +++ b/boot.php @@ -74,7 +74,6 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://redmatrix.nl', 'https://whogotzot.com', 'https://red.zottel.red', - 'https://red.pixelbits.de' ); -- cgit v1.2.3 From 53292cfe8669a81d180e472fa80879da9112bcfa Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 2 Nov 2014 19:51:22 +0000 Subject: Pixelbit restored. Going forwards, we probably want to add a check that a directory is returning something in find_upstream_directory() since this was spotted by a new install who thought *they* were broken. --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index dae58eccf..1d940961b 100755 --- a/boot.php +++ b/boot.php @@ -74,6 +74,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://redmatrix.nl', 'https://whogotzot.com', 'https://red.zottel.red', + 'https://red.pixelbits.de' ); -- cgit v1.2.3 From ba7f1bb8eee5f5374246a512b6c510f874f417ce Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Nov 2014 15:24:24 -0800 Subject: configurable visual alerts/notifications --- boot.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1d940961b..af772b3d7 100755 --- a/boot.php +++ b/boot.php @@ -377,6 +377,22 @@ define ( 'NOTIFY_POKE', 0x0200 ); define ( 'NOTIFY_SYSTEM', 0x8000 ); +/** + * visual notification options + */ + +define ( 'VNOTIFY_NETWORK', 0x0001 ); +define ( 'VNOTIFY_CHANNEL', 0x0002 ); +define ( 'VNOTIFY_MAIL', 0x0004 ); +define ( 'VNOTIFY_EVENT', 0x0008 ); +define ( 'VNOTIFY_EVENTTODAY', 0x0010 ); +define ( 'VNOTIFY_BIRTHDAY', 0x0020 ); +define ( 'VNOTIFY_SYSTEM', 0x0040 ); +define ( 'VNOTIFY_INFO', 0x0080 ); +define ( 'VNOTIFY_ALERT', 0x0100 ); +define ( 'VNOTIFY_INTRO', 0x0200 ); +define ( 'VNOTIFY_REGISTER', 0x0400 ); + // We need a flag to designate that a site is a // global directory mirror, but probably doesn't -- cgit v1.2.3 From d5d6158973ecb83b63d42c57c96dce849842c83b Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Nov 2014 17:11:02 -0800 Subject: ok heads up - potentially destabilising change. I've tried to sort out all the default connection permissions for those who don't have a predefined (or therefore have a "custom") permissions role. Unfortunately this includes most people that were using this software more than a month ago. The real changes are that the SELF address book entry no longer holds "auto-permissions" but instead holds your "default permissions" (if you have a pre-defined role, the defaults will be pulled from the role table). The auto permissions have moved to a pconfig (uid.system.autoperms). A DB update will move these settings into their new homes. What used to be the "Auto-permissions settings" page is now the "default permissions settings" page and a checkbox therein decides whether or not to apply the permissions automatically. A link to this page will only be shown when you have the "custom" role selected. With luck nobody will notice anything wrong. But at least for the next few days, please review permissions that have been assigned to new connections (either automatically or manually) and make sure they make sense (e.g. they aren't "nothing"). You still need to take action when seeing a message "permissions have changed but not yet submitted" as we always let you review and perhaps adjust the settings _before_ a connection is established (unless you have autoperms turned on). --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index af772b3d7..1d4cd6f72 100755 --- a/boot.php +++ b/boot.php @@ -48,7 +48,7 @@ define ( 'RED_PLATFORM', 'redmatrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1130 ); +define ( 'DB_UPDATE_VERSION', 1131 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 1fbd1a79c7a19ff51b9e8ab4bad67ec0bf687839 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 6 Nov 2014 17:27:28 -0800 Subject: Provide a way to mark photos as adult and hide them from the default album view. Still need a button or setting to enable "unsafe viewing". This has no effect anywhere but in the album views. They can still be viewed by flipping through the individual photos with 'prev' and 'next'. We probably need a comprehensive strategy for how to deal with n-s-f-w photos in albums so consider this a band-aid which requires additional work and integration with other facilities which access these photos. It is entirely optional. --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1d4cd6f72..76c09d956 100755 --- a/boot.php +++ b/boot.php @@ -230,6 +230,7 @@ define ( 'PHOTO_NORMAL', 0x0000 ); define ( 'PHOTO_PROFILE', 0x0001 ); define ( 'PHOTO_XCHAN', 0x0002 ); define ( 'PHOTO_THING', 0x0004 ); +define ( 'PHOTO_ADULT', 0x0008 ); /** * Menu types -- cgit v1.2.3 From f077badcb61777810aed21717092a1793bd79b1d Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 6 Nov 2014 23:50:54 -0800 Subject: include self in load_contact_links so you don't get a connect menu entry for yourself --- boot.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 76c09d956..f8c91dfbb 100755 --- a/boot.php +++ b/boot.php @@ -1804,9 +1804,8 @@ function load_contact_links($uid) { // logger('load_contact_links'); - $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d) ", - intval($uid), - intval(ABOOK_FLAG_SELF) + $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d ", + intval($uid) ); if($r) { foreach($r as $rr){ -- cgit v1.2.3 From 62094652333514e92f9f00699e14b9f49680bb64 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 10 Nov 2014 15:21:04 -0800 Subject: add public forum identification to libzot. No attempt is made to identify other types of forums or weird custom channel permissions. If the channel is auto-accept and taggable, it's a public forum. --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f8c91dfbb..4b1c008cd 100755 --- a/boot.php +++ b/boot.php @@ -414,6 +414,7 @@ define ( 'XCHAN_FLAGS_ORPHAN', 0x0002); define ( 'XCHAN_FLAGS_CENSORED', 0x0004); define ( 'XCHAN_FLAGS_SELFCENSORED', 0x0008); define ( 'XCHAN_FLAGS_SYSTEM', 0x0010); +define ( 'XCHAN_FLAGS_PUBFORUM', 0x0020); define ( 'XCHAN_FLAGS_DELETED', 0x1000); /* * Traficlights for Administration of HubLoc -- cgit v1.2.3 From b5af6679857eeafcb360d7dec69acf11af034c1d Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Nov 2014 19:29:30 -0800 Subject: slow progress on sys publishing, making sure all the data we need is in the places we need it but validate it anyway --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4b1c008cd..fb059f8b0 100755 --- a/boot.php +++ b/boot.php @@ -677,8 +677,8 @@ class App { public $css_sources = array(); public $js_sources = array(); public $theme_info = array(); - - public $nav_sel; + public $is_sys = false; + public $nav_sel; public $category; -- cgit v1.2.3 From fc2bf4c29b45a97ec745c26821cc31cfe97f091c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Thu, 13 Nov 2014 00:00:50 +0100 Subject: Some Doxygen documentation. Add some more Doxygen formating for boot.php and dba_driver.php. Cleaning a bit up, too. --- boot.php | 324 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 162 insertions(+), 162 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index fb059f8b0..d883dcc28 100755 --- a/boot.php +++ b/boot.php @@ -1,6 +1,8 @@ ' . "\r\n" ); +define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'NULL_DATE', '0000-00-00 00:00:00' ); define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' ); @@ -196,7 +198,6 @@ define ( 'UPDATE_SUCCESS', 0); define ( 'UPDATE_FAILED', 1); - define ( 'CLIENT_MODE_NORMAL', 0x0000); define ( 'CLIENT_MODE_LOAD', 0x0001); define ( 'CLIENT_MODE_UPDATE', 0x0002); @@ -263,13 +264,11 @@ define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder * Permissions */ - define ( 'PERMS_R_STREAM', 0x00001); define ( 'PERMS_R_PROFILE', 0x00002); define ( 'PERMS_R_PHOTOS', 0x00004); define ( 'PERMS_R_ABOOK', 0x00008); - define ( 'PERMS_W_STREAM', 0x00010); define ( 'PERMS_W_WALL', 0x00020); define ( 'PERMS_W_TAGWALL', 0x00040); @@ -321,7 +320,6 @@ define ( 'ATTACH_FLAG_DIR', 0x0001); define ( 'ATTACH_FLAG_OS', 0x0002); - define ( 'MENU_ITEM_ZID', 0x0001); define ( 'MENU_ITEM_NEWWIN', 0x0002); define ( 'MENU_ITEM_CHATROOM', 0x0004); @@ -336,13 +334,11 @@ define ( 'POLL_MULTIPLE_CHOICE', 0x0004); define ( 'POLL_OVERWRITE', 0x8000); // If you vote twice remove the prior entry - define ( 'UPDATE_FLAGS_UPDATED', 0x0001); define ( 'UPDATE_FLAGS_FORCED', 0x0002); define ( 'UPDATE_FLAGS_DELETED', 0x1000); - define ( 'DROPITEM_NORMAL', 0); define ( 'DROPITEM_PHASE1', 1); define ( 'DROPITEM_PHASE2', 2); @@ -448,7 +444,6 @@ define ( 'TERM_OBJ_OBJECT', 5 ); define ( 'TERM_OBJ_THING', 6 ); define ( 'TERM_OBJ_APP', 7 ); - /** * various namespaces we may need to parse */ @@ -513,7 +508,6 @@ define ( 'GRAVITY_PARENT', 0); define ( 'GRAVITY_LIKE', 3); define ( 'GRAVITY_COMMENT', 6); - /** * Account Flags */ @@ -589,7 +583,6 @@ function startup() { @set_time_limit(0); if(function_exists ('ini_set')) { - // This has to be quite large to deal with embedded private photos @ini_set('pcre.backtrack_limit', 500000); @@ -615,7 +608,6 @@ function startup() { } unset($process); } - } /** @@ -630,8 +622,6 @@ function startup() { * before we spit the page out. * */ - - class App { public $install = false; // true if we are installing the software @@ -643,7 +633,6 @@ class App { public $poi = null; // "person of interest", generally a referenced connection public $layout = array(); // Comanche parsed template - private $perms = null; // observer permissions private $widgets = array(); // widgets for this page private $widgetlist = null; // widget ordering and inclusion directives @@ -672,7 +661,7 @@ class App { public $timezone; public $interactive = true; public $plugins; - private $apps = array(); + private $apps = array(); public $identities; public $css_sources = array(); public $js_sources = array(); @@ -680,16 +669,16 @@ class App { public $is_sys = false; public $nav_sel; - public $category; + public $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 $sourcename = ''; + public $videowidth = 425; + public $videoheight = 350; + public $force_max_items = 0; + public $theme_thread_allow = true; // An array for all theme-controllable parameters // Mostly unimplemented yet. Only options 'template_engine' and @@ -732,9 +721,7 @@ class App { private $cached_profile_picdate; - function __construct() { - // we'll reset this after we read our config file date_default_timezone_set('UTC'); @@ -753,7 +740,6 @@ class App { . 'library/langdet' . PATH_SEPARATOR . '.' ); - $this->scheme = 'http'; if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS']) $this->scheme = 'https'; @@ -792,7 +778,6 @@ class App { $this->cmd = 'channel/' . substr($this->cmd,1); - /** * * Break the URL path into C style argc/argv style arguments for our @@ -820,7 +805,6 @@ class App { $this->module = 'home'; } - /** * See if there is any page number information, and initialise * pagination @@ -857,8 +841,6 @@ class App { } function get_baseurl($ssl = false) { - - if(is_array($this->config) && array_key_exists('system',$this->config) && is_array($this->config['system']) @@ -868,7 +850,6 @@ class App { return $url; } - $scheme = $this->scheme; $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); @@ -933,7 +914,6 @@ class App { return $this->channel; } - function set_observer($xchan) { $this->observer = $xchan; } @@ -1097,6 +1077,7 @@ class App { break; }*/ } + function get_template_ldelim($engine = 'smarty3') { return $this->ldelim[$engine]; } @@ -1107,7 +1088,6 @@ class App { function head_set_icon($icon) { $this->data['pageicon'] = $icon; - } function head_get_icon() { @@ -1117,7 +1097,7 @@ class App { return $icon; } -} +} // End App class // retrieve the App structure @@ -1129,21 +1109,26 @@ function get_app() { } - -// Multi-purpose function to check variable state. -// Usage: x($var) or $x($array,'key') -// returns false if variable/key is not set -// if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0. -// e.g. x('') or x(0) returns 0; - - -function x($s,$k = NULL) { - if($k != NULL) { - if((is_array($s)) && (array_key_exists($k,$s))) { +/** + * @brief Multi-purpose function to check variable state. + * + * Usage: x($var) or $x($array, 'key') + * + * returns false if variable/key is not set + * if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0. + * e.g. x('') or x(0) returns 0; + * + * @param string|array $s variable to check + * @param string $k key inside the array to check + * @return bool + */ +function x($s, $k = null) { + if($k != null) { + if((is_array($s)) && (array_key_exists($k, $s))) { if($s[$k]) return (int) 1; return (int) 0; - } + } return false; } else { @@ -1160,7 +1145,6 @@ function x($s,$k = NULL) { // called from db initialisation if db is dead. - function system_unavailable() { include('include/system_unavailable.php'); system_down(); @@ -1170,6 +1154,7 @@ function system_unavailable() { function clean_urls() { global $a; + // if($a->config['system']['clean_urls']) return true; // return false; @@ -1177,9 +1162,11 @@ function clean_urls() { function z_path() { global $a; + $base = $a->get_baseurl(); if(! clean_urls()) $base .= '/?q='; + return $base; } @@ -1191,6 +1178,7 @@ function z_root() { function absurl($path) { if(strpos($path,'/') === 0) return z_path() . $path; + return $path; } @@ -1200,9 +1188,6 @@ function os_mkdir($path,$mode = 0777,$recursive = false) { @umask($oldumask); } - - - function is_ajax() { return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); } @@ -1212,7 +1197,6 @@ function is_ajax() { // base url for use in cmdline programs which don't have // $_SERVER variables, and synchronising the state of installed plugins. - function check_config(&$a) { $build = get_config('system','db_version'); @@ -1222,21 +1206,22 @@ function check_config(&$a) { $saved = get_config('system','urlverify'); if(! $saved) set_config('system','urlverify',bin2hex(z_root())); + if(($saved) && ($saved != bin2hex(z_root()))) { // our URL changed. Do something. $oldurl = hex2bin($saved); logger('Baseurl changed!'); - $oldhost = substr($oldurl,strpos($oldurl,'//')+2); - $host = substr(z_root(),strpos(z_root(),'//')+2); + $oldhost = substr($oldurl, strpos($oldurl, '//') + 2); + $host = substr(z_root(), strpos(z_root(), '//') + 2); $is_ip_addr = ((preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$host)) ? true : false); $was_ip_addr = ((preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$oldhost)) ? true : false); // only change the url to an ip address if it was already an ip and not a dns name if((! $is_ip_addr) || ($is_ip_addr && $was_ip_addr)) { fix_system_urls($oldurl,z_root()); - set_config('system','urlverify',bin2hex(z_root())); + set_config('system', 'urlverify', bin2hex(z_root())); } else logger('Attempt to change baseurl from a DNS name to an IP address was refused.'); @@ -1251,8 +1236,8 @@ function check_config(&$a) { // so we just need to keep this around a couple of weeks until the hubs that // already exist have one $syschan_exists = get_sys_channel(); - if (! $syschan_exists) - create_sys_channel(); + if (! $syschan_exists) + create_sys_channel(); if($build != DB_UPDATE_VERSION) { $stored = intval($build); @@ -1323,7 +1308,6 @@ function check_config(&$a) { } else set_config('database','update_r' . $x, 'success'); - } } set_config('system','db_version', DB_UPDATE_VERSION); @@ -1380,13 +1364,10 @@ function check_config(&$a) { } } - load_hooks(); - return; } - function fix_system_urls($oldurl,$newurl) { require_once('include/crypto.php'); @@ -1470,16 +1451,13 @@ 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']. // returns the complete html for inserting into the page - function login($register = false, $form_id = 'main-login', $hiddens=false) { $a = get_app(); - $o = ""; + $o = ''; $reg = false; $reglink = get_config('system','register_link'); if(! strlen($reglink)) @@ -1498,17 +1476,15 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { } else { $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"),array( - '$baseurl' => $a->get_baseurl(true) + '$baseurl' => $a->get_baseurl(true) )); $tpl = get_markup_template("login.tpl"); if(strlen($a->query_string)) - $_SESSION['login_return_url'] = $a->query_string; + $_SESSION['login_return_url'] = $a->query_string; } - $o .= replace_macros($tpl,array( - '$dest_url' => $dest_url, '$logout' => t('Logout'), '$login' => t('Login'), @@ -1517,14 +1493,12 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { '$lpassword' => array('password', t('Password'), '', ''), '$remember' => array('remember', t('Remember me'), '', ''), '$hiddens' => $hiddens, - '$register' => $reg, - '$lostpass' => t('Forgot your password?'), '$lostlink' => t('Password Reset'), )); - call_hooks('login_hook',$o); + call_hooks('login_hook', $o); return $o; } @@ -1532,7 +1506,6 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { // Used to end the current process, after saving session state. - function killme() { session_write_close(); exit; @@ -1541,33 +1514,44 @@ function killme() { // redirect to another URL and terminate this process. - function goaway($s) { header("Location: $s"); killme(); } - +/** + * @brief Returns the entity id of locally logged in account or false. + * + * Returns numeric account_id if authenticated or 0. It is possible to be + * authenticated and not connected to a channel. + * + * @return int|bool account_id or false + */ function get_account_id() { if(get_app()->account) return intval(get_app()->account['account_id']); + return false; } - -// Returns the entity id of locally logged in user or false. - - +/** + * @brief Returns the entity id of locally logged in user or false. + * + * Returns authenticated numeric channel_id if authenticated and connected to + * a channel or 0. Sometimes referred to as $uid in the code. + * + * @return int|bool channel_id or false + */ function local_user() { - if((x($_SESSION,'authenticated')) && (x($_SESSION,'uid'))) + if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'uid'))) return intval($_SESSION['uid']); + return false; } // Returns contact id of authenticated site visitor or false - function remote_user() { if((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id'))) return $_SESSION['visitor_id']; @@ -1578,15 +1562,14 @@ function remote_user() { // contents of $s are displayed prominently on the page the next time // a page is loaded. Usually used for errors or alerts. - function notice($s) { $a = get_app(); - if(! x($_SESSION,'sysmsg')) $_SESSION['sysmsg'] = array(); + if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array(); if($a->interactive) { // shameless plug, permission is denied and they have no identity. // There's a fairly good chance that they've not got zot. - if((stristr($s,t('permission denied'))) && (! get_observer_hash())) { - $s .= '
' . t('Got Zot?') . ''; + if((stristr($s, t('permission denied'))) && (! get_observer_hash())) { + $s .= '
' . t('Got Zot?') . ''; } $_SESSION['sysmsg'][] = $s; } @@ -1595,24 +1578,21 @@ function notice($s) { function info($s) { $a = get_app(); - if(! x($_SESSION,'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); + if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); if($a->interactive) $_SESSION['sysmsg_info'][] = $s; } - - -// wrapper around config to limit the text length of an incoming message - - +/** + * @brief Wrapper around config to limit the text length of an incoming message + * + * @return int + */ function get_max_import_size() { - return(intval(get_config('system','max_import_size'))); + return(intval(get_config('system', 'max_import_size'))); } - - - /** * * Wrap calls to proc_close(proc_open()) and call hook @@ -1626,8 +1606,6 @@ function get_max_import_size() { * * $cmd and string args are surrounded with "" */ - - function proc_run($cmd){ $a = get_app(); @@ -1660,24 +1638,28 @@ function proc_run($cmd){ 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'); - for($x = 0; $x < count($args); $x ++) + + for($x = 0; $x < count($args); $x++) $args[$x] = escapeshellarg($args[$x]); $cmdline = implode($args," "); - if(is_windows()) { $cwd = getcwd(); $cmd = "cmd /c start \"title\" /D \"$cwd\" /b $cmdline"; proc_close(proc_open($cmd, array(), $foo)); } else - proc_close(proc_open($cmdline." &",array(),$foo)); + proc_close(proc_open($cmdline ." &", array(), $foo)); } - +/** + * @brief Checks if we are running on M$ Windows. + * + * @return bool true if we run on M$ Windows + */ function is_windows() { - return ((strtoupper(substr(PHP_OS,0,3)) === 'WIN') ? true : false); + return ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false); } @@ -1709,7 +1691,6 @@ function current_theme(){ $page_theme = null; } - $is_mobile = $a->is_mobile || $a->is_tablet; $standard_system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); @@ -1724,7 +1705,7 @@ function current_theme(){ $system_theme = ((isset($a->config['system']['mobile_theme'])) ? $a->config['system']['mobile_theme'] : ''); $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile_theme')) ? $_SESSION['mobile_theme'] : $system_theme); - if($theme_name === '' || $theme_name === '---' ) { + if($theme_name === '' || $theme_name === '---' ) { // user has selected to have the mobile theme be the same as the normal one $system_theme = $standard_system_theme; $theme_name = $standard_theme_name; @@ -1732,21 +1713,20 @@ function current_theme(){ } } else { - $system_theme = $standard_system_theme; - $theme_name = $standard_theme_name; + $system_theme = $standard_system_theme; + $theme_name = $standard_theme_name; if($page_theme) $theme_name = $page_theme; } - if($theme_name && (file_exists('view/theme/' . $theme_name . '/css/style.css') || file_exists('view/theme/' . $theme_name . '/php/style.php'))) return($theme_name); foreach($app_base_themes as $t) { - if(file_exists('view/theme/' . $t . '/css/style.css')|| + if(file_exists('view/theme/' . $t . '/css/style.css') || file_exists('view/theme/' . $t . '/php/style.php')) return($t); } @@ -1771,9 +1751,17 @@ function current_theme_url($installing = false) { $opts .= ((x($a->layout,'schema')) ? '&schema=' . $a->layout['schema'] : ''); if(file_exists('view/theme/' . $t . '/php/style.php')) return('view/theme/' . $t . '/php/style.pcss' . $opts); + return('view/theme/' . $t . '/css/style.css'); } +/** + * @brief Check if current user has admin role. + * + * Check if the current user has ACCOUNT_ROLE_ADMIN. + * + * @return bool true if user is an admin + */ function is_site_admin() { $a = get_app(); if((intval($_SESSION['authenticated'])) @@ -1783,19 +1771,25 @@ function is_site_admin() { return false; } +/** + * @brief Check if current user has developer role. + * + * Check if the current user has ACCOUNT_ROLE_DEVELOPER. + * + * @return bool true if user is a developer + */ function is_developer() { $a = get_app(); if((intval($_SESSION['authenticated'])) && (is_array($a->account)) && ($a->account['account_roles'] & ACCOUNT_ROLE_DEVELOPER)) return true; + return false; } - function load_contact_links($uid) { - $a = get_app(); $ret = array(); @@ -1815,30 +1809,30 @@ function load_contact_links($uid) { } else $ret['empty'] = true; + $a->contacts = $ret; - return; } /** - * returns querystring as string from a mapped array + * @brief Returns querystring as string from a mapped array. * - * @param params Array + * @param array $params mapped array with query parameters + * @param string $name of parameter, default null * @return string */ - -function build_querystring($params, $name=null) { - $ret = ""; - foreach($params as $key=>$val) { +function build_querystring($params, $name = null) { + $ret = ''; + foreach($params as $key => $val) { if(is_array($val)) { - if($name==null) { + if($name === null) { $ret .= build_querystring($val, $key); } else { - $ret .= build_querystring($val, $name."[$key]"); + $ret .= build_querystring($val, $name . "[$key]"); } } else { $val = urlencode($val); - if($name!=null) { + if($name != null) { $ret .= $name . "[$key]" . "=$val&"; } else { $ret .= "$key=$val&"; @@ -1858,6 +1852,7 @@ function argc() { function argv($x) { if(array_key_exists($x,get_app()->argv)) return get_app()->argv[$x]; + return ''; } @@ -1869,15 +1864,16 @@ function get_observer_hash() { $observer = get_app()->get_observer(); if(is_array($observer)) return $observer['xchan_hash']; + return ''; } /** -* Returns the complete URL of the current page, e.g.: http(s)://something.com/network -* -* Taken from http://webcheatsheet.com/php/get_current_page_url.php -*/ + * Returns the complete URL of the current page, e.g.: http(s)://something.com/network + * + * Taken from http://webcheatsheet.com/php/get_current_page_url.php + */ function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} @@ -1890,13 +1886,20 @@ function curPageURL() { return $pageURL; } -function get_custom_nav(&$a,$navname) { +function get_custom_nav(&$a, $navname) { if(! $navname) return $a->page['nav']; // load custom nav menu by name here - } +/** + * @brief Loads a page definition file for a module. + * + * If there is no parsed Comanche template already load a module's pdl file + * and parse it with Comanche. + * + * @param App &$a global application object + */ function load_pdl(&$a) { require_once('include/comanche.php'); @@ -1904,34 +1907,34 @@ function load_pdl(&$a) { $n = 'mod_' . $a->module . '.pdl' ; $u = comanche_get_channel_id(); if($u) - $s = get_pconfig($u,'system',$n); + $s = get_pconfig($u, 'system', $n); + if((! $s) && (($p = theme_include($n)) != '')) $s = @file_get_contents($p); + if($s) - comanche_parser($a,$s); + comanche_parser($a, $s); } - } - - +/** + * @brief build the page. + * + * Build the page - now that we have all the components + * + * @param App &$a global application object + */ function construct_page(&$a) { - - /** - * Build the page - now that we have all the components - */ - - $comanche = ((count($a->layout)) ? true : false); require_once(theme_include('theme_init.php')); $installing = false; - if($a->module == 'setup') + if($a->module == 'setup') { $installing = true; - else { + } else { nav($a); } @@ -1941,7 +1944,6 @@ function construct_page(&$a) { } } - if(($p = theme_include(current_theme() . '.js')) != '') head_add_js($p); @@ -1950,10 +1952,10 @@ function construct_page(&$a) { require_once('include/js_strings.php'); - if(x($a->page,'template_style')) + if(x($a->page, 'template_style')) head_add_css($a->page['template_style'] . '.css'); else - head_add_css(((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.css'); + head_add_css(((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.css'); head_add_css('mod_' . $a->module . '.css'); head_add_css(current_theme_url($installing)); @@ -1963,11 +1965,12 @@ function construct_page(&$a) { $a->build_pagehead(); $arr = $a->get_widgets(); - ksort($arr,SORT_NUMERIC); + ksort($arr, SORT_NUMERIC); if(count($arr)) { foreach($arr as $x) { - if(! array_key_exists($x['location'],$a->page)) + if(! array_key_exists($x['location'], $a->page)) $a->page[$x['location']] = ''; + $a->page[$x['location']] .= $x['html']; } } @@ -1983,27 +1986,25 @@ function construct_page(&$a) { if($comanche) { $arr = array('module' => $a->module, 'layout' => $a->layout); - call_hooks('construct_page',$arr); + call_hooks('construct_page', $arr); $a->layout = $arr['layout']; foreach($a->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); + 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); } // And a couple of convenience macros - if(strpos($v,'$nav') !== false) { - $v = str_replace('$nav',$a->page['nav'],$v); + if(strpos($v, '$nav') !== false) { + $v = str_replace('$nav', $a->page['nav'], $v); } - if(strpos($v,'$content') !== false) { - - $v = str_replace('$content',$a->page['content'],$v); + if(strpos($v, '$content') !== false) { + $v = str_replace('$content', $a->page['content'], $v); } - $a->page[substr($k,7)] = $v; - + $a->page[substr($k, 7)] = $v; } } } @@ -2030,13 +2031,8 @@ function construct_page(&$a) { header("Content-type: text/html; charset=utf-8"); require_once(theme_include( - ((x($a->page,'template')) - ? $a->page['template'] - : 'default' ) - . '.php' ) + ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php' ) ); - - return; } @@ -2047,20 +2043,24 @@ function appdirpath() { function head_set_icon($icon) { global $a; + $a->data['pageicon'] = $icon; // logger('head_set_icon: ' . $icon); } function head_get_icon() { global $a; + $icon = $a->data['pageicon']; - if(! strpos($icon,'://')) + if(! strpos($icon, '://')) $icon = z_root() . $icon; + return $icon; } function get_directory_realm() { - if($x = get_config('system','directory_realm')) + if($x = get_config('system', 'directory_realm')) return $x; + return DIRECTORY_REALM; } -- cgit v1.2.3 From 1a5a5c7edb8697c93f8bababbafa80245378dd7e Mon Sep 17 00:00:00 2001 From: Habeas Codice Date: Thu, 13 Nov 2014 12:21:58 -0800 Subject: PostgreSQL support initial commit There were 11 main types of changes: - UPDATE's and DELETE's sometimes had LIMIT 1 at the end of them. This is not only non-compliant but it would certainly not do what whoever wrote it thought it would. It is likely this mistake was just copied from Friendica. All of these instances, the LIMIT 1 was simply removed. - Bitwise operations (and even some non-zero int checks) erroneously rely on MySQL implicit integer-boolean conversion in the WHERE clauses. This is non-compliant (and bad programming practice to boot). Proper explicit boolean conversions were added. New queries should use proper conventions. - MySQL has a different operator for bitwise XOR than postgres. Rather than add yet another dba_ func, I converted them to "& ~" ("AND NOT") when turning off, and "|" ("OR") when turning on. There were no true toggles (XOR). New queries should refrain from using XOR when not necessary. - There are several fields which the schema has marked as NOT NULL, but the inserts don't specify them. The reason this works is because mysql totally ignores the constraint and adds an empty text default automatically. Again, non-compliant, obviously. In these cases a default of empty text was added. - Several statements rely on a non-standard MySQL feature (http://dev.mysql.com/doc/refman/5.5/en/group-by-handling.html). These queries can all be rewritten to be standards compliant. Interestingly enough, the newly rewritten standards compliant queries run a zillion times faster, even on MySQL. - A couple of function/operator name translations were needed (RAND/RANDOM, GROUP_CONCAT/STRING_AGG, UTC_NOW, REGEXP/~, ^/#) -- assist functions added in the dba_ - INTERVALs: postgres requires quotes around the value, mysql requires that there are not quotes around the value -- assist functions added in the dba_ - NULL_DATE's -- Postgres does not allow the invalid date '0000-00-00 00:00:00' (there is no such thing as year 0 or month 0 or day 0). We use '0001-01-01 00:00:00' for postgres. Conversions are handled in Zot/item packets automagically by quoting all dates with dbescdate(). - char(##) specifications in the schema creates fields with blank spaces that aren't trimmed in the code. MySQL apparently treats char(##) as varchar(##), again, non-compliant. Since postgres works better with text fields anyway, this ball of bugs was simply side-stepped by using 'text' datatype for all text fields in the postgres schema. varchar was used in a couple of places where it actually seemed appropriate (size constraint), but without rigorously vetting that all of the PHP code actually validates data, new bugs might come out from under the rug. - postgres doesn't store nul bytes and a few other non-printables in text fields, even when quoted. bytea fields were used when storing binary data (photo.data, attach.data). A new dbescbin() function was added to handle this transparently. - postgres does not support LIMIT #,# syntax. All databases support LIMIT # OFFSET # syntax. Statements were updated to be standard. These changes require corresponding changes in the coding standards. Please review those before adding any code going forward. Still on my TODO list: - remove quotes from non-reserved identifiers and make reserved identifiers use dba func for quoting - Rewrite search queries for better results (both MySQL and Postgres) --- boot.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index abbf48636..085e6b36b 100755 --- a/boot.php +++ b/boot.php @@ -52,7 +52,7 @@ define ( 'DB_UPDATE_VERSION', 1130 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -define ( 'NULL_DATE', '0000-00-00 00:00:00' ); +//define ( 'NULL_DATE', '0000-00-00 00:00:00' ); define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' ); define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000 @@ -555,7 +555,9 @@ define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was success define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to. define ( 'ITEM_RSS', 0x8000); // Item comes from a feed. Use this to decide whether to link the title // Don't make us evaluate this same item again. - +define ( 'DBTYPE_MYSQL', 0 ); +define ( 'DBTYPE_POSTGRES', 1 ); + /** * * Reverse the effect of magic_quotes_gpc if it is enabled. @@ -1417,7 +1419,7 @@ function fix_system_urls($oldurl,$newurl) { $replace_xchan_url = ((strpos($rr['xchan_url'],$oldurl) !== false) ? true : false); - $x = q("update xchan set xchan_addr = '%s', xchan_url = '%s', xchan_connurl = '%s', xchan_follow = '%s', xchan_connpage = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_date = '%s' where xchan_hash = '%s' limit 1", + $x = q("update xchan set xchan_addr = '%s', xchan_url = '%s', xchan_connurl = '%s', xchan_follow = '%s', xchan_connpage = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_date = '%s' where xchan_hash = '%s'", dbesc($channel_address . '@' . $rhs), dbesc(($replace_xchan_url) ? str_replace($oldurl,$newurl,$rr['xchan_url']) : $rr['xchan_url']), dbesc(str_replace($oldurl,$newurl,$rr['xchan_connurl'])), @@ -1430,7 +1432,7 @@ function fix_system_urls($oldurl,$newurl) { dbesc($rr['xchan_hash']) ); - $y = q("update hubloc set hubloc_addr = '%s', hubloc_url = '%s', hubloc_url_sig = '%s', hubloc_host = '%s', hubloc_callback = '%s' where hubloc_hash = '%s' and hubloc_url = '%s' limit 1", + $y = q("update hubloc set hubloc_addr = '%s', hubloc_url = '%s', hubloc_url_sig = '%s', hubloc_host = '%s', hubloc_callback = '%s' where hubloc_hash = '%s' and hubloc_url = '%s'", dbesc($channel_address . '@' . $rhs), dbesc($newurl), dbesc(base64url_encode(rsa_sign($newurl,$c[0]['channel_prvkey']))), @@ -1787,7 +1789,7 @@ function load_contact_links($uid) { // logger('load_contact_links'); - $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d) ", + $r = q("SELECT abook_id, abook_flags, abook_my_perms, abook_their_perms, xchan_hash, xchan_photo_m, xchan_name, xchan_url from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and not (abook_flags & %d)>0 ", intval($uid), intval(ABOOK_FLAG_SELF) ); -- cgit v1.2.3 From e4859d4bd70b1649e7ebe4cbb285a0993a837f85 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Thu, 13 Nov 2014 22:40:06 +0100 Subject: Changed two strange looking places in boot.php. There have been two places that looked wrong, but I don't know how I can test them. So please review and test if I am not wrong. --- boot.php | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d883dcc28..0feedf7a1 100755 --- a/boot.php +++ b/boot.php @@ -76,7 +76,7 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://redmatrix.nl', 'https://whogotzot.com', 'https://red.zottel.red', - 'https://red.pixelbits.de' + 'https://red.pixelbits.de' ); @@ -635,7 +635,7 @@ class App { private $perms = null; // observer permissions private $widgets = array(); // widgets for this page - private $widgetlist = null; // widget ordering and inclusion directives + //private $widgetlist = null; // widget ordering and inclusion directives public $groups; public $language; @@ -712,13 +712,6 @@ class App { private $hostname; private $baseurl; private $path; - private $db; - - private $curl_code; - private $curl_headers; - - private $cached_profile_image; - private $cached_profile_picdate; function __construct() { @@ -847,12 +840,14 @@ class App { && array_key_exists('baseurl',$this->config['system']) && strlen($this->config['system']['baseurl'])) { $url = $this->config['system']['baseurl']; + return $url; } $scheme = $this->scheme; $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); + return $this->baseurl; } @@ -879,7 +874,6 @@ class App { if(x($parsed,'path')) $this->path = trim($parsed['path'],'\\/'); } - } function get_hostname() { @@ -953,9 +947,10 @@ class App { function get_widgets($location = '') { if($location && count($this->widgets)) { $ret = array(); - foreach($widgets as $w) - if($w['location'] == $location) + foreach($this->widgets as $w) { + if ($w['location'] == $location) $ret[] = $w; + } $arr = array('location' => $location, 'widgets' => $ret); call_hooks('get_widgets', $arr); return $arr['widgets']; @@ -1007,7 +1002,6 @@ class App { // always put main.js at the end $this->page['htmlhead'] .= head_get_main_js(); - } /** @@ -1017,11 +1011,11 @@ class App { * @param string $name */ function register_template_engine($class, $name = '') { - if ($name===""){ + if ($name === ""){ $v = get_class_vars( $class ); - if(x($v,"name")) $name = $v['name']; + if(x($v, "name")) $name = $v['name']; } - if ($name===""){ + if ($name === ""){ echo "template engine $class cannot be registered without a name.\n"; killme(); } @@ -1032,11 +1026,11 @@ class App { * return template engine instance. If $name is not defined, * return engine defined by theme, or default * - * @param strin $name Template engine name + * @param string $name Template engine name * @return object Template Engine instance */ function template_engine($name = ''){ - if ($name!=="") { + if ($name !== "") { $template_engine = $name; } else { $template_engine = 'smarty3'; @@ -1886,6 +1880,17 @@ function curPageURL() { return $pageURL; } +/** + * @brief Returns a custom navigation by name??? + * + * If no $navname provided load default page['nav'] + * + * @todo not fully implemented yet + * + * @param App $a global application object + * @param string $navname + * @return mixed + */ function get_custom_nav(&$a, $navname) { if(! $navname) return $a->page['nav']; @@ -1940,7 +1945,7 @@ function construct_page(&$a) { if($comanche) { if($a->layout['nav']) { - $a->page['nav'] = get_custom_nav($a->layout['nav']); + $a->page['nav'] = get_custom_nav($a, $a->layout['nav']); } } -- cgit v1.2.3 From e8b77fbdff6cfd9455db378b5edb00fece74fea2 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Fri, 14 Nov 2014 00:45:25 +0100 Subject: Fixed a variable conflict in mod/xchan.php. A variable $rr inside the foreachs was used twice. Add translation to mod/xchan.php. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 0feedf7a1..55ae3cc66 100755 --- a/boot.php +++ b/boot.php @@ -950,7 +950,7 @@ class App { foreach($this->widgets as $w) { if ($w['location'] == $location) $ret[] = $w; - } + } $arr = array('location' => $location, 'widgets' => $ret); call_hooks('get_widgets', $arr); return $arr['widgets']; -- cgit v1.2.3 From 1c249a5b06279ea4a19433d45a8dbe6fd71bcd25 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 16 Nov 2014 15:51:42 -0800 Subject: some poller optimisations and a fix for undefined (empty) dbtype which shows up as a mysql error that 'rand' isn't found. --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 7758d1933..569162221 100755 --- a/boot.php +++ b/boot.php @@ -567,7 +567,8 @@ define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was success define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to. define ( 'ITEM_RSS', 0x8000); // Item comes from a feed. Use this to decide whether to link the title // Don't make us evaluate this same item again. -define ( 'DBTYPE_MYSQL', 0 ); + +define ( 'DBTYPE_MYSQL', 0 ); define ( 'DBTYPE_POSTGRES', 1 ); /** -- cgit v1.2.3 From d9ac9df172337f55bd3c3a84962baf5a1304fab9 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 25 Nov 2014 01:31:33 +0000 Subject: Update dir fallbacks. --- boot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 569162221..b2c8fa9ea 100755 --- a/boot.php +++ b/boot.php @@ -74,7 +74,6 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://zothub.com', 'https://zotid.net', 'https://redmatrix.nl', - 'https://whogotzot.com', 'https://red.zottel.red', 'https://red.pixelbits.de' ); -- cgit v1.2.3 From 78c37bc325dcfea0b2328768b3dd42931c70f0a1 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Thu, 4 Dec 2014 01:34:58 +0000 Subject: Put dir back - the fat lady didn't sing afterall. --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b2c8fa9ea..3fdaa55f0 100755 --- a/boot.php +++ b/boot.php @@ -75,7 +75,8 @@ $DIRECTORY_FALLBACK_SERVERS = array( 'https://zotid.net', 'https://redmatrix.nl', 'https://red.zottel.red', - 'https://red.pixelbits.de' + 'https://red.pixelbits.de', + 'https://whogotzot.com' ); -- cgit v1.2.3 From 63646a144015d788634db974f144a1993b0465cc Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 7 Dec 2014 19:27:14 +0100 Subject: Some Doxygen comments and small cleanups. --- boot.php | 188 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 138 insertions(+), 50 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 3fdaa55f0..8a212a11d 100755 --- a/boot.php +++ b/boot.php @@ -27,7 +27,6 @@ * documented. */ - require_once('include/config.php'); require_once('include/network.php'); require_once('include/plugin.php'); @@ -570,7 +569,7 @@ define ( 'ITEM_RSS', 0x8000); // Item comes from a feed. Use this t define ( 'DBTYPE_MYSQL', 0 ); define ( 'DBTYPE_POSTGRES', 1 ); - + /** * * Reverse the effect of magic_quotes_gpc if it is enabled. @@ -614,10 +613,10 @@ function startup() { } /** - * * class: App * - * Our main application structure for the life of this page + * @brief Our main application structure for the life of this page. + * * Primarily deals with the URL that got us here * and tries to make some sense of it, and * stores our page contents and config storage @@ -683,11 +682,15 @@ class App { public $force_max_items = 0; public $theme_thread_allow = true; - // An array for all theme-controllable parameters - // Mostly unimplemented yet. Only options 'template_engine' and - // beyond are used. - - private $theme = array( + /** + * @brief An array for all theme-controllable parameters + * + * Mostly unimplemented yet. Only options 'template_engine' and + * beyond are used. + * + * @var array + */ + private $theme = array( 'sourcename' => '', 'videowidth' => 425, 'videoheight' => 350, @@ -697,9 +700,17 @@ class App { 'template_engine' => 'smarty3', ); - // array of registered template engines ('name'=>'class name') + /** + * array of registered template engines ('name'=>'class name') + * + * @var array + */ public $template_engines = array(); - // array of instanced template engines ('name'=>'instance') + /** + * array of instanced template engines ('name'=>'instance') + * + * @var array + */ public $template_engine_instance = array(); private $ldelim = array( @@ -716,7 +727,9 @@ class App { private $baseurl; private $path; - + /** + * App constructor. + */ function __construct() { // we'll reset this after we read our config file date_default_timezone_set('UTC'); @@ -759,8 +772,8 @@ class App { set_include_path("include/$this->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); + if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") { + $this->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); @@ -770,8 +783,8 @@ class App { // unix style "homedir" - if(substr($this->cmd,0,1) === '~') - $this->cmd = 'channel/' . substr($this->cmd,1); + if(substr($this->cmd, 0, 1) === '~') + $this->cmd = 'channel/' . substr($this->cmd, 1); /** @@ -855,7 +868,6 @@ class App { } function set_baseurl($url) { - if(is_array($this->config) && array_key_exists('system',$this->config) && is_array($this->config['system']) @@ -888,7 +900,7 @@ class App { } function set_path($p) { - $this->path = trim(trim($p),'/'); + $this->path = trim(trim($p), '/'); } function get_path() { @@ -1030,6 +1042,7 @@ class App { * return engine defined by theme, or default * * @param string $name Template engine name + * * @return object Template Engine instance */ function template_engine($name = ''){ @@ -1056,6 +1069,11 @@ class App { echo "template engine $template_engine is not registered!\n"; killme(); } + /** + * @brief Returns the active template engine. + * + * @return string + */ function get_template_engine() { return $this->theme['template_engine']; } @@ -1097,9 +1115,13 @@ class App { } // End App class -// retrieve the App structure -// useful in functions which require it but don't get it passed to them - +/** + * @brief Retrieve the App structure. + * + * Useful in functions which require it but don't get it passed to them + * + * @return App + */ function get_app() { global $a; return $a; @@ -1117,7 +1139,8 @@ function get_app() { * * @param string|array $s variable to check * @param string $k key inside the array to check - * @return bool + * + * @return bool|int */ function x($s, $k = null) { if($k != null) { @@ -1167,24 +1190,43 @@ function z_path() { return $base; } +/** + * @brief Returns the baseurl. + * + * @see App::get_baseurl() + * + * @return string + */ function z_root() { global $a; return $a->get_baseurl(); } +/** + * @brief Return absolut URL for given $path. + * + * @param string $path + * + * @return string + */ function absurl($path) { - if(strpos($path,'/') === 0) + if(strpos($path, '/') === 0) return z_path() . $path; return $path; } -function os_mkdir($path,$mode = 0777,$recursive = false) { +function os_mkdir($path, $mode = 0777, $recursive = false) { $oldumask = @umask(0); @mkdir($path, $mode, $recursive); @umask($oldumask); } +/** + * @brief Function to check if request was an AJAX (xmlhttprequest) request. + * + * @return boolean + */ function is_ajax() { return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); } @@ -1332,11 +1374,11 @@ function check_config(&$a) { else $installed = array(); - $plugins = get_config('system','addon'); + $plugins = get_config('system', 'addon'); $plugins_arr = array(); if($plugins) - $plugins_arr = explode(',',str_replace(' ', '',$plugins)); + $plugins_arr = explode(',', str_replace(' ', '', $plugins)); $a->plugins = $plugins_arr; @@ -1344,7 +1386,7 @@ function check_config(&$a) { if(count($installed)) { foreach($installed as $i) { - if(! in_array($i['name'],$plugins_arr)) { + if(! in_array($i['name'], $plugins_arr)) { unload_plugin($i['name']); } else { @@ -1355,7 +1397,7 @@ function check_config(&$a) { if(count($plugins_arr)) { foreach($plugins_arr as $p) { - if(! in_array($p,$installed_arr)) { + if(! in_array($p, $installed_arr)) { load_plugin($p); } } @@ -1365,7 +1407,7 @@ function check_config(&$a) { } -function fix_system_urls($oldurl,$newurl) { +function fix_system_urls($oldurl, $newurl) { require_once('include/crypto.php'); @@ -1456,7 +1498,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { $a = get_app(); $o = ''; $reg = false; - $reglink = get_config('system','register_link'); + $reglink = get_config('system', 'register_link'); if(! strlen($reglink)) $reglink = 'register'; @@ -1472,7 +1514,7 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { $tpl = get_markup_template("logout.tpl"); } else { - $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"),array( + $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"), array( '$baseurl' => $a->get_baseurl(true) )); @@ -1501,16 +1543,17 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { } -// Used to end the current process, after saving session state. - +/** + * @brief Used to end the current process, after saving session state. + */ function killme() { session_write_close(); exit; } - -// redirect to another URL and terminate this process. - +/** + * @brief Redirect to another URL and terminate this process. + */ function goaway($s) { header("Location: $s"); killme(); @@ -1532,7 +1575,7 @@ function get_account_id() { } /** - * @brief Returns the entity id of locally logged in user or false. + * @brief Returns the entity id (channel_id) of locally logged in user or false. * * Returns authenticated numeric channel_id if authenticated and connected to * a channel or 0. Sometimes referred to as $uid in the code. @@ -1546,22 +1589,28 @@ function local_user() { return false; } - -// Returns contact id of authenticated site visitor or false - +/** + * @brief Returns contact id (visitor_id) of authenticated site visitor or false. + * + * @return int|bool visitor_id or false + */ function remote_user() { - if((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id'))) + if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) return $_SESSION['visitor_id']; + return false; } - -// contents of $s are displayed prominently on the page the next time -// a page is loaded. Usually used for errors or alerts. - +/** + * Contents of $s are displayed prominently on the page the next time + * a page is loaded. Usually used for errors or alerts. + * + * @param string $s Text to display + */ function notice($s) { $a = get_app(); if(! x($_SESSION, 'sysmsg')) $_SESSION['sysmsg'] = array(); + if($a->interactive) { // shameless plug, permission is denied and they have no identity. // There's a fairly good chance that they've not got zot. @@ -1572,7 +1621,13 @@ function notice($s) { } } - +/** + * Contents of $s are displayed prominently on the page the next time a page is + * loaded. Usually used for information. + * For error and alerts use notice(). + * + * @param string $s Text to display + */ function info($s) { $a = get_app(); if(! x($_SESSION, 'sysmsg_info')) $_SESSION['sysmsg_info'] = array(); @@ -1736,13 +1791,19 @@ function current_theme(){ /** - * Return full URL to theme which is currently in effect. + * @brief Return full URL to theme which is currently in effect. + * * Provide a sane default if nothing is chosen or the specified theme does not exist. + * + * @param bool $installing default false + * + * @return string */ - function current_theme_url($installing = false) { global $a; + $t = current_theme(); + $opts = ''; $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : ''); $opts .= ((x($a->layout,'schema')) ? '&schema=' . $a->layout['schema'] : ''); @@ -1761,10 +1822,12 @@ function current_theme_url($installing = false) { */ function is_site_admin() { $a = get_app(); + if((intval($_SESSION['authenticated'])) && (is_array($a->account)) && ($a->account['account_roles'] & ACCOUNT_ROLE_ADMIN)) return true; + return false; } @@ -1816,6 +1879,7 @@ function load_contact_links($uid) { * * @param array $params mapped array with query parameters * @param string $name of parameter, default null + * * @return string */ function build_querystring($params, $name = null) { @@ -1857,6 +1921,11 @@ function dba_timer() { return microtime(true); } +/** + * @brief Returns xchan_hash from the observer. + * + * @return string Empty if no observer, otherwise xchan_hash from observer + */ function get_observer_hash() { $observer = get_app()->get_observer(); if(is_array($observer)) @@ -1892,6 +1961,7 @@ function curPageURL() { * * @param App $a global application object * @param string $navname + * * @return mixed */ function get_custom_nav(&$a, $navname) { @@ -2043,12 +2113,20 @@ function construct_page(&$a) { ); } - +/** + * @brief Returns RedMatrix's root directory. + * + * @return string + */ function appdirpath() { return dirname(__FILE__); } - +/** + * @brief Set a pageicon. + * + * @param string $icon + */ function head_set_icon($icon) { global $a; @@ -2056,6 +2134,11 @@ function head_set_icon($icon) { // logger('head_set_icon: ' . $icon); } +/** + * @brief Get the pageicon. + * + * @return string absolut path to pageicon + */ function head_get_icon() { global $a; @@ -2066,6 +2149,11 @@ function head_get_icon() { return $icon; } +/** + * @brief Return the Realm of the directory. + * + * @return string + */ function get_directory_realm() { if($x = get_config('system', 'directory_realm')) return $x; -- cgit v1.2.3 From 13b50610d647e2a6984450f19925d1085d826795 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Fri, 12 Dec 2014 15:28:11 +0000 Subject: Fix WSOD on login --- boot.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 8a212a11d..392b34039 100755 --- a/boot.php +++ b/boot.php @@ -1514,9 +1514,11 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) { $tpl = get_markup_template("logout.tpl"); } else { - $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"), array( - '$baseurl' => $a->get_baseurl(true) - )); +// There's no such thing as login_head.tpl, has never been in Red, removed from Friendica 1 Jun 2013... + +// $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"), array( +// '$baseurl' => $a->get_baseurl(true) +// )); $tpl = get_markup_template("login.tpl"); if(strlen($a->query_string)) -- cgit v1.2.3 From 233903c84428b9322eaea94bf22f6ae972e44332 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 14 Dec 2014 01:22:52 +0100 Subject: Add security logger to RedDAV. Some smaller clean ups whitepsaces and tabs, use PHP_EOL, Doxygen, etc. --- boot.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 392b34039..842113c31 100755 --- a/boot.php +++ b/boot.php @@ -51,12 +51,21 @@ define ( 'ZOT_REVISION', 1 ); define ( 'DB_UPDATE_VERSION', 1131 ); +/** + * Constant with a HTML line break. + * + * Contains a HTML line break (br) element and a real carriage return with line + * feed for the source. + * This can be used in HTML and JavaScript where needed a line break. + * + * @var string + */ define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); //define ( 'NULL_DATE', '0000-00-00 00:00:00' ); define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' ); -define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000 +define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000 define ( 'DIRECTORY_MODE_PRIMARY', 0x0001); define ( 'DIRECTORY_MODE_SECONDARY', 0x0002); define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); -- cgit v1.2.3 From d3830aea9661dac0610eef72cad35b188832b7f2 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 21 Dec 2014 18:40:25 -0800 Subject: provide last successful poll run time (using relative time) in siteinfo so that we can tell folks that have no idea what we're talking about that their poller definitely isn't running and this is probably why nothing works correctly. --- boot.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 842113c31..366346d25 100755 --- a/boot.php +++ b/boot.php @@ -2171,3 +2171,13 @@ function get_directory_realm() { return DIRECTORY_REALM; } + + +/** + * @brief return relative date of last completed poller execution + */ + +function get_poller_runtime() { + $t = get_config('system','lastpoll'); + return relative_date($t); +} \ No newline at end of file -- cgit v1.2.3 From 7ba92feabf97804b5a43ffe85fffc289247c27db Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 26 Dec 2014 00:13:22 -0800 Subject: doc update --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 366346d25..a8c84c7b9 100755 --- a/boot.php +++ b/boot.php @@ -2180,4 +2180,4 @@ function get_directory_realm() { function get_poller_runtime() { $t = get_config('system','lastpoll'); return relative_date($t); -} \ No newline at end of file +} -- cgit v1.2.3 From 3065650683c221c0a23c1dbcab2e1ec2d73997d4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 28 Dec 2014 23:21:49 -0800 Subject: filter posts you author from unseen notifications - note there are other ways to do this, but involve some code complexity. This is easier to implement but may have a slight impact on the ping query performance. It's not horrid, just mentioning for the record. --- boot.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index a8c84c7b9..4e266f4f1 100755 --- a/boot.php +++ b/boot.php @@ -241,6 +241,8 @@ define ( 'PHOTO_XCHAN', 0x0002 ); define ( 'PHOTO_THING', 0x0004 ); define ( 'PHOTO_ADULT', 0x0008 ); +define ( 'PHOTO_FLAG_OS', 0x4000 ); + /** * Menu types */ -- cgit v1.2.3 From c7aa8bf1b4c2a7ca4d7bf1552aabcb0c0a54756e Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 1 Jan 2015 23:47:14 -0800 Subject: syntax issues (with some php versions?), unchecked intval --- boot.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4e266f4f1..f57a6701c 100755 --- a/boot.php +++ b/boot.php @@ -2183,3 +2183,19 @@ function get_poller_runtime() { $t = get_config('system','lastpoll'); return relative_date($t); } + +function z_get_upload_dir() { + $upload_dir = get_config('system','uploaddir'); + if(! $upload_dir) + $upload_dir = ini_get('upload_tmp_dir'); + if(! $upload_dir) + $upload_dir = sys_get_temp_dir(); + return $upload_dir; +} + +function z_get_temp_dir() { + $temp_dir = get_config('system','tempdir'); + if(! $temp_dir) + $temp_dir = sys_get_temp_dir(); + return $upload_dir; +} \ No newline at end of file -- cgit v1.2.3 From 3e073f4b626ce5e12f3c9412afa5505ac26e5a9b Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 2 Jan 2015 23:07:37 -0800 Subject: no newline at end of file --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f57a6701c..ab2d9671c 100755 --- a/boot.php +++ b/boot.php @@ -2198,4 +2198,4 @@ function z_get_temp_dir() { if(! $temp_dir) $temp_dir = sys_get_temp_dir(); return $upload_dir; -} \ No newline at end of file +} -- cgit v1.2.3 From 386f361855663b445d1497bbbabcf87891ce94d9 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 4 Jan 2015 12:54:23 +0100 Subject: Autocmplete suggestions for non-local users, also suggest from visited channel's connections --- boot.php | 1 + 1 file changed, 1 insertion(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4e266f4f1..87a6845bb 100755 --- a/boot.php +++ b/boot.php @@ -1024,6 +1024,7 @@ class App { '$head_js' => head_get_js(), '$js_strings' => js_strings(), '$zid' => get_my_address(), + '$channel_id' => $this->profile['uid'], )) . $this->page['htmlhead']; // always put main.js at the end -- cgit v1.2.3