BUGFIX: vacation was set even when no date was entered
[e-DoKo.git] / include / functions.php
index 0fec81ebc563e28513911a59378d846b073063b7..7141ec75c86236389a668a33539d870ed0a6fdc8 100644 (file)
@@ -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 "<span class=\"error\">".htmlspecialchars($message)."</span>\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 "    <br />\n";
       echo "    <span title=\"local time: ".date("Y-m-d H:i:s",$timenow).  " ".
-                            "last login: ".date("Y-m-d H:i:s",$lastlogin)."\">time info</span>\n";
+                            "last login: ".date("Y-m-d H:i:s",$lastlogin)."\">".
+                            "<img src=\"pics/button/time-info.png\" class=\"button\" alt-\"time info\" />".
+                            "</span>\n";
       echo "   </div>\n";
 
     }