if ($action === 'removeBug') { if (!isset($bugID)) { throw new Exception("removeBug: bug's ID is missing!"); } $b = new Bug((int) $bugID); $b->removeBug(); $data['error'] = "OK"; $data['message'] = $LANG['Delete_bug_OK']; } if ($action === 'addComm') { if (!isset($bugID)) { throw new Exception("addComm: bug's ID is missing!"); } $b = new Bug((int) $bugID); $data['newComment'] = $b->addComment($commentText); $b->notify('comment'); $data['error'] = "OK"; $data['message'] = $LANG['New_comment_OK']; } if ($action === 'modComm') { if (!isset($bugID)) { throw new Exception("modComm: bug's ID is missing!"); } if (!is_array($comment)) { throw new Exception("modComm: 'comment' is not an array!"); } $b = new Bug((int) $bugID); $b->updateComment((int) $comment['id'], $comment['message']); $data['error'] = "OK"; $data['message'] = $LANG['Update_comment_OK']; }
<?php /** Copyright (C) 2015 Polosson This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ require 'init.php'; try { $b = new Bug(7); $m = $b->notify("comment"); echo '<pre>Mail sent: '; print_r($m); echo '</pre>'; } catch (Exception $e) { echo '<pre>' . $e->getMessage() . '</pre>'; }