Пример #1
0
 public function update_note()
 {
     if (!isset($_POST['note_id'])) {
         error(__("Error"), __("No note ID specified.", "extend"));
     }
     $note = new Note($_POST['note_id']);
     if ($note->no_results) {
         error(__("Error"), __("Invalid note ID specified.", "extend"));
     }
     if (!$note->editable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this note.", "extend"));
     }
     $files = array();
     foreach ($_FILES['attachment'] as $key => $val) {
         foreach ($val as $file => $attr) {
             $files[$file][$key] = $attr;
         }
     }
     foreach ($files as $attachment) {
         if ($attachment['error'] != 4) {
             $path = upload($attachment, null, "attachments");
             Attachment::add(basename($path), $path, "note", $note->id);
         }
     }
     $note->update($_POST['body']);
     Flash::notice(__("Note updated.", "extend"), $note->url(true));
 }
 /**
  * Save our data to the database
  */
 public function action_publish_post($post, $form)
 {
     $this->action_form_publish($form, $post);
     if ($form->notes->value != NULL) {
         $note = new Note($form->note_key->value);
         $note->content = $form->notes->value;
         $note->update();
         // Utils::debug( $note, $note->update(), $this->get_notes() );
         $post->info->note_key = $note->key;
     }
     // exit;
 }