コード例 #1
0
ファイル: hook.php プロジェクト: AircraftRu/consumables
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;
}
*/
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);
            Event::log($_POST["id"], "notificationtemplatetranslations", 4, "notification", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        } else {
            Html::header(NotificationTemplate::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "config", "notification", "notificationtemplate");
            if ($_GET["id"] == '') {
                $options = array("notificationtemplates_id" => $_GET["notificationtemplates_id"]);
            } else {
                $options = array();
            }
コード例 #3
0
ファイル: hook.php プロジェクト: euqip/glpi-smartcities
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;
}
コード例 #4
0
ファイル: hook.php プロジェクト: AssAB/badges
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;
}
コード例 #5
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_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;
}
コード例 #6
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}
コード例 #7
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}
コード例 #8
0
    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']);
            } else {
                commonHeader($LANG['mailing'][113], $_SERVER['PHP_SELF'], "config", "mailing", "notificationtemplate");
                $notificationtemplate->showForm($_GET["id"]);
                commonFooter();
            }
コード例 #9
0
ファイル: order_item.class.php プロジェクト: equinoxefr/order
 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);
     }
 }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
// ----------------------------------------------------------------------
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);
            Event::log($_POST["id"], "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
            glpi_header($_SERVER['HTTP_REFERER']);
        } else {
            commonHeader($LANG['mailing'][113], $_SERVER['PHP_SELF'], "config", "mailing", "notificationtemplate");
            if ($_GET["id"] == '') {
                $options = array("notificationtemplates_id" => $_GET["notificationtemplates_id"]);
            } else {
                $options = array();
            }
コード例 #12
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}
コード例 #13
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}
コード例 #14
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}
コード例 #15
0
ファイル: hook.php プロジェクト: puchadesc/accounts
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;
}
コード例 #16
0
ファイル: hook.php プロジェクト: geldarr/hack-space
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;
}