class.tx_nG6_pi6.php 21.1 KB
Newer Older
Jerome Mariette's avatar
Jerome Mariette committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2009 PF bioinformatique de Toulouse <>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * Plugin 'nG6' for the 'nG6' extension.
 *
 * @author	PF bioinformatique de Toulouse <>
 */

30
31
32
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/lib/class.tx_nG6_utils.php');
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/lib/class.tx_nG6_db.php');
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/res/smarty/libs/Smarty.class.php'); 
Jerome Mariette's avatar
Jerome Mariette committed
33

34
class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
Jerome Mariette's avatar
Jerome Mariette committed
35
36
37
	var $prefixId = 'tx_nG6_pi6';		// Same as class name
	var $scriptRelPath = 'pi6/class.tx_nG6_pi6.php';	// Path to this script relative to the extension dir.
	var $extKey = 'nG6';	// The extension key.
38
	
Jerome Mariette's avatar
Jerome Mariette committed
39
	//var $pi_checkCHash = TRUE;
40
	
Jerome Mariette's avatar
Jerome Mariette committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	/**
	 * Main method of your PlugIn
	 *
	 * @param	string		$content: The content of the PlugIn
	 * @param	array		$conf: The PlugIn Configuration
	 * @return	The content that should be displayed on the website
	 */
	function main($content,$conf)	{
			
		if (strstr($this->cObj->currentRecord,'tt_content'))	{
			$conf['pidList'] = $this->cObj->data['pages'];
			$conf['recursive'] = $this->cObj->data['recursive'];
		}
		$this->pi_loadLL();
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_USER_INT_obj=1;
58

Jerome Mariette's avatar
Jerome Mariette committed
59
60
		// Add the jquery libs + the tree plugins and its css
		$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = '
61
62
63
64
65
66
67
68
69
70
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/jquery.min.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/highstock.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/jquery.highcharts.exporting.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/jquery.dataTables.min.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/bootstrap.min.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/dataTables.bootstrap.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/typeahead.bundle.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/jflow.min.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/tx_nG6_utils.js"></script>
			<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/js/tx_nG6_pi6.js"></script>
Penom Nom's avatar
Penom Nom committed
71
					
72
73
74
75
76
77
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/bootstrap-theme.min.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/dataTables.bootstrap.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/typeaheadjs.css"/>	
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/font-awesome.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/jflow.min.css"/>
			<link type="text/css" rel="stylesheet" media="screen" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/css/tx_nG6.css"/>';
Jerome Mariette's avatar
Jerome Mariette committed
78
79

		$smarty = new Smarty();
80
81
82
83
		$smarty->setTemplateDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/pi6');
		$smarty->setCompileDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/res/smarty/templates_c');
		$smarty->setCacheDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/res/smarty/cache');
		$smarty->setConfigDir(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('nG6').'/res/smarty/configs');
Jerome Mariette's avatar
Jerome Mariette committed
84
85
86
		$smarty->security = true;
		$smarty->security_settings['MODIFIER_FUNCS'] = array('count');

Jerome Mariette's avatar
Jerome Mariette committed
87
88
89
		$group_list = tx_nG6_db::get_group_list();		
		$smarty->assign('login_user', $GLOBALS['TSFE']->loginUser);
		$smarty->assign('user_id', $GLOBALS['TSFE']->fe_user->user['uid']);
90
        $smarty->assign('user_name', $GLOBALS['TSFE']->fe_user->user['username']);
Jerome Mariette's avatar
Jerome Mariette committed
91
92
		$smarty->assign('group_list', $group_list);
		$smarty->assign('data_folder', $this->conf["data"]);
93
		$smarty->assign('server_url', $this->conf['server_url']);
94
        $smarty->assign('server_name', $this->conf["server_name"]);
95
                
96
97
		$distribution = tx_nG6_db::select_projects_repartition('create_user', 'title');
		$smarty->assign('distribution', $distribution);
Penom Nom's avatar
Penom Nom committed
98
		$smarty->assign('ng6_admin_users', tx_nG6_db::get_ng6_admin_users() );
99
100
101
		
		$smarty->assign('ng6_superadmin_users', tx_nG6_db::get_ng6_superadmin_users() );
		$smarty->assign('is_current_user_superadmin', tx_nG6_db::is_user_ng6_superadmin($GLOBALS['TSFE']->fe_user->user['uid']) );
Romain Therville's avatar
Romain Therville committed
102
		$smarty->assign('available_space_ids', tx_nG6_utils::get_available_space_ids());
Romain Therville's avatar
Romain Therville committed
103
104
        $smarty->assign('tx_nG6_pi6_redirection_page',$this->conf['redirection_page']);
        
105
		$smarty->assign('ng6_purge_delay',$this->conf['delay_purge']);
Jerome Mariette's avatar
Jerome Mariette committed
106
107
		return $smarty->fetch('administration_view.tpl');
	}
108
        
Romain Therville's avatar
Romain Therville committed
109
    static function send_purge_demand_mail($project_ids, $extension_allowed = 1){
Romain Therville's avatar
Romain Therville committed
110
111
112
113
		$project_name="";
        foreach(explode(",", $project_ids) as $project_id){
			#retrieve project data
			$p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, TRUE);
114

Romain Therville's avatar
Romain Therville committed
115
116
117
			#retrieve discarded emails
			$string_emails_to_discard = $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_to_discard"] ;
			$array_emails_to_discard = explode(',',$string_emails_to_discard);
118
                        
Romain Therville's avatar
Romain Therville committed
119
120
121
122
123
124
125
126
127
128
129
			#build email list of managers
			$users_id=array();
			$users_emails = array();
			foreach ( $p[$project_id]["users"] as  $u ){
				if (!isset ($users_id[$u["right_level_label"]]) ){
					$users_id[$u["right_level_label"]]=Array();
					$users_emails[$u["right_level_label"]]=Array();
				}
				$users_id[$u["right_level_label"]][] = $u["user_id"];
				$users_emails[$u["right_level_label"]][] = $u["email"];
			}
130

Romain Therville's avatar
Romain Therville committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
			//Warn if mail is sent to several manager
			$email_warn="" ;
			$purge_email_to="";

			if ( count( $users_emails['manager']) > 1 ) {
				$email_warn.="Be aware that every user associated with this project received this email, please send only one answer per purge alert number.\n";
			}

			$purge_user_id_to = array();
			$users_emails_to = array();
			if(isset($users_emails['administrator'])){
				$users_emails_to = array_merge($users_emails_to, $users_emails['administrator']);
				$purge_user_id_to = array_merge($purge_user_id_to, $users_id['administrator']);
			}
			if(isset($users_emails['manager'])){
				$users_emails_to = array_merge($users_emails_to,$users_emails['manager']);
				$purge_user_id_to = array_merge($purge_user_id_to, $users_id['manager']);
			}
			if(isset($users_emails['member'])){
				$users_emails_to = array_merge($users_emails_to, $users_emails['member']);
				$purge_user_id_to = array_merge($purge_user_id_to, $users_id['member']);
			}

			$purge_email_to = join(', ',$users_emails_to );

			$email_warn.=  "Every user associated with this project received this alert.\n";
			if( isset($users_emails['administrator']) && count($users_emails['administrator']) > 0 ){
				$email_warn.=  " - Administrator(s): ".join(', ',$users_emails['administrator']). "\n";
			}
			if( isset($users_emails['manager']) && count($users_emails['manager']) > 0 ){
				$email_warn.=  " - Manager(s): ".join(', ',$users_emails['manager']). "\n";
			}
			if( isset($users_emails['member']) && count($users_emails['member']) > 0 ){
				$email_warn.=  " - Member(s): ".join(', ',$users_emails['member']). "\n";
			}
            
            //Retrieve purgeable information for email
            $run_info=Array();
            $analyses_info=Array();
            $all_purgeable_runs=array_merge($p[$project_id]["state"]["stored"]["run_ids"],$p[$project_id]["state"]["extended"]["run_ids"]);
            $all_purgeable_analysis=array_merge($p[$project_id]["state"]["stored"]["analysis_ids"],$p[$project_id]["state"]["extended"]["analysis_ids"]);
            $nb_run_purgeable = $p[$project_id]["state"]["stored"]["nb_run"]+ $p[$project_id]["state"]["extended"]["nb_run"];
            $nb_analyse_purgeable = $p[$project_id]["state"]["stored"]["nb_analyze"]+ $p[$project_id]["state"]["extended"]["nb_analyze"];
            //Retrieve run name
            $search=array("###TYPE_OBJECT###","###RUN_ID###","###PROJECT_ID###");
            
            foreach($all_purgeable_runs as $run_id ){
            	$run = tx_nG6_db::select_run($run_id);
            	$run_name = $run["name"];    
            	$replace=array("run_id",$run_id,$project_id);
            	$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
            }
            foreach($all_purgeable_analysis as $analysis_id ){
            	$analysis = tx_nG6_db::select_analyse($analysis_id); 
            	$analysis_name = $analysis["name"];
            	$replace=array("analyze_id",$analysis_id,$project_id);
            	$analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
            }
            if (!$GLOBALS['TSFE']->fe_user->user['uid']){
            	http_response_code(401);
            	return "Nobody seems to be authenticated.";	
            }
            #Add purge demand to get id
            $purge_demand_id = tx_nG6_db::add_purge_demand($GLOBALS['TSFE']->fe_user->user['uid'],$project_id,$p[$project_id]["total_purgeable_size"],$all_purgeable_runs,$all_purgeable_analysis,$purge_user_id_to);
            
            //If the trigger check_demand_insert is triggered, add_purge_demand() returns 0 and the process has to send a mail to warn the admins instead.
            if($purge_demand_id > 0){
            	// We remove the hidden runs and analyzes from $p so they will not appear in the purge alert mail
            	$p=tx_nG6_db::select_a_project_retention_data_info($project_id, FALSE, FALSE);
            	
            	//We then need to compute the displayed values once more, to make the hidden elements part of the purge without displaying them in the mail
                $all_purgeable_runs=array_merge($p[$project_id]["state"]["stored"]["run_ids"],$p[$project_id]["state"]["extended"]["run_ids"]);
                $all_purgeable_analysis=array_merge($p[$project_id]["state"]["stored"]["analysis_ids"],$p[$project_id]["state"]["extended"]["analysis_ids"]);
                $nb_run_purgeable = $p[$project_id]["state"]["stored"]["nb_run"]+ $p[$project_id]["state"]["extended"]["nb_run"];
                $nb_analyse_purgeable = $p[$project_id]["state"]["stored"]["nb_analyze"]+ $p[$project_id]["state"]["extended"]["nb_analyze"]; 
                
                //We need to reset those values to only display unhidden elements
                $run_info=Array();
                $analyses_info=Array();
                
                foreach($all_purgeable_runs as $run_id ){
                	$run = tx_nG6_db::select_run($run_id);
                	$run_name = $run["name"];    
                	$replace=array("run_id",$run_id,$project_id);
                	$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
                }
                foreach($all_purgeable_analysis as $analysis_id ){
                    $analysis = tx_nG6_db::select_analyse($analysis_id); 
                    $analysis_name = $analysis["name"];
                    $replace=array("analyze_id",$analysis_id,$project_id);
                    $analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
                }
                
                #Build corresponding string array           
                //We get the project size without any hidden run or analyze
                $total_project_size = tx_nG6_db::get_project_size($project_id, true, false);
227
            			
Romain Therville's avatar
Romain Therville committed
228
229
230
231
232
            	$mail = tx_nG6_utils::get_purge_mail($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id,
					tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_purgeable_size"]),    tx_nG6_utils::get_octet_string_representation($total_project_size),
                    $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
                    $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
                    $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], $email_warn,  join(', ', $run_info), join(', ', $analyses_info), $extension_allowed);
233
            			
Romain Therville's avatar
Romain Therville committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
                $to      =   $purge_email_to;
                $subject = '[nG6 purge] No '.$purge_demand_id.' - Project '.$p[$project_id]["project_name"];
                $headers = array();
                $headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
                $headers[] = 'Errors-To: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
                $headers[] = 'X-Mailer: PHP/' . phpversion();
                $headers[] = 'MIME-Version: 1.0';
                $headers[] = 'Content-type: text/html; charset=utf-8';
                $headers[] = 'Cc: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_copy"];
                mail($to, $subject, $mail, implode("\r\n", $headers));
                //TODO check return function mail ok
        	}else{
        		//If the demand could not be inserted because another one already exists for the given project, we send a mail to the nG6 admins
        		$mail = tx_nG6_utils::get_multiple_purge_demand_mail($p[$project_id]["project_name"]);
                
                //We send the mail to ng6-support@groupes.renater.fr and Didier (See $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_warning"] )
                $to        =   $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_warning"];
                $subject   = '[nG6 purge] Project '.$p[$project_id]["project_name"].' already has a purge demand';
                $headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
                $headers[] = 'Errors-To: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
                $headers[] = 'X-Mailer: PHP/' . phpversion();
                $headers[] = 'MIME-Version: 1.0';
                $headers[] = 'Content-type: text/html; charset=utf-8';
                $headers[] = 'Cc: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_copy"];
                
                mail($to, $subject, $mail, implode("\r\n", $headers));
        	}
Romain Therville's avatar
Romain Therville committed
261
        }
Romain Therville's avatar
Romain Therville committed
262
263
    	return "Mail sent";
	}
Celine Noirot's avatar
Celine Noirot committed
264
 
Romain Therville's avatar
Romain Therville committed
265
        static function resend_purge_demand_mail ($demands_id) {
266
267
268
                $res_demands = tx_nG6_db::get_purge_demand_from_id($demands_id);
                foreach($res_demands as $res_demand){
                        $res_project =  tx_nG6_db::select_project($res_demand["project_id"]);
Romain Therville's avatar
Romain Therville committed
269
270
                        //We compute the project size without hidden elements
                        $total_project_size = tx_nG6_db::get_project_size($res_demand["project_id"], true, false) ;
271
272
273
274
275
276
                        $run_info=Array();
                        $analyses_info=Array();
                        $search=array("###TYPE_OBJECT###","###RUN_ID###","###PROJECT_ID###");
                        $project_id = $res_demand["project_id"];
                        $all_purgeable_runs = explode(',',$res_demand["run_ids"]);
                        $all_purgeable_analysis = explode(',',$res_demand["analyze_ids"]);
Romain Therville's avatar
Romain Therville committed
277
278
279
                        $nb_run_purgeable = 0;
                        $nb_analyse_purgeable = 0;
                        $displayed_purge_size = 0;
280
281
                        foreach($all_purgeable_runs as $run_id ){
    						$run = tx_nG6_db::select_run($run_id);
Romain Therville's avatar
Romain Therville committed
282
283
284
285
286
287
288
289
    						// We exclude hidden runs from the mail
    						if( $run["hidden"] != 1 && isset($run["name"]) ){
    							$run_name = $run["name"];
    							$replace=array("run_id",$run_id,$project_id);
    							$run_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$run["name"].' ('.$run_id.')</a>';
								$nb_run_purgeable++;
								$displayed_purge_size = $displayed_purge_size + $run["storage_size"];
							}
290
291
292
						}
						foreach($all_purgeable_analysis as $analysis_id ){
							$analysis = tx_nG6_db::select_analyse($analysis_id); 
Romain Therville's avatar
Romain Therville committed
293
294
295
296
297
298
299
300
    						// We exclude hidden analyzes from the mail
    						if( $analysis["hidden"] != 1 && isset($analysis["name"]) ){
    							$analysis_name = $analysis["name"];
    							$replace=array("analyze_id",$analysis_id,$project_id);
    							$analyses_info[] = '<a href="'.str_replace($search, $replace, $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["run_link_url"]).'">'.$analysis_name.' ('.$analysis_id.')</a>';
								$nb_analyse_purgeable++;
								$displayed_purge_size = $displayed_purge_size + $analysis["storage_size"];
							}
301
302
303
						}
						//We now use join(', ', $run_info) and join(', ', $analyses_info) in get_purge_mail().
                        
Romain Therville's avatar
Romain Therville committed
304
                        $extension_allowed = 1;
305
                        $mail = tx_nG6_utils::get_purge_mail($res_project["name"],$res_demand["project_id"],
Romain Therville's avatar
Romain Therville committed
306
307
                            $nb_run_purgeable, $nb_analyse_purgeable, $res_demand["demand_id"],
                            tx_nG6_utils::get_octet_string_representation($displayed_purge_size), tx_nG6_utils::get_octet_string_representation($total_project_size),
308
309
                            $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
                            $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
Romain Therville's avatar
Romain Therville committed
310
                            $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", join(', ', $run_info), join(', ', $analyses_info), $extension_allowed);
311
                        
Romain Therville's avatar
Romain Therville committed
312
                        $headers = array();
313
                        $subject = '[nG6 purge / reminder] No '.$res_demand["demand_id"].' - Project '.$res_project["name"];
314
                        $headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
Romain Therville's avatar
Romain Therville committed
315
316
                        //$headers[] = 'Errors-To: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_copy"];
                        $headers[] = 'Errors-To: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
317
                        $headers[] = 'X-Mailer: PHP/' . phpversion();
318
319
320
                        $headers[] = 'MIME-Version: 1.0';
                        $headers[] = 'Content-type: text/html; charset=utf-8';
                        $headers[] = 'Cc: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_copy"];
321
322
323
324
325
                        
                        $to= join(",",$res_demand["emails"]);
                        mail($to, $subject, $mail, implode("\r\n", $headers));
                }
        }
Jerome Mariette's avatar
Jerome Mariette committed
326
327
328
329
330
331
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/pi6/class.tx_nG6_pi6.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/pi6/class.tx_nG6_pi6.php']);
}

332
?>