aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php19
-rwxr-xr-xinclude/items.php112
-rw-r--r--include/plugin.php1
-rw-r--r--include/text.php2
-rw-r--r--js/main.js156
-rw-r--r--mod/photos.php2
-rw-r--r--mod/pretheme.php12
-rw-r--r--view/common_tabs.tpl2
-rw-r--r--view/conversation.tpl3
-rw-r--r--view/jot-header.tpl6
-rw-r--r--view/photo_edit.tpl9
-rw-r--r--view/photos_upload.tpl8
-rw-r--r--view/profile_edit.tpl14
-rw-r--r--view/theme/dispy/conversation.tpl3
-rw-r--r--view/theme/quattro/conversation.tpl3
15 files changed, 242 insertions, 110 deletions
diff --git a/boot.php b/boot.php
index ac5ce2461..c83cabe72 100644
--- a/boot.php
+++ b/boot.php
@@ -8,6 +8,7 @@ require_once('include/datetime.php');
require_once('include/language.php');
require_once('include/nav.php');
require_once('include/cache.php');
+require_once('library/Mobile_Detect/Mobile_Detect.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
@@ -1454,8 +1455,17 @@ if(! function_exists('current_theme')) {
$a = get_app();
- $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
- $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+ $mobile_detect = new Mobile_Detect();
+ $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
+
+ if($is_mobile) {
+ $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
+ $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
+ }
+ else {
+ $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
+ $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+ }
if($theme_name &&
(file_exists('view/theme/' . $theme_name . '/style.css') ||
@@ -1592,18 +1602,21 @@ if(! function_exists('profile_tabs')){
'url' => $url,
'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
'title' => t('Status Messages and Posts'),
+ 'id' => 'status-tab',
),
array(
'label' => t('Profile'),
'url' => $url.'/?tab=profile',
'sel' => ((isset($tab) && $tab=='profile')?'active':''),
'title' => t('Profile Details'),
+ 'id' => 'profile-tab',
),
array(
'label' => t('Photos'),
'url' => $a->get_baseurl() . '/photos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''),
'title' => t('Photo Albums'),
+ 'id' => 'photo-tab',
),
);
@@ -1613,12 +1626,14 @@ if(! function_exists('profile_tabs')){
'url' => $a->get_baseurl() . '/events',
'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''),
'title' => t('Events and Calendar'),
+ 'id' => 'events-tab',
);
$tabs[] = array(
'label' => t('Personal Notes'),
'url' => $a->get_baseurl() . '/notes',
'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''),
'title' => t('Only You Can See This'),
+ 'id' => 'notes-tab',
);
}
diff --git a/include/items.php b/include/items.php
index b11250f8b..b7115587b 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2014,6 +2014,118 @@ function local_delivery($importer,$data) {
$feed->enable_order_by_date(false);
$feed->init();
+
+ if($feed->error())
+ logger('local_delivery: Error parsing XML: ' . $feed->error());
+
+
+ // Check at the feed level for updated contact name and/or photo
+
+ $name_updated = '';
+ $new_name = '';
+ $photo_timestamp = '';
+ $photo_url = '';
+
+
+ $rawtags = $feed->get_feed_tags( NAMESPACE_DFRN, 'owner');
+ if(! $rawtags)
+ $rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
+ if($rawtags) {
+ $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
+ if($elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated']) {
+ $name_updated = $elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated'];
+ $new_name = $elems['name'][0]['data'];
+ }
+ if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo') && ($elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated'])) {
+ $photo_timestamp = datetime_convert('UTC','UTC',$elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated']);
+ $photo_url = $elems['link'][0]['attribs']['']['href'];
+ }
+ }
+
+ if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) {
+ logger('local_delivery: Updating photo for ' . $importer['name']);
+ require_once("Photo.php");
+ $photo_failure = false;
+ $have_photo = false;
+
+ $r = q("SELECT `resource-id` FROM `photo` WHERE `contact-id` = %d AND `uid` = %d LIMIT 1",
+ intval($importer['id']),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ $resource_id = $r[0]['resource-id'];
+ $have_photo = true;
+ }
+ else {
+ $resource_id = photo_new_resource();
+ }
+
+ $img_str = fetch_url($photo_url,true);
+ // guess mimetype from headers or filename
+ $type = guess_image_type($photo_url,true);
+
+
+ $img = new Photo($img_str, $type);
+ if($img->is_valid()) {
+ if($have_photo) {
+ q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `contact-id` = %d AND `uid` = %d",
+ dbesc($resource_id),
+ intval($importer['id']),
+ intval($importer['importer_uid'])
+ );
+ }
+
+ $img->scaleImageSquare(175);
+
+ $hash = $resource_id;
+ $r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 4);
+
+ $img->scaleImage(80);
+ $r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 5);
+
+ $img->scaleImage(48);
+ $r = $img->store($importer['importer_uid'], $importer['id'], $hash, basename($photo_url), 'Contact Photos', 6);
+
+ $a = get_app();
+
+ q("UPDATE `contact` SET `avatar-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s'
+ WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-4.'.$img->getExt()),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-5.'.$img->getExt()),
+ dbesc($a->get_baseurl() . '/photo/' . $hash . '-6.'.$img->getExt()),
+ intval($importer['importer_uid']),
+ intval($importer['id'])
+ );
+ }
+ }
+
+ if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
+ $r = q("select * from contact where uid = %d and id = %d limit 1",
+ intval($importer['importer_uid']),
+ intval($importer['id'])
+ );
+
+ $x = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ dbesc(notags(trim($new_name))),
+ dbesc(datetime_convert()),
+ intval($importer['importer_uid']),
+ intval($importer['id'])
+ );
+
+ // do our best to update the name on content items
+
+ if(count($r)) {
+ q("update item set `author-name` = '%s' where `author-name` = '%s' and `author-link` = '%s' and uid = %d",
+ dbesc(notags(trim($new_name))),
+ dbesc($r[0]['name']),
+ dbesc($r[0]['url']),
+ intval($importer['importer_uid'])
+ );
+ }
+ }
+
+
/*
// Currently unsupported - needs a lot of work
$reloc = $feed->get_feed_tags( NAMESPACE_DFRN, 'relocate' );
diff --git a/include/plugin.php b/include/plugin.php
index f60a7d296..8f6d6ea98 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -256,6 +256,7 @@ function get_theme_info($theme){
'author' => array(),
'maintainer' => array(),
'version' => "",
+ 'credits' => "",
'experimental' => false,
'unsupported' => false
);
diff --git a/include/text.php b/include/text.php
index 36177a78d..9d52fd076 100644
--- a/include/text.php
+++ b/include/text.php
@@ -403,7 +403,7 @@ function load_view_file($s) {
return file_get_contents("$d/$lang/$b");
$theme = current_theme();
-
+
if(file_exists("$d/theme/$theme/$b"))
return file_get_contents("$d/theme/$theme/$b");
diff --git a/js/main.js b/js/main.js
index e53373aed..47ce61704 100644
--- a/js/main.js
+++ b/js/main.js
@@ -210,6 +210,91 @@
timer = setTimeout(NavUpdate,updateInterval);
}
+
+function updateConvItems(mode,data) {
+
+ if(mode === 'update') {
+ prev = 'threads-begin';
+
+ $('.thread-wrapper',data).each(function() {
+ var ident = $(this).attr('id');
+
+ if($('#' + ident).length == 0 && profile_page == 1) {
+ $('img',this).each(function() {
+ $(this).attr('src',$(this).attr('dst'));
+ });
+ $('#' + prev).after($(this));
+ $("abbr.wall-item-ago-time").timeago();
+
+ }
+ else {
+ $('img',this).each(function() {
+ $(this).attr('src',$(this).attr('dst'));
+ });
+ $('#' + ident).replaceWith($(this));
+ $("abbr.wall-item-ago-time").timeago();
+ }
+ prev = ident;
+ });
+ }
+ if(mode === 'append') {
+ next = 'threads-end';
+ $('.thread-wrapper',data).each(function() {
+ var ident = $(this).attr('id');
+
+ if($('#' + ident).length == 0) {
+ $('img',this).each(function() {
+ $(this).attr('src',$(this).attr('dst'));
+ });
+ $('#threads-end').before($(this));
+ $("abbr.wall-item-ago-time").timeago();
+ }
+ else {
+ $('img',this).each(function() {
+ $(this).attr('src',$(this).attr('dst'));
+ });
+ $('#' + ident).replaceWith($(this));
+ $("abbr.wall-item-ago-time").timeago();
+ }
+ });
+ }
+ if(mode === 'replace') {
+ // clear existing content
+ $('.thread-wrapper',data).each(function() {
+ var ident = $(this).attr('id');
+
+ if($('#' + ident).length == 0 && profile_page == 1) {
+ $('img',this).each(function() {
+ $(this).attr('src',$(this).attr('dst'));
+ });
+ $('#' + prev).after($(this));
+ $("abbr.wall-item-ago-time").timeago();
+
+ }
+ prev = ident;
+ });
+ }
+
+ $('.like-rotator').hide();
+
+ if(commentBusy) {
+ commentBusy = false;
+ $('body').css('cursor', 'auto');
+ }
+
+ /* autocomplete @nicknames */
+ $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
+
+
+}
+
+
+
+
+
+
+
+
function liveUpdate() {
if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
if(($('.comment-edit-text-full').length) || (in_progress)) {
@@ -230,74 +315,7 @@
$.get(update_url,function(data) {
in_progress = false;
- // $('.collapsed-comments',data).each(function() {
- // var ident = $(this).attr('id');
- // var is_hidden = $('#' + ident).is(':hidden');
- // if($('#' + ident).length) {
- // $('#' + ident).replaceWith($(this));
- // if(is_hidden)
- // $('#' + ident).hide();
- // }
- //});
-
- // add a new thread
-
- $('.thread-wrapper',data).each(function() {
- var ident = $(this).attr('id');
-
- if($('#' + ident).length == 0 && profile_page == 1) {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- $('#' + prev).after($(this));
- $("abbr.wall-item-ago-time").timeago();
-
- }
- else {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- $('#' + ident).replaceWith($(this));
- $("abbr.wall-item-ago-time").timeago();
-
- }
- prev = ident;
- });
-
- // reset vars for inserting individual items
-
- /* prev = 'live-' + src;
-
- $('.wall-item-outside-wrapper',data).each(function() {
- var ident = $(this).attr('id');
-
- if($('#' + ident).length == 0 && prev != 'live-' + src) {
- $('img',this).each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- $('#' + prev).after($(this));
- }
- else {
- $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
- if($('#' + ident + ' ' + '.comment-edit-text-empty').length)
- $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
- $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total'));
- $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
- $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
- $('#' + ident + ' ' + '.my-comment-photo').each(function() {
- $(this).attr('src',$(this).attr('dst'));
- });
- }
- prev = ident;
- });
- */
- $('.like-rotator').hide();
- if(commentBusy) {
- commentBusy = false;
- $('body').css('cursor', 'auto');
- }
- /* autocomplete @nicknames */
- $(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");
+ updateConvItems('update',data);
});
@@ -654,7 +672,7 @@ Array.prototype.remove = function(item) {
function previewTheme(elm) {
theme = $(elm).val();
$.getJSON('pretheme?f=&theme=' + theme,function(data) {
- $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
+ $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
});
}
diff --git a/mod/photos.php b/mod/photos.php
index ed86fae23..0354b1941 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -985,7 +985,7 @@ function photos_content(&$a) {
call_hooks('photo_upload_form',$ret);
- $default_upload = '<input type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
+ $default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
diff --git a/mod/pretheme.php b/mod/pretheme.php
index 0efa587d8..4584cb29e 100644
--- a/mod/pretheme.php
+++ b/mod/pretheme.php
@@ -7,10 +7,16 @@ function pretheme_init(&$a) {
$info = get_theme_info($theme);
if($info) {
// unfortunately there will be no translation for this string
- $desc = $info['description'] . ' ' . $info['version'];
+ $desc = $info['description'];
+ $version = $info['version'];
+ $credits = $info['credits'];
}
- else $desc = '';
- echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc));
+ else {
+ $desc = '';
+ $version = '';
+ $credits = '';
+ }
+ echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits));
}
killme();
}
diff --git a/view/common_tabs.tpl b/view/common_tabs.tpl
index 22c33d6b1..f8ceff46a 100644
--- a/view/common_tabs.tpl
+++ b/view/common_tabs.tpl
@@ -1,5 +1,5 @@
<ul class="tabs">
{{ for $tabs as $tab }}
- <li><a href="$tab.url" class="tab button $tab.sel"{{ if $tab.title }} title="$tab.title"{{ endif }}>$tab.label</a></li>
+ <li id="$tab.id"><a href="$tab.url" class="tab button $tab.sel"{{ if $tab.title }} title="$tab.title"{{ endif }}>$tab.label</a></li>
{{ endfor }}
</ul>
diff --git a/view/conversation.tpl b/view/conversation.tpl
index fe8304a6c..70cd389c9 100644
--- a/view/conversation.tpl
+++ b/view/conversation.tpl
@@ -1,3 +1,4 @@
+<div id="threads-begin"></div>
{{ for $threads as $thread }}
<div id="thread-wrapper-$thread.id" class="thread-wrapper">
{{ for $thread.items as $item }}
@@ -15,7 +16,7 @@
{{ endfor }}
</div>
{{ endfor }}
-
+<div id="threads-end"></div>
<div id="conversation-end"></div>
{{ if $dropping }}
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index f1c283470..64bcf27ca 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -283,9 +283,9 @@ function enableOnUser(){
if(reply && reply.length) {
commentBusy = true;
$('body').css('cursor', 'wait');
- $.get('filer/' + id + '?term=' + reply);
- if(timer) clearTimeout(timer);
- timer = setTimeout(NavUpdate,3000);
+ $.get('filer/' + id + '?term=' + reply, NavUpdate);
+// if(timer) clearTimeout(timer);
+// timer = setTimeout(NavUpdate,3000);
liking = 1;
$.fancybox.close();
} else {
diff --git a/view/photo_edit.tpl b/view/photo_edit.tpl
index 85d5fb8e2..53b69caae 100644
--- a/view/photo_edit.tpl
+++ b/view/photo_edit.tpl
@@ -28,7 +28,7 @@
<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"/>
+ <a href="#photo-edit-perms-select" id="photo-edit-perms-menu" class="button popupbox" title="$permissions"/>
<span id="jot-perms-icon" class="icon $lockstate" ></span>$permissions
</a>
<div id="photo-edit-perms-menu-end"></div>
@@ -47,9 +47,4 @@
<div id="photo-edit-end"></div>
</form>
-<script>
- $("a#photo-edit-perms-menu").fancybox({
- 'transitionIn' : 'none',
- 'transitionOut' : 'none'
- });
-</script>
+
diff --git a/view/photos_upload.tpl b/view/photos_upload.tpl
index 706b3398d..33c48cbeb 100644
--- a/view/photos_upload.tpl
+++ b/view/photos_upload.tpl
@@ -23,7 +23,7 @@
<div id="photos-upload-perms" class="photos-upload-perms" >
- <a href="#photos-upload-permissions-wrapper" id="photos-upload-perms-menu" class="button" />
+ <a href="#photos-upload-permissions-wrapper" id="photos-upload-perms-menu" class="button popupbox" />
<span id="jot-perms-icon" class="icon $lockstate" ></span>$permissions
</a>
<div id="photos-upload-perms-end"></div>
@@ -43,9 +43,3 @@
<div class="photos-upload-end" ></div>
</form>
-<script>
- $("a#photos-upload-perms-menu").fancybox({
- 'transitionIn' : 'none',
- 'transitionOut' : 'none'
- });
-</script>
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl
index 64cd47324..bc342cc3b 100644
--- a/view/profile_edit.tpl
+++ b/view/profile_edit.tpl
@@ -172,7 +172,6 @@ $lbl_about
</div>
<div id="about-jot-end"></div>
-</div>
<div id="interest-jot-wrapper" >
@@ -184,7 +183,6 @@ $lbl_hobbies
</div>
<div id="interest-jot-end"></div>
-</div>
<div id="likes-jot-wrapper" >
@@ -196,7 +194,6 @@ $lbl_likes
</div>
<div id="likes-jot-end"></div>
-</div>
<div id="dislikes-jot-wrapper" >
@@ -208,7 +205,6 @@ $lbl_dislikes
</div>
<div id="dislikes-jot-end"></div>
-</div>
<div id="contact-jot-wrapper" >
@@ -220,7 +216,6 @@ $lbl_social
</div>
<div id="contact-jot-end"></div>
-</div>
<div class="profile-edit-submit-wrapper" >
@@ -238,7 +233,6 @@ $lbl_music
</div>
<div id="music-jot-end"></div>
-</div>
<div id="book-jot-wrapper" >
<p id="book-jot-desc" >
@@ -249,7 +243,6 @@ $lbl_book
</div>
<div id="book-jot-end"></div>
-</div>
@@ -262,7 +255,6 @@ $lbl_tv
</div>
<div id="tv-jot-end"></div>
-</div>
@@ -275,7 +267,6 @@ $lbl_film
</div>
<div id="film-jot-end"></div>
-</div>
<div class="profile-edit-submit-wrapper" >
@@ -293,7 +284,6 @@ $lbl_love
</div>
<div id="romance-jot-end"></div>
-</div>
@@ -306,7 +296,6 @@ $lbl_work
</div>
<div id="work-jot-end"></div>
-</div>
@@ -319,7 +308,6 @@ $lbl_school
</div>
<div id="education-jot-end"></div>
-</div>
@@ -331,4 +319,4 @@ $lbl_school
</form>
</div>
-<script type="text/javascript">Fill_Country('$country_name');Fill_States('$region');</script> \ No newline at end of file
+<script type="text/javascript">Fill_Country('$country_name');Fill_States('$region');</script>
diff --git a/view/theme/dispy/conversation.tpl b/view/theme/dispy/conversation.tpl
index 325adb972..a42585597 100644
--- a/view/theme/dispy/conversation.tpl
+++ b/view/theme/dispy/conversation.tpl
@@ -1,3 +1,4 @@
+<div id="threads-begin"></div>
{{ for $threads as $thread }}
<div id="thread-wrapper-$thread.id" class="thread-wrapper">
{{ for $thread.items as $item }}
@@ -15,7 +16,7 @@
{{ endfor }}
</div>
{{ endfor }}
-
+<div id="threads-end"></div>
<div id="conversation-end"></div>
{{ if $dropping }}
diff --git a/view/theme/quattro/conversation.tpl b/view/theme/quattro/conversation.tpl
index 794360165..48ab4364a 100644
--- a/view/theme/quattro/conversation.tpl
+++ b/view/theme/quattro/conversation.tpl
@@ -1,3 +1,4 @@
+<div id="threads-begin"></div>
{{ for $threads as $thread }}
<div id="thread-wrapper-$thread.id" class="thread-wrapper">
{{ for $thread.items as $item }}
@@ -21,7 +22,7 @@
{{ endfor }}
</div>
{{ endfor }}
-
+<div id="threads-end"></div>
<div id="conversation-end"></div>
{{ if $dropping }}