当前位置: 首页>>代码示例>>PHP>>正文


PHP NotificationMail类代码示例

本文整理汇总了PHP中NotificationMail的典型用法代码示例。如果您正苦于以下问题:PHP NotificationMail类的具体用法?PHP NotificationMail怎么用?PHP NotificationMail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NotificationMail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateSendTo

 /**
  * Override standard validation and sending notification to send the good PDF reports with 
  * appropriate rigths.
  * 
  * @see NotificationTarget::validateSendTo()
  * 
  * @param string $event notification event
  * @param Array $infos Current user informations
  * @param Boolean $notify_me Notify the current user of his own actions ?
  * 
  * @return boolean false to prevent standard mail sending
  */
 function validateSendTo($event, array $infos, $notify_me = false)
 {
     global $DB;
     if (isset($infos['users_id'])) {
         // save session variables
         $saved_session = $_SESSION;
         // Get current user full informations
         $user = new User();
         $user->getFromDB($infos['users_id']);
         // inialize session for user to build the proper PDF report
         unset($_SESSION['glpiprofiles'], $_SESSION['glpiactiveentities'], $_SESSION['glpiactiveprofile']);
         Session::initEntityProfiles($infos['users_id']);
         // Use default profile if exist
         if (isset($_SESSION['glpiprofiles'][$user->fields['profiles_id']])) {
             Session::changeProfile($user->fields['profiles_id']);
             // Else use first
         } else {
             Session::changeProfile(key($_SESSION['glpiprofiles']));
         }
         $user_name = $infos['username'] . '_';
         $file_name = $this->_buildPDF($user_name);
         $path = GLPI_PLUGIN_DOC_DIR . '/mreporting/notifications/' . $file_name;
         $mmail = new NotificationMail();
         $mmail->AddCustomHeader("Auto-Submitted: auto-generated");
         // For exchange
         $mmail->AddCustomHeader("X-Auto-Response-Suppress: OOF, DR, NDR, RN, NRN");
         // Get current entity administrator info to send the email from him
         $admin = $this->getSender();
         $mmail->From = $admin['email'];
         $mmail->FromName = $admin['name'];
         // Attach pdf to mail
         $mmail->AddAttachment($path, $file_name);
         // Get content infos
         $query = 'SELECT * 
               FROM glpi_notificationtemplatetranslations
               WHERE notificationtemplates_id = (
                  SELECT id 
                  FROM glpi_notificationtemplates 
                  WHERE itemtype = "PluginMreportingNotification"
               )
               AND (language LIKE "' . $_SESSION['glpilanguage'] . '" OR language LIKE "")
               ORDER BY language DESC
               LIMIT 0, 1';
         $result = $DB->query($query);
         $translation = $result->fetch_array();
         $mmail->isHTML(true);
         $mmail->Subject = $translation['subject'];
         $mmail->Body = $translation['content_html'];
         $mmail->AltBody = $translation['content_text'];
         $mmail->AddAddress($infos['email']);
         if ($mmail->Send()) {
         }
         //restore session
         unset($_SESSION);
         $_SESSION = $saved_session;
     }
     return false;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:70,代码来源:notificationtargetnotification.class.php

示例2: showFormMailServerConfig

 function showFormMailServerConfig()
 {
     global $CFG_GLPI;
     echo "<form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>";
     echo "<div>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<tr class='tab_bg_1'><th colspan='4'>" . _n('Notification', 'Notifications', 2) . "</th></tr>";
     echo "<tr class='tab_bg_2'><td>" . __('Enable followup via email') . "</td><td>";
     Dropdown::showYesNo("use_mailing", $CFG_GLPI["use_mailing"]);
     echo "</td>";
     if ($CFG_GLPI['use_mailing']) {
         echo "<td colspan='2'></td></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . __('Administrator email') . "</td>";
         echo "<td><input type='text' name='admin_email' size='40' value='" . $CFG_GLPI["admin_email"] . "'>";
         if (!NotificationMail::isUserAddressValid($CFG_GLPI["admin_email"])) {
             echo "<span class='red'>&nbsp;" . __('Invalid email address') . "</span>";
         }
         echo "</td>";
         echo "<td >" . __('Administrator name') . "</td>";
         echo "<td><input type='text' name='admin_email_name' size='40' value='" . $CFG_GLPI["admin_email_name"] . "'>";
         echo " </td></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td >" . __('Administrator reply-to email (if needed)') . "</td>";
         echo "<td><input type='text' name='admin_reply' size='40' value='" . $CFG_GLPI["admin_reply"] . "'>";
         if (!NotificationMail::isUserAddressValid($CFG_GLPI["admin_reply"])) {
             echo "<span class='red'>&nbsp;" . __('Invalid email address') . "</span>";
         }
         echo " </td>";
         echo "<td >" . __('Response address (if needed)') . "</td>";
         echo "<td><input type='text' name='admin_reply_name' size='40' value='" . $CFG_GLPI["admin_reply_name"] . "'>";
         echo " </td></tr>";
         if (!function_exists('mail')) {
             echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
             echo "<span class='red'>" . __('The PHP mail function is unknown or is not activated on your system.') . "</span><br>" . __('The use of a SMTP is needed.') . "</td></tr>";
         }
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . __('Email signature') . "</td>";
         echo "<td colspan='3'><textarea cols='60' rows='3' name='mailing_signature'>" . $CFG_GLPI["mailing_signature"] . "</textarea></td></tr>";
         echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Mail server') . "</th></tr>";
         echo "<tr class='tab_bg_2'><td>" . __('Way of sending emails') . "</td><td>";
         $mail_methods = array(MAIL_MAIL => __('PHP'), MAIL_SMTP => __('SMTP'), MAIL_SMTPSSL => __('SMTP+SSL'), MAIL_SMTPTLS => __('SMTP+TLS'));
         Dropdown::showFromArray("smtp_mode", $mail_methods, array('value' => $CFG_GLPI["smtp_mode"]));
         echo "</td><td colspan='2'>&nbsp;</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_2'><td >" . __('SMTP host') . "</td>";
         echo "<td><input type='text' name='smtp_host' size='40' value='" . $CFG_GLPI["smtp_host"] . "'>";
         echo "</td>";
         echo "<td >" . __('SMTP login (optional)') . "</td>";
         echo "<td><input type='text' name='smtp_username' size='40' value='" . $CFG_GLPI["smtp_username"] . "'></td></tr>";
         //TRANS: SMTP port
         echo "<tr class='tab_bg_2'><td >" . __('Port') . "</td>";
         echo "<td><input type='text' name='smtp_port' size='5' value='" . $CFG_GLPI["smtp_port"] . "'>";
         echo "</td>";
         echo "<td >" . __('SMTP password (optional)') . "</td>";
         echo "<td><input type='password' name='smtp_passwd' size='40' value='' autocomplete='off'>";
         echo "<br><input type='checkbox' name='_blank_smtp_passwd'>&nbsp;" . __('Clear');
         echo "</td></tr>";
     } else {
         echo "<td colspan='2'></td></tr>";
     }
     $options['candel'] = false;
     if ($CFG_GLPI['use_mailing']) {
         $options['addbuttons'] = array('test_smtp_send' => __('Send a test email to the administrator'));
     }
     $this->showFormButtons($options);
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:68,代码来源:notificationmailsetting.class.php

示例3: send

 static function send($mailing_options)
 {
     $mail = new NotificationMail();
     $mail->sendNotification($mailing_options);
     $mail->ClearAddresses();
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:6,代码来源:notification.class.php

示例4: forgetPassword

 /**
  * Send password recovery for a user.
  *
  * @param $email email of the user
  *
  * @return nothing : send email or display error message
  **/
 function forgetPassword($email)
 {
     global $LANG, $CFG_GLPI;
     echo "<div class='center'>";
     if ($this->getFromDBbyEmail($email)) {
         // Send token if auth DB or not external auth defined
         if ($this->fields["authtype"] == Auth::DB_GLPI || !Auth::useAuthExt()) {
             if (NotificationMail::isUserAddressValid($email)) {
                 $input['token'] = sha1(getRandomString(30));
                 $input['tokendate'] = $_SESSION["glpi_currenttime"];
                 $input['id'] = $this->fields['id'];
                 $this->update($input);
                 NotificationEvent::raiseEvent('passwordforget', $this);
                 echo $LANG['users'][10];
             } else {
                 echo $LANG['mailing'][110];
             }
         } else {
             echo $LANG['users'][9];
         }
     } else {
         echo $LANG['users'][8];
     }
     echo "<br>";
     echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/index.php\">" . $LANG['buttons'][13] . "</a>";
     echo "</div>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:34,代码来源:user.class.php

示例5: showUsersAssociated

 /**
  * show tooltip for user notification information
  *
  * @param $type      integer  user type
  * @param $canedit   boolean  can edit ?
  * @param $options   array    options for default values ($options of showForm)
  *
  * @return nothing display
  **/
 function showUsersAssociated($type, $canedit, array $options = array())
 {
     global $CFG_GLPI;
     $showuserlink = 0;
     if (User::canView()) {
         $showuserlink = 2;
     }
     $usericon = self::getActorIcon('user', $type);
     $user = new User();
     $linkuser = new $this->userlinkclass();
     $itemtype = $this->getType();
     $typename = self::getActorFieldNameType($type);
     $candelete = true;
     $mandatory = '';
     // For ticket templates : mandatories
     if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
         $mandatory = $options['_tickettemplate']->getMandatoryMark("_users_id_" . $typename);
         if ($options['_tickettemplate']->isMandatoryField("_users_id_" . $typename) && isset($this->users[$type]) && count($this->users[$type]) == 1) {
             $candelete = false;
         }
     }
     if (isset($this->users[$type]) && count($this->users[$type])) {
         foreach ($this->users[$type] as $d) {
             $k = $d['users_id'];
             echo "{$mandatory}{$usericon}&nbsp;";
             if ($k) {
                 $userdata = getUserName($k, 2);
             } else {
                 $email = $d['alternative_email'];
                 $userdata = "<a href='mailto:{$email}'>{$email}</a>";
             }
             if ($k) {
                 $param = array('display' => false);
                 if ($showuserlink) {
                     $param['link'] = $userdata["link"];
                 }
                 echo $userdata['name'] . "&nbsp;" . Html::showToolTip($userdata["comment"], $param);
             } else {
                 echo $userdata;
             }
             if ($CFG_GLPI['use_mailing']) {
                 $text = __('Email followup') . "&nbsp;" . Dropdown::getYesNo($d['use_notification']) . '<br>';
                 if ($d['use_notification']) {
                     $uemail = $d['alternative_email'];
                     if (empty($uemail) && $user->getFromDB($d['users_id'])) {
                         $uemail = $user->getDefaultEmail();
                     }
                     $text .= sprintf(__('%1$s: %2$s'), __('Email'), $uemail);
                     if (!NotificationMail::isUserAddressValid($uemail)) {
                         $text .= "&nbsp;<span class='red'>" . __('Invalid email address') . "</span>";
                     }
                 }
                 echo "&nbsp;";
                 if ($canedit || $d['users_id'] == Session::getLoginUserID()) {
                     $opt = array('img' => $CFG_GLPI['root_doc'] . '/pics/edit.png', 'popup' => $linkuser->getFormURL() . "?id=" . $d['id']);
                     Html::showToolTip($text, $opt);
                 }
             }
             if ($canedit && $candelete) {
                 echo "&nbsp;";
                 Html::showSimpleForm($linkuser->getFormURL(), 'delete', _x('button', 'Delete permanently'), array('id' => $d['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png");
             }
             echo "<br>";
         }
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:75,代码来源:commonitilobject.class.php

示例6: showUserNotificationForm

 /**
  * Print the object user form for notification
  *
  * @param $ID              integer ID of the item
  * @param $options   array
  *
  * @return Nothing (display)
  **/
 function showUserNotificationForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->check($ID, UPDATE);
     if (!isset($this->fields['users_id'])) {
         return false;
     }
     $item = new static::$itemtype_1();
     echo "<br><form method='post' action='" . $_SERVER['PHP_SELF'] . "'>";
     echo "<div class='center'>";
     echo "<table class='tab_cadre' width='80%'>";
     echo "<tr class='tab_bg_2'><td>" . $item->getTypeName(1) . "</td>";
     echo "<td>";
     if ($item->getFromDB($this->fields[static::getItilObjectForeignKey()])) {
         echo $item->getField('name');
     }
     echo "</td></tr>";
     $user = new User();
     $default_email = "";
     $emails = array();
     if ($user->getFromDB($this->fields["users_id"])) {
         $default_email = $user->getDefaultEmail();
         $emails = $user->getAllEmails();
     }
     echo "<tr class='tab_bg_2'><td>" . __('User') . "</td>";
     echo "<td>" . $user->getName() . "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Email Followup') . "</td>";
     echo "<td>";
     Dropdown::showYesNo('use_notification', $this->fields['use_notification']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Email') . "</td>";
     echo "<td>";
     if (count($emails) == 1 && !empty($default_email) && NotificationMail::isUserAddressValid($default_email)) {
         echo $default_email;
     } else {
         if (count($emails) > 1) {
             // Several emails : select in the list
             $emailtab = array();
             foreach ($emails as $new_email) {
                 if ($new_email != $default_email) {
                     $emailtab[$new_email] = $new_email;
                 } else {
                     $emailtab[''] = $new_email;
                 }
             }
             Dropdown::showFromArray("alternative_email", $emailtab, array('value' => $this->fields['alternative_email']));
         } else {
             echo "<input type='text' size='40' name='alternative_email' value='" . $this->fields['alternative_email'] . "'>";
         }
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='center' colspan='2'>";
     echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
     echo "<input type='hidden' name='id' value='{$ID}'>";
     echo "</td></tr>";
     echo "</table></div>";
     Html::closeForm();
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:commonitilactor.class.php

示例7: getAlternateAuthSystemsUserLogin

 /**
  * Try to get login of external auth method
  *
  * @param $authtype external auth type (default 0)
  *
  * @return boolean : user login success
  **/
 function getAlternateAuthSystemsUserLogin($authtype = 0)
 {
     global $CFG_GLPI;
     switch ($authtype) {
         case self::CAS:
             include GLPI_PHPCAS;
             phpCAS::client(CAS_VERSION_2_0, $CFG_GLPI["cas_host"], intval($CFG_GLPI["cas_port"]), $CFG_GLPI["cas_uri"], false);
             // no SSL validation for the CAS server
             phpCAS::setNoCasServerValidation();
             // force CAS authentication
             phpCAS::forceAuthentication();
             $this->user->fields['name'] = phpCAS::getUser();
             return true;
         case self::EXTERNAL:
             $ssovariable = Dropdown::getDropdownName('glpi_ssovariables', $CFG_GLPI["ssovariables_id"]);
             $login_string = '';
             // MoYo : checking REQUEST create a security hole for me !
             if (isset($_SERVER[$ssovariable])) {
                 $login_string = $_SERVER[$ssovariable];
             }
             //             else {
             //                $login_string = $_REQUEST[$ssovariable];
             //             }
             $login = $login_string;
             $pos = stripos($login_string, "\\");
             if (!$pos === false) {
                 $login = substr($login_string, $pos + 1);
             }
             if ($CFG_GLPI['existing_auth_server_field_clean_domain']) {
                 $pos = stripos($login, "@");
                 if (!$pos === false) {
                     $login = substr($login, 0, $pos);
                 }
             }
             if (self::isValidLogin($login)) {
                 $this->user->fields['name'] = $login;
                 // Get data from SSO if defined
                 $ret = $this->user->getFromSSO();
                 if (!$ret) {
                     return false;
                 }
                 return true;
             }
             break;
         case self::X509:
             // From eGroupWare  http://www.egroupware.org
             // an X.509 subject looks like:
             // CN=john.doe/OU=Department/O=Company/C=xx/Email=john@comapy.tld/L=City/
             $sslattribs = explode('/', $_SERVER['SSL_CLIENT_S_DN']);
             while ($sslattrib = next($sslattribs)) {
                 list($key, $val) = explode('=', $sslattrib);
                 $sslattributes[$key] = $val;
             }
             if (isset($sslattributes[$CFG_GLPI["x509_email_field"]]) && NotificationMail::isUserAddressValid($sslattributes[$CFG_GLPI["x509_email_field"]]) && self::isValidLogin($sslattributes[$CFG_GLPI["x509_email_field"]])) {
                 $restrict = false;
                 $CFG_GLPI["x509_ou_restrict"] = trim($CFG_GLPI["x509_ou_restrict"]);
                 if (!empty($CFG_GLPI["x509_ou_restrict"])) {
                     $split = explode('$', $CFG_GLPI["x509_ou_restrict"]);
                     if (!in_array($sslattributes['OU'], $split)) {
                         $restrict = true;
                     }
                 }
                 $CFG_GLPI["x509_o_restrict"] = trim($CFG_GLPI["x509_o_restrict"]);
                 if (!empty($CFG_GLPI["x509_o_restrict"])) {
                     $split = explode('$', $CFG_GLPI["x509_o_restrict"]);
                     if (!in_array($sslattributes['O'], $split)) {
                         $restrict = true;
                     }
                 }
                 $CFG_GLPI["x509_cn_restrict"] = trim($CFG_GLPI["x509_cn_restrict"]);
                 if (!empty($CFG_GLPI["x509_cn_restrict"])) {
                     $split = explode('$', $CFG_GLPI["x509_cn_restrict"]);
                     if (!in_array($sslattributes['CN'], $split)) {
                         $restrict = true;
                     }
                 }
                 if (!$restrict) {
                     $this->user->fields['name'] = $sslattributes[$CFG_GLPI["x509_email_field"]];
                     // Can do other things if need : only add it here
                     $this->user->fields['email'] = $this->user->fields['name'];
                     return true;
                 }
             }
             break;
     }
     return false;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:94,代码来源:auth.class.php

示例8: __

 echo __('Email followup') . '&nbsp;';
 $default_notif = true;
 if (isset($_POST['use_notification'][$user_index])) {
     $default_notif = $_POST['use_notification'][$user_index];
 }
 if (isset($_POST['alternative_email'][$user_index]) && !empty($_POST['alternative_email'][$user_index]) && empty($default_email)) {
     if (NotificationMail::isUserAddressValid($_POST['alternative_email'][$user_index])) {
         $default_email = $_POST['alternative_email'][$user_index];
     } else {
         throw new \RuntimeException('Invalid email provided!');
     }
 }
 $rand = Dropdown::showYesNo($_POST['field'] . '[use_notification][]', $default_notif);
 $email_string = '';
 // Only one email
 if (count($emails) == 1 && !empty($default_email) && NotificationMail::isUserAddressValid($default_email[$user_index])) {
     $email_string = $default_email[$user_index];
     // Clean alternative email
     echo "<input type='hidden' size='25' name='" . $_POST['field'] . "[alternative_email][]'\n             value=''>";
 } else {
     if (count($emails) > 1) {
         // Several emails : select in the list
         $emailtab = array();
         foreach ($emails as $new_email) {
             if ($new_email != $default_email) {
                 $emailtab[$new_email] = $new_email;
             } else {
                 $emailtab[''] = $new_email;
             }
         }
         $email_string = Dropdown::showFromArray($_POST['field'] . "[alternative_email][]", $emailtab, array('value' => '', 'display' => false));
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:uemailUpdate.php

示例9: define

// Purpose of file:
// ----------------------------------------------------------------------
$AJAX_INCLUDE = 1;
if (strpos($_SERVER['PHP_SELF'], "uemailUpdate.php")) {
    define('GLPI_ROOT', '..');
    include GLPI_ROOT . "/inc/includes.php";
    header("Content-Type: text/html; charset=UTF-8");
    header_nocache();
}
checkLoginUser();
// print_r($_REQUEST);
if (isset($_REQUEST['field']) && $_REQUEST["value"] > 0 || isset($_REQUEST['allow_email']) && $_REQUEST['allow_email']) {
    $user = new User();
    $email = "";
    if ($user->getFromDB($_REQUEST["value"])) {
        $email = $user->getField('email');
    }
    echo $LANG['job'][19] . '&nbsp;:&nbsp;';
    $default_notif = true;
    if (isset($_REQUEST['use_notification'])) {
        $default_notif = $_REQUEST['use_notification'];
    }
    $rand = Dropdown::showYesNo($_REQUEST['field'] . '[use_notification]', $default_notif);
    echo '<br>' . $LANG['mailing'][118] . "&nbsp;:&nbsp;";
    if (!empty($email) && NotificationMail::isUserAddressValid($email)) {
        echo $email;
    } else {
        echo "<input type='text' size='25' name='" . $_REQUEST['field'] . "[alternative_email]'\n            value='{$email}'>";
    }
}
commonDropdownUpdateItem($_POST);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:uemailUpdate.php

示例10: getOldAssignTechnicianAddress

 function getOldAssignTechnicianAddress()
 {
     global $CFG_GLPI;
     if (isset($this->options['_old_user']) && $this->options['_old_user']['type'] == CommonITILActor::ASSIGN && $this->options['_old_user']['use_notification']) {
         $user = new User();
         $user->getFromDB($this->options['_old_user']['users_id']);
         $author_email = UserEmail::getDefaultForUser($user->fields['id']);
         $author_lang = $user->fields["language"];
         $author_id = $user->fields['id'];
         if (!empty($this->options['_old_user']['alternative_email']) && $this->options['_old_user']['alternative_email'] != $author_email && NotificationMail::isUserAddressValid($this->options['_old_user']['alternative_email'])) {
             $author_email = $this->options['_old_user']['alternative_email'];
         }
         if (empty($author_lang)) {
             $author_lang = $CFG_GLPI["language"];
         }
         if (empty($author_id)) {
             $author_id = -1;
         }
         $this->addToAddressesList(array('email' => $author_email, 'language' => $author_lang, 'users_id' => $author_id));
     }
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:21,代码来源:notificationtargetcommonitilobject.class.php

示例11: NotificationMail

<?php

include "../../../inc/includes.php";
if (isset($_POST["send"])) {
    $mmail = new NotificationMail();
    $query = "SELECT email FROM glpi_useremails WHERE users_id=" . $_SESSION['glpiID'];
    if ($result = $DB->query($query)) {
        if ($DB->numrows($result) > 0) {
            $row = $DB->fetch_assoc($result);
            $mmail->From = $row['email'];
            $mmail->FromName = $row['email'];
        }
    }
    $body = str_replace("\\r", "", str_replace("\\n", "\n", $_POST['body']));
    if ($_POST['users_id_ticketmail']) {
        $address = PluginTicketmailProfile::getEmail($_POST['users_id_ticketmail']);
    } else {
        $address = $_POST["address"];
    }
    if (!NotificationMail::isUserAddressValid($address)) {
        Session::addMessageAfterRedirect(__("Invalid email address"), false, ERROR);
    }
    $mmail->AddAddress($address, $address);
    $mmail->Subject = $_POST["subject"];
    $mmail->Body = $body;
    $mmail->MessageID = "GLPI-ticketmail" . time() . "." . rand() . "@" . php_uname('n');
    if (!$mmail->Send()) {
        Session::addMessageAfterRedirect(__("Your email could not be processed.\nIf the problem persists, contact the administrator"), false, ERROR);
    } else {
        Toolbox::logInFile("mail", sprintf(__('%1$s: %2$s'), sprintf(__('An email was sent to %s'), $address), $_POST["subject"] . "\n"));
        $changes[0] = 0;
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:ticketmail.form.php

示例12: showFormMailServerConfig

 function showFormMailServerConfig()
 {
     global $LANG, $CFG_GLPI;
     echo "<div>";
     echo "<form action='" . getItemTypeFormURL(__CLASS__) . "' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['setup'][704] . "</th></tr>";
     echo "<tr class='tab_bg_2'><td>" . $LANG['setup'][202] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("use_mailing", $CFG_GLPI["use_mailing"]);
     echo "</td>";
     if ($CFG_GLPI['use_mailing']) {
         echo "<td >" . $LANG['setup'][227] . "&nbsp;:</td>";
         echo "<td><input type='text' name='url_base' size='40' value='" . $CFG_GLPI["url_base"] . "'>";
         echo "</td></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . $LANG['setup'][203] . "&nbsp;:</td>";
         echo "<td><input type='text' name='admin_email' size='40' value='" . $CFG_GLPI["admin_email"] . "'>";
         if (!NotificationMail::isUserAddressValid($CFG_GLPI["admin_email"])) {
             echo "<span class='red'>&nbsp;" . $LANG['mailing'][110] . "</span>";
         }
         echo "</td>";
         echo "<td >" . $LANG['setup'][208] . "&nbsp;:</td>";
         echo "<td><input type='text' name='admin_email_name' size='40' value='" . $CFG_GLPI["admin_email_name"] . "'>";
         echo " </td></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td >" . $LANG['setup'][207] . "&nbsp;:</td>";
         echo "<td><input type='text' name='admin_reply' size='40' value='" . $CFG_GLPI["admin_reply"] . "'>";
         if (!NotificationMail::isUserAddressValid($CFG_GLPI["admin_reply"])) {
             echo "<span class='red'>&nbsp;" . $LANG['mailing'][110] . "</span>";
         }
         echo " </td>";
         echo "<td >" . $LANG['setup'][209] . "&nbsp;:</td>";
         echo "<td><input type='text' name='admin_reply_name' size='40' value='" . $CFG_GLPI["admin_reply_name"] . "'>";
         echo " </td></tr>";
         if (!function_exists('mail')) {
             echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
             echo "<span class='red'>" . $LANG['setup'][217] . "&nbsp;:</span>" . $LANG['setup'][218] . "</td></tr>";
         }
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . $LANG['setup'][204] . "&nbsp;:</td>";
         echo "<td colspan='3'><textarea cols='60' rows='3' name='mailing_signature'>" . $CFG_GLPI["mailing_signature"] . "</textarea></td></tr>";
         echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['setup'][660] . "</th></tr>";
         echo "<tr class='tab_bg_2'><td>" . $LANG['setup'][231] . "&nbsp;:</td><td>";
         $mail_methods = array(MAIL_MAIL => $LANG['setup'][650], MAIL_SMTP => $LANG['setup'][651], MAIL_SMTPSSL => $LANG['setup'][652], MAIL_SMTPTLS => $LANG['setup'][653]);
         Dropdown::showFromArray("smtp_mode", $mail_methods, array('value' => $CFG_GLPI["smtp_mode"]));
         echo "</td><td colspan='2' class='center'>";
         echo "<input class='submit' type='submit' name='test_smtp_send' value=\"" . $LANG['setup'][229] . "\">";
         echo "</td></tr>";
         echo "<tr class='tab_bg_2'><td >" . $LANG['setup'][232] . "&nbsp;:</td>";
         echo "<td><input type='text' name='smtp_host' size='40' value='" . $CFG_GLPI["smtp_host"] . "'>";
         echo "</td>";
         echo "<td >" . $LANG['setup'][234] . "&nbsp;:</td>";
         echo "<td><input type='text' name='smtp_username' size='40' value='" . $CFG_GLPI["smtp_username"] . "'></td></tr>";
         echo "<tr class='tab_bg_2'><td >" . $LANG['setup'][175] . "&nbsp;:</td>";
         echo "<td><input type='text' name='smtp_port' size='5' value='" . $CFG_GLPI["smtp_port"] . "'>";
         echo "</td>";
         echo "<td >" . $LANG['setup'][235] . "&nbsp;:</td>";
         echo "<td><input type='password' name='smtp_passwd' size='40' value='' autocomplete='off'>";
         echo "</td></tr>";
     } else {
         echo "</tr>";
     }
     $options['candel'] = false;
     $this->showFormButtons($options);
     /*
           echo "<tr class='tab_bg_2'><td class='center' colspan='4'>";
           echo "<input class='submit' type='submit' name='update' value='".$LANG['buttons'][2]."'>";
           echo "</td></tr>";
           echo "</table></form>";*/
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:71,代码来源:notificationmailsetting.class.php

示例13: showForm

 /**
  * Print the ticket user form for notification
  *
  * @param $ID integer ID of the item
  * @param $options array
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $this->check($ID, 'w');
     echo "<br><form method='post' action='" . $CFG_GLPI['root_doc'] . "/front/popup.php'>";
     echo "<div class='center'>";
     echo "<table class='tab_cadre'>";
     echo "<tr class='tab_bg_2'><td>" . $LANG['job'][38] . "&nbsp;:</td>";
     echo "<td>";
     $ticket = new Ticket();
     if ($ticket->getFromDB($this->fields["tickets_id"])) {
         echo $ticket->getField('name');
     }
     echo "</td></tr>";
     $user = new User();
     $email = "";
     if ($user->getFromDB($this->fields["users_id"])) {
         $email = $user->getField('email');
     }
     echo "<tr class='tab_bg_2'><td>" . $LANG['common'][34] . "&nbsp;:</td>";
     echo "<td>" . $user->getName() . "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['job'][19] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showYesNo('use_notification', $this->fields['use_notification']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][118] . "&nbsp;:</td>";
     echo "<td>";
     if (!empty($email) && NotificationMail::isUserAddressValid($email)) {
         echo $email;
     } else {
         echo "<input type='text' size='40' name='alternative_email' value='" . $this->fields['alternative_email'] . "'>";
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='center' colspan='2'>";
     echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
     echo "<input type='hidden' name='id' value='{$ID}'>";
     echo "</td></tr>";
     echo "</table></div></form>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:48,代码来源:ticket_user.class.php

示例14: getAlternateAuthSystemsUserLogin

 /**
  * Try to get login of external auth method
  *
  * @param $authtype extenral auth type
  *
  * @return boolean : user login success
  **/
 function getAlternateAuthSystemsUserLogin($authtype = 0)
 {
     global $CFG_GLPI;
     switch ($authtype) {
         case self::CAS:
             include GLPI_PHPCAS;
             phpCAS::client(CAS_VERSION_2_0, $CFG_GLPI["cas_host"], intval($CFG_GLPI["cas_port"]), $CFG_GLPI["cas_uri"], false);
             // no SSL validation for the CAS server
             phpCAS::setNoCasServerValidation();
             // force CAS authentication
             phpCAS::forceAuthentication();
             $this->user->fields['name'] = phpCAS::getUser();
             return true;
         case self::EXTERNAL:
             $login_string = $_SERVER[$CFG_GLPI["existing_auth_server_field"]];
             $login = $login_string;
             $pos = stripos($login_string, "\\");
             if (!$pos === false) {
                 $login = substr($login_string, $pos + 1);
             }
             if ($CFG_GLPI['existing_auth_server_field_clean_domain']) {
                 $pos = stripos($login, "@");
                 if (!$pos === false) {
                     $login = substr($login, 0, $pos);
                 }
             }
             if (isValidLogin($login)) {
                 $this->user->fields['name'] = $login;
                 return true;
             }
             break;
         case self::X509:
             // From eGroupWare  http://www.egroupware.org
             // an X.509 subject looks like:
             // CN=john.doe/OU=Department/O=Company/C=xx/Email=john@comapy.tld/L=City/
             $sslattribs = explode('/', $_SERVER['SSL_CLIENT_S_DN']);
             while ($sslattrib = next($sslattribs)) {
                 list($key, $val) = explode('=', $sslattrib);
                 $sslattributes[$key] = $val;
             }
             if (isset($sslattributes[$CFG_GLPI["x509_email_field"]]) && NotificationMail::isUserAddressValid($sslattributes[$CFG_GLPI["x509_email_field"]]) && isValidLogin($sslattributes[$CFG_GLPI["x509_email_field"]])) {
                 $this->user->fields['name'] = $sslattributes[$CFG_GLPI["x509_email_field"]];
                 // Can do other things if need : only add it here
                 $this->user->fields['email'] = $this->user->fields['name'];
                 return true;
             }
             break;
     }
     return false;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:57,代码来源:auth.class.php

示例15: NotificationMailSetting

the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("config", UPDATE);
$notificationmail = new NotificationMailSetting();
if (!empty($_POST["test_smtp_send"])) {
    NotificationMail::testNotification();
    Html::back();
} else {
    if (!empty($_POST["update"])) {
        $config = new Config();
        $config->update($_POST);
        Html::back();
    }
}
Html::header(Notification::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "config", "notification", "config");
$notificationmail->display(array('id' => 1));
Html::footer();
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:notificationmailsetting.form.php


注:本文中的NotificationMail类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。