Merge develop-new into event-attendance-new

Conflicts:
	include/conversation.php
This commit is contained in:
rabuzarus 2015-10-11 19:39:55 +02:00
commit 649578ae33
75 changed files with 20240 additions and 18748 deletions

View File

@ -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)) {

View File

@ -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**

View File

@ -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**

79
doc/htconfig.md Normal file
View File

@ -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

View File

@ -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'];
}
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;
}}

View File

@ -371,12 +371,11 @@ class Photo {
if( (! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg') )
return;
$exif = @exif_read_data($filename);
$exif = @exif_read_data($filename,null,true);
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;
}

View File

@ -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 : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
$feed->init();
if($feed->error())
if($feed->error()) {
logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
$network = NETWORK_PHANTOM;
}
if(! x($vcard,'photo'))
$vcard['photo'] = $feed->get_image_url();

View File

@ -392,7 +392,6 @@ function acl_lookup(&$a, $out_type = 'json') {
if(!local_user())
return "";
$start = (x($_REQUEST,'start')?$_REQUEST['start']:0);
$count = (x($_REQUEST,'count')?$_REQUEST['count']:100);
$search = (x($_REQUEST,'search')?$_REQUEST['search']:"");
@ -492,7 +491,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$groups[] = array(
"type" => "g",
"photo" => "images/twopeople.png",
"name" => $g['name'],
"name" => htmlentities($g['name']),
"id" => intval($g['id']),
"uids" => array_map("intval", explode(",",$g['uids'])),
"link" => '',
@ -545,9 +544,9 @@ function acl_lookup(&$a, $out_type = 'json') {
$x['data'] = array();
if(count($r)) {
foreach($r as $g) {
$x['photos'][] = proxy_url($g['micro']);
$x['photos'][] = proxy_url($g['micro'], false, PROXY_SIZE_MICRO);
$x['links'][] = $g['url'];
$x['suggestions'][] = $g['name'];
$x['suggestions'][] = htmlentities($g['name']);
$x['data'][] = intval($g['id']);
}
}
@ -559,12 +558,12 @@ function acl_lookup(&$a, $out_type = 'json') {
foreach($r as $g){
$contacts[] = array(
"type" => "c",
"photo" => proxy_url($g['micro']),
"name" => $g['name'],
"photo" => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
"name" => htmlentities($g['name']),
"id" => intval($g['id']),
"network" => $g['network'],
"link" => $g['url'],
"nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
"nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
"forum" => $g['forum']
);
}
@ -604,12 +603,12 @@ function acl_lookup(&$a, $out_type = 'json') {
// /nickname
$unknow_contacts[] = array(
"type" => "c",
"photo" => proxy_url($row['author-avatar']),
"name" => $row['author-name'],
"photo" => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO),
"name" => htmlentities($row['author-name']),
"id" => '',
"network" => "unknown",
"link" => $row['author-link'],
"nick" => $nick,
"nick" => htmlentities($nick),
"forum" => false
);
}

View File

@ -2,7 +2,23 @@
require_once("include/oembed.php");
require_once('include/event.php');
require_once('include/map.php');
require_once('mod/proxy.php');
function bb_PictureCacheExt($matches) {
if (strpos($matches[3], "data:image/") === 0)
return ($matches[0]);
$matches[3] = proxy_url($matches[3]);
return "[img=".$matches[1]."x".$matches[2]."]".$matches[3]."[/img]";
}
function bb_PictureCache($matches) {
if (strpos($matches[1], "data:image/") === 0)
return ($matches[0]);
$matches[1] = proxy_url($matches[1]);
return "[img]".$matches[1]."[/img]";
}
function bb_map_coords($match) {
// the extra space in the following line is intentional
@ -101,9 +117,9 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
$text = $oembed;
else {
if (($image != "") AND !strstr(strtolower($oembed), "<img "))
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $url, $image, $title);
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $url, proxy_url($image), $title);
elseif (($preview != "") AND !strstr(strtolower($oembed), "<img "))
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $url, $preview, $title);
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $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 . '#$]', '<img src="' . $image .'" alt="' . t('Image/photo') . '" />', $newbody);
$newbody = str_replace('[$#saved_image' . $cnt . '#$]', '<img src="' . proxy_url($image) .'" alt="' . t('Image/photo') . '" />', $newbody);
$cnt++;
}
@ -585,7 +601,7 @@ function bb_ShareAttributes($share, $simplehtml) {
default:
$headline = trim($share[1]).'<div class="shared_header">';
if ($avatar != "")
$headline .= '<img src="'.$avatar.'" height="32" width="32" >';
$headline .= '<img src="'.proxy_url($avatar, false, PROXY_SIZE_MICRO).'" height="32" width="32" >';
$headline .= sprintf(t('<span><a href="%s" target="_blank">%s</a> wrote the following <a href="%s" target="_blank">post</a>'.$reldate.':</span>'), $profile, $author, $link);
$headline .= "</div>";
@ -1102,13 +1118,17 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
"<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
$Text);
// [img=widthxheight]image source[/img]
//$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '<img src="$3" style="height: $2px; width: $1px;" >', $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", '<img src="$3" style="width: $1px;" >', $Text);
$Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px;" >', $Text);
// Images
// [img]pathtoimage[/img]
$Text = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'bb_PictureCache', $Text);
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
$Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);

View File

@ -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,8 +875,16 @@ 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 {
} 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;
}
}
@ -891,6 +905,7 @@ function item_photo_menu($item){
}
if (local_user()) {
$menu = Array(
t("Follow Thread") => $sub_link,
t("View Status") => $status_link,
@ -898,10 +913,17 @@ function item_photo_menu($item){
t("View Photos") => $photos_link,
t("Network Posts") => $posts_link,
t("Edit Contact") => $contact_url,
t("Send PM") => $pm_url,
t("Poke") => $poke_link
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);

View File

@ -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']),
@ -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) {

View File

@ -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

View File

@ -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;

View File

@ -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`,

View File

@ -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;
}

View File

@ -664,6 +664,7 @@ if(! function_exists('profile_tabs')){
);
if ($is_owner){
if ($a->theme_events_in_profile)
$tabs[] = array(
'label' => t('Events'),
'url' => $a->get_baseurl() . '/events',
@ -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;
}

View File

@ -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,6 +1287,19 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
}
if ($arr['network'] == "") {
$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'])
@ -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)) {

View File

@ -240,6 +240,7 @@ function nav_set_selected($item){
'settings' => null,
'contacts' => null,
'manage' => null,
'events' => null,
'register' => null,
);
$a->nav_sel[$item] = 'selected';

View File

@ -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();
}}

View File

@ -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;
}

27
include/photos.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* @file include/photos.php
* @brief Functions related to photo handling.
*/
function getGps($exifCoord, $hemi) {
$degrees = count($exifCoord) > 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]);
}

View File

@ -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;

View File

@ -970,7 +970,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
. (($click) ? ' fakelink' : '') . '" '
. (($redir) ? ' target="redir" ' : '')
. (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
. proxy_url($contact['micro']) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
. proxy_url($contact['micro'], false, PROXY_SIZE_THUMB) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
. '" /></a></div>' . "\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'];

View File

@ -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']))
));
@ -51,7 +51,7 @@ function allfriends_content(&$a) {
$o .= replace_macros($tpl,array(
'$url' => $rr['url'],
'$name' => $rr['name'],
'$name' => htmlentities($rr['name']),
'$photo' => $rr['photo'],
'$tags' => ''
));

View File

@ -29,7 +29,7 @@ function common_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
));
@ -100,7 +100,7 @@ function common_content(&$a) {
$o .= replace_macros($tpl,array(
'$url' => $rr['url'],
'$name' => $rr['name'],
'$name' => htmlentities($rr['name']),
'$photo' => $rr['photo'],
'$tags' => ''
));

View File

@ -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) {
@ -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,
@ -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,

View File

@ -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,

View File

@ -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'],

View File

@ -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;

View File

@ -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,

View File

@ -1,9 +1,15 @@
<?php
require_once('include/contact_widgets.php');
require_once('include/socgraph.php');
require_once('include/Contact.php');
function dirfind_init(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL );
return;
}
if(! x($a->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,
));
}
}

View File

@ -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 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"])));
// 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]["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;

View File

@ -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,6 +252,7 @@ function events_content(&$a) {
$o ="";
// tabs
if ($a->theme_events_in_profile)
$tabs = profile_tabs($a, True);

31
mod/follow.php Executable file → Normal file
View File

@ -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,16 +61,27 @@ 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"],
'$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'))),
@ -82,8 +99,16 @@ function follow_content(&$a) {
'$nickname' => "",
'$name' => $ret["name"],
'$url' => $ret["url"],
'$zrl' => zrl($ret["url"]),
'$url_label' => t("Profile URL"),
'$myaddr' => $myaddr,
'$request' => $request
'$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;
}

View File

@ -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,

View File

@ -575,7 +575,7 @@ function network_content(&$a, $update = 0) {
$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'))) {

View File

@ -9,6 +9,8 @@ function notes_init(&$a) {
$which = $a->user['nickname'];
nav_set_selected('home');
// profile_load($a,$which,$profile);
}

View File

@ -1,5 +1,7 @@
<?php
include_once("include/bbcode.php");
include_once("include/contact_selectors.php");
include_once("include/Scrape.php");
function notifications_post(&$a) {
@ -138,7 +140,8 @@ function notifications_content(&$a) {
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
`gcontact`.`network` AS `gnetwork`
FROM `intro`
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
@ -152,6 +155,7 @@ function notifications_content(&$a) {
$tpl = get_markup_template("intros.tpl");
foreach($r as $rr) {
if($rr['fid']) {
$return_addr = bin2hex($a->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'])
));

View File

@ -1,5 +1,6 @@
<?php
require_once('include/Photo.php');
require_once('include/photos.php');
require_once('include/items.php');
require_once('include/acl_selectors.php');
require_once('include/bbcode.php');
@ -17,6 +18,8 @@ function photos_init(&$a) {
return;
}
nav_set_selected('home');
$o = '';
if($a->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')) {
@ -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,

View File

@ -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");

View File

@ -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'];

View File

@ -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);
}
/**

View File

@ -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');

View File

@ -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.'),

View File

@ -86,7 +86,7 @@ function suggest_content(&$a) {
$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'),

View File

@ -15,6 +15,8 @@ function videos_init(&$a) {
return;
}
nav_set_selected('home');
$o = '';
if($a->argc > 1) {

View File

@ -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'],

View File

@ -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,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
<h1>{{$header}}</h1>
{{if $myaddr == ""}}
@ -30,6 +28,11 @@
<img src="{{$photo}}" alt="" id="dfrn-request-photo">
{{/if}}
{{if $url}}<dl><dt>{{$url_label}}</dt><dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd></dl>{{/if}}
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about}}</dd></dl>{{/if}}
<div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}}

View File

@ -51,6 +51,9 @@
{{if $lblsuggest}}
<li><a href="fsuggest/{{$contact_id}}" id="contact-edit-suggest">{{$lblsuggest}}</a></li>
{{/if}}
{{if $follow}}
<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>
{{/if}}
</ul>
</div>

View File

@ -27,6 +27,11 @@
<img src="{{$photo}}" alt="" id="dfrn-request-photo">
{{/if}}
{{if $url}}<dl><dt>{{$url_label}}</dt><dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd></dl>{{/if}}
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about}}</dd></dl>{{/if}}
<div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}}

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>{{$title}}</title>
</head>
<body>
<h1>{{$title}}</h1>
<p>{{$description}}</p>
</body>
</html>

View File

@ -1,10 +1,10 @@
<h2>{{$header}}</h2>
<div class="intro-wrapper" id="intro-{{$contact_id}}" >
<p class="intro-desc">{{$str_notifytype}} {{$notify_type}}</p>
<a class="intro-url-link" id="intro-url-link-{{$contact_id}}" href="{{$url}}" ><div class="intro-fullname" id="intro-fullname-{{$contact_id}}" >{{$fullname}}</div></a>
<img id="photo-{{$contact_id}}" class="intro-photo" src="{{$photo}}" width="175" height=175" title="{{$fullname|escape:'html'}}" alt="{{$fullname|escape:'html'}}" />
<dl><dt>{{$url_label}}</dt><dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd></dl>
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location}}</dd></dl>{{/if}}
{{if $gender}}<dl><dt>{{$gender_label}}</dt><dd>{{$gender}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}

View File

@ -1,9 +1,25 @@
<div class="profile-match-wrapper">
<div class="profile-match-photo">
<div class="profile-match-photo" id="contact-entry-photo-{{$id}}"
onmouseover="if (typeof t{{$id}} != 'undefined') clearTimeout(t{{$id}}); openMenu('contact-photo-menu-button-{{$id}}')"
onmouseout="t{{$id}}=setTimeout('closeMenu(\'contact-photo-menu-button-{{$id}}\'); closeMenu(\'contact-photo-menu-{{$id}}\');',200)" >
<a href="{{$url}}">
<img width="80" height="80" src="{{$photo}}" alt="{{$name}}" title="{{$name}}[{{$tags}}]" />
</a>
{{if $photo_menu}}
<span onclick="openClose('contact-photo-menu-{{$id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$id}}">menu</span>
<div class="contact-photo-menu" id="contact-photo-menu-{{$id}}">
<ul>
{{foreach $photo_menu as $k=>$c}}
{{if $c.2}}
<li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
{{else}}
<li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
{{/if}}
{{/foreach}}
</ul>
</div>
{{/if}}
</div>
<div class="profile-match-break"></div>
<div class="profile-match-name">

View File

@ -13,6 +13,8 @@
{{include file="field_checkbox.tpl" field=$nosmile}}
{{include file="field_checkbox.tpl" field=$noinfo}}
{{include file="field_checkbox.tpl" field=$infinite_scroll}}
<h2>{{$calendar_title}}</h2>
{{include file="field_select.tpl" field=$first_day_of_week}}
<div class="settings-submit-wrapper" >

View File

@ -0,0 +1 @@
{{* Dummy file to avoid errors when installing themes *}}

View File

@ -9,6 +9,9 @@ function theme_content(&$a){
if(!local_user())
return;
if (!function_exists('get_vier_config'))
return;
$style = get_pconfig(local_user(), 'vier', 'style');
if ($style == "")
@ -17,7 +20,15 @@ function theme_content(&$a){
if ($style == "")
$style = "plus";
return vier_form($a,$style);
$show_pages = get_vier_config('show_pages', true);
$show_profiles = get_vier_config('show_profiles', true);
$show_helpers = get_vier_config('show_helpers', true);
$show_services = get_vier_config('show_services', true);
$show_friends = get_vier_config('show_friends', true);
$show_lastusers = get_vier_config('show_lastusers', true);
return vier_form($a,$style, $show_pages, $show_profiles, $show_helpers,
$show_services, $show_friends, $show_lastusers);
}
function theme_post(&$a){
@ -26,23 +37,60 @@ function theme_post(&$a){
if (isset($_POST['vier-settings-submit'])){
set_pconfig(local_user(), 'vier', 'style', $_POST['vier_style']);
set_pconfig(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
set_pconfig(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
set_pconfig(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
set_pconfig(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
set_pconfig(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
set_pconfig(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
}
}
function theme_admin(&$a){
if (!function_exists('get_vier_config'))
return;
$style = get_config('vier', 'style');
return vier_form($a,$style);
$helperlist = get_config('vier', 'helperlist');
if ($helperlist == "")
$helperlist = "https://helpers.pyxis.uberspace.de/profile/helpers";
$t = get_markup_template("theme_admin_settings.tpl");
$o .= replace_macros($t, array(
'$helperlist' => array('vier_helperlist', t('Comma separated list of helper forums'), $helperlist, '', ''),
));
$show_pages = get_vier_config('show_pages', true, true);
$show_profiles = get_vier_config('show_profiles', true, true);
$show_helpers = get_vier_config('show_helpers', true, true);
$show_services = get_vier_config('show_services', true, true);
$show_friends = get_vier_config('show_friends', true, true);
$show_lastusers = get_vier_config('show_lastusers', true, true);
$o .= vier_form($a,$style, $show_pages, $show_profiles, $show_helpers, $show_services,
$show_friends, $show_lastusers);
return $o;
}
function theme_admin_post(&$a){
if (isset($_POST['vier-settings-submit'])){
set_config('vier', 'style', $_POST['vier_style']);
set_config('vier', 'show_pages', $_POST['vier_show_pages']);
set_config('vier', 'show_profiles', $_POST['vier_show_profiles']);
set_config('vier', 'show_helpers', $_POST['vier_show_helpers']);
set_config('vier', 'show_services', $_POST['vier_show_services']);
set_config('vier', 'show_friends', $_POST['vier_show_friends']);
set_config('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
set_config('vier', 'helperlist', $_POST['vier_helperlist']);
}
}
function vier_form(&$a, $style){
function vier_form(&$a, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers){
$styles = array(
"plus"=>"Plus",
"breathe"=>"Breathe",
@ -51,12 +99,21 @@ function vier_form(&$a, $style){
"netcolour"=>"Coloured Networks",
"flat"=>"Flat"
);
$show_or_not = array('0'=>t("don't show"), '1'=>t("show"),);
$t = get_markup_template("theme_settings.tpl");
$o .= replace_macros($t, array(
'$submit' => t('Submit'),
'$baseurl' => $a->get_baseurl(),
'$title' => t("Theme settings"),
'$style' => array('vier_style',t ('Set style'),$style,'',$styles),
'$show_pages' => array('vier_show_pages', t('Community Pages'), $show_pages, '', $show_or_not),
'$show_profiles' => array('vier_show_profiles', t('Community Profiles'), $show_profiles, '', $show_or_not),
'$show_helpers' => array('vier_show_helpers', t('Help or @NewHere ?'), $show_helpers, '', $show_or_not),
'$show_services' => array('vier_show_services', t('Connect Services'), $show_services, '', $show_or_not),
'$show_friends' => array('vier_show_friends', t('Find Friends'), $show_friends, '', $show_or_not),
'$show_lastusers' => array('vier_show_lastusers', t('Last users'), $show_lastusers, '', $show_or_not)
));
return $o;
}

3
view/theme/vier/hide.css Normal file
View File

@ -0,0 +1,3 @@
aside {
display: none;
}

View File

@ -0,0 +1,12 @@
#nav-user-linklabel {
display: none;
}
nav ul li .menu-popup {
left: auto;
right: 0px;
}
nav #search-box #search-text {
width: 100px;
}

154
view/theme/vier/shadow.css Normal file
View File

@ -0,0 +1,154 @@
nav {
background: rgb(36, 76, 94);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.7);
padding: 0px;
padding-left: 0px;
}
nav a:active,
nav a:link,
nav a:visited,
nav a {
color: #ccc;
}
nav a:hover,
#nav-messages-see-all a:hover {
color: #fff;
}
nav .nav-notify {
background-color: #F80;
top: 0px;
right: -5px;
padding: 1px 3px;
border-radius: 5px 5px 5px 5px;
}
// -----
nav .nav-menu-icon .nav-notify {
top: 0px;
}
nav .nav-menu.selected a {
color: #000;
/* font-weight: bold; */
}
nav .nav-menu:hover,
nav .nav-menu.selected {
border-bottom: 2px solid #427FED;
}
nav .nav-menu {
height: 23px;
font-size: 14px;
font-weight: initial;
}
#nav-site-menu,
#nav-notifications-menu,
#nav-user-menu {
top: 35px;
}
#nav-messages-menu {
top: 32px;
}
#nav-messages-see-all a {
color: #737373;
}
ul.tabs li .active, span.pager_current a {
border-bottom: 2px solid #427FED;
}
span.pager_current, span.pager_n a:hover,
span.pager_first a:hover, span.pager_last a:hover,
span.pager_prev a:hover, span.pager_next a:hover,
ul.tabs a:hover {
border-bottom: 2px solid #427FED;
}
nav #nav-notifications-linkmenu.on .icon.s22.notify, nav #nav-notifications-linkmenu.selected .icon.s22.notify {
color: #737373;
}
nav #nav-messages-linkmenu.selected,
nav #nav-user-linklabel.selected,
nav #nav-apps-link.selected {
background-color: #fff;
border-bottom-style: none;
}
div.jGrowl div.info {
background: #fff url("../../../images/icons/48/info.png") no-repeat 5px center;
}
div.jGrowl div.notice {
color: #737373;
}
div.jGrowl div.info {
color: #737373;
}
.birthday-notice, .event-notice {
font-weight: initial;
}
div.pager, ul.tabs {
font-weight: initial;
}
nav .nav-menu-icon.selected {
background-color: #fff;
}
#jot #jot-tools li:hover {
background-color: #fff;
}
nav .icon {
color: #737373;
}
nav a:hover .icon {
color: #000;
}
ul.menu-popup {
border: 0px solid #FFF;
margin-top: 0px;
}
header #banner a, header #banner a:active, header #banner a:visited, header #banner a:link, header #banner a:hover {
color: #737373;
}
header {
left: 10px;
}
header #banner {
margin-top: 6px;
}
#banner #logo-text {
margin-left: 5px;
}
aside {
top: 44px;
height: calc(100% - 54px);
}
section {
top: 44px;
}
nav #search-box #search-text {
background-color: initial;
border-style: solid;
border-width: 1px;
border-color: rgba(0, 0, 0, 0.15);
}

View File

@ -375,7 +375,7 @@ code {
.tool a {
/* color: #000; */
}
.tool a:hover, .widget a:hover, #nets-sidear a:hover, #hide-forum-list:hover, .admin.link a:hover, aside h4 a:hover {
.tool a:hover, .widget a:hover, #nets-sidear a:hover, #hide-forum-list:hover, .admin.link a:hover, aside h4 a:hover, right_aside h4 a:hover {
/* text-decoration: underline; */
text-decoration: none;
color: black;
@ -390,8 +390,8 @@ code {
}
.sidebar-group-li:hover, #sidebar-new-group:hover, #hide-forum-list:hover,
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forum-list div:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, #message-new:hover {
#sidebar-ungrouped:hover, .side-link:hover, .nets-ul li:hover, #forum-list div:hover, #forum-list-right div:hover,
.nets-all:hover, .saved-search-li:hover, li.tool:hover, .admin.link:hover, aside h4 a:hover, right_aside h4 a:hover, #message-new:hover {
/* background-color: #ddd; */
/* background-color: #e5e5e5; */
background-color: #F5F5F5;
@ -409,7 +409,7 @@ code {
font-weight: bold;
}
#sidebar-new-group, #hide-forum-list, #forum-list, #sidebar-ungrouped,
#sidebar-new-group, #hide-forum-list, #forum-list, #forum-list-right, #sidebar-ungrouped,
.side-link, #peoplefind-desc, #connect-desc, .nets-all, .admin.link, #message-new {
padding-left: 10px;
padding-top: 3px;
@ -418,7 +418,7 @@ code {
display: block;
}
a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a {
a.nets-link, .side-link a, #sidebar-new-group a, a.savedsearchterm, a.fileas-link, aside h4 a, right_aside h4 a {
display: block;
color: #737373;
}
@ -445,11 +445,11 @@ a.sidebar-group-element {
color: black;
}
#forum-list a, .tool a, .admin.link a {
#forum-list a, #forum-list-right a, .tool a, .admin.link a {
color: #737373;
}
#forum-list {
#forum-list, #forum-list-right {
margin-top: 2px;
}
@ -874,7 +874,7 @@ ul.menu-popup .empty {
right_aside {
width: 0px;
top: 32px;
display: block;
display: none;
}
/* aside */
@ -970,7 +970,7 @@ aside #profiles-menu {
left: 10px;
}
aside #search-text, aside #side-follow-url, aside #side-peoplefind-url {
aside #search-text, aside #side-follow-url, aside #side-peoplefind-url, right_aside input {
width: 140px;
height: 17px;
padding-left: 10px;
@ -984,7 +984,7 @@ aside #search-text, aside #side-follow-url, aside #side-peoplefind-url {
-moz-border-right-colors: #dbdbdb;*/
}
aside h4 {
aside h4, right_aside h4 {
margin-bottom: 0px;
margin-top: 0px;
font-size: 1.17em;

View File

@ -26,5 +26,3 @@ else if ($style == "dark")
$stylecss = file_get_contents('view/theme/vier/dark.css');
echo $stylecss;

View File

@ -0,0 +1,2 @@
<a href="{{$url}}/settings/connectors"><img alt="{{$alt_text}}" src="{{$photo}}" title="{{$alt_text}}"></a>

View File

@ -0,0 +1,11 @@
<div class="directory-item" id="directory-item-{{$id}}" >
<div class="directory-photo-wrapper" id="directory-photo-wrapper-{{$id}}" >
<div class="directory-photo" id="directory-photo-{{$id}}" >
<a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" >
<img class="directory-photo-img" src="{{$photo}}" alt="{{$alt_text}}" title="{{$alt_text}}" />
</a>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
<li class="tool" role="menuitem"><a href="{{$url}}" title="{{$title}}" target="blank">{{$title}}</a></li>

View File

@ -0,0 +1,72 @@
{{if $page}}
<div id="right_pages" class="widget">
<div>{{$page}}</div>
</div>
{{/if}}
{{if $comunity_profiles_title}}
<div id="right_profiles" class="widget">
<h3>{{$comunity_profiles_title}}</h3>
<div id='lastusers-wrapper' class='items-wrapper'>
{{foreach $comunity_profiles_items as $i}}
{{$i}}
{{/foreach}}
</div>
</div>
{{/if}}
{{if $helpers}}
<div id="right_helpers" class="widget">
<h3>{{$helpers.title.1}}</h3>
<ul role="menu">
{{foreach $helpers_items as $i}}
{{$i}}
{{/foreach}}
</ul>
</div>
{{/if}}
{{if $con_services}}
<div id="right_services" class="widget">
<h3>{{$con_services.title.1}}</h3>
<div id="right_services_icons">
{{foreach $connector_items as $i}}
{{$i}}
{{/foreach}}
</div>
</div>
{{/if}}
{{if $nv}}
<div id="right_friends" class="widget">
<h3>{{$nv.title.1}}</h3>
<ul role="menu">
<li class="tool" role="menuitem"><a class="{{$nv.directory.2}}" href="{{$nv.directory.0}}" title="{{$nv.directory.3}}" >{{$nv.directory.1}}</a></li>
<li class="tool" role="menuitem"><a class="{{$nv.global_directory.2}}" href="{{$nv.global_directory.0}}" target="blank" title="{{$nv.global_directory.3}}" >{{$nv.global_directory.1}}</a></li>
<li class="tool" role="menuitem"><a class="{{$nv.match.2}}" href="{{$nv.match.0}}" title="{{$nv.match.3}}" >{{$nv.match.1}}</a></li>
<li class="tool" role="menuitem"><a class="{{$nv.suggest.2}}" href="{{$nv.suggest.0}}" title="{{$nv.suggest.3}}" >{{$nv.suggest.1}}</a></li>
<li class="tool" role="menuitem"><a class="{{$nv.invite.2}}" href="{{$nv.invite.0}}" title="{{$nv.invite.3}}" >{{$nv.invite.1}}</a></li>
</ul>
{{$nv.search}}
</div>
{{/if}}
{{if $lastusers_title}}
<div id="right_lastusers" class="widget">
<h3>{{$lastusers_title}}</h3>
<div id='lastusers-wrapper' class='items-wrapper'>
{{foreach $lastusers_items as $i}}
{{$i}}
{{/foreach}}
</div>
</div>
{{/if}}
{{if $activeusers_title}}
<h3>{{$activeusers_title}}</h3>
<div class='items-wrapper'>
{{foreach $activeusers_items as $i}}
{{$i}}
{{/foreach}}
</div>
{{/if}}

View File

@ -0,0 +1 @@
{{include file="field_input.tpl" field=$helperlist}}

View File

@ -1,5 +1,11 @@
{{include file="field_select.tpl" field=$style}}
{{include file="field_select.tpl" field=$show_pages}}
{{include file="field_select.tpl" field=$show_profiles}}
{{include file="field_select.tpl" field=$show_helpers}}
{{include file="field_select.tpl" field=$show_services}}
{{include file="field_select.tpl" field=$show_friends}}
{{include file="field_select.tpl" field=$show_lastusers}}
<div class="settings-submit-wrapper">
<input type="submit" value="{{$submit}}" class="settings-submit" name="vier-settings-submit" />

View File

@ -9,14 +9,28 @@
* Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
*/
require_once("mod/nodeinfo.php");
require_once("mod/proxy.php");
require_once("include/socgraph.php");
function vier_init(&$a) {
$a->theme_events_in_profile = false;
set_template_engine($a, 'smarty3');
$baseurl = $a->get_baseurl();
$a->theme_info = array();
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] or $a->argv[0] === "network" && local_user()) {
vier_community_info();
$a->page['htmlhead'] .= "<link rel='stylesheet' media='screen and (min-width: 1300px)' href='view/theme/vier/wide.css' />";
}
$a->page['htmlhead'] .= <<< EOT
<link rel='stylesheet' media='screen and (max-width: 1100px)' href='view/theme/vier/narrow.css' />
<script type="text/javascript">
function insertFormatting(comment,BBcode,id) {
@ -68,5 +82,269 @@ function cmtBbClose(id) {
}
</script>
EOT;
// Hide the left menu bar
if (($a->page['aside'] == "") AND in_array($a->argv[0], array("community", "events", "help", "manage", "notifications",
"probe", "webfinger", "login", "invite")))
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
}
function get_vier_config($key, $default = false, $admin = false) {
if (local_user() AND !$admin) {
$result = get_pconfig(local_user(), "vier", $key);
if ($result !== false)
return $result;
}
$result = get_config("vier", $key);
if ($result !== false)
return $result;
return $default;
}
function vier_community_info() {
$a = get_app();
$show_pages = get_vier_config("show_pages", 1);
$show_profiles = get_vier_config("show_profiles", 1);
$show_helpers = get_vier_config("show_helpers", 1);
$show_services = get_vier_config("show_services", 1);
$show_friends = get_vier_config("show_friends", 1);
$show_lastusers = get_vier_config("show_lastusers", 1);
//get_baseurl
$url = $a->get_baseurl($ssl_state);
$aside['$url'] = $url;
// comunity_profiles
if($show_profiles) {
$r = suggestion_query(local_user(), 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
if(count($r)) {
$aside['$comunity_profiles_title'] = t('Community Profiles');
$aside['$comunity_profiles_items'] = array();
foreach($r as $rr) {
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
//'$profile_link' => zrl($rr['url']),
'$profile_link' => $a->get_baseurl().'/follow/?url='.urlencode($rr['url']),
'$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_MICRO),
'$alt_text' => $rr['name'],
));
$aside['$comunity_profiles_items'][] = $entry;
}
}
}
// last 9 users
if($show_lastusers) {
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 ");
$order = " ORDER BY `register_date` DESC ";
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
if(count($r)) {
$aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_items'] = array();
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
$entry = replace_macros($tpl,array(
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $a->get_cached_avatar_image($rr['thumb']),
'$alt_text' => $rr['name']));
$aside['$lastusers_items'][] = $entry;
}
}
}
//right_aside FIND FRIENDS
if ($show_friends AND local_user()) {
$nv = array();
$nv['title'] = Array("", t('Find Friends'), "", "");
$nv['directory'] = Array('directory', t('Local Directory'), "", "");
$nv['global_directory'] = Array(get_server(), t('Global Directory'), "", "");
$nv['match'] = Array('match', t('Similar Interests'), "", "");
$nv['suggest'] = Array('suggest', t('Friend Suggestions'), "", "");
$nv['invite'] = Array('invite', t('Invite Friends'), "", "");
$nv['search'] = '<form name="simple_bar" method="get" action="'.$a->get_baseurl().'/dirfind">
<span class="sbox_l"></span>
<span class="sbox">
<input type="text" name="search" size="13" maxlength="50">
</span>
<span class="sbox_r" id="srch_clear"></span>';
$aside['$nv'] = $nv;
}
//Community_Pages at right_aside
if($show_pages AND local_user()) {
$pagelist = array();
$contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact`
WHERE `network`= '%s' AND `forum` AND `uid` = %d AND
NOT `hidden` AND NOT `blocked` AND
NOT `archive` AND NOT `pending` AND
`success_update` > `failure_update`
ORDER BY `name` ASC",
dbesc(NETWORK_DFRN), intval($a->user['uid']));
$pageD = array();
// Look if the profile is a community page
foreach($contacts as $contact) {
$pageD[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']);
};
$contacts = $pageD;
if ($contacts) {
$page = '
<h3>'.t("Community Pages").'</h3>
<div id="forum-list-right">';
foreach($contacts as $contact) {
$page .= '<div role="menuitem"><a href="' . $a->get_baseurl() . '/redir/' . $contact["id"] . '" title="'.t('External link to forum').'" class="label sparkle" target="_blank"><img class="forumlist-img" height="20" width="20" src="' . $contact['micro'] .'" alt="'.t('External link to forum').'" /></a> <a href="' . $a->get_baseurl() . '/network?f=&cid=' . $contact['id'] . '" >' . $contact["name"]."</a></div>";
}
$page .= '</div>';
$aside['$page'] = $page;
}
}
//END Community Page
//helpers
if($show_helpers) {
$r = array();
$helperlist = get_config("vier", "helperlist");
$helpers = explode(",",$helperlist);
if ($helpers) {
$query = "";
foreach ($helpers AS $index=>$helper) {
if ($query != "")
$query .= ",";
$query .= "'".dbesc(normalise_link(trim($helper)))."'";
}
$r = q("SELECT `url`, `name` FROM `gcontact` WHERE `nurl` IN (%s)", $query);
}
foreach ($r AS $index => $helper)
$r[$index]["url"] = zrl($helper["url"]);
$r[] = Array("url" => "help/Quick-Start-guide", "name" => t("Quick Start"));
$tpl = get_markup_template('ch_helpers.tpl');
if ($r) {
$helpers = array();
$helpers['title'] = Array("", t('Help'), "", "");
$aside['$helpers_items'] = array();
foreach($r as $rr) {
$entry = replace_macros($tpl,array(
'$url' => $rr['url'],
'$title' => $rr['name'],
));
$aside['$helpers_items'][] = $entry;
}
$aside['$helpers'] = $helpers;
}
}
//end helpers
//connectable services
if ($show_services) {
$r = array();
if (nodeinfo_plugin_enabled("appnet"))
$r[] = array("photo" => "images/appnet.png", "name" => "App.net");
if (nodeinfo_plugin_enabled("buffer"))
$r[] = array("photo" => "images/buffer.png", "name" => "Buffer");
if (nodeinfo_plugin_enabled("blogger"))
$r[] = array("photo" => "images/blogger.png", "name" => "Blogger");
if (nodeinfo_plugin_enabled("dwpost"))
$r[] = array("photo" => "images/dreamwidth.png", "name" => "Dreamwidth");
if (nodeinfo_plugin_enabled("fbpost"))
$r[] = array("photo" => "images/facebook.png", "name" => "Facebook");
if (nodeinfo_plugin_enabled("statusnet"))
$r[] = array("photo" => "images/gnusocial.png", "name" => "GNU Social");
if (nodeinfo_plugin_enabled("gpluspost"))
$r[] = array("photo" => "images/googleplus.png", "name" => "Google+");
//if (nodeinfo_plugin_enabled("ijpost"))
// $r[] = array("photo" => "images/", "name" => "");
if (nodeinfo_plugin_enabled("libertree"))
$r[] = array("photo" => "images/libertree.png", "name" => "Libertree");
//if (nodeinfo_plugin_enabled("ljpost"))
// $r[] = array("photo" => "images/", "name" => "");
if (nodeinfo_plugin_enabled("pumpio"))
$r[] = array("photo" => "images/pumpio.png", "name" => "pump.io");
if (nodeinfo_plugin_enabled("tumblr"))
$r[] = array("photo" => "images/tumblr.png", "name" => "Tumblr");
if (nodeinfo_plugin_enabled("twitter"))
$r[] = array("photo" => "images/twitter.png", "name" => "Twitter");
if (nodeinfo_plugin_enabled("wppost"))
$r[] = array("photo" => "images/wordpress", "name" => "Wordpress");
if(function_exists("imap_open") AND !get_config("system","imap_disabled") AND !get_config("system","dfrn_only"))
$r[] = array("photo" => "images/mail", "name" => "E-Mail");
$tpl = get_markup_template('ch_connectors.tpl');
if(count($r)) {
$con_services = array();
$con_services['title'] = Array("", t('Connect Services'), "", "");
$aside['$con_services'] = $con_services;
foreach($r as $rr) {
$entry = replace_macros($tpl,array(
'$url' => $url,
'$photo' => $rr['photo'],
'$alt_text' => $rr['name'],
));
$aside['$connector_items'][] = $entry;
}
}
}
//end connectable services
//print right_aside
$tpl = get_markup_template('communityhome.tpl');
$a->page['right_aside'] = replace_macros($tpl, $aside);
}

50
view/theme/vier/wide.css Normal file
View File

@ -0,0 +1,50 @@
right_aside {
vertical-align: top;
width: 185px;
padding-top: 10px;
padding-right: 20px;
padding-bottom: 0px;
padding-left: 10px;
background-color: #FFFFFF;
font-size: 13px;
overflow-y: auto;
z-index: 2;
line-height: 17px;
color: #737373;
top: 44px;
position: absolute;
/* position: fixed;
height: calc(100% - 54px); */
display: block;
margin-left: calc(100% - 215px);
box-shadow: 1px 2px 0px 0px #D8D8D8;
}
#forumlist-sidebar {
display: none;
}
right_aside span.sbox {
margin-left: 10px;
}
right_aside .directory-item {
width: 50px;
height: 50px;
}
right_aside img.directory-photo-img {
width: 45px;
height: 45px;
}
right_aside #right_services img {
width: 34px;
}
right_aside #lastusers-wrapper,
right_aside div.itens-wrapper,
right_aside #right_services_icons {
margin-left: 10px;
margin-top: 5px;
}