diff --git a/hook.php b/hook.php index 715b9f0..8143bda 100644 --- a/hook.php +++ b/hook.php @@ -199,7 +199,7 @@ function plugin_activity_uninstall() ]; foreach ($tables as $table) { - $DB->query("DROP TABLE IF EXISTS `$table`;"); + $DB->dropTable($table); } $tables_glpi = [ @@ -210,11 +210,7 @@ function plugin_activity_uninstall() ]; foreach ($tables_glpi as $table_glpi) { - $DB->query( - "DELETE - FROM `$table_glpi` - WHERE `itemtype` LIKE 'PluginActivity%'" - ); + $DB->delete($table_glpi, ['itemtype' => ['LIKE' => 'PluginActivity%']]); } // Delete notifications diff --git a/inc/config.class.php b/inc/config.class.php index f698339..bbed129 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -72,7 +72,7 @@ function showForm ($ID, $options = []) { 'used' => $used_entities]); echo ""; // is_recursive - echo "".__('Is recursive').""; + echo "".__('Is recursive', 'activity').""; echo ""; Dropdown::showYesNo('is_recursive'); echo ""; diff --git a/inc/dashboard.class.php b/inc/dashboard.class.php index 9db6791..5d3edbc 100644 --- a/inc/dashboard.class.php +++ b/inc/dashboard.class.php @@ -24,7 +24,7 @@ along with Activity. If not, see . -------------------------------------------------------------------------- */ - +#[AllowDynamicProperties] class PluginActivityDashboard extends CommonGLPI { public $widgets = []; diff --git a/inc/profile.class.php b/inc/profile.class.php index d829c2b..a111940 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -219,13 +219,15 @@ public static function migrateOneProfile() // Add or update rights foreach ($matching as $old => $new) { if (isset($used[$profile_data['profiles_id']][$new])) { - $query = "UPDATE `glpi_profilerights` - SET `rights`='".self::translateARight($profile_data[$old])."' - WHERE `name`='$new' AND `profiles_id`='".$profile_data['profiles_id']."'"; - $DB->query($query); + $DB->update('glpi_profilerights', ['rights' => self::translateARight($profile_data[$old])], [ + 'name' => $new, + 'profiles_id' => $profile_data['profiles_id'] + ]); } else { - $query = "INSERT INTO `glpi_profilerights` (`profiles_id`, `name`, `rights`) VALUES ('".$profile_data['profiles_id']."', '$new', '".self::translateARight($profile_data[$old])."');"; - $DB->query($query); + $DB->add('glpi_profilerights', ['rights' => self::translateARight($profile_data[$old])], [ + 'name' => $new, + 'profiles_id' => $profile_data['profiles_id'] + ]); } } } @@ -250,10 +252,14 @@ public static function initProfile() // Migration old rights in new ones self::migrateOneProfile(); - foreach ($DB->request("SELECT * - FROM `glpi_profilerights` - WHERE `profiles_id`='".$_SESSION['glpiactiveprofile']['id']."' - AND `name` LIKE '%plugin_activity%'") as $prof) { + $it = $DB->request([ + 'FROM' => 'glpi_profilerights', + 'WHERE' => [ + 'profiles_id' => $_SESSION['glpiactiveprofile']['id'], + 'name' => ['LIKE', '%plugin_activity%'] + ] + ]); + foreach ($it as $prof) { if (isset($_SESSION['glpiactiveprofile'])) { $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; }