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

View File

@ -11,6 +11,13 @@ function nuke_session() {
unset($_SESSION['cid']);
unset($_SESSION['theme']);
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,6 +71,7 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$name = $entry->displayName;
if(isset($entry->urls)) {
foreach($entry->urls as $url) {
if($url->type == 'profile') {
$profile_url = $url->value;
@ -81,12 +82,15 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
continue;
}
}
}
if(isset($entry->photos)) {
foreach($entry->photos as $photo) {
if($photo->type == 'profile') {
$profile_photo = $photo->value;
continue;
}
}
}
if((! $name) || (! $profile_url) || (! $profile_photo))
continue;

View File

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

View File

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

View File

@ -81,7 +81,7 @@ function notes_content(&$a,$update = false) {
$r = q("SELECT COUNT(*) AS `total`
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
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
$sql_extra ",
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`
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
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
$sql_extra
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)) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$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');
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",
dbesc($resource_id),
intval($page_owner_uid)
@ -1105,7 +1160,7 @@ function photos_content(&$a) {
$photo = array(
'href' => $a->get_baseurl() . '/photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg',
'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)
@ -1185,6 +1240,7 @@ function photos_content(&$a) {
$edit_tpl = get_markup_template('photo_edit.tpl');
$edit = replace_macros($edit_tpl, array(
'$id' => $ph[0]['id'],
'$rotate' => t('Rotate CW'),
'$album' => template_escape($ph[0]['album']),
'$newalbum' => t('New album name'),
'$nickname' => $a->data['user']['nickname'],

View File

@ -10,8 +10,16 @@ function ping_init(&$a) {
<result>";
$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
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'));
$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>
var updateInterval = $update_interval;
var localUser = $local_user;
function confirmDelete() { return confirm("$delitem"); }
function commentOpen(obj,id) {

View File

@ -17,6 +17,11 @@
<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-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" >
<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;
}
#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;
width: 150px;
}
@ -2127,7 +2127,7 @@ aside input[type='text'] {
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;
margin-bottom: 25px;
}
@ -2138,10 +2138,14 @@ aside input[type='text'] {
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;
}
#photo-edit-rotate-end {
margin-bottom: 15px;
}
#photo-edit-delete-button {
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;
}
.fc-event-skin {
background-color: #3465a4 !important;
}
.wall-item-photo, .photo, .contact-block-img, .my-comment-photo {
border-radius: 3px;
-moz-border-radius: 3px;

View File

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

View File