/**
  * Show the special page. Let the parent handle most stuff, but handle a
  * successful upload ourselves
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     global $wgRequest, $wgOut, $wgUser, $wgUserProfileScripts;
     $wgOut->addExtensionStyle($wgUserProfileScripts . '/UserProfile.css');
     parent::execute($params);
     if ($this->mUploadSuccessful) {
         // Cancel redirect
         $wgOut->redirect('');
         $this->showSuccess($this->mUpload->mExtension);
         //this runs hook on avatar change
         wfRunHooks('NewAvatarUploaded', array($wgUser));
         //end of hook
     }
 }
예제 #2
0
 /**
  * Show the special page. Let the parent handle most stuff, but handle a
  * successful upload ourselves
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     global $wgUserProfileScripts;
     $out = $this->getOutput();
     $out->addExtensionStyle($wgUserProfileScripts . '/UserProfile.css');
     parent::execute($params);
     if ($this->mUploadSuccessful) {
         // Cancel redirect
         $out->redirect('');
         $this->showSuccess($this->mUpload->mExtension);
         // Run a hook on avatar change
         wfRunHooks('NewAvatarUploaded', array($this->getUser()));
     }
 }
예제 #3
0
 /**
  * Show the special page. Let the parent handle most stuff, but handle a
  * successful upload ourselves
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     $out = $this->getOutput();
     // Add CSS
     $out->addModuleStyles('ext.socialprofile.userprofile.css');
     // Let the parent class do most of the heavy lifting.
     parent::execute($params);
     if ($this->mUploadSuccessful) {
         // Cancel redirect
         $out->redirect('');
         $this->showSuccess($this->mUpload->mExtension);
         // Run a hook on avatar change
         wfRunHooks('NewAvatarUploaded', array($this->getUser()));
     }
 }
 public function execute($par)
 {
     global $wgOut;
     $cacheManager = new \PageAttachment\Cache\CacheManager();
     $pageFactory = new \PageAttachment\Session\PageFactory($cacheManager);
     $security = new \PageAttachment\Security\SecurityManager();
     $session = new \PageAttachment\Session\Session($security, $pageFactory);
     $attachToPage = $session->getAttachToPage();
     if (isset($attachToPage) && $attachToPage->getId() > 0) {
         $abort = false;
         if ($security->isDownloadRequestValid()) {
             // Subsequest Passes - Upload File
             parent::execute($par);
         } else {
             // First Pass - Display Form
             $protectedPage = $attachToPage->isProtected();
             if ($security->isAttachmentAddUpdateRequireLogin($protectedPage) && !$security->isLoggedIn()) {
                 $session->setStatusMessage('YouMustBeLoggedInToAddUpdateAttachments');
                 $abort = true;
             } elseif (!$security->isRequestValidationTokenValid()) {
                 $session->setStatusMessage('UnableToAuthenticateYourRequest');
                 $abort = true;
             }
             if ($abort == true) {
                 $title = \Title::newFromText($attachToPage->getPageTitle());
                 $wgOut->redirect($title->getFullURL());
             } else {
                 $security->setDownloadRequestValid(true);
                 $session->setUploadAndAttachFileInitiated(true);
                 parent::execute($par);
             }
         }
     } else {
         $session->setStatusMessage('UnableToDetermineAttachToPage');
         $title = \Title::newFromText(\wfMsgForContent('mainpage'));
         $wgOut->redirect($title->getFullURL());
     }
 }