diff --git a/modules/notifications/class/notifications_controler.php b/modules/notifications/class/notifications_controler.php
deleted file mode 100755
index a76a371b64957c73307688ec76fc8dc0095c70f5..0000000000000000000000000000000000000000
--- a/modules/notifications/class/notifications_controler.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/*
-*    Copyright 2008-2016 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of life_cycle object (create, save, modify, etc...)
-* 
-* 
-* @file
-* @author Luc KEULEYAN - BULL
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup life_cycle
-*/
-
-require_once 'modules/notifications/class/notifications_controler_Abstract.php';
-
-/**
-* @brief  Controler of the notification object 
-*
-* @ingroup notifications
-*/
-class notifications_controler extends notifications_controler_Abstract
-{
-    // custom    
-}
diff --git a/modules/notifications/class/notifications_controler_Abstract.php b/modules/notifications/class/notifications_controler_Abstract.php
deleted file mode 100755
index 66d3111e8e09845c67c02b46714004c8a0b30e36..0000000000000000000000000000000000000000
--- a/modules/notifications/class/notifications_controler_Abstract.php
+++ /dev/null
@@ -1,314 +0,0 @@
-<?php
-
-/*
-*    Copyright 2008-2016 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework 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 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of life_cycle object (create, save, modify, etc...)
-* 
-* 
-* @file
-* @author Luc KEULEYAN - BULL
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup life_cycle
-*/
-
-// To activate de debug mode of the class
-$_ENV['DEBUG'] = false;
-
-// Loads the required class
-try {
-    require_once ("modules/notifications/class/notifications.php");
-    require_once ("modules/notifications/notifications_tables_definition.php");
-    require_once ("core/class/ObjectControlerAbstract.php");
-    require_once ("core/class/ObjectControlerIF.php");
-    require_once ("core/class/class_history.php");
-} catch (Exception $e) {
-    functions::xecho($e->getMessage()) . ' // ';
-}
-
-/**
-* @brief  Controler of the notification object 
-*
-* @ingroup notifications
-*/
-abstract class notifications_controler_Abstract extends ObjectControler implements ObjectControlerIF
-{
-
-    /**
-    * Returns an templates_assoc object based on a templates_assoc identifier
-    *
-    * @param  $ta_sid string  templates_assoc identifier
-    * @return templates_assoc object with properties from the database or null
-    */
-    public function get($notification_sid) {
-        
-        $this->set_specific_id('notification_sid');
-        $notification = $this->advanced_get($notification_sid, _NOTIFICATIONS_TABLE_NAME);
-        
-        if (get_class($notification) <> "notifications") {
-            return null;
-        } else {
-            return $notification;
-        }
-    }
-
-    public function getByNotificationId($notificationId) {
-        $query = "SELECT * FROM " . _NOTIFICATIONS_TABLE_NAME . " WHERE notification_id = ?"; 
-        $dbConn = new Database();
-        $stmt = $dbConn->query($query, array($notificationId));
-        $notifObj = $stmt->fetchObject();
-        return $notifObj;
-    }
-    
-    /**
-    * Deletes in the database (lc_policies related tables) a given lc_policies (policy_id)
-    *
-    * @param  $policy object  policy object
-    * @return array true if the deletion is complete, false otherwise
-    */
-    public function delete($notification) 
-    {
-        $control = array();
-        if (!isset($notification) || empty($notification)) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _NOTIF_EMPTY
-                       );
-            return $control;
-        }
-        
-        $this->set_specific_id('notification_sid');
-        if ($this->advanced_delete($notification) == true) {
-            if (isset($params['log_notif_del'])
-                && ($params['log_notif_del'] == "true"
-                    || $params['log_notif_del'] == true)) {
-                $history = new history();
-                $history->add(
-                    _NOTIFICATIONS_TABLE, $notification->notification_sid, 'DEL', 'notifdel',_NOTIF_DELETED . ' : '
-                    . $notification->notification_id
-                );
-            }
-            $control = array('status' => 'ok',
-                             'value'  => $notification->notification_sid
-                      );
-        } else {
-            $control = array('status' => 'ko',
-                             'value'  => $notification->notification_sid,
-                             'error'  => $error
-                          );
-        }
-        return $control;
-    }
-    
-    
-    /**
-    * Save given object in database:
-    * - make an update if object already exists,
-    * - make an insert if new object.
-    * @param object $policy
-    * @param string mode up or add
-    * @return array
-    */
-    public function save($notification, $mode = "") 
-    {
-        $control = array();
-
-        $this->set_foolish_ids(
-            array(
-                'notification_id',
-                'event_id'
-            )
-        );
-        // If notification not defined or empty, return an error
-        if (!isset($notification) || empty($notification)) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _NOTIF_EMPTY
-                       );
-            return $control;
-        }
-
-
-
-        // If mode not up or add, return an error
-        if (!isset($mode) || empty($mode)
-            || ($mode <> 'add' && $mode <> 'up' )) {
-            $control = array('status' => 'ko',
-                             'value'  => '',
-                             'error'  => _MODE . ' ' ._UNKNOWN
-                        );
-            return $control;
-        }
-        
-        //$notification = $this->isAStatus($notification);
-        $this->set_specific_id('notification_sid');
-        // Data checks
-        $control = $this->control($notification, $mode, $params);
-        
-        if ($control['status'] == 'ok') {
-            $core = new core_tools();
-            $_SESSION['service_tag'] = 'notif_' . $mode;
-            $core->execute_modules_services(
-                $params['modules_services'], 'notif_add_db', 'include'
-            );
-            
-            if ($mode == 'up') {
-                //Update existing status
-                if ($this->update($notification)) {
-                    $control = array('status' => 'ok',
-                                     'value'  => $notification->notification_sid
-                               );
-                    //log
-                    if ($params['log_status_up'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            _NOTIFICATIONS_TABLE, $notification->notification_sid, 'UP','notifup',
-                            _NOTIF_MODIFIED . ' : ' . $notification->notification_sid
-                        );
-                    }
-                } else {
-                    $control = array('status' => 'ko',
-                                     'value'  => '',
-                                     'error'  => _PB_WITH_NOTIF_UPDATE
-                                );
-                }
-            } else { //mode == add
-                if ($this->insert($notification)) {
-                    $dbConn = new Database();
-                    $where = "";
-                    $order = "ORDER BY notification_sid DESC";
-                    $query = $dbConn->limit_select(0, 1, 'notification_sid', 'notifications', $where, '', '', $order);
-
-                    $stmt = $dbConn->query($query);
-                    $result_sid = $stmt->fetchObject(); 
-                    $control = array('status' => 'ok',
-                                     'value'  => $result_sid->notification_sid);
-                    //log
-                    if ($params['log_notif_add'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            _NOTIFICATIONS_TABLE, $notification->notification_sid, 'ADD','notifadd',
-                            _NOTIF_ADDED . ' : ' . $notification->notification_sid
-                        );
-                    }
-                } else {
-                    $control = array('status' => 'ko',
-                                     'value'  => '',
-                                     'error'  => _PB_WITH_STATUS
-                                );
-                }
-            }
-        }
-        unset($_SESSION['service_tag']);
-        return $control;
-    }
-       
-
-    /**
-    * Control the data of Status object
-    *
-    * @param  $status notification object
-    * @param  $mode Mode (add or up)
-    * @param  $params More parameters,
-    *                 array('modules_services' => $_SESSION['modules_services']
-    *                                               type array,
-    *                     'log_status_up'      => 'true' / 'false': log status
-    *                                               modification,
-    *                     'log_status_add'     => 'true' / 'false': log status
-    *                                               addition,
-    *                     'databasetype'       => Type of the database
-    *                )
-    * @return array (  'status' => 'ok' / 'ko',
-    *                  'value'  => notification identifier or empty in case of error,
-    *                  'error'  => Error message, defined only in case of error
-    *                  )
-    */
-    protected function control($notification, $mode, $params=array())
-    {
-        $error = "";
-        $f = new functions();
-       
-        $notification->notification_id = $f->protect_string_db(
-            $f->wash($notification->notification_id, 'no', _ID, 'yes', 0, 50)
-        );
-        $notification->description = $f->wash($notification->description, 'no', _DESC, 'yes', 0, 255);
-        
-        if ($notification->is_enabled == 'false') {
-            $notification->is_enabled = false;
-        } else {
-            $notification->is_enabled = true;
-        }
-        
-        $notification->diffusion_type = $f->protect_string_db(
-            $f->wash($notification->diffusion_type, 'no', _DIFFUSION_TYPE)
-        );
-        $notification->diffusion_properties = $f->protect_string_db(
-            $f->wash($notification->diffusion_properties, 'no', _DIFFUSION_PROPERTIES, 'no')
-        );
-        $notification->attachfor_type = $f->protect_string_db(
-            $f->wash($notification->attachfor_type, 'no', _ATTACHFOR_TYPE, 'no')
-        );
-        $notification->attachfor_properties = $f->protect_string_db(
-            $f->wash($notification->attachfor_properties, 'no', _ATTACHFOR_PROPERTIES, 'no')
-        );
-
-        $_SESSION['service_tag'] = 'notif_check';
-        $core = new core_tools();
-
-        $error .= $_SESSION['error'];
-        //TODO:rewrite wash to return errors without html and not in the session
-        $error = str_replace("<br />", "#", $error);
-        $return = array();
-        if (!empty($error)) {
-                $return = array('status' => 'ko',
-                                'value'  => $notification->notification_sid,
-                                'error'  => $error
-                          );
-        } else {
-            $return = array('status' => 'ok',
-                            'value'  => $notification->notification_sid
-                      );
-        }
-        unset($_SESSION['service_tag']);
-               
-        return $return;
-    }
-    
-    protected function insert($notification)
-    {
-        return $this->advanced_insert($notification);
-    }
-
-    /**
-    * Updates a status in the database (status table) with a Status object
-    *
-    * @param  $status Status object
-    * @return bool true if the update is complete, false otherwise
-    */
-    protected function update($notification)
-    {
-       //var_dump($notification); exit();
-       return $this->advanced_update($notification);
-    }
-    
-    
-}
diff --git a/modules/notifications/manage_notifications.php b/modules/notifications/manage_notifications.php
deleted file mode 100755
index c38ad01bedf4c0c9c1cd03f64205fb6fca9838c0..0000000000000000000000000000000000000000
--- a/modules/notifications/manage_notifications.php
+++ /dev/null
@@ -1,355 +0,0 @@
-<?php
-/* Affichage */
-if ($mode == 'list') {
-    $list = new list_show();
-    $list->admin_list(
-        $notifsList['tab'],
-        count($notifsList['tab']),
-        $notifsList['title'],
-        'notification_sid',
-        'manage_notifications_controler&mode=list',
-        'notifications', 'notification_sid',
-        true,
-        $notifsList['page_name_up'],
-        $notifsList['page_name_val'],
-        $notifsList['page_name_ban'],
-        $notifsList['page_name_del'],
-        $notifsList['page_name_add'],
-        $notifsList['label_add'],
-        false,
-        false,
-        _ALL_NOTIFS,
-        _NOTIF,
-        'bell',
-        true,
-        true,
-        false,
-        true,
-        $notifsList['what'],
-        true,
-        $notifsList['autoCompletionArray']
-    );
-} elseif ($mode == 'up' || $mode == 'add') {
-    ?><h1><i class='fa fa-bell fa-2x'></i>
-    <?php
-        if ($mode == 'up') {
-            echo _MODIFY_NOTIF;
-        } elseif ($mode == 'add') {
-            echo _ADD_NOTIF;
-        } ?>
-    </h1>
-    <div id="inner_content" class="clearfix" align="center">   
-    <?php
-    if ($state == false) {
-        echo '<br /><br /><br /><br />'._NOTIFICATION_ID.' '.$_SESSION['m_admin']['notification']['notification_sid'].' '._UNKNOWN
-        .'<br /><br /><br /><br />';
-    } else {
-        ?>
-    <div class="block">
-    <form name="frmevent" id="frmevent" method="post" action="<?php
-        echo $_SESSION['config']['businessappurl'].'index.php?display=true'
-        .'&amp;module=notifications&amp;page=manage_notifications_controler&amp;mode='
-        .$mode; ?>" class="forms addforms">
-        <input type="hidden" name="display" value="true" />
-        <input type="hidden" name="admin" value="notifications" />
-        <input type="hidden" name="page" value="manage_notifications_controler" />
-        <input type="hidden" name="mode" value="<?php functions::xecho($mode); ?>" />
-
-        <input type="hidden" name="notification_sid" id="notification_sid" value="<?php functions::xecho($_SESSION['m_admin']['notification']['notification_sid']); ?>" />
-
-        <input type="hidden" name="order" id="order" value="<?php
-            functions::xecho($_REQUEST['order']); ?>" />
-        <input type="hidden" name="order_field" id="order_field" value="<?php
-            functions::xecho($_REQUEST['order_field']); ?>" />
-        <input type="hidden" name="what" id="what" value="<?php
-            functions::xecho($_REQUEST['what']); ?>" />
-        <input type="hidden" name="start" id="start" value="<?php
-            functions::xecho($_REQUEST['start']); ?>" />
-
-
-        <p>
-            <label for="label"><?php echo _NOTIFICATION_ID; ?> : </label>
-            <input name="notification_id" type="text" id="notification_id" value="<?php
-                echo functions::show_str(
-                    $_SESSION['m_admin']['notification']['notification_id']
-                ); ?>"/>
-        </p>
-        <p>
-            <label for="label"><?php echo _DESC; ?> : </label>
-            <textarea name="description" cols="80" rows="2" id="description"><?php
-                echo functions::show_str(
-                    $_SESSION['m_admin']['notification']['description']
-                ); ?></textarea>
-        </p>
-         <p>
-            <label><?php echo _ENABLED; ?> : </label>
-            <input type="radio" class="check" name="is_enabled" value="true" <?php
-            if (isset($_SESSION['m_admin']['notification']['is_enabled'])
-                && $_SESSION['m_admin']['notification']['is_enabled'] == 'Y'
-            ) {
-                ?> checked="checked"<?php
-            } ?> /><?php echo _YES; ?>
-                <input type="radio" class="check" name="is_enabled" value="false" <?php
-            if (!isset($_SESSION['m_admin']['notification']['is_enabled'])
-                || (!($_SESSION['m_admin']['notification']['is_enabled'] == 'Y')
-                || $_SESSION['m_admin']['notification']['is_enabled'] == '')
-            ) {
-                ?> checked="checked"<?php
-            } ?> /><?php echo _NO; ?>
-        </p>
-        <p>
-            <label for="label"><?php echo _EVENT; ?> : </label>
-            <select name="event_id" id="event_id">
-				<option value=""><?php echo _SELECT_EVENT_TYPE; ?></option>
-                <optgroup label="<?php echo _ACTIONS; ?>">
-                <?php
-                foreach ($actions_list as $this_action) {
-                    ?><option value="<?php functions::xecho($this_action->id); ?>"
-                    <?php
-                    if ($_SESSION['m_admin']['notification']['event_id']
-                        == $this_action->id) {
-                        echo 'selected="selected"';
-                    } ?>><?php functions::xecho($this_action->label_action); ?></option><?php
-                }
-
-        //Récupération des éléments systèmes ?></optgroup><?php
-                $newarray = array_keys($_SESSION['notif_events']); ?><optgroup label="<?php echo _SYSTEM; ?>"><?php
-                foreach ($_SESSION['notif_events'] as $event_type_id => $event_type_label) {
-                    ?><option value="<?php functions::xecho($event_type_id); ?>"
-                    <?php
-                    if ($_SESSION['m_admin']['notification']['event_id']
-                        == $event_type_id) {
-                        echo 'selected="selected"';
-                    } ?>><?php functions::xecho($event_type_label); ?></option><?php
-                } ?>
-                </optgroup>
-            </select>
-        </p>
-        <p style="display:none">
-            <label><?php echo _NOTIFICATION_MODE; ?> :</label>
-            <input type="radio" name="notification_mode" value="EMAIL"
-                onClick="javascript:window.document.getElementById('template_div').style.display = 'block';
-				window.document.getElementById('rss_url_div').style.display = 'none';" <?php
-                if ($_SESSION['m_admin']['notification']['notification_mode'] == ''
-                    || $_SESSION['m_admin']['notification']['notification_mode'] == 'EMAIL'
-                ) {
-                    echo 'checked="checked"';
-                } ?>/> <?php echo _EMAIL; ?>
-            <input type="radio" name="notification_mode" value="RSS"
-                onClick="javascript:window.document.getElementById('rss_url_div').style.display = 'block';
-				window.document.getElementById('template_div').style.display = 'none';" <?php
-                if ($_SESSION['m_admin']['notification']['notification_mode'] == 'RSS'
-                ) {
-                    echo 'checked="checked"';
-                } ?>/> <?php echo _RSS; ?>
-        </p>
-        <div id="template_div" name="template_div">
-        <p>
-            <label for="label"><?php echo _TEMPLATE; ?> : </label>
-            <select name="template_id" id="template_id">
-                <option value=""><?php echo _SELECT_TEMPLATE; ?></option>
-                <?php
-                foreach ($templates_list as $template) {
-                    if ($template['TYPE'] === 'HTML' && ($template['TARGET'] == 'notifications' || $template['TARGET'] == '')) {
-                        ?><option value="<?php functions::xecho($template['ID']); ?>"
-                        <?php
-                        if ($_SESSION['m_admin']['notification']['template_id']
-                            == $template['ID']) {
-                            echo 'selected="selected"';
-                        } ?>><?php functions::xecho($template['LABEL']); ?></option><?php
-                    }
-                } ?>
-            </select>
-        </p>
-        </div>
-       
-        <p>
-            <label for="status"><?php echo _DIFFUSION_TYPE; ?> : </label>
-            <select name="diffusion_type"
-					id="status" 
-					onchange="change_properties_box(
-						this.options[this.selectedIndex].value,
-						'<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_diffusiontype_formcontent',
-						'diff_type_div',
-						'notifications',
-						'');clear_attach_type();set_attach_type(this.options[this.selectedIndex].value)">
-
-                <option value=""><?php echo _SELECT_DIFFUSION_TYPE; ?></option>
-                <?php
-                foreach ($diffusion_types as $this_diffusion) {
-                    ?>
-                    <option value="<?php functions::xecho($this_diffusion->id); ?>"
-                        <?php
-                        if (trim($_SESSION['m_admin']['notification']['diffusion_type']) == trim($this_diffusion->id)) {
-                            echo 'selected="selected"';
-                        } ?>
-                        >
-                        <?php functions::xecho($this_diffusion->label); ?>
-                    </option>
-                <?php
-                } ?>
-            </select>
-        </p>
-
-        <div id="diff_type_div"
-            class="scroll_div"
-            style="height:200px;
-                    width:600px;
-                    border:1px solid;">
-        </div>
-		<p></p>
-		<p>
-            <label for="attach_for_type"><?php echo _ATTACH_MAIL_FILE; ?> : </label>
-
-            <select name="attach_for_type"
-                    id="status" 
-					onchange="change_properties_box(
-						this.options[this.selectedIndex].value,
-						'<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_attachfortype_formcontent',
-						'attach_for_div',
-						'notifications',
-						'');">
-
-                <option tag="voidAttach" value=""><?php echo _NEVER; ?></option>
-                <?php
-                foreach ($diffusion_types as $this_diffusion) {
-                    if (
-                        $this_diffusion->id != 'dest_user'
-                        && $this_diffusion->id != 'copy_list'
-                        && $this_diffusion->id != 'dest_entity'
-                        && $this_diffusion->id != 'note_dest_user'
-                        && $this_diffusion->id != 'note_copy_list'
-                    ) {
-                        ?><option tag="attach" value="<?php functions::xecho($this_diffusion->id); ?>"
-						<?php
-                        if (trim($_SESSION['m_admin']['notification']['attachfor_type'])
-                            == trim($this_diffusion->id)) {
-                            echo 'selected="selected"';
-                        } ?>><?php functions::xecho($this_diffusion->label); ?></option><?php
-                    }
-                } ?>
-            </select>
-        </p>
-
-        <div id="attach_for_div" class="scroll_div" style="height:200px;width:600px;border:1px solid;">
-			<!-- div for attachment options -->
-			<p class="sstit"> <?php echo _NO_ATTACHMENT_WITH_NOTIFICATION; ?></p>
-        </div>
-        <p class="buttons">
-            <?php
-        if ($mode == 'up') {
-            ?>
-            <input type="submit" class="button" name="notif_submit" value=
-            "<?php echo _VALIDATE; ?>" />
-            <?php
-        } elseif ($mode == 'add') {
-            ?>
-            <input type="submit" class="button" name="notif_submit" value=
-            "<?php echo _ADD; ?>" />
-            <?php
-        } ?>
-        <input type="button" class="button"  name="cancel" value="<?php
-         echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php
-         echo $_SESSION['config']['businessappurl']; ?>index.php?page=manage_notifications_controler&amp;mode=list&amp;module=notifications'"/>
-            <?php
-
-        $filename = 'notification';
-        if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id'] != '') {
-            $filename .= '_'.str_replace(' ', '', $_SESSION['custom_override_id']);
-        }
-        $filename .= '_'.$notification_sid.'.sh';
-
-        if ($_SESSION['custom_override_id'] != '') {
-            $pathToFolow = $_SESSION['config']['corepath'].'custom/'.$_SESSION['custom_override_id'].'/';
-        } else {
-            $pathToFolow = $_SESSION['config']['corepath'];
-        }
-
-        if ($mode == 'up' && PHP_OS == 'Linux' && !file_exists($pathToFolow.'modules/notifications/batch/scripts/'.$filename)) {
-            ?>
-            <input class="button" type="button" name="create_notif_script" id="create_notif_script" value="<?php echo _CREATE_NOTIF_SCRIPT; ?>" 
-            onclick="createNotifScript('<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&amp;page=create_notif_script&amp;module=notifications', '<?php functions::xecho($_SESSION['m_admin']['notification']['notification_sid']); ?>', '<?php echo $_SESSION['m_admin']['notification']['notification_id']; ?>')"/>
-            <?php
-        } ?>
-    </p>
-    </form >
-    </div>
-<?php
-    } ?></div><?php
-
-    // Manage notification mode
-    if ($_SESSION['m_admin']['notification']['notification_mode'] == 'EMAIL'
-        || $_SESSION['m_admin']['notification']['notification_mode'] == '') {
-        ?>
-        <script language="javascript">
-			window.document.getElementById('rss_url_div').style.display = 'none';
-			window.document.getElementById('template_div').style.display = 'block';
-        </script>
-        <?php
-    } elseif ($_SESSION['m_admin']['notification']['notification_mode'] == 'RSS') {
-        ?>
-        <script language="javascript">
-			window.document.getElementById('rss_url_div').style.display = 'block';
-			window.document.getElementById('template_div').style.display = 'none';
-        </script>
-        <?php
-    }
-    // Manage Diffusion type Div & content
-    if ($_SESSION['m_admin']['notification']['diffusion_type'] != '') {
-        /*First Launch */ ?>
-        <script language="javascript">
-        change_properties_box(
-            '<?php functions::xecho($_SESSION['m_admin']['notification']['diffusion_type']); ?>',
-            '<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_diffusiontype_formcontent',
-            'diff_type_div',
-            'notifications',
-            '');
-        </script>
-        <?php
-        if ($_SESSION['m_admin']['notification']['diffusion_type'] != '') {
-            //Loading Extra Javascript :
-            require_once 'modules'.DIRECTORY_SEPARATOR.'notifications'.DIRECTORY_SEPARATOR
-                .'class'.DIRECTORY_SEPARATOR.'diffusion_type_controler.php';
-            $Type = new diffusion_type_controler();
-            $dType = $Type->get($_SESSION['m_admin']['notification']['diffusion_type']); ?>
-            <script language="javascript">
-            setTimeout(function(){loadDiffusionProperties(
-                '<?php functions::xecho($_SESSION['m_admin']['notification']['diffusion_type']); ?>',
-                '<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_diffusionproperties_formcontent'
-                )},500);
-            </script>
-            <?php
-        }
-    }
-
-    // Manage Attachment Div & content
-    if ($_SESSION['m_admin']['notification']['attachfor_type'] != '') {
-        /*First Launch */ ?>
-        <script language="javascript">
-		change_properties_box(
-            '<?php functions::xecho($_SESSION['m_admin']['notification']['attachfor_type']); ?>',
-            '<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_attachfortype_formcontent',
-            'attach_for_div',
-            'notifications',
-            '');
-        </script>
-        <?php
-        if ($_SESSION['m_admin']['notification']['attachfor_type'] != '') {
-            //Loading Extra Javascript :
-            require_once 'modules'.DIRECTORY_SEPARATOR.'notifications'.DIRECTORY_SEPARATOR
-                .'class'.DIRECTORY_SEPARATOR.'diffusion_type_controler.php';
-            $Type = new diffusion_type_controler();
-
-            $dType = $Type->get($_SESSION['m_admin']['notification']['diffusion_type']);
-            //include_once ($dType->script); ?>
-            <script language="javascript">
-                setTimeout(function () {loadAttachforProperties(
-                '<?php functions::xecho($_SESSION['m_admin']['notification']['attachfor_type']); ?>',
-                '<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=notifications&page=load_attachforproperties_formcontent',
-				'attach_for_div'
-                )},500);
-            </script>
-            <?php
-        }
-    }
-}
diff --git a/modules/notifications/manage_notifications_controler.php b/modules/notifications/manage_notifications_controler.php
deleted file mode 100755
index cc790eee6992441030da658f501d0ebe41c199fd..0000000000000000000000000000000000000000
--- a/modules/notifications/manage_notifications_controler.php
+++ /dev/null
@@ -1,499 +0,0 @@
-<?php
-core_tools::load_lang();
-$core_tools = new core_tools();
-$core_tools->test_admin('admin_notif', 'notifications');
-
-// Default mode is add
-$mode = 'add';
-if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) {
-    $mode = $_REQUEST['mode'];
-}
-
-try {
-    require_once 'core/class/ActionControler.php';
-    require_once 'core/class/ObjectControlerAbstract.php';
-    require_once 'core/class/ObjectControlerIF.php';
-    require_once 'modules/templates/class/templates_controler.php';
-    require_once 'modules/notifications/class/notifications_controler.php';
-    require_once 'modules/notifications/class/diffusion_type_controler.php';
-    require_once 'modules/notifications/class/class_schedule_notifications.php';
-
-    if ($mode == 'list') {
-        require_once 'core/class/class_request.php';
-        require_once 'apps'.DIRECTORY_SEPARATOR
-                     .$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR
-                     .'class'.DIRECTORY_SEPARATOR.'class_list_show.php';
-    } elseif ($mode == 'add' || $mode == 'up' || $mode == 'del') {
-        require_once 'core/class/class_request.php';
-    }
-} catch (Exception $e) {
-    functions::xecho($e->getMessage());
-}
-
-//Get list of aff availables actions
-$al = new ActionControler();
-$actions_list = $al->getAllActions();
-
-//Get list of aff availables status
-$select[STATUS_TABLE] = array();
-    array_push($select[STATUS_TABLE], 'id', 'label_status', 'img_filename');
-$request = new request();
-$where = '';
-    $what = '';
-    $tab = $request->PDOselect(
-        $select, $where, array(), $orderstr, $_SESSION['config']['databasetype']
-    );
-$status_list = $tab;
-
-//Get list of all diffusion types
-$dt = new diffusion_type_controler();
-$diffusion_types = $dt->getAllDiffusion();
-
-//Get list of all templates
-$tp = new templates_controler();
-$templates_list = $tp->getAllTemplatesForSelect();
-
-if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
-    $notification_sid = $_REQUEST['id'];
-}
-
-if (isset($_REQUEST['notif_submit'])) {
-    // Action to do with db
-    validate_notif_submit();
-} else {
-    // Display to do
-    $state = true;
-    switch ($mode) {
-        case 'up':
-            $state = display_up($notification_sid);
-            $_SESSION['service_tag'] = 'notif_init';
-            core_tools::execute_modules_services(
-                $_SESSION['modules_services'], 'notif_init', 'include'
-            );
-            location_bar_management($mode);
-            break;
-        case 'add':
-            display_add();
-            $_SESSION['service_tag'] = 'notif_init';
-            core_tools::execute_modules_services(
-                $_SESSION['modules_services'], 'notif_init', 'include'
-            );
-            location_bar_management($mode);
-            break;
-        case 'del':
-            display_del($notification_sid);
-            break;
-        case 'list':
-            $notifsList = display_list();
-            location_bar_management($mode);
-           // print_r($statusList); exit();
-            break;
-    }
-    include 'manage_notifications.php';
-}
-
-/**
- * Management of the location bar.
- */
-function location_bar_management($mode)
-{
-    $pageLabels = array('add' => _ADDITION,
-                    'up' => _MODIFICATION,
-                    'list' => _MANAGE_NOTIFS,
-               );
-    $pageIds = array('add' => 'notif_add',
-                  'up' => 'notif_up',
-                  'list' => 'notif_list',
-            );
-    $init = false;
-    if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') {
-        $init = true;
-    }
-
-    $level = '';
-    if (isset($_REQUEST['level'])
-        && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3
-            || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) {
-        $level = $_REQUEST['level'];
-    }
-
-    $pagePath = $_SESSION['config']['businessappurl'].'index.php?page='
-               .'manage_notifications_controler&module=notifications&mode='.$mode;
-    $pageLabel = $pageLabels[$mode];
-    $pageId = $pageIds[$mode];
-    $ct = new core_tools();
-    $ct->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level);
-}
-
-/**
- * Initialize session parameters for update display.
- *
- * @param string $statusId
- */
-function display_up($notification_sid)
-{
-    $notifCtrl = new notifications_controler();
-    $state = true;
-    $notif = $notifCtrl->get($notification_sid);
-
-    if (empty($notif)) {
-        $state = false;
-    } else {
-        //var_dump($notif);
-        put_in_session('notification', $notif->getArray());
-    }
-
-    return $state;
-}
-
-/**
- * Initialize session parameters for add display.
- */
-function display_add()
-{
-    if (!isset($_SESSION['m_admin']['init'])) {
-        init_session();
-    }
-}
-
-/**
- * Initialize session parameters for list display.
- */
-function display_list()
-{
-    if (PHP_OS == 'Linux') {
-        ?>
-        <table>
-        </table>
-    	<table width="100%">
-    	    <tr>
-    	        <td align="right">
-    	        </td>
-    	   </tr>
-    	</table>
-    <?php
-    }
-    $_SESSION['m_admin'] = array();
-    $list = new list_show();
-    $func = new functions();
-    init_session();
-
-    $select[NOTIFICATIONS] = array();
-    array_push(
-        $select[NOTIFICATIONS], 'notification_sid', 'notification_id', 'description'
-    );
-    $where = '';
-    $what = '';
-    $arrayPDO = array();
-
-    if (isset($_REQUEST['what'])) {
-        $what = $_REQUEST['what'];
-    }
-    $where .= ' (lower(description) like lower(:what) or lower(notification_id) like lower(:what)) ';
-    $arrayPDO = array(':what' => $what.'%');
-
-    // Checking order and order_field values
-    $order = 'asc';
-    if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) {
-        $order = trim($_REQUEST['order']);
-    }
-
-    $field = 'description';
-    if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) {
-        $field = trim($_REQUEST['order_field']);
-    }
-
-    $orderstr = $list->define_order($order, $field);
-    $request = new request();
-    $tab = $request->PDOselect(
-        $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']
-    );
-    //$request->show();
-
-    if (!empty($tab)) {
-        for ($i = 0; $i < count($tab); ++$i) {
-            foreach ($tab[$i] as &$item) {
-                switch ($item['column']) {
-                    case 'notification_sid':
-                        format_item(
-                            $item, _ID, '15', 'left', 'left', 'bottom', true
-                        );
-                        break;
-                    case 'notification_id':
-                        format_item(
-                            $item, _NOTIFICATION_ID, '30', 'left', 'left', 'bottom', true
-                        );
-                        break;
-                    case 'description':
-                        format_item(
-                            $item, _DESC, '45', 'left', 'left', 'bottom', true
-                        );
-                        break;
-                }
-            }
-        }
-    }
-    $_SESSION['m_admin']['init'] = true;
-    $result = array(
-        'tab' => $tab,
-        'what' => $what,
-        'page_name' => 'manage_notifications_controler&mode=list',
-        'page_name_add' => 'manage_notifications_controler&mode=add',
-        'page_name_up' => 'manage_notifications_controler&mode=up',
-        'page_name_del' => 'manage_notifications_controler&mode=del',
-        'page_name_val' => '',
-        'page_name_ban' => '',
-        'label_add' => _ADD_NOTIF,
-        'title' => _NOTIFS_LIST.' : '.$i,
-        'autoCompletionArray' => array(
-                                     'list_script_url' => $_SESSION['config']['businessappurl']
-                                        .'index.php?display=true&module=notifications'
-                                        .'&page=manage_notifs_list_by_name',
-                                     'number_to_begin' => 1,
-                                 ),
-    );
-
-    return $result;
-}
-
-/**
- * Delete given status if exists and initialize session parameters.
- *
- * @param string $statusId
- */
-function display_del($notification_sid)
-{
-    $notifCtrl = new notifications_controler();
-    $notif = $notifCtrl->get($notification_sid);
-    if (isset($notif)) {
-        // Deletion
-        $control = array();
-        $params = array('log_status_del' => $_SESSION['history']['eventdel'],
-                         'databasetype' => $_SESSION['config']['databasetype'],
-                        );
-        $control = $notifCtrl->delete($notif, $params);
-        if (!empty($control['error']) && $control['error'] != 1) {
-            $_SESSION['error'] = str_replace('#', '<br />', $control['error']);
-        } else {
-            $_SESSION['info'] = _NOTIF_DELETED.' : '.$notification_sid;
-
-            if (PHP_OS == 'Linux') {
-                // delete scheduled notification
-                $filename = 'notification';
-                if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id'] != '') {
-                    $filename .= '_'.str_replace(' ', '', $_SESSION['custom_override_id']);
-                }
-                $filename .= '_'.$notification_sid.'.sh';
-
-                $scheduleNotification = new ScheduleNotifications();
-                $cronTab = $scheduleNotification->getCrontab();
-
-                $flagCron = false;
-
-                if ($_SESSION['custom_override_id'] != '') {
-                    $pathToFolow = $_SESSION['config']['corepath'].'custom/'.$_SESSION['custom_override_id'].'/';
-                } else {
-                    $pathToFolow = $_SESSION['config']['corepath'];
-                }
-
-                foreach ($cronTab as $key => $value) {
-                    if ($value['cmd'] == $pathToFolow.'modules/notifications/batch/scripts/'.$filename) {
-                        $cronTab[$key]['state'] = 'deleted';
-                        $flagCron = true;
-                        break;
-                    }
-                }
-
-                if ($flagCron) {
-                    $scheduleNotification->saveCrontab($cronTab, true);
-                }
-
-                unlink($pathToFolow.'modules/notifications/batch/scripts/'.$filename);
-            }
-        } ?><script type="text/javascript">window.top.location='<?php
-            echo $_SESSION['config']['businessappurl']
-                .'index.php?page=manage_notifications_controler&mode=list&module='
-                .'notifications&order='.$_REQUEST['order'].'&order_field='
-                .$_REQUEST['order_field'].'&start='.$_REQUEST['start']
-                .'&what='.$_REQUEST['what']; ?>';</script>
-        <?php
-        exit();
-    } else {
-        // Error management
-        $_SESSION['error'] = _NOTIF.' '._UNKNOWN;
-    }
-}
-
-/**
- * Format given item with given values, according with HTML formating.
- * NOTE: given item needs to be an array with at least 2 keys:
- * 'column' and 'value'.
- * NOTE: given item is modified consequently.
- *
- * @param $item
- * @param $label
- * @param $size
- * @param $labelAlign
- * @param $align
- * @param $valign
- * @param $show
- */
-function format_item(
-    &$item, $label, $size, $labelAlign, $align, $valign, $show, $order = true
-) {
-    $func = new functions();
-    $item['value'] = $func->show_string($item['value']);
-    $item[$item['column']] = $item['value'];
-    $item['label'] = $label;
-    $item['size'] = $size;
-    $item['label_align'] = $labelAlign;
-    $item['align'] = $align;
-    $item['valign'] = $valign;
-    $item['show'] = $show;
-    if ($order) {
-        $item['order'] = $item['value'];
-    } else {
-        $item['order'] = '';
-    }
-}
-
-/**
- * Validate a submit (add or up),
- * up to saving object.
- */
-function validate_notif_submit()
-{
-    $dType = new diffusion_type_controler();
-    $diffType = array();
-    $diffType = $dType->getAllDiffusion();
-
-    $notifCtrl = new notifications_controler();
-    $pageName = 'manage_notifications_controler';
-
-    $mode = $_REQUEST['mode'];
-    $notifObj = new notifications();
-
-    if ($mode != 'add') {
-        $notifObj->notification_sid = $_REQUEST['notification_sid'];
-    }
-    $notifObj->notification_id = $_REQUEST['notification_id'];
-    $notifObj->description = $_REQUEST['description'];
-    $notifObj->notification_mode = $_REQUEST['notification_mode'];
-    $notifObj->event_id = $_REQUEST['event_id'];
-    $notifObj->template_id = $_REQUEST['template_id'];
-    $notifObj->is_enabled = $_REQUEST['is_enabled'];
-    $notifObj->diffusion_type = $_REQUEST['diffusion_type'];
-    $notifObj->attachfor_type = $_REQUEST['attachfor_type'];
-
-    foreach ($diffType as $loadedType) {
-        if ($loadedType->id == $notifObj->diffusion_type) {
-            if ($loadedType->script != '' && !empty($_REQUEST['diffusion_properties'])) {
-                $diffusion_properties_string = implode(',', $_REQUEST['diffusion_properties']);
-            } else {
-                $error .= 'System : Unable to load Require Script';
-            }
-        }
-        if ($loadedType->id == $notifObj->attachfor_type) {
-            if ($loadedType->script != '' && !empty($_REQUEST['attachfor_properties'])) {
-                $attachfor_properties_string = implode(',', $_REQUEST['attachfor_properties']);
-            } else {
-                $error .= 'System : Unable to load Require Script';
-            }
-        }
-    }
-
-    $notifObj->diffusion_properties = (string) $diffusion_properties_string;
-    $notifObj->attachfor_properties = (string) $attachfor_properties_string;
-
-    $control = $notifCtrl->save($notifObj, $mode, $params);
-
-    if (!empty($control['error']) && $control['error'] != 1) {
-        // Error management depending of mode
-        $_SESSION['error'] = str_replace('#', '<br />', $control['error']);
-        //put_in_session('event', $notif);
-        put_in_session('notification', $notifObj->getArray());
-
-        switch ($mode) {
-            case 'up':
-                if (!empty($notifObj->notification_sid)) {
-                    header(
-                        'location: '.$_SESSION['config']['businessappurl']
-                        .'index.php?page='.$pageName.'&mode=up&id='
-                        .$notifObj->notification_sid.'&module=notifications'
-                    );
-                } else {
-                    header(
-                        'location: '.$_SESSION['config']['businessappurl']
-                        .'index.php?page='.$pageName.'&mode=list&module='
-                        .'notifications&order='.$status['order'].'&order_field='
-                        .$status['order_field'].'&start='.$status['start']
-                        .'&what='.$status['what']
-                    );
-                }
-                exit();
-            case 'add':
-                header(
-                    'location: '.$_SESSION['config']['businessappurl']
-                    .'index.php?page='.$pageName.'&mode=add&module=notifications'
-                );
-                exit();
-        }
-    } else {
-        if ($mode == 'add') {
-            $_SESSION['info'] = _NOTIF_ADDED;
-        } else {
-            $_SESSION['info'] = _NOTIF_MODIFIED;
-        }
-
-        if (PHP_OS == 'Linux') {
-            $ScheduleNotifications = new ScheduleNotifications();
-            $ScheduleNotifications->createScriptNotification($control['value'], $notifObj->notification_id);
-        }
-
-        unset($_SESSION['m_admin']);
-        header(
-            'location: '.$_SESSION['config']['businessappurl']
-            .'index.php?page='.$pageName.'&mode=list&module=notifications&order='
-            .$status['order'].'&order_field='.$status['order_field']
-            .'&start='.$status['start'].'&what='.$status['what']
-        );
-    }
-}
-
-function init_session()
-{
-    $_SESSION['m_admin']['notification'] = array(
-        'notification_sid' => '',
-        'notification_id' => '',
-        'event_id' => '',
-        'description' => '',
-        'notification_mode' => '',
-        'template_id' => '',
-        'is_enabled' => 'Y',
-        'diffusion_type' => '',
-        'diffusion_properties' => '',
-        //'diffusion_content'   => '',
-        'attachfor_type' => '',
-        'attachfor_properties' => '',
-    );
-}
-
-/**
- * Put given object in session, according with given type
- * NOTE: given object needs to be at least hashable.
- *
- * @param string   $type
- * @param hashable $hashable
- */
-function put_in_session($type, $hashable, $showString = true)
-{
-    $func = new functions();
-    foreach ($hashable as $key => $value) {
-        if ($showString) {
-            $_SESSION['m_admin'][$type][$key] = $func->show_string($value);
-        } else {
-            $_SESSION['m_admin'][$type][$key] = $value;
-        }
-    }
-    //print_r($_SESSION['m_admin']);
-}
diff --git a/modules/notifications/notifications_tables_definition.php b/modules/notifications/notifications_tables_definition.php
index d9eb4d0753eb0e13fd319894a09f56497251c5c1..d3e4ad018eefa10875cfeacf1da37f611bc8f6d4 100755
--- a/modules/notifications/notifications_tables_definition.php
+++ b/modules/notifications/notifications_tables_definition.php
@@ -1,17 +1,8 @@
 <?php
 
-if (!defined('_TEMPLATES_ASSOCIATION_TABLE_NAME')) {
-    define('_TEMPLATES_ASSOCIATION_TABLE_NAME', 'templates_association');
-}
 if (!defined('_NOTIFICATIONS_TABLE_NAME')) {
     define('_NOTIFICATIONS_TABLE_NAME', 'notifications');
 }
 if (!defined('_NOTIF_EVENT_STACK_TABLE_NAME')) {
     define('_NOTIF_EVENT_STACK_TABLE_NAME', 'notif_event_stack');
 }
-if (!defined('_NOTIF_EMAIL_STACK_TABLE_NAME')) {
-    define('_NOTIF_EMAIL_STACK_TABLE_NAME', 'notif_email_stack');
-}
-if (!defined('_TEMPLATES_TABLE_NAME')) {
-    define('_TEMPLATES_TABLE_NAME', 'templates');
-}
diff --git a/modules/notifications/xml/IVS/requests_definitions.xml b/modules/notifications/xml/IVS/requests_definitions.xml
index 556bd72ccbac4a430633f7c0dcd6e4b3d0a8c2f5..bb09a49944ce18cf7e5829c617832053c4c54e98 100755
--- a/modules/notifications/xml/IVS/requests_definitions.xml
+++ b/modules/notifications/xml/IVS/requests_definitions.xml
@@ -1,12 +1,4 @@
 <requestDefinitions>
-	<requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="manage_notifications_controler" >
-        <parameter name="page" value="manage_notifications_controler"/>
-        <parameter name="module" value="notifications"/>
-    </requestDefinition>
-    <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="manage_notifications_controler" >
-        <parameter name="page" value="manage_notifications_controler"/>
-        <parameter name="module" value="notifications"/>
-    </requestDefinition>
     <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="manage_notifs_list_by_name" >
         <parameter name="page" value="manage_notifs_list_by_name"/>
         <parameter name="display" value="true"/>
diff --git a/modules/templates/class/templates_controler.php b/modules/templates/class/templates_controler.php
deleted file mode 100755
index 25f5c8e3c98c9a411b892baaa34418b511b240c4..0000000000000000000000000000000000000000
--- a/modules/templates/class/templates_controler.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2016 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
-* @brief  Contains the controler of template object 
-* (create, save, modify, etc...)
-* 
-* 
-* @file
-* @author Laurent Giovannoni
-* @date $date$
-* @version $Revision$
-* @ingroup templates
-*/
-
-require_once 'modules/templates/class/templates_controler_Abstract.php';
-
-/**
-* @brief  Controler of the templates object 
-*
-*<ul>
-*  <li>Get an templates object from an id</li>
-*  <li>Save in the database a templates</li>
-*  <li>Manage the operation on the templates related tables in the database 
-*  (insert, select, update, delete)</li>
-*</ul>
-* @ingroup templates
-*/
-class templates_controler extends templates_controler_Abstract
-{
-    // custom
-}
diff --git a/modules/templates/class/templates_controler_Abstract.php b/modules/templates/class/templates_controler_Abstract.php
deleted file mode 100755
index 80eed6dca9d1889973287b0f7415c51d8034c2ed..0000000000000000000000000000000000000000
--- a/modules/templates/class/templates_controler_Abstract.php
+++ /dev/null
@@ -1,589 +0,0 @@
-<?php
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-
-* @brief   templates_controler_Abstract
-* @author  dev <dev@maarch.org>
-* @ingroup templates
-*/
-
-// To activate de debug mode of the class
-$_ENV['DEBUG'] = false;
-
-// Loads the required class
-try {
-    include_once 'modules/templates/class/templates.php';
-    include_once 'modules/templates/templates_tables_definition.php';
-    include_once 'core/class/ObjectControlerAbstract.php';
-    include_once 'core/class/ObjectControlerIF.php';
-    include_once 'core/class/SecurityControler.php';
-} catch (Exception $e) {
-    functions::xecho($e->getMessage()) . ' // ';
-}
-
-/**
-* @brief  Controler of the templates object
-*
-*<ul>
-*  <li>Get an templates object from an id</li>
-*  <li>Save in the database a templates</li>
-*  <li>Manage the operation on the templates related tables in the database
-*  (insert, select, update, delete)</li>
-*</ul>
-* @ingroup templates
-*/
-abstract class templates_controler_Abstract extends ObjectControler implements ObjectControlerIF
-{
-    protected $stylesArray = array();
-    
-    /**
-    * Save given object in database:
-    * - make an update if object already exists,
-    * - make an insert if new object.
-    * @param object $template
-    * @param string mode up or add
-    * @return array
-    */
-    public function save($template, $mode='')
-    {
-        $control = array();
-        if (!isset($template) || empty($template)) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _TEMPLATE_ID_EMPTY,
-            );
-            return $control;
-        }
-        $template = $this->isATemplate($template);
-        $this->set_foolish_ids(array('template_id'));
-        $this->set_specific_id('template_id');
-        if ($mode == 'up') {
-            $control = $this->control($template, $mode);
-            $this->set_foolish_ids(array('template_id'));
-            $this->set_specific_id('template_id');
-            if ($control['status'] == 'ok') {
-                $template = $control['value'];
-                if ($template->template_file_name <> '') {
-                    unlink($_SESSION['m_admin']['templates']['current_style']);
-                }
-                //var_dump($this);exit;
-                //Update existing template
-                if ($this->update($template)) {
-                    $control = array(
-                        'status' => 'ok',
-                        'value' => $template->template_id,
-                    );
-                    $this->updateTemplateEntityAssociation($template->template_id);
-                    //history
-                    if ($_SESSION['history']['templateadd'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            _TEMPLATES_TABLE_NAME,
-                            $template->template_id,
-                            'UP',
-                            'templateadd',
-                            _TEMPLATE_UPDATED.' : '.$template->template_id,
-                            $_SESSION['config']['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array(
-                        'status' => 'ko',
-                        'value' => '',
-                        'error' => _PB_WITH_TEMPLATE,
-                    );
-                }
-                return $control;
-            }
-        } else {
-            $control = $this->control($template, 'add');
-            if ($control['status'] == 'ok') {
-                $template = $control['value'];
-                if ($template->template_file_name <> '') {
-                    unlink($_SESSION['m_admin']['templates']['current_style']);
-                }
-                //Insert new template
-                if ($this->insert($template)) {
-                    $templateId = $this->getLastTemplateId($template->template_label);
-                    $control = array(
-                        'status' => 'ok',
-                        'value' => $templateId,
-                    );
-                    $this->updateTemplateEntityAssociation($templateId);
-                    //history
-                    if ($_SESSION['history']['templateadd'] == 'true') {
-                        $history = new history();
-                        $history->add(
-                            _TEMPLATES_TABLE_NAME,
-                            $templateId,
-                            'ADD',
-                            'templateadd',
-                            _TEMPLATE_ADDED . ' : ' . $templateId,
-                            $_SESSION['config']['databasetype']
-                        );
-                    }
-                } else {
-                    $control = array(
-                        'status' => 'ko',
-                        'value' => '',
-                        'error' => _PB_WITH_TEMPLATE,
-                    );
-                }
-            }
-        }
-        return $control;
-    }
-
-    /**
-    * control the template object before action
-    *
-    * @param  object $template template object
-    * @param  string $mode up or add
-    * @return array ok if the object is well formated, ko otherwise
-    */
-    protected function control($template, $mode)
-    {
-        $f = new functions();
-        $sec = new SecurityControler();
-        $error = '';
-
-        $template->template_label = $f->wash($template->template_label, 'no', _TEMPLATE_LABEL.' ', 'yes', 0, 255);
-        $template->template_comment = $f->wash($template->template_comment, 'no', _TEMPLATE_COMMENT.' ', 'yes', 0, 255);
-
-        
-        $template->template_content = str_replace(';', '###', $template->template_content);
-        $template->template_content = str_replace('--', '___', $template->template_content);
-        $allowedTags = '<html><head><body><title>'; //Structure
-        $allowedTags .= '<h1><h2><h3><h4><h5><h6><b><i><tt><u><strike><blockquote><pre><blink><font><big><small><sup><sub><strong><em>'; // Text formatting
-        $allowedTags .='<p><br><hr><center><div><span>'; // Text position
-        $allowedTags .= '<li><ol><ul><dl><dt><dd>'; // Lists
-        $allowedTags .= '<img><a>'; // Multimedia
-        $allowedTags .= '<table><tr><td><th><tbody><thead><tfooter><caption>'; // Tables
-        $allowedTags .= '<form><input><textarea><select>'; // Forms
-        $template->template_content = strip_tags($template->template_content, $allowedTags);
-        
-        $template->template_type = $f->protect_string_db(
-            $f->wash($template->template_type, 'no', _TEMPLATE_TYPE.' ', 'yes', 0, 32)
-        );
-        $template->template_style = $f->protect_string_db(
-            $f->wash($template->template_style, 'no', _TEMPLATE_STYLE.' ', 'no', 0, 255)
-        );
-        if ($mode == 'add' && $this->templateExists($template->template_id)) {
-            $error .= $template->template_id.' '._ALREADY_EXISTS.'#';
-        }
-        $template->template_target = $f->protect_string_db(
-            $f->wash($template->template_target, 'no', _TEMPLATE_TARGET.' ', 'no', 0, 255)
-        );
-        $error .= $_SESSION['error'];
-        //TODO:rewrite wash to return errors without html
-        $error = str_replace('<br />', '#', $error);
-        $return = array();
-        if (!empty($error)) {
-            $return = array(
-                'status' => 'ko',
-                'value' => $template,
-                'error' => $error,
-            );
-        } else {
-            if ($template->template_type == 'OFFICE') {
-                if (($mode == 'up' && $_SESSION['m_admin']['templates']['applet'])
-                    || ($mode == 'up' && !empty($_SESSION['m_admin']['templates']['current_style']))
-                    || $mode == 'add') {
-                    $storeInfos = array();
-                    $storeInfos = $this->storeTemplateFile();
-                    if (!$storeInfos) {
-                        $return = array(
-                            'status' => 'ko',
-                            'value' => $template,
-                            'error' => $_SESSION['error'],
-                        );
-                    } else {
-                        $template->template_path = $storeInfos['destination_dir'];
-                        $template->template_file_name = $storeInfos['file_destination_name'];
-                        $template->template_style = $storeInfos['template_style'];
-                        $return = array(
-                            'status' => 'ok',
-                            'value' => $template,
-                        );
-                    }
-                } else {
-                    $return = array(
-                        'status' => 'ok',
-                        'value' => $template,
-                    );
-                }
-            } else {
-                $return = array(
-                    'status' => 'ok',
-                    'value' => $template,
-                );
-            }
-        }
-        return $return;
-    }
-
-    /**
-    * Inserts in the database (templates table) a templates object
-    *
-    * @param  $template templates object
-    * @return bool true if the insertion is complete, false otherwise
-    */
-    protected function insert($template)
-    {
-        return $this->advanced_insert($template);
-    }
-
-    /**
-    * Updates in the database (templates table) a templates object
-    *
-    * @param  $template templates object
-    * @return bool true if the update is complete, false otherwise
-    */
-    protected function update($template)
-    {
-        return $this->advanced_update($template);
-    }
-
-    /**
-    * Returns an templates object based on a templates identifier
-    *
-    * @param  $template_id string  templates identifier
-    * @param  $comp_where string  where clause arguments
-    * (must begin with and or or)
-    * @param  $can_be_disabled bool  if true gets the template even if it is
-    * disabled in the database (false by default)
-    * @return templates object with properties from the database or null
-    */
-    public function get($template_id, $comp_where='', $can_be_disabled=false)
-    {
-        $this->set_foolish_ids(array('template_id'));
-        $this->set_specific_id('template_id');
-        if (!empty($template_id) && $template_id <> '' && $template_id <> 'empty') {
-            $template = $this->advanced_get($template_id, _TEMPLATES_TABLE_NAME);
-            $template->template_content = str_replace('###', ';', $template->template_content);
-            $template->template_content = str_replace('___', '--', $template->template_content);
-            if (get_class($template) <> 'templates') {
-                return null;
-            } else {
-                //var_dump($template);
-                return $template;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    /**
-    * get templates with given id for a ws.
-    * Can return null if no corresponding object.
-    * @param $template_id of template to send
-    * @return template
-    */
-    public function getWs($template_id)
-    {
-        $this->set_foolish_ids(array('template_id'));
-        $this->set_specific_id('template_id');
-        $template = $this->advanced_get($template_id, _TEMPLATES_TABLE_NAME);
-        if (get_class($template) <> 'templates') {
-            return null;
-        } else {
-            $template = $template->getArray();
-            return $template;
-        }
-    }
-
-    /**
-    * Deletes in the database (templates related tables) a given
-    * templates (template_id)
-    *
-    * @param  $template string  templates identifier
-    * @return bool true if the deletion is complete, false otherwise
-    */
-    public function delete($template)
-    {
-        $control = array();
-        if (!isset($template) || empty($template)) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _TEMPLATES_EMPTY,
-            );
-            return $control;
-        }
-        $template = $this->isATemplate($template);
-        if (!$this->templateExists($template->template_id)) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _TEMPLATES_NOT_EXISTS,
-            );
-            return $control;
-        }
-        $db = new Database();
-        $query = "delete from "._TEMPLATES_TABLE_NAME." where template_id = ? " ;
-            
-        try {
-            //
-            $stmt = $db->query($query, array($template->template_id));
-            $ok = true;
-        } catch (Exception $e) {
-            $control = array(
-                'status' => 'ko',
-                'value' => '',
-                'error' => _CANNOT_DELETE_TEMPLATE_ID.' '.$template->template_id,
-            );
-            $ok = false;
-        }
-        $control = array(
-            'status' => 'ok',
-            'value' => $template->template_id,
-        );
-        if ($_SESSION['history']['templatedel'] == 'true') {
-            include_once 'core/class/class_history.php';
-            $history = new history();
-            $history->add(
-                _TEMPLATES_TABLE_NAME,
-                $template->template_id,
-                'DEL',
-                'templatedel',
-                _TEMPLATE_DELETED.' : '.$template->template_id,
-                $_SESSION['config']['databasetype']
-            );
-        }
-        return $control;
-    }
-
-    /**
-    * Disables a given templates
-    *
-    * @param  $template templates object
-    * @return bool true if the disabling is complete, false otherwise
-    */
-    public function disable($template)
-    {
-        //
-    }
-
-    /**
-    * Enables a given templates
-    *
-    * @param  $template templates object
-    * @return bool true if the enabling is complete, false otherwise
-    */
-    public function enable($template)
-    {
-        //
-    }
-
-    /**
-    * Fill a template object with an object if it's not a template
-    *
-    * @param  $object ws template object
-    * @return object template
-    */
-    protected function isATemplate($object)
-    {
-        if (get_class($object) <> 'templates') {
-            $func = new functions();
-            $templateObject = new templates();
-            $array = array();
-            $array = $func->object2array($object);
-            foreach (array_keys($array) as $key) {
-                $templateObject->{$key} = $array[$key];
-            }
-            return $templateObject;
-        } else {
-            return $object;
-        }
-    }
-
-    /**
-    * Checks if the template exists
-    *
-    * @param $template_id templates identifier
-    * @return bool true if the template exists
-    */
-    public function templateExists($template_id)
-    {
-        if (!isset($template_id) || empty($template_id)) {
-            return false;
-        }
-        $db = new Database();
-        
-        $query = "select template_id from " . _TEMPLATES_TABLE_NAME
-            . " where template_id = ? ";
-        try {
-            $stmt = $db->query($query, array($template_id));
-        } catch (Exception $e) {
-            echo _UNKNOWN . _TEMPLATES . ' ' . $template_id . ' // ';
-        }
-        if ($stmt->rowCount() > 0) {
-            return true;
-        }
-        return false;
-    }
-    
-    /**
-    * Return the last templateId
-    *
-    * @return bigint templateId
-    */
-    public function getLastTemplateId($templateLabel)
-    {
-        $db = new Database();
-        $query = "select template_id from " . _TEMPLATES_TABLE_NAME
-            . " where template_label = ? "
-            . " order by template_id desc";
-        $stmt = $db->query($query, array($templateLabel));
-        $queryResult = $stmt->fetchObject();
-        return $queryResult->template_id;
-    }
-
-    /**
-    * Return all templates ID
-    *
-    * @return array of templates
-    */
-    public function getAllId($can_be_disabled = false)
-    {
-        $db = new Database();
-        $query = "select template_id from " . _TEMPLATES_TABLE_NAME . " ";
-        if (!$can_be_disabled) {
-            $query .= " where enabled = 'Y'";
-        }
-        try {
-            //
-            $stmt = $db->query($query);
-        } catch (Exception $e) {
-            echo _NO_TEMPLATES . ' // ';
-        }
-        if ($db->rowCount() > 0) {
-            $result = array();
-            $cptId = 0;
-            while ($queryResult = $stmt->fetchObject()) {
-                $result[$cptId] = $queryResult->template_id;
-                $cptId++;
-            }
-            return $result;
-        } else {
-            return null;
-        }
-    }
-    
-    /**
-    * Return all templates in an array
-    *
-    * @return array of templates
-    */
-    public function getAllTemplatesForSelect()
-    {
-        $return = array();
-        
-        $db = new Database();
-        $stmt = $db->query("select * from " . _TEMPLATES_TABLE_NAME . " ");
-        
-        while ($result = $stmt->fetchObject()) {
-            $this_template = array();
-            $this_template['ID'] = $result->template_id;
-            $this_template['LABEL'] = $result->template_label;
-            $this_template['COMMENT'] = $result->template_comment;
-            $this_template['TYPE'] = $result->template_type;
-            $this_template['TARGET'] = $result->template_target;
-            array_push($return, $this_template);
-        }
-        
-        return $return;
-    }
-    
-    public function updateTemplateEntityAssociation($templateId)
-    {
-        $db = new Database();
-        $db->query(
-            "delete from " . _TEMPLATES_ASSOCIATION_TABLE_NAME
-            . " where template_id = ?",
-            array($templateId)
-        );
-       
-        for ($i=0;$i<count($_SESSION['m_admin']['templatesEntitiesSelected']);$i++) {
-            $db->query(
-                "insert into " . _TEMPLATES_ASSOCIATION_TABLE_NAME
-                . " (template_id, value_field) VALUES (?, ?)",
-                array($templateId, $_SESSION['m_admin']['templatesEntitiesSelected'][$i])
-            );
-        }
-    }
-    
-    //returns file ext
-    public function extractFileExt($sFullPath)
-    {
-        $sName = $sFullPath;
-        if (strpos($sName, '.')==0) {
-            $ExtractFileExt = '';
-        } else {
-            $ExtractFileExt = explode('.', $sName);
-        }
-        return end($ExtractFileExt);
-    }
-    
-    public function storeTemplateFile()
-    {
-        if (!$_SESSION['m_admin']['templates']['applet']) {
-            $tmpFileName = 'cm_tmp_file_' . $_SESSION['user']['UserId']
-                . '_' . rand() . '.'
-                . strtolower(
-                    $this->extractFileExt(
-                        $_SESSION['m_admin']['templates']['current_style']
-                    )
-                );
-            $tmpFilePath = $_SESSION['config']['tmppath'] . $tmpFileName;
-            if (!copy($_SESSION['m_admin']['templates']['current_style'], $tmpFilePath)) {
-                $_SESSION['error'] = _PB_TO_COPY_STYLE_ON_TMP . ' ' . $tmpFilePath;
-                return false;
-            } else {
-                $_SESSION['m_admin']['templates']['current_style'] = $tmpFilePath;
-            }
-        }
-        if ($_SESSION['m_admin']['templates']['current_style'] == '') {
-            $_SESSION['error'] = _SELECT_A_TEMPLATE_STYLE;
-            return false;
-        } else {
-            if (file_exists($_SESSION['m_admin']['templates']['current_style'])) {
-                $storeInfos = array();
-                $fileName = basename(
-                    $_SESSION['m_admin']['templates']['current_style']
-                );
-                $fileSize = filesize(
-                    $_SESSION['m_admin']['templates']['current_style']
-                );
-                $fileExtension = $this->extractFileExt(
-                    $_SESSION['m_admin']['templates']['current_style']
-                );
-                include_once 'core/class/docservers_controler.php';
-                $docservers_controler = new docservers_controler();
-                $fileTemplateInfos = array(
-                    'tmpDir'      => $_SESSION['config']['tmppath'],
-                    'size'        => $fileSize,
-                    'format'      => $fileExtension,
-                    'tmpFileName' => $fileName,
-                );
-                $storeInfos = $docservers_controler->storeResourceOnDocserver(
-                    'templates',
-                    $fileTemplateInfos
-                );
-                $storeInfos['template_style'] = $_SESSION['m_admin']['templates']['template_style'];
-                if (!file_exists($storeInfos['path_template'] . str_replace("#", DIRECTORY_SEPARATOR, $storeInfos['destination_dir']) . $storeInfos['file_destination_name'])) {
-                    $_SESSION['error'] = $storeInfos['error'];
-                    return false;
-                }
-                return $storeInfos;
-            } else {
-                $_SESSION['error'] = 'ERROR : file not exists '
-                    . $_SESSION['m_admin']['templates']['current_style'];
-                return false;
-            }
-        }
-    }
-}
diff --git a/modules/templates/file_iframe.php b/modules/templates/file_iframe.php
deleted file mode 100755
index 4ccc3e7915da9381dc975428d0fb30c0636a8204..0000000000000000000000000000000000000000
--- a/modules/templates/file_iframe.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-require_once 'modules/templates/class/templates_controler.php';
-require_once 'modules/templates/templates_tables_definition.php';
-require_once 'modules/attachments/attachments_tables.php';
-$templates_controler = new templates_controler();
-$db = new Database();
-$core = new core_tools();
-$core->load_lang();
-$_SESSION['template_content'] = '';
-if (isset($_REQUEST['template_content']) && !empty($_REQUEST['template_content'])) {
-    $_SESSION['template_content'] = stripslashes($_REQUEST['template_content']);
-    $_SESSION['upfile']['format'] = 'maarch';
-    $_SESSION['upfile']['name'] = 'tmp_file_'
-                .$_SESSION['user']['UserId'].'_'.rand().'.maarch';
-    $tmpPath = $_SESSION['config']['tmppath'].DIRECTORY_SEPARATOR
-             .$_SESSION['upfile']['name'];
-    $myfile = fopen($tmpPath, 'w');
-    fwrite($myfile, $_SESSION['template_content']);
-    fclose($myfile);
-    $_SESSION['upfile']['size'] = filesize($tmpPath);
-} else {
-    if (isset($_REQUEST['model_id']) && !empty($_REQUEST['model_id'])) {
-        $template = $templates_controler->get($_REQUEST['model_id']);
-        $_SESSION['template_content'] = stripslashes($template->template_content);
-        $_SESSION['upfile']['format'] = 'maarch';
-    }
-}
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $_SESSION['config']['lang']; ?>" lang="<?php echo $_SESSION['config']['lang']; ?>">
-<head>
-    <title><?php functions::xecho($_SESSION['config']['applicationname']); ?></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang']; ?>" />
-    <link rel="stylesheet" type="text/css" href="<?php functions::xecho($_SESSION['config']['css']); ?>" media="screen" />
-    <script type="text/javascript" src="../../node_modules/tinymce/tinymce.min.js"></script>
-    <?php
-    $_SESSION['mode_editor'] = false;
-    $height = '85vh';
-    include 'modules/templates/load_editor.php';
-    ?>
-</head>
-<body>
-    <form name="frmtemplate" id="frmtemplate" method="post">
-        <textarea name="template_content" id="template_content" style="width:98%;" rows="40">
-            <?php functions::xecho($_SESSION['template_content']); ?>
-        </textarea>
-        <p>
-            <!--<input type="submit" class="button" name="valid" id="valid" value="<?php echo _VALID_TEXT; ?>" />-->
-        </p>
-    </form>
-</body>
-</html>
diff --git a/modules/templates/templates_tables_definition.php b/modules/templates/templates_tables_definition.php
deleted file mode 100755
index c79265f01fe112a71146df743bd6c9c79b4b2fb8..0000000000000000000000000000000000000000
--- a/modules/templates/templates_tables_definition.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/*
-*   Copyright 2008-2015 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework 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 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework 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 Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-if (!defined('_TEMPLATES_TABLE_NAME')) {
-    define('_TEMPLATES_TABLE_NAME', 'templates');
-}
-
-if (!defined('_TEMPLATES_ASSOCIATION_TABLE_NAME')) {
-    define('_TEMPLATES_ASSOCIATION_TABLE_NAME', 'templates_association');
-}