/**
  * @see Action::execute();
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     WCF::getUser()->checkPermission('admin.system.canEditOption');
     // header
     @header('Content-type: text/xml');
     // file name
     @header('Content-disposition: attachment; filename="options.xml"');
     // no cache headers
     @header('Pragma: no-cache');
     @header('Expires: 0');
     // content
     echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<options>\n";
     $options = Options::getOptions();
     foreach ($options as $option) {
         echo "\t<option>\n";
         echo "\t\t<name><![CDATA[" . StringUtil::escapeCDATA($option['optionName']) . "]]></name>\n";
         echo "\t\t<value><![CDATA[" . StringUtil::escapeCDATA($option['optionValue']) . "]]></value>\n";
         echo "\t</option>\n";
     }
     echo '</options>';
     $this->executed();
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->alliance = Alliance::getByUserID($this->userID, true);
     $this->user = new LWUser($this->userID);
     if ($this->userID == WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if ($this->user->ally_id != $this->allianceID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if (!$this->alliance->getRank(true, 6)) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->alliance->deleteUser($this->userID);
     $this->executed();
     header('Location: index.php?page=AllianceMembersList');
     exit;
 }
 /**
  * @see Action::execute();
  */
 public function execute()
 {
     parent::execute();
     SpiderEditor::synchronize();
     HeaderUtil::redirect('index.php?page=AdminToolsSpiderList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     WCF::getUser()->checkPermission('admin.user.canDeleteUser');
     require_once WCF_DIR . 'lib/data/user/UserEditor.class.php';
     require_once WCF_DIR . 'lib/data/user/group/Group.class.php';
     if ($this->userID !== 0) {
         $this->userIDs[] = $this->userID;
     }
     // active user can't delete himself
     $activeUserID = WCF::getSession()->getUser()->userID;
     $this->userIDs = array_diff($this->userIDs, array($activeUserID));
     // check permission
     if (count($this->userIDs) > 0) {
         $sql = "SELECT\tDISTINCT groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             if (!Group::isAccessibleGroup($row['groupID'])) {
                 throw new PermissionDeniedException();
             }
         }
     }
     $deletedUsers = UserEditor::deleteUsers($this->userIDs);
     $this->executed();
     if (!empty($this->url) && (strpos($this->url, 'searchID=0') !== false || strpos($this->url, 'searchID=') === false)) {
         HeaderUtil::redirect($this->url);
     } else {
         HeaderUtil::redirect('index.php?form=UserSearch&deletedUsers=' . $deletedUsers . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     if ($this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if (!$this->fleet->getCancelDuration()) {
         require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php';
         throw new IllegalLinkException();
     }
     if ($this->fleet->missionID == 11) {
         $formation = $this->fleet->getNavalFormation();
     }
     $this->fleet->getEditor()->cancel();
     if ($this->fleet->missionID == 11) {
         FleetOvent::update($formation->getLeaderFleet());
     }
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->navalFormation = new NavalFormation($this->navalFormationID);
     // check fleet
     if ($this->navalFormation->getLeaderFleet()->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if ($this->navalFormation->usersLimitReached()) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $user = new LWUser(null, null, $this->username);
     if (!$user->userID) {
         require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php';
         throw new IllegalLinkException();
     }
     $this->userID = $user->userID;
     $this->navalFormation->getEditor()->addUser($this->userID);
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     // call execute event
     parent::execute();
     if ($this->source->enableCheckout && $this->checkoutRepository) {
         // load scm driver
         $className = ucfirst(Source::validateSCM($this->source->scm));
         // check out repository
         require_once WCF_DIR . 'lib/system/scm/' . $className . '.class.php';
         call_user_func(array($className, 'checkout'), $this->source->url, $this->source->sourceDirectory, array('username' => $this->source->username, 'password' => $this->source->password));
         // set revision
         $revision = $this->source->getHeadRevision();
         $this->source->update(null, null, null, null, null, null, null, $revision);
     }
     // rebuild package data if requested
     if ($this->rebuildPackageData) {
         require_once PB_DIR . 'lib/system/package/PackageHelper.class.php';
         PackageHelper::readPackages($this->source);
     }
     // call executed event
     $this->executed();
     // forward
     HeaderUtil::redirect('index.php?page=SourceView&sourceID=' . $this->source->sourceID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.template.canDeleteTemplate');
     if (!count($this->templateID)) {
         throw new IllegalLinkException();
     }
     // delete templates (files)
     $templateIDs = '';
     require_once WCF_DIR . 'lib/data/template/TemplateEditor.class.php';
     $sql = "SELECT\t\ttemplate.*, pack.templatePackFolderName, package.packageDir\n\t\t\tFROM\t\twcf" . WCF_N . "_template template\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_template_pack pack\n\t\t\tON\t\t(pack.templatePackID = template.templatePackID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = template.packageID)\n\t\t\tWHERE\t\ttemplate.templateID IN (" . implode(',', $this->templateID) . ")\n\t\t\t\t\tAND template.templatePackID > 0";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!empty($templateIDs)) {
             $templateIDs .= ',';
         }
         $templateIDs .= $row['templateID'];
         $template = new TemplateEditor(null, $row);
         if ($template->templateID) {
             $template->deleteFile();
         }
     }
     // delete database entries
     if (!empty($templateIDs)) {
         TemplateEditor::deleteAll($templateIDs);
     }
     // reset cache
     WCF::getCache()->clear(WCF_DIR . 'cache', 'cache.templates-*.php');
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=TemplateList&deletedTemplates=' . count($this->templateID) . '&templatePackID=' . $this->templatePackID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see	Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // remove entries
     DynamicPageEditor::remove($this->pageID);
     $this->page->moduleManager->remove();
     // clear cache
     DynamicPageEditor::clearCache($this->pageID, $this->page->hostID);
     // page menu entry
     if ($this->page->menuItemID) {
         require_once WCF_DIR . 'lib/data/page/menu/PageMenuItemEditor.class.php';
         // create editor object
         $menuItem = new PageMenuItemEditor($this->page->menuItemID);
         // remove item
         $menuItem->remove();
         // clear cache
         PageMenuItemEditor::clearCache();
     }
     // send redirect headers
     if (!isset($_REQUEST['ajax'])) {
         HeaderUtil::redirect('index.php?page=DynamicPageList&hostID=' . $this->page->hostID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     }
     // call event
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     AbstractAction::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.canBanUser');
     if (count($this->userIDs) > 0) {
         // check permission
         $sql = "SELECT\tDISTINCT groupID\n\t\t\t\tFROM\twcf" . WCF_N . "_user_to_groups\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             if (!Group::isAccessibleGroup($row['groupID'])) {
                 throw new PermissionDeniedException();
             }
         }
         // update user
         $sql = "UPDATE\twcf" . WCF_N . "_user\n\t\t\t\tSET\tbanned = 0\n\t\t\t\tWHERE\tuserID IN (" . implode(',', $this->userIDs) . ")";
         WCF::getDB()->sendQuery($sql);
         // unmark users
         UserEditor::unmarkAll();
         // reset sessions
         Session::resetSessions($this->userIDs);
     }
     $this->executed();
     if (!empty($this->url)) {
         HeaderUtil::redirect($this->url);
     } else {
         // set active menu item
         WCFACP::getMenu()->setActiveMenuItem('wcf.acp.menu.link.user.management');
         // show succes message
         WCF::getTPL()->assign('message', 'wcf.acp.user.unban.success');
         WCF::getTPL()->display('success');
     }
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // avoid session update
     WCF::getSession()->disableUpdate();
     // execute cronjobs
     new CronjobsExec();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     // call execute event
     parent::execute();
     // save status
     UserSession::saveStatus($this->name, $this->status);
     // call executed event
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission(array('admin.smiley.canEditSmiley', 'admin.smiley.canDeleteSmiley'));
     // unmark
     WCF::getSession()->unregister('markedSmileys');
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission.
     WCF::getUser()->checkPermission('admin.system.package.canEditServer');
     // change status
     $this->updateServer->enable($this->updateServer->statusUpdate != 1);
     $this->executed();
     // redirect to the view page.
     HeaderUtil::redirect('index.php?page=UpdateServerList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
 }
 /**
  * @see	Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // remove host
     HostEditor::remove($this->hostID);
     DynamicPageEditor::removeFromHost($this->hostID);
     // send redirect headers
     HeaderUtil::redirect('index.php?page=DynamicHostList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     // execute event
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.system.canViewLog');
     // clear cache
     WCF::getCache()->getCacheSource()->flush();
     $this->executed();
     // forward
     HeaderUtil::redirect('index.php?page=CacheList&cleared=1&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.invitation.canDeleteInvitation');
     // delete invitation
     $this->invitation->delete();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=InvitationList&deletedInvitationID=' . $this->invitationID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     WCF::getUser()->checkPermission('admin.contest.canDeleteClass');
     // delete
     $this->contestClass->delete();
     $this->executed();
     // forward to list page
     header('Location: index.php?page=ContestClassList&deletedclassID=' . $this->contestClassID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.avatar.canDeleteAvatarCategory');
     // delete category
     $this->avatarCategory->delete();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=AvatarCategoryList&deletedAvatarCategoryID=' . $this->avatarCategoryID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute();
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     WCF::getUser()->checkPermission(array('admin.system.package.canUpdatePackage', 'admin.system.package.canUninstallPackage'));
     // update name
     $sql = "UPDATE\twcf" . WCF_N . "_package\n\t\t\tSET\tinstanceName = '" . escapeString($this->name) . "'\n\t\t\tWHERE\tpackageID = " . $this->packageID;
     WCF::getDB()->sendQuery($sql);
     // reset cache
     WCF::getCache()->clearResource('packages');
     $this->executed();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.system.cronjobs.canDeleteCronjob');
     // enable/disbale cronjob
     CronjobEditor::clearLog();
     $this->executed();
     // forward
     HeaderUtil::redirect('index.php?page=CronjobsShowLog&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.infraction.canDeleteWarning');
     // delete warning
     $this->userWarning->delete();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=UserWarningList&deletedUserWarningID=' . $this->userWarningID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission.
     WCF::getUser()->checkPermission('admin.system.package.canEditServer');
     // check master password
     WCFACP::checkMasterPassword();
     // delete server
     $this->updateServer->delete();
     $this->executed();
     // redirect to the view page.
     HeaderUtil::redirect('index.php?page=UpdateServerList&deletedPackageUpdateServerID=' . $this->packageUpdateServerID . "&packageID=" . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
 }
 public function execute()
 {
     parent::execute();
     $comment = new ServerCommentEditor($this->commentID);
     if ($comment->commentID == 0) {
         throw new IllegalLinkException();
     }
     if (!BASHCore::getUser()->getPermission('mod.comment.moderatorPermissions') and $comment->authorID != BASHCore::getUser()->userID) {
         throw new PermissionDeniedException();
     }
     ServerCommentEditor::remove($comment->commentID);
     HeaderUtil::redirect(BASHCore::getSession()->lastRequestURI, false);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.ratingoption.canEditItem');
     // get ratingoption item
     $contestRatingoption = new ContestRatingoptionEditor($this->contestRatingoptionID);
     if (!$contestRatingoption->contestRatingoptionID) {
         throw new IllegalLinkException();
     }
     $contestRatingoption->updateTranslation($this->title, null, WCF::getLanguage()->getLanguageID());
     $this->executed();
 }
 public function execute()
 {
     parent::execute();
     $entry = new NewsEntryEditor($this->entryID);
     if ($entry->entryID == 0) {
         throw new IllegalLinkException();
     }
     if (!BASHCore::getUser()->getPermission('mod.bash.canDeleteNewsEntries') and BASHCore::getUser()->userID != $entry->authorID) {
         throw new PermissionDeniedException();
     }
     NewsEntryEditor::remove($entry->entryID);
     HeaderUtil::redirect('index.php?page=Index' . SID_ARG_2ND_NOT_ENCODED);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     AbstractAction::execute();
     // validate
     $this->validate();
     // do logout
     $this->doLogout();
     $this->executed();
     // redirect to url
     WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get('wcf.user.logout.redirect'), 'wait' => 5));
     WCF::getTPL()->display('redirect');
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID || !$this->alliance->getRank(true, 6)) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->alliance->addInterrelation($this->allianceID2, $this->interrelationType, $this->interrelationState, null);
     $this->executed();
     header('Location: index.php?page=AllianceDiplomacy&allianceID=' . $this->allianceID);
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     //validates the given token to avoid misusing
     $sql = 'SELECT COUNT(token) AS count
     		FROM wcf' . WCF_N . '_' . $this->activationTable . '
     		WHERE userID = ' . $this->userID;
     $row = WCF::getDB()->getFirstRow($sql);
     if ($row['count'] != 1) {
         $message = WCF::getLanguage()->get('wcf.acp.newsletter.optin.invalidToken');
         throw new NamedUserException($message);
     }
     //get ip address and convert it into a long
     $ipAddress = ip2long(StringUtil::trim($_SERVER['REMOTE_ADDR']));
     //prevents database error
     if (!$ipAddress) {
         $ipAddress = ip2long('127.0.0.1');
     }
     //validates the user as a subscriber
     $sql = 'UPDATE wcf' . WCF_N . '_' . $this->activationTable . "\n        \t\tSET token = '', datetime = " . TIME_NOW . ',
     		ip = ' . $ipAddress . ', activated = 1
     		WHERE userID = ' . $this->userID;
     WCF::getDB()->sendQuery($sql);
     $user = new User($this->userID);
     //checks if the subscriber already exists
     $sqlCheck = 'SELECT COUNT(subscriberID) AS count
     			FROM wcf' . WCF_N . '_' . $this->subscriberTable . '
     			WHERE userID = ' . $this->userID;
     $row = WCF::getDB()->getFirstRow($sqlCheck);
     if (!intval($row['count'])) {
         //create a new subscriber
         $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->subscriberTable . '
     			(userID, username, email)
     				VALUES
     			(' . $this->userID . ", '" . escapeString($user->username) . "', '" . escapeString($user->email) . "')";
         WCF::getDB()->sendQuery($sql);
         $subscriberID = WCF::getDB()->getInsertID();
         //inserts an unsubscribe token for the subscriber
         $sql = 'INSERT INTO wcf' . WCF_N . '_' . $this->unsubscriptionTable . '
     				(subscriberID, token)
     			VALUES
     				(' . intval($subscriberID) . ", '" . escapeString(StringUtil::getRandomID()) . "')";
         WCF::getDB()->sendQuery($sql);
     }
     //clears cache
     WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.newsletter-subscriber-' . PACKAGE_ID . '.php', true);
     $this->executed();
     WCF::getTPL()->assign(array('message' => WCF::getLanguage()->get('wcf.acp.newsletter.optin.activationSuccess'), 'url' => PAGE_URL . '/index.php?page=Index' . SID_ARG_2ND));
     WCF::getTPL()->display('redirect');
     exit;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     WCF::getUser()->checkPermission('admin.help.canEditHelpItem');
     // update
     $this->helpItem->enable($this->enable);
     // delete cache
     HelpItemEditor::clearCache();
     $this->executed();
     // forward to list page
     header('Location: index.php?page=HelpItemList&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }