diff --git a/.htaccess b/.htaccess
index 0d334503d0..b181f8b845 100644
--- a/.htaccess
+++ b/.htaccess
@@ -2,6 +2,7 @@ ErrorDocument 404 /core/templates/404.php
php_value upload_max_filesize 512M
php_value post_max_size 512M
+php_value memory_limit 512M
SetEnv htaccessWorking true
RewriteEngine on
diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css
index 0204f2fc12..6555c25a76 100644
--- a/apps/calendar/css/style.css
+++ b/apps/calendar/css/style.css
@@ -17,6 +17,8 @@
#editentry_dialog {display: none;}
#parsingfail_dialog{display: none;}
+#loading { display: none; left: 40%; position: fixed; top: 4.4em; z-index: 100; }
+
#calendar_holder {position: relative;bottom: 0; right: 0; left: 0; top: 3em;}
.fc-content{padding:2px 4px;}
#listview {margin: 0; padding: 10px; background: #EEEEEE;}
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index 9b3ea5005d..ce1a4aa046 100644
--- a/apps/calendar/export.php
+++ b/apps/calendar/export.php
@@ -6,25 +6,25 @@
* See the COPYING-README file.
*/
-require_once ("../../lib/base.php");
+require_once ('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
-$cal = isset($_GET["calid"]) ? $_GET["calid"] : NULL;
-$event = isset($_GET["eventid"]) ? $_GET["eventid"] : NULL;
+$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
+$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
if(isset($cal)){
$calendar = OC_Calendar_App::getCalendar($cal);
$calobjects = OC_Calendar_Object::all($cal);
- header("Content-Type: text/Calendar");
- header("Content-Disposition: inline; filename=calendar.ics");
+ header('Content-Type: text/Calendar');
+ header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics');
foreach($calobjects as $calobject){
- echo $calobject["calendardata"] . "\n";
+ echo $calobject['calendardata'] . '\n';
}
}elseif(isset($event)){
- $data = OC_Calendar_App::getEventObject($_GET["eventid"]);
- $calendarid = $data["calendarid"];
+ $data = OC_Calendar_App::getEventObject($_GET['eventid']);
+ $calendarid = $data['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid);
- header("Content-Type: text/Calendar");
- header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
- echo $data["calendardata"];
+ header('Content-Type: text/Calendar');
+ header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
+ echo $data['calendardata'];
}
?>
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index c3644b5370..6e0a450f6a 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -8,7 +8,15 @@
Calendar={
UI:{
+ loading: function(isLoading){
+ if (isLoading){
+ $('#loading').show();
+ }else{
+ $('#loading').hide();
+ }
+ },
startEventDialog:function(){
+ Calendar.UI.loading(false);
$('.tipsy').remove();
$('#calendar_holder').fullCalendar('unselect');
Calendar.UI.lockTime();
@@ -41,6 +49,7 @@ Calendar={
// TODO: save event
$('#event').dialog('destroy').remove();
}else{
+ Calendar.UI.loading(true);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php'), {start:start, end:end, allday:allday?1:0}, Calendar.UI.startEventDialog);
}
},
@@ -50,13 +59,16 @@ Calendar={
// TODO: save event
$('#event').dialog('destroy').remove();
}else{
+ Calendar.UI.loading(true);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'editeventform.php') + '?id=' + id, Calendar.UI.startEventDialog);
}
},
submitDeleteEventForm:function(url){
var post = $( '#event_form' ).serialize();
$('#errorbox').empty();
+ Calendar.UI.loading(true);
$.post(url, post, function(data){
+ Calendar.UI.loading(false);
if(data.status == 'success'){
$('#calendar_holder').fullCalendar('removeEvents', $('#event_form input[name=id]').val());
$('#event').dialog('destroy').remove();
@@ -69,8 +81,10 @@ Calendar={
validateEventForm:function(url){
var post = $( "#event_form" ).serialize();
$("#errorbox").empty();
+ Calendar.UI.loading(true);
$.post(url, post,
function(data){
+ Calendar.UI.loading(false);
if(data.status == "error"){
var output = missing_field + ":
";
if(data.title == "true"){
@@ -107,8 +121,10 @@ Calendar={
},
moveEvent:function(event, dayDelta, minuteDelta, allDay, revertFunc){
$('.tipsy').remove();
+ Calendar.UI.loading(true);
$.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0, lastmodified: event.lastmodified},
function(data) {
+ Calendar.UI.loading(false);
if (data.status == 'success'){
event.lastmodified = data.lastmodified;
console.log("Event moved successfully");
@@ -120,8 +136,10 @@ Calendar={
},
resizeEvent:function(event, dayDelta, minuteDelta, revertFunc){
$('.tipsy').remove();
+ Calendar.UI.loading(true);
$.post(OC.filePath('calendar', 'ajax', 'resizeevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, lastmodified: event.lastmodified},
function(data) {
+ Calendar.UI.loading(false);
if (data.status == 'success'){
event.lastmodified = data.lastmodified;
console.log("Event resized successfully");
@@ -210,6 +228,7 @@ Calendar={
if($('#choosecalendar_dialog').dialog('isOpen') == true){
$('#choosecalendar_dialog').dialog('moveToTop');
}else{
+ Calendar.UI.loading(true);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'choosecalendar.php'), function(){
$('#choosecalendar_dialog').dialog({
width : 600,
@@ -217,13 +236,16 @@ Calendar={
$(this).dialog('destroy').remove();
}
});
+ Calendar.UI.loading(false);
});
}
},
activation:function(checkbox, calendarid)
{
+ Calendar.UI.loading(true);
$.post(OC.filePath('calendar', 'ajax', 'activation.php'), { calendarid: calendarid, active: checkbox.checked?1:0 },
function(data) {
+ Calendar.UI.loading(false);
if (data.status == 'success'){
checkbox.checked = data.active == 1;
if (data.active == 1){
@@ -520,6 +542,7 @@ $(document).ready(function(){
}
});
},
+ loading: Calendar.UI.loading,
eventSources: eventSources
});
$('#oneweekview_radio').click(function(){
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index 2003b7efc4..13bc8bc1bb 100755
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -19,6 +19,7 @@
var missing_field_dberror = 't('There was a database fail') ?>';
var totalurl = '/calendars';
+
';
+ var displayTemplate = '
';
for (var i in Albums.albums) {
var a = Albums.albums[i];
var local = $(displayTemplate.replace(/\*NAME\*/g, a.name));
- local.css('background-repeat', 'no-repeat');
- local.css('background-position', '0 0');
- local.css('background-image','url("ajax/getCovers.php?album_name='+a.name+'")');
- local.mousemove(function(e) {
+ $("#gallery_album_cover", local).css('background-repeat', 'no-repeat');
+ $("#gallery_album_cover", local).css('background-position', '0');
+ $("#gallery_album_cover", local).css('background-image','url("ajax/getCovers.php?album_name='+a.name+'")');
+ local.mouseover(function(e) {
+ $("#gallery_control_overlay", this).css('visibility','visible');
+ });
+ local.mouseout(function(e) {
+ $("#gallery_control_overlay", this).css('visibility','hidden');
+ });
+ $("#gallery_album_cover", local).mousemove(function(e) {
+
var albumMetadata = Albums.find(this.title);
if (albumMetadata == undefined) {
return;
}
var x = Math.min(Math.floor((e.layerX - this.offsetLeft)/(this.offsetWidth/albumMetadata.numOfCovers)), albumMetadata.numOfCovers-1);
- x *= this.offsetWidth;
+ x *= this.offsetWidth-1;
$(this).css('background-position', -x+'px 0');
});
$(element).append(local);
}
+ },
+ rename: function(element, new_name) {
+ if (new_name) {
+ $(element).attr("title", new_name);
+ $("a", element).attr("href", "?view="+new_name);
+ $("h1", element).text(new_name);
+ }
}
}
diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php
index 6ddfe46de3..0999429c5d 100644
--- a/apps/gallery/lib/album.php
+++ b/apps/gallery/lib/album.php
@@ -1,10 +1,27 @@
execute(array($owner, $name));
}
+
+ public static function rename($oldname, $newname, $owner) {
+ $stmt = OC_DB::prepare('UPDATE OR IGNORE *PREFIX*gallery_albums SET album_name=? WHERE uid_owner=? AND album_name=?');
+ $stmt->execute(array($newname, $owner, $oldname));
+ }
+
+ public static function remove($owner, $name=null) {
+ $sql = 'DELETE FROM *PREFIX*gallery_albums WHERE uid_owner = ?';
+ $args = array($owner);
+ if (!is_null($name)){
+ $sql .= ' AND album_name = ?';
+ $args[] = $name;
+ }
+ $stmt = OC_DB::prepare($sql);
+ return $stmt->execute($args);
+ }
+
public static function find($owner, $name=null){
$sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?';
$args = array($owner);
diff --git a/apps/gallery/lib/images_utils.php b/apps/gallery/lib/images_utils.php
new file mode 100644
index 0000000000..cb46bf3f16
--- /dev/null
+++ b/apps/gallery/lib/images_utils.php
@@ -0,0 +1,43 @@
+ $ratio_orig) {
+ $new_height = $thumbnail_width/$ratio_orig;
+ $new_width = $thumbnail_width;
+ } else {
+ $new_width = $thumbnail_height*$ratio_orig;
+ $new_height = $thumbnail_height;
+ }
+
+ $x_mid = $new_width/2; //horizontal middle
+ $y_mid = $new_height/2; //vertical middle
+
+ $process = imagecreatetruecolor(round($new_width), round($new_height));
+
+ imagecopyresampled($process, $myImage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
+ imagecopyresampled($tgtImg, $process, $shift, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height);
+
+ imagedestroy($process);
+ imagedestroy($myImage);
+}
+
+?>
diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php
index 1590051c48..ef21032796 100644
--- a/apps/gallery/lib/scanner.php
+++ b/apps/gallery/lib/scanner.php
@@ -1,12 +1,23 @@
execute(array());
+ $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos');
+ $stmt->execute(array());
+ }
+
public static function scanDir($path, &$albums) {
$current_album = array('name'=> $path, 'imagesCount' => 0, 'images' => array());
$current_album['name'] = str_replace('/', '.', str_replace(OC::$CONFIG_DATADIRECTORY, '', $current_album['name']));
@@ -25,6 +36,7 @@ class OC_Gallery_Scanner {
}
$current_album['imagesCount'] = count($current_album['images']);
$albums[] = $current_album;
+
$result = OC_Gallery_Album::find(OC_User::getUser(), $current_album['name']);
if ($result->numRows() == 0 && count($current_album['images'])) {
OC_Gallery_Album::create(OC_User::getUser(), $current_album['name']);
@@ -38,6 +50,18 @@ class OC_Gallery_Scanner {
OC_Gallery_Photo::create($albumId, $img);
}
}
+ if (count($current_album['images'])) {
+ self::createThumbnail($current_album['name'],$current_album['images']);
+ }
+ }
+
+ public static function createThumbnail($albumName, $files) {
+ $file_count = min(count($files), 10);
+ $thumbnail = imagecreatetruecolor($file_count*200, 200);
+ for ($i = 0; $i < $file_count; $i++) {
+ CroppedThumbnail(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/files/'.$files[$i], 200, 200, $thumbnail, $i*200);
+ }
+ imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png');
}
public static function isPhoto($filename) {
diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php
index ae43e2fc55..4acc965269 100644
--- a/apps/gallery/templates/view_album.php
+++ b/apps/gallery/templates/view_album.php
@@ -15,7 +15,8 @@ OC_Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
diff --git a/files/index.php b/files/index.php
index 7e156130d8..189917150a 100644
--- a/files/index.php
+++ b/files/index.php
@@ -71,7 +71,7 @@ $breadcrumb = array();
$pathtohere = "";
foreach( explode( "/", $dir ) as $i ){
if( $i != "" ){
- $pathtohere .= "/$i";
+ $pathtohere .= "/".urlencode($i);
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
}
}
diff --git a/files/js/fileactions.js b/files/js/fileactions.js
index 9e2688e82c..6f0729e43b 100644
--- a/files/js/fileactions.js
+++ b/files/js/fileactions.js
@@ -137,7 +137,7 @@ FileActions.register('all','Rename',function(){return OC.imagePath('core','actio
});
FileActions.register('dir','Open','',function(filename){
- window.location='index.php?dir='+$('#dir').val()+'/'+filename;
+ window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
});
FileActions.setDefault('dir','Open');
diff --git a/files/templates/part.list.php b/files/templates/part.list.php
index 46830ba3a3..157ec4ef42 100644
--- a/files/templates/part.list.php
+++ b/files/templates/part.list.php
@@ -5,10 +5,10 @@
$relative_modified_date = relative_modified_date($file['mtime']);
$relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14
if($relative_date_color>200) $relative_date_color = 200; ?>
-
'>
+
'>
-
+
diff --git a/index.php b/index.php
index 2d759d68d7..9bd460be35 100644
--- a/index.php
+++ b/index.php
@@ -100,14 +100,15 @@ else {
$error = true;
}
}
- // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
- elseif(isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])){
- if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
- OC_User::unsetMagicInCookie();
- OC_Util::redirectToDefaultPage();
- }else{
- $error = true;
- }
+ // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
+ elseif(isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])){
+ if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
+ //OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
+ OC_User::unsetMagicInCookie();
+ OC_Util::redirectToDefaultPage();
+ }else{
+ $error = true;
}
+ }
OC_Template::printGuestPage('', 'login', array('error' => $error, 'redirect' => isset($_REQUEST['redirect_url'])?$_REQUEST['redirect_url']:'' ));
}
|