Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
zottel 2016-04-29 08:37:51 +02:00
commit 0788d37c60
21 changed files with 123 additions and 24 deletions

View File

@ -20,6 +20,15 @@ class Hook {
if($r) if($r)
return true; 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 )", $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`, `hook_version`) VALUES ( '%s', '%s', '%s', %d, %d )",
dbesc($hook), dbesc($hook),
dbesc($file), dbesc($file),
@ -46,6 +55,18 @@ class Hook {
return $r; 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. * @brief Inserts a hook into a page request.

View File

@ -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_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_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') '$submit' => t('Submit')
)); ));
} }

View File

@ -1243,14 +1243,14 @@ class Item extends \Zotlabs\Web\Controller {
} }
if (!$iswebpage) { 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'])) { 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); $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$max);
return $result; return $result;
} }
} }
else { 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'])) { 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); $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$max);
return $result; return $result;

View File

@ -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) { if($limit !== false) {
$usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 ); $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 );
} }

View File

@ -273,7 +273,7 @@ class Browser extends DAV\Browser\Plugin {
return; return;
// Storage and quota for the account (all channels of the owner of this directory)! // 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", $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d",
intval($this->auth->channel_account_id) intval($this->auth->channel_account_id)
); );

View File

@ -315,13 +315,13 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
} }
// check against service class quota // 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) { if ($limit !== false) {
$x = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d ", $x = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d ",
intval($c[0]['channel_account_id']) intval($c[0]['channel_account_id'])
); );
if (($x) && ($x[0]['total'] + $size > $limit)) { 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); attach_delete($c[0]['channel_id'], $hash);
return; return;
} }
@ -549,7 +549,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
intval($this->auth->owner_id) 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); $limit = (($ulimit) ? $ulimit : $limit);
$x = q("select sum(filesize) as total from attach where aid = %d", $x = q("select sum(filesize) as total from attach where aid = %d",

View File

@ -208,13 +208,13 @@ class File extends DAV\Node implements DAV\IFile {
return; 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) { if ($limit !== false) {
$x = q("select sum(filesize) as total from attach where aid = %d ", $x = q("select sum(filesize) as total from attach where aid = %d ",
intval($c[0]['channel_account_id']) intval($c[0]['channel_account_id'])
); );
if (($x) && ($x[0]['total'] + $size > $limit)) { 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']); attach_delete($c[0]['channel_id'], $this->data['hash']);
return; return;
} }

View File

@ -0,0 +1,8 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>This page allows you to adjust log settings and to view and existing log.</dd>
<dt>Log Settings</dt>
<dd>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.</dd>
<dt>Log Level</dt>
<dd>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.</dd>
</dl>

View File

@ -0,0 +1,4 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>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.</dd>
</dl>

View File

@ -1,3 +1,4 @@
<h3>Security Settings</h3> <dl class="dl-horizontal">
<p>This page contains various administrator settings related to security.</p> <dt>General</dt>
<p>To save any changes you make to these settings, you must press the Submit button.</p> <dd>This page contains various administrator settings related to security. To save any changes you make to these settings, you must press the Submit button.</dd>
</dl>

View File

@ -0,0 +1,8 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>Create and use chat rooms to communicate in real-time, using the standard Hubzilla permissions system for chat room access control.</dd>
<dt>Create new chat room</dt>
<dd>Use the "Create New" button to create a new chat room. Enter a name and how long messages should be retained.</dd>
<dt>Chatting</dt>
<dd>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.</dd>
</dl>

View File

@ -0,0 +1,8 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>This page displays a list of all this channel's connections. The list can be <a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Click to highlight element...">sorted and filtered using the menu button beside the search button</a>. </dd>
<dt>Connection Details</dt>
<dd>Each list entry shows the details of a specific connection. A translucent avatar image indicates an archived connection.</dd>
<dt>Connection Status</dt>
<dd>A connection can be in different states: <ul><li>Archived</li><li>Ignored</li><li>Blocked</li><li>Hidden</li></ul></dd>
</dl>

View File

@ -0,0 +1,8 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>This page displays a list of all this channel's connections. The list can be <a href='#' onclick='contextualHelpFocus(".section-title-wrapper", 0); return false;' title="Click to highlight element...">sorted and filtered using the menu button beside the search button</a>. </dd>
<dt>Connection Details</dt>
<dd>Each list entry shows the details of a specific connection. A translucent avatar image indicates an archived connection.</dd>
<dt>Connection Status</dt>
<dd>A connection can be in different states: <ul><li>Archived</li><li>Ignored</li><li>Blocked</li><li>Hidden</li></ul></dd>
</dl>

View File

@ -0,0 +1,8 @@
<dl class="dl-horizontal">
<dt>General</dt>
<dd>This page displays a calendar of events both owned by you and shared with you from other channels.</dd>
<dt><a href='#' onclick='contextualHelpFocus("#title", 0); return false;' title="Click to highlight element...">Calendar View</a></dt>
<dd>The calendar can be displayed in month, week, or day mode using the options in the side panel.</dd>
<dt>Export/Import</dt>
<dd>Export or import calendar events using standard iCalendar format (.ics) files.</dd>
</dl>

View File

@ -591,6 +591,7 @@ function service_class_allows($uid, $property, $usage = false) {
if($limit === false) if($limit === false)
return true; // No service class set => everything is allowed return true; // No service class set => everything is allowed
$limit = engr_units_to_bytes($limit);
if($usage === false) { if($usage === false) {
// We use negative values for not allowed properties in a subscriber plan // We use negative values for not allowed properties in a subscriber plan
return ((x($limit)) ? (bool) $limit : true); return ((x($limit)) ? (bool) $limit : true);
@ -627,6 +628,8 @@ function account_service_class_allows($aid, $property, $usage = false) {
if($limit === false) if($limit === false)
return true; // No service class is set => everything is allowed return true; // No service class is set => everything is allowed
$limit = engr_units_to_bytes($limit);
if($usage === false) { if($usage === false) {
// We use negative values for not allowed properties in a subscriber plan // We use negative values for not allowed properties in a subscriber plan
return ((x($limit)) ? (bool) $limit : true); return ((x($limit)) ? (bool) $limit : true);

View File

@ -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));
}
}

View File

@ -131,7 +131,7 @@ function photo_upload($channel, $observer, $args) {
intval($account_id) 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)) { if (($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
$ret['message'] = upgrade_message(); $ret['message'] = upgrade_message();
@ -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]'; $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); $activity_format = sprintf(t('%1$s posted %2$s to %3$s','photo_upload'), $author_link, $photo_link, $album_link);

View File

@ -1825,7 +1825,7 @@ function lang_selector() {
} }
function return_bytes ($size_str) { function engr_units_to_bytes ($size_str) {
switch (substr ($size_str, -1)) { switch (substr ($size_str, -1)) {
case 'M': case 'm': return (int)$size_str * 1048576; case 'M': case 'm': return (int)$size_str * 1048576;
case 'K': case 'k': return (int)$size_str * 1024; case 'K': case 'k': return (int)$size_str * 1024;

View File

@ -210,6 +210,7 @@ header #banner #logo-text {
display: block; display: block;
position: fixed; position: fixed;
top: 51px; top: 51px;
width: 100%;
max-height: 50%; max-height: 50%;
background: $comment_item_colour; background: $comment_item_colour;
padding: 20px; padding: 20px;
@ -223,6 +224,24 @@ header #banner #logo-text {
.contextual-help-content dd { .contextual-help-content dd {
margin-bottom: 1em; 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 */ /* contextual help end */
/* footer */ /* footer */

View File

@ -15,9 +15,6 @@
{{include file="field_textarea.tpl" field=$whitelisted_channels}} {{include file="field_textarea.tpl" field=$whitelisted_channels}}
{{include file="field_textarea.tpl" field=$blacklisted_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_allow}}
{{include file="field_textarea.tpl" field=$embed_deny}} {{include file="field_textarea.tpl" field=$embed_deny}}

View File

@ -36,10 +36,6 @@
<li role="presentation" class="divider"></li> <li role="presentation" class="divider"></li>
<li role="presentation"><a href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" role="menuitem" id="{{$nav.admin.4}}">{{$nav.admin.1}}</a></li> <li role="presentation"><a href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" role="menuitem" id="{{$nav.admin.4}}">{{$nav.admin.1}}</a></li>
{{/if}} {{/if}}
{{if $nav.help.6}}
<li role="presentation" class="divider"></li>
<li role="presentation"><a href="{{$nav.help.0}}" title="{{$nav.help.3}}" role="menuitem" id="{{$nav.help.4}}">{{$nav.help.1}}</a></li>
{{/if}}
{{if $nav.logout}} {{if $nav.logout}}
<li role="presentation" class="divider"></li> <li role="presentation" class="divider"></li>
<li role="presentation"><a href="{{$nav.logout.0}}" title="{{$nav.logout.3}}" role="menuitem" id="{{$nav.logout.4}}">{{$nav.logout.1}}</a></li> <li role="presentation"><a href="{{$nav.logout.0}}" title="{{$nav.logout.3}}" role="menuitem" id="{{$nav.logout.4}}">{{$nav.logout.1}}</a></li>
@ -207,6 +203,9 @@
{{if $nav.help.6}} {{if $nav.help.6}}
<div id="contextual-help-content" class="contextual-help-content"> <div id="contextual-help-content" class="contextual-help-content">
{{$nav.help.5}} {{$nav.help.5}}
<button type="button" class="close" onclick="contextualHelp();">×</button> <div class="pull-right">
<a class="contextual-help-tool" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}"><i class="icon-question"></i></a>
<a class="contextual-help-tool" href="#" onclick="contextualHelp(); return false;"><i class="icon-remove"></i></a>
</div>
</div> </div>
{{/if}} {{/if}}