예제 #1
0
파일: Mail.php 프로젝트: csev/tsugi-php
 public static function send($to, $subject, $message, $id, $token)
 {
     global $CFG;
     if (!isset($CFG->maildomain) || $CFG->maildomain === false) {
         return;
     }
     if (isset($CFG->maileol) && isset($CFG->wwwroot) && isset($CFG->maildomain)) {
         // All good
     } else {
         die_with_error_log("Incomplete mail configuration in mailSend");
     }
     if (strlen($to) < 1 || strlen($subject) < 1 || strlen($id) < 1 || strlen($token) < 1) {
         return false;
     }
     $EOL = $CFG->maileol;
     $maildomain = $CFG->maildomain;
     $manage = $CFG->wwwroot . "/profile.php";
     $unsubscribe_url = Output::getUtilUrl("/unsubscribe.php?id={$id}&token={$token}");
     $msg = $message;
     if (substr($msg, -1) != "\n") {
         $msg .= "\n";
     }
     // $msg .= "\nYou can manage your mail preferences at $manage \n";
     // TODO: Make unsubscribe work
     // echo $msg;
     $headers = "From: no-reply@{$maildomain}" . $EOL . "Return-Path: <bounced-{$id}-{$token}@{$maildomain}>" . $EOL . "List-Unsubscribe: <{$unsubscribe_url}>" . $EOL . 'X-Mailer: PHP/' . phpversion();
     error_log("Mail to: {$to} {$subject}");
     // echo $headers;
     return mail($to, $subject, $msg, $headers);
 }
예제 #2
0
파일: BlobUtil.php 프로젝트: csev/tsugi-php
 public static function getAccessUrlForBlob($blob_id, $serv_file = false)
 {
     global $CFG;
     if ($serv_file !== false) {
         return $serv_file . '?id=' . $blob_id;
     }
     $url = Output::getUtilUrl('/blob_serve.php?id=' . $blob_id);
     return $url;
 }
예제 #3
0
파일: LTIX.php 프로젝트: csev/tsugi-php
 /**
  * getLaunchData - Get the launch data for am LTI ContentItem launch
  */
 public static function getLaunchUrl($endpoint, $debug = false)
 {
     $launchurl = Output::getUtilUrl('/launch.php?debug=');
     $launchurl .= $debug ? '1' : '0';
     $launchurl .= '&endpoint=';
     $launchurl .= urlencode($endpoint);
     return $launchurl;
 }