diff --git a/TODO.md b/TODO.md
deleted file mode 100644
index b4bca5b..0000000
--- a/TODO.md
+++ /dev/null
@@ -1,5 +0,0 @@
-TODO
-----
-
-Adding LDAP usernames
-Auto setup admin account and other system defined things.
diff --git a/conf/config.php b/conf/config.php
new file mode 100644
index 0000000..4c73ff0
--- /dev/null
+++ b/conf/config.php
@@ -0,0 +1,80 @@
+
+# All rights reserved
+#
+# http://baikal-server.com
+#
+# This script is part of the Baïkal Server project. The Baïkal
+# Server project 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.
+#
+# The GNU General Public License can be found at
+# http://www.gnu.org/copyleft/gpl.html.
+#
+# This script 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.
+#
+# This copyright notice MUST APPEAR in all copies of the script!
+#
+##############################################################################
+
+##############################################################################
+# Required configuration
+# You *have* to review these settings for Baïkal to run properly
+#
+
+# Timezone of your users, if unsure, check http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+define("PROJECT_TIMEZONE", 'YNH_TIMEZONE');
+
+# CardDAV ON/OFF switch; default TRUE
+define("BAIKAL_CARD_ENABLED", TRUE);
+
+# CalDAV ON/OFF switch; default TRUE
+define("BAIKAL_CAL_ENABLED", TRUE);
+
+# WebDAV authentication type; default Digest
+define("BAIKAL_DAV_AUTH_TYPE", 'LDAP-UserBind');
+
+# Auth Backend LDAP-UserBind; LDAP URI
+define("BAIKAL_DAV_LDAP_URI", 'ldap://127.0.0.1/');
+
+# Auth Backend LDAP-UserBind; Template for userbind
+# %n => username
+# %u => user part of username when it is an email
+# %u => domain part of username when it is an email
+define("BAIKAL_DAV_LDAP_DN_TEMPLATE", 'uid=%n,ou=users,dc=yunohost,dc=org');
+
+# Auth Backend LDAP-UserBind; attribute for displayname
+define("BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR", 'cn');
+
+# Auth Backend LDAP-UserBind; attribute for email
+define("BAIKAL_DAV_LDAP_EMAIL_ATTR", 'mail');
+
+# Auth Backend Mail; protocol of service
+define("BAIKAL_DAV_MAIL_PROTOCOL", 'imap');
+
+# Auth Backend Mail; server host:port
+define("BAIKAL_DAV_MAIL_SERVER", 'localhost:143');
+
+# Auth Backend Mail; validate the ssl-certificate
+define("BAIKAL_DAV_MAIL_CHECK_CERT", TRUE);
+
+# Auth Backends: automatic creation of users; default yes"
+define("BAIKAL_DAV_AUTO_CREATE_USER", TRUE);
+
+# Baïkal Web Admin ON/OFF switch; default TRUE
+define("BAIKAL_ADMIN_ENABLED", TRUE);
+
+# Baïkal Web Admin autolock ON/OFF switch; default FALSE
+define("BAIKAL_ADMIN_AUTOLOCKENABLED", FALSE);
+
+# Baïkal Web admin password hash; Set via Baïkal Web Admin
+define("BAIKAL_ADMIN_PASSWORDHASH", 'YNH_ADMIN_PASSWORDHASH');
diff --git a/conf/config.system.php b/conf/config.system.php
new file mode 100644
index 0000000..6ec79ec
--- /dev/null
+++ b/conf/config.system.php
@@ -0,0 +1,72 @@
+
+# All rights reserved
+#
+# http://baikal-server.com
+#
+# This script is part of the Baïkal Server project. The Baïkal
+# Server project 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.
+#
+# The GNU General Public License can be found at
+# http://www.gnu.org/copyleft/gpl.html.
+#
+# This script 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.
+#
+# This copyright notice MUST APPEAR in all copies of the script!
+#
+##############################################################################
+
+##############################################################################
+# System configuration
+# Should not be changed, unless YNWYD
+#
+# RULES
+# 0. All folder pathes *must* be suffixed by "/"
+# 1. All URIs *must* be suffixed by "/" if pointing to a folder
+#
+
+# PATH to SabreDAV
+define("BAIKAL_PATH_SABREDAV", PROJECT_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/");
+
+# If you change this value, you'll have to re-generate passwords for all your users
+define("BAIKAL_AUTH_REALM", 'BaikalDAV');
+
+# Should begin and end with a "/"
+define("BAIKAL_CARD_BASEURI", "YNH_LOCATION/card.php/");
+
+# Should begin and end with a "/"
+define("BAIKAL_CAL_BASEURI", "YNH_LOCATION/cal.php/");
+
+# Define path to Baïkal Database SQLite file
+define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/db.sqlite");
+
+# MySQL > Use MySQL instead of SQLite ?
+define("PROJECT_DB_MYSQL", TRUE);
+
+# MySQL > Host, including ':portnumber' if port is not the default one (3306)
+define("PROJECT_DB_MYSQL_HOST", 'localhost');
+
+# MySQL > Database name
+define("PROJECT_DB_MYSQL_DBNAME", 'YNH_DBNAME');
+
+# MySQL > Username
+define("PROJECT_DB_MYSQL_USERNAME", 'YNH_DBUSER');
+
+# MySQL > Password
+define("PROJECT_DB_MYSQL_PASSWORD", 'YNH_DBPWD');
+
+# A random 32 bytes key that will be used to encrypt data
+define("BAIKAL_ENCRYPTION_KEY", 'YNH_ENCRYPTKEY');
+
+# The currently configured Baïkal version
+define("BAIKAL_CONFIGURED_VERSION", '0.2.7');
diff --git a/manifest.json b/manifest.json
index f55c97e..c835a82 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"id": "baikal",
"description": {
"en": "Lightweight CalDAV+CardDAV server",
- "fr": "CalDAV+CardDAV server"
+ "fr": "Serveur CalDAV+CardDAV léger"
},
"developer": {
"name": "aquaxp",
@@ -27,7 +27,14 @@
},
"example": "/baikal",
"default": "/baikal"
+ },
+ {
+ "name": "admin_pwd",
+ "ask": {
+ "en": "Choose a password for baikal admin"
+ },
+ "example": "mysecret"
}
]
}
-}
\ No newline at end of file
+}
diff --git a/scripts/install b/scripts/install
index 97a3654..8fa4588 100644
--- a/scripts/install
+++ b/scripts/install
@@ -3,6 +3,7 @@
# Retrieve arguments
domain=$1
path=$2
+admin_pwd=$3
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a baikal
@@ -10,31 +11,51 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
-# Install dependencies
-sudo apt-get install php5-sqlite php5-fpm sqlite
+# Install PHP dependency
+sudo apt-get update
+sudo apt-get install -y php5-cli
# Copy files to the right place
final_path=/var/www/baikal
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
-sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/baikal.conf
-sudo chown -R www-data:www-data $final_path
-sudo find $final_path -type d -exec chmod 755 {} \;
-sudo touch $final_path/Specific/ENABLE_INSTALL
-sudo chmod 755 $final_path/Specific
-sudo chmod 755 $final_path/Specific/db
-sudo chmod 755 $final_path/Specific/db/db.sqlite
+sudo chown -R www-data: $final_path
+sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" www-data
+sudo su -c "cd $final_path && php composer.phar install" www-data
+sudo rm $final_path/composer*
+
+db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
+db_user=baikal
+sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/Core/Resources/Db/MySQL/db.sql)
+sudo yunohost app setting baikal mysqlpwd -v $db_pwd
+sed -i "s@YNH_TIMEZONE@$(cat /etc/timezone)@g" ../conf/config.php
+sed -i "s@YNH_ADMIN_PASSWORDHASH@$(echo -n admin:BaikalDAV:$admin_pwd | md5sum | cut -d ' ' -f 1)@g" ../conf/config.php
+
+sed -i "s@YNH_LOCATION@$path@g" ../conf/config.system.php
+sed -i "s@YNH_DBNAME@$db_user@g" ../conf/config.system.php
+sed -i "s@YNH_DBUSER@$db_user@g" ../conf/config.system.php
+sed -i "s@YNH_DBPWD@$db_pwd@g" ../conf/config.system.php
+encrypt_key=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{32\}\).*/\1/p')
+sudo yunohost app setting baikal encrypt_key -v $encrypt_key
+sed -i "s@YNH_ENCRYPTKEY@$encrypt_key@g" ../conf/config.system.php
+
+sudo cp ../conf/config.php $final_path/Specific
+sudo cp ../conf/config.system.php $final_path/Specific
+
+sudo chown -R root: $final_path
+sudo chown -R www-data: $final_path/Specific
+sudo find $final_path -type f | xargs sudo chmod 644
+sudo find $final_path -type d | xargs sudo chmod 755
# Change variables in Baikal configuration
-sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/baikal.conf
-sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/baikal.conf
-
-# Change variables in Baikal sources for correct work in subpathes
-sudo sed -i "s@PROJECT_BASEURI_@\"$path/\"@g" $final_path/Core/Frameworks/Baikal/Model/Config/System.php
+sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
+sed -i "s@ALIASTOCHANGE@$final_path/html@g" ../conf/nginx.conf
+sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/baikal.conf
+sudo chown root: /etc/nginx/conf.d/$domain.d/baikal.conf
+sudo chmod 600 /etc/nginx/conf.d/$domain.d/baikal.conf
# Reload Nginx and regenerate SSOwat conf
-sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app setting baikal skipped_uris -v "/"
sudo yunohost app ssowatconf
diff --git a/scripts/remove b/scripts/remove
index 54674d1..ec897b3 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,16 +1,14 @@
#!/bin/bash
-# Backuping db
-backup_path=/var/cache/yunohost/backups/baikal
-final_path=/var/www/baikal/
-
-mkdir -p $backup_path
-sudo cp -a $final_path/Specific/* $backup_path
+db_user=baikal
+db_name=baikal
+root_pwd=$(sudo cat /etc/yunohost/mysql)
+mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
# Removing executable files
-sudo rm -rf /var/www/baiakl
+sudo rm -rf /var/www/baikal
+domain=$(sudo yunohost app setting baikal domain)
sudo rm -f /etc/nginx/conf.d/$domain.d/baikal.conf
# Restarting services
-sudo service php5-fpm restart
sudo service nginx reload
diff --git a/sources/Core/Distrib.php b/sources/Core/Distrib.php
index 5e21338..01b17f9 100644
--- a/sources/Core/Distrib.php
+++ b/sources/Core/Distrib.php
@@ -26,4 +26,4 @@
define("BAIKAL_VERSION", "0.2.7");
define("BAIKAL_HOMEPAGE", "http://baikal-server.com");
-define("PROJECT_PACKAGE", "flat");
+define("PROJECT_PACKAGE", "regular");
diff --git a/sources/Core/Frameworks/Baikal/Core/AbstractExternalAuth.php b/sources/Core/Frameworks/Baikal/Core/AbstractExternalAuth.php
new file mode 100644
index 0000000..726dfa5
--- /dev/null
+++ b/sources/Core/Frameworks/Baikal/Core/AbstractExternalAuth.php
@@ -0,0 +1,136 @@
+
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+abstract class AbstractExternalAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
+
+ /**
+ * enable autocreation of user
+ *
+ * @var PDO
+ */
+ protected $enableAutoCreation;
+
+ /**
+ * Reference to PDO connection
+ *
+ * @var PDO
+ */
+ private $pdo;
+
+ /**
+ * PDO table name we'll be using
+ *
+ * @var string
+ */
+ private $tableName;
+
+ /**
+ * Creates the backend object.
+ *
+ * If the filename argument is passed in, it will parse out the specified file fist.
+ *
+ * @param PDO $pdo
+ * @param string $realm
+ * @param string $tableName The PDO table name to use
+ */
+ public function __construct(\PDO $pdo, $realm = 'BaikalDAV', $tableName = 'users') {
+
+ $this->pdo = $pdo;
+ $this->tableName = $tableName;
+ $this->enableAutoCreation = true;
+ }
+
+ /**
+ * Validates a username and password
+ *
+ * This method should return true or false depending on if login
+ * succeeded.
+ *
+ * @param string $username
+ * @param string $password
+ * @return bool
+ */
+ public function validateUserPass($username, $password) {
+
+ /* auth user agains backend */
+ if (!$this->validateUserPassExternal($username, $password))
+ return false;
+
+ /* check user exists already */
+ $stmt = $this->pdo->prepare('SELECT username FROM '.$this->tableName.' WHERE username = ?');
+ $stmt->execute(array($username));
+ $result = $stmt->fetchAll();
+ if( count($result) == 1) {
+ $this->currentUser = $username;
+ return true;
+ }
+
+ /* failed login, when new user should not create */
+ if( !BAIKAL_DAV_AUTO_CREATE_USER || !$this->enableAutoCreation)
+ return false;
+
+ /* create user */
+ $this->autoUserCreation($username);
+ $this->currentUser = $username;
+ return true;
+ }
+
+ /**
+ * Validates a username and password agains external backend
+ *
+ * This method should return true or false depending on if login
+ * succeeded.
+ *
+ * @param string $username
+ * @param string $password
+ * @return bool
+ */
+ public abstract function validateUserPassExternal($username, $password);
+
+ /**
+ * return the displayname and email from the external Backend
+ *
+ * @param string $username
+ * @return array ('displayname' => string, 'email' => string)
+ */
+ public function getAccountValues($username) {
+
+ return array();
+ }
+
+ /**
+ * create an internal user, when user not exists
+ *
+ * @param string $username
+ */
+ private function autoUserCreation($username) {
+
+ /* get account values from backend */
+ $values = $this->getAccountValues($username);
+ if (!isset($values['displayname']) OR strlen($values['displayname']) === 0)
+ $values['displayname'] = $username;
+ if (!isset($values['email']) OR strlen($values['email']) === 0) {
+ if(filter_var($username, FILTER_VALIDATE_EMAIL))
+ $values['email'] = $username;
+ else
+ $values['email'] = 'unset-mail';
+ }
+
+ /* create user */
+ $user = new \Baikal\Model\User();
+ $user->set('username', $username);
+ $user->set('displayname', $values['displayname']);
+ $user->set('email', $values['email']);
+ $user->persist();
+ }
+
+}
diff --git a/sources/Core/Frameworks/Baikal/Core/LDAPUserBindAuth.php b/sources/Core/Frameworks/Baikal/Core/LDAPUserBindAuth.php
new file mode 100644
index 0000000..c83fa29
--- /dev/null
+++ b/sources/Core/Frameworks/Baikal/Core/LDAPUserBindAuth.php
@@ -0,0 +1,75 @@
+
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class LDAPUserBindAuth extends AbstractExternalAuth {
+
+ /**
+ * AccountValues for getAccountValues
+ *
+ * @var array ('displayname' => string, 'email' => string)
+ */
+ private $accountValues;
+
+ /**
+ * Validates a username and password over ldap
+ *
+ * @param string $username
+ * @param string $password
+ * @return bool
+ */
+ public function validateUserPassExternal($username, $password) {
+
+ /* create ldap connection */
+ $conn = ldap_connect(BAIKAL_DAV_LDAP_URI);
+ if (!$conn)
+ return false;
+ if (!ldap_set_option($conn,LDAP_OPT_PROTOCOL_VERSION,3))
+ return false;
+
+ /* bind with user
+ * error_handler have to change, because a failed bind raises an error
+ * this raise a secuity issue because in the stack trace is the password of user readable
+ */
+ $arr = explode('@', $username, 2);
+ $dn = str_replace('%n', $username, BAIKAL_DAV_LDAP_DN_TEMPLATE);
+ $dn = str_replace('%u', $arr[0], $dn);
+ if(isset($arr[1])) $dn = str_replace('%d', $arr[1], $dn);
+
+ set_error_handler("\Baikal\Core\LDAPUserBindAuth::exception_error_handler");
+ $bind = ldap_bind($conn, $dn, $password);
+ restore_error_handler();
+ if (!$bind) {
+ ldap_close($conn);
+ return false;
+ }
+
+ /* read displayname and email from user */
+ $this->accountValues = array();
+ $sr = ldap_read($conn, $dn, '(objectclass=*)', array(BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR,BAIKAL_DAV_LDAP_EMAIL_ATTR));
+ $entry = ldap_get_entries($conn, $sr);
+ if (isset($entry[0][BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR][0]))
+ $this->accountValues['displayname'] = $entry[0][BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR][0];
+ if (isset($entry[0][BAIKAL_DAV_LDAP_EMAIL_ATTR][0]))
+ $this->accountValues['email'] = $entry[0][BAIKAL_DAV_LDAP_EMAIL_ATTR][0];
+
+ /* close */
+ ldap_close($conn);
+ return true;
+ }
+
+ public function getAccountValues($username) {
+
+ return $this->accountValues;
+ }
+
+ # WorkAround error_handler in failed bind of LDAP
+ public static function exception_error_handler($errno, $errstr, $errfile, $errline) {
+ }
+}
diff --git a/sources/Core/Frameworks/Baikal/Core/MailAuth.php b/sources/Core/Frameworks/Baikal/Core/MailAuth.php
new file mode 100644
index 0000000..63a93c2
--- /dev/null
+++ b/sources/Core/Frameworks/Baikal/Core/MailAuth.php
@@ -0,0 +1,56 @@
+
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class MailAuth extends AbstractExternalAuth {
+
+ /**
+ * Validates a username and password over ldap
+ *
+ * @param string $username
+ * @param string $password
+ * @return bool
+ */
+ public function validateUserPassExternal($username, $password) {
+
+ /* build connection string */
+ $cert = BAIKAL_DAV_MAIL_CHECK_CERT ? "/validate-cert" : "/novalidate-cert";
+ $url = "";
+ switch(BAIKAL_DAV_MAIL_PROTOCOL) {
+ case "imap": $url = "{".BAIKAL_DAV_MAIL_SERVER."/imap/notls}INBOX"; break;
+ case "imaps": $url = "{".BAIKAL_DAV_MAIL_SERVER."/imap/ssl${cert}}INBOX"; break;
+ case "imaptls": $url = "{".BAIKAL_DAV_MAIL_SERVER."/imap/tls${cert}}INBOX"; break;
+ case "pop3": $url = "{".BAIKAL_DAV_MAIL_SERVER."/pop3/notls}"; break;
+ case "pop3s": $url = "{".BAIKAL_DAV_MAIL_SERVER."/pop3/ssl${cert}}"; break;
+ case "pop3tls": $url = "{".BAIKAL_DAV_MAIL_SERVER."/pop3/tls${cert}}"; break;
+ case "smtp": $url = "{".BAIKAL_DAV_MAIL_SERVER."/smtp/notls}"; break;
+ case "smtps": $url = "{".BAIKAL_DAV_MAIL_SERVER."/smtp/ssl${cert}}"; break;
+ case "smtptls": $url = "{".BAIKAL_DAV_MAIL_SERVER."/smtp/tls${cert}}"; break;
+ }
+
+ /* connect to mail server (only one try) */
+ set_error_handler("\Baikal\Core\MailAuth::exception_error_handler");
+ $conn = imap_open($url, $username, $password, NULL, 0);
+ restore_error_handler();
+ if (!$conn)
+ return false;
+
+ /* skip notices, warnings and errors */
+ imap_errors();
+
+ /* close */
+ imap_close($conn);
+ return true;
+ }
+
+ # WorkAround error_handler in failed login in imap_open
+ public static function exception_error_handler($errno, $errstr, $errfile, $errline) {
+ }
+}
+
diff --git a/sources/Core/Frameworks/Baikal/Core/Tools.php b/sources/Core/Frameworks/Baikal/Core/Tools.php
index 64adcd1..416df32 100644
--- a/sources/Core/Frameworks/Baikal/Core/Tools.php
+++ b/sources/Core/Frameworks/Baikal/Core/Tools.php
@@ -207,417 +207,9 @@ CODE;
}
public static function timezones() {
- $aZones = array(
- "Africa/Abidjan",
- "Africa/Accra",
- "Africa/Addis_Ababa",
- "Africa/Algiers",
- "Africa/Asmara",
- "Africa/Bamako",
- "Africa/Bangui",
- "Africa/Banjul",
- "Africa/Bissau",
- "Africa/Blantyre",
- "Africa/Brazzaville",
- "Africa/Bujumbura",
- "Africa/Cairo",
- "Africa/Casablanca",
- "Africa/Ceuta",
- "Africa/Conakry",
- "Africa/Dakar",
- "Africa/Dar_es_Salaam",
- "Africa/Djibouti",
- "Africa/Douala",
- "Africa/El_Aaiun",
- "Africa/Freetown",
- "Africa/Gaborone",
- "Africa/Harare",
- "Africa/Johannesburg",
- "Africa/Juba",
- "Africa/Kampala",
- "Africa/Khartoum",
- "Africa/Kigali",
- "Africa/Kinshasa",
- "Africa/Lagos",
- "Africa/Libreville",
- "Africa/Lome",
- "Africa/Luanda",
- "Africa/Lubumbashi",
- "Africa/Lusaka",
- "Africa/Malabo",
- "Africa/Maputo",
- "Africa/Maseru",
- "Africa/Mbabane",
- "Africa/Mogadishu",
- "Africa/Monrovia",
- "Africa/Nairobi",
- "Africa/Ndjamena",
- "Africa/Niamey",
- "Africa/Nouakchott",
- "Africa/Ouagadougou",
- "Africa/Porto-Novo",
- "Africa/Sao_Tome",
- "Africa/Tripoli",
- "Africa/Tunis",
- "Africa/Windhoek",
- "America/Adak",
- "America/Anchorage",
- "America/Anguilla",
- "America/Antigua",
- "America/Araguaina",
- "America/Argentina/Buenos_Aires",
- "America/Argentina/Catamarca",
- "America/Argentina/Cordoba",
- "America/Argentina/Jujuy",
- "America/Argentina/La_Rioja",
- "America/Argentina/Mendoza",
- "America/Argentina/Rio_Gallegos",
- "America/Argentina/Salta",
- "America/Argentina/San_Juan",
- "America/Argentina/San_Luis",
- "America/Argentina/Tucuman",
- "America/Argentina/Ushuaia",
- "America/Aruba",
- "America/Asuncion",
- "America/Atikokan",
- "America/Bahia",
- "America/Barbados",
- "America/Belem",
- "America/Belize",
- "America/Blanc-Sablon",
- "America/Boa_Vista",
- "America/Bogota",
- "America/Boise",
- "America/Cambridge_Bay",
- "America/Campo_Grande",
- "America/Cancun",
- "America/Caracas",
- "America/Cayenne",
- "America/Cayman",
- "America/Chicago",
- "America/Chihuahua",
- "America/Costa_Rica",
- "America/Cuiaba",
- "America/Curacao",
- "America/Danmarkshavn",
- "America/Dawson",
- "America/Dawson_Creek",
- "America/Denver",
- "America/Detroit",
- "America/Dominica",
- "America/Edmonton",
- "America/Eirunepe",
- "America/El_Salvador",
- "America/Felipe_Carrillo",
- "America/Fortaleza",
- "America/Glace_Bay",
- "America/Godthab",
- "America/Goose_Bay",
- "America/Grand_Turk",
- "America/Grenada",
- "America/Guadeloupe",
- "America/Guatemala",
- "America/Guayaquil",
- "America/Guyana",
- "America/Halifax",
- "America/Havana",
- "America/Hermosillo",
- "America/Indiana/Indianapolis",
- "America/Indiana/Knox",
- "America/Indiana/Marengo",
- "America/Indiana/Petersburg",
- "America/Indiana/Tell_City",
- "America/Indiana/Vevay",
- "America/Indiana/Vincennes",
- "America/Indiana/Winamac",
- "America/Inuvik",
- "America/Iqaluit",
- "America/Jamaica",
- "America/Juneau",
- "America/Kentucky/Louisville",
- "America/Kentucky/Monticello",
- "America/La_Paz",
- "America/Lima",
- "America/Los_Angeles",
- "America/Maceio",
- "America/Managua",
- "America/Manaus",
- "America/Marigot",
- "America/Martinique",
- "America/Matamoros",
- "America/Mazatlan",
- "America/Menominee",
- "America/Merida",
- "America/Mexico_City",
- "America/Miquelon",
- "America/Moncton",
- "America/Monterrey",
- "America/Montevideo",
- "America/Montreal",
- "America/Montserrat",
- "America/Nassau",
- "America/New_York",
- "America/Nipigon",
- "America/Nome",
- "America/Noronha",
- "America/North_Dakota/Center",
- "America/North_Dakota/New_Salem",
- "America/Ojinaga",
- "America/Panama",
- "America/Pangnirtung",
- "America/Paramaribo",
- "America/Phoenix",
- "America/Port-au-Prince",
- "America/Porto_Velho",
- "America/Port_of_Spain",
- "America/Puerto_Rico",
- "America/Rainy_River",
- "America/Rankin_Inlet",
- "America/Recife",
- "America/Regina",
- "America/Resolute",
- "America/Rio_Branco",
- "America/Santarem",
- "America/Santa_Isabel",
- "America/Santiago",
- "America/Santo_Domingo",
- "America/Sao_Paulo",
- "America/Scoresbysund",
- "America/Shiprock",
- "America/St_Barthelemy",
- "America/St_Johns",
- "America/St_Kitts",
- "America/St_Lucia",
- "America/St_Thomas",
- "America/St_Vincent",
- "America/Swift_Current",
- "America/Tegucigalpa",
- "America/Thule",
- "America/Thunder_Bay",
- "America/Tijuana",
- "America/Toronto",
- "America/Tortola",
- "America/Vancouver",
- "America/Whitehorse",
- "America/Winnipeg",
- "America/Yakutat",
- "America/Yellowknife",
- "Antarctica/Casey",
- "Antarctica/Davis",
- "Antarctica/DumontDUrville",
- "Antarctica/Mawson",
- "Antarctica/McMurdo",
- "Antarctica/Palmer",
- "Antarctica/Rothera",
- "Antarctica/South_Pole",
- "Antarctica/Syowa",
- "Antarctica/Vostok",
- "Arctic/Longyearbyen",
- "Asia/Aden",
- "Asia/Almaty",
- "Asia/Amman",
- "Asia/Anadyr",
- "Asia/Aqtau",
- "Asia/Aqtobe",
- "Asia/Ashgabat",
- "Asia/Baghdad",
- "Asia/Bahrain",
- "Asia/Baku",
- "Asia/Bangkok",
- "Asia/Beirut",
- "Asia/Bishkek",
- "Asia/Brunei",
- "Asia/Choibalsan",
- "Asia/Chongqing",
- "Asia/Colombo",
- "Asia/Damascus",
- "Asia/Dhaka",
- "Asia/Dili",
- "Asia/Dubai",
- "Asia/Dushanbe",
- "Asia/Gaza",
- "Asia/Harbin",
- "Asia/Hong_Kong",
- "Asia/Hovd",
- "Asia/Ho_Chi_Minh",
- "Asia/Irkutsk",
- "Asia/Jakarta",
- "Asia/Jayapura",
- "Asia/Jerusalem",
- "Asia/Kabul",
- "Asia/Kamchatka",
- "Asia/Karachi",
- "Asia/Kashgar",
- "Asia/Kathmandu",
- "Asia/Kolkata",
- "Asia/Krasnoyarsk",
- "Asia/Kuala_Lumpur",
- "Asia/Kuching",
- "Asia/Kuwait",
- "Asia/Macau",
- "Asia/Magadan",
- "Asia/Makassar",
- "Asia/Manila",
- "Asia/Muscat",
- "Asia/Nicosia",
- "Asia/Novokuznetsk",
- "Asia/Novosibirsk",
- "Asia/Omsk",
- "Asia/Oral",
- "Asia/Phnom_Penh",
- "Asia/Pontianak",
- "Asia/Pyongyang",
- "Asia/Qatar",
- "Asia/Qyzylorda",
- "Asia/Rangoon",
- "Asia/Riyadh",
- "Asia/Sakhalin",
- "Asia/Samarkand",
- "Asia/Seoul",
- "Asia/Shanghai",
- "Asia/Singapore",
- "Asia/Taipei",
- "Asia/Tashkent",
- "Asia/Tbilisi",
- "Asia/Tehran",
- "Asia/Thimphu",
- "Asia/Tokyo",
- "Asia/Ulaanbaatar",
- "Asia/Urumqi",
- "Asia/Vientiane",
- "Asia/Vladivostok",
- "Asia/Yakutsk",
- "Asia/Yekaterinburg",
- "Asia/Yerevan",
- "Atlantic/Azores",
- "Atlantic/Bermuda",
- "Atlantic/Canary",
- "Atlantic/Cape_Verde",
- "Atlantic/Faroe",
- "Atlantic/Madeira",
- "Atlantic/Reykjavik",
- "Atlantic/South_Georgia",
- "Atlantic/Stanley",
- "Atlantic/St_Helena",
- "Australia/Adelaide",
- "Australia/Brisbane",
- "Australia/Broken_Hill",
- "Australia/Currie",
- "Australia/Darwin",
- "Australia/Eucla",
- "Australia/Hobart",
- "Australia/Lindeman",
- "Australia/Lord_Howe",
- "Australia/Melbourne",
- "Australia/Perth",
- "Australia/Sydney",
- "Europe/Amsterdam",
- "Europe/Andorra",
- "Europe/Athens",
- "Europe/Belgrade",
- "Europe/Berlin",
- "Europe/Bratislava",
- "Europe/Brussels",
- "Europe/Bucharest",
- "Europe/Budapest",
- "Europe/Chisinau",
- "Europe/Copenhagen",
- "Europe/Dublin",
- "Europe/Gibraltar",
- "Europe/Guernsey",
- "Europe/Helsinki",
- "Europe/Isle_of_Man",
- "Europe/Istanbul",
- "Europe/Jersey",
- "Europe/Kaliningrad",
- "Europe/Kiev",
- "Europe/Lisbon",
- "Europe/Ljubljana",
- "Europe/London",
- "Europe/Luxembourg",
- "Europe/Madrid",
- "Europe/Malta",
- "Europe/Mariehamn",
- "Europe/Minsk",
- "Europe/Monaco",
- "Europe/Moscow",
- "Europe/Oslo",
- "Europe/Paris",
- "Europe/Podgorica",
- "Europe/Prague",
- "Europe/Riga",
- "Europe/Rome",
- "Europe/Samara",
- "Europe/San_Marino",
- "Europe/Sarajevo",
- "Europe/Simferopol",
- "Europe/Skopje",
- "Europe/Sofia",
- "Europe/Stockholm",
- "Europe/Tallinn",
- "Europe/Tirane",
- "Europe/Uzhgorod",
- "Europe/Vaduz",
- "Europe/Vatican",
- "Europe/Vienna",
- "Europe/Vilnius",
- "Europe/Volgograd",
- "Europe/Warsaw",
- "Europe/Zagreb",
- "Europe/Zaporozhye",
- "Europe/Zurich",
- "Indian/Antananarivo",
- "Indian/Chagos",
- "Indian/Christmas",
- "Indian/Cocos",
- "Indian/Comoro",
- "Indian/Kerguelen",
- "Indian/Mahe",
- "Indian/Maldives",
- "Indian/Mauritius",
- "Indian/Mayotte",
- "Indian/Reunion",
- "Pacific/Apia",
- "Pacific/Auckland",
- "Pacific/Chatham",
- "Pacific/Easter",
- "Pacific/Efate",
- "Pacific/Enderbury",
- "Pacific/Fakaofo",
- "Pacific/Fiji",
- "Pacific/Funafuti",
- "Pacific/Galapagos",
- "Pacific/Gambier",
- "Pacific/Guadalcanal",
- "Pacific/Guam",
- "Pacific/Honolulu",
- "Pacific/Johnston",
- "Pacific/Kiritimati",
- "Pacific/Kosrae",
- "Pacific/Kwajalein",
- "Pacific/Majuro",
- "Pacific/Marquesas",
- "Pacific/Midway",
- "Pacific/Nauru",
- "Pacific/Niue",
- "Pacific/Norfolk",
- "Pacific/Noumea",
- "Pacific/Pago_Pago",
- "Pacific/Palau",
- "Pacific/Pitcairn",
- "Pacific/Ponape",
- "Pacific/Port_Moresby",
- "Pacific/Rarotonga",
- "Pacific/Saipan",
- "Pacific/Tahiti",
- "Pacific/Tarawa",
- "Pacific/Tongatapu",
- "Pacific/Truk",
- "Pacific/Wake",
- "Pacific/Wallis",
- );
+ $aZones = \DateTimeZone::listIdentifiers();
reset($aZones);
return $aZones;
}
-}
\ No newline at end of file
+}
diff --git a/sources/Core/Frameworks/Baikal/Model/Config/Standard.php b/sources/Core/Frameworks/Baikal/Model/Config/Standard.php
index 6e97b8f..50b869f 100644
--- a/sources/Core/Frameworks/Baikal/Model/Config/Standard.php
+++ b/sources/Core/Frameworks/Baikal/Model/Config/Standard.php
@@ -45,6 +45,38 @@ class Standard extends \Baikal\Model\Config {
"type" => "string",
"comment" => "HTTP authentication type for WebDAV; default Digest"
),
+ "BAIKAL_DAV_LDAP_URI" => array(
+ "type" => "string",
+ "comment" => "URI to LDAP Server (for ldap-userbind auth); default ldapi:///"
+ ),
+ "BAIKAL_DAV_LDAP_DN_TEMPLATE" => array(
+ "type" => "string",
+ "comment" => "User DN for bind; with replacments %n => username, %u => user part, %d => domain part of username"
+ ),
+ "BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR" => array(
+ "type" => "string",
+ "comment" => "LDAP-attribute for displayname; default cn"
+ ),
+ "BAIKAL_DAV_LDAP_EMAIL_ATTR" => array(
+ "type" => "string",
+ "comment" => "LDAP-attribute for email; default mail"
+ ),
+ "BAIKAL_DAV_MAIL_PROTOCOL" => array(
+ "type" => "string",
+ "comment" => "used protocol; default 'imap (TLS/StartTLS)'"
+ ),
+ "BAIKAL_DAV_MAIL_SERVER" => array(
+ "type" => "string",
+ "comment" => "host:port of mail server; default localhost:143"
+ ),
+ "BAIKAL_DAV_MAIL_CHECK_CERT" => array(
+ "type" => "boolean",
+ "comment" => "validate ssl-certificate; default yes"
+ ),
+ "BAIKAL_DAV_AUTO_CREATE_USER" => array(
+ "type" => "boolean",
+ "comment" => "automatic creation of users; default yes"
+ ),
"BAIKAL_ADMIN_ENABLED" => array(
"type" => "boolean",
"comment" => "Baïkal Web Admin ON/OFF switch; default TRUE",
@@ -65,6 +97,14 @@ class Standard extends \Baikal\Model\Config {
"BAIKAL_CARD_ENABLED" => TRUE,
"BAIKAL_CAL_ENABLED" => TRUE,
"BAIKAL_DAV_AUTH_TYPE" => "Digest",
+ "BAIKAL_DAV_LDAP_URI" => "ldapi:///",
+ "BAIKAL_DAV_LDAP_DN_TEMPLATE" => "uid=%n,dc=example,dc=com",
+ "BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR" => "cn",
+ "BAIKAL_DAV_LDAP_EMAIL_ATTR" => "mail",
+ "BAIKAL_DAV_MAIL_PROTOCOL" => "imap (unencrypted)",
+ "BAIKAL_DAV_MAIL_SERVER" => "localhost:143",
+ "BAIKAL_DAV_MAIL_CHECK_CERT" => TRUE,
+ "BAIKAL_DAV_AUTO_CREATE_USER" => TRUE,
"BAIKAL_ADMIN_ENABLED" => TRUE,
"BAIKAL_ADMIN_AUTOLOCKENABLED" => FALSE,
"BAIKAL_ADMIN_PASSWORDHASH" => ""
@@ -94,9 +134,80 @@ class Standard extends \Baikal\Model\Config {
$oMorpho->add(new \Formal\Element\Listbox(array(
"prop" => "BAIKAL_DAV_AUTH_TYPE",
"label" => "WebDAV authentication type",
- "options" => array( "Digest", "Basic" )
+ "options" => array( "Digest", "Basic", "LDAP-UserBind", "Mail" )
)));
+ $oMorpho->add(new \Formal\Element\Text(array(
+ "prop" => "BAIKAL_DAV_LDAP_URI",
+ "label" => "LDAP URI",
+ "class" => "auth_ldap-userbind"
+ )));
+
+ $oMorpho->add(new \Formal\Element\Text(array(
+ "prop" => "BAIKAL_DAV_LDAP_DN_TEMPLATE",
+ "label" => "LDAP DN template",
+ "class" => "auth_ldap-userbind",
+ "popover" => array(
+ "title" => "posible placeholder",
+ "content" => "%n - username
%u - user part of username , when it is an email address)
%d - domain part",
+ )
+ )));
+
+ $oMorpho->add(new \Formal\Element\Text(array(
+ "prop" => "BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR",
+ "label" => "LDAP attribute for DisplayName",
+ "class" => "auth_ldap-userbind"
+ )));
+
+ $oMorpho->add(new \Formal\Element\Text(array(
+ "prop" => "BAIKAL_DAV_LDAP_EMAIL_ATTR",
+ "label" => "LDAP attribute for eMail",
+ "class" => "auth_ldap-userbind"
+ )));
+
+ $oMorpho->add(new \Formal\Element\Listbox(array(
+ "prop" => "BAIKAL_DAV_MAIL_PROTOCOL",
+ "label" => "MailAuth Protocol",
+ "class" => "auth_mail",
+ "options" => array(
+ "imap" => "imap (unencrypted)",
+ "imaps" => "imaps (SSL)",
+ "imaptls" => "imap (StartTLS)",
+ "pop3" => "pop3 (unencrypted)",
+ "pop3s" => "pop3s (SSL)",
+ "pop3tls" => "pop3 (StartTLS)",
+ "smtp" => "smtp (unencrypted)",
+ "smtps" => "smtps (SSL)",
+ "smtptls" => "smtp (StartTLS)"
+ )
+ )));
+
+ $oMorpho->add(new \Formal\Element\Text(array(
+ "prop" => "BAIKAL_DAV_MAIL_SERVER",
+ "label" => "MailAuth Server",
+ "class" => "auth_mail",
+ "popover" => array(
+ "title" => "Format",
+ "content" => "host:port"
+ )
+ )));
+
+ $oMorpho->add(new \Formal\Element\Checkbox(array(
+ "prop" => "BAIKAL_DAV_MAIL_CHECK_CERT",
+ "label" => "MailAuth Check SSL-Certificate",
+ "class" => "auth_mail auth_mail_ssl",
+ "popover" => array(
+ "title" => "Security",
+ "content" => "validate the server certificate"
+ )
+ )));
+
+ $oMorpho->add(new \Formal\Element\Checkbox(array(
+ "prop" => "BAIKAL_DAV_AUTO_CREATE_USER",
+ "label" => "Automatic create users",
+ "class" => "auth_mail auth_ldap-userbind"
+ )));
+
$oMorpho->add(new \Formal\Element\Password(array(
"prop" => "BAIKAL_ADMIN_PASSWORDHASH",
"label" => "Admin password",
@@ -207,6 +318,33 @@ define("BAIKAL_CAL_ENABLED", TRUE);
# WebDAV authentication type; default Digest
define("BAIKAL_DAV_AUTH_TYPE", "Digest");
+# Auth Backend LDAP-UserBind; LDAP URI
+define("BAIKAL_DAV_LDAP_URI", 'ldapi:///');
+
+# Auth Backend LDAP-UserBind; Template for userbind
+# %n => username
+# %u => user part of username when it is an email
+# %u => domain part of username when it is an email
+define("BAIKAL_DAV_LDAP_DN_TEMPLATE", 'cn=%u,dc=%d,ou=domains,o=server');
+
+# Auth Backend LDAP-UserBind; attribute for displayname
+define("BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR", 'cn');
+
+# Auth Backend LDAP-UserBind; attribute for email
+define("BAIKAL_DAV_LDAP_EMAIL_ATTR", 'mail');
+
+# Auth Backend Mail; protocol of service
+define("BAIKAL_DAV_MAIL_PROTOCOL", 'imap');
+
+# Auth Backend Mail; server host:port
+define("BAIKAL_DAV_MAIL_SERVER", 'localhost:143');
+
+# Auth Backend Mail; validate the ssl-certificate
+define("BAIKAL_DAV_MAIL_CHECK_CERT", TRUE);
+
+# Auth Backends: automatic creation of users; default yes"
+define("BAIKAL_DAV_AUTO_CREATE_USER", TRUE);
+
# Baïkal Web Admin ON/OFF switch; default TRUE
define("BAIKAL_ADMIN_ENABLED", TRUE);
@@ -219,4 +357,4 @@ CODE;
$sCode = trim($sCode);
return $sCode;
}
-}
\ No newline at end of file
+}
diff --git a/sources/Core/Frameworks/Baikal/Model/Config/System.php b/sources/Core/Frameworks/Baikal/Model/Config/System.php
index 3d493ea..a17313c 100644
--- a/sources/Core/Frameworks/Baikal/Model/Config/System.php
+++ b/sources/Core/Frameworks/Baikal/Model/Config/System.php
@@ -208,10 +208,10 @@ define("BAIKAL_PATH_SABREDAV", PROJECT_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/");
define("BAIKAL_AUTH_REALM", "BaikalDAV");
# Should begin and end with a "/"
-define("BAIKAL_CARD_BASEURI", PROJECT_BASEURI_ . "card.php/");
+define("BAIKAL_CARD_BASEURI", PROJECT_BASEURI . "card.php/");
# Should begin and end with a "/"
-define("BAIKAL_CAL_BASEURI", PROJECT_BASEURI_ . "cal.php/");
+define("BAIKAL_CAL_BASEURI", PROJECT_BASEURI . "cal.php/");
# Define path to Baïkal Database SQLite file
define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/db.sqlite");
diff --git a/sources/Core/Frameworks/Baikal/Model/User.php b/sources/Core/Frameworks/Baikal/Model/User.php
index 0e61894..5c7bfa0 100644
--- a/sources/Core/Frameworks/Baikal/Model/User.php
+++ b/sources/Core/Frameworks/Baikal/Model/User.php
@@ -226,37 +226,43 @@ class User extends \Flake\Core\Model\Db {
"label" => "Email",
"validation" => "required,email"
)));
-
- $oMorpho->add(new \Formal\Element\Password(array(
- "prop" => "password",
- "label" => "Password",
- )));
-
- $oMorpho->add(new \Formal\Element\Password(array(
- "prop" => "passwordconfirm",
- "label" => "Confirm password",
- "validation" => "sameas:password",
- )));
-
+
if($this->floating()) {
$oMorpho->element("username")->setOption("help", "May be an email, but not forcibly.");
- $oMorpho->element("password")->setOption("validation", "required");
} else {
- $sNotice = "-- Leave empty to keep current password --";
$oMorpho->element("username")->setOption("readonly", true);
+ }
+
+ if( BAIKAL_DAV_AUTH_TYPE == "Digest" || BAIKAL_DAV_AUTH_TYPE == "Basic") {
+ $oMorpho->add(new \Formal\Element\Password(array(
+ "prop" => "password",
+ "label" => "Password",
+ )));
+
+ $oMorpho->add(new \Formal\Element\Password(array(
+ "prop" => "passwordconfirm",
+ "label" => "Confirm password",
+ "validation" => "sameas:password",
+ )));
+
+ if($this->floating()) {
+ $oMorpho->element("password")->setOption("validation", "required");
+ } else {
+ $sNotice = "-- Leave empty to keep current password --";
- $oMorpho->element("password")->setOption("popover", array(
- "title" => "Password",
- "content" => "Write something here only if you want to change the user password."
- ));
+ $oMorpho->element("password")->setOption("popover", array(
+ "title" => "Password",
+ "content" => "Write something here only if you want to change the user password."
+ ));
- $oMorpho->element("passwordconfirm")->setOption("popover", array(
- "title" => "Confirm password",
- "content" => "Write something here only if you want to change the user password."
- ));
+ $oMorpho->element("passwordconfirm")->setOption("popover", array(
+ "title" => "Confirm password",
+ "content" => "Write something here only if you want to change the user password."
+ ));
- $oMorpho->element("password")->setOption("placeholder", $sNotice);
- $oMorpho->element("passwordconfirm")->setOption("placeholder", $sNotice);
+ $oMorpho->element("password")->setOption("placeholder", $sNotice);
+ $oMorpho->element("passwordconfirm")->setOption("placeholder", $sNotice);
+ }
}
return $oMorpho;
diff --git a/sources/Core/Frameworks/Baikal/Scripts/package-flat.sh b/sources/Core/Frameworks/Baikal/Scripts/package-flat.sh
new file mode 100755
index 0000000..acf9649
--- /dev/null
+++ b/sources/Core/Frameworks/Baikal/Scripts/package-flat.sh
@@ -0,0 +1,80 @@
+#!/usr/bin/env sh
+TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`"
+TEMPDIR="/tmp/baikal-flat-$TEMPDATE-temp"
+TEMPARCHIVE="$TEMPDIR/temparchive.tgz"
+TEMPDIRDEREFERENCE="/tmp/baikal-flat-$TEMPDATE"
+
+echo "########################################################################"
+echo "#"
+echo "# Baïkal Packaging script"
+echo "#"
+echo "# Packaging project for flat distribution (replacing symlinks"
+echo "# by their target). Useful for FTP deployment"
+echo "#"
+echo "# TEMPDIR: $TEMPDIR"
+
+rm -rf /tmp/baikal-flat
+
+# Export Project
+# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
+
+mkdir $TEMPDIR && \
+git-archive-all --force-submodules $TEMPARCHIVE && \
+cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \
+
+# Dereferencig symlinks
+cp -RfL $TEMPDIR $TEMPDIRDEREFERENCE && \
+rm -Rf $TEMPDIR && \
+
+TEMPDIR=$TEMPDIRDEREFERENCE/temparchive && \
+
+# Jump to tempdir
+cd $TEMPDIR && \
+
+# Cleaning Resources
+rm -f Core/Resources/Web/README.md && \
+rm -Rf Core/Resources/Web/TwitterBootstrap && \
+
+# Cleaning Scripts
+rm -Rf Core/Scripts && \
+rm -Rf Core/Frameworks/Baikal/Scripts && \
+
+# Cleaning WWWRoot
+rm -Rf Core/Frameworks/Baikal/WWWRoot && \
+rm -Rf Core/Frameworks/BaikalAdmin/WWWRoot && \
+
+# Cleaning Specific/Virtualhosts
+rm -Rf Specific/virtualhosts && \
+
+# Installing dependencies (composer)
+composer install && \
+
+# Removing composer stuff
+rm -f composer.* && \
+
+# Moving HTML roots
+mv html/* . && \
+mv html/.htaccess . && \
+rm -Rf html && \
+
+# Tagging Distrib
+cat Core/Distrib.php | sed -e "s/\"regular\"/\"flat\"/g" > Core/Distrib2.php && \
+rm -f Core/Distrib.php && \
+mv Core/Distrib2.php Core/Distrib.php && \
+
+# Deploy empty DB
+mkdir -p Specific/db && \
+cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
+
+# Add ENABLE_INSTALL
+
+touch Specific/ENABLE_INSTALL && \
+
+# Zipping package
+cd .. && \
+mv $TEMPDIR baikal-flat && \
+zip -r baikal-flat.zip baikal-flat && \
+mv baikal-flat.zip ~/Desktop/ && \
+
+# Displaying result
+echo "# Success: ~/Desktop/baikal-flat.zip"
\ No newline at end of file
diff --git a/sources/Core/Frameworks/Baikal/Scripts/package-regular.sh b/sources/Core/Frameworks/Baikal/Scripts/package-regular.sh
new file mode 100755
index 0000000..36ac06b
--- /dev/null
+++ b/sources/Core/Frameworks/Baikal/Scripts/package-regular.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env sh
+TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`"
+TEMPDIR="/tmp/baikal-regular-$TEMPDATE"
+TEMPARCHIVE="$TEMPDIR/temparchive.tgz"
+
+echo "########################################################################"
+echo "#"
+echo "# Baïkal Packaging script"
+echo "#"
+echo "# Packaging project for regular distribution"
+echo "#"
+echo "# TEMPDIR: $TEMPDIR"
+
+rm -rf /tmp/baikal-regular
+
+# Export Project
+# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all)
+
+mkdir -p $TEMPDIR && \
+git-archive-all --force-submodules $TEMPARCHIVE && \
+cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \
+
+TEMPDIR=$TEMPDIR/temparchive && \
+
+# Jump to tempdir
+cd $TEMPDIR && \
+
+# Cleaning Scripts
+rm -Rf Core/Scripts && \
+rm -Rf Core/Frameworks/Baikal/Scripts && \
+
+# Deploy empty DB
+mkdir -p Specific/db && \
+cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \
+
+# Add ENABLE_INSTALL
+
+touch Specific/ENABLE_INSTALL && \
+
+# Installing dependencies (composer)
+composer install && \
+
+# Removing composer stuff
+rm -f composer.* && \
+
+# GZipping package
+cd .. && \
+mv $TEMPDIR baikal-regular && \
+tar -cvzf baikal-regular.tgz baikal-regular && \
+mv baikal-regular.tgz ~/Desktop/ && \
+
+# Displaying result
+echo "# Success: ~/Desktop/baikal-regular.tgz"
\ No newline at end of file
diff --git a/sources/cal.php b/sources/Core/Frameworks/Baikal/WWWRoot/cal.php
similarity index 81%
rename from sources/cal.php
rename to sources/Core/Frameworks/Baikal/WWWRoot/cal.php
index 145b2b3..ab5c7ce 100644
--- a/sources/cal.php
+++ b/sources/Core/Frameworks/Baikal/WWWRoot/cal.php
@@ -55,10 +55,20 @@ if(!defined("BAIKAL_CAL_ENABLED") || BAIKAL_CAL_ENABLED !== TRUE) {
}
# Backends
-if( BAIKAL_DAV_AUTH_TYPE == "Basic" || preg_match('/Windows-Phone-WebDAV-Client/i', $_SERVER['HTTP_USER_AGENT']) )
- $authBackend = new \Baikal\Core\PDOBasicAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
-else
+if( BAIKAL_DAV_AUTH_TYPE == "Digest" && !preg_match('/Windows-Phone-WebDAV-Client/i', $_SERVER['HTTP_USER_AGENT']))
$authBackend = new \Sabre\DAV\Auth\Backend\PDO($GLOBALS["DB"]->getPDO());
+else {
+ switch (strtoupper(BAIKAL_DAV_AUTH_TYPE)) {
+ case "MAIL":
+ $authBackend = new \Baikal\Core\MailAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ break;
+ case "LDAP-USERBIND":
+ $authBackend = new \Baikal\Core\LDAPUserBindAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ break;
+ default:
+ $authBackend = new \Baikal\Core\PDOBasicAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ }
+}
$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($GLOBALS["DB"]->getPDO());
$calendarBackend = new \Sabre\CalDAV\Backend\PDO($GLOBALS["DB"]->getPDO());
diff --git a/sources/card.php b/sources/Core/Frameworks/Baikal/WWWRoot/card.php
similarity index 81%
rename from sources/card.php
rename to sources/Core/Frameworks/Baikal/WWWRoot/card.php
index d5e887d..ba5b7b3 100644
--- a/sources/card.php
+++ b/sources/Core/Frameworks/Baikal/WWWRoot/card.php
@@ -52,10 +52,20 @@ if(!defined("BAIKAL_CARD_ENABLED") || BAIKAL_CARD_ENABLED !== TRUE) {
}
# Backends
-if( BAIKAL_DAV_AUTH_TYPE == "Basic" || preg_match('/Windows-Phone-WebDAV-Client/i', $_SERVER['HTTP_USER_AGENT']) )
- $authBackend = new \Baikal\Core\PDOBasicAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
-else
+if( BAIKAL_DAV_AUTH_TYPE == "Digest" && !preg_match('/Windows-Phone-WebDAV-Client/i', $_SERVER['HTTP_USER_AGENT']))
$authBackend = new \Sabre\DAV\Auth\Backend\PDO($GLOBALS["DB"]->getPDO());
+else {
+ switch (strtoupper(BAIKAL_DAV_AUTH_TYPE)) {
+ case "MAIL":
+ $authBackend = new \Baikal\Core\MailAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ break;
+ case "LDAP-USERBIND":
+ $authBackend = new \Baikal\Core\LDAPUserBindAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ break;
+ default:
+ $authBackend = new \Baikal\Core\PDOBasicAuth($GLOBALS["DB"]->getPDO(), BAIKAL_AUTH_REALM);
+ }
+}
$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($GLOBALS["DB"]->getPDO());
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($GLOBALS["DB"]->getPDO());
diff --git a/sources/index.php b/sources/Core/Frameworks/Baikal/WWWRoot/index.php
similarity index 100%
rename from sources/index.php
rename to sources/Core/Frameworks/Baikal/WWWRoot/index.php
diff --git a/sources/Core/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html b/sources/Core/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html
index 4761777..bfdfb34 100644
--- a/sources/Core/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html
+++ b/sources/Core/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html
@@ -48,6 +48,25 @@
trigger: 'focus',
placement: 'bottom'
});
+
+ function toggleStandardAuthParameter() {
+ $(".auth_ldap-userbind").hide();
+ $(".auth_mail").hide();
+ var type = ".auth_" + $("#BAIKAL_DAV_AUTH_TYPE").val().toLowerCase();
+ $(type).show();
+ toggleStandardAuthMailSSL();
+ }
+ function toggleStandardAuthMailSSL() {
+ var val = $("#BAIKAL_DAV_MAIL_PROTOCOL").val();
+ if ( val == "pop3" || val == "imap" || val == "smtp" ) {
+ $(".auth_mail_ssl").hide();
+ } else {
+ $(".auth_mail_ssl").show();
+ }
+ }
+ $("#BAIKAL_DAV_AUTH_TYPE").change(function() {toggleStandardAuthParameter();});
+ $("#BAIKAL_DAV_MAIL_PROTOCOL").change(function() {toggleStandardAuthMailSSL();});
+ toggleStandardAuthParameter();
{{ javascript }}