From: Alexander Ebert Date: Thu, 15 Sep 2011 12:49:49 +0000 (+0200) Subject: Exporting email addresses now working X-Git-Tag: 2.0.0_Beta_1~1765^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4802b1905f59f1536805abb3ed0655f195076979;p=GitHub%2FWoltLab%2FWCF.git Exporting email addresses now working --- diff --git a/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl b/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl index 7ed69575e4..796813fdaa 100644 --- a/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl +++ b/wcfsetup/install/files/acp/templates/userEmailAddressExport.tpl @@ -2,17 +2,9 @@ @@ -24,7 +16,6 @@
-
{lang}wcf.acp.user.exportEmailAddress.markedUsers{/lang} @@ -47,8 +38,8 @@
-
  • -
  • +
  • +
  • @@ -76,7 +67,6 @@ {@SID_INPUT_TAG} -
    diff --git a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php index 3bd5cda46b..8e3dd35a5b 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php @@ -1,6 +1,7 @@ typeID = ClipboardHandler::getInstance()->getTypeID('com.woltlab.wcf.user'); + if ($this->typeID === null) { + throw new SystemException("clipboard item type 'com.woltlab.wcf.user' is unknown."); + } + + // get user ids + $users = ClipboardHandler::getInstance()->getMarkedItems($this->typeID); + if (!isset($users['com.woltlab.wcf.user']) || empty($users['com.woltlab.wcf.user'])) throw new IllegalLinkException(); + + // load users + $this->userIDs = array_keys($users['com.woltlab.wcf.user']); + $this->users = $users['com.woltlab.wcf.user']; + } + /** * @see wcf\form\IForm::readFormParameters() */ @@ -35,20 +63,10 @@ class UserEmailAddressExportForm extends ACPForm { parent::readFormParameters(); if (isset($_POST['fileType']) && $_POST['fileType'] == 'xml') $this->fileType = $_POST['fileType']; - if (isset($_POST['userIDs'])) $this->userIDs = ArrayUtil::toIntegerArray(explode(',', $_POST['userIDs'])); if (isset($_POST['separator'])) $this->separator = $_POST['separator']; if (isset($_POST['textSeparator'])) $this->textSeparator = $_POST['textSeparator']; } - /** - * @see wcf\form\IForm::validate() - */ - public function validate() { - parent::validate(); - - if (empty($this->userIDs)) throw new IllegalLinkException(); - } - /** * @see wcf\form\IForm::save() */ @@ -83,7 +101,7 @@ class UserEmailAddressExportForm extends ACPForm { $statement->execute($conditions->getParameters()); $i = 0; - while ($row = WCF::getDB()->fetchArray($result)) { + while ($row = $statement->fetchArray()) { if ($this->fileType == 'xml') echo "
    \n"; else echo $this->textSeparator . $row['email'] . $this->textSeparator . ($i < $count['count'] ? $this->separator : ''); $i++; @@ -93,26 +111,12 @@ class UserEmailAddressExportForm extends ACPForm { echo ""; } - // TODO: Implement unmarkAll() - //UserEditor::unmarkAll(); $this->saved(); - exit; - } - - /** - * @see wcf\page\IPage::readData() - */ - public function readData() { - parent::readData(); - if (!count($_POST)) { - // get marked user ids - $markedUsers = WCF::getSession()->getVar('markedUsers'); - if (is_array($markedUsers)) $this->userIDs = implode(',', $markedUsers); - if (empty($this->userIDs)) throw new IllegalLinkException(); - } + // remove items + ClipboardHandler::getInstance()->removeItems($this->typeID); - $this->users = User::getUsers($this->userIDs); + exit; } /** @@ -123,7 +127,6 @@ class UserEmailAddressExportForm extends ACPForm { WCF::getTPL()->assign(array( 'users' => $this->users, - 'userIDs' => $this->userIDs, 'separator' => $this->separator, 'textSeparator' => $this->textSeparator, 'fileType' => $this->fileType