Skip to content

Commit caa14e8

Browse files
authored
Merge pull request #135 from Ente/TT-207
TT-207
2 parents 291e72b + f87d977 commit caa14e8

File tree

11 files changed

+119
-15
lines changed

11 files changed

+119
-15
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# CHANGELOG
22

3+
## v8.5.1
4+
5+
* Fixed undefined variable warning message <!-- [#133](https://github.com/Ente/timetrack/issues/133) -->
6+
* Changed app.json.sample default values
7+
* Updated README.md <!-- [#134](https://github.com/Ente/timetrack/issues/134) -->
8+
* Added `update.sh` script
9+
* Internal plugin views can now be hidden
10+
* Fix utility plugin 500 error when trying to export data for user that doesn't exist
11+
312
## v8.5
13+
414
* Fixed an issue with IDs not generated correctly for project items.
515
* Added functionality to delete and edit project items.
616
* Adding users to a project has been made easier.

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,43 @@ Simply install the software by following these steps:
6161
- Create a new database, e.g. with the name `ab` and create a dedicated user, login (`mysql -u root -p`) then e.g. `timetool`: `CREATE DATABASE ab;` and `CREATE USER 'timetool'@'localhost' IDENTIFIED BY 'yourpassword';` and `GRANT ALL PRIVILEGES ON ab.* TO 'timetool'@'localhost';` don't forget to `FLUSH PRIVILEGES;`!
6262
- Configure `app.json` (see below - required changes: `base_url`, `db_user`, `db_password`, `smtp` section and any other if your installation is different) then `mv api/v1/inc/app.json.sample app.json && cd /var/www/timetrack`
6363
- Run DB migrations: `vendor/bin/phinx migrate`
64-
- Start webserver e.g. `service apache2 stop && php -S 0.0.0.0:80` or using apache2 (then you have to configure the `sites-available` conf yourself)
65-
- You can then access TimeTrack in your browser at `http://localhost`, default login is `admin` with password `admin`. Create yourself a new admin account, login and delete the default account afterwards.
64+
- Follow "Use with ..." guides
65+
66+
#### Use with apache2.4
67+
68+
- Create a new virtual host: `sudo nano /etc/apache2/sites-available/timetrack.conf`
69+
- Content:
70+
71+
```conf
72+
<VirtualHost *:80>
73+
ServerName timetrack.yourdomain.de
74+
DocumentRoot /var/www/timetrack
75+
76+
<Directory /var/www/timetrack>
77+
AllowOverride All
78+
Require all granted
79+
</Directory>
80+
81+
ErrorLog ${APACHE_LOG_DIR}/error.log
82+
CustomLog ${APACHE_LOG_DIR}/access.log combined
83+
</VirtualHost>
84+
85+
```
86+
87+
- Enable site and module: `sudo a2ensite timetrack && a2enmod rewrite`
88+
89+
#### Use with PHP development server
90+
91+
- Start server: `cd /var/www/timetrack && php -S 0.0.0.0:80`
92+
93+
#### Finalize
94+
95+
You can now access TimeTrack in your browser at `http://localhost`, default login is `admin` with password `admin`. Create yourself a new admin account, login and delete the default account afterwards.
6696

6797
To save log files, please create the subfolder `data/logs` and make it writeable to the web server (e.g. `chown www-data:www-data data/logs && chmod 775 data/logs`).
68-
Please also make sure that the `/data` directory is writable by the webserver, aswell as the plugins directory (default: `api/v1/class/plugins/plugins`).
98+
Please also make sure that the `/data` directory is writable by the webserver, aswell as the plugins directory (default: `api/v1/class/plugins/plugins`). The `/api/v1/toil/permissions.json` also needs to be writeable by the webserver.
99+
100+
**You can run the `update.sh` script to update your instance: `sudo sh update.sh`**
69101

70102
### Configure app.json
71103

@@ -225,6 +257,9 @@ The theme the user selected is saved as a cookie, meaning it is only selected on
225257
## Updates
226258

227259
TimeTrack has to be updated in two ways: database and application.
260+
A full update on linux based machines can also be performed by executing the `update.sh` file inside the root directory. In any other cases follow the steps below:
261+
262+
If you were seeking assistance and were asked to try out the changes in a branch, please execute this command inside the timetrack root directory: `git fetch && git checkout BRANCH` - replace BRANCH with the actual branch name, e.g. TT-24 or develop.
228263

229264
### Application
230265

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.5
1+
8.5.1

api/v1/class/benutzer/benutzer.arbeit.inc.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,15 @@ public function loadUserTheme()
410410

411411
$themes = scandir($_SERVER["DOCUMENT_ROOT"] . "/assets/css");
412412
$themes = array_diff($themes, [".", ".."]);
413+
if(!isset($_COOKIE["theme"])){
414+
return "/assets/css/v8.css";
415+
}
413416
$check = in_array($_COOKIE["theme"], $themes);
414417
if ($this->get_app_ini()["general"]["force_theme"] == "true") {
415418
return $this->get_app_ini()["general"]["theme_file"];
416419
}
417420

418-
if (!isset($_COOKIE["theme"]) || !$check) {
421+
if (!$check) {
419422
return "/assets/css/v8.css";
420423
} else {
421424
return "/assets/css/" . $_COOKIE["theme"];
@@ -446,7 +449,7 @@ public function setUserTheme($theme)
446449

447450
public function checkThemeForce()
448451
{
449-
if ($this->get_app_ini()["general"]["force_theme"] == "true" || $this->get_app_ini()["general"]["force_theme"] == true) {
452+
if ($this->get_app_ini()["general"]["force_theme"] == true) {
450453
return true;
451454
} else {
452455
return false;

api/v1/class/plugins/PluginBuilder.plugins.arbeit.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,12 @@ final public function checkPluginPermissions($pluginName, $view, $user): bool
255255
if (isset($permissions['nav_permissions'][$viewName])) {
256256
$requiredPermission = $permissions['nav_permissions'][$viewName];
257257
$this->logger("{$la} Required permission for view '{$viewName}': '{$requiredPermission}'");
258-
if ($requiredPermission === 5 && $userPermissions === $adminLevel) {
259-
$this->logger("{$la} View '{$viewName}' is marked as internal placeholder. Skipping.");
260-
return true;
258+
if ($requiredPermission === 5) {
259+
$this->logger("{$la} View '{$viewName}' has permission level 5 (internal placeholder). Access denied.");
260+
return false;
261261
}
262262

263+
263264
if ($requiredPermission === $adminLevel && $userPermissions === $adminLevel) {
264265
$this->logger("{$la} User '{$user}' has admin permissions for view '{$viewName}'. Access granted.");
265266
return true;

api/v1/class/plugins/plugins/utility/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main: Main
44
namespace: utility
55
author: Ente
66
description: 'Export all data from an user and more.'
7-
version: '1.0'
7+
version: '1.1'
88
api: 0.1
99
permissions: none
1010
enabled: true

api/v1/class/plugins/plugins/utility/views/download.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@
1616
$a->benutzer()->current_user_is_admin();
1717

1818
if(!isset($_POST["username"])){
19-
$main->logger("[utility] Username not found. Aborting export...");
19+
$main->logger("[utility] Username not found in Request parameters. Aborting export...");
2020
$a->statusMessages()->redirect("error");
21+
exit();
22+
}
23+
24+
if(!$a->benutzer()->user_active($_POST["username"]) == 1){
25+
$main->logger("[utility] Username not found or user disabled. Aborting export...");
26+
$a->statusMessages()->redirect("error");
27+
exit();
2128
}
2229

2330
$main->exportAll($_POST["username"])->download();

api/v1/inc/app.json.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"auto_update": "false",
88
"timezone": "UTC",
99
"theme_file": "/assets/css/v8.css",
10-
"force_theme": "false",
10+
"force_theme": false,
1111
"demo": false,
12-
"telemetry": "enabled",
12+
"telemetry": "disabled",
1313
"telemetry_server_url": "https://telemetry.openducks.org/timetrack/submit"
1414
},
1515
"mysql": {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "TimeTrack is a PHP-written time recording tool for small businesses",
44
"type": "software",
55
"license": "GNU GPL",
6-
"version": "8.5",
6+
"version": "8.5.1",
77
"authors": [
88
{
99
"name": "Bryan Boehnke-Avan",

suite/users/settings.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@
6464
<label for="theme">Select a theme:</label>
6565
<select name="theme" id="theme" onchange="this.form.submit()">
6666
<?php
67+
$noTheme = "";
6768
if($arbeit->benutzer()->checkThemeForce()){
6869
$noTheme = "<p>You cannot select a theme, since your administrator doesn't allow this feature!</p>";
6970
} else {
70-
unset($noTheme);
71+
$noTheme = null;
7172
$arbeit->benutzer()->computeUserThemes();
7273
}
7374

0 commit comments

Comments
 (0)