Exemple #1
0
 public function destroy_and_notify($current_user, $reason)
 {
     # TODO:
     if (!empty($this->creator_id) && $this->creator_id != $current_user->id) {
         $msg = "A tag implication you submitted (" . $this->predicate->name . " → " . $this->consequent->name . ") was deleted for the following reason: " . $reason;
         Dmail::create(array('from_id' => current_user()->id, 'to_id' => $this->creator_id, 'title' => "One of your tag implications was deleted", 'body' => $msg));
     }
     $this->destroy();
 }
Exemple #2
0
 public function create()
 {
     if (Dmail::where('from_id = ? AND created_at > ?', $this->current_user->id, date('Y-m-d H:i:s', time() - 3600))->count() >= CONFIG()->max_dmails_per_hour) {
         $this->notice("You can't send more than " . CONFIG()->max_dmails_per_hour . " dmails per hour.");
         $this->redirectTo('#inbox');
         return;
     }
     $dmail = $this->params()->dmail;
     if (empty($dmail['parent_id'])) {
         $dmail['parent_id'] = null;
     }
     $this->dmail = Dmail::create(array_merge($dmail, ['from_id' => $this->current_user->id, 'ip_addr' => $this->request()->remoteIp()]));
     if ($this->dmail->errors()->none()) {
         $this->notice("Message sent to " . $dmail['to_name']);
         $this->redirectTo("#inbox");
     } else {
         $this->notice("Error: " . $this->dmail->errors()->fullMessages(", "));
         $this->render('compose');
     }
 }
Exemple #3
0
 public function destroy_and_notify($current_user, $reason)
 {
     if ($this->creator_id && $this->creator_id != $current_user->id) {
         $msg = "A tag alias you submitted (" . $this->name . " → " . $this->alias_name() . ") was deleted for the following reason: " . $reason;
         Dmail::create(array('from_id' => current_user()->id, 'to_id' => $this->creator_id, 'title' => "One of your tag aliases was deleted", 'body' => $msg));
     }
     $this->destroy();
 }