From b7559c1df60bc3c0a16ce3ed32c9e8578d8d668e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 2 Oct 2016 10:36:04 +0200 Subject: missing backslash --- Zotlabs/Lib/Enotify.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index d6fe73717..1e2d9d3aa 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -77,7 +77,7 @@ class Enotify { $sender_email = get_config('system','from_email'); if(! $sender_email) - $sender_email = 'Administrator' . '@' . App::get_hostname(); + $sender_email = 'Administrator' . '@' . \App::get_hostname(); $sender_name = get_config('system','from_email_name'); -- cgit v1.2.3 From 816802774dc0d9ecf49d3c1e4f064332508bb429 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 2 Oct 2016 10:47:25 +0200 Subject: another missing backslash --- Zotlabs/Lib/Enotify.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 1e2d9d3aa..a6527ae71 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -82,7 +82,7 @@ class Enotify { $sender_name = get_config('system','from_email_name'); if(! $sender_name) - $sender_name = Zotlabs\Lib\System::get_site_name(); + $sender_name = \Zotlabs\Lib\System::get_site_name(); -- cgit v1.2.3 From 5b10db6f91f4bb876bbadbc9602c68762a3c9b71 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 3 Oct 2016 15:58:54 -0700 Subject: return the email_sent status --- Zotlabs/Lib/Enotify.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index a6527ae71..9a8628968 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -633,8 +633,8 @@ class Enotify { call_hooks('email_send', $params); if($params['sent']) { - logger("notification: enotify::send returns " . $params['result'], LOGGER_DEBUG); - return; + logger("notification: enotify::send (addon) returns " . $params['result'], LOGGER_DEBUG); + return $params['result']; } $fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8'); -- cgit v1.2.3 From cef1aa6d1b21b15458783661ed4c7e6fe8a99011 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 3 Oct 2016 17:16:24 -0700 Subject: add some more stuff to admin/account_edit (service class, language, and techlevel if appropriate). Fix en-au and en-gb so they are listed as languages, and move language selector stuff to include/language.php instead of include/text.php; new file Zotlabs/Lib/Techlevels.php so we only need to write the selection array once. --- Zotlabs/Lib/Techlevels.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Zotlabs/Lib/Techlevels.php (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Techlevels.php b/Zotlabs/Lib/Techlevels.php new file mode 100644 index 000000000..6a8c36fb3 --- /dev/null +++ b/Zotlabs/Lib/Techlevels.php @@ -0,0 +1,21 @@ + t('Beginner/Basic'), + '1' => t('Novice - not skilled but willing to learn'), + '2' => t('Intermediate - somewhat comfortable'), + '3' => t('Advanced - very comfortable'), + '4' => t('Expert - I can write computer code'), + '5' => t('Wizard - I probably know more than you do') + ]; + return $techlevels; + } + +} + -- cgit v1.2.3 From bad5057a7414eba7f7133538dd671a1413be00e3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 3 Oct 2016 19:47:36 -0700 Subject: start removing db backticks --- Zotlabs/Lib/Enotify.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 9a8628968..ccb014255 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -364,7 +364,7 @@ class Enotify { do { $dups = false; $hash = random_string(); - $r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1", + $r = q("SELECT id FROM notify WHERE hash = '%s' LIMIT 1", dbesc($hash)); if ($r) $dups = true; -- cgit v1.2.3 From daaefed61bc6a38a102ce2c357278158535a2b27 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 13 Oct 2016 16:47:45 -0700 Subject: provide text log results of email success/failure rather than 1 and 0. --- Zotlabs/Lib/Enotify.php | 4 ++-- Zotlabs/Lib/ThreadStream.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index ccb014255..9b4117b9c 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -633,7 +633,7 @@ class Enotify { call_hooks('email_send', $params); if($params['sent']) { - logger("notification: enotify::send (addon) returns " . $params['result'], LOGGER_DEBUG); + logger("notification: enotify::send (addon) returns " . (($params['result']) ? 'success' : 'failure'), LOGGER_DEBUG); return $params['result']; } @@ -676,7 +676,7 @@ class Enotify { $multipartMessageBody, // message body $messageHeader // message headers ); - logger("notification: enotify::send returns " . $res, LOGGER_DEBUG); + logger("notification: enotify::send returns " . (($res) ? 'success' : 'failure'), LOGGER_DEBUG); return $res; } diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php index a6d4f8517..beb626f31 100644 --- a/Zotlabs/Lib/ThreadStream.php +++ b/Zotlabs/Lib/ThreadStream.php @@ -58,7 +58,7 @@ class ThreadStream { case 'display': // in this mode we set profile_owner after initialisation (from conversation()) and then // pull some trickery which allows us to re-invoke this function afterward - // it's an ugly hack so FIXME + // it's an ugly hack so @FIXME $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); break; case 'page': @@ -160,9 +160,9 @@ class ThreadStream { } elseif(($this->observer) && (! $item->is_commentable())) { if((array_key_exists('owner',$item->data)) && intval($item->data['owner']['abook_self'])) - $item->set_commentable(perm_is_allowed($this->profile_owner,$this->observer['xchan_hash'],'post_comments')); + $item->set_commentable(perm_is_allowed($this->profile_owner,$ob_hash,'post_comments')); else - $item->set_commentable(can_comment_on_post($this->observer['xchan_hash'],$item->data)); + $item->set_commentable(can_comment_on_post($ob_hash,$item->data)); } } require_once('include/channel.php'); -- cgit v1.2.3 From 437aa168d136db2c782ed2b366e411721f5f605c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 17 Oct 2016 21:03:34 -0700 Subject: array_key_exists warning on PConfig::Delete() --- Zotlabs/Lib/PConfig.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/PConfig.php b/Zotlabs/Lib/PConfig.php index a481667a5..7e29ef8de 100644 --- a/Zotlabs/Lib/PConfig.php +++ b/Zotlabs/Lib/PConfig.php @@ -185,13 +185,16 @@ class PConfig { $ret = false; - if(array_key_exists($key, \App::$config[$uid][$family])) + if(array_key_exists($uid,\App::$config) + && array_key_exists($family,\App::$config['uid']) + && array_key_exists($key, \App::$config[$uid][$family])) unset(\App::$config[$uid][$family][$key]); - $ret = q("DELETE FROM pconfig WHERE uid = %d AND cat = '%s' AND k = '%s'", - intval($uid), - dbesc($family), - dbesc($key) - ); + + $ret = q("DELETE FROM pconfig WHERE uid = %d AND cat = '%s' AND k = '%s'", + intval($uid), + dbesc($family), + dbesc($key) + ); return $ret; } -- cgit v1.2.3 From 17091bd38c4e4e5d8b1812dd1d9efeffe0046d02 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 17 Oct 2016 22:09:41 -0700 Subject: add get_photo hook to go along with get_profile_photo hook. This allows a plugin to over-ride the permissions for cover photos or insert a different photo in place of that requested --- Zotlabs/Lib/Enotify.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index 9b4117b9c..ffe2f0950 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -78,15 +78,12 @@ class Enotify { $sender_email = get_config('system','from_email'); if(! $sender_email) $sender_email = 'Administrator' . '@' . \App::get_hostname(); - $sender_name = get_config('system','from_email_name'); if(! $sender_name) $sender_name = \Zotlabs\Lib\System::get_site_name(); - - $additional_mail_header = ""; if(array_key_exists('item', $params)) { -- cgit v1.2.3 From b71e148ceafd4153ff564b46de92c6859088d2f2 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Tue, 18 Oct 2016 20:43:48 +0200 Subject: [BUGFIX] for fromStandalonePermission(). Not sure if this method is used anywhere, but it should not have worked correctly. This should correct it. Add a unit test for this class. --- Zotlabs/Lib/PermissionDescription.php | 54 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/PermissionDescription.php b/Zotlabs/Lib/PermissionDescription.php index b6c6dd29d..51d5f890d 100644 --- a/Zotlabs/Lib/PermissionDescription.php +++ b/Zotlabs/Lib/PermissionDescription.php @@ -12,22 +12,25 @@ require_once("include/text.php"); * permission settings for an item with an empty ACL. * i.e the caption, icon, and tooltip for the no-ACL option in the ACL dialog. */ -class PermissionDescription { +class PermissionDescription { private $global_perm; private $channel_perm; private $fallback_description; - + /** * Constructor is private. - * Use static methods fromGlobalPermission(), fromStandalonePermission(), or fromDescription() - * to create instances. + * Use static methods fromGlobalPermission(), fromStandalonePermission(), + * or fromDescription() to create instances. + * + * @internal + * @param int $global_perm + * @param int $channel_perm + * @param string $description (optional) default empty */ private function __construct($global_perm, $channel_perm, $description = '') { - $this->global_perm = $global_perm; $this->channel_perm = $channel_perm; - $this->fallback_description = ($description == '') ? t('Visible to your default audience') : $description; } @@ -43,23 +46,22 @@ class PermissionDescription { return new PermissionDescription('', 0x80000, $description); } - /** * Use this method only if the interpretation of an empty ACL doesn't fall back to a global * default permission. You should pass one of the constants from boot.php - PERMS_PUBLIC, * PERMS_NETWORK etc. - * + * * @param integer $perm - a single enumerated constant permission - PERMS_PUBLIC, PERMS_NETWORK etc. * @return a new instance of PermissionDescription */ public static function fromStandalonePermission($perm) { $result = new PermissionDescription('', $perm); - - $checkPerm = $this->get_permission_description(); - if ($checkPerm == $this->fallback_description) { + + $checkPerm = $result->get_permission_description(); + if($checkPerm == $result->fallback_description) { $result = null; - logger('null PermissionDescription from unknown standalone permission: ' . $perm ,LOGGER_DEBUG, LOG_ERROR); + logger('null PermissionDescription from unknown standalone permission: ' . $perm, LOGGER_DEBUG, LOG_ERR); } return $result; @@ -67,9 +69,9 @@ class PermissionDescription { /** * This is the preferred way to create a PermissionDescription, as it provides the most details. - * Use this method if you know an empty ACL will result in one of the global default permissions + * Use this method if you know an empty ACL will result in one of the global default permissions * being used, such as channel_r_stream (for which you would pass 'view_stream'). - * + * * @param string $permname - a key for the global perms array from get_perms() in permissions.php, * e.g. 'view_stream', 'view_profile', etc. * @return a new instance of PermissionDescription @@ -80,19 +82,19 @@ class PermissionDescription { $global_perms = \Zotlabs\Access\Permissions::Perms(); - if (array_key_exists($permname, $global_perms)) { + if(array_key_exists($permname, $global_perms)) { - $channelPerm = \Zotlabs\Access\PermissionLimits::Get(\App::$channel['channel_id'],$permname); + $channelPerm = \Zotlabs\Access\PermissionLimits::Get(\App::$channel['channel_id'], $permname); $result = new PermissionDescription('', $channelPerm); } else { // The acl dialog can handle null arguments, but it shouldn't happen - logger('null PermissionDescription from unknown global permission: ' . $permname ,LOGGER_DEBUG, LOG_ERROR); + logger('null PermissionDescription from unknown global permission: ' . $permname, LOGGER_DEBUG, LOG_ERR); } + return $result; } - /** * Gets a localized description of the permission, or a generic message if the permission * is unknown. @@ -101,8 +103,7 @@ class PermissionDescription { */ public function get_permission_description() { - switch($this->channel_perm) { - + switch($this->channel_perm) { case 0: return t('Only me'); case PERMS_PUBLIC: return t('Public'); case PERMS_NETWORK: return t('Anybody in the $Projectname network'); @@ -117,19 +118,18 @@ class PermissionDescription { /** * Returns an icon css class name if an appropriate one is available, e.g. "fa-globe" for Public, - * otherwise returns empty string. + * otherwise returns empty string. * * @return string icon css class name (often FontAwesome) */ public function get_permission_icon() { - switch($this->channel_perm) { - + switch($this->channel_perm) { case 0:/* only me */ return 'fa-eye-slash'; case PERMS_PUBLIC: return 'fa-globe'; case PERMS_NETWORK: return 'fa-share-alt-square'; // fa-share-alt-square is very similiar to the hubzilla logo, but we should create our own logo class to use - case PERMS_SITE: return 'fa-sitemap'; - case PERMS_CONTACTS: return 'fa-group'; + case PERMS_SITE: return 'fa-sitemap'; + case PERMS_CONTACTS: return 'fa-group'; case PERMS_SPECIFIC: return 'fa-list'; case PERMS_AUTHED: return ''; case PERMS_PENDING: return ''; @@ -137,7 +137,6 @@ class PermissionDescription { } } - /** * Returns a localized description of where the permission came from, if this is known. * If it's not know, or if the permission is standalone and didn't come from a default @@ -147,8 +146,7 @@ class PermissionDescription { */ public function get_permission_origin_description() { - switch($this->global_perm) { - + switch($this->global_perm) { case PERMS_R_STREAM: return t('This is your default setting for the audience of your normal stream, and posts.'); case PERMS_R_PROFILE: return t('This is your default setting for who can view your default channel profile'); case PERMS_R_ABOOK: return t('This is your default setting for who can view your connections'); -- cgit v1.2.3 From aab7bc5282bffeb553c1bbd505ac74fde233ea3b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 2 Nov 2016 18:48:23 -0700 Subject: silence a minor warning --- Zotlabs/Lib/PConfig.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/PConfig.php b/Zotlabs/Lib/PConfig.php index 7e29ef8de..3b47a250a 100644 --- a/Zotlabs/Lib/PConfig.php +++ b/Zotlabs/Lib/PConfig.php @@ -186,6 +186,7 @@ class PConfig { $ret = false; if(array_key_exists($uid,\App::$config) + && is_array(\App::$config['uid']) && array_key_exists($family,\App::$config['uid']) && array_key_exists($key, \App::$config[$uid][$family])) unset(\App::$config[$uid][$family][$key]); -- cgit v1.2.3 From c427fe94dae41a6c2899d426cfd0945f93347b56 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 7 Nov 2016 18:29:38 -0800 Subject: cleanup and re-organise the voting and attendance buttons --- Zotlabs/Lib/ThreadItem.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index a3e871810..48b50b295 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -355,6 +355,10 @@ class ThreadItem { 'unverified' => $unverified, 'forged' => $forged, 'location' => $location, + 'attend_label' => t('Attend'), + 'attend_title' => t('Attendance Options'), + 'vote_label' => t('Vote'), + 'vote_title' => t('Voting Options'), 'indent' => $indent, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), -- cgit v1.2.3 From 640d15dba548533fbda5d73d04db8f6896197026 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 12 Nov 2016 14:09:33 -0800 Subject: don't send notification for posts/comments on old conversations that were refetched after having expired. We'll accomplish this by limiting notifications to items posted within the last month. --- Zotlabs/Lib/Enotify.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index ffe2f0950..b6f4d3351 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -102,6 +102,10 @@ class Enotify { $title = $params['item']['title']; $body = $params['item']['body']; } + if($item['created'] < datetime_convert('UTC','UTC','now - 1 month')) { + logger('notification invoked for an old item which may have been refetched.',LOGGER_DEBUG,LOG_INFO); + return; + } } else { $title = $body = ''; -- cgit v1.2.3 From 1274889931925389add1fd52d07d90eb03a70b62 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 17 Nov 2016 11:00:34 -0800 Subject: issue #588, change 'Bug Report' app to 'Report Bug' --- Zotlabs/Lib/Apps.php | 2 +- Zotlabs/Lib/System.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index a646d8a30..a2f253299 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -203,7 +203,7 @@ class Apps { static public function translate_system_apps(&$arr) { $apps = array( 'Site Admin' => t('Site Admin'), - 'Bug Report' => t('Bug Report'), + 'Report Bug' => t('Report Bug'), 'View Bookmarks' => t('View Bookmarks'), 'My Chatrooms' => t('My Chatrooms'), 'Connections' => t('Connections'), diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 6ccfd664c..32aaa82a9 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -32,13 +32,13 @@ class System { static public function get_notify_icon() { if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['email_notify_icon_url']) return \App::$config['system']['email_notify_icon_url']; - return z_root() . '/images/hz-white-32.png'; + return z_root() . DEFAULT_NOTIFY_ICON; } static public function get_site_icon() { if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['site_icon_url']) return \App::$config['system']['site_icon_url']; - return z_root() . '/images/hz-32.png'; + return z_root() . DEFAULT_PLATFORM_ICON ; } -- cgit v1.2.3 From abb3341030b15bf123e998ccea667695c7d785e8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 19 Nov 2016 13:01:50 -0800 Subject: redmatrix is no longer considered a supported platform and will not be listed in pubsites as of 2.x --- Zotlabs/Lib/System.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 32aaa82a9..26768af26 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -54,5 +54,11 @@ class System { return '0.0.0'; } - + static public function compatible_project($p) { + foreach(['hubzilla','zap'] as $t) { + if(stristr($p,$t)) + return true; + } + return false; + } } -- cgit v1.2.3 From a6d47ca77294b8fc4c2538b95d772b3be505fcf1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 22 Nov 2016 14:24:38 -0800 Subject: notification issue --- Zotlabs/Lib/Enotify.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index b6f4d3351..c64ff9868 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -102,7 +102,7 @@ class Enotify { $title = $params['item']['title']; $body = $params['item']['body']; } - if($item['created'] < datetime_convert('UTC','UTC','now - 1 month')) { + if($params['item']['created'] < datetime_convert('UTC','UTC','now - 1 month')) { logger('notification invoked for an old item which may have been refetched.',LOGGER_DEBUG,LOG_INFO); return; } -- cgit v1.2.3 From d757dd4e1750908a9964189c4310c4037c3c3fc4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 29 Nov 2016 15:47:38 -0800 Subject: provide a fresh new look and cleaner layout and more relevant information to siteinfo --- Zotlabs/Lib/System.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 26768af26..f05cdcf0e 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -42,6 +42,20 @@ class System { } + static public function get_project_link() { + if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_link']) + return \App::$config['system']['project_link']; + return 'https://hubzilla.org'; + } + + static public function get_project_srclink() { + if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_srclink']) + return \App::$config['system']['project_srclink']; + return 'https://github.org/redmatrix/hubzilla'; + } + + + static public function get_server_role() { if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['server_role']) return \App::$config['system']['server_role']; -- cgit v1.2.3 From 0cf6c6c132dda695853ce52089f6745a9c4b29dc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 29 Nov 2016 17:00:37 -0800 Subject: wrong link --- Zotlabs/Lib/System.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index f05cdcf0e..70443016f 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -51,7 +51,7 @@ class System { static public function get_project_srclink() { if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_srclink']) return \App::$config['system']['project_srclink']; - return 'https://github.org/redmatrix/hubzilla'; + return 'https://github.com/redmatrix/hubzilla'; } -- cgit v1.2.3 From 47a356ff52900fd8cd8d4980b44c69c13b2e612f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Dec 2016 14:45:24 -0800 Subject: compatible_project: we are only concerned with the default realm --- Zotlabs/Lib/System.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php index 70443016f..306c90f4a 100644 --- a/Zotlabs/Lib/System.php +++ b/Zotlabs/Lib/System.php @@ -69,6 +69,10 @@ class System { } static public function compatible_project($p) { + + if(get_directory_realm() != DIRECTORY_REALM) + return true; + foreach(['hubzilla','zap'] as $t) { if(stristr($p,$t)) return true; -- cgit v1.2.3 From fbf13dde213dcecfdc6c6e5d95b165bb46eda85a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 5 Dec 2016 14:50:34 -0800 Subject: minor changes to config api and markdown_to_bb --- Zotlabs/Lib/AConfig.php | 4 ++-- Zotlabs/Lib/AbConfig.php | 4 ++-- Zotlabs/Lib/Config.php | 6 +++--- Zotlabs/Lib/IConfig.php | 6 +++--- Zotlabs/Lib/PConfig.php | 6 +++--- Zotlabs/Lib/XConfig.php | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/AConfig.php b/Zotlabs/Lib/AConfig.php index ab8648a18..4e7c5483f 100644 --- a/Zotlabs/Lib/AConfig.php +++ b/Zotlabs/Lib/AConfig.php @@ -10,8 +10,8 @@ class AConfig { return XConfig::Load('a_' . $account_id); } - static public function Get($account_id,$family,$key) { - return XConfig::Get('a_' . $account_id,$family,$key); + static public function Get($account_id,$family,$key,$default = false) { + return XConfig::Get('a_' . $account_id,$family,$key, $default); } static public function Set($account_id,$family,$key,$value) { diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php index cb5d96951..dfc9efc6c 100644 --- a/Zotlabs/Lib/AbConfig.php +++ b/Zotlabs/Lib/AbConfig.php @@ -16,7 +16,7 @@ class AbConfig { } - static public function Get($chan,$xhash,$family,$key) { + static public function Get($chan,$xhash,$family,$key, $default = false) { $r = q("select * from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' limit 1", intval($chan), dbesc($xhash), @@ -26,7 +26,7 @@ class AbConfig { if($r) { return ((preg_match('|^a:[0-9]+:{.*}$|s', $r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']); } - return false; + return $default; } diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php index d4ee1aeda..5625a3f79 100644 --- a/Zotlabs/Lib/Config.php +++ b/Zotlabs/Lib/Config.php @@ -98,13 +98,13 @@ class Config { * @return mixed Return value or false on error or if not set */ - static public function Get($family,$key) { + static public function Get($family,$key,$default = false) { if((! array_key_exists($family, \App::$config)) || (! array_key_exists('config_loaded', \App::$config[$family]))) self::Load($family); if(array_key_exists('config_loaded', \App::$config[$family])) { if(! array_key_exists($key, \App::$config[$family])) { - return false; + return $default; } return ((! is_array(\App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$family][$key])) ? unserialize(\App::$config[$family][$key]) @@ -112,7 +112,7 @@ class Config { ); } - return false; + return $default; } /** diff --git a/Zotlabs/Lib/IConfig.php b/Zotlabs/Lib/IConfig.php index 28c9ab58e..33d94bd49 100644 --- a/Zotlabs/Lib/IConfig.php +++ b/Zotlabs/Lib/IConfig.php @@ -10,7 +10,7 @@ class IConfig { return; } - static public function Get(&$item, $family, $key) { + static public function Get(&$item, $family, $key, $default = false) { $is_item = false; @@ -28,7 +28,7 @@ class IConfig { $iid = $item; if(! $iid) - return false; + return $default; if(is_array($item) && array_key_exists('iconfig',$item) && is_array($item['iconfig'])) { foreach($item['iconfig'] as $c) { @@ -48,7 +48,7 @@ class IConfig { $item['iconfig'][] = $r[0]; return $r[0]['v']; } - return false; + return $default; } diff --git a/Zotlabs/Lib/PConfig.php b/Zotlabs/Lib/PConfig.php index 3b47a250a..d70697fbc 100644 --- a/Zotlabs/Lib/PConfig.php +++ b/Zotlabs/Lib/PConfig.php @@ -67,16 +67,16 @@ class PConfig { * @return mixed Stored value or false if it does not exist */ - static public function Get($uid,$family,$key,$instore = false) { + static public function Get($uid,$family,$key,$default = false) { if(is_null($uid) || $uid === false) - return false; + return $default; if(! array_key_exists($uid, \App::$config)) self::Load($uid); if((! array_key_exists($family, \App::$config[$uid])) || (! array_key_exists($key, \App::$config[$uid][$family]))) - return false; + return $default; return ((! is_array(\App::$config[$uid][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$uid][$family][$key])) ? unserialize(\App::$config[$uid][$family][$key]) diff --git a/Zotlabs/Lib/XConfig.php b/Zotlabs/Lib/XConfig.php index 7f3d0f2cd..bf78c360f 100644 --- a/Zotlabs/Lib/XConfig.php +++ b/Zotlabs/Lib/XConfig.php @@ -59,16 +59,16 @@ class XConfig { * @return mixed Stored $value or false if it does not exist */ - static public function Get($xchan, $family, $key) { + static public function Get($xchan, $family, $key, $default = false) { if(! $xchan) - return false; + return $default; if(! array_key_exists($xchan, \App::$config)) load_xconfig($xchan); if((! array_key_exists($family, \App::$config[$xchan])) || (! array_key_exists($key, \App::$config[$xchan][$family]))) - return false; + return $default; return ((! is_array(\App::$config[$xchan][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$xchan][$family][$key])) ? unserialize(\App::$config[$xchan][$family][$key]) -- cgit v1.2.3 From 0f7d36cfa0ed5896151078e305f4c2d2523f378c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Dec 2016 16:27:43 -0800 Subject: move the rest of superblock out of core --- Zotlabs/Lib/ThreadItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 48b50b295..a1666e148 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -44,7 +44,7 @@ class ThreadItem { * Only add those that will be displayed */ - if((! visible_activity($item)) || array_key_exists('author_blocked',$item)) { + if((! visible_activity($item)) || array_key_exists('blocked',$item)) { continue; } -- cgit v1.2.3 From e06647b54e707f023911ee68d59205c1e85df67a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Dec 2016 17:54:03 -0800 Subject: some preliminary work for email notification of likes - potentially destabilising so disabled until after next release --- Zotlabs/Lib/Enotify.php | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php index c64ff9868..257687567 100644 --- a/Zotlabs/Lib/Enotify.php +++ b/Zotlabs/Lib/Enotify.php @@ -217,6 +217,85 @@ class Enotify { $hsitelink = sprintf( $sitelink, '' . $sitename . ''); } + if ($params['type'] == NOTIFY_LIKE) { +// logger("notification: params = " . print_r($params, true), LOGGER_DEBUG); + + $itemlink = $params['link']; + + // ignore like/unlike activity on posts - they probably require a separate notification preference + + if (array_key_exists('item',$params) && (! activity_match($params['item']['verb'],ACTIVITY_LIKE))) { + logger('notification: not a like activity. Ignoring.'); + pop_lang(); + return; + } + + $parent_mid = $params['parent_mid']; + + // Check to see if there was already a notify for this post. + // If so don't create a second notification + + $p = null; + $p = q("select id from notify where link = '%s' and uid = %d limit 1", + dbesc($params['link']), + intval($recip['channel_id']) + ); + if ($p) { + logger('notification: like already notified'); + pop_lang(); + return; + } + + + // if it's a post figure out who's post it is. + + $p = null; + + if($params['otype'] === 'item' && $parent_mid) { + $p = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($parent_mid), + intval($recip['channel_id']) + ); + } + + xchan_query($p); + + + $item_post_type = item_post_type($p[0]); +// $private = $p[0]['item_private']; + $parent_id = $p[0]['id']; + + $parent_item = $p[0]; + + + // "your post" + if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall'])) + $dest_str = sprintf(t('%1$s, %2$s liked [zrl=%3$s]your %4$s[/zrl]'), + $recip['channel_name'], + '[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]', + $itemlink, + $item_post_type); + else { + pop_lang(); + return; + } + + // Some mail softwares relies on subject field for threading. + // So, we cannot have different subjects for notifications of the same thread. + // Before this we have the name of the replier on the subject rendering + // differents subjects for messages on the same thread. + + $subject = sprintf( t('[$Projectname:Notify] Like received to conversation #%1$d by %2$s'), $parent_id, $sender['xchan_name']); + $preamble = sprintf( t('%1$s, %2$s liked an item/conversation you created.'), $recip['channel_name'], $sender['xchan_name']); + $epreamble = $dest_str; + + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); + $tsitelink = sprintf( $sitelink, $siteurl ); + $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + } + + + if($params['type'] == NOTIFY_WALL) { $subject = sprintf( t('[$Projectname:Notify] %s posted to your profile wall') , $sender['xchan_name']); -- cgit v1.2.3 From be4bbd7b9bba5ff65f5d057a0d801de810c73b90 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 14 Dec 2016 19:12:55 -0800 Subject: SQL error with app categories --- Zotlabs/Lib/Apps.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index a2f253299..ac03e11e1 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -68,7 +68,7 @@ class Apps { if($id !== true) { // if we already installed this app, but it changed, preserve any categories we created $s = ''; - $r = q("select * from term where otype = %d and oid = d", + $r = q("select * from term where otype = %d and oid = %d", intval(TERM_OBJ_APP), intval($id) ); @@ -359,7 +359,7 @@ class Apps { if($r) { if(! $r[0]['app_system']) { if($app['categories'] && (! $app['term'])) { - $r[0]['term'] = q("select * from term where otype = %d and oid = d", + $r[0]['term'] = q("select * from term where otype = %d and oid = %d", intval(TERM_OBJ_APP), intval($r[0]['id']) ); -- cgit v1.2.3