示例#1
0
 function sendFeedback()
 {
     global $Controller, $USER, $SITE;
     $_POST->setType('feedback', 'string');
     $_POST->setType('description', 'string');
     $report = '<h1>Feedback report</h1><p><b>Generated report from ' . $SITE->Name . ' user feedback form.</b></p>
         <table width="100%" border="1" cellspacing="0" cellpadding="5"><tbody>' . '<tr><td>' . __('Feedback') . '</td><td>' . $_POST['feedback'] . '</td></tr>' . '<tr><td>' . __('Description') . '</td><td>' . $_POST['description'] . '</td></tr>' . '<tr><td>' . __('Page') . '</td><td>' . $_SERVER['HTTP_REFERER'] . '</td></tr>' . '<tr><td>' . __('User') . '</td><td>' . $USER . ' (' . $USER->getEmail() . ')' . '</td></tr>' . '<tr><td>' . __('User agent') . '</td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>' . '</tbody></table>';
     $Controller->{(string) ADMIN_GROUP}(OVERRIDE)->mail(MailTools::template($report), MailTools::headers("Yweb" . ' <*****@*****.**>', "Yweb Feedback Report"));
 }
示例#2
0
文件: CronTask.php 项目: arhe/pwak
 /**
  * Error handler personalisé.
  * Intercepte les erreurs et envoie un mail à dev@.
  *
  * @static
  * @access public
  * @param const $errno
  * @param string $errstr
  * @param string $errfile
  * @param int $errline
  * @return boolean
  */
 public static function errorHandler($errno, $errstr, $errfile, $errline)
 {
     if (!error_reporting()) {
         // ne rien faire quand error_reporting() vaut 0, c'est le cas
         // notamment pour les appels avec l'opérateur @
         return true;
     }
     switch ($errno) {
         case E_ERROR:
         case E_USER_ERROR:
             $errtype = 'FATAL ERROR';
             break;
         case E_WARNING:
         case E_USER_WARNING:
             $errtype = 'WARNING';
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $errtype = 'NOTICE';
             break;
         case E_STRICT:
             return true;
         default:
             $errtype = 'UNKNOWN ERROR';
     }
     $db = Database::connection()->database;
     $subj = sprintf(_('[Scheduled task] %s on database "%s"'), $errtype, $db);
     $body = sprintf(_("A PHP error occured on database \"%s\":\n[%s] %s in %s on line %s."), $db, $errtype, $errstr, $errfile, $errline);
     if ($errtype == 'FATAL ERROR') {
         $body .= _("\nScheduled tasks execution aborted.");
     }
     $logger = Tools::loggerFactory();
     $logger->log($body, PEAR_LOG_ALERT);
     MailTools::send(array(MAIL_DEV), $subj, $body);
     return true;
 }
示例#3
0
            foreach ($Recipients as $Recipient) {
                if (in_array($Recipient, $sent_to)) {
                    continue;
                }
                $sent_to[] = $Recipient;
                $Recipient = $Controller->get($Recipient, OVERRIDE, false, false);
                if (!is_object($Recipient) || !is_a($Recipient, 'User')) {
                    continue;
                }
                if (!$Message['override_membercheck'] && !$Recipient->isActive()) {
                    continue;
                }
                $namn['full'] = @$Recipient->userinfo['cn'];
                $namn['first'] = @$Recipient->userinfo['givenName'];
                $namn['sur'] = @$Recipient->userinfo['sn'];
                $msg = str_replace(array('{name}', '{firstname}', '{surname}'), array($namn['full'], $namn['first'], $namn['sur']), $Message['message']);
                $text = html_entity_decode(strip_tags(preg_replace('#<(p|br|/p)[^>]*>#i', "\n", $msg)), ENT_COMPAT, 'UTF-8');
                $hdrs = array();
                if ($Sender = $Controller->{(string) $Message['from']}(OVERRIDE)) {
                    $hdrs['From'] = $Sender . ' <' . ($Sender->getEmail() ? $Sender->getEmail() : $CONFIG->Mail->Sender_email) . '>';
                }
                $hdrs['Subject'] = $Message['subject'];
                $Recipient->mail(MailTools::template($msg), $hdrs, $text);
                //echo ++$i.": ".$Recipient.", ".memory_get_usage()."\n";
                $Recipient = false;
            }
        }
    } catch (Exception $e) {
    }
    $DB->massmail->update(array('#!sent' => 'UNIX_TIMESTAMP()'), array('msg_id' => $Message['msg_id']));
}
示例#4
0
 public function assignJob($assignTo, $assignedBy)
 {
     try {
         SweteDb::q("start transaction");
         $res = SweteDb::q("insert into job_assignments (job_id, assigned_to, assigned_by, date_assigned) values \n\t\t\t(\n\t\t\t\t'" . addslashes($this->_rec->val('job_id')) . "',\n\t\t\t\t'" . addslashes($assignTo) . "',\n\t\t\t\t'" . addslashes($assignedBy) . "',\n\t\t\t\t'" . addslashes(date('Y-m-d H:i:s')) . "'\n\t\t\t)");
         SweteDb::q("update jobs set assigned_to='" . addslashes($assignTo) . "' where job_id='" . addslashes($this->_rec->val('job_id')) . "'");
         SweteDb::q("commit");
     } catch (Exception $ex) {
         SweteDb::q("rollback");
         throw $ex;
     }
     //notify the user that the job was assigned to them
     $res = SweteDb::q("select * from users where username ='******'");
     $userRec = null;
     if (mysql_num_rows($res) > 0) {
         $userRec = mysql_fetch_assoc($res);
     }
     @mysql_free_result($res);
     if ($userRec == null) {
         throw new Exception("Failed to retrieve user info for email notification. Username [{$assignTo}]");
     }
     $jobId = $this->_rec->val('job_id');
     require_once 'inc/MailTools.php';
     MailTools::sendMail($userRec['email'], 'Job ' . $jobId . ' has been assigned to you.', "Attention {$assignTo} : \n\nTranslation Job {$jobId} (created by " . $this->_rec->val('posted_by') . " on " . $this->_rec->getValueAsString('date_created') . ") has been assigned to you by {$assignedBy}.");
 }