예제 #1
0
 public function restore($user, $reason = '')
 {
     $this->unMarkInProps(WPP_WALL_REMOVE);
     $this->unMarkInProps(WPP_WALL_ADMINDELETE);
     $this->customActionNotifyRC($user, 'wall_restore', $reason);
     $wne = $this->getAdminNotificationEntity($user, $reason);
     $wh = F::build('WallHistory', array($this->cityId));
     $wh->add(WH_RESTORE, $wne, $user);
     $this->addWatch($user);
     $wn = new WallNotifications();
     if ($this->isMain()) {
         $wn->unhideNotificationsForUniqueID($this->cityId, $this->getId());
         $this->getWall()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForThread($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForThread($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     } else {
         $this->getThread()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForReply($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForReply($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     }
 }
 public function brickHeader()
 {
     $this->wg->SuppressPageTitle = true;
     $this->response->setVal('isRemoved', false);
     $this->response->setVal('isAdminDeleted', false);
     $this->response->setVal('isNotifyeveryone', false);
     $this->response->setVal('isClosed', false);
     $path = array();
     $this->response->setVal('path', $path);
     $title = Title::newFromId($this->request->getVal('id'));
     if (empty($title)) {
         $title = Title::newFromID($this->request->getVal('id'), Title::GAID_FOR_UPDATE);
     }
     if (!empty($title) && $title->isTalkPage()) {
         $wallMessage = WallMessage::newFromTitle($title);
         $wallMessageParent = $wallMessage->getTopParentObj();
         if (!empty($wallMessageParent)) {
             $wallMessage = $wallMessageParent;
         }
         $wallMessage->load();
         if ($wallMessage->isWallOwner($this->wg->User)) {
             $wallName = wfMessage('wall-message-mywall')->escaped();
         } else {
             $wallOwner = $wallMessage->getWallOwner()->getName();
             $wallName = wfMessage('wall-message-elseswall', $wallOwner)->parse();
         }
         $wallUrl = $wallMessage->getWallUrl();
         $messageTitle = htmlspecialchars($wallMessage->getMetaTitle());
         $isRemoved = $wallMessage->isRemove();
         $isDeleted = $wallMessage->isAdminDelete();
         $this->response->setVal('isRemoved', $isRemoved);
         $this->response->setVal('isAdminDeleted', $isDeleted);
         $this->response->setVal('isNotifyeveryone', $wallMessage->getNotifyeveryone());
         $this->response->setVal('isClosed', $wallMessage->isArchive());
         if ($isRemoved || $isDeleted) {
             $this->wg->Out->setRobotPolicy("noindex,nofollow");
         }
         $user = $this->app->wg->User;
         // remove admin notification for it if Admin just checked it
         if (in_array('sysop', $user->getEffectiveGroups()) || in_array('staff', $user->getEffectiveGroups())) {
             $wna = new WallNotificationsAdmin();
             $wna->removeForThread($this->app->wg->CityId, $wallMessage->getId());
         }
         $wno = new WallNotificationsOwner();
         $wno->removeForThread($this->app->wg->CityId, $user->getId(), $wallMessage->getId());
         $path[] = array('title' => $wallName, 'url' => $wallUrl);
         $path[] = array('title' => $messageTitle);
         $this->getContext()->getOutput()->setRobotPolicy('index,follow');
         wfRunHooks('WallThreadHeader', array($title, $wallMessage, &$path, &$this->response, &$this->request));
     } else {
         wfRunHooks('WallHeader', array($this->wg->Title, &$path, &$this->response, &$this->request));
     }
     $this->response->setVal('path', $path);
 }