From 426ac22e127b21a4598364f89c6f2eb712ed1f2e Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 28 Dec 2014 09:26:30 +0100 Subject: Redirect to login page on failed login. Fixes #628 --- include/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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 -- cgit v1.2.3 From f08ee3bab9810ce4dd8386ef6a08baf15ee1aded Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 28 Dec 2014 11:22:58 +0100 Subject: Make spaces work in [audio] and [video]. Fixes #774 --- include/bbcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index 9445eb007..dbb0187f8 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 ''; + return ''; } function tryzrlvideo($match) { @@ -30,7 +30,7 @@ function tryzrlvideo($match) { $zrl = is_matrix_url($link); if($zrl) $link = zid($link); - return ''; + return ''; } -- cgit v1.2.3 From fffc7dffbac6a335afb175525313069e0b21a388 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 28 Dec 2014 11:28:54 +0100 Subject: Fix typo --- include/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index dbb0187f8..ab56bda61 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -30,7 +30,7 @@ function tryzrlvideo($match) { $zrl = is_matrix_url($link); if($zrl) $link = zid($link); - return ''; + return ''; } -- cgit v1.2.3 From 8e034a3b6b67a9aaa20fe9db671350e198fe7c42 Mon Sep 17 00:00:00 2001 From: marijus Date: Tue, 30 Dec 2014 13:56:27 +0100 Subject: fix recursive file permissions --- include/attach.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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); } } } -- cgit v1.2.3 From e6a3ea2c95579a33a5c009aa223a899c8f2aeeb8 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 15:27:33 +0100 Subject: Make showing wall posts, intros and private messages under Notices optional --- include/enotify.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') 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']) -- cgit v1.2.3 From 9cab8ae58a29ecf7387e6865aa170715caeabf04 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 19:57:12 +0100 Subject: Language names via intl library. Fixes #773 --- include/language.php | 22 ++++++++++++++++++---- include/text.php | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index 9db57dceb..0db5ec86e 100644 --- a/include/language.php +++ b/include/language.php @@ -259,11 +259,25 @@ 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); + $language = $languageRepository->get($s, $l); + } + + return $language->getName(); } diff --git a/include/text.php b/include/text.php index cd34fd88d..ca9c51bc3 100644 --- a/include/text.php +++ b/include/text.php @@ -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)"; } } -- cgit v1.2.3 From b54bbf0fb8af72bd5273597f564f084aa1c1ac79 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 20:34:26 +0100 Subject: Update function doc, return language code if language is not recognized --- include/language.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index 0db5ec86e..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. * @@ -275,7 +274,12 @@ function get_language_name($s, $l = null) { catch(CommerceGuys\Intl\Exception\UnknownLanguageException $e) { $s = substr($s,0,2); if($l !== null) $l = substr($s,0,2); - $language = $languageRepository->get($s, $l); + try { + $language = $languageRepository->get($s, $l); + } + catch(CommerceGuys\Intl\Exception\UnknownLanguageException $e) { + return $s; // Give up + } } return $language->getName(); -- cgit v1.2.3 From 4edc9a696bf0b7d84f2f7d8caa1b5d95902cf09f Mon Sep 17 00:00:00 2001 From: marijus Date: Tue, 30 Dec 2014 21:04:48 +0100 Subject: design fixes for photos, files and random fixes --- include/RedDAV/RedBrowser.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') 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'; -- cgit v1.2.3 From 2444a3f9d9eb3ec45b5a5d337f4a23e0c5a96774 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 21:33:20 +0100 Subject: Don't show links to edit alternate profiles if multi_profiles is disabled --- include/identity.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/identity.php b/include/identity.php index 7ae8e48f6..17238ea99 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'], -- cgit v1.2.3 From 4f35efa0bad4ae6489b63f3eebafe6542d654094 Mon Sep 17 00:00:00 2001 From: RedMatrix Date: Wed, 31 Dec 2014 10:43:19 +1100 Subject: Revert "Language names via intl library." --- include/language.php | 30 ++++++------------------------ include/text.php | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/language.php b/include/language.php index f5ee3471e..9db57dceb 100644 --- a/include/language.php +++ b/include/language.php @@ -250,7 +250,8 @@ 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 should be in 2-letter ISO 639-1 format + * $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. * * If nothing could be looked up it returns $s. * @@ -258,30 +259,11 @@ 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) { - // 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)); + if($l === null) + $l = $s; - $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(); + logger('get_language_name: for ' . $s . ' in ' . $l . ' returns: ' . Locale::getDisplayLanguage($s, $l), LOGGER_DEBUG); + return Locale::getDisplayLanguage($s, $l); } diff --git a/include/text.php b/include/text.php index ca9c51bc3..cd34fd88d 100644 --- a/include/text.php +++ b/include/text.php @@ -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] = get_language_name($ll, $ll) . " ($ll)"; + $lang_options[$ll]=$ll; } } -- cgit v1.2.3 From 7bf7f8180dbc3a89824815de3bc1e4f40857d2f6 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Wed, 31 Dec 2014 10:42:08 +0100 Subject: Revert "Revert "Language names via intl library."" This reverts commit 4f35efa0bad4ae6489b63f3eebafe6542d654094. --- include/language.php | 30 ++++++++++++++++++++++++------ include/text.php | 2 +- 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'include') 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/text.php b/include/text.php index cd34fd88d..ca9c51bc3 100644 --- a/include/text.php +++ b/include/text.php @@ -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)"; } } -- cgit v1.2.3 From 686b6ee1182c09969e2817b53825a78975c75bf5 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Thu, 1 Jan 2015 14:44:50 +0100 Subject: Use grouped select field for timezone selection --- include/datetime.php | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) (limited to 'include') 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 =''; - 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('','', $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. -- cgit v1.2.3 From 85e76773a04995884e798a89cc285f48377bcb62 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Thu, 1 Jan 2015 15:54:16 +0100 Subject: Use grouped select field for role selection --- include/permissions.php | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'include') 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 = ''; + 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; } -- cgit v1.2.3 From 128b0008eef797050cf5146fb1dd69505c4439d4 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Mon, 5 Jan 2015 18:30:12 +0100 Subject: Replace jslider with jRange --- include/widgets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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'), -- cgit v1.2.3 From 3185bfe3ca131d471b8fcdc0c94abf1a114486c7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 5 Jan 2015 16:12:55 -0800 Subject: detect https coming through reverse proxy or load balancer using x-forwarded-proto instead of (actually in addition to testing) $_SERVER['HTTPS'] and/or $_SERVER['SERVER_PORT'] to indicate ssl is enabled --- include/plugin.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') 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'; -- cgit v1.2.3 From 43f43d78cf9dba9a4c8b9ac1e54484901b3a7bcd Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 5 Jan 2015 20:57:30 -0800 Subject: regression: need float clear on manage page so footer doesn't end up floated, add default value to features so that features can be created that are default enabled, or modified later to default enabled without requiring a system config to accomplish this. --- include/features.php | 79 +++++++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 35 deletions(-) (limited to 'include') 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), ), ); -- cgit v1.2.3 From fac6963444fbaf1e776e35b1e283a080f1a24a43 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 6 Jan 2015 14:00:31 +0100 Subject: Add title to bb_observer tags to further clarify a bit what's going on --- include/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/bbcode.php b/include/bbcode.php index ab56bda61..030a1fb49 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -437,7 +437,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // replace [observer.baseurl] if ($observer) { - $s1 = ''; + $s1 = ''; $s2 = ''; $obsBaseURL = $observer['xchan_connurl']; $obsBaseURL = preg_replace("/\/poco\/.*$/", '', $obsBaseURL); -- cgit v1.2.3 From 1cfff44535678276d83ded807e5c1c7e7c6f18b1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 6 Jan 2015 13:42:55 -0800 Subject: lines reversed in handle_tag() --- include/text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index ca9c51bc3..edcd087a6 100644 --- a/include/text.php +++ b/include/text.php @@ -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); -- cgit v1.2.3 From 4b9ed48a54313f931e000bf649b890aa34429780 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 6 Jan 2015 14:50:29 -0800 Subject: don't let dns_get_record() "write to screen" if it errors. --- include/network.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') 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; -- cgit v1.2.3 From fbe0610ce9a4ef62da8aba166250485f56e73d03 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 6 Jan 2015 15:44:23 -0800 Subject: don't update locally deleted items --- include/zot.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index c88b2a369..c21ad8a3f 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']); -- cgit v1.2.3 From 34ecbcceea9ae6399f50c6e8718a9f84345136b9 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Wed, 7 Jan 2015 19:39:50 +0100 Subject: Make nav search use textcomplete --- include/nav.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'include') 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 -- cgit v1.2.3 From ce953e2f41c2bf8abdda2584dd84c2bd0175f609 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 7 Jan 2015 14:35:03 -0800 Subject: syncing connections issue, incorrect return_url after deleting connection --- include/Contact.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') 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", -- cgit v1.2.3 From aa490a39bb32aed4f8ea4ffcf7134b900d245b5c Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 Jan 2015 16:02:15 -0800 Subject: include channel clones in PM deliveries (also some whitespace edits) --- include/items.php | 2 +- include/notifier.php | 1 + include/text.php | 30 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index c488e1953..e2534528a 100755 --- a/include/items.php +++ b/include/items.php @@ -3183,7 +3183,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/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/text.php b/include/text.php index edcd087a6..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 .= '
'; - if($a->pager['page'] != 1) + if($a->pager['page'] != 1) $o .= ''."pager['page'] - 1).'">' . t('prev') . ' '; $o .= "" . t('first') . " "; - $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 .= ''.(($i < 10) ? ' '.$i : $i); else $o .= "".(($i < 10) ? ' '.$i : $i).""; @@ -350,7 +350,7 @@ function paginate(&$a) { $lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages); $o .= "" . t('last') . " "; - if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0) + if(($a->pager['total'] - ($a->pager['itemspage'] * $a->pager['page'])) > 0) $o .= ''."pager['page'] + 1).'">' . t('next') . ''; $o .= '
'."\r\n"; } -- cgit v1.2.3 From 1e4e7ce2d3c28331d408ad0e40ab0e3bb912e7f1 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 Jan 2015 19:09:52 -0800 Subject: SECURITY: dir_sort_links() exposes session cookie --- include/dir_fns.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/dir_fns.php b/include/dir_fns.php index af6f78c01..98b906e84 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -56,10 +56,10 @@ function dir_sort_links() { $current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal'); $url = 'directory?'; - $tmp = $_REQUEST; + $tmp = array_merge($_GET,$_POST); unset($tmp['order']); $sorturl = $url . http_build_query($tmp); - $tmp = $_REQUEST; + $tmp = array_merge($_GET,$_POST); unset($tmp['pubforums']); $forumsurl = $url . http_build_query($tmp); -- cgit v1.2.3 From af943f45692a37c570ca4a4ef450f897b3065a90 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 Jan 2015 19:13:13 -0800 Subject: double q argument could also cause issues --- include/dir_fns.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/dir_fns.php b/include/dir_fns.php index 98b906e84..0cbe2daec 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -56,12 +56,15 @@ function dir_sort_links() { $current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal'); $url = 'directory?'; + $tmp = array_merge($_GET,$_POST); unset($tmp['order']); + unset($tmp['q']); $sorturl = $url . http_build_query($tmp); - $tmp = array_merge($_GET,$_POST); + $tmp = array_merge($_GET,$_POST); unset($tmp['pubforums']); + unset($tmp['q']); $forumsurl = $url . http_build_query($tmp); $o = replace_macros(get_markup_template('dir_sort_links.tpl'), array( -- cgit v1.2.3 From 1b535ff8a5762604ae96d0ad00488738090c083b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 Jan 2015 19:20:50 -0800 Subject: clean up some url anomalies in dir_sort_links after security fix --- include/dir_fns.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/dir_fns.php b/include/dir_fns.php index 0cbe2daec..371ee0fbc 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -55,16 +55,18 @@ function dir_sort_links() { // Probably there's an easier way to do this $current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'normal'); - $url = 'directory?'; + $url = 'directory?f='; $tmp = array_merge($_GET,$_POST); unset($tmp['order']); unset($tmp['q']); + unset($tmp['f']); $sorturl = $url . http_build_query($tmp); $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( -- cgit v1.2.3 From 978d78b95310adad1075d525babfa566c81876f5 Mon Sep 17 00:00:00 2001 From: marijus Date: Fri, 9 Jan 2015 15:18:45 +0100 Subject: basic changes for file activity --- include/conversation.php | 1 + include/items.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include') 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/items.php b/include/items.php index e2534528a..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) -- cgit v1.2.3 From 10102ac2ac4d5b02012a9794e23656717ab05556 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 10 Jan 2015 14:59:10 -0800 Subject: connection clone issues --- include/zot.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index c21ad8a3f..384769d61 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2368,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(); -- cgit v1.2.3