diff --git a/boot.php b/boot.php
index 875e5369ed..20c243c240 100644
--- a/boot.php
+++ b/boot.php
@@ -412,6 +412,7 @@ if(! class_exists('App')) {
public $videoheight = 350;
public $force_max_items = 0;
public $theme_thread_allow = true;
+ public $theme_events_in_profile = true;
// An array for all theme-controllable parameters
// Mostly unimplemented yet. Only options 'stylesheet' and
@@ -1661,7 +1662,7 @@ if(! function_exists('load_contact_links')) {
if(! $uid || x($a->contacts,'empty'))
return;
- $r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
+ $r = q("SELECT `id`,`network`,`url`,`thumb`, `rel` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''",
intval($uid)
);
if(count($r)) {
diff --git a/doc/Home.md b/doc/Home.md
index ff991e3d2a..11b1f9e159 100644
--- a/doc/Home.md
+++ b/doc/Home.md
@@ -33,6 +33,7 @@ Friendica Documentation and Resources
* [Message Flow](help/Message-Flow)
* [Using SSL with Friendica](help/SSL)
* [Twitter/GNU Social API Functions](help/api)
+* [Config values that can only be set in .htconfig.php](help/htconfig)
**Developer Manual**
diff --git a/doc/de/Home.md b/doc/de/Home.md
index 561809d6ce..a101b5f734 100644
--- a/doc/de/Home.md
+++ b/doc/de/Home.md
@@ -37,6 +37,7 @@ Friendica - Dokumentation und Ressourcen
* [Entwickler](help/Developers)
* [Twitter/GNU Social API Functions](help/api) (EN)
* [Translation of Friendica](help/translations) (EN)
+* [Konfigurationswerte, die nur in der .htconfig.php gesetzt werden können](help/htconfig) (EN)
**Entwickler Dokumentation**
diff --git a/doc/htconfig.md b/doc/htconfig.md
new file mode 100644
index 0000000000..5d98f55a76
--- /dev/null
+++ b/doc/htconfig.md
@@ -0,0 +1,79 @@
+Config values that can only be set in .htconfig.php
+===================================================
+
+There are some config values that haven't found their way into the administration page. This has several reasons. Maybe they are part of a
+current development that isn't considered stable and will be added later in the administration page when it is considered safe. Or it triggers
+something that isn't expected to be of public interest. Or it is for testing purposes only.
+
+**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger. Especially don't do that with
+undocumented values.
+
+The header of the section describes the category, the value is the parameter. Example: To set the directory value please add this
+line to your .htconfig.php:
+
+ $a->config['system']['directory'] = 'http://dir.friendi.ca';
+
+
+
+## Jabber ##
+* debug (Boolean) - Enable debug level for the jabber account synchronisation.
+* logfile - Logfile for the jabber account synchronisation.
+
+## System ##
+
+* birthday_input_format - Default value is "ymd".
+* block_local_dir (Boolean) - Blocks the access to the directory of the local users.
+* default_service_class -
+* delivery_batch_count - Number of deliveries per process. Default value is 1. (Disabled when using the worker)
+* diaspora_test (Boolean) - For development only. Disables the message transfer.
+* directory - The path to global directory. If not set then "http://dir.friendi.ca" is used.
+* disable_email_validation (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
+* disable_url_validation (Boolean) - Disables the DNS lookup of an URL.
+* event_input_format - Default value is "ymd".
+* ignore_cache (Boolean) - For development only. Disables the item cache.
+* like_no_comment (Boolean) - Don't update the "commented" value of an item when it is liked.
+* local_block (Boolean) - Used in conjunction with "block_public".
+* local_search (Boolean) - Blocks the search for not logged in users to prevent crawlers from blocking your system.
+* max_contact_queue - Default value is 500.
+* max_batch_queue - Default value is 1000.
+* no_oembed (Boolean) - Don't use OEmbed to fetch more information about a link.
+* no_oembed_rich_content (Boolean) - Don't show the rich content (e.g. embedded PDF).
+* no_smilies (Boolean) - Don't show smilies.
+* no_view_full_size (Boolean) - Don't add the link "View full size" under a resized image.
+* optimize_items (Boolean) - Triggers an SQL command to optimize the item table before expiring items.
+* ostatus_poll_timeframe - Defines how old an item can be to try to complete the conversation with it.
+* paranoia (Boolean) - Log out users if their IP address changed.
+* permit_crawling (Boolean) - Restricts the search for not logged in users to one search per minute.
+* png_quality - Default value is 8.
+* proc_windows (Boolean) - Should be enabled if Friendica is running under Windows.
+* proxy_cache_time - Time after which the cache is cleared. Default value is one day.
+* pushpoll_frequency -
+* qsearch_limit - Default value is 100.
+* relay_server - Experimental Diaspora feature. Address of the relay server where public posts should be send to. For example https://podrelay.net
+* relay_subscribe (Boolean) - Enables the receiving of public posts from the relay. They will be included in the search and on the community page when it is set up to show all public items.
+* relay_scope - Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts witt selected tags should be received.
+* relay_server_tags - Comma separated list of tags for the "tags" subscription (see "relay_scrope")
+* relay_user_tags (Boolean) - If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".
+* remove_multiplicated_lines (Boolean) - If enabled, multiple linefeeds in items are stripped to a single one.
+* show_unsupported_addons (Boolean) - Show all addons including the unsupported ones.
+* show_unsupported_themes (Boolean) - Show all themes including the unsupported ones.
+* throttle_limit_day - Maximum number of posts that a user can send per day with the API.
+* throttle_limit_week - Maximum number of posts that a user can send per week with the API.
+* throttle_limit_month - Maximum number of posts that a user can send per month with the API.
+* wall-to-wall_share (Boolean) - Displays forwarded posts like "wall-to-wall" posts.
+* worker (Boolean) - (Experimental) Use the worker system instead of calling several background processes. Reduces the overall load and speeds up item delivery.
+* worker_dont_fork (Boolean) - if enabled, the workers are only called from the poller process. Useful on systems that permit the use of "proc_open".
+* worker_queues - Number of parallel workers. Default value is 10 queues.
+* xrd_timeout - Timeout for fetching the XRD links. Default value is 20 seconds.
+
+## service_class ##
+
+* upgrade_link -
+
+## experimentals ##
+
+* exp_themes (Boolean) - Show experimental themes as well.
+
+## theme ##
+
+* hide_eventlist (Boolean) - Don't show the birthdays and events on the profile and network page
diff --git a/include/Contact.php b/include/Contact.php
index 920ec3c2b4..e6ec8daade 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -219,17 +219,20 @@ function contact_photo_menu($contact) {
$status_link = $profile_link . "?url=status";
$photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile";
- $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
}
- $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
+ if (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA)))
+ $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
+
+ if ($contact["network"] == NETWORK_DFRN)
+ $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id'];
+
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
$posts_link = $a->get_baseurl() . '/network/0?nets=all&cid=' . $contact['id'];
$contact_drop_link = $a->get_baseurl() . "/contacts/" . $contact['id'] . '/drop?confirm=1';
$menu = Array(
- 'poke' => array(t("Poke"), $poke_link),
'status' => array(t("View Status"), $status_link),
'profile' => array(t("View Profile"), $profile_link),
'photos' => array(t("View Photos"), $photos_link),
@@ -237,6 +240,7 @@ function contact_photo_menu($contact) {
'edit' => array(t("Edit Contact"), $contact_url),
'drop' => array(t("Drop Contact"), $contact_drop_link),
'pm' => array(t("Send PM"), $pm_url),
+ 'poke' => array(t("Poke"), $poke_link),
);
@@ -254,6 +258,7 @@ function contact_photo_menu($contact) {
}
}
return $o;*/
+
foreach($menu as $k=>$v){
if ($v[1]!="") {
if(($v[0] !== t("Network Posts")) && ($v[0] !== t("Send PM")) && ($v[0] !== t('Edit Contact')))
@@ -262,7 +267,14 @@ function contact_photo_menu($contact) {
$menu[$k][2] = 0;
}
}
- return $menu;
+
+ $menucondensed = array();
+
+ foreach ($menu AS $menuitem)
+ if ($menuitem[1] != "")
+ $menucondensed[] = $menuitem;
+
+ return $menucondensed;
}}
diff --git a/include/Photo.php b/include/Photo.php
index 785601c7e4..9732801c9a 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -345,38 +345,37 @@ class Photo {
}
public function orient($filename) {
- if ($this->is_imagick()) {
- // based off comment on http://php.net/manual/en/imagick.getimageorientation.php
- $orientation = $this->image->getImageOrientation();
- switch ($orientation) {
- case imagick::ORIENTATION_BOTTOMRIGHT:
- $this->image->rotateimage("#000", 180);
- break;
- case imagick::ORIENTATION_RIGHTTOP:
- $this->image->rotateimage("#000", 90);
- break;
- case imagick::ORIENTATION_LEFTBOTTOM:
- $this->image->rotateimage("#000", -90);
- break;
- }
+ if ($this->is_imagick()) {
+ // based off comment on http://php.net/manual/en/imagick.getimageorientation.php
+ $orientation = $this->image->getImageOrientation();
+ switch ($orientation) {
+ case imagick::ORIENTATION_BOTTOMRIGHT:
+ $this->image->rotateimage("#000", 180);
+ break;
+ case imagick::ORIENTATION_RIGHTTOP:
+ $this->image->rotateimage("#000", 90);
+ break;
+ case imagick::ORIENTATION_LEFTBOTTOM:
+ $this->image->rotateimage("#000", -90);
+ break;
+ }
- $this->image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);
- return TRUE;
- }
+ $this->image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);
+ return TRUE;
+ }
// based off comment on http://php.net/manual/en/function.imagerotate.php
if(!$this->is_valid())
- return FALSE;
+ return FALSE;
if( (! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg') )
- return;
+ return;
- $exif = @exif_read_data($filename);
+ $exif = @exif_read_data($filename,null,true);
+ if(! $exif)
+ return;
- if(! $exif)
- return;
-
- $ort = $exif['Orientation'];
+ $ort = $exif['IFD0']['Orientation'];
switch($ort)
{
@@ -413,6 +412,10 @@ class Photo {
$this->rotate(90);
break;
}
+
+ // logger('exif: ' . print_r($exif,true));
+ return $exif;
+
}
diff --git a/include/Scrape.php b/include/Scrape.php
index 93d68be22b..0169f55fd5 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -552,7 +552,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
if($diaspora)
$network = NETWORK_DIASPORA;
- elseif($has_lrdd)
+ elseif($has_lrdd AND ($notify))
$network = NETWORK_OSTATUS;
if(strpos($url,'@'))
@@ -652,9 +652,10 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
$feed->set_raw_data(($xml) ? $xml : '
', $url, $image, $title);
+ $text .= sprintf('
', $url, proxy_url($image), $title);
elseif (($preview != "") AND !strstr(strtolower($oembed), "
', $url, $preview, $title);
+ $text .= sprintf('
', $url, proxy_url($preview), $title);
$text .= $oembed;
@@ -455,7 +471,7 @@ function bb_replace_images($body, $images) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '', $newbody);
$cnt++;
}
@@ -585,7 +601,7 @@ function bb_ShareAttributes($share, $simplehtml) {
default:
$headline = trim($share[1]).'
$2", $Text); + // [img=widthxheight]image source[/img] - //$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $Text); + $Text = preg_replace_callback("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", 'bb_PictureCacheExt', $Text); + $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $Text); $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '', $Text); // Images // [img]pathtoimage[/img] + $Text = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'bb_PictureCache', $Text); + $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '', $Text); $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '', $Text); diff --git a/include/conversation.php b/include/conversation.php index fd03f4b788..7417dbf812 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -217,7 +217,7 @@ function localize_item(&$item){ // we can't have a translation string with three positions but no distinguishable text // So here is the translate string. $txt = t('%1$s poked %2$s'); - + // now translate the verb $poked_t = trim(sprintf($txt, "","")); $txt = str_replace( $poked_t, t($verb), $txt); @@ -416,25 +416,25 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $page_writeable = true; if(!$update) { // The special div is needed for liveUpdate to kick in for this page. - // We only launch liveUpdate if you aren't filtering in some incompatible + // We only launch liveUpdate if you aren't filtering in some incompatible // way and also you aren't writing a comment (discovered in javascript). $live_update_div = '' . "\r\n" - . "\r\n"; } @@ -451,7 +451,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { // because browser prefetching might change it on us. We have to deliver it with the page. $live_update_div = '' . "\r\n" - . "\r\n"; } } @@ -461,7 +461,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $page_writeable = true; if(!$update) { $live_update_div = '' . "\r\n" - . "\r\n"; } } @@ -678,7 +678,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'name' => $profile_name_e, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => proxy_url($profile_avatar), + 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB), 'title' => $item['title_e'], 'body' => $body_e, 'tags' => $tags_e, @@ -697,7 +697,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, - 'owner_photo' => proxy_url($owner_photo), + 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, @@ -813,10 +813,16 @@ function best_link_url($item,&$sparkle,$ssl_state = false) { if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) { $best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id']; $sparkle = true; - } - else + } else $best_url = $a->contacts[$clean_url]['url']; } + } elseif (local_user()) { + $r = q("SELECT `id`, `network` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s'", + dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url))); + if ($r) { + $best_url = $a->get_baseurl($ssl_state).'/redir/'.$r[0]['id']; + $sparkle = true; + } } if(! $best_url) { if(strlen($item['author-link'])) @@ -869,9 +875,17 @@ function item_photo_menu($item){ $profile_link = zrl($profile_link); if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) { $cid = $item['contact-id']; - } - else { - $cid = 0; + } else { + $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1", + intval(local_user()), dbesc(normalise_link($item['author-link']))); + if ($r) { + $cid = $r[0]["id"]; + + if ($r[0]["network"] == NETWORK_DIASPORA) + $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid; + + } else + $cid = 0; } } if(($cid) && (! $item['self'])) { @@ -891,17 +905,25 @@ function item_photo_menu($item){ } - $menu = Array( - t("Follow Thread") => $sub_link, - t("View Status") => $status_link, - t("View Profile") => $profile_link, - t("View Photos") => $photos_link, - t("Network Posts") => $posts_link, - t("Edit Contact") => $contact_url, - t("Send PM") => $pm_url, - t("Poke") => $poke_link - ); + if (local_user()) { + $menu = Array( + t("Follow Thread") => $sub_link, + t("View Status") => $status_link, + t("View Profile") => $profile_link, + t("View Photos") => $photos_link, + t("Network Posts") => $posts_link, + t("Edit Contact") => $contact_url, + t("Send PM") => $pm_url + ); + if ($a->contacts[$clean_url]['network'] === NETWORK_DFRN) + $menu[t("Poke")] = $poke_link; + + if ((($cid == 0) OR ($a->contacts[$clean_url]['rel'] == CONTACT_IS_FOLLOWER)) AND + in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) + $menu[t("Connect/Follow")] = $a->get_baseurl($ssl_state)."/follow?url=".urlencode($item['author-link']); + } else + $menu = array(t("View Profile") => $item['author-link']); $args = array('item' => $item, 'menu' => $menu); diff --git a/include/diaspora.php b/include/diaspora.php index 3145c52ea3..757cf1a6ba 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -110,6 +110,9 @@ function diaspora_dispatch($importer,$msg,$attempt=1) { elseif($xmlbase->message) { $ret = diaspora_message($importer,$xmlbase->message,$msg); } + elseif($xmlbase->participation) { + $ret = diaspora_participation($importer,$xmlbase->participation); + } else { logger('diaspora_dispatch: unknown message type: ' . print_r($xmlbase,true)); } @@ -589,7 +592,7 @@ function diaspora_request($importer,$xml) { // perhaps we were already sharing with this person. Now they're sharing with us. // That makes us friends. - if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) { + if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) { q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d", intval(CONTACT_IS_FRIEND), intval($contact['id']), @@ -771,7 +774,7 @@ function diaspora_post_allow($importer,$contact, $is_comment = false) { // perhaps we were already sharing with this person. Now they're sharing with us. // That makes us friends. // Normally this should have handled by getting a request - but this could get lost - if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) { + if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) { q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d", intval(CONTACT_IS_FRIEND), intval($contact['id']), @@ -1834,7 +1837,7 @@ function diaspora_message($importer,$xml,$msg) { $author_signature = base64_decode($msg_author_signature); - $person = find_diaspora_person_by_handle($msg_diaspora_handle); + $person = find_diaspora_person_by_handle($msg_diaspora_handle); if(is_array($person) && x($person,'pubkey')) $key = $person['pubkey']; else { @@ -1881,6 +1884,9 @@ function diaspora_message($importer,$xml,$msg) { return; } +function diaspora_participation($importer,$xml) { + logger("Unsupported message type 'participation' ".print_r($xml, true)); +} function diaspora_photo($importer,$xml,$msg,$attempt=1) { diff --git a/include/features.php b/include/features.php index cc26141ac3..1307132a64 100644 --- a/include/features.php +++ b/include/features.php @@ -23,6 +23,7 @@ function get_features() { t('General Features'), //array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')), array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')), + array('photo_location', t('Photo Location'), t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'),false), ), // Post composition diff --git a/include/feed.php b/include/feed.php index 18d96e6abb..f11bb52a1b 100644 --- a/include/feed.php +++ b/include/feed.php @@ -106,9 +106,17 @@ function feed_import($xml,$importer,&$contact, &$hub) { $header["wall"] = 0; $header["origin"] = 0; $header["gravity"] = GRAVITY_PARENT; + $header["private"] = 2; + $header["verb"] = ACTIVITY_POST; + $header["object-type"] = ACTIVITY_OBJ_NOTE; $header["contact-id"] = $contact["id"]; + if(!strlen($contact["notify"])) { + // one way feed - no remote comment ability + $header["last-child"] = 0; + } + if (!is_object($entries)) return; @@ -193,8 +201,8 @@ function feed_import($xml,$importer,&$contact, &$hub) { //$item["object"] = $xml; - $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'", - intval($importer["uid"]), dbesc($item["uri"])); + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` = '%s'", + intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED)); if ($r) { logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG); continue; diff --git a/include/follow.php b/include/follow.php index ca0228cc0f..21c05c8f3e 100644 --- a/include/follow.php +++ b/include/follow.php @@ -154,11 +154,7 @@ function new_contact($uid,$url,$interactive = false) { $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0); - if($ret['network'] === NETWORK_MAIL) { - $writeable = 1; - - } - if($ret['network'] === NETWORK_DIASPORA) + if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) $writeable = 1; // check if we already have a contact @@ -215,9 +211,7 @@ function new_contact($uid,$url,$interactive = false) { return $result; } - $new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING); - if($ret['network'] === NETWORK_DIASPORA) - $new_relation = CONTACT_IS_FOLLOWER; + $new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING); // create contact record $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`, diff --git a/include/gprobe.php b/include/gprobe.php index 03cdbd072b..84292f263a 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -47,7 +47,7 @@ function gprobe_run(&$argv, &$argc){ $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { $result = unserialize($result); - if ($result["network"] == NETWORK_FEED) { + if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) { logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG); return; } diff --git a/include/identity.php b/include/identity.php index 0fba0c592f..6faddffd3c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -501,7 +501,7 @@ if(! function_exists('get_events')) { } $today = ((substr($strt,0,10) === datetime_convert('UTC',$a->timezone,'now','Y-m-d')) ? true : false); - + $rr['title'] = $title; $rr['description'] = $desciption; $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); @@ -533,21 +533,21 @@ function advanced_profile(&$a) { if($a->profile['name']) { $tpl = get_markup_template('profile_advanced.tpl'); - + $profile = array(); - + $profile['fullname'] = array( t('Full Name:'), $a->profile['name'] ) ; - + if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); - + if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { - + $year_bd_format = t('j F, Y'); $short_bd_format = t('j F'); - - $val = ((intval($a->profile['dob'])) + + $val = ((intval($a->profile['dob'])) ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],5) . ' 00:00 +00:00',$short_bd_format))); @@ -556,7 +556,7 @@ function advanced_profile(&$a) { } if($age = age($a->profile['dob'],$a->profile['timezone'],'')) $profile['age'] = array( t('Age:'), $age ); - + if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); @@ -591,7 +591,7 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); - + if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); @@ -599,14 +599,14 @@ function advanced_profile(&$a) { if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); - + if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); - + if ($a->profile['uid'] == local_user()) $profile['edit'] = array($a->get_baseurl(). '/profiles/'.$a->profile['id'], t('Edit profile'),"", t('Edit profile')); - + return replace_macros($tpl, array( '$title' => t('Profile'), '$profile' => $profile @@ -664,14 +664,15 @@ if(! function_exists('profile_tabs')){ ); if ($is_owner){ - $tabs[] = array( - 'label' => t('Events'), - 'url' => $a->get_baseurl() . '/events', - 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), - 'title' => t('Events and Calendar'), - 'id' => 'events-tab', - 'accesskey' => 'e', - ); + if ($a->theme_events_in_profile) + $tabs[] = array( + 'label' => t('Events'), + 'url' => $a->get_baseurl() . '/events', + 'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), + 'title' => t('Events and Calendar'), + 'id' => 'events-tab', + 'accesskey' => 'e', + ); $tabs[] = array( 'label' => t('Personal Notes'), 'url' => $a->get_baseurl() . '/notes', @@ -709,7 +710,7 @@ function zrl_init(&$a) { $result = Cache::get("gprobe:".$urlparts["host"]); if (!is_null($result)) { $result = unserialize($result); - if ($result["network"] == NETWORK_FEED) { + if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) { logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG); return; } @@ -737,8 +738,8 @@ function zrl($s,$force = false) { // Used from within PCSS themes to set theme parameters. If there's a // puid request variable, that is the "page owner" and normally their theme -// settings take precedence; unless a local user sets the "always_my_theme" -// system pconfig, which means they don't want to see anybody else's theme +// settings take precedence; unless a local user sets the "always_my_theme" +// system pconfig, which means they don't want to see anybody else's theme // settings except their own while on this site. function get_theme_uid() { diff --git a/include/items.php b/include/items.php index ad41a0380d..4e86a5200a 100644 --- a/include/items.php +++ b/include/items.php @@ -1239,10 +1239,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $guid_prefix)); $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']); $arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : ''); - $arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : ''); + $arr['author-name'] = ((x($arr,'author-name')) ? trim($arr['author-name']) : ''); $arr['author-link'] = ((x($arr,'author-link')) ? notags(trim($arr['author-link'])) : ''); $arr['author-avatar'] = ((x($arr,'author-avatar')) ? notags(trim($arr['author-avatar'])) : ''); - $arr['owner-name'] = ((x($arr,'owner-name')) ? notags(trim($arr['owner-name'])) : ''); + $arr['owner-name'] = ((x($arr,'owner-name')) ? trim($arr['owner-name']) : ''); $arr['owner-link'] = ((x($arr,'owner-link')) ? notags(trim($arr['owner-link'])) : ''); $arr['owner-avatar'] = ((x($arr,'owner-avatar')) ? notags(trim($arr['owner-avatar'])) : ''); $arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert()); @@ -1250,8 +1250,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa $arr['commented'] = ((x($arr,'commented') !== false) ? datetime_convert('UTC','UTC',$arr['commented']) : datetime_convert()); $arr['received'] = ((x($arr,'received') !== false) ? datetime_convert('UTC','UTC',$arr['received']) : datetime_convert()); $arr['changed'] = ((x($arr,'changed') !== false) ? datetime_convert('UTC','UTC',$arr['changed']) : datetime_convert()); - $arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : ''); - $arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : ''); + $arr['title'] = ((x($arr,'title')) ? trim($arr['title']) : ''); + $arr['location'] = ((x($arr,'location')) ? trim($arr['location']) : ''); $arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : ''); $arr['last-child'] = ((x($arr,'last-child')) ? intval($arr['last-child']) : 0 ); $arr['visible'] = ((x($arr,'visible') !== false) ? intval($arr['visible']) : 1 ); @@ -1287,11 +1287,24 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa } if ($arr['network'] == "") { - $r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($arr['contact-id']), + $r = q("SELECT `network` FROM `contact` WHERE `network` IN ('%s', '%s', '%s') AND `nurl` = '%s' AND `uid` = %d LIMIT 1", + dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS), + dbesc(normalise_link($arr['author-link'])), intval($arr['uid']) ); + if(!count($r)) + $r = q("SELECT `network` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND `nurl` = '%s' LIMIT 1", + dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS), + dbesc(normalise_link($arr['author-link'])) + ); + + if(!count($r)) + $r = q("SELECT `network` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($arr['contact-id']), + intval($arr['uid']) + ); + if(count($r)) $arr['network'] = $r[0]["network"]; @@ -1476,9 +1489,10 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa $arr = $unescaped; // find the item we just created - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `network` = '%s' ORDER BY `id` ASC ", dbesc($arr['uri']), - intval($arr['uid']) + intval($arr['uid']), + dbesc($arr['network']) ); if(count($r)) { diff --git a/include/nav.php b/include/nav.php index 972a6248c1..7fa9754ef1 100644 --- a/include/nav.php +++ b/include/nav.php @@ -240,6 +240,7 @@ function nav_set_selected($item){ 'settings' => null, 'contacts' => null, 'manage' => null, + 'events' => null, 'register' => null, ); $a->nav_sel[$item] = 'selected'; diff --git a/include/network.php b/include/network.php index 02b2d7c2ae..2815e1ab85 100644 --- a/include/network.php +++ b/include/network.php @@ -309,16 +309,25 @@ function xml_status($st, $message = '') { if(! function_exists('http_status_exit')) { -function http_status_exit($val) { - +function http_status_exit($val, $description = array()) { $err = ''; - if($val >= 400) + if($val >= 400) { $err = 'Error'; + if (!isset($description["title"])) + $description["title"] = $err." ".$val; + } if($val >= 200 && $val < 300) $err = 'OK'; logger('http_status_exit ' . $val); header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err); + + if (isset($description["title"])) { + $tpl = get_markup_template('http_status.tpl'); + echo replace_macros($tpl, array('$title' => $description["title"], + '$description' => $description["description"])); + } + killme(); }} diff --git a/include/oembed.php b/include/oembed.php index d4d7ce05e1..0e12383603 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -157,7 +157,7 @@ function oembed_format_object($j){ case "rich": { // not so safe.. if (!get_config("system","no_oembed_rich_content")) - $ret.= $jhtml; + $ret.= proxy_parse_html($jhtml); }; break; } diff --git a/include/photos.php b/include/photos.php new file mode 100644 index 0000000000..93a565b511 --- /dev/null +++ b/include/photos.php @@ -0,0 +1,27 @@ + 0 ? gps2Num($exifCoord[0]) : 0; + $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; + $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0; + + $flip = ($hemi == 'W' or $hemi == 'S') ? -1 : 1; + + return floatval($flip * ($degrees + ($minutes / 60) + ($seconds / 3600))); +} + +function gps2Num($coordPart) { + $parts = explode('/', $coordPart); + + if (count($parts) <= 0) + return 0; + + if (count($parts) == 1) + return $parts[0]; + + return floatval($parts[0]) / floatval($parts[1]); +} diff --git a/include/socgraph.php b/include/socgraph.php index d380af4344..b0f0c8672f 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -570,7 +570,7 @@ function poco_last_updated($profile, $force = false) { return false; } - if (($data["poll"] == "") OR ($data["network"] == NETWORK_FEED)) { + if (($data["poll"] == "") OR (in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) { q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc(normalise_link($profile))); return false; diff --git a/include/text.php b/include/text.php index 0002f074e9..4ce634b603 100644 --- a/include/text.php +++ b/include/text.php @@ -970,7 +970,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { . (($click) ? ' fakelink' : '') . '" ' . (($redir) ? ' target="redir" ' : '') . (($url) ? ' href="' . $url . '"' : '') . $click . ' >' . "\r\n"; } }} @@ -1410,9 +1410,6 @@ function prepare_body(&$item,$attach = false, $preview = false) { put_item_in_cache($item, true); $s = $item["rendered-html"]; - require_once("mod/proxy.php"); - $s = proxy_parse_html($s); - $prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview); call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html']; diff --git a/mod/allfriends.php b/mod/allfriends.php index 1a45775fb2..784dfb8771 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -21,7 +21,7 @@ function allfriends_content(&$a) { ); $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( - '$name' => $c[0]['name'], + '$name' => htmlentities($c[0]['name']), '$photo' => $c[0]['photo'], 'url' => z_root() . '/contacts/' . $cid )); @@ -34,7 +34,7 @@ function allfriends_content(&$a) { return; $o .= replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => sprintf( t('Friends of %s'), $c[0]['name']) + '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name'])) )); @@ -48,10 +48,10 @@ function allfriends_content(&$a) { $tpl = get_markup_template('common_friends.tpl'); foreach($r as $rr) { - + $o .= replace_macros($tpl,array( '$url' => $rr['url'], - '$name' => $rr['name'], + '$name' => htmlentities($rr['name']), '$photo' => $rr['photo'], '$tags' => '' )); diff --git a/mod/common.php b/mod/common.php index 3118d12479..1e65137ac6 100644 --- a/mod/common.php +++ b/mod/common.php @@ -16,7 +16,7 @@ function common_content(&$a) { if(! $uid) return; - if($cmd === 'loc' && $cid) { + if($cmd === 'loc' && $cid) { $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1", intval($cid), intval($uid) @@ -26,10 +26,10 @@ function common_content(&$a) { $c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1", intval($uid) ); - } + } $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array( - '$name' => $c[0]['name'], + '$name' => htmlentities($c[0]['name']), '$photo' => $c[0]['photo'], 'url' => z_root() . '/contacts/' . $cid )); @@ -97,10 +97,10 @@ function common_content(&$a) { $tpl = get_markup_template('common_friends.tpl'); foreach($r as $rr) { - + $o .= replace_macros($tpl,array( '$url' => $rr['url'], - '$name' => $rr['name'], + '$name' => htmlentities($rr['name']), '$photo' => $rr['photo'], '$tags' => '' )); diff --git a/mod/contacts.php b/mod/contacts.php index 89154eded9..c562c9822d 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -33,7 +33,7 @@ function contacts_init(&$a) { if($contact_id) { $a->data['contact'] = $r[0]; $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( - '$name' => $a->data['contact']['name'], + '$name' => htmlentities($a->data['contact']['name']), '$photo' => $a->data['contact']['photo'], '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] )); @@ -238,12 +238,12 @@ function _contact_update_profile($contact_id) { $data = probe_url($r[0]["url"]); - // "Feed" is mostly a sign of communication problems - if (($data["network"] == NETWORK_FEED) AND ($data["network"] != $r[0]["network"])) + // "Feed" or "Unknown" is mostly a sign of communication problems + if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"])) return; $updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm", - "poco", "network", "alias", "pubkey"); + "poco", "network", "alias"); $update = array(); if ($data["network"] == NETWORK_OSTATUS) { @@ -432,7 +432,7 @@ function contacts_content(&$a) { } $a->page['aside'] = ''; - + return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array( '$contact' => _contact_detail_for_template($orig_record[0]), '$method' => 'get', @@ -509,7 +509,7 @@ function contacts_content(&$a) { if(!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) $relation_text = ""; - $relation_text = sprintf($relation_text,$contact['name']); + $relation_text = sprintf($relation_text,htmlentities($contact['name'])); if(($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) { $url = "redir/{$contact['id']}"; @@ -590,6 +590,10 @@ function contacts_content(&$a) { if ($contact['network'] == NETWORK_DFRN) $profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)); + if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND + ($contact['rel'] == CONTACT_IS_FOLLOWER)) + $follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]); + $o .= replace_macros($tpl, array( '$header' => t('Contact Editor'), '$tab_str' => $tab_str, @@ -617,6 +621,8 @@ function contacts_content(&$a) { '$updpub' => t('Update public posts'), '$last_update' => $last_update, '$udnow' => t('Update now'), + '$follow' => $follow, + '$follow_text' => t("Connect/Follow"), '$profile_select' => $profile_select, '$contact_id' => $contact['id'], '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), @@ -632,7 +638,7 @@ function contacts_content(&$a) { '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'], '$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')), '$photo' => $contact['photo'], - '$name' => $contact['name'], + '$name' => htmlentities($contact['name']), '$dir_icon' => $dir_icon, '$alt_text' => $alt_text, '$sparkle' => $sparkle, @@ -832,8 +838,8 @@ function _contact_detail_for_template($rr){ $url = $rr['url']; $sparkle = ''; } - - + + return array( 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), 'edit_hover' => t('Edit contact'), @@ -841,9 +847,9 @@ function _contact_detail_for_template($rr){ 'id' => $rr['id'], 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, - 'thumb' => proxy_url($rr['thumb']), - 'name' => $rr['name'], - 'username' => $rr['name'], + 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), + 'name' => htmlentities($rr['name']), + 'username' => htmlentities($rr['name']), 'sparkle' => $sparkle, 'itemurl' => $rr['url'], 'url' => $url, diff --git a/mod/content.php b/mod/content.php index cec23a9142..c5a5556116 100644 --- a/mod/content.php +++ b/mod/content.php @@ -11,8 +11,8 @@ // There is no "pagination query", but we will manage the "current page" on the client // and provide a link to fetch the next page - until there are no pages left to fetch. -// With the exception of complex tag and text searches, this prototype is incredibly -// fast - e.g. one or two milliseconds to fetch parent items for the current content, +// With the exception of complex tag and text searches, this prototype is incredibly +// fast - e.g. one or two milliseconds to fetch parent items for the current content, // and 10-20 milliseconds to fetch all the child items. @@ -476,7 +476,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { 'name' => $name_e, 'sparkle' => $sparkle, 'lock' => $lock, - 'thumb' => proxy_url($profile_avatar), + 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB), 'title' => $title_e, 'body' => $body_e, 'text' => $text_e, @@ -485,7 +485,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, - 'owner_photo' => proxy_url($owner_photo), + 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, @@ -859,7 +859,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $name_e, - 'thumb' => proxy_url($profile_avatar), + 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB), 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $title_e, @@ -869,7 +869,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { 'indent' => $indent, 'shiny' => $shiny, 'owner_url' => $owner_url, - 'owner_photo' => proxy_url($owner_photo), + 'owner_photo' => proxy_url($owner_photo, false, PROXY_SIZE_THUMB), 'owner_name' => $owner_name_e, 'plink' => get_plink($item), 'edpost' => $edpost, diff --git a/mod/crepair.php b/mod/crepair.php index 457a06685d..686be3948f 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -24,7 +24,7 @@ function crepair_init(&$a) { $a->data['contact'] = $r[0]; $tpl = get_markup_template("vcard-widget.tpl"); $vcard_widget .= replace_macros($tpl, array( - '$name' => $a->data['contact']['name'], + '$name' => htmlentities($a->data['contact']['name']), '$photo' => $a->data['contact']['photo'] )); $a->page['aside'] .= $vcard_widget; @@ -179,8 +179,8 @@ function crepair_content(&$a) { '$label_remote_self' => t('Remote Self'), '$allow_remote_self' => $allow_remote_self, '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options), - '$contact_name' => $contact['name'], - '$contact_nick' => $contact['nick'], + '$contact_name' => htmlentities($contact['name']), + '$contact_nick' => htmlentities($contact['nick']), '$contact_id' => $contact['id'], '$contact_url' => $contact['url'], '$request' => $contact['request'], diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 1cc258853b..d5dbab951e 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -382,7 +382,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { if($duplex) $new_relation = CONTACT_IS_FRIEND; else - $new_relation = CONTACT_IS_SHARING; + $new_relation = CONTACT_IS_FOLLOWER; if($new_relation != CONTACT_IS_FOLLOWER) $writable = 1; diff --git a/mod/directory.php b/mod/directory.php index fa3a89e45a..6fd99256f0 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -171,7 +171,7 @@ function directory_content(&$a) { $entry = replace_macros($tpl,array( '$id' => $rr['id'], '$profile_link' => $profile_link, - '$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo])), + '$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB), '$alt_text' => $rr['name'], '$name' => $rr['name'], '$details' => $pdesc . $details, diff --git a/mod/dirfind.php b/mod/dirfind.php index b0d578a3c6..95f9bf53a8 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,9 +1,15 @@ page,'aside')) $a->page['aside'] = ''; @@ -113,6 +119,8 @@ function dirfind_content(&$a, $prefix = "") { if(count($j->results)) { + $id = 0; + $tpl = get_markup_template('match.tpl'); foreach($j->results as $jj) { @@ -120,20 +128,30 @@ function dirfind_content(&$a, $prefix = "") { if ($jj->cid > 0) { $connlnk = ""; $conntxt = ""; + $contact = q("SELECT * FROM `contact` WHERE `id` = %d", + intval($jj->cid)); + if ($contact) + $photo_menu = contact_photo_menu($contact[0]); + else + $photo_menu = array(); } else { $connlnk = $a->get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $conntxt = t('Connect'); + $photo_menu = array(array(t("View Profile"), zrl($jj->url))); + $photo_menu[] = array(t("Connect/Follow"), $connlnk); } $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); $o .= replace_macros($tpl,array( '$url' => zrl($jj->url), - '$name' => $jj->name, - '$photo' => proxy_url($jj->photo), + '$name' => htmlentities($jj->name), + '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), '$tags' => $jj->tags, '$conntxt' => $conntxt, '$connlnk' => $connlnk, + '$photo_menu' => $photo_menu, + '$id' => ++$id, )); } } diff --git a/mod/display.php b/mod/display.php index be5dd7cae3..6b345e6302 100644 --- a/mod/display.php +++ b/mod/display.php @@ -97,43 +97,10 @@ function display_fetchauthor($a, $item) { $profiledata["nickname"] = $item["author-name"]; $profiledata["name"] = $item["author-name"]; $profiledata["picdate"] = ""; - $profiledata["photo"] = proxy_url($item["author-avatar"]); + $profiledata["photo"] = proxy_url($item["author-avatar"], false, PROXY_SIZE_SMALL); $profiledata["url"] = $item["author-link"]; $profiledata["network"] = $item["network"]; - // Fetching further contact data from the contact table - $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'", - dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"])); - - if (!count($r)) - $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", - dbesc(normalise_link($profiledata["url"])), intval($item["uid"])); - - if (!count($r)) - $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", - dbesc(normalise_link($profiledata["url"]))); - - if (count($r)) { - $profiledata["photo"] = proxy_url($r[0]["photo"]); - $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"])); - $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"])); - if ($r[0]["nick"] != "") - $profiledata["nickname"] = $r[0]["nick"]; - } - - // Fetching profile data from unique contacts - $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"]))); - if (count($r)) { - if ($profiledata["photo"] == "") - $profiledata["photo"] = proxy_url($r[0]["avatar"]); - if ($profiledata["address"] == "") - $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"])); - if ($profiledata["about"] == "") - $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"])); - if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != "")) - $profiledata["nickname"] = $r[0]["nick"]; - } - // Check for a repeated message $skip = false; $body = trim($item["body"]); @@ -187,28 +154,49 @@ function display_fetchauthor($a, $item) { $profiledata["address"] = ""; $profiledata["about"] = ""; + } - // Fetching profile data from unique contacts - if ($profiledata["url"] != "") { - $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"]))); - if (count($r)) { - $profiledata["photo"] = proxy_url($r[0]["avatar"]); - $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"])); - $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"])); - if ($r[0]["nick"] != "") - $profiledata["nickname"] = $r[0]["nick"]; - } + // Fetching further contact data from the contact table + $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'", + dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"])); + + if (!count($r)) + $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", + dbesc(normalise_link($profiledata["url"])), intval($item["uid"])); + + if (!count($r)) + $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", + dbesc(normalise_link($profiledata["url"]))); + + if (count($r)) { + if ((($r[0]["uid"] != local_user()) OR !local_user()) AND ($profiledata["network"] == NETWORK_DIASPORA)) { + $r[0]["location"] = ""; + $r[0]["about"] = ""; } + + $profiledata["photo"] = proxy_url($r[0]["photo"], false, PROXY_SIZE_SMALL); + $profiledata["address"] = bbcode($r[0]["location"]); + $profiledata["about"] = bbcode($r[0]["about"]); + if ($r[0]["nick"] != "") + $profiledata["nickname"] = $r[0]["nick"]; + } + + // Fetching profile data from unique contacts + $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"]))); + if (count($r)) { + if ($profiledata["photo"] == "") + $profiledata["photo"] = proxy_url($r[0]["avatar"], false, PROXY_SIZE_SMALL); + if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) + $profiledata["address"] = bbcode($r[0]["location"]); + if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA)) + $profiledata["about"] = bbcode($r[0]["about"]); + if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != "")) + $profiledata["nickname"] = $r[0]["nick"]; } if (local_user()) { if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) $profiledata["remoteconnect"] = $a->get_baseurl()."/follow?url=".urlencode($profiledata["url"]); - //if ($profiledata["network"] == NETWORK_DFRN) { - // $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"])."&addr=".bin2hex($a->get_baseurl()."/profile/".$a->user["nickname"]); - // $profiledata["remoteconnect"] = $connect; - //} elseif ($profiledata["network"] == NETWORK_DIASPORA) - // $profiledata["remoteconnect"] = $a->get_baseurl()."/contacts?add=".GetProfileUsername($profiledata["url"], "", true); } elseif ($profiledata["network"] == NETWORK_DFRN) { $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]); $profiledata["remoteconnect"] = $connect; diff --git a/mod/events.php b/mod/events.php index ff61514170..e601ce8e4e 100644 --- a/mod/events.php +++ b/mod/events.php @@ -179,14 +179,17 @@ function events_content(&$a) { ); } + if ($a->theme_events_in_profile) + nav_set_selected('home'); + else + nav_set_selected('events'); $editselect = 'none'; if( feature_enabled(local_user(), 'richtext') ) $editselect = 'textareas'; // First day of the week (0 = Sunday) - // To-Do: Needs to be configurable - $firstDay = 0; + $firstDay = get_pconfig(local_user(),'system','first_day_of_week'); $i18n = array( "firstDay" => $firstDay, @@ -249,7 +252,8 @@ function events_content(&$a) { $o =""; // tabs - $tabs = profile_tabs($a, True); + if ($a->theme_events_in_profile) + $tabs = profile_tabs($a, True); diff --git a/mod/follow.php b/mod/follow.php old mode 100755 new mode 100644 index bdcde77435..54c20e5093 --- a/mod/follow.php +++ b/mod/follow.php @@ -31,6 +31,12 @@ function follow_content(&$a) { $ret = probe_url($url); + if ($ret["network"] == NETWORK_PHANTOM) { + notice( t("The network type couldn't be detected. Contact can't be added.") . EOL); + goaway($_SESSION['return_url']); + // NOTREACHED + } + if ($ret["network"] == NETWORK_MAIL) $ret["url"] = $ret["addr"]; @@ -55,35 +61,54 @@ function follow_content(&$a) { // Makes the connection request for friendica contacts easier $_SESSION["fastlane"] = $ret["url"]; + $r = q("SELECT `location`, `about`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", + normalise_link($ret["url"])); + + if (!$r) + $r = array(array("location" => "", "about" => "", "keywords" => "")); + + if($ret['network'] === NETWORK_DIASPORA) { + $r[0]["location"] = ""; + $r[0]["about"] = ""; + } + $header = $ret["name"]; if ($ret["addr"] != "") $header .= " <".$ret["addr"].">"; - $header .= " (".network_to_name($ret['network']).")"; + $header .= " (".network_to_name($ret['network'], $ret['url']).")"; $o = replace_macros($tpl,array( '$header' => htmlentities($header), - '$photo' => $ret["photo"], - '$desc' => "", - '$pls_answer' => t('Please answer the following:'), - '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'),t('Yes'))), - '$add_note' => t('Add a personal note:'), - '$page_desc' => "", - '$friendica' => "", - '$statusnet' => "", - '$diaspora' => "", - '$diasnote' => "", - '$your_address' => t('Your Identity Address:'), - '$invite_desc' => "", - '$emailnet' => "", - '$submit' => t('Submit Request'), - '$cancel' => t('Cancel'), - '$nickname' => "", - '$name' => $ret["name"], - '$url' => $ret["url"], - '$myaddr' => $myaddr, - '$request' => $request + '$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL), + '$desc' => "", + '$pls_answer' => t('Please answer the following:'), + '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'),t('Yes'))), + '$add_note' => t('Add a personal note:'), + '$page_desc' => "", + '$friendica' => "", + '$statusnet' => "", + '$diaspora' => "", + '$diasnote' => "", + '$your_address' => t('Your Identity Address:'), + '$invite_desc' => "", + '$emailnet' => "", + '$submit' => t('Submit Request'), + '$cancel' => t('Cancel'), + '$nickname' => "", + '$name' => $ret["name"], + '$url' => $ret["url"], + '$zrl' => zrl($ret["url"]), + '$url_label' => t("Profile URL"), + '$myaddr' => $myaddr, + '$request' => $request, + '$location' => bbcode($r[0]["location"]), + '$location_label' => t("Location:"), + '$about' => bbcode($r[0]["about"], false, false), + '$about_label' => t("About:"), + '$keywords' => $r[0]["keywords"], + '$keywords_label' => t("Tags:") )); return $o; } diff --git a/mod/match.php b/mod/match.php index 74f83a6cc9..f31b0f67a4 100644 --- a/mod/match.php +++ b/mod/match.php @@ -2,6 +2,7 @@ include_once('include/text.php'); require_once('include/socgraph.php'); require_once('include/contact_widgets.php'); +require_once('mod/proxy.php'); function match_content(&$a) { @@ -65,7 +66,7 @@ function match_content(&$a) { $o .= replace_macros($tpl,array( '$url' => zrl($jj->url), '$name' => $jj->name, - '$photo' => proxy_url($jj->photo), + '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB), '$inttxt' => ' ' . t('is interested in:'), '$conntxt' => t('Connect'), '$connlnk' => $connlnk, diff --git a/mod/network.php b/mod/network.php index 9389c07e1b..dfd7c01300 100644 --- a/mod/network.php +++ b/mod/network.php @@ -568,14 +568,14 @@ function network_content(&$a, $update = 0) { intval($cid) ); if(count($r)) { - $sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` - WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0 - ORDER BY `item`.`received` DESC) AS `temp1` + $sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` + WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0 + ORDER BY `item`.`received` DESC) AS `temp1` ON $sql_table.$sql_parent = `temp1`.`parent` "; $sql_extra = ""; $o = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => sprintf( t('Contact: %s'), $r[0]['name']) + '$title' => sprintf( t('Contact: %s'), htmlentities($r[0]['name'])) )) . $o; if($r[0]['network'] === NETWORK_OSTATUS && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { diff --git a/mod/notes.php b/mod/notes.php index b960924956..73c1507e3e 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -9,6 +9,8 @@ function notes_init(&$a) { $which = $a->user['nickname']; + nav_set_selected('home'); + // profile_load($a,$which,$profile); } diff --git a/mod/notifications.php b/mod/notifications.php index 44f6dd5675..a267b7c958 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -1,5 +1,7 @@ user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); @@ -162,7 +166,7 @@ function notifications_content(&$a) { '$intro_id' => $rr['intro_id'], '$madeby' => sprintf( t('suggested by %s'),$rr['name']), '$contact_id' => $rr['contact-id'], - '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"), + '$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"), '$fullname' => $rr['fname'], '$url' => zrl($rr['furl']), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), @@ -206,7 +210,27 @@ function notifications_content(&$a) { )); } + $header = $rr["name"]; + + $ret = probe_url($rr["url"]); + + if ($rr['gnetwork'] == "") + $rr['gnetwork'] = $ret["network"]; + + if ($ret["addr"] != "") + $header .= " <".$ret["addr"].">"; + + $header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")"; + + // Don't show these data until you are connected. Diaspora is doing the same. + if($rr['gnetwork'] === NETWORK_DIASPORA) { + $rr['glocation'] = ""; + $rr['gabout'] = ""; + $rr['ggender'] = ""; + } + $notif_content .= replace_macros($tpl, array( + '$header' => htmlentities($header), '$str_notifytype' => t('Notification type: '), '$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')), '$dfrn_text' => $dfrn_text, @@ -214,12 +238,11 @@ function notifications_content(&$a) { '$uid' => $_SESSION['uid'], '$intro_id' => $rr['intro_id'], '$contact_id' => $rr['contact-id'], - '$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo']) : "images/person-175.jpg"), + '$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"), '$fullname' => $rr['name'], + '$location' => bbcode($rr['glocation'], false, false), '$location_label' => t('Location:'), - '$location' => $rr['glocation'], - '$location_label' => t('Location:'), - '$about' => proxy_parse_html(bbcode($rr['gabout'], false, false)), + '$about' => bbcode($rr['gabout'], false, false), '$about_label' => t('About:'), '$keywords' => $rr['gkeywords'], '$keywords_label' => t('Tags:'), @@ -227,7 +250,9 @@ function notifications_content(&$a) { '$gender_label' => t('Gender:'), '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''), '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')), - '$url' => zrl($rr['url']), + '$url' => $rr['url'], + '$zrl' => zrl($rr['url']), + '$url_label' => t('Profile URL'), '$knowyou' => $knowyou, '$approve' => t('Approve'), '$note' => $rr['note'], @@ -278,7 +303,7 @@ function notifications_content(&$a) { $notif_content .= replace_macros($tpl_item_likes,array( //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], - '$item_image' => $it['author-avatar'], + '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']), '$item_when' => relative_date($it['created']) )); @@ -288,7 +313,7 @@ function notifications_content(&$a) { $notif_content .= replace_macros($tpl_item_dislikes,array( //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], - '$item_image' => $it['author-avatar'], + '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']), '$item_when' => relative_date($it['created']) )); @@ -303,7 +328,7 @@ function notifications_content(&$a) { $notif_content .= replace_macros($tpl_item_friends,array( //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], - '$item_image' => $it['author-avatar'], + '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']), '$item_when' => relative_date($it['created']) )); @@ -318,7 +343,7 @@ function notifications_content(&$a) { $notif_content .= replace_macros($tpl,array( //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'], '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'], - '$item_image' => $it['author-avatar'], + '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), '$item_text' => $item_text, '$item_when' => relative_date($it['created']) )); @@ -351,7 +376,7 @@ function notifications_content(&$a) { foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], - '$item_image' => $it['photo'], + '$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO), '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) )); diff --git a/mod/photos.php b/mod/photos.php index ddfc1f345a..5ca973d166 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1,5 +1,6 @@ argc > 1) { @@ -198,6 +201,10 @@ function photos_post(&$a) { goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); } + /* + * RENAME photo album + */ + $newalbum = notags(trim($_POST['albumname'])); if($newalbum != $album) { q("UPDATE `photo` SET `album` = '%s' WHERE `album` = '%s' AND `uid` = %d", @@ -210,6 +217,9 @@ function photos_post(&$a) { return; // NOTREACHED } + /* + * DELETE photo album and all its photos + */ if($_POST['dropalbum'] == t('Delete Album')) { @@ -538,7 +548,7 @@ function photos_post(&$a) { if(count($links)) { foreach($links as $link) { if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') - $profile = $link['@attributes']['href']; + $profile = $link['@attributes']['href']; if($link['@attributes']['rel'] === 'salmon') { $salmon = '$url:' . str_replace(',','%sc',$link['@attributes']['href']); if(strlen($inform)) @@ -837,7 +847,7 @@ function photos_post(&$a) { killme(); } - $ph->orient($src); + $exif = $ph->orient($src); @unlink($src); $max_length = get_config('system','max_image_length'); @@ -878,8 +888,20 @@ function photos_post(&$a) { // Create item container + $lat = $lon = null; + + if($exif && $exif['GPS']) { + if(feature_enabled($channel_id,'photo_location')) { + $lat = getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']); + $lon = getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']); + } + } + $arr = array(); + if($lat && $lon) + $arr['coord'] = $lat . ' ' . $lon; + $arr['uid'] = $page_owner_uid; $arr['uri'] = $uri; $arr['parent-uri'] = $uri; @@ -1066,10 +1088,9 @@ function photos_content(&$a) { $is_owner = (local_user() && (local_user() == $owner_uid)); $o .= profile_tabs($a,$is_owner, $a->data['user']['nickname']); - // - // dispatch request - // - + /** + * Display upload form + */ if($datatype === 'upload') { if(! ($can_post)) { @@ -1180,6 +1201,10 @@ function photos_content(&$a) { return $o; } + /* + * Display a single photo album + */ + if($datatype === 'album') { $album = hex2bin($datum); @@ -1207,6 +1232,7 @@ function photos_content(&$a) { intval($a->pager['itemspage']) ); + //edit album name if($cmd === 'edit') { if(($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { @@ -1294,11 +1320,12 @@ function photos_content(&$a) { } + /** + * Display one photo + */ if($datatype === 'image') { - - //$o = ''; // fetch image, item containing image, then comments @@ -1422,6 +1449,9 @@ function photos_content(&$a) { $linked_items = q("SELECT * FROM `item` WHERE `resource-id` = '%s' $sql_extra LIMIT 1", dbesc($datum) ); + + $map = null; + if(count($linked_items)) { $link_item = $linked_items[0]; $r = q("SELECT COUNT(*) AS `total` @@ -1465,6 +1495,10 @@ function photos_content(&$a) { ); update_thread($link_item['parent']); } + + if($link_item['coord']) { + $map = generate_map($link_item['coord']); + } } $tags=Null; @@ -1767,6 +1801,8 @@ function photos_content(&$a) { '$desc' => $ph[0]['desc'], '$tags' => $tags_e, '$edit' => $edit, + '$map' => $map, + '$map_text' => t('Map'), '$likebuttons' => $likebuttons, '$like' => $like_e, '$dislike' => $dikslike_e, diff --git a/mod/ping.php b/mod/ping.php index e87ed98553..791ceed351 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -173,7 +173,7 @@ function ping_init(&$a) { * 'message' => notification message. "{0}" will be replaced by subject name **/ function xmlize($n){ - $n['photo'] = proxy_url($n['photo']); + $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO); $n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8"); $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8"); diff --git a/mod/poco.php b/mod/poco.php index f84fc964d9..4d16c6ed29 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -226,6 +226,13 @@ function poco_init(&$a) { Cache::set("about:".$rr['updated'].":".$rr['nurl'],$about); } + // Non connected persons can only see the keywords of a Diaspora account + if ($rr['network'] == NETWORK_DIASPORA) { + $rr['location'] = ""; + $about = ""; + $rr['gender'] = ""; + } + $entry = array(); if($fields_ret['id']) $entry['id'] = (int)$rr['id']; diff --git a/mod/proxy.php b/mod/proxy.php index d82d334cec..d26967dddf 100644 --- a/mod/proxy.php +++ b/mod/proxy.php @@ -3,6 +3,12 @@ define("PROXY_DEFAULT_TIME", 86400); // 1 Day +define("PROXY_SIZE_MICRO", "micro"); +define("PROXY_SIZE_THUMB", "thumb"); +define("PROXY_SIZE_SMALL", "small"); +define("PROXY_SIZE_MEDIUM", "medium"); +define("PROXY_SIZE_LARGE", "large"); + require_once('include/security.php'); require_once("include/Photo.php"); @@ -37,6 +43,7 @@ function proxy_init() { $thumb = false; $size = 1024; + $sizetype = ""; // If the cache path isn't there, try to create it if (!is_dir($_SERVER["DOCUMENT_ROOT"]."/proxy")) @@ -59,14 +66,27 @@ function proxy_init() { $size = 200; // thumb, small, medium and large. - if (substr($url, -6) == ":thumb") - $size = 150; - if (substr($url, -6) == ":small") - $size = 340; - if (substr($url, -7) == ":medium") + if (substr($url, -6) == ":micro") { + $size = 48; + $sizetype = ":micro"; + $url = substr($url, 0, -6); + } elseif (substr($url, -6) == ":thumb") { + $size = 80; + $sizetype = ":thumb"; + $url = substr($url, 0, -6); + } elseif (substr($url, -6) == ":small") { + $size = 175; + $url = substr($url, 0, -6); + $sizetype = ":small"; + } elseif (substr($url, -7) == ":medium") { $size = 600; - if (substr($url, -6) == ":large") + $url = substr($url, 0, -7); + $sizetype = ":medium"; + } elseif (substr($url, -6) == ":large") { $size = 1024; + $url = substr($url, 0, -6); + $sizetype = ":large"; + } $pos = strrpos($url, "=."); if ($pos) @@ -176,6 +196,8 @@ function proxy_init() { } } + $img_str_orig = $img_str; + // reduce quality - if it isn't a GIF if ($mime != "image/gif") { $img = new Photo($img_str, $mime); @@ -188,10 +210,12 @@ function proxy_init() { // If there is a real existing directory then put the cache file there // advantage: real file access is really fast // Otherwise write in cachefile - if ($valid AND $direct_cache) - file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true), $img_str); - elseif ($cachefile != '') - file_put_contents($cachefile, $img_str); + if ($valid AND $direct_cache) { + file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true), $img_str_orig); + if ($sizetype <> '') + file_put_contents($_SERVER["DOCUMENT_ROOT"]."/proxy/".proxy_url($_REQUEST['url'], true).$sizetype, $img_str); + } elseif ($cachefile != '') + file_put_contents($cachefile, $img_str_orig); header("Content-type: $mime"); @@ -208,7 +232,7 @@ function proxy_init() { killme(); } -function proxy_url($url, $writemode = false) { +function proxy_url($url, $writemode = false, $size = "") { global $_SERVER; $a = get_app(); @@ -251,6 +275,9 @@ function proxy_url($url, $writemode = false) { $proxypath = $a->get_baseurl()."/proxy/".$path; + if ($size != "") + $size = ":".$size; + // Too long files aren't supported by Apache // Writemode in combination with long files shouldn't be possible if ((strlen($proxypath) > 250) AND $writemode) @@ -260,7 +287,7 @@ function proxy_url($url, $writemode = false) { elseif ($writemode) return ($path); else - return ($proxypath); + return ($proxypath.$size); } /** diff --git a/mod/search.php b/mod/search.php index 251dd4778f..c15dfae3fe 100644 --- a/mod/search.php +++ b/mod/search.php @@ -95,10 +95,29 @@ function search_content(&$a) { } if(get_config('system','local_search') AND !local_user()) { - notice(t('Public access denied.').EOL); - return; - //http_status_exit(403); - //killme(); + http_status_exit(403, + array("title" => t("Public access denied."), + "description" => t("Only logged in users are permitted to perform a search."))); + killme(); + //notice(t('Public access denied.').EOL); + //return; + } + + if (get_config('system','permit_crawling') AND !local_user()) { + // To-Do: + // - 10 requests are "free", after the 11th only a call per minute is allowed + + $remote = $_SERVER["REMOTE_ADDR"]; + $result = Cache::get("remote_search:".$remote); + if (!is_null($result)) { + if ($result > (time() - 60)) { + http_status_exit(429, + array("title" => t("Too Many Requests"), + "description" => t("Only one search per minute is permitted for not logged in users."))); + killme(); + } + } + Cache::set("remote_search:".$remote, time(), CACHE_HOUR); } nav_set_selected('search'); diff --git a/mod/settings.php b/mod/settings.php index 556fb63e8a..6601858ee4 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -284,6 +284,7 @@ function settings_post(&$a) { $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']); $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $first_day_of_week = ((x($_POST,'first_day_of_week')) ? intval($_POST['first_day_of_week']) : 0); $noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0); $infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0); $no_auto_update = ((x($_POST,'no_auto_update')) ? intval($_POST['no_auto_update']) : 0); @@ -308,6 +309,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network); set_pconfig(local_user(),'system','no_smilies',$nosmile); + set_pconfig(local_user(),'system','first_day_of_week',$first_day_of_week); set_pconfig(local_user(),'system','ignore_info',$noinfo); set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll); set_pconfig(local_user(),'system','no_auto_update',$no_auto_update); @@ -915,6 +917,10 @@ function settings_content(&$a) { $nosmile = get_pconfig(local_user(),'system','no_smilies'); $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 + $first_day_of_week = get_pconfig(local_user(),'system','first_day_of_week'); + $first_day_of_week = (($first_day_of_week===false)? '0': $first_day_of_week); // default if not set: 0 + $weekdays = array(0 => t("Sunday"), 1 => t("Monday")); + $noinfo = get_pconfig(local_user(),'system','ignore_info'); $noinfo = (($noinfo===false)? '0': $noinfo); // default if not set: 0 @@ -944,6 +950,8 @@ function settings_content(&$a) { '$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')), '$itemspage_mobile_network' => array('itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + '$calendar_title' => t('Calendar'), + '$first_day_of_week' => array('first_day_of_week', t('Beginning of week:'), $first_day_of_week, '', $weekdays, false), '$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''), '$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''), '$no_auto_update' => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, 'When disabled, the network page is updated all the time, which could be confusing while reading.'), diff --git a/mod/suggest.php b/mod/suggest.php index e07e933114..8bf31ca8e5 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -81,12 +81,12 @@ function suggest_content(&$a) { foreach($r as $rr) { - $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); + $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $o .= replace_macros($tpl,array( '$url' => zrl($rr['url']), '$name' => $rr['name'], - '$photo' => proxy_url($rr['photo']), + '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'], '$ignid' => $rr['id'], '$conntxt' => t('Connect'), diff --git a/mod/videos.php b/mod/videos.php index df47262f1d..a7d48cb751 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -15,6 +15,8 @@ function videos_init(&$a) { return; } + nav_set_selected('home'); + $o = ''; if($a->argc > 1) { diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index b84856701d..a6bf74b288 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -62,9 +62,9 @@ function viewcontacts_content(&$a) { $contacts[] = array( 'id' => $rr['id'], 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), - 'thumb' => proxy_url($rr['thumb']), - 'name' => substr($rr['name'],0,20), - 'username' => $rr['name'], + 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), + 'name' => htmlentities(substr($rr['name'],0,20)), + 'username' => htmlentities($rr['name']), 'url' => $url, 'sparkle' => '', 'itemurl' => $rr['url'], diff --git a/object/Item.php b/object/Item.php index 283745d34d..3050365f92 100644 --- a/object/Item.php +++ b/object/Item.php @@ -134,7 +134,7 @@ class Item extends BaseObject { $filer = (($conv->get_profile_owner() == local_user()) ? t("save to folder") : false); $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true); - $profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); + $profile_name = htmlentities(((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']); if($item['author-link'] && (! $item['author-name'])) $profile_name = $item['author-link']; @@ -253,6 +253,8 @@ class Item extends BaseObject { if ($shareable) $buttons['share'] = array( t('Share this'), t('share')); } + $comment = $this->get_comment_box($indent); + if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0){ $shiny = 'shiny'; } @@ -322,6 +324,10 @@ class Item extends BaseObject { !diaspora_is_redmatrix($item["owner-link"]) AND isset($buttons["like"])) unset($buttons["like"]); + // Diaspora doesn't has multithreaded comments + if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment')) + unset($comment); + // Facebook can like comments - but it isn't programmed in the connector yet. if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"])) unset($buttons["like"]); @@ -346,7 +352,7 @@ class Item extends BaseObject { 'isevent' => $isevent, 'attend' => $attend, 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), - 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), + 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), htmlentities($this->get_owner_name()), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), 'to' => t('to'), 'via' => t('via'), 'wall' => t('Wall-to-Wall'), @@ -354,7 +360,7 @@ class Item extends BaseObject { 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $name_e, - 'thumb' => proxy_url($profile_avatar), + 'thumb' => proxy_url($profile_avatar, false, PROXY_SIZE_THUMB), 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $title_e, @@ -367,8 +373,8 @@ class Item extends BaseObject { 'indent' => $indent, 'shiny' => $shiny, 'owner_url' => $this->get_owner_url(), - 'owner_photo' => proxy_url($this->get_owner_photo()), - 'owner_name' => $owner_name_e, + 'owner_photo' => proxy_url($this->get_owner_photo(), false, PROXY_SIZE_THUMB), + 'owner_name' => htmlentities($owner_name_e), 'plink' => get_plink($item), 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'isstarred' => $isstarred, @@ -382,7 +388,7 @@ class Item extends BaseObject { 'dislike' => $responses['dislike']['output'], 'responses' => $responses, 'switchcomment' => t('Comment'), - 'comment' => $this->get_comment_box($indent), + 'comment' => $comment, 'previewing' => ($conv->is_preview() ? ' preview ' : ''), 'wait' => t('Please wait'), 'thread_level' => $thread_level, @@ -544,7 +550,7 @@ class Item extends BaseObject { */ public function set_conversation($conv) { $previous_mode = ($this->conversation ? $this->conversation->get_mode() : ''); - + $this->conversation = $conv; // Set it on our children too @@ -665,7 +671,7 @@ class Item extends BaseObject { if(!$this->is_toplevel() && !(get_config('system','thread_allow') && $a->theme_thread_allow)) { return ''; } - + $comment_box = ''; $conv = $this->get_conversation(); $template = get_markup_template($this->get_comment_box_template()); diff --git a/util/messages.po b/util/messages.po index a6792943bd..ac852f66db 100644 --- a/util/messages.po +++ b/util/messages.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: 3.4.1\n" +"Project-Id-Version: 3.4.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-22 09:58+0200\n" +"POT-Creation-Date: 2015-10-11 10:35+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME
{{$description}}
+ + diff --git a/view/templates/intros.tpl b/view/templates/intros.tpl index aa10cde48f..b9f7f15418 100644 --- a/view/templates/intros.tpl +++ b/view/templates/intros.tpl @@ -1,10 +1,10 @@ - +{{$str_notifytype}} {{$notify_type}}
-