diff --git a/main/auth/external_login/facebook.inc.php b/main/auth/external_login/facebook.inc.php
index 4cfd8c199f..edd1d86f57 100644
--- a/main/auth/external_login/facebook.inc.php
+++ b/main/auth/external_login/facebook.inc.php
@@ -11,7 +11,7 @@
* Please edit the facebook.conf.php file to adapt it to your fb application parameter
**/
require_once dirname(__FILE__).'/../../inc/global.inc.php';
-require_once dirname(__FILE__).'/facebook.conf.php';
+require_once dirname(__FILE__).'/facebook.init.php';
require_once dirname(__FILE__).'/facebook-php-sdk/src/facebook.php';
require_once dirname(__FILE__).'/functions.inc.php';
diff --git a/main/auth/external_login/facebook.conf.php b/main/auth/external_login/facebook.init.php
similarity index 63%
rename from main/auth/external_login/facebook.conf.php
rename to main/auth/external_login/facebook.init.php
index 87eb53622b..f1ee6f9d19 100644
--- a/main/auth/external_login/facebook.conf.php
+++ b/main/auth/external_login/facebook.init.php
@@ -17,19 +17,16 @@
require_once dirname(__FILE__).'/facebook-php-sdk/src/facebook.php';
global $facebook_config;
-/**
- * Decomment those lines and put your facebook app parameters here
- * Find them here : https://developers.facebook.com/apps/
- **/
-/*$facebook_config = array('appId'=> 'APPID',
- 'secret' => 'secret app',
- 'return_url' => api_get_path(WEB_PATH).'?action=fbconnect');
- */
+//Loads the portal facebook settings
+require_once dirname(__FILE__).'../../inc/conf/auth.conf.php';
+
+/**
+ * See facebook section of the auth.conf.php file
+*/
global $facebook;
$facebook = new Facebook(array(
'appId' => $facebook_config['appId'],
'secret' => $facebook_config['secret']
));
-require_once dirname(__FILE__).'/facebook.inc.php';
-?>
+require_once dirname(__FILE__).'/facebook.inc.php';
\ No newline at end of file
diff --git a/main/auth/external_login/ldap.conf.php b/main/auth/external_login/ldap.conf.php
deleted file mode 100644
index 6450402fbd..0000000000
--- a/main/auth/external_login/ldap.conf.php
+++ /dev/null
@@ -1,114 +0,0 @@
- 'DC=cblue,DC=be',
- //admin distinguished name
- 'admin_dn' => 'CN=admin,dc=cblue,dc=be',
- //admin password
- 'admin_password' => 'pass',
- //ldap host
- 'host' => array('1.2.3.4', '2.3.4.5', '3.4.5.6'),
- // filter
-// 'filter' => '', // no () arround the string
- //'port' => , default on 389
- //protocl version (2 or 3)
- 'protocol_version' => 3,
- // set this to 0 to connect to AD server
- 'referrals' => 0,
- //String used to search the user in ldap. %username will ber replaced by the username.
- //See extldap_get_user_search_string() function below
-// 'user_search' => 'sAMAccountName=%username%', // no () arround the string
- 'user_search' => 'uid=%username%', // no () arround the string
- //encoding used in ldap (most common are UTF-8 and ISO-8859-1
- 'encoding' => 'UTF-8',
- //Set to true if user info have to be update at each login
- 'update_userinfo' => true
-);
-
-/**
- * return the string used to search a user in ldap
- *
- * @param string username
- * @return string the serach string
- * @author ndiechburg
- **/
-function extldap_get_user_search_string($username)
-{
- global $extldap_config;
-
- // init
- $filter = '('.$extldap_config['user_search'].')';
- // replacing %username% by the actual username
- $filter = str_replace('%username%',$username,$filter);
- // append a global filter if needed
- if (isset($extldap_config['filter']) && $extldap_config['filter'] != "")
- $filter = '(&'.$filter.'('.$extldap_config['filter'].'))';
-
- return $filter;
-}
-
-/**
- * Correspondance array between chamilo user info and ldap user info
- * This array is of this form :
- * ' =>
- *
- * If is "func", then the value of will be the return value of the function
- * extldap_get_($ldap_array)
- * In this cas you will have to declare the extldap_get_ function
- *
- * If is a string beginning with "!", then the value will be this string without "!"
- *
- * If is any other string then the value of will be
- * $ldap_array[][0]
- *
- * If is an array then its value will be an array of values with the same rules as above
- *
- **/
-$extldap_user_correspondance = array(
- 'firstname' => 'givenName',
- 'lastname' => 'sn',
- 'status' => 'func',
- 'admin' => 'func',
- 'email' => 'mail',
- 'auth_source' => '!extldap',
- //'username' => ,
- 'language' => '!english',
- 'password' => '!PLACEHOLDER',
- 'extra' => array(
- 'title' => 'title',
- 'globalid' => 'employeeID',
- 'department' => 'department',
- 'country' => 'co',
- 'bu' => 'Company')
- );
-/**
- * Please declare here all the function you use in extldap_user_correspondance
- * All these functions must have an $ldap_user parameter. This parameter is the
- * array returned by the ldap for the user
- **/
-/**
- * example function for email
- **/
-/*
-function extldap_get_email($ldap_user){
- return $ldap_user['cn'].$ldap['sn'].'@gmail.com';
-}
- */
-function extldap_get_status($ldap_user){
- return STUDENT;
-}
-function extldap_get_admin($ldap_user){
- return false;
-}
-
-?>
diff --git a/main/auth/external_login/ldap.inc.php b/main/auth/external_login/ldap.inc.php
index 7321a524ba..c025974f4c 100644
--- a/main/auth/external_login/ldap.inc.php
+++ b/main/auth/external_login/ldap.inc.php
@@ -6,7 +6,7 @@
//Includes the configuration file
require_once dirname(__FILE__).'/../../inc/global.inc.php';
-require_once dirname(__FILE__).'/ldap.conf.php';
+require_once dirname(__FILE__).'../../inc/conf/auth.conf.php';
/**
* Returns a transcoded and trimmed string
@@ -15,8 +15,7 @@ require_once dirname(__FILE__).'/ldap.conf.php';
* @return string
* @author ndiechburg
**/
-function extldap_purify_string($string)
-{
+function extldap_purify_string($string) {
global $extldap_config;
if(isset($extldap_config['encoding'])) {
return trim(api_to_system_encoding($string, $extldap_config['encoding']));
@@ -141,8 +140,7 @@ function extldap_authenticate($username, $password, $in_auth_with_no_password=fa
* configuration array declared in ldap.conf.php file
*
* @param array ldap user
- * @param array correspondance array (if not set use extldap_user_correspondance declared
- * in ldap.conf.php
+ * @param array correspondance array (if not set use extldap_user_correspondance declared in auth.conf.php
* @return array userinfo array
* @author ndiechburg
**/
@@ -186,4 +184,46 @@ function extldap_get_chamilo_user($ldap_user, $cor = null)
}
return $chamilo_user;
}
-?>
+
+
+
+/**
+ * Please declare here all the function you use in extldap_user_correspondance
+ * All these functions must have an $ldap_user parameter. This parameter is the
+ * array returned by the ldap for the user
+ **/
+/**
+ * example function for email
+ **/
+/*
+function extldap_get_email($ldap_user){
+ return $ldap_user['cn'].$ldap['sn'].'@gmail.com';
+}
+ */
+function extldap_get_status($ldap_user){
+ return STUDENT;
+}
+function extldap_get_admin($ldap_user){
+ return false;
+}
+
+
+/**
+ * return the string used to search a user in ldap
+ *
+ * @param string username
+ * @return string the serach string
+ * @author ndiechburg
+ **/
+function extldap_get_user_search_string($username) {
+ global $extldap_config;
+ // init
+ $filter = '('.$extldap_config['user_search'].')';
+ // replacing %username% by the actual username
+ $filter = str_replace('%username%',$username,$filter);
+ // append a global filter if needed
+ if (isset($extldap_config['filter']) && $extldap_config['filter'] != "")
+ $filter = '(&'.$filter.'('.$extldap_config['filter'].'))';
+
+ return $filter;
+}
\ No newline at end of file
diff --git a/main/auth/external_login/login.ldap.php b/main/auth/external_login/login.ldap.php
index d725404f0e..8e01546699 100644
--- a/main/auth/external_login/login.ldap.php
+++ b/main/auth/external_login/login.ldap.php
@@ -38,8 +38,8 @@
use \ChamiloSession as Session;
-require_once(dirname(__FILE__).'/ldap.conf.php');
-require_once(dirname(__FILE__).'/functions.inc.php');
+require_once dirname(__FILE__).'/ldap.inc.php';
+require_once dirname(__FILE__).'/functions.inc.php';
$ldap_user = extldap_authenticate($login,$password);
if ($ldap_user !== false) {
@@ -64,5 +64,4 @@ if ($ldap_user !== false) {
$loginFailed = true;
$uidReset = false;
unset($_user['user_id']);
-}
-?>
+}
\ No newline at end of file
diff --git a/main/auth/external_login/newUser.ldap.php b/main/auth/external_login/newUser.ldap.php
index b3c2fe4a87..cfc504d91f 100644
--- a/main/auth/external_login/newUser.ldap.php
+++ b/main/auth/external_login/newUser.ldap.php
@@ -38,8 +38,8 @@
use \ChamiloSession as Session;
-require_once(dirname(__FILE__).'/ldap.conf.php');
-require_once(dirname(__FILE__).'/functions.inc.php');
+require_once dirname(__FILE__).'/ldap.inc.php';
+require_once dirname(__FILE__).'/functions.inc.php';
$ldap_user = extldap_authenticate($login,$password);
if ($ldap_user !== false) {
@@ -64,6 +64,4 @@ if ($ldap_user !== false) {
$loginFailed = true;
$uidReset = false;
unset($_user['user_id']);
-}
-
-?>
+}
\ No newline at end of file
diff --git a/main/auth/openid/login.php b/main/auth/openid/login.php
old mode 100755
new mode 100644
index 9a7e8c499d..bae526062a
--- a/main/auth/openid/login.php
+++ b/main/auth/openid/login.php
@@ -12,7 +12,8 @@
/**
* Initialisation
*/
-require_once 'openid.conf.php';
+require_once dirname(__FILE__).'../../inc/conf/auth.conf.php';
+
require_once 'openid.lib.php';
require_once 'xrds.lib.php';
@@ -235,21 +236,19 @@ function openid_association($op_endpoint) {
* ?
*/
function openid_association_request($public) {
- require_once(api_get_path(SYS_CODE_PATH).'auth/openid/openid.conf.php');
-
- $request = array(
- 'openid.ns' => OPENID_NS_2_0,
- 'openid.mode' => 'associate',
- 'openid.session_type' => 'DH-SHA1',
- 'openid.assoc_type' => 'HMAC-SHA1'
- );
- if ($request['openid.session_type'] == 'DH-SHA1' || $request['openid.session_type'] == 'DH-SHA256') {
- $cpub = _openid_dh_long_to_base64($public);
- $request['openid.dh_consumer_public'] = $cpub;
- }
+ $request = array(
+ 'openid.ns' => OPENID_NS_2_0,
+ 'openid.mode' => 'associate',
+ 'openid.session_type' => 'DH-SHA1',
+ 'openid.assoc_type' => 'HMAC-SHA1'
+ );
- return $request;
+ if ($request['openid.session_type'] == 'DH-SHA1' || $request['openid.session_type'] == 'DH-SHA256') {
+ $cpub = _openid_dh_long_to_base64($public);
+ $request['openid.dh_consumer_public'] = $cpub;
+ }
+ return $request;
}
/**
diff --git a/main/auth/openid/openid.conf.php b/main/auth/openid/openid.conf.php
deleted file mode 100755
index ab3e326759..0000000000
--- a/main/auth/openid/openid.conf.php
+++ /dev/null
@@ -1,14 +0,0 @@
-OpenID is a secure way to use one user ID and password to log in to many web sites without special software, giving the same password to each site, or losing control over which information is shared with each site that you visit.
';
-$langMainInfoDetail .= 'Users can create accounts using their OpenID, assign one or more OpenIDs to an existing account, and log in using an OpenID. This lowers the barrier to registration, which is good for the site, and offers convenience and security to the users. Logging in via OpenID is far more secure than cross-site logins using drupal.module.
';
-$langMainInfoDetail .= 'More information on OpenID is available at OpenID.net
';
-?>
diff --git a/main/install/install_files.inc.php b/main/install/install_files.inc.php
index 569c6494a1..f45f8381ef 100644
--- a/main/install/install_files.inc.php
+++ b/main/install/install_files.inc.php
@@ -30,7 +30,8 @@ if (defined('SYSTEM_INSTALLATION')) {
copy(api_get_path(CONFIGURATION_PATH).'course_info.conf.dist.php', api_get_path(CONFIGURATION_PATH).'course_info.conf.php');
copy(api_get_path(CONFIGURATION_PATH).'mail.conf.dist.php', api_get_path(CONFIGURATION_PATH).'mail.conf.php');
copy(api_get_path(CONFIGURATION_PATH).'profile.conf.dist.php', api_get_path(CONFIGURATION_PATH).'profile.conf.php');
- copy(api_get_path(CONFIGURATION_PATH).'events.conf.dist.php', api_get_path(CONFIGURATION_PATH).'events.conf.php');
+ copy(api_get_path(CONFIGURATION_PATH).'events.conf.dist.php', api_get_path(CONFIGURATION_PATH).'events.conf.php');
+ copy(api_get_path(CONFIGURATION_PATH).'auth.conf.dist.php', api_get_path(CONFIGURATION_PATH).'auth.conf.php');
copy(api_get_path(CONFIGURATION_PATH).'portfolio.conf.dist.php', api_get_path(CONFIGURATION_PATH).'portfolio.conf.php');
} else {
echo 'You are not allowed here !';
diff --git a/plugin/add_facebook_login_button/index.php b/plugin/add_facebook_login_button/index.php
index c82f332d48..e7a2642d5a 100644
--- a/plugin/add_facebook_login_button/index.php
+++ b/plugin/add_facebook_login_button/index.php
@@ -5,17 +5,14 @@ $_template['show_message'] = false;
//if (api_is_anonymous() && api_get_setting('facebook_login_activate') == 'true') {
if (api_is_anonymous()) {
- require_once(api_get_path(SYS_CODE_PATH)."auth/external_login/facebook.conf.php");
+ require_once api_get_path(SYS_CODE_PATH)."auth/external_login/facebook.init.php";
$_template['show_message'] = true;
// the default title
$button_url = api_get_path(WEB_PLUGIN_PATH)."add_facebook_login_button/img/cnx_fb.png";
$href_link = facebook_get_login_url();
if (!empty($plugin_info['settings']['add_facebook_login_button_facebook_button_url'])) {
$button_url = api_htmlentities($plugin_info['settings']['add_facebook_login_button_facebook_button_url']);
- }
-
+ }
$_template['facebook_button_url'] = $button_url;
- $_template['facebook_href_link'] = $href_link;
-
-
+ $_template['facebook_href_link'] = $href_link;
}