summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing_log/log.php
blob: e6a12b9fb1d77dfeb6ba8fe8e022fdaf72ec3b68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

class OC_Files_Sharing_Log {
	static public function fopen($arguments) {
		$target = $arguments['target'];
		$source = $arguments['source'];
		$mode = $arguments['mode'];
		self::log($target, $source, $mode);
	}

	static public function file_get_contents($arguments) {
		$target = $arguments['target'];
		$source = $arguments['source'];
		$mode = 'get';
		self::log($target, $source, $mode);
	}

	static public function file_put_contents($arguments) {
		$target = $arguments['target'];
		$source = $arguments['source'];
		$mode = 'put';
		self::log($target, $source, $mode);
	}

	static public function log($target, $source, $mode) {
		$query = OCP\DB::prepare("SELECT * FROM *PREFIX*sharing WHERE source = ? AND target = ?");
		$info = $query->execute(array($source, $target))->fetchAll();
		$info = $info[0];
		//var_dump($info);
		$query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing_log VALUES (?,?,?,?,?)");
		$query->execute(array($info['uid_owner'], $source, OCP\User::getUser(), time(), $mode));
		//die;
	}
}