예제 #1
0
 $can_view = $can_edit = $can_create = $can_delete = false;
 if (isset($options) && isset($options['owner_table']) && $options['owner_table'] && isset($options['title']) && $options['title']) {
     global $plugins;
     $can_view = $plugins[$options['owner_table']]->can_i('view', $options['title']);
     $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
     $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
     $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
 } else {
     return;
 }
 if (!$can_view && !$can_edit) {
     return;
 }
 $note_id = (int) $_REQUEST['note_id'];
 if ($note_id > 0) {
     $note = module_note::get_note($note_id);
     $owner_table = $note['owner_table'];
     $owner_id = $note['owner_id'];
     if ($can_delete && isset($options['do_delete']) && $options['do_delete'] == 'yes' && isset($options['note_id']) && $options['note_id']) {
         module_note::note_delete($owner_table, $owner_id, $options['note_id']);
         set_message('Note deleted successfully');
         redirect_browser($note['rel_data']);
     }
 } else {
     $owner_table = isset($options['owner_table']) ? $options['owner_table'] : (isset($_REQUEST['owner_table']) ? htmlspecialchars($_REQUEST['owner_table']) : '');
     $owner_id = isset($options['owner_id']) ? $options['owner_id'] : (isset($_REQUEST['owner_id']) ? htmlspecialchars($_REQUEST['owner_id']) : '');
     $note = array("note_time" => time(), "note" => '', "reminder" => '', "user_id" => '', 'rel_data' => isset($rel_data) ? serialize($rel_data) : '', 'public' => 0);
 }
 $note_edit_safe = true;
 if (get_display_mode() != 'ajax') {
     print_heading('Note');