diff options
Diffstat (limited to 'apps')
107 files changed, 1908 insertions, 1291 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index 73601d26217..cd9341d3b1d 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -40,7 +40,7 @@ $dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; $dir = \OC\Files\Filesystem::normalizePath($dir); $dirInfo = \OC\Files\Filesystem::getFileInfo($dir); // Redirect if directory does not exist -if (!$dirInfo->getType() === 'dir') { +if (!$dirInfo || !$dirInfo->getType() === 'dir') { header('Location: ' . OCP\Util::getScriptName() . ''); exit(); } @@ -97,7 +97,7 @@ $permissions = $dirInfo->getPermissions(); $storageInfo=OC_Helper::getStorageInfo($dir); $freeSpace=$storageInfo['free']; $uploadLimit=OCP\Util::uploadLimit(); -$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); +$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir, $freeSpace); $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) $encryptionInitStatus = 2; diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index a7d1fa9d8a2..732690f047a 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -180,7 +180,7 @@ var FileActions = { } var element = $(html); element.data('action', actions['Delete']); - element.on('click', {a: null, elem: parent, actionFunc: actions['Delete']}, actionHandler); + element.on('click', {a: null, elem: parent, actionFunc: actions['Delete'].action}, actionHandler); parent.parent().children().last().append(element); } diff --git a/apps/files/l10n/el.php b/apps/files/l10n/el.php index 9144cf3ea10..c71aa9a35ab 100644 --- a/apps/files/l10n/el.php +++ b/apps/files/l10n/el.php @@ -5,6 +5,7 @@ $TRANSLATIONS = array( "File name cannot be empty." => "Το όνομα αρχείου δεν μπορεί να είναι κενό.", "\"%s\" is an invalid file name." => "Το \"%s\" είναι ένα μη έγκυρο όνομα αρχείου.", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Μη έγκυρο όνομα, '\\', '/', '<', '>', ':', '\"', '|', '?' και '*' δεν επιτρέπονται.", +"The target folder has been moved or deleted." => "Ο φάκελος προορισμού έχει μετακινηθεί ή διαγραφεί.", "The name %s is already used in the folder %s. Please choose a different name." => "Το όνομα %s χρησιμοποιείτε ήδη στον φάκελο %s. Παρακαλώ επιλέξτε ένα άλλο όνομα.", "Not a valid source" => "Μη έγκυρη πηγή", "Server is not allowed to open URLs, please check the server configuration" => "Ο διακομιστής δεν επιτρέπεται να ανοίγει URL, παρακαλώ ελέγξτε τις ρυθμίσεις του διακομιστή", @@ -28,6 +29,8 @@ $TRANSLATIONS = array( "Invalid directory." => "Μη έγκυρος φάκελος.", "Files" => "Αρχεία", "Unable to upload {filename} as it is a directory or has 0 bytes" => "Αδυναμία φόρτωσης {filename} καθώς είναι κατάλογος αρχείων ή έχει 0 bytes", +"Total file size {size1} exceeds upload limit {size2}" => "Το συνολικό μέγεθος αρχείου {size1} υπερβαίνει το όριο μεταφόρτωσης {size2}", +"Not enough free space, you are uploading {size1} but only {size2} is left" => "Δεν υπάρχει αρκετός ελεύθερος χώρος, μεταφορτώνετε μέγεθος {size1} αλλά υπάρχει χώρος μόνο {size2}", "Upload cancelled." => "Η αποστολή ακυρώθηκε.", "Could not get result from server." => "Αδυναμία λήψης αποτελέσματος από το διακομιστή.", "File upload is in progress. Leaving the page now will cancel the upload." => "Η αποστολή του αρχείου βρίσκεται σε εξέλιξη. Το κλείσιμο της σελίδας θα ακυρώσει την αποστολή.", diff --git a/apps/files/l10n/et_EE.php b/apps/files/l10n/et_EE.php index f1fdc82673c..74818f99f11 100644 --- a/apps/files/l10n/et_EE.php +++ b/apps/files/l10n/et_EE.php @@ -3,7 +3,9 @@ $TRANSLATIONS = array( "Could not move %s - File with this name already exists" => "Ei saa liigutada faili %s - samanimeline fail on juba olemas", "Could not move %s" => "%s liigutamine ebaõnnestus", "File name cannot be empty." => "Faili nimi ei saa olla tühi.", +"\"%s\" is an invalid file name." => "\"%s\" on vigane failinimi.", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Vigane nimi, '\\', '/', '<', '>', ':', '\"', '|', '?' ja '*' pole lubatud.", +"The target folder has been moved or deleted." => "Sihtkataloog on ümber tõstetud või kustutatud.", "The name %s is already used in the folder %s. Please choose a different name." => "Nimi %s on juba kasutusel kataloogis %s. Palun vali mõni teine nimi.", "Not a valid source" => "Pole korrektne lähteallikas", "Server is not allowed to open URLs, please check the server configuration" => "Server ei võimalda URL-ide avamist, palun kontrolli serveri seadistust", @@ -27,6 +29,8 @@ $TRANSLATIONS = array( "Invalid directory." => "Vigane kaust.", "Files" => "Failid", "Unable to upload {filename} as it is a directory or has 0 bytes" => "Ei saa üles laadida {filename}, kuna see on kataloog või selle suurus on 0 baiti", +"Total file size {size1} exceeds upload limit {size2}" => "Faili suurus {size1} ületab faili üleslaadimise mahu piirangu {size2}.", +"Not enough free space, you are uploading {size1} but only {size2} is left" => "Pole piisavalt vaba ruumi. Sa laadid üles {size1}, kuid ainult {size2} on saadaval.", "Upload cancelled." => "Üleslaadimine tühistati.", "Could not get result from server." => "Serverist ei saadud tulemusi", "File upload is in progress. Leaving the page now will cancel the upload." => "Faili üleslaadimine on töös. Lehelt lahkumine katkestab selle üleslaadimise.", @@ -48,6 +52,7 @@ $TRANSLATIONS = array( "_%n file_::_%n files_" => array("%n fail","%n faili"), "{dirs} and {files}" => "{dirs} ja {files}", "_Uploading %n file_::_Uploading %n files_" => array("Laadin üles %n faili","Laadin üles %n faili"), +"\"{name}\" is an invalid file name." => "\"{name}\" on vigane failinimi.", "Your storage is full, files can not be updated or synced anymore!" => "Sinu andmemaht on täis! Faile ei uuendata ega sünkroniseerita!", "Your storage is almost full ({usedSpacePercent}%)" => "Su andmemaht on peaaegu täis ({usedSpacePercent}%)", "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Krüpteerimisrakend on lubatud, kuid võtmeid pole lähtestatud. Palun logi välja ning uuesti sisse.", diff --git a/apps/files/l10n/pl_PL.php b/apps/files/l10n/pl_PL.php deleted file mode 100644 index b67f67b972e..00000000000 --- a/apps/files/l10n/pl_PL.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -$TRANSLATIONS = array( -"Save" => "Zapisz" -); -$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"; diff --git a/apps/files/l10n/ro.php b/apps/files/l10n/ro.php index 7686025e35c..3f192df5b43 100644 --- a/apps/files/l10n/ro.php +++ b/apps/files/l10n/ro.php @@ -4,7 +4,9 @@ $TRANSLATIONS = array( "Could not move %s" => "Nu se poate muta %s", "File name cannot be empty." => "Numele fișierului nu poate rămâne gol.", "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nume nevalide, '\\', '/', '<', '>', ':', '\"', '|', '?' și '*' nu sunt permise.", +"Error while downloading %s to %s" => "Eroare la descarcarea %s in %s", "Error when creating the file" => "Eroare la crearea fisierului", +"Folder name cannot be empty." => "Numele folderului nu poate fi liber.", "Error when creating the folder" => "Eroare la crearea folderului", "Unable to set upload directory." => "Imposibil de a seta directorul pentru incărcare.", "Invalid Token" => "Jeton Invalid", diff --git a/apps/files/l10n/tr.php b/apps/files/l10n/tr.php index a2570e002ac..095578ce65b 100644 --- a/apps/files/l10n/tr.php +++ b/apps/files/l10n/tr.php @@ -29,7 +29,7 @@ $TRANSLATIONS = array( "Invalid directory." => "Geçersiz dizin.", "Files" => "Dosyalar", "Unable to upload {filename} as it is a directory or has 0 bytes" => "Bir dizin veya 0 bayt olduğundan {filename} yüklenemedi", -"Total file size {size1} exceeds upload limit {size2}" => "Toplam dosya boyutu {size1} gönderme sınırını {size2} aşıyor", +"Total file size {size1} exceeds upload limit {size2}" => "Toplam dosya boyutu {size1}, {size2} gönderme sınırını aşıyor", "Not enough free space, you are uploading {size1} but only {size2} is left" => "Yeterince boş alan yok. Gönderdiğiniz boyut {size1} ancak {size2} alan mevcut", "Upload cancelled." => "Yükleme iptal edildi.", "Could not get result from server." => "Sunucudan sonuç alınamadı.", diff --git a/apps/files/templates/admin.php b/apps/files/templates/admin.php index a5afd55fbc3..5f7d3261d6c 100644 --- a/apps/files/templates/admin.php +++ b/apps/files/templates/admin.php @@ -1,28 +1,26 @@ <?php OCP\Util::addscript('files', 'admin'); ?> -<form name="filesForm" action='#' method='post'> - <fieldset class="personalblock"> - <h2><?php p($l->t('File handling')); ?></h2> - <?php if($_['uploadChangable']):?> - <label for="maxUploadSize"><?php p($l->t( 'Maximum upload size' )); ?> </label> - <input type="text" name='maxUploadSize' id="maxUploadSize" value='<?php p($_['uploadMaxFilesize']) ?>'/> - <?php if($_['displayMaxPossibleUploadSize']):?> - (<?php p($l->t('max. possible: ')); p($_['maxPossibleUploadSize']) ?>) - <?php endif;?> - <br/> +<form name="filesForm" class="section" action="#" method="post"> + <h2><?php p($l->t('File handling')); ?></h2> + <?php if($_['uploadChangable']):?> + <label for="maxUploadSize"><?php p($l->t( 'Maximum upload size' )); ?> </label> + <input type="text" name='maxUploadSize' id="maxUploadSize" value='<?php p($_['uploadMaxFilesize']) ?>'/> + <?php if($_['displayMaxPossibleUploadSize']):?> + (<?php p($l->t('max. possible: ')); p($_['maxPossibleUploadSize']) ?>) <?php endif;?> - <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1" - title="<?php p($l->t( 'Needed for multi-file and folder downloads.' )); ?>" - <?php if ($_['allowZipDownload']): ?> checked="checked"<?php endif; ?> /> - <label for="allowZipDownload"><?php p($l->t( 'Enable ZIP-download' )); ?></label><br/> + <br/> + <?php endif;?> + <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1" + title="<?php p($l->t( 'Needed for multi-file and folder downloads.' )); ?>" + <?php if ($_['allowZipDownload']): ?> checked="checked"<?php endif; ?> /> + <label for="allowZipDownload"><?php p($l->t( 'Enable ZIP-download' )); ?></label><br/> - <input type="text" name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php p($_['maxZipInputSize']) ?>' - title="<?php p($l->t( '0 is unlimited' )); ?>" - <?php if (!$_['allowZipDownload']): ?> disabled="disabled"<?php endif; ?> /><br /> - <em><?php p($l->t( 'Maximum input size for ZIP files' )); ?> </em><br /> + <input type="text" name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php p($_['maxZipInputSize']) ?>' + title="<?php p($l->t( '0 is unlimited' )); ?>" + <?php if (!$_['allowZipDownload']): ?> disabled="disabled"<?php endif; ?> /><br /> + <em><?php p($l->t( 'Maximum input size for ZIP files' )); ?> </em><br /> - <input type="hidden" value="<?php p($_['requesttoken']); ?>" name="requesttoken" /> - <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" - value="<?php p($l->t( 'Save' )); ?>"/> - </fieldset> + <input type="hidden" value="<?php p($_['requesttoken']); ?>" name="requesttoken" /> + <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" + value="<?php p($l->t( 'Save' )); ?>"/> </form> diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js index ef7ddcb874a..80c04b5b242 100644 --- a/apps/files/tests/js/fileactionsSpec.js +++ b/apps/files/tests/js/fileactionsSpec.js @@ -38,15 +38,17 @@ describe('FileActions tests', function() { 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.action-download').length).toEqual(0); + expect($tr.find('.action.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.action-download').length).toEqual(1); + expect($tr.find('.action.action-download').attr('data-action')).toEqual('Download'); + expect($tr.find('.nametext .action.action-rename').length).toEqual(1); + expect($tr.find('.nametext .action.action-rename').attr('data-action')).toEqual('Rename'); expect($tr.find('.action.delete').length).toEqual(1); }); it('calling display() twice correctly replaces file actions', function() { @@ -56,8 +58,8 @@ describe('FileActions tests', function() { 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.action-download').length).toEqual(1); + expect($tr.find('.nametext .action.action-rename').length).toEqual(1); expect($tr.find('.action.delete').length).toEqual(1); }); it('redirects to download URL when clicking download', function() { @@ -66,10 +68,20 @@ describe('FileActions tests', function() { 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(); + $tr.find('.action-download').click(); expect(redirectStub.calledOnce).toEqual(true); expect(redirectStub.getCall(0).args[0]).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=test%20download%20File.txt'); redirectStub.restore(); }); + it('deletes file when clicking delete', function() { + var deleteStub = sinon.stub(FileList, 'do_delete'); + var $tr = FileList.addFile('test delete File.txt', 1234, new Date()); + FileActions.display($tr.find('td.filename'), true); + + $tr.find('.action.delete').click(); + + expect(deleteStub.calledOnce).toEqual(true); + deleteStub.restore(); + }); }); diff --git a/apps/files_encryption/l10n/el.php b/apps/files_encryption/l10n/el.php index ad8617bc6d2..972d7d7138c 100644 --- a/apps/files_encryption/l10n/el.php +++ b/apps/files_encryption/l10n/el.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Παρακαλώ επιβεβαιώστε ότι η PHP 5.3.3 ή νεότερη είναι εγκατεστημένη και ότι το OpenSSL μαζί με το PHP extension είναι ενεργοποιήμένο και έχει ρυθμιστεί σωστά. Προς το παρόν, η εφαρμογή κρυπτογράφησης είναι απενεργοποιημένη.", "Following users are not set up for encryption:" => "Οι κάτωθι χρήστες δεν έχουν ρυθμιστεί για κρυπογράφηση:", "Initial encryption started... This can take some time. Please wait." => "Η αρχική κρυπτογράφηση άρχισε... Αυτό μπορεί να πάρει κάποια ώρα. Παρακαλώ περιμένετε.", +"Initial encryption running... Please try again later." => "Εκτέλεση αρχικής κρυπτογράφησης... Παρακαλώ προσπαθήστε αργότερα.", "Go directly to your " => "Πηγαίνε απευθείας στο ", "personal settings" => "προσωπικές ρυθμίσεις", "Encryption" => "Κρυπτογράφηση", diff --git a/apps/files_encryption/l10n/et_EE.php b/apps/files_encryption/l10n/et_EE.php index dcf035289fa..f82f9df9279 100644 --- a/apps/files_encryption/l10n/et_EE.php +++ b/apps/files_encryption/l10n/et_EE.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Palun veendu, et on paigaldatud PHP 5.3.3 või uuem ning PHP OpenSSL laiendus on lubatud ning seadistatud korrektselt. Hetkel krüpteerimise rakendus on peatatud.", "Following users are not set up for encryption:" => "Järgmised kasutajad pole seadistatud krüpteeringuks:", "Initial encryption started... This can take some time. Please wait." => "Algne krüpteerimine käivitati... See võib võtta natuke aega. Palun oota.", +"Initial encryption running... Please try again later." => "Toimub esmane krüpteerimine... Palun proovi hiljem uuesti.", "Go directly to your " => "Liigu otse oma", "personal settings" => "isiklikes seadetes", "Encryption" => "Krüpteerimine", diff --git a/apps/files_encryption/l10n/hu_HU.php b/apps/files_encryption/l10n/hu_HU.php index a80c8d6f36d..22c1fa989bd 100644 --- a/apps/files_encryption/l10n/hu_HU.php +++ b/apps/files_encryption/l10n/hu_HU.php @@ -16,6 +16,7 @@ $TRANSLATIONS = array( "Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Kérem gondoskodjon arról, hogy PHP 5.3.3 vagy annál frissebb legyen telepítve, továbbá az OpenSSL a megfelelő PHP-bővítménnyel együtt rendelkezésre álljon és helyesen legyen konfigurálva! A titkosító modul egyelőre kikapcsolásra került.", "Following users are not set up for encryption:" => "A következő felhasználók nem állították be a titkosítást:", "Initial encryption started... This can take some time. Please wait." => "A titkosítási folyamat megkezdődött... Ez hosszabb ideig is eltarthat. Kérem várjon.", +"Initial encryption running... Please try again later." => "Kezedeti titkosítás fut... Próbálja később.", "Go directly to your " => "Ugrás ide:", "personal settings" => "személyes beállítások", "Encryption" => "Titkosítás", diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 6549273c8f1..ae2d8d63e23 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -3,9 +3,10 @@ /** * ownCloud * - * @author Sam Tuke, Robin Appelman - * @copyright 2012 Sam Tuke samtuke@owncloud.com, Robin Appelman - * icewind1991@gmail.com + * @author Bjoern Schiessle, Sam Tuke, Robin Appelman + * @copyright 2012 Sam Tuke <samtuke@owncloud.com> + * 2012 Robin Appelman <icewind1991@gmail.com> + * 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 @@ -36,37 +37,40 @@ namespace OCA\Encryption; */ class Proxy extends \OC_FileProxy { - private static $blackList = null; //mimetypes blacklisted from encryption private static $unencryptedSizes = array(); // remember unencrypted size private static $fopenMode = array(); // remember the fopen mode + private static $enableEncryption = false; // Enable encryption for the given path /** * Check if a file requires encryption * @param string $path + * @param string $mode type of access * @return bool * - * Tests if server side encryption is enabled, and file is allowed by blacklists + * Tests if server side encryption is enabled, and if we should call the + * crypt stream wrapper for the given file */ - private static function shouldEncrypt($path) { + private static function shouldEncrypt($path, $mode = 'w') { $userId = Helper::getUser($path); - if (\OCP\App::isEnabled('files_encryption') === false || Crypt::mode() !== 'server' || - strpos($path, '/' . $userId . '/files') !== 0) { + // don't call the crypt stream wrapper, if... + if ( + \OCP\App::isEnabled('files_encryption') === false // encryption is disabled + || Crypt::mode() !== 'server' // we are not in server-side-encryption mode + || strpos($path, '/' . $userId . '/files') !== 0 // path is not in files/ + || substr($path, 0, 8) === 'crypt://' // we are already in crypt mode + ) { return false; } - if (is_null(self::$blackList)) { - self::$blackList = explode(',', \OCP\Config::getAppValue('files_encryption', 'type_blacklist', '')); - } - - if (Crypt::isCatfileContent($path)) { - return true; - } - - $extension = substr($path, strrpos($path, '.') + 1); + $view = new \OC_FilesystemView(''); + $util = new Util($view, $userId); - if (array_search($extension, self::$blackList) === false) { + // for write operation we always encrypt the files, for read operations + // we check if the existing file is encrypted or not decide if it needs to + // decrypt it. + if (($mode !== 'r' && $mode !== 'rb') || $util->isEncryptedPath($path)) { return true; } @@ -207,22 +211,15 @@ class Proxy extends \OC_FileProxy { } /** - * @param $path - * @return bool - */ - public function postTouch($path) { - $this->handleFile($path); - - return true; - } - - /** * @brief remember initial fopen mode because sometimes it gets changed during the request * @param string $path path * @param string $mode type of access */ public function preFopen($path, $mode) { + self::$fopenMode[$path] = $mode; + self::$enableEncryption = self::shouldEncrypt($path, $mode); + } @@ -235,26 +232,14 @@ class Proxy extends \OC_FileProxy { $path = \OC\Files\Filesystem::normalizePath($path); - if (!$result) { + if (!$result || self::$enableEncryption === false) { return $result; } - // split the path parts - $pathParts = explode('/', $path); - - // don't try to encrypt/decrypt cache chunks or files in the trash bin - if (isset($pathParts[2]) && ($pathParts[2] === 'cache' || $pathParts[2] === 'files_trashbin')) { - return $result; - } - - // Disable encryption proxy to prevent recursive calls - $proxyStatus = \OC_FileProxy::$enabled; - \OC_FileProxy::$enabled = false; - // if we remember the mode from the pre proxy we re-use it - // oterwise we fall back to stream_get_meta_data() + // otherwise we fall back to stream_get_meta_data() if (isset(self::$fopenMode[$path])) { $mode = self::$fopenMode[$path]; unset(self::$fopenMode[$path]); @@ -263,35 +248,12 @@ class Proxy extends \OC_FileProxy { $mode = $meta['mode']; } - $view = new \OC_FilesystemView(''); - - $userId = Helper::getUser($path); - $util = new Util($view, $userId); - - // If file is already encrypted, decrypt using crypto protocol - if ( - Crypt::mode() === 'server' - && $util->isEncryptedPath($path) - ) { - - // Close the original encrypted file - fclose($result); + // Close the original encrypted file + fclose($result); - // Open the file using the crypto stream wrapper - // protocol and let it do the decryption work instead - $result = fopen('crypt://' . $path, $mode); - - } elseif ( - self::shouldEncrypt($path) - and $mode !== 'r' - and $mode !== 'rb' - - ) { - $result = fopen('crypt://' . $path, $mode); - } - - // Re-enable the proxy - \OC_FileProxy::$enabled = $proxyStatus; + // Open the file using the crypto stream wrapper + // protocol and let it do the decryption work instead + $result = fopen('crypt://' . $path, $mode); return $result; @@ -404,39 +366,4 @@ class Proxy extends \OC_FileProxy { return $size; } - /** - * @param $path - */ - public function handleFile($path) { - - // Disable encryption proxy to prevent recursive calls - $proxyStatus = \OC_FileProxy::$enabled; - \OC_FileProxy::$enabled = false; - - $view = new \OC_FilesystemView('/'); - $session = new \OCA\Encryption\Session($view); - $userId = Helper::getUser($path); - $util = new Util($view, $userId); - - // split the path parts - $pathParts = explode('/', $path); - - // get relative path - $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path); - - // only if file is on 'files' folder fix file size and sharing - if (isset($pathParts[2]) && $pathParts[2] === 'files' && $util->fixFileSize($path)) { - - // get sharing app state - $sharingEnabled = \OCP\Share::isEnabled(); - - // get users - $usersSharing = $util->getSharingUsersArray($sharingEnabled, $relativePath); - - // update sharing-keys - $util->setSharedFileKeyfiles($session, $usersSharing, $relativePath); - } - - \OC_FileProxy::$enabled = $proxyStatus; - } } diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index 58ac03373a7..df5de558867 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -545,7 +545,7 @@ class Stream { $util = new Util($this->rootView, $this->userId); // Get all users sharing the file includes current user - $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId); + $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath); $checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds); // Fetch public keys for all sharing users @@ -568,21 +568,25 @@ class Stream { // part file. $path = Helper::stripPartialFileExtension($this->rawPath); - // get file info - $fileInfo = $this->rootView->getFileInfo($path); - if ($fileInfo) { - // set encryption data - $fileInfo['encrypted'] = true; - $fileInfo['size'] = $this->size; - $fileInfo['unencrypted_size'] = $this->unencryptedSize; + $fileInfo = array( + 'encrypted' => true, + 'size' => $this->size, + 'unencrypted_size' => $this->unencryptedSize, + ); - // set fileinfo - $this->rootView->putFileInfo($path, $fileInfo); - } + // set fileinfo + $this->rootView->putFileInfo($path, $fileInfo); + + } + $result = fclose($this->handle); + + if ($result === false) { + \OCP\Util::writeLog('Encryption library', 'Could not close stream, file could be corrupted', \OCP\Util::FATAL); } - return fclose($this->handle); + return $result; + } } diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 3db5a423478..b86815021a8 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -432,25 +432,28 @@ class Util { $proxyStatus = \OC_FileProxy::$enabled; \OC_FileProxy::$enabled = false; - // we only need 24 byte from the last chunk $data = ''; - $handle = $this->view->fopen($path, 'r'); - if (is_resource($handle)) { - // suppress fseek warining, we handle the case that fseek doesn't - // work in the else branch - if (@fseek($handle, -24, SEEK_END) === 0) { - $data = fgets($handle); - } else { - // if fseek failed on the storage we create a local copy from the file - // and read this one - fclose($handle); - $localFile = $this->view->getLocalFile($path); - $handle = fopen($localFile, 'r'); - if (is_resource($handle) && fseek($handle, -24, SEEK_END) === 0) { + + // we only need 24 byte from the last chunk + if ($this->view->file_exists($path)) { + $handle = $this->view->fopen($path, 'r'); + if (is_resource($handle)) { + // suppress fseek warining, we handle the case that fseek doesn't + // work in the else branch + if (@fseek($handle, -24, SEEK_END) === 0) { $data = fgets($handle); + } else { + // if fseek failed on the storage we create a local copy from the file + // and read this one + fclose($handle); + $localFile = $this->view->getLocalFile($path); + $handle = fopen($localFile, 'r'); + if (is_resource($handle) && fseek($handle, -24, SEEK_END) === 0) { + $data = fgets($handle); + } } + fclose($handle); } - fclose($handle); } // re-enable proxy @@ -1124,8 +1127,9 @@ class Util { * @brief Find, sanitise and format users sharing a file * @note This wraps other methods into a portable bundle * @param boolean $sharingEnabled + * @param string $filePath path relativ to current users files folder */ - public function getSharingUsersArray($sharingEnabled, $filePath, $currentUserId = false) { + public function getSharingUsersArray($sharingEnabled, $filePath) { $appConfig = \OC::$server->getAppConfig(); @@ -1144,12 +1148,14 @@ class Util { $ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath); - $userIds = array(); + // always add owner to the list of users with access to the file + $userIds = array($owner); + if ($sharingEnabled) { // Find out who, if anyone, is sharing the file - $result = \OCP\Share::getUsersSharingFile($ownerPath, $owner, true); - $userIds = $result['users']; + $result = \OCP\Share::getUsersSharingFile($ownerPath, $owner); + $userIds = \array_merge($userIds, $result['users']); if ($result['public']) { $userIds[] = $this->publicShareKeyId; } @@ -1165,11 +1171,6 @@ class Util { $userIds[] = $recoveryKeyId; } - // add current user if given - if ($currentUserId !== false) { - $userIds[] = $currentUserId; - } - // check if it is a group mount if (\OCP\App::isEnabled("files_external")) { $mount = \OC_Mount_Config::getSystemMountPoints(); diff --git a/apps/files_encryption/templates/settings-admin.php b/apps/files_encryption/templates/settings-admin.php index 231a68b6a58..cf676c445ce 100644 --- a/apps/files_encryption/templates/settings-admin.php +++ b/apps/files_encryption/templates/settings-admin.php @@ -1,63 +1,60 @@ -<form id="encryption"> - <fieldset class="personalblock"> +<form id="encryption" class="section"> + <h2><?php p($l->t('Encryption')); ?></h2> - <h2><?php p($l->t('Encryption')); ?></h2> + <p> + <?php p($l->t("Enable recovery key (allow to recover users files in case of password loss):")); ?> + <br/> + <br/> + <input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/> + <label for="recoveryPassword"><?php p($l->t("Recovery key password")); ?></label> + <br/> + <input type="password" name="encryptionRecoveryPassword" id="repeatEncryptionRecoveryPassword"/> + <label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat Recovery key password")); ?></label> + <br/> + <input + type='radio' + name='adminEnableRecovery' + value='1' + <?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : 'disabled'); ?> /> + <?php p($l->t("Enabled")); ?> + <br/> - <p> - <?php p($l->t("Enable recovery key (allow to recover users files in case of password loss):")); ?> - <br/> - <br/> - <input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/> - <label for="recoveryPassword"><?php p($l->t("Recovery key password")); ?></label> - <br/> - <input type="password" name="encryptionRecoveryPassword" id="repeatEncryptionRecoveryPassword"/> - <label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat Recovery key password")); ?></label> - <br/> - <input - type='radio' - name='adminEnableRecovery' - value='1' - <?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : 'disabled'); ?> /> - <?php p($l->t("Enabled")); ?> - <br/> + <input + type='radio' + name='adminEnableRecovery' + value='0' + <?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : 'disabled'); ?> /> + <?php p($l->t("Disabled")); ?> + </p> + <br/><br/> - <input - type='radio' - name='adminEnableRecovery' - value='0' - <?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : 'disabled'); ?> /> - <?php p($l->t("Disabled")); ?> - </p> + <p name="changeRecoveryPasswordBlock" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>> + <strong><?php p($l->t("Change recovery key password:")); ?></strong> <br/><br/> - - <p name="changeRecoveryPasswordBlock" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>> - <strong><?php p($l->t("Change recovery key password:")); ?></strong> - <br/><br/> - <input - type="password" - name="changeRecoveryPassword" - id="oldEncryptionRecoveryPassword" - <label for="oldEncryptionRecoveryPassword"><?php p($l->t("Old Recovery key password")); ?></label> - <br/> - <br/> - <input - type="password" - name="changeRecoveryPassword" - id="newEncryptionRecoveryPassword" - <label for="newEncryptionRecoveryPassword"><?php p($l->t("New Recovery key password")); ?></label> - <br/> - <input - type="password" - name="changeRecoveryPassword" - id="repeatedNewEncryptionRecoveryPassword" - <label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat New Recovery key password")); ?></label> - <br/> - <button - type="button" - name="submitChangeRecoveryKey" - disabled><?php p($l->t("Change Password")); ?> - </button> - <span class="msg"></span> - </p> - </fieldset> + <input + type="password" + name="changeRecoveryPassword" + id="oldEncryptionRecoveryPassword" + <label for="oldEncryptionRecoveryPassword"><?php p($l->t("Old Recovery key password")); ?></label> + <br/> + <br/> + <input + type="password" + name="changeRecoveryPassword" + id="newEncryptionRecoveryPassword" + <label for="newEncryptionRecoveryPassword"><?php p($l->t("New Recovery key password")); ?></label> + <br/> + <input + type="password" + name="changeRecoveryPassword" + id="repeatedNewEncryptionRecoveryPassword" + <label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat New Recovery key password")); ?></label> + <br/> + <button + type="button" + name="submitChangeRecoveryKey" + disabled><?php p($l->t("Change Password")); ?> + </button> + <span class="msg"></span> + </p> </form> diff --git a/apps/files_encryption/templates/settings-personal.php b/apps/files_encryption/templates/settings-personal.php index 1b4239d82cd..8139ece1950 100644 --- a/apps/files_encryption/templates/settings-personal.php +++ b/apps/files_encryption/templates/settings-personal.php @@ -1,66 +1,63 @@ -<form id="encryption">
- <fieldset class="personalblock">
- <h2><?php p( $l->t( 'Encryption' ) ); ?></h2>
+<form id="encryption" class="section">
+ <h2><?php p( $l->t( 'Encryption' ) ); ?></h2>
- <?php if ( $_["initialized"] === '1' ): ?>
- <p>
- <a name="changePKPasswd" />
- <label for="changePrivateKeyPasswd">
- <?php p( $l->t( "Your private key password no longer match your log-in password:" ) ); ?>
- </label>
- <br />
- <em><?php p( $l->t( "Set your old private key password to your current log-in password." ) ); ?>
- <?php if ( $_["recoveryEnabledForUser"] ):
- p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
- endif; ?>
- </em>
- <br />
- <input
- type="password"
- name="changePrivateKeyPassword"
- id="oldPrivateKeyPassword" />
- <label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label>
- <br />
- <input
- type="password"
- name="changePrivateKeyPassword"
- id="newPrivateKeyPassword" />
- <label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label>
- <br />
- <button
- type="button"
- name="submitChangePrivateKeyPassword"
- disabled><?php p($l->t( "Update Private Key Password" )); ?>
- </button>
- <span class="msg"></span>
- </p>
- <?php endif; ?>
-
- <?php if ( $_["recoveryEnabled"] && $_["privateKeySet"] ): ?>
+ <?php if ( $_["initialized"] === '1' ): ?>
+ <p>
+ <a name="changePKPasswd" />
+ <label for="changePrivateKeyPasswd">
+ <?php p( $l->t( "Your private key password no longer match your log-in password:" ) ); ?>
+ </label>
+ <br />
+ <em><?php p( $l->t( "Set your old private key password to your current log-in password." ) ); ?>
+ <?php if ( $_["recoveryEnabledForUser"] ):
+ p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
+ endif; ?>
+ </em>
+ <br />
+ <input
+ type="password"
+ name="changePrivateKeyPassword"
+ id="oldPrivateKeyPassword" />
+ <label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label>
+ <br />
+ <input
+ type="password"
+ name="changePrivateKeyPassword"
+ id="newPrivateKeyPassword" />
+ <label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label>
<br />
- <p>
- <label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
- <br />
- <em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
- <br />
- <input
- type='radio'
- name='userEnableRecovery'
- value='1'
- <?php echo ( $_["recoveryEnabledForUser"] == 1 ? 'checked="checked"' : '' ); ?> />
- <?php p( $l->t( "Enabled" ) ); ?>
- <br />
+ <button
+ type="button"
+ name="submitChangePrivateKeyPassword"
+ disabled><?php p($l->t( "Update Private Key Password" )); ?>
+ </button>
+ <span class="msg"></span>
+ </p>
+ <?php endif; ?>
- <input
- type='radio'
- name='userEnableRecovery'
- value='0'
- <?php echo ( $_["recoveryEnabledForUser"] == 0 ? 'checked="checked"' : '' ); ?> />
- <?php p( $l->t( "Disabled" ) ); ?>
- <div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
- <div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
- </p>
- <?php endif; ?>
+ <?php if ( $_["recoveryEnabled"] && $_["privateKeySet"] ): ?>
+ <br />
+ <p>
+ <label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
+ <br />
+ <em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
+ <br />
+ <input
+ type='radio'
+ name='userEnableRecovery'
+ value='1'
+ <?php echo ( $_["recoveryEnabledForUser"] == 1 ? 'checked="checked"' : '' ); ?> />
+ <?php p( $l->t( "Enabled" ) ); ?>
+ <br />
- </fieldset>
+ <input
+ type='radio'
+ name='userEnableRecovery'
+ value='0'
+ <?php echo ( $_["recoveryEnabledForUser"] == 0 ? 'checked="checked"' : '' ); ?> />
+ <?php p( $l->t( "Disabled" ) ); ?>
+ <div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
+ <div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
+ </p>
+ <?php endif; ?>
</form>
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php index be56968ac09..1f57d7cb635 100755 --- a/apps/files_encryption/tests/share.php +++ b/apps/files_encryption/tests/share.php @@ -100,11 +100,11 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { $this->filename = 'share-tmp.test'; - // we don't want to tests with app files_trashbin enabled - \OC_App::disable('files_trashbin'); - // remember files_trashbin state $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin'); + + // we don't want to tests with app files_trashbin enabled + \OC_App::disable('files_trashbin'); } function tearDown() { diff --git a/apps/files_external/3rdparty/phpseclib/LICENSE b/apps/files_external/3rdparty/phpseclib/LICENSE index 6ecd9b9bec1..75f6b2045c5 100644 --- a/apps/files_external/3rdparty/phpseclib/LICENSE +++ b/apps/files_external/3rdparty/phpseclib/LICENSE @@ -1,4 +1,4 @@ -Copyright 2007-2012 TerraFrost and other contributors +Copyright 2007-2013 TerraFrost and other contributors http://phpseclib.sourceforge.net/ Permission is hereby granted, free of charge, to any person obtaining @@ -18,4 +18,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/apps/files_external/3rdparty/phpseclib/README.md b/apps/files_external/3rdparty/phpseclib/README.md index e90b12f4a6d..de528231662 100644 --- a/apps/files_external/3rdparty/phpseclib/README.md +++ b/apps/files_external/3rdparty/phpseclib/README.md @@ -6,11 +6,11 @@ MIT-licensed pure-PHP implementations of an arbitrary-precision integer arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, Rijndael, AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509 -* [Download (0.3.5)](http://sourceforge.net/projects/phpseclib/files/phpseclib0.3.5.zip/download) +* [Download (0.3.6)](http://sourceforge.net/projects/phpseclib/files/phpseclib0.3.6.zip/download) * [Browse Git](https://github.com/phpseclib/phpseclib) * [Documentation](http://phpseclib.sourceforge.net/) * [Support](http://www.frostjedi.com/phpbb/viewforum.php?f=46) -* [Code Coverage Report](http://phpseclib.bantux.org/code_coverage/latest/) +* [Code Coverage Report](http://phpseclib.bantux.org/code_coverage/master/latest/) <img src="http://phpseclib.sourceforge.net/pear-icon.png" alt="PEAR Channel" width="16" height="16"> PEAR Channel: [phpseclib.sourceforge.net](http://phpseclib.sourceforge.net/pear.htm) diff --git a/apps/files_external/3rdparty/phpseclib/composer.json b/apps/files_external/3rdparty/phpseclib/composer.json index 79c92b52e47..70f4f7c36e9 100644 --- a/apps/files_external/3rdparty/phpseclib/composer.json +++ b/apps/files_external/3rdparty/phpseclib/composer.json @@ -11,6 +11,8 @@ "signing", "rsa", "aes", + "blowfish", + "twofish", "ssh", "sftp", "x509", @@ -25,16 +27,34 @@ { "name": "Jim Wigginton", "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", "role": "Developer" } ], "require": { "php": ">=5.0.0" }, + "require-dev": { + "squizlabs/php_codesniffer": "1.*" + }, "suggest": { "ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.", "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP >= 4.3.3." + "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3." }, "include-path": ["phpseclib/"], "autoload": { @@ -42,7 +62,8 @@ "Crypt": "phpseclib/", "File": "phpseclib/", "Math": "phpseclib/", - "Net": "phpseclib/" + "Net": "phpseclib/", + "System": "phpseclib/" }, "files": [ "phpseclib/Crypt/Random.php" diff --git a/apps/files_external/3rdparty/phpseclib/composer.lock b/apps/files_external/3rdparty/phpseclib/composer.lock new file mode 100644 index 00000000000..1b5ff07e484 --- /dev/null +++ b/apps/files_external/3rdparty/phpseclib/composer.lock @@ -0,0 +1,95 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "4975b8cde04a99d6e78e108753845af6", + "packages": [ + + ], + "packages-dev": [ + { + "name": "squizlabs/php_codesniffer", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "a76a39b317ce8106abe6264daa505e24e1731860" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a76a39b317ce8106abe6264daa505e24e1731860", + "reference": "a76a39b317ce8106abe6264daa505e24e1731860", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.1.2" + }, + "suggest": { + "phpunit/php-timer": "dev-master" + }, + "bin": [ + "scripts/phpcs" + ], + "type": "library", + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/CommentParser/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2014-02-04 23:49:58" + } + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ], + "platform": { + "php": ">=5.0.0" + }, + "platform-dev": [ + + ] +} diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/AES.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/AES.php index 81fa2feab66..cf8c050a59e 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/AES.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/AES.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of AES. @@ -54,19 +53,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_AES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVIII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_AES + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVIII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * Include Crypt_Rijndael */ if (!class_exists('Crypt_Rijndael')) { - require_once('Rijndael.php'); + include_once 'Rijndael.php'; } /**#@+ @@ -125,12 +124,13 @@ define('CRYPT_AES_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of AES. * + * @package Crypt_AES * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_AES */ -class Crypt_AES extends Crypt_Rijndael { +class Crypt_AES extends Crypt_Rijndael +{ /** * The namespace used by the cipher for its constants. * @@ -183,6 +183,3 @@ class Crypt_AES extends Crypt_Rijndael { return; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Base.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Base.php index 7c650ca729b..f08529b902b 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Base.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Base.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Base Class for all Crypt_* cipher classes @@ -44,14 +43,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Base - * @author Jim Wigginton <terrafrost@php.net> - * @author Hans-Juergen Petrich <petrich@tronic-media.com> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 1.0.1 - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Base + * @author Jim Wigginton <terrafrost@php.net> + * @author Hans-Juergen Petrich <petrich@tronic-media.com> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 1.0.1 + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -115,13 +114,14 @@ define('CRYPT_MODE_MCRYPT', 2); /** * Base Class for all Crypt_* cipher classes * + * @package Crypt_Base * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @version 1.0.0 * @access public - * @package Crypt_Base */ -class Crypt_Base { +class Crypt_Base +{ /** * The Encryption Mode * @@ -582,7 +582,7 @@ class Crypt_Base { case !function_exists('hash_algos'): case !in_array($hash, hash_algos()): if (!class_exists('Crypt_Hash')) { - require_once('Crypt/Hash.php'); + include_once 'Crypt/Hash.php'; } $i = 1; while (strlen($key) < $dkLen) { @@ -1984,6 +1984,3 @@ class Crypt_Base { return $functions; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Blowfish.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Blowfish.php index c8ef67e8f7c..b352e7c4688 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Blowfish.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Blowfish.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of Blowfish. @@ -45,14 +44,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Blowfish - * @author Jim Wigginton <terrafrost@php.net> - * @author Hans-Juergen Petrich <petrich@tronic-media.com> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 1.0 - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Blowfish + * @author Jim Wigginton <terrafrost@php.net> + * @author Hans-Juergen Petrich <petrich@tronic-media.com> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 1.0 + * @link http://phpseclib.sourceforge.net */ /** @@ -61,7 +60,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -120,13 +119,14 @@ define('CRYPT_BLOWFISH_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of Blowfish. * + * @package Crypt_Blowfish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @version 1.0 * @access public - * @package Crypt_Blowfish */ -class Crypt_Blowfish extends Crypt_Base { +class Crypt_Blowfish extends Crypt_Base +{ /** * Block Length of the cipher * @@ -418,8 +418,7 @@ class Crypt_Blowfish extends Crypt_Base { if (!$keylength) { $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - } - elseif ($keylength > 56) { + } elseif ($keylength > 56) { $key = substr($key, 0, 56); } @@ -673,6 +672,3 @@ class Crypt_Blowfish extends Crypt_Base { $this->inline_crypt = $lambda_functions[$code_hash]; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/DES.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/DES.php index 8b04210659d..fcbf01993a1 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/DES.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/DES.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of DES. @@ -51,12 +50,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_DES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_DES + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -65,7 +64,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -139,12 +138,13 @@ define('CRYPT_DES_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of DES. * + * @package Crypt_DES * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_DES */ -class Crypt_DES extends Crypt_Base { +class Crypt_DES extends Crypt_Base +{ /** * Block Length of the cipher * @@ -1336,12 +1336,14 @@ class Crypt_DES extends Crypt_Base { $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[ $d & 0xFF]; // Reorder: odd bytes/even bytes. Push the result in key schedule. - $keys[$des_round][CRYPT_DES_ENCRYPT][ ] = - $keys[$des_round][CRYPT_DES_DECRYPT][$ki - 1] = ( $cp & 0xFF000000) | (($cp << 8) & 0x00FF0000) | - (($dp >> 16) & 0x0000FF00) | (($dp >> 8) & 0x000000FF); - $keys[$des_round][CRYPT_DES_ENCRYPT][ ] = - $keys[$des_round][CRYPT_DES_DECRYPT][$ki ] = (($cp << 8) & 0xFF000000) | (($cp << 16) & 0x00FF0000) | - (($dp >> 8) & 0x0000FF00) | ( $dp & 0x000000FF); + $val1 = ( $cp & 0xFF000000) | (($cp << 8) & 0x00FF0000) | + (($dp >> 16) & 0x0000FF00) | (($dp >> 8) & 0x000000FF); + $val2 = (($cp << 8) & 0xFF000000) | (($cp << 16) & 0x00FF0000) | + (($dp >> 8) & 0x0000FF00) | ( $dp & 0x000000FF); + $keys[$des_round][CRYPT_DES_ENCRYPT][ ] = $val1; + $keys[$des_round][CRYPT_DES_DECRYPT][$ki - 1] = $val1; + $keys[$des_round][CRYPT_DES_ENCRYPT][ ] = $val2; + $keys[$des_round][CRYPT_DES_DECRYPT][$ki ] = $val2; } } @@ -1531,6 +1533,3 @@ class Crypt_DES extends Crypt_Base { $this->inline_crypt = $lambda_functions[$code_hash]; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Hash.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Hash.php index 21897241989..b156169d68b 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Hash.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Hash.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. @@ -13,7 +12,7 @@ * * PHP versions 4 and 5 * - * {@internal The variable names are the same as those in + * {@internal The variable names are the same as those in * {@link http://tools.ietf.org/html/rfc2104#section-2 RFC2104}.}} * * Here's a short example of how to use this library: @@ -35,10 +34,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -47,12 +46,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Hash - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Hash + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -76,12 +75,13 @@ define('CRYPT_HASH_MODE_HASH', 3); /** * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. * + * @package Crypt_Hash * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_Hash */ -class Crypt_Hash { +class Crypt_Hash +{ /** * Hash Parameter * @@ -581,7 +581,7 @@ class Crypt_Hash { function _sha512($m) { if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } static $init384, $init512, $k; @@ -589,11 +589,11 @@ class Crypt_Hash { if (!isset($k)) { // Initialize variables $init384 = array( // initial values for SHA384 - 'cbbb9d5dc1059ed8', '629a292a367cd507', '9159015a3070dd17', '152fecd8f70e5939', + 'cbbb9d5dc1059ed8', '629a292a367cd507', '9159015a3070dd17', '152fecd8f70e5939', '67332667ffc00b31', '8eb44a8768581511', 'db0c2e0d64f98fa7', '47b5481dbefa4fa4' ); $init512 = array( // initial values for SHA512 - '6a09e667f3bcc908', 'bb67ae8584caa73b', '3c6ef372fe94f82b', 'a54ff53a5f1d36f1', + '6a09e667f3bcc908', 'bb67ae8584caa73b', '3c6ef372fe94f82b', 'a54ff53a5f1d36f1', '510e527fade682d1', '9b05688c2b3e6c1f', '1f83d9abfb41bd6b', '5be0cd19137e2179' ); diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC2.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC2.php index 5e0ca88c8fc..de22d631a16 100755 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC2.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC2.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of RC2. @@ -45,11 +44,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_RC2 - * @author Patrick Monnerat <pm@datasphere.ch> - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_RC2 + * @author Patrick Monnerat <pm@datasphere.ch> + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -58,7 +57,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -117,11 +116,12 @@ define('CRYPT_RC2_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of RC2. * + * @package Crypt_RC2 * @version 0.1.1 * @access public - * @package Crypt_RC2 */ -class Crypt_RC2 extends Crypt_Base { +class Crypt_RC2 extends Crypt_Base +{ /** * Block Length of the cipher * @@ -651,6 +651,3 @@ class Crypt_RC2 extends Crypt_Base { $this->inline_crypt = $lambda_functions[$code_hash]; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC4.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC4.php index f6a9eae2fb7..d062be2573f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC4.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC4.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of RC4. @@ -53,12 +52,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_RC4 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_RC4 + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -67,7 +66,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -95,20 +94,21 @@ define('CRYPT_RC4_DECRYPT', 1); /** * Pure-PHP implementation of RC4. * + * @package Crypt_RC4 * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_RC4 */ -class Crypt_RC4 extends Crypt_Base { +class Crypt_RC4 extends Crypt_Base +{ /** * Block Length of the cipher * - * RC4 is a stream cipher + * RC4 is a stream cipher * so we the block_size to 0 * * @see Crypt_Base::block_size - * @var Integer + * @var Integer * @access private */ var $block_size = 0; @@ -132,7 +132,6 @@ class Crypt_RC4 extends Crypt_Base { */ var $const_namespace = 'RC4'; - /** * The mcrypt specific name of the cipher * @@ -332,6 +331,3 @@ class Crypt_RC4 extends Crypt_Base { return $text; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RSA.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RSA.php index 92ebfdf7236..feb887c7031 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RSA.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RSA.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP PKCS#1 (v2.1) compliant implementation of RSA. @@ -48,10 +47,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -60,12 +59,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_RSA - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMIX Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_RSA + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMIX Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -73,17 +72,17 @@ */ // the class_exists() will only be called if the crypt_random_string function hasn't been defined and // will trigger a call to __autoload() if you're wanting to auto-load classes -// call function_exists() a second time to stop the require_once from being called outside +// call function_exists() a second time to stop the include_once from being called outside // of the auto loader if (!function_exists('crypt_random_string')) { - require_once('Random.php'); + include_once 'Random.php'; } /** * Include Crypt_Hash */ if (!class_exists('Crypt_Hash')) { - require_once('Hash.php'); + include_once 'Hash.php'; } /**#@+ @@ -145,7 +144,7 @@ define('CRYPT_RSA_ASN1_INTEGER', 2); /** * ASN1 Bit String */ -define('CRYPT_RSA_ASN1_BITSTRING', 3); +define('CRYPT_RSA_ASN1_BITSTRING', 3); /** * ASN1 Sequence (with the constucted bit set) */ @@ -240,12 +239,13 @@ define('CRYPT_RSA_PUBLIC_FORMAT_PKCS1', 7); /** * Pure-PHP PKCS#1 compliant implementation of RSA. * + * @package Crypt_RSA * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_RSA */ -class Crypt_RSA { +class Crypt_RSA +{ /** * Precomputed Zero * @@ -433,7 +433,7 @@ class Crypt_RSA { /** * OpenSSL configuration file name. * - * Set to NULL to use system configuration file. + * Set to null to use system configuration file. * @see Crypt_RSA::createKey() * @var Mixed * @Access public @@ -461,7 +461,7 @@ class Crypt_RSA { function Crypt_RSA() { if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } $this->configFile = CRYPT_RSA_OPENSSL_CONFIG; @@ -555,7 +555,7 @@ class Crypt_RSA { $config['config'] = $this->configFile; } $rsa = openssl_pkey_new(array('private_key_bits' => $bits) + $config); - openssl_pkey_export($rsa, $privatekey, NULL, $config); + openssl_pkey_export($rsa, $privatekey, null, $config); $publickey = openssl_pkey_get_details($rsa); $publickey = $publickey['key']; @@ -773,7 +773,7 @@ class Crypt_RSA { $private.= crypt_random_string(16 - (strlen($private) & 15)); $source.= pack('Na*', strlen($private), $private); if (!class_exists('Crypt_AES')) { - require_once('Crypt/AES.php'); + include_once 'Crypt/AES.php'; } $sequence = 0; $symkey = ''; @@ -794,7 +794,7 @@ class Crypt_RSA { $key.= 'Private-Lines: ' . ((strlen($private) + 63) >> 6) . "\r\n"; $key.= chunk_split($private, 64); if (!class_exists('Crypt_Hash')) { - require_once('Crypt/Hash.php'); + include_once 'Crypt/Hash.php'; } $hash = new Crypt_Hash('sha1'); $hash->setKey(pack('H*', sha1($hashkey))); @@ -834,7 +834,7 @@ class Crypt_RSA { $symkey = pack('H*', md5($this->password . $iv)); // symkey is short for symmetric key $symkey.= substr(pack('H*', md5($symkey . $this->password . $iv)), 0, 8); if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $des = new Crypt_TripleDES(); $des->setKey($symkey); @@ -984,7 +984,7 @@ class Crypt_RSA { DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell. DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's - own implementation. ie. the implementation *is* the standard and any bugs that may exist in that + own implementation. ie. the implementation *is* the standard and any bugs that may exist in that implementation are part of the standard, as well. * OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */ @@ -992,41 +992,42 @@ class Crypt_RSA { $iv = pack('H*', trim($matches[2])); $symkey = pack('H*', md5($this->password . substr($iv, 0, 8))); // symkey is short for symmetric key $symkey.= pack('H*', md5($symkey . $this->password . substr($iv, 0, 8))); - $ciphertext = preg_replace('#.+(\r|\n|\r\n)\1|[\r\n]|-.+-| #s', '', $key); - $ciphertext = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $ciphertext) ? base64_decode($ciphertext) : false; + // remove the Proc-Type / DEK-Info sections as they're no longer needed + $key = preg_replace('#^(?:Proc-Type|DEK-Info): .*#m', '', $key); + $ciphertext = $this->_extractBER($key); if ($ciphertext === false) { $ciphertext = $key; } switch ($matches[1]) { case 'AES-256-CBC': if (!class_exists('Crypt_AES')) { - require_once('Crypt/AES.php'); + include_once 'Crypt/AES.php'; } $crypto = new Crypt_AES(); break; case 'AES-128-CBC': if (!class_exists('Crypt_AES')) { - require_once('Crypt/AES.php'); + include_once 'Crypt/AES.php'; } $symkey = substr($symkey, 0, 16); $crypto = new Crypt_AES(); break; case 'DES-EDE3-CFB': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CFB); break; case 'DES-EDE3-CBC': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $symkey = substr($symkey, 0, 24); $crypto = new Crypt_TripleDES(); break; case 'DES-CBC': if (!class_exists('Crypt_DES')) { - require_once('Crypt/DES.php'); + include_once 'Crypt/DES.php'; } $crypto = new Crypt_DES(); break; @@ -1037,8 +1038,7 @@ class Crypt_RSA { $crypto->setIV($iv); $decoded = $crypto->decrypt($ciphertext); } else { - $decoded = preg_replace('#-.+-|[\r\n]| #', '', $key); - $decoded = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $decoded) ? base64_decode($decoded) : false; + $decoded = $this->_extractBER($key); } if ($decoded !== false) { @@ -1240,7 +1240,7 @@ class Crypt_RSA { switch ($encryption) { case 'aes256-cbc': if (!class_exists('Crypt_AES')) { - require_once('Crypt/AES.php'); + include_once 'Crypt/AES.php'; } $symkey = ''; $sequence = 0; @@ -1452,7 +1452,7 @@ class Crypt_RSA { break; } } - + } else { $components = $this->_parseKey($key, $type); } @@ -2152,7 +2152,7 @@ class Crypt_RSA { * * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.2 RFC3447#section-7.1.2}. The fact that the error * messages aren't distinguishable from one another hinders debugging, but, to quote from RFC3447#section-7.1.2: - * + * * Note. Care must be taken to ensure that an opponent cannot * distinguish the different error conditions in Step 3.g, whether by * error message or timing, or, more generally, learn partial @@ -2781,4 +2781,31 @@ class Crypt_RSA { return $this->_rsassa_pss_verify($message, $signature); } } + + /** + * Extract raw BER from Base64 encoding + * + * @access private + * @param String $str + * @return String + */ + function _extractBER($str) + { + /* X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them + * above and beyond the ceritificate. + * ie. some may have the following preceding the -----BEGIN CERTIFICATE----- line: + * + * Bag Attributes + * localKeyID: 01 00 00 00 + * subject=/O=organization/OU=org unit/CN=common name + * issuer=/O=organization/CN=common name + */ + $temp = preg_replace('#.*?^-+[^-]+-+#ms', '', $str, 1); + // remove the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- stuff + $temp = preg_replace('#-+[^-]+-+#', '', $temp); + // remove new lines + $temp = str_replace(array("\r", "\n", ' '), '', $temp); + $temp = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $temp) ? base64_decode($temp) : false; + return $temp != false ? $temp : $str; + } } diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Random.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Random.php index 8532aab5a59..977ec79726b 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Random.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Random.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Random Number Generator @@ -33,12 +32,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Random - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Random + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -132,9 +131,7 @@ function crypt_random_string($length) $old_session_id = session_id(); $old_use_cookies = ini_get('session.use_cookies'); $old_session_cache_limiter = session_cache_limiter(); - if (isset($_SESSION)) { - $_OLD_SESSION = $_SESSION; - } + $_OLD_SESSION = isset($_SESSION) ? $_SESSION : false; if ($old_session_id != '') { session_write_close(); } @@ -167,7 +164,7 @@ function crypt_random_string($length) ini_set('session.use_cookies', $old_use_cookies); session_cache_limiter($old_session_cache_limiter); } else { - if (isset($_OLD_SESSION)) { + if ($_OLD_SESSION !== false) { $_SESSION = $_OLD_SESSION; unset($_OLD_SESSION); } else { diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Rijndael.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Rijndael.php index c63e0ff7e3f..42531516cf8 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Rijndael.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Rijndael.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of Rijndael. @@ -63,12 +62,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Rijndael - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVIII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Rijndael + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVIII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** @@ -77,7 +76,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -136,12 +135,13 @@ define('CRYPT_RIJNDAEL_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of Rijndael. * + * @package Crypt_Rijndael * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_Rijndael */ -class Crypt_Rijndael extends Crypt_Base { +class Crypt_Rijndael extends Crypt_Base +{ /** * The default password key_size used by setPassword() * @@ -1369,6 +1369,3 @@ class Crypt_Rijndael extends Crypt_Base { $this->inline_crypt = $lambda_functions[$code_hash]; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/TripleDES.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/TripleDES.php index 4030c6c9fbe..21318209fe2 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/TripleDES.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/TripleDES.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of Triple DES. @@ -45,19 +44,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_TripleDES - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_TripleDES + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * Include Crypt_DES */ if (!class_exists('Crypt_DES')) { - require_once('DES.php'); + include_once 'DES.php'; } /** @@ -77,12 +76,13 @@ define('CRYPT_DES_MODE_CBC3', CRYPT_DES_MODE_CBC); /** * Pure-PHP implementation of Triple DES. * + * @package Crypt_TripleDES * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Crypt_TripleDES */ -class Crypt_TripleDES extends Crypt_DES { +class Crypt_TripleDES extends Crypt_DES +{ /** * The default password key_size used by setPassword() * @@ -417,6 +417,3 @@ class Crypt_TripleDES extends Crypt_DES { parent::_setupKey(); } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Twofish.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Twofish.php index 6342298d1a3..9be5fd10997 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Twofish.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/Twofish.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of Twofish. @@ -45,14 +44,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Crypt - * @package Crypt_Twofish - * @author Jim Wigginton <terrafrost@php.net> - * @author Hans-Juergen Petrich <petrich@tronic-media.com> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 1.0 - * @link http://phpseclib.sourceforge.net + * @category Crypt + * @package Crypt_Twofish + * @author Jim Wigginton <terrafrost@php.net> + * @author Hans-Juergen Petrich <petrich@tronic-media.com> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 1.0 + * @link http://phpseclib.sourceforge.net */ /** @@ -61,7 +60,7 @@ * Base cipher class */ if (!class_exists('Crypt_Base')) { - require_once('Base.php'); + include_once 'Base.php'; } /**#@+ @@ -120,13 +119,14 @@ define('CRYPT_TWOFISH_MODE_MCRYPT', CRYPT_MODE_MCRYPT); /** * Pure-PHP implementation of Twofish. * + * @package Crypt_Twofish * @author Jim Wigginton <terrafrost@php.net> * @author Hans-Juergen Petrich <petrich@tronic-media.com> * @version 1.0 * @access public - * @package Crypt_Twofish */ -class Crypt_Twofish extends Crypt_Base { +class Crypt_Twofish extends Crypt_Base +{ /** * The namespace used by the cipher for its constants. * @@ -919,6 +919,3 @@ class Crypt_Twofish extends Crypt_Base { $this->inline_crypt = $lambda_functions[$code_hash]; } } - -// vim: ts=4:sw=4:et: -// vim6: fdl=1: diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/File/ANSI.php b/apps/files_external/3rdparty/phpseclib/phpseclib/File/ANSI.php index f7ac85536f8..0e0004ce27d 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/File/ANSI.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/File/ANSI.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP ANSI Decoder @@ -17,10 +16,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,23 +28,24 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category File - * @package File_ANSI - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMXII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category File + * @package File_ANSI + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMXII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * Pure-PHP ANSI Decoder * + * @package File_ANSI * @author Jim Wigginton <terrafrost@php.net> * @version 0.3.0 * @access public - * @package File_ANSI */ -class File_ANSI { +class File_ANSI +{ /** * Max Width * @@ -557,4 +557,4 @@ class File_ANSI { return '<pre style="color: white; background: black" width="' . ($this->max_x + 1) . '">' . $scrollback . '</pre>'; } -}
\ No newline at end of file +} diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/File/ASN1.php b/apps/files_external/3rdparty/phpseclib/phpseclib/File/ASN1.php index 9f481fc3ccb..67d1f6dc790 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/File/ASN1.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/File/ASN1.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP ASN.1 Parser @@ -20,10 +19,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -32,12 +31,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category File - * @package File_ASN1 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMXII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category File + * @package File_ASN1 + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMXII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -58,21 +57,21 @@ define('FILE_ASN1_CLASS_PRIVATE', 3); * @access private * @link http://www.obj-sys.com/asn1tutorial/node124.html */ -define('FILE_ASN1_TYPE_BOOLEAN', 1); -define('FILE_ASN1_TYPE_INTEGER', 2); -define('FILE_ASN1_TYPE_BIT_STRING', 3); -define('FILE_ASN1_TYPE_OCTET_STRING', 4); -define('FILE_ASN1_TYPE_NULL', 5); -define('FILE_ASN1_TYPE_OBJECT_IDENTIFIER',6); -//define('FILE_ASN1_TYPE_OBJECT_DESCRIPTOR',7); -//define('FILE_ASN1_TYPE_INSTANCE_OF', 8); // EXTERNAL -define('FILE_ASN1_TYPE_REAL', 9); -define('FILE_ASN1_TYPE_ENUMERATED', 10); -//define('FILE_ASN1_TYPE_EMBEDDED', 11); -define('FILE_ASN1_TYPE_UTF8_STRING', 12); -//define('FILE_ASN1_TYPE_RELATIVE_OID', 13); -define('FILE_ASN1_TYPE_SEQUENCE', 16); // SEQUENCE OF -define('FILE_ASN1_TYPE_SET', 17); // SET OF +define('FILE_ASN1_TYPE_BOOLEAN', 1); +define('FILE_ASN1_TYPE_INTEGER', 2); +define('FILE_ASN1_TYPE_BIT_STRING', 3); +define('FILE_ASN1_TYPE_OCTET_STRING', 4); +define('FILE_ASN1_TYPE_NULL', 5); +define('FILE_ASN1_TYPE_OBJECT_IDENTIFIER', 6); +//define('FILE_ASN1_TYPE_OBJECT_DESCRIPTOR', 7); +//define('FILE_ASN1_TYPE_INSTANCE_OF', 8); // EXTERNAL +define('FILE_ASN1_TYPE_REAL', 9); +define('FILE_ASN1_TYPE_ENUMERATED', 10); +//define('FILE_ASN1_TYPE_EMBEDDED', 11); +define('FILE_ASN1_TYPE_UTF8_STRING', 12); +//define('FILE_ASN1_TYPE_RELATIVE_OID', 13); +define('FILE_ASN1_TYPE_SEQUENCE', 16); // SEQUENCE OF +define('FILE_ASN1_TYPE_SET', 17); // SET OF /**#@-*/ /**#@+ * More Tag Classes @@ -80,19 +79,19 @@ define('FILE_ASN1_TYPE_SET', 17); // SET OF * @access private * @link http://www.obj-sys.com/asn1tutorial/node10.html */ -define('FILE_ASN1_TYPE_NUMERIC_STRING', 18); -define('FILE_ASN1_TYPE_PRINTABLE_STRING',19); -define('FILE_ASN1_TYPE_TELETEX_STRING', 20); // T61String -define('FILE_ASN1_TYPE_VIDEOTEX_STRING', 21); -define('FILE_ASN1_TYPE_IA5_STRING', 22); -define('FILE_ASN1_TYPE_UTC_TIME', 23); -define('FILE_ASN1_TYPE_GENERALIZED_TIME',24); -define('FILE_ASN1_TYPE_GRAPHIC_STRING', 25); -define('FILE_ASN1_TYPE_VISIBLE_STRING', 26); // ISO646String -define('FILE_ASN1_TYPE_GENERAL_STRING', 27); -define('FILE_ASN1_TYPE_UNIVERSAL_STRING',28); -//define('FILE_ASN1_TYPE_CHARACTER_STRING',29); -define('FILE_ASN1_TYPE_BMP_STRING', 30); +define('FILE_ASN1_TYPE_NUMERIC_STRING', 18); +define('FILE_ASN1_TYPE_PRINTABLE_STRING', 19); +define('FILE_ASN1_TYPE_TELETEX_STRING', 20); // T61String +define('FILE_ASN1_TYPE_VIDEOTEX_STRING', 21); +define('FILE_ASN1_TYPE_IA5_STRING', 22); +define('FILE_ASN1_TYPE_UTC_TIME', 23); +define('FILE_ASN1_TYPE_GENERALIZED_TIME', 24); +define('FILE_ASN1_TYPE_GRAPHIC_STRING', 25); +define('FILE_ASN1_TYPE_VISIBLE_STRING', 26); // ISO646String +define('FILE_ASN1_TYPE_GENERAL_STRING', 27); +define('FILE_ASN1_TYPE_UNIVERSAL_STRING', 28); +//define('FILE_ASN1_TYPE_CHARACTER_STRING', 29); +define('FILE_ASN1_TYPE_BMP_STRING', 30); /**#@-*/ /**#@+ @@ -111,12 +110,13 @@ define('FILE_ASN1_TYPE_ANY', -2); * * Bypass normal encoding rules in File_ASN1::encodeDER() * + * @package File_ASN1 * @author Jim Wigginton <terrafrost@php.net> * @version 0.3.0 * @access public - * @package File_ASN1 */ -class File_ASN1_Element { +class File_ASN1_Element +{ /** * Raw element value * @@ -141,12 +141,13 @@ class File_ASN1_Element { /** * Pure-PHP ASN.1 Parser * + * @package File_ASN1 * @author Jim Wigginton <terrafrost@php.net> * @version 0.3.0 * @access public - * @package File_ASN1 */ -class File_ASN1 { +class File_ASN1 +{ /** * ASN.1 object identifier * @@ -252,7 +253,7 @@ class File_ASN1 { if (!$static_init) { $static_init = true; if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } } } @@ -316,7 +317,7 @@ class File_ASN1 { $length = ord($this->_string_shift($encoded)); $start++; if ( $length == 0x80 ) { // indefinite length - // "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all + // "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all // immediately available." -- paragraph 8.1.3.2.c //if ( !$constructed ) { // return false; @@ -419,7 +420,7 @@ class File_ASN1 { //} $current['content'].= $temp[$i]['content']; } - // $length = + // $length = } break; case FILE_ASN1_TYPE_NULL: @@ -456,7 +457,7 @@ class File_ASN1 { -- X.690-0207.pdf#page=23 (paragraph 8.21.3) - Per that, we're not going to do any validation. If there are any illegal characters in the string, + Per that, we're not going to do any validation. If there are any illegal characters in the string, we don't really care */ case FILE_ASN1_TYPE_NUMERIC_STRING: // 0,1,2,3,4,5,6,7,8,9, and space @@ -545,13 +546,13 @@ class File_ASN1 { return array($key => $value); } } - return NULL; + return null; case isset($mapping['implicit']): case isset($mapping['explicit']): case $decoded['type'] == $mapping['type']: break; default: - return NULL; + return null; } if (isset($mapping['implicit'])) { @@ -566,8 +567,8 @@ class File_ASN1 { if (isset($mapping['min']) && isset($mapping['max'])) { $child = $mapping['children']; foreach ($decoded['content'] as $content) { - if (($map[] = $this->asn1map($content, $child, $special)) === NULL) { - return NULL; + if (($map[] = $this->asn1map($content, $child, $special)) === null) { + return null; } } @@ -585,15 +586,14 @@ class File_ASN1 { if ($child['type'] != FILE_ASN1_TYPE_CHOICE) { // Get the mapping and input class & constant. $childClass = $tempClass = FILE_ASN1_CLASS_UNIVERSAL; - $constant = NULL; + $constant = null; if (isset($temp['constant'])) { $tempClass = isset($temp['class']) ? $temp['class'] : FILE_ASN1_CLASS_CONTEXT_SPECIFIC; } if (isset($child['class'])) { $childClass = $child['class']; $constant = $child['cast']; - } - elseif (isset($child['constant'])) { + } elseif (isset($child['constant'])) { $childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC; $constant = $child['constant']; } @@ -611,7 +611,7 @@ class File_ASN1 { if ($maymatch) { // Attempt submapping. $candidate = $this->asn1map($temp, $child, $special); - $maymatch = $candidate !== NULL; + $maymatch = $candidate !== null; } if ($maymatch) { @@ -624,12 +624,12 @@ class File_ASN1 { } elseif (isset($child['default'])) { $map[$key] = $child['default']; // Use default. } elseif (!isset($child['optional'])) { - return NULL; // Syntax error. + return null; // Syntax error. } } // Fail mapping if all input items have not been consumed. - return $i < $n? NULL: $map; + return $i < $n? null: $map; // the main diff between sets and sequences is the encapsulation of the foreach in another for loop case FILE_ASN1_TYPE_SET: @@ -639,8 +639,8 @@ class File_ASN1 { if (isset($mapping['min']) && isset($mapping['max'])) { $child = $mapping['children']; foreach ($decoded['content'] as $content) { - if (($map[] = $this->asn1map($content, $child, $special)) === NULL) { - return NULL; + if (($map[] = $this->asn1map($content, $child, $special)) === null) { + return null; } } @@ -661,12 +661,11 @@ class File_ASN1 { $maymatch = true; if ($child['type'] != FILE_ASN1_TYPE_CHOICE) { $childClass = FILE_ASN1_CLASS_UNIVERSAL; - $constant = NULL; + $constant = null; if (isset($child['class'])) { $childClass = $child['class']; $constant = $child['cast']; - } - elseif (isset($child['constant'])) { + } elseif (isset($child['constant'])) { $childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC; $constant = $child['constant']; } @@ -683,7 +682,7 @@ class File_ASN1 { if ($maymatch) { // Attempt submapping. $candidate = $this->asn1map($temp, $child, $special); - $maymatch = $candidate !== NULL; + $maymatch = $candidate !== null; } if (!$maymatch) { @@ -704,7 +703,7 @@ class File_ASN1 { if (isset($child['default'])) { $map[$key] = $child['default']; } elseif (!isset($child['optional'])) { - return NULL; + return null; } } } @@ -797,7 +796,7 @@ class File_ASN1 { function encodeDER($source, $mapping, $special = array()) { $this->location = array(); - return $this->_encode_der($source, $mapping, NULL, $special); + return $this->_encode_der($source, $mapping, null, $special); } /** @@ -819,7 +818,7 @@ class File_ASN1 { * @return String * @access private */ - function _encode_der($source, $mapping, $idx = NULL, $special = array()) + function _encode_der($source, $mapping, $idx = null, $special = array()) { if (is_object($source) && strtolower(get_class($source)) == 'file_asn1_element') { return $source->element; @@ -850,7 +849,7 @@ class File_ASN1 { $child = $mapping['children']; foreach ($source as $content) { - $temp = $this->_encode_der($content, $child, NULL, $special); + $temp = $this->_encode_der($content, $child, null, $special); if ($temp === false) { return false; } @@ -1030,19 +1029,19 @@ class File_ASN1 { switch (true) { case !isset($source): - return $this->_encode_der(NULL, array('type' => FILE_ASN1_TYPE_NULL) + $mapping, NULL, $special); + return $this->_encode_der(null, array('type' => FILE_ASN1_TYPE_NULL) + $mapping, null, $special); case is_int($source): case is_object($source) && strtolower(get_class($source)) == 'math_biginteger': - return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_INTEGER) + $mapping, NULL, $special); + return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_INTEGER) + $mapping, null, $special); case is_float($source): - return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_REAL) + $mapping, NULL, $special); + return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_REAL) + $mapping, null, $special); case is_bool($source): - return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_BOOLEAN) + $mapping, NULL, $special); + return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_BOOLEAN) + $mapping, null, $special); case is_array($source) && count($source) == 1: $typename = implode('', array_keys($source)); $outtype = array_search($typename, $this->ANYmap, true); if ($outtype !== false) { - return $this->_encode_der($source[$typename], array('type' => $outtype) + $mapping, NULL, $special); + return $this->_encode_der($source[$typename], array('type' => $outtype) + $mapping, null, $special); } } @@ -1058,7 +1057,7 @@ class File_ASN1 { user_error('No filters defined for ' . implode('/', $loc)); return false; } - return $this->_encode_der($source, $filters + $mapping, NULL, $special); + return $this->_encode_der($source, $filters + $mapping, null, $special); case FILE_ASN1_TYPE_NULL: $value = ''; break; diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/File/X509.php b/apps/files_external/3rdparty/phpseclib/phpseclib/File/X509.php index 0b4e291361e..9e7b0b3b962 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/File/X509.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/File/X509.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP X.509 Parser @@ -8,7 +7,7 @@ * * Encode and decode X.509 certificates. * - * The extensions are from {@link http://tools.ietf.org/html/rfc5280 RFC5280} and + * The extensions are from {@link http://tools.ietf.org/html/rfc5280 RFC5280} and * {@link http://web.archive.org/web/19961027104704/http://www3.netscape.com/eng/security/cert-exts.html Netscape Certificate Extensions}. * * Note that loading an X.509 certificate and resaving it may invalidate the signature. The reason being that the signature is based on a @@ -23,10 +22,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -35,19 +34,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category File - * @package File_X509 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMXII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category File + * @package File_X509 + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMXII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * Include File_ASN1 */ if (!class_exists('File_ASN1')) { - require_once('ASN1.php'); + include_once 'ASN1.php'; } /** @@ -124,12 +123,13 @@ define('FILE_X509_ATTR_REPLACE', -3); // Clear first, then add a value. /** * Pure-PHP X.509 Parser * + * @package File_X509 * @author Jim Wigginton <terrafrost@php.net> * @version 0.3.1 * @access public - * @package File_X509 */ -class File_X509 { +class File_X509 +{ /** * ASN.1 syntax for X.509 certificates * @@ -248,7 +248,7 @@ class File_X509 { * The signature subject * * There's no guarantee File_X509 is going to reencode an X.509 cert in the same way it was originally - * encoded so we take save the portion of the original cert that the signature would have made for. + * encoded so we take save the portion of the original cert that the signature would have made for. * * @var String * @access private @@ -307,7 +307,7 @@ class File_X509 { function File_X509() { if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } // Explicitly Tagged Module, 1988 Syntax @@ -1431,7 +1431,7 @@ class File_X509 { $this->currentCert = $cert; $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); - $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : NULL; + $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; unset($this->signatureSubject); @@ -1469,7 +1469,7 @@ class File_X509 { $this->dn = $x509['tbsCertificate']['subject']; $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); - $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : NULL; + $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; return $x509; } @@ -1496,33 +1496,33 @@ class File_X509 { default: switch ($algorithm) { case 'rsaEncryption': - $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'] = - base64_encode("\0" . base64_decode(preg_replace('#-.+-|[\r\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']))); + $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'] + = base64_encode("\0" . base64_decode(preg_replace('#-.+-|[\r\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']))); } } $asn1 = new File_ASN1(); - $asn1->loadOIDs($this->oids); $filters = array(); - $filters['tbsCertificate']['signature']['parameters'] = - $filters['tbsCertificate']['signature']['issuer']['rdnSequence']['value'] = - $filters['tbsCertificate']['issuer']['rdnSequence']['value'] = - $filters['tbsCertificate']['subject']['rdnSequence']['value'] = - $filters['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = - $filters['signatureAlgorithm']['parameters'] = - $filters['authorityCertIssuer']['directoryName']['rdnSequence']['value'] = - //$filters['policyQualifiers']['qualifier'] = - $filters['distributionPoint']['fullName']['directoryName']['rdnSequence']['value'] = - $filters['directoryName']['rdnSequence']['value'] = - array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $type_utf8_string = array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['tbsCertificate']['signature']['parameters'] = $type_utf8_string; + $filters['tbsCertificate']['signature']['issuer']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['issuer']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['subject']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = $type_utf8_string; + $filters['signatureAlgorithm']['parameters'] = $type_utf8_string; + $filters['authorityCertIssuer']['directoryName']['rdnSequence']['value'] = $type_utf8_string; + //$filters['policyQualifiers']['qualifier'] = $type_utf8_string; + $filters['distributionPoint']['fullName']['directoryName']['rdnSequence']['value'] = $type_utf8_string; + $filters['directoryName']['rdnSequence']['value'] = $type_utf8_string; + /* in the case of policyQualifiers/qualifier, the type has to be FILE_ASN1_TYPE_IA5_STRING. FILE_ASN1_TYPE_PRINTABLE_STRING will cause OpenSSL's X.509 parser to spit out random characters. */ - $filters['policyQualifiers']['qualifier'] = - array('type' => FILE_ASN1_TYPE_IA5_STRING); + $filters['policyQualifiers']['qualifier'] + = array('type' => FILE_ASN1_TYPE_IA5_STRING); $asn1->loadFilters($filters); @@ -1715,8 +1715,7 @@ class File_X509 { if ($map === false) { user_error($id . ' is not a currently supported attribute', E_USER_NOTICE); unset($attributes[$i]); - } - elseif (is_array($attributes[$i]['value'])) { + } elseif (is_array($attributes[$i]['value'])) { $values = &$attributes[$i]['value']; for ($j = 0; $j < count($values); $j++) { switch ($id) { @@ -1963,7 +1962,7 @@ class File_X509 { * @param Integer $date optional * @access public */ - function validateDate($date = NULL) + function validateDate($date = null) { if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { return false; @@ -1992,7 +1991,7 @@ class File_X509 { * Validate a signature * * Works on X.509 certs, CSR's and CRL's. - * Returns true if the signature is verified, false if it is not correct or NULL on error + * Returns true if the signature is verified, false if it is not correct or null on error * * By default returns false for self-signed certs. Call validateSignature(false) to make this support * self-signed. @@ -2006,7 +2005,7 @@ class File_X509 { function validateSignature($caonly = true) { if (!is_array($this->currentCert) || !isset($this->signatureSubject)) { - return NULL; + return null; } /* TODO: @@ -2107,7 +2106,7 @@ class File_X509 { /** * Validates a signature * - * Returns true if the signature is verified, false if it is not correct or NULL on error + * Returns true if the signature is verified, false if it is not correct or null on error * * @param String $publicKeyAlgorithm * @param String $publicKey @@ -2122,7 +2121,7 @@ class File_X509 { switch ($publicKeyAlgorithm) { case 'rsaEncryption': if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $rsa = new Crypt_RSA(); $rsa->loadKey($publicKey); @@ -2142,11 +2141,11 @@ class File_X509 { } break; default: - return NULL; + return null; } break; default: - return NULL; + return null; } return true; @@ -2367,7 +2366,7 @@ class File_X509 { * @return Mixed * @access public */ - function getDNProp($propName, $dn = NULL, $withType = false) + function getDNProp($propName, $dn = null, $withType = false) { if (!isset($dn)) { $dn = $this->dn; @@ -2421,7 +2420,7 @@ class File_X509 { function setDN($dn, $merge = false, $type = 'utf8String') { if (!$merge) { - $this->dn = NULL; + $this->dn = null; } if (is_array($dn)) { @@ -2460,7 +2459,7 @@ class File_X509 { * @access public * @return Boolean */ - function getDN($format = FILE_X509_DN_ARRAY, $dn = NULL) + function getDN($format = FILE_X509_DN_ARRAY, $dn = null) { if (!isset($dn)) { $dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn; @@ -2524,7 +2523,7 @@ class File_X509 { case FILE_X509_DN_HASH: $dn = $this->getDN(FILE_X509_DN_CANON, $dn); if (!class_exists('Crypt_Hash')) { - require_once('Crypt/Hash.php'); + include_once 'Crypt/Hash.php'; } $hash = new Crypt_Hash('sha1'); $hash = $hash->hash($dn); @@ -2676,7 +2675,7 @@ class File_X509 { { switch (true) { case !empty($this->dn): - return $this->getDNProp($propName, NULL, $withType); + return $this->getDNProp($propName, null, $withType); case !isset($this->currentCert) || !is_array($this->currentCert): break; case isset($this->currentCert['tbsCertificate']): @@ -2792,7 +2791,7 @@ class File_X509 { switch ($keyinfo['algorithm']['algorithm']) { case 'rsaEncryption': if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $publicKey = new Crypt_RSA(); $publicKey->loadKey($key); @@ -2865,17 +2864,17 @@ class File_X509 { switch ($algorithm) { case 'rsaEncryption': if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $this->publicKey = new Crypt_RSA(); $this->publicKey->loadKey($key); $this->publicKey->setPublicKey(); break; default: - $this->publicKey = NULL; + $this->publicKey = null; } - $this->currentKeyIdentifier = NULL; + $this->currentKeyIdentifier = null; $this->currentCert = $csr; return $csr; @@ -2902,8 +2901,8 @@ class File_X509 { default: switch ($algorithm) { case 'rsaEncryption': - $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'] = - base64_encode("\0" . base64_decode(preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']))); + $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'] + = base64_encode("\0" . base64_decode(preg_replace('#-.+-|[\r\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']))); } } @@ -2912,8 +2911,8 @@ class File_X509 { $asn1->loadOIDs($this->oids); $filters = array(); - $filters['certificationRequestInfo']['subject']['rdnSequence']['value'] = - array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['certificationRequestInfo']['subject']['rdnSequence']['value'] + = array('type' => FILE_ASN1_TYPE_UTF8_STRING); $asn1->loadFilters($filters); @@ -2990,17 +2989,17 @@ class File_X509 { switch ($algorithm) { case 'rsaEncryption': if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $this->publicKey = new Crypt_RSA(); $this->publicKey->loadKey($key); $this->publicKey->setPublicKey(); break; default: - $this->publicKey = NULL; + $this->publicKey = null; } - $this->currentKeyIdentifier = NULL; + $this->currentKeyIdentifier = null; $this->currentCert = $spkac; return $spkac; @@ -3048,14 +3047,14 @@ class File_X509 { $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); $this->_mapInExtensions($crl, 'tbsCertList/crlExtensions', $asn1); - $rclist = &$this->_subArray($crl,'tbsCertList/revokedCertificates'); + $rclist = &$this->_subArray($crl, 'tbsCertList/revokedCertificates'); if (is_array($rclist)) { foreach ($rclist as $i => $extension) { $this->_mapInExtensions($rclist, "$i/crlEntryExtensions", $asn1); } } - $this->currentKeyIdentifier = NULL; + $this->currentKeyIdentifier = null; $this->currentCert = $crl; return $crl; @@ -3080,25 +3079,27 @@ class File_X509 { $asn1->loadOIDs($this->oids); $filters = array(); - $filters['tbsCertList']['issuer']['rdnSequence']['value'] = - $filters['tbsCertList']['signature']['parameters'] = - $filters['signatureAlgorithm']['parameters'] = - array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['tbsCertList']['issuer']['rdnSequence']['value'] + = array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['tbsCertList']['signature']['parameters'] + = array('type' => FILE_ASN1_TYPE_UTF8_STRING); + $filters['signatureAlgorithm']['parameters'] + = array('type' => FILE_ASN1_TYPE_UTF8_STRING); if (empty($crl['tbsCertList']['signature']['parameters'])) { - $filters['tbsCertList']['signature']['parameters'] = - array('type' => FILE_ASN1_TYPE_NULL); + $filters['tbsCertList']['signature']['parameters'] + = array('type' => FILE_ASN1_TYPE_NULL); } if (empty($crl['signatureAlgorithm']['parameters'])) { - $filters['signatureAlgorithm']['parameters'] = - array('type' => FILE_ASN1_TYPE_NULL); + $filters['signatureAlgorithm']['parameters'] + = array('type' => FILE_ASN1_TYPE_NULL); } $asn1->loadFilters($filters); $this->_mapOutExtensions($crl, 'tbsCertList/crlExtensions', $asn1); - $rclist = &$this->_subArray($crl,'tbsCertList/revokedCertificates'); + $rclist = &$this->_subArray($crl, 'tbsCertList/revokedCertificates'); if (is_array($rclist)) { foreach ($rclist as $i => $extension) { $this->_mapOutExtensions($rclist, "$i/crlEntryExtensions", $asn1); @@ -3139,14 +3140,14 @@ class File_X509 { return false; } - $currentCert = isset($this->currentCert) ? $this->currentCert : NULL; - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: NULL; + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; if (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertificate'])) { $this->currentCert = $subject->currentCert; - $this->currentCert['tbsCertificate']['signature']['algorithm'] = - $this->currentCert['signatureAlgorithm']['algorithm'] = - $signatureAlgorithm; + $this->currentCert['tbsCertificate']['signature']['algorithm'] = $signatureAlgorithm; + $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; + if (!empty($this->startDate)) { $this->currentCert['tbsCertificate']['validity']['notBefore']['generalTime'] = $this->startDate; unset($this->currentCert['tbsCertificate']['validity']['notBefore']['utcTime']); @@ -3312,12 +3313,11 @@ class File_X509 { } $this->publicKey = $origPublicKey; - $currentCert = isset($this->currentCert) ? $this->currentCert : NULL; - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: NULL; + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject: null; if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['certificationRequestInfo'])) { - $this->currentCert['signatureAlgorithm']['algorithm'] = - $signatureAlgorithm; + $this->currentCert['signatureAlgorithm']['algorithm'] = $signatureAlgorithm; if (!empty($this->dn)) { $this->currentCert['certificationRequestInfo']['subject'] = $this->dn; } @@ -3366,8 +3366,8 @@ class File_X509 { return false; } - $currentCert = isset($this->currentCert) ? $this->currentCert : NULL; - $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : NULL; + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; $thisUpdate = !empty($this->startDate) ? $this->startDate : @date('D, d M y H:i:s O'); if (isset($crl->currentCert) && is_array($crl->currentCert) && isset($crl->currentCert['tbsCertList'])) { @@ -3400,10 +3400,9 @@ class File_X509 { if (!empty($this->serialNumber)) { $crlNumber = $this->serialNumber; - } - else { + } else { $crlNumber = $this->getExtension('id-ce-cRLNumber'); - $crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : NULL; + $crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : null; } $this->removeExtension('id-ce-authorityKeyIdentifier'); @@ -3414,8 +3413,7 @@ class File_X509 { if (!$version) { if (!empty($tbsCertList['crlExtensions'])) { $version = 1; // v2. - } - elseif (!empty($tbsCertList['revokedCertificates'])) { + } elseif (!empty($tbsCertList['revokedCertificates'])) { foreach ($tbsCertList['revokedCertificates'] as $cert) { if (!empty($cert['crlEntryExtensions'])) { $version = 1; // v2. @@ -3613,7 +3611,7 @@ class File_X509 { * @access private * @return array ref or false */ - function &_extensions(&$root, $path = NULL, $create = false) + function &_extensions(&$root, $path = null, $create = false) { if (!isset($root)) { $root = $this->currentCert; @@ -3667,7 +3665,7 @@ class File_X509 { * @access private * @return Boolean */ - function _removeExtension($id, $path = NULL) + function _removeExtension($id, $path = null) { $extensions = &$this->_extensions($this->currentCert, $path); @@ -3698,7 +3696,7 @@ class File_X509 { * @access private * @return Mixed */ - function _getExtension($id, $cert = NULL, $path = NULL) + function _getExtension($id, $cert = null, $path = null) { $extensions = $this->_extensions($cert, $path); @@ -3723,7 +3721,7 @@ class File_X509 { * @access private * @return Array */ - function _getExtensions($cert = NULL, $path = NULL) + function _getExtensions($cert = null, $path = null) { $exts = $this->_extensions($cert, $path); $extensions = array(); @@ -3748,7 +3746,7 @@ class File_X509 { * @access private * @return Boolean */ - function _setExtension($id, $value, $critical = false, $replace = true, $path = NULL) + function _setExtension($id, $value, $critical = false, $replace = true, $path = null) { $extensions = &$this->_extensions($this->currentCert, $path, true); @@ -3795,7 +3793,7 @@ class File_X509 { * @access public * @return Mixed */ - function getExtension($id, $cert = NULL) + function getExtension($id, $cert = null) { return $this->_getExtension($id, $cert); } @@ -3807,7 +3805,7 @@ class File_X509 { * @access public * @return Array */ - function getExtensions($cert = NULL) + function getExtensions($cert = null) { return $this->_getExtensions($cert); } @@ -3886,7 +3884,7 @@ class File_X509 { * @access public * @return Mixed */ - function getAttribute($id, $disposition = FILE_X509_ATTR_ALL, $csr = NULL) + function getAttribute($id, $disposition = FILE_X509_ATTR_ALL, $csr = null) { if (empty($csr)) { $csr = $this->currentCert; @@ -3926,7 +3924,7 @@ class File_X509 { * @access public * @return Array */ - function getAttributes($csr = NULL) + function getAttributes($csr = null) { if (empty($csr)) { $csr = $this->currentCert; @@ -4035,7 +4033,7 @@ class File_X509 { * @access public * @return String binary key identifier */ - function computeKeyIdentifier($key = NULL, $method = 1) + function computeKeyIdentifier($key = null, $method = 1) { if (is_null($key)) { $key = $this; @@ -4064,7 +4062,7 @@ class File_X509 { $raw = base64_decode($raw); // If the key is private, compute identifier from its corresponding public key. if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $key = new Crypt_RSA(); if (!$key->loadKey($raw)) { @@ -4096,7 +4094,7 @@ class File_X509 { // Now we have the key string: compute its sha-1 sum. if (!class_exists('Crypt_Hash')) { - require_once('Crypt/Hash.php'); + include_once 'Crypt/Hash.php'; } $hash = new Crypt_Hash('sha1'); $hash = $hash->hash($key); @@ -4228,7 +4226,7 @@ class File_X509 { * @access public * @return Boolean */ - function revoke($serial, $date = NULL) + function revoke($serial, $date = null) { if (isset($this->currentCert['tbsCertList'])) { if (is_array($rclist = &$this->_subArray($this->currentCert, 'tbsCertList/revokedCertificates', true))) { @@ -4293,7 +4291,7 @@ class File_X509 { * @access public * @return array */ - function listRevoked($crl = NULL) + function listRevoked($crl = null) { if (!isset($crl)) { $crl = $this->currentCert; @@ -4344,7 +4342,7 @@ class File_X509 { * @access public * @return Mixed */ - function getRevokedCertificateExtension($serial, $id, $crl = NULL) + function getRevokedCertificateExtension($serial, $id, $crl = null) { if (!isset($crl)) { $crl = $this->currentCert; @@ -4367,7 +4365,7 @@ class File_X509 { * @access public * @return Array */ - function getRevokedCertificateExtensions($serial, $crl = NULL) + function getRevokedCertificateExtensions($serial, $crl = null) { if (!isset($crl)) { $crl = $this->currentCert; @@ -4415,15 +4413,15 @@ class File_X509 { */ function _extractBER($str) { - /* - X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them above and beyond the ceritificate. ie. - some may have the following preceding the -----BEGIN CERTIFICATE----- line: - - Bag Attributes - localKeyID: 01 00 00 00 - subject=/O=organization/OU=org unit/CN=common name - issuer=/O=organization/CN=common name - */ + /* X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them + * above and beyond the ceritificate. + * ie. some may have the following preceding the -----BEGIN CERTIFICATE----- line: + * + * Bag Attributes + * localKeyID: 01 00 00 00 + * subject=/O=organization/OU=org unit/CN=common name + * issuer=/O=organization/CN=common name + */ $temp = preg_replace('#.*?^-+[^-]+-+#ms', '', $str, 1); // remove the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- stuff $temp = preg_replace('#-+[^-]+-+#', '', $temp); diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Math/BigInteger.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Math/BigInteger.php index e40433de5bd..1b4ea675fcc 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Math/BigInteger.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Math/BigInteger.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP arbitrary precision integer arithmetic library. @@ -9,7 +8,7 @@ * * PHP versions 4 and 5 * - * {@internal (all DocBlock comments regarding implementation - such as the one that follows - refer to the + * {@internal (all DocBlock comments regarding implementation - such as the one that follows - refer to the * {@link MATH_BIGINTEGER_MODE_INTERNAL MATH_BIGINTEGER_MODE_INTERNAL} mode) * * Math_BigInteger uses base-2**26 to perform operations such as multiplication and division and @@ -53,10 +52,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -65,12 +64,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Math - * @package Math_BigInteger - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVI Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://pear.php.net/package/Math_BigInteger + * @category Math + * @package Math_BigInteger + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVI Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger */ /**#@+ @@ -174,12 +173,13 @@ define('MATH_BIGINTEGER_KARATSUBA_CUTOFF', 25); * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 * numbers. * + * @package Math_BigInteger * @author Jim Wigginton <terrafrost@php.net> * @version 1.0.0RC4 * @access public - * @package Math_BigInteger */ -class Math_BigInteger { +class Math_BigInteger +{ /** * Holds the BigInteger's value. * @@ -223,7 +223,7 @@ class Math_BigInteger { /** * Mode independent value used for serialization. * - * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for + * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for * a variable that'll be serializable regardless of whether or not extensions are being used. Unlike $this->value, * however, $this->hex is only calculated when $this->__sleep() is called. * @@ -797,7 +797,7 @@ class Math_BigInteger { $vars[] = 'precision'; } return $vars; - + } /** @@ -2279,7 +2279,7 @@ class Math_BigInteger { /** * Montgomery Multiply * - * Interleaves the montgomery reduction and long multiplication algorithms together as described in + * Interleaves the montgomery reduction and long multiplication algorithms together as described in * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} * * @see _prepMontgomery() @@ -2359,7 +2359,7 @@ class Math_BigInteger { * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} * * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For - * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields + * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the @@ -3290,7 +3290,7 @@ class Math_BigInteger { * @return Boolean * @access public * @internal Uses the - * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See + * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24}. */ function isPrime($t = false) @@ -3299,6 +3299,7 @@ class Math_BigInteger { if (!$t) { // see HAC 4.49 "Note (controlling the error probability)" + // @codingStandardsIgnoreStart if ($length >= 163) { $t = 2; } // floor(1300 / 8) else if ($length >= 106) { $t = 3; } // floor( 850 / 8) else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) @@ -3311,6 +3312,7 @@ class Math_BigInteger { else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8) else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8) else { $t = 27; } + // @codingStandardsIgnoreEnd } // ie. gmp_testbit($this, 0) @@ -3339,16 +3341,16 @@ class Math_BigInteger { if (!isset($primes)) { $primes = array( - 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, - 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, - 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, - 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, - 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, - 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, - 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, - 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, - 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, - 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, + 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, + 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, + 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, + 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, + 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, + 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, + 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, + 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, + 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, + 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 ); diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SCP.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SCP.php index 88180cac67a..4cfa357009f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SCP.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SCP.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of SCP. @@ -30,10 +29,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -42,12 +41,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Net - * @package Net_SCP - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMX Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Net + * @package Net_SCP + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMX Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -82,12 +81,13 @@ define('NET_SCP_SSH2', 2); /** * Pure-PHP implementations of SCP. * + * @package Net_SCP * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Net_SCP */ -class Net_SCP { +class Net_SCP +{ /** * SSH Object * @@ -151,7 +151,7 @@ class Net_SCP { * So, for example, if you set $data to 'filename.ext' and then do Net_SCP::get(), you will get a file, twelve bytes * long, containing 'filename.ext' as its contents. * - * Setting $mode to NET_SCP_LOCAL_FILE will change the above behavior. With NET_SCP_LOCAL_FILE, $remote_file will + * Setting $mode to NET_SCP_LOCAL_FILE will change the above behavior. With NET_SCP_LOCAL_FILE, $remote_file will * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how * large $remote_file will be, as well. * @@ -181,7 +181,7 @@ class Net_SCP { } if ($this->mode == NET_SCP_SSH2) { - $this->packet_size = $this->ssh->packet_size_client_to_server[NET_SSH2_CHANNEL_EXEC]; + $this->packet_size = $this->ssh->packet_size_client_to_server[NET_SSH2_CHANNEL_EXEC] - 4; } $remote_file = basename($remote_file); @@ -353,7 +353,7 @@ class Net_SCP { { switch ($this->mode) { case NET_SCP_SSH2: - $this->ssh->_close_channel(NET_SSH2_CHANNEL_EXEC); + $this->ssh->_close_channel(NET_SSH2_CHANNEL_EXEC, true); break; case NET_SCP_SSH1: $this->ssh->disconnect(); diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP.php index 5356ffbf77a..68d944f9f3f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of SFTP. @@ -34,10 +33,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -46,19 +45,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Net - * @package Net_SFTP - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMIX Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Net + * @package Net_SFTP + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMIX Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * Include Net_SSH2 */ if (!class_exists('Net_SSH2')) { - require_once('SSH2.php'); + include_once 'SSH2.php'; } /**#@+ @@ -116,12 +115,13 @@ define('NET_SFTP_RESUME_START', 8); /** * Pure-PHP implementations of SFTP. * + * @package Net_SFTP * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Net_SFTP */ -class Net_SFTP extends Net_SSH2 { +class Net_SFTP extends Net_SSH2 +{ /** * Packet Types * @@ -233,7 +233,7 @@ class Net_SFTP extends Net_SSH2 { * Directory Cache * * Rather than always having to open a directory and close it immediately there after to see if a file is a directory or - * rather than always + * rather than always * * @see Net_SFTP::_save_dir() * @see Net_SFTP::_remove_dir() @@ -347,7 +347,7 @@ class Net_SFTP extends Net_SSH2 { 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS', 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME', // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers - // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in + // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in // two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000. // that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored. -1 << 31 => 'NET_SFTP_ATTR_EXTENDED' @@ -402,7 +402,7 @@ class Net_SFTP extends Net_SSH2 { function login($username) { $args = func_get_args(); - if (!call_user_func_array(array('Net_SSH2', 'login'), $args)) { + if (!call_user_func_array(array(&$this, '_login'), $args)) { return false; } @@ -635,7 +635,11 @@ class Net_SFTP extends Net_SSH2 { return false; } - if ($dir[strlen($dir) - 1] != '/') { + // assume current dir if $dir is empty + if ($dir === '') { + $dir = './'; + // suffix a slash if needed + } elseif ($dir[strlen($dir) - 1] != '/') { $dir.= '/'; } @@ -1038,7 +1042,7 @@ class Net_SFTP extends Net_SSH2 { */ function truncate($filename, $new_size) { - $attr = pack('N3', NET_SFTP_ATTR_SIZE, $new_size / 0x100000000, $new_size); + $attr = pack('N3', NET_SFTP_ATTR_SIZE, $new_size / 4294967296, $new_size); // 4294967296 == 0x100000000 == 1<<32 return $this->_setstat($filename, $attr, false); } @@ -1054,7 +1058,7 @@ class Net_SFTP extends Net_SSH2 { * @return Boolean * @access public */ - function touch($filename, $time = NULL, $atime = NULL) + function touch($filename, $time = null, $atime = null) { if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { return false; @@ -1097,7 +1101,7 @@ class Net_SFTP extends Net_SSH2 { /** * Changes file or directory owner * - * Returns TRUE on success or FALSE on error. + * Returns true on success or false on error. * * @param String $filename * @param Integer $uid @@ -1117,7 +1121,7 @@ class Net_SFTP extends Net_SSH2 { /** * Changes file or directory group * - * Returns TRUE on success or FALSE on error. + * Returns true on success or false on error. * * @param String $filename * @param Integer $gid @@ -1135,8 +1139,8 @@ class Net_SFTP extends Net_SSH2 { /** * Set permissions on a file. * - * Returns the new file permissions on success or FALSE on error. - * If $recursive is true than this just returns TRUE or FALSE. + * Returns the new file permissions on success or false on error. + * If $recursive is true than this just returns true or false. * * @param Integer $mode * @param String $filename @@ -1216,7 +1220,7 @@ class Net_SFTP extends Net_SSH2 { } /* - "Because some systems must use separate system calls to set various attributes, it is possible that a failure + "Because some systems must use separate system calls to set various attributes, it is possible that a failure response will be returned, but yet some of the attributes may be have been successfully modified. If possible, servers SHOULD avoid this situation; however, clients MUST be aware that this is possible." @@ -1326,7 +1330,7 @@ class Net_SFTP extends Net_SSH2 { } $dir = $this->_realpath($dir); - // by not providing any permissions, hopefully the server will use the logged in users umask - their + // by not providing any permissions, hopefully the server will use the logged in users umask - their // default permissions. $attr = $mode == -1 ? "\0\0\0\0" : pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); @@ -1424,7 +1428,7 @@ class Net_SFTP extends Net_SSH2 { * So, for example, if you set $data to 'filename.ext' and then do Net_SFTP::get(), you will get a file, twelve bytes * long, containing 'filename.ext' as its contents. * - * Setting $mode to NET_SFTP_LOCAL_FILE will change the above behavior. With NET_SFTP_LOCAL_FILE, $remote_file will + * Setting $mode to NET_SFTP_LOCAL_FILE will change the above behavior. With NET_SFTP_LOCAL_FILE, $remote_file will * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how * large $remote_file will be, as well. * @@ -1502,8 +1506,6 @@ class Net_SFTP extends Net_SSH2 { return false; } - $initialize = true; - // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.3 if ($mode & NET_SFTP_LOCAL_FILE) { if (!is_file($data)) { @@ -1537,7 +1539,7 @@ class Net_SFTP extends Net_SSH2 { while ($sent < $size) { $temp = $mode & NET_SFTP_LOCAL_FILE ? fread($fp, $sftp_packet_size) : substr($data, $sent, $sftp_packet_size); $subtemp = $offset + $sent; - $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 0x100000000, $subtemp, strlen($temp), $temp); + $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp); if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet)) { fclose($fp); return false; @@ -1683,9 +1685,10 @@ class Net_SFTP extends Net_SSH2 { $content = ''; } + $start = $offset; $size = $this->max_sftp_packet < $length || $length < 0 ? $this->max_sftp_packet : $length; while (true) { - $packet = pack('Na*N3', strlen($handle), $handle, $offset / 0x100000000, $offset, $size); + $packet = pack('Na*N3', strlen($handle), $handle, $offset / 4294967296, $offset, $size); if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet)) { if ($local_file !== false) { fclose($fp); @@ -1716,12 +1719,12 @@ class Net_SFTP extends Net_SSH2 { return false; } - if ($length > 0 && $length <= $offset - $size) { + if ($length > 0 && $length <= $offset - $start) { break; } } - if ($length > 0 && $length <= $offset - $size) { + if ($length > 0 && $length <= $offset - $start) { if ($local_file === false) { $content = substr($content, 0, $length); } else { @@ -1923,7 +1926,7 @@ class Net_SFTP extends Net_SSH2 { // (0xFFFFFFFF bytes), anyway. as such, we'll just represent all file sizes that are bigger than // 4GB as being 4GB. extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8))); - $attr['size'] = $upper ? 0x100000000 * $upper : 0; + $attr['size'] = $upper ? 4294967296 * $upper : 0; $attr['size']+= $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size; break; case NET_SFTP_ATTR_UIDGID: // 0x00000002 (SFTPv3 only) @@ -2054,7 +2057,7 @@ class Net_SFTP extends Net_SSH2 { $stop = strtok(microtime(), ' ') + strtok(''); if (defined('NET_SFTP_LOGGING')) { - $packet_type = '-> ' . $this->packet_types[$type] . + $packet_type = '-> ' . $this->packet_types[$type] . ' (' . round($stop - $start, 4) . 's)'; if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n"; @@ -2130,7 +2133,7 @@ class Net_SFTP extends Net_SSH2 { $packet = $this->_string_shift($this->packet_buffer, $length); if (defined('NET_SFTP_LOGGING')) { - $packet_type = '<- ' . $this->packet_types[$this->packet_type] . + $packet_type = '<- ' . $this->packet_types[$this->packet_type] . ' (' . round($stop - $start, 4) . 's)'; if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) { echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n"; diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP/Stream.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP/Stream.php index 0572c5c4025..48b79b3ef7f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP/Stream.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SFTP/Stream.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * SFTP Stream Wrapper @@ -14,10 +13,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -26,23 +25,24 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Net - * @package Net_SFTP_Stream - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMXIII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Net + * @package Net_SFTP_Stream + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMXIII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /** * SFTP Stream Wrapper * + * @package Net_SFTP_Stream * @author Jim Wigginton <terrafrost@php.net> * @version 0.3.2 * @access public - * @package Net_SFTP_Stream */ -class Net_SFTP_Stream { +class Net_SFTP_Stream +{ /** * SFTP instances * @@ -134,8 +134,12 @@ class Net_SFTP_Stream { */ function Net_SFTP_Stream() { + if (defined('NET_SFTP_STREAM_LOGGING')) { + echo "__construct()\r\n"; + } + if (!class_exists('Net_SFTP')) { - require_once('Net/SFTP.php'); + include_once 'Net/SFTP.php'; } } @@ -513,7 +517,7 @@ class Net_SFTP_Stream { * Open directory handle * * The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and - * removed in 5.4 I'm just going to ignore it + * removed in 5.4 I'm just going to ignore it * * @param String $path * @param Integer $options diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH1.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH1.php index 83d5980d00a..0a6aa908289 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH1.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH1.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of SSHv1. @@ -36,7 +35,7 @@ * ?> * </code> * - * More information on the SSHv1 specification can be found by reading + * More information on the SSHv1 specification can be found by reading * {@link http://www.snailbook.com/docs/protocol-1.5.txt protocol-1.5.txt}. * * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy @@ -45,10 +44,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -57,12 +56,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Net - * @package Net_SSH1 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Net + * @package Net_SSH1 + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -202,11 +201,11 @@ define('NET_SSH1_LOG_COMPLEX', 2); /** * Outputs the content real-time */ -define('NET_SSH2_LOG_REALTIME', 3); +define('NET_SSH1_LOG_REALTIME', 3); /** * Dumps the content real-time to a file */ -define('NET_SSH2_LOG_REALTIME_FILE', 4); +define('NET_SSH1_LOG_REALTIME_FILE', 4); /**#@-*/ /**#@+ @@ -226,12 +225,13 @@ define('NET_SSH1_READ_REGEX', 2); /** * Pure-PHP implementation of SSHv1. * + * @package Net_SSH1 * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Net_SSH1 */ -class Net_SSH1 { +class Net_SSH1 +{ /** * The SSH identifier * @@ -429,12 +429,36 @@ class Net_SSH1 { /** * Current Timeout * - * @see Net_SSH2::_get_channel_packet() + * @see Net_SSH1::_get_channel_packet() * @access private */ var $curTimeout; /** + * Log Boundary + * + * @see Net_SSH1::_format_log + * @access private + */ + var $log_boundary = ':'; + + /** + * Log Long Width + * + * @see Net_SSH1::_format_log + * @access private + */ + var $log_long_width = 65; + + /** + * Log Short Width + * + * @see Net_SSH1::_format_log + * @access private + */ + var $log_short_width = 16; + + /** * Default Constructor. * * Connects to an SSHv1 server @@ -449,16 +473,16 @@ class Net_SSH1 { function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) { if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } // Include Crypt_Random // the class_exists() will only be called if the crypt_random_string function hasn't been defined and // will trigger a call to __autoload() if you're wanting to auto-load classes - // call function_exists() a second time to stop the require_once from being called outside + // call function_exists() a second time to stop the include_once from being called outside // of the auto loader if (!function_exists('crypt_random_string') && !class_exists('Crypt_Random') && !function_exists('crypt_random_string')) { - require_once('Crypt/Random.php'); + include_once 'Crypt/Random.php'; } $this->protocol_flags = array( @@ -603,7 +627,7 @@ class Net_SSH1 { // break; case NET_SSH1_CIPHER_DES: if (!class_exists('Crypt_DES')) { - require_once('Crypt/DES.php'); + include_once 'Crypt/DES.php'; } $this->crypto = new Crypt_DES(); $this->crypto->disablePadding(); @@ -612,7 +636,7 @@ class Net_SSH1 { break; case NET_SSH1_CIPHER_3DES: if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $this->crypto = new Crypt_TripleDES(CRYPT_DES_MODE_3CBC); $this->crypto->disablePadding(); @@ -621,7 +645,7 @@ class Net_SSH1 { break; //case NET_SSH1_CIPHER_RC4: // if (!class_exists('Crypt_RC4')) { - // require_once('Crypt/RC4.php'); + // include_once('Crypt/RC4.php'); // } // $this->crypto = new Crypt_RC4(); // $this->crypto->enableContinuousBuffer(); @@ -1017,7 +1041,7 @@ class Net_SSH1 { if ($this->curTimeout) { $read = array($this->fsock); - $write = $except = NULL; + $write = $except = null; $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $sec = floor($this->curTimeout); @@ -1253,7 +1277,7 @@ class Net_SSH1 { { /* if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $rsa = new Crypt_RSA(); @@ -1318,7 +1342,7 @@ class Net_SSH1 { /** * Returns a log of the packets that have been sent and received. * - * Returns a string if NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX, an array if NET_SSH2_LOGGING == NET_SSH2_LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING') + * Returns a string if NET_SSH1_LOGGING == NET_SSH1_LOG_COMPLEX, an array if NET_SSH1_LOGGING == NET_SSH1_LOG_SIMPLE and false if !defined('NET_SSH1_LOGGING') * * @access public * @return String or Array @@ -1351,8 +1375,6 @@ class Net_SSH1 { */ function _format_log($message_log, $message_number_log) { - static $boundary = ':', $long_width = 65, $short_width = 16; - $output = ''; for ($i = 0; $i < count($message_log); $i++) { $output.= $message_number_log[$i] . "\r\n"; @@ -1362,19 +1384,13 @@ class Net_SSH1 { if (strlen($current_log)) { $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; } - $fragment = $this->_string_shift($current_log, $short_width); - $hex = substr( - preg_replace( - '#(.)#es', - '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', - $fragment), - strlen($boundary) - ); + $fragment = $this->_string_shift($current_log, $this->log_short_width); + $hex = substr(preg_replace_callback('#.#s', array($this, '_format_log_helper'), $fragment), strlen($this->log_boundary)); // replace non ASCII printable characters with dots // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters // also replace < with a . since < messes up the output on web browsers $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); - $output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n"; + $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; $j++; } while (strlen($current_log)); $output.= "\r\n"; @@ -1384,6 +1400,20 @@ class Net_SSH1 { } /** + * Helper function for _format_log + * + * For use with preg_replace_callback() + * + * @param Array $matches + * @access private + * @return String + */ + function _format_log_helper($matches) + { + return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT); + } + + /** * Return the server key public exponent * * Returns, by default, the base-10 representation. If $raw_output is set to true, returns, instead, @@ -1496,57 +1526,57 @@ class Net_SSH1 { */ function _append_log($protocol_flags, $message) { - switch (NET_SSH1_LOGGING) { - // useful for benchmarks - case NET_SSH1_LOG_SIMPLE: - $this->protocol_flags_log[] = $protocol_flags; - break; - // the most useful log for SSH1 - case NET_SSH1_LOG_COMPLEX: - $this->protocol_flags_log[] = $protocol_flags; - $this->_string_shift($message); - $this->log_size+= strlen($message); - $this->message_log[] = $message; - while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) { - $this->log_size-= strlen(array_shift($this->message_log)); - array_shift($this->protocol_flags_log); - } - break; - // dump the output out realtime; packets may be interspersed with non packets, - // passwords won't be filtered out and select other packets may not be correctly - // identified - case NET_SSH1_LOG_REALTIME: - echo "<pre>\r\n" . $this->_format_log(array($message), array($protocol_flags)) . "\r\n</pre>\r\n"; - @flush(); - @ob_flush(); + switch (NET_SSH1_LOGGING) { + // useful for benchmarks + case NET_SSH1_LOG_SIMPLE: + $this->protocol_flags_log[] = $protocol_flags; + break; + // the most useful log for SSH1 + case NET_SSH1_LOG_COMPLEX: + $this->protocol_flags_log[] = $protocol_flags; + $this->_string_shift($message); + $this->log_size+= strlen($message); + $this->message_log[] = $message; + while ($this->log_size > NET_SSH1_LOG_MAX_SIZE) { + $this->log_size-= strlen(array_shift($this->message_log)); + array_shift($this->protocol_flags_log); + } + break; + // dump the output out realtime; packets may be interspersed with non packets, + // passwords won't be filtered out and select other packets may not be correctly + // identified + case NET_SSH1_LOG_REALTIME: + echo "<pre>\r\n" . $this->_format_log(array($message), array($protocol_flags)) . "\r\n</pre>\r\n"; + @flush(); + @ob_flush(); + break; + // basically the same thing as NET_SSH1_LOG_REALTIME with the caveat that NET_SSH1_LOG_REALTIME_FILE + // needs to be defined and that the resultant log file will be capped out at NET_SSH1_LOG_MAX_SIZE. + // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily + // at the beginning of the file + case NET_SSH1_LOG_REALTIME_FILE: + if (!isset($this->realtime_log_file)) { + // PHP doesn't seem to like using constants in fopen() + $filename = NET_SSH1_LOG_REALTIME_FILE; + $fp = fopen($filename, 'w'); + $this->realtime_log_file = $fp; + } + if (!is_resource($this->realtime_log_file)) { break; - // basically the same thing as NET_SSH1_LOG_REALTIME with the caveat that NET_SSH1_LOG_REALTIME_FILE - // needs to be defined and that the resultant log file will be capped out at NET_SSH1_LOG_MAX_SIZE. - // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily - // at the beginning of the file - case NET_SSH1_LOG_REALTIME_FILE: - if (!isset($this->realtime_log_file)) { - // PHP doesn't seem to like using constants in fopen() - $filename = NET_SSH2_LOG_REALTIME_FILE; - $fp = fopen($filename, 'w'); - $this->realtime_log_file = $fp; - } - if (!is_resource($this->realtime_log_file)) { - break; - } - $entry = $this->_format_log(array($message), array($protocol_flags)); - if ($this->realtime_log_wrap) { - $temp = "<<< START >>>\r\n"; - $entry.= $temp; - fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); - } - $this->realtime_log_size+= strlen($entry); - if ($this->realtime_log_size > NET_SSH1_LOG_MAX_SIZE) { - fseek($this->realtime_log_file, 0); - $this->realtime_log_size = strlen($entry); - $this->realtime_log_wrap = true; - } - fputs($this->realtime_log_file, $entry); - } + } + $entry = $this->_format_log(array($message), array($protocol_flags)); + if ($this->realtime_log_wrap) { + $temp = "<<< START >>>\r\n"; + $entry.= $temp; + fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); + } + $this->realtime_log_size+= strlen($entry); + if ($this->realtime_log_size > NET_SSH1_LOG_MAX_SIZE) { + fseek($this->realtime_log_file, 0); + $this->realtime_log_size = strlen($entry); + $this->realtime_log_wrap = true; + } + fputs($this->realtime_log_file, $entry); + } } } diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH2.php b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH2.php index dad03697233..2fddb68a9b2 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH2.php +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/Net/SSH2.php @@ -1,5 +1,4 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Pure-PHP implementation of SSHv2. @@ -47,10 +46,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -59,12 +58,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @category Net - * @package Net_SSH2 - * @author Jim Wigginton <terrafrost@php.net> - * @copyright MMVII Jim Wigginton - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://phpseclib.sourceforge.net + * @category Net + * @package Net_SSH2 + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net */ /**#@+ @@ -144,19 +143,20 @@ define('NET_SSH2_LOG_MAX_SIZE', 1024 * 1024); /** * Pure-PHP implementation of SSHv2. * + * @package Net_SSH2 * @author Jim Wigginton <terrafrost@php.net> * @version 0.1.0 * @access public - * @package Net_SSH2 */ -class Net_SSH2 { +class Net_SSH2 +{ /** * The SSH identifier * * @var String * @access private */ - var $identifier = 'SSH-2.0-phpseclib_0.3'; + var $identifier; /** * The Socket Object @@ -748,6 +748,30 @@ class Net_SSH2 { var $is_timeout = false; /** + * Log Boundary + * + * @see Net_SSH2::_format_log + * @access private + */ + var $log_boundary = ':'; + + /** + * Log Long Width + * + * @see Net_SSH2::_format_log + * @access private + */ + var $log_long_width = 65; + + /** + * Log Short Width + * + * @see Net_SSH2::_format_log + * @access private + */ + var $log_short_width = 16; + + /** * Default Constructor. * * Connects to an SSHv2 server @@ -763,15 +787,15 @@ class Net_SSH2 { // Include Math_BigInteger // Used to do Diffie-Hellman key exchange and DSA/RSA signature verification. if (!class_exists('Math_BigInteger')) { - require_once('Math/BigInteger.php'); + include_once 'Math/BigInteger.php'; } if (!function_exists('crypt_random_string')) { - require_once('Crypt/Random.php'); + include_once 'Crypt/Random.php'; } if (!class_exists('Crypt_Hash')) { - require_once('Crypt/Hash.php'); + include_once 'Crypt/Hash.php'; } $this->last_packet = strtok(microtime(), ' ') + strtok(''); // == microtime(true) in PHP5 @@ -861,7 +885,7 @@ class Net_SSH2 { } $read = array($this->fsock); - $write = $except = NULL; + $write = $except = null; $sec = floor($timeout); $usec = 1000000 * ($timeout - $sec); @@ -895,19 +919,7 @@ class Net_SSH2 { return false; } - $ext = array(); - if (extension_loaded('mcrypt')) { - $ext[] = 'mcrypt'; - } - if (extension_loaded('gmp')) { - $ext[] = 'gmp'; - } else if (extension_loaded('bcmath')) { - $ext[] = 'bcmath'; - } - - if (!empty($ext)) { - $this->identifier.= ' (' . implode(', ', $ext) . ')'; - } + $this->identifier = $this->_generate_identifier(); if (defined('NET_SSH2_LOGGING')) { $this->_append_log('<-', $extra . $temp); @@ -945,6 +957,36 @@ class Net_SSH2 { } /** + * Generates the SSH identifier + * + * You should overwrite this method in your own class if you want to use another identifier + * + * @access protected + * @return String + */ + function _generate_identifier() + { + $identifier = 'SSH-2.0-phpseclib_0.3'; + + $ext = array(); + if (extension_loaded('mcrypt')) { + $ext[] = 'mcrypt'; + } + + if (extension_loaded('gmp')) { + $ext[] = 'gmp'; + } elseif (extension_loaded('bcmath')) { + $ext[] = 'bcmath'; + } + + if (!empty($ext)) { + $identifier .= ' (' . implode(', ', $ext) . ')'; + } + + return $identifier; + } + + /** * Key Exchange * * @param String $kexinit_payload_server @@ -1223,23 +1265,23 @@ class Net_SSH2 { } switch ($kex_algorithms[$i]) { - // see http://tools.ietf.org/html/rfc2409#section-6.2 and + // see http://tools.ietf.org/html/rfc2409#section-6.2 and // http://tools.ietf.org/html/rfc2412, appendex E case 'diffie-hellman-group1-sha1': - $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . + '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; break; // see http://tools.ietf.org/html/rfc3526#section-3 case 'diffie-hellman-group14-sha1': - $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . - '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . - '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . - 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . - '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . - '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . - 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . + '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . + '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . + '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'; break; } @@ -1260,7 +1302,8 @@ class Net_SSH2 { -- http://tools.ietf.org/html/rfc4419#section-6.2 */ $one = new Math_BigInteger(1); $keyLength = min($keyLength, $kexHash->getLength()); - $max = $one->bitwise_leftShift(16 * $keyLength)->subtract($one); // 2 * 8 * $keyLength + $max = $one->bitwise_leftShift(16 * $keyLength); // 2 * 8 * $keyLength + $max = $max->subtract($one); $x = $one->random($one, $max); $e = $g->modPow($x, $prime); @@ -1353,14 +1396,14 @@ class Net_SSH2 { switch ($encrypt) { case '3des-cbc': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $this->encrypt = new Crypt_TripleDES(); // $this->encrypt_block_size = 64 / 8 == the default break; case '3des-ctr': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $this->encrypt = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); // $this->encrypt_block_size = 64 / 8 == the default @@ -1369,7 +1412,7 @@ class Net_SSH2 { case 'aes192-cbc': case 'aes128-cbc': if (!class_exists('Crypt_Rijndael')) { - require_once('Crypt/Rijndael.php'); + include_once 'Crypt/Rijndael.php'; } $this->encrypt = new Crypt_Rijndael(); $this->encrypt_block_size = 16; // eg. 128 / 8 @@ -1378,21 +1421,21 @@ class Net_SSH2 { case 'aes192-ctr': case 'aes128-ctr': if (!class_exists('Crypt_Rijndael')) { - require_once('Crypt/Rijndael.php'); + include_once 'Crypt/Rijndael.php'; } $this->encrypt = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CTR); $this->encrypt_block_size = 16; // eg. 128 / 8 break; case 'blowfish-cbc': if (!class_exists('Crypt_Blowfish')) { - require_once('Crypt/Blowfish.php'); + include_once 'Crypt/Blowfish.php'; } $this->encrypt = new Crypt_Blowfish(); $this->encrypt_block_size = 8; break; case 'blowfish-ctr': if (!class_exists('Crypt_Blowfish')) { - require_once('Crypt/Blowfish.php'); + include_once 'Crypt/Blowfish.php'; } $this->encrypt = new Crypt_Blowfish(CRYPT_BLOWFISH_MODE_CTR); $this->encrypt_block_size = 8; @@ -1402,7 +1445,7 @@ class Net_SSH2 { case 'twofish256-cbc': case 'twofish-cbc': if (!class_exists('Crypt_Twofish')) { - require_once('Crypt/Twofish.php'); + include_once 'Crypt/Twofish.php'; } $this->encrypt = new Crypt_Twofish(); $this->encrypt_block_size = 16; @@ -1411,7 +1454,7 @@ class Net_SSH2 { case 'twofish192-ctr': case 'twofish256-ctr': if (!class_exists('Crypt_Twofish')) { - require_once('Crypt/Twofish.php'); + include_once 'Crypt/Twofish.php'; } $this->encrypt = new Crypt_Twofish(CRYPT_TWOFISH_MODE_CTR); $this->encrypt_block_size = 16; @@ -1420,7 +1463,7 @@ class Net_SSH2 { case 'arcfour128': case 'arcfour256': if (!class_exists('Crypt_RC4')) { - require_once('Crypt/RC4.php'); + include_once 'Crypt/RC4.php'; } $this->encrypt = new Crypt_RC4(); break; @@ -1431,13 +1474,13 @@ class Net_SSH2 { switch ($decrypt) { case '3des-cbc': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $this->decrypt = new Crypt_TripleDES(); break; case '3des-ctr': if (!class_exists('Crypt_TripleDES')) { - require_once('Crypt/TripleDES.php'); + include_once 'Crypt/TripleDES.php'; } $this->decrypt = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); break; @@ -1445,7 +1488,7 @@ class Net_SSH2 { case 'aes192-cbc': case 'aes128-cbc': if (!class_exists('Crypt_Rijndael')) { - require_once('Crypt/Rijndael.php'); + include_once 'Crypt/Rijndael.php'; } $this->decrypt = new Crypt_Rijndael(); $this->decrypt_block_size = 16; @@ -1454,21 +1497,21 @@ class Net_SSH2 { case 'aes192-ctr': case 'aes128-ctr': if (!class_exists('Crypt_Rijndael')) { - require_once('Crypt/Rijndael.php'); + include_once 'Crypt/Rijndael.php'; } $this->decrypt = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CTR); $this->decrypt_block_size = 16; break; case 'blowfish-cbc': if (!class_exists('Crypt_Blowfish')) { - require_once('Crypt/Blowfish.php'); + include_once 'Crypt/Blowfish.php'; } $this->decrypt = new Crypt_Blowfish(); $this->decrypt_block_size = 8; break; case 'blowfish-ctr': if (!class_exists('Crypt_Blowfish')) { - require_once('Crypt/Blowfish.php'); + include_once 'Crypt/Blowfish.php'; } $this->decrypt = new Crypt_Blowfish(CRYPT_BLOWFISH_MODE_CTR); $this->decrypt_block_size = 8; @@ -1478,7 +1521,7 @@ class Net_SSH2 { case 'twofish256-cbc': case 'twofish-cbc': if (!class_exists('Crypt_Twofish')) { - require_once('Crypt/Twofish.php'); + include_once 'Crypt/Twofish.php'; } $this->decrypt = new Crypt_Twofish(); $this->decrypt_block_size = 16; @@ -1487,7 +1530,7 @@ class Net_SSH2 { case 'twofish192-ctr': case 'twofish256-ctr': if (!class_exists('Crypt_Twofish')) { - require_once('Crypt/Twofish.php'); + include_once 'Crypt/Twofish.php'; } $this->decrypt = new Crypt_Twofish(CRYPT_TWOFISH_MODE_CTR); $this->decrypt_block_size = 16; @@ -1496,7 +1539,7 @@ class Net_SSH2 { case 'arcfour128': case 'arcfour256': if (!class_exists('Crypt_RC4')) { - require_once('Crypt/RC4.php'); + include_once 'Crypt/RC4.php'; } $this->decrypt = new Crypt_RC4(); break; @@ -1647,11 +1690,27 @@ class Net_SSH2 { * @param Mixed $password * @param Mixed $... * @return Boolean - * @see _login_helper + * @see _login * @access public */ function login($username) { + $args = func_get_args(); + return call_user_func_array(array(&$this, '_login'), $args); + } + + /** + * Login Helper + * + * @param String $username + * @param Mixed $password + * @param Mixed $... + * @return Boolean + * @see _login_helper + * @access private + */ + function _login($username) + { $args = array_slice(func_get_args(), 1); if (empty($args)) { return $this->_login_helper($username); @@ -1710,8 +1769,13 @@ class Net_SSH2 { } // although PHP5's get_class() preserves the case, PHP4's does not - if (is_object($password) && strtolower(get_class($password)) == 'crypt_rsa') { - return $this->_privatekey_login($username, $password); + if (is_object($password)) { + switch (strtolower(get_class($password))) { + case 'crypt_rsa': + return $this->_privatekey_login($username, $password); + case 'system_ssh_agent': + return $this->_ssh_agent_login($username, $password); + } } if (is_array($password)) { @@ -1757,7 +1821,7 @@ class Net_SSH2 { // remove the username and password from the logged packet if (!defined('NET_SSH2_LOGGING')) { - $logged = NULL; + $logged = null; } else { $logged = pack('CNa*Na*Na*CNa*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen('username'), 'username', strlen('ssh-connection'), 'ssh-connection', @@ -1821,7 +1885,7 @@ class Net_SSH2 { */ function _keyboard_interactive_login($username, $password) { - $packet = pack('CNa*Na*Na*Na*Na*', + $packet = pack('CNa*Na*Na*Na*Na*', NET_SSH2_MSG_USERAUTH_REQUEST, strlen($username), $username, strlen('ssh-connection'), 'ssh-connection', strlen('keyboard-interactive'), 'keyboard-interactive', 0, '', 0, '' ); @@ -1949,6 +2013,26 @@ class Net_SSH2 { } /** + * Login with an ssh-agent provided key + * + * @param String $username + * @param System_SSH_Agent $agent + * @return Boolean + * @access private + */ + function _ssh_agent_login($username, $agent) + { + $keys = $agent->requestIdentities(); + foreach ($keys as $key) { + if ($this->_privatekey_login($username, $key)) { + return true; + } + } + + return false; + } + + /** * Login with an RSA private key * * @param String $username @@ -2056,7 +2140,7 @@ class Net_SSH2 { /** * Get the output from stdError - * + * * @access public */ function getStdError() @@ -2075,7 +2159,7 @@ class Net_SSH2 { * @return String * @access public */ - function exec($command, $callback = NULL) + function exec($command, $callback = null) { $this->curTimeout = $this->timeout; $this->is_timeout = false; @@ -2086,7 +2170,7 @@ class Net_SSH2 { } // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to - // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but, + // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but, // honestly, if you're transfering more than 2GB, you probably shouldn't be using phpseclib, anyway. // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info $this->window_size_server_to_client[NET_SSH2_CHANNEL_EXEC] = 0x7FFFFFFF; @@ -2143,7 +2227,7 @@ class Net_SSH2 { // neither will your script. // although, in theory, the size of SSH_MSG_CHANNEL_REQUEST could exceed the maximum packet size established by - // SSH_MSG_CHANNEL_OPEN_CONFIRMATION, RFC4254#section-5.1 states that the "maximum packet size" refers to the + // SSH_MSG_CHANNEL_OPEN_CONFIRMATION, RFC4254#section-5.1 states that the "maximum packet size" refers to the // "maximum size of an individual data packet". ie. SSH_MSG_CHANNEL_DATA. RFC4254#section-5.2 corroborates. $packet = pack('CNNa*CNa*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_EXEC], strlen('exec'), 'exec', 1, strlen($command), $command); @@ -2349,7 +2433,6 @@ class Net_SSH2 { return false; } - $channel = $this->in_request_pty_exec ? NET_SSH2_CHANNEL_EXEC : NET_SSH2_CHANNEL_SHELL; return $this->_send_channel_packet($this->_get_interactive_channel(), $cmd); } @@ -2430,8 +2513,7 @@ class Net_SSH2 { */ function reset() { - $channel = $this->in_request_pty_exec ? NET_SSH2_CHANNEL_EXEC : NET_SSH2_CHANNEL_SHELL; - $this->_close_channel($channel); + $this->_close_channel($this->_get_interactive_channel()); } /** @@ -2724,7 +2806,7 @@ class Net_SSH2 { } $read = array($this->fsock); - $write = $except = NULL; + $write = $except = null; $start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838 $sec = floor($this->curTimeout); @@ -2801,7 +2883,7 @@ class Net_SSH2 { /* if ($channel == NET_SSH2_CHANNEL_EXEC) { // SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server - // this actually seems to make things twice as fast. more to the point, the message right after + // this actually seems to make things twice as fast. more to the point, the message right after // SSH_MSG_CHANNEL_DATA (usually SSH_MSG_IGNORE) won't block for as long as it would have otherwise. // in OpenSSH it slows things down but only by a couple thousandths of a second. $this->_send_channel_packet($channel, chr(0)); @@ -2861,12 +2943,9 @@ class Net_SSH2 { case 'exit-status': extract(unpack('Cfalse/Nexit_status', $this->_string_shift($response, 5))); $this->exit_status = $exit_status; - // "The channel needs to be closed with SSH_MSG_CHANNEL_CLOSE after this message." - // -- http://tools.ietf.org/html/rfc4254#section-6.10 - $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); - $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); - $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF; + // "The client MAY ignore these messages." + // -- http://tools.ietf.org/html/rfc4254#section-6.10 break; default: @@ -2907,7 +2986,7 @@ class Net_SSH2 { * @return Boolean * @access private */ - function _send_binary_packet($data, $logged = NULL) + function _send_binary_packet($data, $logged = null) { if (!is_resource($this->fsock) || feof($this->fsock)) { user_error('Connection closed prematurely'); @@ -2967,70 +3046,70 @@ class Net_SSH2 { */ function _append_log($message_number, $message) { - // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) - if (strlen($message_number) > 2) { - $this->_string_shift($message); - } + // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) + if (strlen($message_number) > 2) { + $this->_string_shift($message); + } - switch (NET_SSH2_LOGGING) { - // useful for benchmarks - case NET_SSH2_LOG_SIMPLE: - $this->message_number_log[] = $message_number; - break; - // the most useful log for SSH2 - case NET_SSH2_LOG_COMPLEX: - $this->message_number_log[] = $message_number; - $this->log_size+= strlen($message); - $this->message_log[] = $message; - while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) { - $this->log_size-= strlen(array_shift($this->message_log)); - array_shift($this->message_number_log); - } - break; - // dump the output out realtime; packets may be interspersed with non packets, - // passwords won't be filtered out and select other packets may not be correctly - // identified - case NET_SSH2_LOG_REALTIME: - switch (PHP_SAPI) { - case 'cli': - $start = $stop = "\r\n"; - break; - default: - $start = '<pre>'; - $stop = '</pre>'; - } - echo $start . $this->_format_log(array($message), array($message_number)) . $stop; - @flush(); - @ob_flush(); - break; - // basically the same thing as NET_SSH2_LOG_REALTIME with the caveat that NET_SSH2_LOG_REALTIME_FILE - // needs to be defined and that the resultant log file will be capped out at NET_SSH2_LOG_MAX_SIZE. - // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily - // at the beginning of the file - case NET_SSH2_LOG_REALTIME_FILE: - if (!isset($this->realtime_log_file)) { - // PHP doesn't seem to like using constants in fopen() - $filename = NET_SSH2_LOG_REALTIME_FILENAME; - $fp = fopen($filename, 'w'); - $this->realtime_log_file = $fp; - } - if (!is_resource($this->realtime_log_file)) { + switch (NET_SSH2_LOGGING) { + // useful for benchmarks + case NET_SSH2_LOG_SIMPLE: + $this->message_number_log[] = $message_number; + break; + // the most useful log for SSH2 + case NET_SSH2_LOG_COMPLEX: + $this->message_number_log[] = $message_number; + $this->log_size+= strlen($message); + $this->message_log[] = $message; + while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) { + $this->log_size-= strlen(array_shift($this->message_log)); + array_shift($this->message_number_log); + } + break; + // dump the output out realtime; packets may be interspersed with non packets, + // passwords won't be filtered out and select other packets may not be correctly + // identified + case NET_SSH2_LOG_REALTIME: + switch (PHP_SAPI) { + case 'cli': + $start = $stop = "\r\n"; break; - } - $entry = $this->_format_log(array($message), array($message_number)); - if ($this->realtime_log_wrap) { - $temp = "<<< START >>>\r\n"; - $entry.= $temp; - fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); - } - $this->realtime_log_size+= strlen($entry); - if ($this->realtime_log_size > NET_SSH2_LOG_MAX_SIZE) { - fseek($this->realtime_log_file, 0); - $this->realtime_log_size = strlen($entry); - $this->realtime_log_wrap = true; - } - fputs($this->realtime_log_file, $entry); - } + default: + $start = '<pre>'; + $stop = '</pre>'; + } + echo $start . $this->_format_log(array($message), array($message_number)) . $stop; + @flush(); + @ob_flush(); + break; + // basically the same thing as NET_SSH2_LOG_REALTIME with the caveat that NET_SSH2_LOG_REALTIME_FILE + // needs to be defined and that the resultant log file will be capped out at NET_SSH2_LOG_MAX_SIZE. + // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily + // at the beginning of the file + case NET_SSH2_LOG_REALTIME_FILE: + if (!isset($this->realtime_log_file)) { + // PHP doesn't seem to like using constants in fopen() + $filename = NET_SSH2_LOG_REALTIME_FILENAME; + $fp = fopen($filename, 'w'); + $this->realtime_log_file = $fp; + } + if (!is_resource($this->realtime_log_file)) { + break; + } + $entry = $this->_format_log(array($message), array($message_number)); + if ($this->realtime_log_wrap) { + $temp = "<<< START >>>\r\n"; + $entry.= $temp; + fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp)); + } + $this->realtime_log_size+= strlen($entry); + if ($this->realtime_log_size > NET_SSH2_LOG_MAX_SIZE) { + fseek($this->realtime_log_file, 0); + $this->realtime_log_size = strlen($entry); + $this->realtime_log_wrap = true; + } + fputs($this->realtime_log_file, $entry); + } } /** @@ -3103,16 +3182,19 @@ class Net_SSH2 { * for SCP more than anything. * * @param Integer $client_channel + * @param Boolean $want_reply * @return Boolean * @access private */ - function _close_channel($client_channel) + function _close_channel($client_channel, $want_reply = false) { // see http://tools.ietf.org/html/rfc4254#section-5.3 $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); - $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + if (!$want_reply) { + $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + } $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE; @@ -3120,6 +3202,10 @@ class Net_SSH2 { while (!is_bool($this->_get_channel_packet($client_channel))); + if ($want_reply) { + $this->_send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + } + if ($this->bitmap & NET_SSH2_MASK_SHELL) { $this->bitmap&= ~NET_SSH2_MASK_SHELL; } @@ -3220,8 +3306,6 @@ class Net_SSH2 { */ function _format_log($message_log, $message_number_log) { - static $boundary = ':', $long_width = 65, $short_width = 16; - $output = ''; for ($i = 0; $i < count($message_log); $i++) { $output.= $message_number_log[$i] . "\r\n"; @@ -3231,19 +3315,13 @@ class Net_SSH2 { if (strlen($current_log)) { $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 '; } - $fragment = $this->_string_shift($current_log, $short_width); - $hex = substr( - preg_replace( - '#(.)#es', - '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', - $fragment), - strlen($boundary) - ); + $fragment = $this->_string_shift($current_log, $this->log_short_width); + $hex = substr(preg_replace_callback('#.#s', array($this, '_format_log_helper'), $fragment), strlen($this->log_boundary)); // replace non ASCII printable characters with dots // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters // also replace < with a . since < messes up the output on web browsers $raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment); - $output.= str_pad($hex, $long_width - $short_width, ' ') . $raw . "\r\n"; + $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; $j++; } while (strlen($current_log)); $output.= "\r\n"; @@ -3253,6 +3331,20 @@ class Net_SSH2 { } /** + * Helper function for _format_log + * + * For use with preg_replace_callback() + * + * @param Array $matches + * @access private + * @return String + */ + function _format_log_helper($matches) + { + return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT); + } + + /** * Returns all errors * * @return String @@ -3505,7 +3597,7 @@ class Net_SSH2 { $signature = $this->_string_shift($signature, $temp['length']); if (!class_exists('Crypt_RSA')) { - require_once('Crypt/RSA.php'); + include_once 'Crypt/RSA.php'; } $rsa = new Crypt_RSA(); @@ -3572,7 +3664,15 @@ class Net_SSH2 { */ function _is_includable($suffix) { - foreach (explode(PATH_SEPARATOR, get_include_path()) as $prefix) { + // stream_resolve_include_path was introduced in PHP 5.3.2 + if (function_exists('stream_resolve_include_path')) { + return stream_resolve_include_path($suffix) !== false; + } + + $paths = PATH_SEPARATOR == ':' ? + preg_split('#(?<!phar):#', get_include_path()) : + explode(PATH_SEPARATOR, get_include_path()); + foreach ($paths as $prefix) { $ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR; $file = $prefix . $ds . $suffix; diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/System/SSH_Agent.php b/apps/files_external/3rdparty/phpseclib/phpseclib/System/SSH_Agent.php new file mode 100644 index 00000000000..2d4c3629c37 --- /dev/null +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/System/SSH_Agent.php @@ -0,0 +1,315 @@ +<?php +/** + * Pure-PHP ssh-agent client. + * + * PHP versions 4 and 5 + * + * Here are some examples of how to use this library: + * <code> + * <?php + * include('System/SSH_Agent.php'); + * include('Net/SSH2.php'); + * + * $agent = new System_SSH_Agent(); + * + * $ssh = new Net_SSH2('www.domain.tld'); + * if (!$ssh->login('username', $agent)) { + * exit('Login Failed'); + * } + * + * echo $ssh->exec('pwd'); + * echo $ssh->exec('ls -la'); + * ?> + * </code> + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category System + * @package System_SSH_Agent + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMXIV Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + * @internal See http://api.libssh.org/rfc/PROTOCOL.agent + */ + +/**#@+ + * Message numbers + * + * @access private + */ +// to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1) +define('SYSTEM_SSH_AGENTC_REQUEST_IDENTITIES', 11); +// this is the SSH2 response; the SSH1 response is SSH_AGENT_RSA_IDENTITIES_ANSWER (2). +define('SYSTEM_SSH_AGENT_IDENTITIES_ANSWER', 12); +define('SYSTEM_SSH_AGENT_FAILURE', 5); +// the SSH1 request is SSH_AGENTC_RSA_CHALLENGE (3) +define('SYSTEM_SSH_AGENTC_SIGN_REQUEST', 13); +// the SSH1 response is SSH_AGENT_RSA_RESPONSE (4) +define('SYSTEM_SSH_AGENT_SIGN_RESPONSE', 14); +/**#@-*/ + +/** + * Pure-PHP ssh-agent client identity object + * + * Instantiation should only be performed by System_SSH_Agent class. + * This could be thought of as implementing an interface that Crypt_RSA + * implements. ie. maybe a Net_SSH_Auth_PublicKey interface or something. + * The methods in this interface would be getPublicKey, setSignatureMode + * and sign since those are the methods phpseclib looks for to perform + * public key authentication. + * + * @package System_SSH_Agent + * @author Jim Wigginton <terrafrost@php.net> + * @version 0.1.0 + * @access internal + */ +class System_SSH_Agent_Identity +{ + /** + * Key Object + * + * @var Crypt_RSA + * @access private + * @see System_SSH_Agent_Identity::getPublicKey() + */ + var $key; + + /** + * Key Blob + * + * @var String + * @access private + * @see System_SSH_Agent_Identity::sign() + */ + var $key_blob; + + /** + * Socket Resource + * + * @var Resource + * @access private + * @see System_SSH_Agent_Identity::sign() + */ + var $fsock; + + /** + * Default Constructor. + * + * @param Resource $fsock + * @return System_SSH_Agent_Identity + * @access private + */ + function System_SSH_Agent_Identity($fsock) + { + $this->fsock = $fsock; + } + + /** + * Set Public Key + * + * Called by System_SSH_Agent::requestIdentities() + * + * @param Crypt_RSA $key + * @access private + */ + function setPublicKey($key) + { + $this->key = $key; + $this->key->setPublicKey(); + } + + /** + * Set Public Key + * + * Called by System_SSH_Agent::requestIdentities(). The key blob could be extracted from $this->key + * but this saves a small amount of computation. + * + * @param String $key_blob + * @access private + */ + function setPublicKeyBlob($key_blob) + { + $this->key_blob = $key_blob; + } + + /** + * Get Public Key + * + * Wrapper for $this->key->getPublicKey() + * + * @param Integer $format optional + * @return Mixed + * @access public + */ + function getPublicKey($format = null) + { + return !isset($format) ? $this->key->getPublicKey() : $this->key->getPublicKey($format); + } + + /** + * Set Signature Mode + * + * Doesn't do anything as ssh-agent doesn't let you pick and choose the signature mode. ie. + * ssh-agent's only supported mode is CRYPT_RSA_SIGNATURE_PKCS1 + * + * @param Integer $mode + * @access public + */ + function setSignatureMode($mode) + { + } + + /** + * Create a signature + * + * See "2.6.2 Protocol 2 private key signature request" + * + * @param String $message + * @return String + * @access public + */ + function sign($message) + { + // the last parameter (currently 0) is for flags and ssh-agent only defines one flag (for ssh-dss): SSH_AGENT_OLD_SIGNATURE + $packet = pack('CNa*Na*N', SYSTEM_SSH_AGENTC_SIGN_REQUEST, strlen($this->key_blob), $this->key_blob, strlen($message), $message, 0); + $packet = pack('Na*', strlen($packet), $packet); + if (strlen($packet) != fputs($this->fsock, $packet)) { + user_error('Connection closed during signing'); + } + + $length = current(unpack('N', fread($this->fsock, 4))); + $type = ord(fread($this->fsock, 1)); + if ($type != SYSTEM_SSH_AGENT_SIGN_RESPONSE) { + user_error('Unable to retreive signature'); + } + + $signature_blob = fread($this->fsock, $length - 1); + // the only other signature format defined - ssh-dss - is the same length as ssh-rsa + // the + 12 is for the other various SSH added length fields + return substr($signature_blob, strlen('ssh-rsa') + 12); + } +} + +/** + * Pure-PHP ssh-agent client identity factory + * + * requestIdentities() method pumps out System_SSH_Agent_Identity objects + * + * @package System_SSH_Agent + * @author Jim Wigginton <terrafrost@php.net> + * @version 0.1.0 + * @access internal + */ +class System_SSH_Agent +{ + /** + * Socket Resource + * + * @var Resource + * @access private + */ + var $fsock; + + /** + * Default Constructor + * + * @return System_SSH_Agent + * @access public + */ + function System_SSH_Agent() + { + switch (true) { + case isset($_SERVER['SSH_AUTH_SOCK']): + $address = $_SERVER['SSH_AUTH_SOCK']; + break; + case isset($_ENV['SSH_AUTH_SOCK']): + $address = $_ENV['SSH_AUTH_SOCK']; + break; + default: + user_error('SSH_AUTH_SOCK not found'); + return false; + } + + $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); + if (!$this->fsock) { + user_error("Unable to connect to ssh-agent (Error $errno: $errstr)"); + } + } + + /** + * Request Identities + * + * See "2.5.2 Requesting a list of protocol 2 keys" + * Returns an array containing zero or more System_SSH_Agent_Identity objects + * + * @return Array + * @access public + */ + function requestIdentities() + { + if (!$this->fsock) { + return array(); + } + + $packet = pack('NC', 1, SYSTEM_SSH_AGENTC_REQUEST_IDENTITIES); + if (strlen($packet) != fputs($this->fsock, $packet)) { + user_error('Connection closed while requesting identities'); + } + + $length = current(unpack('N', fread($this->fsock, 4))); + $type = ord(fread($this->fsock, 1)); + if ($type != SYSTEM_SSH_AGENT_IDENTITIES_ANSWER) { + user_error('Unable to request identities'); + } + + $identities = array(); + $keyCount = current(unpack('N', fread($this->fsock, 4))); + for ($i = 0; $i < $keyCount; $i++) { + $length = current(unpack('N', fread($this->fsock, 4))); + $key_blob = fread($this->fsock, $length); + $length = current(unpack('N', fread($this->fsock, 4))); + $key_comment = fread($this->fsock, $length); + $length = current(unpack('N', substr($key_blob, 0, 4))); + $key_type = substr($key_blob, 4, $length); + switch ($key_type) { + case 'ssh-rsa': + if (!class_exists('Crypt_RSA')) { + include_once 'Crypt/RSA.php'; + } + $key = new Crypt_RSA(); + $key->loadKey('ssh-rsa ' . base64_encode($key_blob) . ' ' . $key_comment); + break; + case 'ssh-dss': + // not currently supported + break; + } + // resources are passed by reference by default + if (isset($key)) { + $identity = new System_SSH_Agent_Identity($this->fsock); + $identity->setPublicKey($key); + $identity->setPublicKeyBlob($key_blob); + $identities[] = $identity; + unset($key); + } + } + + return $identities; + } +} diff --git a/apps/files_external/3rdparty/phpseclib/phpseclib/openssl.cnf b/apps/files_external/3rdparty/phpseclib/phpseclib/openssl.cnf index 6baa566102c..2b8b52f9f7f 100644 --- a/apps/files_external/3rdparty/phpseclib/phpseclib/openssl.cnf +++ b/apps/files_external/3rdparty/phpseclib/phpseclib/openssl.cnf @@ -3,4 +3,4 @@ HOME = . RANDFILE = $ENV::HOME/.rnd -[ v3_ca ]
\ No newline at end of file +[ v3_ca ] diff --git a/apps/files_external/l10n/bg_BG.php b/apps/files_external/l10n/bg_BG.php index d59a4b8c80b..118da27f74a 100644 --- a/apps/files_external/l10n/bg_BG.php +++ b/apps/files_external/l10n/bg_BG.php @@ -6,8 +6,6 @@ $TRANSLATIONS = array( "Folder name" => "Име на папката", "Configuration" => "Конфигурация", "Options" => "Опции", -"Applicable" => "Приложимо", -"None set" => "Няма избрано", "All Users" => "Всички потребители", "Groups" => "Групи", "Users" => "Потребители", diff --git a/apps/files_external/l10n/bn_BD.php b/apps/files_external/l10n/bn_BD.php index 065d61acfca..6c8f5777958 100644 --- a/apps/files_external/l10n/bn_BD.php +++ b/apps/files_external/l10n/bn_BD.php @@ -8,8 +8,6 @@ $TRANSLATIONS = array( "External Storage" => "বাহ্যিক সংরক্ষণাগার", "Configuration" => "কনফিগারেসন", "Options" => "বিকল্পসমূহ", -"Applicable" => "প্রযোজ্য", -"None set" => "কোনটিই নির্ধারণ করা হয় নি", "All Users" => "সমস্ত ব্যবহারকারী", "Groups" => "গোষ্ঠীসমূহ", "Users" => "ব্যবহারকারী", diff --git a/apps/files_external/l10n/ca.php b/apps/files_external/l10n/ca.php index 3e722046296..94033f0c599 100644 --- a/apps/files_external/l10n/ca.php +++ b/apps/files_external/l10n/ca.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Emmagatzemament extern", "Configuration" => "Configuració", "Options" => "Options", -"Applicable" => "Aplicable", "Add storage" => "Afegeix emmagatzemament", -"None set" => "Cap d'establert", "All Users" => "Tots els usuaris", "Groups" => "Grups", "Users" => "Usuaris", diff --git a/apps/files_external/l10n/cs_CZ.php b/apps/files_external/l10n/cs_CZ.php index 1b92e35c456..279030ef1a6 100644 --- a/apps/files_external/l10n/cs_CZ.php +++ b/apps/files_external/l10n/cs_CZ.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Externí úložiště", "Configuration" => "Nastavení", "Options" => "Možnosti", -"Applicable" => "Přístupný pro", "Add storage" => "Přidat úložiště", -"None set" => "Nenastaveno", "All Users" => "Všichni uživatelé", "Groups" => "Skupiny", "Users" => "Uživatelé", diff --git a/apps/files_external/l10n/da.php b/apps/files_external/l10n/da.php index f3ac35e42e0..0d2b5f35d0d 100644 --- a/apps/files_external/l10n/da.php +++ b/apps/files_external/l10n/da.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Eksternt lager", "Configuration" => "Opsætning", "Options" => "Valgmuligheder", -"Applicable" => "Kan anvendes", "Add storage" => "Tilføj lager", -"None set" => "Ingen sat", "All Users" => "Alle brugere", "Groups" => "Grupper", "Users" => "Brugere", diff --git a/apps/files_external/l10n/de.php b/apps/files_external/l10n/de.php index a78728b4c20..4c3f5639656 100644 --- a/apps/files_external/l10n/de.php +++ b/apps/files_external/l10n/de.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Externer Speicher", "Configuration" => "Konfiguration", "Options" => "Optionen", -"Applicable" => "Zutreffend", +"Available for" => "Verfügbar für", "Add storage" => "Speicher hinzufügen", -"None set" => "Nicht definiert", +"No user or group" => "Kein Nutzer oder Gruppe", "All Users" => "Alle Benutzer", "Groups" => "Gruppen", "Users" => "Benutzer", diff --git a/apps/files_external/l10n/de_CH.php b/apps/files_external/l10n/de_CH.php index 8a13c7cdd57..33a5a4894a3 100644 --- a/apps/files_external/l10n/de_CH.php +++ b/apps/files_external/l10n/de_CH.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Externer Speicher", "Configuration" => "Konfiguration", "Options" => "Optionen", -"Applicable" => "Zutreffend", "Add storage" => "Speicher hinzufügen", -"None set" => "Nicht definiert", "All Users" => "Alle Benutzer", "Groups" => "Gruppen", "Users" => "Benutzer", diff --git a/apps/files_external/l10n/de_DE.php b/apps/files_external/l10n/de_DE.php index 5ffe946c699..63198c98176 100644 --- a/apps/files_external/l10n/de_DE.php +++ b/apps/files_external/l10n/de_DE.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Externer Speicher", "Configuration" => "Konfiguration", "Options" => "Optionen", -"Applicable" => "Zutreffend", +"Available for" => "Verfügbar für", "Add storage" => "Speicher hinzufügen", -"None set" => "Nicht definiert", +"No user or group" => "Kein Nutzer oder Gruppe", "All Users" => "Alle Benutzer", "Groups" => "Gruppen", "Users" => "Benutzer", diff --git a/apps/files_external/l10n/el.php b/apps/files_external/l10n/el.php index 4dcd93d7ac8..43d0a79eac4 100644 --- a/apps/files_external/l10n/el.php +++ b/apps/files_external/l10n/el.php @@ -14,14 +14,13 @@ $TRANSLATIONS = array( "External storage" => "Εξωτερική αποθήκευση", "Configuration" => "Ρυθμίσεις", "Options" => "Επιλογές", -"Applicable" => "Εφαρμόσιμο", "Add storage" => "Προσθηκη αποθηκευσης", -"None set" => "Κανένα επιλεγμένο", "All Users" => "Όλοι οι Χρήστες", "Groups" => "Ομάδες", "Users" => "Χρήστες", "Delete" => "Διαγραφή", "Enable User External Storage" => "Ενεργοποίηση Εξωτερικού Αποθηκευτικού Χώρου Χρήστη", +"Allow users to mount the following external storage" => "Χορήγηση άδειας στους χρήστες να συνδέσουν τα παρακάτω εξωτερικά μέσα αποθήκευσης", "SSL root certificates" => "Πιστοποιητικά SSL root", "Import Root Certificate" => "Εισαγωγή Πιστοποιητικού Root" ); diff --git a/apps/files_external/l10n/en_GB.php b/apps/files_external/l10n/en_GB.php index f7fdbf2f0d1..f0ebb629de9 100644 --- a/apps/files_external/l10n/en_GB.php +++ b/apps/files_external/l10n/en_GB.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "External storage", "Configuration" => "Configuration", "Options" => "Options", -"Applicable" => "Applicable", +"Available for" => "Available for", "Add storage" => "Add storage", -"None set" => "None set", +"No user or group" => "No user or group", "All Users" => "All Users", "Groups" => "Groups", "Users" => "Users", diff --git a/apps/files_external/l10n/eo.php b/apps/files_external/l10n/eo.php index aba16e2efa8..5312872c07a 100644 --- a/apps/files_external/l10n/eo.php +++ b/apps/files_external/l10n/eo.php @@ -9,8 +9,6 @@ $TRANSLATIONS = array( "Folder name" => "Dosierujnomo", "Configuration" => "Agordo", "Options" => "Malneproj", -"Applicable" => "Aplikebla", -"None set" => "Nenio agordita", "All Users" => "Ĉiuj uzantoj", "Groups" => "Grupoj", "Users" => "Uzantoj", diff --git a/apps/files_external/l10n/es.php b/apps/files_external/l10n/es.php index ea831c947f4..04537ecf56f 100644 --- a/apps/files_external/l10n/es.php +++ b/apps/files_external/l10n/es.php @@ -14,9 +14,8 @@ $TRANSLATIONS = array( "External storage" => "Almacenamiento externo", "Configuration" => "Configuración", "Options" => "Opciones", -"Applicable" => "Aplicable", "Add storage" => "Añadir almacenamiento", -"None set" => "No se ha configurado", +"No user or group" => "Ningún usuario o grupo", "All Users" => "Todos los usuarios", "Groups" => "Grupos", "Users" => "Usuarios", diff --git a/apps/files_external/l10n/es_AR.php b/apps/files_external/l10n/es_AR.php index 05204b748c4..3518eba2479 100644 --- a/apps/files_external/l10n/es_AR.php +++ b/apps/files_external/l10n/es_AR.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Almacenamiento externo", "Configuration" => "Configuración", "Options" => "Opciones", -"Applicable" => "Aplicable", "Add storage" => "Añadir almacenamiento", -"None set" => "No fue configurado", "All Users" => "Todos los usuarios", "Groups" => "Grupos", "Users" => "Usuarios", diff --git a/apps/files_external/l10n/es_MX.php b/apps/files_external/l10n/es_MX.php index 5d3fd44bec6..4ce3eac986f 100644 --- a/apps/files_external/l10n/es_MX.php +++ b/apps/files_external/l10n/es_MX.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Almacenamiento externo", "Configuration" => "Configuración", "Options" => "Opciones", -"Applicable" => "Aplicable", "Add storage" => "Añadir almacenamiento", -"None set" => "No se ha configurado", "All Users" => "Todos los usuarios", "Groups" => "Grupos", "Users" => "Usuarios", diff --git a/apps/files_external/l10n/et_EE.php b/apps/files_external/l10n/et_EE.php index c6450f95e18..d3aa683673e 100644 --- a/apps/files_external/l10n/et_EE.php +++ b/apps/files_external/l10n/et_EE.php @@ -5,6 +5,7 @@ $TRANSLATIONS = array( "Grant access" => "Anna ligipääs", "Please provide a valid Dropbox app key and secret." => "Palun sisesta korrektne Dropboxi rakenduse võti ja salasõna.", "Error configuring Google Drive storage" => "Viga Google Drive'i salvestusruumi seadistamisel", +"Saved" => "Salvestatud", "<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Hoiatus:</b> \"smbclient\" pole paigaldatud. Jagatud CIFS/SMB hoidlate ühendamine pole võimalik. Palu oma süsteemihalduril paigaldata SAMBA tugi.", "<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Hoiatus:</b> PHP-s puudub FTP tugi. Jagatud FTP hoidlate ühendamine pole võimalik. Palu oma süsteemihalduril paigaldata FTP tugi.", "<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Hoiatus:</b> PHP-s puudub Curl tugi. Jagatud ownCloud / WebDAV või GoogleDrive ühendamine pole võimalik. Palu oma süsteemihalduril see paigaldada.", @@ -13,14 +14,13 @@ $TRANSLATIONS = array( "External storage" => "Väline andmehoidla", "Configuration" => "Seadistamine", "Options" => "Valikud", -"Applicable" => "Rakendatav", "Add storage" => "Lisa andmehoidla", -"None set" => "Pole määratud", "All Users" => "Kõik kasutajad", "Groups" => "Grupid", "Users" => "Kasutajad", "Delete" => "Kustuta", "Enable User External Storage" => "Luba kasutajatele väline salvestamine", +"Allow users to mount the following external storage" => "Võimalda kasutajatel ühendada järgmist välist andmehoidlat", "SSL root certificates" => "SSL root sertifikaadid", "Import Root Certificate" => "Impordi root sertifikaadid" ); diff --git a/apps/files_external/l10n/eu.php b/apps/files_external/l10n/eu.php index bdc5cf56760..caaf96516bc 100644 --- a/apps/files_external/l10n/eu.php +++ b/apps/files_external/l10n/eu.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Kanpoko biltegiratzea", "Configuration" => "Konfigurazioa", "Options" => "Aukerak", -"Applicable" => "Aplikagarria", "Add storage" => "Gehitu biltegiratzea", -"None set" => "Ezarri gabe", "All Users" => "Erabiltzaile guztiak", "Groups" => "Taldeak", "Users" => "Erabiltzaileak", diff --git a/apps/files_external/l10n/fa.php b/apps/files_external/l10n/fa.php index 544b8a14d5c..4b74443d40d 100644 --- a/apps/files_external/l10n/fa.php +++ b/apps/files_external/l10n/fa.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "حافظه خارجی", "Configuration" => "پیکربندی", "Options" => "تنظیمات", -"Applicable" => "قابل اجرا", "Add storage" => "اضافه کردن حافظه", -"None set" => "تنظیم نشده", "All Users" => "تمام کاربران", "Groups" => "گروه ها", "Users" => "کاربران", diff --git a/apps/files_external/l10n/fi_FI.php b/apps/files_external/l10n/fi_FI.php index d2f9d1a73a5..9f8dbd414fd 100644 --- a/apps/files_external/l10n/fi_FI.php +++ b/apps/files_external/l10n/fi_FI.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Ulkoinen tallennustila", "Configuration" => "Asetukset", "Options" => "Valinnat", -"Applicable" => "Sovellettavissa", +"Available for" => "Saatavuus", "Add storage" => "Lisää tallennustila", -"None set" => "Ei asetettu", +"No user or group" => "Ei käyttäjää tai ryhmää", "All Users" => "Kaikki käyttäjät", "Groups" => "Ryhmät", "Users" => "Käyttäjät", diff --git a/apps/files_external/l10n/fr.php b/apps/files_external/l10n/fr.php index 4b8e2b905b6..d9e2dbfcaed 100644 --- a/apps/files_external/l10n/fr.php +++ b/apps/files_external/l10n/fr.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Stockage externe", "Configuration" => "Configuration", "Options" => "Options", -"Applicable" => "Disponible", "Add storage" => "Ajouter un support de stockage", -"None set" => "Aucun spécifié", "All Users" => "Tous les utilisateurs", "Groups" => "Groupes", "Users" => "Utilisateurs", diff --git a/apps/files_external/l10n/gl.php b/apps/files_external/l10n/gl.php index ec13fe241f6..3b5aaa53de0 100644 --- a/apps/files_external/l10n/gl.php +++ b/apps/files_external/l10n/gl.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Almacenamento externo", "Configuration" => "Configuración", "Options" => "Opcións", -"Applicable" => "Aplicábel", +"Available for" => "Dispoñíbel para", "Add storage" => "Engadir almacenamento", -"None set" => "Ningún definido", +"No user or group" => "Non hai usuario ou grupo", "All Users" => "Todos os usuarios", "Groups" => "Grupos", "Users" => "Usuarios", diff --git a/apps/files_external/l10n/he.php b/apps/files_external/l10n/he.php index 6aec07e78cf..e433f4fc306 100644 --- a/apps/files_external/l10n/he.php +++ b/apps/files_external/l10n/he.php @@ -9,8 +9,6 @@ $TRANSLATIONS = array( "Folder name" => "שם התיקייה", "Configuration" => "הגדרות", "Options" => "אפשרויות", -"Applicable" => "ניתן ליישום", -"None set" => "לא הוגדרה", "All Users" => "כל המשתמשים", "Groups" => "קבוצות", "Users" => "משתמשים", diff --git a/apps/files_external/l10n/hu_HU.php b/apps/files_external/l10n/hu_HU.php index 60661380433..9fed43e6267 100644 --- a/apps/files_external/l10n/hu_HU.php +++ b/apps/files_external/l10n/hu_HU.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Külső tárolók", "Configuration" => "Beállítások", "Options" => "Opciók", -"Applicable" => "Érvényességi kör", "Add storage" => "Tároló becsatolása", -"None set" => "Nincs beállítva", "All Users" => "Az összes felhasználó", "Groups" => "Csoportok", "Users" => "Felhasználók", diff --git a/apps/files_external/l10n/id.php b/apps/files_external/l10n/id.php index 9f91fdf992f..94fa89077a8 100644 --- a/apps/files_external/l10n/id.php +++ b/apps/files_external/l10n/id.php @@ -12,9 +12,7 @@ $TRANSLATIONS = array( "External storage" => "Penyimpanan eksternal", "Configuration" => "Konfigurasi", "Options" => "Opsi", -"Applicable" => "Berlaku", "Add storage" => "Tambahkan penyimpanan", -"None set" => "Tidak satupun di set", "All Users" => "Semua Pengguna", "Groups" => "Grup", "Users" => "Pengguna", diff --git a/apps/files_external/l10n/is.php b/apps/files_external/l10n/is.php index e86cfa108a6..5a350bad4a0 100644 --- a/apps/files_external/l10n/is.php +++ b/apps/files_external/l10n/is.php @@ -11,8 +11,6 @@ $TRANSLATIONS = array( "Folder name" => "Nafn möppu", "Configuration" => "Uppsetning", "Options" => "Stillingar", -"Applicable" => "Gilt", -"None set" => "Ekkert sett", "All Users" => "Allir notendur", "Groups" => "Hópar", "Users" => "Notendur", diff --git a/apps/files_external/l10n/it.php b/apps/files_external/l10n/it.php index d62d8e97327..ea3e5738189 100644 --- a/apps/files_external/l10n/it.php +++ b/apps/files_external/l10n/it.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Archiviazione esterna", "Configuration" => "Configurazione", "Options" => "Opzioni", -"Applicable" => "Applicabile", +"Available for" => "Disponibile per", "Add storage" => "Aggiungi archiviazione", -"None set" => "Nessuna impostazione", +"No user or group" => "Nessun utente o gruppo", "All Users" => "Tutti gli utenti", "Groups" => "Gruppi", "Users" => "Utenti", diff --git a/apps/files_external/l10n/ja.php b/apps/files_external/l10n/ja.php index 312dc85188d..e2d252d22a9 100644 --- a/apps/files_external/l10n/ja.php +++ b/apps/files_external/l10n/ja.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "外部ストレージ", "Configuration" => "設定", "Options" => "オプション", -"Applicable" => "適用範囲", "Add storage" => "ストレージを追加", -"None set" => "未設定", "All Users" => "すべてのユーザー", "Groups" => "グループ", "Users" => "ユーザー", diff --git a/apps/files_external/l10n/ka_GE.php b/apps/files_external/l10n/ka_GE.php index 4953f91ce6a..7412bb145b6 100644 --- a/apps/files_external/l10n/ka_GE.php +++ b/apps/files_external/l10n/ka_GE.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "ექსტერნალ საცავი", "Configuration" => "კონფიგურაცია", "Options" => "ოფცია", -"Applicable" => "მიღებადი", "Add storage" => "საცავის დამატება", -"None set" => "არაფერია მითითებული", "All Users" => "ყველა მომხმარებელი", "Groups" => "ჯგუფები", "Users" => "მომხმარებელი", diff --git a/apps/files_external/l10n/ko.php b/apps/files_external/l10n/ko.php index 088a419e1c1..87157e1f885 100644 --- a/apps/files_external/l10n/ko.php +++ b/apps/files_external/l10n/ko.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "외부 저장소", "Configuration" => "설정", "Options" => "옵션", -"Applicable" => "적용 가능", "Add storage" => "저장소 추가", -"None set" => "설정되지 않음", "All Users" => "모든 사용자", "Groups" => "그룹", "Users" => "사용자", diff --git a/apps/files_external/l10n/lt_LT.php b/apps/files_external/l10n/lt_LT.php index c96119c8b68..abb43ab8adc 100644 --- a/apps/files_external/l10n/lt_LT.php +++ b/apps/files_external/l10n/lt_LT.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Išorinė saugykla", "Configuration" => "Konfigūracija", "Options" => "Nustatymai", -"Applicable" => "Pritaikyti", "Add storage" => "Pridėti saugyklą", -"None set" => "Nieko nepasirinkta", "All Users" => "Visi vartotojai", "Groups" => "Grupės", "Users" => "Vartotojai", diff --git a/apps/files_external/l10n/lv.php b/apps/files_external/l10n/lv.php index 18e56178892..1512ff0dc2f 100644 --- a/apps/files_external/l10n/lv.php +++ b/apps/files_external/l10n/lv.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Ārējā krātuve", "Configuration" => "Konfigurācija", "Options" => "Opcijas", -"Applicable" => "Piemērojams", "Add storage" => "Pievienot krātuvi", -"None set" => "Neviens nav iestatīts", "All Users" => "Visi lietotāji", "Groups" => "Grupas", "Users" => "Lietotāji", diff --git a/apps/files_external/l10n/mk.php b/apps/files_external/l10n/mk.php index b59bb138f1d..ddce2d5c178 100644 --- a/apps/files_external/l10n/mk.php +++ b/apps/files_external/l10n/mk.php @@ -11,8 +11,6 @@ $TRANSLATIONS = array( "Folder name" => "Име на папка", "Configuration" => "Конфигурација", "Options" => "Опции", -"Applicable" => "Применливо", -"None set" => "Ништо поставено", "All Users" => "Сите корисници", "Groups" => "Групи", "Users" => "Корисници", diff --git a/apps/files_external/l10n/nb_NO.php b/apps/files_external/l10n/nb_NO.php index c103112dbe3..3426e5589db 100644 --- a/apps/files_external/l10n/nb_NO.php +++ b/apps/files_external/l10n/nb_NO.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Ekstern lagringsplass", "Configuration" => "Konfigurasjon", "Options" => "Innstillinger", -"Applicable" => "Anvendelig", "Add storage" => "Legg til lagringsplass", -"None set" => "Ingen valgt", "All Users" => "Alle brukere", "Groups" => "Grupper", "Users" => "Brukere", diff --git a/apps/files_external/l10n/nl.php b/apps/files_external/l10n/nl.php index 4fa579775f9..dceccc7ee53 100644 --- a/apps/files_external/l10n/nl.php +++ b/apps/files_external/l10n/nl.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Externe opslag", "Configuration" => "Configuratie", "Options" => "Opties", -"Applicable" => "Van toepassing", +"Available for" => "Beschikbaar voor", "Add storage" => "Toevoegen opslag", -"None set" => "Niets ingesteld", +"No user or group" => "Geen gebruiker of groep", "All Users" => "Alle gebruikers", "Groups" => "Groepen", "Users" => "Gebruikers", diff --git a/apps/files_external/l10n/pl.php b/apps/files_external/l10n/pl.php index ece0620f754..4a3dbaf206a 100644 --- a/apps/files_external/l10n/pl.php +++ b/apps/files_external/l10n/pl.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Zewnętrzne zasoby dyskowe", "Configuration" => "Konfiguracja", "Options" => "Opcje", -"Applicable" => "Zastosowanie", +"Available for" => "Dostępne przez", "Add storage" => "Dodaj zasoby dyskowe", -"None set" => "Nie ustawione", +"No user or group" => "Brak użytkownika lub grupy", "All Users" => "Wszyscy uzytkownicy", "Groups" => "Grupy", "Users" => "Użytkownicy", diff --git a/apps/files_external/l10n/pt_BR.php b/apps/files_external/l10n/pt_BR.php index fbb945c5439..5638fd1d703 100644 --- a/apps/files_external/l10n/pt_BR.php +++ b/apps/files_external/l10n/pt_BR.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Armazenamento Externo", "Configuration" => "Configuração", "Options" => "Opções", -"Applicable" => "Aplicável", +"Available for" => "Disponível para", "Add storage" => "Adicionar Armazenamento", -"None set" => "Nenhum definido", +"No user or group" => "Nenhum usuário ou grupo", "All Users" => "Todos os Usuários", "Groups" => "Grupos", "Users" => "Usuários", diff --git a/apps/files_external/l10n/pt_PT.php b/apps/files_external/l10n/pt_PT.php index eb4d8feb41a..5bd2d0d43b6 100644 --- a/apps/files_external/l10n/pt_PT.php +++ b/apps/files_external/l10n/pt_PT.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Armazenamento Externo", "Configuration" => "Configuração", "Options" => "Opções", -"Applicable" => "Aplicável", "Add storage" => "Adicionar armazenamento", -"None set" => "Não definido", "All Users" => "Todos os utilizadores", "Groups" => "Grupos", "Users" => "Utilizadores", diff --git a/apps/files_external/l10n/ro.php b/apps/files_external/l10n/ro.php index a90b0299e17..e6cdd8450ec 100644 --- a/apps/files_external/l10n/ro.php +++ b/apps/files_external/l10n/ro.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Stocare externă", "Configuration" => "Configurație", "Options" => "Opțiuni", -"Applicable" => "Aplicabil", "Add storage" => "Adauga stocare", -"None set" => "Niciunul", "All Users" => "Toți utilizatorii", "Groups" => "Grupuri", "Users" => "Utilizatori", diff --git a/apps/files_external/l10n/ru.php b/apps/files_external/l10n/ru.php index 8ed437839cd..d4695c867af 100644 --- a/apps/files_external/l10n/ru.php +++ b/apps/files_external/l10n/ru.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Внешний носитель данных", "Configuration" => "Конфигурация", "Options" => "Опции", -"Applicable" => "Применимый", "Add storage" => "Добавить носитель данных", -"None set" => "Не установлено", "All Users" => "Все пользователи", "Groups" => "Группы", "Users" => "Пользователи", diff --git a/apps/files_external/l10n/si_LK.php b/apps/files_external/l10n/si_LK.php index ac41f596340..a9f39a3bbc9 100644 --- a/apps/files_external/l10n/si_LK.php +++ b/apps/files_external/l10n/si_LK.php @@ -9,8 +9,6 @@ $TRANSLATIONS = array( "Folder name" => "ෆොල්ඩරයේ නම", "Configuration" => "වින්යාසය", "Options" => "විකල්පයන්", -"Applicable" => "අදාළ", -"None set" => "කිසිවක් නැත", "All Users" => "සියළු පරිශීලකයන්", "Groups" => "කණ්ඩායම්", "Users" => "පරිශීලකයන්", diff --git a/apps/files_external/l10n/sk_SK.php b/apps/files_external/l10n/sk_SK.php index aa288982576..1f1a150b8a1 100644 --- a/apps/files_external/l10n/sk_SK.php +++ b/apps/files_external/l10n/sk_SK.php @@ -5,6 +5,7 @@ $TRANSLATIONS = array( "Grant access" => "Povoliť prístup", "Please provide a valid Dropbox app key and secret." => "Zadajte platný kľúč aplikácie a heslo Dropbox", "Error configuring Google Drive storage" => "Chyba pri konfigurácii úložiska Google drive", +"Saved" => "Uložené", "<b>Warning:</b> \"smbclient\" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it." => "<b>Upozornenie:</b> \"smbclient\" nie je nainštalovaný. Nie je možné pripojenie oddielov CIFS/SMB. Požiadajte administrátora systému, nech ho nainštaluje.", "<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Upozornenie:</b> Podpora FTP v PHP nie je povolená alebo nainštalovaná. Nie je možné pripojenie oddielov FTP. Požiadajte administrátora systému, nech ho nainštaluje.", "<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Varovanie:</b> nie je nainštalovaná, alebo povolená, podpora Curl v PHP. Nie je možné pripojenie oddielov ownCloud, WebDAV, či GoogleDrive. Prosím požiadajte svojho administrátora systému, nech ju nainštaluje.", @@ -13,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Externé úložisko", "Configuration" => "Nastavenia", "Options" => "Možnosti", -"Applicable" => "Aplikovateľné", "Add storage" => "Pridať úložisko", -"None set" => "Žiadne nastavené", "All Users" => "Všetci používatelia", "Groups" => "Skupiny", "Users" => "Používatelia", diff --git a/apps/files_external/l10n/sl.php b/apps/files_external/l10n/sl.php index 05e626fcf83..9d1970064e8 100644 --- a/apps/files_external/l10n/sl.php +++ b/apps/files_external/l10n/sl.php @@ -14,9 +14,7 @@ $TRANSLATIONS = array( "External storage" => "Zunanja shramba", "Configuration" => "Nastavitve", "Options" => "Možnosti", -"Applicable" => "Se uporablja", "Add storage" => "Dodaj shrambo", -"None set" => "Ni nastavljeno", "All Users" => "Vsi uporabniki", "Groups" => "Skupine", "Users" => "Uporabniki", diff --git a/apps/files_external/l10n/sv.php b/apps/files_external/l10n/sv.php index 183df674b9d..0a50fd2cc7d 100644 --- a/apps/files_external/l10n/sv.php +++ b/apps/files_external/l10n/sv.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Extern lagring", "Configuration" => "Konfiguration", "Options" => "Alternativ", -"Applicable" => "Tillämplig", "Add storage" => "Lägg till lagring", -"None set" => "Ingen angiven", "All Users" => "Alla användare", "Groups" => "Grupper", "Users" => "Användare", diff --git a/apps/files_external/l10n/ta_LK.php b/apps/files_external/l10n/ta_LK.php index 94ddaf9c5e1..fe5d2a8bc87 100644 --- a/apps/files_external/l10n/ta_LK.php +++ b/apps/files_external/l10n/ta_LK.php @@ -9,8 +9,6 @@ $TRANSLATIONS = array( "Folder name" => "கோப்புறை பெயர்", "Configuration" => "தகவமைப்பு", "Options" => "தெரிவுகள்", -"Applicable" => "பயன்படத்தக்க", -"None set" => "தொகுப்பில்லா", "All Users" => "பயனாளர்கள் எல்லாம்", "Groups" => "குழுக்கள்", "Users" => "பயனாளர்", diff --git a/apps/files_external/l10n/th_TH.php b/apps/files_external/l10n/th_TH.php index a1a56a4d2e4..0a5a419c5e5 100644 --- a/apps/files_external/l10n/th_TH.php +++ b/apps/files_external/l10n/th_TH.php @@ -11,8 +11,6 @@ $TRANSLATIONS = array( "Folder name" => "ชื่อโฟลเดอร์", "Configuration" => "การกำหนดค่า", "Options" => "ตัวเลือก", -"Applicable" => "สามารถใช้งานได้", -"None set" => "ยังไม่มีการกำหนด", "All Users" => "ผู้ใช้งานทั้งหมด", "Groups" => "กลุ่ม", "Users" => "ผู้ใช้งาน", diff --git a/apps/files_external/l10n/tr.php b/apps/files_external/l10n/tr.php index a835d6f174a..e9e5556a9f3 100644 --- a/apps/files_external/l10n/tr.php +++ b/apps/files_external/l10n/tr.php @@ -14,9 +14,9 @@ $TRANSLATIONS = array( "External storage" => "Harici depolama", "Configuration" => "Yapılandırma", "Options" => "Seçenekler", -"Applicable" => "Uygulanabilir", +"Available for" => "Kullanabilenler", "Add storage" => "Depo ekle", -"None set" => "Hiçbiri", +"No user or group" => "Kullanıcı veya grup yok", "All Users" => "Tüm Kullanıcılar", "Groups" => "Gruplar", "Users" => "Kullanıcılar", diff --git a/apps/files_external/l10n/uk.php b/apps/files_external/l10n/uk.php index a7c028aa935..2f5767c9a1d 100644 --- a/apps/files_external/l10n/uk.php +++ b/apps/files_external/l10n/uk.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Зовнішнє сховище", "Configuration" => "Налаштування", "Options" => "Опції", -"Applicable" => "Придатний", "Add storage" => "Додати сховище", -"None set" => "Не встановлено", "All Users" => "Усі користувачі", "Groups" => "Групи", "Users" => "Користувачі", diff --git a/apps/files_external/l10n/vi.php b/apps/files_external/l10n/vi.php index 5fd00dc2bf5..370bd71c31c 100644 --- a/apps/files_external/l10n/vi.php +++ b/apps/files_external/l10n/vi.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "Lưu trữ ngoài", "Configuration" => "Cấu hình", "Options" => "Tùy chọn", -"Applicable" => "Áp dụng", "Add storage" => "Thêm bộ nhớ", -"None set" => "không", "All Users" => "Tất cả người dùng", "Groups" => "Nhóm", "Users" => "Người dùng", diff --git a/apps/files_external/l10n/zh_CN.php b/apps/files_external/l10n/zh_CN.php index bb85d0e4f49..3051df04d93 100644 --- a/apps/files_external/l10n/zh_CN.php +++ b/apps/files_external/l10n/zh_CN.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "外部存储", "Configuration" => "配置", "Options" => "选项", -"Applicable" => "适用的", "Add storage" => "添加存储", -"None set" => "未设置", "All Users" => "所有用户", "Groups" => "组", "Users" => "用户", diff --git a/apps/files_external/l10n/zh_TW.php b/apps/files_external/l10n/zh_TW.php index 7c256cd2ab7..ae7d84b0ee3 100644 --- a/apps/files_external/l10n/zh_TW.php +++ b/apps/files_external/l10n/zh_TW.php @@ -13,9 +13,7 @@ $TRANSLATIONS = array( "External storage" => "外部儲存", "Configuration" => "設定", "Options" => "選項", -"Applicable" => "可用的", "Add storage" => "增加儲存區", -"None set" => "尚未設定", "All Users" => "所有使用者", "Groups" => "群組", "Users" => "使用者", diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 80238666376..e8815acaf16 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,152 +1,152 @@ -<form id="files_external"> - <fieldset class="personalblock"> +<form id="files_external" class="section"> <h2><?php p($l->t('External Storage')); ?></h2> - <?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?> - <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'> - <thead> - <tr> - <th></th> - <th><?php p($l->t('Folder name')); ?></th> - <th><?php p($l->t('External storage')); ?></th> - <th><?php p($l->t('Configuration')); ?></th> - <!--<th><?php p($l->t('Options')); ?></th> --> - <?php if ($_['isAdminPage']) print_unescaped('<th>'.$l->t('Applicable').'</th>'); ?> - <th> </th> - </tr> - </thead> - <tbody width="100%"> - <?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?> - <?php foreach ($_['mounts'] as $mount): ?> - <tr <?php print_unescaped(($mount['mountpoint'] !== '') ? 'class="'.OC_Util::sanitizeHTML($mount['class']).'"' : 'id="addMountPoint"'); ?>> - <td class="status"> - <?php if (isset($mount['status'])): ?> - <span class="<?php p(($mount['status']) ? 'success' : 'error'); ?>"></span> - <?php endif; ?> + <?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?> + <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'> + <thead> + <tr> + <th></th> + <th><?php p($l->t('Folder name')); ?></th> + <th><?php p($l->t('External storage')); ?></th> + <th><?php p($l->t('Configuration')); ?></th> + <!--<th><?php p($l->t('Options')); ?></th> --> + <?php if ($_['isAdminPage']) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> + <th> </th> + </tr> + </thead> + <tbody width="100%"> + <?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?> + <?php foreach ($_['mounts'] as $mount): ?> + <tr <?php print_unescaped(($mount['mountpoint'] !== '') ? 'class="'.OC_Util::sanitizeHTML($mount['class']).'"' : 'id="addMountPoint"'); ?>> + <td class="status"> + <?php if (isset($mount['status'])): ?> + <span class="<?php p(($mount['status']) ? 'success' : 'error'); ?>"></span> + <?php endif; ?> + </td> + <td class="mountPoint"><input type="text" name="mountPoint" + value="<?php p($mount['mountpoint']); ?>" + placeholder="<?php p($l->t('Folder name')); ?>" /></td> + <?php if ($mount['mountpoint'] == ''): ?> + <td class="backend"> + <select id="selectBackend" data-configurations='<?php print_unescaped(json_encode($_['backends'])); ?>'> + <option value="" disabled selected + style="display:none;"><?php p($l->t('Add storage')); ?></option> + <?php foreach ($_['backends'] as $class => $backend): ?> + <option value="<?php p($class); ?>"><?php p($backend['backend']); ?></option> + <?php endforeach; ?> + </select> </td> - <td class="mountPoint"><input type="text" name="mountPoint" - value="<?php p($mount['mountpoint']); ?>" - placeholder="<?php p($l->t('Folder name')); ?>" /></td> - <?php if ($mount['mountpoint'] == ''): ?> - <td class="backend"> - <select id="selectBackend" data-configurations='<?php print_unescaped(json_encode($_['backends'])); ?>'> - <option value="" disabled selected - style="display:none;"><?php p($l->t('Add storage')); ?></option> - <?php foreach ($_['backends'] as $class => $backend): ?> - <option value="<?php p($class); ?>"><?php p($backend['backend']); ?></option> - <?php endforeach; ?> - </select> - </td> - <?php else: ?> - <td class="backend" - data-class="<?php p($mount['class']); ?>"><?php p($mount['backend']); ?></td> - <?php endif; ?> - <td class ="configuration" width="100%"> - <?php if (isset($mount['options'])): ?> - <?php foreach ($mount['options'] as $parameter => $value): ?> - <?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?> - <?php - $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter]; - $is_optional = FALSE; - if (strpos($placeholder, '&') === 0) { - $is_optional = TRUE; - $placeholder = substr($placeholder, 1); - } - ?> - <?php if (strpos($placeholder, '*') === 0): ?> - <input type="password" - <?php if ($is_optional): ?> class="optional"<?php endif; ?> - data-parameter="<?php p($parameter); ?>" - value="<?php p($value); ?>" - placeholder="<?php p(substr($placeholder, 1)); ?>" /> - <?php elseif (strpos($placeholder, '!') === 0): ?> - <label><input type="checkbox" - data-parameter="<?php p($parameter); ?>" - <?php if ($value == 'true'): ?> checked="checked"<?php endif; ?> - /><?php p(substr($placeholder, 1)); ?></label> - <?php elseif (strpos($placeholder, '#') === 0): ?> - <input type="hidden" - data-parameter="<?php p($parameter); ?>" - value="<?php p($value); ?>" /> - <?php else: ?> - <input type="text" - <?php if ($is_optional): ?> class="optional"<?php endif; ?> - data-parameter="<?php p($parameter); ?>" - value="<?php p($value); ?>" - placeholder="<?php p($placeholder); ?>" /> - <?php endif; ?> + <?php else: ?> + <td class="backend" + data-class="<?php p($mount['class']); ?>"><?php p($mount['backend']); ?></td> + <?php endif; ?> + <td class ="configuration" width="100%"> + <?php if (isset($mount['options'])): ?> + <?php foreach ($mount['options'] as $parameter => $value): ?> + <?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?> + <?php + $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter]; + $is_optional = FALSE; + if (strpos($placeholder, '&') === 0) { + $is_optional = TRUE; + $placeholder = substr($placeholder, 1); + } + ?> + <?php if (strpos($placeholder, '*') === 0): ?> + <input type="password" + <?php if ($is_optional): ?> class="optional"<?php endif; ?> + data-parameter="<?php p($parameter); ?>" + value="<?php p($value); ?>" + placeholder="<?php p(substr($placeholder, 1)); ?>" /> + <?php elseif (strpos($placeholder, '!') === 0): ?> + <label><input type="checkbox" + data-parameter="<?php p($parameter); ?>" + <?php if ($value == 'true'): ?> checked="checked"<?php endif; ?> + /><?php p(substr($placeholder, 1)); ?></label> + <?php elseif (strpos($placeholder, '#') === 0): ?> + <input type="hidden" + data-parameter="<?php p($parameter); ?>" + value="<?php p($value); ?>" /> + <?php else: ?> + <input type="text" + <?php if ($is_optional): ?> class="optional"<?php endif; ?> + data-parameter="<?php p($parameter); ?>" + value="<?php p($value); ?>" + placeholder="<?php p($placeholder); ?>" /> <?php endif; ?> - <?php endforeach; ?> - <?php if (isset($_['backends'][$mount['class']]['custom']) && !in_array('files_external/js/'.$_['backends'][$mount['class']]['custom'], \OC_Util::$scripts)): ?> - <?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?> <?php endif; ?> + <?php endforeach; ?> + <?php if (isset($_['backends'][$mount['class']]['custom']) && !in_array('files_external/js/'.$_['backends'][$mount['class']]['custom'], \OC_Util::$scripts)): ?> + <?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?> <?php endif; ?> - </td> - <?php if ($_['isAdminPage']): ?> - <td class="applicable" - align="right" - data-applicable-groups='<?php if (isset($mount['applicable']['groups'])) - print_unescaped(json_encode($mount['applicable']['groups'])); ?>' - data-applicable-users='<?php if (isset($mount['applicable']['users'])) - print_unescaped(json_encode($mount['applicable']['users'])); ?>'> - <select class="chzn-select" - multiple style="width:20em;" - data-placeholder="<?php p($l->t('None set')); ?>"> - <option value="all" <?php if (isset($mount['applicable']['users']) && in_array('all', $mount['applicable']['users'])) print_unescaped('selected="selected"');?> ><?php p($l->t('All Users')); ?></option> - <optgroup label="<?php p($l->t('Groups')); ?>"> - <?php foreach ($_['groups'] as $group): ?> - <option value="<?php p($group); ?>(group)" - <?php if (isset($mount['applicable']['groups']) && in_array($group, $mount['applicable']['groups'])): ?> - selected="selected" - <?php endif; ?>><?php p($group); ?></option> - <?php endforeach; ?> - </optgroup> - <optgroup label="<?php p($l->t('Users')); ?>"> - <?php foreach ($_['users'] as $user): ?> - <option value="<?php p($user); ?>" - <?php if (isset($mount['applicable']['users']) && in_array($user, $mount['applicable']['users'])): ?> - selected="selected" - <?php endif; ?>><?php p($_['userDisplayNames'][$user]); ?></option> - <?php endforeach; ?> - </optgroup> - </select> - </td> <?php endif; ?> - <td <?php if ($mount['mountpoint'] != ''): ?>class="remove" - <?php else: ?>style="visibility:hidden;" - <?php endif ?>><img alt="<?php p($l->t('Delete')); ?>" - title="<?php p($l->t('Delete')); ?>" - class="svg action" - src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>" /></td> - </tr> - <?php endforeach; ?> - </tbody> - </table> - <br /> + </td> + <?php if ($_['isAdminPage']): ?> + <td class="applicable" + align="right" + data-applicable-groups='<?php if (isset($mount['applicable']['groups'])) + print_unescaped(json_encode($mount['applicable']['groups'])); ?>' + data-applicable-users='<?php if (isset($mount['applicable']['users'])) + print_unescaped(json_encode($mount['applicable']['users'])); ?>'> + <select class="chzn-select" + multiple style="width:20em;" + data-placeholder="<?php p($l->t('No user or group')); ?>"> + <option value="all" + <?php if (empty($mount['class']) || (isset($mount['applicable']['users']) && in_array('all', $mount['applicable']['users']))) print_unescaped('selected="selected"');?> > + <?php p($l->t('All Users')); ?> + </option> + <optgroup label="<?php p($l->t('Groups')); ?>"> + <?php foreach ($_['groups'] as $group): ?> + <option value="<?php p($group); ?>(group)" + <?php if (isset($mount['applicable']['groups']) && in_array($group, $mount['applicable']['groups'])): ?> + selected="selected" + <?php endif; ?>><?php p($group); ?></option> + <?php endforeach; ?> + </optgroup> + <optgroup label="<?php p($l->t('Users')); ?>"> + <?php foreach ($_['users'] as $user): ?> + <option value="<?php p($user); ?>" + <?php if (isset($mount['applicable']['users']) && in_array($user, $mount['applicable']['users'])): ?> + selected="selected" + <?php endif; ?>><?php p($_['userDisplayNames'][$user]); ?></option> + <?php endforeach; ?> + </optgroup> + </select> + </td> + <?php endif; ?> + <td <?php if ($mount['mountpoint'] != ''): ?>class="remove" + <?php else: ?>style="visibility:hidden;" + <?php endif ?>><img alt="<?php p($l->t('Delete')); ?>" + title="<?php p($l->t('Delete')); ?>" + class="svg action" + src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>" /></td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + <br /> - <?php if ($_['isAdminPage']): ?> - <br /> - <input type="checkbox" name="allowUserMounting" id="allowUserMounting" - value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> - <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label> <span id="userMountingMsg" class="msg"></span> + <?php if ($_['isAdminPage']): ?> + <br /> + <input type="checkbox" name="allowUserMounting" id="allowUserMounting" + value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> + <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label> <span id="userMountingMsg" class="msg"></span> - <p id="userMountingBackups"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> - <?php p($l->t('Allow users to mount the following external storage')); ?><br /> - <?php $i = 0; foreach ($_['personal_backends'] as $class => $backend): ?> - <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($class); ?>" <?php if ($backend['enabled']) print_unescaped(' checked="checked"'); ?> /> - <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend['backend']); ?></label> <br /> - <?php $i++; ?> - <?php endforeach; ?> - </p> - <?php endif; ?> - </fieldset> + <p id="userMountingBackups"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> + <?php p($l->t('Allow users to mount the following external storage')); ?><br /> + <?php $i = 0; foreach ($_['personal_backends'] as $class => $backend): ?> + <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($class); ?>" <?php if ($backend['enabled']) print_unescaped(' checked="checked"'); ?> /> + <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend['backend']); ?></label> <br /> + <?php $i++; ?> + <?php endforeach; ?> + </p> + <?php endif; ?> </form> <?php if ( ! $_['isAdminPage']): ?> -<form id="files_external" +<form id="files_external" class="section" method="post" enctype="multipart/form-data" action="<?php p(OCP\Util::linkTo('files_external', 'ajax/addRootCertificate.php')); ?>"> -<fieldset class="personalblock"> <h2><?php p($l->t('SSL root certificates'));?></h2> <table id="sslCertificate" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'> <tbody width="100%"> @@ -166,6 +166,5 @@ <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']); ?>"> <input type="file" id="rootcert_import" name="rootcert_import"> <input type="submit" name="cert_import" value="<?php p($l->t('Import Root Certificate')); ?>" /> -</fieldset> </form> <?php endif; ?> diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index 4b716e764f4..ab32108ea25 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -71,19 +71,6 @@ if (version_compare($installedVersion, '0.3', '<')) { } // clean up oc_share table from files which are no longer exists -if (version_compare($installedVersion, '0.3.5', '<')) { - - // get all shares where the original file no longer exists - $findShares = \OC_DB::prepare('SELECT `file_source` FROM `*PREFIX*share` LEFT JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE `*PREFIX*filecache`.`fileid` IS NULL AND `*PREFIX*share`.`item_type` IN (\'file\', \'folder\')'); - $sharesFound = $findShares->execute(array())->fetchAll(); - - // delete those shares from the oc_share table - if (is_array($sharesFound) && !empty($sharesFound)) { - $delArray = array(); - foreach ($sharesFound as $share) { - $delArray[] = $share['file_source']; - } - $removeShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source` IN (?)'); - $result = $removeShares->execute(array(implode(',', $delArray))); - } +if (version_compare($installedVersion, '0.3.5.6', '<')) { + \OC\Files\Cache\Shared_Updater::fixBrokenSharesOnAppUpdate(); } diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version index 09e9157034c..8f91d33378e 100644 --- a/apps/files_sharing/appinfo/version +++ b/apps/files_sharing/appinfo/version @@ -1 +1 @@ -0.3.5
\ No newline at end of file +0.3.5.6 diff --git a/apps/files_sharing/l10n/et_EE.php b/apps/files_sharing/l10n/et_EE.php index af5891fcc7f..7150f05da22 100644 --- a/apps/files_sharing/l10n/et_EE.php +++ b/apps/files_sharing/l10n/et_EE.php @@ -11,6 +11,7 @@ $TRANSLATIONS = array( "sharing is disabled" => "jagamine on peatatud", "For more info, please ask the person who sent this link." => "Täpsema info saamiseks palun pöördu lingi saatnud isiku poole.", "shared by %s" => "jagas %s", +"Download %s" => "Laadi alla %s", "Direct link" => "Otsene link" ); $PLURAL_FORMS = "nplurals=2; plural=(n != 1);"; diff --git a/apps/files_sharing/l10n/sk_SK.php b/apps/files_sharing/l10n/sk_SK.php index 4e9856da4a7..6856c0591f4 100644 --- a/apps/files_sharing/l10n/sk_SK.php +++ b/apps/files_sharing/l10n/sk_SK.php @@ -11,6 +11,7 @@ $TRANSLATIONS = array( "sharing is disabled" => "zdieľanie je zakázané", "For more info, please ask the person who sent this link." => "Pre viac informácií kontaktujte osobu, ktorá vám poslala tento odkaz.", "shared by %s" => "Zdieľa %s", +"Download %s" => "Stiahnuť %s", "Direct link" => "Priama linka" ); $PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"; diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 01db29d72e2..eeb62c3cce2 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -20,6 +20,7 @@ */ namespace OC\Files\Cache; + use OCP\Share_Backend_Collection; /** @@ -50,7 +51,7 @@ class Shared_Cache extends Cache { \OC\Files\Filesystem::initMountPoints($source['fileOwner']); $mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']); if (is_array($mount)) { - $fullPath = $mount[key($mount)]->getMountPoint().$source['path']; + $fullPath = $mount[key($mount)]->getMountPoint() . $source['path']; list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath); if ($storage) { $this->files[$target] = $internalPath; @@ -75,7 +76,7 @@ class Shared_Cache extends Cache { /** * get the stored metadata of a file or folder * - * @param string/int $file + * @param string /int $file * @return array */ public function get($file) { @@ -95,8 +96,8 @@ class Shared_Cache extends Cache { } else { $query = \OC_DB::prepare( 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,' - .' `size`, `mtime`, `encrypted`, `unencrypted_size`' - .' FROM `*PREFIX*filecache` WHERE `fileid` = ?'); + . ' `size`, `mtime`, `encrypted`, `unencrypted_size`' + . ' FROM `*PREFIX*filecache` WHERE `fileid` = ?'); $result = $query->execute(array($file)); $data = $result->fetchRow(); $data['fileid'] = (int)$data['fileid']; @@ -288,8 +289,7 @@ class Shared_Cache extends Cache { foreach ($files as $file) { if ($file['mimetype'] === 'httpd/unix-directory') { $exploreDirs[] = ltrim($dir . '/' . $file['name'], '/'); - } - else if (($mimepart && $file['mimepart'] === $mimepart) || ($mimetype && $file['mimetype'] === $mimetype)) { + } else if (($mimepart && $file['mimepart'] === $mimepart) || ($mimetype && $file['mimetype'] === $mimetype)) { // usersPath not reliable //$file['path'] = $file['usersPath']; $file['path'] = ltrim($dir . '/' . $file['name'], '/'); @@ -344,8 +344,6 @@ class Shared_Cache extends Cache { if ($row['encrypted'] or ($row['unencrypted_size'] > 0 and $row['mimetype'] === 'httpd/unix-directory')) { $row['encrypted_size'] = $row['size']; $row['size'] = $row['unencrypted_size']; - } else { - $row['size'] = $row['size']; } $files[] = $row; } @@ -402,4 +400,48 @@ class Shared_Cache extends Cache { return false; } + /** + * get the path of a file on this storage by it's id + * + * @param int $id + * @param string $pathEnd (optional) used internally for recursive calls + * @return string | null + */ + public function getPathById($id, $pathEnd = '') { + // direct shares are easy + if ($path = $this->getShareById($id)) { + return $path . $pathEnd; + } else { + // if the item is a direct share we try and get the path of the parent and append the name of the item to it + list($parent, $name) = $this->getParentInfo($id); + if ($parent > 0) { + return $this->getPathById($parent, '/' . $name . $pathEnd); + } else { + return null; + } + } + } + + private function getShareById($id) { + $item = \OCP\Share::getItemSharedWithBySource('file', $id); + if ($item) { + return trim($item['file_target'], '/'); + } + $item = \OCP\Share::getItemSharedWithBySource('folder', $id); + if ($item) { + return trim($item['file_target'], '/'); + } + return null; + } + + private function getParentInfo($id) { + $sql = 'SELECT `parent`, `name` FROM `*PREFIX*filecache` WHERE `fileid` = ?'; + $query = \OC_DB::prepare($sql); + $result = $query->execute(array($id)); + if ($row = $result->fetchRow()) { + return array($row['parent'], $row['name']); + } else { + return array(-1, ''); + } + } } diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php index 23ebc9fb811..e3a7679292d 100644 --- a/apps/files_sharing/lib/updater.php +++ b/apps/files_sharing/lib/updater.php @@ -135,4 +135,19 @@ class Shared_Updater { } } + /** + * clean up oc_share table from files which are no longer exists + * + * This fixes issues from updates from files_sharing < 0.3.5.6 (ownCloud 4.5) + * It will just be called during the update of the app + */ + static public function fixBrokenSharesOnAppUpdate() { + // delete all shares where the original file no longer exists + $findAndRemoveShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share` ' . + 'WHERE `file_source` NOT IN ( ' . + 'SELECT `fileid` FROM `*PREFIX*filecache` WHERE `item_type` IN (\'file\', \'folder\'))' + ); + $findAndRemoveShares->execute(array()); + } + } diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php index a75e1860527..47969833ab5 100644 --- a/apps/files_sharing/tests/cache.php +++ b/apps/files_sharing/tests/cache.php @@ -246,4 +246,43 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base { } } + public function testGetPathByIdDirectShare() { + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + \OC\Files\Filesystem::file_put_contents('test.txt', 'foo'); + $info = \OC\Files\Filesystem::getFileInfo('test.txt'); + \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OC_Util::tearDownFS(); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/test.txt')); + list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/Shared/test.txt'); + /** + * @var \OC\Files\Storage\Shared $sharedStorage + */ + + $sharedCache = $sharedStorage->getCache(); + $this->assertEquals('test.txt', $sharedCache->getPathById($info->getId())); + } + + public function testGetPathByIdShareSubFolder() { + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + \OC\Files\Filesystem::mkdir('foo'); + \OC\Files\Filesystem::mkdir('foo/bar'); + \OC\Files\Filesystem::touch('foo/bar/test.txt', 'bar'); + $folderInfo = \OC\Files\Filesystem::getFileInfo('foo'); + $fileInfo = \OC\Files\Filesystem::getFileInfo('foo/bar/test.txt'); + \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OC_Util::tearDownFS(); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + $this->assertTrue(\OC\Files\Filesystem::file_exists('/Shared/foo')); + list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/Shared/foo'); + /** + * @var \OC\Files\Storage\Shared $sharedStorage + */ + + $sharedCache = $sharedStorage->getCache(); + $this->assertEquals('foo', $sharedCache->getPathById($folderInfo->getId())); + $this->assertEquals('foo/bar/test.txt', $sharedCache->getPathById($fileInfo->getId())); + } } diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php new file mode 100644 index 00000000000..79ae4879b64 --- /dev/null +++ b/apps/files_sharing/tests/updater.php @@ -0,0 +1,91 @@ +<?php +/** + * ownCloud + * + * @author Morris Jobke + * @copyright 2014 Morris Jobke <morris.jobke@gmail.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_Files_Sharing_Updater + */ +class Test_Files_Sharing_Updater extends \PHPUnit_Framework_TestCase { + + function setUp() { + // some previous tests didn't clean up and therefore this has to be done here + // FIXME: DIRTY HACK - TODO: find tests, that don't clean up and fix it there + $this->tearDown(); + + // add items except one - because this is the test case for the broken share table + $addItems = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` (`storage`, `path_hash`, ' . + '`parent`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`) ' . + 'VALUES (1, ?, 1, 1, 1, 1, 1, 1)'); + $items = array(1, 3); + $fileIds = array(); + foreach($items as $item) { + // the number is used as path_hash + $addItems->execute(array($item)); + $fileIds[] = \OC_DB::insertId('*PREFIX*filecache'); + } + + $addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`file_source`, `item_type`, `uid_owner`) VALUES (?, \'file\', 1)'); + // the number is used as item_source + $addShares->execute(array($fileIds[0])); + $addShares->execute(array(200)); // id of "deleted" file + $addShares->execute(array($fileIds[1])); + } + + function tearDown() { + $removeShares = \OC_DB::prepare('DELETE FROM `*PREFIX*share`'); + $removeShares->execute(); + $removeItems = \OC_DB::prepare('DELETE FROM `*PREFIX*filecache`'); + $removeItems->execute(); + } + + /** + * @medium + */ + function testRemoveBrokenShares() { + // check if there are just 3 shares (see setUp - precondition: empty table) + $countShares = \OC_DB::prepare('SELECT COUNT(`id`) FROM `*PREFIX*share`'); + $result = $countShares->execute()->fetchOne(); + $this->assertEquals(3, $result); + + // check if there are just 2 items (see setUp - precondition: empty table) + $countItems = \OC_DB::prepare('SELECT COUNT(`fileid`) FROM `*PREFIX*filecache`'); + $result = $countItems->execute()->fetchOne(); + $this->assertEquals(2, $result); + + // execute actual code which should be tested + \OC\Files\Cache\Shared_Updater::fixBrokenSharesOnAppUpdate(); + + // check if there are just 2 shares (one gets killed by the code as there is no filecache entry for this) + $countShares = \OC_DB::prepare('SELECT COUNT(`id`) FROM `*PREFIX*share`'); + $result = $countShares->execute()->fetchOne(); + $this->assertEquals(2, $result); + + // check if the share of file '200' is removed as there is no entry for this in filecache table + $countShares = \OC_DB::prepare('SELECT COUNT(`id`) FROM `*PREFIX*share` WHERE `file_source` = 200'); + $result = $countShares->execute()->fetchOne(); + $this->assertEquals(0, $result); + + // check if there are just 2 items + $countItems = \OC_DB::prepare('SELECT COUNT(`fileid`) FROM `*PREFIX*filecache`'); + $result = $countItems->execute()->fetchOne(); + $this->assertEquals(2, $result); + } +} diff --git a/apps/user_ldap/l10n/el.php b/apps/user_ldap/l10n/el.php index 1e975911953..926419d86b2 100644 --- a/apps/user_ldap/l10n/el.php +++ b/apps/user_ldap/l10n/el.php @@ -33,12 +33,14 @@ $TRANSLATIONS = array( "Save" => "Αποθήκευση", "Test Configuration" => "Δοκιμαστικες ρυθμισεις", "Help" => "Βοήθεια", +"Groups meeting these criteria are available in %s:" => "Οι ομάδες που πληρούν τα κριτήρια είναι διαθέσιμες σε %s:", "only those object classes:" => "μόνο αυτές οι κλάσεις αντικειμένων:", "only from those groups:" => "μόνο από αυτές τις ομάδες:", "Edit raw filter instead" => "Επεξεργασία πρωτογενούς φίλτρου αντί αυτού", "Raw LDAP filter" => "Πρωτογενές φίλτρο ", "The filter specifies which LDAP groups shall have access to the %s instance." => "Το φίλτρο καθορίζει ποιες ομάδες LDAP θα έχουν πρόσβαση στην εγκατάσταση %s.", "groups found" => "ομάδες βρέθηκαν", +"Users login with this attribute:" => "Οι χρήστες εισέρχονται με αυτό το χαρακτηριστικό:", "LDAP Username:" => "Όνομα χρήστη LDAP:", "LDAP Email Address:" => "Διεύθυνση ηλ. ταχυδρομείου LDAP:", "Other Attributes:" => "Άλλες Ιδιότητες:", @@ -53,6 +55,7 @@ $TRANSLATIONS = array( "For anonymous access, leave DN and Password empty." => "Για ανώνυμη πρόσβαση, αφήστε κενά τα πεδία DN και Pasword.", "One Base DN per line" => "Ένα DN Βάσης ανά γραμμή ", "You can specify Base DN for users and groups in the Advanced tab" => "Μπορείτε να καθορίσετε το Base DN για χρήστες και ομάδες από την καρτέλα Προηγμένες ρυθμίσεις", +"Limit %s access to users meeting these criteria:" => "Περιορισμός της πρόσβασης %s σε χρήστες που πληρούν τα κριτήρια:", "The filter specifies which LDAP users shall have access to the %s instance." => "Το φίλτρο καθορίζει ποιοι χρήστες LDAP θα έχουν πρόσβαση στην εγκατάσταση %s.", "users found" => "χρήστες βρέθηκαν", "Back" => "Επιστροφή", @@ -85,6 +88,7 @@ $TRANSLATIONS = array( "One Group Base DN per line" => "Μια ομαδικη Βάση DN ανά γραμμή", "Group Search Attributes" => "Ομάδα Χαρακτηριστικων Αναζήτηση", "Group-Member association" => "Group-Member association", +"Nested Groups" => "Φωλιασμένες ομάδες", "Special Attributes" => "Ειδικά Χαρακτηριστικά ", "Quota Field" => "Ποσοσταση πεδιου", "Quota Default" => "Προκαθισμενο πεδιο", diff --git a/apps/user_ldap/l10n/et_EE.php b/apps/user_ldap/l10n/et_EE.php index 090accceda0..9bf3a189efd 100644 --- a/apps/user_ldap/l10n/et_EE.php +++ b/apps/user_ldap/l10n/et_EE.php @@ -33,12 +33,14 @@ $TRANSLATIONS = array( "Save" => "Salvesta", "Test Configuration" => "Testi seadistust", "Help" => "Abiinfo", +"Groups meeting these criteria are available in %s:" => "Kriteeriumiga sobivad grupid on saadaval %s:", "only those object classes:" => "ainult need objektiklassid:", "only from those groups:" => "ainult nendest gruppidest:", "Edit raw filter instead" => "Selle asemel muuda filtrit", "Raw LDAP filter" => "LDAP filter", "The filter specifies which LDAP groups shall have access to the %s instance." => "Filter määrab millised LDAP grupid saavad ligipääsu sellele %s instantsile.", "groups found" => "gruppi leitud", +"Users login with this attribute:" => "Logimiseks kasutatkse atribuuti: ", "LDAP Username:" => "LDAP kasutajanimi:", "LDAP Email Address:" => "LDAP e-posti aadress:", "Other Attributes:" => "Muud atribuudid:", @@ -53,6 +55,7 @@ $TRANSLATIONS = array( "For anonymous access, leave DN and Password empty." => "Anonüümseks ligipääsuks jäta DN ja parool tühjaks.", "One Base DN per line" => "Üks baas-DN rea kohta", "You can specify Base DN for users and groups in the Advanced tab" => "Sa saad kasutajate ja gruppide baas DN-i määrata lisavalikute vahekaardilt", +"Limit %s access to users meeting these criteria:" => "Piira %s liigpääs kriteeriumiga sobivatele kasutajatele:", "The filter specifies which LDAP users shall have access to the %s instance." => "Filter määrab millised LDAP kasutajad pääsevad ligi %s instantsile.", "users found" => "kasutajat leitud", "Back" => "Tagasi", @@ -85,6 +88,8 @@ $TRANSLATIONS = array( "One Group Base DN per line" => "Üks grupi baas-DN rea kohta", "Group Search Attributes" => "Grupi otsingu atribuudid", "Group-Member association" => "Grupiliikme seotus", +"Nested Groups" => "Sisegrupp", +"When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)" => "Sisse lülitamisel on toetatakse gruppe sisaldavad gruppe. (Toimib, kui grupi liikme atribuut sisaldab DN-e.)", "Special Attributes" => "Spetsiifilised atribuudid", "Quota Field" => "Mahupiirangu atribuut", "Quota Default" => "Vaikimisi mahupiirang", diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 79c4ae224c3..ee4a7df3cb8 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -1,5 +1,5 @@ <form id="ldap" action="#" method="post"> - <div id="ldapSettings" class="personalblock"> + <div id="ldapSettings" class="section"> <ul> <?php foreach($_['toc'] as $id => $title) { ?> <li id="<?php p($id); ?>"><a href="<?php p($id); ?>"><?php p($title); ?></a></li> diff --git a/apps/user_webdavauth/templates/settings.php b/apps/user_webdavauth/templates/settings.php index ad1701add8c..4596fdf3c78 100755 --- a/apps/user_webdavauth/templates/settings.php +++ b/apps/user_webdavauth/templates/settings.php @@ -1,9 +1,7 @@ -<form id="webdavauth" action="#" method="post"> - <fieldset class="personalblock"> - <h2><?php p($l->t('WebDAV Authentication'));?></h2> - <p><label for="webdav_url"><?php p($l->t('Address: '));?><input type="url" placeholder="https://example.com/webdav" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"></label> - <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken"> - <input type="submit" value="Save" /> - <br /><?php p($l->t('The user credentials will be sent to this address. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials.')); ?> - </fieldset> +<form id="webdavauth" class="section" action="#" method="post"> + <h2><?php p($l->t('WebDAV Authentication'));?></h2> + <p><label for="webdav_url"><?php p($l->t('Address: '));?><input type="url" placeholder="https://example.com/webdav" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"></label> + <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken"> + <input type="submit" value="Save" /> + <br /><?php p($l->t('The user credentials will be sent to this address. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials.')); ?> </form> |