Merge branch 'master' of gitorious.org:owncloud/owncloud
This commit is contained in:
commit
fbb314ef4b
|
@ -20,7 +20,7 @@ OC_App::addNavigationEntry( array(
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
'href' => OC_Helper::linkTo( 'contacts', 'index.php' ),
|
'href' => OC_Helper::linkTo( 'contacts', 'index.php' ),
|
||||||
'icon' => OC_Helper::imagePath( 'settings', 'users.svg' ),
|
'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');
|
OC_APP::registerPersonal('contacts','settings');
|
||||||
|
|
|
@ -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/user_ldap.php');
|
||||||
|
require_once('apps/user_ldap/group_ldap.php');
|
||||||
|
|
||||||
OC_APP::registerAdmin('user_ldap','settings');
|
OC_APP::registerAdmin('user_ldap','settings');
|
||||||
|
|
||||||
|
@ -33,6 +35,7 @@ define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
|
||||||
|
|
||||||
// register user backend
|
// register user backend
|
||||||
OC_User::useBackend( 'LDAP' );
|
OC_User::useBackend( 'LDAP' );
|
||||||
|
OC_Group::useBackend( 'LDAP' );
|
||||||
|
|
||||||
// add settings page to navigation
|
// add settings page to navigation
|
||||||
$entry = array(
|
$entry = array(
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ownCloud
|
||||||
|
*
|
||||||
|
* @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 Test_Group_Ldap extends UnitTestCase {
|
||||||
|
function setUp(){
|
||||||
|
OC_Group::clearBackends();
|
||||||
|
}
|
||||||
|
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -297,7 +297,10 @@ function object(o) {
|
||||||
* Fills height of window. (more precise than height: 100%;)
|
* Fills height of window. (more precise than height: 100%;)
|
||||||
*/
|
*/
|
||||||
function fillHeight(selector) {
|
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');
|
selector.css('height', height + 'px');
|
||||||
if(selector.outerHeight() > selector.height())
|
if(selector.outerHeight() > selector.height())
|
||||||
selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px');
|
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%;)
|
* Fills height and width of window. (more precise than height: 100%; or width: 100%;)
|
||||||
*/
|
*/
|
||||||
function fillWindow(selector) {
|
function fillWindow(selector) {
|
||||||
|
if (selector.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
fillHeight(selector);
|
fillHeight(selector);
|
||||||
var width = parseFloat($(window).width())-parseFloat(selector.css('left'));
|
var width = parseFloat($(window).width())-selector.offset().left;
|
||||||
selector.css('width', width + 'px');
|
selector.css('width', width + 'px');
|
||||||
if(selector.outerWidth() > selector.width())
|
if(selector.outerWidth() > selector.width())
|
||||||
selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px');
|
selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px');
|
||||||
|
|
33
lib/app.php
33
lib/app.php
|
@ -35,6 +35,7 @@ class OC_App{
|
||||||
static private $adminForms = array();
|
static private $adminForms = array();
|
||||||
static private $personalForms = array();
|
static private $personalForms = array();
|
||||||
static private $appInfo = array();
|
static private $appInfo = array();
|
||||||
|
static private $appTypes = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief loads all apps
|
* @brief loads all apps
|
||||||
|
@ -85,11 +86,7 @@ class OC_App{
|
||||||
if(is_string($types)){
|
if(is_string($types)){
|
||||||
$types=array($types);
|
$types=array($types);
|
||||||
}
|
}
|
||||||
$appData=self::getAppInfo($app);
|
$appTypes=self::getAppTypes($app);
|
||||||
if(!isset($appData['types'])){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$appTypes=$appData['types'];
|
|
||||||
foreach($types as $type){
|
foreach($types as $type){
|
||||||
if(array_search($type,$appTypes)!==false){
|
if(array_search($type,$appTypes)!==false){
|
||||||
return true;
|
return true;
|
||||||
|
@ -97,6 +94,32 @@ class OC_App{
|
||||||
}
|
}
|
||||||
return false;
|
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
|
* get all enabled apps
|
||||||
|
|
|
@ -163,4 +163,38 @@ class OC_Appconfig{
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ class OC_DB {
|
||||||
self::connect();
|
self::connect();
|
||||||
// We need Database type and table prefix
|
// We need Database type and table prefix
|
||||||
if(is_null(self::$type)){
|
if(is_null(self::$type)){
|
||||||
self::$type=OC_Config::getValue( "dbtype", "oc_" );
|
self::$type=OC_Config::getValue( "dbtype", "sqlite" );
|
||||||
}
|
}
|
||||||
$type = self::$type;
|
$type = self::$type;
|
||||||
if(is_null(self::$prefix)){
|
if(is_null(self::$prefix)){
|
||||||
|
@ -501,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
|
* @param $file string path to the MDB2 xml db export file
|
||||||
*/
|
*/
|
||||||
public static function replaceDB( $file ){
|
public static function replaceDB( $file ){
|
||||||
|
|
|
@ -104,15 +104,15 @@ class OC_Files {
|
||||||
header('Content-Type: application/zip');
|
header('Content-Type: application/zip');
|
||||||
header('Content-Length: ' . filesize($filename));
|
header('Content-Length: ' . filesize($filename));
|
||||||
}else{
|
}else{
|
||||||
header('Content-Type: ' . OC_Filesystem::getMimeType($filename));
|
$fileData=OC_FileCache::get($filename);
|
||||||
header('Content-Length: ' . OC_Filesystem::filesize($filename));
|
header('Content-Type: ' . $fileData['mimetype']);
|
||||||
|
header('Content-Length: ' . $fileData['size']);
|
||||||
}
|
}
|
||||||
}elseif($zip or !OC_Filesystem::file_exists($filename)){
|
}elseif($zip or !OC_Filesystem::file_exists($filename)){
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
$tmpl = new OC_Template( '', '404', 'guest' );
|
$tmpl = new OC_Template( '', '404', 'guest' );
|
||||||
$tmpl->assign('file',$filename);
|
$tmpl->assign('file',$filename);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
// die('404 Not Found');
|
|
||||||
}else{
|
}else{
|
||||||
header("HTTP/1.0 403 Forbidden");
|
header("HTTP/1.0 403 Forbidden");
|
||||||
die('403 Forbidden');
|
die('403 Forbidden');
|
||||||
|
|
|
@ -57,7 +57,7 @@ class OC_Migrate{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif finds and loads the providers
|
* @brief finds and loads the providers
|
||||||
*/
|
*/
|
||||||
static private function findProviders(){
|
static private function findProviders(){
|
||||||
// Find the providers
|
// 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 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 ootional $type string type of export, defualts to user
|
||||||
* @param otional $path string path to zip output folder
|
* @param otional $path string path to zip output folder
|
||||||
|
@ -190,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 $path string path to zip
|
||||||
* @param optional $type type of import (user or instance)
|
* @param optional $type type of import (user or instance)
|
||||||
* @param optional $uid userid of new user
|
* @param optional $uid userid of new user
|
||||||
|
@ -298,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 $dir string path of dir to delete
|
||||||
* $param optional $deleteRootToo bool delete the root directory
|
* $param optional $deleteRootToo bool delete the root directory
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -323,7 +323,7 @@ class OC_Migrate{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif copies recursively
|
* @brief copies recursively
|
||||||
* @param $path string path to source folder
|
* @param $path string path to source folder
|
||||||
* @param $dest string path to destination
|
* @param $dest string path to destination
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -354,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
|
* @param $path string path to the zip
|
||||||
* @return string path to extract location (with a trailing slash) or false on failure
|
* @return string path to extract location (with a trailing slash) or false on failure
|
||||||
*/
|
*/
|
||||||
|
@ -396,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
|
* @return bool whether operation was successfull
|
||||||
*/
|
*/
|
||||||
private static function exportAppData( ){
|
private static function exportAppData( ){
|
||||||
|
@ -444,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
|
* @param optional $array array of data to include in the returned json
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -479,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
|
* @param $db optional path to migration.db, defaults to user data dir
|
||||||
* @return bool whether the operation was successful
|
* @return bool whether the operation was successful
|
||||||
*/
|
*/
|
||||||
|
@ -538,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
|
* @param $appid string id of the app
|
||||||
* @return bool whether the operation was successful
|
* @return bool whether the operation was successful
|
||||||
*/
|
*/
|
||||||
|
@ -592,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
|
* @param $path string path to zip destination
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -612,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
|
* @return array
|
||||||
*/
|
*/
|
||||||
static public function getApps(){
|
static public function getApps(){
|
||||||
|
@ -627,7 +627,7 @@ class OC_Migrate{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif imports a new user
|
* @brief imports a new user
|
||||||
* @param $db string path to migration.db
|
* @param $db string path to migration.db
|
||||||
* @param $info object of migration info
|
* @param $info object of migration info
|
||||||
* @param $uid optional uid to use
|
* @param $uid optional uid to use
|
||||||
|
@ -690,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 $uid string user_id of the user to be created
|
||||||
* @param $hash string hash of the user to be created
|
* @param $hash string hash of the user to be created
|
||||||
* @return bool result of user creation
|
* @return bool result of user creation
|
||||||
|
|
|
@ -33,7 +33,7 @@ class OC_Migration_Content{
|
||||||
private $tmpfiles=false;
|
private $tmpfiles=false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif sets up the
|
* @brief sets up the
|
||||||
* @param $zip ZipArchive object
|
* @param $zip ZipArchive object
|
||||||
* @param optional $db a MDB2 database object (required for exporttype user)
|
* @param optional $db a MDB2 database object (required for exporttype user)
|
||||||
* @return bool
|
* @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
|
// @param $query the sql query to prepare
|
||||||
public function prepare( $query ){
|
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
|
* @param $query the query to process
|
||||||
* @return string of processed query
|
* @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 $data a sql data set returned from self::prepare()->query()
|
||||||
* @param $options array of copyRows options
|
* @param $options array of copyRows options
|
||||||
* @return void
|
* @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 $dir string path of the directory to add
|
||||||
* @param $recursive bool
|
* @param $recursive bool
|
||||||
* @param $internaldir string path of folder to add dir to in zip
|
* @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 $data string of data to add
|
||||||
* @param $path the relative path inside of the zip to save the file to
|
* @param $path the relative path inside of the zip to save the file to
|
||||||
* @return bool
|
* @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
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function finish(){
|
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(){
|
private function cleanup(){
|
||||||
// Delete tmp files
|
// Delete tmp files
|
||||||
|
@ -249,4 +249,4 @@ class OC_Migration_Content{
|
||||||
unlink( $i );
|
unlink( $i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* @return array appdata to be exported
|
||||||
*/
|
*/
|
||||||
abstract function export( );
|
abstract function export( );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @breif imports data for the app
|
* @brief imports data for the app
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
abstract function import( );
|
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
|
* @param $content a OC_Migration_Content object
|
||||||
*/
|
*/
|
||||||
public function setData( $uid, $content, $info=null ){
|
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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getID(){
|
public function getID(){
|
||||||
|
|
|
@ -29,14 +29,14 @@ $(document).ready(function(){
|
||||||
if(app){
|
if(app){
|
||||||
if(active){
|
if(active){
|
||||||
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app},function(result){
|
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app},function(result){
|
||||||
if(!result || result.status!='succes'){
|
if(!result || result.status!='success'){
|
||||||
OC.dialogs.alert('Error','Error while disabling app');
|
OC.dialogs.alert('Error','Error while disabling app');
|
||||||
}
|
}
|
||||||
},'json');
|
},'json');
|
||||||
$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
|
$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
|
||||||
}else{
|
}else{
|
||||||
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app},function(result){
|
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app},function(result){
|
||||||
if(!result || result.status!='succes'){
|
if(!result || result.status!='success'){
|
||||||
OC.dialogs.alert('Error','Error while enabling app');
|
OC.dialogs.alert('Error','Error while enabling app');
|
||||||
}
|
}
|
||||||
},'json');
|
},'json');
|
||||||
|
|
Loading…
Reference in New Issue