]> source.dussan.org Git - nextcloud-server.git/commitdiff
ported the rest of the OC_Helper calls
authorFrank Karlitschek <frank@owncloud.org>
Tue, 1 May 2012 22:20:45 +0000 (00:20 +0200)
committerFrank Karlitschek <frank@owncloud.org>
Tue, 1 May 2012 22:20:45 +0000 (00:20 +0200)
34 files changed:
apps/bookmarks/appinfo/app.php
apps/calendar/appinfo/app.php
apps/calendar/templates/calendar.php
apps/contacts/ajax/importaddressbook.php [changed mode: 0644->0755]
apps/contacts/ajax/loadcard.php
apps/contacts/appinfo/app.php
apps/contacts/index.php
apps/contacts/photo.php
apps/contacts/thumbnail.php
apps/external/appinfo/app.php
apps/files/admin.php
apps/files/ajax/upload.php [changed mode: 0644->0755]
apps/files/appinfo/app.php
apps/files/index.php
apps/files_archive/lib/storage.php [changed mode: 0644->0755]
apps/files_archive/lib/tar.php [changed mode: 0644->0755]
apps/files_archive/lib/zip.php
apps/files_archive/tests/archive.php [changed mode: 0644->0755]
apps/files_archive/tests/storage.php [changed mode: 0644->0755]
apps/files_archive/tests/tar.php [changed mode: 0644->0755]
apps/files_archive/tests/zip.php [changed mode: 0644->0755]
apps/files_encryption/lib/proxy.php
apps/files_encryption/tests/encryption.php [changed mode: 0644->0755]
apps/files_encryption/tests/stream.php [changed mode: 0644->0755]
apps/files_external/lib/ftp.php [changed mode: 0644->0755]
apps/files_external/lib/google.php [changed mode: 0644->0755]
apps/files_external/lib/swift.php [changed mode: 0644->0755]
apps/files_external/lib/webdav.php [changed mode: 0644->0755]
apps/files_external/tests/ftp.php [changed mode: 0644->0755]
apps/gallery/appinfo/app.php
apps/media/appinfo/app.php
apps/user_ldap/user_ldap.php [changed mode: 0644->0755]
lib/helper.php
lib/public/util.php

index 449969d8e5f8b4bab1eb35e4b0a96c0f8aee0597..246a0d0ecd769587433b01ca32f2af2ff9abb4ab 100755 (executable)
@@ -13,7 +13,7 @@ OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php'
 OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' ));
 
 $l = new OC_l10n('bookmarks');
-OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
+OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo( 'bookmarks', 'index.php' ), 'icon' => OCP\Util::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => $l->t('Bookmarks')));
 
 OC_App::registerPersonal('bookmarks', 'settings');
 OCP\Util::addscript('bookmarks','bookmarksearch');
index 9a60aaeeb95a5ee4e4bd28be076afbe431f50ec5..cf1325fad7ad71e28d653e13325f5e04a79378b2 100755 (executable)
@@ -19,7 +19,7 @@ OC_App::addNavigationEntry( array(
   'id' => 'calendar_index',
   'order' => 10,
   'href' => OCP\Util::linkTo( 'calendar', 'index.php' ),
-  'icon' => OC_Helper::imagePath( 'calendar', 'icon.svg' ),
+  'icon' => OCP\Util::imagePath( 'calendar', 'icon.svg' ),
   'name' => $l->t('Calendar')));
 OC_App::registerPersonal('calendar', 'settings');
 OC_Search::registerProvider('OC_Search_Provider_Calendar');
index f8bd91640e564d3e26befe76b8a25929deab4f71..4285dc0f833df60c7ef6fb46211bbff119f9e6d7 100755 (executable)
@@ -40,7 +40,7 @@
                                                                <input type="button" value="<?php echo $l->t('Week');?>" id="oneweekview_radio"/>
                                                                <input type="button" value="<?php echo $l->t('Month');?>" id="onemonthview_radio"/>
                                                                <input type="button" value="<?php echo $l->t('List');?>" id="listview_radio"/>&nbsp;&nbsp;
-                                                               <img id="loading" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" />
+                                                               <img id="loading" src="<?php echo OCP\Util::imagePath('core', 'loading.gif'); ?>" />
                                                        </div>
                                                </form>
                                                <form>
old mode 100644 (file)
new mode 100755 (executable)
index 5776c80..e54d22b
@@ -9,8 +9,8 @@
 require_once('../../../lib/base.php');
 OC_JSON::checkLoggedIn();
 OC_Util::checkAppEnabled('contacts');
-$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
-$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
 $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
 
 $freeSpace=OC_Filesystem::free_space('/');
@@ -19,6 +19,6 @@ $maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
 
 $tmpl = new OC_Template('contacts', 'part.importaddressbook');
 $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
+$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
 $tmpl->printpage();
 ?>
index a2660130a258540c9ef713e25c0813fb1d669569..90ba3f66097551bea48a0c9ccb15b80eb2db186e 100755 (executable)
@@ -38,8 +38,8 @@ function debug($msg) {
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
 
-$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
-$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
 $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
 
 $freeSpace=OC_Filesystem::free_space('/');
@@ -51,7 +51,7 @@ $email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
 
 $tmpl = new OC_Template('contacts','part.contact');
 $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
+$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
 $tmpl->assign('adr_types',$adr_types);
 $tmpl->assign('phone_types',$phone_types);
 $tmpl->assign('email_types',$email_types);
index 2c4da2fd6cdd0c18b0ab38f148175f7512708e0c..87c369597434a8edccf38be9041040b21f18fb08 100755 (executable)
@@ -18,7 +18,7 @@ OC_App::addNavigationEntry( array(
   'id' => 'contacts_index',
   'order' => 10,
   'href' => OCP\Util::linkTo( 'contacts', 'index.php' ),
-  'icon' => OC_Helper::imagePath( 'settings', 'users.svg' ),
+  'icon' => OCP\Util::imagePath( 'settings', 'users.svg' ),
   'name' => OC_L10N::get('contact')->t('Contacts') ));
 
 
index 8f2a561b312a9051109ec5e2bc8ffb936808bf62..c018fca764abadba8a689dbb8257764cf8ba9345 100755 (executable)
@@ -37,8 +37,8 @@ $phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
 $email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
 $categories = OC_Contacts_App::getCategories();
 
-$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
-$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
 $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
 
 $freeSpace=OC_Filesystem::free_space('/');
@@ -59,7 +59,7 @@ OCP\Util::addStyle('contacts','contacts');
 
 $tmpl = new OC_Template( "contacts", "index", "user" );
 $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
+$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
 $tmpl->assign('property_types', $property_types);
 $tmpl->assign('phone_types', $phone_types);
 $tmpl->assign('email_types', $email_types);
index 12d7f370710f6c36bb6d8e6ca9bc99dfa63472e8..a545afc434b2f47d7da271f4ac5b1159ea162056 100755 (executable)
@@ -16,7 +16,7 @@ OC_Util::checkAppEnabled('contacts');
 function getStandardImage(){
        OC_Response::setExpiresHeader('P10D');
        OC_Response::enableCaching();
-       OC_Response::redirect(OC_Helper::imagePath('contacts', 'person_large.png'));
+       OC_Response::redirect(OCP\Util::imagePath('contacts', 'person_large.png'));
 }
 
 $id = isset($_GET['id']) ? $_GET['id'] : null;
index ab5d160135e0def5f0b6e478ea8723cad80a9235..239ec7f4d47514ddebd9d07de92ae8e35760fc5d 100755 (executable)
@@ -29,7 +29,7 @@ OC_Util::checkAppEnabled('contacts');
 function getStandardImage(){
        OC_Response::setExpiresHeader('P10D');
        OC_Response::enableCaching();
-       OC_Response::redirect(OC_Helper::imagePath('contacts', 'person.png'));
+       OC_Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
 }
 
 if(!function_exists('imagecreatefromjpeg')) {
index b69cc3b2d6b19ba32bb8400ed0ddb7a35996c4aa..66116ac4c6ec7e040c8cef6df34fe9ab92c6b8dc 100755 (executable)
@@ -31,5 +31,5 @@ OC_App::register(array('order' => 70, 'id' => 'external', 'name' => 'External'))
 $sites = OC_External::getSites();
 for ($i = 0; $i < sizeof($sites); $i++) {
        OC_App::addNavigationEntry(
-                       array('id' => 'external_index' . ($i + 1), 'order' => 80 + $i, 'href' => OCP\Util::linkTo('external', 'index.php') . '?id=' . ($i + 1), 'icon' => OC_Helper::imagePath('external', 'external.png'), 'name' => $sites[$i][0]));
+                       array('id' => 'external_index' . ($i + 1), 'order' => 80 + $i, 'href' => OCP\Util::linkTo('external', 'index.php') . '?id=' . ($i + 1), 'icon' => OCP\Util::imagePath('external', 'external.png'), 'name' => $sites[$i][0]));
 }
index ae7ea0436a0fa7e0e9d3a786f831e7b2bfd808f9..120e245fd425c42353da5d978f5a82cefae233e1 100755 (executable)
@@ -29,24 +29,24 @@ OCP\User::checkAdminUser();
 
 $htaccessWorking=(getenv('htaccessWorking')=='true');
 
-$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
-$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
-$maxUploadFilesize = OC_Helper::humanFileSize(min($upload_max_filesize, $post_max_size));
+$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
+$maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
 if($_POST) {
        if(isset($_POST['maxUploadSize'])){
-               if(($setMaxSize = OC_Files::setUploadLimit(OC_Helper::computerFileSize($_POST['maxUploadSize']))) !== false) {
-                       $maxUploadFilesize = OC_Helper::humanFileSize($setMaxSize);
+               if(($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
+                       $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
                }
        }
        if(isset($_POST['maxZipInputSize'])) {
                $maxZipInputSize=$_POST['maxZipInputSize'];
-               OC_Config::setValue('maxZipInputSize', OC_Helper::computerFileSize($maxZipInputSize));
+               OC_Config::setValue('maxZipInputSize', OCP\Util::computerFileSize($maxZipInputSize));
        }
        if(isset($_POST['submitFilesAdminSettings'])) {
                OC_Config::setValue('allowZipDownload', isset($_POST['allowZipDownload']));
        }
 }
-$maxZipInputSize = OC_Helper::humanFileSize(OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB')));
+$maxZipInputSize = OCP\Util::humanFileSize(OC_Config::getValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB')));
 $allowZipDownload = intval(OC_Config::getValue('allowZipDownload', true));
 
 OC_App::setActiveNavigationEntry( "files_administration" );
@@ -54,7 +54,7 @@ OC_App::setActiveNavigationEntry( "files_administration" );
 $tmpl = new OC_Template( 'files', 'admin' );
 $tmpl->assign( 'htaccessWorking', $htaccessWorking );
 $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign( 'maxPossibleUploadSize', OC_Helper::humanFileSize(PHP_INT_MAX));
+$tmpl->assign( 'maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX));
 $tmpl->assign( 'allowZipDownload', $allowZipDownload);
 $tmpl->assign( 'maxZipInputSize', $maxZipInputSize);
 return $tmpl->fetchPage();
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index 3ac8ef5..c50f623
@@ -46,7 +46,7 @@ $result=array();
 if(strpos($dir,'..') === false){
        $fileCount=count($files['name']);
        for($i=0;$i<$fileCount;$i++){
-        $target = OC_Helper::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
+        $target = OCP\Util::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
                if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){
                        $meta=OC_FileCache::getCached($target);
                        $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target));
index 40523521d9ca2158fb839866fb8754e143de31a3..0e82713fe5c406f48ef4f362fa62b95171d06043 100755 (executable)
@@ -5,6 +5,6 @@ $l=OC_L10N::get('files');
 
 OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" ));
 
-OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") ));
+OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") ));
 
 OC_Search::registerProvider('OC_Search_Provider_File');
index 9634a72586680807ae2af65a75d9018a0e2b18a0..3f97317fc5f982ee62f8b9c3f080c457ad8cf5ad 100755 (executable)
@@ -80,8 +80,8 @@ $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
 $breadcrumbNav->assign( "breadcrumb", $breadcrumb );
 $breadcrumbNav->assign( "baseURL", OCP\Util::linkTo("files", "index.php")."?dir=");
 
-$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
-$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
+$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
+$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
 $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
 
 $freeSpace=OC_Filesystem::free_space('/');
@@ -95,7 +95,7 @@ $tmpl->assign( 'dir', $dir);
 $tmpl->assign( 'readonly', !OC_Filesystem::is_writable($dir));
 $tmpl->assign( "files", $files );
 $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
-$tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
+$tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
 $tmpl->assign( 'allowZipDownload', intval(OC_Config::getValue('allowZipDownload', true)));
 $tmpl->printPage();
 
old mode 100644 (file)
new mode 100755 (executable)
index 700d963..7a4ae33
@@ -104,7 +104,7 @@ class OC_Filestorage_Archive extends OC_Filestorage_Common{
        }
        public function touch($path, $mtime=null){
                if(is_null($mtime)){
-                       $tmpFile=OC_Helper::tmpFile();
+                       $tmpFile=OCP\Util::tmpFile();
                        $this->archive->extractFile($path,$tmpFile);
                        $this->archive->addfile($path,$tmpFile);
                }else{
old mode 100644 (file)
new mode 100755 (executable)
index 1eed11a..3a07a28
@@ -93,7 +93,7 @@ class OC_Archive_TAR extends OC_Archive{
         */
        function rename($source,$dest){
                //no proper way to delete, rename entire archive, rename file and remake archive
-               $tmp=OC_Helper::tmpFolder();
+               $tmp=OCP\Util::tmpFolder();
                $this->tar->extract($tmp);
                rename($tmp.$source,$tmp.$dest);
                $this->tar=null;
@@ -177,7 +177,7 @@ class OC_Archive_TAR extends OC_Archive{
         * @return bool
         */
        function extractFile($path,$dest){
-               $tmp=OC_Helper::tmpFolder();
+               $tmp=OCP\Util::tmpFolder();
                if(!$this->fileExists($path)){
                        return false;
                }
@@ -185,7 +185,7 @@ class OC_Archive_TAR extends OC_Archive{
                if($success){
                        rename($tmp.$path,$dest);
                }
-               OC_Helper::rmdirr($tmp);
+               OCP\Util::rmdirr($tmp);
                return $success;
        }
        /**
@@ -216,9 +216,9 @@ class OC_Archive_TAR extends OC_Archive{
                        return false;
                }
                //no proper way to delete, extract entire archive, delete file and remake archive
-               $tmp=OC_Helper::tmpFolder();
+               $tmp=OCP\Util::tmpFolder();
                $this->tar->extract($tmp);
-               OC_Helper::rmdirr($tmp.$path);
+               OCP\Util::rmdirr($tmp.$path);
                $this->tar=null;
                unlink($this->path);
                $this->reopen();
@@ -237,7 +237,7 @@ class OC_Archive_TAR extends OC_Archive{
                }else{
                        $ext='';
                }
-               $tmpFile=OC_Helper::tmpFile($ext);
+               $tmpFile=OCP\Util::tmpFile($ext);
                if($this->fileExists($path)){
                        $this->extractFile($path,$tmpFile);
                }elseif($mode=='r' or $mode=='rb'){
index dd94859f08906f21ff1d179eabdaf72d6918c64b..16f722a734e476d4243521d5104ec8de738a1547 100755 (executable)
@@ -169,7 +169,7 @@ class OC_Archive_ZIP extends OC_Archive{
                        }else{
                                $ext='';
                        }
-                       $tmpFile=OC_Helper::tmpFile($ext);
+                       $tmpFile=OCP\Util::tmpFile($ext);
                        OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
                        if($this->fileExists($path)){
                                $this->extractFile($path,$tmpFile);
old mode 100644 (file)
new mode 100755 (executable)
index 9e99466..512afe9
@@ -55,7 +55,7 @@ abstract class Test_Archive extends UnitTestCase {
                $textFile=$dir.'/lorem.txt';
                $this->assertEqual(file_get_contents($textFile),$this->instance->getFile('lorem.txt'));
                
-               $tmpFile=OC_Helper::tmpFile('.txt');
+               $tmpFile=OCP\Util::tmpFile('.txt');
                $this->instance->extractFile('lorem.txt',$tmpFile);
                $this->assertEqual(file_get_contents($textFile),file_get_contents($tmpFile));
        }
@@ -89,7 +89,7 @@ abstract class Test_Archive extends UnitTestCase {
                $this->instance=$this->getNew();
                $fh=$this->instance->getStream('lorem.txt','w');
                $source=fopen($dir.'/lorem.txt','r');
-               OC_Helper::streamCopy($source,$fh);
+               OCP\Util::streamCopy($source,$fh);
                fclose($source);
                fclose($fh);
                $this->assertTrue($this->instance->fileExists('lorem.txt'));
@@ -109,13 +109,13 @@ abstract class Test_Archive extends UnitTestCase {
        public function testExtract(){
                $dir=OC::$SERVERROOT.'/apps/files_archive/tests/data';
                $this->instance=$this->getExisting();
-               $tmpDir=OC_Helper::tmpFolder();
+               $tmpDir=OCP\Util::tmpFolder();
                $this->instance->extract($tmpDir);
                $this->assertEqual(true,file_exists($tmpDir.'lorem.txt'));
                $this->assertEqual(true,file_exists($tmpDir.'dir/lorem.txt'));
                $this->assertEqual(true,file_exists($tmpDir.'logo-wide.png'));
                $this->assertEqual(file_get_contents($dir.'/lorem.txt'),file_get_contents($tmpDir.'lorem.txt'));
-               OC_Helper::rmdirr($tmpDir);
+               OCP\Util::rmdirr($tmpDir);
        }
        public function testMoveRemove(){
                $dir=OC::$SERVERROOT.'/apps/files_archive/tests/data';
old mode 100644 (file)
new mode 100755 (executable)
index 4d0a833..52d6a42
@@ -13,7 +13,7 @@ class Test_Filestorage_Archive_Zip extends Test_FileStorage {
        private $tmpFile;
        
        public function setUp(){
-               $this->tmpFile=OC_Helper::tmpFile('.zip');
+               $this->tmpFile=OCP\Util::tmpFile('.zip');
                $this->instance=new OC_Filestorage_Archive(array('archive'=>$this->tmpFile));
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index aa46455..c543c22
@@ -16,7 +16,7 @@ if(is_dir(OC::$SERVERROOT.'/apps/files_archive/tests/data')){
                }
 
                protected function getNew(){
-                       return new OC_Archive_TAR(OC_Helper::tmpFile('.tar.gz'));
+                       return new OC_Archive_TAR(OCP\Util::tmpFile('.tar.gz'));
                }
        }
 }else{
old mode 100644 (file)
new mode 100755 (executable)
index 18a2997..b22ea3b
@@ -16,7 +16,7 @@ if(is_dir(OC::$SERVERROOT.'/apps/files_archive/tests/data')){
                }
 
                protected function getNew(){
-                       return new OC_Archive_ZIP(OC_Helper::tmpFile('.zip'));
+                       return new OC_Archive_ZIP(OCP\Util::tmpFile('.zip'));
                }
        }
 }else{
index 11a6a84e667f3015718baa3ade47de63b6ff7bb6..cbe88adb5e47a4aafacd368b17fc281c9e22500b 100755 (executable)
@@ -92,7 +92,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
                                //first encrypt the target file so we don't end up with a half encrypted file
                                OCP\Util::writeLog('files_encryption','Decrypting '.$path.' before writing',OCP\Util::DEBUG);
                                $tmp=fopen('php://temp');
-                               OC_Helper::streamCopy($result,$tmp);
+                               OCP\Util::streamCopy($result,$tmp);
                                fclose($result);
                                OC_Filesystem::file_put_contents($path,$tmp);
                                fclose($tmp);
@@ -104,7 +104,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
 
        public function postGetMimeType($path,$mime){
                if(self::isEncrypted($path)){
-                       $mime=OC_Helper::getMimeType('crypt://'.$path,'w');
+                       $mime=OCP\Util::getMimeType('crypt://'.$path,'w');
                }
                return $mime;
        }
old mode 100644 (file)
new mode 100755 (executable)
index 1309325..24b3bbc
@@ -27,14 +27,14 @@ class Test_Encryption extends UnitTestCase {
                $this->assertNotEqual($encrypted,$source);
                $this->assertEqual($decrypted,$source);
 
-               $tmpFileEncrypted=OC_Helper::tmpFile();
+               $tmpFileEncrypted=OCP\Util::tmpFile();
                OC_Crypt::encryptfile($file,$tmpFileEncrypted,$key);
                $encrypted=file_get_contents($tmpFileEncrypted);
                $decrypted=OC_Crypt::blockDecrypt($encrypted,$key);
                $this->assertNotEqual($encrypted,$source);
                $this->assertEqual($decrypted,$source);
 
-               $tmpFileDecrypted=OC_Helper::tmpFile();
+               $tmpFileDecrypted=OCP\Util::tmpFile();
                OC_Crypt::decryptfile($tmpFileEncrypted,$tmpFileDecrypted,$key);
                $decrypted=file_get_contents($tmpFileDecrypted);
                $this->assertEqual($decrypted,$source);
old mode 100644 (file)
new mode 100755 (executable)
index 578b091..225e82c
@@ -22,7 +22,7 @@ class Test_CryptStream extends UnitTestCase {
                $file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
                $source=fopen($file,'r');
                $target=$this->getStream('test2','w');
-               OC_Helper::streamCopy($source,$target);
+               OCP\Util::streamCopy($source,$target);
                fclose($target);
                fclose($source);
 
@@ -44,7 +44,7 @@ class Test_CryptStream extends UnitTestCase {
                        $id=uniqid();
                }
                if(!isset($this->tmpFiles[$id])){
-                       $file=OC_Helper::tmpFile();
+                       $file=OCP\Util::tmpFile();
                        $this->tmpFiles[$id]=$file;
                }else{
                        $file=$this->tmpFiles[$id];
old mode 100644 (file)
new mode 100755 (executable)
index 802446b..1618a22
@@ -108,7 +108,7 @@ class OC_FileStorage_FTP extends OC_Filestorage_Common{
                                }else{
                                        $ext='';
                                }
-                               $tmpFile=OC_Helper::tmpFile($ext);
+                               $tmpFile=OCP\Util::tmpFile($ext);
                                OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
                                if($this->file_exists($path)){
                                        $this->getFile($path,$tmpFile);
old mode 100644 (file)
new mode 100755 (executable)
index 0d6db19..24a9d6c
@@ -84,7 +84,7 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
                                curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
                }
                if ($isDownload) {
-                       $tmpFile = OC_Helper::tmpFile();
+                       $tmpFile = OCP\Util::tmpFile();
                        $fp = fopen($tmpFile, 'w');
                        curl_setopt($curl, CURLOPT_FILE, $fp);
                        curl_exec($curl);
old mode 100644 (file)
new mode 100755 (executable)
index a987d17..aaba79d
@@ -164,7 +164,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
         * @return array
         */
        private function getSubContainers($container){
-               $tmpFile=OC_Helper::tmpFile();
+               $tmpFile=OCP\Util::tmpFile();
                $obj=$this->getSubContainerFile($container);
                try{
                        $obj->save_to_filename($tmpFile);
@@ -190,7 +190,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
                if(!$name){
                        return false;
                }
-               $tmpFile=OC_Helper::tmpFile();
+               $tmpFile=OCP\Util::tmpFile();
                $obj=$this->getSubContainerFile($container);
                try{
                        $obj->save_to_filename($tmpFile);
@@ -225,7 +225,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
                if(!$name){
                        return false;
                }
-               $tmpFile=OC_Helper::tmpFile();
+               $tmpFile=OCP\Util::tmpFile();
                $obj=$this->getSubContainerFile($container);
                try{
                        $obj->save_to_filename($tmpFile);
@@ -501,7 +501,7 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
        private function getTmpFile($path){
                $obj=$this->getObject($path);
                if(!is_null($obj)){
-                       $tmpFile=OC_Helper::tmpFile();
+                       $tmpFile=OCP\Util::tmpFile();
                        $obj->save_to_filename($tmpFile);
                        return $tmpFile;
                }else{
old mode 100644 (file)
new mode 100755 (executable)
index 7a2da5c..75e5f80
@@ -150,7 +150,7 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
                                }else{
                                        $ext='';
                                }
-                               $tmpFile=OC_Helper::tmpFile($ext);
+                               $tmpFile=OCP\Util::tmpFile($ext);
                                OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack');
                                if($this->file_exists($path)){
                                        $this->getFile($path,$tmpFile);
old mode 100644 (file)
new mode 100755 (executable)
index e30fb9a..d2d3622
@@ -23,7 +23,7 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){
                }
 
                public function tearDown(){
-                       OC_Helper::rmdirr($this->instance->constructUrl(''));
+                       OCP\Util::rmdirr($this->instance->constructUrl(''));
                }
        }
 }
index 8f6575762242c8fb88435a057fb6a212c9b52db2..ad4723c142582b1c8797305db398c95502b21833 100755 (executable)
@@ -38,7 +38,7 @@ OC_App::addNavigationEntry( array(
  'id' => 'gallery_index',
  'order' => 20,
  'href' => OCP\Util::linkTo('gallery', 'index.php'),
- 'icon' => OC_Helper::imagePath('core', 'places/picture.svg'),
+ 'icon' => OCP\Util::imagePath('core', 'places/picture.svg'),
  'name' => $l->t('Pictures')));
 
 class OC_GallerySearchProvider extends OC_Search_Provider{
index 11aeac2b5b40126351cb0ae6e7556c39db268796..5e7a411f67710b379db3d528f365dcc7d98e6690 100755 (executable)
@@ -29,6 +29,6 @@ OC_APP::registerPersonal('media','settings');
 
 OC_App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
 
-OC_App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OC_Helper::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music')));
+OC_App::addNavigationEntry(array('id' => 'media_index', 'order' => 2, 'href' => OCP\Util::linkTo('media', 'index.php'), 'icon' => OCP\Util::imagePath('core', 'places/music.svg'), 'name' => $l->t('Music')));
 
 OC_Search::registerProvider('OC_MediaSearchProvider');
old mode 100644 (file)
new mode 100755 (executable)
index 1e8dc6a..1e454ab
@@ -87,7 +87,7 @@ class OC_USER_LDAP extends OC_User_Backend {
                        $quota = false;
                }
                $quota = $quota != -1 ? $quota : $this->ldap_quota_def;
-               OC_Preferences::setValue($uid, 'files', 'quota', OC_Helper::computerFileSize($quota));
+               OC_Preferences::setValue($uid, 'files', 'quota', OCP\Util::computerFileSize($quota));
        }
 
        private function setEmail( $uid ) {
index c5af76dbe525b5007ac663f87ed74fb55e68bbd1..82d1017debdd944592c003eb1925b8e336d95c38 100644 (file)
@@ -528,8 +528,7 @@ class OC_Helper {
      * @param $filename
      * @return string
      */
-    public static function buildNotExistingFileName($path, $filename)
-    {
+    public static function buildNotExistingFileName($path, $filename){
            if($path==='/'){
                    $path='';
            }
index b18f0d2311f7293f79695460b2b2710e5c35c97a..05be41a2a058b271c171322f0045720714b904c3 100644 (file)
@@ -60,10 +60,8 @@ class Util {
         * @param bool $html
         */
        public static function sendMail($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='') {
-
                // call the internal mail class
                \OC_MAIL::send($toaddress,$toname,$subject,$mailtext,$fromaddress,$fromname,$html=0,$altbody='',$ccaddress='',$ccname='',$bcc='');
-
        }
 
         /**
@@ -74,10 +72,8 @@ class Util {
         * @param int level
          */
         public static function writeLog($app, $message, $level) {
-
                 // call the internal log class
                 \OC_LOG::write($app, $message, $level);
-
         }
 
 
@@ -158,6 +154,117 @@ class Util {
                return(\OC_Helper::severHost());
        }
 
+       /**
+        * @brief Creates path to an image
+        * @param $app app
+        * @param $image image name
+        * @returns the url
+        *
+        * Returns the path to the image.
+        */
+        public static function imagePath( $app, $image ){
+               return(\OC_Helper::imagePath( $app, $image ));
+       }
+
+
+       /**
+        * @brief Make a human file size
+        * @param $bytes file size in bytes
+        * @returns a human readable file size
+        *
+        * Makes 2048 to 2 kB.
+        */
+       public static function humanFileSize( $bytes ){
+               return(\OC_Helper::humanFileSize( $bytes ));
+       }
+
+       /**
+        * @brief Make a computer file size
+        * @param $str file size in a fancy format
+        * @returns a file size in bytes
+        *
+        * Makes 2kB to 2048.
+        *
+        * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
+        */
+       public static function computerFileSize( $str ){
+               return(\OC_Helper::computerFileSize( $str ));
+       }
+
+
+
+       /**
+        * @brief Recusive deletion of folders
+        * @param string $dir path to the folder
+        *
+        */
+       static function rmdirr($dir) {
+               \OC_Helper::rmdirr( $dir );
+       }
+
+
+       /**
+        * get the mimetype form a local file
+        * @param string path
+        * @return string
+        * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
+        */
+       static function getMimeType($path){
+               return(\OC_Helper::getMimeType( $path ));
+       }
+
+       /**
+        * copy the contents of one stream to another
+        * @param resource source
+        * @param resource target
+        * @return int the number of bytes copied
+        */
+       public static function streamCopy($source,$target){
+               return(\OC_Helper::streamCopy($source,$target));
+       }
+
+
+       /**
+        * create a temporary file with an unique filename
+        * @param string postfix
+        * @return string
+        *
+        * temporary files are automatically cleaned up after the script is finished
+        */
+       public static function tmpFile($postfix=''){
+               return(\OC_Helper::tmpFile($postfix));
+       }
+
+       /**
+        * create a temporary folder with an unique filename
+        * @return string
+        *
+        * temporary files are automatically cleaned up after the script is finished
+        */
+       public static function tmpFolder(){
+               return(\OC_Helper::tmpFolder());
+       }
+
+       /**
+        * Adds a suffix to the name in case the file exists
+        *
+        * @param $path
+        * @param $filename
+        * @return string
+        */
+       public static function buildNotExistingFileName($path, $filename){
+               return(\OC_Helper::buildNotExistingFileName($path, $filename));
+       }
+
+
+
+
+
+
+
+
+
+