Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
zottel
2016-07-31 02:14:33 +02:00
19 changed files with 8578 additions and 8319 deletions
+1 -1
View File
@@ -173,7 +173,7 @@ class Ping extends \Zotlabs\Web\Controller {
);
break;
case 'all_events':
$r = q("update event set `dimissed` = 1 where `dismissed` = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
$r = q("update event set `dismissed` = 1 where `dismissed` = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ",
intval(local_channel()),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')),
dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days'))
+2 -1
View File
@@ -58,7 +58,8 @@ class Ratingsearch extends \Zotlabs\Web\Controller {
$ret['success'] = true;
$r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash
where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 and xchan_orphan = 0 and xchan_deleted = 0
where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1
and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0
order by xchan_name asc",
dbesc($target)
);
-13
View File
@@ -2,7 +2,6 @@
namespace Zotlabs\Module;
class Rmagic extends \Zotlabs\Web\Controller {
function init() {
@@ -32,18 +31,6 @@ class Rmagic extends \Zotlabs\Web\Controller {
$arr = array('address' => $address);
call_hooks('reverse_magic_auth', $arr);
try {
require_once('library/openid/openid.php');
$openid = new \LightOpenID(z_root());
$openid->identity = $address;
$openid->returnUrl = z_root() . '/openid';
$openid->required = array('namePerson/friendly', 'namePerson');
$openid->optional = array('namePerson/first','media/image/aspect11','media/image/default');
goaway($openid->authUrl());
} catch (\Exception $e) {
notice( t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.').'<br /><br >'. t('The error message was:').' '.$e->getMessage());
}
// if they're still here...
notice( t('Authentication failed.') . EOL);
return;
-75
View File
@@ -69,81 +69,6 @@ class Browser extends DAV\Browser\Plugin {
}
}
/**
* Extend from parent to add our own listeners
*/
function initialize(DAV\Server $server) {
parent::initialize($server);
if ($this->enablePost) {
$this->server->on('onBrowserPostAction', [$this, 'cloudPostAction']);
}
}
/**
* Handles POST requests for tree operations.
*
* @param string $uri
* @param string $action
* @param array $postVars
* @return boolean false will stop other events in the beforeMethod chain to execute
*/
function cloudPostAction($uri, $action, $postVars) {
switch ($postVars['sabreAction']) {
case 'mkcol' :
if (isset($postVars['name']) && trim($postVars['name'])) {
// Using basename() because we won't allow slashes
list(, $folderName) = \Sabre\HTTP\URLUtil::splitPath(trim($postVars['name']));
if (isset($postVars['resourceType'])) {
$resourceType = explode(',', $postVars['resourceType']);
} else {
$resourceType = ['{DAV:}collection'];
}
$properties = [];
foreach ($postVars as $varName => $varValue) {
// Any _POST variable in clark notation is treated
// like a property.
if ($varName[0] === '{') {
// PHP will convert any dots to underscores.
// This leaves us with no way to differentiate
// the two.
// Therefore we replace the string *DOT* with a
// real dot. * is not allowed in uris so we
// should be good.
$varName = str_replace('*DOT*', '.', $varName);
$properties[$varName] = $varValue;
}
}
$mkCol = new DAV\MkCol(
$resourceType,
$properties
);
$this->server->createCollection($uri . '/' . $folderName, $mkCol);
}
break;
case 'put' :
if ($_FILES)
$file = current($_FILES);
else
break;
for ($i = 0; $i < count($file['name']); $i++) {
list(, $newName) = \Sabre\HTTP\URLUtil::splitPath(trim($file['name'][$i]));
if (is_uploaded_file($file['tmp_name'][$i])) {
$this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'][$i], 'r'));
}
}
break;
}
return false;
}
/**
* @brief Creates the directory listing for the given path.
*
+1 -1
View File
@@ -13,7 +13,7 @@ require_once('include/api_auth.php');
/*
*
* Red API. Loosely based on and possibly compatible with a Twitter-Like API but all similarities end there.
* Hubzilla API. Loosely based on and possibly compatible with Twitter-Like (v1.0) API but all similarities end there.
*
*/
+1
View File
@@ -74,6 +74,7 @@ function z_mime_content_type($filename) {
// 'webm' => 'audio/webm',
'mp4' => 'video/mp4',
// 'mp4' => 'audio/mp4',
'mkv' => 'video/x-matroska',
// adobe
'pdf' => 'application/pdf',
+17 -16
View File
@@ -2608,32 +2608,33 @@ function getIconFromType($type) {
'application/octet-stream' => 'fa-file-o',
//Text
'text/plain' => 'fa-file-text-o',
'application/msword' => 'fa-file-text-o',
'application/pdf' => 'fa-file-text-o',
'application/vnd.oasis.opendocument.text' => 'fa-file-text-o',
'application/msword' => 'fa-file-word-o',
'application/pdf' => 'fa-file-pdf-o',
'application/vnd.oasis.opendocument.text' => 'fa-file-word-o',
'application/epub+zip' => 'fa-book',
//Spreadsheet
'application/vnd.oasis.opendocument.spreadsheet' => 'fa-table',
'application/vnd.ms-excel' => 'fa-table',
'application/vnd.oasis.opendocument.spreadsheet' => 'fa-file-excel-o',
'application/vnd.ms-excel' => 'fa-file-excel-o',
//Image
'image/jpeg' => 'fa-picture-o',
'image/png' => 'fa-picture-o',
'image/gif' => 'fa-picture-o',
'image/svg+xml' => 'fa-picture-o',
//Archive
'application/zip' => 'fa-archive',
'application/x-rar-compressed' => 'fa-archive',
'application/zip' => 'fa-file-archive-o',
'application/x-rar-compressed' => 'fa-file-archive-o',
//Audio
'audio/mpeg' => 'fa-music',
'audio/wav' => 'fa-music',
'application/ogg' => 'fa-music',
'audio/ogg' => 'fa-music',
'audio/webm' => 'fa-music',
'audio/mp4' => 'fa-music',
'audio/mpeg' => 'fa-file-audio-o',
'audio/wav' => 'fa-file-audio-o',
'application/ogg' => 'fa-file-audio-o',
'audio/ogg' => 'fa-file-audio-o',
'audio/webm' => 'fa-file-audio-o',
'audio/mp4' => 'fa-file-audio-o',
//Video
'video/quicktime' => 'fa-film',
'video/webm' => 'fa-film',
'video/mp4' => 'fa-film'
'video/quicktime' => 'fa-file-video-o',
'video/webm' => 'fa-file-video-o',
'video/mp4' => 'fa-file-video-o',
'video/x-matroska' => 'fa-file-video-o'
);
$iconFromType = 'fa-file-o';
+1 -1
View File
@@ -159,7 +159,7 @@ class ASN_BASE {
}
$length = $tempLength;
}
$data = substr($string, $p, $length);
$data = substr($string, $p, intval($length));
$parsed[] = self::parseASNData($type, $data, $level, $maxLevels);
$p = $p + $length;
}
+2 -2
View File
@@ -1,6 +1,5 @@
<?php
function po2php_run($argc,$argv) {
if ($argc < 2) {
@@ -59,8 +58,9 @@ function po2php_run($argc,$argv) {
$out .= 'function string_plural_select_' . $lang . '($n){'."\n";
$out .= ' return '.$cond.';'."\n";
$out .= '}}'."\n";
$out .= 'App::$rtl = ' . intval($rtl) ;
}
$out .= 'App::$rtl = ' . intval($rtl) . ';';
if ($k!="" && substr($l,0,7)=="msgstr "){
if ($ink) { $ink = False; $out .= 'App::$strings["'.$k.'"] = '; }
+3 -6
View File
@@ -41,12 +41,9 @@
}
#profile-jot-text.hover {
color: #f00;
background-color: #43488A;
opacity: 0.5;
border-color: #f00;
border-style: solid;
box-shadow: inset 0 3px 4px #888;
background-color: aliceblue;
opacity: 0.5;
box-shadow: inset 0 0px 7px #5cb85c;
}
.jot-attachment {
+13
View File
@@ -41,3 +41,16 @@
padding: 7px 10px;
width: 100%;
}
#cloud-drag-area.hover {
background-color: aliceblue;
opacity: 0.5;
box-shadow: inset 0 0px 7px #5cb85c;
}
.upload-progress-bar {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOM2RFTDwAE2QHxFMHIIwAAAABJRU5ErkJggg==') repeat-y;
background-size: 0px;
padding: 0px !important;
height: 3px;
}
+4934 -4734
View File
File diff suppressed because it is too large Load Diff
+1099 -1059
View File
File diff suppressed because it is too large Load Diff
+2312 -2311
View File
File diff suppressed because it is too large Load Diff
+184 -66
View File
@@ -3,96 +3,214 @@
*/
$(document).ready(function () {
// call initialization file
if (window.File && window.FileList && window.FileReader) {
DragDropUploadInit();
}
// call initialization file
if (window.File && window.FileList && window.FileReader) {
UploadInit();
}
});
//
// initialize
function DragDropUploadInit() {
function UploadInit() {
var fileselect = $("#fileselect"),
filedrag = $("#filedrag");
var fileselect = $("#files-upload");
var filedrag = $("#cloud-drag-area");
var submit = $("#upload-submit");
// file select
fileselect.on("change", DragDropUploadFileSelectHandler);
// is XHR2 available?
var xhr = new XMLHttpRequest();
if (xhr.upload) {
// is XHR2 available?
var xhr = new XMLHttpRequest();
if (xhr.upload) {
// file select
fileselect.attr("multiple", 'multiple');
fileselect.on("change", UploadFileSelectHandler);
// file drop
filedrag.on("dragover", DragDropUploadFileHover);
filedrag.on("dragleave", DragDropUploadFileHover);
filedrag.on("drop", DragDropUploadFileSelectHandler);
filedrag.show();
}
window.filesToUpload = 0;
window.fileUploadsCompleted = 0;
// file submit
submit.on("click", fileselect, UploadFileSelectHandler);
// file drop
filedrag.on("dragover", DragDropUploadFileHover);
filedrag.on("dragleave", DragDropUploadFileHover);
filedrag.on("drop", DragDropUploadFileSelectHandler);
}
window.filesToUpload = 0;
window.fileUploadsCompleted = 0;
}
// file drag hover
function DragDropUploadFileHover(e) {
e.stopPropagation();
e.preventDefault();
e.target.className = (e.type == "dragover" ? "hover" : "");
e.stopPropagation();
e.preventDefault();
e.currentTarget.className = (e.type == "dragover" ? "hover" : "");
}
// file selection
// file selection via drag/drop
function DragDropUploadFileSelectHandler(e) {
// cancel event and hover styling
DragDropUploadFileHover(e);
// cancel event and hover styling
DragDropUploadFileHover(e);
// fetch FileList object
var files = e.target.files || e.originalEvent.dataTransfer.files;
// fetch FileList object
var files = e.target.files || e.originalEvent.dataTransfer.files;
$("#file-upload-list").empty();
// process all File objects
for (var i = 0, f; f = files[i]; i++) {
$("#file-upload-list").append(
"<p>" + "<span id='upload-progress-" + i + "'></span> -> File: <strong>" + f.name +
"</strong> type: <strong>" + f.type +
"</strong> size: <strong>" + f.size +
"</strong> bytes</p>"
);
DragDropUploadFile(f, i);
}
$('.new-upload').remove();
// process all File objects
for (var i = 0, f; f = files[i]; i++) {
prepareHtml(f, i);
UploadFile(f, i);
}
}
// file selection via input
function UploadFileSelectHandler(e) {
// fetch FileList object
if(e.target.id === 'upload-submit') {
e.preventDefault();
var files = e.data[0].files;
}
if(e.target.id === 'files-upload') {
$('.new-upload').remove();
var files = e.target.files;
}
// process all File objects
for (var i = 0, f; f = files[i]; i++) {
if(e.target.id === 'files-upload')
prepareHtml(f, i);
if(e.target.id === 'upload-submit') {
UploadFile(f, i);
}
}
}
function prepareHtml(f, i) {
var num = i - 1;
$('#cloud-index #new-upload-progress-bar-' + num.toString()).after(
'<tr id="new-upload-' + i + '" class="new-upload">' +
'<td><i class="fa ' + getIconFromType(f.type) + '" title="' + f.type + '"></i></td>' +
'<td>' + f.name + '</td>' +
'<td id="upload-progress-' + i + '"></td><td></td><td></td><td></td><td></td>' +
'<td class="hidden-xs">' + formatSizeUnits(f.size) + '</td><td class="hidden-xs"></td>' +
'</tr>' +
'<tr id="new-upload-progress-bar-' + i + '" class="new-upload">' +
'<td id="upload-progress-bar-' + i + '" colspan="9" class="upload-progress-bar"></td>' +
'</tr>'
);
}
function formatSizeUnits(bytes){
if (bytes>=1000000000) {bytes=(bytes/1000000000).toFixed(2)+' GB';}
else if (bytes>=1000000) {bytes=(bytes/1000000).toFixed(2)+' MB';}
else if (bytes>=1000) {bytes=(bytes/1000).toFixed(2)+' KB';}
else if (bytes>1) {bytes=bytes+' bytes';}
else if (bytes==1) {bytes=bytes+' byte';}
else {bytes='0 byte';}
return bytes;
}
// this is basically a js port of include/text.php getIconFromType() function
function getIconFromType(type) {
var map = {
//Common file
'application/octet-stream': 'fa-file-o',
//Text
'text/plain': 'fa-file-text-o',
'application/msword': 'fa-file-word-o',
'application/pdf': 'fa-file-pdf-o',
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
'application/epub+zip': 'fa-book',
//Spreadsheet
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
'application/vnd.ms-excel': 'fa-file-excel-o',
//Image
'image/jpeg': 'fa-picture-o',
'image/png': 'fa-picture-o',
'image/gif': 'fa-picture-o',
'image/svg+xml': 'fa-picture-o',
//Archive
'application/zip': 'fa-file-archive-o',
'application/x-rar-compressed': 'fa-file-archive-o',
//Audio
'audio/mpeg': 'fa-file-audio-o',
'audio/mp3': 'fa-file-audio-o', //webkit browsers need that
'audio/wav': 'fa-file-audio-o',
'application/ogg': 'fa-file-audio-o',
'audio/ogg': 'fa-file-audio-o',
'audio/webm': 'fa-file-audio-o',
'audio/mp4': 'fa-file-audio-o',
//Video
'video/quicktime': 'fa-file-video-o',
'video/webm': 'fa-file-video-o',
'video/mp4': 'fa-file-video-o',
'video/x-matroska': 'fa-file-video-o'
};
var iconFromType = 'fa-file-o';
if (type in map) {
iconFromType = map[type];
}
return iconFromType;
}
// upload files
function DragDropUploadFile(file, idx) {
function UploadFile(file, idx) {
window.filesToUpload = window.filesToUpload + 1;
window.filesToUpload = window.filesToUpload + 1;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true; // Include the SESSION cookie info for authentication
(xhr.upload || xhr).addEventListener('progress', function (e) {
var done = e.position || e.loaded;
var total = e.totalSize || e.total;
// Dynamically update the percentage complete displayed in the file upload list
$('#upload-progress-' + idx).html(Math.round(done / total * 100) + '%');
});
xhr.addEventListener('load', function (e) {
//console.log('xhr upload complete', e);
window.fileUploadsCompleted = window.fileUploadsCompleted + 1;
// When all the uploads have completed, refresh the page
if (window.filesToUpload > 0 && window.fileUploadsCompleted === window.filesToUpload) {
window.fileUploadsCompleted = window.filesToUpload = 0;
// After uploads complete, refresh browser window to display new files
window.location.href = window.location.href;
}
});
// POST to the entire cloud path
xhr.open('post', window.location.pathname, true);
var xhr = new XMLHttpRequest();
var data = new FormData(document.getElementById("ajax-upload-files"));
data.append('file[]', file);
xhr.send(data);
xhr.withCredentials = true; // Include the SESSION cookie info for authentication
(xhr.upload || xhr).addEventListener('progress', function (e) {
var done = e.position || e.loaded;
var total = e.totalSize || e.total;
// Dynamically update the percentage complete displayed in the file upload list
$('#upload-progress-' + idx).html(Math.round(done / total * 100) + '%');
$('#upload-progress-bar-' + idx).css('background-size', Math.round(done / total * 100) + '%');
if(done == total) {
$('#upload-progress-' + idx).html('Processing...');
}
});
xhr.addEventListener('load', function (e) {
//we could possibly turn the filenames to real links here and add the delete and edit buttons to avoid page reload...
$('#upload-progress-' + idx).html('Ready!');
//console.log('xhr upload complete', e);
window.fileUploadsCompleted = window.fileUploadsCompleted + 1;
// When all the uploads have completed, refresh the page
if (window.filesToUpload > 0 && window.fileUploadsCompleted === window.filesToUpload) {
window.fileUploadsCompleted = window.filesToUpload = 0;
// After uploads complete, refresh browser window to display new files
window.location.href = window.location.href;
}
});
xhr.addEventListener('error', function (e) {
$('#upload-progress-' + idx).html('<span style="color: red;">ERROR</span>');
});
// POST to the entire cloud path
xhr.open('post', window.location.pathname, true);
var formfields = $("#ajax-upload-files").serializeArray();
var data = new FormData();
$.each(formfields, function(i, field) {
data.append(field.name, field.value);
});
data.append('file', file);
xhr.send(data);
}
-21
View File
@@ -2042,24 +2042,3 @@ dl.bb-dl > dd > li {
#wiki-preview img {
max-width: 100%;
}
#filedrag
{
display: none;
font-weight: bold;
text-align: center;
padding: 1em 0;
margin: 1em 0;
color: #555;
border: 2px dashed #555;
border-radius: 7px;
cursor: default;
}
#filedrag.hover
{
color: #f00;
border-color: #f00;
border-style: solid;
box-shadow: inset 0 3px 4px #888;
}
+2 -8
View File
@@ -11,16 +11,10 @@
{{if $quota.limit || $quota.used}}<div class="{{if $quota.warning}}section-content-danger-wrapper{{else}}section-content-info-wrapper{{/if}}">{{if $quota.warning}}<strong>{{$quota.warning}} </strong>{{/if}}{{$quota.desc}}</div>{{/if}}
<form id="ajax-upload-files" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="sabreAction" value="put">
<div>
<div id="filedrag" style="height: 7em;"><br>{{$dragdroptext}}</div>
</div>
<div id="file-upload-list"></div>
<div class="clear"></div>
<label for="files-upload">{{$upload_header}}</label>
<div class="clear"></div>
<input class="form-group pull-left" id="files-upload" type="file" name="file[]" multiple>
<button class="btn btn-primary btn-sm pull-right" type="submit" value="{{$upload_submit}}">{{$upload_submit}}</button>
<input class="form-group pull-left" id="files-upload" type="file" name="file">
<button id="upload-submit" class="btn btn-primary btn-sm pull-right" type="submit" value="{{$upload_submit}}">{{$upload_submit}}</button>
</form>
<div class="clear"></div>
<hr/>
</div>
+3 -1
View File
@@ -1,4 +1,4 @@
<div class="section-content-wrapper-np">
<div id="cloud-drag-area" class="section-content-wrapper-np">
<table id="cloud-index">
<tr>
<th width="1%"></th>
@@ -18,6 +18,7 @@
<td class="hidden-xs"></td>
</tr>
{{/if}}
<tr id="new-upload-progress-bar--1"></tr> {{* this is needed to append the upload files in the right order *}}
{{foreach $entries as $item}}
<tr id="cloud-index-{{$item.attachId}}">
<td><i class="fa {{$item.iconFromType}}" title="{{$item.type}}"></i></td>
@@ -38,6 +39,7 @@
<tr id="cloud-tools-{{$item.attachId}}">
<td id="perms-panel-{{$item.attachId}}" colspan="9"></td>
</tr>
{{/foreach}}
</table>
</div>
+3 -3
View File
@@ -511,10 +511,10 @@ function enableOnUser(){
xhr.addEventListener('load', function (e) {
//console.log('xhr upload complete', e);
window.fileUploadsCompleted = window.fileUploadsCompleted + 1;
addeditortext(xhr.responseText);
$('#jot-media').val($('#jot-media').val() + xhr.responseText);
// When all the uploads have completed, refresh the page
if (window.filesToUpload > 0 && window.fileUploadsCompleted === window.filesToUpload) {
addeditortext(xhr.responseText);
$('#jot-media').val($('#jot-media').val() + xhr.responseText);
if (window.filesToUpload > 0 && window.fileUploadsCompleted === window.filesToUpload) {
$('#profile-rotator').spin(false);
window.fileUploadsCompleted = window.filesToUpload = 0;
}