Index: trunk/expressoMail1_2/index.php
===================================================================
--- trunk/expressoMail1_2/index.php	(revision 5295)
+++ trunk/expressoMail1_2/index.php	(revision 5316)
@@ -169,6 +169,6 @@
 	$template->set_var("msg_number",$_GET['msgball']['msgnum'] ? $_GET['msgball']['msgnum'] : $_GET['to']);
 	$template->set_var("user_email",$_SESSION['phpgw_info']['expressomail']['user']['email']);
-	include_once $_SESSION['rootPath'] . '/header.inc.php';
-	require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+	include_once dirname(__FILE__) . '/../header.inc.php';
+	require_once dirname(__FILE__) . '/../API/class.servicelocator.php';
 	$alternativeMailService = ServiceLocator::getService('ldap');
 	$AlternateEmailExpresso = Array();
Index: trunk/expressoMail1_2/inc/class.db_functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.db_functions.inc.php	(revision 5134)
+++ trunk/expressoMail1_2/inc/class.db_functions.inc.php	(revision 5316)
@@ -369,5 +369,5 @@
             if($msg_number != null && $msg_part != null && $msg_folder != null && (intval($idx_file == '0' ? '1' : $idx_file)))
             {
-                require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+                require_once dirname(__FILE__).'/class.attachment.inc.php';
                 $attachmentObj = new attachment();
                 $attachmentObj->setStructureFromMail($msg_folder,$msg_number);
Index: trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 5309)
+++ trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 5316)
@@ -274,5 +274,5 @@
 		$to = $header->to;
 		$head_array['to'] = array();
-		if(isset($to[1]) && $to[1]->host == ".SYNTAX-ERROR.") { //E-mails que não possuem o campo "para", vêm com o recipiente preenchido, porém com um recipiente a mais alegando erro de sintaxe.
+		if(isset($to[1]) && isset($to[1]->host) && $to[1]->host == ".SYNTAX-ERROR.") { //E-mails que não possuem o campo "para", vêm com o recipiente preenchido, porém com um recipiente a mais alegando erro de sintaxe.
 			$head_array['to']['name'] = $head_array['to']['email'] = NULL;
 		}
@@ -935,5 +935,5 @@
     {
         $return = array();
-        require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+        require_once dirname(__FILE__).'/class.attachment.inc.php';
 	
         $atObj = new attachment();
@@ -1322,7 +1322,7 @@
              * Requires of librarys
              */
-            require_once $_SESSION['rootPath'].'/library/mime/mimePart.php';
-            require_once $_SESSION['rootPath'].'/library/mime/mimeDecode.php';
-            require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+            require_once dirname(__FILE__).'/../../library/mime/mimePart.php';
+            require_once dirname(__FILE__).'/../../library/mime/mimeDecode.php';
+            require_once dirname(__FILE__).'/class.attachment.inc.php';
             //include_once("class.message_components.inc.php");
             //--------------------------------------------------------------------//
@@ -1533,6 +1533,6 @@
 
                     case 'REPLY':
-                          include_once($_SESSION['rootPath'].'/header.inc.php');
-                          include_once($_SESSION['rootPath'].'/calendar/inc/class.boicalendar.inc.php');
+                          include_once(dirname(__FILE__).'/../../header.inc.php');
+                          include_once(dirname(__FILE__).'/../../calendar/inc/class.boicalendar.inc.php');
                           $boicalendar = new boicalendar();
 
@@ -2064,8 +2064,8 @@
 		if (!count($images)) return '';
                
-		foreach ($images as $key => $value) { 
+		foreach ($images as $key => $value) {                    
 			$images[$key]['width']  = 160; 
 			$images[$key]['height'] = 120; 
-			$images[$key]['url']    = "inc/get_archive.php?msgFolder=".$msg_folder."&msgNumber=".$msg_number."&indexPart=".$image['pid']."&image=true"; 
+			$images[$key]['url']    = "inc/get_archive.php?msgFolder=".$msg_folder."&msgNumber=".$msg_number."&indexPart=".$value['pid']."&image=true"; 
     		}
 
@@ -2570,5 +2570,5 @@
 	function send_mail($params)
 	{
-		require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+		require_once dirname(__FILE__) . '/../../API/class.servicelocator.php';
 		$mailService = ServiceLocator::getService('mail');
 
@@ -3299,5 +3299,5 @@
 	function get_forwarding_attachment($msg_folder, $msg_number, $msg_part, $encoding)
 	{
-            include_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+            include_once dirname(__FILE__).'/class.attachment.inc.php';
             $attachment = new attachment();
 			$attachment->decodeConf['rfc_822bodies'] = true; //Forçar a não decodificação de mensagens em anexo.
@@ -3308,5 +3308,5 @@
         function get_forwarding_attachment2($msg_folder, $msg_number, $msg_part, $encoding)
 	{
-            include_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+            include_once dirname(__FILE__).'/class.attachment.inc.php';
             $attachment = new attachment();
             $attachment->setStructureFromMail($msg_folder, $msg_number);
@@ -3663,5 +3663,5 @@
 	{
 	
-		require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+		require_oncedirname(__FILE__) . '/../../API/class.servicelocator.php';
 		$mailService = ServiceLocator::getService('mail');
 
@@ -4959,5 +4959,5 @@
         	fputs($f,base64_encode($source));
             fclose($f);
-            $command = "python ".$_SESSION['rootPath']."/expressoMail1_2/imap.py \"$imap_server\" \"$imap_port\" \"$username\" \"$password\" \"$timestamp\" \"$folder\" \"$file\"";
+            $command = "python ".dirname(__FILE__)."/../imap.py \"$imap_server\" \"$imap_port\" \"$username\" \"$password\" \"$timestamp\" \"$folder\" \"$file\"";
             $return['command']= exec($command);
         }else{
@@ -5129,5 +5129,5 @@
  		                "$msg_user</body><br><br><hr>"; 
  		             
- 		require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+ 		require_once dirname(__FILE__) . '/../../API/class.servicelocator.php';
  		$mailService = ServiceLocator::getService('mail');      
  		$mailService->addStringAttachment($mail_content, 'report.eml', 'application/text'); 
Index: trunk/expressoMail1_2/inc/class.exporteml.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.exporteml.inc.php	(revision 5181)
+++ trunk/expressoMail1_2/inc/class.exporteml.inc.php	(revision 5316)
@@ -664,5 +664,5 @@
 	function download_all_attachments($params) {
 		
-		require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+		require_once dirname(__FILE__).'/class.attachment.inc.php';
 		$atObj = new attachment();
 		$atObj->setStructureFromMail($params['folder'],$params['num_msg']);
Index: trunk/expressoMail1_2/inc/show_thumbs.php
===================================================================
--- trunk/expressoMail1_2/inc/show_thumbs.php	(revision 4416)
+++ trunk/expressoMail1_2/inc/show_thumbs.php	(revision 5316)
@@ -4,5 +4,5 @@
  */
  require_once '../../header.session.inc.php';
- require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+ require_once dirname(__FILE__).'/class.attachment.inc.php';
  //------------------------//
 
Index: trunk/expressoMail1_2/inc/class.ScriptS.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.ScriptS.inc.php	(revision 5294)
+++ trunk/expressoMail1_2/inc/class.ScriptS.inc.php	(revision 5316)
@@ -50,6 +50,6 @@
         $this->EmailExpresso = trim($_SESSION['phpgw_info']['expressomail']['user']['email']);
 		
-		include_once $_SESSION['rootPath'] . '/header.inc.php'; 
-		require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+		include_once dirname(__FILE__).'/../../header.inc.php'; 
+		require_once dirname(__FILE__).'/../../API/class.servicelocator.php';
  		$alternativeMailService = ServiceLocator::getService('ldap');
 		$this->AlternateEmailExpresso = $alternativeMailService->getMailAlternateByUidNumber($_SESSION['phpgw_info']['expressomail']['user']['account_id']);
Index: trunk/expressoMail1_2/inc/class.attachment.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.attachment.inc.php	(revision 5172)
+++ trunk/expressoMail1_2/inc/class.attachment.inc.php	(revision 5316)
@@ -37,6 +37,6 @@
          * Requires
          */
-            require_once $_SESSION['rootPath'].'/library/mime/mimePart.php';
-            require_once $_SESSION['rootPath'].'/library/mime/mimeDecode.php';
+            require_once dirname(__FILE__).'/../../library/mime/mimePart.php';
+            require_once dirname(__FILE__).'/../../library/mime/mimeDecode.php';
         //----------------------------------------------------------//
 
Index: trunk/expressoMail1_2/inc/show_img.php
===================================================================
--- trunk/expressoMail1_2/inc/show_img.php	(revision 4416)
+++ trunk/expressoMail1_2/inc/show_img.php	(revision 5316)
@@ -4,5 +4,5 @@
  */
  require_once '../../header.session.inc.php';
- require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+ require_oncedirname(__FILE__).'/class.attachment.inc.php';
  //------------------------//
 
Index: trunk/expressoMail1_2/inc/show_embedded_attach.php
===================================================================
--- trunk/expressoMail1_2/inc/show_embedded_attach.php	(revision 4416)
+++ trunk/expressoMail1_2/inc/show_embedded_attach.php	(revision 5316)
@@ -4,5 +4,5 @@
  */
  require_once '../../header.session.inc.php';
- require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+ require_once dirname(__FILE__).'/class.attachment.inc.php';
  //------------------------//
 
Index: trunk/expressoMail1_2/inc/get_archive.php
===================================================================
--- trunk/expressoMail1_2/inc/get_archive.php	(revision 5272)
+++ trunk/expressoMail1_2/inc/get_archive.php	(revision 5316)
@@ -92,5 +92,5 @@
 if($msgNumber != 'null' && $indexPart !== null && $msgFolder)
 {
-    require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php';
+    require_once dirname(__FILE__).'/class.attachment.inc.php';
 
     $attachment = new attachment();
Index: trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 5245)
+++ trunk/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 5316)
@@ -1,5 +1,5 @@
 <?php
 
-require_once(($_SESSION['rootPath'] ? $_SESSION['rootPath'] : PHPGW_INCLUDE_ROOT).'/API/class.servicelocator.php');
+require_once(dirname(__FILE__).'/../../API/class.servicelocator.php');
 include_once("class.imap_functions.inc.php");
 include_once("class.functions.inc.php");
@@ -277,5 +277,5 @@
                 $modal = true;
              
-            include_once $_SESSION['rootPath']. '/header.inc.php';
+            include_once dirname(__FILE__). '/../../header.inc.php';
             
             if($modal)
@@ -387,5 +387,5 @@
         function quickSearchGlobal($params, $all=false) 
         {              
-            include_once $_SESSION['rootPath']. '/header.inc.php';
+            include_once dirname(__FILE__). '/../../header.inc.php';
             $c = CreateObject('phpgwapi.config','contactcenter');
             $all_data = $c->read_repository();
