diff --git a/boot.php b/boot.php index e9e0fd360a..dd6bc6ac5d 100644 --- a/boot.php +++ b/boot.php @@ -16,7 +16,7 @@ require_once('include/dbstructure.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Ginger'); -define ( 'FRIENDICA_VERSION', '3.3.2' ); +define ( 'FRIENDICA_VERSION', '3.3.3-RC' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DB_UPDATE_VERSION', 1178 ); define ( 'EOL', "
\r\n" ); diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 6137136305..668544b0bc 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -2,13 +2,14 @@ require_once("include/contact_selectors.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) { @@ -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 "); if($r) { $ret = array(); - foreach($r as $rr) + foreach($r as $rr) $ret[] = intval($rr['id']); return $ret; } @@ -257,7 +258,7 @@ function get_acl_permissions($user = null) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; if(is_array($user)) { - $allow_cid = ((strlen($user['allow_cid'])) + $allow_cid = ((strlen($user['allow_cid'])) ? explode('><', $user['allow_cid']) : array() ); $allow_gid = ((strlen($user['allow_gid'])) ? explode('><', $user['allow_gid']) : array() ); @@ -417,21 +418,21 @@ function acl_lookup(&$a, $out_type = 'json') { } if ($type=='' || $type=='c'){ - $r = q("SELECT COUNT(*) AS c FROM `contact` - WHERE `uid` = %d AND `self` = 0 + $r = q("SELECT COUNT(*) AS c FROM `contact` + WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' $sql_extra2" , intval(local_user()) ); $contact_count = (int)$r[0]['c']; - } + } elseif ($type == 'm') { // autocomplete for Private Messages - $r = q("SELECT COUNT(*) AS c FROM `contact` - WHERE `uid` = %d AND `self` = 0 - AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 + $r = q("SELECT COUNT(*) AS c FROM `contact` + WHERE `uid` = %d AND `self` = 0 + AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `network` IN ('%s','%s','%s') $sql_extra2" , intval(local_user()), dbesc(NETWORK_DFRN), @@ -445,8 +446,8 @@ function acl_lookup(&$a, $out_type = 'json') { // autocomplete for Contacts - $r = q("SELECT COUNT(*) AS c FROM `contact` - WHERE `uid` = %d AND `self` = 0 + $r = q("SELECT COUNT(*) AS c FROM `contact` + WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra2" , intval(local_user()) ); @@ -455,22 +456,22 @@ function acl_lookup(&$a, $out_type = 'json') { } else { $contact_count = 0; } - - + + $tot = $group_count+$contact_count; - + $groups = array(); $contacts = array(); - + if ($type=='' || $type=='g'){ - + $r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids - FROM `group`,`group_member` - WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d + FROM `group`,`group_member` + WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d AND `group_member`.`gid`=`group`.`id` $sql_extra GROUP BY `group`.`id` - ORDER BY `group`.`name` + ORDER BY `group`.`name` LIMIT %d,%d", intval(local_user()), intval($start), @@ -478,7 +479,7 @@ function acl_lookup(&$a, $out_type = 'json') { ); foreach($r as $g){ -// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); +// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); $groups[] = array( "type" => "g", "photo" => "images/twopeople.png", @@ -490,10 +491,10 @@ function acl_lookup(&$a, $out_type = 'json') { ); } } - + 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` != '' $sql_extra2 ORDER BY `name` ASC ", @@ -501,7 +502,7 @@ function acl_lookup(&$a, $out_type = 'json') { ); } 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 AND `network` IN ('%s','%s','%s') $sql_extra2 @@ -513,7 +514,7 @@ function acl_lookup(&$a, $out_type = 'json') { ); } 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 $sql_extra2 ORDER BY `name` ASC ", @@ -533,7 +534,7 @@ function acl_lookup(&$a, $out_type = 'json') { $x['data'] = array(); if(count($r)) { foreach($r as $g) { - $x['photos'][] = $g['micro']; + $x['photos'][] = proxy_url($g['micro']); $x['links'][] = $g['url']; $x['suggestions'][] = $g['name']; $x['data'][] = intval($g['id']); @@ -547,7 +548,7 @@ function acl_lookup(&$a, $out_type = 'json') { foreach($r as $g){ $contacts[] = array( "type" => "c", - "photo" => $g['micro'], + "photo" => proxy_url($g['micro']), "name" => $g['name'], "id" => intval($g['id']), "network" => $g['network'], @@ -555,28 +556,28 @@ function acl_lookup(&$a, $out_type = 'json') { "nick" => ($g['attag']) ? $g['attag'] : $g['nick'], "forum" => $g['forum'] ); - } + } } - + $items = array_merge($groups, $contacts); 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 */ function _contact_link($i){ return dbesc($i['link']); } $known_contacts = array_map(_contact_link, $contacts); $unknow_contacts=array(); - $r = q("select + $r = q("select `author-avatar`,`author-name`,`author-link` from item where parent=%d and ( `author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%' - ) and + ) and `author-link` NOT IN ('%s') GROUP BY `author-link` ORDER BY `author-name` ASC - ", + ", intval($conv_id), dbesc($search), dbesc($search), @@ -592,7 +593,7 @@ function acl_lookup(&$a, $out_type = 'json') { // /nickname $unknow_contacts[] = array( "type" => "c", - "photo" => $row['author-avatar'], + "photo" => proxy_url($row['author-avatar']), "name" => $row['author-name'], "id" => '', "network" => "unknown", @@ -617,14 +618,14 @@ function acl_lookup(&$a, $out_type = 'json') { ); return $o; } - + $o = array( 'tot' => $tot, 'start' => $start, 'count' => $count, 'items' => $items, ); - + echo json_encode($o); killme(); diff --git a/include/api.php b/include/api.php index 7cff2af5f3..2d3c31af0c 100644 --- a/include/api.php +++ b/include/api.php @@ -1643,7 +1643,8 @@ $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); switch($type){ diff --git a/include/text.php b/include/text.php index 9fef4aebb5..b45c2765eb 100644 --- a/include/text.php +++ b/include/text.php @@ -2,6 +2,7 @@ require_once("include/template_processor.php"); require_once("include/friendica_smarty.php"); +require_once("mod/proxy.php"); if(! function_exists('replace_macros')) { /** @@ -928,7 +929,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { . (($click) ? ' fakelink' : '') . '" ' . (($redir) ? ' target="redir" ' : '') . (($url) ? ' href="' . $url . '"' : '') . $click . ' >' . $contact['name']
+			. proxy_url($contact['micro']) . '' . "\r\n"; } }} diff --git a/mod/contacts.php b/mod/contacts.php index 047dc1ea90..300331a9dc 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -3,6 +3,7 @@ require_once('include/Contact.php'); require_once('include/socgraph.php'); require_once('include/contact_selectors.php'); +require_once('mod/proxy.php'); function contacts_init(&$a) { if(! local_user()) @@ -73,12 +74,12 @@ function contacts_init(&$a) { function contacts_batch_actions(&$a){ $contacts_id = $_POST['contact_batch']; if (!is_array($contacts_id)) return; - + $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0", implode(",", $contacts_id), intval(local_user()) ); - + $count_actions=0; foreach($orig_records as $orig_record) { $contact_id = $orig_record['id']; @@ -106,7 +107,7 @@ function contacts_batch_actions(&$a){ if ($count_actions>0) { info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) ); } - + if(x($_SESSION,'return_url')) goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); else @@ -623,11 +624,11 @@ function contacts_content(&$a) { if($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)) : ''); - - $r = q("SELECT COUNT(*) AS `total` FROM `contact` + $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` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ", intval($_SESSION['uid'])); if(count($r)) { @@ -681,7 +682,7 @@ function contacts_content(&$a) { 'id' => $rr['id'], 'alt_text' => $alt_text, 'dir_icon' => $dir_icon, - 'thumb' => $rr['thumb'], + 'thumb' => proxy_url($rr['thumb']), 'name' => $rr['name'], 'username' => $rr['name'], 'sparkle' => $sparkle, diff --git a/mod/display.php b/mod/display.php index 217e0685be..f483977cd4 100644 --- a/mod/display.php +++ b/mod/display.php @@ -106,8 +106,8 @@ function display_fetchauthor($a, $item) { normalise_link($profiledata["url"]), $item["uid"]); if (count($r)) { $profiledata["photo"] = proxy_url($r[0]["photo"]); - $profiledata["address"] = bbcode($r[0]["location"]); - $profiledata["about"] = bbcode($r[0]["about"]); + $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"]; } @@ -118,9 +118,9 @@ function display_fetchauthor($a, $item) { if ($profiledata["photo"] == "") $profiledata["photo"] = proxy_url($r[0]["avatar"]); if ($profiledata["address"] == "") - $profiledata["address"] = bbcode($r[0]["location"]); + $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"])); 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"] != "")) $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"])); if (count($r)) { $profiledata["photo"] = proxy_url($r[0]["avatar"]); - $profiledata["address"] = bbcode($r[0]["location"]); - $profiledata["about"] = bbcode($r[0]["about"]); + $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"]; } diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 8e261e7115..3a6c48a3b2 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -13,6 +13,8 @@ function viewcontacts_init(&$a) { function viewcontacts_content(&$a) { + require_once("mod/proxy.php"); + if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { notice( t('Public access denied.') . EOL); return; @@ -21,7 +23,7 @@ function viewcontacts_content(&$a) { if(((! count($a->profile)) || ($a->profile['hide-friends']))) { notice( t('Permission denied.') . EOL); return; - } + } $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( 'id' => $rr['id'], '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), 'username' => $rr['name'], 'url' => $url, diff --git a/util/vagrant_provision.sh b/util/vagrant_provision.sh index 9988f36256..cd9f632dea 100644 --- a/util/vagrant_provision.sh +++ b/util/vagrant_provision.sh @@ -63,6 +63,13 @@ SQL="${Q1}${Q2}" $MYSQL -uroot -proot -e "$SQL" 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 sudo rm -rf /var/www/ sudo ln -fs /vagrant /var/www diff --git a/view/templates/admin_summary.tpl b/view/templates/admin_summary.tpl index aaa8c95408..8a3ac5bf0a 100644 --- a/view/templates/admin_summary.tpl +++ b/view/templates/admin_summary.tpl @@ -27,7 +27,7 @@
{{$plugins.0}}
{{foreach $plugins.1 as $p}} -
{{$p}}
+
{{$p}}
{{/foreach}}