Code Duplication    Length = 9-11 lines in 2 locations

lib/backend.php 2 locations

@@ 379-389 (lines=11) @@
376
		}
377
		// new note
378
		if (!$fileindb) {
379
			if ($FOLDER != '') {
380
				$tmpfile = $FOLDER . "/" . $name . ".htm";
381
				if ($group != '')
382
					$tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm";
383
				if (!Filesystem::file_exists($tmpfile)) {
384
					Filesystem::touch($tmpfile);
385
				}
386
				if ($info = Filesystem::getFileInfo($tmpfile)) {
387
					$mtime = $info['mtime'];
388
				}
389
			}
390
			$this->db->executeQuery("INSERT INTO *PREFIX*ownnote (uid, name, grouping, mtime, note, shared) VALUES (?,?,?,?,?,?)", Array($uid, $name, $group, $mtime, '', ''));
391
			$ret = $this->db->lastInsertId('*PREFIX*ownnote');
392
		}
@@ 465-473 (lines=9) @@
462
		$name = $note['name'];
463
		$group = $note['grouping'];
464
465
		if ($FOLDER != '') {
466
			$tmpfile = $FOLDER . "/" . $name . ".htm";
467
			if ($group != '')
468
				$tmpfile = $FOLDER . "/[" . $group . "] " . $name . ".htm";
469
			Filesystem::file_put_contents($tmpfile, $content);
470
			if ($info = Filesystem::getFileInfo($tmpfile)) {
471
				$mtime = $info['mtime'];
472
			}
473
		}
474
		$this->db->executeQuery("UPDATE *PREFIX*ownnote set note='', mtime=? WHERE id=?", Array($mtime, $note['id']));
475
476
		$this->db->executeQuery("DELETE FROM *PREFIX*ownnote_parts WHERE id=?", Array($note['id']));