fix merge conflicts

This commit is contained in:
Georg Ehrke 2012-04-15 12:43:07 +02:00
commit e292b1fcdb
115 changed files with 1064 additions and 587 deletions

View File

@ -1,5 +1,5 @@
<?php
$l=new OC_L10N('admin_dependencies_chk');
$l=OC_L10N::get('admin_dependencies_chk');
OC_App::register( array(
'order' => 14,

View File

@ -2,7 +2,6 @@
<info>
<id>admin_dependencies_chk</id>
<name>Owncloud dependencies info</name>
<version>0.01</version>
<licence>AGPL</licence>
<author>Brice Maron (eMerzh)</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.01

View File

@ -20,7 +20,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$l=new OC_L10N('admin_dependencies_chk');
$l=OC_L10N::get('admin_dependencies_chk');
$tmpl = new OC_Template( 'admin_dependencies_chk', 'settings');
$modules = array();

View File

@ -3,7 +3,6 @@
<id>admin_migrate</id>
<name>ownCloud Instance Migration</name>
<description>Import/Export your owncloud instance</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Thomas Schmidt and Tom Needham</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>bookmarks</id>
<name>Bookmarks</name>
<description>Bookmark manager for ownCloud</description>
<version>0.2</version>
<licence>AGPL</licence>
<author>Arthur Schiwon, Marvin Thomas Rabe</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.2

View File

@ -94,7 +94,7 @@ function addBookmark($url, $title, $tags='') {
}
if(empty($title)) {
$l = new OC_L10N('bookmarks');
$l = OC_L10N::get('bookmarks');
$title = $l->t('unnamed');
}

View File

@ -20,8 +20,8 @@
*
*/
class OC_Search_Provider_Bookmarks implements OC_Search_Provider{
static function search($query){
class OC_Search_Provider_Bookmarks extends OC_Search_Provider{
function search($query){
$results=array();
$offset = 0;

View File

@ -1,7 +1,7 @@
<?php
function createBookmarklet() {
$l = new OC_L10N('bookmarks');
$l = OC_L10N::get('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="bookmarklet" 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>';

View File

@ -7,7 +7,6 @@
*/
require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();

View File

@ -7,7 +7,7 @@
*/
require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
$l10n = OC_L10N::get('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$output = new OC_TEMPLATE("calendar", "part.choosecalendar");

View File

@ -8,8 +8,6 @@
require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');

View File

@ -9,7 +9,6 @@
require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$l10n = new OC_L10N('calendar');
$tmpl = new OC_Template('calendar', 'part.import');
$tmpl->assign('path', $_POST['path']);
$tmpl->assign('filename', $_POST['filename']);

View File

@ -10,7 +10,7 @@ require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$l = new OC_L10N('calendar');
$l = OC_L10N::get('calendar');
$lat = $_GET['lat'];
$lng = $_GET['long'];

View File

@ -9,7 +9,7 @@
// Init owncloud
require_once('../../../../lib/base.php');
$l=new OC_L10N('calendar');
$l=OC_L10N::get('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();

View File

@ -1,5 +1,5 @@
<?php
$l=new OC_L10N('calendar');
$l=OC_L10N::get('calendar');
OC::$CLASSPATH['OC_Calendar_App'] = 'apps/calendar/lib/app.php';
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php';

View File

@ -2,7 +2,6 @@
<info>
<id>calendar</id>
<name>Calendar</name>
<version>0.3</version>
<licence>AGPL</licence>
<author>Georg Ehrke, Bart Visscher, Jakob Sack</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.3

View File

@ -17,6 +17,10 @@ class OC_Calendar_App{
* @brief language object for calendar app
*/
public static $l10n;
/*
* @brief categories of the user
*/
protected static $categories = null;
/*
@ -108,6 +112,10 @@ class OC_Calendar_App{
return true;
}
/*
* @brief returns the default categories of ownCloud
* @return (array) $categories
*/
protected static function getDefaultCategories()
{
return array(
@ -129,6 +137,10 @@ class OC_Calendar_App{
);
}
/*
* @brief returns the vcategories object of the user
* @return (object) $vcategories
*/
protected static function getVCategories() {
if (is_null(self::$categories)) {
self::$categories = new OC_VCategories('calendar', null, self::getDefaultCategories());
@ -136,6 +148,10 @@ class OC_Calendar_App{
return self::$categories;
}
/*
* @brief returns the categories of the vcategories object
* @return (array) $categories
*/
public static function getCategoryOptions()
{
$categories = self::getVCategories()->categories();

View File

@ -1,6 +1,6 @@
<?php
class OC_Search_Provider_Calendar implements OC_Search_Provider{
static function search($query){
class OC_Search_Provider_Calendar extends OC_Search_Provider{
function search($query){
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
if(count($calendars)==0 || !OC_App::isEnabled('calendar')){
//return false;

View File

@ -20,7 +20,7 @@ OC_App::addNavigationEntry( array(
'order' => 10,
'href' => OC_Helper::linkTo( 'contacts', 'index.php' ),
'icon' => OC_Helper::imagePath( 'settings', 'users.svg' ),
'name' => OC_Contacts_App::$l10n->t('Contacts') ));
'name' => OC_L10N::get('contact')->t('Contacts') ));
OC_APP::registerPersonal('contacts','settings');

View File

@ -2,7 +2,6 @@
<info>
<id>contacts</id>
<name>Contacts</name>
<version>0.1</version>
<licence>AGPL</licence>
<author>Jakob Sack</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -9,7 +9,7 @@
/**
* This class manages our app actions
*/
OC_Contacts_App::$l10n = new OC_L10N('contacts');
OC_Contacts_App::$l10n = OC_L10N::get('contacts');
OC_Contacts_App::$categories = new OC_VCategories('contacts');
class OC_Contacts_App {
public static $l10n;

View File

@ -1,6 +1,6 @@
<?php
class OC_Search_Provider_Contacts implements OC_Search_Provider{
static function search($query){
class OC_Search_Provider_Contacts extends OC_Search_Provider{
function search($query){
$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser(), 1);
// if(count($calendars)==0 || !OC_App::isEnabled('contacts')){
// //return false;

View File

@ -1,5 +1,5 @@
<div id="firstrun">
<?php echo $l->t('You have no contacts in your list.') ?>
<?php echo $l->t('You have no contacts in your addressbook.') ?>
<div id="selections">
<input type="button" value="<?php echo $l->t('Import contacts') ?>" onclick="Contacts.UI.Addressbooks.doImport()" />
<input type="button" value="<?php echo $l->t('Add contact') ?>" onclick="Contacts.UI.Card.editNew()" />

View File

@ -3,7 +3,6 @@
<id>external</id>
<name>External</name>
<description>Show external Application in the ownCloud menu</description>
<version>1.0</version>
<licence>AGPL</licence>
<author>Frank Karlitschek</author>
<require>2</require>

1
apps/external/appinfo/version vendored Normal file
View File

@ -0,0 +1 @@
1.0

View File

@ -3,7 +3,6 @@
<id>files_archive</id>
<name>Archive support</name>
<description>Transparent opening of archives</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>3</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>files_encryption</id>
<name>Encryption</name>
<description>Server side encryption of files</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>3</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>files_external</id>
<name>External storage support</name>
<description>Mount external storage sources</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>3</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>files_imageviewer</id>
<name>Image Viewer</name>
<description>Simple image viewer for owncloud</description>
<version>1.0</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>2</require>

View File

@ -0,0 +1 @@
1.0

View File

@ -3,7 +3,6 @@
<id>files_pdfviewer</id>
<name>PDF Viewer</name>
<description>Inline PDF viewer (pdfjs-based)</description>
<version>0.1</version>
<licence>GPL</licence>
<author>Joan Creus</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>files_sharing</id>
<name>Share Files</name>
<description>File sharing between users</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Michael Gapczynski</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -62,6 +62,8 @@ if ($source !== false) {
$tmpl->assign("fileList", $list->fetchPage());
$tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage());
$tmpl->assign("readonly", true);
$tmpl->assign("allowZipDownload", false);
$tmpl->assign("dir", 'shared dir');
$tmpl->printPage();
} else {
//get time mimetype and set the headers

View File

@ -2,8 +2,11 @@ $(document).ready(function() {
var shared_status = {};
if (typeof FileActions !== 'undefined') {
FileActions.register('all', 'Share', function(filename) {
if (scanFiles.scanning){return;}//workaround to prevent aditional http request block scanning feedback
if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
var icon;
if (typeof filename == 'undefined') {
return false;
}
var file = $('#dir').val()+'/'+filename;
if(shared_status[file])
return shared_status[file].icon;
@ -145,7 +148,7 @@ $(document).ready(function() {
data: data,
success: function(token) {
if (token) {
showPublicLink(token);
showPublicLink(token, source.substr(source.lastIndexOf('/')));
}
}
});
@ -203,7 +206,7 @@ function createDropdown(filename, files) {
if (users) {
$.each(users, function(index, row) {
if (row.uid_shared_with == 'public') {
showPublicLink(row.token);
showPublicLink(row.token, '/'+filename);
} else if (isNaN(index)) {
addUser(row.uid_shared_with, row.permissions, index.substr(0, index.lastIndexOf('-')));
} else {
@ -234,9 +237,9 @@ function addUser(uid_shared_with, permissions, parentFolder) {
$(user).appendTo('#shared_list');
}
function showPublicLink(token) {
function showPublicLink(token, file) {
$('#makelink').attr('checked', true);
$('#link').data('token', token);
$('#link').val(parent.location.protocol+'//'+location.host+OC.linkTo('files_sharing','get.php')+'?token='+token);
$('#link').val(parent.location.protocol+'//'+location.host+OC.linkTo('files_sharing','get.php')+'?token='+token+'&f='+file);
$('#link').show('blind');
}

View File

@ -3,7 +3,6 @@
<id>files_texteditor</id>
<name>Text Editor</name>
<description>Simple plain text editor based on Ace editor.</description>
<version>0.3</version>
<licence>AGPL</licence>
<author>Tom Needham</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.3

View File

@ -69,7 +69,7 @@ function showControls(filename,writeperms){
if(writeperms=="true"){
editorbarhtml += '<button id="editor_save">'+t('files_texteditor','Save')+'</button><div class="separator"></div>';
}
editorbarhtml += '<label for="gotolineval">Go to line:</label><input stype="text" id="gotolineval"><label for="editorseachval">Search:</label><input type="text" name="editorsearchval" id="editorsearchval"><div class="separator"></div><button id="editor_close">'+t('files_texteditor','Close')+'</button></div>';
editorbarhtml += '<label for="editorseachval">Search:</label><input type="text" name="editorsearchval" id="editorsearchval"><div class="separator"></div><button id="editor_close">'+t('files_texteditor','Close')+'</button></div>';
// Change breadcrumb classes
$('#controls .last').removeClass('last');
$('#controls').append(editorbarhtml);
@ -79,7 +79,6 @@ function showControls(filename,writeperms){
function bindControlEvents(){
$("#editor_save").die('click',doFileSave).live('click',doFileSave);
$('#editor_close').die('click',hideFileEditor).live('click',hideFileEditor);
$('#gotolineval').die('keyup', goToLine).live('keyup', goToLine);
$('#editorsearchval').die('keyup', doSearch).live('keyup', doSearch);
$('#clearsearchbtn').die('click', resetSearch).live('click', resetSearch);
$('#nextsearchbtn').die('click', nextSearchResult).live('click', nextSearchResult);
@ -91,13 +90,6 @@ function editorIsShown(){
return is_editor_shown;
}
// Moves the editor view to the line number speificed in #gotolineval
function goToLine(){
// Go to the line specified
window.aceEditor.gotoLine($('#gotolineval').val());
}
//resets the search
function resetSearch(){
$('#editorsearchval').val('');

View File

@ -2,7 +2,6 @@
<info>
<id>files_versioning</id>
<name>Versioning and Backup</name>
<version>1.0.0</version>
<licence>GPLv2</licence>
<author>Craig Roberts</author>
<require>3</require>

View File

@ -0,0 +1 @@
1.0.0

View File

@ -27,7 +27,7 @@ OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php';
OC::$CLASSPATH['OC_Gallery_Sharing'] = 'apps/gallery/lib/sharing.php';
OC::$CLASSPATH['OC_Gallery_Hooks_Handlers'] = 'apps/gallery/lib/hooks_handlers.php';
$l = new OC_L10N('gallery');
$l = OC_L10N::get('gallery');
OC_App::register(array(
'order' => 20,
@ -41,8 +41,8 @@ OC_App::addNavigationEntry( array(
'icon' => OC_Helper::imagePath('core', 'places/picture.svg'),
'name' => $l->t('Pictures')));
class OC_GallerySearchProvider implements OC_Search_Provider{
static function search($query){
class OC_GallerySearchProvider extends OC_Search_Provider{
function search($query){
$stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
$results=array();

View File

@ -2,7 +2,6 @@
<info>
<id>gallery</id>
<name>Pictures</name>
<version>0.4</version>
<licence>AGPL</licence>
<author>Bartek Przybylski</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.4

View File

@ -7,7 +7,7 @@ OC_Util::addStyle('files', 'files');
OC_Util::addScript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
OC_Util::addScript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
OC_Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
$l = new OC_L10N('gallery');
$l = OC_L10N::get('gallery');
?>
<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OC_User::getUser(), 'gallery', 'order', 'ASC'); ?>';</script>
<div id="controls">

View File

@ -5,7 +5,7 @@ OC_Util::addScript('gallery', 'album_cover');
OC_Util::addScript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
OC_Util::addScript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
OC_Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
$l = new OC_L10N('gallery');
$l = OC_L10N::get('gallery');
?>
<script type="text/javascript">
$(document).ready(function() {

View File

@ -20,7 +20,7 @@
*
*/
$l=new OC_L10N('media');
$l=OC_L10N::get('media');
require_once('apps/media/lib_media.php');

View File

@ -3,7 +3,6 @@
<id>media</id>
<name>Media</name>
<description>Media player and server for ownCloud</description>
<version>0.3</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.3

View File

@ -82,8 +82,8 @@ class OC_MEDIA{
}
}
class OC_MediaSearchProvider implements OC_Search_Provider{
static function search($query){
class OC_MediaSearchProvider extends OC_Search_Provider{
function search($query){
require_once('lib_collection.php');
$artists=OC_MEDIA_COLLECTION::getArtists($query);
$albums=OC_MEDIA_COLLECTION::getAlbums(0,$query);

View File

@ -3,7 +3,6 @@
<id>remoteStorage</id>
<name>remoteStorage compatibility</name>
<description>Enables you to use ownCloud as their remote storage for unhosted applications. This app requires the Webfinger app to be installed and enabled correctly. More info on <a href="http://unhosted.org">the website of the unhosted movement</a>.</description>
<version>0.6</version>
<licence>AGPL or MIT</licence>
<author>Michiel de Jong</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.6

View File

@ -21,7 +21,9 @@
*
*/
require_once('apps/user_ldap/lib_ldap.php');
require_once('apps/user_ldap/user_ldap.php');
require_once('apps/user_ldap/group_ldap.php');
OC_APP::registerAdmin('user_ldap','settings');
@ -33,6 +35,7 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
// register user backend
OC_User::useBackend( 'LDAP' );
OC_Group::useBackend( 'LDAP' );
// add settings page to navigation
$entry = array(

View File

@ -3,7 +3,6 @@
<id>user_ldap</id>
<name>LDAP user backend</name>
<description>Authenticate Users by LDAP</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Dominik Schmidt</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -0,0 +1,82 @@
<?php
/**
* ownCloud LDAP group backend
*
* @author Arthur Schiwon
* @copyright 2012 Arthur Schiwon blizzz@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_GROUP_LDAP extends OC_Group_Backend {
// //group specific settings
protected $ldapGroupFilter;
protected $ldapGroupDisplayName;
public function __construct() {
$this->ldapGroupFilter = OC_Appconfig::getValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
$this->ldapGroupDisplayName = OC_Appconfig::getValue('user_ldap', 'ldap_group_display_name', 'cn');
}
/**
* @brief is user in group?
* @param $uid uid of the user
* @param $gid gid of the group
* @returns true/false
*
* Checks whether the user is member of a group or not.
*/
public function inGroup($uid, $gid) {
return array();
}
/**
* @brief Get all groups a user belongs to
* @param $uid Name of the user
* @returns array with group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
*/
public function getUserGroups($uid) {
return array();
}
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public function getUsersInGroup($gid) {
return array();
}
/**
* @brief get a list of all groups
* @returns array with group names
*
* Returns a list with all groups
*/
public function getGroups() {
$groups = OC_LDAP::search($this->ldapGroupFilter, $this->ldapGroupDisplayName);
if(count($groups) == 0 )
return array();
else {
return array_unique($groups, SORT_LOCALE_STRING);
}
}
}

118
apps/user_ldap/lib_ldap.php Normal file
View File

@ -0,0 +1,118 @@
<?php
/**
* ownCloud LDAP lib
*
* @author Arthur Schiwon
* @copyright 2012 Arthur Schiwon blizzz@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_LDAP {
static protected $ldapConnectionRes = false;
static protected $configured = false;
//cached settings
static protected $ldapHost;
static protected $ldapPort;
static protected $ldapBase;
static protected $ldapAgentName;
static protected $ldapAgentPassword;
static protected $ldapTLS;
static protected $ldapNoCase;
static public function init() {
self::readConfiguration();
self::establishConnection();
}
/**
* @brief executes an LDAP search
* @param $filter the LDAP filter for the search
* @param $attr optional, when a certain attribute shall be filtered out
* @returns array with the search result
*
* Executes an LDAP search
*/
static public function search($filter, $attr = null) {
$sr = ldap_search(self::getConnectionResource(), self::$ldapBase, $filter);
$findings = ldap_get_entries(self::getConnectionResource(), $sr );
if(!is_null($attr)) {
$selection = array();
foreach($findings as $item) {
if(isset($item[strtolower($attr)])) {
$selection[] = $item[strtolower($attr)][0];
}
}
return $selection;
}
return $findings;
}
/**
* Returns the LDAP handler
*/
static private function getConnectionResource() {
if(!self::$ldapConnectionRes) {
self::init();
}
return self::$ldapConnectionRes;
}
/**
* Caches the general LDAP configuration.
*/
static private function readConfiguration() {
if(!self::$configured) {
self::$ldapHost = OC_Appconfig::getValue('user_ldap', 'ldap_host', '');
self::$ldapPort = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
self::$ldapAgentName = OC_Appconfig::getValue('user_ldap', 'ldap_dn','');
self::$ldapAgentPassword = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
self::$ldapBase = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
self::$ldapTLS = OC_Appconfig::getValue('user_ldap', 'ldap_tls',0);
self::$ldapNoCase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
//TODO: sanity checking
self::$configured = true;
}
}
/**
* Connects and Binds to LDAP
*/
static private function establishConnection() {
if(!self::$ldapConnectionRes) {
self::$ldapConnectionRes = ldap_connect(self::$ldapHost, self::$ldapPort);
if(ldap_set_option(self::$ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
if(ldap_set_option(self::$ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
if(self::$ldapTLS) {
ldap_start_tls(self::$ldapConnectionRes);
}
}
}
//TODO: Check if it works. Before, it was outside the resource-condition
$ldapLogin = @ldap_bind(self::$ldapConnectionRes, self::$ldapAgentName, self::$ldapAgentPassword );
if(!$ldapLogin) {
return false;
}
}
}
}

View File

@ -1,10 +1,9 @@
<?php
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
* @author Arthur Schiwon
* @copyright 2012 Arthur Schiwon blizzz@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@ -21,20 +20,17 @@
*
*/
/**
* Class for connecting multiply ownCloud installations
*
*/
class OC_Connect{
static private $clouds=array();
class Test_Group_Ldap extends UnitTestCase {
function setUp(){
OC_Group::clearBackends();
}
static function connect($path,$user,$password){
$cloud=new OC_REMOTE_CLOUD($path,$user,$password);
if($cloud->connected){
self::$clouds[$path]=$cloud;
return $cloud;
}else{
return false;
}
function testSingleBackend(){
OC_Group::useBackend(new OC_GROUP_LDAP());
$group_ldap = new OC_GROUP_LDAP();
$this->assertIsA(OC_Group::getGroups(),gettype(array()));
$this->assertIsA($group_ldap->getGroups(),gettype(array()));
}
}

View File

@ -94,10 +94,6 @@ class OC_USER_LDAP extends OC_User_Backend {
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);
}

View File

@ -3,7 +3,6 @@
<id>user_migrate</id>
<name>User Account Migration</name>
<description>Migrate your user accounts</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Tom Needham</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>user_openid</id>
<name>OpenID user backend</name>
<description>Allow login through OpenID</description>
<version>0.1</version>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.1

View File

@ -3,7 +3,6 @@
<id>user_webfinger</id>
<name>Webfinger</name>
<description>Provide WebFinger for all users so they get a user address like user@owncloudinstance which can be used for external applications. Other apps can provide information for webfinger requests, such as remoteStorage compatibility.</description>
<version>0.3</version>
<licence>AGPL or MIT</licence>
<author>Michiel de Jong, Florian Hülsmann</author>
<require>2</require>

View File

@ -0,0 +1 @@
0.3

View File

@ -26,7 +26,7 @@ require_once('../../lib/base.php');
$app = $_POST["app"];
$l = new OC_L10N( $app );
$l = OC_L10N::get( $app );
OC_JSON::success(array('data' => $l->getTranslations()));
?>

View File

@ -49,7 +49,7 @@ input[type="checkbox"] { width:auto; }
#body-login input[type="text"], #body-login input[type="password"] { width: 13em; }
#body-login input.login { width: auto; float: right; }
#remember_login { margin:.8em .2em 0 1em; }
.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; opacity:.3; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
.searchbox input[type="search"] { position:fixed; font-size:1.2em; top:.4em; right:3em; padding:.2em .5em .2em 1.5em; background:#fff url('../img/actions/search.svg') no-repeat .5em center; border:0; -moz-border-radius:1em; -webkit-border-radius:1em; border-radius:1em; opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; }
input[type="submit"].enabled { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; }
input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text-shadow:#ffeedd 0 1px 0; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #ffeedd inset; }
@ -106,8 +106,9 @@ label.infield { cursor: text !important; }
#notification { z-index:101; cursor:pointer; background-color:#fc4; border:0; padding:0 .7em .3em; display:none; position:fixed; left:50%; top:0; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
.action, .selectedActions a, #logout { opacity:.5; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
.action, .selectedActions a { opacity:.5; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
.action { width: 16px; height: 16px; }
#logout { opacity:.8; }
.action:hover, .selectedActions a:hover, #logout:hover { opacity:1; }
table:not(.nostyle) tr { -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; }

View File

@ -297,7 +297,10 @@ function object(o) {
* Fills height of window. (more precise than height: 100%;)
*/
function fillHeight(selector) {
var height = parseFloat($(window).height())-parseFloat(selector.css('top'));
if (selector.length == 0) {
return;
}
var height = parseFloat($(window).height())-selector.offset().top;
selector.css('height', height + 'px');
if(selector.outerHeight() > selector.height())
selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px');
@ -307,8 +310,11 @@ function fillHeight(selector) {
* Fills height and width of window. (more precise than height: 100%; or width: 100%;)
*/
function fillWindow(selector) {
if (selector.length == 0) {
return;
}
fillHeight(selector);
var width = parseFloat($(window).width())-parseFloat(selector.css('left'));
var width = parseFloat($(window).width())-selector.offset().left;
selector.css('width', width + 'px');
if(selector.outerWidth() > selector.width())
selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px');

View File

@ -20,7 +20,7 @@ if (isset($_POST['user'])) {
$tmpl = new OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link);
$msg = $tmpl->fetchPage();
$l = new OC_L10N('core');
$l = OC_L10N::get('core');
$from = 'lostpassword-noreply@' . $_SERVER['HTTP_HOST'];
mail($email, $l->t('Owncloud password reset'), $msg, 'From:' . $from);
}

View File

@ -1,7 +1,7 @@
<?php
//some strings that are used in /lib but wont be translatable unless they are in /core too
$l=new OC_L10N('core');
$l=OC_L10N::get('core');
$l->t("Personal");
$l->t("Users");
$l->t("Apps");

View File

@ -14,7 +14,7 @@ if (!isset($_FILES['files'])) {
}
foreach ($_FILES['files']['error'] as $error) {
if ($error != 0) {
$l=new OC_L10N('files');
$l=OC_L10N::get('files');
$errors = array(
UPLOAD_ERR_OK=>$l->t("There is no error, the file uploaded with success"),
UPLOAD_ERR_INI_SIZE=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'),

View File

@ -1,7 +1,7 @@
<?php
$l=new OC_L10N('files');
$l=OC_L10N::get('files');
OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" ));

View File

@ -35,6 +35,7 @@ class OC_App{
static private $adminForms = array();
static private $personalForms = array();
static private $appInfo = array();
static private $appTypes = array();
/**
* @brief loads all apps
@ -85,11 +86,7 @@ class OC_App{
if(is_string($types)){
$types=array($types);
}
$appData=self::getAppInfo($app);
if(!isset($appData['types'])){
return false;
}
$appTypes=$appData['types'];
$appTypes=self::getAppTypes($app);
foreach($types as $type){
if(array_search($type,$appTypes)!==false){
return true;
@ -98,6 +95,32 @@ class OC_App{
return false;
}
/**
* get the types of an app
* @param string $app
* @return array
*/
private static function getAppTypes($app){
//load the cache
if(count(self::$appTypes)==0){
self::$appTypes=OC_Appconfig::getValues(false,'types');
}
//get it from info.xml if we haven't cached it
if(!isset(self::$appTypes[$app])){
$appData=self::getAppInfo($app);
if(isset($appData['types'])){
self::$appTypes[$app]=$appData['types'];
}else{
self::$appTypes[$app]=array();
}
OC_Appconfig::setValue($app,'types',implode(',',self::$appTypes[$app]));
}
return explode(',',self::$appTypes[$app]);
}
/**
* get all enabled apps
*/
@ -140,12 +163,17 @@ class OC_App{
OC_Installer::installShippedApp($app);
}else{
$download=OC_OCSClient::getApplicationDownload($app,1);
if(isset($download['downloadlink']) and $download['downloadlink']<>'') {
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
$app=OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink']));
}
}
}
if($app!==false){
OC_Appconfig::setValue( $app, 'enabled', 'yes' );
return true;
}else{
return false;
}
}
/**
@ -249,7 +277,7 @@ class OC_App{
* entries are sorted by the key 'order' ascending.
*/
public static function getSettingsNavigation(){
$l=new OC_L10N('core');
$l=OC_L10N::get('core');
$settings = array();
// by default, settings only contain the help menu
@ -303,6 +331,20 @@ class OC_App{
return $list;
}
/**
* get the last version of the app, either from appinfo/version or from appinfo/info.xml
*/
public static function getAppVersion($appid){
$file=OC::$APPSROOT.'/apps/'.$appid.'/appinfo/version';
$version=@file_get_contents($file);
if($version){
return $version;
}else{
$appData=self::getAppInfo($appid);
return $appData['version'];
}
}
/**
* @brief Read app metadata from the info.xml file
* @param string $appid id of the app or the path of the info.xml file
@ -436,12 +478,11 @@ class OC_App{
// The rest comes here
$versions = self::getAppVersions();
foreach( $versions as $app=>$installedVersion ){
$appInfo=OC_App::getAppInfo($app);
if (isset($appInfo['version'])) {
$currentVersion=$appInfo['version'];
$currentVersion=OC_App::getAppVersion($app);
if ($currentVersion) {
if (version_compare($currentVersion, $installedVersion, '>')) {
OC_App::updateApp($app);
OC_Appconfig::setValue($app,'installed_version',$appInfo['version']);
OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
}
}
}

View File

@ -163,4 +163,38 @@ class OC_Appconfig{
return true;
}
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
* @param app
* @param key
* @return array
*/
public static function getValues($app,$key){
if($app!==false and $key!==false){
return false;
}
$where='WHERE';
$fields='configvalue';
$params=array();
if($app!==false){
$where.=' appid = ?';
$fields.=', configkey';
$params[]=$app;
$key='configkey';
}else{
$fields.=', appid';
$where.=' configkey = ?';
$params[]=$key;
$key='appid';
}
$queryString='SELECT '.$fields.' FROM *PREFIX*appconfig '.$where;
$query=OC_DB::prepare($queryString);
$result=$query->execute($params);
$values=array();
while($row=$result->fetchRow()){
$values[$row[$key]]=$row['configvalue'];
}
return $values;
}
}

View File

@ -36,6 +36,24 @@ class OC_DB {
static private $affected=0;
static private $result=false;
static private $inTransaction=false;
static private $prefix=null;
static private $type=null;
/**
* check which backend we should use
* @return BACKEND_MDB2 or BACKEND_PDO
*/
private static function getDBBackend(){
$backend=self::BACKEND_MDB2;
if(class_exists('PDO') && OC_Config::getValue('installed', false)){//check if we can use PDO, else use MDB2 (instalation always needs to be done my mdb2)
$type = OC_Config::getValue( "dbtype", "sqlite" );
if($type=='sqlite3') $type='sqlite';
$drivers=PDO::getAvailableDrivers();
if(array_search($type,$drivers)!==false){
$backend=self::BACKEND_PDO;
}
}
}
/**
* @brief connects to the database
@ -48,15 +66,7 @@ class OC_DB {
return;
}
if(is_null($backend)){
$backend=self::BACKEND_MDB2;
if(class_exists('PDO') && OC_Config::getValue('installed', false)){//check if we can use PDO, else use MDB2 (instalation always needs to be done my mdb2)
$type = OC_Config::getValue( "dbtype", "sqlite" );
if($type=='sqlite3') $type='sqlite';
$drivers=PDO::getAvailableDrivers();
if(array_search($type,$drivers)!==false){
$backend=self::BACKEND_PDO;
}
}
$backend=self::getDBBackend();
}
if($backend==self::BACKEND_PDO){
self::connectPDO();
@ -423,8 +433,14 @@ class OC_DB {
private static function processQuery( $query ){
self::connect();
// We need Database type and table prefix
$type = OC_Config::getValue( "dbtype", "sqlite" );
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
if(is_null(self::$type)){
self::$type=OC_Config::getValue( "dbtype", "sqlite" );
}
$type = self::$type;
if(is_null(self::$prefix)){
self::$prefix=OC_Config::getValue( "dbtableprefix", "oc_" );
}
$prefix = self::$prefix;
// differences in escaping of table names ('`' for mysql) and getting the current timestamp
if( $type == 'sqlite' || $type == 'sqlite3' ){
@ -485,7 +501,7 @@ class OC_DB {
}
/**
* @breif replaces the owncloud tables with a new set
* @brief replaces the owncloud tables with a new set
* @param $file string path to the MDB2 xml db export file
*/
public static function replaceDB( $file ){

View File

@ -281,6 +281,7 @@ class OC_FileCache{
/**
* get the file id as used in the cache
* unlike the public getId, full paths are used here (/usename/files/foo instead of /foo)
* @param string $path
* @return int
*/
@ -304,6 +305,39 @@ class OC_FileCache{
}
}
/**
* get the file id as used in the cache
* @param string path
* @param string root (optional)
* @return int
*/
public static function getId($path,$root=''){
if(!$root){
$root=OC_Filesystem::getRoot();
}
if($root=='/'){
$root='';
}
$path=$root.$path;
return self::getFileId($path);
}
/**
* get the file path from the id, relative to the home folder of the user
* @param int id
* @param string user (optional)
* @return string
*/
public static function getPath($id,$user=''){
if(!$user){
$user=OC_User::getUser();
}
$query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id=? AND user=?');
$result=$query->execute(array($id,$user));
$row=$result->fetchRow();
return $row['path'];
}
/**
* get the file id of the parent folder, taking into account '/' has no parent
* @param string $path

View File

@ -63,7 +63,7 @@ class OC_Files {
$executionTime = intval(ini_get('max_execution_time'));
set_time_limit(0);
$zip = new ZipArchive();
$filename = get_temp_dir().'/ownCloud_'.mt_rand(10000,99999).'.zip';
$filename = OC_Helper::tmpFile('.zip');
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) {
exit("cannot open <$filename>\n");
}
@ -84,7 +84,7 @@ class OC_Files {
$executionTime = intval(ini_get('max_execution_time'));
set_time_limit(0);
$zip = new ZipArchive();
$filename = get_temp_dir().'/ownCloud_'.mt_rand(10000,99999).'.zip';
$filename = OC_Helper::tmpFile('.zip');
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) {
exit("cannot open <$filename>\n");
}
@ -104,15 +104,15 @@ class OC_Files {
header('Content-Type: application/zip');
header('Content-Length: ' . filesize($filename));
}else{
header('Content-Type: ' . OC_Filesystem::getMimeType($filename));
header('Content-Length: ' . OC_Filesystem::filesize($filename));
$fileData=OC_FileCache::get($filename);
header('Content-Type: ' . $fileData['mimetype']);
header('Content-Length: ' . $fileData['size']);
}
}elseif($zip or !OC_Filesystem::file_exists($filename)){
header("HTTP/1.0 404 Not Found");
$tmpl = new OC_Template( '', '404', 'guest' );
$tmpl->assign('file',$filename);
$tmpl->printPage();
// die('404 Not Found');
}else{
header("HTTP/1.0 403 Forbidden");
die('403 Forbidden');
@ -225,7 +225,7 @@ class OC_Files {
*/
static function validateZipDownload($dir, $files) {
if(!OC_Config::getValue('allowZipDownload', true)) {
$l = new OC_L10N('files');
$l = OC_L10N::get('files');
header("HTTP/1.0 409 Conflict");
$tmpl = new OC_Template( '', 'error', 'user' );
$errors = array(
@ -250,7 +250,7 @@ class OC_Files {
$totalsize += OC_Filesystem::filesize($dir.'/'.$files);
}
if($totalsize > $zipLimit) {
$l = new OC_L10N('files');
$l = OC_L10N::get('files');
header("HTTP/1.0 409 Conflict");
$tmpl = new OC_Template( '', 'error', 'user' );
$errors = array(

View File

@ -283,8 +283,12 @@ class OC_FilesystemView {
if(OC_Filesystem::isValidPath($path)){
$source=$this->fopen($path,'r');
if($source){
$extention=substr($path,strrpos($path,'.'));
$tmpFile=OC_Helper::tmpFile($extention);
$extension='';
$extOffset=strpos($path,'.');
if($extOffset !== false) {
$extension=substr($path,strrpos($path,'.'));
}
$tmpFile=OC_Helper::tmpFile($extension);
file_put_contents($tmpFile,$source);
return $tmpFile;
}

View File

@ -294,6 +294,9 @@ class OC_Helper {
}elseif(file_exists($dir)){
unlink($dir);
}
if(file_exists($dir)) {
return false;
}
}
/**
@ -472,9 +475,20 @@ class OC_Helper {
* remove all files created by self::tmpFile
*/
public static function cleanTmp(){
$leftoversFile='/tmp/oc-not-deleted';
if(file_exists($leftoversFile)){
$leftovers=file($leftoversFile);
foreach($leftovers as $file) {
self::rmdirr($file);
}
unlink($leftoversFile);
}
foreach(self::$tmpFiles as $file){
if(file_exists($file)){
self::rmdirr($file);
if(!self::rmdirr($file)) {
file_put_contents($leftoversFile, $file."\n", FILE_APPEND);
}
}
}
}

View File

@ -175,7 +175,7 @@ class OC_Installer{
}
//set the installed version
OC_Appconfig::setValue($info['id'],'installed_version',$info['version']);
OC_Appconfig::setValue($info['id'],'installed_version',OC_App::getAppVersion($info['id']));
OC_Appconfig::setValue($info['id'],'enabled','no');
return $info['id'];
}
@ -297,7 +297,7 @@ class OC_Installer{
include(OC::$APPSROOT."/apps/$app/appinfo/install.php");
}
$info=OC_App::getAppInfo($app);
OC_Appconfig::setValue($app,'installed_version',$info['version']);
OC_Appconfig::setValue($app,'installed_version',OC_App::getAppVersion($app));
return $info;
}
}

View File

@ -24,7 +24,7 @@ class OC_JSON{
*/
public static function checkAppEnabled($app){
if( !OC_App::isEnabled($app)){
$l = new OC_L10N('core');
$l = OC_L10N::get('core');
self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled') )));
exit();
}
@ -35,7 +35,7 @@ class OC_JSON{
*/
public static function checkLoggedIn(){
if( !OC_User::isLoggedIn()){
$l = new OC_L10N('core');
$l = OC_L10N::get('core');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
@ -47,7 +47,7 @@ class OC_JSON{
public static function checkAdminUser(){
self::checkLoggedIn();
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
$l = new OC_L10N('core');
$l = OC_L10N::get('core');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}

View File

@ -24,6 +24,11 @@
* This class is for i18n and l10n
*/
class OC_L10N{
/**
* cached instances
*/
protected static $instances=array();
/**
* cache
*/
@ -47,6 +52,21 @@ class OC_L10N{
'datetime' => 'd.m.Y H:i:s',
'time' => 'H:i:s');
/**
* get an L10N instance
* @return OC_L10N
*/
public static function get($app,$lang=null){
if(is_null($lang)){
if(!isset(self::$instances[$app])){
self::$instances[$app]=new OC_L10N($app);
}
return self::$instances[$app];
}else{
return new OC_L10N($app,$lang);
}
}
/**
* @brief The constructor
* @param $app the app requesting l10n
@ -261,18 +281,15 @@ class OC_L10N{
public static function findAvailableLanguages($app=null){
$available=array('en');//english is always available
$dir = self::findI18nDir($app);
if(file_exists($dir)){
$dh = opendir($dir);
while(($file = readdir($dh)) !== false){
if(substr($file, -4, 4) == '.php' and (strlen($file) == 6 || strlen($file) == 9)){
if(is_dir($dir)){
$files=scandir($dir);
foreach($files as $file){
if(substr($file, -4, 4) == '.php'){
$i = substr($file, 0, -4);
if($i != ''){
$available[] = $i;
}
}
}
closedir($dh);
}
return $available;
}
}

View File

@ -57,7 +57,7 @@ class OC_Migrate{
}
/**
* @breif finds and loads the providers
* @brief finds and loads the providers
*/
static private function findProviders(){
// Find the providers
@ -72,7 +72,7 @@ class OC_Migrate{
}
/**
* @breif exports a user, or owncloud instance
* @brief exports a user, or owncloud instance
* @param optional $uid string user id of user to export if export type is user, defaults to current
* @param ootional $type string type of export, defualts to user
* @param otional $path string path to zip output folder
@ -91,7 +91,8 @@ class OC_Migrate{
if( self::$exporttype == 'user' ){
// Check user exists
if( !is_null($uid) ){
if( !OC_User_Database::userExists( $uid ) ){
$db = new OC_User_Database;
if( !$db->userExists( $uid ) ){
OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR);
return json_encode( array( 'success' => false ) );
}
@ -189,7 +190,7 @@ class OC_Migrate{
}
/**
* @breif imports a user, or owncloud instance
* @brief imports a user, or owncloud instance
* @param $path string path to zip
* @param optional $type type of import (user or instance)
* @param optional $uid userid of new user
@ -297,7 +298,7 @@ class OC_Migrate{
}
/**
* @breif recursively deletes a directory
* @brief recursively deletes a directory
* @param $dir string path of dir to delete
* $param optional $deleteRootToo bool delete the root directory
* @return bool
@ -322,7 +323,7 @@ class OC_Migrate{
}
/**
* @breif copies recursively
* @brief copies recursively
* @param $path string path to source folder
* @param $dest string path to destination
* @return bool
@ -353,7 +354,7 @@ class OC_Migrate{
}
/**
* @breif tries to extract the import zip
* @brief tries to extract the import zip
* @param $path string path to the zip
* @return string path to extract location (with a trailing slash) or false on failure
*/
@ -395,7 +396,7 @@ class OC_Migrate{
}
/**
* @breif creates a migration.db in the users data dir with their app data in
* @brief creates a migration.db in the users data dir with their app data in
* @return bool whether operation was successfull
*/
private static function exportAppData( ){
@ -433,7 +434,7 @@ class OC_Migrate{
// Now add some app info the the return array
$appinfo = OC_App::getAppInfo( $provider->getID() );
$return['apps'][$provider->getID()]['version'] = $appinfo['version'];
$return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());
}
@ -443,7 +444,7 @@ class OC_Migrate{
/**
* @breif generates json containing export info, and merges any data supplied
* @brief generates json containing export info, and merges any data supplied
* @param optional $array array of data to include in the returned json
* @return bool
*/
@ -478,7 +479,7 @@ class OC_Migrate{
}
/**
* @breif connects to migration.db, or creates if not found
* @brief connects to migration.db, or creates if not found
* @param $db optional path to migration.db, defaults to user data dir
* @return bool whether the operation was successful
*/
@ -537,7 +538,7 @@ class OC_Migrate{
}
/**
* @breif creates the tables in migration.db from an apps database.xml
* @brief creates the tables in migration.db from an apps database.xml
* @param $appid string id of the app
* @return bool whether the operation was successful
*/
@ -591,7 +592,7 @@ class OC_Migrate{
}
/**
* @breif tries to create the zip
* @brief tries to create the zip
* @param $path string path to zip destination
* @return bool
*/
@ -611,7 +612,7 @@ class OC_Migrate{
}
/**
* @breif returns an array of apps that support migration
* @brief returns an array of apps that support migration
* @return array
*/
static public function getApps(){
@ -626,7 +627,7 @@ class OC_Migrate{
}
/**
* @breif imports a new user
* @brief imports a new user
* @param $db string path to migration.db
* @param $info object of migration info
* @param $uid optional uid to use
@ -689,7 +690,7 @@ class OC_Migrate{
}
/*
* @breif creates a new user in the database
* @brief creates a new user in the database
* @param $uid string user_id of the user to be created
* @param $hash string hash of the user to be created
* @return bool result of user creation

View File

@ -33,7 +33,7 @@ class OC_Migration_Content{
private $tmpfiles=false;
/**
* @breif sets up the
* @brief sets up the
* @param $zip ZipArchive object
* @param optional $db a MDB2 database object (required for exporttype user)
* @return bool
@ -51,7 +51,7 @@ class OC_Migration_Content{
}
// @breif prepares the db
// @brief prepares the db
// @param $query the sql query to prepare
public function prepare( $query ){
@ -74,7 +74,7 @@ class OC_Migration_Content{
}
/**
* @breif processes the db query
* @brief processes the db query
* @param $query the query to process
* @return string of processed query
*/
@ -130,7 +130,7 @@ class OC_Migration_Content{
}
/**
* @breif saves a sql data set into migration.db
* @brief saves a sql data set into migration.db
* @param $data a sql data set returned from self::prepare()->query()
* @param $options array of copyRows options
* @return void
@ -175,7 +175,7 @@ class OC_Migration_Content{
}
/**
* @breif adds a directory to the zip object
* @brief adds a directory to the zip object
* @param $dir string path of the directory to add
* @param $recursive bool
* @param $internaldir string path of folder to add dir to in zip
@ -209,7 +209,7 @@ class OC_Migration_Content{
}
/**
* @breif adds a file to the zip from a given string
* @brief adds a file to the zip from a given string
* @param $data string of data to add
* @param $path the relative path inside of the zip to save the file to
* @return bool
@ -228,7 +228,7 @@ class OC_Migration_Content{
}
/**
* @breif closes the zip, removes temp files
* @brief closes the zip, removes temp files
* @return bool
*/
public function finish(){
@ -241,7 +241,7 @@ class OC_Migration_Content{
}
/**
* @breif cleans up after the zip
* @brief cleans up after the zip
*/
private function cleanup(){
// Delete tmp files

View File

@ -17,19 +17,19 @@ abstract class OC_Migration_Provider{
}
/**
* @breif exports data for apps
* @brief exports data for apps
* @return array appdata to be exported
*/
abstract function export( );
/**
* @breif imports data for the app
* @brief imports data for the app
* @return void
*/
abstract function import( );
/**
* @breif sets the OC_Migration_Content object to $this->content
* @brief sets the OC_Migration_Content object to $this->content
* @param $content a OC_Migration_Content object
*/
public function setData( $uid, $content, $info=null ){
@ -43,7 +43,7 @@ abstract class OC_Migration_Provider{
}
/**
* @breif returns the appid of the provider
* @brief returns the appid of the provider
* @return string
*/
public function getID(){

View File

@ -1,204 +0,0 @@
<?php
/**
* Class for connection to a remote owncloud installation
*
*/
class OC_REMOTE_CLOUD{
private $path;
private $connected=false;
private $cookiefile=false;
/**
* make an api call to the remote cloud
* @param string $action
* @param array parameters
* @param bool assoc when set to true, the result will be parsed as associative array
*
*/
private function apiCall($action,$parameters=false,$assoc=false){
if(!$this->cookiefile){
$this->cookiefile=get_temp_dir().'/remoteCloudCookie'.uniqid();
}
$url=$this->path.='/files/api.php';
$fields_string="action=$action&";
if(is_array($parameters)){
foreach($parameters as $key=>$value){
$fields_string.=$key.'='.$value.'&';
}
rtrim($fields_string,'&');
}
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($parameters));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$result=curl_exec($ch);
$result=trim($result);
$info=curl_getinfo($ch);
$httpCode=$info['http_code'];
curl_close($ch);
if($httpCode==200 or $httpCode==0){
return json_decode($result,$assoc);
}else{
return false;
}
}
public function __construct($path,$user,$password){
$this->path=$path;
$this->connected=$this->apiCall('login',array('username'=>$user,'password'=>$password));
}
/**
* check if we are stull logged in on the remote cloud
*
*/
public function isLoggedIn(){
if(!$this->connected){
return false;
}
return $this->apiCall('checklogin');
}
public function __get($name){
switch($name){
case 'connected':
return $this->connected;
}
}
/**
* disconnect from the remote cloud
*
*/
public function disconnect(){
$this->connected=false;
if(is_file($this->cookiefile)){
unlink($this->cookiefile);
}
$this->cookiefile=false;
}
/**
* create a new file or directory
* @param string $dir
* @param string $name
* @param string $type
*/
public function newFile($dir,$name,$type){
if(!$this->connected){
return false;
}
return $this->apiCall('new',array('dir'=>$dir,'name'=>$name,'type'=>$type),true);
}
/**
* deletes a file or directory
* @param string $dir
* @param string $file
*/
public function delete($dir,$name){
if(!$this->connected){
return false;
}
return $this->apiCall('delete',array('dir'=>$dir,'file'=>$name),true);
}
/**
* moves a file or directory
* @param string $sorceDir
* @param string $sorceFile
* @param string $targetDir
* @param string $targetFile
*/
public function move($sourceDir,$sourceFile,$targetDir,$targetFile){
if(!$this->connected){
return false;
}
return $this->apiCall('move',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true);
}
/**
* copies a file or directory
* @param string $sorceDir
* @param string $sorceFile
* @param string $targetDir
* @param string $targetFile
*/
public function copy($sourceDir,$sourceFile,$targetDir,$targetFile){
if(!$this->connected){
return false;
}
return $this->apiCall('copy',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true);
}
/**
* get a file tree
* @param string $dir
*/
public function getTree($dir){
if(!$this->connected){
return false;
}
return $this->apiCall('gettree',array('dir'=>$dir),true);
}
/**
* get the files inside a directory of the remote cloud
* @param string $dir
*/
public function getFiles($dir){
if(!$this->connected){
return false;
}
return $this->apiCall('getfiles',array('dir'=>$dir),true);
}
/**
* get a remove file and save it in a temporary file and return the path of the temporary file
* @param string $dir
* @param string $file
* @return string
*/
public function getFile($dir, $file){
if(!$this->connected){
return false;
}
$ch=curl_init();
if(!$this->cookiefile){
$this->cookiefile=get_temp_dir().'/remoteCloudCookie'.uniqid();
}
$tmpfile=tempnam(get_temp_dir(),'remoteCloudFile');
$fp=fopen($tmpfile,'w+');
$url=$this->path.="/files/api.php?action=get&dir=$dir&file=$file";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
fclose($fp);
curl_close($ch);
return $tmpfile;
}
public function sendFile($sourceDir,$sourceFile,$targetDir,$targetFile){
$source=$sourceDir.'/'.$sourceFile;
$tmp=OC_Filesystem::toTmpFile($source);
return $this->sendTmpFile($tmp,$targetDir,$targetFile);
}
public function sendTmpFile($tmp,$targetDir,$targetFile){
$token=sha1(uniqid().$tmp);
$file=get_temp_dir().'/'.'remoteCloudFile'.$token;
rename($tmp,$file);
if( OC_Config::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
$url = "https://". $_SERVER['SERVER_NAME'] . OC::$WEBROOT;
}else{
$url = "http://". $_SERVER['SERVER_NAME'] . OC::$WEBROOT;
}
return $this->apiCall('pull',array('dir'=>$targetDir,'file'=>$targetFile,'token'=>$token,'source'=>$url),true);
}
}

View File

@ -26,13 +26,22 @@
*/
class OC_Search{
static private $providers=array();
static private $registeredProviders=array();
/**
* remove all registered search providers
*/
public static function clearProviders(){
self::$providers=array();
self::$registeredProviders=array();
}
/**
* register a new search provider to be used
* @param string $provider class name of a OC_Search_Provider
*/
public static function registerProvider($provider){
self::$providers[]=$provider;
public static function registerProvider($class,$options=array()){
self::$registeredProviders[]=array('class'=>$class,'options'=>$options);
}
/**
@ -41,10 +50,25 @@ class OC_Search{
* @return array An array of OC_Search_Result's
*/
public static function search($query){
self::initProviders();
$results=array();
foreach(self::$providers as $provider){
$results=array_merge($results, $provider::search($query));
$results=array_merge($results, $provider->search($query));
}
return $results;
}
/**
* create instances of all the registered search providers
*/
private static function initProviders(){
if(count(self::$providers)>0){
return;
}
foreach(self::$registeredProviders as $provider){
$class=$provider['class'];
$options=$provider['options'];
self::$providers[]=new $class($options);
}
}
}

View File

@ -2,11 +2,13 @@
/**
* provides search functionalty
*/
interface OC_Search_Provider {
class OC_Search_Provider {
public function __construct($options){}
/**
* search for $query
* @param string $query
* @return array An array of OC_Search_Result's
*/
static function search($query);
public function search($query){}
}

View File

@ -1,7 +1,7 @@
<?php
class OC_Search_Provider_File implements OC_Search_Provider{
static function search($query){
class OC_Search_Provider_File extends OC_Search_Provider{
function search($query){
$files=OC_FileCache::search($query,true);
$results=array();
foreach($files as $fileData){

View File

@ -76,7 +76,7 @@ function simple_file_size($bytes) {
}
function relative_modified_date($timestamp) {
$l=new OC_L10N('template');
$l=OC_L10N::get('template');
$timediff = time() - $timestamp;
$diffminutes = round($timediff/60);
$diffhours = round($diffminutes/60);
@ -155,7 +155,7 @@ class OC_Template{
$this->renderas = $renderas;
$this->application = $app;
$this->vars = array();
$this->l10n = new OC_L10N($app);
$this->l10n = OC_L10N::get($app);
$this->findTemplate($name);
}

View File

@ -59,9 +59,9 @@ class OC_Updater{
public static function ShowUpdatingHint(){
$data=OC_Updater::check();
if(isset($data['version']) and $data['version']<>'') {
$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Please click <a href="'.$data['web'].'">here</a> for more information</span>';
$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Get <a href="'.$data['web'].'">more information</a></span>';
}else{
$txt='Your ownCloud is up to date';
$txt='up to date';
}
return($txt);
}

View File

@ -172,7 +172,7 @@ class OC_User_Database extends OC_User_Backend {
* @return boolean
*/
public function userExists($uid){
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" );
$query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid LIKE ?" );
$result = $query->execute( array( $uid ));
return $result->numRows() > 0;

Some files were not shown because too many files have changed in this diff Show More