X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnewnotice.php;h=b5fc98c37c904d662200da2653931f5199be889e;hb=0625f18c8e29bd840546136abe9e869b145fc497;hp=8de6643a0f29b5f437c0d49f4873cf8f449a4991;hpb=d79dc8344b529281dfb8a8383c529720a429472b;p=quix0rs-gnu-social.git diff --git a/actions/newnotice.php b/actions/newnotice.php index 8de6643a0f..b5fc98c37c 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -43,12 +43,27 @@ class NewnoticeAction extends Action { if (!$content) { $this->show_form(_('No content!')); return; - } else if (strlen($content) > 140) { + } else if (mb_strlen($content) > 140) { + common_debug("Content = '$content'", __FILE__); + common_debug("mb_strlen(\$content) = " . mb_strlen($content), __FILE__); $this->show_form(_('That\'s too long. Max notice size is 140 chars.')); return; } - $notice = Notice::saveNew($user->id, $content, 'web'); + $inter = new CommandInterpreter(); + + $cmd = $inter->handle_command($user, $content); + + if ($cmd) { + $cmd->execute(new WebChannel()); + return; + } + + $replyto = $this->trimmed('inreplyto'); + + common_debug("Replyto = $replyto\n"); + + $notice = Notice::saveNew($user->id, $content, 'web', 1, ($replyto == 'false') ? NULL : $replyto); if (is_string($notice)) { $this->show_form($notice); @@ -64,7 +79,7 @@ class NewnoticeAction extends Action { array('nickname' => $user->nickname)); } else { $url = common_local_url('shownotice', - array('notice' => $id)); + array('notice' => $notice->id)); } common_redirect($url, 303); }