aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php2
-rw-r--r--include/RedDAV/RedBrowser.php6
-rw-r--r--include/attach.php2
-rw-r--r--include/auth.php2
-rw-r--r--include/bbcode.php6
-rw-r--r--include/conversation.php1
-rw-r--r--include/datetime.php47
-rw-r--r--include/dir_fns.php11
-rw-r--r--include/enotify.php17
-rw-r--r--include/features.php79
-rw-r--r--include/identity.php5
-rwxr-xr-xinclude/items.php8
-rw-r--r--include/language.php30
-rw-r--r--include/nav.php10
-rw-r--r--include/network.php4
-rw-r--r--include/notifier.php1
-rw-r--r--include/permissions.php38
-rwxr-xr-xinclude/plugin.php2
-rw-r--r--include/text.php36
-rw-r--r--include/widgets.php2
-rw-r--r--include/zot.php14
21 files changed, 169 insertions, 154 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 233798181..4f7a2a19f 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -519,6 +519,8 @@ function contact_remove($channel_id, $abook_id) {
if((! $channel_id) || (! $abook_id))
return false;
+ logger('removing contact ' . $abook_id . ' for channel ' . $channel_id,LOGGER_DEBUG);
+
$archive = get_pconfig($channel_id, 'system','archive_removed_contacts');
if($archive) {
q("update abook set abook_flags = ( abook_flags | %d ) where abook_id = %d and abook_channel = %d",
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index d07f60083..709f6339b 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -342,6 +342,7 @@ class RedBrowser extends DAV\Browser\Plugin {
'application/octet-stream' => 'icon-file-alt',
//Text
+ 'text/plain' => 'icon-file-text-alt',
'application/msword' => 'icon-file-text-alt',
'application/pdf' => 'icon-file-text-alt',
'application/vnd.oasis.opendocument.text' => 'icon-file-text-alt',
@@ -365,6 +366,11 @@ class RedBrowser extends DAV\Browser\Plugin {
'audio/mpeg' => 'icon-music',
'audio/wav' => 'icon-music',
'application/ogg' => 'icon-music',
+
+ //Video
+ 'video/quicktime' => 'icon-film',
+
+
);
$iconFromType = 'icon-file-alt';
diff --git a/include/attach.php b/include/attach.php
index ad6ca1b21..a76dd4b28 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -717,7 +717,7 @@ function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gi
);
if($r) {
foreach($r as $rr) {
- attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse);
+ attach_change_permissions($channel_id, $rr['hash'], $allow_cid, $allow_gid, $deny_cid, $deny_gid, $recurse);
}
}
}
diff --git a/include/auth.php b/include/auth.php
index 545fbe8c9..c4bbaf546 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -283,7 +283,7 @@ else {
@file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $error . "\n", FILE_APPEND);
notice( t('Login failed.') . EOL );
- goaway(z_root());
+ goaway(z_root() . '/login');
}
// If the user specified to remember the authentication, then change the cookie
diff --git a/include/bbcode.php b/include/bbcode.php
index 9445eb007..030a1fb49 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -22,7 +22,7 @@ function tryzrlaudio($match) {
$zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
- return '<audio src="' . $link . '" controls="controls" ><a href="' . $link . '">' . $link . '</a></audio>';
+ return '<audio src="' . str_replace(' ','%20',$link) . '" controls="controls" ><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></audio>';
}
function tryzrlvideo($match) {
@@ -30,7 +30,7 @@ function tryzrlvideo($match) {
$zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
- return '<video controls="controls" src="' . $link . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . $link . '">' . $link . '</a></video>';
+ return '<video controls="controls" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>';
}
@@ -437,7 +437,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// replace [observer.baseurl]
if ($observer) {
- $s1 = '<span class="bb_observer">';
+ $s1 = '<span class="bb_observer" title="' . t('Different viewers will see this text differently') . '">';
$s2 = '</span>';
$obsBaseURL = $observer['xchan_connurl'];
$obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL);
diff --git a/include/conversation.php b/include/conversation.php
index a2fb3d162..986892fff 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -264,6 +264,7 @@ function localize_item(&$item){
}
+
/*
// FIXME store parent item as object or target
// (and update to json storage)
diff --git a/include/datetime.php b/include/datetime.php
index 59dad2045..346d03bd4 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -14,25 +14,17 @@ function timezone_cmp($a, $b) {
return ( t($a) < t($b)) ? -1 : 1;
}
-// emit a timezone selector grouped (primarily) by continent
-
-function select_timezone($current = 'America/Los_Angeles') {
-
+// Return timezones grouped (primarily) by continent
+function get_timezones( ){
$timezone_identifiers = DateTimeZone::listIdentifiers();
-
- $o ='<select id="timezone_select" name="timezone">';
usort($timezone_identifiers, 'timezone_cmp');
$continent = '';
+ $continents = array();
foreach($timezone_identifiers as $value) {
$ex = explode("/", $value);
if(count($ex) > 1) {
- if($ex[0] != $continent) {
- if($continent != '')
- $o .= '</optgroup>';
- $continent = $ex[0];
- $o .= '<optgroup label="' . t($continent) . '">';
- }
+ $continent = t($ex[0]);
if(count($ex) > 2)
$city = substr($value,strpos($value,'/')+1);
else
@@ -40,35 +32,14 @@ function select_timezone($current = 'America/Los_Angeles') {
}
else {
$city = $ex[0];
- if($continent != t('Miscellaneous')) {
- $o .= '</optgroup>';
- $continent = t('Miscellaneous');
- $o .= '<optgroup label="' . t($continent) . '">';
- }
+ $continent = t('Miscellaneous');
}
$city = str_replace('_', ' ', t($city));
- $selected = (($value == $current) ? " selected=\"selected\" " : "");
- $o .= "<option value=\"$value\" $selected >$city</option>";
- }
- $o .= '</optgroup></select>';
- return $o;
-}
-
-// return a select using 'field_select_raw' template, with timezones
-// groupped (primarily) by continent
-// arguments follow convetion as other field_* template array:
-// 'name', 'label', $value, 'help'
-function field_timezone($name='timezone', $label='', $current = 'America/Los_Angeles', $help){
- $options = select_timezone($current);
- $options = str_replace('<select id="timezone_select" name="timezone">','', $options);
- $options = str_replace('</select>','', $options);
-
- $tpl = get_markup_template('field_select_raw.tpl');
- return replace_macros($tpl, array(
- '$field' => array($name, $label, $current, $help, $options),
- ));
-
+ if(!x($continents,$ex[0])) $continents[$ex[0]] = array();
+ $continents[$continent][$value] = $city;
+ }
+ return $continents;
}
// General purpose date parse/convert function.
diff --git a/include/dir_fns.php b/include/dir_fns.php
index af6f78c01..371ee0fbc 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -55,13 +55,18 @@ function dir_sort_links() {
// Probably there's an easier way to do this
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal');
- $url = 'directory?';
- $tmp = $_REQUEST;
+ $url = 'directory?f=';
+
+ $tmp = array_merge($_GET,$_POST);
unset($tmp['order']);
+ unset($tmp['q']);
+ unset($tmp['f']);
$sorturl = $url . http_build_query($tmp);
- $tmp = $_REQUEST;
+ $tmp = array_merge($_GET,$_POST);
unset($tmp['pubforums']);
+ unset($tmp['q']);
+ unset($tmp['f']);
$forumsurl = $url . http_build_query($tmp);
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
diff --git a/include/enotify.php b/include/enotify.php
index f3eb80117..3fef3ba0a 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -357,9 +357,21 @@ function notification($params) {
// create notification entry in DB
+ $seen = 0;
+
+ // Mark some notifications as seen right away
+ // Note! The notification have to be created, because they are used to send emails
+ // So easiest solution to hide them from Notices is to mark them as seen right away.
+ // Another option would be to not add them to the DB, and change how emails are handled (probably would be better that way)
+ $always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
+ if(!$always_show_in_notices) {
+ if(($params['type'] == NOTIFY_WALL) || ($params['type'] == NOTIFY_MAIL) || ($params['type'] == NOTIFY_INTRO)) {
+ $seen = 1;
+ }
+ }
- $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,type,verb,otype)
- values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,'%s','%s')",
+ $r = q("insert into notify (hash,name,url,photo,date,aid,uid,link,parent,seen,type,verb,otype)
+ values('%s','%s','%s','%s','%s',%d,%d,'%s','%s',%d,%d,'%s','%s')",
dbesc($datarray['hash']),
dbesc($datarray['name']),
dbesc($datarray['url']),
@@ -369,6 +381,7 @@ function notification($params) {
intval($datarray['uid']),
dbesc($datarray['link']),
dbesc($datarray['parent']),
+ intval($seen),
intval($datarray['type']),
dbesc($datarray['verb']),
dbesc($datarray['otype'])
diff --git a/include/features.php b/include/features.php
index 7009b1d6b..1a4b2654f 100644
--- a/include/features.php
+++ b/include/features.php
@@ -7,13 +7,28 @@
function feature_enabled($uid,$feature) {
$x = get_pconfig($uid,'feature',$feature);
- if($x === false)
+ 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);
return($arr['enabled']);
}
+function get_feature_default($feature) {
+ $f = get_features();
+ foreach($f as $cat) {
+ foreach($cat as $feat) {
+ if(is_array($feat) && $feat[0] === $feature)
+ return $feat[3];
+ }
+ }
+ return false;
+}
+
+
function get_features() {
$arr = array(
@@ -22,58 +37,52 @@ function get_features() {
'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')),
- array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
- array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections')),
- array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels')),
- array('webpages', t('Web Pages'), t('Provide managed web pages on your channel')),
- array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders')),
-// prettyphoto has licensing issues and will no longer be provided in core -
-// in any event this setting should probably be a theme option or plugin
-// array('prettyphoto', t('Enhanced Photo Albums'), t('Enable photo album with enhanced features')),
- array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu')),
+ 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),
//FIXME - needs a description, but how the hell do we explain this to normals?
- array('sendzid', t('Extended Identity Sharing'), t('Share your identity with all websites on the internet. When disabled, identity is only shared with sites in the matrix.')),
- array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options')),
- array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel')),
+ array('sendzid', t('Extended Identity Sharing'), t('Share your identity with all websites on the internet. When disabled, identity is only shared with sites in the matrix.'),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),
),
// Post composition
'composition' => array(
t('Post Composition Features'),
-// array('richtext', t('Richtext Editor'), t('Enable richtext editor')),
- array('markdown', t('Use Markdown'), t('Allow use of "Markdown" to format posts')),
-// array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')),
- array('channel_sources', t('Channel Sources'), t('Automatically import channel content from other channels or feeds')),
- array('content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key')),
- array('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view')),
+// 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('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('adult_photo_flagging', t('Flag Adult Photos'), t('Provide photo edit option to hide adult photos from default album view'),false),
),
// Network Tools
'net_module' => array(
t('Network and Stream Filtering'),
- array('archives', t('Search by Date'), t('Ability to select posts by date ranges')),
- array('groups', t('Collections Filter'), t('Enable widget to display Network posts only from selected collections')),
- array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
- array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on')),
- array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity')),
- array('affinity', t('Affinity Tool'), t('Filter stream activity by depth of relationships')),
- array('suggest', t('Suggest Channels'), t('Show channel suggestions')),
+ 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('suggest', t('Suggest Channels'), t('Show channel suggestions'),false),
),
// Item tools
'tools' => array(
t('Post/Comment Tools'),
-// array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once')),
-// array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending')),
- array('commtag', t('Tagging'), t('Ability to tag existing posts')),
- array('categories', t('Post Categories'), t('Add categories to your posts')),
- array('filing', t('Saved Folders'), t('Ability to file posts under folders')),
- array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments')),
- array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator')),
- array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your channel page')),
+ 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),
),
);
diff --git a/include/identity.php b/include/identity.php
index 1b761d768..2f400520f 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -856,7 +856,8 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
);
- if(feature_enabled(local_user(),'multi_profiles')) {
+ $multi_profiles = feature_enabled(local_user(), 'multi_profiles');
+ if($multi_profiles) {
$profile['edit'] = array($a->get_baseurl(). '/profiles', t('Profiles'),"", t('Manage/edit profiles'));
$profile['menu']['cr_new'] = t('Create New Profile');
}
@@ -869,6 +870,8 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
if($r) {
foreach($r as $rr) {
+ if(!($multi_profiles || $rr['is_default']))
+ continue;
$profile['menu']['entries'][] = array(
'photo' => $rr['thumb'],
'id' => $rr['id'],
diff --git a/include/items.php b/include/items.php
index c488e1953..e7cc15878 100755
--- a/include/items.php
+++ b/include/items.php
@@ -835,7 +835,9 @@ function get_item_elements($x) {
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
- $arr['item_restrict'] = ITEM_DELETED;
+ $arr['item_restrict'] = ITEM_DELETED;
+ if(array_key_exists('flags',$x) && in_array('hidden',$x['flags']))
+ $arr['item_restrict'] = ITEM_HIDDEN;
// Here's the deal - the site might be down or whatever but if there's a new person you've never
// seen before sending stuff to your stream, we MUST be able to look them up and import their data from their
@@ -1306,6 +1308,8 @@ function encode_item_flags($item) {
if($item['item_restrict'] & ITEM_DELETED)
$ret[] = 'deleted';
+ if($item['item_restrict'] & ITEM_HIDDEN)
+ $ret[] = 'hidden';
if($item['item_flags'] & ITEM_THREAD_TOP)
$ret[] = 'thread_parent';
if($item['item_flags'] & ITEM_NSFW)
@@ -3183,7 +3187,7 @@ function mail_store($arr) {
$arr['account_id'] = ((x($arr,'account_id')) ? intval($arr['account_id']) : 0);
$arr['mid'] = ((x($arr,'mid')) ? notags(trim($arr['mid'])) : random_string());
$arr['from_xchan'] = ((x($arr,'from_xchan')) ? notags(trim($arr['from_xchan'])) : '');
- $arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_xchan'])) : '');
+ $arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
$arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
diff --git a/include/language.php b/include/language.php
index 9db57dceb..f5ee3471e 100644
--- a/include/language.php
+++ b/include/language.php
@@ -250,8 +250,7 @@ function detect_language($s) {
* By default we use the localized language name. You can switch the result
* to any language with the optional 2nd parameter $l.
*
- * $s and $l can be in any format that PHP's Locale understands. We will mostly
- * use the 2-letter ISO 639-1 (en, de, fr) format.
+ * $s and $l should be in 2-letter ISO 639-1 format
*
* If nothing could be looked up it returns $s.
*
@@ -259,11 +258,30 @@ function detect_language($s) {
* @param $l (optional) In which language to return the name
* @return string with the language name, or $s if unrecognized
*/
+require_once(__DIR__ . '/../library/intl/vendor/autoload.php');
+use CommerceGuys\Intl\Language\LanguageRepository;
function get_language_name($s, $l = null) {
- if($l === null)
- $l = $s;
+ // get() expects the second part to be in upper case
+ if(strpos($s,'-') !== false) $s = substr($s,0,2) . strtoupper(substr($s,2));
+ if($l !== null && strpos($l,'-') !== false) $l = substr($l,0,2) . strtoupper(substr($l,2));
- logger('get_language_name: for ' . $s . ' in ' . $l . ' returns: ' . Locale::getDisplayLanguage($s, $l), LOGGER_DEBUG);
- return Locale::getDisplayLanguage($s, $l);
+ $languageRepository = new LanguageRepository;
+
+ // Sometimes intl doesn't like the second part at all ...
+ try {
+ $language = $languageRepository->get($s, $l);
+ }
+ catch(CommerceGuys\Intl\Exception\UnknownLanguageException $e) {
+ $s = substr($s,0,2);
+ if($l !== null) $l = substr($s,0,2);
+ try {
+ $language = $languageRepository->get($s, $l);
+ }
+ catch(CommerceGuys\Intl\Exception\UnknownLanguageException $e) {
+ return $s; // Give up
+ }
+ }
+
+ return $language->getName();
}
diff --git a/include/nav.php b/include/nav.php
index a9bff4b29..a567f83c5 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -15,15 +15,7 @@ function nav(&$a) {
$a->page['htmlhead'] .= <<< EOT
<script>$(document).ready(function() {
- var a;
- a = $("#nav-search-text").autocomplete({
- serviceUrl: '$base/acl',
- minChars: 2,
- width: 250,
- id: 'nav-search-text-ac',
- });
- a.setOptions({ autoSubmit: true, params: { type: 'x' }});
-
+ $("#nav-search-text").search_autocomplete('$base/acl');
});
</script>
diff --git a/include/network.php b/include/network.php
index 98c411cd8..170b77d7d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -384,7 +384,7 @@ function validate_url(&$url) {
$url = 'http://' . $url;
$h = @parse_url($url);
- if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
+ if(($h) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
return true;
}
return false;
@@ -402,7 +402,7 @@ function validate_email($addr) {
return false;
$h = substr($addr,strpos($addr,'@') + 1);
- if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
+ if(($h) && (@dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) {
return true;
}
return false;
diff --git a/include/notifier.php b/include/notifier.php
index e1eb0c554..06ef7bc94 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -165,6 +165,7 @@ function notifier_run($argv, $argc){
}
xchan_mail_query($message[0]);
$uid = $message[0]['channel_id'];
+ $recipients[] = $message[0]['from_xchan']; // include clones
$recipients[] = $message[0]['to_xchan'];
$item = $message[0];
diff --git a/include/permissions.php b/include/permissions.php
index 9e60223fb..ccbde1a7c 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -800,38 +800,18 @@ function get_role_perms($role) {
}
/**
- * @brief Creates a HTML select field with all available roles.
+ * @brief Returns a list or roles, grouped by type
*
* @param string $current The current role
- * @return string Returns the complete HTML code for this privacy-role-select field.
+ * @return string Returns an array of roles, grouped by type
*/
-function role_selector($current) {
-
- if(! $current)
- $current = 'custom';
-
+function get_roles() {
$roles = array(
- 'social' => array( t('Social Networking'),
- array('social' => t('Mostly Public'), 'social_restricted' => t('Restricted'), 'social_private' => t('Private'))),
- 'forum' => array( t('Community Forum'),
- array('forum' => t('Mostly Public'), 'forum_restricted' => t('Restricted'), 'forum_private' => t('Private'))),
- 'feed' => array( t('Feed Republish'),
- array('feed' => t('Mostly Public'), 'feed_restricted' => t('Restricted'))),
- 'special' => array( t('Special Purpose'),
- array('soapbox' => t('Celebrity/Soapbox'), 'repository' => t('Group Repository'))),
- 'other' => array( t('Other'),
- array('custom' => t('Custom/Expert Mode'))));
-
- $o = '<select name="permissions_role" id="privacy-role-select">';
- foreach($roles as $k => $v) {
- $o .= '<optgroup label="'. htmlspecialchars($v[0]) . '">';
- foreach($v[1] as $kk => $vv) {
- $selected = (($kk === $current) ? ' selected="selected"' : '');
- $o .= '<option value="' . $kk . '"' . $selected . '>' . htmlspecialchars($vv) . '</option>';
- }
- $o .= '</optgroup>';
- }
- $o .= '</select>';
+ t('Social Networking') => array('social' => t('Mostly Public'), 'social_restricted' => t('Restricted'), 'social_private' => t('Private')),
+ t('Community Forum') => array('forum' => t('Mostly Public'), 'forum_restricted' => t('Restricted'), 'forum_private' => t('Private')),
+ t('Feed Republish') => array('feed' => t('Mostly Public'), 'feed_restricted' => t('Restricted')),
+ t('Special Purpose') => array('soapbox' => t('Celebrity/Soapbox'), 'repository' => t('Group Repository')),
+ t('Other') => array('custom' => t('Custom/Expert Mode')));
- return $o;
+ return $roles;
}
diff --git a/include/plugin.php b/include/plugin.php
index e500ccc56..08decc8e3 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -472,6 +472,8 @@ function script_path() {
$scheme = 'https';
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
$scheme = 'https';
+ elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
+ $scheme = 'https';
else
$scheme = 'http';
diff --git a/include/text.php b/include/text.php
index cd34fd88d..e0bf393e5 100644
--- a/include/text.php
+++ b/include/text.php
@@ -6,8 +6,8 @@ require_once("include/smarty.php");
/**
* This is our template processor
- *
- * @param string|FriendicaSmarty $s the string requiring macro substitution,
+ *
+ * @param string|FriendicaSmarty $s the string requiring macro substitution,
* or an instance of FriendicaSmarty
* @param array $r key value pairs (search => replace)
* @return string substituted string
@@ -17,10 +17,10 @@ function replace_macros($s,$r) {
$arr = array('template' => $s, 'params' => $r);
call_hooks('replace_macros', $arr);
-
+
$t = $a->template_engine();
$output = $t->replace_macros($arr['template'],$arr['params']);
-
+
return $output;
}
@@ -40,7 +40,7 @@ function random_string($size = 64,$type = RANDOM_STRING_HEX) {
}
/**
- * This is our primary input filter.
+ * This is our primary input filter.
*
* The high bit hack only involved some old IE browser, forget which (IE5/Mac?)
* that had an XSS attack vector due to stripping the high-bit on an 8-bit character
@@ -105,7 +105,7 @@ function z_input_filter($channel_id,$s,$type = 'text/bbcode') {
return purify_html($s);
return escape_tags($s);
-
+
}
@@ -316,23 +316,23 @@ function paginate(&$a) {
if($a->pager['total'] > $a->pager['itemspage']) {
$o .= '<div class="pager">';
- if($a->pager['page'] != 1)
+ if($a->pager['page'] != 1)
$o .= '<span class="pager_prev">'."<a href=\"$url".'&page='.($a->pager['page'] - 1).'">' . t('prev') . '</a></span> ';
$o .= "<span class=\"pager_first\"><a href=\"$url"."&page=1\">" . t('first') . "</a></span> ";
- $numpages = $a->pager['total'] / $a->pager['itemspage'];
+ $numpages = $a->pager['total'] / $a->pager['itemspage'];
$numstart = 1;
- $numstop = $numpages;
+ $numstop = $numpages;
- if($numpages > 14) {
- $numstart = (($pagenum > 7) ? ($pagenum - 7) : 1);
- $numstop = (($pagenum > ($numpages - 7)) ? $numpages : ($numstart + 14));
- }
+ if($numpages > 14) {
+ $numstart = (($pagenum > 7) ? ($pagenum - 7) : 1);
+ $numstop = (($pagenum > ($numpages - 7)) ? $numpages : ($numstart + 14));
+ }
for($i = $numstart; $i <= $numstop; $i++){
- if($i == $a->pager['page'])
+ if($i == $a->pager['page'])
$o .= '<span class="pager_current">'.(($i < 10) ? '&nbsp;'.$i : $i);
else
$o .= "<span class=\"pager_n\"><a href=\"$url"."&page=$i\">".(($i < 10) ? '&nbsp;'.$i : $i)."</a>";
@@ -350,7 +350,7 @@ function paginate(&$a) {
$lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);
$o .= "<span class=\"pager_last\"><a href=\"$url"."&page=$lastpage\">" . t('last') . "</a></span> ";
- if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0)
+ if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0)
$o .= '<span class="pager_next">'."<a href=\"$url"."&page=".($a->pager['page'] + 1).'">' . t('next') . '</a></span>';
$o .= '</div>'."\r\n";
}
@@ -1629,7 +1629,7 @@ function lang_selector() {
$ll = substr($l,5);
$ll = substr($ll,0,strrpos($ll,'/'));
$selected = (($ll === $a->language && (x($_SESSION, 'language'))) ? $ll : $selected);
- $lang_options[$ll]=$ll;
+ $lang_options[$ll] = get_language_name($ll, $ll) . " ($ll)";
}
}
@@ -2207,10 +2207,10 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
if(strrpos($newname,'+')) {
//get the id
+ $tagcid = substr($newname,strrpos($newname,'+') + 1);
+
if(strrpos($tagcid,' '))
$tagcid = substr($tagcid,0,strrpos($tagcid,' '));
-
- $tagcid = substr($newname,strrpos($newname,'+') + 1);
if(strlen($tagcid) < 16)
$abook_id = intval($tagcid);
diff --git a/include/widgets.php b/include/widgets.php
index bb9890add..18778ed36 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -421,7 +421,7 @@ function widget_affinity($arr) {
if(feature_enabled(local_user(),'affinity')) {
$tpl = get_markup_template('main_slider.tpl');
$x = replace_macros($tpl,array(
- '$val' => $cmin . ';' . $cmax,
+ '$val' => $cmin . ',' . $cmax,
'$refresh' => t('Refresh'),
'$me' => t('Me'),
'$intimate' => t('Best Friends'),
diff --git a/include/zot.php b/include/zot.php
index c88b2a369..384769d61 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1542,15 +1542,20 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
continue;
}
- $r = q("select id, edited, item_flags, mid, parent_mid from item where mid = '%s' and uid = %d limit 1",
+ $r = q("select id, edited, item_restrict, item_flags, mid, parent_mid from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['mid']),
intval($channel['channel_id'])
);
if($r) {
// We already have this post.
- // Maybe it has been edited?
$item_id = $r[0]['id'];
- if($arr['edited'] > $r[0]['edited']) {
+ if($r[0]['item_restrict'] & ITEM_DELETED) {
+ // It was deleted locally.
+ $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
+ continue;
+ }
+ // Maybe it has been edited?
+ elseif($arr['edited'] > $r[0]['edited']) {
$arr['id'] = $r[0]['id'];
$arr['uid'] = $channel['channel_id'];
update_imported_item($sender,$arr,$channel['channel_id']);
@@ -2363,6 +2368,9 @@ 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);
+
if(! $uid)
$uid = local_user();