log.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class OC_Files_Sharing_Log {
  3. static public function fopen($arguments) {
  4. $target = $arguments['target'];
  5. $source = $arguments['source'];
  6. $mode = $arguments['mode'];
  7. self::log($target, $source, $mode);
  8. }
  9. static public function file_get_contents($arguments) {
  10. $target = $arguments['target'];
  11. $source = $arguments['source'];
  12. $mode = 'get';
  13. self::log($target, $source, $mode);
  14. }
  15. static public function file_put_contents($arguments) {
  16. $target = $arguments['target'];
  17. $source = $arguments['source'];
  18. $mode = 'put';
  19. self::log($target, $source, $mode);
  20. }
  21. static public function log($target, $source, $mode) {
  22. $query = OCP\DB::prepare("SELECT * FROM *PREFIX*sharing WHERE source = ? AND target = ?");
  23. $info = $query->execute(array($source, $target))->fetchAll();
  24. $info = $info[0];
  25. //var_dump($info);
  26. $query = OCP\DB::prepare("INSERT INTO *PREFIX*sharing_log VALUES (?,?,?,?,?)");
  27. $query->execute(array($info['uid_owner'], $source, OCP\User::getUser(), time(), $mode));
  28. //die;
  29. }
  30. }