Merge branch 'master' into oc_error
This commit is contained in:
commit
b8275691e7
|
@ -1,9 +1,4 @@
|
|||
<?php
|
||||
$l=OC_L10N::get('admin_dependencies_chk');
|
||||
|
||||
OCP\App::register( array(
|
||||
'order' => 14,
|
||||
'id' => 'admin_dependencies_chk',
|
||||
'name' => 'Owncloud Install Info' ));
|
||||
|
||||
OCP\App::registerAdmin('admin_dependencies_chk','settings');
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
|
||||
OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php';
|
||||
|
||||
OCP\App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' ));
|
||||
|
||||
$l = new OC_l10n('bookmarks');
|
||||
OCP\App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo( 'bookmarks', 'index.php' ), 'icon' => OCP\Util::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
|
||||
|
||||
|
|
|
@ -7,16 +7,23 @@
|
|||
*/
|
||||
//check for calendar rights or create new one
|
||||
ob_start();
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('calendar');
|
||||
|
||||
$nl="\r\n";
|
||||
$comps = array('VEVENT'=>true, 'VTODO'=>true, 'VJOURNAL'=>true);
|
||||
|
||||
$progressfile = 'import_tmp/' . md5(session_id()) . '.txt';
|
||||
|
||||
function writeProgress($pct) {
|
||||
if(is_writable('import_tmp/')){
|
||||
$progressfopen = fopen($progressfile, 'w');
|
||||
fwrite($progressfopen, '10');
|
||||
fwrite($progressfopen, $pct);
|
||||
fclose($progressfopen);
|
||||
}
|
||||
}
|
||||
writeProgress('10');
|
||||
$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
|
||||
if($_POST['method'] == 'new'){
|
||||
$id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), $_POST['calname']);
|
||||
|
@ -29,20 +36,12 @@ if($_POST['method'] == 'new'){
|
|||
}
|
||||
$id = $_POST['id'];
|
||||
}
|
||||
if(is_writable('import_tmp/')){
|
||||
$progressfopen = fopen($progressfile, 'w');
|
||||
fwrite($progressfopen, '20');
|
||||
fclose($progressfopen);
|
||||
}
|
||||
writeProgress('20');
|
||||
// normalize the newlines
|
||||
$file = str_replace(array("\r","\n\n"), array("\n","\n"), $file);
|
||||
$lines = explode("\n", $file);
|
||||
unset($file);
|
||||
if(is_writable('import_tmp/')){
|
||||
$progressfopen = fopen($progressfile, 'w');
|
||||
fwrite($progressfopen, '30');
|
||||
fclose($progressfopen);
|
||||
}
|
||||
writeProgress('30');
|
||||
// analyze the file, group components by uid, and keep refs to originating calendar object
|
||||
// $cals is array calendar objects, keys are 1st line# $cal, ie array( $cal => $caldata )
|
||||
// $caldata is array( 'first' => 1st component line#, 'last' => last comp line#, 'end' => end line# )
|
||||
|
@ -86,11 +85,7 @@ foreach($lines as $line) {
|
|||
$i++;
|
||||
}
|
||||
// import the calendar
|
||||
if(is_writable('import_tmp/')){
|
||||
$progressfopen = fopen($progressfile, 'w');
|
||||
fwrite($progressfopen, '60');
|
||||
fclose($progressfopen);
|
||||
}
|
||||
writeProgress('60');
|
||||
foreach($uids as $uid) {
|
||||
|
||||
$prefix=$suffix=$content=array();
|
||||
|
@ -117,11 +112,7 @@ foreach($uids as $uid) {
|
|||
}
|
||||
}
|
||||
// finished import
|
||||
if(is_writable('import_tmp/')){
|
||||
$progressfopen = fopen($progressfile, 'w');
|
||||
fwrite($progressfopen, '100');
|
||||
fclose($progressfopen);
|
||||
}
|
||||
writeProgress('100');
|
||||
sleep(3);
|
||||
if(is_writable('import_tmp/')){
|
||||
unlink($progressfile);
|
||||
|
|
|
@ -11,10 +11,6 @@ OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'delete
|
|||
OCP\Util::addscript('calendar','loader');
|
||||
OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min");
|
||||
OCP\Util::addStyle("3rdparty", "chosen/chosen");
|
||||
OCP\App::register( array(
|
||||
'order' => 10,
|
||||
'id' => 'calendar',
|
||||
'name' => 'Calendar' ));
|
||||
OCP\App::addNavigationEntry( array(
|
||||
'id' => 'calendar_index',
|
||||
'order' => 10,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
echo '<td width="20px"><input id="active_' . $_['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Calendar.activation(this,' . $_['calendar']['id'] . ')"' . ($_['calendar']['active'] ? ' checked="checked"' : '') . '></td>';
|
||||
echo '<td id="' . OCP\USER::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . $_['calendar']['displayname'] . '</label></td>';
|
||||
echo '<td id="' . OCP\USER::getUser() . '_' . $_['calendar']['id'] . '"><label for="active_' . $_['calendar']['id'] . '">' . htmlspecialchars($_['calendar']['displayname']) . '</label></td>';
|
||||
echo '<td width="20px"><a href="#" onclick="Calendar.UI.Share.dropdown(\'' . OCP\USER::getUser() . '\', \'' . $_['calendar']['id'] . '\');" title="' . $l->t("Share Calendar") . '" class="action"><img class="svg action" src="' . ((!$_['shared']) ? OCP\Util::imagePath('core', 'actions/share.svg') : OCP\Util::imagePath('core', 'actions/shared.svg')) . '"></a></td>';
|
||||
echo '<td width="20px"><a href="#" onclick="Calendar.UI.showCalDAVUrl(\'' . OCP\USER::getUser() . '\', \'' . $_['calendar']['uri'] . '\');" title="' . $l->t("CalDav Link") . '" class="action"><img class="svg action" src="'.OCP\Util::imagePath('core', 'actions/public.svg').'"></a></td>';
|
||||
echo '<td width="20px"><a href="?app=calendar&getfile=export.php?calid=' . $_['calendar']['id'] . '" title="' . $l->t('Download') . '" class="action"><img class="svg action" src="'.OCP\Util::imagePath('core', 'actions/download.svg').'"></a></td>';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
echo '<td width="20px"><input id="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '" type="checkbox" onClick="Calendar.UI.Share.activation(this,\'' . $_['share']['owner'] . '\',' . $_['share']['calendar']['id'] . ')"' . ($_['share']['active'] ? ' checked="checked"' : '') . '></td>';
|
||||
echo '<td><label for="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '">' . $_['share']['calendar']['displayname'] . '</label></td>';
|
||||
echo '<td><label for="active_' . $_['share']['owner'] . '_' . $_['share']['calendar']['id'] . '">' . htmlspecialchars($_['share']['calendar']['displayname']) . '</label></td>';
|
||||
echo '<td style="font-style: italic;">' . $l->t('shared with you by') . ' ' . $_['share']['owner'] . '</td>';
|
|
@ -9,11 +9,6 @@ OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'delete
|
|||
OCP\Util::connectHook('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents');
|
||||
OCP\Util::connectHook('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources');
|
||||
|
||||
OCP\App::register( array(
|
||||
'order' => 10,
|
||||
'id' => 'contacts',
|
||||
'name' => 'Contacts' ));
|
||||
|
||||
OCP\App::addNavigationEntry( array(
|
||||
'id' => 'contacts_index',
|
||||
'order' => 10,
|
||||
|
|
|
@ -26,8 +26,6 @@ OCP\Util::addStyle( 'external', 'style');
|
|||
|
||||
OCP\App::registerAdmin('external', 'settings');
|
||||
|
||||
OCP\App::register(array('order' => 70, 'id' => 'external', 'name' => 'External'));
|
||||
|
||||
$sites = OC_External::getSites();
|
||||
for ($i = 0; $i < sizeof($sites); $i++) {
|
||||
OCP\App::addNavigationEntry(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
// FIXME: this should start a secure session if forcessl is enabled
|
||||
// see lib/base.php for an example
|
||||
session_start();
|
||||
//session_start();
|
||||
$_SESSION['timezone'] = $_GET['time'];
|
||||
?>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
$l=OC_L10N::get('files');
|
||||
|
||||
OCP\App::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
|
||||
OCP\App::registerAdmin('files','admin');
|
||||
|
||||
OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") ));
|
||||
|
|
|
@ -74,11 +74,11 @@ foreach( explode( '/', $dir ) as $i ){
|
|||
// make breadcrumb und filelist markup
|
||||
$list = new OCP\Template( 'files', 'part.list', '' );
|
||||
$list->assign( 'files', $files );
|
||||
$list->assign( 'baseURL', OCP\Util::linkTo('files', 'index.php').'?dir=');
|
||||
$list->assign( 'baseURL', OCP\Util::linkTo('files', 'index.php').'&dir=');
|
||||
$list->assign( 'downloadURL', OCP\Util::linkTo('files', 'download.php').'?file=');
|
||||
$breadcrumbNav = new OCP\Template( 'files', 'part.breadcrumb', '' );
|
||||
$breadcrumbNav->assign( 'breadcrumb', $breadcrumb );
|
||||
$breadcrumbNav->assign( 'baseURL', OCP\Util::linkTo('files', 'index.php').'?dir=');
|
||||
$breadcrumbNav->assign( 'baseURL', OCP\Util::linkTo('files', 'index.php').'&dir=');
|
||||
|
||||
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
|
||||
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
|
||||
|
|
|
@ -161,7 +161,7 @@ FileActions.register('all','Rename',function(){return OC.imagePath('core','actio
|
|||
});
|
||||
|
||||
FileActions.register('dir','Open','',function(filename){
|
||||
window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
window.location=OC.linkTo('files', 'index.php') + '&dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
});
|
||||
|
||||
FileActions.setDefault('dir','Open');
|
||||
|
|
|
@ -41,7 +41,7 @@ FileList={
|
|||
html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name});
|
||||
td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
|
||||
td.append('<input type="checkbox" />');
|
||||
var link_elem = $('<a></a>').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
|
||||
var link_elem = $('<a></a>').attr({ "class": "name", "href": OC.linkTo('files', 'index.php')+"&dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
|
||||
link_elem.append($('<span></span>').addClass('nametext').text(name));
|
||||
link_elem.append($('<span></span>').attr({'class': 'uploadtext', 'currentUploads': 0}));
|
||||
td.append(link_elem);
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
$(document).ready(function() {
|
||||
if(typeof FileActions!=='undefined'){
|
||||
FileActions.register('application/zip','Open','',function(filename){
|
||||
window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
window.location=OC.linkTo('files', 'index.php')+'&dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
});
|
||||
FileActions.setDefault('application/zip','Open');
|
||||
FileActions.register('application/x-gzip','Open','',function(filename){
|
||||
window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
window.location=OC.linkTo('files', 'index.php')+'&dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
|
||||
});
|
||||
FileActions.setDefault('application/x-gzip','Open');
|
||||
}
|
||||
|
|
|
@ -44,7 +44,13 @@ class OC_Crypt {
|
|||
}
|
||||
|
||||
public static function init($login,$password) {
|
||||
$view1=new OC_FilesystemView('/');
|
||||
if(!$view1->file_exists('/'.$login)){
|
||||
$view1->mkdir('/'.$login);
|
||||
}
|
||||
|
||||
$view=new OC_FilesystemView('/'.$login);
|
||||
|
||||
OC_FileProxy::$enabled=false;
|
||||
if(!$view->file_exists('/encryption.key')){// does key exist?
|
||||
OC_Crypt::createkey($login,$password);
|
||||
|
@ -54,6 +60,7 @@ class OC_Crypt {
|
|||
$_SESSION['enckey']=OC_Crypt::decrypt($key, $password);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the blowfish encryption handeler for a key
|
||||
* @param string $key (optional)
|
||||
|
|
|
@ -7,7 +7,7 @@ $type = (strpos($_POST['file'], '.') === false) ? 'folder' : 'file';
|
|||
$subject = $user.' shared a '.$type.' with you';
|
||||
$link = $_POST['link'];
|
||||
$text = $user.' shared the '.$type.' '.$_POST['file'].' with you. It is available for download here: '.$link;
|
||||
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.$_SERVER['HTTP_HOST']);
|
||||
$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.OCP\Util::getServerHost());
|
||||
OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
|
||||
|
||||
?>
|
|
@ -2,12 +2,6 @@
|
|||
|
||||
require_once('apps/files_versions/versions.php');
|
||||
|
||||
// Add an entry in the app list
|
||||
OCP\App::register( array(
|
||||
'order' => 10,
|
||||
'id' => 'files_versions',
|
||||
'name' => 'Versioning' ));
|
||||
|
||||
OCP\App::registerAdmin('files_versions', 'settings');
|
||||
OCP\Util::addscript('files_versions', 'versions');
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class Storage {
|
|||
Storage::init();
|
||||
|
||||
// check if filename is a directory
|
||||
if(is_dir($filesfoldername.$filename)){
|
||||
if(is_dir($filesfoldername.'/'.$filename)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,14 @@ class Storage {
|
|||
}
|
||||
|
||||
// check filesize
|
||||
if(filesize($filesfoldername.$filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
|
||||
if(filesize($filesfoldername.'/'.$filename)>\OCP\Config::getSystemValue('files_versionsmaxfilesize', Storage::DEFAULTMAXFILESIZE)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval)
|
||||
if ($uid == \OCP\User::getUser()) {
|
||||
$matches=glob($versionsfoldername.$filename.'.v*');
|
||||
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
|
||||
sort($matches);
|
||||
$parts=explode('.v',end($matches));
|
||||
if((end($parts)+Storage::DEFAULTMININTERVAL)>time()){
|
||||
|
@ -114,10 +114,10 @@ class Storage {
|
|||
|
||||
// create all parent folders
|
||||
$info=pathinfo($filename);
|
||||
@mkdir($versionsfoldername.$info['dirname'],0700,true);
|
||||
if(!file_exists($versionsfoldername.'/'.$info['dirname'])) mkdir($versionsfoldername.'/'.$info['dirname'],0700,true);
|
||||
|
||||
// store a new version of a file
|
||||
copy($filesfoldername.$filename,$versionsfoldername.$filename.'.v'.time());
|
||||
copy($filesfoldername.'/'.$filename,$versionsfoldername.'/'.$filename.'.v'.time());
|
||||
|
||||
// expire old revisions
|
||||
Storage::expire($filename);
|
||||
|
@ -143,7 +143,7 @@ class Storage {
|
|||
$filesfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/files';
|
||||
|
||||
// rollback
|
||||
if ( @copy($versionsfoldername.$filename.'.v'.$revision,$filesfoldername.$filename) ) {
|
||||
if ( @copy($versionsfoldername.'/'.$filename.'.v'.$revision,$filesfoldername.'/'.$filename) ) {
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -172,7 +172,7 @@ class Storage {
|
|||
$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
|
||||
|
||||
// check for old versions
|
||||
$matches=glob($versionsfoldername.$filename.'.v*');
|
||||
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
|
||||
if(count($matches)>1){
|
||||
return true;
|
||||
}else{
|
||||
|
@ -201,7 +201,7 @@ class Storage {
|
|||
$versions=array();
|
||||
|
||||
// fetch for old versions
|
||||
$matches=glob($versionsfoldername.$filename.'.v*');
|
||||
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
|
||||
sort($matches);
|
||||
foreach($matches as $ma) {
|
||||
$parts=explode('.v',$ma);
|
||||
|
@ -238,14 +238,14 @@ class Storage {
|
|||
$versionsfoldername=\OCP\Config::getSystemValue('datadirectory').'/'. $uid .'/'.\OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
|
||||
|
||||
// check for old versions
|
||||
$matches=glob($versionsfoldername.$filename.'.v*');
|
||||
$matches=glob($versionsfoldername.'/'.$filename.'.v*');
|
||||
if(count($matches)>\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS)){
|
||||
$numbertodelete=count($matches-\OCP\Config::getSystemValue('files_versionmaxversions', Storage::DEFAULTMAXVERSIONS));
|
||||
|
||||
// delete old versions of a file
|
||||
$deleteitems=array_slice($matches,0,$numbertodelete);
|
||||
foreach($deleteitems as $de){
|
||||
unlink($versionsfoldername.$filename.'.v'.$de);
|
||||
unlink($versionsfoldername.'/'.$filename.'.v'.$de);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,11 +29,6 @@ OC::$CLASSPATH['OC_Gallery_Hooks_Handlers'] = 'apps/gallery/lib/hooks_handlers.p
|
|||
|
||||
$l = OC_L10N::get('gallery');
|
||||
|
||||
OCP\App::register(array(
|
||||
'order' => 20,
|
||||
'id' => 'gallery',
|
||||
'name' => 'Pictures'));
|
||||
|
||||
OCP\App::addNavigationEntry( array(
|
||||
'id' => 'gallery_index',
|
||||
'order' => 20,
|
||||
|
|
|
@ -29,8 +29,6 @@ require_once('apps/media/lib_scanner.php');
|
|||
OCP\Util::addscript('media','loader');
|
||||
OCP\App::registerPersonal('media','settings');
|
||||
|
||||
OCP\App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
|
||||
|
||||
OCP\App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music')));
|
||||
|
||||
OC_Search::registerProvider('OC_MediaSearchProvider');
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
<?php
|
||||
OCP\App::register( array(
|
||||
'order' => 10,
|
||||
'id' => 'remoteStorage',
|
||||
'name' => 'remoteStorage compatibility' ));
|
||||
OCP\App::registerPersonal('remoteStorage','settings');
|
||||
|
|
|
@ -3,11 +3,6 @@ $l=new OC_L10N('tasks');
|
|||
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
|
||||
OC::$CLASSPATH['OC_Task_App'] = 'apps/tasks/lib/app.php';
|
||||
|
||||
OCP\App::register( array(
|
||||
'order' => 11,
|
||||
'id' => 'tasks',
|
||||
'name' => 'Tasks' ));
|
||||
|
||||
OCP\App::addNavigationEntry( array(
|
||||
'id' => 'tasks_index',
|
||||
'order' => 11,
|
||||
|
|
|
@ -26,7 +26,6 @@ OCP\Util::addScript('','oc-vcategories');
|
|||
OCP\App::setActiveNavigationEntry('tasks_index');
|
||||
|
||||
$categories = OC_Calendar_App::getCategoryOptions();
|
||||
$l10n = new OC_L10N('tasks');
|
||||
$priority_options = OC_Task_App::getPriorityOptions();
|
||||
$output = new OCP\Template('tasks', 'tasks', 'user');
|
||||
$output->assign('priority_options', $priority_options);
|
||||
|
|
|
@ -25,10 +25,15 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
// //group specific settings
|
||||
protected $ldapGroupFilter;
|
||||
protected $ldapGroupMemberAssocAttr;
|
||||
protected $configured = false;
|
||||
|
||||
public function __construct() {
|
||||
$this->ldapGroupFilter = OCP\Config::getAppValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
|
||||
$this->ldapGroupMemberAssocAttr = OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember');
|
||||
|
||||
if(!empty($this->ldapGroupFilter) && !empty($this->ldapGroupMemberAssocAttr)) {
|
||||
$this->configured = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,6 +45,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
* Checks whether the user is member of a group or not.
|
||||
*/
|
||||
public function inGroup($uid, $gid) {
|
||||
if(!$this->configured) {
|
||||
return false;
|
||||
}
|
||||
$dn_user = OC_LDAP::username2dn($uid);
|
||||
$dn_group = OC_LDAP::groupname2dn($gid);
|
||||
// just in case
|
||||
|
@ -79,6 +87,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
* if the user exists at all.
|
||||
*/
|
||||
public function getUserGroups($uid) {
|
||||
if(!$this->configured) {
|
||||
return array();
|
||||
}
|
||||
$userDN = OC_LDAP::username2dn($uid);
|
||||
if(!$userDN) {
|
||||
return array();
|
||||
|
@ -111,6 +122,10 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
* @returns array with user ids
|
||||
*/
|
||||
public function usersInGroup($gid) {
|
||||
if(!$this->configured) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$groupDN = OC_LDAP::groupname2dn($gid);
|
||||
if(!$groupDN) {
|
||||
return array();
|
||||
|
@ -149,6 +164,10 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
* Returns a list with all groups
|
||||
*/
|
||||
public function getGroups() {
|
||||
if(!$this->configured) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
|
||||
$groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
|
||||
return $groups;
|
||||
|
|
|
@ -366,19 +366,24 @@ class OC_LDAP {
|
|||
$table = self::getMapTable($isUser);
|
||||
$dn = self::sanitizeDN($dn);
|
||||
|
||||
$sqliteAdjustment = '';
|
||||
$sqlAdjustment = '';
|
||||
$dbtype = OCP\Config::getSystemValue('dbtype');
|
||||
if(($dbtype == 'sqlite') || ($dbtype == 'sqlite3')) {
|
||||
$sqliteAdjustment = 'OR';
|
||||
if($dbtype == 'mysql') {
|
||||
$sqlAdjustment = 'FROM dual';
|
||||
}
|
||||
|
||||
$insert = OCP\DB::prepare('
|
||||
INSERT '.$sqliteAdjustment.' IGNORE INTO '.$table.'
|
||||
(ldap_dn, owncloud_name)
|
||||
VALUES (?,?)
|
||||
INSERT INTO '.$table.' (ldap_dn, owncloud_name)
|
||||
SELECT ?,?
|
||||
'.$sqlAdjustment.'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM '.$table.'
|
||||
WHERE ldap_dn = ?
|
||||
AND owncloud_name = ? )
|
||||
');
|
||||
|
||||
$res = $insert->execute(array($dn, $ocname));
|
||||
$res = $insert->execute(array($dn, $ocname, $dn, $ocname));
|
||||
|
||||
return !OCP\DB::isError($res);
|
||||
}
|
||||
|
|
|
@ -1624,7 +1624,7 @@ if (! array_key_exists('idp_url', $profile))
|
|||
//Determine the requested URL - DO NOT OVERRIDE
|
||||
$profile['req_url'] = sprintf("%s://%s%s",
|
||||
$proto,
|
||||
$_SERVER['HTTP_HOST'],
|
||||
OCP\Util::getServerHost(),
|
||||
// $port,//host already includes the path
|
||||
$_SERVER["REQUEST_URI"]);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<form id="openidform">
|
||||
<fieldset class="personalblock">
|
||||
<strong>OpenID</strong>
|
||||
<?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.OCP\Util::getServerHost().OC::$WEBROOT.'/?'; echo OCP\USER::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br />
|
||||
<?php echo (OCP\Util::getServerProtocol()).'://'.OCP\Util::getServerHost().OC::$WEBROOT.'/?'; echo OCP\USER::getUser(); ?><br /><em><?php echo $l->t('you can authenticate to other sites with this address');?></em><br />
|
||||
<label for="identity"><?php echo $l->t('Authorized OpenID provider');?></label>
|
||||
<input type="text" name="identity" id="identity" value="<?php echo $_['identity']; ?>" placeholder="<?php echo $l->t('Your address at Wordpress, Identi.ca, …');?>" /><span class="msg"></span>
|
||||
</fieldset>
|
||||
|
|
|
@ -39,9 +39,9 @@ class OC_USER_OPENID extends OC_User_Backend {
|
|||
// Get identity from user and redirect browser to OpenID Server
|
||||
$openid = new SimpleOpenID;
|
||||
$openid->SetIdentity($uid);
|
||||
$openid->SetTrustRoot('http://' . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetTrustRoot('http://' . OCP\Util::getServerHost());
|
||||
if ($openid->GetOpenIDServer()){
|
||||
$openid->SetApprovedURL('http://' . $_SERVER["HTTP_HOST"] . OC::$WEBROOT); // Send Response from OpenID server to this script
|
||||
$openid->SetApprovedURL('http://' . OCP\Util::getServerHost() . OC::$WEBROOT); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
exit;
|
||||
}else{
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
<?php
|
||||
OCP\App::register( array(
|
||||
'order' => 11,
|
||||
'id' => 'user_webfinger',
|
||||
'name' => 'Webfinger' ));
|
||||
OCP\CONFIG::setAppValue('core', 'public_host-meta', '/apps/user_webfinger/host-meta.php');
|
||||
OCP\CONFIG::setAppValue('core', 'public_webfinger', '/apps/user_webfinger/webfinger.php');
|
||||
|
|
|
@ -23,7 +23,7 @@ $CONFIG = array(
|
|||
"sysinfoexception" => true,
|
||||
"mail_smtpmode" => "sendmail",
|
||||
"mail_smtphost" => "127.0.0.1",
|
||||
"mail_smtpauth" => "false",
|
||||
"mail_smtpauth" => false,
|
||||
"mail_smtpname" => "",
|
||||
"mail_smtppassword" => "",
|
||||
"appcodechecker" => "",
|
||||
|
|
|
@ -22,7 +22,7 @@ if (isset($_POST['user'])) {
|
|||
$tmpl->assign('link', $link);
|
||||
$msg = $tmpl->fetchPage();
|
||||
$l = OC_L10N::get('core');
|
||||
$from = 'lostpassword-noreply@' . $_SERVER['HTTP_HOST'];
|
||||
$from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
|
||||
$r=mail($email, $l->t('Owncloud password reset'), $msg, 'From:' . $from);
|
||||
OC_MAIL::send($email,$_POST['user'],$l->t('ownCloud password reset'),$msg,$from,'ownCloud');
|
||||
echo('sent');
|
||||
|
|
40
lib/app.php
40
lib/app.php
|
@ -28,7 +28,6 @@
|
|||
*/
|
||||
class OC_App{
|
||||
static private $init = false;
|
||||
static private $apps = array();
|
||||
static private $activeapp = '';
|
||||
static private $navigation = array();
|
||||
static private $settingsForms = array();
|
||||
|
@ -54,14 +53,7 @@ class OC_App{
|
|||
return true;
|
||||
}
|
||||
|
||||
// Our very own core apps are hardcoded
|
||||
foreach( array( 'settings') as $app ){
|
||||
if(is_null($types)){
|
||||
require( $app.'/appinfo/app.php' );
|
||||
}
|
||||
}
|
||||
|
||||
// The rest comes here
|
||||
// Load the enabled apps here
|
||||
$apps = self::getEnabledApps();
|
||||
// prevent app.php from printing output
|
||||
ob_start();
|
||||
|
@ -216,36 +208,6 @@ class OC_App{
|
|||
OC_Appconfig::setValue( $app, 'enabled', 'no' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief makes owncloud aware of this app
|
||||
* @param $data array with all information
|
||||
* @returns true/false
|
||||
*
|
||||
* This function registers the application. $data is an associative array.
|
||||
* The following keys are required:
|
||||
* - id: id of the application, has to be unique ('addressbook')
|
||||
* - name: Human readable name ('Addressbook')
|
||||
* - version: array with Version (major, minor, bugfix) ( array(1, 0, 2))
|
||||
*
|
||||
* The following keys are optional:
|
||||
* - order: integer, that influences the position of your application in
|
||||
* a list of applications. Lower values come first.
|
||||
*
|
||||
*/
|
||||
public static function register( $data ){
|
||||
OC_App::$apps[] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief returns information of all apps
|
||||
* @return array with all information
|
||||
*
|
||||
* This function returns all data it got via register().
|
||||
*/
|
||||
public static function get(){
|
||||
return OC_App::$apps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief adds an entry to the navigation
|
||||
* @param $data array containing the data
|
||||
|
|
15
lib/base.php
15
lib/base.php
|
@ -214,8 +214,8 @@ class OC{
|
|||
// redirect to https site if configured
|
||||
if( OC_Config::getValue( "forcessl", false )){
|
||||
ini_set("session.cookie_secure", "on");
|
||||
if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') {
|
||||
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
||||
if(OC_Helper::serverProtocol()<>'https') {
|
||||
$url = "https://". OC_Helper::serverHost() . $_SERVER['REQUEST_URI'];
|
||||
header("Location: $url");
|
||||
exit();
|
||||
}
|
||||
|
@ -329,6 +329,11 @@ class OC{
|
|||
date_default_timezone_set('UTC');
|
||||
ini_set('arg_separator.output','&');
|
||||
|
||||
// try to switch magic quotes off.
|
||||
if(function_exists('set_magic_quotes_runtime')) {
|
||||
@set_magic_quotes_runtime(false);
|
||||
}
|
||||
|
||||
//try to configure php to enable big file uploads.
|
||||
//this doesn´t work always depending on the webserver and php configuration.
|
||||
//Let´s try to overwrite some defaults anyways
|
||||
|
@ -376,11 +381,11 @@ class OC{
|
|||
|
||||
// CSRF protection
|
||||
if(isset($_SERVER['HTTP_REFERER'])) $referer=$_SERVER['HTTP_REFERER']; else $referer='';
|
||||
if(isset($_SERVER['HTTPS']) and $_SERVER['HTTPS']<>'') $protocol='https://'; else $protocol='http://';
|
||||
$protocol=OC_Helper::serverProtocol().'://';
|
||||
if(!self::$CLI){
|
||||
$server=$protocol.$_SERVER['SERVER_NAME'];
|
||||
$server=$protocol.OC_Helper::serverHost();
|
||||
if(($_SERVER['REQUEST_METHOD']=='POST') and (substr($referer,0,strlen($server))<>$server)) {
|
||||
$url = $protocol.$_SERVER['SERVER_NAME'].OC::$WEBROOT.'/index.php';
|
||||
$url = $protocol.OC_Helper::serverProtocol().OC::$WEBROOT.'/index.php';
|
||||
header("Location: $url");
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ class OC_FileCache{
|
|||
}
|
||||
return $result;
|
||||
}else{
|
||||
OC_Log::write('files','getChached(): file not found in cache ('.$path.')',OC_Log::DEBUG);
|
||||
OC_Log::write('files','getCached(): file not found in cache ('.$path.')',OC_Log::DEBUG);
|
||||
if(isset(self::$savedData[$path])){
|
||||
return self::$savedData[$path];
|
||||
}else{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Privde a common interface to all different storage options
|
||||
* Provde a common interface to all different storage options
|
||||
*/
|
||||
abstract class OC_Filestorage{
|
||||
public function __construct($parameters){}
|
||||
|
|
|
@ -18,7 +18,24 @@
|
|||
*
|
||||
* 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 to provide access to ownCloud filesystem via a "view", and methods for
|
||||
* working with files within that view (e.g. read, write, delete, etc.). Each
|
||||
* view is restricted to a set of directories via a virtual root. The default view
|
||||
* uses the currently logged in user's data directory as root (parts of
|
||||
* OC_Filesystem are merely a wrapper for OC_FilesystemView).
|
||||
*
|
||||
* Apps that need to access files outside of the user data folders (to modify files
|
||||
* belonging to a user other than the one currently logged in, for example) should
|
||||
* use this class directly rather than using OC_Filesystem, or making use of PHP's
|
||||
* built-in file manipulation functions. This will ensure all hooks and proxies
|
||||
* are triggered correctly.
|
||||
*
|
||||
* Filesystem functions are not called directly; they are passed to the correct
|
||||
* OC_Filestorage object
|
||||
*/
|
||||
|
||||
class OC_FilesystemView {
|
||||
|
@ -103,7 +120,9 @@ class OC_FilesystemView {
|
|||
}
|
||||
|
||||
/**
|
||||
* following functions are equivilent to their php buildin equivilents for arguments/return values.
|
||||
* the following functions operate with arguments and return values identical
|
||||
* to those of their PHP built-in equivalents. Mostly they are merely wrappers
|
||||
* for OC_Filestorage via basicOperation().
|
||||
*/
|
||||
public function mkdir($path){
|
||||
return $this->basicOperation('mkdir',$path,array('create','write'));
|
||||
|
@ -336,16 +355,20 @@ class OC_FilesystemView {
|
|||
}
|
||||
|
||||
/**
|
||||
* abstraction for running most basic operations
|
||||
* @brief abstraction layer for basic filesystem functions: wrapper for OC_Filestorage
|
||||
* @param string $operation
|
||||
* @param string #path
|
||||
* @param array (optional) hooks
|
||||
* @param mixed (optional) $extraParam
|
||||
* @return mixed
|
||||
*
|
||||
* This method takes requests for basic filesystem functions (e.g. reading & writing
|
||||
* files), processes hooks and proxies, sanitises paths, and finally passes them on to
|
||||
* OC_Filestorage for delegation to a storage backend for execution
|
||||
*/
|
||||
private function basicOperation($operation,$path,$hooks=array(),$extraParam=null){
|
||||
if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and OC_Filesystem::isValidPath($path)){
|
||||
$interalPath=$this->getInternalPath($path);
|
||||
$internalPath=$this->getInternalPath($path);
|
||||
$run=true;
|
||||
if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()){
|
||||
foreach($hooks as $hook){
|
||||
|
@ -358,9 +381,9 @@ class OC_FilesystemView {
|
|||
}
|
||||
if($run and $storage=$this->getStorage($path)){
|
||||
if(!is_null($extraParam)){
|
||||
$result=$storage->$operation($interalPath,$extraParam);
|
||||
$result=$storage->$operation($internalPath,$extraParam);
|
||||
}else{
|
||||
$result=$storage->$operation($interalPath);
|
||||
$result=$storage->$operation($internalPath);
|
||||
}
|
||||
$result=OC_FileProxy::runPostProxies($operation,$path,$result);
|
||||
if(OC_Filesystem::$loaded and $this->fakeRoot==OC_Filesystem::getRoot()){
|
||||
|
|
|
@ -233,6 +233,7 @@ class OC_Group {
|
|||
|
||||
$groups=array_merge($backend->getUserGroups($uid),$groups);
|
||||
}
|
||||
asort($groups);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
@ -250,6 +251,7 @@ class OC_Group {
|
|||
|
||||
$groups=array_merge($backend->getGroups(),$groups);
|
||||
}
|
||||
asort($groups);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,27 @@ class OC_Helper {
|
|||
return $host;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns the server protocol
|
||||
* @returns the server protocol
|
||||
*
|
||||
* Returns the server protocol. It respects reverse proxy servers and load balancers
|
||||
*/
|
||||
public static function serverProtocol() {
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
|
||||
$proto = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
|
||||
}else{
|
||||
if(isset($_SERVER['HTTPS']) and !empty($_SERVER['HTTPS']) and ($_SERVER['HTTPS']!='off')) {
|
||||
$proto = 'https';
|
||||
}else{
|
||||
$proto = 'http';
|
||||
}
|
||||
}
|
||||
return($proto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Creates an absolute url
|
||||
* @param $app app
|
||||
|
@ -99,9 +120,7 @@ class OC_Helper {
|
|||
*/
|
||||
public static function linkToAbsolute( $app, $file ) {
|
||||
$urlLinkTo = self::linkTo( $app, $file );
|
||||
// Checking if the request was made through HTTPS. The last in line is for IIS
|
||||
$protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off');
|
||||
$urlLinkTo = ($protocol?'https':'http') . '://' . self::serverHost() . $urlLinkTo;
|
||||
$urlLinkTo = OC_Helper::serverProtocol(). '://' . self::serverHost() . $urlLinkTo;
|
||||
return $urlLinkTo;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,22 +63,25 @@ class OC_Log_Owncloud {
|
|||
self::init();
|
||||
$minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN );
|
||||
$entries = array();
|
||||
if(!file_exists(self::$logFile)) {
|
||||
return array();
|
||||
}
|
||||
$contents=file(self::$logFile);
|
||||
if(!$contents) {//error while reading log
|
||||
return array();
|
||||
}
|
||||
$end=max(count($contents)-$offset-1, 0);
|
||||
$start=max($end-$limit,0);
|
||||
$i=$end;
|
||||
while($i>$start){
|
||||
$entry=json_decode($contents[$i]);
|
||||
$handle = fopen(self::$logFile, 'r');
|
||||
if ($handle) {
|
||||
// Just a guess to set the file pointer to the right spot
|
||||
$maxLineLength = 150;
|
||||
fseek($handle, -($limit * $maxLineLength + $offset * $maxLineLength), SEEK_END);
|
||||
// Skip first line, because it is most likely a partial line
|
||||
fgets($handle);
|
||||
while (!feof($handle)) {
|
||||
$line = fgets($handle);
|
||||
if (!empty($line)) {
|
||||
$entry = json_decode($line);
|
||||
if ($entry->level >= $minLevel) {
|
||||
$entries[] = $entry;
|
||||
}
|
||||
$i--;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
// Extract the needed entries and reverse the order
|
||||
$entries = array_reverse(array_slice($entries, -($limit + $offset), $limit));
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class OC_Mail {
|
|||
|
||||
$SMTPMODE = OC_Config::getValue( 'mail_smtpmode', 'sendmail' );
|
||||
$SMTPHOST = OC_Config::getValue( 'mail_smtphost', '127.0.0.1' );
|
||||
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', 'false' );
|
||||
$SMTPAUTH = OC_Config::getValue( 'mail_smtpauth', false );
|
||||
$SMTPUSERNAME = OC_Config::getValue( 'mail_smtpname', '' );
|
||||
$SMTPPASSWORD = OC_Config::getValue( 'mail_smtppassword', '' );
|
||||
|
||||
|
|
|
@ -357,11 +357,11 @@ class OC_OCS {
|
|||
*/
|
||||
private static function apiConfig($format) {
|
||||
$user=OC_OCS::checkpassword(false);
|
||||
$url=substr($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'],0,-11).'';
|
||||
$url=substr(OCP\Util::getServerHost().$_SERVER['SCRIPT_NAME'],0,-11).'';
|
||||
|
||||
$xml['version']='1.5';
|
||||
$xml['website']='ownCloud';
|
||||
$xml['host']=$_SERVER['HTTP_HOST'];
|
||||
$xml['host']=OCP\Util::getServerHost();
|
||||
$xml['contact']='';
|
||||
$xml['ssl']='false';
|
||||
echo(OC_OCS::generatexml($format,'ok',100,'',$xml,'config','',1));
|
||||
|
|
|
@ -52,7 +52,6 @@ class App {
|
|||
*
|
||||
*/
|
||||
public static function register( $data ){
|
||||
return \OC_App::register( $data );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -168,6 +168,16 @@ class Util {
|
|||
return(\OC_Helper::serverHost());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the server protocol
|
||||
* @returns the server protocol
|
||||
*
|
||||
* Returns the server protocol. It respects reverse proxy servers and load balancers
|
||||
*/
|
||||
public static function getServerProtocol() {
|
||||
return(\OC_Helper::serverProtocol());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates path to an image
|
||||
* @param $app app
|
||||
|
|
|
@ -94,6 +94,7 @@ class OC_Setup {
|
|||
'error' => 'MySQL username and/or password not valid',
|
||||
'hint' => 'You need to enter either an existing account or the administrator.'
|
||||
);
|
||||
return($error);
|
||||
}
|
||||
else {
|
||||
$oldUser=OC_Config::getValue('dbuser', false);
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* This class provides all methods for user management.
|
||||
* This class provides wrapper methods for user management. Multiple backends are
|
||||
* supported. User management operations are delegated to the configured backend for
|
||||
* execution.
|
||||
*
|
||||
* Hooks provided:
|
||||
* pre_createUser(&run, uid, password)
|
||||
|
@ -240,7 +242,7 @@ class OC_User {
|
|||
* Checks if the user is logged in
|
||||
*/
|
||||
public static function isLoggedIn(){
|
||||
if( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ){
|
||||
if( isset($_SESSION['user_id']) AND $_SESSION['user_id'] AND self::userExists($_SESSION['user_id']) ){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
|
@ -336,6 +338,7 @@ class OC_User {
|
|||
}
|
||||
}
|
||||
}
|
||||
asort($users);
|
||||
return $users;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,10 @@ define('OC_USER_BACKEND_USER_EXISTS', 0x100000);
|
|||
|
||||
|
||||
/**
|
||||
* abstract base class for user management
|
||||
* subclass this for your own backends and see OC_User_Example for descriptions
|
||||
* Abstract base class for user management. Provides methods for querying backend
|
||||
* capabilities.
|
||||
*
|
||||
* Subclass this for your own backends, and see OC_User_Example for descriptions
|
||||
*/
|
||||
abstract class OC_User_Backend {
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Frank Karlitschek
|
||||
* @copyright 2012 Robin Appelman icewind@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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* user backend using http auth requests
|
||||
*/
|
||||
class OC_User_HTTP extends OC_User_Backend {
|
||||
/**
|
||||
* split http://user@host/path into a user and url part
|
||||
* @param string path
|
||||
* @return array
|
||||
*/
|
||||
private function parseUrl($url){
|
||||
$parts=parse_url($url);
|
||||
$url=$parts['scheme'].'://'.$parts['host'];
|
||||
if(isset($parts['port'])){
|
||||
$url.=':'.$parts['port'];
|
||||
}
|
||||
$url.=$parts['path'];
|
||||
if(isset($parts['query'])){
|
||||
$url.='?'.$parts['query'];
|
||||
}
|
||||
return array($parts['user'],$url);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* check if an url is a valid login
|
||||
* @param string url
|
||||
* @return boolean
|
||||
*/
|
||||
private function matchUrl($url){
|
||||
return ! is_null(parse_url($url,PHP_URL_USER));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the password is correct
|
||||
* @param $uid The username
|
||||
* @param $password The password
|
||||
* @returns string
|
||||
*
|
||||
* Check if the password is correct without logging in the user
|
||||
* returns the user id or false
|
||||
*/
|
||||
public function checkPassword($uid, $password){
|
||||
if(!$this->matchUrl($uid)){
|
||||
return false;
|
||||
}
|
||||
list($user,$url)=$this->parseUrl($uid);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
curl_exec($ch);
|
||||
|
||||
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
return $status==200;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if a user exists
|
||||
* @param string $uid the username
|
||||
* @return boolean
|
||||
*/
|
||||
public function userExists($uid){
|
||||
return $this->matchUrl($uid);
|
||||
}
|
||||
}
|
11
lib/util.php
11
lib/util.php
|
@ -28,6 +28,14 @@ class OC_Util {
|
|||
exit;
|
||||
}
|
||||
|
||||
// Check if apps folder is writable.
|
||||
if(!is_writable(OC::$SERVERROOT."/apps/")) {
|
||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
||||
$tmpl->assign('errors',array(1=>array('error'=>"Can't write into apps directory 'apps'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Create root dir.
|
||||
if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){
|
||||
$success=@mkdir($CONFIG_DATADIRECTORY_ROOT);
|
||||
|
@ -256,6 +264,9 @@ class OC_Util {
|
|||
if(floatval(phpversion())<5.3){
|
||||
$errors[]=array('error'=>'PHP 5.3 is required.<br/>','hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
|
||||
}
|
||||
if(!defined('PDO::ATTR_DRIVER_NAME')){
|
||||
$errors[]=array('error'=>'PHP PDO module is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class OC_VCategories {
|
|||
if(!is_null($vobject)) {
|
||||
$this->loadFromVObject($vobject, $sync);
|
||||
} else {
|
||||
OC_Log::write('core','OC_VCategories::rescan, unable to parse. ID: '.$value[0].', '.substr($value[1], 0, 50).'(...)', OC_Log::DEBUG);
|
||||
OC_Log::write('core','OC_VCategories::rescan, unable to parse. ID: '.', '.substr($object, 0, 100).'(...)', OC_Log::DEBUG);
|
||||
}
|
||||
}
|
||||
$this->save();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
require_once('../lib/base.php');
|
||||
|
||||
$url='http://'.substr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],0,-17).'ocs/v1.php/';
|
||||
$url='http://'.substr(OCP\Util::getServerHost().$_SERVER['REQUEST_URI'],0,-17).'ocs/v1.php/';
|
||||
|
||||
echo('
|
||||
<providers>
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
OC_App::register( array( 'order' => 2, "id" => 'search', 'name' => 'Search' ));
|
||||
|
||||
?>
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
OC_App::register( array( "id" => "settings", "name" => "Settings" ));
|
||||
OC_App::register( array( "order" => 1, "id" => "admin", "name" => "Administration" ));
|
||||
OC_App::register( array( "order" => 1, "id" => "help", "name" => "Help" ));
|
||||
|
||||
?>
|
|
@ -17,7 +17,7 @@ $(document).ready(function(){
|
|||
});
|
||||
$('#leftcontent li').click(function(){
|
||||
var app=$(this).data('app');
|
||||
$('#rightcontent p').show();
|
||||
$('#rightcontent p.license').show();
|
||||
$('#rightcontent span.name').text(app.name);
|
||||
$('#rightcontent small.externalapp').text(app.internallabel);
|
||||
$('#rightcontent span.version').text(app.version);
|
||||
|
@ -31,6 +31,10 @@ $(document).ready(function(){
|
|||
$('#rightcontent input.enable').val((app.active)?t('settings','Disable'):t('settings','Enable'));
|
||||
$('#rightcontent input.enable').data('appid',app.id);
|
||||
$('#rightcontent input.enable').data('active',app.active);
|
||||
if ( app.internal == false ) {
|
||||
$('#rightcontent p.appslink').show();
|
||||
$('#rightcontent a').attr('href','http://apps.owncloud.com/content/show.php?content='+app.id);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#rightcontent input.enable').click(function(){
|
||||
|
|
|
@ -20,6 +20,7 @@ $rootInfo=OC_FileCache::get('');
|
|||
$used=$rootInfo['size'];
|
||||
$free=OC_Filesystem::free_space();
|
||||
$total=$free+$used;
|
||||
if($total==0) $total=1; // prevent division by zero
|
||||
$relative=round(($used/$total)*10000)/100;
|
||||
|
||||
$email=OC_Preferences::getValue(OC_User::getUser(), 'settings','email','');
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<h3><strong><span class="name"><?php echo $l->t('Select an App');?></span></strong><span class="version"></span><small class="externalapp" style="visibility:hidden;"></small></h3>
|
||||
<p class="description"></p>
|
||||
<img src="" class="preview" />
|
||||
<p class="hidden"><span class="licence"></span><?php echo $l->t('-licensed');?> <?php echo $l->t('by');?> <span class="author"></span></p>
|
||||
<p class="appslink hidden"><a href="#" target="_blank"><?php echo $l->t('See application page at apps.owncloud.com');?></a></p>
|
||||
<p class="license hidden"><span class="licence"></span><?php echo $l->t('-licensed');?> <?php echo $l->t('by');?> <span class="author"></span></p>
|
||||
<input class="enable hidden" type="submit" />
|
||||
</div>
|
||||
|
|
|
@ -20,6 +20,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract class to provide the basis of backend-specific unit test classes.
|
||||
*
|
||||
* All subclasses MUST assign a backend property in setUp() which implements
|
||||
* user operations (add, remove, etc.). Test methods in this class will then be
|
||||
* run on each separate subclass and backend therein.
|
||||
*
|
||||
* For an example see /tests/lib/user/dummy.php
|
||||
*/
|
||||
|
||||
abstract class Test_User_Backend extends UnitTestCase {
|
||||
/**
|
||||
* @var OC_User_Backend $backend
|
||||
|
|
Loading…
Reference in New Issue