aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Extend/Hook.php21
-rw-r--r--Zotlabs/Module/Admin.php2
-rw-r--r--Zotlabs/Module/Cal.php2
-rw-r--r--Zotlabs/Module/Editpost.php114
-rw-r--r--Zotlabs/Module/Item.php4
-rw-r--r--Zotlabs/Module/Photos.php4
-rw-r--r--Zotlabs/Storage/Browser.php2
-rw-r--r--Zotlabs/Storage/Directory.php6
-rw-r--r--Zotlabs/Storage/File.php4
9 files changed, 60 insertions, 99 deletions
diff --git a/Zotlabs/Extend/Hook.php b/Zotlabs/Extend/Hook.php
index edfacfa3b..713165faf 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.
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/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php
index 89967bca1..958ce5aa6 100644
--- a/Zotlabs/Module/Cal.php
+++ b/Zotlabs/Module/Cal.php
@@ -38,7 +38,7 @@ class Cal extends \Zotlabs\Web\Controller {
head_set_icon(\App::$data['channel']['xchan_photo_s']);
- \App::$page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
+ \App::$page['htmlhead'] .= "<script> var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
}
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index d8b971f6c..1c2c2a30b 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -5,7 +5,7 @@ require_once('include/acl_selectors.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/taxonomy.php');
-
+require_once('include/conversation.php');
class Editpost extends \Zotlabs\Web\Controller {
@@ -49,20 +49,7 @@ class Editpost extends \Zotlabs\Web\Controller {
// $plaintext = false;
$channel = \App::get_channel();
-
- \App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
- '$baseurl' => z_root(),
- '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
- '$pretext' => '',
- '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
- '$geotag' => $geotag,
- '$nickname' => $channel['channel_address'],
- '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
- '$confirmdelete' => t('Delete item?'),
- '$editor_autocomplete'=> true,
- '$bbco_autocomplete'=> 'bbcode'
- ));
-
+
if(intval($itm[0]['item_obscured'])) {
$key = get_config('system','prvkey');
if($itm[0]['title'])
@@ -71,18 +58,6 @@ class Editpost extends \Zotlabs\Web\Controller {
$itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']),$key);
}
- $tpl = get_markup_template("jot.tpl");
-
- $jotplugins = '';
- $jotnets = '';
-
- call_hooks('jot_tool', $jotplugins);
- call_hooks('jot_networks', $jotnets);
-
- //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-
- $voting = feature_enabled($owner_uid,'consensus_tools');
-
$category = '';
$catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
@@ -106,66 +81,31 @@ class Editpost extends \Zotlabs\Web\Controller {
}
}
}
-
- $cipher = get_pconfig(\App::$profile['profile_uid'],'system','default_cipher');
- if(! $cipher)
- $cipher = 'aes256';
-
-
- $editor = replace_macros($tpl,array(
- '$return_path' => $_SESSION['return_url'],
- '$action' => 'item',
- '$share' => t('Edit'),
- '$bold' => t('Bold'),
- '$italic' => t('Italic'),
- '$underline' => t('Underline'),
- '$quote' => t('Quote'),
- '$code' => t('Code'),
- '$upload' => t('Upload photo'),
- '$attach' => t('Attach file'),
- '$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
- '$setloc' => t('Set your location'),
- '$noloc' => t('Clear browser location'),
- '$voting' => t('Toggle voting'),
- '$feature_voting' => $voting,
- '$consensus' => intval($itm[0]['item_consensus']),
- '$wait' => t('Please wait'),
- '$permset' => t('Permission settings'),
- '$ptyp' => $itm[0]['obj_type'],
- '$content' => undo_post_tagging($itm[0]['body']),
- '$post_id' => $post_id,
- '$parent' => (($itm[0]['parent'] != $itm[0]['id']) ? $itm[0]['parent'] : ''),
- '$baseurl' => z_root(),
- '$defloc' => $channel['channel_location'],
- '$visitor' => false,
- '$public' => t('Public post'),
- '$jotnets' => $jotnets,
- '$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
- '$placeholdertitle' => t('Title (optional)'),
- '$category' => $category,
- '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
- '$emtitle' => t('Example: bob@example.com, mary@example.com'),
- '$lockstate' => $lockstate,
- '$acl' => '',
- '$bang' => '',
- '$profile_uid' => $owner_uid,
- '$preview' => t('Preview'),
- '$jotplugins' => $jotplugins,
- '$sourceapp' => t(\App::$sourcename),
- '$catsenabled' => $catsenabled,
- '$defexpire' => datetime_convert('UTC', date_default_timezone_get(),$itm[0]['expires']),
- '$feature_expire' => ((feature_enabled(\App::$profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false),
- '$expires' => t('Set expiration date'),
- '$feature_encrypt' => ((feature_enabled(\App::$profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false),
- '$encrypt' => t('Encrypt text'),
- '$cipher' => $cipher,
- '$expiryModalOK' => t('OK'),
- '$expiryModalCANCEL' => t('Cancel'),
- '$bbcode' => true
- ));
+
+ $x = array(
+ 'nickname' => $channel['channel_address'],
+ 'editor_autocomplete'=> true,
+ 'bbco_autocomplete'=> 'bbcode',
+ 'return_path' => $_SESSION['return_url'],
+ 'button' => t('Edit'),
+ 'hide_voting' => true,
+ 'hide_future' => true,
+ 'hide_location' => true,
+ 'ptyp' => $itm[0]['obj_type'],
+ 'body' => undo_post_tagging($itm[0]['body']),
+ 'post_id' => $post_id,
+ 'defloc' => $channel['channel_location'],
+ 'visitor' => true,
+ 'title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
+ 'category' => $category,
+ 'showacl' => false,
+ 'profile_uid' => $owner_uid,
+ 'catsenabled' => $catsenabled,
+ 'hide_expire' => true,
+ 'bbcode' => true
+ );
+
+ $editor = status_editor($a, $x);
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
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..2b7f5525f 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -42,7 +42,7 @@ class Photos extends \Zotlabs\Web\Controller {
head_set_icon(\App::$data['channel']['xchan_photo_s']);
- \App::$page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "'; var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
+ \App::$page['htmlhead'] .= "<script> var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
}
@@ -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;
}