$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) { if (strpos($aData["type"], "search") !== false) { $oInsiders->setWhereGroup("filter", "recipientcollection." . $aData["field"], $_REQUEST["member_filter"], "LIKE"); } } $oInsiders->setInnerGroupCondition("filter", "OR");
$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); } $recipient->set("confirmed", $confirmed); $recipient->set("deactivated", $deactivated); $recipient->set("news_type", $newstype);
/** * 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; } }