terms of use, and video thumbnail fix

This commit is contained in:
Hannes Mannerheim 2015-01-25 19:05:09 +01:00
parent dab96e99a9
commit 8c38287b0c
9 changed files with 195 additions and 37 deletions

View File

@ -71,6 +71,9 @@ class QvitterPlugin extends Plugin {
$settings['urlshortenerapiurl'] = 'http://qttr.at/yourls-api.php';
$settings['urlshortenersignature'] = 'b6afeec983';
// CUSTOM TERMS OF USE
$settings['customtermsofuse'] = false;
/* · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
@ -483,7 +486,8 @@ class QvitterPlugin extends Plugin {
$enclosure_o = $attachment->getEnclosure();
$thumb = File_thumbnail::getKV('file_id', $attachment->id);
if(isset($thumb->url)) {
$attachment_url_to_id[$enclosure_o->url] = $attachment->id;
$attachment_url_to_id[$enclosure_o->url]['id'] = $attachment->id;
$attachment_url_to_id[$enclosure_o->url]['thumb_url'] = $thumb->url;
}
} catch (ServerException $e) {
// There was not enough metadata available
@ -495,7 +499,13 @@ class QvitterPlugin extends Plugin {
if (!empty($twitter_status['attachments'])) {
foreach ($twitter_status['attachments'] as &$attachment) {
if (!empty($attachment_url_to_id[$attachment['url']])) {
$attachment['id'] = $attachment_url_to_id[$attachment['url']];
$attachment['id'] = $attachment_url_to_id[$attachment['url']]['id'];
// if the attachment is other than image, and we have a thumb (e.g. videos),
// we include the default thumbnail url
if(substr($attachment['mimetype'],0,5) != 'image') {
$attachment['thumb_url'] = $attachment_url_to_id[$attachment['url']]['thumb_url'];
}
}
}
}
@ -729,7 +739,7 @@ class QvitterPlugin extends Plugin {
if($title == 'faq') {
$faq = file_get_contents(QVITTERDIR.'/doc/faq.html');
$faq = file_get_contents(QVITTERDIR.'/doc/en/faq.html');
$faq = str_replace('{instance-name}',common_config('site','name'),$faq);
$faq = str_replace('{instance-url}',common_config('site','server'),$faq);
$faq = str_replace('{instance-url-with-protocol}',common_path('', true),$faq);

View File

@ -188,6 +188,10 @@ class QvitterAction extends ApiAction
window.commonSessionToken = '<?php print common_session_token(); ?>';
window.siteMaxThumbnailSize = <?php print common_config('thumbnail', 'maxsize'); ?>;
window.siteAttachmentURLBase = '<?php print $attachmentroot; ?>';
window.siteEmail = '<?php print common_config('site', 'email'); ?>';
window.siteLicenseTitle = '<?php print common_config('license', 'title'); ?>';
window.siteLicenseURL = '<?php print common_config('license', 'url'); ?>';
window.customTermsOfUse = <?php print json_encode(QvitterPlugin::settings("customtermsofuse")); ?>;
</script>
<style>

View File

@ -565,9 +565,6 @@ body.rtl .front-welcome-text {
}
.front-signup {
margin-top:123px;
height: 206px;
}
.front-signup:not(#popup-signup) {
height: auto;
padding-bottom: 53px;
}
@ -910,8 +907,26 @@ button#submit-login:hover {
opacity: 1;
position: relative;
margin-top:10px;
height:346px;
border:0 none;
background:none;
}
.modal-body .front-signup #signup-terms-header {
text-align:center;
margin:20px 0 0 0;
cursor:pointer;
}
.modal-body .front-signup #signup-terms-header:before {
content: "\f05a";
display:inline-block;
padding:0 6px 0 2px;
font-family:FontAwesome;
}
.modal-body .front-signup #signup-terms-container {
padding: 0 20px 20px;
font-size:12px;
}
.modal-body .front-signup .signup-input-container {
margin:6px auto 0 auto;
width:276px;
@ -1985,6 +2000,11 @@ ul.queet-actions li .icon.sm-trash:before {
ul.queet-actions li .icon.sm-fav:before {
content: "\f005";
}
ul.queet-actions li .icon.sm-ellipsis:before {
content: "\f141";
font-size: 22px;
line-height: 28px;
}
.queet.rtl .queet-content {
margin-left:0;
@ -3073,12 +3093,9 @@ div.nav-session {
}
.profile-card .user-actions {
height: 32px;
position:relative;
float: right;
margin: 10px;
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
div.clearfix {
clear:both;

27
doc/en/terms.html Normal file
View File

@ -0,0 +1,27 @@
<p>{instance-name} is not a service and you are not a customer here. We are a small part of
a bigger social change, creating a large decentralized community. This means that we don't
have to be neutral toward the content on our GNU social instance. If you don't like the
direction this instance is going, you are free to move to another instance or start your own.
You will still be able to follow and be followed (and blocked) by users on this instance.</p>
<p>In constrast to the top-down authority of commercial social media, this creates a kind
of flat power structure. We are enabled to protect eachother from harassment and opression,
but without censorship.</p>
<p>On this instance, users who harass others will be removed. We also take a strong stance
against e.g. racism, sexism, ableism, homo- and transphobia. Such expressions make the
site unsafe for other users, and in practice limit their freedom of speech.</p>
<p>The Public Timeline is considered an especially sensitive place. It is what new users see,
and all registered users will see the posts published there. Moderators can exclude users
from appearing in the public timeline it at any moment, without warning, permanently or
temporarily. Consider it a privilege to be published in the public timeline, not a right.
If you are excluded from the public timeline, you can still use all other features on the
site just like any other user.</p>
<p>Advertising and commercial entities are not allowed on this instance. We are completely
non-profit and all our expenses are payed for by donations from individuals.
<a href="mailto:{instance-email}">We can help you</a> start your own GNU social instance
if your intention is commercial.</p>
<p>All content on this site is licensed with <a href="{instance-license-url}">{instance-license-title}</a>.</p>

29
doc/sv/terms.html Normal file
View File

@ -0,0 +1,29 @@
<p>{instance-name} är inte en tjänst och du är ingen kund här. Vi är en liten del av en
större social rörelse för att skapa ett stort decentraliserad nätverk. Det betyder att
vi inte måste vara neutrala till innehållet på vår GNU social-instans för att upprätthålla
yttrandefrihet på nätverket. Om du inte gillar inriktningen på vår instans kan du flytta
till en annan eller starta en egen. Du kommer fortfarande kunna följa och bli följd av
(och blockad av) användare på den här instansen.</p>
<p>Till skillnad från den de toppstyrda kommersiella sociala medierna,
skapar ett decentraliserat nätverk en plattare struktur. Vi bemäktigas att skydda varandra
från trakasserier och förtryck, men utan att införa en central censur.</p>
<p>På den här instansen kommer användare som trakasserar andra att bli borttagna. Vi försöker
också vara vaksamma mot t ex rasism, sexism, funko-, trans- och homofobi. Sådana yttranden
skapar ett osäkert rum för andra användare, och i praktiken begränsar det deras yttrandefrihet.</p>
<p>Den offentliga tidslinjen, under rubriken "Hela sajtens flöde", anser vi vara särskilt
känslig. Dels är den vårt ansikte utåt, dels får alla se vad som skrivs där inte bara
användarens följare. Moderatorer kan därför dölja användare från den offentliga tidslinjen,
närsomhelst och utan förvarning. Det är ingen rättighet att synas där. Om du dolts från
den offentliga tidslinjen kan du fortfarande använda sajtens alla funktioner precis som
alla andra användare.</p>
<p>Reklam och kommersiella användare är inte tillåtna på den här instansen. Vi driver den
helt icke-kommersiellt och alla våra omkostnader betalas av donationer från enskilda.
<a href="mailto:{instance-email}">Vi kan hjälpa dig</a> att starta din egen GNU social-
instans om du har kommersiella intentioner.</p>
<p>Allt innehåll på sajten publiceras under licensen <a href="{instance-license-url}">{instance-license-title}</a>.</p>

View File

@ -46,6 +46,41 @@ function timeNow() {
}
/* ·
·
· Get a document and replace strings
·
· @param doc: the name of the document
· @param actionOnSuccess: callback function to run on success
·
· · · · · · · · · · · · · */
function getDoc(doc, actionOnSuccess) {
var timeNow = new Date().getTime();
$.get(window.fullUrlToThisQvitterApp + 'doc/' + window.selectedLanguage + '/' + doc + '.html?t=' + timeNow, function(data){
if(data) {
actionOnSuccess(renderDoc(data));
}
}).fail(function() { // default to english if we can't find the doc in selected language
$.get(window.fullUrlToThisQvitterApp + 'doc/en/' + doc + '.html?t=' + timeNow, function(data){
if(data) {
actionOnSuccess(renderDoc(data));
}
});
});
}
function renderDoc(docHtml) {
docHtml = docHtml.replace(/{instance-name}/g,window.siteTitle);
docHtml = docHtml.replace(/{instance-url}/g,window.siteRootDomain);
docHtml = docHtml.replace(/{instance-url-with-protocol}/g,window.siteInstanceURL);
docHtml = docHtml.replace(/{nickname}/g,window.loggedIn.screen_name);
docHtml = docHtml.replace(/{instance-email}/g,window.siteEmail);
docHtml = docHtml.replace(/{instance-license-title}/g,window.siteLicenseTitle);
docHtml = docHtml.replace(/{instance-license-url}/g,window.siteLicenseURL);
return docHtml;
}
/* ·
·
· Check login credentials with http basic auth

View File

@ -1830,7 +1830,16 @@ function buildQueetHtml(obj, idInStream, extraClassesThisRun, requeeted_by) {
if(bigThumbH > window.siteMaxThumbnailSize) {
bigThumbH = window.siteMaxThumbnailSize;
}
attachment_html = attachment_html + '<a href="' + this.url + '"><img data-big-thumbnail="' + window.siteAttachmentURLBase + this.id + '/thumbnail?w=' + bigThumbW + '&h=' + bigThumbH + '" src="' + window.siteAttachmentURLBase + this.id + '/thumbnail?w=200&h=200"/></a>';
// if thumb_url is set, we use that
if(typeof this.thumb_url != 'undefined') {
var thumb_url = this.thumb_url;
}
else {
var thumb_url = window.siteAttachmentURLBase + this.id + '/thumbnail?w=200&h=200';
}
attachment_html = attachment_html + '<a href="' + this.url + '"><img data-big-thumbnail="' + window.siteAttachmentURLBase + this.id + '/thumbnail?w=' + bigThumbW + '&h=' + bigThumbH + '" src="' + thumb_url + '"/></a>';
}
});
}

View File

@ -154,6 +154,8 @@ window.l.ca.FAQ = 'PMF';
window.l.ca.inviteAFriend = 'Convida els amics!';
window.l.ca.goToExternalProfile = 'Mostra el perfil complet';
window.l.ca.cropAndSave = 'Retalla i desa';
window.l.ca.showTerms = 'Read our Terms of Use';
// spanish
window.l.es = new Object();
@ -273,6 +275,7 @@ window.l.es.FAQ = 'Preguntas Frecuentes';
window.l.es.inviteAFriend = '¡Invita a tus amigos!';
window.l.es.goToExternalProfile = 'Ir al perfil completo';
window.l.es.cropAndSave = 'Recortar y guardar';
window.l.es.showTerms = 'Read our Terms of Use';
// spanish (ahorita)
window.l.es_ahorita = new Object();
@ -398,7 +401,7 @@ window.l.pt_br.FAQ = 'FAQ';
window.l.pt_br.inviteAFriend = 'Convide seus amigos!';
window.l.pt_br.goToExternalProfile = 'Ir para o perfil completo';
window.l.pt_br.cropAndSave = 'Crop and save';
window.l.pt_br.showTerms = 'Read our Terms of Use';
// galician
@ -519,6 +522,7 @@ window.l.gl.FAQ = 'FAQ';
window.l.gl.inviteAFriend = 'Convida aos teus amigos!';
window.l.gl.goToExternalProfile = 'Ir ao perfil completo';
window.l.gl.cropAndSave = 'Crop and save';
window.l.gl.showTerms = 'Read our Terms of Use';
// basque
window.l.eu = new Object();
@ -638,6 +642,7 @@ window.l.eu.FAQ = 'FAQ';
window.l.eu.inviteAFriend = 'Zure Lagunak Gonbidatu!';
window.l.eu.goToExternalProfile = 'Profil osora joan';
window.l.eu.cropAndSave = 'Crop and save';
window.l.eu.showTerms = 'Read our Terms of Use';
// french
window.l.fr = new Object();
@ -757,6 +762,7 @@ window.l.fr.FAQ = 'FAQ';
window.l.fr.inviteAFriend = 'Invite des ami·e·s !';
window.l.fr.goToExternalProfile = 'Aller sur le profil complet';
window.l.fr.cropAndSave = 'Recadrer et enregistrer';
window.l.fr.showTerms = 'Read our Terms of Use';
// deutsch
window.l.de = new Object();
@ -888,6 +894,7 @@ window.l.de.FAQ = 'FAQ';
window.l.de.inviteAFriend = 'Lade deine Freunde ein!';
window.l.de.goToExternalProfile = 'Vollständiges Profil anzeigen';
window.l.de.cropAndSave = 'Zuschneiden und Abspeichern';
window.l.de.showTerms = 'Read our Terms of Use';
// english
window.l.en = new Object();
@ -1015,6 +1022,7 @@ window.l.en.FAQ = 'FAQ';
window.l.en.inviteAFriend = 'Invite a friend!';
window.l.en.goToExternalProfile = 'Go to full profile';
window.l.en.cropAndSave = 'Crop and save';
window.l.en.showTerms = 'Read our Terms of Use';
// simplified chinese
@ -1135,6 +1143,7 @@ window.l.zh_cn.FAQ = 'FAQ';
window.l.zh_cn.inviteAFriend = '邀请好友';
window.l.zh_cn.goToExternalProfile = '前往完整的个人档案';
window.l.zh_cn.cropAndSave = 'Crop and save';
window.l.zh_cn.showTerms = 'Read our Terms of Use';
// traditional chinese
@ -1255,6 +1264,7 @@ window.l.zh_tw.FAQ = 'FAQ';
window.l.zh_tw.inviteAFriend = '邀請你的朋友';
window.l.zh_tw.goToExternalProfile = '前往詳細個人檔案';
window.l.zh_tw.cropAndSave = 'Crop and save';
window.l.zh_tw.showTerms = 'Read our Terms of Use';
// svenska
@ -1375,6 +1385,7 @@ window.l.sv.FAQ = 'FAQ';
window.l.sv.inviteAFriend = 'Bjud in dina vänner!';
window.l.sv.goToExternalProfile = 'Gå till hela profilen';
window.l.sv.cropAndSave = 'Beskär och spara';
window.l.sv.showTerms = 'Läs våra användarvillkor';
// suomi
window.l.fi = new Object();
@ -1494,6 +1505,7 @@ window.l.fi.FAQ = 'FAQ';
window.l.fi.inviteAFriend = 'Kutsu kavereitasi!';
window.l.fi.goToExternalProfile = 'Siirry täyteen profiiliin';
window.l.fi.cropAndSave = 'Crop and save';
window.l.fi.showTerms = 'Read our Terms of Use';
// farsi/persian
window.l.fa = new Object();
@ -1613,6 +1625,7 @@ window.l.fa.FAQ = 'FAQ';
window.l.fa.inviteAFriend = 'دعوت از دوستانتان';
window.l.fa.goToExternalProfile = 'رفتن به نمایه کامل';
window.l.fa.cropAndSave = 'Crop and save';
window.l.fa.showTerms = 'Read our Terms of Use';
// arabic
window.l.ar = new Object();
@ -1732,6 +1745,7 @@ window.l.ar.FAQ = 'FAQ';
window.l.ar.inviteAFriend = 'دعوة أصدقائك!';
window.l.ar.goToExternalProfile = 'اذهب إلى الملف الشخصي الكامل';
window.l.ar.cropAndSave = 'قُص و احفظ.';
window.l.ar.showTerms = 'Read our Terms of Use';
// esperanto
window.l.eo = new Object();
@ -1860,6 +1874,7 @@ window.l.eo.FAQ = 'FAQ';
window.l.eo.inviteAFriend = 'Inviti viajn amikojn!';
window.l.eo.goToExternalProfile = 'iru al plena profilon';
window.l.eo.cropAndSave = 'Tondu kaj savu';
window.l.eo.showTerms = 'Read our Terms of Use';
// italian
window.l.it = new Object();
@ -1988,6 +2003,7 @@ window.l.it.FAQ = 'FAQ';
window.l.it.inviteAFriend = 'Invita i tuoi amici!';
window.l.it.goToExternalProfile = 'Vai al profilo completo';
window.l.it.cropAndSave = 'ritaglia e salva';
window.l.it.showTerms = 'Read our Terms of Use';
// Norwegian
window.l.no = new Object();
@ -2107,6 +2123,7 @@ window.l.no.FAQ = 'FAQ';
window.l.no.inviteAFriend = 'Inviter venner';
window.l.no.goToExternalProfile = 'Gå til fullstendig profil';
window.l.no.cropAndSave = 'Beskjær og lagre';
window.l.no.showTerms = 'Read our Terms of Use';
// asturian
window.l.ast = new Object();
@ -2226,6 +2243,7 @@ window.l.ast.FAQ = 'Entrugues Frecuentes';
window.l.ast.inviteAFriend = '¡Convida a los collacios!';
window.l.ast.goToExternalProfile = 'Dir al perfil completu';
window.l.ast.cropAndSave = 'Recortar y guardar';
window.l.ast.showTerms = 'Read our Terms of Use';

View File

@ -113,6 +113,7 @@ if(!window.registrationsClosed) {
'<div class="signup-input-container"><input placeholder="' + window.sL.registerLocation + '" type="text" autocomplete="off" class="text-input" id="signup-user-location-step2"></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.loginPassword + '" type="password" class="text-input" id="signup-user-password1-step2" value="' + $('#signup-user-password').val() + '"><div class="fieldhelp">>5</div></div>' +
'<div class="signup-input-container"><input placeholder="' + window.sL.registerRepeatPassword + '" type="password" class="text-input" id="signup-user-password2-step2"></div>' +
'<div id="signup-terms-header">' + window.sL.showTerms + '</div><div id="signup-terms-container"></div>' +
'<button id="signup-btn-step2" class="signup-btn disabled" type="submit">' + window.sL.signUpButtonText + '</button>' +
'</div>',false);
@ -223,6 +224,29 @@ if(!window.registrationsClosed) {
}
/* ·
·
· Show/hide Terms of Use
·
· · · · · · · · · · · · · */
$('body').on('click','#signup-terms-header',function(){
if($('#signup-terms-container').text().length > 0) {
$('#signup-terms-container').html('');
}
else {
if(window.customTermsOfUse) {
$('#signup-terms-container').html(window.customTermsOfUse);
}
else {
getDoc('terms',function(termsHtml){
$('#signup-terms-container').html(termsHtml);
});
}
}
});
/* ·
@ -398,27 +422,12 @@ $('#logout').click(function(){
$('#faq-link').click(function(){
popUpAction('popup-faq', window.siteTitle + ' ' + window.sL.FAQ,'<div id="faq-container"></div>',false);
var timeNow = new Date().getTime();
$.get(window.fullUrlToThisQvitterApp + 'doc/' + window.selectedLanguage + '/faq.html?t=' + timeNow, function(data){
if(data) {
renderFAQ(data);
}
}).fail(function() { // default to english if we can't find the faq in selected language
$.get(window.fullUrlToThisQvitterApp + 'doc/en/faq.html?t=' + timeNow, function(data){
if(data) {
renderFAQ(data);
}
});
getDoc('faq',function(faqHtml){
$('#faq-container').html(faqHtml);
});
});
function renderFAQ(faqHtml) {
faqHtml = faqHtml.replace(/{instance-name}/g,window.siteTitle);
faqHtml = faqHtml.replace(/{instance-url}/g,window.siteRootDomain);
faqHtml = faqHtml.replace(/{instance-url-with-protocol}/g,window.siteInstanceURL);
faqHtml = faqHtml.replace(/{nickname}/g,window.loggedIn.screen_name);
$('#faq-container').html(faqHtml);
}
/* ·
·