fix merge conflicts
|
@ -28,18 +28,6 @@ OC_Util::checkLoggedIn();
|
|||
OC_Util::checkAppEnabled('bookmarks');
|
||||
|
||||
require_once('bookmarksHelper.php');
|
||||
addBookmark($_GET['url'], '', 'Read-Later');
|
||||
|
||||
OC_App::setActiveNavigationEntry( 'bookmarks_index' );
|
||||
|
||||
OC_Util::addScript('bookmarks','addBm');
|
||||
OC_Util::addStyle('bookmarks', 'bookmarks');
|
||||
|
||||
$tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' );
|
||||
|
||||
$url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
|
||||
$metadata = getURLMetadata($url);
|
||||
|
||||
$tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8'));
|
||||
$tmpl->assign('TITLE', htmlentities($metadata['title'],ENT_COMPAT,'utf-8'));
|
||||
|
||||
$tmpl->printPage();
|
||||
include 'templates/addBm.php';
|
||||
|
|
|
@ -30,50 +30,6 @@ require_once('../../../lib/base.php');
|
|||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||
$_ut = "strftime('%s','now')";
|
||||
} elseif($CONFIG_DBTYPE == 'pgsql') {
|
||||
$_ut = 'date_part(\'epoch\',now())::integer';
|
||||
} else {
|
||||
$_ut = "UNIX_TIMESTAMP()";
|
||||
}
|
||||
|
||||
//FIXME: Detect when user adds a known URL
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks
|
||||
(url, title, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, 0, $_ut, $_ut)
|
||||
");
|
||||
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($_GET["url"]),
|
||||
htmlspecialchars_decode($_GET["title"]),
|
||||
OC_User::getUser()
|
||||
);
|
||||
$query->execute($params);
|
||||
|
||||
$b_id = OC_DB::insertid('*PREFIX*bookmarks');
|
||||
|
||||
|
||||
if($b_id !== false) {
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks_tags
|
||||
(bookmark_id, tag)
|
||||
VALUES (?, ?)
|
||||
");
|
||||
|
||||
$tags = explode(' ', urldecode($_GET["tags"]));
|
||||
foreach ($tags as $tag) {
|
||||
if(empty($tag)) {
|
||||
//avoid saving blankspaces
|
||||
continue;
|
||||
}
|
||||
$params = array($b_id, trim($tag));
|
||||
$query->execute($params);
|
||||
}
|
||||
|
||||
OC_JSON::success(array('data' => $b_id));
|
||||
}
|
||||
|
||||
require_once('../bookmarksHelper.php');
|
||||
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
|
||||
OC_JSON::success(array('data' => $id));
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - bookmarks plugin
|
||||
*
|
||||
* @author Arthur Schiwon
|
||||
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
//no apps or filesystem
|
||||
$RUNTIME_NOSETUPFS=true;
|
||||
|
||||
require_once('../../../lib/base.php');
|
||||
|
||||
// Check if we are a user
|
||||
OC_JSON::checkLoggedIn();
|
||||
OC_JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
// $metadata = array();
|
||||
|
||||
require '../bookmarksHelper.php';
|
||||
$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"]));
|
||||
|
||||
|
||||
OC_JSON::success(array('data' => $metadata));
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
|
||||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
|
|
|
@ -75,14 +75,6 @@
|
|||
<sorting>descending</sorting>
|
||||
</field>
|
||||
</index>
|
||||
<!-- <index>
|
||||
<name>url</name>
|
||||
<unique>true</unique>
|
||||
<field>
|
||||
<name>url</name>
|
||||
<sorting>ascending</sorting>
|
||||
</field>
|
||||
</index>-->
|
||||
</declaration>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<id>bookmarks</id>
|
||||
<name>Bookmarks</name>
|
||||
<description>Bookmark manager for ownCloud</description>
|
||||
<version>0.1</version>
|
||||
<version>0.2</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Arthur Schiwon</author>
|
||||
<author>Arthur Schiwon, Marvin Thomas Rabe</author>
|
||||
<require>2</require>
|
||||
</info>
|
|
@ -70,3 +70,55 @@ function getURLMetadata($url) {
|
|||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
function addBookmark($url, $title='', $tags='') {
|
||||
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
|
||||
if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
||||
$_ut = "strftime('%s','now')";
|
||||
} elseif($CONFIG_DBTYPE == 'pgsql') {
|
||||
$_ut = 'date_part(\'epoch\',now())::integer';
|
||||
} else {
|
||||
$_ut = "UNIX_TIMESTAMP()";
|
||||
}
|
||||
|
||||
//FIXME: Detect when user adds a known URL
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks
|
||||
(url, title, user_id, public, added, lastmodified)
|
||||
VALUES (?, ?, ?, 0, $_ut, $_ut)
|
||||
");
|
||||
|
||||
if(empty($title)) {
|
||||
$metadata = getURLMetadata($url);
|
||||
$title = $metadata['title'];
|
||||
}
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($url),
|
||||
htmlspecialchars_decode($title),
|
||||
OC_User::getUser()
|
||||
);
|
||||
$query->execute($params);
|
||||
|
||||
$b_id = OC_DB::insertid('*PREFIX*bookmarks');
|
||||
|
||||
if($b_id !== false) {
|
||||
$query = OC_DB::prepare("
|
||||
INSERT INTO *PREFIX*bookmarks_tags
|
||||
(bookmark_id, tag)
|
||||
VALUES (?, ?)
|
||||
");
|
||||
|
||||
$tags = explode(' ', urldecode($tags));
|
||||
foreach ($tags as $tag) {
|
||||
if(empty($tag)) {
|
||||
//avoid saving blankspaces
|
||||
continue;
|
||||
}
|
||||
$params = array($b_id, trim($tag));
|
||||
$query->execute($params);
|
||||
}
|
||||
|
||||
return $b_id;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
#content { overflow: auto; }
|
||||
#content { overflow: auto; height: 100%; }
|
||||
#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
|
||||
#firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; }
|
||||
#firstrun .button { font-size: 0.7em; }
|
||||
#firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; }
|
||||
|
||||
.bookmarks_headline {
|
||||
font-size: large;
|
||||
|
@ -12,11 +16,6 @@
|
|||
padding: 0.5ex;
|
||||
}
|
||||
|
||||
.bookmarks_add {
|
||||
display: none;
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
.bookmarks_list {
|
||||
margin-top: 36px;
|
||||
}
|
||||
|
@ -32,7 +31,7 @@
|
|||
}
|
||||
|
||||
.bookmarks_input {
|
||||
width: 20em;
|
||||
width: 8em;
|
||||
}
|
||||
|
||||
.bookmark_actions {
|
||||
|
@ -83,4 +82,4 @@
|
|||
.loading_meta {
|
||||
display: none;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@ $(document).ready(function() {
|
|||
|
||||
function addBookmark(event) {
|
||||
var url = $('#bookmark_add_url').val();
|
||||
var title = $('#bookmark_add_title').val();
|
||||
var tags = $('#bookmark_add_tags').val();
|
||||
$.ajax({
|
||||
url: 'ajax/addBookmark.php',
|
||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
||||
success: function(data){
|
||||
location.href='index.php';
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -3,19 +3,12 @@ var bookmarks_loading = false;
|
|||
|
||||
var bookmarks_sorting = 'bookmarks_sorting_recent';
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.bookmarks_addBtn').click(function(event){
|
||||
$('.bookmarks_add').slideToggle();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#bookmark_add_submit').click(addOrEditBookmark);
|
||||
$(window).scroll(updateOnBottom);
|
||||
|
||||
$('#bookmark_add_url').focusout(getMetadata);
|
||||
|
||||
$('.bookmarks_list').empty();
|
||||
getBookmarks();
|
||||
|
||||
});
|
||||
|
||||
function getBookmarks() {
|
||||
|
@ -35,6 +28,10 @@ function getBookmarks() {
|
|||
|
||||
for(var i in bookmarks.data) {
|
||||
updateBookmarksList(bookmarks.data[i]);
|
||||
$("#firstrun").hide();
|
||||
}
|
||||
if($('.bookmarks_list').is(':empty')) {
|
||||
$("#firstrun").show();
|
||||
}
|
||||
|
||||
$('.bookmark_link').click(recordClick);
|
||||
|
@ -46,20 +43,6 @@ function getBookmarks() {
|
|||
});
|
||||
}
|
||||
|
||||
function getMetadata() {
|
||||
var url = encodeEntities($('#bookmark_add_url').val());
|
||||
$('.loading_meta').css('display','inline');
|
||||
$.ajax({
|
||||
url: 'ajax/getMeta.php',
|
||||
data: 'url=' + encodeURIComponent(url),
|
||||
success: function(pageinfo){
|
||||
$('#bookmark_add_url').val(pageinfo.data.url);
|
||||
$('#bookmark_add_title').val(pageinfo.data.title);
|
||||
$('.loading_meta').css('display','none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// function addBookmark() {
|
||||
// Instead of creating editBookmark() function, Converted the one above to
|
||||
// addOrEditBookmark() to make .js file more compact.
|
||||
|
@ -69,28 +52,17 @@ function addOrEditBookmark(event) {
|
|||
var url = encodeEntities($('#bookmark_add_url').val());
|
||||
var title = encodeEntities($('#bookmark_add_title').val());
|
||||
var tags = encodeEntities($('#bookmark_add_tags').val());
|
||||
var taglist = tags.split(' ');
|
||||
var tagshtml = '';
|
||||
for ( var i=0, len=taglist.length; i<len; ++i ){
|
||||
tagshtml += '<a class="bookmark_tag" href="?tag=' + encodeURI(taglist[i]) + '">' + taglist[i] + '</a> ';
|
||||
}
|
||||
$("#firstrun").hide();
|
||||
|
||||
if (id == 0) {
|
||||
$.ajax({
|
||||
url: 'ajax/addBookmark.php',
|
||||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||
success: function(response){
|
||||
var bookmark_id = response.data;
|
||||
$('.bookmarks_add').slideToggle();
|
||||
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
||||
$('.bookmarks_list').prepend(
|
||||
'<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
|
||||
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
|
||||
'<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
|
||||
'<p class="bookmark_tags">' + tagshtml + '</p>' +
|
||||
'<p class="bookmark_url">' + url + '</p>' +
|
||||
'</div>'
|
||||
);
|
||||
$('.bookmarks_input').val('');
|
||||
$('.bookmarks_list').empty();
|
||||
bookmarks_page = 0;
|
||||
getBookmarks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -99,18 +71,11 @@ function addOrEditBookmark(event) {
|
|||
url: 'ajax/editBookmark.php',
|
||||
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
|
||||
success: function(){
|
||||
$('.bookmarks_add').slideToggle();
|
||||
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
||||
$('.bookmarks_input').val('');
|
||||
$('#bookmark_add_id').val('0');
|
||||
|
||||
var record = $('.bookmark_single[data-id = "' + id + '"]');
|
||||
record.children('.bookmark_url:first').text(url);
|
||||
|
||||
var record_title = record.children('.bookmark_title:first').children('a:first');
|
||||
record_title.attr('href', url);
|
||||
record_title.text(title);
|
||||
|
||||
record.children('.bookmark_tags:first').html(tagshtml);
|
||||
$('.bookmarks_list').empty();
|
||||
bookmarks_page = 0;
|
||||
getBookmarks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -122,7 +87,12 @@ function delBookmark(event) {
|
|||
$.ajax({
|
||||
url: 'ajax/delBookmark.php',
|
||||
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
|
||||
success: function(data){ record.animate({ opacity: 'hide' }, 'fast'); }
|
||||
success: function(data){
|
||||
record.remove();
|
||||
if($('.bookmarks_list').is(':empty')) {
|
||||
$("#firstrun").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -152,10 +122,20 @@ function updateBookmarksList(bookmark) {
|
|||
if(!hasProtocol(bookmark.url)) {
|
||||
bookmark.url = 'http://' + bookmark.url;
|
||||
}
|
||||
if(bookmark.title == '') bookmark.title = bookmark.url;
|
||||
$('.bookmarks_list').append(
|
||||
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
|
||||
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
|
||||
'<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
|
||||
'<p class="bookmark_actions">' +
|
||||
'<span class="bookmark_edit">' +
|
||||
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
|
||||
'</span>' +
|
||||
'<span class="bookmark_delete">' +
|
||||
'<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
|
||||
'</span> ' +
|
||||
'</p>' +
|
||||
'<p class="bookmark_title">'+
|
||||
'<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' +
|
||||
'</p>' +
|
||||
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
|
||||
'</div>'
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
|
@ -8,6 +8,4 @@
|
|||
|
||||
$tmpl = new OC_Template( 'bookmarks', 'settings');
|
||||
|
||||
//OC_Util::addScript('bookmarks','settings');
|
||||
|
||||
return $tmpl->fetchPage();
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<div class="bookmarks_addBm">
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></p>
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
|
||||
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
|
||||
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
|
||||
</div>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Read later - ownCloud</title>
|
||||
<link rel="stylesheet" href="css/readlater.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="message"><h1>Saved!</h1></div>
|
||||
</body>
|
||||
</html>
|
8
apps/bookmarks/templates/bookmarklet.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
function createBookmarklet() {
|
||||
$l = new OC_L10N('bookmarks');
|
||||
echo '<small>' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:') . '</small>'
|
||||
. '<a class="button" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(\'' . OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') . '?output=popup&url=\'+c(b.location),\'bkmk_popup\',\'left=\'+((a.screenX||a.screenLeft)+10)+\',top=\'+((a.screenY||a.screenTop)+10)+\',height=230px,width=230px,resizable=1,alwaysRaised=1\');a.setTimeout(function(){d.focus()},300);})();">'
|
||||
. $l->t('Read later') . '</a>';
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
|
||||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
|
@ -9,17 +9,18 @@
|
|||
?>
|
||||
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
|
||||
<div id="controls">
|
||||
<input type="button" class="bookmarks_addBtn" value="<?php echo $l->t('Add bookmark'); ?>"/>
|
||||
</div>
|
||||
<div class="bookmarks_add">
|
||||
<input type="hidden" id="bookmark_add_id" value="0" />
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
|
||||
<img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
|
||||
<p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
|
||||
<p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
|
||||
<p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
|
||||
<input type="text" id="bookmark_add_url" placeholder="<?php echo $l->t('Address'); ?>" class="bookmarks_input" />
|
||||
<input type="text" id="bookmark_add_title" placeholder="<?php echo $l->t('Title'); ?>" class="bookmarks_input" />
|
||||
<input type="text" id="bookmark_add_tags" placeholder="<?php echo $l->t('Tags'); ?>" class="bookmarks_input" />
|
||||
<input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" />
|
||||
</div>
|
||||
<div class="bookmarks_list">
|
||||
<?php echo $l->t('You have no bookmarks'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="firstrun" style="display: none;">
|
||||
<?php
|
||||
echo $l->t('You have no bookmarks');
|
||||
require_once('bookmarklet.php');
|
||||
createBookmarklet();
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
|
||||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
|
@ -8,7 +8,10 @@
|
|||
?>
|
||||
<form id="bookmarks">
|
||||
<fieldset class="personalblock">
|
||||
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
|
||||
<br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
|
||||
<span class="bold"><?php echo $l->t('Bookmarklet <br />');?></span>
|
||||
<?php
|
||||
require_once('bookmarklet.php');
|
||||
createBookmarklet();
|
||||
?>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -21,4 +21,4 @@ switch($view){
|
|||
}
|
||||
OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'currentview', $view);
|
||||
OC_JSON::success();
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
||||
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
require_once ('../../../lib/base.php');
|
||||
require_once('../../../3rdparty/when/When.php');
|
||||
|
||||
|
@ -13,6 +14,7 @@ OC_JSON::checkAppEnabled('calendar');
|
|||
|
||||
$start = DateTime::createFromFormat('U', $_GET['start']);
|
||||
$end = DateTime::createFromFormat('U', $_GET['end']);
|
||||
|
||||
if($_GET['calendar_id'] == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){
|
||||
$calendars = OC_Calendar_Share::allSharedwithuser(OC_USER::getUser(), OC_Calendar_Share::CALENDAR, 1, ($_GET['calendar_id'] == 'shared_rw')?'rw':'r');
|
||||
$events = array();
|
||||
|
@ -27,17 +29,21 @@ if($_GET['calendar_id'] == 'shared_rw' || $_GET['calendar_id'] == 'shared_r'){
|
|||
exit;
|
||||
}
|
||||
$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
|
||||
OC_Response::enableCaching(0);
|
||||
OC_Response::setETagHeader($calendar['ctag']);
|
||||
}
|
||||
|
||||
$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
|
||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
|
||||
$return = array();
|
||||
|
||||
foreach($events as $event){
|
||||
$object = OC_VObject::parse($event['calendardata']);
|
||||
$vevent = $object->VEVENT;
|
||||
|
||||
$return_event = OC_Calendar_App::prepareForOutput($event, $vevent);
|
||||
|
||||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||
$return_event = array();
|
||||
$start_dt = $dtstart->getDateTime();
|
||||
$end_dt = $dtend->getDateTime();
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
||||
|
@ -50,9 +56,12 @@ foreach($events as $event){
|
|||
if($event['repeating'] == 1){
|
||||
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
|
||||
$r = new When();
|
||||
$r->recur((string) $start_dt->format('Ymd\THis'))->rrule((string) $vevent->RRULE);
|
||||
$r->recur($start_dt)->rrule((string) $vevent->RRULE);
|
||||
while($result = $r->next()){
|
||||
if($result->format('U') > $_GET['end']){
|
||||
if($result < $start){
|
||||
continue;
|
||||
}
|
||||
if($result > $end){
|
||||
break;
|
||||
}
|
||||
if($return_event['allDay'] == true){
|
||||
|
@ -62,21 +71,18 @@ foreach($events as $event){
|
|||
$return_event['start'] = $result->format('Y-m-d H:i:s');
|
||||
$return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration);
|
||||
}
|
||||
$return[] = OC_Calendar_App::prepareForOutput($event, $vevent, $return_event);
|
||||
$return[] = $return_event;
|
||||
}
|
||||
}else{
|
||||
$return_event = array();
|
||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
||||
$return_event['allDay'] = true;
|
||||
if($return_event['allDay'] == true){
|
||||
$return_event['start'] = $start_dt->format('Y-m-d');
|
||||
$end_dt->modify('-1 sec');
|
||||
$return_event['end'] = $end_dt->format('Y-m-d');
|
||||
}else{
|
||||
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
|
||||
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
|
||||
$return_event['allDay'] = false;
|
||||
}
|
||||
$return[] = OC_Calendar_App::prepareForOutput($event, $vevent, $return_event);
|
||||
$return[] = $return_event;
|
||||
}
|
||||
}
|
||||
OC_JSON::encodedPrint($return);
|
||||
|
|
17
apps/calendar/appinfo/update.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
$installedVersion=OC_Appconfig::getValue('calendar', 'installed_version');
|
||||
if (version_compare($installedVersion, '0.2.1', '<')) {
|
||||
$stmt = OC_DB::prepare( 'SELECT id, calendarcolor FROM *PREFIX*calendar_calendars WHERE calendarcolor IS NOT NULL' );
|
||||
$result = $stmt->execute();
|
||||
while( $row = $result->fetchRow()) {
|
||||
$id = $row['id'];
|
||||
$color = $row['calendarcolor'];
|
||||
if ($color[0] == '#' || strlen($color) < 6) {
|
||||
continue;
|
||||
}
|
||||
$color = '#' .$color;
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET calendarcolor=? WHERE id=?' );
|
||||
$r = $stmt->execute(array($color,$id));
|
||||
}
|
||||
}
|
|
@ -479,7 +479,7 @@ Calendar={
|
|||
colors[i].label = $(elm).text();
|
||||
});
|
||||
for (var i in colors) {
|
||||
picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: #' + colors[i].color + ';"></span>');
|
||||
picker.append('<span class="calendar-colorpicker-color ' + (colors[i].color == $(obj).children(":selected").val() ? ' active' : '') + '" rel="' + colors[i].label + '" style="background-color: ' + colors[i].color + ';"></span>');
|
||||
}
|
||||
picker.delegate(".calendar-colorpicker-color", "click", function() {
|
||||
$(obj).val($(this).attr('rel'));
|
||||
|
@ -792,7 +792,10 @@ $(document).ready(function(){
|
|||
allDayText: allDayText,
|
||||
viewDisplay: function(view) {
|
||||
$('#datecontrol_date').html(view.title);
|
||||
$.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
|
||||
if (view.name != defaultView) {
|
||||
$.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
|
||||
defaultView = view.name;
|
||||
}
|
||||
Calendar.UI.setViewActive(view.name);
|
||||
if (view.name == 'agendaWeek') {
|
||||
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1);
|
||||
|
|
|
@ -115,7 +115,8 @@ class OC_Calendar_App{
|
|||
return OC_Calendar_Object::getWeekofMonth(self::$l10n);
|
||||
}
|
||||
|
||||
public static function prepareForOutput($event, $vevent, $return_event){
|
||||
public static function prepareForOutput($event, $vevent){
|
||||
$return_event = array();
|
||||
$return_event['id'] = (int)$event['id'];
|
||||
$return_event['title'] = htmlspecialchars($event['summary']);
|
||||
$return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'';
|
||||
|
@ -127,6 +128,5 @@ class OC_Calendar_App{
|
|||
}
|
||||
$return_event['lastmodified'] = (int)$lastmodified;
|
||||
return $return_event;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class OC_Calendar_Calendar{
|
|||
* @param string $components Default: "VEVENT,VTODO,VJOURNAL"
|
||||
* @param string $timezone Default: null
|
||||
* @param integer $order Default: 1
|
||||
* @param string $color Default: null
|
||||
* @param string $color Default: null, format: '#RRGGBB(AA)'
|
||||
* @return insertid
|
||||
*/
|
||||
public static function addCalendar($userid,$name,$components='VEVENT,VTODO,VJOURNAL',$timezone=null,$order=0,$color=null){
|
||||
|
@ -122,7 +122,7 @@ class OC_Calendar_Calendar{
|
|||
* @param string $components
|
||||
* @param string $timezone
|
||||
* @param integer $order
|
||||
* @param string $color
|
||||
* @param string $color format: '#RRGGBB(AA)'
|
||||
* @return insertid
|
||||
*/
|
||||
public static function addCalendarFromDAVData($principaluri,$uri,$name,$components,$timezone,$order,$color){
|
||||
|
@ -141,7 +141,7 @@ class OC_Calendar_Calendar{
|
|||
* @param string $components Default: null
|
||||
* @param string $timezone Default: null
|
||||
* @param integer $order Default: null
|
||||
* @param string $color Default: null
|
||||
* @param string $color Default: null, format: '#RRGGBB(AA)'
|
||||
* @return boolean
|
||||
*
|
||||
* Values not null will be set
|
||||
|
@ -230,22 +230,23 @@ class OC_Calendar_Calendar{
|
|||
}
|
||||
public static function getCalendarColorOptions(){
|
||||
return array(
|
||||
'ff0000', // "Red"
|
||||
'b3dc6c', // "Green"
|
||||
'ffff00', // "Yellow"
|
||||
'808000', // "Olive"
|
||||
'ffa500', // "Orange"
|
||||
'ff7f50', // "Coral"
|
||||
'ee82ee', // "Violet"
|
||||
'9fc6e7', // "light blue"
|
||||
'#ff0000', // "Red"
|
||||
'#b3dc6c', // "Green"
|
||||
'#ffff00', // "Yellow"
|
||||
'#808000', // "Olive"
|
||||
'#ffa500', // "Orange"
|
||||
'#ff7f50', // "Coral"
|
||||
'#ee82ee', // "Violet"
|
||||
'#9fc6e7', // "light blue"
|
||||
);
|
||||
}
|
||||
public static function getEventSourceInfo($calendar){
|
||||
return array(
|
||||
'url' => 'ajax/events.php?calendar_id='.$calendar['id'],
|
||||
'backgroundColor' => '#'.$calendar['calendarcolor'],
|
||||
'backgroundColor' => $calendar['calendarcolor'],
|
||||
'borderColor' => '#888',
|
||||
'textColor' => 'black',
|
||||
'cache' => true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,6 +194,7 @@ class OC_Calendar_Object{
|
|||
public static function deleteFromDAVData($cid,$uri){
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*calendar_objects WHERE calendarid = ? AND uri=?' );
|
||||
$stmt->execute(array($cid,$uri));
|
||||
OC_Calendar_Calendar::touchCalendar($cid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
|
|||
}else{
|
||||
$info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
|
||||
}
|
||||
$link = OC_Helper::linkTo('apps/calendar', 'index.php?showevent='.urlencode($object['id']));
|
||||
$link = OC_Helper::linkTo('calendar', 'index.php').'?showevent='.urlencode($object['id']);
|
||||
$results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>';
|
||||
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
|
||||
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
|
||||
var totalurl = '<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?>/calendars';
|
||||
var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
|
||||
$(document).ready(function() {
|
||||
<?php
|
||||
if(array_key_exists('showevent', $_)){
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php if(count($_['calendar_options']) > 1) { ?>
|
||||
<th width="75px"> <?php echo $l->t("Calendar");?>:</th>
|
||||
<td>
|
||||
<select style="width:140px;" name="calendar">
|
||||
|
@ -34,6 +35,12 @@
|
|||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<th width="75px"> </th>
|
||||
<td>
|
||||
<input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['id'] ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
|
|
@ -40,6 +40,6 @@
|
|||
</table>
|
||||
|
||||
<?php echo $l->t('Calendar CalDAV syncing address:');?>
|
||||
<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
|
||||
<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?><br />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -66,6 +66,7 @@ foreach($current as $item) {
|
|||
|
||||
if(is_array($value)) {
|
||||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
|
||||
$value = array_map('strip_tags', $value);
|
||||
} else {
|
||||
$value = strip_tags($value);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,13 @@ OC_JSON::checkLoggedIn();
|
|||
OC_JSON::checkAppEnabled('contacts');
|
||||
|
||||
$userid = OC_User::getUser();
|
||||
$bookid = OC_Contacts_Addressbook::add($userid, strip_tags($_POST['name']), null);
|
||||
$name = trim(strip_tags($_POST['name']));
|
||||
if(!$name) {
|
||||
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));
|
||||
OC_Log::write('contacts','ajax/createaddressbook.php: Cannot add addressbook with an empty name: '.strip_tags($_POST['name']), OC_Log::ERROR);
|
||||
exit();
|
||||
}
|
||||
$bookid = OC_Contacts_Addressbook::add($userid, $name, null);
|
||||
if(!$bookid) {
|
||||
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding addressbook.'))));
|
||||
OC_Log::write('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OC_Log::ERROR);
|
||||
|
|
|
@ -51,7 +51,8 @@ $checksum = isset($_POST['checksum'])?$_POST['checksum']:null;
|
|||
// }
|
||||
// }
|
||||
|
||||
if(is_array($value)){ // FIXME: How to strip_tags for compound values?
|
||||
if(is_array($value)){
|
||||
$value = array_map('strip_tags', $value);
|
||||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form!
|
||||
$value = OC_VObject::escapeSemicolons($value);
|
||||
} else {
|
||||
|
|
|
@ -15,7 +15,14 @@ OC_JSON::checkAppEnabled('contacts');
|
|||
$bookid = $_POST['id'];
|
||||
OC_Contacts_App::getAddressbook($bookid); // is owner access check
|
||||
|
||||
if(!OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null)) {
|
||||
$name = trim(strip_tags($_POST['name']));
|
||||
if(!$name) {
|
||||
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot update addressbook with an empty name.'))));
|
||||
OC_Log::write('contacts','ajax/updateaddressbook.php: Cannot update addressbook with an empty name: '.strip_tags($_POST['name']), OC_Log::ERROR);
|
||||
exit();
|
||||
}
|
||||
|
||||
if(!OC_Contacts_Addressbook::edit($bookid, $name, null)) {
|
||||
OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
|
||||
OC_Log::write('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OC_Log::ERROR);
|
||||
//exit();
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#contacts_propertymenu li a:hover { color: #fff }
|
||||
#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;}
|
||||
#card { /*max-width: 70em; border: thin solid lightgray; display: block;*/ }
|
||||
#firstrun { /*border: thin solid lightgray;*/ width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
|
||||
#firstrun #selections { /*border: thin solid lightgray;*/ font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; }
|
||||
#firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; }
|
||||
#firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; }
|
||||
|
||||
#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 16em; }
|
||||
#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #f8f8f8; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; }
|
||||
|
|
|
@ -10,6 +10,8 @@ require_once('../../lib/base.php');
|
|||
|
||||
// Check if we are a user
|
||||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('contacts');
|
||||
|
||||
// Get active address books. This creates a default one if none exists.
|
||||
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
|
||||
$contacts = OC_Contacts_VCard::all($ids);
|
||||
|
|
|
@ -8,7 +8,7 @@ String.prototype.strip_tags = function(){
|
|||
tags = this;
|
||||
stripped = tags.replace(/[\<\>]/gi, "");
|
||||
return stripped;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Contacts={
|
||||
|
@ -117,7 +117,7 @@ Contacts={
|
|||
$('#carddav_url_close').show();
|
||||
},
|
||||
messageBox:function(title, msg) {
|
||||
if(msg.toLowerCase().indexOf('auth') > 0) {
|
||||
if(msg.toLowerCase().indexOf('auth') != -1) {
|
||||
// fugly hack, I know
|
||||
alert(msg);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ Contacts={
|
|||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
loadListHandlers:function() {
|
||||
//$('.add,.delete').hide();
|
||||
|
@ -323,7 +323,7 @@ Contacts={
|
|||
}
|
||||
});
|
||||
},
|
||||
delete:function() {
|
||||
delete: function() {
|
||||
$('#contacts_deletecard').tipsy('hide');
|
||||
$.getJSON('ajax/deletecard.php',{'id':this.id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
@ -335,17 +335,6 @@ Contacts={
|
|||
// Load first in list.
|
||||
if($('#contacts li').length > 0) {
|
||||
Contacts.UI.Card.update();
|
||||
/*
|
||||
var firstid = $('#contacts li:first-child').data('id');
|
||||
console.log('trying to load: ' + firstid);
|
||||
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':firstid},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
Contacts.UI.Card.loadContact(jsondata.data);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
}
|
||||
});*/
|
||||
} else {
|
||||
// load intro page
|
||||
$.getJSON('ajax/loadintro.php',{},function(jsondata){
|
||||
|
@ -374,6 +363,7 @@ Contacts={
|
|||
$('#rightcontent').data('id',this.id);
|
||||
//console.log('loaded: ' + this.data.FN[0]['value']);
|
||||
this.populateNameFields();
|
||||
this.loadCategories();
|
||||
this.loadPhoto();
|
||||
this.loadMails();
|
||||
this.loadPhones();
|
||||
|
@ -455,9 +445,6 @@ Contacts={
|
|||
this.fullname += ', ' + this.honsuf;
|
||||
}
|
||||
$('#n').html(this.fullname);
|
||||
//$('.jecEditableOption').attr('title', 'Custom');
|
||||
//$('.jecEditableOption').text(this.fn);
|
||||
//$('.jecEditableOption').attr('value', 0);
|
||||
$('#fn_select option').remove();
|
||||
$('#fn_select').combobox('value', this.fn);
|
||||
var names = [this.fullname, this.givname + ' ' + this.famname, this.famname + ' ' + this.givname, this.famname + ', ' + this.givname];
|
||||
|
@ -466,17 +453,16 @@ Contacts={
|
|||
.append($('<option></option>')
|
||||
.text(value));
|
||||
});
|
||||
/*$('#full').text(this.fullname);
|
||||
$('#short').text(this.givname + ' ' + this.famname);
|
||||
$('#reverse').text(this.famname + ' ' + this.givname);
|
||||
$('#reverse_comma').text(this.famname + ', ' + this.givname);*/
|
||||
$('#contact_identity').find('*[data-element="N"]').data('checksum', this.data.N[0]['checksum']);
|
||||
$('#contact_identity').find('*[data-element="FN"]').data('checksum', this.data.FN[0]['checksum']);
|
||||
$('#contact_identity').show();
|
||||
},
|
||||
loadCategories:function(){
|
||||
if(this.data.CATEGORIES) {
|
||||
//
|
||||
}
|
||||
},
|
||||
editNew:function(){ // add a new contact
|
||||
//Contacts.UI.notImplemented();
|
||||
//return false;
|
||||
this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = '';
|
||||
$.getJSON('ajax/newcontact.php',{},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
@ -713,12 +699,6 @@ Contacts={
|
|||
.text(value));
|
||||
});
|
||||
|
||||
/*$('#short').text(n[1] + ' ' + n[0]);
|
||||
$('#full').text(this.fullname);
|
||||
$('#reverse').text(n[0] + ' ' + n[1]);
|
||||
$('#reverse_comma').text(n[0] + ', ' + n[1]);*/
|
||||
//$('#n').html(full);
|
||||
//$('#fn').val(0);
|
||||
if(this.id == '') {
|
||||
var aid = $(dlg).find('#aid').val();
|
||||
Contacts.UI.Card.add(n.join(';'), $('#short').text(), aid);
|
||||
|
@ -835,7 +815,7 @@ Contacts={
|
|||
checksum = Contacts.UI.checksumFor(obj);
|
||||
container = Contacts.UI.propertyContainerFor(obj);
|
||||
}
|
||||
var adr = new Array($(dlg).find('#adr_pobox').val(),$(dlg).find('#adr_extended').val(),$(dlg).find('#adr_street').val(),$(dlg).find('#adr_city').val(),$(dlg).find('#adr_region').val(),$(dlg).find('#adr_zipcode').val(),$(dlg).find('#adr_country').val());
|
||||
var adr = new Array($(dlg).find('#adr_pobox').val().strip_tags(),$(dlg).find('#adr_extended').val().strip_tags(),$(dlg).find('#adr_street').val().strip_tags(),$(dlg).find('#adr_city').val().strip_tags(),$(dlg).find('#adr_region').val().strip_tags(),$(dlg).find('#adr_zipcode').val().strip_tags(),$(dlg).find('#adr_country').val().strip_tags());
|
||||
$(container).find('.adr').val(adr.join(';'));
|
||||
$(container).find('.adr_type').val($(dlg).find('#adr_type').val());
|
||||
$(container).find('.adr_type_label').html(t('contacts',ucwords($(dlg).find('#adr_type').val().toLowerCase())));
|
||||
|
@ -889,21 +869,22 @@ Contacts={
|
|||
},
|
||||
loadPhoto:function(){
|
||||
if(this.data.PHOTO) {
|
||||
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
//alert(jsondata.data.page);
|
||||
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
$('#file_upload_form').show();
|
||||
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide();
|
||||
} else {
|
||||
$('#contacts_details_photo_wrapper').empty();
|
||||
$('#file_upload_form').hide();
|
||||
$('#contacts_propertymenu a[data-type="PHOTO"]').parent().show();
|
||||
}
|
||||
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
//alert(jsondata.data.page);
|
||||
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
||||
}
|
||||
else{
|
||||
Contacts.UI.messageBox(jsondata.data.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
editPhoto:function(id, tmp_path){
|
||||
//alert('editPhoto: ' + tmp_path);
|
||||
|
@ -1062,13 +1043,13 @@ Contacts={
|
|||
return false;
|
||||
}else{
|
||||
$.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid},
|
||||
function(data) {
|
||||
if (data.status == 'success'){
|
||||
function(jsondata) {
|
||||
if (jsondata.status == 'success'){
|
||||
$('#chooseaddressbook_dialog').dialog('destroy').remove();
|
||||
Contacts.UI.Contacts.update();
|
||||
Contacts.UI.Addressbooks.overview();
|
||||
} else {
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), data.message);
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
//alert('Error: ' + data.message);
|
||||
}
|
||||
});
|
||||
|
@ -1078,10 +1059,14 @@ Contacts={
|
|||
Contacts.UI.notImplemented();
|
||||
},
|
||||
submit:function(button, bookid){
|
||||
var displayname = $("#displayname_"+bookid).val();
|
||||
var displayname = $("#displayname_"+bookid).val().trim();
|
||||
var active = $("#edit_active_"+bookid+":checked").length;
|
||||
var description = $("#description_"+bookid).val();
|
||||
|
||||
|
||||
if(displayname.length == 0) {
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Displayname cannot be empty.'));
|
||||
return false;
|
||||
}
|
||||
var url;
|
||||
if (bookid == 'new'){
|
||||
url = OC.filePath('contacts', 'ajax', 'createaddressbook.php');
|
||||
|
@ -1089,12 +1074,14 @@ Contacts={
|
|||
url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php');
|
||||
}
|
||||
$.post(url, { id: bookid, name: displayname, active: active, description: description },
|
||||
function(data){
|
||||
if(data.status == 'success'){
|
||||
$(button).closest('tr').prev().html(data.page).show().next().remove();
|
||||
function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$(button).closest('tr').prev().html(jsondata.page).show().next().remove();
|
||||
Contacts.UI.Contacts.update();
|
||||
} else {
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
}
|
||||
});
|
||||
Contacts.UI.Contacts.update();
|
||||
},
|
||||
cancel:function(button, bookid){
|
||||
$(button).closest('tr').prev().show().next().remove();
|
||||
|
@ -1143,13 +1130,6 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Open blank form to add new contact.
|
||||
* FIXME: Load the same page but only show name data and popup the name edit dialog.
|
||||
* On save load the page again with an id and show all fields.
|
||||
* NOTE: Or: Load the full page and popup name dialog modal. On success set the newly aquired ID, on
|
||||
* Cancel or failure give appropriate message and show ... something else :-P
|
||||
*/
|
||||
$('#contacts_newcontact').click(function(){
|
||||
Contacts.UI.Card.editNew();
|
||||
});
|
||||
|
@ -1175,9 +1155,6 @@ $(document).ready(function(){
|
|||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete currently selected contact TODO: and clear page
|
||||
*/
|
||||
$('#contacts_deletecard').live('click',function(){
|
||||
Contacts.UI.Card.delete();
|
||||
});
|
||||
|
|
|
@ -124,12 +124,14 @@ Contacts={
|
|||
url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php');
|
||||
}
|
||||
$.post(url, { id: bookid, name: displayname, active: active, description: description },
|
||||
function(data){
|
||||
if(data.status == 'success'){
|
||||
function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$(button).closest('tr').prev().html(data.page).show().next().remove();
|
||||
Contacts.UI.Contacts.update();
|
||||
} else {
|
||||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
|
||||
}
|
||||
});
|
||||
Contacts.UI.Contacts.update();
|
||||
},
|
||||
cancel:function(button, bookid){
|
||||
$(button).closest('tr').prev().show().next().remove();
|
||||
|
|
|
@ -5,18 +5,40 @@
|
|||
*/
|
||||
(function ($) {
|
||||
var inviewObjects = {}, viewportSize, viewportOffset,
|
||||
d = document, w = window, documentElement = d.documentElement, expando = $.expando;
|
||||
d = document, w = window, documentElement = d.documentElement, expando = $.expando, isFiring = false, $elements = {};
|
||||
|
||||
$.event.special.inview = {
|
||||
add: function(data) {
|
||||
inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) };
|
||||
var inviewObject = { data: data, $element: $(this) }
|
||||
inviewObjects[data.guid + "-" + this[expando]] = inviewObject;
|
||||
var selector = inviewObject.data.selector,
|
||||
$element = inviewObject.$element;
|
||||
var hash = parseInt(getHash( data.guid + this[expando]));
|
||||
$elements[hash] = selector ? $element.find(selector) : $element;
|
||||
},
|
||||
|
||||
remove: function(data) {
|
||||
try { delete inviewObjects[data.guid + "-" + this[expando]]; } catch(e) {}
|
||||
try {
|
||||
var hash = parseInt(getHash(data.guid + this[expando]));
|
||||
delete($elements[hash]);
|
||||
} catch (e){}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function getHash(str){
|
||||
str = str+'';
|
||||
var hash = 0;
|
||||
if (str.length == 0) return hash;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
char = str.charCodeAt(i);
|
||||
hash = ((hash<<5)-hash)+char;
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
function getViewportSize() {
|
||||
var mode, domObject, size = { height: w.innerHeight, width: w.innerWidth };
|
||||
|
||||
|
@ -46,22 +68,15 @@
|
|||
}
|
||||
|
||||
function checkInView() {
|
||||
var $elements = $(), elementsLength, i = 0;
|
||||
|
||||
$.each(inviewObjects, function(i, inviewObject) {
|
||||
var selector = inviewObject.data.selector,
|
||||
$element = inviewObject.$element;
|
||||
$elements = $elements.add(selector ? $element.find(selector) : $element);
|
||||
});
|
||||
|
||||
elementsLength = $elements.length;
|
||||
if (elementsLength) {
|
||||
if (isFiring){
|
||||
return;
|
||||
}
|
||||
isFiring = true;
|
||||
viewportSize = viewportSize || getViewportSize();
|
||||
viewportOffset = viewportOffset || getViewportOffset();
|
||||
|
||||
for (; i<elementsLength; i++) {
|
||||
// Ignore elements that are not in the DOM tree
|
||||
if (!$.contains(documentElement, $elements[i])) {
|
||||
|
||||
for (var i in $elements) {
|
||||
if (isNaN(parseInt(i))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -72,13 +87,14 @@
|
|||
visiblePartX,
|
||||
visiblePartY,
|
||||
visiblePartsMerged;
|
||||
|
||||
|
||||
// Don't ask me why because I haven't figured out yet:
|
||||
// viewportOffset and viewportSize are sometimes suddenly null in Firefox 5.
|
||||
// Even though it sounds weird:
|
||||
// It seems that the execution of this function is interferred by the onresize/onscroll event
|
||||
// where viewportOffset and viewportSize are unset
|
||||
if (!viewportOffset || !viewportSize) {
|
||||
isFiring = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -100,7 +116,7 @@
|
|||
$element.data('inview', false).trigger('inview', [false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
isFiring = false;
|
||||
}
|
||||
|
||||
$(w).bind("scroll resize", function() {
|
||||
|
|
|
@ -53,7 +53,7 @@ class OC_Contacts_App {
|
|||
OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR);
|
||||
}
|
||||
else {
|
||||
OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.$OC_User::getUser(), OC_Log::ERROR);
|
||||
OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OC_Log::ERROR);
|
||||
}
|
||||
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved?
|
||||
exit();
|
||||
|
|
|
@ -18,7 +18,7 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{
|
|||
$vcards = OC_Contacts_VCard::all($addressbook['id']);
|
||||
foreach($vcards as $vcard){
|
||||
if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){
|
||||
$link = OC_Helper::linkTo('apps/contacts', 'index.php?id='.urlencode($vcard['id']));
|
||||
$link = OC_Helper::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']);
|
||||
$results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,118 @@ class OC_Contacts_VCard{
|
|||
return $result->fetchRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Format property TYPE parameters for upgrading from v. 2.1
|
||||
* @param $property Reference to a Sabre_VObject_Property.
|
||||
* In version 2.1 e.g. a phone can be formatted like: TEL;HOME;CELL:123456789
|
||||
* This has to be changed to either TEL;TYPE=HOME,CELL:123456789 or TEL;TYPE=HOME;TYPE=CELL:123456789 - both are valid.
|
||||
*/
|
||||
public static function formatPropertyTypes(&$property) {
|
||||
foreach($property->parameters as $key=>&$parameter){
|
||||
$types = OC_Contacts_App::getTypesOfProperty($property->name);
|
||||
if(is_array($types) && in_array(strtoupper($parameter->name), array_keys($types)) || strtoupper($parameter->name) == 'PREF') {
|
||||
$property->parameters[] = new Sabre_VObject_Parameter('TYPE', $parameter->name);
|
||||
}
|
||||
unset($property->parameters[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode properties for upgrading from v. 2.1
|
||||
* @param $property Reference to a Sabre_VObject_Property.
|
||||
* The only encoding allowed in version 3.0 is 'b' for binary. All encoded strings
|
||||
* must therefor be decoded and the parameters removed.
|
||||
*/
|
||||
public static function decodeProperty(&$property) {
|
||||
// Check out for encoded string and decode them :-[
|
||||
foreach($property->parameters as $key=>&$parameter){
|
||||
if(strtoupper($parameter->name) == 'ENCODING') {
|
||||
if(strtoupper($parameter->value) == 'QUOTED-PRINTABLE') { // what kind of other encodings could be used?
|
||||
$property->value = quoted_printable_decode($property->value);
|
||||
unset($property->parameters[$key]);
|
||||
}
|
||||
} elseif(strtoupper($parameter->name) == 'CHARSET') {
|
||||
unset($property->parameters[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tries to update imported VCards to adhere to rfc2426 (VERSION: 3.0)
|
||||
* @param vcard An OC_VObject of type VCARD (passed by reference).
|
||||
*/
|
||||
protected static function updateValuesFromAdd(&$vcard) { // any suggestions for a better method name? ;-)
|
||||
$stringprops = array('N', 'FN', 'ORG', 'NICK', 'ADR', 'NOTE');
|
||||
$typeprops = array('ADR', 'TEL', 'EMAIL');
|
||||
$upgrade = false;
|
||||
$fn = $n = $uid = $email = null;
|
||||
$version = $vcard->getAsString('VERSION');
|
||||
// Add version if needed
|
||||
if($version && $version < '3.0') {
|
||||
$upgrade = true;
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OC_Log::DEBUG);
|
||||
}
|
||||
foreach($vcard->children as &$property){
|
||||
// Decode string properties and remove obsolete properties.
|
||||
if($upgrade && in_array($property->name, $stringprops)) {
|
||||
self::decodeProperty($property);
|
||||
}
|
||||
// Fix format of type parameters.
|
||||
if($upgrade && in_array($property->name, $typeprops)) {
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. before: '.$property->serialize(),OC_Log::DEBUG);
|
||||
self::formatPropertyTypes($property);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. after: '.$property->serialize(),OC_Log::DEBUG);
|
||||
}
|
||||
if($property->name == 'FN'){
|
||||
$fn = $property->value;
|
||||
}
|
||||
if($property->name == 'N'){
|
||||
$n = $property->value;
|
||||
}
|
||||
if($property->name == 'UID'){
|
||||
$uid = $property->value;
|
||||
}
|
||||
if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN.
|
||||
$email = $property->value;
|
||||
}
|
||||
}
|
||||
// Check for missing 'N', 'FN' and 'UID' properties
|
||||
if(!$fn) {
|
||||
if($n && $n != ';;;;'){
|
||||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
|
||||
} elseif($email) {
|
||||
$fn = $email;
|
||||
} else {
|
||||
$fn = 'Unknown Name';
|
||||
}
|
||||
$vcard->setString('FN', $fn);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG);
|
||||
}
|
||||
if(!$n || $n = ';;;;'){ // Fix missing 'N' field. Ugly hack ahead ;-)
|
||||
$slice = array_reverse(array_slice(explode(' ', $fn), 0, 2)); // Take 2 first name parts of 'FN' and reverse.
|
||||
if(count($slice) < 2) { // If not enought, add one more...
|
||||
$slice[] = "";
|
||||
}
|
||||
$n = implode(';', $slice).';;;';
|
||||
$vcard->setString('N', $n);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
||||
}
|
||||
if(!$uid) {
|
||||
$vcard->setUID();
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'UID\' field: '.$uid,OC_Log::DEBUG);
|
||||
}
|
||||
$vcard->setString('VERSION','3.0');
|
||||
// Add product ID is missing.
|
||||
$prodid = trim($vcard->getAsString('PRODID'));
|
||||
if(!$prodid) {
|
||||
$appinfo = OC_App::getAppInfo('contacts');
|
||||
$prodid = '-//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN';
|
||||
$vcard->setString('PRODID', $prodid);
|
||||
}
|
||||
$now = new DateTime;
|
||||
$vcard->setString('REV', $now->format(DateTime::W3C));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a card
|
||||
* @param integer $id Addressbook id
|
||||
|
@ -114,58 +226,17 @@ class OC_Contacts_VCard{
|
|||
|
||||
$card = OC_VObject::parse($data);
|
||||
if(!is_null($card)){
|
||||
$fn = $card->getAsString('FN');
|
||||
if(!$fn){ // Fix missing 'FN' field.
|
||||
$n = $card->getAsString('N');
|
||||
if(!is_null($n)){
|
||||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
|
||||
$card->setString('FN', $fn);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG);
|
||||
} else {
|
||||
$fn = 'Unknown Name';
|
||||
}
|
||||
}
|
||||
$n = $card->getAsString('N');
|
||||
if(!$n){ // Fix missing 'N' field.
|
||||
$n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;';
|
||||
$card->setString('N', $n);
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
||||
}
|
||||
$uid = $card->getAsString('UID');
|
||||
if(!$uid){
|
||||
$card->setUID();
|
||||
$uid = $card->getAsString('UID');
|
||||
};
|
||||
$uri = $uid.'.vcf';
|
||||
|
||||
// Add product ID.
|
||||
$prodid = trim($card->getAsString('PRODID'));
|
||||
if(!$prodid) {
|
||||
$appinfo = OC_App::getAppInfo('contacts');
|
||||
$prodid = '//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN';
|
||||
$card->setString('PRODID', $prodid);
|
||||
}
|
||||
// VCARD must have a version
|
||||
$version = $card->getAsString('VERSION');
|
||||
// Add version if needed
|
||||
if(!$version){
|
||||
$card->add(new Sabre_VObject_Property('VERSION','3.0'));
|
||||
//$data = $card->serialize();
|
||||
}/* else {
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Version already set as: '.$version,OC_Log::DEBUG);
|
||||
}*/
|
||||
$now = new DateTime;
|
||||
$card->setString('REV', $now->format(DateTime::W3C));
|
||||
self::updateValuesFromAdd($card);
|
||||
$data = $card->serialize();
|
||||
}
|
||||
else{
|
||||
// that's hard. Creating a UID and not saving it
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Error parsing VCard: '.$data,OC_Log::ERROR);
|
||||
return null; // Ditch cards that can't be parsed by Sabre.
|
||||
//$uid = self::createUID();
|
||||
//$uri = $uid.'.vcf';
|
||||
};
|
||||
|
||||
$fn = $card->getAsString('FN');
|
||||
$uid = $card->getAsString('UID');
|
||||
$uri = $uid.'.vcf';
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
||||
$newid = OC_DB::insertid('*PREFIX*contacts_cards');
|
||||
|
@ -183,54 +254,23 @@ class OC_Contacts_VCard{
|
|||
* @return insertid
|
||||
*/
|
||||
public static function addFromDAVData($id,$uri,$data){
|
||||
$fn = $n = $uid = null;
|
||||
$email = null;
|
||||
$card = OC_VObject::parse($data);
|
||||
if(!is_null($card)){
|
||||
foreach($card->children as $property){
|
||||
if($property->name == 'FN'){
|
||||
$fn = $property->value;
|
||||
}
|
||||
if($property->name == 'N'){
|
||||
$n = $property->value;
|
||||
}
|
||||
if($property->name == 'UID'){
|
||||
$uid = $property->value;
|
||||
}
|
||||
if($property->name == 'EMAIL' && is_null($email)){
|
||||
$email = $property->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$fn) {
|
||||
if($n){
|
||||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
|
||||
} elseif($email) {
|
||||
$fn = $email;
|
||||
} else {
|
||||
$fn = 'Unknown Name';
|
||||
}
|
||||
$card->addProperty('FN', $fn);
|
||||
self::updateValuesFromAdd($card);
|
||||
$data = $card->serialize();
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$n,OC_Log::DEBUG);
|
||||
}
|
||||
if(!$n){ // Fix missing 'N' field.
|
||||
$n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;';
|
||||
$card->setString('N', $n);
|
||||
$data = $card->serialize();
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG);
|
||||
}
|
||||
if(!$uid) {
|
||||
$card->setUID();
|
||||
$data = $card->serialize();
|
||||
}
|
||||
} else {
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::addFromDAVData. Error parsing VCard: '.$data, OC_Log::ERROR);
|
||||
return null; // Ditch cards that can't be parsed by Sabre.
|
||||
};
|
||||
$fn = $card->getAsString('FN');
|
||||
|
||||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
|
||||
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
|
||||
$newid = OC_DB::insertid('*PREFIX*contacts_cards');
|
||||
|
||||
OC_Contacts_Addressbook::touch($id);
|
||||
|
||||
return OC_DB::insertid('*PREFIX*contacts_cards');
|
||||
return $newid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -329,6 +369,7 @@ class OC_Contacts_VCard{
|
|||
// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
|
||||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
|
||||
$stmt->execute(array($aid,$uri));
|
||||
OC_Contacts_Addressbook::touch($aid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -380,10 +421,14 @@ class OC_Contacts_VCard{
|
|||
'checksum' => md5($property->serialize()));
|
||||
foreach($property->parameters as $parameter){
|
||||
// Faulty entries by kaddressbook
|
||||
// Actually TYPE=PREF is correct according to RFC 2426
|
||||
// but this way is more handy in the UI. Tanghus.
|
||||
if($parameter->name == 'TYPE' && $parameter->value == 'PREF'){
|
||||
$parameter->name = 'PREF';
|
||||
$parameter->value = '1';
|
||||
}
|
||||
// NOTE: Apparently Sabre_VObject_Reader can't always deal with value list parameters
|
||||
// like TYPE=HOME,CELL,VOICE. Tanghus.
|
||||
if ($property->name == 'TEL' && $parameter->name == 'TYPE'){
|
||||
if (isset($temp['parameters'][$parameter->name])){
|
||||
$temp['parameters'][$parameter->name][] = $parameter->value;
|
||||
|
|
|
@ -13,10 +13,19 @@ require_once('../../lib/base.php');
|
|||
OC_Util::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('contacts');
|
||||
|
||||
function getStandardImage(){
|
||||
OC_Response::setExpiresHeader('P10D');
|
||||
OC_Response::enableCaching();
|
||||
OC_Response::redirect(OC_Helper::imagePath('contacts', 'person_large.png'));
|
||||
}
|
||||
|
||||
$id = $_GET['id'];
|
||||
|
||||
$contact = OC_Contacts_App::getContactVCard($id);
|
||||
$image = new OC_Image();
|
||||
if(!$image) {
|
||||
getStandardImage();
|
||||
}
|
||||
// invalid vcard
|
||||
if( is_null($contact)) {
|
||||
OC_Log::write('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
|
||||
|
@ -45,7 +54,8 @@ if( is_null($contact)) {
|
|||
}
|
||||
if (!$image->valid()) {
|
||||
// Not found :-(
|
||||
$image->loadFromFile('img/person_large.png');
|
||||
getStandardImage();
|
||||
//$image->loadFromFile('img/person_large.png');
|
||||
}
|
||||
header('Content-Type: '.$image->mimeType());
|
||||
$image->show();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type='text/javascript'>
|
||||
var totalurl = '<?php echo OC_Helper::linkTo('contacts', 'carddav.php', null, true); ?>/addressbooks';
|
||||
var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
|
||||
</script>
|
||||
<div id="controls">
|
||||
<form>
|
||||
|
|
|
@ -70,14 +70,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
<?php
|
||||
if(0) { /*foreach($card['EMAIL'] as $email) {*/
|
||||
?>
|
||||
<li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $email['checksum'] ?>" data-element="EMAIL">
|
||||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($email['parameters']['PREF'])?'checked="checked"':''); ?> />
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="<?php echo $email['value'] ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
<?php } ?>
|
||||
</ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
|
||||
</div> <!-- email addresses-->
|
||||
|
||||
|
@ -93,17 +85,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<?php echo html_select_options($_['phone_types'], array()) ?>
|
||||
</select>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
<?php
|
||||
if(0) { /*foreach($card['TEL'] as $phone) {*/
|
||||
?>
|
||||
<li class="propertycontainer" style="white-space: nowrap;" data-checksum="<?php echo $phone['checksum'] ?>" data-element="TEL">
|
||||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" <?php echo (isset($phone['parameters']['PREF'])?'checked="checked"':''); ?> />
|
||||
<input type="text" required="required" class="nonempty contacts_property" style="width:8em; border: 0px;" name="value" value="<?php echo $phone['value'] ?>" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
|
||||
<select class="contacts_property" multiple="multiple" name="parameters[TYPE][]">
|
||||
<?php echo html_select_options($_['phone_types'], isset($phone['parameters']['TYPE'])?$phone['parameters']['TYPE']:array()) ?>
|
||||
</select>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
<?php } ?>
|
||||
</ul><!-- a id="add_phone" class="add" title="<?php echo $l->t('Add phone number'); ?>"></a -->
|
||||
</div> <!-- Phone numbers -->
|
||||
|
||||
|
@ -118,40 +99,6 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<span class="adr_type_label"></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
</dt><dd><ul class="addresslist"></ul></dd></dl>
|
||||
|
||||
<?php if(0) { /*foreach($card['ADR'] as $address) {*/ ?>
|
||||
<dl class="addresscard propertycontainer" data-checksum="<?php echo $address['checksum']; ?>" data-element="ADR">
|
||||
<dt>
|
||||
<input class="adr contacts_property" name="value" type="hidden" value="<?php echo implode(';',$address['value']); ?>" />
|
||||
<input type="hidden" class="adr_type contacts_property" name="parameters[TYPE][]" value="<?php echo strtoupper(implode(',',$address['parameters'])); ?>" />
|
||||
<span class="adr_type_label">
|
||||
<?php
|
||||
if(count($address['parameters']) > 0) {
|
||||
//array_walk($address['parameters'], ) Nah, this wont work...
|
||||
$translated = array();
|
||||
foreach($address['parameters'] as $type) {
|
||||
$translated[] = $l->t(ucwords(strtolower($type)));
|
||||
}
|
||||
echo implode('/', $translated);
|
||||
}
|
||||
?></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
</dt>
|
||||
<dd>
|
||||
<ul class="addresslist">
|
||||
<?php
|
||||
$adr = $address['value'];
|
||||
$tmp = ($adr[0]?'<li>'.$adr[0].'</li>':'');
|
||||
$tmp .= ($adr[1]?'<li>'.$adr[1].'</li>':'');
|
||||
$tmp .= ($adr[2]?'<li>'.$adr[2].'</li>':'');
|
||||
$tmp .= ($adr[3]||$adr[5]?'<li>'.$adr[5].' '.$adr[3].'</li>':'');
|
||||
$tmp .= ($adr[4]?'<li>'.$adr[4].'</li>':'');
|
||||
$tmp .= ($adr[6]?'<li>'.$adr[6].'</li>':'');
|
||||
echo $tmp;
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div> <!-- Addresses -->
|
||||
|
|
|
@ -3,7 +3,7 @@ $id = $_['id'];
|
|||
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
|
||||
$hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
|
||||
?>
|
||||
<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkTo('contacts', 'photo.php', null, true); ?>?id=<?php echo $id; ?>&refresh=<?php echo rand(); ?>" />
|
||||
<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>&refresh=<?php echo rand(); ?>" />
|
||||
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
|
||||
|
||||
|
||||
|
|
|
@ -38,13 +38,13 @@ OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.',
|
|||
return true;
|
||||
});*/
|
||||
</script>
|
||||
<img id="cropbox" src="<?php echo OC_Helper::linkTo('contacts', 'dynphoto.php', null, true); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
|
||||
<img id="cropbox" src="<?php echo OC_Helper::linkToAbsolute('contacts', 'dynphoto.php'); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
|
||||
<form id="cropform"
|
||||
class="coords"
|
||||
method="post"
|
||||
enctype="multipart/form-data"
|
||||
target="crop_target"
|
||||
action="<?php echo OC_Helper::linkTo('contacts', 'ajax/savecrop.php', null, true); ?>">
|
||||
action="<?php echo OC_Helper::linkToAbsolute('contacts', 'ajax/savecrop.php'); ?>">
|
||||
|
||||
<input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
|
||||
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<fieldset class="personalblock">
|
||||
<strong><?php echo $l->t('Contacts'); ?></strong><br />
|
||||
<?php echo $l->t('CardDAV syncing address:'); ?>
|
||||
<?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
|
||||
<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?><br />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>files_pdfviewer</id>
|
||||
<name>PDF viewer (pdfjs-based)</name>
|
||||
<name>PDF Viewer</name>
|
||||
<description>Inline PDF viewer (pdfjs-based)</description>
|
||||
<version>0.1</version>
|
||||
<licence>GPL</licence>
|
||||
<author>Joan Creus</author>
|
||||
|
|
|
@ -8,6 +8,7 @@ require_once('../lib_share.php');
|
|||
$userDirectory = "/".OC_User::getUser()."/files";
|
||||
$source = $userDirectory.$_GET['source'];
|
||||
$path = $source;
|
||||
$users = array();
|
||||
if ($users = OC_Share::getMySharedItem($source)) {
|
||||
for ($i = 0; $i < count($users); $i++) {
|
||||
if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
||||
|
@ -19,7 +20,6 @@ $source = dirname($source);
|
|||
while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
|
||||
if ($values = OC_Share::getMySharedItem($source)) {
|
||||
$values = array_values($values);
|
||||
$users = array();
|
||||
$parentUsers = array();
|
||||
for ($i = 0; $i < count($values); $i++) {
|
||||
if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
#shared_list { padding:0.5em; list-style-type: none; }
|
||||
#public { border-top:1px solid #ddd; padding-top:0.5em; }
|
||||
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
|
||||
a.unshare:hover { opacity:1; }
|
||||
a.unshare:hover { opacity:1; }
|
||||
#share_with { width: 16em; }
|
|
@ -174,7 +174,7 @@ $(document).ready(function() {
|
|||
function createDropdown(filename, files) {
|
||||
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
|
||||
html += '<div id="private">';
|
||||
html += '<select data-placeholder="User or Group" style="width:220px;" id="share_with" class="chzen-select">';
|
||||
html += '<select data-placeholder="User or Group" id="share_with" class="chzen-select">';
|
||||
html += '<option value=""></option>';
|
||||
html += '</select>';
|
||||
html += '<ul id="shared_list"></ul>';
|
||||
|
|
|
@ -88,12 +88,15 @@ class OC_Share {
|
|||
$uid = $uid."@".$gid;
|
||||
}
|
||||
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
|
||||
// Clear the folder size cache for the 'Shared' folder
|
||||
// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?");
|
||||
// $clearFolderSize->execute(array($sharedFolder));
|
||||
// Emit post_create and post_write hooks to notify of a new file in the user's filesystem
|
||||
OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target));
|
||||
OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
|
||||
// Add file to filesystem cache
|
||||
$userDirectory = "/".OC_User::getUser()."/files";
|
||||
$data = OC_Filecache::get(substr($source, strlen($userDirectory)));
|
||||
$parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
|
||||
$parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
|
||||
$parent = $parentResult['id'];
|
||||
$is_writeable = $permissions & OC_Share::WRITE;
|
||||
$cacheQuery = OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
|
||||
$cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#editor{
|
||||
position: absoloute;
|
||||
position: fixed;
|
||||
display: block;
|
||||
top: 80px;
|
||||
left: 160px;
|
||||
top: 6.5em;
|
||||
left: 12.5em;
|
||||
}
|
||||
#editorwrapper{
|
||||
position: absoloute;
|
||||
|
|
|
@ -172,6 +172,7 @@ function giveEditorFocus(){
|
|||
function showFileEditor(dir,filename){
|
||||
if(!editorIsShown()){
|
||||
// Loads the file editor and display it.
|
||||
$('#content').append('<div id="editor"></div>');
|
||||
var data = $.getJSON(
|
||||
OC.filePath('files_texteditor','ajax','loadfile.php'),
|
||||
{file:filename,dir:dir},
|
||||
|
@ -273,10 +274,10 @@ $(document).ready(function(){
|
|||
var dir=text.substr(0,text.length-file.length-1);
|
||||
showFileEditor(dir,file);
|
||||
});
|
||||
}
|
||||
};
|
||||
// Binds the file save and close editor events, and gotoline button
|
||||
bindControlEvents();
|
||||
|
||||
$('#editor').remove();
|
||||
// Binds the save keyboard shortcut events
|
||||
//$(document).unbind('keydown').bind('keydown',checkForSaveKeyPress);
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ OC_App::addNavigationEntry( array(
|
|||
$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
|
||||
$results=array();
|
||||
while($row=$result->fetchRow()){
|
||||
$results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('apps/gallery', 'index.php?view='.$row['album_name']),'Galleries');
|
||||
$results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries');
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
div#gallery_list { margin: 70pt 20pt 0 20pt; }
|
||||
div#gallery_list { margin: 4.5em 2em 0 2em; }
|
||||
div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; }
|
||||
div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 20px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;}
|
||||
div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 5px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;}
|
||||
div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; }
|
||||
div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 20px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;}
|
||||
div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 5px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;}
|
||||
div.gallery_album_box:hover { color: black; }
|
||||
div.gallery_album_box:hover div.gallery_album_decoration { opacity: 0.7;}
|
||||
div.gallery_album_decoration a {padding: 0 4pt; cursor: pointer;}
|
||||
|
|
|
@ -69,7 +69,6 @@ class OC_Gallery_Photo {
|
|||
public static function getThumbnail($image_name) {
|
||||
$save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/';
|
||||
$save_dir .= dirname($image_name). '/';
|
||||
$image_name = basename($image_name);
|
||||
$thumb_file = $save_dir . $image_name;
|
||||
if (file_exists($thumb_file)) {
|
||||
$image = new OC_Image($thumb_file);
|
||||
|
|
|
@ -17,7 +17,7 @@ a.jp-mute,a.jp-unmute { left:24em; }
|
|||
div.jp-volume-bar { position:absolute; overflow:hidden; background:#eee; width:4em; height:0.4em; cursor:pointer; top:1.3em; left:27em; }
|
||||
div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
|
||||
|
||||
#collection { padding-top:1em; position:relative; width:100%; float:left; table-layout:fixed; }
|
||||
#collection { position:relative; width:100%; float:left; table-layout:fixed; }
|
||||
#collection td { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||
#leftcontent img.remove { display:none; float:right; cursor:pointer; opacity: 0; }
|
||||
#leftcontent li:hover img.remove { display:inline; opacity: .3; }
|
||||
|
@ -31,7 +31,7 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
|
|||
#collection td.artist-expander, #collection td.album-expander { width:2em; text-align:center; }
|
||||
td.artist a.expander, td.album a.expander { float:right; padding:0 1em; }
|
||||
tr.active td { background-color:#eee; font-weight:bold; }
|
||||
tr td { border-top:1px solid #eee; height:2.2em; }
|
||||
tr td { border-bottom:1px solid #eee; height:2.2em; }
|
||||
tr .artist img { vertical-align:middle; }
|
||||
tr.album td.artist { padding-left:1em; }
|
||||
tr.song td.artist { padding-left:2em; }
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
var initScanned = false;
|
||||
|
||||
Collection={
|
||||
artists:[],
|
||||
albums:[],
|
||||
|
@ -68,10 +70,10 @@ Collection={
|
|||
for(var i=0;i<Collection.loadedListeners.length;i++){
|
||||
Collection.loadedListeners[i]();
|
||||
}
|
||||
if(data.songs.length==0){
|
||||
if(data.songs.length==0 && initScanned == false){
|
||||
$('#scan input.start').click();
|
||||
initScanned = true;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -81,13 +83,11 @@ Collection={
|
|||
Collection.parent.show();
|
||||
}
|
||||
if(!Collection.loaded){
|
||||
Collection.load(Collection.display)
|
||||
Collection.load(Collection.display);
|
||||
}else{
|
||||
if(Collection.parent){
|
||||
Collection.parent.find('tr:not(.template)').remove();
|
||||
var template=Collection.parent.find('tr.template');
|
||||
var lastArtist='';
|
||||
var lastAlbum='';
|
||||
$.each(Collection.artists,function(i,artist){
|
||||
if(artist.name && artist.songs.length>0){
|
||||
var tr=template.clone().removeClass('template');
|
||||
|
@ -108,7 +108,7 @@ Collection={
|
|||
$('tr[data-artist="'+artist.name+'"]').addClass('active');
|
||||
});
|
||||
if(artist.songs.length>1){
|
||||
var expander=$('<a class="expander">></a>');
|
||||
expander=$('<a class="expander">></a>');
|
||||
expander.data('expanded',false);
|
||||
expander.click(function(event){
|
||||
var tr=$(this).parent().parent();
|
||||
|
@ -136,10 +136,11 @@ Collection={
|
|||
var first=true;
|
||||
$.each(artist.albums,function(j,album){
|
||||
$.each(album.songs,function(i,song){
|
||||
var newRow;
|
||||
if(first){
|
||||
newRow=tr;
|
||||
}else{
|
||||
var newRow=tr.clone();
|
||||
newRow=tr.clone();
|
||||
newRow.find('td.artist').text('');
|
||||
newRow.find('.expander').remove();
|
||||
}
|
||||
|
@ -221,13 +222,14 @@ Collection={
|
|||
tr.find('td.album-expander a.expander').addClass('expanded');
|
||||
tr.find('td.album-expander a.expander').text('v');
|
||||
$.each(albumData.songs,function(i,song){
|
||||
var newRow;
|
||||
if(i>0){
|
||||
var newRow=tr.clone();
|
||||
newRow=tr.clone();
|
||||
newRow.find('a.expander').remove();
|
||||
newRow.find('td.album a').text('');
|
||||
newRow.find('td.artist a').text('');
|
||||
}else{
|
||||
var newRow=tr;
|
||||
newRow=tr;
|
||||
}
|
||||
newRow.find('td.title a').text(song.name);
|
||||
newRow.find('td.title a').click(function(event){
|
||||
|
@ -339,11 +341,11 @@ Collection={
|
|||
path:song.song_path,
|
||||
playCount:song.song_playcount,
|
||||
};
|
||||
album.songs.push(songData)
|
||||
album.songs.push(songData);
|
||||
artist.songs.push(songData);
|
||||
Collection.songs.push(songData);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
Collection.parent=$('#collection');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function musicTypeFromFile(file){
|
||||
var extention=file.substr(file.indexOf('.')+1);
|
||||
if(extention=='ogg'){
|
||||
return 'oga'
|
||||
return 'oga';
|
||||
}
|
||||
//TODO check for more specific cases
|
||||
return extention;
|
||||
|
@ -39,7 +39,7 @@ function loadPlayer(type,ready){
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
loadPlayer.done=false
|
||||
loadPlayer.done=false;
|
||||
|
||||
// FileActions.register('audio','Add to playlist','',addAudio);
|
||||
// FileActions.register('application/ogg','Add to playlist','',addAudio);
|
||||
|
|
|
@ -16,7 +16,7 @@ $(document).ready(function(){
|
|||
PlayList.render();
|
||||
});
|
||||
var button=$('<input type="button" title="'+t('media','Add album to playlist')+'" class="add"></input>');
|
||||
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')')
|
||||
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')');
|
||||
button.click(function(event){
|
||||
event.stopPropagation();
|
||||
PlayList.add(media);
|
||||
|
@ -24,7 +24,7 @@ $(document).ready(function(){
|
|||
});
|
||||
row.find('div.name').append(button);
|
||||
button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true});
|
||||
}
|
||||
};
|
||||
Collection.display();
|
||||
|
||||
Collection.load(function(){
|
||||
|
@ -34,11 +34,9 @@ $(document).ready(function(){
|
|||
PlayList.add(song);
|
||||
PlayList.play(0);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function getUrlVars(){
|
||||
var vars = {}, hash;
|
||||
var hashes = window.location.hash.substr(1).split('&');
|
||||
|
@ -52,8 +50,8 @@ function getUrlVars(){
|
|||
function musicTypeFromFile(file){
|
||||
var extention=file.split('.').pop();
|
||||
if(extention=='ogg'){
|
||||
return 'oga'
|
||||
return 'oga';
|
||||
}
|
||||
//TODO check for more specific cases
|
||||
return extention;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,19 +26,19 @@ PlayList.render=function(){
|
|||
li.click(function(event){
|
||||
PlayList.play($(this).data('index'));
|
||||
});
|
||||
li.append(img)
|
||||
li.append(img);
|
||||
li.data('index',i);
|
||||
li.addClass('song');
|
||||
PlayList.parent.append(li);
|
||||
}
|
||||
$(".jp-playlist-" + PlayList.current).addClass("collection_playing");
|
||||
}
|
||||
};
|
||||
PlayList.getSelected=function(){
|
||||
return $('tbody td.name input:checkbox:checked').parent().parent();
|
||||
}
|
||||
};
|
||||
PlayList.hide=function(){
|
||||
$('#playlist').hide();
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
PlayList.parent=$('#leftcontent');
|
||||
|
|
|
@ -6,7 +6,7 @@ Scanner={
|
|||
$.getJSON(OC.linkTo('media','ajax/api.php')+'?action=find_music',function(songs){
|
||||
Scanner.songsFound=songs.length;
|
||||
if(ready){
|
||||
ready(songs)
|
||||
ready(songs);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -24,13 +24,13 @@ Scanner={
|
|||
Scanner.songsScanned=data.count;
|
||||
$('#scan span.songCount').text(Scanner.songsScanned);
|
||||
var progress=(Scanner.songsScanned/Scanner.songsFound)*100;
|
||||
$('#scanprogressbar').progressbar('value',progress)
|
||||
$('#scanprogressbar').progressbar('value',progress);
|
||||
});
|
||||
Scanner.eventSource.listen('done',function(count){
|
||||
$('#scan input.start').show();
|
||||
$('#scan input.stop').hide();
|
||||
$('#scanprogressbar').hide();
|
||||
Collection.load(Collection.display)
|
||||
Collection.load(Collection.display);
|
||||
if(ready){
|
||||
ready();
|
||||
}
|
||||
|
@ -41,4 +41,4 @@ Scanner={
|
|||
Scanner.close();
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -207,7 +207,7 @@ class OC_MEDIA_AMPACHE{
|
|||
echo("\t\t<title>$name</title>\n");
|
||||
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
|
||||
echo("\t\t<album id='$album'>$albumName</album>\n");
|
||||
$url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
|
||||
$url=OC_Helper::linkToAbsolute('media', 'server/xml.server.php')."?action=play&song=$id&auth={$_GET['auth']}";
|
||||
$url=self::fixXmlString($url);
|
||||
echo("\t\t<url>$url</url>\n");
|
||||
echo("\t\t<time>{$song['song_length']}</time>\n");
|
||||
|
|
|
@ -89,18 +89,18 @@ class OC_MediaSearchProvider extends OC_Search_Provider{
|
|||
$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query);
|
||||
$results=array();
|
||||
foreach($artists as $artist){
|
||||
$results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist['artist_name']) ),'Music');
|
||||
$results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist['artist_name']),'Music');
|
||||
}
|
||||
foreach($albums as $album){
|
||||
$artist=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
|
||||
$results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album['album_name']) ),'Music');
|
||||
$results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album['album_name']),'Music');
|
||||
}
|
||||
foreach($songs as $song){
|
||||
$minutes=floor($song['song_length']/60);
|
||||
$secconds=$song['song_length']%60;
|
||||
$artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
|
||||
$album=OC_MEDIA_COLLECTION::getalbumName($song['song_album']);
|
||||
$results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']) ),'Music');
|
||||
$results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']),'Music');
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<fieldset class="personalblock">
|
||||
<strong>Media</strong><br />
|
||||
Ampache address:
|
||||
<?php echo OC_Helper::linkTo('apps/media', '', null, true); ?><br />
|
||||
<?php echo OC_Helper::linkToAbsolute('media', ''); ?><br />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -32,13 +32,13 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389);
|
|||
define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
|
||||
|
||||
// register user backend
|
||||
OC_User::useBackend( "LDAP" );
|
||||
OC_User::useBackend( 'LDAP' );
|
||||
|
||||
// add settings page to navigation
|
||||
$entry = array(
|
||||
'id' => "user_ldap_settings",
|
||||
'id' => 'user_ldap_settings',
|
||||
'order'=>1,
|
||||
'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
|
||||
'href' => OC_Helper::linkTo( 'user_ldap', 'settings.php' ),
|
||||
'name' => 'LDAP'
|
||||
);
|
||||
// OC_App::addNavigationSubEntry( "core_users", $entry);
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
|
||||
<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
|
||||
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p>
|
||||
<p><label for="ldap_quota">Quota Attribute</label><input type="text" id="ldap_quota" name="ldap_quota" value="<?php echo $_['ldap_quota']; ?>" />
|
||||
<label for="ldap_quota_def">Quota Default</label><input type="text" id="ldap_quota_def" name="ldap_quota_def" value="<?php echo $_['ldap_quota_def']; ?>" />bytes</p>
|
||||
<p><label for="ldap_email">Email Attribute</label><input type="text" id="ldap_email" name="ldap_email" value="<?php echo $_['ldap_email']; ?>" /></p>
|
||||
<input type="submit" value="Save" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -36,6 +36,12 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
protected $ldap_tls;
|
||||
protected $ldap_nocase;
|
||||
protected $ldap_display_name;
|
||||
protected $ldap_quota;
|
||||
protected $ldap_quota_def;
|
||||
protected $ldap_email;
|
||||
|
||||
// will be retrieved from LDAP server
|
||||
protected $ldap_dc = false;
|
||||
|
||||
function __construct() {
|
||||
$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
|
||||
|
@ -47,6 +53,9 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
|
||||
$this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
|
||||
$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
|
||||
$this->ldap_quota_attr = OC_Appconfig::getValue('user_ldap', 'ldap_quota_attr','');
|
||||
$this->ldap_quota_def = OC_Appconfig::getValue('user_ldap', 'ldap_quota_def','');
|
||||
$this->ldap_email_attr = OC_Appconfig::getValue('user_ldap', 'ldap_email_attr','');
|
||||
|
||||
if( !empty($this->ldap_host)
|
||||
&& !empty($this->ldap_port)
|
||||
|
@ -66,6 +75,28 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
ldap_unbind($this->ds);
|
||||
}
|
||||
|
||||
private function setQuota( $uid ) {
|
||||
if( !$this->ldap_dc )
|
||||
return false;
|
||||
|
||||
$quota = $this->ldap_dc[$this->ldap_quota_attr][0];
|
||||
$quota = $quota != -1 ? $quota : $this->ldap_quota_def;
|
||||
OC_Preferences::setValue($uid, 'files', 'quota', $quota);
|
||||
}
|
||||
|
||||
private function setEmail( $uid ) {
|
||||
if( !$this->ldap_dc )
|
||||
return false;
|
||||
|
||||
$email = OC_Preferences::getValue($uid, 'settings', 'email', '');
|
||||
if ( !empty( $email ) )
|
||||
return false;
|
||||
|
||||
$email = $this->ldap_dc[$this->ldap_email_attr][0];
|
||||
OC_Preferences::setValue($uid, 'settings', 'email', $email);
|
||||
}
|
||||
|
||||
//Connect to LDAP and store the resource
|
||||
private function getDs() {
|
||||
if(!$this->ds) {
|
||||
$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
|
||||
|
@ -74,18 +105,19 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
if($this->ldap_tls)
|
||||
ldap_start_tls($this->ds);
|
||||
}
|
||||
|
||||
//TODO: Not necessary to perform a bind each time, is it?
|
||||
// login
|
||||
if(!empty($this->ldap_dn)) {
|
||||
$ldap_login = @ldap_bind( $this->ds, $this->ldap_dn, $this->ldap_password );
|
||||
if(!$ldap_login)
|
||||
if(!$ldap_login) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->ds;
|
||||
}
|
||||
|
||||
private function getDn( $uid ) {
|
||||
private function getDc( $uid ) {
|
||||
if(!$this->configured)
|
||||
return false;
|
||||
|
||||
|
@ -99,31 +131,43 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
|
||||
if( $entries['count'] == 0 )
|
||||
if( $entries['count'] == 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $entries[0]['dn'];
|
||||
$this->ldap_dc = $entries[0];
|
||||
|
||||
return $this->ldap_dc;
|
||||
}
|
||||
|
||||
public function checkPassword( $uid, $password ) {
|
||||
if(!$this->configured){
|
||||
return false;
|
||||
}
|
||||
$dn = $this->getDn( $uid );
|
||||
if( !$dn )
|
||||
$dc = $this->getDc( $uid );
|
||||
if( !$dc )
|
||||
return false;
|
||||
|
||||
if (!@ldap_bind( $this->getDs(), $dn, $password ))
|
||||
if (!@ldap_bind( $this->getDs(), $dc['dn'], $password )) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if(!empty($this->ldap_quota) && !empty($this->ldap_quota_def)) {
|
||||
$this->setQuota($uid);
|
||||
}
|
||||
|
||||
if(!empty($this->ldap_email_attr)) {
|
||||
$this->setEmail($uid);
|
||||
}
|
||||
|
||||
if($this->ldap_nocase) {
|
||||
$filter = str_replace('%uid', $uid, $this->ldap_filter);
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
$entries = ldap_get_entries( $this->getDs(), $sr );
|
||||
if( $entries['count'] == 1 ) {
|
||||
foreach($entries as $row) {
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
return $row[$ldap_display_name][0];
|
||||
}
|
||||
}
|
||||
|
@ -131,12 +175,12 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
else {
|
||||
return $uid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
return $uid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function userExists( $uid ) {
|
||||
|
@ -146,17 +190,17 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
$dn = $this->getDn($uid);
|
||||
return !empty($dn);
|
||||
}
|
||||
|
||||
|
||||
public function getUsers()
|
||||
{
|
||||
if(!$this->configured)
|
||||
return false;
|
||||
|
||||
|
||||
// connect to server
|
||||
$ds = $this->getDs();
|
||||
if( !$ds )
|
||||
return false;
|
||||
|
||||
|
||||
// get users
|
||||
$filter = 'objectClass=person';
|
||||
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
|
||||
|
@ -169,7 +213,7 @@ class OC_USER_LDAP extends OC_User_Backend {
|
|||
// TODO ldap_get_entries() seems to lower all keys => needs review
|
||||
$ldap_display_name = strtolower($this->ldap_display_name);
|
||||
if(isset($row[$ldap_display_name])) {
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
$users[] = $row[$ldap_display_name][0];
|
||||
}
|
||||
}
|
||||
// TODO language specific sorting of user names
|
||||
|
|
|
@ -14,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'='))
|
|||
}
|
||||
}
|
||||
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
|
||||
OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
|
||||
|
||||
OC_APP::registerPersonal('user_openid','settings');
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){
|
|||
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
|
||||
$USERNAME='';
|
||||
}
|
||||
$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;
|
||||
$IDENTITY=OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$USERNAME;
|
||||
|
||||
require_once 'phpmyid.php';
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ $CONFIG = array(
|
|||
"forcessl" => false,
|
||||
"enablebackup" => false,
|
||||
"theme" => "",
|
||||
"3rdpartyroot" => "",
|
||||
"3rdpartyurl" => "",
|
||||
// "datadirectory" => ""
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
See the COPYING-README file. */
|
||||
|
||||
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; cursor:default; }
|
||||
html, body { height: 100%; }
|
||||
article, aside, dialog, figure, footer, header, hgroup, nav, section { display:block; }
|
||||
body { line-height:1.5; }
|
||||
table { border-collapse:separate; border-spacing:0; white-space:nowrap; }
|
||||
|
@ -39,8 +40,8 @@ input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active,
|
|||
input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active,
|
||||
.searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active { background-color:#fff; color:#333; opacity:1; }
|
||||
|
||||
input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
|
||||
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
|
||||
input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
|
||||
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, select:hover, select:focus, select:active, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
|
||||
input[type="checkbox"] { width:auto; }
|
||||
#quota { cursor:default; }
|
||||
|
||||
|
@ -55,11 +56,11 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-
|
|||
/* CONTENT ------------------------------------------------------------------ */
|
||||
#controls { padding: 0 0.5em; width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; }
|
||||
#controls .button { display:inline-block; }
|
||||
#content { margin:3.5em 0 0 12.5em; }
|
||||
#content { top: 3.5em; left: 12.5em; position: absolute; }
|
||||
#leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; }
|
||||
#leftcontent li, .leftcontent li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }
|
||||
#leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active { background:#eee; }
|
||||
#rightcontent, .rightcontent { position:absolute; top:6.4em; left:33em; }
|
||||
#rightcontent, .rightcontent { position:fixed; top: 6.4em; left: 32.5em; }
|
||||
|
||||
|
||||
/* LOG IN & INSTALLATION ------------------------------------------------------------ */
|
||||
|
@ -113,8 +114,8 @@ table:not(.nostyle) tr { -webkit-transition:background-color 500ms; -moz-transit
|
|||
tbody tr:hover, tr:active { background-color:#f8f8f8; }
|
||||
|
||||
#body-settings .personalblock, #body-settings .helpblock { padding:.5em 1em; margin:1em; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
|
||||
#body-settings .personalblock#quota { position:relative; margin-top:4.5em; padding:0; }
|
||||
#body-settings #controls+.helpblock { position:relative; margin-top:7.3em; }
|
||||
#body-settings .personalblock#quota { position:relative; padding:0; }
|
||||
#body-settings #controls+.helpblock { position:relative; margin-top: 3em; }
|
||||
.personalblock > legend { margin-top:2em; }
|
||||
|
||||
#quota div, div.jp-play-bar, div.jp-seek-bar { padding:0; background:#e6e6e6; font-weight:normal; white-space:nowrap; -moz-border-radius-bottomleft:.4em; -webkit-border-bottom-left-radius:.4em; border-bottom-left-radius:.4em; -moz-border-radius-topleft:.4em; -webkit-border-top-left-radius:.4em; border-top-left-radius:.4em; }
|
||||
|
|
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 441 B |
After Width: | Height: | Size: 436 B |
BIN
core/img/filetypes/application-vnd.oasis.opendocument.text.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
core/img/filetypes/application-x-7z-compressed.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-bzip-compressed-tar.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-bzip.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-compressed-tar.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-deb.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-debian-package.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
core/img/filetypes/application-x-gzip.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-lzma-compressed-tar.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-rar.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-rpm.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-tar.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-x-tarz.png
Normal file
After Width: | Height: | Size: 652 B |
BIN
core/img/filetypes/application-zip.png
Normal file
After Width: | Height: | Size: 652 B |
28
core/img/filetypes/readme-2.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
15.02.2012
|
||||
|
||||
Following new icons have been added:
|
||||
core/img/filetypes/application-vnd.oasis.opendocument.formula.png
|
||||
core/img/filetypes/application-vnd.oasis.opendocument.graphics.png
|
||||
core/img/filetypes/application-vnd.oasis.opendocument.presentation.png
|
||||
core/img/filetypes/application-vnd.oasis.opendocument.spreadsheet.png
|
||||
core/img/filetypes/application-vnd.oasis.opendocument.text.png
|
||||
Download: http://odftoolkit.org/ODF-Icons#ODF_Icons
|
||||
License: Apache 2.0
|
||||
|
||||
core/img/filetypes/application-x-7z-compressed.png
|
||||
core/img/filetypes/application-x-bzip-compressed-tar.png
|
||||
core/img/filetypes/application-x-bzip.png
|
||||
core/img/filetypes/application-x-compressed-tar.png
|
||||
core/img/filetypes/application-x-deb.png
|
||||
core/img/filetypes/application-x-debian-package.png
|
||||
core/img/filetypes/application-x-gzip.png
|
||||
core/img/filetypes/application-x-lzma-compressed-tar.png
|
||||
core/img/filetypes/application-x-rar.png
|
||||
core/img/filetypes/application-x-rpm.png
|
||||
core/img/filetypes/application-x-tar.png
|
||||
core/img/filetypes/application-x-tarz.png
|
||||
core/img/filetypes/application-zip.png
|
||||
Author: Gomez Hyuuga
|
||||
License: Creative Commons Attribution-Share Alike 3.0 Unported License
|
||||
Download: http://kde-look.org/content/show.php/?content=101767
|
||||
|
|
@ -13,7 +13,7 @@ function t(app,text){
|
|||
success:function(jsondata){
|
||||
t.cache[app] = jsondata.data;
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
// Bad answer ...
|
||||
if( !( app in t.cache )){
|
||||
|
@ -58,7 +58,7 @@ OC={
|
|||
}
|
||||
link+=app;
|
||||
if(type){
|
||||
link+=type+'/'
|
||||
link+=type+'/';
|
||||
}
|
||||
link+=file;
|
||||
return link;
|
||||
|
@ -73,7 +73,7 @@ OC={
|
|||
*/
|
||||
imagePath:function(app,file){
|
||||
if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support
|
||||
file+=(SVGSupport())?'.svg':'.png'
|
||||
file+=(SVGSupport())?'.svg':'.png';
|
||||
}
|
||||
return OC.filePath(app,'img',file);
|
||||
},
|
||||
|
@ -126,7 +126,7 @@ OC={
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
OC.search.customResults={};
|
||||
OC.search.currentResult=-1;
|
||||
OC.search.lastQuery='';
|
||||
|
@ -147,7 +147,7 @@ if(typeof localStorage !='undefined'){
|
|||
getItem:function(name){
|
||||
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name));
|
||||
}
|
||||
}
|
||||
};
|
||||
}else{
|
||||
//dummy localstorage
|
||||
OC.localStorage={
|
||||
|
@ -160,7 +160,7 @@ if(typeof localStorage !='undefined'){
|
|||
getItem:function(name){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,7 +182,7 @@ if (!Array.prototype.filter) {
|
|||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* implement Array.indexOf for browsers without native support
|
||||
|
@ -235,11 +235,11 @@ SVGSupport.checkMimeType=function(){
|
|||
});
|
||||
if(headers["Content-Type"]!='image/svg+xml'){
|
||||
replaceSVG();
|
||||
SVGSupport.checkMimeType.correct=false
|
||||
SVGSupport.checkMimeType.correct=false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
SVGSupport.checkMimeType.correct=true;
|
||||
|
||||
//replace all svg images with png for browser compatibility
|
||||
|
@ -305,11 +305,12 @@ $(document).ready(function(){
|
|||
|
||||
$(window).resize(function () {
|
||||
fillHeight($('#leftcontent'));
|
||||
fillWindow($('#content'));
|
||||
fillWindow($('#rightcontent'));
|
||||
});
|
||||
$(window).trigger('resize');
|
||||
|
||||
if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg
|
||||
if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg
|
||||
replaceSVG();
|
||||
}else{
|
||||
SVGSupport.checkMimeType();
|
||||
|
@ -379,7 +380,6 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
|
||||
if($('body').attr("id")=="body-user") { $('#settings #expanddiv').hide(); }
|
||||
$('#settings #expand').click(function(event) {
|
||||
$('#settings #expanddiv').slideToggle();
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -16,7 +16,7 @@ if (isset($_POST['user'])) {
|
|||
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
|
||||
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
|
||||
if (!empty($email)) {
|
||||
$link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token;
|
||||
$link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php').'?user='.$_POST['user'].'&token='.$token;
|
||||
$tmpl = new OC_Template('core/lostpassword', 'email');
|
||||
$tmpl->assign('link', $link);
|
||||
$msg = $tmpl->fetchPage();
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
<ul id="settings" class="svg">
|
||||
<img id="expand" class="svg" alt="<?php echo $l->t('Settings');?>" src="<?php echo image_path('', 'actions/settings.svg'); ?>" />
|
||||
<span style="display:none"><?php echo $l->t('Settings');?></span>
|
||||
<div id="expanddiv">
|
||||
<span style="display:none;"><?php echo $l->t('Settings');?></span>
|
||||
<div id="expanddiv" <?php if($_['bodyid'] == 'body-user') echo 'style="display:none;"'; ?>>
|
||||
<?php foreach($_['settingsnavigation'] as $entry):?>
|
||||
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
|
||||
<field>
|
||||
<name>configvalue</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
|
||||
|
||||
|
||||
</declaration>
|
||||
|
||||
</table>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
|
||||
|
||||
<field>
|
||||
<name>path</name>
|
||||
<type>text</type>
|
||||
|
@ -90,7 +90,7 @@
|
|||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
|
||||
|
||||
<field>
|
||||
<name>size</name>
|
||||
<type>integer</type>
|
||||
|
@ -522,7 +522,7 @@
|
|||
</declaration>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<table>
|
||||
|
||||
<name>*dbprefix*properties</name>
|
||||
|
|
|
@ -76,11 +76,11 @@ foreach( explode( "/", $dir ) as $i ){
|
|||
// make breadcrumb und filelist markup
|
||||
$list = new OC_Template( "files", "part.list", "" );
|
||||
$list->assign( "files", $files );
|
||||
$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
|
||||
$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php?file="));
|
||||
$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
|
||||
$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php")."?file=");
|
||||
$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
|
||||
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
|
||||
$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
|
||||
$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
|
||||
|
||||
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
|
||||
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
|
||||
|
|
|
@ -166,6 +166,7 @@ $(document).ready(function() {
|
|||
|
||||
$('.file_upload_start').live('change',function(){
|
||||
var form=$(this).closest('form');
|
||||
var that=this;
|
||||
var uploadId=form.attr('data-upload-id');
|
||||
var files=this.files;
|
||||
var target=form.children('iframe');
|
||||
|
@ -173,6 +174,12 @@ $(document).ready(function() {
|
|||
if(files){
|
||||
for(var i=0;i<files.length;i++){
|
||||
totalSize+=files[i].size;
|
||||
if(FileList.deleteFiles && FileList.deleteFiles.indexOf(files[i].name)!=-1){//finish delete if we are uploading a deleted file
|
||||
FileList.finishDelete(function(){
|
||||
$(that).change();
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(totalSize>$('#max_upload').val()){
|
||||
|
|
|
@ -44,13 +44,14 @@ if($not_installed) {
|
|||
|
||||
// Handle WebDAV
|
||||
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
|
||||
header('location: '.OC_Helper::linkTo('files','webdav.php'));
|
||||
header('location: '.OC_Helper::linkToAbsolute('files','webdav.php'));
|
||||
exit();
|
||||
}
|
||||
|
||||
// Someone is logged in :
|
||||
elseif(OC_User::isLoggedIn()) {
|
||||
if(isset($_GET["logout"]) and ($_GET["logout"])) {
|
||||
OC_App::loadApps();
|
||||
OC_User::logout();
|
||||
header("Location: ".OC::$WEBROOT.'/');
|
||||
exit();
|
||||
|
@ -80,7 +81,7 @@ else {
|
|||
OC_User::unsetMagicInCookie();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Someone wants to log in :
|
||||
elseif(isset($_POST["user"]) && isset($_POST['password'])) {
|
||||
if(OC_User::login($_POST["user"], $_POST["password"])) {
|
||||
|
|
|
@ -230,7 +230,7 @@ class OC_App{
|
|||
// admin users menu
|
||||
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
|
||||
// admin apps menu
|
||||
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
|
||||
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
|
||||
// admin log menu
|
||||
$settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" ));
|
||||
|
||||
|
|
40
lib/base.php
|
@ -54,6 +54,14 @@ class OC{
|
|||
* the folder that stores the data for the root filesystem (e.g. /srv/http/owncloud/data)
|
||||
*/
|
||||
public static $CONFIG_DATADIRECTORY_ROOT = '';
|
||||
/**
|
||||
* The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty)
|
||||
*/
|
||||
public static $THIRDPARTYROOT = '';
|
||||
/**
|
||||
* the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty)
|
||||
*/
|
||||
public static $THIRDPARTYWEBROOT = '';
|
||||
|
||||
/**
|
||||
* SPL autoload
|
||||
|
@ -138,12 +146,35 @@ class OC{
|
|||
}
|
||||
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI));
|
||||
|
||||
|
||||
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){
|
||||
OC::$WEBROOT='/'.OC::$WEBROOT;
|
||||
}
|
||||
|
||||
// search the 3rdparty folder
|
||||
if(OC_Config::getValue('3rdpartyroot', '')<>'' and OC_Config::getValue('3rdpartyurl', '')<>''){
|
||||
OC::$THIRDPARTYROOT=OC_Config::getValue('3rdpartyroot', '');
|
||||
OC::$THIRDPARTYWEBROOT=OC_Config::getValue('3rdpartyurl', '');
|
||||
}elseif(file_exists(OC::$SERVERROOT.'/3rdparty')){
|
||||
OC::$THIRDPARTYROOT=OC::$SERVERROOT;
|
||||
OC::$THIRDPARTYWEBROOT=OC::$WEBROOT;
|
||||
}elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')){
|
||||
$url_tmp=explode('/',OC::$WEBROOT);
|
||||
$length=count($url_tmp);
|
||||
unset($url_tmp[$length-1]);
|
||||
OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp);
|
||||
$root_tmp=explode('/',OC::$SERVERROOT);
|
||||
$length=count($root_tmp);
|
||||
unset($root_tmp[$length-1]);
|
||||
OC::$THIRDPARTYROOT=implode('/',$root_tmp);
|
||||
}else{
|
||||
echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// set the right include path
|
||||
set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
|
||||
set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT);
|
||||
|
||||
// Redirect to installer if not installed
|
||||
if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') {
|
||||
|
@ -171,6 +202,13 @@ class OC{
|
|||
echo 'Error while upgrading the database';
|
||||
die();
|
||||
}
|
||||
if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) {
|
||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
||||
$tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
|
||||
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class OC_Config{
|
|||
$result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content );
|
||||
if(!$result) {
|
||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
||||
$tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud")));
|
||||
$tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -318,6 +318,9 @@ class OC_DB {
|
|||
|
||||
// Make changes and save them to a temporary file
|
||||
$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' );
|
||||
if($file2 == ''){
|
||||
die('could not create tempfile in get_temp_dir() - aborting');
|
||||
}
|
||||
$content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
|
||||
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
|
||||
if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't
|
||||
|
|