├── .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 | Lightweight CalDAV+CardDAV server. Baïkal
4 |
Baïkal is running alright.
12 |
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'] . ".Configure Baïkal Database.
5 |Configure your new Baïkal {{ baikalversion }} installation.
5 | 6 | {% if oldConfigSystem %} 7 |{{ message }}
5 |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 |Please authenticate to access Baïkal Web Admin.
5 |Manage Address Books for{{ modellabel }}.
5 | 6 | 7 |Display name | 13 |Contacts | 14 |Description | 15 |16 | |
---|---|---|---|
{{ addressbook.label|escape }} | 22 |{{ addressbook.contacts|escape }} | 23 |{{ addressbook.description|escape }} | 24 |25 | 30 | | 31 |
Manage Calendars for{{ modellabel }}.
5 | 6 | 7 |Display name | 13 |Events | 14 |Description | 15 |16 | |
---|---|---|---|
{{ calendar.label|escape }}{%if calendar.instanced%} Has instances{% endif %} | 22 |{{ calendar.events|escape }} | 23 |{{ calendar.description|escape }} | 24 |25 | 30 | | 31 |
Manage Baïkal user accounts, and associated resources.
5 | 6 |
12 | {{ user.username|escape }} 13 | {{ user.displayname|escape }} <{{ user.email|escape }}> 14 | |
15 |
16 |
17 | |
24 |
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 = '
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 |" . $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 |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('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('
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('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('
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('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 | --------------------------------------------------------------------------------