function updateGlobalNotification($global_notification_id, $data)
 {
     $dao = new ArtifactGlobalNotificationDao(CodendiDataAccess::instance());
     $feedback = '';
     $arr_email_address = split('[,;]', $data['addresses']);
     if (!util_validateCCList($arr_email_address, $feedback, false)) {
         $GLOBALS['Response']->addFeedback('error', $feedback);
     } else {
         $data['addresses'] = util_cleanup_emails(implode(', ', $arr_email_address));
         return $dao->modify($global_notification_id, $data);
     }
     return false;
 }
 protected function updateGlobalNotification($global_notification_id, $data)
 {
     $feedback = '';
     $arr_email_address = split('[,;]', $data['addresses']);
     if (!util_validateCCList($arr_email_address, $feedback, false)) {
         $GLOBALS['Response']->addFeedback('error', $feedback);
     } else {
         $data['addresses'] = util_cleanup_emails(implode(', ', $arr_email_address));
         return $this->getGlobalDao()->modify($global_notification_id, $data);
     }
     return false;
 }
Ejemplo n.º 3
0
/**
 * Return the emails normalized 
**/
function util_normalize_emails($adresses)
{
    $adresses = util_split_emails($adresses);
    list($host, $port) = explode(':', $GLOBALS['sys_default_domain']);
    foreach ($adresses as $key => $value) {
        if (trim($value) !== "") {
            $value = util_cleanup_emails($value);
            if (!validate_email($value)) {
                //Maybe it is a codendi username, we take his e-mail
                $result = user_get_result_set_from_unix($value);
                if ($result && db_numrows($result) > 0) {
                    $value = db_result($result, 0, "email");
                } else {
                    $value = $value . "@" . $host;
                }
            }
            $adresses[$key] = $value;
        }
    }
    return implode(',', $adresses);
}