'; $_td_str_colsp2 = ''; $_td_str_left = ''; $_td_str_right = ''; # Build query and execute $query = "SELECT *"; $query .= " FROM _mail_archive"; $query .= " WHERE _mail_archive.ma_id=".$adata[ma_id]; # $query .= " ORDER BY ma_time_stamp DESC"; $result = db_query_execute($query); $numrows = db_query_numrows($result); # Process results IF ( $numrows) { while ($row = db_fetch_array($result)) { IF ($_SEC['_suser_id']) { # Dim some vars $good = 0; # Is it the client main address $clinfo = get_contact_client_info($_SEC['_suser_id']); $pos = strpos(strtolower($row[ma_fld_from]),strtolower($clinfo['cl_email'])); IF ($pos !== false) {$good++;} $pos1 = strpos(strtolower($row[ma_fld_recip]),strtolower($clinfo['cl_email'])); IF ($pos1 !== false) {$good++;} # Check all additional email addresses for a client IF (!$good) { $cl_emails = get_contact_client_info_alias($_SEC['_suser_id'],1); $x = sizeof($cl_emails); IF ($x) { FOR ($i=1; $i<=$x; $i++) { $pos = strpos(strtolower($row[ma_fld_from]),strtolower($cl_emails[$x]['cl_email'])); IF ($pos !== false) {$good++; break;} $pos1 = strpos(strtolower($row[ma_fld_recip]),strtolower($cl_emails[$x]['cl_email'])); IF ($pos1 !== false) {$good++; break;} } } } } IF ($_SEC['_sadmin_flg'] || $good) { # Build Title String, Content String, and Footer Menu String $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= '
'.htmlspecialchars($row[ma_fld_recip], ENT_QUOTES).''.dt_make_datetime ( $row[ma_time_stamp], $_CCFG['_PKG_DATE_FORMAT_SHORT_DTTM'] ).'
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_To'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_recip], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; if($row[ma_fld_cc]){ $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_CC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_cc], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; } if($row[ma_fld_bcc]){ $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_BCC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_bcc], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; } $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_From'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_from], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Subject'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$row[ma_fld_subject].''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left_vtop.$_LANG['_MAIL']['l_Message'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_sp.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_colsp2.'
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_colsp2.nl2br(do_stripslashes($row[ma_fld_message])).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; IF ( $_CCFG['_IS_PRINT'] != 1 ) { $_mstr .= do_nav_link ('admin.php', $_TCFG['_IMG_ADMIN_M'],$_TCFG['_IMG_ADMIN_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=resend&obj=arch&ma_id='.$adata[ma_id], $_TCFG['_IMG_EMAIL_M'],$_TCFG['_IMG_EMAIL_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=delete&obj=arch&ma_id='.$adata[ma_id], $_TCFG['_IMG_DELETE_M'],$_TCFG['_IMG_DELETE_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=search', $_TCFG['_IMG_SEARCH_M'],$_TCFG['_IMG_SEARCH_M_MO'],'',''); } ELSE { $_mstr = ''; } } # Call block it function //$_out .= do_mod_block_it ($_tstr, $_cstr, '1', $_mstr, '1'); $_out .= $_cstr.'
'.$_nl; } } # Return results IF ( $aret_flag ) { return $_out; } ELSE { echo $_out; } } # Do Form for Mail Archive Search function do_form_search_mail_archive( $adata, $aret_flag=0) { # Get security vars $_SEC = get_security_flags (); # Dim some Vars: global $_CCFG, $_TCFG, $_UVAR, $_LANG, $_SERVER, $_nl, $_sp; $query = ""; $result= ""; $numrows = 0; # Build common td start tag / strings (reduce text) $_td_str_left = ''; $_td_str_right = ''; $_td_str_span = ''; # Build Title String, Content String, and Footer Menu String $_tstr .= $_LANG['_MAIL']['Search_Mail_Archive']; # Set some defaults IF ( $adata['search_type'] == '' ) { $adata['search_type'] = 0; } # Do Main Form $_cstr .= '
'.$_nl; # $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Search_Type'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Date_Sent'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; IF ( $adata[cb_on_01]==1 ) { $_set = ' CHECKED'; } ELSE { $_set = ''; } $_cstr .= ''.$_nl; IF ( $adata[s_sent_ts_01] <= 0 || $adata[s_sent_ts_01] == '') { $adata[s_sent_ts_01] = time().$_nl; } $_cstr .= do_date_edit_list (s_sent_ts_01, $adata[s_sent_ts_01], 1).$_nl; IF ( $adata[cb_and_after]==1 ) { $_set = ' CHECKED'; } ELSE { $_set = ''; } $_cstr .= $_sp.$_sp.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_sp.$_LANG['_MAIL']['Sent_And_After'].''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Date_Sent'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; IF ( $adata[cb_on_02]==1 ) { $_set = ' CHECKED'; } ELSE { $_set = ''; } $_cstr .= ''.$_nl; IF ( $adata[s_sent_ts_02] <= 0 || $adata[s_sent_ts_02] == '') { $adata[s_sent_ts_02] = time().$_nl; } $_cstr .= do_date_edit_list (s_sent_ts_02, $adata[s_sent_ts_02], 1).$_nl; IF ( $adata[cb_and_before]==1 ) { $_set = ' CHECKED'; } ELSE { $_set = ''; } $_cstr .= $_sp.$_sp.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_sp.$_LANG['_MAIL']['Sent_And_Before'].''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_To'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_From'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_CC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_BCC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Subject'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Message'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= do_button ('Cerca','submit()','','','b_search').$_nl; $_cstr .= do_button ('Anulla','reset()','','','b_reset').$_nl; //$_cstr .= do_button ('b_purge', 'SUBMIT', $_LANG['_MAIL']['B_Purge_Result_Set'], 'button_form_h', 'button_form', '1').$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; # Purge Result Set IF ( $adata[mode] == 'purge' && $adata[stage] != '2' ) { $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl.$_td_str_span.$_nl.'
'.$_nl.''.$_nl.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_span.$_LANG['_MAIL']['Purge_Archive_Message_01'].'?'.$_sp.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_span.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; //$_cstr .= do_button ('b_purge_do', 'SUBMIT', $_LANG['_MAIL']['B_Purge_Result_Set'], 'button_form_h', 'button_form', '1').$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl.$_td_str_span.$_nl.'
'.$_nl.''.$_nl.''.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; } # Search stuff and return $_search_cnt = 0; IF ( $adata[search_type] == 0 ) { $_search_type = 'AND'; } ELSE { $_search_type = 'OR'; } $where = " WHERE ("; $where .= " ( _mail_archive.ma_id > ".'0'." ) "; IF ( $adata[s_sent_ts_01] && $adata[cb_on_01] ) { IF ( !$adata[cb_and_after] ) { $_ts_01_end = $adata[s_sent_ts_01]+86399; IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_time_stamp >= '$adata[s_sent_ts_01]'"; $where_2 .= " AND _mail_archive.ma_time_stamp <= '$_ts_01_end')"; $_search_cnt++; } ELSE { $_ts_01_end = $adata[s_sent_ts_01]+86399; IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_time_stamp >= '$adata[s_sent_ts_01]')"; $_search_cnt++; } } IF ( $adata[s_sent_ts_02] && $adata[cb_on_02] ) { IF ( !$adata[cb_and_before] ) { $_ts_02_end = $adata[s_sent_ts_02]+86399; IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_time_stamp >= '$adata[s_sent_ts_02]'"; $where_2 .= " AND _mail_archive.ma_time_stamp <= '$_ts_02_end')"; $_search_cnt++; } ELSE { $_ts_02_end = $adata[s_sent_ts_02]+86399; IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_time_stamp <= '$_ts_02_end')"; $_search_cnt++; } } IF ( $adata[s_to] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_recip like '$adata[s_to]%'"; $where_2 .= " OR _mail_archive.ma_fld_recip like '%$adata[s_to]%'"; $where_2 .= " OR _mail_archive.ma_fld_recip like '%$adata[s_to]')"; $_search_cnt++; } IF ( $adata[s_from] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_from like '$adata[s_from]%'"; $where_2 .= " OR _mail_archive.ma_fld_from like '%$adata[s_from]%'"; $where_2 .= " OR _mail_archive.ma_fld_from like '%$adata[s_from]')"; $_search_cnt++; } IF ( $adata[s_cc] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_cc like '$adata[s_cc]%'"; $where_2 .= " OR _mail_archive.ma_fld_cc like '%$adata[s_cc]%'"; $where_2 .= " OR _mail_archive.ma_fld_cc like '%$adata[s_cc]')"; $_search_cnt++; } IF ( $adata[s_bcc] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_bcc like '$adata[s_bcc]%'"; $where_2 .= " OR _mail_archive.ma_fld_bcc like '%$adata[s_bcc]%'"; $where_2 .= " OR _mail_archive.ma_fld_bcc like '%$adata[s_bcc]')"; $_search_cnt++; } IF ( $adata[s_subject] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_subject like '$adata[s_subject]%'"; $where_2 .= " OR _mail_archive.ma_fld_subject like '%$adata[s_subject]%'"; $where_2 .= " OR _mail_archive.ma_fld_subject like '%$adata[s_subject]')"; $_search_cnt++; } IF ( $adata[s_message] ) { IF ( $_search_cnt > 0 ) { $where_2 .= " ".$_search_type." "; } $where_2 .= "(_mail_archive.ma_fld_message like '$adata[s_message]%'"; $where_2 .= " OR _mail_archive.ma_fld_message like '%$adata[s_message]%'"; $where_2 .= " OR _mail_archive.ma_fld_message like '%$adata[s_message]')"; $_search_cnt++; } IF ( $_search_cnt > 0 ) { $where .= " AND ( ".$where_2." )"; } $where .= ")"; # Purge Result Set IF ( $adata[mode] == 'purge' && $adata[stage] == '2' ) { $query = "DELETE FROM _mail_archive"; $query .= $where; # Do select / form if criteria entered IF ( $_search_cnt > 0 ) { $result = db_query_execute($query); $eff_rows = db_query_affected_rows (); IF ( $_search_cnt > 0 ) { # Build form output $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; $_cstr .= $_LANG['_MAIL']['Purge_Archive_Results'].$_nl; $_cstr .= '

'.$_LANG['_MAIL']['Purge_Archive_Message_02'].' :'.$eff_rows.'

'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; # Clear search count to bypass below $_search_cnt = 0; } } } ELSE { $query = "SELECT *"; $query .= " FROM _mail_archive"; $query .= $where; $query .= " ORDER BY ma_time_stamp DESC"; # Do select / form if criteria entered IF ( $_search_cnt > 0 ) { $result = db_query_execute($query); $numrows = db_query_numrows($result); # Build form output $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; } } # Process query results IF ( $numrows && $_search_cnt > 0 ) { $_cstr .= ''.$_nl; # $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; while ($row = db_fetch_array($result)) { $_cstr .= ''.$_nl; # $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; } $_cstr .= '
'.$_nl; $_cstr .= ''.$_LANG['_MAIL']['Found_Items'].$_sp.'('.$numrows.')
'.$_nl; $_cstr .= '
'.$_LANG['_MAIL']['l_Id'].$_sp.''.$_LANG['_MAIL']['l_Date_Sent'].$_sp.''.''.$_sp.''.''.$_sp.''.$_LANG['_MAIL']['l_Actions'].$_sp.'
'.$row[ma_id].''.dt_make_datetime ( $row[ma_time_stamp], 'l, d M Y, H:i' ).''; $_cstr .= ''.$_LANG['_MAIL']['l_To'].$_sp.''.$_nl; $_cstr .= '
'.$_LANG['_MAIL']['l_From'].$_sp.''.$_nl; $_cstr .= '
'.$_LANG['_MAIL']['l_Subject'].$_sp.''.$_nl; $_cstr .= '
'.'
'; $_cstr .= htmlspecialchars($row[ma_fld_recip], ENT_QUOTES).$_nl; $_cstr .= '
'.htmlspecialchars($row[ma_fld_from], ENT_QUOTES).$_nl; $_cstr .= '
'.$row[ma_fld_subject].$_nl; $_cstr .= '
'.'
'.$_nl; IF ( $_CCFG['_IS_PRINT'] != 1 ) { //$_cstr .= do_nav_link ("Invia",$_SERVER["PHP_SELF"].'?mode=resend&obj=arch&ma_id='.$row['ma_id'],'',''); $_cstr .= do_nav_link ("Vedi",$_SERVER["PHP_SELF"].'?mode=view&obj=arch&ma_id='.$row['ma_id'],'',''); //$_cstr .= do_nav_link ('mod_print.php?mode=view&obj=arch&ma_id='.$row['ma_id'], $_TCFG['_S_IMG_PRINT_S'],$_TCFG['_S_IMG_PRINT_S_MO'],'_new',''); //$_cstr .= do_nav_link ("Cancella",$_SERVER["PHP_SELF"].'?mode=delete&obj=arch&stage=2&ma_id='.$row['ma_id'],'',''); } $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; } ELSE { IF ( $_search_cnt > 0 ) { $_cstr .= ''.$_nl; $_cstr .= '

'.$_LANG['_MAIL']['No_Items_Found'].'

'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; } } //$_mstr .= do_nav_link ('admin.php', $_TCFG['_IMG_ADMIN_M'],$_TCFG['_IMG_ADMIN_M_MO'],'',''); //$_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=search', $_TCFG['_IMG_SEARCH_M'],$_TCFG['_IMG_SEARCH_M_MO'],'',''); # Call block it function //$_out .= do_mod_block_it ($_tstr, $_cstr, '1', $_mstr, '1'); $_out .= $_cstr.'
'.$_nl; IF ( $aret_flag ) { return $_out; } ELSE { echo $_out; } } # Do display entry (individual entry) function do_resend_entry_mail_archive ( $adata, $aret_flag=0) { # Dim some Vars: global $_CCFG, $_TCFG, $_DBCFG, $_UVAR, $_LANG, $_SERVER, $_nl, $_sp; $query = ""; $result= ""; $numrows = 0; # Build common td start tag / strings (reduce text) $_td_str_left_vtop = ''; $_td_str_colsp2J = ''; $_td_str_colsp2C = ''; $_td_str_left = ''; $_td_str_right = ''; # Build query and execute $query = "SELECT *"; $query .= " FROM _mail_archive"; $query .= " WHERE _mail_archive.ma_id=".$adata[ma_id]; # $query .= " ORDER BY ma_time_stamp DESC"; $result = db_query_execute($query); $numrows = db_query_numrows($result); # Process results IF ( $numrows ) { while ($row = db_fetch_array($result)) { # Set eMail Parameters (pre-eval template, some used in template) $mail['recip'] = $row[ma_fld_recip]; $mail['from'] = $row[ma_fld_from]; $mail['cc'] = $row[ma_fld_cc]; $mail['bcc'] = $row[ma_fld_bcc]; $mail['subject'] = $row[ma_fld_subject]; $mail['message'] = $row[ma_fld_message]; # Call basic email function (ret=0 on error) $_ret = do_mail_basic ($mail); # Check return IF ( $_ret ) { $_ret_msg = $_LANG['_MAIL']['Resend_Archive_Entry_Message_03_L1']; $_ret_msg .= '
'.$_LANG['_MAIL']['Resend_Archive_Entry_Message_03_L2']; } ELSE { $_ret_msg = $_LANG['_MAIL']['Resend_Archive_Entry_Message_02']; } # Build Title String, Content String, and Footer Menu String $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= ''.$_nl; $_tstr .= '
'.htmlspecialchars($row[ma_fld_recip], ENT_QUOTES).''.dt_make_datetime ( $row[ma_time_stamp], $_CCFG['_PKG_DATE_FORMAT_SHORT_DTTM'] ).'
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl.$_td_str_colsp2C.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_LANG['_MAIL']['Resend_Archive_Entry_Results'].''.$_nl; $_cstr .= '
'.$_ret_msg.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_nl.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_To'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_recip], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_CC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_cc], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_BCC'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_bcc], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_From'].$_sp.''.$_nl; $_cstr .= $_td_str_right.htmlspecialchars($row[ma_fld_from], ENT_QUOTES).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left.$_LANG['_MAIL']['l_Subject'].$_sp.''.$_nl; $_cstr .= $_td_str_right.$row[ma_fld_subject].''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_left_vtop.$_LANG['_MAIL']['l_Message'].$_sp.'('.$_LANG['_MAIL']['output_below'].')'.$_nl; $_cstr .= $_td_str_right.$_sp.''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_colsp2J.'
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= $_td_str_colsp2J.nl2br(do_stripslashes($row[ma_fld_message])).''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; $_mstr .= do_nav_link ('admin.php', $_TCFG['_IMG_ADMIN_M'],$_TCFG['_IMG_ADMIN_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mod=mail&mode=search', $_TCFG['_IMG_SEARCH_M'],$_TCFG['_IMG_SEARCH_M_MO'],'',''); # Call block it function $_out .= $_cstr; $_out .= '
'.$_nl; } } IF ( $aret_flag ) { return $_out; } ELSE { echo $_out; } } function do_form_resend(){ global $_GPV,$_nl,$_sp,$_LANG; # Do Confirmmation form IF ( $_GPV[ma_id] != '' && $_GPV[stage] != "2" ) { # Content start flag $_out .= ''.$_nl; # Build Title String, Content String, and Footer Menu String $_tstr = $_LANG['_MAIL']['Resend_Archive_Entry_Confirmation']; # Do confirmation form to content string $_cstr = '

'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= '
'.$_nl; $_cstr .= ''.$_LANG['_MAIL']['Resend_Archive_Entry_Message_01'].'='.$_sp.$_GPV[ma_id].''.$_nl; $_cstr .= '
'.$_sp.'
'.$_nl; $_cstr .= ''.$_nl; $_cstr .= ''.$_nl; $_cstr .= do_button ('Resend','submit()','','','b_resend').$_nl; $_cstr .= '
'.$_nl; $_cstr .= '
'.$_nl; $_mstr_flag = '1'; $_mstr .= do_nav_link ('admin.php', $_TCFG['_IMG_ADMIN_M'],$_TCFG['_IMG_ADMIN_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=view&obj=arch&ma_id='.$_GPV[ma_id], $_TCFG['_IMG_VIEW_M'],$_TCFG['_IMG_VIEW_M_MO'],'',''); $_mstr .= do_nav_link ($_SERVER["PHP_SELF"].'?mode=search&sw=archive', $_TCFG['_IMG_SEARCH_M'],$_TCFG['_IMG_SEARCH_M_MO'],'',''); # Call block it function $_out .= $_cstr; $_out .= '
'.$_nl; } # Check and call code accordingly: IF ( $_GPV[ma_id] != '' && $_GPV[stage] == "2" ) { $_out .= ''.$_nl; $_out .= do_resend_entry_mail_archive ( $data, 1); } # Echo final output return $_out; } function do_form_sendmail($adata,$amode,$astage){ global $_CCFG,$_GPV,$_POST,$_FILES,$title,$_nl,$_tab; if($astage==1 || !isset($astage)){ $descr="Scrivi una mail da inoltrare a uno o piú utenti contemporaneamente."; $code='
'; if($amode=='edit'){ $code.=''; } $code.=' '.$_nl; for($i=0;$i<$_CCFG['_NO_OF_ATTACHEMENTS'];$i++)$code.=' '.$_nl; $code.='
Mittente: '.do_select_list_department("department_id",$adata[department_id]).'
Destinari: '.$_nl; $code.=do_select_list_users("iduser",$adata[iduser])."
"; for($i=0;$i':'').$_nl; $code.=str_repeat($_tab,5).'
Con status: '.do_checkbox("status[]","Attivo",1,true).' '.do_checkbox("status[]","Disattivo",2,false).'
CC :
BCC :

Oggetto :
Messaggio :
Allegato '.($i+1).':

'; $btns=new cToolbar(); $btns->addButton("Invia","frm.submit()"); $code.=$btns->draw().'

'; $code.='
'; $code=do_block($code,"block_corner"); $btns=""; }else{ $_CCFG[EMAIL_AS_HTML]=true; $info=get_department_info($_GPV[department_id]); $message="$_GPV[messagge]\n\n"; $mail['message']=stripslashes($message); $mail['subject']=$_GPV[subject]; $mail['cc']=$_GPV['CC'];$mail['bcc']=$_GPV['BCC']; $mail['from'] =$info[nome].' <'.$info[email].'>'; $mail['from'] =$info[email]; $mail['recip'] =$_CCFG['_EMAIL']; $mail['AttmFiles']=Array(); for($i=0;$i<$_CCFG['_NO_OF_ATTACHEMENTS'];$i++)if(isset($_FILES['doc']['type'][$i]) && $_FILES['doc']['error'][$i]==0){ $dest=$_CCFG[_PKG_PATH_BASE]."Temp/".$_FILES['doc']['name'][$i]; move_uploaded_file($_FILES['doc']['tmp_name'][$i], $dest) or die("Can't move file ".$_FILES['doc']['tmp_name'][$i]." TO $dest !"); array_push($mail['AttmFiles'],$dest); } $mail['recip']="rofrantz@yahoo.com"; $sql="SELECT ditta,nomecogn,email FROM utenti WHERE 1=1 "; switch(array_sum($_POST[status])){ case 1://ACTIVE USSERS case 2://DISABLED USERS $sql.="AND status".($_POST[status][0]==1?'=':'!=')."'".$_CCFG[_PKG_STR_ACTIVE]."'"; break; case 3://ALL USERS,no matter their status break; } switch($_POST[range_utenti][0]){ case "ALL": //All users if(isset($_POST[tipo_utenti])){ $types=" "; for($i=0;$i".mysql_error()); $code='


Invio e-mail a seguenti utent'.(@mysql_num_rows($res)>1?'i':'e').' :

'.$_nl; while($data=mysql_fetch_array($res))if($data[email]){ $mail['recip'] =$data[email]; $code.=($data[nomecogn]?$data[nomecogn]:$data[ditta]).($data[email]?': '.$data[email]:'').'
'; $_ret=do_mail_basic($mail); if($_ret)die("ERROR SENDING:$_ret"); $mail['cc']="";$mail['bcc']=""; } $btns=new cToolbar(); $btns->addButton("Torna ad ADMIN","window.location.href='".$_CCFG['_PKG_URL_BASE']."admin/'"); $code.='
'.$btns->draw().'
'; } $_out=do_page($title,$descr,$code,"",""); return $_out; } # Get security vars $_SEC = get_security_flags(); IF ( !$_SEC['_sadmin_flg'] && $_GPV[mode]!='view') { # Set login flag $_login_flag = 1; # Call function for clients listings $_out = ''.$_nl; $_out .= do_login($data, 'admin', '1').$_nl; $title="Login"; } IF ( $_SEC['_sadmin_flg']){ $amode = $_GPV[mode]?$_GPV[mode]:'send'; $astage = $_GPV[stage]; if($amode=='send'){ $title="Mailing a utenti"; $_out=do_form_sendmail($adata,$amode,$astage); }elseif($amode=='resend' && $_GPV[obj]=='arch'){ $title=""; $_out=do_form_resend(); }else{ $title="Archivio e-mails inviati"; # Build Data Array (may also be over-ridden later in code) $data = $_GPV; # From reset password form (for reference) $data['username'] = $_GPV[username]; $data['password'] = $_GPV[password]; # From contact form (for reference) $data['mc_id'] = $_GPV[mc_id]; $data['mc_name'] = do_parse_input_data($_GPV[mc_name]); $data['mc_email'] = $_GPV[mc_email]; $data['mc_subj'] = $_GPV[mc_subj]; $data['mc_msg'] = do_parse_input_data($_GPV[mc_msg]); # From contact client form (for reference) $data['cc_cl_id'] = $_GPV[cc_cl_id]; $data['cc_mc_id'] = $_GPV[cc_mc_id]; $data['cc_subj'] = $_GPV[cc_subj]; $data['cc_msg'] = do_parse_input_data($_GPV[cc_msg]); if($amode=='view') $_out .= do_display_entry_mail_archive ( $data, 1); else $_out.=do_form_search_mail_archive( $data, 1); } } echo do_page_content($_out,$title); ?>