aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php6
-rw-r--r--include/ItemObject.php2
-rw-r--r--include/account.php22
-rw-r--r--include/acl_selectors.php26
-rw-r--r--include/api.php10
-rw-r--r--include/comanche.php4
-rw-r--r--include/config.php19
-rw-r--r--include/contact_selectors.php2
-rw-r--r--include/conversation.php22
-rw-r--r--include/deliver.php3
-rw-r--r--include/enotify.php9
-rw-r--r--include/event.php2
-rw-r--r--include/features.php107
-rw-r--r--include/follow.php7
-rw-r--r--include/group.php10
-rw-r--r--include/identity.php142
-rw-r--r--include/import.php9
-rwxr-xr-xinclude/items.php47
-rw-r--r--include/language.php2
-rw-r--r--include/message.php9
-rw-r--r--include/network.php76
-rw-r--r--include/notifier.php28
-rwxr-xr-xinclude/oembed.php32
-rw-r--r--include/permissions.php4
-rw-r--r--include/photo/photo_driver.php3
-rw-r--r--include/photo/photo_gd.php17
-rw-r--r--include/photo/photo_imagick.php18
-rwxr-xr-xinclude/plugin.php47
-rw-r--r--include/poller.php2
-rw-r--r--include/queue_fn.php28
-rw-r--r--include/security.php25
-rw-r--r--include/taxonomy.php7
-rw-r--r--include/text.php32
-rw-r--r--include/widgets.php144
-rw-r--r--include/zot.php74
35 files changed, 722 insertions, 275 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 3bd5f9936..611371db6 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -331,6 +331,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc(datetime_convert()),
intval($channel_id)
);
+
// if this was the default channel, set another one as default
if($a->account['account_default_channel'] == $channel_id) {
$r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1",
@@ -344,12 +345,11 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
}
else {
$rr = q("update account set account_default_channel = 0 where account_id = %d",
- intval($r[0]['channel_id']),
- intval($a->account['account_id']));
+ intval($a->account['account_id'])
+ );
}
}
-
logger('deleting hublocs',LOGGER_DEBUG);
$r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 8be99d91e..1b7b2ce78 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -264,7 +264,7 @@ class Item extends BaseObject {
if($keep_reports === 0)
$keep_reports = 30;
- if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0)
+ if((! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0)
$dreport = t('Delivery Report');
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
diff --git a/include/account.php b/include/account.php
index e448bdcc6..dae0f4895 100644
--- a/include/account.php
+++ b/include/account.php
@@ -11,6 +11,7 @@ require_once('include/text.php');
require_once('include/language.php');
require_once('include/datetime.php');
require_once('include/crypto.php');
+require_once('include/identity.php');
function check_account_email($email) {
@@ -329,7 +330,7 @@ function send_reg_approval_email($arr) {
return($delivered ? true : false);
}
-function send_verification_email($email,$password) {
+function send_register_success_email($email,$password) {
$email_msg = replace_macros(get_intltext_template('register_open_eml.tpl'), array(
'$sitename' => get_config('system','sitename'),
@@ -353,7 +354,7 @@ function send_verification_email($email,$password) {
* @param string $hash
* @return array|boolean
*/
-function user_allow($hash) {
+function account_allow($hash) {
$ret = array('success' => false);
@@ -406,6 +407,9 @@ function user_allow($hash) {
pop_lang();
+ if(get_config('system','auto_channel_create'))
+ auto_channel_create($register[0]['uid']);
+
if ($res) {
info( t('Account approved.') . EOL );
return true;
@@ -414,7 +418,7 @@ function user_allow($hash) {
/**
- * @brief Denies a user registration.
+ * @brief Denies an account registration.
*
* This does not have to go through user_remove() and save the nickname
* permanently against re-registration, as the person was not yet
@@ -423,7 +427,8 @@ function user_allow($hash) {
* @param string $hash
* @return boolean
*/
-function user_deny($hash) {
+
+function account_deny($hash) {
$register = q("SELECT * FROM register WHERE hash = '%s' LIMIT 1",
dbesc($hash)
@@ -452,11 +457,14 @@ function user_deny($hash) {
}
+// called from regver to activate an account from the email verification link
-function user_approve($hash) {
+function account_approve($hash) {
$ret = array('success' => false);
+ // Note: when the password in the register table is 'verify', the uid actually contains the account_id
+
$register = q("SELECT * FROM `register` WHERE `hash` = '%s' and password = 'verify' LIMIT 1",
dbesc($hash)
);
@@ -491,6 +499,10 @@ function user_approve($hash) {
intval($register[0]['uid'])
);
+
+ if(get_config('system','auto_channel_create'))
+ auto_channel_create($register[0]['uid']);
+
info( t('Account verified. Please login.') . EOL );
return true;
diff --git a/include/acl_selectors.php b/include/acl_selectors.php
index 4d44ec12e..3c8f34321 100644
--- a/include/acl_selectors.php
+++ b/include/acl_selectors.php
@@ -210,10 +210,13 @@ function fixacl(&$item) {
$item = str_replace(array('<','>'),array('',''),$item);
}
-function populate_acl($defaults = null,$show_jotnets = true) {
+function populate_acl($defaults = null,$show_jotnets = true, $showall = '') {
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
+ if(! $showall)
+ $showall = t('Visible to your default audience');
+
if(is_array($defaults)) {
$allow_cid = ((strlen($defaults['allow_cid']))
? explode('><', $defaults['allow_cid']) : array() );
@@ -231,22 +234,21 @@ function populate_acl($defaults = null,$show_jotnets = true) {
$jotnets = '';
if($show_jotnets) {
-logger('jot_networks');
call_hooks('jot_networks', $jotnets);
}
$tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array(
- '$showall'=> t("Visible to your default audience"),
- '$show' => t("Show"),
- '$hide' => t("Don't show"),
- '$allowcid' => json_encode($allow_cid),
- '$allowgid' => json_encode($allow_gid),
- '$denycid' => json_encode($deny_cid),
- '$denygid' => json_encode($deny_gid),
- '$jnetModalTitle' => t('Other networks and post services'),
- '$jotnets' => $jotnets,
- '$aclModalTitle' => t('Permissions'),
+ '$showall' => $showall,
+ '$show' => t("Show"),
+ '$hide' => t("Don't show"),
+ '$allowcid' => json_encode($allow_cid),
+ '$allowgid' => json_encode($allow_gid),
+ '$denycid' => json_encode($deny_cid),
+ '$denygid' => json_encode($deny_gid),
+ '$jnetModalTitle' => t('Other networks and post services'),
+ '$jotnets' => $jotnets,
+ '$aclModalTitle' => t('Permissions'),
'$aclModalDismiss' => t('Close')
));
diff --git a/include/api.php b/include/api.php
index 5053977c5..ef41a4912 100644
--- a/include/api.php
+++ b/include/api.php
@@ -2106,10 +2106,10 @@ require_once('include/api_auth.php');
'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
'shorturllength' => '30',
'hubzilla' => array(
- 'PLATFORM_NAME' => PLATFORM_NAME,
- 'RED_VERSION' => RED_VERSION,
+ 'PLATFORM_NAME' => get_platform_name(),
+ 'RED_VERSION' => get_project_version(),
'ZOT_REVISION' => ZOT_REVISION,
- 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION
+ 'DB_UPDATE_VERSION' => get_update_version()
)
));
@@ -2142,12 +2142,12 @@ require_once('include/api_auth.php');
if($type === 'xml') {
header("Content-type: application/xml");
- echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . RED_VERSION . '</version>' . "\r\n";
+ echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . get_project_version() . '</version>' . "\r\n";
killme();
}
elseif($type === 'json') {
header("Content-type: application/json");
- echo '"' . RED_VERSION . '"';
+ echo '"' . get_project_version() . '"';
killme();
}
}
diff --git a/include/comanche.php b/include/comanche.php
index 1537226ca..ddf331321 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -275,6 +275,7 @@ function comanche_widget($name, $text) {
$vars = array();
$matches = array();
+
$cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $text, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
@@ -287,8 +288,7 @@ function comanche_widget($name, $text) {
if(! function_exists($func)) {
if(file_exists('widget/' . trim($name) . '.php'))
require_once('widget/' . trim($name) . '.php');
- elseif(folder_exists('widget/'. trim($name))
- && (file_exists('widget/' . trim($name) . '/' . trim($name) . '.php')))
+ elseif(file_exists('widget/' . trim($name) . '/' . trim($name) . '.php'))
require_once('widget/' . trim($name) . '/' . trim($name) . '.php');
}
else {
diff --git a/include/config.php b/include/config.php
index c94d25eb8..f65e4a470 100644
--- a/include/config.php
+++ b/include/config.php
@@ -531,3 +531,22 @@ function del_xconfig($xchan, $family, $key) {
);
return $ret;
}
+
+
+// account configuration storage is built on top of the under-utilised xconfig
+
+function load_aconfig($account_id) {
+ load_xconfig('a_' . $account_id);
+}
+
+function get_aconfig($account_id, $family, $key) {
+ return get_xconfig('a_' . $account_id, $family, $key);
+}
+
+function set_aconfig($account_id, $family, $key, $value) {
+ return set_xconfig('a_' . $account_id, $family, $key, $value);
+}
+
+function del_aconfig($account_id, $family, $key) {
+ return del_xconfig('a_' . $account_id, $family, $key);
+} \ No newline at end of file
diff --git a/include/contact_selectors.php b/include/contact_selectors.php
index 8671f1bd1..d44bee784 100644
--- a/include/contact_selectors.php
+++ b/include/contact_selectors.php
@@ -79,7 +79,7 @@ function network_to_name($s) {
NETWORK_MAIL => t('Email'),
NETWORK_DIASPORA => t('Diaspora'),
NETWORK_FACEBOOK => t('Facebook'),
- NETWORK_ZOT => t('Zot!'),
+ NETWORK_ZOT => t('Zot'),
NETWORK_LINKEDIN => t('LinkedIn'),
NETWORK_XMPP => t('XMPP/IM'),
NETWORK_MYSPACE => t('MySpace'),
diff --git a/include/conversation.php b/include/conversation.php
index 747bb5d0a..1ade8ed3a 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -942,25 +942,35 @@ function item_photo_menu($item){
$clean_url = normalise_link($item['author-link']);
}
- $menu = Array(
+ $poco_rating = get_config('system','poco_rating_enable');
+ // if unset default to enabled
+ if($poco_rating === false)
+ $poco_rating = true;
+
+ $ratings_url = (($poco_rating) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
+
+ $post_menu = Array(
t("View Source") => $vsrc_link,
t("Follow Thread") => $sub_link,
t("Unfollow Thread") => $unsub_link,
- t("View Status") => $status_link,
+ );
+
+ $author_menu = array(
t("View Profile") => $profile_link,
- t("View Photos") => $photos_link,
t("Activity/Posts") => $posts_link,
t("Connect") => $follow_url,
t("Edit Connection") => $contact_url,
- t("Send PM") => $pm_url,
+ t("Message") => $pm_url,
+ t('Ratings') => $ratings_url,
t("Poke") => $poke_link
);
- $args = array('item' => $item, 'menu' => $menu);
+
+ $args = array('item' => $item, 'post_menu' => $post_menu, 'author_menu' => $author_menu);
call_hooks('item_photo_menu', $args);
- $menu = $args['menu'];
+ $menu = array_merge($args['post_menu'],$args['author_menu']);
$o = "";
foreach($menu as $k=>$v){
diff --git a/include/deliver.php b/include/deliver.php
index 7ff0fa125..40df543d5 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -31,6 +31,7 @@ function deliver_run($argv, $argc) {
if(($r[0]['outq_posturl'] === z_root() . '/post') && ($r[0]['outq_msg'])) {
logger('deliver: local delivery', LOGGER_DEBUG);
+
// local delivery
// we should probably batch these and save a few delivery processes
@@ -72,7 +73,7 @@ function deliver_run($argv, $argc) {
}
}
- // otherwise it's a remote delivery - call queue_deliver();
+ // otherwise it's a remote delivery - call queue_deliver() with the $immediate flag
queue_deliver($r[0],true);
diff --git a/include/enotify.php b/include/enotify.php
index c9b6e0463..c4c49c8ff 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -273,14 +273,14 @@ function notification($params) {
$preamble = sprintf( t('%1$s, you\'ve received an new connection request from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]a new connection request[/zrl] from %3$s.'),
$recip['channel_name'],
- $itemlink,
+ $siteurl . '/connections/ifpending',
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
$body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']);
$sitelink = t('Please visit %s to approve or reject the connection request.');
- $tsitelink = sprintf( $sitelink, $siteurl );
- $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
- $itemlink = $params['link'];
+ $tsitelink = sprintf( $sitelink, $siteurl . '/connections/ifpending');
+ $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/connections/ifpending">' . $sitename . '</a>');
+ $itemlink = $params['link'];
}
if ($params['type'] == NOTIFY_SUGGEST) {
@@ -529,6 +529,7 @@ function notification($params) {
$tpl = get_markup_template('email_notify_html.tpl');
$email_html_body = replace_macros($tpl,array(
'$banner' => $datarray['banner'],
+ '$notify_icon' => get_notify_icon(),
'$product' => $datarray['product'],
'$preamble' => $datarray['preamble'],
'$sitename' => $datarray['sitename'],
diff --git a/include/event.php b/include/event.php
index 539bfe484..51988acac 100644
--- a/include/event.php
+++ b/include/event.php
@@ -67,7 +67,7 @@ function ical_wrapper($ev) {
$o .= "BEGIN:VCALENDAR";
$o .= "\r\nVERSION:2.0";
$o .= "\r\nMETHOD:PUBLISH";
- $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\r\n";
+ $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n";
if(array_key_exists('start', $ev))
$o .= format_event_ical($ev);
else {
diff --git a/include/features.php b/include/features.php
index 4e962b00e..4d8d162fa 100644
--- a/include/features.php
+++ b/include/features.php
@@ -5,12 +5,19 @@
*/
+
+
+
function feature_enabled($uid,$feature) {
- $x = get_pconfig($uid,'feature',$feature);
+
+ $x = get_config('feature_lock',$feature);
if($x === false) {
- $x = get_config('feature',$feature);
- if($x === false)
- $x = get_feature_default($feature);
+ $x = get_pconfig($uid,'feature',$feature);
+ if($x === false) {
+ $x = get_config('feature',$feature);
+ if($x === false)
+ $x = get_feature_default($feature);
+ }
}
$arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
call_hooks('feature_enabled',$arr);
@@ -29,66 +36,88 @@ function get_feature_default($feature) {
}
-function get_features() {
+function get_features($filtered = true) {
$arr = array(
// General
'general' => array(
t('General Features'),
-// This is per post, and different from fixed expiration 'expire' which isn't working yet
- array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time'), false),
- array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false),
- array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false),
- array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false),
- array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false),
- array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders'),false),
- array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false),
- array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false),
-
- array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false),
- array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false),
+ // This is per post, and different from fixed expiration 'expire' which isn't working yet
+ array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time'), false, get_config('feature_lock','content_expire')),
+ array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false, get_config('feature_lock','multi_profiles')),
+ array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')),
+ array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')),
+ array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')),
+ array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')),
+ array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
+ array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
+ array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
+
+ array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
+ array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),
),
// Post composition
'composition' => array(
t('Post Composition Features'),
-// array('richtext', t('Richtext Editor'), t('Enable richtext editor'),false),
- array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false),
- array('large_photos', t('Large Photos'), t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),false),
- array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false),
- array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false),
- array('consensus_tools', t('Enable Voting Tools'), t('Provide a class of post which others can vote on'),false),
- array('delayed_posting', t('Delayed Posting'), t('Allow posts to be published at a later date'),false),
- array('suppress_duplicates', t('Suppress Duplicate Posts/Comments'), t('Prevent posts with identical content to be published with less than two minutes in between submissions.'),true),
+// array('richtext', t('Richtext Editor'), t('Enable richtext editor'),falseget_config('feature_lock','richtext')),
+ array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts'),false,get_config('feature_lock','markdown')),
+ array('large_photos', t('Large Photos'), t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),false,get_config('feature_lock','large_photos')),
+ array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds'),false,get_config('feature_lock','channel_sources')),
+ array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'),false,get_config('feature_lock','content_encrypt')),
+ array('consensus_tools', t('Enable Voting Tools'), t('Provide a class of post which others can vote on'),false,get_config('feature_lock','consensus_tools')),
+ array('delayed_posting', t('Delayed Posting'), t('Allow posts to be published at a later date'),false,get_config('feature_lock','delayed_posting')),
+ array('suppress_duplicates', t('Suppress Duplicate Posts/Comments'), t('Prevent posts with identical content to be published with less than two minutes in between submissions.'),true,get_config('feature_lock','suppress_duplicates')),
),
// Network Tools
'net_module' => array(
t('Network and Stream Filtering'),
- array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false),
- array('groups', t('Collections Filter'), t('Enable widget to display Network posts only from selected collections'),false),
- array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'),false),
- array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'),false),
- array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity'),false),
- array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships'),false),
- array('connfilter', t('Connection Filtering'), t('Filter incoming posts from connections based on keywords/content')),
- array('suggest', t('Suggest Channels'), t('Show channel suggestions'),false),
+ array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false,get_config('feature_lock','archives')),
+ array('groups', t('Privacy Groups'), t('Enable management and selection of privacy groups'),true,get_config('feature_lock','groups')),
+ array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'),false,get_config('feature_lock','savedsearch')),
+ array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'),false,get_config('feature_lock','personal_tab')),
+ array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity'),false,get_config('feature_lock','new_tab')),
+ array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships'),false,get_config('feature_lock','affinity')),
+ array('connfilter', t('Connection Filtering'), t('Filter incoming posts from connections based on keywords/content'),false,get_config('feature_lock','connfilter')),
+ array('suggest', t('Suggest Channels'), t('Show channel suggestions'),false,get_config('feature_lock','suggest')),
),
// Item tools
'tools' => array(
t('Post/Comment Tools'),
- array('commtag', t('Tagging'), t('Ability to tag existing posts'),false),
- array('categories', t('Post Categories'), t('Add categories to your posts'),false),
- array('filing', t('Saved Folders'), t('Ability to file posts under folders'),false),
- array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'),false),
- array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'),false),
- array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page'),false),
+ array('commtag', t('Community Tagging'), t('Ability to tag existing posts'),false,get_config('feature_lock','commtag')),
+ array('categories', t('Post Categories'), t('Add categories to your posts'),false,get_config('feature_lock','categories')),
+ array('filing', t('Saved Folders'), t('Ability to file posts under folders'),false,get_config('feature_lock','filing')),
+ array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'),false,get_config('feature_lock','dislike')),
+ array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'),false,get_config('feature_lock','star_posts')),
+ array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page'),false,get_config('feature_lock','tagedelic')),
),
);
+ // removed any locked features and remove the entire category if this makes it empty
+
+ if($filtered) {
+ foreach($arr as $k => $x) {
+ $has_items = false;
+ for($y = 0; $y < count($arr[$k]); $y ++) {
+ if(is_array($arr[$k][$y])) {
+ if($arr[$k][$y][4] === false) {
+ $has_items = true;
+ }
+ else {
+ unset($arr[$k][$y]);
+ }
+ }
+ }
+ if(! $has_items) {
+ unset($arr[$k]);
+ }
+ }
+ }
+
call_hooks('get_features',$arr);
return $arr;
}
diff --git a/include/follow.php b/include/follow.php
index 97be82da7..5e1146657 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -122,6 +122,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
else
$permissions = $j['permissions'];
+
foreach($permissions as $k => $v) {
if($v) {
$their_perms = $their_perms | intval($global_perms[$k][1]);
@@ -167,6 +168,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
}
}
+
if(! $xchan_hash) {
$result['message'] = t('Channel discovery failed.');
logger('follow: ' . $result['message']);
@@ -202,6 +204,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$default_group = $r[0]['channel_default_group'];
}
+
if($is_http) {
@@ -226,6 +229,8 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
dbesc($xchan_hash),
intval($uid)
);
+
+
if($r) {
$abook_instance = $r[0]['abook_instance'];
@@ -242,7 +247,6 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
);
}
else {
-
$closeness = get_pconfig($uid,'system','new_abook_closeness');
if($closeness === false)
$closeness = 80;
@@ -270,6 +274,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
dbesc($xchan_hash),
intval($uid)
);
+
if($r) {
$result['abook'] = $r[0];
proc_run('php', 'include/notifier.php', 'permission_create', $result['abook']['abook_id']);
diff --git a/include/group.php b/include/group.php
index 0875b10f9..bef008afd 100644
--- a/include/group.php
+++ b/include/group.php
@@ -229,7 +229,7 @@ function mini_group_select($uid,$group = '') {
logger('mini_group_select: ' . print_r($grps,true), LOGGER_DATA);
$o = replace_macros(get_markup_template('group_selection.tpl'), array(
- '$label' => t('Add new connections to this collection (privacy group)'),
+ '$label' => t('Add new connections to this privacy group'),
'$groups' => $grps
));
return $o;
@@ -292,10 +292,10 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
$tpl = get_markup_template("group_side.tpl");
$o = replace_macros($tpl, array(
- '$title' => t('Collections'),
- '$edittext' => t('Edit collection'),
- '$createtext' => t('Add new collection'),
- '$ungrouped' => (($every === 'contacts') ? t('Channels not in any collection') : ''),
+ '$title' => t('Privacy Groups'),
+ '$edittext' => t('Edit group'),
+ '$createtext' => t('Add privacy group'),
+ '$ungrouped' => (($every === 'contacts') ? t('Channels not in any privacy group') : ''),
'$groups' => $groups,
'$add' => t('add'),
));
diff --git a/include/identity.php b/include/identity.php
index 98ba26bd8..037cf5061 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -178,7 +178,7 @@ function create_identity($arr) {
$ret = array('success' => false);
if(! $arr['account_id']) {
- $ret['message'] = t('No account identifier');
+ $ret['message'] = t('No account identifier');
return $ret;
}
$ret = identity_check_service_class($arr['account_id']);
@@ -352,7 +352,7 @@ function create_identity($arr) {
);
if($role_permissions) {
- $myperms = ((array_key_exists('perms_auto',$role_permissions) && $role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0);
+ $myperms = ((array_key_exists('perms_accept',$role_permissions)) ? intval($role_permissions['perms_accept']) : 0);
}
else
$myperms = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK
@@ -482,6 +482,8 @@ function identity_basic_export($channel_id, $items = false) {
$ret = array();
+ // use constants here as otherwise we will have no idea if we can import from a site
+ // with a non-standard platform and version.
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION);
$r = q("select * from channel where channel_id = %d limit 1",
@@ -922,6 +924,13 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$pdesc = true;
$reddress = true;
+ if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) {
+ $block = true;
+ }
+
+ if($block && intval(get_config('system','block_public_blackout')))
+ return $o;
+
if((! is_array($profile)) && (! count($profile)))
return $o;
@@ -933,6 +942,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$show_connect = false;
+
$profile['picdate'] = urlencode($profile['picdate']);
call_hooks('profile_sidebar_enter', $profile);
@@ -1006,9 +1016,6 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
// logger('online: ' . $profile['online']);
- if(! perm_is_allowed($profile['uid'],((is_array($observer)) ? $observer['xchan_hash'] : ''),'view_profile')) {
- $block = true;
- }
if(($profile['hidewall'] && (! local_channel()) && (! remote_channel())) || $block ) {
$location = $reddress = $pdesc = $gender = $marital = $homepage = False;
@@ -1049,8 +1056,10 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$tpl = get_markup_template('profile_vcard.tpl');
require_once('include/widgets.php');
- $z = widget_rating(array('target' => $profile['channel_hash']));
+ if(! feature_enabled($profile['uid'],'hide_rating'))
+ $z = widget_rating(array('target' => $profile['channel_hash']));
+
$o .= replace_macros($tpl, array(
'$profile' => $profile,
'$connect' => $connect,
@@ -1258,7 +1267,7 @@ function advanced_profile(&$a) {
$profile['like_button_label'] = tt('Like','Likes',$profile['like_count'],'noun');
if($likers) {
foreach($likers as $l)
- $profile['likers'][] = array('name' => $l['xchan_name'],'url' => zid($l['xchan_url']));
+ $profile['likers'][] = array('name' => $l['xchan_name'],'photo' => zid($l['xchan_photo_s']), 'url' => zid($l['xchan_url']));
}
if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
@@ -1695,3 +1704,122 @@ function profiles_build_sync($channel_id) {
build_sync_packet($channel_id,array('profile' => $r));
}
}
+
+
+function auto_channel_create($account_id) {
+
+ if(! $account_id)
+ return false;
+
+ $arr = array();
+ $arr['account_id'] = $account_id;
+ $arr['name'] = get_aconfig($account_id,'register','channel_name');
+ $arr['nickname'] = legal_webbie(get_aconfig($account_id,'register','channel_address'));
+ $arr['permissions_role'] = get_aconfig($account_id,'register','permissions_role');
+
+ del_aconfig($account_id,'register','channel_name');
+ del_aconfig($account_id,'register','channel_address');
+ del_aconfig($account_id,'register','permissions_role');
+
+ if((! $arr['name']) || (! $arr['nickname'])) {
+ $x = q("select * from account where account_id = %d limit 1",
+ intval($account_id)
+ );
+ if($x) {
+ if(! $arr['name'])
+ $arr['name'] = substr($x[0]['account_email'],0,strpos($x[0]['account_email'],'@'));
+ if(! $arr['nickname'])
+ $arr['nickname'] = legal_webbie(substr($x[0]['account_email'],0,strpos($x[0]['account_email'],'@')));
+ }
+ }
+ if(! $arr['permissions_role'])
+ $arr['permissions_role'] = 'social';
+
+ if(validate_channelname($arr['name']))
+ return false;
+ if($arr['nickname'] === 'sys')
+ $arr['nickname'] = $arr['nickname'] . mt_rand(1000,9999);
+
+ $arr['nickname'] = check_webbie(array($arr['nickname'], $arr['nickname'] . mt_rand(1000,9999)));
+
+ return create_identity($arr);
+
+}
+
+function get_cover_photo($channel_id,$format = 'bbcode', $res = PHOTO_RES_COVER_1200) {
+
+ $r = q("select height, width, resource_id, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ intval($channel_id),
+ intval($res),
+ intval(PHOTO_COVER)
+ );
+ if(! $r)
+ return false;
+
+ $output = false;
+
+ $url = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $res ;
+
+ switch($format) {
+ case 'bbcode':
+ $output = '[zrl=' . $r[0]['width'] . 'x' . $r[0]['height'] . ']' . $url . '[/zrl]';
+ break;
+ case 'html':
+ $output = '<img class="zrl" width="' . $r[0]['width'] . '" height="' . $r[0]['height'] . '" src="' . $url . '" alt="' . t('cover photo') . '" />';
+ break;
+ case 'array':
+ default:
+ $output = array(
+ 'width' => $r[0]['width'],
+ 'height' => $r[0]['type'],
+ 'type' => $r[0]['type'],
+ 'url' => $url
+ );
+ break;
+ }
+
+ return $output;
+
+}
+
+function get_zcard($channel,$observer_hash = '',$args = array()) {
+
+ logger('get_zcard');
+
+ $channel['channel_addr'] = $channel['channel_address'] . '@' . get_app()->get_hostname();
+
+ $r = q("select height, width, resource_id, scale, type from photo where uid = %d and scale = %d and photo_usage = %d",
+ intval($channel['channel_id']),
+ intval(PHOTO_RES_COVER_1200),
+ intval(PHOTO_COVER)
+ );
+
+ if($r) {
+ $cover = $r[0];
+ $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale'];
+ }
+
+ $pphoto = array('type' => $channel['xchan_photo_mimetype'],
+ 'width' => 300 , 'height' => 300, 'href' => $channel['xchan_photo_l']);
+
+ $maxwidth = (($args['width']) ? intval($args['width']) : 0);
+ $maxheight = (($args['height']) ? intval($args['height']) : 0);
+
+ $zcard = array('chan' => $channel);
+ if(($maxwidth > 1200) || ($maxwidth < 1))
+ $maxwidth = 1200;
+ $scale = (float) $maxwidth / 1200;
+
+ $translate = intval(($scale / 1.0) * 100);
+
+ $o .= replace_macros(get_markup_template('zcard.tpl'),array(
+ '$scale' => $scale,
+ '$translate' => $translate,
+ '$cover' => $cover,
+ '$pphoto' => $pphoto,
+ '$zcard' => $zcard
+ ));
+
+ return $o;
+
+} \ No newline at end of file
diff --git a/include/import.php b/include/import.php
index ffaea6c1a..b7ec1c565 100644
--- a/include/import.php
+++ b/include/import.php
@@ -2,7 +2,7 @@
require_once('include/menu.php');
-function import_channel($channel, $account_id) {
+function import_channel($channel, $account_id, $seize) {
if(! array_key_exists('channel_system',$channel)) {
$channel['channel_system'] = (($channel['channel_pageflags'] & 0x1000) ? 1 : 0);
@@ -496,6 +496,8 @@ function import_items($channel,$items) {
}
}
+ $deliver = false; // Don't deliver any messages or notifications when importing
+
foreach($items as $i) {
$item = get_item_elements($i,$allow_code);
if(! $item)
@@ -509,16 +511,15 @@ function import_items($channel,$items) {
if($item['edited'] > $r[0]['edited']) {
$item['id'] = $r[0]['id'];
$item['uid'] = $channel['channel_id'];
- item_store_update($item);
+ item_store_update($item,$allow_code,$deliver);
continue;
}
}
else {
$item['aid'] = $channel['channel_account_id'];
$item['uid'] = $channel['channel_id'];
- $item_result = item_store($item);
+ $item_result = item_store($item,$allow_code,$deliver);
}
-
}
}
}
diff --git a/include/items.php b/include/items.php
index 44f9633a9..5361a5fde 100755
--- a/include/items.php
+++ b/include/items.php
@@ -159,7 +159,7 @@ function filter_insecure($channel_id, $arr) {
$ret = array();
- if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_collections'))) || (! $arr))
+ if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_privacy_groups'))) || (! $arr))
return $arr;
$str = '';
@@ -604,8 +604,8 @@ function get_feed_for($channel, $observer_hash, $params) {
$atom = '';
$atom .= replace_macros($feed_template, array(
- '$version' => xmlify(RED_VERSION),
- '$red' => xmlify(PLATFORM_NAME),
+ '$version' => xmlify(get_project_version()),
+ '$red' => xmlify(get_platform_name()),
'$feed_id' => xmlify($channel['xchan_url']),
'$feed_title' => xmlify($channel['channel_name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) ,
@@ -2160,7 +2160,7 @@ function encode_rel_links($links) {
* * \e boolean \b success
* * \e int \b item_id
*/
-function item_store($arr, $allow_exec = false) {
+function item_store($arr, $allow_exec = false, $deliver = true) {
$d = array('item' => $arr, 'allow_exec' => $allow_exec);
call_hooks('item_store', $d );
@@ -2537,7 +2537,7 @@ function item_store($arr, $allow_exec = false) {
// so that we have an item in the DB that's marked deleted and won't store a fresh post
// that isn't aware that we were already told to delete it.
- if(! intval($arr['item_deleted'])) {
+ if(($deliver) && (! intval($arr['item_deleted']))) {
send_status_notifications($current_post,$arr);
tag_deliver($arr['uid'],$current_post);
}
@@ -2550,7 +2550,7 @@ function item_store($arr, $allow_exec = false) {
-function item_store_update($arr,$allow_exec = false) {
+function item_store_update($arr,$allow_exec = false, $deliver = true) {
$d = array('item' => $arr, 'allow_exec' => $allow_exec);
call_hooks('item_store_update', $d );
@@ -2780,9 +2780,11 @@ function item_store_update($arr,$allow_exec = false) {
call_hooks('post_remote_update_end',$arr);
- send_status_notifications($orig_post_id,$arr);
+ if($deliver) {
+ send_status_notifications($orig_post_id,$arr);
+ tag_deliver($uid,$orig_post_id);
+ }
- tag_deliver($uid,$orig_post_id);
$ret['success'] = true;
$ret['item_id'] = $orig_post_id;
@@ -3436,6 +3438,7 @@ function check_item_source($uid, $item) {
if(! $r[0]['src_patt'])
return true;
+
require_once('include/html2plain.php');
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
@@ -3685,6 +3688,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
return;
}
+ $sys_expire = intval(get_config('system','default_expire_days'));
+ $chn_expire = intval($importer['channel_expire_days']);
+
+ $expire_days = $sys_expire;
+
+ if(($chn_expire != 0) && ($chn_expire < $sys_expire))
+ $expire_days = $chn_expire;
+
+logger('expire_days: ' . $expire_days);
+
$feed = new SimplePie();
$feed->set_raw_data($xml);
$feed->init();
@@ -3788,6 +3801,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
intval($importer['channel_id'])
);
+
// Update content if 'updated' changes
if($r) {
@@ -3846,6 +3860,17 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray['owner_xchan'] = $contact['xchan_hash'];
+ if(array_key_exists('created',$datarray) && $datarray['created'] != NULL_DATE && $expire_days) {
+ $t1 = $datarray['created'];
+ $t2 = datetime_convert('UTC','UTC','now - ' . $expire_days . 'days');
+ if($t1 < $t2) {
+ logger('feed content older than expiration. Ignoring.', LOGGER_DEBUG, LOG_INFO);
+ continue;
+ }
+ }
+
+
+
$r = q("SELECT edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
dbesc($item_id),
intval($importer['channel_id'])
@@ -4835,7 +4860,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
intval($uid)
);
if(! $r) {
- $result['message'] = t('Collection not found.');
+ $result['message'] = t('Privacy group not found.');
return $result;
}
@@ -4851,14 +4876,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
} else {
$contact_str = ' 0 ';
- $result['message'] = t('Collection is empty.');
+ $result['message'] = t('Privacy group is empty.');
return $result;
}
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash($uid,$r[0]['hash']);
- $result['headline'] = sprintf( t('Collection: %s'),$x['name']);
+ $result['headline'] = sprintf( t('Privacy group: %s'),$x['name']);
}
elseif($arr['cid'] && $uid) {
diff --git a/include/language.php b/include/language.php
index 59979aa85..cea31924c 100644
--- a/include/language.php
+++ b/include/language.php
@@ -182,7 +182,7 @@ function t($s, $ctx = '') {
function translate_projectname($s) {
- return str_replace(array('$projectname','$Projectname'),array(PLATFORM_NAME,ucfirst(PLATFORM_NAME)),$s);
+ return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s);
}
diff --git a/include/message.php b/include/message.php
index 940fcc275..f24bb6e4b 100644
--- a/include/message.php
+++ b/include/message.php
@@ -11,6 +11,7 @@ require_once('include/attach.php');
function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='',$expires = ''){
$ret = array('success' => false);
+ $is_reply = false;
$a = get_app();
$observer_hash = get_observer_hash();
@@ -51,6 +52,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$conv_guid = '';
if(strlen($replyto)) {
+ $is_reply = true;
$r = q("select conv_guid from mail where channel_id = %d and ( mid = '%s' or parent_mid = '%s' ) limit 1",
intval(local_channel()),
dbesc($replyto),
@@ -187,8 +189,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
- $r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created, expires )
- VALUES ( %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ $r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created, expires, mail_isreply )
+ VALUES ( %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
intval($channel['channel_account_id']),
dbesc($conv_guid),
intval(1),
@@ -201,7 +203,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
dbesc($mid),
dbesc($replyto),
dbesc(datetime_convert()),
- dbescdate($expires)
+ dbescdate($expires),
+ intval($is_reply)
);
// verify the save
diff --git a/include/network.php b/include/network.php
index 859a60650..fe6b553e9 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1144,6 +1144,10 @@ function discover_by_webbie($webbie) {
dbesc($addr)
);
+ // fix relative urls
+ if($vcard['photo'] && (strpos($vcard['photo'],'http') !== 0))
+ $vcard['photo'] = $diaspora_base . '/' . $vcard['photo'];
+
/**
*
* Diaspora communications are notoriously unreliable and receiving profile update messages (indeed any messages)
@@ -1615,18 +1619,19 @@ function format_and_send_email($sender,$xchan,$item) {
// load the template for private message notifications
$tpl = get_markup_template('email_notify_html.tpl');
$email_html_body = replace_macros($tpl,array(
- '$banner' => $banner,
- '$product' => $product,
- '$preamble' => '',
- '$sitename' => $sitename,
- '$siteurl' => $siteurl,
+ '$banner' => $banner,
+ '$notify_icon' => get_notify_icon(),
+ '$product' => $product,
+ '$preamble' => '',
+ '$sitename' => $sitename,
+ '$siteurl' => $siteurl,
'$source_name' => $sender['xchan_name'],
'$source_link' => $sender['xchan_url'],
'$source_photo' => $sender['xchan_photo_m'],
- '$username' => $xchan['xchan_name'],
+ '$username' => $xchan['xchan_name'],
'$hsitelink' => $datarray['hsitelink'],
'$hitemlink' => $datarray['hitemlink'],
- '$thanks' => $thanks,
+ '$thanks' => $thanks,
'$site_admin' => $site_admin,
'$title' => $title,
'$htmlversion' => $htmlversion,
@@ -1635,20 +1640,20 @@ function format_and_send_email($sender,$xchan,$item) {
// load the template for private message notifications
$tpl = get_markup_template('email_notify_text.tpl');
$email_text_body = replace_macros($tpl, array(
- '$banner' => $banner,
- '$product' => $product,
- '$preamble' => '',
- '$sitename' => $sitename,
- '$siteurl' => $siteurl,
+ '$banner' => $banner,
+ '$product' => $product,
+ '$preamble' => '',
+ '$sitename' => $sitename,
+ '$siteurl' => $siteurl,
'$source_name' => $sender['xchan_name'],
'$source_link' => $sender['xchan_url'],
'$source_photo' => $sender['xchan_photo_m'],
- '$username' => $xchan['xchan_name'],
- '$hsitelink' => $datarray['hsitelink'],
- '$hitemlink' => $datarray['hitemlink'],
- '$thanks' => $thanks,
+ '$username' => $xchan['xchan_name'],
+ '$hsitelink' => $datarray['hsitelink'],
+ '$hitemlink' => $datarray['hitemlink'],
+ '$thanks' => $thanks,
'$site_admin' => $site_admin,
- '$title' => $title,
+ '$title' => $title,
'$textversion' => $textversion
));
@@ -1662,13 +1667,13 @@ function format_and_send_email($sender,$xchan,$item) {
// use the EmailNotification library to send the message
enotify::send(array(
- 'fromName' => $product,
- 'fromEmail' => $sender_email,
- 'replyTo' => $sender_email,
- 'toEmail' => str_replace('mailto:','',$xchan['xchan_addr']),
- 'messageSubject' => (($title) ? $title : t('No Subject')),
- 'htmlVersion' => $email_html_body,
- 'textVersion' => $email_text_body,
+ 'fromName' => $product,
+ 'fromEmail' => $sender_email,
+ 'replyTo' => $sender_email,
+ 'toEmail' => str_replace('mailto:','',$xchan['xchan_addr']),
+ 'messageSubject' => (($title) ? $title : t('No Subject')),
+ 'htmlVersion' => $email_html_body,
+ 'textVersion' => $email_text_body,
'additionalMailHeader' => '',
));
@@ -1763,16 +1768,13 @@ function get_site_info() {
$site_info = get_config('system','info');
$site_name = get_config('system','sitename');
if(! get_config('system','hidden_version_siteinfo')) {
- $version = RED_VERSION;
+ $version = get_project_version();
$tag = get_std_version();
if(@is_dir('.git') && function_exists('shell_exec')) {
$commit = trim( @shell_exec('git log -1 --format="%h"'));
-// if(! get_config('system','hidden_tag_siteinfo'))
-// $tag = trim( @shell_exec('git describe --tags --abbrev=0'));
-// else
-// $tag = '';
}
+
if(! isset($commit) || strlen($commit) > 16)
$commit = '';
}
@@ -1788,6 +1790,17 @@ function get_site_info() {
$hide_in_statistics = intval(get_config('system','hide_in_statistics'));
$site_expire = intval(get_config('system', 'default_expire_days'));
+ load_config('feature_lock');
+ $locked_features = array();
+ if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
+ foreach($a->config['feature_lock'] as $k => $v) {
+ if($k === 'config_loaded')
+ continue;
+ $locked_features[$k] = intval($v);
+ }
+ }
+
+
$data = Array(
'version' => $version,
@@ -1799,12 +1812,13 @@ function get_site_info() {
'invitation_only' => intval(get_config('system','invitation_only')),
'directory_mode' => $directory_mode[get_config('system','directory_mode')],
'language' => get_config('system','language'),
- 'rss_connections' => get_config('system','feed_contacts'),
+ 'rss_connections' => intval(get_config('system','feed_contacts')),
'expiration' => $site_expire,
'default_service_restrictions' => $service_class,
+ 'locked_features' => $locked_features,
'admin' => $admin,
'site_name' => (($site_name) ? $site_name : ''),
- 'platform' => PLATFORM_NAME,
+ 'platform' => get_platform_name(),
'dbdriver' => $db->getdriver(),
'lastpoll' => get_config('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''),
diff --git a/include/notifier.php b/include/notifier.php
index 50981df9d..5260e629f 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -188,6 +188,7 @@ function notifier_run($argv, $argc){
$recipients[] = $r[0]['abook_xchan'];
$private = false;
$packet_type = 'refresh';
+ $packet_recips = array(array('guid' => $r[0]['xchan_guid'],'guid_sig' => $r[0]['xchan_guid_sig'],'hash' => $r[0]['xchan_hash']));
}
}
}
@@ -297,7 +298,7 @@ function notifier_run($argv, $argc){
$channel = $s[0];
if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan']) {
- logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}");
+ logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}", LOGGER_NORMAL, LOG_WARNING);
return;
}
@@ -316,7 +317,7 @@ function notifier_run($argv, $argc){
return;
if(strpos($r[0]['postopts'],'nodeliver') !== false) {
- logger('notifier: target item is undeliverable', LOGGER_DEBUG);
+ logger('notifier: target item is undeliverable', LOGGER_DEBUG, LOG_NOTICE);
return;
}
@@ -352,8 +353,8 @@ function notifier_run($argv, $argc){
// $cmd === 'relay' indicates the owner is sending it to the original recipients
// don't allow the item in the relay command to relay to owner under any circumstances, it will loop
- logger('notifier: relay_to_owner: ' . (($relay_to_owner) ? 'true' : 'false'), LOGGER_DATA);
- logger('notifier: top_level_post: ' . (($top_level_post) ? 'true' : 'false'), LOGGER_DATA);
+ logger('notifier: relay_to_owner: ' . (($relay_to_owner) ? 'true' : 'false'), LOGGER_DATA, LOG_DEBUG);
+ logger('notifier: top_level_post: ' . (($top_level_post) ? 'true' : 'false'), LOGGER_DATA, LOG_DEBUG);
// tag_deliver'd post which needs to be sent back to the original author
@@ -395,7 +396,7 @@ function notifier_run($argv, $argc){
// TODO verify this is needed - copied logic from same place in old code
if(intval($target_item['item_deleted']) && (! intval($target_item['item_wall']))) {
- logger('notifier: ignoring delete notification for non-wall item');
+ logger('notifier: ignoring delete notification for non-wall item', LOGGER_NORMAL, LOG_NOTICE);
return;
}
}
@@ -410,13 +411,13 @@ function notifier_run($argv, $argc){
$x = $encoded_item;
$x['title'] = 'private';
$x['body'] = 'private';
- logger('notifier: encoded item: ' . print_r($x,true), LOGGER_DATA);
+ logger('notifier: encoded item: ' . print_r($x,true), LOGGER_DATA, LOG_DEBUG);
stringify_array_elms($recipients);
if(! $recipients)
return;
-// logger('notifier: recipients: ' . print_r($recipients,true));
+// logger('notifier: recipients: ' . print_r($recipients,true), LOGGER_NORMAL, LOG_DEBUG);
$env_recips = (($private) ? array() : null);
@@ -444,7 +445,7 @@ function notifier_run($argv, $argc){
if(($private) && (! $env_recips)) {
// shouldn't happen
- logger('notifier: private message with no envelope recipients.' . print_r($argv,true));
+ logger('notifier: private message with no envelope recipients.' . print_r($argv,true), LOGGER_NORMAL, LOG_NOTICE);
}
logger('notifier: recipients (may be delivered to more if public): ' . print_r($recip_list,true), LOGGER_DEBUG);
@@ -459,7 +460,7 @@ function notifier_run($argv, $argc){
if(! $r) {
- logger('notifier: no hubs');
+ logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE);
return;
}
@@ -482,7 +483,7 @@ function notifier_run($argv, $argc){
foreach($hubs as $hub) {
if(in_array($hub['hubloc_url'],$dead_hubs)) {
- logger('skipping dead hub: ' . $hub['hubloc_url'], LOGGER_DEBUG);
+ logger('skipping dead hub: ' . $hub['hubloc_url'], LOGGER_DEBUG, LOG_INFO);
continue;
}
@@ -502,7 +503,7 @@ function notifier_run($argv, $argc){
}
}
- logger('notifier: will notify/deliver to these hubs: ' . print_r($hublist,true), LOGGER_DEBUG);
+ logger('notifier: will notify/deliver to these hubs: ' . print_r($hublist,true), LOGGER_DEBUG, LOG_DEBUG);
foreach($dhubs as $hub) {
@@ -512,6 +513,7 @@ function notifier_run($argv, $argc){
$narr = array(
'channel' => $channel,
'env_recips' => $env_recips,
+ 'packet_recips' => $packet_recips,
'recipients' => $recipients,
'item' => $item,
'target_item' => $target_item,
@@ -547,7 +549,7 @@ function notifier_run($argv, $argc){
$packet = null;
if($packet_type === 'refresh' || $packet_type === 'purge') {
- $packet = zot_build_packet($channel,$packet_type);
+ $packet = zot_build_packet($channel,$packet_type,(($packet_recips) ? $packet_recips : null));
}
elseif($packet_type === 'request') {
$packet = zot_build_packet($channel,$packet_type,$env_recips,$hub['hubloc_sitekey'],$hash,
@@ -576,7 +578,7 @@ function notifier_run($argv, $argc){
));
// only create delivery reports for normal undeleted items
- if(is_array($target_item) && array_key_exists('postopts',$target_item) && (! $target_item['item_deleted'])) {
+ if(is_array($target_item) && array_key_exists('postopts',$target_item) && (! $target_item['item_deleted']) && (! get_config('system','disable_dreport'))) {
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan, dreport_queue ) values ( '%s','%s','%s','%s','%s','%s','%s' ) ",
dbesc($target_item['mid']),
dbesc($hub['hubloc_host']),
diff --git a/include/oembed.php b/include/oembed.php
index e50d34c7d..ff52545ee 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -53,6 +53,10 @@ function oembed_fetch_url($embedurl){
$a = get_app();
+ $embedurl = str_replace('&amp;','&', $embedurl);
+
+// logger('fetch: ' . $embedurl);
+
$txt = Cache::get($a->videowidth . $embedurl);
if(strstr($txt,'youtu') && strstr(z_root(),'https:')) {
@@ -78,7 +82,6 @@ function oembed_fetch_url($embedurl){
else {
// try oembed autodiscovery
$redirects = 0;
-
$result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));
if($result['success'])
$html_text = $result['body'];
@@ -88,8 +91,8 @@ function oembed_fetch_url($embedurl){
if ($dom){
$xpath = new DOMXPath($dom);
$attr = "oembed";
-
$xattr = oe_build_xpath("class","oembed");
+
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
@@ -121,20 +124,29 @@ function oembed_fetch_url($embedurl){
if ($txt[0]!="{") $txt='{"type":"error"}';
//save in cache
- Cache::set($a->videowidth . $embedurl,$txt);
+
+ if(! get_config('system','oembed_cache_disable'))
+ Cache::set($a->videowidth . $embedurl,$txt);
}
$j = json_decode($txt);
$j->embedurl = $embedurl;
+
+// logger('fetch return: ' . print_r($j,true));
+
return $j;
+
+
}
function oembed_format_object($j){
$a = get_app();
$embedurl = $j->embedurl;
+// logger('format: ' . print_r($j,true));
+
$jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null));
$ret="<span class='oembed ".$j->type."'>";
@@ -173,6 +185,14 @@ function oembed_format_object($j){
$ret.="<br>";
}; break;
case "link": {
+ if($j->thumbnail_url) {
+ if(is_matrix_url($embedurl)) {
+ $embedurl = zid($embedurl);
+ $j->thumbnail_url = zid($j->thumbnail_url);
+ }
+ $ret = '<a href="' . $embedurl . '" ><img src="' . $j->thumbnail_url . '" alt="thumbnail" /></a><br /><br />';
+ }
+
//$ret = "<a href='".$embedurl."'>".$j->title."</a>";
}; break;
case "rich": {
@@ -184,13 +204,13 @@ function oembed_format_object($j){
// add link to source if not present in "rich" type
if ( $j->type!='rich' || !strpos($j->html,$embedurl) ){
$embedlink = (isset($j->title))?$j->title:$embedurl;
- $ret .= '<span class="bookmark-identifier">#^</span>' . "<a href='$embedurl' rel='oembed'>$embedlink</a>";
- $ret .= "<br>";
+ $ret .= '<br /><span class="bookmark-identifier">#^</span>' . "<a href='$embedurl' rel='oembed'>$embedlink</a>";
+ $ret .= "<br />";
if (isset($j->author_name)) $ret.=" by ".$j->author_name;
if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else {
// add <a> for html2bbcode conversion
- $ret .= "<a href='$embedurl' rel='oembed'/>";
+ $ret .= "<br /><a href='$embedurl' rel='oembed'>$embedurl</a>";
}
$ret.="<br style='clear:left'></span>";
return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
diff --git a/include/permissions.php b/include/permissions.php
index a8e761f87..8071af686 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -641,10 +641,10 @@ function get_role_perms($role) {
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
+ |PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
+ |PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 0de3b9c97..dce92d8da 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -69,6 +69,8 @@ abstract class photo_driver {
abstract function cropImage($max,$x,$y,$w,$h);
+ abstract function cropImageRect($maxx,$maxy,$x,$y,$w,$h);
+
abstract function imageString();
@@ -229,6 +231,7 @@ abstract class photo_driver {
$this->doScaleImage($dest_width,$dest_height);
}
+
public function scaleImageSquare($dim) {
if(!$this->is_valid())
return FALSE;
diff --git a/include/photo/photo_gd.php b/include/photo/photo_gd.php
index 2ac7287e4..24bdc204f 100644
--- a/include/photo/photo_gd.php
+++ b/include/photo/photo_gd.php
@@ -108,6 +108,23 @@ class photo_gd extends photo_driver {
$this->setDimensions();
}
+ public function cropImageRect($maxx,$maxy,$x,$y,$w,$h) {
+ if(!$this->is_valid())
+ return FALSE;
+
+ $dest = imagecreatetruecolor( $maxx, $maxy );
+ imagealphablending($dest, false);
+ imagesavealpha($dest, true);
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
+ imagecopyresampled($dest, $this->image, 0, 0, $x, $y, $maxx, $maxy, $w, $h);
+ if($this->image)
+ imagedestroy($this->image);
+ $this->image = $dest;
+ $this->setDimensions();
+ }
+
+
+
public function imageString() {
if(!$this->is_valid())
return FALSE;
diff --git a/include/photo/photo_imagick.php b/include/photo/photo_imagick.php
index 3f84fd06c..32bb61342 100644
--- a/include/photo/photo_imagick.php
+++ b/include/photo/photo_imagick.php
@@ -163,6 +163,24 @@ class photo_imagick extends photo_driver {
$this->doScaleImage($max,$max);
}
+ public function cropImageRect($maxx,$maxy,$x,$y,$w,$h) {
+ if(!$this->is_valid())
+ return FALSE;
+
+ $this->image->setFirstIterator();
+ do {
+ $this->image->cropImage($w, $h, $x, $y);
+ /**
+ * We need to remove the canvas,
+ * or the image is not resized to the crop:
+ * http://php.net/manual/en/imagick.cropimage.php#97232
+ */
+ $this->image->setImagePage(0, 0, 0, 0);
+ } while ($this->image->nextImage());
+
+ $this->doScaleImage($maxx,$maxy);
+ }
+
public function imageString() {
if(!$this->is_valid())
return FALSE;
diff --git a/include/plugin.php b/include/plugin.php
index 4a35a0170..a47558b63 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -313,7 +313,6 @@ function call_hooks($name, &$data = null) {
* * Version: 1.2.3
* * Author: John <profile url>
* * Author: Jane <email>
- * * Compat: Red [(version)], Friendica [(version)]
* *
*\endcode
* @param string $plugin the name of the plugin
@@ -325,8 +324,8 @@ function get_plugin_info($plugin){
'name' => $plugin,
'description' => '',
'author' => array(),
- 'version' => '',
- 'compat' => ''
+ 'maintainer' => array(),
+ 'version' => ''
);
if (!is_file("addon/$plugin/$plugin.php"))
@@ -342,17 +341,16 @@ function get_plugin_info($plugin){
if ($l != ""){
list($k, $v) = array_map("trim", explode(":", $l, 2));
$k = strtolower($k);
- if ($k == 'author'){
+ if ($k == 'author' || $k == 'maintainer'){
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) {
- $info['author'][] = array('name' => $m[1], 'link' => $m[2]);
+ $info[$k][] = array('name' => $m[1], 'link' => $m[2]);
} else {
- $info['author'][] = array('name' => $v);
- }
- } else {
- if (array_key_exists($k, $info)){
- $info[$k] = $v;
+ $info[$k][] = array('name' => $v);
}
+ }
+ else {
+ $info[$k] = $v;
}
}
}
@@ -361,6 +359,35 @@ function get_plugin_info($plugin){
return $info;
}
+function check_plugin_versions($info) {
+
+ if(! is_array($info))
+ return true;
+
+ if(array_key_exists('minversion',$info)) {
+ if(! version_compare(STD_VERSION,trim($info['minversion']), '>=')) {
+ logger('minversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
+ return false;
+ }
+ }
+ if(array_key_exists('maxversion',$info)) {
+ if(version_compare(STD_VERSION,trim($info['maxversion']), '>')) {
+ logger('maxversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
+ return false;
+ }
+ }
+ if(array_key_exists('minphpversion',$info)) {
+ if(! version_compare(PHP_VERSION,trim($info['minphpversion']), '>=')) {
+ logger('minphpversion limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
/**
* @brief Parse theme comment in search of theme infos.
diff --git a/include/poller.php b/include/poller.php
index 031fb4533..808b54ee5 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -205,7 +205,7 @@ function poller_run($argv, $argc){
$keep_reports = intval(get_config('system','expire_delivery_reports'));
if($keep_reports === 0)
- $keep_reports = 30;
+ $keep_reports = 10;
q("delete from dreport where dreport_time < %s - INTERVAL %s",
db_utcnow(),
diff --git a/include/queue_fn.php b/include/queue_fn.php
index 1e53d7488..0708aab56 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -88,6 +88,7 @@ function queue_deliver($outq, $immediate = false) {
}
}
else {
+
// zot sites should all have a site record, unless they've been dead for as long as
// your site has existed. Since we don't know for sure what these sites are,
// call them unknown
@@ -100,6 +101,11 @@ function queue_deliver($outq, $immediate = false) {
}
}
+ $arr = array('outq' => $outq, 'handled' => false, 'immediate' => $immediate);
+ call_hooks('queue_deliver',$arr);
+ if($arr['handled'])
+ return;
+
// "post" queue driver - used for diaspora and friendica-over-diaspora communications.
if($outq['outq_driver'] === 'post') {
@@ -118,11 +124,31 @@ function queue_deliver($outq, $immediate = false) {
dbesc($outq['outq_hash'])
);
remove_queue_item($outq['outq_hash']);
+
+ // server is responding - see if anything else is going to this destination and is piled up
+ // and try to send some more. We're relying on the fact that delivery_loop() results in an
+ // immediate delivery otherwise we could get into a queue loop.
+
+ if(! $immediate) {
+ $x = q("select outq_hash from outq where outq_posturl = '%s' and outq_delivered = 0",
+ dbesc($outq['outq_posturl'])
+ );
+
+ $piled_up = array();
+ if($x) {
+ foreach($x as $xx) {
+ $piled_up[] = $xx['outq_hash'];
+ }
+ }
+ if($piled_up) {
+ delivery_loop($piled_up);
+ }
+ }
}
else {
logger('deliver: queue post returned ' . $result['return_code']
. ' from ' . $outq['outq_posturl'],LOGGER_DEBUG);
- update_queue_item($argv[$x]);
+ update_queue_item($outq['outq_posturl']);
}
return;
}
diff --git a/include/security.php b/include/security.php
index d4ebe0024..ee94dba82 100644
--- a/include/security.php
+++ b/include/security.php
@@ -18,20 +18,13 @@ function authenticate_success($user_record, $login_initial = false, $interactive
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
+ $lastlog_updated = false;
+
if(x($user_record, 'account_id')) {
$a->account = $user_record;
$_SESSION['account_id'] = $user_record['account_id'];
$_SESSION['authenticated'] = 1;
- if($login_initial || $update_lastlog) {
- q("update account set account_lastlog = '%s' where account_id = %d",
- dbesc(datetime_convert()),
- intval($_SESSION['account_id'])
- );
- $a->account['account_lastlog'] = datetime_convert();
- call_hooks('logged_in', $a->account);
-
- }
$uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid'])))
? intval($_SESSION['uid'])
@@ -42,9 +35,19 @@ function authenticate_success($user_record, $login_initial = false, $interactive
change_channel($uid_to_load);
}
+ if($login_initial || $update_lastlog) {
+ q("update account set account_lastlog = '%s' where account_id = %d",
+ dbesc(datetime_convert()),
+ intval($_SESSION['account_id'])
+ );
+ $a->account['account_lastlog'] = datetime_convert();
+ $lastlog_updated = true;
+ call_hooks('logged_in', $a->account);
+ }
+
}
- if($login_initial) {
+ if(($login_initial) && (! $lastlog_updated)) {
call_hooks('logged_in', $user_record);
@@ -178,7 +181,7 @@ function permissions_sql($owner_id, $remote_observer = null) {
*/
else {
- $observer = (($remote_observer) ? $remote_observer : get_observer_hash());
+ $observer = ((! is_null($remote_observer)) ? $remote_observer : get_observer_hash());
if($observer) {
$groups = init_groups_visitor($observer);
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 0bf89a7c1..5ef106938 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -398,16 +398,17 @@ function get_things($profile_hash,$uid) {
$things[$k] = null;
foreach($r as $rr) {
- $l = q("select xchan_name, xchan_url from likes left join xchan on likee = xchan_hash where
+ $l = q("select xchan_name, xchan_photo_s, xchan_url from likes left join xchan on likee = xchan_hash where
target_type = '%s' and target_id = '%s' and channel_id = %d",
dbesc(ACTIVITY_OBJ_THING),
dbesc($rr['obj_obj']),
intval($uid)
);
- for($x = 0; $x < count($l); $x ++)
+ for($x = 0; $x < count($l); $x ++) {
$l[$x]['xchan_url'] = zid($l[$x]['xchan_url']);
-
+ $l[$x]['xchan_photo_s'] = zid($l[$x]['xchan_photo_s']);
+ }
if(! $things[$rr['obj_verb']])
$things[$rr['obj_verb']] = array();
diff --git a/include/text.php b/include/text.php
index dd52b16b6..0b5ad9c72 100644
--- a/include/text.php
+++ b/include/text.php
@@ -536,9 +536,10 @@ function attribute_contains($attr, $s) {
*
* @param string $msg Message to log
* @param int $level A log level.
+ * @param int $priority - compatible with syslog
*/
-function logger($msg, $level = 0) {
+function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
// turn off logger in install mode
global $a;
global $db;
@@ -559,8 +560,8 @@ function logger($msg, $level = 0) {
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
}
- $s = datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL;
- $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'logged' => false);
+ $s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
+ $pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false);
call_hooks('logger',$pluginfo);
@@ -568,6 +569,23 @@ function logger($msg, $level = 0) {
@file_put_contents($pluginfo['filename'], $pluginfo['message'], FILE_APPEND);
}
+function log_priority_str($priority) {
+ $parr = array(
+ LOG_EMERG => 'LOG_EMERG',
+ LOG_ALERT => 'LOG_ALERT',
+ LOG_CRIT => 'LOG_CRIT',
+ LOG_ERR => 'LOG_ERR',
+ LOG_WARNING => 'LOG_WARNING',
+ LOG_NOTICE => 'LOG_NOTICE',
+ LOG_INFO => 'LOG_INFO',
+ LOG_DEBUG => 'LOG_DEBUG'
+ );
+
+ if($parr[$priority])
+ return $parr[$priority];
+ return 'LOG_UNDEFINED';
+}
+
/**
* @brief This is a special logging facility for developers.
*
@@ -794,7 +812,7 @@ function contact_block() {
);
if(count($r)) {
- $contacts = sprintf( tt('%d Connection','%d Connections', $total),$total);
+ $contacts = t('Connections');
$micropro = Array();
foreach($r as $rr) {
$rr['archived'] = (intval($rr['abook_archived']) ? true : false);
@@ -807,7 +825,7 @@ function contact_block() {
$o = replace_macros($tpl, array(
'$contacts' => $contacts,
'$nickname' => $a->profile['channel_address'],
- '$viewconnections' => t('View Connections'),
+ '$viewconnections' => (($total > $shown) ? sprintf(t('View all %s connections'),$total) : ''),
'$micropro' => $micropro,
));
@@ -972,7 +990,7 @@ function get_mood_verbs() {
'tired' => t('tired'),
'perky' => t('perky'),
'angry' => t('angry'),
- 'stupefied' => t('stupified'),
+ 'stupefied' => t('stupefied'),
'puzzled' => t('puzzled'),
'interested' => t('interested'),
'bitter' => t('bitter'),
@@ -2698,5 +2716,7 @@ function item_url_replace($channel,&$item,$old,$new) {
$item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey']));
$item['item_verified'] = 1;
}
+
+ // @fixme item['plink'] and item['llink']
}
diff --git a/include/widgets.php b/include/widgets.php
index 4b14d6c94..7e502e4c2 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -170,8 +170,8 @@ function widget_follow($args) {
}
return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Connection'),
- '$desc' => t('Enter the channel address'),
- '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
+ '$desc' => t('Enter channel address'),
+ '$hint' => t('Examples: bob@example.com, https://example.com/barbara'),
'$follow' => t('Connect'),
'$abook_usage_message' => $abook_usage_message
));
@@ -493,38 +493,41 @@ function widget_settings_menu($arr) {
'selected' => ((argv(1) === 'channel') ? 'active' : ''),
),
- array(
- 'label' => t('Additional features'),
- 'url' => $a->get_baseurl(true).'/settings/features',
- 'selected' => ((argv(1) === 'features') ? 'active' : ''),
- ),
+ );
- array(
- 'label' => t('Feature/Addon settings'),
- 'url' => $a->get_baseurl(true).'/settings/featured',
- 'selected' => ((argv(1) === 'featured') ? 'active' : ''),
- ),
+ if(get_features()) {
+ $tabs[] = array(
+ 'label' => t('Additional features'),
+ 'url' => $a->get_baseurl(true).'/settings/features',
+ 'selected' => ((argv(1) === 'features') ? 'active' : ''),
+ );
+ }
- array(
- 'label' => t('Display settings'),
- 'url' => $a->get_baseurl(true).'/settings/display',
- 'selected' => ((argv(1) === 'display') ? 'active' : ''),
- ),
+ $tabs[] = array(
+ 'label' => t('Feature/Addon settings'),
+ 'url' => $a->get_baseurl(true).'/settings/featured',
+ 'selected' => ((argv(1) === 'featured') ? 'active' : ''),
+ );
- array(
- 'label' => t('Connected apps'),
- 'url' => $a->get_baseurl(true) . '/settings/oauth',
- 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
- ),
+ $tabs[] = array(
+ 'label' => t('Display settings'),
+ 'url' => $a->get_baseurl(true).'/settings/display',
+ 'selected' => ((argv(1) === 'display') ? 'active' : ''),
+ );
- array(
- 'label' => t('Export channel'),
- 'url' => $a->get_baseurl(true) . '/uexport',
- 'selected' => ''
- ),
+ $tabs[] = array(
+ 'label' => t('Connected apps'),
+ 'url' => $a->get_baseurl(true) . '/settings/oauth',
+ 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
+ );
+ $tabs[] = array(
+ 'label' => t('Export channel'),
+ 'url' => $a->get_baseurl(true) . '/uexport',
+ 'selected' => ''
);
+
if($role === false || $role === 'custom') {
$tabs[] = array(
'label' => t('Connection Default Permissions'),
@@ -804,21 +807,39 @@ function widget_suggestedchats($arr) {
}
function widget_item($arr) {
- // FIXME there is no $a here
- $uid = $a->profile['profile_uid'];
- if((! $uid) || (! $arr['mid']))
+
+ $channel_id = 0;
+ if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
+ $channel_id = intval($arr['channel_id']);
+ if(! $channel_id)
+ $channel_id = get_app()->profile_uid;
+ if(! $channel_id)
+ return '';
+
+
+ if((! $arr['mid']) && (! $arr['title']))
return '';
- if(! perm_is_allowed($uid, get_observer_hash(), 'view_pages'))
+ if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages'))
return '';
require_once('include/security.php');
- $sql_extra = item_permissions_sql($uid);
-
- $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
- dbesc($arr['mid']),
- intval($uid)
- );
+ $sql_extra = item_permissions_sql($channel_id);
+
+ if($arr['title']) {
+ $r = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and item_type = %d $sql_options $revision limit 1",
+ intval($channel_id),
+ dbesc($arr['title']),
+ intval(ITEM_TYPE_WEBPAGE)
+ );
+ }
+ else {
+ $r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
+ dbesc($arr['mid']),
+ intval($channel_id)
+ );
+ }
if(! $r)
return '';
@@ -912,8 +933,8 @@ function widget_photo($arr) {
// ensure they can't sneak in an eval(js) function
- if(strpos($style,'(') !== false)
- return '';
+ if(strpbrk($style,'(\'"<>') !== false)
+ $style = '';
if(array_key_exists('zrl', $arr) && isset($arr['zrl']))
$zrl = (($arr['zrl']) ? true : false);
@@ -933,6 +954,38 @@ function widget_photo($arr) {
}
+function widget_cover_photo($arr) {
+
+ require_once('include/identity.php');
+ $o = '';
+
+ $channel_id = 0;
+ if(array_key_exists('channel_id', $arr) && intval($arr['channel_id']))
+ $channel_id = intval($arr['channel_id']);
+ if(! $channel_id)
+ $channel_id = get_app()->profile_uid;
+ if(! $channel_id)
+ return '';
+
+ if(array_key_exists('style', $arr) && isset($arr['style']))
+ $style = $arr['style'];
+ else
+ $style = 'width:100%; padding-right: 10px; height: auto;';
+
+ // ensure they can't sneak in an eval(js) function
+
+ if(strpbrk($style,'(\'"<>') !== false)
+ $style = '';
+
+ $c = get_cover_photo($channel_id,'html');
+
+ if($c) {
+ $o = '<div class="widget">' . (($style) ? str_replace('alt=',' style="' . $style . '" alt=',$c) : $c) . '</div>';
+ }
+ return $o;
+}
+
+
function widget_photo_rand($arr) {
require_once('include/photos.php');
@@ -1075,16 +1128,18 @@ function widget_rating($arr) {
}
+
+ $o = '<div class="widget">';
+ $o .= '<h3>' . t('Rating Tools') . '</h3>';
+
if((($remote) || (local_channel())) && (! $self)) {
- $o = '<div class="widget rateme">';
if($remote)
- $o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
+ $o .= '<a class="btn btn-block btn-primary btn-sm" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
else
- $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
- $o .= '</div>';
+ $o .= '<div class="btn btn-block btn-primary btn-sm" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
}
- $o .= '<div class="widget rateme"><a class="rateme" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
+ $o .= '<a class="btn btn-block btn-default btn-sm" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
$o .= '</div>';
return $o;
@@ -1214,6 +1269,7 @@ function widget_admin($arr) {
'site' => array(z_root() . '/admin/site/', t('Site'), 'site'),
'users' => array(z_root() . '/admin/users/', t('Accounts'), 'users'),
'channels' => array(z_root() . '/admin/channels/', t('Channels'), 'channels'),
+ 'features' => array(z_root() . '/admin/features/', t('Features'), 'features'),
'plugins' => array(z_root() . '/admin/plugins/', t('Plugins'), 'plugins'),
'themes' => array(z_root() . '/admin/themes/', t('Themes'), 'themes'),
'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'),
diff --git a/include/zot.php b/include/zot.php
index 922637bc1..0210f3f4a 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -142,7 +142,7 @@ function zot_build_packet($channel, $type = 'notify', $recipients = null, $remot
$data[$k] = $v;
}
- logger('zot_build_packet: ' . print_r($data,true), LOGGER_DATA);
+ logger('zot_build_packet: ' . print_r($data,true), LOGGER_DATA, LOG_DEBUG);
// Hush-hush ultra top-secret mode
@@ -194,7 +194,7 @@ function zot_finger($webbie, $channel = null, $autofallback = true) {
logger('zot_finger: no address :' . $webbie);
return array('success' => false);
}
- logger('using xchan_addr: ' . $xchan_addr, LOGGER_DATA);
+ logger('using xchan_addr: ' . $xchan_addr, LOGGER_DATA, LOG_DEBUG);
// potential issue here; the xchan_addr points to the primary hub.
// The webbie we were called with may not, so it might not be found
@@ -211,7 +211,7 @@ function zot_finger($webbie, $channel = null, $autofallback = true) {
if ($r[0]['hubloc_network'] && $r[0]['hubloc_network'] !== 'zot') {
logger('zot_finger: alternate network: ' . $webbie);
- logger('url: '.$url.', net: '.var_export($r[0]['hubloc_network'],true), LOGGER_DATA);
+ logger('url: '.$url.', net: '.var_export($r[0]['hubloc_network'],true), LOGGER_DATA, LOG_DEBUG);
return array('success' => false);
}
} else {
@@ -288,9 +288,9 @@ function zot_refresh($them, $channel = null, $force = false) {
return true;
}
- logger('zot_refresh: them: ' . print_r($them,true), LOGGER_DATA);
+ logger('zot_refresh: them: ' . print_r($them,true), LOGGER_DATA, LOG_DEBUG);
if ($channel)
- logger('zot_refresh: channel: ' . print_r($channel,true), LOGGER_DATA);
+ logger('zot_refresh: channel: ' . print_r($channel,true), LOGGER_DATA, LOG_DEBUG);
$url = null;
@@ -353,7 +353,7 @@ function zot_refresh($them, $channel = null, $force = false) {
$result = z_post_url($url . $rhs,$postvars);
- logger('zot_refresh: zot-info: ' . print_r($result,true), LOGGER_DATA);
+ logger('zot_refresh: zot-info: ' . print_r($result,true), LOGGER_DATA, LOG_DEBUG);
if ($result['success']) {
@@ -381,7 +381,7 @@ function zot_refresh($them, $channel = null, $force = false) {
$channel['channel_prvkey']);
if($permissions)
$permissions = json_decode($permissions,true);
- logger('decrypted permissions: ' . print_r($permissions,true), LOGGER_DATA);
+ logger('decrypted permissions: ' . print_r($permissions,true), LOGGER_DATA, LOG_DEBUG);
}
else
$permissions = $j['permissions'];
@@ -614,7 +614,7 @@ function zot_register_hub($arr) {
$x = z_fetch_url($url);
- logger('zot_register_hub: ' . print_r($x,true), LOGGER_DATA);
+ logger('zot_register_hub: ' . print_r($x,true), LOGGER_DATA, LOG_DEBUG);
if($x['success']) {
$record = json_decode($x['body'],true);
@@ -754,8 +754,8 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
dbesc($xchan_hash)
);
- logger('import_xchan: update: existing: ' . print_r($r[0],true), LOGGER_DATA);
- logger('import_xchan: update: new: ' . print_r($arr,true), LOGGER_DATA);
+ logger('import_xchan: update: existing: ' . print_r($r[0],true), LOGGER_DATA, LOG_DEBUG);
+ logger('import_xchan: update: new: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
$what .= 'xchan ';
$changed = true;
}
@@ -955,7 +955,7 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
$ret['hash'] = $xchan_hash;
}
- logger('import_xchan: result: ' . print_r($ret,true), LOGGER_DATA);
+ logger('import_xchan: result: ' . print_r($ret,true), LOGGER_DATA, LOG_DEBUG);
return $ret;
}
@@ -980,7 +980,7 @@ function zot_process_response($hub, $arr, $outq) {
if (! $x) {
logger('zot_process_response: No json from ' . $hub);
- logger('zot_process_response: headers: ' . print_r($arr['header'],true), LOGGER_DATA);
+ logger('zot_process_response: headers: ' . print_r($arr['header'],true), LOGGER_DATA, LOG_DEBUG);
}
if(is_array($x) && array_key_exists('delivery_report',$x) && is_array($x['delivery_report'])) {
@@ -1015,7 +1015,7 @@ function zot_process_response($hub, $arr, $outq) {
// async messages remain in the queue until processed.
if(intval($outq['outq_async']))
- queue_set_delivered($outq['outq_hash'],$outq['outq_channel']);
+ remove_queue_item($outq['outq_hash'],$outq['outq_channel']);
logger('zot_process_response: ' . print_r($x,true), LOGGER_DEBUG);
}
@@ -1037,7 +1037,7 @@ function zot_process_response($hub, $arr, $outq) {
*/
function zot_fetch($arr) {
- logger('zot_fetch: ' . print_r($arr,true), LOGGER_DATA);
+ logger('zot_fetch: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
$url = $arr['sender']['url'] . $arr['callback'];
@@ -1134,7 +1134,7 @@ function zot_import($arr, $sender_url) {
$i['notify'] = json_decode(crypto_unencapsulate($i['notify'],get_config('system','prvkey')),true);
}
- logger('zot_import: notify: ' . print_r($i['notify'],true), LOGGER_DATA);
+ logger('zot_import: notify: ' . print_r($i['notify'],true), LOGGER_DATA, LOG_DEBUG);
$hub = zot_gethub($i['notify']['sender']);
if((! $hub) || ($hub['hubloc_url'] != $sender_url)) {
@@ -1151,7 +1151,7 @@ function zot_import($arr, $sender_url) {
if(array_key_exists('message',$i) && array_key_exists('type',$i['message']) && $i['message']['type'] === 'rating') {
// rating messages are processed only by directory servers
- logger('Rating received: ' . print_r($arr,true), LOGGER_DATA);
+ logger('Rating received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
$result = process_rating_delivery($i['notify']['sender'],$i['message']);
continue;
}
@@ -1261,8 +1261,8 @@ function zot_import($arr, $sender_url) {
continue;
}
- logger('Activity received: ' . print_r($arr,true), LOGGER_DATA);
- logger('Activity recipients: ' . print_r($deliveries,true), LOGGER_DATA);
+ logger('Activity received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
+ logger('Activity recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG);
$relay = ((array_key_exists('flags',$i['message']) && in_array('relay',$i['message']['flags'])) ? true : false);
$result = process_delivery($i['notify']['sender'],$arr,$deliveries,$relay,false,$message_request);
@@ -1270,16 +1270,16 @@ function zot_import($arr, $sender_url) {
elseif($i['message']['type'] === 'mail') {
$arr = get_mail_elements($i['message']);
- logger('Mail received: ' . print_r($arr,true), LOGGER_DATA);
- logger('Mail recipients: ' . print_r($deliveries,true), LOGGER_DATA);
+ logger('Mail received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
+ logger('Mail recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG);
$result = process_mail_delivery($i['notify']['sender'],$arr,$deliveries);
}
elseif($i['message']['type'] === 'profile') {
$arr = get_profile_elements($i['message']);
- logger('Profile received: ' . print_r($arr,true), LOGGER_DATA);
- logger('Profile recipients: ' . print_r($deliveries,true), LOGGER_DATA);
+ logger('Profile received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
+ logger('Profile recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG);
$result = process_profile_delivery($i['notify']['sender'],$arr,$deliveries);
}
@@ -1288,16 +1288,16 @@ function zot_import($arr, $sender_url) {
$arr = $i['message'];
- logger('Channel sync received: ' . print_r($arr,true), LOGGER_DATA);
- logger('Channel sync recipients: ' . print_r($deliveries,true), LOGGER_DATA);
+ logger('Channel sync received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
+ logger('Channel sync recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG);
$result = process_channel_sync_delivery($i['notify']['sender'],$arr,$deliveries);
}
elseif($i['message']['type'] === 'location') {
$arr = $i['message'];
- logger('Location message received: ' . print_r($arr,true), LOGGER_DATA);
- logger('Location message recipients: ' . print_r($deliveries,true), LOGGER_DATA);
+ logger('Location message received: ' . print_r($arr,true), LOGGER_DATA, LOG_DEBUG);
+ logger('Location message recipients: ' . print_r($deliveries,true), LOGGER_DATA, LOG_DEBUG);
$result = process_location_delivery($i['notify']['sender'],$arr,$deliveries);
}
@@ -1483,7 +1483,7 @@ function public_recips($msg) {
}
}
- logger('public_recips: ' . print_r($r,true), LOGGER_DATA);
+ logger('public_recips: ' . print_r($r,true), LOGGER_DATA, LOG_DEBUG);
return $r;
}
@@ -1501,7 +1501,7 @@ function public_recips($msg) {
*/
function allowed_public_recips($msg) {
- logger('allowed_public_recips: ' . print_r($msg,true),LOGGER_DATA);
+ logger('allowed_public_recips: ' . print_r($msg,true),LOGGER_DATA, LOG_DEBUG);
if(array_key_exists('public_scope',$msg['message']))
$scope = $msg['message']['public_scope'];
@@ -2873,7 +2873,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
logger('build_sync_packet');
if($packet)
- logger('packet: ' . print_r($packet, true),LOGGER_DATA);
+ logger('packet: ' . print_r($packet, true),LOGGER_DATA, LOG_DEBUG);
if(! $uid)
$uid = local_channel();
@@ -2967,7 +2967,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
$interval = ((get_config('system','delivery_interval') !== false)
? intval(get_config('system','delivery_interval')) : 2 );
- logger('build_sync_packet: packet: ' . print_r($info,true), LOGGER_DATA);
+ logger('build_sync_packet: packet: ' . print_r($info,true), LOGGER_DATA, LOG_DEBUG);
foreach($synchubs as $hub) {
$hash = random_string();
@@ -3186,8 +3186,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
logger('process_channel_sync_delivery: total_feeds service class limit exceeded');
continue;
}
- q("insert into abook ( abook_xchan, abook_channel ) values ('%s', %d ) ",
+ q("insert into abook ( abook_xchan, abook_account, abook_channel ) values ('%s', %d, %d ) ",
dbesc($clean['abook_xchan']),
+ intval($channel['channel_account_id']),
intval($channel['channel_id'])
);
$total_friends ++;
@@ -3828,7 +3829,7 @@ function zotinfo($arr) {
$ret['site']['channels'] = channel_total();
- $ret['site']['version'] = PLATFORM_NAME . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']';
+ $ret['site']['version'] = get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']';
$ret['site']['admin'] = get_config('system','admin_email');
@@ -3848,7 +3849,7 @@ function zotinfo($arr) {
$ret['site']['sellpage'] = get_config('system','sellpage');
$ret['site']['location'] = get_config('system','site_location');
$ret['site']['realm'] = get_directory_realm();
- $ret['site']['project'] = PLATFORM_NAME;
+ $ret['site']['project'] = get_platform_name();
}
@@ -3864,7 +3865,7 @@ function zotinfo($arr) {
function check_zotinfo($channel,$locations,&$ret) {
-// logger('locations: ' . print_r($locations,true),LOGGER_DATA);
+// logger('locations: ' . print_r($locations,true),LOGGER_DATA, LOG_DEBUG);
// This function will likely expand as we find more things to detect and fix.
// 1. Because magic-auth is reliant on it, ensure that the system channel has a valid hubloc
@@ -3924,6 +3925,9 @@ function check_zotinfo($channel,$locations,&$ret) {
function delivery_report_is_storable($dr) {
+ if(get_config('system','disable_dreport'))
+ return false;
+
call_hooks('dreport_is_storable',$dr);
// let plugins accept or reject - if neither, continue on
@@ -4085,7 +4089,7 @@ function zot_reply_pickup($data) {
$sitekey = $hubsite['hubloc_sitekey'];
- logger('mod_zot: Checking sitekey: ' . $sitekey, LOGGER_DATA);
+ logger('mod_zot: Checking sitekey: ' . $sitekey, LOGGER_DATA, LOG_DEBUG);
if(rsa_verify($data['callback'],base64url_decode($data['callback_sig']),$sitekey)) {
$forgery = false;