function run()
 {
     $enotif = new MoodBarHTMLEmailNotification();
     // Get the user from ID (rename safe). Anons are 0, so defer to name.
     if (isset($this->params['editorID']) && $this->params['editorID']) {
         $editor = User::newFromId($this->params['editorID']);
         // B/C, only the name might be given.
     } else {
         $editor = User::newFromName($this->params['editor'], false);
         if (!$editor) {
             $this->setLastError($this->params['editor'] . ' is not a valid user');
             return false;
         }
     }
     $enotif->actuallyNotifyOnRespond($editor, $this->title, $this->params['timestamp'], $this->params['feedback'], $this->params['response'], $this->params['type'], $this->params['responseId']);
     return true;
 }
 public function execute()
 {
     global $wgRequest, $wgUser;
     if ($wgUser->isAnon()) {
         $this->dieUsage("You don't have permission to do that", 'permission-denied');
     }
     if ($wgUser->isBlocked(false)) {
         $this->dieUsageMsg(array('blockedtext'));
     }
     $params = $this->extractRequestParams();
     //Response Object
     $item = MBFeedbackResponseItem::create(array());
     $setParams = array();
     foreach ($params as $key => $value) {
         if ($item->isValidKey($key)) {
             $setParams[$key] = $value;
         }
     }
     $item->setProperties($setParams);
     $item->save();
     $commenter = $item->getProperty('feedbackitem')->getProperty('user');
     if ($commenter !== null && $commenter->isAnon() == false) {
         $talkPage = $commenter->getTalkPage();
         $response = Parser::cleanSigInSig($params['response']);
         $feedback_link = wfMessage('moodbar-feedback-response-title')->inContentLanguage()->params(SpecialPage::getTitleFor('FeedbackDashboard', $item->getProperty('feedback'))->getPrefixedText())->escaped();
         $summary = wfMessage('moodbar-feedback-edit-summary')->inContentLanguage()->rawParams($item->getProperty('feedback'), $response)->escaped();
         $this->disableUserTalkEmailNotification();
         $id = intval($item->getProperty('id'));
         $api = new ApiMain(new FauxRequest(array('action' => 'edit', 'title' => $talkPage->getFullText(), 'appendtext' => ($talkPage->exists() ? "\n\n" : '') . $feedback_link . "\n" . '<span id="feedback-dashboard-response-' . $id . '"></span>' . "\n\n" . $response . "\n\n~~~~\n\n" . '<span class="markashelpful-mbresponse-' . $id . '">&#160;</span>', 'token' => $params['token'], 'summary' => $summary, 'notminor' => true), true, array('wsEditToken' => $wgRequest->getSessionData('wsEditToken'))), true);
         $api->execute();
         $this->restoreUserTalkEmailNotification();
         global $wgLang;
         $EMailNotif = new MoodBarHTMLEmailNotification();
         $EMailNotif->notifyOnRespond($wgUser, $talkPage, wfTimestampNow(), $item->getProperty('feedback'), $wgLang->truncate($response, 250), $item->getProperty('feedbackitem')->getProperty('type'), $id);
     }
     $result = array('result' => 'success');
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }