X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=7141ec75c86236389a668a33539d870ed0a6fdc8;hp=0fec81ebc563e28513911a59378d846b073063b7;hb=397a0a16021c28327d45568637cbcc7c05c1c27d;hpb=5edd63b115fe7712c6e220fc6a0b78dbace4f3cd diff --git a/include/functions.php b/include/functions.php index 0fec81e..7141ec7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -54,10 +54,49 @@ function config_check() return; } -function mymail($To,$Subject,$message,$header="") +function mymail($uid,$subject,$message) { + global $EmailName; + + /* check if user wants email right away or if we should save it in + * the database for later delivery + */ + if(0) + { + /* send to database (not yet implemented)*/ + } + else + { + /* send email right away */ + + /* add standard header and footer */ + $subject = "$EmailName".$subject; + + /* standard greeting */ + $header = "Hello ...\n\n"; + + /* and standard goodbye */ + $footer = "\n\nHave a nice day\n". + " your E-Doko service department\n\n". + "-- \n". + "You can change your mail delivery mode in the preference menu.\n". + 'web: http://doko.nubati.net '. + 'help: http://wiki.nubati.net/EmailDoko '. + 'bugs: http://wiki.nubati.net/EmailDokoIssues'; + + $To = DB_get_email('userid',$uid); + + sendmail($To,$subject,$header.$message.$footer); + } +} + +function sendmail($To,$Subject,$message) +{ + /* this function sends the mail or outputs to the screen in case of debugging */ global $debug,$EMAIL_REPLY; + $header = ""; + if(isset($EMAIL_REPLY)) $header .= "From: e-DoKo daemon <$EMAIL_REPLY>\r\n"; @@ -104,7 +143,7 @@ function myisset() function myerror($message) { echo "".htmlspecialchars($message)."\n"; - mymail($ADMIN_EMAIL,$EmailName." Error in Code",$message); + sendmail($ADMIN_EMAIL,$EmailName." Error in Code",$message); return; } @@ -881,7 +920,9 @@ function display_table () echo "
\n"; echo " time info\n"; + "last login: ".date("Y-m-d H:i:s",$lastlogin)."\">". + "". + "\n"; echo " \n"; }