Ignore:
Timestamp:
10/26/10 15:40:00 (13 years ago)
Author:
amuller
Message:

Ticket #1391 - Implementando notificação do FM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/upload.php

    r3019 r3415  
    1818$upload_max_size = $current_config['filemanager_Max_file_size']; 
    1919$path = $_POST['path']; 
     20$notifUser = $_POST['notifTo']; 
    2021$show_upload_boxes = count($_FILES['upload_file']['name'])-1; 
    2122 
     
    183184                } 
    184185        } 
     186 
     187if(count($notifUser) > 0) 
     188{ 
     189        define('PHPGW_INCLUDE_ROOT','../../'); 
     190        define('PHPGW_API_INC','../../phpgwapi/inc'); 
     191        include_once(PHPGW_API_INC.'/class.phpmailer.inc.php'); 
     192        $mail = new PHPMailer(); 
     193        $mail->IsSMTP(); 
     194        $boemailadmin = CreateObject('emailadmin.bo'); 
     195        $emailadmin_profile = $boemailadmin->getProfileList(); 
     196        $emailadmin = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); 
     197        $mail->Host = $emailadmin['smtpServer']; 
     198        $mail->Port = $emailadmin['smtpPort']; 
     199        $mail->From = $GLOBALS['phpgw']->preferences->values['email']; 
     200        $mail->FromName = $GLOBALS['phpgw_info']['user']['fullname']; 
     201        $mail->IsHTML(true); 
     202        foreach ($notifUser as $userMail) 
     203        { 
     204                $mail->AddAddress($userMail); 
     205                $mail->Subject = lang("Filemanager notification"); 
     206                $mail->Body = lang("The user %1, sent the file \"%2\" (type %3) and asked to notify you.",$GLOBALS['phpgw_info']['user']['fullname'],$_FILES['upload_file']['name'][0],$_FILES['upload_file']['type'][0])."<br>"; 
     207                $mail->Body .= lang("Comments by user: %1",$_POST['upload_comment'][0])."<br>"; 
     208                $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("index.php").">link</a><br>"); 
     209//              $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("../index.php","menuaction=filemanager.uifilemanager.view&file=" . urlencode(base64_encode($_FILES['upload_file']['name'][0]))."&path=".urlencode(base64_encode($path)))."\">link</a><br>"); 
     210                if(!$mail->Send()) { 
     211                        $return[] = $mail->ErrorInfo; 
     212                } 
     213        } 
     214} 
     215 
    185216if (count($return) > 0){ 
    186217                $_SESSION['response'] = serialize($return); 
Note: See TracChangeset for help on using the changeset viewer.