remove obsolete space from: File (

pull/1165/head
Andreas Ziegler 2016-05-31 18:00:15 +02:00
parent a5080ab70c
commit 8a9ffc1f9b
9 changed files with 14 additions and 14 deletions

View File

@ -548,7 +548,7 @@ class ServersController extends AppController {
$destpath = APP . "files" . DS . "certs" . DS;
$dir = new Folder(APP . "files" . DS . "certs", true);
if (!preg_match('@^[\w-,\s,\.]+\.[A-Za-z0-9_]{2,4}$@', $server['Server']['submitted_cert']['name'])) throw new Exception ('Filename not allowed');
$pemfile = new File ($destpath . $id . '.' . $ext);
$pemfile = new File($destpath . $id . '.' . $ext);
$result = $pemfile->write($pemData);
$s = $this->Server->read(null, $id);
$s['Server']['cert_file'] = $s['Server']['id'] . '.' . $ext;
@ -1008,7 +1008,7 @@ class ServersController extends AppController {
$version = json_decode($result['message'], true);
if (isset($version['version']) && preg_match('/^[0-9]+\.+[0-9]+\.[0-9]+$/', $version['version'])) {
App::uses('Folder', 'Utility');
$file = new File (ROOT . DS . 'VERSION.json', true);
$file = new File(ROOT . DS . 'VERSION.json', true);
$local_version = json_decode($file->read(), true);
$file->close();
$version = explode('.', $version['version']);

View File

@ -475,7 +475,7 @@ class AppModel extends Model {
public function checkMISPVersion() {
App::uses('Folder', 'Utility');
$file = new File (ROOT . DS . 'VERSION.json', true);
$file = new File(ROOT . DS . 'VERSION.json', true);
$version_array = json_decode($file->read(), true);
$file->close();
return $version_array;

View File

@ -1070,7 +1070,7 @@ class Attribute extends AppModel {
$rootDir = APP . DS . "files" . DS . $attribute['event_id'];
$dir = new Folder($rootDir, true); // create directory structure
$destpath = $rootDir . DS . $attribute['id'];
$file = new File ($destpath, true); // create the file
$file = new File($destpath, true); // create the file
$decodedData = base64_decode($attribute['data']); // decode
if ($file->write($decodedData)) { // save the data
return true;
@ -1122,7 +1122,7 @@ class Attribute extends AppModel {
// move the file to the correct location
$destpath = $rootDir . DS . $this->getId(); // id of the new attribute in the database
$file = new File($destpath);
$zipfile = new File ($destpath . '.zip');
$zipfile = new File($destpath . '.zip');
$fileInZip = new File($rootDir . DS . $extraPath . $filename); // FIXME do sanitization of the filename
// zip and password protect the malware files

View File

@ -2579,7 +2579,7 @@ class Event extends AppModel {
}
// generate a randomised filename for the temporary file that will be passed to the python script
$randomFileName = $this->generateRandomFileName();
$tempFile = new File (APP . "files" . DS . "scripts" . DS . "tmp" . DS . $randomFileName, true, 0644);
$tempFile = new File(APP . "files" . DS . "scripts" . DS . "tmp" . DS . $randomFileName, true, 0644);
// save the json_encoded event(s) to the temporary file
$result = $tempFile->write(json_encode($events));

View File

@ -2198,7 +2198,7 @@ class Server extends AppModel {
// for event publishing when we don't have a user.
if (empty($user)) $user = array('Organisation' => array('name' => 'SYSTEM'), 'email' => 'SYSTEM', 'id' => 0);
App::uses('Folder', 'Utility');
$file = new File (ROOT . DS . 'VERSION.json', true);
$file = new File(ROOT . DS . 'VERSION.json', true);
$localVersion = json_decode($file->read(), true);
$file->close();
@ -2334,7 +2334,7 @@ class Server extends AppModel {
foreach ($writeableDirs as $path => &$error) {
$dir = new Folder(APP . $path);
if (is_null($dir->path)) $error = 1;
$file = new File (APP . $path . DS . 'test.txt', true);
$file = new File(APP . $path . DS . 'test.txt', true);
if ($error == 0 && !$file->write('test')) $error = 2;
if ($error != 0) $diagnostic_errors++;
$file->delete();

View File

@ -390,7 +390,7 @@ class ShadowAttribute extends AppModel {
$rootDir = APP . DS . "files" . DS . 'shadow' . DS . $attribute['event_id'];
$dir = new Folder($rootDir, true); // create directory structure
$destpath = $rootDir . DS . $attribute['id'];
$file = new File ($destpath, true); // create the file
$file = new File($destpath, true); // create the file
$decodedData = base64_decode($attribute['data']); // decode
if ($file->write($decodedData)) { // save the data
return true;
@ -444,8 +444,8 @@ class ShadowAttribute extends AppModel {
$dir = new Folder($rootDir, true);
// move the file to the correct location
$destpath = $rootDir . DS . $this->getId(); // id of the new attribute in the database
$file = new File ($destpath);
$zipfile = new File ($destpath . '.zip');
$file = new File($destpath);
$zipfile = new File($destpath . '.zip');
$fileInZip = new File($rootDir . DS . $extraPath . $filename); // FIXME do sanitization of the filename
// zip and password protect the malware files

View File

@ -113,7 +113,7 @@ class Sighting extends AppModel{
public function handleStixSighting($data) {
$randomFileName = $this->generateRandomFileName();
$tempFile = new File (APP . "files" . DS . "scripts" . DS . "tmp" . DS . $randomFileName, true, 0644);
$tempFile = new File(APP . "files" . DS . "scripts" . DS . "tmp" . DS . $randomFileName, true, 0644);
// save the json_encoded event(s) to the temporary file
if (!$tempFile->write($data)) return array('success' => 0, 'message' => 'Could not write the Sightings file to disk.');

View File

@ -38,7 +38,7 @@ class Taxonomy extends AppModel{
}
$updated = array();
foreach ($directories as &$dir) {
$file = new File (APP . 'files' . DS . 'taxonomies' . DS . $dir . DS . 'machinetag.json');
$file = new File(APP . 'files' . DS . 'taxonomies' . DS . $dir . DS . 'machinetag.json');
$vocab = json_decode($file->read(), true);
$file->close();
if (!isset($vocab['version'])) $vocab['version'] = 1;

View File

@ -41,7 +41,7 @@ class Warninglist extends AppModel{
$directories = glob(APP . 'files' . DS . 'warninglists' . DS . 'lists' . DS . '*', GLOB_ONLYDIR);
$updated = array();
foreach ($directories as &$dir) {
$file = new File ($dir . DS . 'list.json');
$file = new File($dir . DS . 'list.json');
$list = json_decode($file->read(), true);
$file->close();
if (!isset($list['version'])) $list['version'] = 1;