1
0
Fork 0

Merge branch 'master', remote-tracking branch 'remotes/upstream/master'

* remotes/upstream/master:
  photo rotation
  event calendar theming
  import quattro event reminder
  mark bubbles unsupported
  keep FB out of private notes
  clear submanage, etc from session on logout
  if identity (uid) changes - reload any other open browser windows on next ping.

* master:
This commit is contained in:
Simon L'nu 2012-05-23 05:03:05 -04:00
commit bd12902d7b
19 changed files with 417 additions and 269 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1349' ); define ( 'FRIENDICA_VERSION', '3.0.1350' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1144 ); define ( 'DB_UPDATE_VERSION', 1144 );
@ -511,6 +511,7 @@ if(! class_exists('App')) {
$tpl = file_get_contents('view/head.tpl'); $tpl = file_get_contents('view/head.tpl');
$this->page['htmlhead'] = replace_macros($tpl,array( $this->page['htmlhead'] = replace_macros($tpl,array(
'$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!! '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
'$local_user' => local_user(),
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION, '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
'$delitem' => t('Delete this item?'), '$delitem' => t('Delete this item?'),
'$comment' => t('Comment'), '$comment' => t('Comment'),

View file

@ -87,6 +87,12 @@ class Photo {
} }
public function rotate($degrees) {
$this->image = imagerotate($this->image,$degrees,0);
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
}
public function scaleImageUp($min) { public function scaleImageUp($min) {

View file

@ -11,6 +11,13 @@ function nuke_session() {
unset($_SESSION['cid']); unset($_SESSION['cid']);
unset($_SESSION['theme']); unset($_SESSION['theme']);
unset($_SESSION['page_flags']); unset($_SESSION['page_flags']);
unset($_SESSION['submanage']);
unset($_SESSION['my_url']);
unset($_SESSION['my_address']);
unset($_SESSION['addr']);
unset($_SESSION['return_url']);
unset($_SESSION['theme']);
unset($_SESSION['page_flags']);
} }

View file

@ -71,20 +71,24 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$name = $entry->displayName; $name = $entry->displayName;
foreach($entry->urls as $url) { if(isset($entry->urls)) {
if($url->type == 'profile') { foreach($entry->urls as $url) {
$profile_url = $url->value; if($url->type == 'profile') {
continue; $profile_url = $url->value;
} continue;
if($url->type == 'webfinger') { }
$connect_url = str_replace('acct:' , '', $url->value); if($url->type == 'webfinger') {
continue; $connect_url = str_replace('acct:' , '', $url->value);
continue;
}
} }
} }
foreach($entry->photos as $photo) { if(isset($entry->photos)) {
if($photo->type == 'profile') { foreach($entry->photos as $photo) {
$profile_photo = $photo->value; if($photo->type == 'profile') {
continue; $profile_photo = $photo->value;
continue;
}
} }
} }

View file

@ -117,6 +117,9 @@
/* nav update event */ /* nav update event */
$('nav').bind('nav-update', function(e,data){; $('nav').bind('nav-update', function(e,data){;
var invalid = $(data).find('invalid').text();
if(invalid == 1) { window.location.href=window.location.href }
var net = $(data).find('net').text(); var net = $(data).find('net').text();
if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') } if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') }
$('#net-update').html(net); $('#net-update').html(net);
@ -211,7 +214,8 @@
function NavUpdate() { function NavUpdate() {
if(! stopped) { if(! stopped) {
$.get("ping",function(data) { var pingCmd = 'ping' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
$.get(pingCmd,function(data) {
$(data).find('result').each(function() { $(data).find('result').each(function() {
// send nav-update event // send nav-update event
$('nav').trigger('nav-update', this); $('nav').trigger('nav-update', this);

View file

@ -108,6 +108,10 @@ function network_content(&$a, $update = 0) {
return login(false); return login(false);
} }
$arr = array('query' => $a->query_string);
call_hooks('network_content_init', $arr);
$o = ''; $o = '';
// item filter tabs // item filter tabs

View file

@ -81,7 +81,7 @@ function notes_content(&$a,$update = false) {
$r = q("SELECT COUNT(*) AS `total` $r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
$sql_extra ", $sql_extra ",
intval(local_user()) intval(local_user())
@ -96,7 +96,7 @@ function notes_content(&$a,$update = false) {
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid` $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
$sql_extra $sql_extra
ORDER BY `item`.`created` DESC LIMIT %d ,%d ", ORDER BY `item`.`created` DESC LIMIT %d ,%d ",

View file

@ -287,6 +287,7 @@ function photos_post(&$a) {
if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
@ -302,6 +303,60 @@ function photos_post(&$a) {
$albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
if((x($_POST,'rotate') !== false) && (intval($_POST['rotate']) == 1)) {
logger('rotate');
$r = q("select * from photo where `resource-id` = '%s' and uid = %d and scale = 0 limit 1",
dbesc($resource_id),
intval($page_owner_uid)
);
if(count($r)) {
$ph = new Photo($r[0]['data']);
if($ph->is_valid()) {
$ph->rotate(270);
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 0 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
intval($page_owner_uid)
);
if($width > 640 || $height > 640) {
$ph->scaleImage(640);
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 1 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
intval($page_owner_uid)
);
}
if($width > 320 || $height > 320) {
$ph->scaleImage(320);
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("update photo set data = '%s', height = %d, width = %d where `resource-id` = '%s' and uid = %d and scale = 2 limit 1",
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
intval($page_owner_uid)
);
}
}
}
}
$p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC", $p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
@ -1105,7 +1160,7 @@ function photos_content(&$a) {
$photo = array( $photo = array(
'href' => $a->get_baseurl() . '/photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg', 'href' => $a->get_baseurl() . '/photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg',
'title'=> t('View Full Size'), 'title'=> t('View Full Size'),
'src' => $a->get_baseurl() . '/photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' 'src' => $a->get_baseurl() . '/photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' . '?f=&_u=' . datetime_convert('','','','ymdhis')
); );
if($nextlink) if($nextlink)
@ -1185,6 +1240,7 @@ function photos_content(&$a) {
$edit_tpl = get_markup_template('photo_edit.tpl'); $edit_tpl = get_markup_template('photo_edit.tpl');
$edit = replace_macros($edit_tpl, array( $edit = replace_macros($edit_tpl, array(
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],
'$rotate' => t('Rotate CW'),
'$album' => template_escape($ph[0]['album']), '$album' => template_escape($ph[0]['album']),
'$newalbum' => t('New album name'), '$newalbum' => t('New album name'),
'$nickname' => $a->data['user']['nickname'], '$nickname' => $a->data['user']['nickname'],

View file

@ -10,8 +10,16 @@ function ping_init(&$a) {
<result>"; <result>";
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if(local_user()){ if(local_user()){
// Different login session than the page that is calling us.
if(intval($_GET['uid']) && intval($_GET['uid']) != local_user()) {
echo '<invalid>1</invalid></result>';
killme();
}
$firehose = intval(get_pconfig(local_user(),'system','notify_full')); $firehose = intval(get_pconfig(local_user(),'system','notify_full'));
$t = q("select count(*) as total from notify where uid = %d and seen = 0", $t = q("select count(*) as total from notify where uid = %d and seen = 0",

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@
<script> <script>
var updateInterval = $update_interval; var updateInterval = $update_interval;
var localUser = $local_user;
function confirmDelete() { return confirm("$delitem"); } function confirmDelete() { return confirm("$delitem"); }
function commentOpen(obj,id) { function commentOpen(obj,id) {

View file

@ -17,6 +17,11 @@
<input name="newtag" id="photo-edit-newtag" size="84" title="$help_tags" type="text" /> <input name="newtag" id="photo-edit-newtag" size="84" title="$help_tags" type="text" />
<div id="photo-edit-tags-end"></div> <div id="photo-edit-tags-end"></div>
<div id="photo-edit-rotate-wrapper">
<div id="photo-edit-rotate-label">$rotate</div>
<input type="checkbox" name="rotate" value="1" />
</div>
<div id="photo-edit-rotate-end"></div>
<div id="photo-edit-perms" class="photo-edit-perms" > <div id="photo-edit-perms" class="photo-edit-perms" >
<a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button" title="$permissions"/> <a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button" title="$permissions"/>

View file

View file

@ -2118,7 +2118,7 @@ aside input[type='text'] {
margin-bottom: 15px; margin-bottom: 15px;
} }
#photo-edit-caption-label, #photo-edit-tags-label, #photo-edit-albumname-label { #photo-edit-caption-label, #photo-edit-tags-label, #photo-edit-albumname-label, #photo-edit-rotate-label {
float: left; float: left;
width: 150px; width: 150px;
} }
@ -2127,7 +2127,7 @@ aside input[type='text'] {
margin-bottom: 15px; margin-bottom: 15px;
} }
#photo-edit-caption, #photo-edit-newtag, #photo-edit-albumname { #photo-edit-caption, #photo-edit-newtag, #photo-edit-albumname, #photo-edit-rotate {
float: left; float: left;
margin-bottom: 25px; margin-bottom: 25px;
} }
@ -2138,10 +2138,14 @@ aside input[type='text'] {
margin-bottom: 25px; margin-bottom: 25px;
} }
#photo-edit-caption-end, #photo-edit-tags-end, #photo-edit-albumname-end { #photo-edit-caption-end, #photo-edit-tags-end, #photo-edit-albumname-end, #photo-edit-rotate-end {
clear: both; clear: both;
} }
#photo-edit-rotate-end {
margin-bottom: 15px;
}
#photo-edit-delete-button { #photo-edit-delete-button {
margin-left: 200px; margin-left: 200px;
} }

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,39 @@
<link rel='stylesheet' type='text/css' href='$baseurl/library/fullcalendar/fullcalendar.css' />
<script language="javascript" type="text/javascript"
src="$baseurl/library/fullcalendar/fullcalendar.min.js"></script>
<script>
// start calendar from yesterday
var yesterday= new Date()
yesterday.setDate(yesterday.getDate()-1)
function showEvent(eventid) {
$.get(
'$baseurl/events/?id='+eventid,
function(data){
$.fancybox(data);
}
);
}
$(document).ready(function() {
$('#events-reminder').fullCalendar({
firstDay: yesterday.getDay(),
year: yesterday.getFullYear(),
month: yesterday.getMonth(),
date: yesterday.getDate(),
events: '$baseurl/events/json/',
header: {
left: '',
center: '',
right: ''
},
timeFormat: 'H(:mm)',
defaultView: 'basicWeek',
height: 50,
eventClick: function(calEvent, jsEvent, view) {
showEvent(calEvent.id);
}
});
});
</script>
<div id="events-reminder"></div>
<br>

View file

@ -40,6 +40,9 @@ nav #site-location {
right: 36px; right: 36px;
} }
.fc-event-skin {
background-color: #3465a4 !important;
}
.wall-item-photo, .photo, .contact-block-img, .my-comment-photo { .wall-item-photo, .photo, .contact-block-img, .my-comment-photo {
border-radius: 3px; border-radius: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;

View file

@ -45,6 +45,7 @@ function cmtBbClose(id) {
} }
$(document).ready(function() { $(document).ready(function() {
$('html').click(function() { $("#nav-notifications-menu" ).hide(); }); $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
$('.group-edit-icon').hover( $('.group-edit-icon').hover(

View file