static function postClone(NotificationTemplate $clone, $oldid)
 {
     global $DB;
     $trad = new NotificationTemplateTranslation();
     $fkey = getForeignKeyFieldForTable($clone->getTable());
     $crit = array($fkey => $oldid);
     foreach ($DB->request($trad->getTable(), $crit) as $data) {
         unset($data['id']);
         $data[$fkey] = $clone->getID();
         $trad->add(Toolbox::addslashes_deep($data));
     }
 }
 /**
  * Install mreporting notifications.
  * 
  * @return array 'success' => true on success
  */
 static function install()
 {
     global $LANG, $DB;
     // Création du template de la notification
     $template = new NotificationTemplate();
     $found_template = $template->find("itemtype = 'PluginMreportingNotification'");
     if (count($found_template) == 0) {
         $template_id = $template->add(array('name' => $LANG['plugin_mreporting']['notification_name'], 'comment' => $LANG['plugin_mreporting']['notification_comment'], 'itemtype' => 'PluginMreportingNotification'));
         // Ajout d'une traduction (texte) en Français
         $translation = new NotificationTemplateTranslation();
         $translation->add(array('notificationtemplates_id' => $template_id, 'language' => '', 'subject' => $LANG['plugin_mreporting']['notification_subject'], 'content_text' => $LANG['plugin_mreporting']['notification_text'], 'content_html' => $LANG['plugin_mreporting']['notification_html']));
         // Création de la notification
         $notification = new Notification();
         $notification_id = $notification->add(array('name' => $LANG['plugin_mreporting']['notification_name'], 'comment' => $LANG['plugin_mreporting']['notification_comment'], 'entities_id' => 0, 'is_recursive' => 1, 'is_active' => 1, 'itemtype' => 'PluginMreportingNotification', 'notificationtemplates_id' => $template_id, 'event' => 'sendReporting', 'mode' => 'mail'));
     }
     $DB->query('INSERT INTO glpi_notificationtargets (items_id, type, notifications_id) 
            VALUES (1, 1, ' . $notification_id . ');');
     return array('success' => true);
 }
Example #3
0
function plugin_consumables_uninstall()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/consumables/inc/profile.class.php";
    include_once GLPI_ROOT . "/plugins/consumables/inc/menu.class.php";
    $tables = array("glpi_plugin_consumables_profiles", "glpi_plugin_consumables_requests");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableRequest', 'FIELDS' => 'id');
    $notif = new Notification();
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableResponse', 'FIELDS' => 'id');
    $notif = new Notification();
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginConsumablesRequest', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    // Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginConsumablesProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    PluginConsumablesMenu::removeRightsFromSession();
    PluginConsumablesProfile::removeRightsFromSession();
    return true;
}
 public static function install()
 {
     $notifications = array('plugin_formcreator_form_created' => array('name' => __('A form has been created', 'formcreator'), 'subject' => __('Your request have been saved', 'formcreator'), 'content' => __('Hi,\\nYour request from GLPI have been successfully saved with number ##formcreator.request_id## and transmetted to the helpdesk team.\\nYou can see your answers onto the following link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_need_validation' => array('name' => __('A form need to be validate', 'formcreator'), 'subject' => __('A form from GLPI need to be validate', 'formcreator'), 'content' => __('Hi,\\nA form from GLPI need to be validate and you have been choosen as the validator.\\nYou can access it by clicking onto this link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::APPROVER), 'plugin_formcreator_refused' => array('name' => __('The form is refused', 'formcreator'), 'subject' => __('Your form have been refused by the validator', 'formcreator'), 'content' => __('Hi,\\nWe are sorry to inform you that your form have been refused by the validator for the reason below:\\n##formcreator.validation_comment##\\n\\nYou can still modify and resubmit it by clicking onto this link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_accepted' => array('name' => __('The form is accepted', 'formcreator'), 'subject' => __('Your form have been accepted by the validator', 'formcreator'), 'content' => __('Hi,\\nWe are pleased to inform you that your form have been accepted by the validator.\\nYour request will be considered soon.', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_deleted' => array('name' => __('The form is deleted', 'formcreator'), 'subject' => __('Your form have been deleted by an administrator', 'formcreator'), 'content' => __('Hi,\\nWe are sorry to inform you that your request cannot be considered and have been deleted by an administrator.', 'formcreator'), 'notified' => self::AUTHOR));
     // Create the notification template
     $notification = new Notification();
     $notification_target = new NotificationTarget();
     $template = new NotificationTemplate();
     $translation = new NotificationTemplateTranslation();
     foreach ($notifications as $event => $datas) {
         // Check if notification allready exists
         $exists = $notification->find("itemtype = 'PluginFormcreatorFormanswer' AND event = '{$event}'");
         // If it doesn't exists, create it
         if (count($exists) == 0) {
             $template_id = $template->add(array('name' => addslashes($datas['name']), 'comment' => '', 'itemtype' => 'PluginFormcreatorFormanswer'));
             // Add a default translation for the template
             $translation->add(array('notificationtemplates_id' => $template_id, 'language' => '', 'subject' => addslashes($datas['subject']), 'content_text' => addslashes($datas['content']), 'content_html' => '<p>' . str_replace('\\n', '<br />', $datas['content']) . '</p>'));
             // Create the notification
             $notification_id = $notification->add(array('name' => addslashes($datas['name']), 'comment' => '', 'entities_id' => 0, 'is_recursive' => 1, 'is_active' => 1, 'itemtype' => 'PluginFormcreatorFormanswer', 'notificationtemplates_id' => $template_id, 'event' => $event, 'mode' => 'mail'));
             // Add default notification targets
             $notification_target->add(array("items_id" => $datas['notified'], "type" => Notification::USER_TYPE, "notifications_id" => $notification_id));
         }
     }
 }
Example #5
0
function plugin_resources_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_resources_resources", "glpi_plugin_resources_resources_items", "glpi_plugin_resources_employees", "glpi_plugin_resources_employers", "glpi_plugin_resources_clients", "glpi_plugin_resources_choices", "glpi_plugin_resources_choiceitems", "glpi_plugin_resources_departments", "glpi_plugin_resources_contracttypes", "glpi_plugin_resources_resourcestates", "glpi_plugin_resources_tasktypes", "glpi_plugin_resources_profiles", "glpi_plugin_resources_tasks", "glpi_plugin_resources_taskplannings", "glpi_plugin_resources_tasks_items", "glpi_plugin_resources_checklists", "glpi_plugin_resources_checklistconfigs", "glpi_plugin_resources_reportconfigs", "glpi_plugin_resources_resourcerestings", "glpi_plugin_resources_resourceholidays", "glpi_plugin_resources_ticketcategories", "glpi_plugin_resources_resourcesituations", "glpi_plugin_resources_contractnatures", "glpi_plugin_resources_ranks", "glpi_plugin_resources_resourcespecialities", "glpi_plugin_resources_leavingreasons", "glpi_plugin_resources_professions", "glpi_plugin_resources_professionlines", "glpi_plugin_resources_professioncategories", "glpi_plugin_resources_employments", "glpi_plugin_resources_employmentstates", "glpi_plugin_resources_budgets", "glpi_plugin_resources_costs", "glpi_plugin_resources_budgettypes", "glpi_plugin_resources_budgetvolumes");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_resources", "glpi_plugin_resources_device", "glpi_plugin_resources_needs", "glpi_plugin_resources_employee", "glpi_dropdown_plugin_resources_employer", "glpi_dropdown_plugin_resources_client", "glpi_dropdown_plugin_resources_type", "glpi_dropdown_plugin_resources_department", "glpi_dropdown_plugin_resources_tasks_type", "glpi_plugin_resources_mailingsettings", "glpi_plugin_resources_mailing");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $in = "IN (" . implode(',', array("'PluginResourcesResource'", "'PluginResourcesTask'", "'PluginResourcesHelpdesk'", "'PluginResourcesDirectory'", "'PluginResourcesChecklistconfig'", "'PluginResourcesResourceResting'", "'PluginResourcesResourceHoliday'", "'PluginResourcesBudget'", "'PluginResourcesEmployment'", "'PluginResourcesRecap'")) . ")";
    $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
    foreach ($tables as $table) {
        $query = "DELETE FROM `{$table}` WHERE (`itemtype` " . $in . " ) ";
        $DB->query($query);
    }
    //drop rules
    $Rule = new Rule();
    $a_rules = $Rule->find("`sub_type`='PluginResourcesRuleChecklist'\n                              OR `sub_type`='PluginResourcesRuleContracttype'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'update', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'delete', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newtask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updatetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deletetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertExpiredTasks', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingResources', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertArrivalChecklists', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingChecklists', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'LeavingResource', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'report', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginResourcesResource', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginResourcesResource'));
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginResourcesClient'));
    }
    $rep_files_resources = GLPI_PLUGIN_DOC_DIR . "/resources";
    Toolbox::deleteDir($rep_files_resources);
    return true;
}
function plugin_additionalalerts_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_additionalalerts_ocsalerts", "glpi_plugin_additionalalerts_infocomalerts", "glpi_plugin_additionalalerts_notificationstates", "glpi_plugin_additionalalerts_notificationtypes", "glpi_plugin_additionalalerts_configs");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_additionalalerts_reminderalerts", "glpi_plugin_alerting_config", "glpi_plugin_alerting_state", "glpi_plugin_alerting_profiles", "glpi_plugin_alerting_mailing", "glpi_plugin_alerting_type", "glpi_plugin_additionalalerts_profiles");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'ocs', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'newocs', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'event' => 'notinfocom', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    //Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginAdditionalalertsProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    PluginAdditionalalertsProfile::removeRightsFromSession();
    PluginAdditionalalertsMenu::removeRightsFromSession();
    return true;
}
Example #7
0
function plugin_domains_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_domains_domains", "glpi_plugin_domains_domains_items", "glpi_plugin_domains_domaintypes", "glpi_plugin_domains_profiles", "glpi_plugin_domains_configs", "glpi_plugin_domains_notificationstates");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_domain", "glpi_plugin_domain_device", "glpi_dropdown_plugin_domain_type", "glpi_plugin_domain_profiles", "glpi_plugin_domain_mailing");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginDomainsDomain', 'event' => 'ExpiredDomains', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginDomainsDomain', 'event' => 'DomainsWhichExpire', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginDomainsDomain', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets", "glpi_contracts_items");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginDomainsDomain';");
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginDomainsDomain'));
    }
    return true;
}
Example #8
0
function plugin_ideabox_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_ideabox_ideaboxs", "glpi_plugin_ideabox_ideaboxes", "glpi_plugin_ideabox_comments", "glpi_plugin_ideabox_profiles");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old tables
    $tables = array("glpi_plugin_ideabox", "glpi_plugin_ideabox_mailing");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'update', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'delete', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'newcomment', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'updatecomment', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'event' => 'deletecomment', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginIdeaboxIdeabox', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginIdeaboxIdeabox' OR `itemtype` = 'PluginIdeaboxComment';");
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginIdeaboxIdeabox'));
    }
    return true;
}
    $newID = $notificationtemplate->add($_POST);
    Event::log($newID, "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " :  " . $_POST["name"] . ".");
    $language = new NotificationTemplateTranslation();
    $url = getItemTypeFormURL('NotificationTemplateTranslation', true);
    $url .= "?notificationtemplates_id={$newID}";
    glpi_header($url);
} else {
    if (isset($_POST["delete"])) {
        $notificationtemplate->check($_POST["id"], 'd');
        $notificationtemplate->delete($_POST);
        Event::log($_POST["id"], "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $notificationtemplate->redirectToList();
    } else {
        if (isset($_POST["delete_languages"])) {
            $notificationtemplate->check(-1, 'd');
            $language = new NotificationTemplateTranslation();
            if (isset($_POST['languages'])) {
                foreach ($_POST['languages'] as $key => $val) {
                    if ($val == 'on') {
                        $input['id'] = $key;
                        $language->delete($input);
                    }
                }
            }
            glpi_header($_SERVER['HTTP_REFERER']);
        } else {
            if (isset($_POST["update"])) {
                $notificationtemplate->check($_POST["id"], 'w');
                $notificationtemplate->update($_POST);
                Event::log($_POST["id"], "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                glpi_header($_SERVER['HTTP_REFERER']);
Example #10
0
 public static function uninstallOrderItemNotification()
 {
     global $DB;
     $notif = new Notification();
     $options = array('itemtype' => 'PluginOrderOrder_Item', 'event' => 'delivered', 'FIELDS' => 'id');
     foreach ($DB->request('glpi_notifications', $options) as $data) {
         $notif->delete($data);
     }
     $template = new NotificationTemplate();
     $translation = new NotificationTemplateTranslation();
     //templates
     $options = array('itemtype' => 'PluginOrderOrder_Item', 'FIELDS' => 'id');
     foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
         $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
         foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
             $translation->delete($data_template);
         }
         $template->delete($data);
     }
 }
GLPI 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 GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Walid Nouh
// Purpose of file:
// ----------------------------------------------------------------------
if (!defined('GLPI_ROOT')) {
    define('GLPI_ROOT', '..');
    include GLPI_ROOT . "/inc/includes.php";
}
if (isset($_POST["sub_type"])) {
    $sub_type = $_POST["sub_type"];
} else {
    if (isset($_GET["sub_type"])) {
        $sub_type = $_GET["sub_type"];
    } else {
        $sub_type = 0;
    }
}
checkRight("config", "r");
NotificationTemplateTranslation::showAvailableTags($sub_type);
ajaxFooter();
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$language = new NotificationTemplateTranslation();
if (isset($_POST["add"])) {
    $language->check(-1, 'w', $_POST);
    $newID = $language->add($_POST);
    Event::log($newID, "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " : " . $_POST["language"] . ".");
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $language->check($_POST["id"], 'd');
        $language->delete($_POST);
        Event::log($_POST["id"], "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $language->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $language->check($_POST["id"], 'w');
            $language->update($_POST);
Example #13
0
function plugin_badges_uninstall()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/badges/inc/profile.class.php";
    include_once GLPI_ROOT . "/plugins/badges/inc/menu.class.php";
    $tables = array("glpi_plugin_badges_badges", "glpi_plugin_badges_badgetypes", "glpi_plugin_badges_configs", "glpi_plugin_badges_notificationstates", "glpi_plugin_badges_requests");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_badges", "glpi_dropdown_plugin_badges_type", "glpi_plugin_badges_users", "glpi_plugin_badges_profiles", "glpi_plugin_badges_config", "glpi_plugin_badges_mailing", "glpi_plugin_badges_default");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'ExpiredBadges', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'BadgesWhichExpire', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'BadgesReturn', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'AccessBadgeRequest', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginBadgesBadge', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_notepads", "glpi_dropdowntranslations");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` LIKE 'PluginBadges%';");
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginBadgesBadge'));
    }
    CronTask::Unregister('PluginBadgesReturn');
    //Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginBadgesProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    PluginBadgesMenu::removeRightsFromSession();
    PluginBadgesProfile::removeRightsFromSession();
    return true;
}
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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$language = new NotificationTemplateTranslation();
if (isset($_POST["add"])) {
    $language->check(-1, CREATE, $_POST);
    $newID = $language->add($_POST);
    Event::log($newID, "notificationtemplatetranslations", 4, "notification", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["language"]));
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $language->check($_POST["id"], PURGE);
        $language->delete($_POST, 1);
        Event::log($_POST["id"], "notificationtemplatetranslations", 4, "notification", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        $language->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $language->check($_POST["id"], UPDATE);
            $language->update($_POST);
 public static function uninstall()
 {
     global $DB;
     $notif = new Notification();
     foreach (array('ask', 'validation', 'cancel', 'undovalidation', 'duedate', 'delivered') as $event) {
         $options = array('itemtype' => 'PluginOrderOrder', 'event' => $event, 'FIELDS' => 'id');
         foreach ($DB->request('glpi_notifications', $options) as $data) {
             $notif->delete($data);
         }
     }
     //templates
     $template = new NotificationTemplate();
     $translation = new NotificationTemplateTranslation();
     $options = array('itemtype' => 'PluginOrderOrder', 'FIELDS' => 'id');
     foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
         $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
         foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
             $translation->delete($data_template);
         }
         $template->delete($data);
     }
 }
Example #16
0
function plugin_projet_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_projet_projets", "glpi_plugin_projet_projetstates", "glpi_plugin_projet_projets_items", "glpi_plugin_projet_projets_projets", "glpi_plugin_projet_tasks", "glpi_plugin_projet_tasks_items", "glpi_plugin_projet_taskstates", "glpi_plugin_projet_tasktypes", "glpi_plugin_projet_taskplannings", "glpi_plugin_projet_tasks_tasks", "glpi_plugin_projet_profiles", "glpi_plugin_projet_followups");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $oldtables = array("glpi_plugin_projet", "glpi_plugin_projet_items", "glpi_plugin_projet_tasks", "glpi_plugin_projet_tasks_items", "glpi_dropdown_plugin_projet_tasks_type", "glpi_plugin_projet_mailing", "glpi_dropdown_plugin_projet_status", "glpi_dropdown_plugin_projet_task_status", "glpi_plugin_project", "glpi_plugin_project_items", "glpi_plugin_project_tasks", "glpi_plugin_project_tasks_items", "glpi_dropdown_plugin_project_status", "glpi_dropdown_plugin_project_tasks_type", "glpi_dropdown_plugin_project_task_status", "glpi_plugin_project_mailing", "glpi_plugin_project_profiles", "glpi_plugin_project_users", "glpi_plugin_project_setup", "glpi_plugin_project_groups", "glpi_plugin_project_items", "glpi_plugin_project_enterprises", "glpi_plugin_project_contracts", "glpi_plugin_project_documents", "glpi_dropdown_project_tasks_type", "glpi_project", "glpi_project_tasks", "glpi_project_user", "glpi_project_items", "glpi_plugin_projet_projetitems", "glpi_plugin_projet_mailings", "glpi_plugin_projet_taskitems");
    foreach ($oldtables as $oldtable) {
        $DB->query("DROP TABLE IF EXISTS `{$oldtable}`;");
    }
    $rep_files_projet = GLPI_PLUGIN_DOC_DIR . "/projet";
    Toolbox::deleteDir($rep_files_projet);
    $in = "IN (" . implode(',', array("'PluginProjetProjet'", "'PluginProjetTask'")) . ")";
    $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_contracts_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
    foreach ($tables as $table) {
        $query = "DELETE FROM `{$table}` WHERE (`itemtype` " . $in . " ) ";
        $DB->query($query);
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'update', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'delete', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'newtask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'updatetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'deletetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginProjetProjet', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    return true;
}
Example #17
0
function plugin_accounts_uninstall()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/accounts/inc/profile.class.php";
    include_once GLPI_ROOT . "/plugins/accounts/inc/menu.class.php";
    $tables = array("glpi_plugin_accounts_accounts", "glpi_plugin_accounts_accounts_items", "glpi_plugin_accounts_accounttypes", "glpi_plugin_accounts_accountstates", "glpi_plugin_accounts_configs", "glpi_plugin_accounts_hashs", "glpi_plugin_accounts_hashes", "glpi_plugin_accounts_aeskeys", "glpi_plugin_accounts_notificationstates");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_comptes", "glpi_plugin_compte_device", "glpi_dropdown_plugin_compte_type", "glpi_dropdown_plugin_compte_status", "glpi_plugin_compte_profiles", "glpi_plugin_compte_config", "glpi_plugin_compte_default", "glpi_plugin_compte_mailing", "glpi_plugin_compte", "glpi_plugin_compte_hash", "glpi_plugin_compte_aeskey", "glpi_plugin_accounts_profiles");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'ExpiredAccounts', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'AccountsWhichExpire', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAccountsAccount', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_dropdowntranslations");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}`\n               WHERE `itemtype` = 'PluginAccountsAccount'\n               OR `itemtype` = 'PluginAccountsHelpdesk'\n               OR `itemtype` = 'PluginAccountsGroup'\n               OR `itemtype` = 'PluginAccountsAccountState'\n               OR `itemtype` = 'PluginAccountsAccountType' ;");
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginAccountsAccount'));
    }
    //Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginAccountsProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    PluginAccountsProfile::removeRightsFromSession();
    PluginAccountsMenu::removeRightsFromSession();
    return true;
}
Example #18
0
function plugin_accounts_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_accounts_accounts", "glpi_plugin_accounts_accounts_items", "glpi_plugin_accounts_accounttypes", "glpi_plugin_accounts_accountstates", "glpi_plugin_accounts_profiles", "glpi_plugin_accounts_configs", "glpi_plugin_accounts_hashs", "glpi_plugin_accounts_hashes", "glpi_plugin_accounts_aeskeys", "glpi_plugin_accounts_notificationstates");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_comptes", "glpi_plugin_compte_device", "glpi_dropdown_plugin_compte_type", "glpi_dropdown_plugin_compte_status", "glpi_plugin_compte_profiles", "glpi_plugin_compte_config", "glpi_plugin_compte_default", "glpi_plugin_compte_mailing", "glpi_plugin_compte", "glpi_plugin_compte_hash", "glpi_plugin_compte_aeskey");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'ExpiredAccounts', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'AccountsWhichExpire', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAccountsAccount', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}`\n               WHERE `itemtype` = 'PluginAccountsAccount'\n               OR `itemtype` = 'PluginAccountsHelpdesk'\n               OR `itemtype` = 'PluginAccountsGroup' ;");
    }
    if (class_exists('PluginDatainjectionModel')) {
        PluginDatainjectionModel::clean(array('itemtype' => 'PluginAccountsAccount'));
    }
    return true;
}
Example #19
0
function plugin_additionalalerts_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_additionalalerts_ocsalerts", "glpi_plugin_additionalalerts_infocomalerts", "glpi_plugin_additionalalerts_notificationstates", "glpi_plugin_additionalalerts_notificationtypes", "glpi_plugin_additionalalerts_profiles", "glpi_plugin_additionalalerts_configs");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_additionalalerts_reminderalerts", "glpi_plugin_alerting_config", "glpi_plugin_alerting_state", "glpi_plugin_alerting_profiles", "glpi_plugin_alerting_mailing", "glpi_plugin_alerting_type");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'ocs', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'newocs', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'event' => 'notinfocom', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    return true;
}
Example #20
0
function plugin_certificates_uninstall() {
   global $DB;
   
   include_once (GLPI_ROOT."/plugins/certificates/inc/profile.class.php");
   include_once (GLPI_ROOT."/plugins/certificates/inc/menu.class.php");
   
   $tables = array("glpi_plugin_certificates_certificates",
               "glpi_plugin_certificates_certificates_items",
               "glpi_plugin_certificates_certificatetypes",
               "glpi_plugin_certificates_certificatestates",
               "glpi_plugin_certificates_configs",
               "glpi_plugin_certificates_notificationstates");

   foreach($tables as $table)
      $DB->query("DROP TABLE IF EXISTS `$table`;");
   
   //old versions	
   $tables = array("glpi_plugin_certificates",
               "glpi_plugin_certificates_profiles",
               "glpi_plugin_certificates_device",
               "glpi_dropdown_plugin_certificates_type",
               "glpi_dropdown_plugin_certificates_status",
               "glpi_plugin_certificates_config",
               "glpi_plugin_certificates_mailing",
               "glpi_plugin_certificates_default");

   foreach($tables as $table)
      $DB->query("DROP TABLE IF EXISTS `$table`;");
   
   $notif = new Notification();
   $options = array('itemtype' => 'PluginCertificatesCertificate',
                    'event'    => 'ExpiredCertificates',
                    'FIELDS'   => 'id');
   foreach ($DB->request('glpi_notifications', $options) as $data) {
      $notif->delete($data);
   }
   $options = array('itemtype' => 'PluginCertificatesCertificate',
                    'event'    => 'CertificatesWhichExpire',
                    'FIELDS'   => 'id');
   foreach ($DB->request('glpi_notifications', $options) as $data) {
      $notif->delete($data);
   }
   
   //templates
   $template = new NotificationTemplate();
   $translation = new NotificationTemplateTranslation();
   $options = array('itemtype' => 'PluginCertificatesCertificate',
                    'FIELDS'   => 'id');
   foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
      $options_template = array('notificationtemplates_id' => $data['id'],
                    'FIELDS'   => 'id');
   
         foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
         }
      $template->delete($data);
   }
   
   $tables_glpi = array("glpi_displaypreferences",
               "glpi_documents_items",
               "glpi_bookmarks",
               "glpi_logs",
               "glpi_tickets",
               "glpi_contracts_items",
               "glpi_notepads");

   foreach($tables_glpi as $table_glpi)
      $DB->query("DELETE FROM `$table_glpi` WHERE `itemtype` = 'PluginCertificatesCertificate';");
      
   //Delete rights associated with the plugin
   $profileRight = new ProfileRight();
   foreach (PluginCertificatesProfile::getAllRights() as $right) {
      $profileRight->deleteByCriteria(array('name' => $right['field']));
   }
   PluginCertificatesMenu::removeRightsFromSession();
   
   PluginCertificatesProfile::removeRightsFromSession();

   return true;
}
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkRight("config", 'r');
if (isset($_POST['id']) && $_POST['id'] > 0) {
    if (!isset($_REQUEST['glpi_tab'])) {
        exit;
    }
    $translation = new NotificationTemplateTranslation();
    $translation->getFromDB($_POST['id']);
    switch ($_REQUEST['glpi_tab']) {
        case 12:
            Log::showForItem($translation);
            break;
        default:
            if (!Plugin::displayAction($translation, $_REQUEST['glpi_tab'])) {
            }
    }
}
ajaxFooter();
Example #22
0
This file is part of GLPI.

GLPI 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.

GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
if (!defined('GLPI_ROOT')) {
    include '../inc/includes.php';
}
Html::popHeader(__('List of available tags'), $_SERVER['PHP_SELF']);
if (isset($_GET["sub_type"])) {
    Session::checkCentralAccess();
    NotificationTemplateTranslation::showAvailableTags($_GET["sub_type"]);
    Html::ajaxFooter();
} else {
    Html::displayErrorAndDie("lost");
}
Html::popFooter();
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkRight("config", 'r');
if (isset($_POST['id']) && $_POST['id'] > 0) {
    if (!isset($_REQUEST['glpi_tab'])) {
        exit;
    }
    $template = new NotificationTemplate();
    $template->getFromDB($_POST['id']);
    switch ($_REQUEST['glpi_tab']) {
        case -1:
        case 1:
            $templatelanguage = new NotificationTemplateTranslation();
            $templatelanguage->showSummary($template);
            break;
        case 12:
            Log::showForItem($template);
            break;
        default:
            if (!Plugin::displayAction($template, $_REQUEST['glpi_tab'])) {
            }
    }
}
ajaxFooter();