home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / radar.php < prev    next >
Encoding:
PHP Script  |  2004-01-03  |  2.8 KB  |  92 lines

  1. <?php
  2. /////////////////////////////////////////////////////////
  3. //    
  4. //    source/radar.php
  5. //
  6. //    (C)Copyright 2000-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  7. //
  8. //        This file is part of IlohaMail.
  9. //        IlohaMail is free software released under the GPL 
  10. //        license.  See enclosed file COPYING for details,
  11. //        or see http://www.fsf.org/copyleft/gpl.html
  12. //
  13. /////////////////////////////////////////////////////////
  14.  
  15. /********************************************************
  16.  
  17.     AUTHOR: Ryo Chijiiwa <ryo@ilohamail.org>
  18.     FILE: source/radar.php
  19.     PURPOSE:
  20.         Periodically reload and check if there are any RECENT messages in INBOX.
  21.         If there are messages, display and icon and stop reloading.
  22.         Otherwise, schedule another check a couple of minutes later.
  23.     PRE-CONDITIONS:
  24.         $user - Session ID
  25.     COMMENTS:
  26.         You might want to deactivate this feature if you expect large numbers of simultaneous
  27.         users.  This page could potentially bombard your server (both HTTP and IMAP).
  28.  
  29. ********************************************************/
  30. include("../include/super2global.inc");
  31. include("../include/nocache.inc");
  32.  
  33. if (isset($user)){
  34.     include("../include/session_auth.inc");
  35.     include("../include/icl.inc");
  36.  
  37.     if ($ICL_CAPABILITY["radar"]){
  38.         $recent=iil_CheckForRecent($host, $loginID, $password, "INBOX");
  39.         $interval = $my_prefs["radar_interval"];
  40.         if ($interval < $MIN_RADAR_REFRESH) $interval = $MIN_RADAR_REFRESH;
  41.         if ($recent==0){
  42.             $output ="<script language=\"JavaScript\">\n";
  43.             $output.="setTimeout('location=\"radar.php?user=$user\"',".$interval."000);\n";
  44.             $output.="</script>\n";
  45.         }else if ($recent > 0){
  46.             $output = "<img src=\"themes/".$my_prefs["theme"]."/images/inbox.GIF\">\n";
  47.         }
  48.     }
  49.     
  50.     $linkc=$my_colors["tool_link"];
  51.     $bgc=$my_colors["tool_bg"];
  52.     
  53.     //determine email address
  54.     if (empty($my_prefs["email_address"])){
  55.         if (empty($init_from_address))
  56.             $title = $loginID.( strpos($loginID, "@")>0 ? "":"@".$host );
  57.         else
  58.             $title = str_replace("%u", $loginID, str_replace("%h", $host, $init_from_address));
  59.     }else{
  60.         $title = $my_prefs["email_address"];
  61.     }
  62.     
  63.     
  64.     echo "<HTML>\n<HEAD>\n";
  65.     echo "<script type=text/javascript>\n";
  66.     echo "function refresh(){ location=\"radar.php?user=$user\"; }\n";
  67.     //$title = $loginID.(strpos($loginID,"@")===false?"@".$host:"");
  68.     if ($recent > 0) $title="(!)".$title;
  69.     ?>
  70.         var _p = this.parent;
  71.         while (_p != this) {
  72.             if (_p == _p.parent) { break; }
  73.             _p = _p.parent;
  74.         }
  75.         _p.document.title = "<?php echo $title?>";
  76.     <?php
  77.     echo "</script>\n";
  78.     echo "</HEAD>\n";
  79.     echo '<BODY BGCOLOR="'.$bgc.'">';
  80.     echo "\n";
  81.     
  82.     echo  "<!--\n";
  83.     echo "last check: ".date("M d Y H:i:s", time())."\n";
  84.     echo "Result was: ".$recent."\n";
  85.     echo "Session: $user \n";
  86.     echo "ICL_SSL: $ICL_SSL\nICL_PORT: $ICL_PORT\n";
  87.     echo "-->\n";
  88.     
  89.     echo $output;
  90. }
  91. ?>
  92. </BODY></HTML>