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 / icl.inc < prev    next >
Encoding:
Text File  |  2003-09-04  |  1.8 KB  |  69 lines

  1. <?php
  2. /********************************************************
  3.     include/icl.inc
  4.     
  5.     (C)Ryo Chijiiwa <Ryo@IlohaMail.org> 2002 
  6.  
  7.     This file is part of IlohaMail, and released under GPL.
  8.     See COPYING, or http://www.fsf.org/copyleft/gpl.html
  9.     
  10.     PURPOSE:
  11.         IlohaMail Client Library.  Load imap.inc or pop3.inc
  12.     COMMENTS:
  13.         Assumes $host to be in the format:
  14.         [protocol/]host[:port]
  15.         Where protocol is one of {pop,imap,imaps}
  16.         and port is a valid port number.
  17.  
  18. ********************************************************/
  19.  
  20. if (!isset($port)) $port = 143;
  21.  
  22. //look for ':', if there, port number follows
  23. $colon_pos = strpos($host, ":");
  24. if ($colon_pos!==false){
  25.     $port = substr($host, $colon_pos+1);
  26.     $host = substr($host, 0, $colon_pos);
  27. }else if (empty($port)){
  28.     //no port, default to 143 for IMAP
  29.     $port = 143;
  30. }
  31.  
  32. //look for '/', split protocol and port
  33. $slash_pos = strpos($host, "/");
  34. if ($slash_pos!==false){
  35.     $protocol = strtoupper(substr($host, 0, $slash_pos));
  36.     $host = substr($host, $slash_pos + 1);
  37. }else{
  38.     //no protocol, guess from port #
  39.     if ($port==110) $protocol = "POP3";
  40.     else if ($port==143) $protocol = "IMAP";
  41.     else if ($port==993) $protocol = "IMAPS";
  42. }
  43. $ICL_PORT = $port;
  44.  
  45. //little hack for IMAP-SSL
  46. if ($protocol=="IMAPS"){
  47.     $protocol = "IMAP";
  48.     $ICL_SSL = true;
  49. }else{
  50.     $ICL_SSL = false;
  51. }
  52.  
  53. if ($protocol=="IMAP"){
  54.     $ICL_CAPABILITY["folders"] = true;
  55.     $ICL_CAPABILITY["search"] = true;
  56.     $ICL_CAPABILITY["radar"] = true;
  57.     $ICL_CAPABILITY["calendar"] = true;
  58.     $ICL_CAPABILITY["flags"] = true;
  59.     include("../include/imap.inc");
  60. }else if ($protocol=="POP3"){
  61.     $ICL_CAPABILITY["folders"] = false;
  62.     $ICL_CAPABILITY["search"] = false;
  63.     $ICL_CAPABILITY["radar"] = false;
  64.     $ICL_CAPABILITY["calendar"] = true;
  65.     $ICL_CAPABILITY["flags"] = false;
  66.     include("../include/pop3.inc");
  67. }
  68.  
  69. ?>