ported the rest of the OC_Helper calls

This commit is contained in:
Frank Karlitschek 2012-05-02 00:20:45 +02:00
parent e48f511606
commit 93b63cf375
34 changed files with 173 additions and 67 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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>

6
apps/contacts/ajax/importaddressbook.php Normal file → Executable file
View File

@ -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();
?>

View File

@ -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);

View File

@ -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') ));

View File

@ -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);

View File

@ -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;

View File

@ -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')) {

View File

@ -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]));
}

View File

@ -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();

2
apps/files/ajax/upload.php Normal file → Executable file
View File

@ -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));

View File

@ -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');

View File

@ -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();

2
apps/files_archive/lib/storage.php Normal file → Executable file
View File

@ -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{

12
apps/files_archive/lib/tar.php Normal file → Executable file
View File

@ -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'){

View File

@ -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);

8
apps/files_archive/tests/archive.php Normal file → Executable file
View File

@ -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';

2
apps/files_archive/tests/storage.php Normal file → Executable file
View File

@ -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));
}

2
apps/files_archive/tests/tar.php Normal file → Executable file
View File

@ -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{

2
apps/files_archive/tests/zip.php Normal file → Executable file
View File

@ -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{

View File

@ -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;
}

4
apps/files_encryption/tests/encryption.php Normal file → Executable file
View File

@ -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);

4
apps/files_encryption/tests/stream.php Normal file → Executable file
View File

@ -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];

2
apps/files_external/lib/ftp.php Normal file → Executable file
View File

@ -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);

2
apps/files_external/lib/google.php Normal file → Executable file
View File

@ -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);

8
apps/files_external/lib/swift.php Normal file → Executable file
View File

@ -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{

2
apps/files_external/lib/webdav.php Normal file → Executable file
View File

@ -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);

2
apps/files_external/tests/ftp.php Normal file → Executable file
View File

@ -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(''));
}
}
}

View File

@ -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{

View File

@ -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');

2
apps/user_ldap/user_ldap.php Normal file → Executable file
View File

@ -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 ) {

View 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='';
}

View 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));
}