2009-02-20 15:05:22 +01:00
|
|
|
<?php
|
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (C) 2007 Easter-eggs
|
2021-04-13 18:04:19 +02:00
|
|
|
* https://ldapsaisie.org
|
2009-02-20 15:05:22 +01:00
|
|
|
*
|
|
|
|
* Author: See AUTHORS file in top-level directory.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
2024-02-19 19:59:55 +01:00
|
|
|
class LSmail extends LSlog_staticLoggerClass {
|
|
|
|
|
2009-02-20 15:05:22 +01:00
|
|
|
/*
|
|
|
|
* Méthode chargeant les dépendances d'affichage
|
2020-04-29 15:54:21 +02:00
|
|
|
*
|
2022-12-31 05:52:31 +01:00
|
|
|
* @return void
|
2009-02-20 15:05:22 +01:00
|
|
|
*/
|
|
|
|
public static function loadDependenciesDisplay() {
|
|
|
|
if (LSsession :: loadLSclass('LSsmoothbox')) {
|
|
|
|
LSsmoothbox :: loadDependenciesDisplay();
|
|
|
|
}
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2020-05-28 16:56:36 +02:00
|
|
|
LStemplate :: addJSscript('LSmail.js');
|
|
|
|
LStemplate :: addCssFile('LSmail.css');
|
2009-02-20 15:05:22 +01:00
|
|
|
}
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2009-02-20 15:05:22 +01:00
|
|
|
public static function ajax_display(&$data) {
|
2022-12-31 04:09:56 +01:00
|
|
|
$msg = $_REQUEST['msg'];
|
|
|
|
$subject = $_REQUEST['subject'];
|
|
|
|
if (
|
|
|
|
isset($_REQUEST['object']['type'])
|
|
|
|
&& isset($_REQUEST['object']['dn'])
|
|
|
|
&& LSsession ::loadLSobject($_REQUEST['object']['type'])
|
|
|
|
) {
|
|
|
|
$obj = new $_REQUEST['object']['type']();
|
|
|
|
$obj -> loadData($_REQUEST['object']['dn']);
|
|
|
|
$msg = $obj -> getFData($msg);
|
|
|
|
$subject = $obj -> getFData($subject);
|
2009-02-20 15:05:22 +01:00
|
|
|
}
|
|
|
|
|
2022-12-31 04:09:56 +01:00
|
|
|
LStemplate :: assign('LSmail_msg', $msg);
|
|
|
|
LStemplate :: assign('LSmail_subject', $subject);
|
|
|
|
LStemplate :: assign('LSmail_options', $_REQUEST['options']);
|
2016-11-17 11:51:49 +01:00
|
|
|
|
2009-02-20 15:05:22 +01:00
|
|
|
if (is_array($_REQUEST['mails'])) {
|
2022-12-31 04:09:56 +01:00
|
|
|
LStemplate :: assign('LSmail_mails', $_REQUEST['mails']);
|
2009-02-20 15:05:22 +01:00
|
|
|
}
|
|
|
|
else if(empty($_REQUEST['mails'])) {
|
2022-12-31 04:09:56 +01:00
|
|
|
LStemplate :: assign('LSmail_mails', array($_REQUEST['mails']));
|
2009-02-20 15:05:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$data = array(
|
2013-06-16 10:01:49 +02:00
|
|
|
'html' => LSsession :: fetchTemplate('LSmail.tpl')
|
2009-02-20 15:05:22 +01:00
|
|
|
);
|
|
|
|
}
|
2020-04-29 15:54:21 +02:00
|
|
|
|
2009-02-20 15:05:22 +01:00
|
|
|
public static function ajax_send(&$data) {
|
|
|
|
if (isset($_REQUEST['infos'])) {
|
|
|
|
if (LSsession ::loadLSaddon('mail')) {
|
|
|
|
if(sendMail($_REQUEST['infos']['mail'],$_REQUEST['infos']['subject'],$_REQUEST['infos']['msg'])) {
|
|
|
|
$data = array(
|
|
|
|
'msgok' => _("Your message has been sent successfully.")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSsession_12');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-29 15:54:21 +02:00
|
|
|
}
|