From aab9218558fda38e0f7f357f35b7fabb8dfb7631 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 22 Apr 2016 11:50:46 -0400 Subject: [PATCH 1/9] Added help content --- doc/context/en/admin/security/help.html | 7 ++++--- doc/context/en/chat/help.html | 8 ++++++++ doc/context/en/events/help.html | 8 ++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 doc/context/en/chat/help.html create mode 100644 doc/context/en/events/help.html diff --git a/doc/context/en/admin/security/help.html b/doc/context/en/admin/security/help.html index e9a741a5e..bfe81b132 100644 --- a/doc/context/en/admin/security/help.html +++ b/doc/context/en/admin/security/help.html @@ -1,3 +1,4 @@ -

Security Settings

-

This page contains various administrator settings related to security.

-

To save any changes you make to these settings, you must press the Submit button.

\ No newline at end of file +
+
General
+
This page contains various administrator settings related to security. To save any changes you make to these settings, you must press the Submit button.
+
\ No newline at end of file diff --git a/doc/context/en/chat/help.html b/doc/context/en/chat/help.html new file mode 100644 index 000000000..0aa85b9a9 --- /dev/null +++ b/doc/context/en/chat/help.html @@ -0,0 +1,8 @@ +
+
General
+
You can create and use chat rooms here. Existing chat rooms are either displayed in the
+
Create new chat room
+
Use the "Create New" button to create a new chat room. Enter a name and how long messages should be retained.
+
Chatting
+
Enter your message in the message box and press Submit. You can set a status by selecting the chat room menu button beside the Submit button. Other people "in the room" are visible in the side panel in the "Chat Members" panel.
+
\ No newline at end of file diff --git a/doc/context/en/events/help.html b/doc/context/en/events/help.html new file mode 100644 index 000000000..8c0b1d4ab --- /dev/null +++ b/doc/context/en/events/help.html @@ -0,0 +1,8 @@ +
+
General
+
This page displays a calendar of events both owned by you and shared with you from other channels.
+
Calendar View
+
The calendar can be displayed in month, week, or day mode using the options in the side panel.
+
Export/Import
+
Export or import calendar events using standard iCalendar format (.ics) files.
+
\ No newline at end of file From b13c21f8720f27d05c33793df01a429d4a4220e8 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 27 Apr 2016 06:23:05 -0400 Subject: [PATCH 2/9] Added context help content --- doc/context/en/admin/logs/help.html | 8 ++++++++ doc/context/en/admin/queue/help.html | 4 ++++ doc/context/en/chat/help.html | 2 +- doc/context/en/connections/help.html | 8 ++++++++ doc/context/en/connections/ifpending/help.html | 8 ++++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 doc/context/en/admin/logs/help.html create mode 100644 doc/context/en/admin/queue/help.html create mode 100644 doc/context/en/connections/help.html create mode 100644 doc/context/en/connections/ifpending/help.html diff --git a/doc/context/en/admin/logs/help.html b/doc/context/en/admin/logs/help.html new file mode 100644 index 000000000..708ec9bde --- /dev/null +++ b/doc/context/en/admin/logs/help.html @@ -0,0 +1,8 @@ +
+
General
+
This page allows you to adjust log settings and to view and existing log.
+
Log Settings
+
When you enable the Debugging option, system log information will begin appending to the file specified in the "Log File" box (path is relative to the hub root, for example /var/www). Note that this file must be writable by the web server.
+
Log Level
+
The log level option allows you to set how much information is appended to the log file. Warning: Increasing this level can quickly inflate the size of the log file to >100MB, especially on hubs with more than a few members.
+
\ No newline at end of file diff --git a/doc/context/en/admin/queue/help.html b/doc/context/en/admin/queue/help.html new file mode 100644 index 000000000..28885a154 --- /dev/null +++ b/doc/context/en/admin/queue/help.html @@ -0,0 +1,4 @@ +
+
General
+
The queue statistics display how many posts are in the queue for delivery to other hubs. The priority is related to how many times the delivery has been unsuccessfully attempted.
+
\ No newline at end of file diff --git a/doc/context/en/chat/help.html b/doc/context/en/chat/help.html index 0aa85b9a9..cc71686d8 100644 --- a/doc/context/en/chat/help.html +++ b/doc/context/en/chat/help.html @@ -1,6 +1,6 @@
General
-
You can create and use chat rooms here. Existing chat rooms are either displayed in the
+
Create and use chat rooms to communicate in real-time, using the standard Hubzilla permissions system for chat room access control.
Create new chat room
Use the "Create New" button to create a new chat room. Enter a name and how long messages should be retained.
Chatting
diff --git a/doc/context/en/connections/help.html b/doc/context/en/connections/help.html new file mode 100644 index 000000000..0f95fde63 --- /dev/null +++ b/doc/context/en/connections/help.html @@ -0,0 +1,8 @@ +
+
General
+
This page displays a list of all this channel's connections. The list can be sorted and filtered using the menu button beside the search button.
+
Connection Details
+
Each list entry shows the details of a specific connection. A translucent avatar image indicates an archived connection.
+
Connection Status
+
A connection can be in different states:
  • Archived
  • Ignored
  • Blocked
  • Hidden
+
\ No newline at end of file diff --git a/doc/context/en/connections/ifpending/help.html b/doc/context/en/connections/ifpending/help.html new file mode 100644 index 000000000..0f95fde63 --- /dev/null +++ b/doc/context/en/connections/ifpending/help.html @@ -0,0 +1,8 @@ +
+
General
+
This page displays a list of all this channel's connections. The list can be sorted and filtered using the menu button beside the search button.
+
Connection Details
+
Each list entry shows the details of a specific connection. A translucent avatar image indicates an archived connection.
+
Connection Status
+
A connection can be in different states:
  • Archived
  • Ignored
  • Blocked
  • Hidden
+
\ No newline at end of file From 8e8df26066d806c663e3eecc7d869d611e311f81 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 27 Apr 2016 13:25:58 -0700 Subject: [PATCH 3/9] Use / for album name in photo activities if no album present. --- include/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/photos.php b/include/photos.php index 24e872890..d088d455a 100644 --- a/include/photos.php +++ b/include/photos.php @@ -296,7 +296,7 @@ function photo_upload($channel, $observer, $args) { $photo_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' . t('a new photo') . '[/zrl]'; - $album_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album) . ']' . $album . '[/zrl]'; + $album_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album) . ']' . ((strlen($album)) ? $album : '/') . '[/zrl]'; $activity_format = sprintf(t('%1$s posted %2$s to %3$s','photo_upload'), $author_link, $photo_link, $album_link); From bdef71bda0cbd148e57181275339ae88df9c12fe Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 27 Apr 2016 21:26:52 -0700 Subject: [PATCH 4/9] provide courtesy function for syncing one item. We'll probably be doing this a lot. --- include/items.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/items.php b/include/items.php index 7947f64a2..2720dd841 100755 --- a/include/items.php +++ b/include/items.php @@ -5616,3 +5616,18 @@ function send_profile_photo_activity($channel,$photo,$profile) { } + +function sync_an_item($channel_id,$item_id) { + + $r = q("select * from item where id = %d", + intval($item_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($item_id) + ); + build_sync_packet($channel_d,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } +} \ No newline at end of file From 2ddd03f5975c43ff497c3dfdf491262fd519c1bb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 27 Apr 2016 22:44:06 -0700 Subject: [PATCH 5/9] provide a Hook method to unregister all hooks with a given filespec component. This will be useful in upgrading plugins to use new interfaces, as you won't have to individually unregister hook declarations that you are no longer using in the code. --- Zotlabs/Extend/Hook.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php index edfacfa3b..d95defc43 100644 --- a/Zotlabs/Extend/Hook.php +++ b/Zotlabs/Extend/Hook.php @@ -20,6 +20,15 @@ class Hook { if($r) return true; + // To aid in upgrade and transition, remove old settings for any registered hooks that match in all respects except + // for priority or hook_version + + $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'", + dbesc($hook), + dbesc($file), + dbesc($function), + ); + $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", dbesc($hook), dbesc($file), @@ -46,6 +55,18 @@ class Hook { return $r; } + // unregister all hooks with this file component. + // Useful for addon upgrades where you want to clean out old interfaces. + + static public function unregister_by_file($file) { + + $r = q("DELETE FROM hook WHERE `file` = '%s' ", + dbesc($file), + ); + + return $r; + } + /** * @brief Inserts a hook into a page request. From f108838ca976299eabab45fb07373278391d6b66 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 28 Apr 2016 11:42:37 +0200 Subject: [PATCH 6/9] css fix --- view/theme/redbasic/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index bd5df5e63..bb25310b6 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -210,6 +210,7 @@ header #banner #logo-text { display: block; position: fixed; top: 51px; + width: 100%; max-height: 50%; background: $comment_item_colour; padding: 20px; From b664af748e32f6e8f3d451e95fd8cb65940eca17 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 28 Apr 2016 13:08:41 +0200 Subject: [PATCH 7/9] provide help button in context help popup --- view/theme/redbasic/css/style.css | 18 ++++++++++++++++++ view/tpl/nav.tpl | 9 ++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index bb25310b6..290a1a697 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -224,6 +224,24 @@ header #banner #logo-text { .contextual-help-content dd { margin-bottom: 1em; } + +.contextual-help-tool { + padding: 7px; + filter: alpha(opacity=20); + opacity: .2; +} + +.contextual-help-tool:hover { + filter: alpha(opacity=50); + opacity: .5; + text-decoration: none; +} + +.contextual-help-tool i { + color: #000; + font-size: 16px; +} + /* contextual help end */ /* footer */ diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 03b48fd00..14fb8a982 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -36,10 +36,6 @@
  • {{$nav.admin.1}}
  • {{/if}} - {{if $nav.help.6}} - -
  • {{$nav.help.1}}
  • - {{/if}} {{if $nav.logout}}
  • {{$nav.logout.1}}
  • @@ -207,6 +203,9 @@ {{if $nav.help.6}}
    {{$nav.help.5}} - +
    + + +
    {{/if}} From 30a6ae3daa42da8d1d9560fcc4c706b3e41c4d80 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Apr 2016 20:17:05 -0700 Subject: [PATCH 8/9] This setting isn't implemented so remove the UI until it is. --- Zotlabs/Module/Admin.php | 2 +- view/tpl/admin_security.tpl | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 1ff9065cd..1d37b41bc 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -725,7 +725,7 @@ class Admin extends \Zotlabs\Web\Controller { '$embed_allow' => array('embed_allow', t('Allow embedded HTML content only from these domains'), $whiteembeds_str, t('One site per line. Leave empty to allow from any site by default')), '$embed_deny' => array('embed_deny', t('Block embedded HTML from these domains'), $blackembeds_str, ''), - '$embed_coop' => array('embed_coop', t('Cooperative embed security'), $embed_coop, t('Enable to share embed security with other compatible sites/hubs')), +// '$embed_coop' => array('embed_coop', t('Cooperative embed security'), $embed_coop, t('Enable to share embed security with other compatible sites/hubs')), '$submit' => t('Submit') )); } diff --git a/view/tpl/admin_security.tpl b/view/tpl/admin_security.tpl index 691db2d88..3823d8235 100755 --- a/view/tpl/admin_security.tpl +++ b/view/tpl/admin_security.tpl @@ -15,9 +15,6 @@ {{include file="field_textarea.tpl" field=$whitelisted_channels}} {{include file="field_textarea.tpl" field=$blacklisted_channels}} - - {{include file="field_checkbox.tpl" field=$embed_coop}} - {{include file="field_textarea.tpl" field=$embed_allow}} {{include file="field_textarea.tpl" field=$embed_deny}} From bb96f44861c66e9eb334e18e4b4b659685433008 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Apr 2016 21:02:27 -0700 Subject: [PATCH 9/9] allow engineering units (e.g. 400M, 1G) as service class limits --- Zotlabs/Extend/Hook.php | 4 ++-- Zotlabs/Module/Item.php | 4 ++-- Zotlabs/Module/Photos.php | 2 +- Zotlabs/Storage/Browser.php | 2 +- Zotlabs/Storage/Directory.php | 6 +++--- Zotlabs/Storage/File.php | 4 ++-- include/account.php | 3 +++ include/photos.php | 2 +- include/text.php | 2 +- 9 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php index d95defc43..713165faf 100644 --- a/Zotlabs/Extend/Hook.php +++ b/Zotlabs/Extend/Hook.php @@ -26,7 +26,7 @@ class Hook { $r = q("DELETE FROM `hook` where `hook` = '%s' and `file` = '%s' and `function` = '%s'", dbesc($hook), dbesc($file), - dbesc($function), + dbesc($function) ); $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )", @@ -61,7 +61,7 @@ class Hook { static public function unregister_by_file($file) { $r = q("DELETE FROM hook WHERE `file` = '%s' ", - dbesc($file), + dbesc($file) ); return $r; diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 74fbeed67..93570fdec 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1243,14 +1243,14 @@ class Item extends \Zotlabs\Web\Controller { } if (!$iswebpage) { - $max = service_class_fetch($channel_id,'total_items'); + $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_items')); if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) { $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$max); return $result; } } else { - $max = service_class_fetch($channel_id,'total_pages'); + $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_pages')); if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) { $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$max); return $result; diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index ce350666f..15a1f4d9c 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -615,7 +615,7 @@ class Photos extends \Zotlabs\Web\Controller { ); - $limit = service_class_fetch(\App::$data['channel']['channel_id'],'photo_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch(\App::$data['channel']['channel_id'],'photo_upload_limit')); if($limit !== false) { $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 ); } diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 720940953..c75ebe41f 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -273,7 +273,7 @@ class Browser extends DAV\Browser\Plugin { return; // Storage and quota for the account (all channels of the owner of this directory)! - $limit = service_class_fetch($owner, 'attach_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch($owner, 'attach_upload_limit')); $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d", intval($this->auth->channel_account_id) ); diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index edbef5a95..3c0cff6ef 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -315,13 +315,13 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { } // check against service class quota - $limit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit')); if ($limit !== false) { $x = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d ", intval($c[0]['channel_account_id']) ); if (($x) && ($x[0]['total'] + $size > $limit)) { - logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit); + logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . userReadableSize($limit)); attach_delete($c[0]['channel_id'], $hash); return; } @@ -549,7 +549,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { intval($this->auth->owner_id) ); - $ulimit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'); + $ulimit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit')); $limit = (($ulimit) ? $ulimit : $limit); $x = q("select sum(filesize) as total from attach where aid = %d", diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php index 897f24edd..d40fee0ea 100644 --- a/Zotlabs/Storage/File.php +++ b/Zotlabs/Storage/File.php @@ -208,13 +208,13 @@ class File extends DAV\Node implements DAV\IFile { return; } - $limit = service_class_fetch($c[0]['channel_id'], 'attach_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch($c[0]['channel_id'], 'attach_upload_limit')); if ($limit !== false) { $x = q("select sum(filesize) as total from attach where aid = %d ", intval($c[0]['channel_account_id']) ); if (($x) && ($x[0]['total'] + $size > $limit)) { - logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit); + logger('service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . userReadableSize($limit)); attach_delete($c[0]['channel_id'], $this->data['hash']); return; } diff --git a/include/account.php b/include/account.php index c64197b49..5998609d4 100644 --- a/include/account.php +++ b/include/account.php @@ -591,6 +591,7 @@ function service_class_allows($uid, $property, $usage = false) { if($limit === false) return true; // No service class set => everything is allowed + $limit = engr_units_to_bytes($limit); if($usage === false) { // We use negative values for not allowed properties in a subscriber plan return ((x($limit)) ? (bool) $limit : true); @@ -627,6 +628,8 @@ function account_service_class_allows($aid, $property, $usage = false) { if($limit === false) return true; // No service class is set => everything is allowed + $limit = engr_units_to_bytes($limit); + if($usage === false) { // We use negative values for not allowed properties in a subscriber plan return ((x($limit)) ? (bool) $limit : true); diff --git a/include/photos.php b/include/photos.php index d088d455a..73a29d8eb 100644 --- a/include/photos.php +++ b/include/photos.php @@ -131,7 +131,7 @@ function photo_upload($channel, $observer, $args) { intval($account_id) ); - $limit = service_class_fetch($channel_id,'photo_upload_limit'); + $limit = engr_units_to_bytes(service_class_fetch($channel_id,'photo_upload_limit')); if (($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) { $ret['message'] = upgrade_message(); diff --git a/include/text.php b/include/text.php index 926e2eed6..f1043909d 100644 --- a/include/text.php +++ b/include/text.php @@ -1825,7 +1825,7 @@ function lang_selector() { } -function return_bytes ($size_str) { +function engr_units_to_bytes ($size_str) { switch (substr ($size_str, -1)) { case 'M': case 'm': return (int)$size_str * 1048576; case 'K': case 'k': return (int)$size_str * 1024;