diff -ruN --exclude=CVS pontomail/IMAPService.inc /var/www/www.thaigrid.net/drupal/modules/pontomail/IMAPService.inc --- pontomail/IMAPService.inc 2006-01-08 13:14:18.000000000 +0700 +++ /var/www/www.thaigrid.net/drupal/modules/pontomail/IMAPService.inc 2006-03-27 15:25:42.000000000 +0700 @@ -5,13 +5,13 @@ */ class IMAPService { - private $mbox = NULL; - private $server; - private $port; - private $open = FALSE; - private $mbox_string = ""; - private $full_con_str = ""; - private $base_con_str = ""; + var $mbox = NULL; + var $server; + var $port; + var $open = FALSE; + var $mbox_string = ""; + var $full_con_str = ""; + var $base_con_str = ""; function connect($service_addr, $port, $user_name, $pass, $folder = "", $box_options) { $this->server = $service_addr; @@ -56,6 +56,7 @@ function get_mbox_status() { $folders = $this->get_subscriptions(); + $ans = array(); foreach($folders as $k => $finfo) { $temp = split('}', $finfo->name); $folder = $temp[1]; @@ -78,11 +79,17 @@ function get_folders($filter = "*") { $folders = imap_getmailboxes($this->mbox, '{' . $this->server .':' . $this->port . '}', $filter); + if (!$folders) { + $folders = array(); + } return $folders; } function get_subscriptions($filter = "*") { $folders = imap_getsubscribed($this->mbox, '{' . $this->server .':' . $this->port . '}', $filter); + if (!$folders) { + $folders = $this->get_folders($filter); + } return $folders; } @@ -183,8 +190,8 @@ if(!$parts->parts) { return; } - $base_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; - $replace_url = url('/pontomail/' . arg(1) . '/' . arg(2) + $base_url = ''; + $replace_url = url('pontomail/' . arg(1) . '/' . arg(2) . '/' . arg(3) . '/' . arg(4) . '/' . arg(5)); foreach($parts->parts as $key => $part) { if(strtoupper($part->disposition) == "ATTACHMENT" || $this->mime_type_check($part->type, $part->subtype)) { @@ -449,7 +456,7 @@ return; } - static function get_folder_name($folder){ + function get_folder_name($folder){ $temp = split('}', $folder); return $temp[1]; } diff -ruN --exclude=CVS pontomail/pontomail.module /var/www/www.thaigrid.net/drupal/modules/pontomail/pontomail.module --- pontomail/pontomail.module 2006-01-08 13:21:01.000000000 +0700 +++ /var/www/www.thaigrid.net/drupal/modules/pontomail/pontomail.module 2006-03-22 14:07:05.000000000 +0700 @@ -95,7 +95,7 @@ * @return array An array of valid permissions for the pontomail module. */ function pontomail_perm() { - return array('setup email'); + return array('setup email', 'administer pontomail'); } // funtion pontomail_perm /** @@ -133,7 +133,7 @@ function pontomail_settings() { // Only Administrators can access this module if(!user_access('administer pontomail')) { - return message_access(); + return drupal_access_denied(); } // Return the settings for the mail system. $form = NULL; @@ -540,7 +540,7 @@ $no_tls = $account['no_tls']; $validate_cert = $account['validate_cert']; - $try = db_queryd("INSERT INTO {pontomail_servers} (uid, server_name, server_address, server_port, + $try = db_query("INSERT INTO {pontomail_servers} (uid, server_name, server_address, server_port, server_type, user, password, secure, con_ssl, no_tls, validate_cert) VALUES(%d, '%s', '%s', '%d', '%s', '%s', '%s', '%d', '%d', '%d', '%d')",