$oPage->setReload();
 $aMessages = array();
 $name = stripslashes($name);
 $email = stripslashes($email);
 $confirmed = (int) $confirmed;
 $deactivated = (int) $deactivated;
 $newstype = (int) $newstype;
 $recipient->set("name", $name);
 if (!isValidMail($email)) {
     $aMessages[] = i18n("Please specify a valid e-mail address", $plugin_name);
 } else {
     $email = strtolower($email);
     // e-mail always in lower case
     if ($recipient->get("email") != $email) {
         $oRecipients->resetQuery();
         $oRecipients->setWhere("email", $email);
         $oRecipients->setWhere("idclient", $client);
         $oRecipients->setWhere("idlang", $lang);
         $oRecipients->setWhere($recipient->primaryKey, $recipient->get($recipient->primaryKey), "!=");
         $oRecipients->query();
         if ($oRecipients->next()) {
             $aMessages[] = i18n("Could not set new e-mail adress: Other recipient with same e-mail address already exists", $plugin_name);
         } else {
             $recipient->set("email", $email);
         }
     }
 }
 if ($recipient->get("confirmed") != $confirmed && $confirmed) {
     $recipient->set("confirmeddate", date("Y-m-d H:i:s"), false);
 } elseif (!$confirmed) {
     $recipient->set("confirmeddate", "0000-00-00 00:00:00", false);
    $_REQUEST["searchin"] = "--all--";
}
// Free memory
unset($oUser);
unset($oClient);
##################################
# Get data
##################################
$oRecipients = new RecipientCollection();
// Updating keys, if activated; all recipients of all clients!
$sMsg = "";
if (getSystemProperty("newsletter", "updatekeys")) {
    $iUpdatedRecipients = $oRecipients->updateKeys();
    $sMsg = $notification->returnNotification("info", sprintf(i18n("%d recipients, with no or incompatible key has been updated. Deactivate update function.", $plugin_name), $iUpdatedRecipients));
}
$oRecipients->setWhere("recipientcollection.idclient", $client);
$oRecipients->setWhere("recipientcollection.idlang", $lang);
// sort by and sort order
$oRecipients->setOrder("recipientcollection." . $_REQUEST["sortby"] . " " . $_REQUEST["sortorder"]);
// Show group
if ($_REQUEST["restrictgroup"] != "--all--") {
    $oRecipients->link("RecipientGroupMemberCollection");
    $oRecipients->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["restrictgroup"]);
}
// Search for
if ($_REQUEST["filter"] != "") {
    if ($_REQUEST["searchin"] == "--all--" || $_REQUEST["searchin"] == "") {
        foreach ($aFields as $sKey => $aData) {
            if (strpos($aData["type"], "search") !== false) {
                $oRecipients->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["filter"], "LIKE");
            }
 $sContent .= '      </tr>' . chr(10);
 $sContent .= '   </table>' . chr(10);
 $sContent .= '</div>' . chr(10);
 $oMemberListOptionRow->setContentData($sContent);
 // Members
 $oAddedRecipientList = new UI_List();
 $oAddedRecipientList->setWidth("100%");
 $oAddedRecipientList->setBorder(1);
 $oAddedRecipientList->setCell(0, 1, "<strong>" . i18n("Name", $plugin_name) . "</strong>");
 $oImgDel = new cHTMLImage("images/but_invert_selection.gif");
 $sLnkDelIcon = '<a title="' . i18n("Check all", $plugin_name) . '" href="javascript://" onclick="fncCheckDel(\'deluser[]\');">' . $oImgDel->render() . '</a>';
 $oAddedRecipientList->setCell(0, 2, $sLnkDelIcon);
 $oAddedRecipientList->setCellAlignment(0, 2, "right");
 $oInsiders = new RecipientCollection();
 $oInsiders->link("RecipientGroupMemberCollection");
 $oInsiders->setWhere("recipientcollection.idclient", $client);
 $oInsiders->setWhere("recipientcollection.idlang", $lang);
 $oInsiders->setWhere("RecipientGroupMemberCollection.idnewsgroup", $_REQUEST["idrecipientgroup"]);
 // Get insiders for outsiders list (*sigh!*)
 // TODO: Ask user to have at least mySQL 4.1...
 $oInsiders->query();
 $aInsiders = array();
 if ($oInsiders->count() > 0) {
     while ($oInsider = $oInsiders->next()) {
         $aInsiders[] = $oInsider->get($oInsider->primaryKey);
     }
 }
 // Filter
 if ($_REQUEST["member_filter"] != "") {
     if ($_REQUEST["member_searchin"] == "--all--" || $_REQUEST["member_searchin"] == "") {
         foreach ($aFields as $sKey => $aData) {
 /**
  * checkEMail returns true, if there is no recipient with the same e-mail address; otherwise false
  * @param  $email string    e-mail
  * @return recpient item if item with e-mail exists, false otherwise
  */
 public function emailExists($sEmail)
 {
     global $client, $lang;
     $oRecipientCollection = new RecipientCollection();
     $oRecipientCollection->setWhere("idclient", $client);
     $oRecipientCollection->setWhere("idlang", $lang);
     $oRecipientCollection->setWhere("email", strtolower($sEmail));
     $oRecipientCollection->query();
     if ($oItem = $oRecipientCollection->next()) {
         return $oItem;
     } else {
         return false;
     }
 }