Beispiel #1
0
 /**
  * send email notfications for uploading
  *
  * @param string $path   the path to set
  * @param string $action may be "download" | "upload" | "newdir" | "login"
  *
  * @return $message
  */
 public static function emailNotification($path, $action = false)
 {
     global $encodeExplorer;
     $path = Utils::normalizeStr($path);
     if (strlen(SetUp::getConfig('upload_email')) > 5) {
         $time = SetUp::formatModTime(time());
         $appname = SetUp::getConfig('appname');
         switch ($action) {
             case "download":
                 $title = $encodeExplorer->getString("new_download");
                 break;
             case "upload":
                 $title = $encodeExplorer->getString("new_upload");
                 break;
             case "newdir":
                 $title = $encodeExplorer->getString("new_directory");
                 break;
             case "login":
                 $title = $encodeExplorer->getString("new_access");
                 break;
             default:
                 $title = $encodeExplorer->getString("new_activity");
                 break;
         }
         $message = $time . "\n\n";
         $message .= "IP   : " . $_SERVER['REMOTE_ADDR'] . "\n";
         $message .= $encodeExplorer->getString("user") . " : " . GateKeeper::getUserInfo('name') . "\n";
         $message .= $encodeExplorer->getString("path") . " : " . $path . "\n";
         // send to multiple recipients
         // $sendTo = SetUp::getConfig('upload_email').",cc1@example.com,cc2@example.com";
         $sendTo = SetUp::getConfig('upload_email');
         mail($sendTo, $title, $message, "Content-type: text/plain; charset=UTF-8\r\n" . "From: " . $appname . " <noreply@{$_SERVER['SERVER_NAME']}>\r\n" . "Reply-To: " . $appname . " <noreply@{$_SERVER['SERVER_NAME']}>");
     }
 }