merge master into filesystem

This commit is contained in:
Robin Appelman 2012-01-08 18:01:33 +01:00
commit ccc43f0ea0
28 changed files with 809 additions and 168 deletions

View file

@ -621,7 +621,13 @@ class When
if($interval == "month")
{
$this->try_date->modify('+1 month');
$this->try_date->modify('first day of next month');
if((int) date('t', $this->try_date->format('U')) > (int) $this->start_date->format('j')){
$this->try_date->modify('+' . (int) $this->start_date->format('j') - 1 . ' day');
}else{
$this->try_date->modify('+' . (int) date('t', $this->try_date->format('U')) - 1 . ' day');
}
}
else
{

View file

@ -44,12 +44,6 @@ $modules[] =array(
'modules'=> array('gallery'),
'message'=> $l->t('The php-gd module is needed to create thumbnails of your images'));
$modules[] =array(
'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning',
'part'=> 'mp3info',
'modules'=> array('media'),
'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files'));
$modules[] =array(
'status' => function_exists("ldap_bind") ? 'ok' : 'error',
'part'=> 'php-ldap',

View file

@ -8,4 +8,5 @@
../templates/part.eventform.php
../templates/part.import.php
../templates/part.newevent.php
../templates/settings.php
../templates/settings.php
../templates/lAfix.php

View file

@ -25,6 +25,7 @@
$date = substr($data['startdate'], 0, 10);
list($year, $month, $day) = explode('-', $date);
echo '$(\'#calendar_holder\').fullCalendar(\'gotoDate\', ' . $year . ', ' . --$month . ', ' . $day . ');';
echo '$(\'#dialog_holder\').load(OC.filePath(\'calendar\', \'ajax\', \'editeventform.php\') + \'?id=\' + ' . $_['showevent'] . ' , Calendar.UI.startEventDialog);';
}
?>
});

View file

@ -0,0 +1,39 @@
<?php
$l->t('Sunday');
$l->t('Monday');
$l->t('Tuesday');
$l->t('Wednesday');
$l->t('Thursday');
$l->t('Friday');
$l->t('Saturday');
$l->t('Sun.');
$l->t('Mon.');
$l->t('Tue.');
$l->t('Wed.');
$l->t('Thu.');
$l->t('Fri.');
$l->t('Sat.');
$l->t('January');
$l->t('February');
$l->t('March');
$l->t('April');
$l->t('May');
$l->t('June');
$l->t('July');
$l->t('August');
$l->t('September');
$l->t('October');
$l->t('November');
$l->t('December');
$l->t('Jan.');
$l->t('Feb.');
$l->t('Mar.');
$l->t('Apr.');
$l->t('May.');
$l->t('Jun.');
$l->t('Jul.');
$l->t('Aug.');
$l->t('Sep.');
$l->t('Oct.');
$l->t('Nov.');
$l->t('Dec.');

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,4 +1,26 @@
<?
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
require_once(OC::$CLASSPATH['OC_Gallery_Album']);
OC_JSON::checkLoggedIn();

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,5 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC::$CLASSPATH['OC_Gallery_Album'] = 'apps/gallery/lib/album.php';
OC::$CLASSPATH['OC_Gallery_Photo'] = 'apps/gallery/lib/photo.php';
OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php';

View file

@ -6,6 +6,6 @@
<licence>AGPL</licence>
<author>Bartek Przybylski</author>
<require>2</require>
<description></description>
<description>Gallery application for ownCloud</description>
<default_enable/>
</info>

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../lib/base.php');
OC_Util::checkLoggedIn();

View file

@ -1,5 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_Gallery_Album {
public static function create($owner, $name, $path){
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path) VALUES (?, ?, ?)');

View file

@ -1,5 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_Hook::connect("OC_Filesystem", "post_write", "OC_Gallery_Hooks_Handlers", "addPhotoFromPath");
OC_Hook::connect("OC_Filesystem", "delete", "OC_Gallery_Hooks_Handlers", "removePhoto");
OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Gallery_Hooks_Handlers", "renamePhoto");
@ -11,6 +32,7 @@ class OC_Gallery_Hooks_Handlers {
private static $APP_TAG = "Gallery";
private static function isPhoto($filename) {
OC_Log::write(self::$APP_TAG, "Checking file ".$filename." with mimetype ".OC_Filesystem::getMimeType($filename), OC_Log::DEBUG);
if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/")
return 1;
return 0;
@ -18,7 +40,8 @@ class OC_Gallery_Hooks_Handlers {
private static function createAlbum($path) {
$new_album_name = trim(str_replace('/', '.', $path), '.');
if ($new_album_name == '') $new_album_name = 'main';
if ($new_album_name == '')
$new_album_name = 'main';
OC_Log::write(self::$APP_TAG, 'Creating new album '.$new_album_name, OC_Log::DEBUG);
OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path);
@ -31,6 +54,7 @@ class OC_Gallery_Hooks_Handlers {
$fullpath = $params['path'];
OC_Log::write(self::$APP_TAG, 'Adding file with path '. $fullpath, OC_Log::DEBUG);
$path = substr($fullpath, 0, strrpos($fullpath, '/'));
if ($path == '') $path = '/';
$album = OC_Gallery_Album::find(OC_User::getUser(), null, $path);
if ($album->numRows() == 0) {
@ -55,7 +79,10 @@ class OC_Gallery_Hooks_Handlers {
public static function renamePhoto($params) {
$olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/'));
$newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/'));
if ($olddir == '') $olddir = '/';
if ($newdir == '') $newdir = '/';
if (!self::isPhoto($params['newpath'])) return;
OC_Log::write(self::$APP_TAG, 'Moving photo from '.$params['oldpath'].' to '.$params['newpath'], OC_Log::DEBUG);
$album;
$newAlbumId;
$oldAlbumId;

View file

@ -1,4 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('gallery');

View file

@ -1,5 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_Gallery_Photo{
public static function create($albumId, $img){
$stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)');

View file

@ -1,5 +1,26 @@
<?php
/**
* ownCloud - gallery application
*
* @author Bartek Przybylski
* @copyright 2012 Bartek Przybylski bart.p.pl@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once('base.php'); // base lib
require_once('images_utils.php');

View file

@ -22,11 +22,11 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
#collection li.album,#collection li.song { margin-left:3em; }
#leftcontent img.remove { display:none; float:right; cursor:pointer; }
#leftcontent li:hover img.remove { display:inline; }
#leftcontent li {white-space: normal; }
#leftcontent li div.label { float: left; width: 200px; overflow: hidden; text-overflow: ellipsis; }
#collection li button { float:right; }
#collection li,#playlist li { list-style-type:none; }
.template { display:none; }
.collection_playing { background:#eee; }
.collection_playing { background:#eee; font-weight: bold; }
#collection li { padding-right:10px; }
#searchresults input.play, #searchresults input.add { float:left; height:1em; width:1em; }

View file

@ -93,9 +93,11 @@ var PlayList={
ended:PlayList.next,
pause:function(){
localStorage.setItem(oc_current_user+'oc_playlist_playing','false');
document.title = "ownCloud";
},
play:function(){
play:function(event){
localStorage.setItem(oc_current_user+'oc_playlist_playing','true');
document.title = "\u25b8 " + event.jPlayer.status.media.name + " - " + event.jPlayer.status.media.artist + " - ownCloud";
},
supplied:type,
ready:function(){

View file

@ -1,11 +1,23 @@
PlayList.render=function(){
$('#playlist').show();
/*
* We should not empty() PlayList.parent() but thorougly manage its
* elements instead because some code might be attached to those.
* JQuery tipsies are one of them. The following line make sure they
* are all removed before we delete the associated <li/>.
*/
$(".tipsy").remove();
PlayList.parent.empty();
for(var i=0;i<PlayList.items.length;i++){
var item=PlayList.items[i];
var li=$('<li/>');
li.append(item.name);
li.attr('class', 'jp-playlist-' + i);
li.attr('class', 'jp-playlist-' + i);
li.attr('title', item.artist + ' - ' + item.name + '<br/>(' + item.album + ')');
var div = $('<div class="label">' + item.name + '</div>');
li.append(div);
$('.jp-playlist-' + i).tipsy({gravity:'w', fade:true, live:true, html:true});
var img=$('<img class="remove svg action" src="'+OC.imagePath('core','actions/delete')+'"/>');
img.click(function(event){
event.stopPropagation();

View file

@ -30,7 +30,6 @@ class OC_MEDIA_SCANNER{
//these are used to store which artists and albums we found, it can save a lot of addArtist/addAlbum calls
static private $artists=array();
static private $albums=array();//stored as "$artist/$album" to allow albums with the same name from different artists
static private $useMp3Info=null;
/**
* scan a folder for music
@ -70,72 +69,55 @@ class OC_MEDIA_SCANNER{
* @return boolean
*/
public static function scanFile($path){
if(is_null(self::$useMp3Info)){
self::$useMp3Info=OC_Helper::canExecute("mp3info");
}
$file=OC_Filesystem::getLocalFile($path);
if(substr($path,-3)=='mp3' and self::$useMp3Info){//use the command line tool id3info if possible
$output=array();
$size=filesize($file);
exec('mp3info -p "%a\n%l\n%t\n%n\n%S" "'.$file.'"',$output);
if(count($output)>4){
$artist=$output[0];
$album=$output[1];
$title=$output[2];
$track=$output[3];
$length=$output[4];
}else{
return; //invalid mp3 file
}
}else{
if(!self::isMusic($path)){
return;
}
if(!self::$getID3){
self::$getID3=@new getID3();
self::$getID3->encoding='UTF-8';
}
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
if(!isset($data['comments'])){
OC_Log::write('media',"error reading id3 tags in '$file'",OC_Log::WARN);
return;
}
if(!isset($data['comments']['artist'])){
OC_Log::write('media',"error reading artist tag in '$file'",OC_Log::WARN);
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
}
if(!isset($data['comments']['album'])){
OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN);
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
}
if(!isset($data['comments']['title'])){
OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN);
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);
}
$size=$data['filesize'];
if (isset($data['comments']['track']))
{
$track = $data['comments']['track'][0];
}
else if (isset($data['comments']['track_number']))
{
$track = $data['comments']['track_number'][0];
$track = explode('/',$track);
$track = $track[0];
}
else
{
$track = 0;
}
$length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0;
if(!self::isMusic($path)){
return;
}
if(!self::$getID3){
self::$getID3=@new getID3();
self::$getID3->encoding='UTF-8';
}
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
if(!isset($data['comments'])){
OC_Log::write('media',"error reading id3 tags in '$file'",OC_Log::WARN);
return;
}
if(!isset($data['comments']['artist'])){
OC_Log::write('media',"error reading artist tag in '$file'",OC_Log::WARN);
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
}
if(!isset($data['comments']['album'])){
OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN);
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
}
if(!isset($data['comments']['title'])){
OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN);
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);
}
$size=$data['filesize'];
if (isset($data['comments']['track']))
{
$track = $data['comments']['track'][0];
}
else if (isset($data['comments']['track_number']))
{
$track = $data['comments']['track_number'][0];
$track = explode('/',$track);
$track = $track[0];
}
else
{
$track = 0;
}
$length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0;
if(!isset(self::$artists[$artist])){
$artistId=OC_MEDIA_COLLECTION::addArtist($artist);
self::$artists[$artist]=$artistId;

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-10-22 13:05+0200\n"
"POT-Creation-Date: 2012-01-07 18:29+0100\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"
@ -17,8 +17,8 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ajax/editeventform.php:26
msgid "Wrong calendar"
#: ajax/guesstimezone.php:42
msgid "New Timezone:"
msgstr ""
#: ajax/settimezone.php:22
@ -29,171 +29,391 @@ msgstr ""
msgid "Invalid request"
msgstr ""
#: appinfo/app.php:21 templates/calendar.php:11
#: templates/part.eventform.php:21
#: appinfo/app.php:20 templates/calendar.php:13
#: templates/part.eventform.php:20
msgid "Calendar"
msgstr ""
#: js/calendar.js:153
msgid "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}"
#: lib/app.php:19
msgid "Wrong calendar"
msgstr ""
#: js/calendar.js:155
msgid "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}"
msgstr ""
#: lib/object.php:344
#: lib/app.php:60 lib/object.php:332
msgid "Birthday"
msgstr ""
#: lib/object.php:345
#: lib/app.php:61 lib/object.php:333
msgid "Business"
msgstr ""
#: lib/object.php:346
#: lib/app.php:62 lib/object.php:334
msgid "Call"
msgstr ""
#: lib/object.php:347
#: lib/app.php:63 lib/object.php:335
msgid "Clients"
msgstr ""
#: lib/object.php:348
#: lib/app.php:64 lib/object.php:336
msgid "Deliverer"
msgstr ""
#: lib/object.php:349
#: lib/app.php:65 lib/object.php:337
msgid "Holidays"
msgstr ""
#: lib/object.php:350
#: lib/app.php:66 lib/object.php:338
msgid "Ideas"
msgstr ""
#: lib/object.php:351
#: lib/app.php:67 lib/object.php:339
msgid "Journey"
msgstr ""
#: lib/object.php:352
#: lib/app.php:68 lib/object.php:340
msgid "Jubilee"
msgstr ""
#: lib/object.php:353
#: lib/app.php:69 lib/object.php:341
msgid "Meeting"
msgstr ""
#: lib/object.php:354
#: lib/app.php:70 lib/object.php:342
msgid "Other"
msgstr ""
#: lib/object.php:355
#: lib/app.php:71 lib/object.php:343
msgid "Personal"
msgstr ""
#: lib/object.php:356
#: lib/app.php:72 lib/object.php:344
msgid "Projects"
msgstr ""
#: lib/object.php:357
#: lib/app.php:73 lib/object.php:345
msgid "Questions"
msgstr ""
#: lib/object.php:358
#: lib/app.php:74 lib/object.php:346
msgid "Work"
msgstr ""
#: lib/object.php:365
#: lib/object.php:353
msgid "Does not repeat"
msgstr ""
#: lib/object.php:366
#: lib/object.php:354
msgid "Daily"
msgstr ""
#: lib/object.php:367
#: lib/object.php:355
msgid "Weekly"
msgstr ""
#: lib/object.php:368
#: lib/object.php:356
msgid "Every Weekday"
msgstr ""
#: lib/object.php:369
#: lib/object.php:357
msgid "Bi-Weekly"
msgstr ""
#: lib/object.php:370
#: lib/object.php:358
msgid "Monthly"
msgstr ""
#: lib/object.php:371
#: lib/object.php:359
msgid "Yearly"
msgstr ""
#: lib/object.php:389
#: lib/object.php:366
msgid "never"
msgstr ""
#: lib/object.php:367
msgid "by occurrences"
msgstr ""
#: lib/object.php:368
msgid "by date"
msgstr ""
#: lib/object.php:375
msgid "by monthday"
msgstr ""
#: lib/object.php:376
msgid "by weekday"
msgstr ""
#: lib/object.php:383 templates/lAfix.php:3
msgid "Monday"
msgstr ""
#: lib/object.php:384 templates/lAfix.php:4
msgid "Tuesday"
msgstr ""
#: lib/object.php:385 templates/lAfix.php:5
msgid "Wednesday"
msgstr ""
#: lib/object.php:386 templates/lAfix.php:6
msgid "Thursday"
msgstr ""
#: lib/object.php:387 templates/lAfix.php:7
msgid "Friday"
msgstr ""
#: lib/object.php:388 templates/lAfix.php:8
msgid "Saturday"
msgstr ""
#: lib/object.php:389 templates/lAfix.php:2
msgid "Sunday"
msgstr ""
#: lib/object.php:396
msgid "events week of month"
msgstr ""
#: lib/object.php:397
msgid "first"
msgstr ""
#: lib/object.php:398
msgid "second"
msgstr ""
#: lib/object.php:399
msgid "third"
msgstr ""
#: lib/object.php:400
msgid "fourth"
msgstr ""
#: lib/object.php:401
msgid "fifth"
msgstr ""
#: lib/object.php:402
msgid "last"
msgstr ""
#: lib/object.php:424 templates/lAfix.php:16
msgid "January"
msgstr ""
#: lib/object.php:425 templates/lAfix.php:17
msgid "February"
msgstr ""
#: lib/object.php:426 templates/lAfix.php:18
msgid "March"
msgstr ""
#: lib/object.php:427 templates/lAfix.php:19
msgid "April"
msgstr ""
#: lib/object.php:428 templates/lAfix.php:20
msgid "May"
msgstr ""
#: lib/object.php:429 templates/lAfix.php:21
msgid "June"
msgstr ""
#: lib/object.php:430 templates/lAfix.php:22
msgid "July"
msgstr ""
#: lib/object.php:431 templates/lAfix.php:23
msgid "August"
msgstr ""
#: lib/object.php:432 templates/lAfix.php:24
msgid "September"
msgstr ""
#: lib/object.php:433 templates/lAfix.php:25
msgid "October"
msgstr ""
#: lib/object.php:434 templates/lAfix.php:26
msgid "November"
msgstr ""
#: lib/object.php:435 templates/lAfix.php:27
msgid "December"
msgstr ""
#: lib/object.php:441
msgid "by events date"
msgstr ""
#: lib/object.php:442
msgid "by yearday(s)"
msgstr ""
#: lib/object.php:443
msgid "by weeknumber(s)"
msgstr ""
#: lib/object.php:444
msgid "by day and month"
msgstr ""
#: lib/object.php:467
msgid "Not an array"
msgstr ""
#: templates/calendar.php:8
#: lib/search.php:32 lib/search.php:34 lib/search.php:37
msgid "Date"
msgstr ""
#: lib/search.php:40
msgid "Cal."
msgstr ""
#: templates/calendar.php:10
msgid "All day"
msgstr ""
#: templates/calendar.php:9
#: templates/calendar.php:11
msgid "Missing fields"
msgstr ""
#: templates/calendar.php:10 templates/part.eventform.php:3
#: templates/calendar.php:12 templates/part.eventform.php:3
msgid "Title"
msgstr ""
#: templates/calendar.php:12
#: templates/calendar.php:14
msgid "From Date"
msgstr ""
#: templates/calendar.php:13
#: templates/calendar.php:15
msgid "From Time"
msgstr ""
#: templates/calendar.php:14
#: templates/calendar.php:16
msgid "To Date"
msgstr ""
#: templates/calendar.php:15
#: templates/calendar.php:17
msgid "To Time"
msgstr ""
#: templates/calendar.php:16
#: templates/calendar.php:18
msgid "The event ends before it starts"
msgstr ""
#: templates/calendar.php:17
#: templates/calendar.php:19
msgid "There was a database fail"
msgstr ""
#: templates/calendar.php:23
#: templates/calendar.php:38
msgid "Week"
msgstr ""
#: templates/calendar.php:24
#: templates/calendar.php:39
msgid "Month"
msgstr ""
#: templates/calendar.php:25
#: templates/calendar.php:40
msgid "List"
msgstr ""
#: templates/calendar.php:30
#: templates/calendar.php:45
msgid "Today"
msgstr ""
#: templates/calendar.php:31
#: templates/calendar.php:46
msgid "Calendars"
msgstr ""
#: templates/calendar.php:48
#: templates/calendar.php:64
msgid "There was a fail, while parsing the file."
msgstr ""
#: templates/lAfix.php:9
msgid "Sun."
msgstr ""
#: templates/lAfix.php:10
msgid "Mon."
msgstr ""
#: templates/lAfix.php:11
msgid "Tue."
msgstr ""
#: templates/lAfix.php:12
msgid "Wed."
msgstr ""
#: templates/lAfix.php:13
msgid "Thu."
msgstr ""
#: templates/lAfix.php:14
msgid "Fri."
msgstr ""
#: templates/lAfix.php:15
msgid "Sat."
msgstr ""
#: templates/lAfix.php:28
msgid "Jan."
msgstr ""
#: templates/lAfix.php:29
msgid "Feb."
msgstr ""
#: templates/lAfix.php:30
msgid "Mar."
msgstr ""
#: templates/lAfix.php:31
msgid "Apr."
msgstr ""
#: templates/lAfix.php:32
msgid "May."
msgstr ""
#: templates/lAfix.php:33
msgid "Jun."
msgstr ""
#: templates/lAfix.php:34
msgid "Jul."
msgstr ""
#: templates/lAfix.php:35
msgid "Aug."
msgstr ""
#: templates/lAfix.php:36
msgid "Sep."
msgstr ""
#: templates/lAfix.php:37
msgid "Oct."
msgstr ""
#: templates/lAfix.php:38
msgid "Nov."
msgstr ""
#: templates/lAfix.php:39
msgid "Dec."
msgstr ""
#: templates/part.choosecalendar.php:1
msgid "Choose active calendars"
msgstr ""
@ -216,7 +436,7 @@ msgid "Edit"
msgstr ""
#: templates/part.choosecalendar.rowfields.php:4
#: templates/part.editevent.php:8
#: templates/part.editevent.php:9
msgid "Delete"
msgstr ""
@ -244,7 +464,7 @@ msgstr ""
msgid "Save"
msgstr ""
#: templates/part.editcalendar.php:42 templates/part.editevent.php:7
#: templates/part.editcalendar.php:42 templates/part.editevent.php:8
#: templates/part.newevent.php:6
msgid "Submit"
msgstr ""
@ -257,7 +477,7 @@ msgstr ""
msgid "Edit an event"
msgstr ""
#: templates/part.editevent.php:9
#: templates/part.editevent.php:10
msgid "Export"
msgstr ""
@ -273,43 +493,83 @@ msgstr ""
msgid "Select category"
msgstr ""
#: templates/part.eventform.php:39
#: templates/part.eventform.php:37
msgid "All Day Event"
msgstr ""
#: templates/part.eventform.php:43
#: templates/part.eventform.php:41
msgid "From"
msgstr ""
#: templates/part.eventform.php:51
#: templates/part.eventform.php:49
msgid "To"
msgstr ""
#: templates/part.eventform.php:59
#: templates/part.eventform.php:57
msgid "Advanced options"
msgstr ""
#: templates/part.eventform.php:64
#: templates/part.eventform.php:61
msgid "Repeat"
msgstr ""
#: templates/part.eventform.php:80
msgid "Attendees"
#: templates/part.eventform.php:68
msgid "Advanced"
msgstr ""
#: templates/part.eventform.php:87
#: templates/part.eventform.php:112
msgid "Select weekdays"
msgstr ""
#: templates/part.eventform.php:125 templates/part.eventform.php:138
msgid "Select days"
msgstr ""
#: templates/part.eventform.php:130
msgid "and the events day of year."
msgstr ""
#: templates/part.eventform.php:143
msgid "and the events day of month."
msgstr ""
#: templates/part.eventform.php:151
msgid "Select months"
msgstr ""
#: templates/part.eventform.php:164
msgid "Select weeks"
msgstr ""
#: templates/part.eventform.php:169
msgid "and the events week of year."
msgstr ""
#: templates/part.eventform.php:175
msgid "Interval"
msgstr ""
#: templates/part.eventform.php:181
msgid "End"
msgstr ""
#: templates/part.eventform.php:193
msgid "occurrences"
msgstr ""
#: templates/part.eventform.php:208
msgid "Location"
msgstr ""
#: templates/part.eventform.php:89
#: templates/part.eventform.php:210
msgid "Location of the Event"
msgstr ""
#: templates/part.eventform.php:95
#: templates/part.eventform.php:216
msgid "Description"
msgstr ""
#: templates/part.eventform.php:96
#: templates/part.eventform.php:218
msgid "Description of the Event"
msgstr ""
@ -353,6 +613,10 @@ msgstr ""
msgid "Timezone"
msgstr ""
#: templates/settings.php:30
msgid "Check always for changes of the timezone"
msgstr ""
#: templates/settings.php:32
msgid "Timeformat"
msgstr ""

View file

@ -152,14 +152,16 @@ class OC{
}
}
$installedVersion=OC_Config::getValue('version','0.0.0');
$currentVersion=implode('.',OC_Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
OC_DB::updateDbFromStructure('../db_structure.xml');
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}
if(OC_Config::getValue('installed', false)){
$installedVersion=OC_Config::getValue('version','0.0.0');
$currentVersion=implode('.',OC_Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
OC_DB::updateDbFromStructure('../db_structure.xml');
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}
OC_App::updateApps();
OC_App::updateApps();
}
ini_set('session.cookie_httponly','1;');
session_start();

View file

@ -71,7 +71,14 @@ class OC_DB {
/**
* connect to the database using pdo
*/
private static function connectPDO(){
public static function connectPDO(){
if(self::$connection){
if(self::$backend==self::BACKEND_MDB2){
self::disconnect();
}else{
return;
}
}
// The global data we need
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
@ -113,7 +120,14 @@ class OC_DB {
/**
* connect to the database using mdb2
*/
static private function connectMDB2(){
public static function connectMDB2(){
if(self::$connection){
if(self::$backend==self::BACKEND_PDO){
self::disconnect();
}else{
return;
}
}
// The global data we need
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
@ -255,8 +269,8 @@ class OC_DB {
self::$connection->disconnect();
}
self::$connection=false;
self::$mdb2=false;
self::$pdo=false;
self::$MDB2=false;
self::$PDO=false;
}
return true;
@ -374,6 +388,8 @@ class OC_DB {
private static function connectScheme(){
// We need a mdb2 database connection
self::connectMDB2();
self::$MDB2->loadModule('Manager');
self::$MDB2->loadModule('Reverse');
// Connect if this did not happen before
if(!self::$schema){

View file

@ -98,35 +98,45 @@ class OC_Setup {
);
}
else {
$oldUser=OC_Config::getValue('dbuser', false);
$oldPassword=OC_Config::getValue('dbpassword', false);
$query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql
if(mysql_query($query, $connection)) {
//use the admin login data for the new database user
//add prefix to the mysql user name to prevent collissions
$dbusername=substr('oc_mysql_'.$username,0,16);
//hash the password so we don't need to store the admin config in the config file
$dbpassword=md5(time().$password);
self::createDBUser($dbusername, $dbpassword, $connection);
OC_Config::setValue('dbuser', $dbusername);
OC_Config::setValue('dbpassword', $dbpassword);
$dbusername=substr('oc_'.$username,0,16);
if($dbusername!=$oldUser){
//hash the password so we don't need to store the admin config in the config file
$dbpassword=md5(time().$password);
self::createDBUser($dbusername, $dbpassword, $connection);
OC_Config::setValue('dbuser', $dbusername);
OC_Config::setValue('dbpassword', $dbpassword);
}
//create the database
self::createDatabase($dbname, $dbusername, $connection);
}
else {
OC_Config::setValue('dbuser', $dbuser);
OC_Config::setValue('dbpassword', $dbpass);
if($dbuser!=$oldUser){
OC_Config::setValue('dbuser', $dbuser);
OC_Config::setValue('dbpassword', $dbpass);
}
//create the database
self::createDatabase($dbname, $dbuser, $connection);
}
//fill the database if needed
$query="SELECT * FROM $dbname.{$dbtableprefix}users";
$query="select count(*) from information_schema.tables where table_schema='$dbname' AND table_name = '{$dbtableprefix}users';";
$result = mysql_query($query,$connection);
if(!$result) {
if($result){
$row=mysql_fetch_row($result);
}
if(!$result or $row[0]==0) {
OC_DB::createDbFromStructure('db_structure.xml');
}
mysql_close($connection);
@ -180,9 +190,12 @@ class OC_Setup {
}
//fill the database if needed
$query = "SELECT relname FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1";
$query = "select count(*) FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1";
$result = pg_query($connection, $query);
if(!$result) {
if($result){
$row = pg_fetch_row($result);
}
if(!$result or $row[0]==0) {
OC_DB::createDbFromStructure('db_structure.xml');
}
pg_close($connection);