Пример #1
0
 }
 // Add default auth
 echo ' - Fill auths table<BR>';
 $authM = new authManager();
 $authMethodM = new authMethodManager();
 $userM = new userManager();
 if ($authM->getId($userM->getIdByName('admin'), $authMethodM->getId('LOCAL')) == 0) {
     $authM->create($userM->getIdByName('admin'), $authMethodM->getId('LOCAL'), 'admin', 'gob', 'lib/avatars/brain.jpg', '', '', 'admin');
 }
 // Add default access
 echo ' - Fill access table<BR>';
 $accessM = new accessManager();
 $objectM = new objectManager();
 $groupM = new groupManager();
 $pluginM = new pluginManager();
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 100);
 }
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 20);
 }
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 10);
 }
 // Add default job
 echo ' - Fill jobs table<BR>';
 $jobM = new jobManager();
 $pluginM = new pluginManager();
 if ($jobM->getId($pluginM->getId('core'), 'translate') == 0) {
     $jobM->create($pluginM->getId('core'), 'translate');
 }
Пример #2
0
 function register($method, $name, $password, $avatar, $lastName, $firstName, $mail, $isSendMail = 'TRUE')
 {
     $authM = new authManager();
     $authMethodM = new authMethodManager();
     $groupM = new groupManager();
     // Check if the user already exist
     if ($mail != '' && mailCheck($mail) && $this->getId($mail) == 0) {
         // $authM->getId($userId,$methodId) && ($method,$mail,$password) == 0
         // Generate a password
         $generatedPassword = stringGenerate();
         if ($isSendMail == 'TRUE') {
             // On envoie le mail de confirmation avec le mot de passe
             $sujet = 'Création d\'un compte ' . get_ini('APPLICATION_NAME');
             $message = '
         	            Bonjour,<br />
         	            <br />
         	            Voici vos identifiants pour l\'application ' . get_ini('APPLICATION_NAME') . '<br />
         	            Login: <strong>' . $mail . '</strong><br />
         	            Password: <strong>' . $generatedPassword . '</strong><br />
         	            <br />
         	            Merci!<br />
         	            <br />
         	            ' . get_ini('ADMIN_MAIL') . '
         	            ';
             $destinataire = strtolower($mail);
             $headers = "From: " . get_ini('ADMIN_MAIL') . "\n";
             $headers .= "Reply-To: " . get_ini('ADMIN_MAIL') . "\n";
             $headers .= "Content-Type: text/html; charset=\"UTF-8\"";
             if (!mail($destinataire, $sujet, $message, $headers)) {
                 echo "Une erreur c'est produite lors de l'envois de l'email.";
             }
         }
         // On créé l'utilisateur
         $q0_last_insert = $this->create($name, $avatar, $mail);
         // On ajoute la méthode de connexion locale
         $authM->create($q0_last_insert, $authMethodM->getId('LOCAL'), $name, $generatedPassword, $avatar, $lastName, $firstName, $mail);
         // On ajoute le groupe par défaut si il y en a un
         if (get_ini('default_group') != '') {
             $groupM->addGroupUserMap($groupM->getId(get_ini('default_group')), $q0_last_insert);
         }
         // On ajoute d'éventuelle autre méthode d'authentification (Facebook, google, ...)
         switch ($method) {
             case 'LDAP':
                 $authM->create($q0_last_insert, $authMethodM->getId('LDAP'), strtolower($name), '', get_ini('DEFAULT_AVATAR'), '', '', $mail, 'FALSE');
                 break;
             case 'FACEBOOK':
                 $authM->create($q0_last_insert, $authMethodM->getId('FACEBOOK'), $name, $password, $avatar, $lastName, $firstName, $mail);
                 break;
             case 'GOOGLE':
                 $authM->create($q0_last_insert, $authMethodM->getId('GOOGLE'), $name, $password, $avatar, $lastName, $firstName, $mail);
                 break;
         }
     } else {
         // Todo error
     }
 }
Пример #3
0
<button type="button" class="btn btn-primary" onClick="popupFormSubmit(\'index.php?m=a&g=core&p=admin_groups&a=update\',$(\'form#popupForm\').serialize());">
Modifier
</button>
		';
        break;
    case 'update':
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        } elseif (isset($_POST['id'])) {
            $id = $_POST['id'];
        } else {
            // TODO ERROR
        }
        if (isset($_POST['name']) && $_POST['name'] != '' && isset($id)) {
            $groupM = new groupManager();
            if ($groupM->getId($_POST['name']) == 0) {
                $groupM->update($id, $_POST['name']);
                // TODO confirmation
                echo 'Le groupe vient d\'être modifié!';
                echo '<script type="text/javascript">dataTable.ajax.reload();</script>';
            } else {
                // TODO
                echo 'Ce groupe existe déjà.';
            }
        }
        break;
    case 'delete_form':
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        } elseif (isset($_POST['id'])) {
            $id = $_POST['id'];
<?php

// ------------------------------------------------------------------- //
// Add this statements only on the admin_plugins and setup page. This check if the current user is in the admins group
// ------------------------------------------------------------------- //
$groupM = new groupManager();
$user = new user($_SESSION['USER_ID']);
if (!isset($user->groupIdArray) || !in_array($groupM->getId('admins'), $user->groupIdArray)) {
    include 'plugins/core/403.php';
    exit(403);
}
// ------------------------------------------------------------------- //
//$q0 = get_link()->prepare('INSERT INTO GLDEV.gl_core_security ( id, id_source, id_target, secure_level, created_date, edited_date, deleted_date, created_id, edited_id, deleted_id) VALUES ( '1', '21', '1', '100', 0, 0, 0, 0, 0, 0)');
//$q0->execute();
$pageM = new pageManager();
// Populate core_pages table in database
echo '<U>Add new Php pages : </U><BR>';
foreach ($init->pluginsIndex as $plugin) {
    if ($handle = opendir('plugins/' . $plugin)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != "" && strtolower(substr($file, strrpos($file, '.') + 1)) == 'php') {
                $pageName = strtolower(substr($file, 0, strrpos($file, '.')));
                if ($pageM->getId(getPluginId($plugin), $pageName) == 0) {
                    $pageM->create(getPluginId($plugin), $pageName);
                    echo 'Page ' . $plugin . '/' . $pageName . ' added<BR>';
                }
            }
        }
        closedir($handle);
    }
}