Esempio n. 1
0
 private function doRename($sNewName, $sComment, $bUpdateLinks)
 {
     $nTime = time();
     try {
         if (!AnwCurrentSession::isActionAllowed($sNewName, 'create', $this->getoPage()->getLang())) {
             throw new AnwAclException("permission create denied");
         }
         $oPageTest = new AnwPageByName($sNewName);
         $oPageTest->setSkipLoadingContent(true);
         if ($oPageTest->exists()) {
             throw new AnwPageAlreadyExistsException();
         }
         $sOldName = $this->getoPage()->getName();
         //rename page
         $this->getoPage()->rename($sNewName, $bUpdateLinks);
         //unlock
         $this->unlockPageForEdition();
         //redirect
         AnwUtils::redirect(AnwUtils::link($sNewName));
     } catch (AnwBadPageNameException $e) {
         $sError = $this->g_("err_badpagename");
         $this->renameForm($sNewName, $sComment, $sError);
     } catch (AnwBadCommentException $e) {
         $sError = $this->g_("err_badcomment");
         $this->renameForm($sNewName, $sComment, $sError);
     } catch (AnwPageAlreadyExistsException $e) {
         $sError = $this->g_("err_pagealreadyexists");
         $this->renameForm($sNewName, $sComment, $sError);
     } catch (AnwAclException $e) {
         $sError = $this->g_("err_nopermission");
         $this->renameForm($sNewName, $sComment, $sError);
     }
 }