Merge remote-tracking branch 'upstream/develop' into 1501-central-item-storage

This commit is contained in:
Michael Vogel 2015-02-01 13:28:32 +01:00
commit e02b982f77
9 changed files with 70 additions and 57 deletions

View file

@ -16,7 +16,7 @@ require_once('include/dbstructure.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Ginger'); define ( 'FRIENDICA_CODENAME', 'Ginger');
define ( 'FRIENDICA_VERSION', '3.3.2' ); define ( 'FRIENDICA_VERSION', '3.3.3-RC' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1178 ); define ( 'DB_UPDATE_VERSION', 1178 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );

View file

@ -2,13 +2,14 @@
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("include/features.php"); require_once("include/features.php");
require_once("mod/proxy.php");
/** /**
* *
*/ */
/** /**
* @package acl_selectors * @package acl_selectors
*/ */
function group_select($selname,$selclass,$preselected = false,$size = 4) { function group_select($selname,$selclass,$preselected = false,$size = 4) {
@ -245,7 +246,7 @@ function prune_deadguys($arr) {
$r = q("select id from contact where id in ( " . $str . ") and blocked = 0 and pending = 0 and archive = 0 "); $r = q("select id from contact where id in ( " . $str . ") and blocked = 0 and pending = 0 and archive = 0 ");
if($r) { if($r) {
$ret = array(); $ret = array();
foreach($r as $rr) foreach($r as $rr)
$ret[] = intval($rr['id']); $ret[] = intval($rr['id']);
return $ret; return $ret;
} }
@ -257,7 +258,7 @@ function get_acl_permissions($user = null) {
$allow_cid = $allow_gid = $deny_cid = $deny_gid = false; $allow_cid = $allow_gid = $deny_cid = $deny_gid = false;
if(is_array($user)) { if(is_array($user)) {
$allow_cid = ((strlen($user['allow_cid'])) $allow_cid = ((strlen($user['allow_cid']))
? explode('><', $user['allow_cid']) : array() ); ? explode('><', $user['allow_cid']) : array() );
$allow_gid = ((strlen($user['allow_gid'])) $allow_gid = ((strlen($user['allow_gid']))
? explode('><', $user['allow_gid']) : array() ); ? explode('><', $user['allow_gid']) : array() );
@ -417,21 +418,21 @@ function acl_lookup(&$a, $out_type = 'json') {
} }
if ($type=='' || $type=='c'){ if ($type=='' || $type=='c'){
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `notify` != '' $sql_extra2" , AND `notify` != '' $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
$contact_count = (int)$r[0]['c']; $contact_count = (int)$r[0]['c'];
} }
elseif ($type == 'm') { elseif ($type == 'm') {
// autocomplete for Private Messages // autocomplete for Private Messages
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s') $sql_extra2" , AND `network` IN ('%s','%s','%s') $sql_extra2" ,
intval(local_user()), intval(local_user()),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -445,8 +446,8 @@ function acl_lookup(&$a, $out_type = 'json') {
// autocomplete for Contacts // autocomplete for Contacts
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND `self` = 0
AND `pending` = 0 $sql_extra2" , AND `pending` = 0 $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
@ -455,22 +456,22 @@ function acl_lookup(&$a, $out_type = 'json') {
} else { } else {
$contact_count = 0; $contact_count = 0;
} }
$tot = $group_count+$contact_count; $tot = $group_count+$contact_count;
$groups = array(); $groups = array();
$contacts = array(); $contacts = array();
if ($type=='' || $type=='g'){ if ($type=='' || $type=='g'){
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids $r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids
FROM `group`,`group_member` FROM `group`,`group_member`
WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d
AND `group_member`.`gid`=`group`.`id` AND `group_member`.`gid`=`group`.`id`
$sql_extra $sql_extra
GROUP BY `group`.`id` GROUP BY `group`.`id`
ORDER BY `group`.`name` ORDER BY `group`.`name`
LIMIT %d,%d", LIMIT %d,%d",
intval(local_user()), intval(local_user()),
intval($start), intval($start),
@ -478,7 +479,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
foreach($r as $g){ foreach($r as $g){
// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); // logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
$groups[] = array( $groups[] = array(
"type" => "g", "type" => "g",
"photo" => "images/twopeople.png", "photo" => "images/twopeople.png",
@ -490,10 +491,10 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
} }
if ($type=='' || $type=='c'){ if ($type=='' || $type=='c'){
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, forum FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -501,7 +502,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
elseif($type == 'm') { elseif($type == 'm') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0
AND `network` IN ('%s','%s','%s') AND `network` IN ('%s','%s','%s')
$sql_extra2 $sql_extra2
@ -513,7 +514,7 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
} }
elseif($type == 'a') { elseif($type == 'a') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
WHERE `uid` = %d AND `pending` = 0 WHERE `uid` = %d AND `pending` = 0
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -533,7 +534,7 @@ function acl_lookup(&$a, $out_type = 'json') {
$x['data'] = array(); $x['data'] = array();
if(count($r)) { if(count($r)) {
foreach($r as $g) { foreach($r as $g) {
$x['photos'][] = $g['micro']; $x['photos'][] = proxy_url($g['micro']);
$x['links'][] = $g['url']; $x['links'][] = $g['url'];
$x['suggestions'][] = $g['name']; $x['suggestions'][] = $g['name'];
$x['data'][] = intval($g['id']); $x['data'][] = intval($g['id']);
@ -547,7 +548,7 @@ function acl_lookup(&$a, $out_type = 'json') {
foreach($r as $g){ foreach($r as $g){
$contacts[] = array( $contacts[] = array(
"type" => "c", "type" => "c",
"photo" => $g['micro'], "photo" => proxy_url($g['micro']),
"name" => $g['name'], "name" => $g['name'],
"id" => intval($g['id']), "id" => intval($g['id']),
"network" => $g['network'], "network" => $g['network'],
@ -555,28 +556,28 @@ function acl_lookup(&$a, $out_type = 'json') {
"nick" => ($g['attag']) ? $g['attag'] : $g['nick'], "nick" => ($g['attag']) ? $g['attag'] : $g['nick'],
"forum" => $g['forum'] "forum" => $g['forum']
); );
} }
} }
$items = array_merge($groups, $contacts); $items = array_merge($groups, $contacts);
if ($conv_id) { if ($conv_id) {
/* if $conv_id is set, get unknow contacts in thread */ /* if $conv_id is set, get unknow contacts in thread */
/* but first get know contacts url to filter them out */ /* but first get know contacts url to filter them out */
function _contact_link($i){ return dbesc($i['link']); } function _contact_link($i){ return dbesc($i['link']); }
$known_contacts = array_map(_contact_link, $contacts); $known_contacts = array_map(_contact_link, $contacts);
$unknow_contacts=array(); $unknow_contacts=array();
$r = q("select $r = q("select
`author-avatar`,`author-name`,`author-link` `author-avatar`,`author-name`,`author-link`
from item where parent=%d from item where parent=%d
and ( and (
`author-name` LIKE '%%%s%%' OR `author-name` LIKE '%%%s%%' OR
`author-link` LIKE '%%%s%%' `author-link` LIKE '%%%s%%'
) and ) and
`author-link` NOT IN ('%s') `author-link` NOT IN ('%s')
GROUP BY `author-link` GROUP BY `author-link`
ORDER BY `author-name` ASC ORDER BY `author-name` ASC
", ",
intval($conv_id), intval($conv_id),
dbesc($search), dbesc($search),
dbesc($search), dbesc($search),
@ -592,7 +593,7 @@ function acl_lookup(&$a, $out_type = 'json') {
// /nickname // /nickname
$unknow_contacts[] = array( $unknow_contacts[] = array(
"type" => "c", "type" => "c",
"photo" => $row['author-avatar'], "photo" => proxy_url($row['author-avatar']),
"name" => $row['author-name'], "name" => $row['author-name'],
"id" => '', "id" => '',
"network" => "unknown", "network" => "unknown",
@ -617,14 +618,14 @@ function acl_lookup(&$a, $out_type = 'json') {
); );
return $o; return $o;
} }
$o = array( $o = array(
'tot' => $tot, 'tot' => $tot,
'start' => $start, 'start' => $start,
'count' => $count, 'count' => $count,
'items' => $items, 'items' => $items,
); );
echo json_encode($o); echo json_encode($o);
killme(); killme();

View file

@ -1643,7 +1643,8 @@
$user_info = api_get_user($a); $user_info = api_get_user($a);
$ret = api_format_items($item,$user_info)[0]; $rets = api_format_items($item,$user_info);
$ret = $rets[0];
$data = array('$status' => $ret); $data = array('$status' => $ret);
switch($type){ switch($type){

View file

@ -2,6 +2,7 @@
require_once("include/template_processor.php"); require_once("include/template_processor.php");
require_once("include/friendica_smarty.php"); require_once("include/friendica_smarty.php");
require_once("mod/proxy.php");
if(! function_exists('replace_macros')) { if(! function_exists('replace_macros')) {
/** /**
@ -928,7 +929,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
. (($click) ? ' fakelink' : '') . '" ' . (($click) ? ' fakelink' : '') . '" '
. (($redir) ? ' target="redir" ' : '') . (($redir) ? ' target="redir" ' : '')
. (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="' . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
. $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name'] . proxy_url($contact['micro']) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
. '" /></a></div>' . "\r\n"; . '" /></a></div>' . "\r\n";
} }
}} }}

View file

@ -3,6 +3,7 @@
require_once('include/Contact.php'); require_once('include/Contact.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/proxy.php');
function contacts_init(&$a) { function contacts_init(&$a) {
if(! local_user()) if(! local_user())
@ -73,12 +74,12 @@ function contacts_init(&$a) {
function contacts_batch_actions(&$a){ function contacts_batch_actions(&$a){
$contacts_id = $_POST['contact_batch']; $contacts_id = $_POST['contact_batch'];
if (!is_array($contacts_id)) return; if (!is_array($contacts_id)) return;
$orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0", $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
implode(",", $contacts_id), implode(",", $contacts_id),
intval(local_user()) intval(local_user())
); );
$count_actions=0; $count_actions=0;
foreach($orig_records as $orig_record) { foreach($orig_records as $orig_record) {
$contact_id = $orig_record['id']; $contact_id = $orig_record['id'];
@ -106,7 +107,7 @@ function contacts_batch_actions(&$a){
if ($count_actions>0) { if ($count_actions>0) {
info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) ); info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) );
} }
if(x($_SESSION,'return_url')) if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
else else
@ -623,11 +624,11 @@ function contacts_content(&$a) {
if($nets) if($nets)
$sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets)); $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
intval($_SESSION['uid'])); intval($_SESSION['uid']));
if(count($r)) { if(count($r)) {
@ -681,7 +682,7 @@ function contacts_content(&$a) {
'id' => $rr['id'], 'id' => $rr['id'],
'alt_text' => $alt_text, 'alt_text' => $alt_text,
'dir_icon' => $dir_icon, 'dir_icon' => $dir_icon,
'thumb' => $rr['thumb'], 'thumb' => proxy_url($rr['thumb']),
'name' => $rr['name'], 'name' => $rr['name'],
'username' => $rr['name'], 'username' => $rr['name'],
'sparkle' => $sparkle, 'sparkle' => $sparkle,

View file

@ -106,8 +106,8 @@ function display_fetchauthor($a, $item) {
normalise_link($profiledata["url"]), $item["uid"]); normalise_link($profiledata["url"]), $item["uid"]);
if (count($r)) { if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["photo"]); $profiledata["photo"] = proxy_url($r[0]["photo"]);
$profiledata["address"] = bbcode($r[0]["location"]); $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
$profiledata["about"] = bbcode($r[0]["about"]); $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if ($r[0]["nick"] != "") if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
} }
@ -118,9 +118,9 @@ function display_fetchauthor($a, $item) {
if ($profiledata["photo"] == "") if ($profiledata["photo"] == "")
$profiledata["photo"] = proxy_url($r[0]["avatar"]); $profiledata["photo"] = proxy_url($r[0]["avatar"]);
if ($profiledata["address"] == "") if ($profiledata["address"] == "")
$profiledata["address"] = bbcode($r[0]["location"]); $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
if ($profiledata["about"] == "") if ($profiledata["about"] == "")
$profiledata["about"] = bbcode($r[0]["about"]); $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != "")) if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
} }
@ -184,8 +184,8 @@ function display_fetchauthor($a, $item) {
$r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"])); $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
if (count($r)) { if (count($r)) {
$profiledata["photo"] = proxy_url($r[0]["avatar"]); $profiledata["photo"] = proxy_url($r[0]["avatar"]);
$profiledata["address"] = bbcode($r[0]["location"]); $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
$profiledata["about"] = bbcode($r[0]["about"]); $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
if ($r[0]["nick"] != "") if ($r[0]["nick"] != "")
$profiledata["nickname"] = $r[0]["nick"]; $profiledata["nickname"] = $r[0]["nick"];
} }

View file

@ -13,6 +13,8 @@ function viewcontacts_init(&$a) {
function viewcontacts_content(&$a) { function viewcontacts_content(&$a) {
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL); notice( t('Public access denied.') . EOL);
return; return;
@ -21,7 +23,7 @@ function viewcontacts_content(&$a) {
if(((! count($a->profile)) || ($a->profile['hide-friends']))) { if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
$r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ", $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
@ -60,7 +62,7 @@ function viewcontacts_content(&$a) {
$contacts[] = array( $contacts[] = array(
'id' => $rr['id'], 'id' => $rr['id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'thumb' => $rr['thumb'], 'thumb' => proxy_url($rr['thumb']),
'name' => substr($rr['name'],0,20), 'name' => substr($rr['name'],0,20),
'username' => $rr['name'], 'username' => $rr['name'],
'url' => $url, 'url' => $url,

View file

@ -63,6 +63,13 @@ SQL="${Q1}${Q2}"
$MYSQL -uroot -proot -e "$SQL" $MYSQL -uroot -proot -e "$SQL"
service mysql restart service mysql restart
#configure rudimentary mail server (local delivery only)
#add Friendica accounts for local user accounts, use email address like vagrant@friendica.dev, read the email with 'mail'.
debconf-set-selections <<< "postfix postfix/mailname string friendica.dev"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local Only'"
apt-get install -y postfix
apt-get install mailutils
#make the vagrant directory the docroot #make the vagrant directory the docroot
sudo rm -rf /var/www/ sudo rm -rf /var/www/
sudo ln -fs /vagrant /var/www sudo ln -fs /vagrant /var/www

View file

@ -27,7 +27,7 @@
<dt>{{$plugins.0}}</dt> <dt>{{$plugins.0}}</dt>
{{foreach $plugins.1 as $p}} {{foreach $plugins.1 as $p}}
<dd>{{$p}}</dd> <dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
{{/foreach}} {{/foreach}}
</dl> </dl>