static function canView()
 {
     global $DB;
     $profile = new PluginWinadminpasswordProfile();
     $profile->getFromDB($_SESSION['glpiactiveprofile']['id']);
     $use = $profile->fields['use'];
     if ($use == "1") {
         return true;
     } else {
         return false;
     }
 }
Exemple #2
0
function plugin_winadminpassword_install()
{
    global $DB;
    $migration = new Migration(100);
    if (!TableExists("glpi_plugin_winadminpassword_profiles")) {
        $query_profile = "CREATE TABLE IF NOT EXISTS `glpi_plugin_winadminpassword_profiles` (\n\t                        `id` int(11) NOT NULL,\n\t                        `profile` varchar(255) default NULL,\n\t                        `use` tinyint(1) default 0,\n\t                        PRIMARY KEY (`id`)\n\t                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query_profile, $DB->error());
        $migration->migrationOneTable("glpi_plugin_winadminpassword_profiles");
        // Give right to current Profile
        include_once GLPI_ROOT . '/plugins/winadminpassword/inc/profile.class.php';
        $prof = new PluginWinadminpasswordProfile();
        $prof->add(array('id' => $_SESSION['glpiactiveprofile']['id'], 'profile' => $_SESSION['glpiactiveprofile']['name'], 'use' => 1));
    }
    if (!TableExists("glpi_plugin_winadminpassword_configs")) {
        $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_winadminpassword_configs` (\n\t                        `id` int(11) NOT NULL auto_increment,\n\t                        `key` varchar(255) collate utf8_unicode_ci default NULL,\n\t\t\t\t`length` int(11) default 12,\n\t\t\t\t`algo` int(11) default 1,\n\t\t\t\t`size` int(11) default 14,\n\t\t\t\t`color` varchar(255) collate utf8_unicode_ci,\n\t                        PRIMARY KEY  (`id`)\n\t                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, $DB->error());
    }
    $migration->executeMigration();
    return true;
}
Exemple #3
0
LICENSE

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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--------------------------------------------------------------------------
// ----------------------------------------------------------------------
// Original Author of file: Nicolas BOURGES
// Purpose of file: plugin winadminpassword v1.1.1 - GLPI 0.84
// ----------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight("profile", "r");
$prof = new PluginWinadminpasswordProfile();
if (isset($_POST['update_user_profile'])) {
    $prof->update($_POST);
    Html::back();
}