Ejemplo n.º 1
0
 /**
  * plugin installation
  *
  * perform here all needed step for the plugin installation
  * such as create default config, add database tables,
  * add fields to existing tables, create local folders...
  */
 function install($plugin_version, &$errors = array())
 {
     global $conf;
     $config = new Ldap();
     if (file_exists(LDAP_LOGIN_PATH . 'data.dat')) {
         $config->load_config();
     } else {
         $config->load_default_config();
     }
     $config->save_config();
     $this->installed = true;
 }
Ejemplo n.º 2
0
$template->assign('ALLOW_NEWUSERS', $me->config['allow_newusers']);
// do we send a mail to admins in case of new users ?
$template->assign('ADVERTISE_ADMINS', $me->config['advertise_admin_new_ldapuser']);
// do we send the piwigo (!) password to the mail address provided by ldap ?
$template->assign('SEND_CASUAL_MAIL', $me->config['send_password_by_mail_ldap']);
// Is there a restriction in the ldap users group ?
// Only members of this ldap group can log in !
$template->assign('USERS_GROUP', $me->config['users_group']);
if (isset($_POST['save'])) {
    $me->config['users_group'] = $_POST['USERS_GROUP'];
    if (isset($_POST['ALLOW_NEWUSERS'])) {
        $me->config['allow_newusers'] = True;
    } else {
        $me->config['allow_newusers'] = False;
    }
    if (isset($_POST['ADVERTISE_ADMINS'])) {
        $me->config['advertise_admin_new_ldapuser'] = True;
    } else {
        $me->config['advertise_admin_new_ldapuser'] = False;
    }
    if (isset($_POST['SEND_CASUAL_MAIL'])) {
        $me->config['send_password_by_mail_ldap'] = True;
    } else {
        $me->config['send_password_by_mail_ldap'] = False;
    }
}
// Save LDAP configuration
if (isset($_POST['save'])) {
    $me->save_config();
}
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');