[dev] One function to rules them all
This commit is contained in:
parent
1f31150932
commit
cec634f99d
|
@ -107,6 +107,16 @@ class QvitterAction extends ApiAction
|
|||
} else {
|
||||
$attachmentroot = common_path('attachment/', StatusNet::isHTTPS());
|
||||
}
|
||||
$avatarconfig=common_config('avatar');
|
||||
if($avatarconfig['server']) {
|
||||
if(StatusNet::isHTTPS() ){
|
||||
$avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||
} elseif(!StatusNet::isHTTPS()) {
|
||||
$avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path'];
|
||||
}
|
||||
} else {
|
||||
$attachmentroot = common_path('attachment/', StatusNet::isHTTPS());
|
||||
}
|
||||
$instanceurl = common_path('', StatusNet::isHTTPS());
|
||||
$favicon_path = QvitterPlugin::settings("favicon_path");
|
||||
|
||||
|
@ -383,6 +393,7 @@ 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.siteAvatarURLBase = '<?php print $avatarroot; ?>';
|
||||
window.siteEmail = '<?php print common_config('site', 'email'); ?>';
|
||||
window.siteLicenseTitle = '<?php print common_config('license', 'title'); ?>';
|
||||
window.siteLicenseURL = '<?php print common_config('license', 'url'); ?>';
|
||||
|
|
|
@ -726,18 +726,14 @@ function updateAllQueetsTimes() {
|
|||
· · · · · · · · · */
|
||||
|
||||
function isLocalURL(url) {
|
||||
if(url.substring(0,window.siteInstanceURL.length) == window.siteInstanceURL) {
|
||||
if(url.substring(0,window.siteInstanceURL.length) == window.siteInstanceURL // site url
|
||||
|| url.substring(0,window.siteAttachmentURLBase.length) == window.siteAttachmentURLBase // attachment url
|
||||
|| url.substring(0,window.siteAvatarURLBase.length) == window.siteAvatarURLBase // avatar url
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if(url.substring(0,window.siteAttachmentURLBase.length) == window.siteAttachmentURLBase) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ·
|
||||
|
@ -1052,14 +1048,10 @@ function userArrayCacheGetUserNicknameById(id) {
|
|||
· · · · · · · · · */
|
||||
|
||||
function detectLocalOrExternalUserObject(userObject) {
|
||||
var dataProfileImageUrlWithoutProtocol = removeProtocolFromUrl(userObject.profile_image_url);
|
||||
var siteInstanceURLWithoutProtocol = removeProtocolFromUrl(window.siteInstanceURL);
|
||||
if(dataProfileImageUrlWithoutProtocol.substring(0,siteInstanceURLWithoutProtocol.length) == siteInstanceURLWithoutProtocol
|
||||
|| dataProfileImageUrlWithoutProtocol.substring(0,window.avatarServer.length) == window.avatarServer
|
||||
){
|
||||
|
||||
if(isLocalURL(userObject.profile_image_url) ) {
|
||||
return 'local';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return 'external';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user