Merge remote branch 'upstream/master'

This commit is contained in:
zottel 2012-05-02 08:11:52 +02:00
commit 6000e7f30d
20 changed files with 397 additions and 263 deletions

View File

@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1328' );
define ( 'FRIENDICA_VERSION', '2.3.1329' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1141 );
define ( 'DB_UPDATE_VERSION', 1142 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -384,11 +384,13 @@ CREATE TABLE IF NOT EXISTS `glink` (
`cid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`gcid` int(11) NOT NULL,
`zcid` int(11) NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `cid` (`cid`),
KEY `uid` (`uid`),
KEY `gcid` (`gcid`),
KEY `zcid` (`zcid`),
KEY `updated` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -282,7 +282,7 @@ function scrape_feed($url) {
}
}
if(! $basename)
$basename = substr($url,0,strrpos($url,'/')) . '/';
$basename = implode('/', array_slice(explode('/',$url),0,3)) . '/';
$items = $dom->getElementsByTagName('link');

View File

@ -133,3 +133,47 @@ function categories_widget($baseurl,$selected = '') {
));
}
function common_friends_visitor_widget($profile_uid) {
$a = get_app();
if(local_user() == $profile_uid)
return;
$cid = $zcid = 0;
if(can_write_wall($a,$profile_uid))
$cid = local_user();
else {
if(get_my_url()) {
$r = q("select id from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link(get_my_url()))
);
if(count($r))
$zcid = $r[0]['id'];
}
}
if($cid == 0 && $zcid == 0)
return;
require_once('include/socgraph.php');
if($cid)
$t = count_common_friends($profile_uid,$cid);
else
$t = count_common_friends($profile_uid,$cid);
if(! $t)
return;
if($cid)
$r = common_friends($profile_uid,$cid,5);
else
$r = common_friends_zcid($profile_uid,$zcid);
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d friend in common", "%d friends in common", $t), $t),
'$items' => $r
));
};

View File

@ -402,8 +402,8 @@ class enotify {
*/
static public function send($params) {
$fromName = email_header_encode($params['fromName'],'UTF-8');
$messageSubject = email_header_encode($params['messageSubject'],'UTF-8');
$fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');
$messageSubject = email_header_encode(html_entity_decode($params['messageSubject'],ENT_QUOTES,'UTF-8'),'UTF-8');
// generate a mime boundary
$mimeBoundary =rand(0,9)."-"

View File

@ -2,6 +2,7 @@
require_once("boot.php");
require_once('include/Scrape.php');
require_once('include/socgraph.php');
function gprobe_run($argv, $argc){
global $a, $db;
@ -36,21 +37,25 @@ function gprobe_run($argv, $argc){
dbesc(normalise_link($url))
);
if(count($r))
return;
if(! count($r)) {
$arr = probe_url($url);
if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) {
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`)
values ( '%s', '%s', '%s', '%s') ",
dbesc($arr['name']),
dbesc($arr['url']),
dbesc(normalise_link($arr['url'])),
dbesc($arr['photo'])
$arr = probe_url($url);
if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) {
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`)
values ( '%s', '%s', '%s', '%s') ",
dbesc($arr['name']),
dbesc($arr['url']),
dbesc(normalise_link($arr['url'])),
dbesc($arr['photo'])
);
}
$r = q("select * from gcontact where nurl = '%s' limit 1",
dbesc(normalise_link($url))
);
}
if(count($r))
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
return;
}

View File

@ -506,7 +506,7 @@ function onepoll_run($argv, $argc){
}
if(count($r)) {
if(! $r[0]['total']) {
poco_load($contact['id'],$importer_uid,$contact['poco']);
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
}
}

View File

@ -20,7 +20,7 @@ require_once('include/datetime.php');
function poco_load($cid,$uid = 0,$url = null) {
function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$a = get_app();
if($cid) {
@ -53,7 +53,6 @@ function poco_load($cid,$uid = 0,$url = null) {
if(($a->get_curl_code() > 299) || (! $s))
return;
$j = json_decode($s);
logger('poco_load: json: ' . print_r($j,true),LOGGER_DATA);
@ -81,7 +80,6 @@ function poco_load($cid,$uid = 0,$url = null) {
$connect_url = str_replace('acct:' , '', $url->value);
continue;
}
}
foreach($entry->photos as $photo) {
if($photo->type == 'profile') {
@ -128,34 +126,38 @@ function poco_load($cid,$uid = 0,$url = null) {
if(! $gcid)
return;
$r = q("select * from glink where `cid` = %d and `uid` = %d and `gcid` = %d limit 1",
$r = q("select * from glink where `cid` = %d and `uid` = %d and `gcid` = %d and `zcid` = %d limit 1",
intval($cid),
intval($uid),
intval($gcid)
intval($gcid),
intval($zcid)
);
if(! count($r)) {
q("insert into glink ( `cid`,`uid`,`gcid`,`updated`) values (%d,%d,%d,'%s') ",
q("insert into glink ( `cid`,`uid`,`gcid`,`zcid`, `updated`) values (%d,%d,%d,%d, '%s') ",
intval($cid),
intval($uid),
intval($gcid),
intval($zcid),
dbesc(datetime_convert())
);
}
else {
q("update glink set updated = '%s' where `cid` = %d and `uid` = %d and `gcid` = %d limit 1",
q("update glink set updated = '%s' where `cid` = %d and `uid` = %d and `gcid` = %d and zcid = %d limit 1",
dbesc(datetime_convert()),
intval($cid),
intval($uid),
intval($gcid)
intval($gcid),
intval($zcid)
);
}
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
q("delete from glink where `cid` = %d and `uid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY",
q("delete from glink where `cid` = %d and `uid` = %d and `zcid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY",
intval($cid),
intval($uid)
intval($uid),
intval($zcid)
);
}
@ -180,23 +182,58 @@ function count_common_friends($uid,$cid) {
}
function common_friends($uid,$cid) {
function common_friends($uid,$cid,$limit=9999) {
$r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d )
order by `gcontact`.`name` asc ",
order by `gcontact`.`name` asc limit 0, %d",
intval($cid),
intval($uid),
intval($uid),
intval($cid)
intval($cid),
intval($limit)
);
return $r;
}
function count_common_friends_zcid($uid,$zcid) {
$r = q("SELECT count(*) as `total`
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 ) ",
intval($zcid),
intval($uid)
);
if(count($r))
return $r[0]['total'];
return 0;
}
function common_friends_zcid($uid,$zcid,$limit = 6) {
$r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 )
order by `gcontact`.`name` asc limit 0, %d",
intval($zcid),
intval($uid),
intval($limit)
);
return $r;
}
function count_all_friends($uid,$cid) {
$r = q("SELECT count(*) as `total`
@ -254,7 +291,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
$r2 = q("SELECT gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d )
where glink.uid = 0 and glink.cid = 0 and glink.zcid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d )
and not gcontact.name in ( select name from contact where uid = %d )
and not gcontact.id in ( select gcid from gcign where uid = %d )
order by rand() limit %d, %d ",
@ -276,7 +313,7 @@ function update_suggestions() {
$done = array();
poco_load(0,0,$a->get_baseurl() . '/poco');
poco_load(0,0,0,$a->get_baseurl() . '/poco');
$done[] = $a->get_baseurl() . '/poco';
@ -288,7 +325,7 @@ function update_suggestions() {
foreach($j->entries as $entry) {
$url = $entry->url . '/poco';
if(! in_array($url,$done))
poco_load(0,0,$entry->url . '/poco');
poco_load(0,0,0,$entry->url . '/poco');
}
}
}
@ -302,7 +339,7 @@ function update_suggestions() {
foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
poco_load(0,0,$base);
poco_load(0,0,0,$base);
}
}
}

View File

@ -143,6 +143,10 @@ function profile_content(&$a, $update = 0) {
return $o;
}
$o .= common_friends_visitor_widget($a->profile['profile_uid']);
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
$o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1141 );
define( 'UPDATE_VERSION' , 1142 );
/**
*
@ -1229,4 +1229,13 @@ function update_1140() {
if(! $r)
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
}
}
function update_1141() {
$r = q("alter table glink add zcid int(11) not null after gcid, add index(zcid) ");
if(! $r)
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
}

File diff suppressed because it is too large Load Diff

View File

@ -13,4 +13,4 @@
<div class="profile-match-connect"><a href="$connlnk" title="$conntxt">$conntxt</a></div>
{{ endif }}
</div>
</div>

View File

@ -0,0 +1,21 @@
<div id="remote-friends-in-common" class="bigwidget">
<div id="rfic-desc">$desc</div>
{{ if $items }}
{{ for $items as $item }}
<div class="profile-match-wrapper">
<div class="profile-match-photo">
<a href="$item.url">
<img src="$item.photo" width="80" height="80" alt="$item.name" title="$item.name" />
</a>
</div>
<div class="profile-match-break"></div>
<div class="profile-match-name">
<a href="$itemurl" title="$item.name">$item.name</a>
</div>
<div class="profile-match-end"></div>
</div>
{{ endfor }}
{{ endif }}
<div id="rfic-end" class="clear"></div>
</div>

View File

@ -53,9 +53,6 @@ $nv.search
{{ endif }}
</div>
<div id="twitter">
</div>
<div id="close_lastusers">
{{ if $lastusers_title }}
<h3>$lastusers_title<a id="close_lastusers_icon" onClick="close_lastusers()" class="icon close_box" title="close"></a></h3>
@ -96,4 +93,7 @@ $nv.search
{{ endfor }}
</ul>
{{ endif }}
</div>
<div id="twitter">
</div>

View File

@ -1597,9 +1597,10 @@ transition: all 0.2s ease-in-out;
width: 99%;
font-size: 15px;
color: #eec;
border: 1px solid #444;
border: 1px solid #eec;
padding: 0.3em;
margin-bottom: 10px;
background: #444
}
.grey
{

View File

@ -547,7 +547,7 @@ code {
float: right;
}
.tool a {
color: #3465a4;
color: #88a9d2;
}
.tool a:hover {
text-decoration: none;
@ -594,7 +594,7 @@ header #banner a:active,
header #banner a:visited,
header #banner a:link,
header #banner a:hover {
color: #2e2f2e;
color: #eec;
text-decoration: none;
outline: none;
vertical-align: middle;
@ -806,7 +806,7 @@ nav .nav-menu-icon:hover {
}
nav .nav-menu-icon.selected {
background-color: #fff;
background-color: #308dbf;
}
nav .nav-menu-icon img {
width: 22px;
@ -929,7 +929,7 @@ ul.menu-popup {
}
ul.menu-popup a {
display: block;
color: #2e302e;
color: #eec;
padding: 5px 10px;
text-decoration: none;
}
@ -1923,6 +1923,7 @@ body .pageheader{
margin: 0 0 5px;
width: 60%;
border: 1px solid #d2d2d2;
background: #444;
}
#profile-jot-form #jot-title:-webkit-input-placeholder {
font-weight: normal;

View File

@ -195,9 +195,9 @@ function diabook_community_info(){
//Community Page
if(local_user()) {
$page = '<div id="page-sidebar-right_aside" >
$page = '<div id="" >
<h3 style="margin-top:0px;">'.t("Community Pages").'<a id="close_pages_icon" onClick="close_pages()" class="icon close_box" title="close"></a></h3></div>
<div id="sidebar-page-list"><ul>';
<div id=""><ul style="margin-left: 7px;margin-top: 0px;padding-left: 0px;padding-top: 0px;">';
$pagelist = array();
@ -218,7 +218,7 @@ function diabook_community_info(){
$contacts = $pageD;
foreach($contacts as $contact) {
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" style="float: left; margin-right: 3px;" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" style="margin-top: 2px;" title="' . $contact['url'] . '" class="label" target="external-link">'.
$page .= '<li style="list-style-type: none;" class="tool"><img height="20" width="20" style="float: left; margin-right: 3px;" src="' . $contact['micro'] .'" alt="' . $contact['url'] . '" /> <a href="'.$a->get_baseurl().'/redir/'.$contact["id"].'" style="margin-top: 2px; word-wrap: break-word; width: 132px;" title="' . $contact['url'] . '" class="label" target="external-link">'.
$contact["name"]."</a></li>";
}
$page .= '</ul></div></div>';

View File

@ -2,10 +2,10 @@ article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display
audio,canvas,video,time{display:inline-block;*display:inline;*zoom:1;}
audio:not([controls]),[hidden]{display:none;}
html{font-size:100%;overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
body{margin:0;font-size:16px;line-height:1.1em;font-family:sans-serif;color:#222;background-color:#e8e8e8;}
button,input,select,textarea{font-family:sans-serif;color:#222;background-color:#e8e8e8;}
select{border:1px #555 dotted;padding:3px;margin:3px;color:#222;background:#e8e8e8;}
option{padding:3px;color:#222;background:#e8e8e8;}option[selected="selected"]{color:#111;background:#cca;}
body{margin:0;font-size:16px;line-height:1.1em;font-family:sans-serif;color:#111;background-color:#eee;}
button,input,select,textarea{font-family:sans-serif;color:#222;background-color:#eee;}
select{border:1px #555 dotted;padding:3px;margin:3px;color:#222;background:#eee;}
option{padding:3px;color:#222;background:#eee;}option[selected="selected"]{color:#111;background:#cca;}
ul,ol{padding:0;}
:focus{outline:0;}
[disabled="disabled"]{background:#ddd;color:#333;}

View File

@ -13,6 +13,8 @@
/* from html5boilerplate */
/* these are to tell browsers they should be displayed a certain way */
//@import "_base.less";
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section {
display: block; }
@ -44,25 +46,25 @@ body {
font-size: 16px;
line-height: 1.1em;
font-family: sans-serif;
color: #222;
background-color: #e8e8e8; }
color: #111;
background-color: #eee; }
button, input, select, textarea {
font-family: sans-serif;
color: #222;
background-color: #e8e8e8; }
background-color: #eee; }
select {
border: 1px #555 dotted;
padding: 3px;
margin: 3px;
color: #222;
background: #e8e8e8; }
background: #eee; }
option {
padding: 3px;
color: #222;
background: #e8e8e8;
background: #eee;
&[selected="selected"] {
color: #111;
background: #cca; } }