Passed
Push — master ( a2212a...22a21e )
by Matthias
09:28 queued 01:42
created
lib/FileSignatures.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         ['mimeType' => '', 'extensions' => ['xls'], 'signature' => ['starting' => ['offset' => 512, 'bytes' => ['/0908100000060500/']]]],
46 46
         ['mimeType' => '', 'extensions' => ['doc'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/0d444f43/']]]],
47 47
         ['mimeType' => '', 'extensions' => ['webm'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/1a45dfa3/']]]],
48
-        ['mimeType' => '', 'extensions' => ['mkv','mka', 'mks', 'mk3d', 'webm'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/45dfa3934282886d6174726f736b61/', '/1a45dfa3/']]]],
48
+        ['mimeType' => '', 'extensions' => ['mkv', 'mka', 'mks', 'mk3d', 'webm'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/45dfa3934282886d6174726f736b61/', '/1a45dfa3/']]]],
49 49
         ['mimeType' => '', 'extensions' => ['gz', 'tgz', 'vlt'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/1f8b08/']]]],
50 50
         ['mimeType' => '', 'extensions' => ['tar'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/1f9d/', '/1fA0/']]]],
51 51
         ['mimeType' => '', 'extensions' => ['eps'], 'signature' => ['starting' => ['offset' => 0, 'bytes' => ['/252150532d41646f62652d332e3020455053462d332030/']]]],
Please login to merge, or discard this patch.
lib/Controller/MonitoringController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         foreach ($sequences as $sequenceId => $sequence) {
126 126
             if (sizeof($sequence) >= $this->config->getAppValue(Application::APP_ID, 'minimum_sequence_length', 0)) {
127
-                usort($sequence, function ($a, $b) {
127
+                usort($sequence, function($a, $b) {
128 128
                     return $b->getId() - $a->getId();
129 129
                 });
130 130
                 $sequenceResult = $this->sequenceAnalyzer->analyze($sequenceId, $sequence);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             }
134 134
         }
135 135
 
136
-        usort($result, function ($a, $b) {
136
+        usort($result, function($a, $b) {
137 137
             return $b['id'] - $a['id'];
138 138
         });
139 139
 
Please login to merge, or discard this patch.
lib/Controller/ScanController.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     protected $fileExtensionAnalyzer;
81 81
 
82 82
     /** @var IDBConnection */
83
-	protected $connection;
83
+    protected $connection;
84 84
 
85 85
     /** @var string */
86 86
     protected $userId;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
     protected function getLastActivity($objectId)
297 297
     {
298 298
         $query = $this->connection->getQueryBuilder();
299
-    	$query->select('*')->from('activity');
299
+        $query->select('*')->from('activity');
300 300
         $query->where($query->expr()->eq('affecteduser', $query->createNamedParameter($this->userId)))
301 301
             ->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($objectId)));
302 302
         $result = $query->execute();
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
     {
152 152
         if ($command === Monitor::WRITE) {
153 153
             // Delete file
154
-            if ($this->deleteFromStorage($path . '/' . $name)) {
154
+            if ($this->deleteFromStorage($path.'/'.$name)) {
155 155
                 return new JSONResponse(['status' => 'success', 'id' => $id, 'sequence' => $sequence], Http::STATUS_OK);
156 156
             } else {
157 157
                 return new JSONResponse(['status' => 'error', 'message' => 'File cannot be deleted.'], Http::STATUS_OK);
158 158
             }
159 159
         } else if ($command === Monitor::DELETE) {
160 160
             // Restore file
161
-            $trashPath = '/'.$name.'.d'.$timestamp;;
161
+            $trashPath = '/'.$name.'.d'.$timestamp; ;
162 162
             if ($this->restoreFromTrashbin($trashPath, $name, $timestamp) !== false) {
163 163
                 return new JSONResponse(['status' => 'success', 'id' => $id, 'sequence' => $sequence], Http::STATUS_OK);
164 164
             }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
         // sort ASC for timestamp
202
-        usort($allFiles, function ($a, $b) {
202
+        usort($allFiles, function($a, $b) {
203 203
             if ($a['timestamp'] === $b['timestamp']) {
204 204
                 return 0;
205 205
             }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         $fileOperation = new FileOperation();
324 324
         $fileOperation->setUserId($this->userId);
325 325
         if (strpos($file['path'], 'files_trashbin') !== false) {
326
-            $node = $this->userFolder->getParent()->get($file['path'] . '.d' . $file['timestamp']);
326
+            $node = $this->userFolder->getParent()->get($file['path'].'.d'.$file['timestamp']);
327 327
             $fileOperation->setCommand(Monitor::DELETE);
328 328
             $fileOperation->setTimestamp($file['timestamp']);
329 329
             $pathInfo = pathinfo($node->getInternalPath());
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -406,14 +406,12 @@
 block discarded – undo
406 406
                 $storageStructure->setNumberOfFiles($storageStructure->getNumberOfFiles() + $tmpStorageStructure->getNumberOfFiles());
407 407
             }
408 408
             return $storageStructure;
409
-        }
410
-        else if ($node instanceof File) {
409
+        } else if ($node instanceof File) {
411 410
             // it's a file
412 411
             $storageStructure->addFile($node);
413 412
             $storageStructure->increaseNumberOfFiles();
414 413
             return $storageStructure;
415
-        }
416
-        else {
414
+        } else {
417 415
             // it's me Mario.
418 416
             // there is nothing else than file or folder
419 417
             $this->logger->error('getStorageStructure: Neither file nor folder.', array('app' => Application::APP_ID));
Please login to merge, or discard this patch.
lib/Analyzer/FileCorruptionAnalyzer.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,22 +94,22 @@
 block discarded – undo
94 94
                     }
95 95
                     // starting byte sequence
96 96
                     if (array_key_exists('starting', $signature['signature'])) {
97
-						foreach ($signature['signature']['starting']['bytes'] as $bytes) {
98
-							if (preg_match($bytes, strtolower(bin2hex(substr($data, $signature['signature']['starting']['offset'], strlen($bytes) / 2))))) {
99
-									$isFileCorrupted = false;
100
-							}
101
-						}
97
+                        foreach ($signature['signature']['starting']['bytes'] as $bytes) {
98
+                            if (preg_match($bytes, strtolower(bin2hex(substr($data, $signature['signature']['starting']['offset'], strlen($bytes) / 2))))) {
99
+                                    $isFileCorrupted = false;
100
+                            }
101
+                        }
102 102
                     }
103 103
                     // trailing byte sequence
104 104
                     if (array_key_exists('trailing', $signature['signature'])) {
105 105
                         $trailingIsNotMatching = true;
106
-						foreach ($signature['signature']['trailing']['bytes'] as $bytes) {
107
-							$trailingOffset = strlen($data) - $signature['signature']['trailing']['offset'] - strlen($bytes) / 2;
108
-							if (preg_match($bytes, strtolower(bin2hex(substr($data, $trailingOffset, strlen($bytes) / 2))))) {
109
-									$trailingIsNotMatching = false;
110
-							}
111
-						}
112
-						$isFileCorrupted = $isFileCorrupted || $trailingIsNotMatching;
106
+                        foreach ($signature['signature']['trailing']['bytes'] as $bytes) {
107
+                            $trailingOffset = strlen($data) - $signature['signature']['trailing']['offset'] - strlen($bytes) / 2;
108
+                            if (preg_match($bytes, strtolower(bin2hex(substr($data, $trailingOffset, strlen($bytes) / 2))))) {
109
+                                    $trailingIsNotMatching = false;
110
+                            }
111
+                        }
112
+                        $isFileCorrupted = $isFileCorrupted || $trailingIsNotMatching;
113 113
                         return new FileCorruptionResult($isFileCorrupted);
114 114
                     }
115 115
                     return new FileCorruptionResult($isFileCorrupted);
Please login to merge, or discard this patch.
lib/Analyzer/EntropyFunnellingAnalyzer.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -144,23 +144,23 @@
 block discarded – undo
144 144
         return 0.0;
145 145
     }
146 146
 
147
-     /**
148
-      * Calculates the median of an array.
149
-      *
150
-      * @param  array $array
151
-      *
152
-      * @return float
153
-      */
154
-     public function median($array)
155
-     {
156
-         if (is_array($array) && count($array) > 0) {
157
-             $count = count($array);
158
-             sort($array);
159
-             $mid = floor(($count - 1) / 2);
160
-
161
-             return ($array[$mid] + $array[$mid + 1 - $count % 2]) / 2;
162
-         }
163
-
164
-         return 0.0;
165
-     }
147
+        /**
148
+         * Calculates the median of an array.
149
+         *
150
+         * @param  array $array
151
+         *
152
+         * @return float
153
+         */
154
+        public function median($array)
155
+        {
156
+            if (is_array($array) && count($array) > 0) {
157
+                $count = count($array);
158
+                sort($array);
159
+                $mid = floor(($count - 1) / 2);
160
+
161
+                return ($array[$mid] + $array[$mid + 1 - $count % 2]) / 2;
162
+            }
163
+
164
+            return 0.0;
165
+        }
166 166
 }
Please login to merge, or discard this patch.
templates/admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@
 block discarded – undo
41 41
         <h3>
42 42
             <?php p($l->t('Suspicion threshold for notifications')); ?>
43 43
         </h3>
44
-        <select id="sequence-suspicion-level" name="sequence-suspicion-level" class="suspicion-level-<?php p($_['active_suspicion_level']['code']); ?>" data-placeholder="<?php p($l->t('Sequence suspicion level'));?>">
44
+        <select id="sequence-suspicion-level" name="sequence-suspicion-level" class="suspicion-level-<?php p($_['active_suspicion_level']['code']); ?>" data-placeholder="<?php p($l->t('Sequence suspicion level')); ?>">
45 45
             <option class="suspicion-level-<?php p($_['active_suspicion_level']['code']); ?>" value="<?php p($_['active_suspicion_level']['code']); ?>">
46 46
 				<?php p($_['active_suspicion_level']['name']); ?>
47 47
 			</option>
48 48
             <?php foreach ($_['suspicion_levels'] as $suspicionLevel): ?>
49 49
 				<option class="suspicion-level-<?php p($suspicionLevel['code']); ?>" value="<?php p($suspicionLevel['code']); ?>">
50
-					<?php p($suspicionLevel['name']);?>
50
+					<?php p($suspicionLevel['name']); ?>
51 51
 				</option>
52 52
 			<?php endforeach; ?>
53 53
         </select>
Please login to merge, or discard this patch.
templates/personal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         <h3>
29 29
             <?php p($l->t('Current color mode')); ?>
30 30
         </h3>
31
-        <select id="color-scheme" name="color-scheme" data-placeholder="<?php p($l->t('Color mode'));?>">
31
+        <select id="color-scheme" name="color-scheme" data-placeholder="<?php p($l->t('Color mode')); ?>">
32 32
             <option value="<?php p($_['color_active']['code']); ?>">
33 33
 				<?php p($_['color_active']['name']); ?>
34 34
 			</option>
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
         $container = $this->getContainer();
65 65
 
66 66
         // mapper
67
-        $container->registerService('FileOperationMapper', function ($c) {
67
+        $container->registerService('FileOperationMapper', function($c) {
68 68
             return new FileOperationMapper(
69 69
                 $c->query('ServerContainer')->getDb()
70 70
             );
71 71
         });
72 72
 
73 73
         // services
74
-        $container->registerService('FileOperationService', function ($c) {
74
+        $container->registerService('FileOperationService', function($c) {
75 75
             return new FileOperationService(
76 76
                 $c->query(FileOperationMapper::class),
77 77
                 $c->query('ServerContainer')->getUserSession()->getUser()->getUID()
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         });
80 80
 
81 81
         // classifier
82
-        $container->registerService('Classifier', function ($c) {
82
+        $container->registerService('Classifier', function($c) {
83 83
             return new Classifier(
84 84
                 $c->query(ILogger::class),
85 85
                 $c->query(FileOperationMapper::class),
@@ -88,28 +88,28 @@  discard block
 block discarded – undo
88 88
         });
89 89
 
90 90
         // entropy
91
-        $container->registerService('Entropy', function ($c) {
91
+        $container->registerService('Entropy', function($c) {
92 92
             return new Entropy(
93 93
                 $c->query(ILogger::class)
94 94
             );
95 95
         });
96 96
 
97 97
         // analyzer
98
-        $container->registerService('SequenceSizeAnalyzer', function ($c) {
98
+        $container->registerService('SequenceSizeAnalyzer', function($c) {
99 99
             return new SequenceSizeAnalyzer();
100 100
         });
101 101
 
102
-        $container->registerService('FileTypeFunnellingAnalyzer', function ($c) {
102
+        $container->registerService('FileTypeFunnellingAnalyzer', function($c) {
103 103
             return new FileTypeFunnellingAnalyzer();
104 104
         });
105 105
 
106
-        $container->registerService('EntropyFunnellingAnalyzer', function ($c) {
106
+        $container->registerService('EntropyFunnellingAnalyzer', function($c) {
107 107
             return new EntropyFunnellingAnalyzer(
108 108
                 $c->query(ILogger::class)
109 109
             );
110 110
         });
111 111
 
112
-        $container->registerService('FileExtensionAnalyzer', function ($c) {
112
+        $container->registerService('FileExtensionAnalyzer', function($c) {
113 113
             return new FileExtensionAnalyzer(
114 114
                 $c->query(ILogger::class),
115 115
                 $c->query(Entropy::class)
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             );
118 118
         });
119 119
 
120
-        $container->registerService('SequenceAnalyzer', function ($c) {
120
+        $container->registerService('SequenceAnalyzer', function($c) {
121 121
             return new SequenceAnalyzer(
122 122
                 $c->query(SequenceSizeAnalyzer::class),
123 123
                 $c->query(FileTypeFunnellingAnalyzer::class),
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             );
126 126
         });
127 127
 
128
-        $container->registerService('EntropyAnalyzer', function ($c) {
128
+        $container->registerService('EntropyAnalyzer', function($c) {
129 129
             return new EntropyAnalyzer(
130 130
                 $c->query(ILogger::class),
131 131
                 $c->query(IRootFolder::class),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             );
135 135
         });
136 136
 
137
-        $container->registerService('FileCorruptionAnalyzer', function ($c) {
137
+        $container->registerService('FileCorruptionAnalyzer', function($c) {
138 138
             return new FileCorruptionAnalyzer(
139 139
                 $c->query(ILogger::class),
140 140
                 $c->query(IRootFolder::class),
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             );
143 143
         });
144 144
 
145
-        $container->registerService('Monitor', function ($c) {
145
+        $container->registerService('Monitor', function($c) {
146 146
             return new Monitor(
147 147
                 $c->query(IRequest::class),
148 148
                 $c->query(IConfig::class),
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             );
159 159
         });
160 160
 
161
-        $container->registerService('FilesEvents', function ($c) {
161
+        $container->registerService('FilesEvents', function($c) {
162 162
             return new FilesEvents(
163 163
                 $c->query(ILogger::class),
164 164
                 $c->query(Monitor::class),
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         // register sabre plugin to catch the profind requests
176 176
         $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
177
-        $eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) {
177
+        $eventDispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function(SabrePluginEvent $event) {
178 178
             $logger = $this->getContainer()->query(ILogger::class);
179 179
             $config = $this->getContainer()->query(IConfig::class);
180 180
             $userSession = $this->getContainer()->query(IUserSession::class);
Please login to merge, or discard this patch.
lib/Events/FilesEvents.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 class FilesEvents {
29 29
 
30
-	/** @var string */
30
+    /** @var string */
31 31
     private $userId;
32 32
     
33 33
     /** @var ILogger */
@@ -37,74 +37,74 @@  discard block
 block discarded – undo
37 37
     private $monitor;
38 38
 
39 39
 
40
-	/**
40
+    /**
41 41
      * @param ILogger   $logger
42 42
      * @param Monitor   $monitor
43
-	 * @param string    $userId
44
-	 */
45
-	public function __construct(
43
+     * @param string    $userId
44
+     */
45
+    public function __construct(
46 46
         ILogger $logger,
47 47
         Monitor $monitor,
48 48
         $userId
49 49
 
50
-	) {
50
+    ) {
51 51
         $this->logger = $logger;
52 52
         $this->monitor = $monitor;
53
-		$this->userId = $userId;
54
-	}
53
+        $this->userId = $userId;
54
+    }
55 55
 
56
-	/**
57
-	 * @param array $params
58
-	 */
59
-	public function onFileUpdate(array $params) {
56
+    /**
57
+     * @param array $params
58
+     */
59
+    public function onFileUpdate(array $params) {
60 60
         $this->logger->debug("Updating ".$params['path'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
61 61
         $this->analyze([$params['path']], Monitor::WRITE);
62
-	}
62
+    }
63 63
 
64 64
 
65
-	/**
66
-	 * @param array $params
67
-	 */
68
-	public function onFileRename(array $params) {
65
+    /**
66
+     * @param array $params
67
+     */
68
+    public function onFileRename(array $params) {
69 69
         $this->logger->debug("Renaming ".$params['oldpath']." to ".$params['newpath'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
70 70
         $this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME);
71 71
     }
72 72
 
73 73
     /**
74
-	 * @param array $params
75
-	 */
74
+     * @param array $params
75
+     */
76 76
     public function onFileCreate(array $params) {
77 77
         $this->logger->debug("Creating ".$params['path'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
78 78
         $this->analyze([$params['path']], Monitor::CREATE);
79 79
     }
80 80
     
81 81
     /**
82
-	 * @param array $params
83
-	 */
82
+     * @param array $params
83
+     */
84 84
     public function onFileWrite(array $params) {
85 85
         $this->logger->debug("Writing ".$params['path'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
86 86
         $this->analyze([$params['path']], Monitor::WRITE);
87 87
     }
88 88
     
89 89
     /**
90
-	 * @param array $params
91
-	 */
90
+     * @param array $params
91
+     */
92 92
     public function onFileDelete(array $params) {
93 93
         $this->logger->debug("Deleting ".$params['path'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
94 94
         $this->analyze([$params['path']], Monitor::DELETE);
95 95
     }
96 96
     
97 97
     /**
98
-	 * @param array $params
99
-	 */
98
+     * @param array $params
99
+     */
100 100
     public function onFileCopy(array $params) {
101 101
         $this->logger->debug("Copying ".$params['oldpath']." to ".$params['newpath'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
102 102
         $this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME);
103 103
     }
104 104
     
105 105
     /**
106
-	 * @param array $params
107
-	 */
106
+     * @param array $params
107
+     */
108 108
     public function onFileTouch(array $params) {
109 109
         $this->logger->debug("Touching ".$params['path'].": Params: ".print_r($params, true), ['app' =>  Application::APP_ID]);
110 110
         $this->analyze([$params['path']], Monitor::WRITE);
Please login to merge, or discard this patch.