From 598baa1b32b59b187fbdc7012d23831208d0ebbd Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 21 May 2016 12:55:17 -0400 Subject: Moved git repository storage to store/[data]/git to avoid collision with a channel named git. Fixed bug where temp repo folder was never created. --- Zotlabs/Module/Admin.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 0a167b273..42a91107d 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1735,7 +1735,7 @@ class Admin extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); } - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1748,7 +1748,7 @@ class Admin extends \Zotlabs\Web\Controller { } } } - $repoDir = __DIR__ . '/../../store/git/sys/extend/addon/' . $repoName; + $repoDir = __DIR__ . '/../../store/[data]/git/sys/extend/addon/' . $repoName; if (!is_dir($repoDir)) { logger('Repo directory does not exist: ' . $repoDir); json_return_and_die(array('message' => 'Invalid addon repo.', 'success' => false)); @@ -1785,7 +1785,7 @@ class Admin extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); } - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1798,7 +1798,7 @@ class Admin extends \Zotlabs\Web\Controller { } } } - $repoDir = __DIR__ . '/../../store/git/sys/extend/addon/' . $repoName; + $repoDir = __DIR__ . '/../../store/[data]/git/sys/extend/addon/' . $repoName; if (!is_dir($repoDir)) { logger('Repo directory does not exist: ' . $repoDir); json_return_and_die(array('message' => 'Invalid addon repo.', 'success' => false)); @@ -1818,7 +1818,7 @@ class Admin extends \Zotlabs\Web\Controller { if (array_key_exists('repoURL', $_REQUEST)) { require __DIR__ . '/../../library/PHPGit.autoload.php'; // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { @@ -1846,7 +1846,7 @@ class Admin extends \Zotlabs\Web\Controller { json_return_and_die(array('message' => 'Invalid git repo', 'success' => false)); } $repoDir = $addonDir . '/' . $repoName; - $tempRepoBaseDir = __DIR__ . '/../../store/git/sys/temp/'; + $tempRepoBaseDir = __DIR__ . '/../../store/[data]/git/sys/temp/'; $tempAddonDir = $tempRepoBaseDir . $repoName; if (!is_writable($addonDir) || !is_writable($tempAddonDir)) { @@ -1880,9 +1880,9 @@ class Admin extends \Zotlabs\Web\Controller { if (array_key_exists('repoURL', $_REQUEST)) { require __DIR__ . '/../../library/PHPGit.autoload.php'; // Load PHPGit dependencies $repoURL = $_REQUEST['repoURL']; - $extendDir = __DIR__ . '/../../store/git/sys/extend'; + $extendDir = __DIR__ . '/../../store/[data]/git/sys/extend'; $addonDir = $extendDir . '/addon'; - $tempAddonDir = __DIR__ . '/../../store/git/sys/temp'; + $tempAddonDir = __DIR__ . '/../../store/[data]/git/sys/temp'; if (!file_exists($extendDir)) { if (!mkdir($extendDir, 0770, true)) { logger('Error creating extend folder: ' . $extendDir); @@ -1894,6 +1894,12 @@ class Admin extends \Zotlabs\Web\Controller { } } } + if (!is_dir($tempAddonDir)) { + if (!mkdir($tempAddonDir, 0770, true)) { + logger('Error creating temp plugin repo folder: ' . $extendDir); + json_return_and_die(array('message' => 'Error creating temp plugin repo folder: ' . $extendDir, 'success' => false)); + } + } $repoName = null; if (array_key_exists('repoName', $_REQUEST) && $_REQUEST['repoName'] !== '') { $repoName = $_REQUEST['repoName']; -- cgit v1.2.3 From 7a526fa8a9934fb6f193a11815bcb03490acb2c6 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sat, 21 May 2016 12:58:05 -0400 Subject: Temp repo folder error message correction --- Zotlabs/Module/Admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 42a91107d..cd6e45e9f 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1896,8 +1896,8 @@ class Admin extends \Zotlabs\Web\Controller { } if (!is_dir($tempAddonDir)) { if (!mkdir($tempAddonDir, 0770, true)) { - logger('Error creating temp plugin repo folder: ' . $extendDir); - json_return_and_die(array('message' => 'Error creating temp plugin repo folder: ' . $extendDir, 'success' => false)); + logger('Error creating temp plugin repo folder: ' . $tempAddonDir); + json_return_and_die(array('message' => 'Error creating temp plugin repo folder: ' . $tempAddonDir, 'success' => false)); } } $repoName = null; -- cgit v1.2.3 From ed56b6e67b27900e2ff413a7781c9095aa8251a0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 21 May 2016 18:02:14 -0700 Subject: first cut at zot-finger request signatures --- Zotlabs/Module/Probe.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Probe.php b/Zotlabs/Module/Probe.php index 79abe9819..dda792131 100644 --- a/Zotlabs/Module/Probe.php +++ b/Zotlabs/Module/Probe.php @@ -20,17 +20,17 @@ class Probe extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); $addr = trim($_GET['addr']); $do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false); - $res = zot_finger($addr,$channel,false); + + $j = \Zotlabs\Zot\Finger::run($addr,$channel,false); + + // $res = zot_finger($addr,$channel,false); + $o .= '
';
-			if($res['success'])
-				$j = json_decode($res['body'],true);
-			else {
+			if(! $j['success']) {
 				$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
 				$o .= "https connection failed. Trying again with auto failover to http.\r\n\r\n";
-				$res = zot_finger($addr,$channel,true);
-				if($res['success'])
-					$j = json_decode($res['body'],true);
-				else
+				$j = \Zotlabs\Zot\Finger::run($addr,$channel,true);
+				if(! $j['success']) 
 					$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
 	
 			}
-- 
cgit v1.2.3


From 1cb311cef9848178780e3fd52814bf3a64ed0556 Mon Sep 17 00:00:00 2001
From: redmatrix 
Date: Sat, 21 May 2016 18:18:33 -0700
Subject: finish updating zot_finger instances

---
 Zotlabs/Module/Chanview.php |  9 +++------
 Zotlabs/Module/Magic.php    |  8 +++-----
 Zotlabs/Module/Mail.php     |  7 +++----
 Zotlabs/Module/Regdir.php   | 13 +++++--------
 4 files changed, 14 insertions(+), 23 deletions(-)

(limited to 'Zotlabs/Module')

diff --git a/Zotlabs/Module/Chanview.php b/Zotlabs/Module/Chanview.php
index f70444816..36fbbb864 100644
--- a/Zotlabs/Module/Chanview.php
+++ b/Zotlabs/Module/Chanview.php
@@ -62,18 +62,15 @@ class Chanview extends \Zotlabs\Web\Controller {
 			}
 	
 			if($_REQUEST['address']) {
-				$ret = zot_finger($_REQUEST['address'],null);
-				if($ret['success']) {
-					$j = json_decode($ret['body'],true);
-					if($j)
-						import_xchan($j);
+				$j = \Zotlabs\Zot\Finger::run($_REQUEST['address'],null);
+				if($j['success']) {
+					import_xchan($j);
 					$r = q("select * from xchan where xchan_addr = '%s' limit 1",
 						dbesc($_REQUEST['address'])
 					);
 					if($r)
 						\App::$poi = $r[0];
 				}
-	
 			}
 		}
 	
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php
index 63db4a317..6798f72a9 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -47,11 +47,9 @@ class Magic extends \Zotlabs\Web\Controller {
 			 *
 			 */
 	
-			$ret = zot_finger((($addr) ? $addr : '[system]@' . $parsed['host']),null);
-			if($ret['success']) {
-				$j = json_decode($ret['body'],true);
-				if($j)
-					import_xchan($j);
+			$j = \Zotlabs\Zot\Finger::run((($addr) ? $addr : '[system]@' . $parsed['host']),null);
+			if($j['success']) {
+				import_xchan($j);
 	
 				// Now try again
 	
diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php
index e6487d681..3dbfa8d71 100644
--- a/Zotlabs/Module/Mail.php
+++ b/Zotlabs/Module/Mail.php
@@ -32,17 +32,16 @@ class Mail extends \Zotlabs\Web\Controller {
 		if(! $recipient) {
 			$channel = \App::get_channel();
 	
-			$ret = zot_finger($rstr,$channel);
+			$j = \Zotlabs\Zot\Finger::run($rstr,$channel);
 	
-			if(! $ret['success']) {
+			if(! $j['success']) {
 				notice( t('Unable to lookup recipient.') . EOL);
 				return;
 			} 
-			$j = json_decode($ret['body'],true);
 	
 			logger('message_post: lookup: ' . $url . ' ' . print_r($j,true));
 	
-			if(! ($j['success'] && $j['guid'])) {
+			if(! $j['guid']) {
 				notice( t('Unable to communicate with requested channel.'));
 				return;
 			}
diff --git a/Zotlabs/Module/Regdir.php b/Zotlabs/Module/Regdir.php
index 65f8daf67..48a7cc16d 100644
--- a/Zotlabs/Module/Regdir.php
+++ b/Zotlabs/Module/Regdir.php
@@ -60,14 +60,11 @@ class Regdir extends \Zotlabs\Web\Controller {
 				json_return_and_die($result);
 			}
 	
-			$f = zot_finger('[system]@' . $m['host']);
-			if($f['success']) {
-				$j = json_decode($f['body'],true);
-				if($j['success'] && $j['guid']) {
-					$x = import_xchan($j);
-					if($x['success']) {
-						$result['success'] = true;
-					}
+			$j = \Zotlabs\Zot\Finger::run('[system]@' . $m['host']);
+			if($j['success'] && $j['guid']) {
+				$x = import_xchan($j);
+				if($x['success']) {
+					$result['success'] = true;
 				}
 			}
 	
-- 
cgit v1.2.3


From de006771c7fe92a889d759c2c75c1473c420ad47 Mon Sep 17 00:00:00 2001
From: redmatrix 
Date: Sun, 22 May 2016 16:54:30 -0700
Subject: renamed include files identity.php (channel.php) and Contact.php
 (connections.php)

---
 Zotlabs/Module/Admin.php           |  4 ----
 Zotlabs/Module/Blocks.php          |  2 +-
 Zotlabs/Module/Cal.php             |  2 --
 Zotlabs/Module/Chanview.php        |  2 --
 Zotlabs/Module/Connect.php         |  2 +-
 Zotlabs/Module/Connections.php     |  2 +-
 Zotlabs/Module/Connedit.php        |  3 +--
 Zotlabs/Module/Cover_photo.php     |  2 +-
 Zotlabs/Module/Display.php         |  4 ++--
 Zotlabs/Module/Editblock.php       |  2 +-
 Zotlabs/Module/Editlayout.php      |  2 +-
 Zotlabs/Module/Editwebpage.php     |  2 +-
 Zotlabs/Module/Getfile.php         |  1 -
 Zotlabs/Module/Import.php          |  4 ++--
 Zotlabs/Module/Item.php            |  2 +-
 Zotlabs/Module/Layouts.php         |  2 +-
 Zotlabs/Module/Mail.php            |  7 +------
 Zotlabs/Module/Menu.php            |  2 +-
 Zotlabs/Module/Message.php         |  2 --
 Zotlabs/Module/Network.php         |  2 +-
 Zotlabs/Module/New_channel.php     |  2 +-
 Zotlabs/Module/Oep.php             |  4 ++--
 Zotlabs/Module/Photos.php          |  2 +-
 Zotlabs/Module/Profile_photo.php   |  2 +-
 Zotlabs/Module/Profiles.php        |  4 ++--
 Zotlabs/Module/Profperm.php        |  2 +-
 Zotlabs/Module/Pubstream.php       |  2 +-
 Zotlabs/Module/Randprof.php        |  1 -
 Zotlabs/Module/Register.php        |  2 +-
 Zotlabs/Module/Removeaccount.php   | 11 +++--------
 Zotlabs/Module/Removeme.php        |  5 +----
 Zotlabs/Module/Search.php          |  2 +-
 Zotlabs/Module/Settings.php        |  2 +-
 Zotlabs/Module/Setup.php           |  2 +-
 Zotlabs/Module/Uexport.php         |  2 +-
 Zotlabs/Module/Viewconnections.php |  4 +---
 Zotlabs/Module/Wall_attach.php     |  2 +-
 Zotlabs/Module/Wall_upload.php     |  2 +-
 Zotlabs/Module/Webpages.php        |  2 +-
 39 files changed, 39 insertions(+), 67 deletions(-)

(limited to 'Zotlabs/Module')

diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index cd6e45e9f..172b109c8 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -902,7 +902,6 @@ class Admin extends \Zotlabs\Web\Controller {
 		}
 		// account delete button was submitted
 		if (x($_POST, 'page_users_delete')) {
-			require_once('include/Contact.php');
 			foreach ($users as $uid){
 				account_remove($uid, true, false);
 			}
@@ -951,7 +950,6 @@ class Admin extends \Zotlabs\Web\Controller {
 			switch (argv(2)){
 				case 'delete':
 					// delete user
-					require_once('include/Contact.php');
 					account_remove($uid,true,false);
 	
 					notice( sprintf(t("Account '%s' deleted"), $account[0]['account_email']) . EOL);
@@ -1096,7 +1094,6 @@ class Admin extends \Zotlabs\Web\Controller {
 			notice( sprintf( tt("%s channel code allowed/disallowed", "%s channels code allowed/disallowed", count($channels)), count($channels)) );
 		}
 		if (x($_POST,'page_channels_delete')){
-			require_once("include/Contact.php");
 			foreach($channels as $uid){
 				channel_remove($uid,true);
 			}
@@ -1128,7 +1125,6 @@ class Admin extends \Zotlabs\Web\Controller {
 				case "delete":{
 					check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't');
 					// delete channel
-					require_once("include/Contact.php");
 					channel_remove($uid,true);
 					
 					notice( sprintf(t("Channel '%s' deleted"), $channel[0]['channel_name']) . EOL);
diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php
index ed702befb..32650a090 100644
--- a/Zotlabs/Module/Blocks.php
+++ b/Zotlabs/Module/Blocks.php
@@ -1,7 +1,7 @@
 disabled())) {
 				$r = null;
 	
-				require_once('include/identity.php');
+				require_once('include/channel.php');
 				$sys = get_sys_channel();
 				$sysid = $sys['channel_id'];
 	
@@ -233,7 +233,7 @@ class Display extends \Zotlabs\Web\Controller {
 		elseif($update && !$load) {
 			$r = null;
 	
-			require_once('include/identity.php');
+			require_once('include/channel.php');
 			$sys = get_sys_channel();
 			$sysid = $sys['channel_id'];
 	
diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php
index a79962033..fb86557f2 100644
--- a/Zotlabs/Module/Editblock.php
+++ b/Zotlabs/Module/Editblock.php
@@ -1,7 +1,7 @@
  1) {
 			$channel = \App::get_channel();
 	
-			require_once('include/identity.php');
+			require_once('include/channel.php');
 	
 			if(argc() > 1 && intval(argv(1)) > 1900) {
 				$year = intval(argv(1));
diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php
index a9445cdeb..d58c431e5 100644
--- a/Zotlabs/Module/Viewconnections.php
+++ b/Zotlabs/Module/Viewconnections.php
@@ -2,8 +2,6 @@
 namespace Zotlabs\Module;
 
 require_once('include/selectors.php');
-require_once('include/Contact.php');
-
 
 class Viewconnections extends \Zotlabs\Web\Controller {
 
@@ -16,7 +14,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
 			profile_load($a,argv(1));
 	}
 	
-		function get() {
+	function get() {
 	
 		if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
 			notice( t('Public access denied.') . EOL);
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 5bdecfa75..9a1019ddb 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -2,7 +2,7 @@
 namespace Zotlabs\Module;
 
 require_once('include/attach.php');
-require_once('include/identity.php');
+require_once('include/channel.php');
 require_once('include/photos.php');
 
 
diff --git a/Zotlabs/Module/Wall_upload.php b/Zotlabs/Module/Wall_upload.php
index fff3ed03a..3868cb14e 100644
--- a/Zotlabs/Module/Wall_upload.php
+++ b/Zotlabs/Module/Wall_upload.php
@@ -2,7 +2,7 @@
 namespace Zotlabs\Module;
 
 require_once('include/photo/photo_driver.php');
-require_once('include/identity.php');
+require_once('include/channel.php');
 require_once('include/photos.php');
 
 
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index d8adb55b2..bb8d454c8 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -1,7 +1,7 @@
 
Date: Sun, 22 May 2016 17:52:30 -0700
Subject: turn the oft-repeated block_public ... check into a function
 observer_prohibited()

---
 Zotlabs/Module/Acl.php             |   2 +-
 Zotlabs/Module/Cal.php             |   9 +-
 Zotlabs/Module/Channel.php         | 550 +++++++++++++++++++------------------
 Zotlabs/Module/Directory.php       |   4 +-
 Zotlabs/Module/Display.php         |   6 +-
 Zotlabs/Module/Feed.php            |   2 +-
 Zotlabs/Module/Photos.php          |   4 +-
 Zotlabs/Module/Profile.php         |   4 +-
 Zotlabs/Module/Pubstream.php       |   2 +-
 Zotlabs/Module/Ratings.php         |   6 +-
 Zotlabs/Module/Viewconnections.php |   4 +-
 Zotlabs/Module/Zotfeed.php         |   4 +-
 12 files changed, 296 insertions(+), 301 deletions(-)

(limited to 'Zotlabs/Module')

diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 5c14ab599..62ac29286 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -260,7 +260,7 @@ class Acl extends \Zotlabs\Web\Controller {
 	
 	//	logger('navbar_complete');
 	
-		if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
+		if(observer_prohibited()) {
 			return;
 		}
 	
diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php
index 602a2b5ab..a1adb30e5 100644
--- a/Zotlabs/Module/Cal.php
+++ b/Zotlabs/Module/Cal.php
@@ -11,7 +11,7 @@ require_once('include/items.php');
 class Cal extends \Zotlabs\Web\Controller {
 
 	function init() {
-		if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
+		if(observer_prohibited()) {
 			return;
 		}
 	
@@ -45,13 +45,12 @@ class Cal extends \Zotlabs\Web\Controller {
 	
 	
 	
-		function get() {
+	function get() {
 	
-		if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
+		if(observer_prohibited()) {
 			return;
 		}
-	
-	
+		
 		$channel = null;
 	
 		if(argc() > 1) {
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index f55705442..29bfcbc3c 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -13,353 +13,355 @@ require_once('include/PermissionDescription.php');
 
 class Channel extends \Zotlabs\Web\Controller {
 
-function init() {
-
-	$which = null;
-	if(argc() > 1)
-		$which = argv(1);
-	if(! $which) {
-		if(local_channel()) {
-			$channel = \App::get_channel();
-			if($channel && $channel['channel_address'])
-			$which = $channel['channel_address'];
+	function init() {
+
+		$which = null;
+		if(argc() > 1)
+			$which = argv(1);
+		if(! $which) {
+			if(local_channel()) {
+				$channel = \App::get_channel();
+				if($channel && $channel['channel_address'])
+				$which = $channel['channel_address'];
+			}
+		}
+		if(! $which) {
+			notice( t('You must be logged in to see this page.') . EOL );
+			return;
 		}
-	}
-	if(! $which) {
-		notice( t('You must be logged in to see this page.') . EOL );
-		return;
-	}
 
-	$profile = 0;
-	$channel = \App::get_channel();
+		$profile = 0;
+		$channel = \App::get_channel();
 
-	if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
-		$which = $channel['channel_address'];
-		$profile = argv(1);		
-	}
+		if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
+			$which = $channel['channel_address'];
+			$profile = argv(1);		
+		}
 
-	\App::$page['htmlhead'] .= '' . "\r\n" ;
-	\App::$page['htmlhead'] .= '' . "\r\n" ;
+		\App::$page['htmlhead'] .= '' . "\r\n" ;
+		\App::$page['htmlhead'] .= '' . "\r\n" ;
 
-// Not yet ready for prime time
-//	\App::$page['htmlhead'] .= '' . "\r\n" ;
-//	\App::$page['htmlhead'] .= '' . "\r\n" ;
+		// Not yet ready for prime time
+		//	\App::$page['htmlhead'] .= '' . "\r\n" ;
+		//	\App::$page['htmlhead'] .= '' . "\r\n" ;
 
-	// Run profile_load() here to make sure the theme is set before
-	// we start loading content
+		// Run profile_load() here to make sure the theme is set before
+		// we start loading content
 
-	profile_load($a,$which,$profile);
+		profile_load($a,$which,$profile);
 
-}
+	}
 
-function get($update = 0, $load = false) {
+	function get($update = 0, $load = false) {
 
 
-	if($load)
-		$_SESSION['loadtime'] = datetime_convert();
+		if($load)
+			$_SESSION['loadtime'] = datetime_convert();
 
-	$checkjs = new \Zotlabs\Web\CheckJS(1);
+		$checkjs = new \Zotlabs\Web\CheckJS(1);
 
-	$category = $datequery = $datequery2 = '';
+		$category = $datequery = $datequery2 = '';
 
-	$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
+		$mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
 
-	$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
-	$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
+		$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
+		$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
 
-	if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) {
+		if(observer_prohibited(true)) {			
 			return login();
-	}
+		}
 
-	$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
-	$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
+		$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
+		$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
 
-	$groups = array();
+		$groups = array();
 
-	$o = '';
+		$o = '';
 
-	if($update) {
-		// Ensure we've got a profile owner if updating.
-		\App::$profile['profile_uid'] = \App::$profile_uid = $update;
-	}
-	else {
-		if(\App::$profile['profile_uid'] == local_channel()) {
-			nav_set_selected('home');
+		if($update) {
+			// Ensure we've got a profile owner if updating.
+			\App::$profile['profile_uid'] = \App::$profile_uid = $update;
+		}
+		else {
+			if(\App::$profile['profile_uid'] == local_channel()) {
+				nav_set_selected('home');
+			}
 		}
-	}
 
-	$is_owner = (((local_channel()) && (\App::$profile['profile_uid'] == local_channel())) ? true : false);
+		$is_owner = (((local_channel()) && (\App::$profile['profile_uid'] == local_channel())) ? true : false);
 
-	$channel = \App::get_channel();
-	$observer = \App::get_observer();
-	$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
+		$channel = \App::get_channel();
+		$observer = \App::get_observer();
+		$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
 
-	$perms = get_all_perms(\App::$profile['profile_uid'],$ob_hash);
+		$perms = get_all_perms(\App::$profile['profile_uid'],$ob_hash);
 
-	if(! $perms['view_stream']) {
+		if(! $perms['view_stream']) {
 			// We may want to make the target of this redirect configurable
 			if($perms['view_profile']) {
 				notice( t('Insufficient permissions.  Request redirected to profile page.') . EOL);
 				goaway (z_root() . "/profile/" . \App::$profile['channel_address']);
 			}
-		notice( t('Permission denied.') . EOL);
-		return;
-	}
+			notice( t('Permission denied.') . EOL);
+			return;
+		}
 
 
-	if(! $update) {
+		if(! $update) {
 
-		$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
+			$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
 
-		$o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
+			$o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
 
-		if($channel && $is_owner) {
-			$channel_acl = array(
-				'allow_cid' => $channel['channel_allow_cid'], 
-				'allow_gid' => $channel['channel_allow_gid'], 
-				'deny_cid' => $channel['channel_deny_cid'], 
-				'deny_gid' => $channel['channel_deny_gid']
-			);
-		}
-		else
-			$channel_acl = array(); 
-
-
-		if($perms['post_wall']) {
-
-			$x = array(
-				'is_owner' => $is_owner,
-				'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
-				'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''),
-				'nickname' => \App::$profile['channel_address'],
-				'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
-				'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
-				'showacl' => (($is_owner) ? 'yes' : ''),
-				'bang' => '',
-				'visitor' => (($is_owner || $observer) ? true : false),
-				'profile_uid' => \App::$profile['profile_uid'],
-				'editor_autocomplete' => true,
-				'bbco_autocomplete' => 'bbcode',
-				'bbcode' => true
-        	);
-
-        	$o .= status_editor($a,$x);
-		}
+			if($channel && $is_owner) {
+				$channel_acl = array(
+					'allow_cid' => $channel['channel_allow_cid'], 
+					'allow_gid' => $channel['channel_allow_gid'], 
+					'deny_cid' => $channel['channel_deny_cid'], 
+					'deny_gid' => $channel['channel_deny_gid']
+				);
+			}
+			else
+				$channel_acl = array(); 
+
+
+			if($perms['post_wall']) {
+
+				$x = array(
+					'is_owner' => $is_owner,
+					'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(\App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false),
+					'default_location' => (($is_owner) ? \App::$profile['channel_location'] : ''),
+					'nickname' => \App::$profile['channel_address'],
+					'lockstate' => (((strlen(\App::$profile['channel_allow_cid'])) || (strlen(\App::$profile['channel_allow_gid'])) || (strlen(\App::$profile['channel_deny_cid'])) || (strlen(\App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'),
+					'acl' => (($is_owner) ? populate_acl($channel_acl,true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : ''),
+					'showacl' => (($is_owner) ? 'yes' : ''),
+					'bang' => '',
+					'visitor' => (($is_owner || $observer) ? true : false),
+					'profile_uid' => \App::$profile['profile_uid'],
+					'editor_autocomplete' => true,
+					'bbco_autocomplete' => 'bbcode',
+					'bbcode' => true
+        		);
+
+        		$o .= status_editor($a,$x);
+			}
 
-	}
+		}
 
 
-	/**
-	 * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
-	 */
+		/**
+		 * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
+		 */
 
-	$item_normal = item_normal();
-	$sql_extra = item_permissions_sql(\App::$profile['profile_uid']);
+		$item_normal = item_normal();
+		$sql_extra = item_permissions_sql(\App::$profile['profile_uid']);
 
-	if(get_pconfig(\App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
-		$page_mode = 'list';
-	else
-		$page_mode = 'client';
+		if(get_pconfig(\App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid))
+			$page_mode = 'list';
+		else
+			$page_mode = 'client';
 
-	$abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
+		$abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
 
-	$simple_update = (($update) ? " AND item_unseen = 1 " : '');
+		$simple_update = (($update) ? " AND item_unseen = 1 " : '');
 
-	\App::$page['htmlhead'] .= "\r\n" . '' . "\r\n";
+		\App::$page['htmlhead'] .= "\r\n" . '' . "\r\n";
 		
-	if($update && $_SESSION['loadtime'])
-		$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' )  OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
-	if($load)
-		$simple_update = '';
-
-	if(($update) && (! $load)) {
-
-		if ($mid) {
-			$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
-				AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
-				dbesc($mid . '%'),
-				intval(\App::$profile['profile_uid'])
-			);
-		} else {
-			$r = q("SELECT distinct parent AS `item_id`, created from item
-				left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
-				WHERE uid = %d $item_normal
-				AND item_wall = 1 $simple_update
-				AND (abook.abook_blocked = 0 or abook.abook_flags is null)
-				$sql_extra
-				ORDER BY created DESC",
-				intval(\App::$profile['profile_uid'])
-			);
-			$_SESSION['loadtime'] = datetime_convert();
-		}
-
-	}
-	else {
-
-		if(x($category)) {
-		        $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
-		}
-		if(x($hashtags)) {
-		        $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
-		}
-
-		if($datequery) {
-			$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
-		}
-		if($datequery2) {
-			$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
-		}
+		if($update && $_SESSION['loadtime'])
+			$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' )  OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
+		if($load)
+			$simple_update = '';
 
-		$itemspage = get_pconfig(local_channel(),'system','itemspage');
-		\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
-		$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+		if(($update) && (! $load)) {
 
-		if($load || ($checkjs->disabled())) {
-			if ($mid) {
-				$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal
-					AND item_wall = 1 $sql_extra limit 1",
-					dbesc($mid),
+			if($mid) {
+				$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal
+					AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
+					dbesc($mid . '%'),
 					intval(\App::$profile['profile_uid'])
 				);
-				if (! $r) {
-					notice( t('Permission denied.') . EOL);
-				}
-
-			} else {
-				$r = q("SELECT distinct id AS item_id, created FROM item 
-					left join abook on item.author_xchan = abook.abook_xchan
+			} 
+			else {
+				$r = q("SELECT distinct parent AS `item_id`, created from item
+					left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
 					WHERE uid = %d $item_normal
-					AND item_wall = 1 and item_thread_top = 1
-					AND (abook_blocked = 0 or abook.abook_flags is null)
-					$sql_extra $sql_extra2
-					ORDER BY created DESC $pager_sql ",
+					AND item_wall = 1 $simple_update
+					AND (abook.abook_blocked = 0 or abook.abook_flags is null)
+					$sql_extra
+					ORDER BY created DESC",
 					intval(\App::$profile['profile_uid'])
 				);
+				$_SESSION['loadtime'] = datetime_convert();
 			}
+
 		}
 		else {
-			$r = array();
-		}
-	}
 
-	if($r) {
+			if(x($category)) {
+			        $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
+			}
+			if(x($hashtags)) {
+			        $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
+			}
 
-		$parents_str = ids_to_querystr($r,'item_id');
- 
-		$items = q("SELECT `item`.*, `item`.`id` AS `item_id` 
-			FROM `item`
-			WHERE `item`.`uid` = %d $item_normal
-			AND `item`.`parent` IN ( %s )
-			$sql_extra ",
-			intval(\App::$profile['profile_uid']),
-			dbesc($parents_str)
-		);
-
-		xchan_query($items);
-		$items = fetch_post_tags($items, true);
-		$items = conv_sort($items,'created');
-
-		if ($load && $mid && (! count($items))) {
-			// This will happen if we don't have sufficient permissions
-			// to view the parent item (or the item itself if it is toplevel)
-			notice( t('Permission denied.') . EOL);
+			if($datequery) {
+				$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
+			}
+			if($datequery2) {
+				$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
+			}
+
+			$itemspage = get_pconfig(local_channel(),'system','itemspage');
+			\App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+			$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+
+			if($load || ($checkjs->disabled())) {
+				if($mid) {
+					$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal
+						AND item_wall = 1 $sql_extra limit 1",
+						dbesc($mid),
+						intval(\App::$profile['profile_uid'])
+					);
+					if (! $r) {
+						notice( t('Permission denied.') . EOL);
+					}
+
+				} 
+				else {
+					$r = q("SELECT distinct id AS item_id, created FROM item 
+						left join abook on item.author_xchan = abook.abook_xchan
+						WHERE uid = %d $item_normal
+						AND item_wall = 1 and item_thread_top = 1
+						AND (abook_blocked = 0 or abook.abook_flags is null)
+						$sql_extra $sql_extra2
+						ORDER BY created DESC $pager_sql ",
+						intval(\App::$profile['profile_uid'])
+					);
+				}
+			}
+			else {
+				$r = array();
+			}
 		}
 
-	} else {
-		$items = array();
-	}
+		if($r) {
 
-	if((! $update) && (! $load)) {
-
-		// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
-		// because browser prefetching might change it on us. We have to deliver it with the page.
-
-		$maxheight = get_pconfig(\App::$profile['profile_uid'],'system','channel_divmore_height');
-		if(! $maxheight)
-			$maxheight = 400;
-
-		$o .= '
' . "\r\n"; - $o .= "\r\n"; - - \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( - '$baseurl' => z_root(), - '$pgtype' => 'channel', - '$uid' => ((\App::$profile['profile_uid']) ? \App::$profile['profile_uid'] : '0'), - '$gid' => '0', - '$cid' => '0', - '$cmin' => '0', - '$cmax' => '0', - '$star' => '0', - '$liked' => '0', - '$conv' => '0', - '$spam' => '0', - '$nouveau' => '0', - '$wall' => '1', - '$fh' => '0', - '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), - '$search' => '', - '$order' => '', - '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$file' => '', - '$cats' => (($category) ? $category : ''), - '$tags' => (($hashtags) ? $hashtags : ''), - '$mid' => $mid, - '$verb' => '', - '$dend' => $datequery, - '$dbegin' => $datequery2 - )); + $parents_str = ids_to_querystr($r,'item_id'); + + $items = q("SELECT `item`.*, `item`.`id` AS `item_id` + FROM `item` + WHERE `item`.`uid` = %d $item_normal + AND `item`.`parent` IN ( %s ) + $sql_extra ", + intval(\App::$profile['profile_uid']), + dbesc($parents_str) + ); + xchan_query($items); + $items = fetch_post_tags($items, true); + $items = conv_sort($items,'created'); - } + if($load && $mid && (! count($items))) { + // This will happen if we don't have sufficient permissions + // to view the parent item (or the item itself if it is toplevel) + notice( t('Permission denied.') . EOL); + } - $update_unseen = ''; + } + else { + $items = array(); + } - if($page_mode === 'list') { + if((! $update) && (! $load)) { + + // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, + // because browser prefetching might change it on us. We have to deliver it with the page. + + $maxheight = get_pconfig(\App::$profile['profile_uid'],'system','channel_divmore_height'); + if(! $maxheight) + $maxheight = 400; + + $o .= '
' . "\r\n"; + $o .= "\r\n"; + + \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + '$baseurl' => z_root(), + '$pgtype' => 'channel', + '$uid' => ((\App::$profile['profile_uid']) ? \App::$profile['profile_uid'] : '0'), + '$gid' => '0', + '$cid' => '0', + '$cmin' => '0', + '$cmax' => '0', + '$star' => '0', + '$liked' => '0', + '$conv' => '0', + '$spam' => '0', + '$nouveau' => '0', + '$wall' => '1', + '$fh' => '0', + '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1), + '$search' => '', + '$order' => '', + '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), + '$file' => '', + '$cats' => (($category) ? $category : ''), + '$tags' => (($hashtags) ? $hashtags : ''), + '$mid' => $mid, + '$verb' => '', + '$dend' => $datequery, + '$dbegin' => $datequery2 + )); - /** - * in "list mode", only mark the parent item and any like activities as "seen". - * We won't distinguish between comment likes and post likes. The important thing - * is that the number of unseen comments will be accurate. The SQL to separate the - * comment likes could also get somewhat hairy. - */ - if($parents_str) { - $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; - $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; - } - } - else { - if($parents_str) { - $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; } - } - if($is_owner && $update_unseen) { - $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", - intval(local_channel()) - ); - } + $update_unseen = ''; + if($page_mode === 'list') { - if($checkjs->disabled()) { - $o .= conversation($a,$items,'channel',$update,'traditional'); - } else { - $o .= conversation($a,$items,'channel',$update,$page_mode); - } + /** + * in "list mode", only mark the parent item and any like activities as "seen". + * We won't distinguish between comment likes and post likes. The important thing + * is that the number of unseen comments will be accurate. The SQL to separate the + * comment likes could also get somewhat hairy. + */ - if((! $update) || ($checkjs->disabled())) { - $o .= alt_pager($a,count($items)); - if ($mid && $items[0]['title']) - \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title']; - } + if($parents_str) { + $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; + $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; + } + } + else { + if($parents_str) { + $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; + } + } + + if($is_owner && $update_unseen) { + $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen", + intval(local_channel()) + ); + } - if($mid) - $o .= '
'; - return $o; -} + if($checkjs->disabled()) { + $o .= conversation($a,$items,'channel',$update,'traditional'); + } + else { + $o .= conversation($a,$items,'channel',$update,$page_mode); + } + if((! $update) || ($checkjs->disabled())) { + $o .= alt_pager($a,count($items)); + if ($mid && $items[0]['title']) + \App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title']; + } + if($mid) + $o .= '
'; + + return $o; + } } \ No newline at end of file diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index b8bac53bb..560038ffc 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -57,9 +57,9 @@ class Directory extends \Zotlabs\Web\Controller { } } - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 6e880cbb4..c1a0d84bc 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -7,17 +7,13 @@ class Display extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { - // logger("mod-display: update = $update load = $load"); - - $checkjs = new \Zotlabs\Web\CheckJS(1); - if($load) $_SESSION['loadtime'] = datetime_convert(); - if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php index 9d33ba2c3..47871eafb 100644 --- a/Zotlabs/Module/Feed.php +++ b/Zotlabs/Module/Feed.php @@ -31,7 +31,7 @@ class Feed extends \Zotlabs\Web\Controller { $channel = $r[0]; - if((intval(get_config('system','block_public'))) && (! get_account_id())) + if(observer_prohibited(true)) killme(); logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']); diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 266ac05e0..7186209ba 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -18,7 +18,7 @@ class Photos extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } @@ -518,7 +518,7 @@ class Photos extends \Zotlabs\Web\Controller { // photos/name/image/xxxxx - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index 04a64fe76..8bf358bc8 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -55,8 +55,8 @@ class Profile extends \Zotlabs\Web\Controller { function get() { - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { - return login(); + if(observer_prohibited(true)) { + return login(); } $groups = array(); diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index c25e04312..312be7718 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,7 +12,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $_SESSION['loadtime'] = datetime_convert(); - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { + if(observer_prohibited(true)) { return login(); } diff --git a/Zotlabs/Module/Ratings.php b/Zotlabs/Module/Ratings.php index 802bbfec2..969fb5015 100644 --- a/Zotlabs/Module/Ratings.php +++ b/Zotlabs/Module/Ratings.php @@ -8,7 +8,7 @@ class Ratings extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } @@ -80,9 +80,9 @@ class Ratings extends \Zotlabs\Web\Controller { - function get() { + function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php index d58c431e5..ea478f92a 100644 --- a/Zotlabs/Module/Viewconnections.php +++ b/Zotlabs/Module/Viewconnections.php @@ -7,7 +7,7 @@ class Viewconnections extends \Zotlabs\Web\Controller { function init() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { return; } if(argc() > 1) @@ -16,7 +16,7 @@ class Viewconnections extends \Zotlabs\Web\Controller { function get() { - if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + if(observer_prohibited()) { notice( t('Public access denied.') . EOL); return; } diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 28040149f..6b505c890 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -15,7 +15,7 @@ class Zotfeed extends \Zotlabs\Web\Controller { if(! $mindate) $mindate = datetime_convert('UTC','UTC', 'now - 14 days'); - if(get_config('system','block_public') && (! get_account_id()) && (! remote_channel())) { + if(observer_prohibited()) { $result['message'] = 'Public access denied'; json_return_and_die($result); } @@ -45,8 +45,6 @@ class Zotfeed extends \Zotlabs\Web\Controller { $result['messages'] = zot_feed($r[0]['channel_id'],$observer['xchan_hash'],array('mindate' => $mindate)); $result['success'] = true; json_return_and_die($result); - - } } -- cgit v1.2.3 From 2d06663490c5fd63b0ebbae141d0b2bbd5a4a8ca Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 22 May 2016 19:25:27 -0700 Subject: move apps to zlib --- Zotlabs/Module/Appman.php | 17 +++++++++-------- Zotlabs/Module/Apps.php | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php index ba2a64f35..a200e986a 100644 --- a/Zotlabs/Module/Appman.php +++ b/Zotlabs/Module/Appman.php @@ -2,8 +2,9 @@ namespace Zotlabs\Module; -require_once('include/apps.php'); +//require_once('include/apps.php'); +use \Zotlabs\Lib as Zlib; class Appman extends \Zotlabs\Web\Controller { @@ -30,16 +31,16 @@ class Appman extends \Zotlabs\Web\Controller { 'categories' => escape_tags($_REQUEST['categories']) ); - $_REQUEST['appid'] = app_install(local_channel(),$arr); + $_REQUEST['appid'] = Zlib\Apps::app_install(local_channel(),$arr); - if(app_installed(local_channel(),$arr)) + if(Zlib\Apps::app_installed(local_channel(),$arr)) info( t('App installed.') . EOL); return; } - $papp = app_decode($_POST['papp']); + $papp = Zlib\Apps::app_decode($_POST['papp']); if(! is_array($papp)) { notice( t('Malformed app.') . EOL); @@ -47,13 +48,13 @@ class Appman extends \Zotlabs\Web\Controller { } if($_POST['install']) { - app_install(local_channel(),$papp); - if(app_installed(local_channel(),$papp)) + Zlib\Apps::app_install(local_channel(),$papp); + if(Zlib\Apps::app_installed(local_channel(),$papp)) info( t('App installed.') . EOL); } if($_POST['delete']) { - app_destroy(local_channel(),$papp); + Zlib\Apps::app_destroy(local_channel(),$papp); } if($_POST['edit']) { @@ -100,7 +101,7 @@ class Appman extends \Zotlabs\Web\Controller { } } - $embed = array('embed', t('Embed code'), app_encode($app,true),'', 'onclick="this.select();"'); + $embed = array('embed', t('Embed code'), Zlib\Apps::app_encode($app,true),'', 'onclick="this.select();"'); } diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php index 33259b319..d3e8b1504 100644 --- a/Zotlabs/Module/Apps.php +++ b/Zotlabs/Module/Apps.php @@ -1,8 +1,9 @@ Date: Sun, 22 May 2016 20:54:52 -0700 Subject: move chatroom stuff to zlib --- Zotlabs/Module/Chat.php | 22 ++++++++++++---------- Zotlabs/Module/Chatsvc.php | 12 +++++++----- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php index 9508ed3de..d14c32b7d 100644 --- a/Zotlabs/Module/Chat.php +++ b/Zotlabs/Module/Chat.php @@ -1,9 +1,11 @@ - $room)); + Zlib\Chatroom::destroy($channel,array('cr_name' => $room)); goaway(z_root() . '/chat/' . $channel['channel_address']); } @@ -67,7 +69,7 @@ class Chat extends \Zotlabs\Web\Controller { if(intval($arr['expire']) < 0) $arr['expire'] = 0; - chatroom_create($channel,$arr); + Zlib\Chatroom::create($channel,$arr); $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", dbesc($room), @@ -87,7 +89,7 @@ class Chat extends \Zotlabs\Web\Controller { } - function get() { + function get() { if(local_channel()) $channel = \App::get_channel(); @@ -105,7 +107,7 @@ class Chat extends \Zotlabs\Web\Controller { } if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) { - chatroom_leave($observer,argv(2),$_SERVER['REMOTE_ADDR']); + Zlib\Chatroom::leave($observer,argv(2),$_SERVER['REMOTE_ADDR']); goaway(z_root() . '/channel/' . argv(1)); } @@ -158,7 +160,7 @@ class Chat extends \Zotlabs\Web\Controller { $room_id = intval(argv(2)); $bookmark_link = get_bookmark_link($ob); - $x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); + $x = Zlib\Chatroom::enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); if(! $x) return; $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1", @@ -238,7 +240,7 @@ class Chat extends \Zotlabs\Web\Controller { )); } - $rooms = chatroom_list(\App::$profile['profile_uid']); + $rooms = Zlib\Chatroom::roomlist(\App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( '$header' => sprintf( t('%1$s\'s Chatrooms'), \App::$profile['name']), diff --git a/Zotlabs/Module/Chatsvc.php b/Zotlabs/Module/Chatsvc.php index a9bc97301..6a28a7c4d 100644 --- a/Zotlabs/Module/Chatsvc.php +++ b/Zotlabs/Module/Chatsvc.php @@ -1,14 +1,16 @@ - false); @@ -27,7 +29,7 @@ class Chatsvc extends \Zotlabs\Web\Controller { } - function post() { + function post() { $ret = array('success' => false); @@ -65,7 +67,7 @@ class Chatsvc extends \Zotlabs\Web\Controller { json_return_and_die($ret); } - function get() { + function get() { $status = strip_tags($_REQUEST['status']); $room_id = intval(\App::$data['chat']['room_id']); -- cgit v1.2.3 From a1aa3d906159e4ad563779e5f220dddbfbd744c4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 22 May 2016 22:08:01 -0700 Subject: Can't use "use x as y" aliases in callback function declarations --- Zotlabs/Module/Apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php index d3e8b1504..4bdec4573 100644 --- a/Zotlabs/Module/Apps.php +++ b/Zotlabs/Module/Apps.php @@ -33,7 +33,7 @@ class Apps extends \Zotlabs\Web\Controller { else $syslist = Zlib\Apps::get_system_apps(true); - usort($syslist,'Zlib\\Apps::app_name_compare'); + usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare'); // logger('apps: ' . print_r($syslist,true)); -- cgit v1.2.3 From 80b422bdbe570e70adc2e55473f9e29a045722fe Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 23 May 2016 13:49:54 -0700 Subject: typo --- Zotlabs/Module/Connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index c9b20ae14..c5c38b96a 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -230,7 +230,7 @@ class Connedit extends \Zotlabs\Web\Controller { if(\App::$poi && \App::$poi['abook_my_perms'] != $abook_my_perms && (! intval(\App::$poi['abook_self']))) { - \Zotlabs\Daemon\Master(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id)); + \Zotlabs\Daemon\Master::Summon(array('Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id)); } if($new_friend) { -- cgit v1.2.3 From 29ba8918093166ac32ef9a727a9b71ba8e01a402 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 24 May 2016 01:25:13 -0700 Subject: moved enotify --- Zotlabs/Module/Item.php | 6 +++--- Zotlabs/Module/Ping.php | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index b4f493e5b..041939ad8 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -17,10 +17,10 @@ namespace Zotlabs\Module; */ require_once('include/crypto.php'); -require_once('include/enotify.php'); require_once('include/items.php'); require_once('include/attach.php'); +use \Zotlabs\Lib as Zlib; class Item extends \Zotlabs\Web\Controller { @@ -925,7 +925,7 @@ class Item extends \Zotlabs\Web\Controller { // otherwise it will happen during delivery if(($datarray['owner_xchan'] != $datarray['author_xchan']) && (intval($parent_item['item_wall']))) { - notification(array( + Zlib\Enotify::submit(array( 'type' => NOTIFY_COMMENT, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], @@ -943,7 +943,7 @@ class Item extends \Zotlabs\Web\Controller { $parent = $post_id; if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) { - notification(array( + Zlib\Enotify::submit(array( 'type' => NOTIFY_WALL, 'from_xchan' => $datarray['author_xchan'], 'to_xchan' => $datarray['owner_xchan'], diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index bea4a08b7..f0caa4373 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -1,12 +1,13 @@ Date: Tue, 24 May 2016 16:36:55 -0700 Subject: relocate index and db --- Zotlabs/Module/Setup.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index 462ccced6..b913190b1 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -82,11 +82,11 @@ class Setup extends \Zotlabs\Web\Controller { $siteurl = rtrim($siteurl,'/'); require_once('include/dba/dba_driver.php'); - unset($db); - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); + + $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); - if(! $db->connected) { - echo 'Database Connect failed: ' . $db->error; + if(! \DBA::$dba->connected) { + echo 'Database Connect failed: ' . DBA::$dba->error; killme(); \App::$data['db_conn_failed']=true; } @@ -138,10 +138,12 @@ class Setup extends \Zotlabs\Web\Controller { } } - // connect to db - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); - - if(! $db->connected) { + if(! \DBA::$dba->connected) { + // connect to db + $db = \DBA::dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, $dbtype, true); + } + + if(! \DBA::$dba->connected) { echo 'CRITICAL: DB not connected.'; killme(); } @@ -228,7 +230,7 @@ class Setup extends \Zotlabs\Web\Controller { $txt .= "
".\App::$data['db_failed'] . "
". EOL ; $db_return_text .= $txt; } - if($db && $db->connected) { + if(\DBA::$dba && \DBA::$dba->connected) { $r = q("SELECT COUNT(*) as `total` FROM `account`"); if($r && count($r) && $r[0]['total']) { $tpl = get_markup_template('install.tpl'); @@ -598,7 +600,7 @@ class Setup extends \Zotlabs\Web\Controller { if(! is_writable(TEMPLATE_BUILD_PATH) ) { $status = false; $help = t('Red uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL; - $help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the Red top level folder.'), TEMPLATE_BUILD_PATH) . EOL; + $help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the top level web folder.'), TEMPLATE_BUILD_PATH) . EOL; $help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL; $help .= sprintf( t('Note: as a security measure, you should give the web server write access to %s only--not the template files (.tpl) that it contains.'), TEMPLATE_BUILD_PATH) . EOL; } @@ -698,12 +700,12 @@ class Setup extends \Zotlabs\Web\Controller { function load_database($db) { - $str = file_get_contents($db->get_install_script()); + $str = file_get_contents(\DBA::$dba->get_install_script()); $arr = explode(';',$str); $errors = false; foreach($arr as $a) { if(strlen(trim($a))) { - $r = @$db->q(trim($a)); + $r = dbq(trim($a)); if(! $r) { $errors .= t('Errors encountered creating database tables.') . $a . EOL; } -- cgit v1.2.3 From 516c43ba154dc43ec0ef6135fb0a9732d0185a6f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 24 May 2016 17:54:45 -0700 Subject: more work associated with DBA and index.php shuffle --- Zotlabs/Module/Setup.php | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index b913190b1..447f46ed6 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -12,7 +12,6 @@ namespace Zotlabs\Module; /** * @brief Initialisation for the setup module. * - * @param[in,out] App &$a */ class Setup extends \Zotlabs\Web\Controller { @@ -54,16 +53,15 @@ class Setup extends \Zotlabs\Web\Controller { /** * @brief Handle the actions of the different setup steps. * - * @param[in,out] App &$a */ - function post() { - global $db; + + function post() { switch($this->install_wizard_pass) { case 1: case 2: return; - break; // just in case return don't return :) + // implied break; case 3: $urlpath = \App::get_path(); $dbhost = trim($_POST['dbhost']); @@ -88,33 +86,9 @@ class Setup extends \Zotlabs\Web\Controller { if(! \DBA::$dba->connected) { echo 'Database Connect failed: ' . DBA::$dba->error; killme(); - \App::$data['db_conn_failed']=true; } - /*if(get_db_errno()) { - unset($db); - $db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true); - - if(! get_db_errno()) { - $r = q("CREATE DATABASE '%s'", - dbesc($dbdata) - ); - if($r) { - unset($db); - $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true); - } else { - \App::$data['db_create_failed']=true; - } - } else { - \App::$data['db_conn_failed']=true; - return; - } - }*/ - //if(get_db_errno()) { - - //} - return; - break; + // implied break; case 4: $urlpath = \App::get_path(); $dbhost = notags(trim($_POST['dbhost'])); @@ -177,6 +151,8 @@ class Setup extends \Zotlabs\Web\Controller { \App::$data['db_installed'] = true; return; + // implied break; + default: break; } } @@ -193,11 +169,10 @@ class Setup extends \Zotlabs\Web\Controller { * * Depending on the state we are currently in it returns different content. * - * @param App &$a * @return string parsed HTML output */ - function get() { - global $db; + + function get() { $o = ''; $wizard_status = ''; -- cgit v1.2.3 From 929d33fb22754e8525f3054b321891335b522faa Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 25 May 2016 14:18:41 +0200 Subject: another try on #385 - replace sabres restrictive CSP with what we do in boot.php --- Zotlabs/Module/Cloud.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index d9b0c47d4..b691475ce 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -100,9 +100,12 @@ class Cloud extends \Zotlabs\Web\Controller { // require_once('\Zotlabs\Storage/QuotaPlugin.php'); // $server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth)); + ob_start(); // All we need to do now, is to fire up the server $server->exec(); + ob_end_flush(); + killme(); } -- cgit v1.2.3 From 2f64684299784126bb3bc80fbe9978ec57d19a4c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 25 May 2016 20:06:21 -0700 Subject: some event fixes, also change jquery-textcomplete to un-minified since the minified version appears to require a mapping file and causes a lot of server fetch errors trying to load it. --- Zotlabs/Module/Events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 3440e0727..2b5e239f9 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -232,7 +232,7 @@ class Events extends \Zotlabs\Web\Controller { } if($share) - \Zotlabs\Daemon\Master(array('Notifier','event',$item_id)); + \Zotlabs\Daemon\Master::Summon(array('Notifier','event',$item_id)); } -- cgit v1.2.3 From 9017dcd0fd904ecdf54b75ad39588db4f2e91ea6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 May 2016 14:23:17 +0200 Subject: typo --- Zotlabs/Module/Ping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index f0caa4373..32427b06f 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -286,7 +286,7 @@ class Ping extends \Zotlabs\Web\Controller { foreach($r as $item) { if((argv(1) === 'home') && (! intval($item['item_wall']))) continue; - $result[] = \Zotlbas\Lib\Enotify::format($item); + $result[] = \Zotlabs\Lib\Enotify::format($item); } } // logger('ping (network||home): ' . print_r($result, true), LOGGER_DATA); -- cgit v1.2.3 From 24360fd19182cad5ed29d10bb47c208bc195c232 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 May 2016 14:33:10 +0200 Subject: check if $addonDir is a dir to silence warning if it does not exist --- Zotlabs/Module/Admin.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 172b109c8..8f15035d1 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1421,13 +1421,15 @@ class Admin extends \Zotlabs\Web\Controller { function listAddonRepos() { $addonrepos = []; $addonDir = __DIR__ . '/../../extend/addon/'; - if ($handle = opendir($addonDir)) { - while (false !== ($entry = readdir($handle))) { - if ($entry != "." && $entry != "..") { - $addonrepos[] = $entry; + if(is_dir($addonDir)) { + if ($handle = opendir($addonDir)) { + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + $addonrepos[] = $entry; + } } + closedir($handle); } - closedir($handle); } return $addonrepos; } -- cgit v1.2.3 From 551cf8ee9413c5c57e7b71d6016466e598636900 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 26 May 2016 19:40:16 -0700 Subject: link to hubchart site for site detail on pubsites page --- Zotlabs/Module/Pubsites.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 31bca5f30..0dda08e6d 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -28,9 +28,10 @@ class Pubsites extends \Zotlabs\Web\Controller { if($ret['success']) { $j = json_decode($ret['body'],true); if($j) { - $o .= ''; + $o .= '
' . t('Hub URL') . '' . t('Access Type') . '' . t('Registration Policy') . '' . t('Software') . '' . t('Ratings') . '
'; if($j['sites']) { foreach($j['sites'] as $jj) { + $m = parse_url($jj['url']); if(strpos($jj['project'],\Zotlabs\Lib\System::get_platform_name()) === false) continue; $host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3)); @@ -43,7 +44,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $location = '
 '; } $urltext = str_replace(array('https://'), '', $jj['url']); - $o .= '' . $rate_links . ''; + $o .= '' . $rate_links . ''; } } -- cgit v1.2.3
' . t('Hub URL') . '' . t('Access Type') . '' . t('Registration Policy') . '' . t('Stats') . '' . t('Software') . '' . t('Ratings') . '
' . $urltext . '' . $location . '' . $jj['access'] . '' . $jj['register'] . '' . ucwords($jj['project']) . ' ' . t('View') . '
' . $urltext . '' . $location . '' . $jj['access'] . '' . $jj['register'] . '' . '' . ucwords($jj['project']) . ' ' . t('View') . '