├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── feature_request.yml │ └── upgrading.yml └── workflows │ └── ci.yml ├── .gitignore ├── .php-cs-fixer.dist.php ├── Core ├── Distrib.php ├── Frameworks │ ├── Baikal │ │ ├── Controller │ │ │ ├── Main.php │ │ │ └── Navigation │ │ │ │ └── Topbar │ │ │ │ └── Anonymous.php │ │ ├── Core │ │ │ ├── PDOBasicAuth.php │ │ │ ├── Server.php │ │ │ ├── Tools.php │ │ │ └── View.php │ │ ├── Framework.php │ │ ├── Model │ │ │ ├── AddressBook.php │ │ │ ├── AddressBook │ │ │ │ └── Contact.php │ │ │ ├── Calendar.php │ │ │ ├── Calendar │ │ │ │ ├── Calendar.php │ │ │ │ └── Event.php │ │ │ ├── Config.php │ │ │ ├── Config │ │ │ │ ├── Database.php │ │ │ │ └── Standard.php │ │ │ ├── Principal.php │ │ │ └── User.php │ │ ├── Resources │ │ │ ├── Images │ │ │ │ └── logo-baikal.png │ │ │ └── Templates │ │ │ │ ├── Main.html │ │ │ │ ├── Navigation │ │ │ │ └── Topbar │ │ │ │ │ └── Anonymous.html │ │ │ │ └── Page │ │ │ │ └── index.html │ │ ├── View │ │ │ ├── Main.php │ │ │ └── Navigation │ │ │ │ └── Topbar │ │ │ │ └── Anonymous.php │ │ └── WWWRoot │ │ │ └── index.php │ ├── BaikalAdmin │ │ ├── Controller │ │ │ ├── Dashboard.php │ │ │ ├── Install │ │ │ │ ├── Database.php │ │ │ │ ├── Initialize.php │ │ │ │ ├── UpgradeConfirmation.php │ │ │ │ └── VersionUpgrade.php │ │ │ ├── Login.php │ │ │ ├── Logout.php │ │ │ ├── Navigation │ │ │ │ ├── Topbar.php │ │ │ │ └── Topbar │ │ │ │ │ ├── Anonymous.php │ │ │ │ │ └── Install.php │ │ │ ├── Settings │ │ │ │ ├── Database.php │ │ │ │ └── Standard.php │ │ │ ├── User │ │ │ │ ├── AddressBooks.php │ │ │ │ └── Calendars.php │ │ │ └── Users.php │ │ ├── Core │ │ │ ├── Auth.php │ │ │ └── View.php │ │ ├── Framework.php │ │ ├── Resources │ │ │ ├── GlyphiconsPro │ │ │ │ ├── generate-sprite.php │ │ │ │ ├── glyph-dark.png │ │ │ │ ├── glyph2x-dark.png │ │ │ │ ├── glyphpro-2x.css │ │ │ │ ├── glyphpro.css │ │ │ │ └── test-glyphpro2x.html │ │ │ ├── Images │ │ │ │ └── logo-framboise.png │ │ │ ├── Strings │ │ │ │ └── EN │ │ │ │ │ └── Exceptions.json │ │ │ ├── Templates │ │ │ │ ├── Dashboard.html │ │ │ │ ├── Install │ │ │ │ │ ├── Database.html │ │ │ │ │ ├── Initialize.html │ │ │ │ │ └── UpgradeConfirmation.html │ │ │ │ ├── Login.html │ │ │ │ ├── Navigation │ │ │ │ │ ├── Topbar.html │ │ │ │ │ └── Topbar │ │ │ │ │ │ ├── Anonymous.html │ │ │ │ │ │ └── Install.html │ │ │ │ ├── Page │ │ │ │ │ ├── baikal-text-20.png │ │ │ │ │ ├── index.html │ │ │ │ │ └── style.css │ │ │ │ ├── Settings │ │ │ │ │ ├── Database.html │ │ │ │ │ └── Standard.html │ │ │ │ ├── User │ │ │ │ │ ├── AddressBooks.html │ │ │ │ │ └── Calendars.html │ │ │ │ └── Users.html │ │ │ └── main.js │ │ ├── Route │ │ │ ├── Dashboard.php │ │ │ ├── Logout.php │ │ │ ├── Settings │ │ │ │ ├── Database.php │ │ │ │ └── Standard.php │ │ │ ├── User │ │ │ │ ├── AddressBooks.php │ │ │ │ └── Calendars.php │ │ │ └── Users.php │ │ ├── View │ │ │ ├── Dashboard.php │ │ │ ├── Install │ │ │ │ ├── Database.php │ │ │ │ ├── Initialize.php │ │ │ │ └── UpgradeConfirmation.php │ │ │ ├── Login.php │ │ │ ├── Navigation │ │ │ │ ├── Topbar.php │ │ │ │ └── Topbar │ │ │ │ │ ├── Anonymous.php │ │ │ │ │ └── Install.php │ │ │ ├── Settings │ │ │ │ ├── Database.php │ │ │ │ └── Standard.php │ │ │ ├── User │ │ │ │ ├── AddressBooks.php │ │ │ │ └── Calendars.php │ │ │ └── Users.php │ │ ├── WWWRoot │ │ │ ├── index.php │ │ │ └── install │ │ │ │ └── index.php │ │ └── config.php │ ├── Flake │ │ ├── Controller │ │ │ ├── Cli.php │ │ │ ├── HtmlBlock.php │ │ │ ├── HtmlBlockTemplated.php │ │ │ ├── Page.php │ │ │ └── Rpc.php │ │ ├── Core │ │ │ ├── Collection.php │ │ │ ├── CollectionTyped.php │ │ │ ├── Controller.php │ │ │ ├── DOM │ │ │ │ └── HTMLElement.php │ │ │ ├── Database.php │ │ │ ├── Database │ │ │ │ ├── Mysql.php │ │ │ │ ├── Pgsql.php │ │ │ │ ├── Sqlite.php │ │ │ │ └── Statement.php │ │ │ ├── Datastructure │ │ │ │ ├── Chain.php │ │ │ │ ├── ChainLink.php │ │ │ │ └── Chainable.php │ │ │ ├── FLObject.php │ │ │ ├── Framework.php │ │ │ ├── Model.php │ │ │ ├── Model │ │ │ │ ├── Db.php │ │ │ │ └── NoDb.php │ │ │ ├── PostConnectionService.php │ │ │ ├── Render │ │ │ │ ├── Container.php │ │ │ │ └── Zone.php │ │ │ ├── Requester.php │ │ │ ├── Requester │ │ │ │ └── Sql.php │ │ │ ├── Route.php │ │ │ ├── Template.php │ │ │ └── View.php │ │ ├── Framework.php │ │ ├── Model │ │ │ ├── IUser.php │ │ │ └── User │ │ │ │ ├── Admin.php │ │ │ │ └── Customer.php │ │ ├── Util │ │ │ ├── Frameworks.php │ │ │ ├── Profiler.php │ │ │ ├── Router.php │ │ │ ├── Router │ │ │ │ └── QuestionMarkRewrite.php │ │ │ └── Tools.php │ │ └── config.php │ ├── Formal │ │ ├── Core │ │ │ └── Message.php │ │ ├── Element.php │ │ ├── Element │ │ │ ├── Checkbox.php │ │ │ ├── Listbox.php │ │ │ ├── Password.php │ │ │ └── Text.php │ │ ├── Form.php │ │ ├── Form │ │ │ └── Morphology.php │ │ └── Framework.php │ └── TwitterBootstrap │ │ ├── css │ │ ├── bootstrap-responsive.css │ │ ├── bootstrap-responsive.min.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── img │ │ ├── glyphicons-halflings-white.png │ │ └── glyphicons-halflings.png │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-3.1.0.min.js │ │ └── jquery.color-2.2.0.min.js └── Resources │ ├── Db │ ├── MySQL │ │ └── db.sql │ ├── PgSQL │ │ └── db.sql │ └── SQLite │ │ └── db.sql │ ├── System │ ├── htaccess-deny-all │ └── htaccess-documentroot │ └── Web │ ├── Baikal │ ├── BaikalAdmin │ ├── README.md │ └── TwitterBootstrap ├── LICENSE ├── Makefile ├── README.md ├── SECURITY.md ├── Specific ├── .htaccess └── db │ └── .gitignore ├── composer.json ├── config └── baikal.yaml.dist ├── html ├── .htaccess ├── admin │ ├── index.php │ └── install │ │ └── index.php ├── cal.php ├── card.php ├── dav.php ├── index.php ├── res │ └── core └── robots.txt └── phpstan.neon /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Create a report to help us improve existing features 3 | body: 4 | - type: checkboxes 5 | id: checklist 6 | attributes: 7 | label: Checklist 8 | options: 9 | - label: I have used the search function for [**OPEN**](https://github.com/sabre-io/Baikal/issues) issues to see if someone else has already submitted the same bug report. 10 | required: true 11 | - label: I have **also** used the search function for [**CLOSED**](https://github.com/sabre-io/Baikal/issues?q=is%3Aissue+is%3Aclosed) issues to see if the problem is already solved and just waiting to be released. 12 | required: true 13 | - label: I will describe the problem with as much detail as possible. 14 | required: true 15 | - label: This is not about the docker image. In that case, contact the authors of the docker image. 16 | required: true 17 | - type: input 18 | id: version 19 | attributes: 20 | label: Baikal version 21 | placeholder: x.y.z 22 | validations: 23 | required: true 24 | - type: input 25 | id: php_version 26 | attributes: 27 | label: PHP version 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: steps 32 | attributes: 33 | label: Steps to reproduce 34 | description: Give a step-by-step instruction what you have to do before the bug occurrs. 35 | - type: textarea 36 | id: expected 37 | attributes: 38 | label: Expected behaviour 39 | description: After following the steps, what did you think Baikal would do? 40 | - type: textarea 41 | id: current 42 | attributes: 43 | label: Current behaviour 44 | description: What did Baikal do instead? 45 | - type: textarea 46 | id: logs 47 | attributes: 48 | label: Logs 49 | description: Especially in case of a blank page or other larger problems, enable logs on your server and post the error message. 50 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Docker 4 | url: https://github.com/ckulka/baikal-docker/ 5 | about: Having problems with a Docker installation? Contact the authors of the docker image. 6 | - name: Installation Instructions 7 | url: https://sabre.io/baikal/install/ 8 | about: Please review the instructions before asking for help with your new installation. 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Request a new feature 3 | body: 4 | - type: checkboxes 5 | id: checklist 6 | attributes: 7 | label: Checklist 8 | options: 9 | - label: I have used the search function for [**OPEN**](https://github.com/sabre-io/Baikal/issues) issues to see if someone else has already submitted the same feature request. 10 | required: true 11 | - label: I have **also** used the search function for [**CLOSED**](https://github.com/sabre-io/Baikal/issues?q=is%3Aissue+is%3Aclosed) issues to see if the feature is already implemented and just waiting to be released. 12 | required: true 13 | - label: I will describe the problem with as much detail as possible. 14 | required: true 15 | - label: This is not about the docker image. In that case, contact the authors of the docker image. 16 | required: true 17 | - type: input 18 | id: version 19 | attributes: 20 | label: Baikal version 21 | placeholder: x.y.z 22 | validations: 23 | required: true 24 | - type: input 25 | id: php_version 26 | attributes: 27 | label: PHP version 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: steps 32 | attributes: 33 | label: Problem you are having 34 | - type: textarea 35 | id: expected 36 | attributes: 37 | label: Suggested solution 38 | description: Try do be as specific as possible. Please not only explain what the feature does, but also how. When your request is about changing or extending the UI, describe what the UI would look like and how the user would interact with it. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/upgrading.yml: -------------------------------------------------------------------------------- 1 | name: Upgrading 2 | description: When having trouble upgrading Baikal 3 | body: 4 | - type: checkboxes 5 | id: checklist 6 | attributes: 7 | label: Checklist 8 | options: 9 | - label: I have used the search function for [**OPEN**](https://github.com/sabre-io/Baikal/issues) issues to see if someone else has already submitted the same feature request. 10 | required: true 11 | - label: I have **also** used the search function for [**CLOSED**](https://github.com/sabre-io/Baikal/issues?q=is%3Aissue+is%3Aclosed) issues to see if the feature is already implemented and just waiting to be released. 12 | required: true 13 | - label: I will describe the problem with as much detail as possible. 14 | required: true 15 | - label: This is not about the docker image. In that case, contact the authors of the docker image. 16 | required: true 17 | - type: checkboxes 18 | id: checklist_upgrading 19 | attributes: 20 | label: Common problems checklist 21 | options: 22 | - label: I have installed the release zip, not the source code zip 23 | required: true 24 | - label: I have moved the whole, untouched `Specific` and `config` folders to the new installation 25 | required: true 26 | - type: input 27 | id: version 28 | attributes: 29 | label: Baikal version before 30 | placeholder: x.y.z 31 | validations: 32 | required: true 33 | - type: input 34 | id: version_after 35 | attributes: 36 | label: Baikal version after 37 | placeholder: x.y.z 38 | validations: 39 | required: true 40 | - type: input 41 | id: php_version 42 | attributes: 43 | label: PHP version 44 | validations: 45 | required: true 46 | - type: textarea 47 | id: problems 48 | attributes: 49 | label: Problem you are having 50 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: continuous-integration 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - release/* 7 | pull_request: 8 | jobs: 9 | code-analysis: 10 | name: Code Analysis (PHP ${{ matrix.php-versions }}) 11 | runs-on: ubuntu-latest 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | php-versions: ['8.1', '8.2', '8.3'] 16 | cs-fixer: [ true ] 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | 21 | - name: Setup PHP, with composer and extensions 22 | uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php 23 | with: 24 | php-version: ${{ matrix.php-versions }} 25 | extensions: mbstring, dom, fileinfo, mysql, redis, opcache 26 | coverage: ${{ matrix.coverage }} 27 | tools: composer 28 | 29 | - name: Get composer cache directory 30 | id: composer-cache 31 | run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 32 | 33 | - name: Cache composer dependencies 34 | uses: actions/cache@v4 35 | with: 36 | path: ${{ steps.composer-cache.outputs.dir }} 37 | # Use composer.json for key, if composer.lock is not committed. 38 | # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} 39 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 40 | restore-keys: ${{ runner.os }}-composer- 41 | 42 | - name: Remove php-cs-fixer dependency when not used 43 | if: matrix.cs-fixer == false 44 | run: composer remove --dev friendsofphp/php-cs-fixer 45 | 46 | - name: Install composer dependencies 47 | run: composer install --no-progress --prefer-dist --optimize-autoloader 48 | 49 | - name: Code Analysis (PHP CS-Fixer) 50 | if: matrix.cs-fixer == true 51 | run: php vendor/bin/php-cs-fixer fix --dry-run --diff 52 | 53 | - name: Code Analysis (PHPStan) 54 | run: composer phpstan 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # logs 2 | logs 3 | 4 | # Specific 5 | config/baikal.yaml 6 | config/.htaccess 7 | Specific/INSTALL_DISABLED 8 | 9 | # Composer stuff 10 | composer.lock 11 | vendor 12 | 13 | # Build 14 | /build 15 | 16 | # Vim 17 | .*.swp 18 | 19 | # Others 20 | .DS_Store 21 | 22 | # IDE 23 | nbproject 24 | 25 | # Tests 26 | .php-cs-fixer.cache 27 | .php_cs.cache 28 | -------------------------------------------------------------------------------- /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | getFinder() 5 | ->exclude('vendor') 6 | ->in(__DIR__); 7 | $config->setRules([ 8 | '@PSR2' => true, 9 | '@Symfony' => true, 10 | 'binary_operator_spaces' => [ 11 | 'default' => 'at_least_single_space', 12 | ], 13 | 'braces_position' => [ 14 | 'functions_opening_brace' => 'same_line', 15 | 'classes_opening_brace' => 'same_line'], 16 | 'concat_space' => ['spacing' => 'one'], 17 | 'fully_qualified_strict_types' => false, 18 | 'no_superfluous_phpdoc_tags' => false, 19 | 'no_unneeded_control_parentheses' => false, 20 | 'phpdoc_align' => false, 21 | 'single_line_comment_style' => false, 22 | 'single_line_comment_spacing' => false, 23 | 'single_quote' => false, 24 | 'trailing_comma_in_multiline' => true, 25 | 'visibility_required' => false, 26 | 'yoda_style' => false 27 | ]); 28 | 29 | return $config; 30 | -------------------------------------------------------------------------------- /Core/Distrib.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | define("BAIKAL_VERSION", "0.10.1"); 29 | define("BAIKAL_HOMEPAGE", "https://sabre.io/baikal/"); 30 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Controller/Main.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Controller; 29 | 30 | class Main extends \Flake\Core\Controller { 31 | function execute() { 32 | } 33 | 34 | function render() { 35 | $oView = new \Baikal\View\Main(); 36 | 37 | return $oView->render(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Controller/Navigation/Topbar/Anonymous.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Controller\Navigation\Topbar; 29 | 30 | class Anonymous extends \Flake\Core\Controller { 31 | function execute() { 32 | } 33 | 34 | function render() { 35 | $oView = new \Baikal\View\Navigation\Topbar\Anonymous(); 36 | 37 | return $oView->render(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Core/PDOBasicAuth.php: -------------------------------------------------------------------------------- 1 | 12 | * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License 13 | */ 14 | class PDOBasicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic { 15 | /** 16 | * Reference to PDO connection. 17 | * 18 | * @var PDO 19 | */ 20 | protected $pdo; 21 | 22 | /** 23 | * PDO table name we'll be using. 24 | * 25 | * @var string 26 | */ 27 | protected $tableName; 28 | 29 | /** 30 | * Authentication realm. 31 | * 32 | * @var string 33 | */ 34 | protected $authRealm; 35 | 36 | /** 37 | * @var string 38 | */ 39 | private $currentUser; 40 | 41 | /** 42 | * Creates the backend object. 43 | * 44 | * If the filename argument is passed in, it will parse out the specified file fist. 45 | * 46 | * @param PDO $pdo 47 | * @param string $tableName The PDO table name to use 48 | */ 49 | function __construct(\PDO $pdo, $authRealm, $tableName = 'users') { 50 | $this->pdo = $pdo; 51 | $this->tableName = $tableName; 52 | $this->authRealm = $authRealm; 53 | } 54 | 55 | /** 56 | * Validates a username and password. 57 | * 58 | * This method should return true or false depending on if login 59 | * succeeded. 60 | * 61 | * @param string $username 62 | * @param string $password 63 | * 64 | * @return bool 65 | */ 66 | function validateUserPass($username, $password) { 67 | $stmt = $this->pdo->prepare('SELECT username, digesta1 FROM ' . $this->tableName . ' WHERE username = ?'); 68 | $stmt->execute([$username]); 69 | $result = $stmt->fetchAll(); 70 | 71 | if (!count($result)) { 72 | return false; 73 | } 74 | 75 | $hash = md5($username . ':' . $this->authRealm . ':' . $password); 76 | if ($result[0]['digesta1'] === $hash) { 77 | $this->currentUser = $username; 78 | 79 | return true; 80 | } 81 | 82 | return false; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Core/View.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://baikal-server.com 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Core; 29 | 30 | class View extends \Flake\Core\View { 31 | function templatesPath() { 32 | $sViewName = get_class($this); 33 | $sTemplate = str_replace("\\", "/", substr($sViewName, strlen("Baikal\\View\\"))) . ".html"; 34 | 35 | return PROJECT_PATH_ROOT . "Core/Resources/Web/Baikal/Templates/" . $sTemplate; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Framework.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | class Framework extends \Flake\Core\Framework { 33 | static function installTool() { 34 | if (defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === true) { 35 | # Install tool has been launched and we're already on the install page 36 | return; 37 | } else { 38 | # Install tool has been launched; redirecting user 39 | $sInstallToolUrl = PROJECT_URI . "admin/install/"; 40 | header("Location: " . $sInstallToolUrl); 41 | exit(0); 42 | } 43 | } 44 | 45 | static function bootstrap() { 46 | # Registering Baikal classloader 47 | define("BAIKAL_PATH_FRAMEWORKROOT", dirname(__FILE__) . "/"); 48 | 49 | \Baikal\Core\Tools::assertEnvironmentIsOk(); 50 | \Baikal\Core\Tools::configureEnvironment(); 51 | 52 | # Check that a config file exists 53 | if (!file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) { 54 | self::installTool(); 55 | } else { 56 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 57 | date_default_timezone_set($config['system']['timezone']); 58 | 59 | # Check that Baïkal is already configured 60 | if (!isset($config['system']['configured_version'])) { 61 | self::installTool(); 62 | } else { 63 | # Check that running version matches configured version 64 | if (version_compare(BAIKAL_VERSION, $config['system']['configured_version']) > 0) { 65 | self::installTool(); 66 | } else { 67 | # Check that admin password is set 68 | if (!$config['system']['admin_passwordhash']) { 69 | self::installTool(); 70 | } 71 | 72 | \Baikal\Core\Tools::assertBaikalIsOk(); 73 | 74 | set_error_handler("\Baikal\Framework::exception_error_handler"); 75 | } 76 | } 77 | } 78 | } 79 | 80 | # Mapping PHP errors to exceptions; needed by SabreDAV 81 | static function exception_error_handler($errno, $errstr, $errfile, $errline) { 82 | throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/AddressBook.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model; 29 | 30 | class AddressBook extends \Flake\Core\Model\Db { 31 | const DATATABLE = "addressbooks"; 32 | const PRIMARYKEY = "id"; 33 | const LABELFIELD = "displayname"; 34 | 35 | protected $aData = [ 36 | "principaluri" => "", 37 | "displayname" => "", 38 | "uri" => "", 39 | "description" => "", 40 | ]; 41 | 42 | static function humanName() { 43 | return "Address Book"; 44 | } 45 | 46 | static function icon() { 47 | return "icon-book"; 48 | } 49 | 50 | static function mediumicon() { 51 | return "glyph-adress-book"; 52 | } 53 | 54 | static function bigicon() { 55 | return "glyph2x-adress-book"; 56 | } 57 | 58 | function getContactsBaseRequester() { 59 | $oBaseRequester = \Baikal\Model\AddressBook\Contact::getBaseRequester(); 60 | $oBaseRequester->addClauseEquals( 61 | "addressbookid", 62 | $this->get("id") 63 | ); 64 | 65 | return $oBaseRequester; 66 | } 67 | 68 | function formMorphologyForThisModelInstance() { 69 | $oMorpho = new \Formal\Form\Morphology(); 70 | 71 | $oMorpho->add(new \Formal\Element\Text([ 72 | "prop" => "uri", 73 | "label" => "Address Book token ID", 74 | "validation" => "required,tokenid", 75 | "popover" => [ 76 | "title" => "Address Book token ID", 77 | "content" => "The unique identifier for this address book.", 78 | ], 79 | ])); 80 | 81 | $oMorpho->add(new \Formal\Element\Text([ 82 | "prop" => "displayname", 83 | "label" => "Display name", 84 | "validation" => "required", 85 | "popover" => [ 86 | "title" => "Display name", 87 | "content" => "This is the name that will be displayed in your CardDAV client.", 88 | ], 89 | ])); 90 | 91 | $oMorpho->add(new \Formal\Element\Text([ 92 | "prop" => "description", 93 | "label" => "Description", 94 | ])); 95 | 96 | if ($this->floating()) { 97 | $oMorpho->element("uri")->setOption( 98 | "help", 99 | "Allowed characters are digits, lowercase letters and the dash symbol '-'." 100 | ); 101 | } else { 102 | $oMorpho->element("uri")->setOption("readonly", true); 103 | } 104 | 105 | return $oMorpho; 106 | } 107 | 108 | function destroy() { 109 | $oContacts = $this->getContactsBaseRequester()->execute(); 110 | foreach ($oContacts as $contact) { 111 | $contact->destroy(); 112 | } 113 | 114 | parent::destroy(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/AddressBook/Contact.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model\AddressBook; 29 | 30 | class Contact extends \Flake\Core\Model\Db { 31 | const DATATABLE = "cards"; 32 | const PRIMARYKEY = "id"; 33 | const LABELFIELD = "uri"; 34 | 35 | protected $aData = [ 36 | "carddata" => "", 37 | "uri" => "", 38 | "addressbookid" => "", 39 | "lastmodified" => "", 40 | ]; 41 | } 42 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/Calendar/Calendar.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model\Calendar; 29 | 30 | class Calendar extends \Flake\Core\Model\Db { 31 | const DATATABLE = "calendars"; 32 | const PRIMARYKEY = "id"; 33 | const LABELFIELD = "components"; 34 | 35 | protected $aData = [ 36 | "components" => "", 37 | ]; 38 | 39 | function hasInstances() { 40 | $rSql = $GLOBALS["DB"]->exec_SELECTquery( 41 | "count(*) as count", 42 | "calendarinstances", 43 | "calendarid='" . $this->aData["id"] . "'" 44 | ); 45 | 46 | if (($aRs = $rSql->fetch()) === false) { 47 | return false; 48 | } else { 49 | reset($aRs); 50 | 51 | return $aRs["count"] > 1; 52 | } 53 | } 54 | 55 | function destroy() { 56 | if ($this->hasInstances()) { 57 | throw new \Exception("Trying to destroy a calendar with instances"); 58 | } 59 | parent::destroy(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/Calendar/Event.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model\Calendar; 29 | 30 | class Event extends \Flake\Core\Model\Db { 31 | const DATATABLE = "calendarobjects"; 32 | const PRIMARYKEY = "id"; 33 | const LABELFIELD = "uri"; 34 | 35 | protected $aData = [ 36 | "calendardata" => "", 37 | "uri" => "", 38 | "calendarid" => "", 39 | "lastmodified" => "", 40 | ]; 41 | } 42 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/Config.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | abstract class Config extends \Flake\Core\Model\NoDb { 33 | protected $sConfigFileSection = ""; 34 | protected $aData = []; 35 | 36 | function __construct($sConfigFileSection) { 37 | # Note: no call to parent::__construct() to avoid erasing $this->aData 38 | $this->sConfigFileSection = $sConfigFileSection; 39 | 40 | try { 41 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 42 | if (isset($config[$sConfigFileSection])) { 43 | $aConfig = $config[$sConfigFileSection]; 44 | } else { 45 | error_log('Section ' . $sConfigFileSection 46 | . ' not found in config file. Using default values.'); 47 | $aConfig = []; 48 | } 49 | 50 | foreach (array_keys($this->aData) as $sProp) { 51 | if (array_key_exists($sProp, $aConfig)) { 52 | $this->aData[$sProp] = $aConfig[$sProp]; 53 | } 54 | } 55 | } catch (\Exception $e) { 56 | error_log('Error reading baikal.yaml file : ' . $e->getMessage()); 57 | // Keep default values in $aData 58 | } 59 | } 60 | 61 | protected function getConfigAsString() { 62 | if (file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) { 63 | return Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml")[$this->sConfigFileSection]; 64 | } else { 65 | return $this->aData; 66 | } 67 | } 68 | 69 | function writable() { 70 | return ( 71 | @file_exists(PROJECT_PATH_CONFIG . "baikal.yaml") 72 | && @is_file(PROJECT_PATH_CONFIG . "baikal.yaml") 73 | && @is_writable(PROJECT_PATH_CONFIG . "baikal.yaml") 74 | ); 75 | } 76 | 77 | static function icon() { 78 | return "icon-cog"; 79 | } 80 | 81 | static function mediumicon() { 82 | return "glyph-cogwheel"; 83 | } 84 | 85 | static function bigicon() { 86 | return "glyph2x-cogwheel"; 87 | } 88 | 89 | function floating() { 90 | return false; 91 | } 92 | 93 | function persist() { 94 | if (file_exists(PROJECT_PATH_CONFIG . "baikal.yaml")) { 95 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 96 | } else { 97 | $config = []; 98 | } 99 | $config[$this->sConfigFileSection] = $this->aData; 100 | $yaml = Yaml::dump($config); 101 | file_put_contents(PROJECT_PATH_CONFIG . "baikal.yaml", $yaml); 102 | } 103 | 104 | function destroy() { 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Model/Principal.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\Model; 29 | 30 | class Principal extends \Flake\Core\Model\Db { 31 | const DATATABLE = "principals"; 32 | const PRIMARYKEY = "id"; 33 | protected $aData = [ 34 | "uri" => "", 35 | "displayname" => "", 36 | "email" => "", 37 | ]; 38 | } 39 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Resources/Images/logo-baikal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/Baikal/Resources/Images/logo-baikal.png -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Resources/Templates/Main.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

baikal logo Baïkal 4 |

Lightweight CalDAV+CardDAV server.

5 |
6 | 7 | {{ message }} 8 | 9 |
10 | 13 |
14 | {% endautoescape %} 15 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Resources/Templates/Navigation/Topbar/Anonymous.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 | 20 | {% endautoescape %} 21 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/Resources/Templates/Page/index.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 | 3 | 4 | 5 | 6 | {{ pagetitle }} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | {{ head }} 18 | 19 | 20 | {{ navbar }} 21 | 22 |
23 | {{ Payload }} 24 |
25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | {{ javascript }} 34 | 35 | 36 | {% endautoescape %} 37 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/View/Main.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://baikal-server.com 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\View; 29 | 30 | class Main extends \Baikal\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/View/Navigation/Topbar/Anonymous.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://baikal-server.com 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Baikal\View\Navigation\Topbar; 29 | 30 | class Anonymous extends \Baikal\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/Baikal/WWWRoot/index.php: -------------------------------------------------------------------------------- 1 | 7 | * All rights reserved 8 | * 9 | * http://sabre.io/baikal 10 | * 11 | * This script is part of the Baïkal Server project. The Baïkal 12 | * Server project is free software; you can redistribute it 13 | * and/or modify it under the terms of the GNU General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2 of the License, or (at your option) any later version. 16 | * 17 | * The GNU General Public License can be found at 18 | * http://www.gnu.org/copyleft/gpl.html. 19 | * 20 | * This script is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * This copyright notice MUST APPEAR in all copies of the script! 26 | ***************************************************************/ 27 | 28 | ini_set("session.cookie_httponly", 1); 29 | ini_set("display_errors", 0); 30 | ini_set("log_errors", 1); 31 | 32 | define("BAIKAL_CONTEXT", true); 33 | define("PROJECT_CONTEXT_BASEURI", "/"); 34 | 35 | if (file_exists(getcwd() . "/Core")) { 36 | # Flat FTP mode 37 | define("PROJECT_PATH_ROOT", getcwd() . "/"); #./ 38 | } else { 39 | # Dedicated server mode 40 | define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ 41 | } 42 | 43 | if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { 44 | exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); 45 | } 46 | 47 | require PROJECT_PATH_ROOT . 'vendor/autoload.php'; 48 | 49 | # Bootstrapping Flake 50 | \Flake\Framework::bootstrap(); 51 | 52 | # Bootstrapping Baïkal 53 | \BaikalAdmin\Framework::bootstrap(); 54 | 55 | # Create and setup a page object 56 | $oPage = new \Flake\Controller\Page(PROJECT_PATH_ROOT . "Core/Resources/Web/Baikal/Templates/Page/index.html"); 57 | $oPage->injectHTTPHeaders(); 58 | $oPage->setTitle("Baïkal server"); 59 | $oPage->setBaseUrl(PROJECT_URI); 60 | 61 | # Draw page 62 | $oPage->zone("navbar")->addBlock(new \Baikal\Controller\Navigation\Topbar\Anonymous()); 63 | $oPage->zone("Payload")->addBlock(new \Baikal\Controller\Main()); 64 | 65 | # Render the page 66 | echo $oPage->render(); 67 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Dashboard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | class Dashboard extends \Flake\Core\Controller { 33 | function execute() { 34 | } 35 | 36 | function render() { 37 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 38 | 39 | $oView = new \BaikalAdmin\View\Dashboard(); 40 | $oView->setData("BAIKAL_VERSION", BAIKAL_VERSION); 41 | 42 | # Services status 43 | $oView->setData("cal_enabled", $config['system']['cal_enabled']); 44 | $oView->setData("card_enabled", $config['system']['card_enabled']); 45 | 46 | # Statistics: Users 47 | $iNbUsers = \Baikal\Model\User::getBaseRequester()->count(); 48 | $oView->setData("nbusers", $iNbUsers); 49 | 50 | # Statistics: CalDAV 51 | $iNbCalendars = \Baikal\Model\Calendar::getBaseRequester()->count(); 52 | $oView->setData("nbcalendars", $iNbCalendars); 53 | 54 | $iNbEvents = \Baikal\Model\Calendar\Event::getBaseRequester()->count(); 55 | $oView->setData("nbevents", $iNbEvents); 56 | 57 | # Statistics: CardDAV 58 | $iNbBooks = \Baikal\Model\AddressBook::getBaseRequester()->count(); 59 | $oView->setData("nbbooks", $iNbBooks); 60 | 61 | $iNbContacts = \Baikal\Model\AddressBook\Contact::getBaseRequester()->count(); 62 | $oView->setData("nbcontacts", $iNbContacts); 63 | 64 | return $oView->render(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Install/UpgradeConfirmation.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller\Install; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | class UpgradeConfirmation extends \Flake\Core\Controller { 33 | function execute() { 34 | } 35 | 36 | function render() { 37 | $oView = new \BaikalAdmin\View\Install\UpgradeConfirmation(); 38 | 39 | try { 40 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 41 | } catch (\Exception $e) { 42 | error_log('Error reading baikal.yaml file : ' . $e->getMessage()); 43 | } 44 | 45 | if (isset($config['system']['configured_version']) && $config['system']['configured_version'] === BAIKAL_VERSION) { 46 | $sMessage = "Your system is configured to use version " . $config['system']['configured_version'] . ".
There's no upgrade to be done."; 47 | } else { 48 | $oldVersion = "Unknown"; 49 | if (isset($config['system']['configured_version'])) { 50 | $oldVersion = $config['system']['configured_version']; 51 | } 52 | $sMessage = "Upgrading Baïkal from version $oldVersion to version " . BAIKAL_VERSION . ""; 53 | } 54 | 55 | $oView->setData("message", $sMessage); 56 | $oView->setData("projectUri", PROJECT_URI); 57 | 58 | return $oView->render(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Login.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | class Login extends \Flake\Core\Controller { 33 | function execute() { 34 | } 35 | 36 | function render() { 37 | $sActionUrl = $GLOBALS["ROUTER"]::buildRoute("default", []); 38 | $sSubmittedFlagName = "auth"; 39 | $sMessage = ""; 40 | 41 | $sLogin = htmlspecialchars(\Flake\Util\Tools::POST("login")); 42 | 43 | if (self::isSubmitted() && !\BaikalAdmin\Core\Auth::isAuthenticated()) { 44 | // Log failed accesses, for further processing by tools like Fail2Ban 45 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 46 | if (isset($config['system']["failed_access_message"]) && $config['system']["failed_access_message"] !== "") { 47 | $log_msg = str_replace("%u", $sLogin, $config['system']["failed_access_message"]); 48 | error_log($log_msg, 4); 49 | } 50 | $sMessage = \Formal\Core\Message::error( 51 | "The login/password you provided is invalid. Please retry.", 52 | "Authentication error" 53 | ); 54 | } elseif (self::justLoggedOut()) { 55 | $sMessage = \Formal\Core\Message::notice( 56 | "You have been disconnected from your session.", 57 | "Session ended", 58 | false 59 | ); 60 | } 61 | 62 | $sPassword = htmlspecialchars(\Flake\Util\Tools::POST("password")); 63 | 64 | if (trim($sLogin) === "") { 65 | $sLogin = "admin"; 66 | } 67 | 68 | $oView = new \BaikalAdmin\View\Login(); 69 | $oView->setData("message", $sMessage); 70 | $oView->setData("actionurl", $sActionUrl); 71 | $oView->setData("submittedflagname", $sSubmittedFlagName); 72 | $oView->setData("login", $sLogin); 73 | $oView->setData("password", $sPassword); 74 | 75 | return $oView->render(); 76 | } 77 | 78 | protected static function isSubmitted() { 79 | return (intval(\Flake\Util\Tools::POST("auth")) === 1); 80 | } 81 | 82 | protected static function justLoggedOut() { 83 | $aParams = $GLOBALS["ROUTER"]::getURLParams(); 84 | 85 | return (!empty($aParams) && $aParams[0] === "loggedout"); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Logout.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller; 29 | 30 | class Logout extends \Flake\Core\Controller { 31 | function execute() { 32 | \BaikalAdmin\Core\Auth::unAuthenticate(); 33 | 34 | $sControllerForDefaultRoute = $GLOBALS["ROUTER"]::getControllerForRoute("default"); 35 | $sLink = $GLOBALS["ROUTER"]::buildRouteForController($sControllerForDefaultRoute, "loggedout"); 36 | \Flake\Util\Tools::redirect($sLink); 37 | } 38 | 39 | function render() { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller\Navigation; 29 | 30 | class Topbar extends \Flake\Core\Controller { 31 | function execute() { 32 | } 33 | 34 | function render() { 35 | $oView = new \BaikalAdmin\View\Navigation\Topbar(); 36 | 37 | $sCurrentRoute = $GLOBALS["ROUTER"]::getCurrentRoute(); 38 | $sActiveHome = $sActiveUsers = $sActiveSettingsStandard = $sActiveSettingsDatabase = ""; 39 | 40 | $sControllerForDefaultRoute = $GLOBALS["ROUTER"]::getControllerForRoute("default"); 41 | $sHomeLink = $sControllerForDefaultRoute::link(); 42 | $sUsersLink = \BaikalAdmin\Controller\Users::link(); 43 | $sSettingsStandardLink = \BaikalAdmin\Controller\Settings\Standard::link(); 44 | $sSettingsDatabaseLink = \BaikalAdmin\Controller\Settings\Database::link(); 45 | $sLogoutLink = \BaikalAdmin\Controller\Logout::link(); 46 | 47 | if ($sCurrentRoute === "default") { 48 | $sActiveHome = "active"; 49 | } 50 | if ( 51 | $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Users") 52 | || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\Calendars") 53 | || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\AddressBooks") 54 | ) { 55 | $sActiveUsers = "active"; 56 | } 57 | 58 | if ($sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Settings\Standard")) { 59 | $sActiveSettingsStandard = "active"; 60 | } 61 | 62 | if ($sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Settings\Database")) { 63 | $sActiveSettingsDatabase = "active"; 64 | } 65 | 66 | $oView->setData("activehome", $sActiveHome); 67 | $oView->setData("activeusers", $sActiveUsers); 68 | $oView->setData("activesettingsstandard", $sActiveSettingsStandard); 69 | $oView->setData("activesettingsdatabase", $sActiveSettingsDatabase); 70 | $oView->setData("homelink", $sHomeLink); 71 | $oView->setData("userslink", $sUsersLink); 72 | $oView->setData("settingsstandardlink", $sSettingsStandardLink); 73 | $oView->setData("settingsdatabaselink", $sSettingsDatabaseLink); 74 | $oView->setData("logoutlink", $sLogoutLink); 75 | 76 | return $oView->render(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Anonymous.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller\Navigation\Topbar; 29 | 30 | class Anonymous extends \Flake\Core\Controller { 31 | function execute() { 32 | } 33 | 34 | function render() { 35 | $oView = new \BaikalAdmin\View\Navigation\Topbar\Anonymous(); 36 | 37 | return $oView->render(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller\Navigation\Topbar; 29 | 30 | class Install extends \Flake\Core\Controller { 31 | function execute() { 32 | } 33 | 34 | function render() { 35 | $oView = new \BaikalAdmin\View\Navigation\Topbar\Install(); 36 | 37 | return $oView->render(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Controller/Settings/Standard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Controller\Settings; 29 | 30 | class Standard extends \Flake\Core\Controller { 31 | /** 32 | * @var \Baikal\Model\Config\Standard 33 | */ 34 | private $oModel; 35 | 36 | /** 37 | * @var \Formal\Form 38 | */ 39 | private $oForm; 40 | 41 | function execute() { 42 | $this->oModel = new \Baikal\Model\Config\Standard(); 43 | 44 | # Assert that config file is writable 45 | if (!$this->oModel->writable()) { 46 | throw new \Exception("Config file is not writable;" . __FILE__ . " > " . __LINE__); 47 | } 48 | 49 | $this->oForm = $this->oModel->formForThisModelInstance([ 50 | "close" => false, 51 | ]); 52 | 53 | if ($this->oForm->submitted()) { 54 | $this->oForm->execute(); 55 | } 56 | } 57 | 58 | function render() { 59 | $oView = new \BaikalAdmin\View\Settings\Standard(); 60 | $oView->setData("form", $this->oForm->render()); 61 | 62 | return $oView->render(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Core/Auth.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Core; 29 | 30 | use Symfony\Component\Yaml\Yaml; 31 | 32 | class Auth { 33 | static function isAuthenticated() { 34 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 35 | 36 | if (isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5($config['system']['admin_passwordhash'])) { 37 | return true; 38 | } 39 | 40 | return false; 41 | } 42 | 43 | static function authenticate() { 44 | if (intval(\Flake\Util\Tools::POST("auth")) !== 1) { 45 | return false; 46 | } 47 | 48 | $sUser = \Flake\Util\Tools::POST("login"); 49 | $sPass = \Flake\Util\Tools::POST("password"); 50 | 51 | try { 52 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 53 | } catch (\Exception $e) { 54 | error_log('Error reading baikal.yaml file : ' . $e->getMessage()); 55 | 56 | return false; 57 | } 58 | $sPassHash = self::hashAdminPassword($sPass, $config['system']['auth_realm']); 59 | if ($sUser === "admin" && $sPassHash === $config['system']['admin_passwordhash']) { 60 | $_SESSION["baikaladminauth"] = md5($config['system']['admin_passwordhash']); 61 | 62 | return true; 63 | } 64 | 65 | return false; 66 | } 67 | 68 | static function unAuthenticate() { 69 | unset($_SESSION["baikaladminauth"]); 70 | } 71 | 72 | static function hashAdminPassword($sPassword, $sAuthRealm) { 73 | return hash('sha256', 'admin:' . $sAuthRealm . ':' . $sPassword); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Core/View.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Core; 29 | 30 | class View extends \Flake\Core\View { 31 | function templatesPath() { 32 | $sViewName = get_class($this); 33 | $sTemplate = str_replace("\\", "/", substr($sViewName, strlen("BaikalAdmin\\View\\"))) . ".html"; 34 | 35 | return BAIKALADMIN_PATH_TEMPLATES . $sTemplate; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Framework.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin; 29 | 30 | class Framework extends \Flake\Core\Framework { 31 | static function bootstrap() { 32 | define("BAIKALADMIN_PATH_ROOT", PROJECT_PATH_ROOT . "Core/Frameworks/BaikalAdmin/"); # ./ 33 | 34 | \Baikal\Framework::bootstrap(); 35 | \Formal\Framework::bootstrap(); 36 | 37 | $GLOBALS["ROUTER"]::setURIPath("admin/"); 38 | 39 | # Include BaikalAdmin Framework config 40 | require_once BAIKALADMIN_PATH_ROOT . "config.php"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph-dark.png -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph2x-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph2x-dark.png -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/test-glyphpro2x.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/test-glyphpro2x.html -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Images/logo-framboise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/BaikalAdmin/Resources/Images/logo-framboise.png -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Strings/EN/Exceptions.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Install/Database.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Baïkal Database setup

4 |

Configure Baïkal Database.

5 |
6 | 7 | 8 | {{ message }} 9 | {{ form }} 10 | 11 | {% endautoescape %} -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Install/Initialize.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Baïkal initialization wizard

4 |

Configure your new Baïkal {{ baikalversion }} installation.

5 | 6 | {% if oldConfigSystem %} 7 |
8 | With the 0.7.0 release, our configuration format was updated to use YAML files.
9 | You need to go through this installer again but we pre-filled most values with the ones from your old installation.
10 | As we updated our hashing algorithm for the admin interface password, you need to enter it again.
11 | The database with your contacts and events stays untouched. We still recommend that you make a full backup of your data before proceeding, as a safety measure. 12 |
13 | {% endif %} 14 |
15 | 16 | 17 | {{ message }} 18 | {{ form }} 19 | 20 | {% endautoescape %} -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Install/UpgradeConfirmation.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Baïkal upgrade wizard

4 |

{{ message }}

5 |
6 |

Please create a backup before upgrading.

7 |

Upgrading might take a few minutes depending on the number of events and contacts. Do not interrupt the upgrade!

8 |

 

9 |

10 |

11 | Start upgrade 12 |

13 | 19 | {% endautoescape %} 20 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Login.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Authentication

4 |

Please authenticate to access Baïkal Web Admin.

5 |
6 | 7 | {{ message }} 8 | 9 |
10 | 11 |
12 |

13 | 14 | 15 |

16 | 17 |

18 | 19 | 20 |

21 | 22 |
23 | 24 |
25 |
26 |
27 | {% endautoescape %} -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 | 23 | {% endautoescape %} 24 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Anonymous.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Install.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Page/baikal-text-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/BaikalAdmin/Resources/Templates/Page/baikal-text-20.png -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 | 3 | 4 | 5 | 6 | {{ pagetitle }} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | {{ head }} 18 | 19 | 20 | {{ navbar }} 21 | 22 |
23 | {{ Payload }} 24 |
25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | {{ javascript }} 34 | 35 | 36 | {% endautoescape %} 37 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Page/style.css: -------------------------------------------------------------------------------- 1 | /* generics */ 2 | 3 | body { 4 | padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */ 5 | } 6 | 7 | .table thead th { 8 | background-color: #777; 9 | color: white; 10 | } 11 | 12 | .table-striped tbody tr:nth-child(even) td, .table-striped tbody tr:nth-child(even) th { 13 | background-color: rgb(240, 240, 240); 14 | } 15 | 16 | table .no-border-left { border-left: none !important;} 17 | table p { 18 | margin-bottom: 0; 19 | } 20 | 21 | p.lead { line-height: 40px;} 22 | 23 | 24 | /* Jumbotrons 25 | -------------------------------------------------- */ 26 | .jumbotron { 27 | position: relative; 28 | } 29 | .jumbotron h1 { 30 | font-size: 40px; 31 | font-weight: bold; 32 | letter-spacing: -1px; 33 | line-height: 90px; 34 | } 35 | .jumbotron p { 36 | margin-bottom: 18px; 37 | font-weight: 300; 38 | } 39 | .jumbotron .btn-large { 40 | font-size: 20px; 41 | font-weight: normal; 42 | padding: 14px 24px; 43 | margin-right: 10px; 44 | -webkit-border-radius: 6px; 45 | -moz-border-radius: 6px; 46 | border-radius: 6px; 47 | } 48 | .jumbotron .btn-large small { 49 | font-size: 14px; 50 | } 51 | 52 | @media (max-width: 550px) { 53 | .jumbotron h1 { 54 | font-size: 20px; 55 | font-weight: bold; 56 | letter-spacing: -1px; 57 | line-height: 20px; 58 | } 59 | 60 | p.lead { 61 | font-size: 14px; 62 | line-height: 14px; 63 | } 64 | 65 | [class^="glyph2x-"], 66 | [class*=" glyph2x-"] { 67 | display: none; 68 | } 69 | } 70 | 71 | /* Address books */ 72 | table.addressbooks .col-displayname { width: 20%;} 73 | table.addressbooks .col-description { width: 40%;} 74 | table.addressbooks .col-actions { width: 40%;} 75 | 76 | /* Calendars */ 77 | table.calendars .col-displayname { width: 20%;} 78 | table.calendars .col-description { width: 40%;} 79 | table.calendars .col-actions { width: 40%;} 80 | 81 | /* Users */ 82 | table.users .col-id { width: 2%;} 83 | table.users .col-username { width: 45%;} 84 | 85 | /* Loader */ 86 | .loader { 87 | display: inline-block; 88 | width: 64px; 89 | height: 64px; 90 | } 91 | .loader:after { 92 | content: " "; 93 | display: block; 94 | width: 46px; 95 | height: 46px; 96 | margin: 1px; 97 | border-radius: 50%; 98 | border: 5px solid #000; 99 | border-color: #000 transparent #000 transparent; 100 | animation: lds-dual-ring 1.2s linear infinite; 101 | } 102 | @keyframes lds-dual-ring { 103 | 0% { 104 | transform: rotate(0deg); 105 | } 106 | 100% { 107 | transform: rotate(360deg); 108 | } 109 | } 110 | 111 | .popover { 112 | max-width: 100%; 113 | } 114 | 115 | .copy-to-clipboard { 116 | cursor: pointer; 117 | } 118 | 119 | .copy-to-clipboard i { 120 | margin-left: 5px; 121 | opacity: 1; 122 | } 123 | 124 | .copy-to-clipboard:hover i { 125 | opacity: 0.5; 126 | } 127 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Settings/Database.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Baïkal database settings

4 |
5 | 6 | {{ message }} 7 | {{ form }} 8 | 9 | {% endautoescape %} -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Settings/Standard.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Baïkal system settings

4 |
5 | 6 | {{ form }} 7 | {% endautoescape %} -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/User/AddressBooks.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Address Books

4 |

Manage Address Books for{{ modellabel }}.

5 |

Back to users list

6 |

+ Add address book

7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for addressbook in addressbooks %} 20 | 21 | 22 | 23 | 24 | 31 | 32 | {% endfor %} 33 | 34 |
Display nameContactsDescription
{{ addressbook.label|escape }}{{ addressbook.contacts|escape }}{{ addressbook.description|escape }} 25 |

26 | 27 | Edit 28 | Delete 29 |

30 |
35 | 36 | 37 | {{ messages }} 38 | {{ form }} 39 | {% endautoescape %} 40 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/User/Calendars.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Calendars

4 |

Manage Calendars for{{ modellabel }}.

5 |

Back to users list

6 |

+ Add calendar

7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {% for calendar in calendars %} 20 | 21 | 22 | 23 | 24 | 31 | 32 | {% endfor %} 33 | 34 |
Display nameEventsDescription
{{ calendar.label|escape }}{%if calendar.instanced%} Has instances{% endif %}{{ calendar.events|escape }}{{ calendar.description|escape }} 25 |

26 | 27 | Edit 28 | Delete 29 |

30 |
35 | 36 | 37 | {{ messages }} 38 | {{ form }} 39 | {% endautoescape %} 40 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/Templates/Users.html: -------------------------------------------------------------------------------- 1 | {% autoescape false %} 2 |
3 |

Users

4 |

Manage Baïkal user accounts, and associated resources.

5 |

+ Add user

6 |
7 | 8 | 9 | {% for user in users %} 10 | 11 | 15 | 24 | 25 | {% endfor %} 26 |
12 | {{ user.username|escape }}
13 | {{ user.displayname|escape }} <{{ user.email|escape }}> 14 |
16 |

17 | 18 | Calendars 19 | Address Books 20 | Edit 21 | Delete 22 |

23 |
27 | 28 | 29 | {{ messages }} 30 | {{ form }} 31 | {% endautoescape %} 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Resources/main.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $("[rel=tooltip]").tooltip(); 3 | $(".popover-hover").popover(); 4 | $(".popover-focus").popover({ 5 | trigger: 'focus' 6 | }); 7 | $(".popover-focus-top").popover({ 8 | trigger: 'focus', 9 | placement: 'top' 10 | }); 11 | $(".popover-focus-bottom").popover({ 12 | trigger: 'focus', 13 | placement: 'bottom' 14 | }); 15 | }); 16 | 17 | function copyToClipboard(el) { 18 | var range = document.createRange(); 19 | range.selectNodeContents(el); 20 | var sel = window.getSelection(); 21 | sel.removeAllRanges(); 22 | sel.addRange(range); 23 | document.execCommand("copy"); 24 | sel.removeAllRanges(); 25 | $(el).css({backgroundColor:"#75c753"}); 26 | $(el).animate({backgroundColor:"transparent"}, 1500); 27 | } 28 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/Dashboard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route; 29 | 30 | class Dashboard extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Dashboard()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/Logout.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route; 29 | 30 | class Logout extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Logout()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/Settings/Database.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route\Settings; 29 | 30 | class Database extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Settings\Database()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/Settings/Standard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route\Settings; 29 | 30 | class Standard extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Settings\Standard()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/User/AddressBooks.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route\User; 29 | 30 | class AddressBooks extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\User\AddressBooks( 33 | self::getParams() 34 | )); 35 | } 36 | 37 | static function parametersMap() { 38 | return [ 39 | "user" => [ 40 | "required" => true, 41 | ], 42 | "new" => [ 43 | "required" => false, 44 | ], 45 | "edit" => [ 46 | "required" => false, 47 | ], 48 | "delete" => [ 49 | "required" => false, 50 | ], 51 | "confirm" => [ 52 | "required" => false, 53 | ], 54 | ]; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/User/Calendars.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route\User; 29 | 30 | class Calendars extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $aParams = self::getParams(); 33 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\User\Calendars($aParams)); 34 | } 35 | 36 | static function parametersMap() { 37 | return [ 38 | "user" => [ 39 | "required" => true, 40 | ], 41 | "new" => [ 42 | "required" => false, 43 | ], 44 | "edit" => [ 45 | "required" => false, 46 | ], 47 | "delete" => [ 48 | "required" => false, 49 | ], 50 | "confirm" => [ 51 | "required" => false, 52 | ], 53 | ]; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/Route/Users.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\Route; 29 | 30 | class Users extends \Flake\Core\Route { 31 | static function layout(\Flake\Core\Render\Container &$oRenderContainer) { 32 | $aParams = self::getParams(); 33 | $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Users($aParams)); 34 | } 35 | 36 | static function parametersMap() { 37 | return [ 38 | "new" => [ 39 | "required" => false, 40 | ], 41 | "edit" => [ 42 | "required" => false, 43 | ], 44 | "delete" => [ 45 | "required" => false, 46 | ], 47 | "confirm" => [ 48 | "required" => false, 49 | ], 50 | ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Dashboard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View; 29 | 30 | class Dashboard extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Install/Database.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Install; 29 | 30 | class Database extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Install/Initialize.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Install; 29 | 30 | class Initialize extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Install/UpgradeConfirmation.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Install; 29 | 30 | class UpgradeConfirmation extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Login.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View; 29 | 30 | class Login extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Navigation/Topbar.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Navigation; 29 | 30 | class Topbar extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Navigation/Topbar/Anonymous.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Navigation\Topbar; 29 | 30 | class Anonymous extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Navigation/Topbar/Install.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Navigation\Topbar; 29 | 30 | class Install extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Settings/Database.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Settings; 29 | 30 | class Database extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Settings/Standard.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\Settings; 29 | 30 | class Standard extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/User/AddressBooks.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\User; 29 | 30 | class AddressBooks extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/User/Calendars.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View\User; 29 | 30 | class Calendars extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/View/Users.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace BaikalAdmin\View; 29 | 30 | class Users extends \BaikalAdmin\Core\View { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/WWWRoot/index.php: -------------------------------------------------------------------------------- 1 | 7 | * All rights reserved 8 | * 9 | * http://sabre.io/baikal 10 | * 11 | * This script is part of the Baïkal Server project. The Baïkal 12 | * Server project is free software; you can redistribute it 13 | * and/or modify it under the terms of the GNU General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2 of the License, or (at your option) any later version. 16 | * 17 | * The GNU General Public License can be found at 18 | * http://www.gnu.org/copyleft/gpl.html. 19 | * 20 | * This script is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * This copyright notice MUST APPEAR in all copies of the script! 26 | ***************************************************************/ 27 | 28 | ini_set("session.cookie_httponly", 1); 29 | ini_set("log_errors", 1); 30 | error_reporting(E_ALL); 31 | 32 | define("BAIKAL_CONTEXT", true); 33 | define("BAIKAL_CONTEXT_ADMIN", true); 34 | define("PROJECT_CONTEXT_BASEURI", "/admin/"); 35 | 36 | if (file_exists(dirname(getcwd()) . "/Core")) { 37 | # Flat FTP mode 38 | define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ 39 | } else { 40 | # Dedicated server mode 41 | define("PROJECT_PATH_ROOT", dirname(dirname(getcwd())) . "/"); #../../ 42 | } 43 | 44 | if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { 45 | exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); 46 | } 47 | 48 | require PROJECT_PATH_ROOT . 'vendor/autoload.php'; 49 | 50 | # Bootstrapping Flake 51 | \Flake\Framework::bootstrap(); 52 | 53 | # Bootstrap BaikalAdmin 54 | \BaikalAdmin\Framework::bootstrap(); 55 | 56 | # Create and setup a page object 57 | $oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html"); 58 | $oPage->injectHTTPHeaders(); 59 | 60 | $oPage->setTitle("Baïkal " . BAIKAL_VERSION . " Web Admin"); 61 | $oPage->setBaseUrl(PROJECT_URI); 62 | 63 | if (!\BaikalAdmin\Core\Auth::isAuthenticated()) { 64 | if (\BaikalAdmin\Core\Auth::authenticate()) { 65 | // Redirect to itself 66 | header('Location: ' . $_SERVER['REQUEST_URI']); 67 | exit(); 68 | } else { 69 | // Draw login page 70 | $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Anonymous()); 71 | $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Login()); 72 | } 73 | } else { 74 | // CSRF token check 75 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { 76 | if (!isset($_POST['CSRF_TOKEN'])) { 77 | throw new \Exception('CSRF token was not submitted. Try removing your cookies and log in again'); 78 | } 79 | if ($_POST['CSRF_TOKEN'] !== $_SESSION['CSRF_TOKEN']) { 80 | throw new \Exception('CSRF token did not match the session CSRF token. Please try to do this action again.'); 81 | } 82 | } 83 | 84 | $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar()); 85 | 86 | # Route the request 87 | $GLOBALS["ROUTER"]::route($oPage); 88 | } 89 | 90 | # Render the page 91 | echo $oPage->render(); 92 | -------------------------------------------------------------------------------- /Core/Frameworks/BaikalAdmin/config.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://sabre.io/baikal 10 | # 11 | # This script is part of the Baïkal Server project. The Baïkal 12 | # Server project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | define("BAIKALADMIN_PATH_TEMPLATES", BAIKALADMIN_PATH_ROOT . "Resources/Templates/"); 29 | 30 | $GLOBALS["ROUTES"] = [ 31 | "default" => "\BaikalAdmin\Route\Dashboard", 32 | "users" => "\BaikalAdmin\Route\Users", 33 | "users/calendars" => "\BaikalAdmin\Route\User\Calendars", 34 | "users/addressbooks" => "\BaikalAdmin\Route\User\AddressBooks", 35 | "settings/standard" => "\BaikalAdmin\Route\Settings\Standard", 36 | "settings/database" => "\BaikalAdmin\Route\Settings\Database", 37 | "logout" => "\BaikalAdmin\Route\Logout", 38 | ]; 39 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Controller/HtmlBlock.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Controller; 29 | 30 | class HtmlBlock extends \Flake\Core\Controller { 31 | /** 32 | * @var string 33 | */ 34 | private $sHtml; 35 | 36 | function __construct($sHtml) { 37 | $this->sHtml = $sHtml; 38 | } 39 | 40 | function execute() { 41 | } 42 | 43 | function render() { 44 | return $this->sHtml; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Controller/HtmlBlockTemplated.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Controller; 29 | 30 | class HtmlBlockTemplated extends \Flake\Core\Controller { 31 | /** 32 | * @var string 33 | */ 34 | private $sTemplatePath; 35 | 36 | /** 37 | * @var array 38 | */ 39 | private $aMarkers; 40 | 41 | function __construct($sTemplatePath, $aMarkers = []) { 42 | $this->sTemplatePath = $sTemplatePath; 43 | $this->aMarkers = $aMarkers; 44 | } 45 | 46 | function render() { 47 | $oTemplate = new \Flake\Core\Template($this->sTemplatePath); 48 | $sHtml = $oTemplate->parse( 49 | $this->aMarkers 50 | ); 51 | 52 | return $sHtml; 53 | } 54 | 55 | function execute() { 56 | // TODO: Implement execute() method. 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Controller/Rpc.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Controller; 29 | 30 | class Rpc extends \Flake\Core\Render\Container { 31 | function initializeContext() { 32 | $this->injectHTTPHeaders(); 33 | $GLOBALS["POSTCONNECTIONSERVICES"] = []; 34 | } 35 | 36 | function injectHTTPHeaders() { 37 | ob_start(); 38 | 39 | header("Access-Control-Allow-Origin: *"); # To allow cross domain AJAX response 40 | header("Access-Control-Allow-Credentials: true"); # To allow cross domain cookies 41 | header("Content-Type: application/json; charset=UTF-8"); 42 | 43 | # Needed to cut client off when needed 44 | header("Connection: close\r\n"); 45 | ignore_user_abort(true); 46 | } 47 | 48 | function P3PAllowCrossDomainCookies() { 49 | # This tells IE6+ to accept passing cookies allong when establishing a XHR connection to read.codr.fr 50 | header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); 51 | } 52 | 53 | function sendResponseCutClientAndRunPostConnectionTasks() { 54 | header("Content-Length: " . ob_get_length()); 55 | ob_end_flush(); 56 | flush(); 57 | 58 | reset($GLOBALS["POSTCONNECTIONSERVICES"]); 59 | 60 | # If post-connection services are registered, process 61 | foreach ($GLOBALS["POSTCONNECTIONSERVICES"] as $service) { 62 | $service->execute(); 63 | } 64 | 65 | session_write_close(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/CollectionTyped.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | class CollectionTyped extends \Flake\Core\Collection { 31 | protected $sTypeClassOrProtocol; 32 | 33 | function __construct($sTypeClassOrProtocol) { 34 | $this->sTypeClassOrProtocol = $sTypeClassOrProtocol; 35 | $this->setMetaType($this->sTypeClassOrProtocol); 36 | } 37 | 38 | function push(&$mMixed) { 39 | if (!\Flake\Util\Tools::is_a($mMixed, $this->sTypeClassOrProtocol)) { 40 | throw new \Exception("\Flake\Core\CollectionTyped<" . $this->sTypeClassOrProtocol . ">: Given object is not correctly typed."); 41 | } 42 | 43 | parent::push($mMixed); 44 | } 45 | 46 | # Create a new collection like this one 47 | function newCollectionLikeThisOne() { 48 | $oCollection = new \Flake\Core\CollectionTyped($this->sTypeClassOrProtocol); 49 | 50 | return $oCollection; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Controller.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | abstract class Controller extends \Flake\Core\FLObject { 31 | protected $aParams = []; 32 | 33 | function __construct($aParams = []) { 34 | $this->aParams = $aParams; 35 | } 36 | 37 | function getParams() { 38 | return $this->aParams; 39 | } 40 | 41 | static function link(/*[$sParam, $sParam2, ...]*/) { 42 | return static::buildRoute(); 43 | } 44 | 45 | static function buildRoute($aParams = []) { 46 | # TODO: il faut remplacer le mécanisme basé sur un nombre variable de paramètres en un mécanisme basé sur un seul paramètre "tableau" 47 | #$aParams = func_get_args(); 48 | $sController = "\\" . get_called_class(); 49 | 50 | #array_unshift($aParams, $sController); # Injecting current controller as first param 51 | #return call_user_func_array($GLOBALS["ROUTER"] . "::buildRouteForController", $aParams); 52 | return $GLOBALS["ROUTER"]::buildRouteForController($sController, $aParams); 53 | } 54 | 55 | abstract function execute(); 56 | 57 | abstract function render(); 58 | } 59 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Database/Mysql.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Database; 29 | 30 | class Mysql extends \Flake\Core\Database { 31 | protected $sHost = ""; 32 | protected $sDbName = ""; 33 | protected $sUsername = ""; 34 | protected $sPassword = ""; 35 | 36 | function __construct($sHost, $sDbName, $sUsername, $sPassword) { 37 | $this->sHost = $sHost; 38 | $this->sDbName = $sDbName; 39 | $this->sUsername = $sUsername; 40 | $this->sPassword = $sPassword; 41 | 42 | $this->oDb = new \PDO( 43 | 'mysql:host=' . $this->sHost . ';dbname=' . $this->sDbName, 44 | $this->sUsername, 45 | $this->sPassword 46 | ); 47 | $this->oDb->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 48 | } 49 | 50 | function tables() { 51 | $aTables = []; 52 | 53 | $sSql = "SHOW TABLES FROM `" . $this->sDbName . "`"; 54 | $oStmt = $this->query($sSql); 55 | 56 | while (($aRs = $oStmt->fetch()) !== false) { 57 | $aTables[] = array_shift($aRs); 58 | } 59 | 60 | asort($aTables); 61 | reset($aTables); 62 | 63 | return $aTables; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Database/Pgsql.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Database; 29 | 30 | class Pgsql extends \Flake\Core\Database { 31 | protected $oDb = false; // current DB link 32 | protected $debugOutput = false; 33 | protected $store_lastBuiltQuery = true; 34 | protected $debug_lastBuiltQuery = ""; 35 | protected $sHost = ""; 36 | protected $sDbName = ""; 37 | protected $sUsername = ""; 38 | protected $sPassword = ""; 39 | 40 | public function __construct($sHost, $sDbName, $sUsername, $sPassword) { 41 | $this->sHost = $sHost; 42 | $this->sDbName = $sDbName; 43 | $this->sUsername = $sUsername; 44 | $this->sPassword = $sPassword; 45 | 46 | $this->oDb = new \PDO( 47 | 'pgsql:host=' . $this->sHost . ';dbname=' . $this->sDbName, 48 | $this->sUsername, 49 | $this->sPassword 50 | ); 51 | } 52 | 53 | public function tables() { 54 | $aTables = []; 55 | 56 | $sSql = "SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public'"; 57 | $oStmt = $this->query($sSql); 58 | 59 | while (($aRs = $oStmt->fetch()) !== false) { 60 | $aTables[] = array_shift($aRs); 61 | } 62 | 63 | asort($aTables); 64 | reset($aTables); 65 | 66 | return $aTables; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Database/Sqlite.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Database; 29 | 30 | class Sqlite extends \Flake\Core\Database { 31 | protected $sDbPath = ""; 32 | 33 | function __construct($sDbPath) { 34 | $this->sDbPath = $sDbPath; 35 | $this->oDb = new \PDO('sqlite:' . $this->sDbPath); 36 | $this->oDb->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 37 | } 38 | 39 | # Taken from http://dev.kohanaframework.org/issues/2985 40 | function tables() { 41 | $aTables = []; 42 | 43 | # Find all user level table names 44 | $oStmt = $this->query('SELECT name ' 45 | . 'FROM sqlite_master ' 46 | . 'WHERE type=\'table\' AND name NOT LIKE \'sqlite_%\' ' 47 | . 'ORDER BY name'); 48 | 49 | while (($aRs = $oStmt->fetch()) !== false) { 50 | // Get the table name from the results 51 | $aTables[] = array_shift($aRs); 52 | } 53 | 54 | reset($aTables); 55 | 56 | return $aTables; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Database/Statement.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Database; 29 | 30 | class Statement extends \Flake\Core\FLObject { 31 | protected $stmt; 32 | 33 | function __construct($stmt) { 34 | $this->stmt = $stmt; 35 | } 36 | 37 | function fetch() { 38 | if ($this->stmt !== false) { 39 | return $this->stmt->fetch(\PDO::FETCH_ASSOC, \PDO::FETCH_ORI_FIRST); 40 | } 41 | 42 | return false; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Datastructure/Chain.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Datastructure; 29 | 30 | /** 31 | * @extends \SplDoublyLinkedList<\Flake\Core\Datastructure\Chainable> 32 | */ 33 | class Chain extends \SplDoublyLinkedList { 34 | function push($value): void { 35 | $value->chain($this, $this->count()); 36 | parent::push($value); 37 | } 38 | 39 | function offsetUnset($offset): void { 40 | throw new \Exception("Cannot delete Chainable in Chain"); 41 | } 42 | 43 | function &first() { 44 | $oRes = $this->bottom(); 45 | 46 | return $oRes; 47 | } 48 | 49 | function &last() { 50 | $oRes = $this->top(); 51 | 52 | return $oRes; 53 | } 54 | 55 | function reset() { 56 | reset($this); 57 | } 58 | 59 | function __toString() { 60 | ob_start(); 61 | var_dump($this); 62 | $sDump = ob_get_contents(); 63 | ob_end_clean(); 64 | 65 | return "
" . htmlspecialchars($sDump) . "
"; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Datastructure/ChainLink.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Datastructure; 29 | 30 | abstract class ChainLink implements \Flake\Core\Datastructure\Chainable { 31 | protected $__container; 32 | protected $__key; 33 | 34 | function chain(Chain $container, $key) { 35 | $this->__container = $container; 36 | $this->__key = $key; 37 | } 38 | 39 | function offsetSet($offset, $value): void { 40 | if (is_null($this->__container)) { 41 | return; 42 | } 43 | 44 | $this->__container->offsetSet($offset, $value); 45 | } 46 | 47 | function offsetExists($offset): bool { 48 | if (is_null($this->__container)) { 49 | return false; 50 | } 51 | 52 | return $this->__container->offsetExists($offset); 53 | } 54 | 55 | function offsetUnset($offset): void { 56 | if (is_null($this->__container)) { 57 | return; 58 | } 59 | 60 | $this->__container->offsetUnset($offset); 61 | } 62 | 63 | #[\ReturnTypeWillChange] 64 | function &offsetGet($offset) { 65 | if (is_null($this->__container)) { 66 | return null; 67 | } 68 | 69 | $oRes = $this->__container->offsetGet($offset); 70 | 71 | return $oRes; 72 | } 73 | 74 | function rewind(): void { 75 | $this->__container->rewind(); 76 | } 77 | 78 | #[\ReturnTypeWillChange] 79 | function current() { 80 | return $this->__container->current(); 81 | } 82 | 83 | #[\ReturnTypeWillChange] 84 | function key() { 85 | return $this->__container->key(); 86 | } 87 | 88 | function &next(): void { 89 | $this->__container->next(); 90 | } 91 | 92 | function &prev() { 93 | $oPrev = $this->__container->prev(); 94 | 95 | return $oPrev; 96 | } 97 | 98 | function valid(): bool { 99 | return $this->__container->valid(); 100 | } 101 | 102 | function count(): int { 103 | return $this->__container->count(); 104 | } 105 | 106 | function &first() { 107 | $oRes = $this->__container->first(); 108 | 109 | return $oRes; 110 | } 111 | 112 | function &last() { 113 | $oRes = $this->__container->last(); 114 | 115 | return $oRes; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Datastructure/Chainable.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Datastructure; 29 | 30 | interface Chainable extends \ArrayAccess, \Iterator, \Countable { 31 | # public function &next(); # This is already specified by interface Iterator 32 | function &prev(); 33 | 34 | function &first(); 35 | 36 | function &last(); 37 | 38 | function chain(Chain $chain, $key); 39 | } 40 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/FLObject.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | class FLObject { 31 | function __toString() { 32 | ob_start(); 33 | var_dump($this); 34 | $sDump = ob_get_contents(); 35 | ob_end_clean(); 36 | 37 | return "
" . htmlspecialchars($sDump) . "
"; 38 | } 39 | 40 | function isA($sClassOrProtocolName) { 41 | return \Flake\Util\Tools::is_a($this, $sClassOrProtocolName); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Framework.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | class Framework { 31 | } 32 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Model.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | abstract class Model extends \Flake\Core\FLObject { 31 | protected $aData = []; 32 | 33 | protected function getData() { 34 | reset($this->aData); 35 | 36 | return $this->aData; 37 | } 38 | 39 | function __get($sPropName) { 40 | return $this->get($sPropName); 41 | } 42 | 43 | function __isset($name) { 44 | if (array_key_exists($name, $this->aData)) { 45 | return true; 46 | } 47 | 48 | return false; 49 | } 50 | 51 | function get($sPropName) { 52 | if (array_key_exists($sPropName, $this->aData)) { 53 | return $this->aData[$sPropName]; 54 | } 55 | 56 | throw new \Exception("\Flake\Core\Model->get(): property " . htmlspecialchars($sPropName) . " does not exist on " . get_class($this)); 57 | } 58 | 59 | function set($sPropName, $sPropValue) { 60 | if (array_key_exists($sPropName, $this->aData)) { 61 | $this->aData[$sPropName] = $sPropValue; 62 | 63 | return $this; 64 | } 65 | 66 | throw new \Exception("\Flake\Core\Model->set(): property " . htmlspecialchars($sPropName) . " does not exist on " . get_class($this)); 67 | } 68 | 69 | function label() { 70 | return $this->get($this::LABELFIELD); 71 | } 72 | 73 | static function icon() { 74 | return "icon-book"; 75 | } 76 | 77 | static function mediumicon() { 78 | return "glyph-book"; 79 | } 80 | 81 | static function bigicon() { 82 | return "glyph2x-book"; 83 | } 84 | 85 | static function humanName() { 86 | $aRes = explode("\\", get_called_class()); 87 | 88 | return array_pop($aRes); 89 | } 90 | 91 | function floating() { 92 | return true; 93 | } 94 | 95 | function formForThisModelInstance($options = []) { 96 | $sClass = get_class($this); 97 | $oForm = new \Formal\Form($sClass, $options); 98 | $oForm->setModelInstance($this); 99 | 100 | return $oForm; 101 | } 102 | 103 | function formMorphologyForThisModelInstance() { 104 | throw new \Exception(get_class($this) . ": No form morphology provided for Model."); 105 | } 106 | 107 | abstract function persist(); 108 | 109 | abstract function destroy(); 110 | } 111 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Model/NoDb.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Model; 29 | 30 | abstract class NoDb extends \Flake\Core\Model { 31 | function __construct($aData = false) { 32 | if ($aData !== false) { 33 | $this->aData = $aData; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/PostConnectionService.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | abstract class PostConnectionService extends \Flake\Core\FLObject { 31 | /** 32 | * @var array 33 | */ 34 | private $aParams; 35 | 36 | function __construct($aParams = []) { 37 | $this->aParams = $aParams; 38 | } 39 | 40 | function execute() { 41 | sleep(10); 42 | mail("mail@jeromeschneider.fr", "Hello", "je suis la"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Render/Container.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Render; 29 | 30 | abstract class Container extends \Flake\Core\Controller { 31 | public $aSequence = []; 32 | public $aBlocks = []; 33 | public $aRendu = []; 34 | public $aZones = []; 35 | 36 | function addBlock(&$oBlock, $sZone = "_DEFAULT_") { 37 | $aTemp = [ 38 | "block" => &$oBlock, 39 | "rendu" => "", 40 | ]; 41 | $this->aSequence[] = &$aTemp; 42 | $this->aBlocks[$sZone][] = &$aTemp["rendu"]; 43 | } 44 | 45 | function &zone($sZone) { 46 | if (!array_key_exists($sZone, $this->aZones)) { 47 | $this->aZones[$sZone] = new \Flake\Core\Render\Zone($this, $sZone); 48 | } 49 | 50 | return $this->aZones[$sZone]; 51 | } 52 | 53 | function render() { 54 | $this->execute(); 55 | $aRenderedBlocks = $this->renderBlocks(); 56 | 57 | return implode("", $aRenderedBlocks); 58 | } 59 | 60 | function execute() { 61 | foreach ($this->aSequence as $aStep) { 62 | $aStep["block"]->execute(); 63 | } 64 | } 65 | 66 | protected function renderBlocks() { 67 | $aHtml = []; 68 | foreach ($this->aSequence as $sKey => $aStep) { 69 | $this->aSequence[$sKey]["rendu"] = $this->aSequence[$sKey]["block"]->render(); 70 | } 71 | 72 | $aHtml = []; 73 | foreach ($this->aBlocks as $sZone => $aBlock) { 74 | $aHtml[$sZone] = implode("", $aBlock); 75 | } 76 | 77 | reset($aHtml); 78 | 79 | return $aHtml; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Render/Zone.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core\Render; 29 | 30 | class Zone extends \Flake\Core\FLObject { 31 | private $oZonableObject; 32 | private $sZone; 33 | 34 | function __construct(&$oZonableObject, $sZone) { 35 | $this->oZonableObject = &$oZonableObject; 36 | $this->sZone = $sZone; 37 | } 38 | 39 | function addBlock($oBlock) { 40 | $this->oZonableObject->addBlock( 41 | $oBlock, 42 | $this->sZone 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Requester.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | abstract class Requester extends \Flake\Core\FLObject { 31 | protected $sModelClass = ''; 32 | protected $sOrderField = ''; 33 | protected $sOrderDirection = 'ASC'; 34 | protected $iLimitStart = false; 35 | protected $iLimitNumber = false; 36 | 37 | function __construct($sModelClass) { 38 | $this->sModelClass = $sModelClass; 39 | } 40 | 41 | protected function addClause($sField, $sValue) { 42 | $this->addClauseEquals($sField, $sValue); 43 | 44 | return $this; 45 | } 46 | 47 | function limit($iStart, $iNumber = false) { 48 | if ($iNumber !== false) { 49 | return $this->setLimitStart($iStart)->setLimitNumber($iNumber); 50 | } 51 | 52 | return $this->setLimitStart($iStart); 53 | } 54 | 55 | function orderBy($sOrderField, $sOrderDirection = "ASC") { 56 | $this->sOrderField = $sOrderField; 57 | $this->sOrderDirection = $sOrderDirection; 58 | 59 | return $this; 60 | } 61 | 62 | function setLimitStart($iLimitStart) { 63 | $this->iLimitStart = $iLimitStart; 64 | 65 | return $this; 66 | } 67 | 68 | function setLimitNumber($iLimitNumber) { 69 | $this->iLimitNumber = $iLimitNumber; 70 | 71 | return $this; 72 | } 73 | 74 | abstract function addClauseEquals($sField, $sValue); 75 | 76 | abstract function execute(); 77 | 78 | abstract function count(); 79 | } 80 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Route.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | use Flake\Core\Render\Container; 31 | 32 | abstract class Route extends \Flake\Core\FLObject { 33 | # should be abstract, but is not, due to PHP strict standard 34 | static function layout(Container &$oRenderContainer) { 35 | } 36 | 37 | static function parametersMap() { 38 | return []; 39 | } 40 | 41 | # converts raw url params "a/b/c/d"=[a, b, c, d] in route params [a=>b, c=>d] 42 | 43 | static function getParams() { 44 | $aRouteParams = []; 45 | 46 | $aParametersMap = static::parametersMap(); # static to use method as defined in derived class 47 | $aURLParams = $GLOBALS["ROUTER"]::getURLParams(); 48 | 49 | reset($aParametersMap); 50 | foreach ($aParametersMap as $sParam => $aMap) { 51 | $sURLToken = $sParam; 52 | 53 | if (array_key_exists("urltoken", $aMap)) { 54 | $sURLToken = $aMap["urltoken"]; 55 | } 56 | 57 | if (($iPos = array_search($sURLToken, $aURLParams)) !== false) { 58 | $aRouteParams[$sParam] = $aURLParams[($iPos + 1)]; # the value corresponding to this param is the next one in the URL 59 | } 60 | } 61 | 62 | reset($aRouteParams); 63 | 64 | return $aRouteParams; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/Template.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | class Template extends \Flake\Core\FLObject { 31 | private $sAbsPath = ""; 32 | private $sHtml = ""; 33 | 34 | function __construct($sAbsPath) { 35 | $this->sAbsPath = $sAbsPath; 36 | $this->sHtml = $this->getTemplateFile( 37 | $this->sAbsPath 38 | ); 39 | } 40 | 41 | private function getTemplateFile($sAbsPath) { 42 | return file_get_contents($sAbsPath); 43 | } 44 | 45 | function parse($aMarkers = []) { 46 | return \Flake\Util\Tools::parseTemplateCode( 47 | $this->sHtml, 48 | $aMarkers 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Core/View.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Core; 29 | 30 | abstract class View extends \Flake\Core\FLObject { 31 | protected $aData; 32 | 33 | function __construct() { 34 | $this->aData = []; 35 | } 36 | 37 | function setData($sName, $mData) { 38 | $this->aData[$sName] = $mData; 39 | } 40 | 41 | function getData() { 42 | return $this->aData; 43 | } 44 | 45 | function get($sWhat) { 46 | if (array_key_exists($sWhat, $this->aData)) { 47 | return $this->aData[$sWhat]; 48 | } 49 | 50 | return false; 51 | } 52 | 53 | function render() { 54 | $sTemplatePath = $this->templatesPath(); 55 | $oTemplate = new \Flake\Core\Template($this->templatesPath()); 56 | 57 | return $oTemplate->parse($this->getData()); 58 | } 59 | 60 | abstract function templatesPath(); 61 | } 62 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Model/IUser.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Model; 29 | 30 | interface IUser { 31 | function isAdmin(); 32 | 33 | function getDisplayName(); 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Model/User/Admin.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Model\User; 29 | 30 | class Admin extends \Flake\Core\Model\NoDb { 31 | function isAdmin() { 32 | return true; 33 | } 34 | 35 | function getDisplayName() { 36 | return "Admin"; 37 | } 38 | 39 | function persist() { 40 | } 41 | 42 | function destroy() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Model/User/Customer.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Model\User; 29 | 30 | class Customer extends \Flake\Core\Model\Db implements \Flake\Model\IUser { 31 | const DATATABLE = "user"; 32 | const PRIMARYKEY = "uid"; 33 | const LABELFIELD = "username"; 34 | 35 | protected $aData = [ 36 | "username" => "", 37 | "firstname" => "", 38 | "lastname" => "", 39 | "email" => "", 40 | "password" => "", 41 | "salt" => "", 42 | "crdate" => 0, 43 | "enabled" => 0, 44 | ]; 45 | 46 | function isAdmin() { 47 | return false; 48 | } 49 | 50 | function getDisplayName() { 51 | return $this->get("firstname") . " " . $this->get("lastname"); 52 | } 53 | 54 | function persist() { 55 | } 56 | 57 | function destroy() { 58 | } 59 | 60 | static function hashPassword($sClearPassword, $sSalt) { 61 | return sha1(APP_ENCRYPTION_KEY . ":" . $sClearPassword . ":" . $sSalt); 62 | } 63 | 64 | static function fetchByCredentials($sUsername, $sClearPassword) { 65 | # Algorithm: 66 | # 1- find the user by username 67 | # 2- hash the given password using the salt for this user 68 | # 3- compare hashes 69 | 70 | $oUser = self::getBaseRequester() 71 | ->addClauseEquals("username", $sUsername) 72 | ->addClauseEquals("enabled", 1) 73 | ->execute() 74 | ->first(); 75 | 76 | if (is_null($oUser)) { 77 | return false; 78 | } 79 | 80 | if ($oUser->get("password") !== self::hashPassword($sClearPassword, $oUser->get("salt"))) { 81 | return false; 82 | } 83 | 84 | return $oUser; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Util/Frameworks.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Util; 29 | 30 | class Frameworks extends \Flake\Core\FLObject { 31 | private function __construct() { # private constructor to force static class 32 | } 33 | 34 | function isAFramework($sName) { 35 | $sName = trim(\Flake\Util\Tools::trimSlashes($sName)); 36 | if ($sName === "" || $sName === "." || $sName === "..") { 37 | return false; 38 | } 39 | 40 | $sFrameworkPath = PROJECT_PATH_FRAMEWORKS . $sName; 41 | 42 | return file_exists($sFrameworkPath) && is_dir($sFrameworkPath); 43 | } 44 | 45 | static function enabled($sFramework) { 46 | return false; 47 | } 48 | 49 | # TODO: Create a 'Framework' Model 50 | function getPath($sName) { 51 | if (self::isAFramework($sName)) { 52 | throw new \Flake\Core\Exception(htmlspecialchars($$sName) . " is not a framework.", $sName); 53 | } 54 | 55 | return \Flake\Util\Tools::appendSlash(PROJECT_PATH_FRAMEWORKS . $sName); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/Util/Profiler.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Flake\Util; 29 | 30 | class Profiler extends \Flake\Core\FLObject { 31 | protected static $TUSAGE; 32 | protected static $RUSAGE; 33 | 34 | protected function __construct() { 35 | # Static class 36 | } 37 | 38 | static function start() { 39 | $dat = getrusage(); 40 | self::$TUSAGE = microtime(true); 41 | self::$RUSAGE = $dat["ru_utime.tv_sec"] * 1e6 + $dat["ru_utime.tv_usec"]; 42 | } 43 | 44 | static function cpuUsage() { 45 | $dat = getrusage(); 46 | $tv_usec = (($dat["ru_utime.tv_sec"] * 1e6) + $dat["ru_utime.tv_usec"]) - self::$RUSAGE; 47 | $time = (microtime(true) - self::$TUSAGE) * 1e6; 48 | 49 | // cpu per request 50 | if ($time > 0) { 51 | $cpu = number_format(($tv_usec / $time) * 100, 2); 52 | } else { 53 | $cpu = '0.00'; 54 | } 55 | 56 | return $cpu; 57 | } 58 | 59 | static function cpuTime() { 60 | $dat = getrusage(); 61 | $tv_usec = (($dat["ru_utime.tv_sec"] * 1e6) + $dat["ru_utime.tv_usec"]) - self::$RUSAGE; 62 | $time = (microtime(true) - self::$TUSAGE) * 1e6; 63 | $cpuusage = ($tv_usec / $time); 64 | 65 | return round(($time / 1000) * $cpuusage); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Core/Frameworks/Flake/config.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://flake.codr.fr 10 | # 11 | # This script is part of the Flake project. The Flake 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | if (defined("PROJECT_LOCALE")) { 29 | define("FLAKE_LOCALE", PROJECT_LOCALE); 30 | } else { 31 | define("FLAKE_LOCALE", "fr_FR.UTF-8"); 32 | } 33 | 34 | if (defined("PROJECT_TIMEZONE")) { 35 | define("FLAKE_TIMEZONE", PROJECT_TIMEZONE); 36 | } else { 37 | define("FLAKE_TIMEZONE", "Europe/Paris"); 38 | } 39 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Core/Message.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal\Core; 29 | 30 | class Message { 31 | private function __construct() { 32 | } 33 | 34 | static function error($sMessage, $sTitle = "") { 35 | if ($sTitle !== "") { 36 | $sTitle = '

' . $sTitle . '

'; 37 | } 38 | 39 | $sHtml = << 41 | {$sTitle} 42 | {$sMessage} 43 | 44 | HTML; 45 | 46 | return $sHtml; 47 | } 48 | 49 | static function notice($sMessage, $sTitle = "", $bClose = true) { 50 | $sClose = ""; 51 | 52 | if ($sTitle !== "") { 53 | $sTitle = '

' . $sTitle . '

'; 54 | } 55 | 56 | if ($bClose === true) { 57 | $sClose = '×'; 58 | } 59 | 60 | $sHtml = << 62 | {$sClose} 63 | {$sTitle} 64 | {$sMessage} 65 | 66 | HTML; 67 | 68 | return $sHtml; 69 | } 70 | 71 | static function warningConfirmMessage($sHeader, $sDescription, $sActionUrl, $sActionLabel, $sCancelUrl, $sCancelLabel = "Cancel") { 72 | $sHtml = << 74 | 75 |

{$sHeader}

76 | {$sDescription} 77 |

78 | {$sActionLabel} Cancel 79 |

80 | 81 | HTML; 82 | 83 | return $sHtml; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Element.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal; 29 | 30 | abstract class Element { 31 | protected $aOptions = [ 32 | "class" => "", 33 | "inputclass" => "input-xlarge", 34 | "readonly" => false, 35 | "validation" => "", 36 | "error" => false, 37 | "placeholder" => "", 38 | "help" => "", 39 | "popover" => "", 40 | "refreshonchange" => false, 41 | ]; 42 | 43 | protected $sValue = ""; 44 | 45 | function __construct($aOptions) { 46 | $this->aOptions = array_merge($this->aOptions, $aOptions); 47 | } 48 | 49 | function option($sName) { 50 | if (array_key_exists($sName, $this->aOptions)) { 51 | return $this->aOptions[$sName]; 52 | } 53 | 54 | throw new \Exception("\Formal\Element->option(): Option '" . htmlspecialchars($sName) . "' not found."); 55 | } 56 | 57 | function optionArray($sOptionName) { 58 | $sOption = trim($this->option($sOptionName)); 59 | if ($sOption !== "") { 60 | $aOptions = explode(",", $sOption); 61 | } else { 62 | $aOptions = []; 63 | } 64 | 65 | reset($aOptions); 66 | 67 | return $aOptions; 68 | } 69 | 70 | function setOption($sOptionName, $sOptionValue) { 71 | $this->aOptions[$sOptionName] = $sOptionValue; 72 | } 73 | 74 | function value() { 75 | return $this->sValue; 76 | } 77 | 78 | function setValue($sValue) { 79 | $this->sValue = $sValue; 80 | } 81 | 82 | function __toString() { 83 | return get_class($this) . "<" . $this->option("label") . ">"; 84 | } 85 | 86 | function renderWitness() { 87 | return ''; 88 | } 89 | 90 | function posted() { 91 | $aPost = \Flake\Util\Tools::POST("witness"); 92 | if (is_array($aPost)) { 93 | $sProp = $this->option("prop"); 94 | 95 | return (array_key_exists($sProp, $aPost)) && (intval($aPost[$sProp]) === 1); 96 | } 97 | 98 | return false; 99 | } 100 | 101 | abstract function render(); 102 | } 103 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Element/Checkbox.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal\Element; 29 | 30 | class Checkbox extends \Formal\Element { 31 | public function setValue($sValue) { 32 | # Boolean 33 | $this->sValue = ((intval($sValue) === 1)); 34 | } 35 | 36 | function render() { 37 | $disabled = ""; 38 | $inputclass = ""; 39 | $groupclass = ""; 40 | $onchange = ""; 41 | $helpblock = ""; 42 | $popover = ""; 43 | 44 | $value = $this->value(); 45 | 46 | $checked = ($value === true ? " checked=\"checked\" " : ""); 47 | $label = $this->option("label"); 48 | $prop = $this->option("prop"); 49 | 50 | if ($this->option("readonly") === true) { 51 | $inputclass .= " disabled"; 52 | $disabled = " disabled"; 53 | } 54 | 55 | if ($this->option("error") === true) { 56 | $groupclass .= " error"; 57 | } 58 | 59 | if (($sHelp = trim($this->option("help"))) !== "") { 60 | $helpblock = "

" . $sHelp . "

"; 61 | } 62 | 63 | if (($aPopover = $this->option("popover")) !== "") { 64 | $inputclass .= " popover-hover "; 65 | $popover = " title=\"" . htmlspecialchars($aPopover["title"]) . "\" "; 66 | $popover .= " data-content=\"" . htmlspecialchars($aPopover["content"]) . "\" "; 67 | } 68 | 69 | if ($this->option("refreshonchange") === true) { 70 | $onchange = " onchange=\"document.getElementsByTagName('form')[0].elements['refreshed'].value=1;document.getElementsByTagName('form')[0].submit();\" "; 71 | } 72 | 73 | $sHtml = << 75 | 76 |
77 | 78 | {$helpblock} 79 |
80 | 81 | HTML; 82 | 83 | return $sHtml . $this->renderWitness(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Element/Password.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal\Element; 29 | 30 | class Password extends \Formal\Element\Text { 31 | protected function inputtype() { 32 | return "password"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Element/Text.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal\Element; 29 | 30 | class Text extends \Formal\Element { 31 | protected function inputtype() { 32 | return "text"; 33 | } 34 | 35 | function render() { 36 | $disabled = ""; 37 | $inputclass = ""; 38 | $groupclass = ""; 39 | $placeholder = ""; 40 | 41 | $value = $this->value(); 42 | $label = $this->option("label"); 43 | $prop = $this->option("prop"); 44 | $placeholder = ""; 45 | $helpblock = ""; 46 | $popover = ""; 47 | 48 | if ($this->option("readonly") === true) { 49 | $inputclass .= " disabled"; 50 | $disabled = " disabled"; 51 | } 52 | 53 | if ($this->option("error") === true) { 54 | $groupclass .= " error"; 55 | } 56 | 57 | if (trim($this->option("class")) !== "") { 58 | $groupclass .= " " . $this->option("class"); 59 | } 60 | 61 | if (trim($this->option("inputclass")) !== "") { 62 | $inputclass = $this->option("inputclass"); 63 | } 64 | 65 | if (($sPlaceHolder = trim($this->option("placeholder"))) !== "") { 66 | $placeholder = " placeholder=\"" . htmlspecialchars($sPlaceHolder) . "\" "; 67 | } 68 | 69 | $clientvalue = htmlspecialchars($value ?? ''); 70 | 71 | $sInputType = $this->inputtype(); 72 | 73 | if (($sHelp = trim($this->option("help"))) !== "") { 74 | $helpblock = "

" . $sHelp . "

"; 75 | } 76 | 77 | if (($aPopover = $this->option("popover")) !== "") { 78 | if (array_key_exists("position", $aPopover)) { 79 | $sPosition = $aPopover["position"]; 80 | $inputclass .= " popover-focus-" . $sPosition; 81 | } else { 82 | $inputclass .= " popover-focus "; 83 | } 84 | 85 | $popover = " title=\"" . htmlspecialchars($aPopover["title"]) . "\" "; 86 | $popover .= " data-content=\"" . htmlspecialchars($aPopover["content"]) . "\" "; 87 | $popover .= " data-html=\"true\""; 88 | } 89 | 90 | $sHtml = << 92 | 93 |
94 | 95 | {$helpblock} 96 |
97 | 98 | HTML; 99 | 100 | return $sHtml . $this->renderWitness(); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Form/Morphology.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal\Form; 29 | 30 | class Morphology { 31 | protected $oElements; 32 | 33 | function __construct() { 34 | $this->oElements = new \Flake\Core\CollectionTyped("\Formal\Element"); 35 | } 36 | 37 | function add(\Formal\Element $oElement) { 38 | $this->oElements->push($oElement); 39 | } 40 | 41 | protected function keyForPropName($sPropName) { 42 | $aKeys = $this->oElements->keys(); 43 | reset($aKeys); 44 | foreach ($aKeys as $sKey) { 45 | $oElement = $this->oElements->getForKey($sKey); 46 | 47 | if ($oElement->option("prop") === $sPropName) { 48 | return $sKey; 49 | } 50 | } 51 | 52 | return false; 53 | } 54 | 55 | function &element($sPropName) { 56 | if (($sKey = $this->keyForPropName($sPropName)) === false) { 57 | throw new \Exception("\Formal\Form\Morphology->element(): Element prop='" . $sPropName . "' not found"); 58 | } 59 | 60 | $oElement = $this->oElements->getForKey($sKey); 61 | 62 | return $oElement; 63 | } 64 | 65 | function remove($sPropName) { 66 | if (($sKey = $this->keyForPropName($sPropName)) === false) { 67 | throw new \Exception("\Formal\Form\Morphology->element(): Element prop='" . $sPropName . "' not found"); 68 | } 69 | 70 | $this->oElements->remove($sKey); 71 | } 72 | 73 | function elements() { 74 | return $this->oElements; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Core/Frameworks/Formal/Framework.php: -------------------------------------------------------------------------------- 1 | 7 | # All rights reserved 8 | # 9 | # http://formal.codr.fr 10 | # 11 | # This script is part of the Formal project. The Formal 12 | # project is free software; you can redistribute it 13 | # and/or modify it under the terms of the GNU General Public 14 | # License as published by the Free Software Foundation; either 15 | # version 2 of the License, or (at your option) any later version. 16 | # 17 | # The GNU General Public License can be found at 18 | # http://www.gnu.org/copyleft/gpl.html. 19 | # 20 | # This script is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # This copyright notice MUST APPEAR in all copies of the script! 26 | ################################################################# 27 | 28 | namespace Formal; 29 | 30 | class Framework extends \Flake\Core\Framework { 31 | static function bootstrap() { 32 | define("FORMAL_PATH_ROOT", PROJECT_PATH_ROOT . "Core/Frameworks/Formal/"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Core/Frameworks/TwitterBootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/TwitterBootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /Core/Frameworks/TwitterBootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabre-io/Baikal/49b610c3f597cefb941d8ceb6c7af3253a6954f8/Core/Frameworks/TwitterBootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /Core/Resources/System/htaccess-deny-all: -------------------------------------------------------------------------------- 1 | Order allow,deny 2 | Deny from all 3 | -------------------------------------------------------------------------------- /Core/Resources/System/htaccess-documentroot: -------------------------------------------------------------------------------- 1 | # Disabling cache management 2 | # that could cause problems with DAV requests 3 | # Useful only for Apache servers, with AllowOverride All 4 | # (ie, .htaccess files enabled) 5 | 6 | # Allow HTTP headers with Apache/FastCGI 7 | # See http://code.google.com/p/sabredav/wiki/Authentication#Apache_+_(Fast)CGI 8 | 9 | 10 | RewriteEngine On 11 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 12 | 13 | 14 | 15 | ExpiresActive Off 16 | -------------------------------------------------------------------------------- /Core/Resources/Web/Baikal: -------------------------------------------------------------------------------- 1 | ../../Frameworks/Baikal/Resources -------------------------------------------------------------------------------- /Core/Resources/Web/BaikalAdmin: -------------------------------------------------------------------------------- 1 | ../../Frameworks/BaikalAdmin/Resources -------------------------------------------------------------------------------- /Core/Resources/Web/README.md: -------------------------------------------------------------------------------- 1 | # Resources must be symlinked relatively to this folder 2 | -------------------------------------------------------------------------------- /Core/Resources/Web/TwitterBootstrap: -------------------------------------------------------------------------------- 1 | ../../Frameworks/TwitterBootstrap -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build-assets dist clean 2 | 3 | BUILD_DIR="build/baikal" 4 | 5 | BUILD_FILES=Core html LICENSE README.md composer.json 6 | 7 | VERSION=$(shell php -r "include 'Core/Distrib.php'; echo BAIKAL_VERSION;") 8 | 9 | dist: vendor/autoload.php 10 | # Building Baikal $(VERSION) 11 | rm -r $(BUILD_DIR); true 12 | mkdir -p $(BUILD_DIR) $(BUILD_DIR)/Specific $(BUILD_DIR)/Specific/db $(BUILD_DIR)/config 13 | touch $(BUILD_DIR)/Specific/db/.empty 14 | touch $(BUILD_DIR)/config/.empty 15 | rsync -av \ 16 | $(BUILD_FILES) \ 17 | --exclude="*.swp" \ 18 | $(BUILD_DIR) 19 | composer config platform.php 8.1 -d $(BUILD_DIR) 20 | composer install --no-interaction --no-dev -d $(BUILD_DIR) 21 | rm $(BUILD_DIR)/composer.* 22 | cd build; zip -r baikal-$(VERSION).zip baikal/ 23 | 24 | build-assets: vendor/autoload.php 25 | cat vendor/sabre/dav/examples/sql/mysql.*.sql > Core/Resources/Db/MySQL/db.sql 26 | cat vendor/sabre/dav/examples/sql/sqlite.*.sql > Core/Resources/Db/SQLite/db.sql 27 | 28 | vendor/autoload.php: composer.lock 29 | composer install --no-interaction 30 | 31 | composer.lock: composer.json 32 | composer update --no-interaction 33 | 34 | clean: 35 | # Wipe out all local data, and go back to a clean install 36 | rm config/baikal.yaml Specific/db/db.sqlite; true 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Baïkal 2 | ====== 3 | 4 | [![continuous-integration](https://github.com/sabre-io/Baikal/actions/workflows/ci.yml/badge.svg)](https://github.com/sabre-io/Baikal/actions/workflows/ci.yml) 5 | 6 | This is the source repository for the Baïkal CalDAV and CardDAV server. 7 | 8 | Head to [sabre.io/baikal][2] for information about installation, upgrading and troubleshooting. 9 | 10 | A German tutorial about installation of Baïkal, using it together with Thunderbird, Android and DavX5, sharing calendars, database maintenance and security can be found [here][6]. Its focus is for people with not so much IT experience. Therefore it is very detailed, step by step with a RaspberryPI used as server. 11 | 12 | With the same objective, a French guide, about installation on Debian, database maintenance, security and dealing with iOS clients can be found [here][7]. Its focus is also for people with not so much IT experience. 13 | 14 | Upgrading 15 | --------- 16 | 17 | Please follow [the upgrade instructions][5]. 18 | 19 | Credits 20 | ------- 21 | 22 | Baikal was created by [Jérôme Schneider][3] from Net Gusto and [fruux][4] and is now developed by volunteers. 23 | Many thanks to Daniel Aleksandersen (@zcode) for greatly improving the quality of the project page. 24 | 25 | [2]: https://sabre.io/baikal/ 26 | [3]: https://github.com/jeromeschneider 27 | [4]: https://fruux.com/ 28 | [5]: https://sabre.io/baikal/upgrade/ 29 | [6]: https://github.com/JsBergbau/BaikalAnleitung 30 | [7]: https://github.com/criticalsool/Baikal-Guide-FR 31 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report security issues to @ByteHamster using his [contact form](https://www.bytehamster.com/contact/). Alternatively, you can send an email to `baikal@.com` 6 | -------------------------------------------------------------------------------- /Specific/.htaccess: -------------------------------------------------------------------------------- 1 | Order allow,deny 2 | Deny from all 3 | -------------------------------------------------------------------------------- /Specific/db/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sabre/baikal", 3 | "type": "project", 4 | "description": "Baïkal is a lightweight CalDAV + CardDAV server based on PHP, SQLite or MySQL, and SabreDAV", 5 | "keywords": ["Project", "Server", "Calendar", "Contact", "WebDAV", "CalDAV", "CardDAV", "iCalendar", "lightweight"], 6 | "homepage": "https://sabre.io/baikal/", 7 | "license" : "GPL-3.0-only", 8 | "require": { 9 | "php" : "^8.1", 10 | "sabre/dav" : "~4.7.0", 11 | "twig/twig" : "~3.14.0", 12 | "symfony/yaml" : "~6.4.13", 13 | "psr/log" : "^1", 14 | "ext-dom" : "*", 15 | "ext-openssl" : "*", 16 | "ext-pdo" : "*", 17 | "ext-zlib" : "*" 18 | }, 19 | "require-dev" : { 20 | "friendsofphp/php-cs-fixer": "3.65.0", 21 | "phpstan/phpstan": "^1.10" 22 | }, 23 | "replace" : { 24 | "jeromeschneider/baikal" : "self.version" 25 | }, 26 | "autoload": { 27 | "psr-0" : { 28 | "Baikal" : "Core/Frameworks/", 29 | "Flake" : "Core/Frameworks/", 30 | "Formal" : "Core/Frameworks/" 31 | } 32 | }, 33 | "support" : { 34 | "source" : "https://github.com/sabre-io/Baikal" 35 | }, 36 | "scripts": { 37 | "cs-fixer": [ 38 | "php-cs-fixer fix" 39 | ], 40 | "phpstan": [ 41 | "phpstan analyse Core html" 42 | ], 43 | "test": [ 44 | "composer cs-fixer", 45 | "composer phpstan" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /config/baikal.yaml.dist: -------------------------------------------------------------------------------- 1 | system: 2 | configured_version: '0.7.0' 3 | timezone: 'Europe/Paris' 4 | card_enabled: true 5 | cal_enabled: true 6 | invite_from: 'noreply@localhost' 7 | dav_auth_type: 'Digest' 8 | admin_passwordhash: 5fe794627e1f841f8debba065e2c807a 9 | failed_access_message: 'user %u authentication failure for Baikal' 10 | auth_realm: BaikalDAV 11 | base_uri: '' 12 | database: 13 | encryption_key: 5d3f0fa0192e3058ea70f1bb20924add 14 | backend: 'mysql' 15 | sqlite_file: "absolute/path/to/Specific/db/db.sqlite" 16 | mysql_host: 'localhost' 17 | mysql_dbname: 'baikal' 18 | mysql_username: 'baikal' 19 | mysql_password: 'baikal' 20 | pgsql_host: 'localhost' 21 | pgsql_dbname: 'baikal' 22 | pgsql_username: 'baikal' 23 | pgsql_password: 'baikal' 24 | -------------------------------------------------------------------------------- /html/.htaccess: -------------------------------------------------------------------------------- 1 | # Disabling cache management 2 | # that could cause problems with DAV requests 3 | # Useful only for Apache servers, with AllowOverride All 4 | # (ie, .htaccess files enabled) 5 | 6 | # Allow HTTP headers with Apache/FastCGI 7 | # See http://code.google.com/p/sabredav/wiki/Authentication#Apache_+_(Fast)CGI 8 | 9 | 10 | RewriteEngine On 11 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 12 | 13 | 14 | 15 | ExpiresActive Off 16 | 17 | 18 | 19 | Redirect 308 /.well-known/caldav /dav.php 20 | Redirect 308 /.well-known/carddav /dav.php 21 | 22 | -------------------------------------------------------------------------------- /html/admin/index.php: -------------------------------------------------------------------------------- 1 | ../../Core/Frameworks/BaikalAdmin/WWWRoot/index.php -------------------------------------------------------------------------------- /html/admin/install/index.php: -------------------------------------------------------------------------------- 1 | ../../../Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php -------------------------------------------------------------------------------- /html/cal.php: -------------------------------------------------------------------------------- 1 | 7 | * All rights reserved 8 | * 9 | * http://sabre.io/baikal 10 | * 11 | * This script is part of the Baïkal Server project. The Baïkal 12 | * Server project is free software; you can redistribute it 13 | * and/or modify it under the terms of the GNU General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2 of the License, or (at your option) any later version. 16 | * 17 | * The GNU General Public License can be found at 18 | * http://www.gnu.org/copyleft/gpl.html. 19 | * 20 | * This script is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * This copyright notice MUST APPEAR in all copies of the script! 26 | ***************************************************************/ 27 | 28 | use Symfony\Component\Yaml\Yaml; 29 | 30 | ini_set("session.cookie_httponly", 1); 31 | ini_set("display_errors", 0); 32 | ini_set("log_errors", 1); 33 | 34 | define("BAIKAL_CONTEXT", true); 35 | define("PROJECT_CONTEXT_BASEURI", "/"); 36 | 37 | if (file_exists(getcwd() . "/Core")) { 38 | # Flat FTP mode 39 | define("PROJECT_PATH_ROOT", getcwd() . "/"); #./ 40 | } else { 41 | # Dedicated server mode 42 | define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ 43 | } 44 | 45 | if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { 46 | exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); 47 | } 48 | 49 | require PROJECT_PATH_ROOT . 'vendor/autoload.php'; 50 | 51 | # Bootstrapping Flake 52 | \Flake\Framework::bootstrap(); 53 | 54 | # Bootstrapping Baïkal 55 | \Baikal\Framework::bootstrap(); 56 | 57 | try { 58 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 59 | } catch (\Exception $e) { 60 | exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); 61 | } 62 | 63 | if (!isset($config['system']["cal_enabled"]) || $config['system']["cal_enabled"] !== true) { 64 | throw new ErrorException("Baikal CalDAV is disabled.", 0, 255, __FILE__, __LINE__); 65 | } 66 | 67 | $server = new \Baikal\Core\Server( 68 | $config['system']["cal_enabled"], 69 | $config['system']["card_enabled"], 70 | $config['system']["dav_auth_type"], 71 | $config['system']["auth_realm"], 72 | $GLOBALS['DB']->getPDO(), 73 | PROJECT_BASEURI . 'cal.php/' 74 | ); 75 | $server->start(); 76 | -------------------------------------------------------------------------------- /html/card.php: -------------------------------------------------------------------------------- 1 | 7 | * All rights reserved 8 | * 9 | * http://sabre.io/baikal 10 | * 11 | * This script is part of the Baïkal Server project. The Baïkal 12 | * Server project is free software; you can redistribute it 13 | * and/or modify it under the terms of the GNU General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2 of the License, or (at your option) any later version. 16 | * 17 | * The GNU General Public License can be found at 18 | * http://www.gnu.org/copyleft/gpl.html. 19 | * 20 | * This script is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * This copyright notice MUST APPEAR in all copies of the script! 26 | ***************************************************************/ 27 | 28 | use Symfony\Component\Yaml\Yaml; 29 | 30 | ini_set("session.cookie_httponly", 1); 31 | ini_set("display_errors", 0); 32 | ini_set("log_errors", 1); 33 | 34 | define("BAIKAL_CONTEXT", true); 35 | define("PROJECT_CONTEXT_BASEURI", "/"); 36 | 37 | if (file_exists(getcwd() . "/Core")) { 38 | # Flat FTP mode 39 | define("PROJECT_PATH_ROOT", getcwd() . "/"); #./ 40 | } else { 41 | # Dedicated server mode 42 | define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ 43 | } 44 | 45 | if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { 46 | exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); 47 | } 48 | 49 | require PROJECT_PATH_ROOT . 'vendor/autoload.php'; 50 | 51 | # Bootstrapping Flake 52 | \Flake\Framework::bootstrap(); 53 | 54 | # Bootstrapping Baïkal 55 | \Baikal\Framework::bootstrap(); 56 | 57 | try { 58 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 59 | } catch (\Exception $e) { 60 | exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); 61 | } 62 | 63 | if (!isset($config['system']["card_enabled"]) || $config['system']["card_enabled"] !== true) { 64 | throw new ErrorException("Baikal CardDAV is disabled.", 0, 255, __FILE__, __LINE__); 65 | } 66 | 67 | $server = new \Baikal\Core\Server( 68 | $config['system']["cal_enabled"], 69 | $config['system']["card_enabled"], 70 | $config['system']["dav_auth_type"], 71 | $config['system']["auth_realm"], 72 | $GLOBALS['DB']->getPDO(), 73 | PROJECT_BASEURI . 'card.php/' 74 | ); 75 | $server->start(); 76 | -------------------------------------------------------------------------------- /html/dav.php: -------------------------------------------------------------------------------- 1 | 7 | * All rights reserved 8 | * 9 | * http://sabre.io/baikal 10 | * 11 | * This script is part of the Baïkal Server project. The Baïkal 12 | * Server project is free software; you can redistribute it 13 | * and/or modify it under the terms of the GNU General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2 of the License, or (at your option) any later version. 16 | * 17 | * The GNU General Public License can be found at 18 | * http://www.gnu.org/copyleft/gpl.html. 19 | * 20 | * This script is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * This copyright notice MUST APPEAR in all copies of the script! 26 | ***************************************************************/ 27 | 28 | use Symfony\Component\Yaml\Yaml; 29 | 30 | ini_set("session.cookie_httponly", 1); 31 | ini_set("display_errors", 0); 32 | ini_set("log_errors", 1); 33 | 34 | define("BAIKAL_CONTEXT", true); 35 | define("PROJECT_CONTEXT_BASEURI", "/"); 36 | 37 | if (file_exists(getcwd() . "/Core")) { 38 | # Flat FTP mode 39 | define("PROJECT_PATH_ROOT", getcwd() . "/"); #./ 40 | } else { 41 | # Dedicated server mode 42 | define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ 43 | } 44 | 45 | if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) { 46 | exit('

Incomplete installation

Baïkal dependencies have not been installed. If you are a regular user, this means that you probably downloaded the wrong zip file.

To install the dependencies manually, execute "composer install" in the Baïkal root folder.

'); 47 | } 48 | require PROJECT_PATH_ROOT . 'vendor/autoload.php'; 49 | 50 | # Bootstrapping Flake 51 | \Flake\Framework::bootstrap(); 52 | 53 | # Bootstrapping Baïkal 54 | \Baikal\Framework::bootstrap(); 55 | 56 | try { 57 | $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml"); 58 | } catch (\Exception $e) { 59 | exit('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); 60 | } 61 | 62 | $server = new \Baikal\Core\Server( 63 | $config['system']["cal_enabled"], 64 | $config['system']["card_enabled"], 65 | $config['system']["dav_auth_type"], 66 | $config['system']["auth_realm"], 67 | $GLOBALS['DB']->getPDO(), 68 | PROJECT_BASEURI . 'dav.php/' 69 | ); 70 | $server->start(); 71 | -------------------------------------------------------------------------------- /html/index.php: -------------------------------------------------------------------------------- 1 | ../Core/Frameworks/Baikal/WWWRoot/index.php -------------------------------------------------------------------------------- /html/res/core: -------------------------------------------------------------------------------- 1 | ../../Core/Resources/Web -------------------------------------------------------------------------------- /html/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 0 3 | excludePaths: 4 | - Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php 5 | - Core/Resources/Web/BaikalAdmin/GlyphiconsPro/generate-sprite.php 6 | - html/res/core/BaikalAdmin/GlyphiconsPro/generate-sprite.php 7 | ignoreErrors: 8 | - 9 | message: '#Instantiated class Flake\\Core\\Exception not found.#' 10 | path: Core/Frameworks/Flake/Util/Frameworks.php 11 | - 12 | message: '#Call to static method compileCss\(\) on an unknown class Frameworks\\LessPHP\\Delegate.#' 13 | path: Core/Frameworks/Flake/Controller/Page.php 14 | - 15 | message: '#Access to undefined constant Flake\\Core\\Model::LABELFIELD.#' 16 | path: Core/Frameworks/Flake/Core/Model.php 17 | --------------------------------------------------------------------------------