public function action_save_notes() { if (Yii::app()->user->isGuest) { return print "You need ot be logged in to save notes."; } $contact = new ContactObj($_REQUEST["cid"]); if (!$contact->loaded) { return print "Contact could not be found."; } $user = new UserObj(Yii::app()->user->name); if (!$user->loaded) { return print "You need to be logged in to save notes."; } $oldnotes = $contact->load_notes($user->username); $newnotes = $_REQUEST["notes"]; # Save the notes if (!$contact->save_notes($user->username, $newnotes)) { $log = new LogObj(); $log->type = "error"; $log->log_message = "Attempting to update contact(" . $contact->cid . ") notes from \"{$oldnotes}\" to \"{$newnotes}\".\n"; $log->log_message .= $contact->get_error(); if (!$log->save()) { die($log->get_error()); } return print $log->log_message; } return print 1; }
} ?> <?php $contents = ob_get_contents(); ob_end_clean(); $boxGraphs->content = $contents; } // Box 2: Notes $boxNotes = clone $box; $boxNotes->header = StdLib::load_image("notes.png", "16px", "16px") . " Notes <span class='hide save-notify'> < saved ></span>"; ob_start(); ?> <textarea class="notes" style='width:98%;min-height:100px;'><?php echo $contact->load_notes($user->username); ?> </textarea> <?php $contents = ob_get_contents(); ob_end_clean(); $boxNotes->content = $contents; $boxNotes->styles["content"]["background-color"] = "#fffddc"; $boxNotes->id = "widget-box-notes"; // Box 3: Tags $boxTags = clone $box; $atags = explode(",", $contact->tags); if (count($atags) == 1 and $atags[0] == "") { $htag = "0"; } else {