| @@ 399-409 (lines=11) @@ | ||
| 396 | } |
|
| 397 | // new note |
|
| 398 | if (!$fileindb) { |
|
| 399 | if ($FOLDER != '') { |
|
| 400 | $tmpfile = $FOLDER . "/" . $name . ".htm"; |
|
| 401 | if ($group != '') |
|
| 402 | $tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm"; |
|
| 403 | if (!Filesystem::file_exists($tmpfile)) { |
|
| 404 | Filesystem::touch($tmpfile); |
|
| 405 | } |
|
| 406 | if ($info = Filesystem::getFileInfo($tmpfile)) { |
|
| 407 | $mtime = $info['mtime']; |
|
| 408 | } |
|
| 409 | } |
|
| 410 | $this->db->executeQuery("INSERT INTO *PREFIX*ownnote (uid, name, grouping, mtime, note, shared) VALUES (?,?,?,?,?,?)", Array($uid, $name, $group, $mtime, '', '')); |
|
| 411 | $ret = $this->db->lastInsertId('*PREFIX*ownnote'); |
|
| 412 | } |
|
| @@ 484-492 (lines=9) @@ | ||
| 481 | $name = $note['name']; |
|
| 482 | $group = $note['grouping']; |
|
| 483 | ||
| 484 | if ($FOLDER != '') { |
|
| 485 | $tmpfile = $FOLDER . "/" . $name . ".htm"; |
|
| 486 | if ($group != '') |
|
| 487 | $tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm"; |
|
| 488 | Filesystem::file_put_contents($tmpfile, $content); |
|
| 489 | if ($info = Filesystem::getFileInfo($tmpfile)) { |
|
| 490 | $mtime = $info['mtime']; |
|
| 491 | } |
|
| 492 | } |
|
| 493 | $this->db->executeQuery("UPDATE *PREFIX*ownnote set note='', mtime=? WHERE id=?", Array($mtime, $note['id'])); |
|
| 494 | ||
| 495 | $this->db->executeQuery("DELETE FROM *PREFIX*ownnote_parts WHERE id=?", Array($note['id'])); |
|
| @@ 99-107 (lines=9) @@ | ||
| 96 | $name = $note->getName(); |
|
| 97 | $content = $note->getNote(); |
|
| 98 | ||
| 99 | if ($FOLDER != '' && $name) { |
|
| 100 | $tmpfile = $FOLDER . "/" . $name . ".htm"; |
|
| 101 | if ($group != '') |
|
| 102 | $tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm"; |
|
| 103 | Filesystem::file_put_contents($tmpfile, $content); |
|
| 104 | if ($info = Filesystem::getFileInfo($tmpfile)) { |
|
| 105 | $note->setMtime($info['mtime']); |
|
| 106 | } |
|
| 107 | } |
|
| 108 | ||
| 109 | return $this->noteMapper->create($note); |
|
| 110 | } |
|
| @@ 153-161 (lines=9) @@ | ||
| 150 | // if (!$this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE, $note->getId())) { |
|
| 151 | // return false; |
|
| 152 | // } |
|
| 153 | if ($FOLDER != '' && $name) { |
|
| 154 | $tmpfile = $FOLDER . "/" . $name . ".htm"; |
|
| 155 | if ($group != '') |
|
| 156 | $tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm"; |
|
| 157 | Filesystem::file_put_contents($tmpfile, $content); |
|
| 158 | if ($info = Filesystem::getFileInfo($tmpfile)) { |
|
| 159 | $note->setMtime($info['mtime']); |
|
| 160 | } |
|
| 161 | } |
|
| 162 | if(!$note->getId()){ |
|
| 163 | return $this->noteMapper->create($note); |
|
| 164 | } |
|