@ -0,0 +1,28 @@ |
||||
{ |
||||
"camelCase": true, |
||||
"eqeqeq": true, |
||||
"immed": true, |
||||
"latedef": false, |
||||
"noarg": true, |
||||
"nonbsp": true, |
||||
"undef": true, |
||||
"unused": true, |
||||
"trailing": true, |
||||
"maxparams": 5, |
||||
"curly": true, |
||||
"jquery": true, |
||||
"maxlen": 80, |
||||
"indent": 4, |
||||
"browser": true, |
||||
"globals": { |
||||
"console": true, |
||||
"it": true, |
||||
"itx": true, |
||||
"expect": true, |
||||
"describe": true, |
||||
"beforeEach": true, |
||||
"afterEach": true, |
||||
"sinon": true, |
||||
"fakeServer": true |
||||
} |
||||
} |
@ -0,0 +1,75 @@ |
||||
/** |
||||
* ownCloud |
||||
* |
||||
* @author Vincent Petry |
||||
* @copyright 2014 Vincent Petry <pvince81@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/>.
|
||||
* |
||||
*/ |
||||
|
||||
/* global OC, FileActions, FileList */ |
||||
describe('FileActions tests', function() { |
||||
var $filesTable; |
||||
beforeEach(function() { |
||||
// init horrible parameters
|
||||
var $body = $('body'); |
||||
$body.append('<input type="hidden" id="dir" value="/subdir"></input>'); |
||||
$body.append('<input type="hidden" id="permissions" value="31"></input>'); |
||||
// dummy files table
|
||||
$filesTable = $body.append('<table id="filestable"></table>'); |
||||
}); |
||||
afterEach(function() { |
||||
$('#dir, #permissions, #filestable').remove(); |
||||
}); |
||||
it('calling display() sets file actions', function() { |
||||
// note: download_url is actually the link target, not the actual download URL...
|
||||
var $tr = FileList.addFile('testName.txt', 1234, new Date(), false, false, {download_url: 'test/download/url'}); |
||||
|
||||
// no actions before call
|
||||
expect($tr.find('.action[data-action=Download]').length).toEqual(0); |
||||
expect($tr.find('.action[data-action=Rename]').length).toEqual(0); |
||||
expect($tr.find('.action.delete').length).toEqual(0); |
||||
|
||||
FileActions.display($tr.find('td.filename'), true); |
||||
|
||||
// actions defined after cal
|
||||
expect($tr.find('.action[data-action=Download]').length).toEqual(1); |
||||
expect($tr.find('.nametext .action[data-action=Rename]').length).toEqual(1); |
||||
expect($tr.find('.action.delete').length).toEqual(1); |
||||
}); |
||||
it('calling display() twice correctly replaces file actions', function() { |
||||
var $tr = FileList.addFile('testName.txt', 1234, new Date(), false, false, {download_url: 'test/download/url'}); |
||||
|
||||
FileActions.display($tr.find('td.filename'), true); |
||||
FileActions.display($tr.find('td.filename'), true); |
||||
|
||||
// actions defined after cal
|
||||
expect($tr.find('.action[data-action=Download]').length).toEqual(1); |
||||
expect($tr.find('.nametext .action[data-action=Rename]').length).toEqual(1); |
||||
expect($tr.find('.action.delete').length).toEqual(1); |
||||
}); |
||||
it('redirects to download URL when clicking download', function() { |
||||
var redirectStub = sinon.stub(OC, 'redirect'); |
||||
// note: download_url is actually the link target, not the actual download URL...
|
||||
var $tr = FileList.addFile('test download File.txt', 1234, new Date(), false, false, {download_url: 'test/download/url'}); |
||||
FileActions.display($tr.find('td.filename'), true); |
||||
|
||||
$tr.find('.action[data-action=Download]').click(); |
||||
|
||||
expect(redirectStub.calledOnce).toEqual(true); |
||||
expect(redirectStub.getCall(0).args[0]).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?files=test%20download%20File.txt&dir=%2Fsubdir&download'); |
||||
redirectStub.restore(); |
||||
}); |
||||
}); |
@ -0,0 +1,49 @@ |
||||
@media only screen and (max-width: 600px) { |
||||
|
||||
/* make header scroll up for single shares, more view of content on small screens */ |
||||
#header.share-file { |
||||
position: absolute !important; |
||||
} |
||||
|
||||
/* hide size and date columns */ |
||||
table th#headerSize, |
||||
table td.filesize, |
||||
table th#headerDate, |
||||
table td.date { |
||||
display: none; |
||||
} |
||||
|
||||
/* restrict length of displayed filename to prevent overflow */ |
||||
table td.filename .nametext { |
||||
max-width: 75% !important; |
||||
} |
||||
|
||||
/* on mobile, show single shared image at full width without margin */ |
||||
#imgframe { |
||||
width: 100%; |
||||
padding: 0; |
||||
margin-bottom: 35px; |
||||
} |
||||
/* some margin for the file type icon */ |
||||
#imgframe .publicpreview { |
||||
margin-top: 32px; |
||||
} |
||||
|
||||
/* always show actions on mobile */ |
||||
#fileList a.action { |
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)" !important; |
||||
filter: alpha(opacity=20) !important; |
||||
opacity: .2 !important; |
||||
display: inline !important; |
||||
} |
||||
/* some padding for better clickability */ |
||||
#fileList a.action img { |
||||
padding: 0 6px 0 12px; |
||||
} |
||||
/* hide text of the actions on mobile */ |
||||
#fileList a.action span { |
||||
display: none; |
||||
} |
||||
|
||||
|
||||
} |
After Width: | Height: | Size: 286 B |
After Width: | Height: | Size: 946 B |
After Width: | Height: | Size: 195 B |
After Width: | Height: | Size: 692 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 698 B |
@ -1,28 +1,23 @@ |
||||
{ |
||||
"libraries": [ |
||||
"jquery-1.10.0.min.js", |
||||
"jquery-migrate-1.2.1.min.js", |
||||
"jquery-ui-1.10.0.custom.js", |
||||
"jquery-showpassword.js", |
||||
"jquery.infieldlabel.js", |
||||
"jquery.placeholder.js", |
||||
"jquery-tipsy.js" |
||||
], |
||||
"modules": [ |
||||
"jquery-1.10.0.min.js", |
||||
"jquery-migrate-1.2.1.min.js", |
||||
"jquery-ui-1.10.0.custom.js", |
||||
"jquery-showpassword.js", |
||||
"jquery.infieldlabel.js", |
||||
"jquery.placeholder.js", |
||||
"jquery-tipsy.js", |
||||
"compatibility.js", |
||||
"jquery.ocdialog.js", |
||||
"oc-dialogs.js", |
||||
"js.js", |
||||
"octemplate.js", |
||||
"eventsource.js", |
||||
"config.js", |
||||
"multiselect.js", |
||||
"search.js", |
||||
"router.js", |
||||
"oc-requesttoken.js", |
||||
"styles.js", |
||||
"apps.js", |
||||
"fixes.js", |
||||
"jquery-ui-2.10.0.custom.js", |
||||
"jquery-tipsy.js", |
||||
"jquery.ocdialog.js" |
||||
"compatibility.js", |
||||
"jquery.ocdialog.js", |
||||
"oc-dialogs.js", |
||||
"js.js", |
||||
"octemplate.js", |
||||
"eventsource.js", |
||||
"config.js", |
||||
"multiselect.js", |
||||
"router.js", |
||||
"oc-requesttoken.js" |
||||
] |
||||
} |
||||
|
@ -1,73 +0,0 @@ |
||||
<?php |
||||
|
||||
// Check for autosetup: |
||||
$autosetup_file = OC::$SERVERROOT."/config/autoconfig.php"; |
||||
if( file_exists( $autosetup_file )) { |
||||
OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', OC_Log::INFO); |
||||
include $autosetup_file; |
||||
$_POST = array_merge ($_POST, $AUTOCONFIG); |
||||
$_REQUEST = array_merge ($_REQUEST, $AUTOCONFIG); |
||||
} |
||||
|
||||
$dbIsSet = isset($_POST['dbtype']); |
||||
$directoryIsSet = isset($_POST['directory']); |
||||
$adminAccountIsSet = isset($_POST['adminlogin']); |
||||
|
||||
if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
||||
$_POST['install'] = 'true'; |
||||
if( file_exists( $autosetup_file )) { |
||||
unlink($autosetup_file); |
||||
} |
||||
} |
||||
|
||||
OC_Util::addScript( '3rdparty', 'strengthify/jquery.strengthify' ); |
||||
OC_Util::addStyle( '3rdparty', 'strengthify/strengthify' ); |
||||
OC_Util::addScript('setup'); |
||||
|
||||
$hasSQLite = class_exists('SQLite3'); |
||||
$hasMySQL = is_callable('mysql_connect'); |
||||
$hasPostgreSQL = is_callable('pg_connect'); |
||||
$hasOracle = is_callable('oci_connect'); |
||||
$hasMSSQL = is_callable('sqlsrv_connect'); |
||||
$datadir = OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data'); |
||||
$vulnerableToNullByte = false; |
||||
if(@file_exists(__FILE__."\0Nullbyte")) { // Check if the used PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243) |
||||
$vulnerableToNullByte = true; |
||||
} |
||||
|
||||
// Protect data directory here, so we can test if the protection is working |
||||
OC_Setup::protectDataDirectory(); |
||||
|
||||
$opts = array( |
||||
'hasSQLite' => $hasSQLite, |
||||
'hasMySQL' => $hasMySQL, |
||||
'hasPostgreSQL' => $hasPostgreSQL, |
||||
'hasOracle' => $hasOracle, |
||||
'hasMSSQL' => $hasMSSQL, |
||||
'directory' => $datadir, |
||||
'secureRNG' => OC_Util::secureRNGAvailable(), |
||||
'htaccessWorking' => OC_Util::isHtAccessWorking(), |
||||
'vulnerableToNullByte' => $vulnerableToNullByte, |
||||
'errors' => array(), |
||||
'dbIsSet' => $dbIsSet, |
||||
'directoryIsSet' => $directoryIsSet, |
||||
); |
||||
|
||||
if(isset($_POST['install']) AND $_POST['install']=='true') { |
||||
// We have to launch the installation process : |
||||
$e = OC_Setup::install($_POST); |
||||
$errors = array('errors' => $e); |
||||
|
||||
if(count($e) > 0) { |
||||
//OC_Template::printGuestPage("", "error", array("errors" => $errors)); |
||||
$options = array_merge($_POST, $opts, $errors); |
||||
OC_Template::printGuestPage("", "installation", $options); |
||||
} |
||||
else { |
||||
header( 'Location: '.OC_Helper::linkToRoute( 'post_setup_check' )); |
||||
exit(); |
||||
} |
||||
} |
||||
else { |
||||
OC_Template::printGuestPage("", "installation", $opts); |
||||
} |
@ -0,0 +1,138 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
namespace OC\Core\Setup; |
||||
|
||||
class Controller { |
||||
public function run($post) { |
||||
// Check for autosetup: |
||||
$post = $this->loadAutoConfig($post); |
||||
$opts = $this->getSystemInfo(); |
||||
|
||||
if(isset($post['install']) AND $post['install']=='true') { |
||||
// We have to launch the installation process : |
||||
$e = \OC_Setup::install($post); |
||||
$errors = array('errors' => $e); |
||||
|
||||
if(count($e) > 0) { |
||||
$options = array_merge($post, $opts, $errors); |
||||
$this->display($options); |
||||
} |
||||
else { |
||||
$this->finishSetup(); |
||||
} |
||||
} |
||||
else { |
||||
$this->display($opts); |
||||
} |
||||
} |
||||
|
||||
public function display($post) { |
||||
$defaults = array( |
||||
'adminlogin' => '', |
||||
'adminpass' => '', |
||||
'dbuser' => '', |
||||
'dbpass' => '', |
||||
'dbname' => '', |
||||
'dbtablespace' => '', |
||||
'dbhost' => '', |
||||
); |
||||
$parameters = array_merge($defaults, $post); |
||||
|
||||
\OC_Util::addScript( '3rdparty', 'strengthify/jquery.strengthify' ); |
||||
\OC_Util::addStyle( '3rdparty', 'strengthify/strengthify' ); |
||||
\OC_Util::addScript('setup'); |
||||
\OC_Template::printGuestPage('', 'installation', $parameters); |
||||
} |
||||
|
||||
public function finishSetup() { |
||||
header( 'Location: '.\OC_Helper::linkToRoute( 'post_setup_check' )); |
||||
exit(); |
||||
} |
||||
|
||||
public function loadAutoConfig($post) { |
||||
$dbIsSet = isset($post['dbtype']); |
||||
$directoryIsSet = isset($post['directory']); |
||||
$adminAccountIsSet = isset($post['adminlogin']); |
||||
|
||||
$autosetup_file = \OC::$SERVERROOT.'/config/autoconfig.php'; |
||||
if( file_exists( $autosetup_file )) { |
||||
\OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', \OC_Log::INFO); |
||||
include $autosetup_file; |
||||
$post = array_merge ($post, $AUTOCONFIG); |
||||
} |
||||
|
||||
if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
||||
$post['install'] = 'true'; |
||||
if( file_exists( $autosetup_file )) { |
||||
unlink($autosetup_file); |
||||
} |
||||
} |
||||
$post['dbIsSet'] = $dbIsSet; |
||||
$post['directoryIsSet'] = $directoryIsSet; |
||||
|
||||
return $post; |
||||
} |
||||
|
||||
public function getSystemInfo() { |
||||
$hasSQLite = class_exists('SQLite3'); |
||||
$hasMySQL = is_callable('mysql_connect'); |
||||
$hasPostgreSQL = is_callable('pg_connect'); |
||||
$hasOracle = is_callable('oci_connect'); |
||||
$hasMSSQL = is_callable('sqlsrv_connect'); |
||||
$databases = array(); |
||||
if ($hasSQLite) { |
||||
$databases['sqlite'] = 'SQLite'; |
||||
} |
||||
if ($hasMySQL) { |
||||
$databases['mysql'] = 'MySQL'; |
||||
} |
||||
if ($hasPostgreSQL) { |
||||
$databases['pgsql'] = 'PostgreSQL'; |
||||
} |
||||
if ($hasOracle) { |
||||
$databases['oci'] = 'Oracle'; |
||||
} |
||||
if ($hasMSSQL) { |
||||
$databases['mssql'] = 'MS SQL'; |
||||
} |
||||
$datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT.'/data'); |
||||
$vulnerableToNullByte = false; |
||||
if(@file_exists(__FILE__."\0Nullbyte")) { // Check if the used PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243) |
||||
$vulnerableToNullByte = true; |
||||
} |
||||
|
||||
$errors = array(); |
||||
|
||||
// Protect data directory here, so we can test if the protection is working |
||||
\OC_Setup::protectDataDirectory(); |
||||
try { |
||||
$htaccessWorking = \OC_Util::isHtAccessWorking(); |
||||
} catch (\OC\HintException $e) { |
||||
$errors[] = array( |
||||
'error' => $e->getMessage(), |
||||
'hint' => $e->getHint() |
||||
); |
||||
$htaccessWorking = false; |
||||
} |
||||
|
||||
return array( |
||||
'hasSQLite' => $hasSQLite, |
||||
'hasMySQL' => $hasMySQL, |
||||
'hasPostgreSQL' => $hasPostgreSQL, |
||||
'hasOracle' => $hasOracle, |
||||
'hasMSSQL' => $hasMSSQL, |
||||
'databases' => $databases, |
||||
'directory' => $datadir, |
||||
'secureRNG' => \OC_Util::secureRNGAvailable(), |
||||
'htaccessWorking' => $htaccessWorking, |
||||
'vulnerableToNullByte' => $vulnerableToNullByte, |
||||
'errors' => $errors, |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,50 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* ownCloud |
||||
* |
||||
* @author Vincent Petry |
||||
* @copyright 2014 Vincent Petry <pvince81@owncloud.com> |
||||
* |
||||
* @license AGPL3 |
||||
*/ |
||||
|
||||
class OC_Connector_Sabre_ExceptionLoggerPlugin extends Sabre_DAV_ServerPlugin |
||||
{ |
||||
private $appName; |
||||
|
||||
/** |
||||
* @param string $loggerAppName app name to use when logging |
||||
*/ |
||||
public function __construct($loggerAppName = 'webdav') { |
||||
$this->appName = $loggerAppName; |
||||
} |
||||
|
||||
/** |
||||
* This initializes the plugin. |
||||
* |
||||
* This function is called by Sabre_DAV_Server, after |
||||
* addPlugin is called. |
||||
* |
||||
* This method should set up the required event subscriptions. |
||||
* |
||||
* @param Sabre_DAV_Server $server |
||||
* @return void |
||||
*/ |
||||
public function initialize(Sabre_DAV_Server $server) { |
||||
|
||||
$server->subscribeEvent('exception', array($this, 'logException'), 10); |
||||
} |
||||
|
||||
/** |
||||
* Log exception |
||||
* |
||||
* @internal param Exception $e exception |
||||
*/ |
||||
public function logException($e) { |
||||
$exceptionClass = get_class($e); |
||||
if ($exceptionClass !== 'Sabre_DAV_Exception_NotAuthenticated') { |
||||
\OCP\Util::logException($this->appName, $e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,28 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
interface ICacheFactory{ |
||||
/** |
||||
* Get a memory cache instance |
||||
* |
||||
* All entries added trough the cache instance will be namespaced by $prefix to prevent collisions between apps |
||||
* |
||||
* @param string $prefix |
||||
* @return \OCP\ICache |
||||
*/ |
||||
public function create($prefix = ''); |
||||
|
||||
/** |
||||
* Check if any memory cache backend is available |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function isAvailable(); |
||||
} |
@ -1,2 +0,0 @@ |
||||
CC BY 3.0 |
||||
http://thenounproject.com/en-us/noun/printer/#icon-No109 |
Before Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 807 B |
@ -0,0 +1,62 @@ |
||||
<?php |
||||
/** |
||||
* ownCloud |
||||
* |
||||
* @author Bjoern Schiessle |
||||
* @copyright 2014 Bjoern Schiessle <schiessle@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_ErrorHandler extends \PHPUnit_Framework_TestCase { |
||||
|
||||
/** |
||||
* @brief provide username, password combinations for testRemovePassword |
||||
* @return array |
||||
*/ |
||||
function passwordProvider() { |
||||
return array( |
||||
array('user', 'password'), |
||||
array('user@owncloud.org', 'password'), |
||||
array('user', 'pass@word'), |
||||
array('us:er', 'password'), |
||||
array('user', 'pass:word'), |
||||
); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @dataProvider passwordProvider |
||||
* @param string $username |
||||
* @param string $password |
||||
*/ |
||||
function testRemovePassword($username, $password) { |
||||
$url = 'http://'.$username.':'.$password.'@owncloud.org'; |
||||
$expectedResult = 'http://xxx:xxx@owncloud.org'; |
||||
$result = TestableErrorHandler::testRemovePassword($url); |
||||
|
||||
$this->assertEquals($expectedResult, $result); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @brief dummy class to access protected methods of \OC\Log\ErrorHandler |
||||
*/ |
||||
class TestableErrorHandler extends \OC\Log\ErrorHandler { |
||||
public static function testRemovePassword($msg) { |
||||
return self::removePassword($msg); |
||||
} |
||||
} |