This commit is contained in:
Thomas Willingham 2012-09-13 20:52:06 +01:00
commit 1957aa8f0d
15 changed files with 1446 additions and 866 deletions

View File

@ -11,9 +11,9 @@ require_once('include/cache.php');
require_once('library/Mobile_Detect/Mobile_Detect.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1463' );
define ( 'FRIENDICA_VERSION', '3.0.1464' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1154 );
define ( 'DB_UPDATE_VERSION', 1155 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -1511,6 +1511,11 @@ if(! function_exists('current_theme')) {
$is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
if($is_mobile) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$system_theme = '';
$theme_name = '';
}
else {
$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);
@ -1520,6 +1525,7 @@ if(! function_exists('current_theme')) {
$theme_name = '';
}
}
}
if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
@ -1760,3 +1766,20 @@ function build_querystring($params, $name=null) {
}
return $ret;
}
/**
* Returns the complete URL of the current page, e.g.: http(s)://something.com/network
*
* Taken from http://webcheatsheet.com/php/get_current_page_url.php
*/
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

View File

@ -260,6 +260,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`type` char(255) NOT NULL,
`nofinish` tinyint(1) NOT NULL DEFAULT '0',
`adjust` tinyint(1) NOT NULL DEFAULT '1',
`ignore` tinyint(1) NOT NULL DEFAULT '0',
`allow_cid` mediumtext NOT NULL,
`allow_gid` mediumtext NOT NULL,
`deny_cid` mediumtext NOT NULL,
@ -271,7 +272,8 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `type` ( `type` ),
KEY `start` ( `start` ),
KEY `finish` ( `finish` ),
KEY `adjust` ( `adjust` )
KEY `adjust` ( `adjust` ),
KEY `ignore` ( `ignore` ),
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View File

@ -1184,6 +1184,15 @@ function tag_deliver($uid,$item_id) {
// send a notification
// use a local photo if we have one
$r = q("select thumb from contact where uid = %d and nurl = '%s' limit 1",
intval($u[0]['uid']),
dbesc(normalise_link($item['author-link']))
);
$photo = (($r && count($r)) ? $r[0]['thumb'] : $item['author-avatar']);
require_once('include/enotify.php');
notification(array(
'type' => NOTIFY_TAGSELF,
@ -1196,7 +1205,7 @@ function tag_deliver($uid,$item_id) {
'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
'source_name' => $item['author-name'],
'source_link' => $item['author-link'],
'source_photo' => $item['author-avatar'],
'source_photo' => $photo,
'verb' => ACTIVITY_TAG,
'otype' => 'item'
));
@ -1247,6 +1256,59 @@ function tag_deliver($uid,$item_id) {
function tgroup_check($uid,$item) {
$a = get_app();
$mention = false;
// check that the message originated elsewhere and is a top-level post
if(($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
return false;
$u = q("select * from user where uid = %d limit 1",
intval($uid)
);
if(! count($u))
return false;
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
$link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
// Diaspora uses their own hardwired link URL in @-tags
// instead of the one we supply with webfinger
$dlink = normalise_link($a->get_baseurl() . '/u/' . $u[0]['nickname']);
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
$mention = true;
logger('tgroup_check: mention found: ' . $mtch[2]);
}
}
}
if(! $mention)
return false;
if((! $community_page) && (! $prvgroup))
return false;
return true;
}
@ -1803,6 +1865,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if($pass == 1)
continue;
// not allowed to post
if($contact['rel'] == CONTACT_IS_FOLLOWER)
continue;
// Have we seen it? If not, import it.
$item_id = $item->get_id();
@ -2077,6 +2145,14 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$datarray['owner-avatar'] = $contact['thumb'];
}
// We've allowed "followers" to reach this point so we can decide if they are
// posting an @-tag delivery, which followers are allowed to do for certain
// page types. Now that we've parsed the post, let's check if it is legit. Otherwise ignore it.
if(($contact['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['uid'],$datarray)))
continue;
$r = item_store($datarray);
continue;
@ -2699,15 +2775,6 @@ function local_delivery($importer,$data) {
}
// TODO: make this next part work against both delivery threads of a community post
// if((! link_compare($datarray['author-link'],$importer['url'])) && (! $community)) {
// logger('local_delivery: received relay claiming to be from ' . $importer['url'] . ' however comment author url is ' . $datarray['author-link'] );
// they won't know what to do so don't report an error. Just quietly die.
// return 0;
// }
// our user with $importer['importer_uid'] is the owner
$own = q("select name,url,thumb from contact where uid = %d and self = 1 limit 1",
intval($importer['importer_uid'])
@ -2777,15 +2844,6 @@ function local_delivery($importer,$data) {
}
}
// if($community) {
// $newtag = '@[url=' . $a->get_baseurl() . '/profile/' . $importer['nickname'] . ']' . $importer['username'] . '[/url]';
// if(! stristr($datarray['tag'],$newtag)) {
// if(strlen($datarray['tag']))
// $datarray['tag'] .= ',';
// $datarray['tag'] .= $newtag;
// }
// }
$posted_id = item_store($datarray);
$parent = 0;
@ -2855,6 +2913,9 @@ function local_delivery($importer,$data) {
$item_id = $item->get_id();
$datarray = get_atom_elements($feed,$item);
if($importer['rel'] == CONTACT_IS_FOLLOWER)
continue;
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['importer_uid'])
@ -3089,6 +3150,9 @@ function local_delivery($importer,$data) {
$datarray['owner-avatar'] = $importer['thumb'];
}
if(($importer['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['importer_uid'],$datarray)))
continue;
$posted_id = item_store($datarray);
if(stristr($datarray['verb'],ACTIVITY_POKE)) {

17
mod/toggle_mobile.php Normal file
View File

@ -0,0 +1,17 @@
<?php
function toggle_mobile_init(&$a) {
if(isset($_GET['off']))
$_SESSION['show-mobile'] = false;
else
$_SESSION['show-mobile'] = true;
if(isset($_GET['address']))
$address = $_GET['address'];
else
$address = $a->get_baseurl();
goaway($address);
}

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1154 );
define( 'UPDATE_VERSION' , 1155 );
/**
*
@ -1343,3 +1343,11 @@ function update_1153() {
if(!$r) return UPDATE_FAILED;
return UPDATE_SUCCESS;
}
function update_1154() {
$r = q("ALTER TABLE `event` ADD `ignore` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `adjust` , ADD INDEX ( `ignore` )");
if(!$r) return UPDATE_FAILED;
return UPDATE_SUCCESS;
}

View File

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 3.0.1463\n"
"Project-Id-Version: 3.0.1464\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-09-11 10:00-0700\n"
"POT-Creation-Date: 2012-09-12 10:00-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -47,8 +47,8 @@ msgstr ""
#: ../../mod/group.php:19 ../../mod/viewcontacts.php:22
#: ../../mod/register.php:38 ../../mod/regmod.php:116 ../../mod/item.php:126
#: ../../mod/item.php:142 ../../mod/mood.php:114
#: ../../mod/profile_photo.php:19 ../../mod/profile_photo.php:142
#: ../../mod/profile_photo.php:153 ../../mod/profile_photo.php:166
#: ../../mod/profile_photo.php:19 ../../mod/profile_photo.php:169
#: ../../mod/profile_photo.php:180 ../../mod/profile_photo.php:193
#: ../../mod/message.php:38 ../../mod/message.php:168
#: ../../mod/allfriends.php:9 ../../mod/nogroup.php:25
#: ../../mod/wall_upload.php:64 ../../mod/follow.php:9
@ -398,10 +398,10 @@ msgid "Contact information unavailable"
msgstr ""
#: ../../mod/photos.php:149 ../../mod/photos.php:653 ../../mod/photos.php:1073
#: ../../mod/photos.php:1088 ../../mod/profile_photo.php:60
#: ../../mod/profile_photo.php:67 ../../mod/profile_photo.php:74
#: ../../mod/profile_photo.php:177 ../../mod/profile_photo.php:261
#: ../../mod/profile_photo.php:270
#: ../../mod/photos.php:1088 ../../mod/profile_photo.php:74
#: ../../mod/profile_photo.php:81 ../../mod/profile_photo.php:88
#: ../../mod/profile_photo.php:204 ../../mod/profile_photo.php:296
#: ../../mod/profile_photo.php:305
#: ../../addon/communityhome/communityhome.php:111
#: ../../view/theme/diabook/theme.php:599 ../../include/user.php:318
#: ../../include/user.php:325 ../../include/user.php:332
@ -444,12 +444,12 @@ msgstr ""
msgid "Image file is empty."
msgstr ""
#: ../../mod/photos.php:729 ../../mod/profile_photo.php:126
#: ../../mod/photos.php:729 ../../mod/profile_photo.php:153
#: ../../mod/wall_upload.php:110
msgid "Unable to process image."
msgstr ""
#: ../../mod/photos.php:756 ../../mod/profile_photo.php:266
#: ../../mod/photos.php:756 ../../mod/profile_photo.php:301
#: ../../mod/wall_upload.php:136
msgid "Image upload failed."
msgstr ""
@ -2367,7 +2367,7 @@ msgstr ""
msgid "Profile is <strong>not published</strong>."
msgstr ""
#: ../../mod/settings.php:944 ../../mod/profile_photo.php:214
#: ../../mod/settings.php:944 ../../mod/profile_photo.php:248
msgid "or"
msgstr ""
@ -2771,7 +2771,7 @@ msgstr ""
msgid "Profile"
msgstr ""
#: ../../mod/newmember.php:36 ../../mod/profile_photo.php:211
#: ../../mod/newmember.php:36 ../../mod/profile_photo.php:244
msgid "Upload Profile Photo"
msgstr ""
@ -3193,61 +3193,65 @@ msgstr ""
msgid "Set your current mood and tell your friends"
msgstr ""
#: ../../mod/profile_photo.php:30
#: ../../mod/profile_photo.php:44
msgid "Image uploaded but image cropping failed."
msgstr ""
#: ../../mod/profile_photo.php:63 ../../mod/profile_photo.php:70
#: ../../mod/profile_photo.php:77 ../../mod/profile_photo.php:273
#: ../../mod/profile_photo.php:77 ../../mod/profile_photo.php:84
#: ../../mod/profile_photo.php:91 ../../mod/profile_photo.php:308
#, php-format
msgid "Image size reduction [%s] failed."
msgstr ""
#: ../../mod/profile_photo.php:91
#: ../../mod/profile_photo.php:118
msgid ""
"Shift-reload the page or clear browser cache if the new photo does not "
"display immediately."
msgstr ""
#: ../../mod/profile_photo.php:101
#: ../../mod/profile_photo.php:128
msgid "Unable to process image"
msgstr ""
#: ../../mod/profile_photo.php:117 ../../mod/wall_upload.php:88
#: ../../mod/profile_photo.php:144 ../../mod/wall_upload.php:88
#, php-format
msgid "Image exceeds size limit of %d"
msgstr ""
#: ../../mod/profile_photo.php:210
#: ../../mod/profile_photo.php:242
msgid "Upload File:"
msgstr ""
#: ../../mod/profile_photo.php:212
#: ../../mod/profile_photo.php:243
msgid "Select a profile:"
msgstr ""
#: ../../mod/profile_photo.php:245
#: ../../addon/dav/friendica/layout.fnk.php:152
msgid "Upload"
msgstr ""
#: ../../mod/profile_photo.php:214
#: ../../mod/profile_photo.php:248
msgid "skip this step"
msgstr ""
#: ../../mod/profile_photo.php:214
#: ../../mod/profile_photo.php:248
msgid "select a photo from your photo albums"
msgstr ""
#: ../../mod/profile_photo.php:227
#: ../../mod/profile_photo.php:262
msgid "Crop Image"
msgstr ""
#: ../../mod/profile_photo.php:228
#: ../../mod/profile_photo.php:263
msgid "Please adjust the image cropping for optimum viewing."
msgstr ""
#: ../../mod/profile_photo.php:230
#: ../../mod/profile_photo.php:265
msgid "Done Editing"
msgstr ""
#: ../../mod/profile_photo.php:264
#: ../../mod/profile_photo.php:299
msgid "Image uploaded successfully."
msgstr ""

View File

@ -21,6 +21,9 @@
<section><?php if(x($page,'content')) echo $page['content']; ?>
</section>
</div>
<footer>
<a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>
</footer>
<?php } else { ?>
<div class='main-container'>
@ -33,7 +36,10 @@
</div>
<right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>
<?php if( ($a->module === 'contacts') && x($page,'aside')) echo $page['aside']; ?>
<footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
<footer>
<a href="<?php echo $a->get_baseurl() ?>/toggle_mobile?off=1&address=<?php echo curPageURL() ?>">toggle mobile</a>
<?php if(x($page,'footer')) echo $page['footer']; ?>
</footer>
<!-- </div>-->
</div>
<?php } ?>

View File

@ -152,3 +152,9 @@ div.section-wrapper {
#login-submit-wrapper {
text-align: center;
}
footer {
text-align: center;
padding-top: 3em;
padding-bottom: 1em;
}

View File

@ -393,8 +393,8 @@ section {
/* footer */
footer {
display: none;
text-align: center;
padding-bottom: 1em;
}
.birthday-today, .event-today {

View File

@ -0,0 +1,13 @@
<div id="message-sidebar" class="widget">
<br />
<div id="side-invite-link" class="side-link" ><a href="$new.url" class="{{ if $new.sel }}newmessage-selected{{ endif }}">$new.label</a> </div>
<ul class="message-ul">
{{ for $tabs as $t }}
<li class="tool">
<a href="$t.url" class="message-link{{ if $t.sel }}message-selected{{ endif }}">$t.label</a>
</li>
{{ endfor }}
</ul>
</div>

View File

@ -4,9 +4,9 @@
<form action="dirfind" method="post" />
<input id="side-peoplefind-url" type="text-sidebar" name="search" size="24" title="$hint" /><input id="side-peoplefind-submit" type="submit" name="submit" value="$findthem" />
</form>
<div class="side-link" id="side-match-link"><a href="match" >$similar</a></div>
<div class="side-link" id="side-suggest-link"><a href="suggest" >$suggest</a></div>
<div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >$random</a></div>
<div class="side-link" id="side-invite-link"><a href="match" >$similar</a></div>
<div class="side-link" id="side-invite-link"><a href="suggest" >$suggest</a></div>
<div class="side-link" id="side-invite-link" ><a href="randprof" target="extlink" >$random</a></div>
{{ if $inv }}
<div class="side-link" id="side-invite-link" ><a href="invite" >$inv</a></div>
{{ endif }}

View File

@ -3,7 +3,7 @@
{{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo" alt="$profile.name"></div>
<div id="profile-photo-wrapper"><img class="photo" width="191" height="191" src="$profile.photo" alt="$profile.name"></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 684 B

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,8 @@
/*
* Name: Smoothly
* Description: Theme optimized for iPad/iPad2
* Version: 0.6
* Description: Theme optimized for iPad[2]
* Version: 0.7
* Author: Alex <https://friendica.pixelbits.de/profile/alex>
* Maintainer: Alex <https://friendica.pixelbits.de/profile/alex>
* Screenshot: <a href="screenshot.png">Screenshot</a>