Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_TIMEZONE=Europe/Berlin
APP_LOCALE=de
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=de_DE
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
Expand Down Expand Up @@ -45,7 +46,7 @@ SESSION_DOMAIN=null
#MAIL_PORT=1025
#MAIL_USERNAME=null
#MAIL_PASSWORD=null
#MAIL_ENCRYPTION=null
MAIL_SCHEME=null
#MAIL_FROM_ADDRESS="hello@example.com"
#MAIL_FROM_NAME="${APP_NAME}"

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/public/build
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.testing
Expand All @@ -15,6 +16,7 @@ Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.nova
/.vscode
/public/css/app.css
/public/js/app.js
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/LegacyDeleteBudgetPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LegacyDeleteBudgetPlan extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$hhp = LegacyBudgetPlan::findOrFail($this->argument('id'));
$groups = $hhp->budgetGroups();
Expand Down
7 changes: 4 additions & 3 deletions app/Console/Commands/LegacyMigrateEncryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use forms\projekte\auslagen\AuslagenHandler2;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Env;
use Illuminate\Support\Facades\DB;

class LegacyMigrateEncryption extends Command
Expand All @@ -32,7 +33,7 @@ class LegacyMigrateEncryption extends Command
*/
public function handle(): int
{
if (! isset($_ENV['CHAT_PRIVATE_KEY'], $_ENV['CHAT_PUBLIC_KEY'], $_ENV['IBAN_SECRET_KEY'])) {
if (! Env::get('CHAT_PRIVATE_KEY') !== null && Env::get('CHAT_PUBLIC_KEY') !== null && Env::get('IBAN_SECRET_KEY') !== null) {
$this->error('Please set chat private key and public key / IBAN_SECRET_KEY');

return self::FAILURE;
Expand All @@ -49,13 +50,13 @@ public function handle(): int
if (str_starts_with($message->text, '$enc$')) {
// old prefix
$text = substr($text, strlen('$enc$'));
$text = ChatHandler::legacyDecryptMessage($text, $_ENV['CHAT_PRIVATE_KEY']);
$text = ChatHandler::legacyDecryptMessage($text, Env::get('CHAT_PRIVATE_KEY'));
$message->text = \Crypt::encryptString($text);
$message->save();
$count++;
} elseif ($message->type === -1) {
// not used productive anymore, was "private message"
$text = ChatHandler::legacyDecryptMessage($text, $_ENV['CHAT_PRIVATE_KEY']);
$text = ChatHandler::legacyDecryptMessage($text, Env::get('CHAT_PRIVATE_KEY'));
$message->text = \Crypt::encryptString($text);
$message->save();
$count++;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/StuFisHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class StuFisHealth extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$output = collect([
'version' => config('stufis.version', ''),
Expand Down
11 changes: 5 additions & 6 deletions app/Http/Controllers/BudgetPlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
use App\Models\Enums\BudgetType;
use App\Models\FiscalYear;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Gate;

class BudgetPlanController extends Controller
{
public function index()
{
$this->authorize('viewAny', BudgetPlan::class);
Gate::authorize('viewAny', BudgetPlan::class);

$years = FiscalYear::orderByDesc('start_date')->get();

Expand All @@ -23,7 +24,7 @@ public function index()
public function show(int $plan_id)
{
$plan = BudgetPlan::findOrFail($plan_id);
$this->authorize('view', $plan);
Gate::authorize('view', $plan);
$items = [
BudgetType::INCOME->slug() => $plan->budgetItemsTree(BudgetType::INCOME),
BudgetType::EXPENSE->slug() => $plan->budgetItemsTree(BudgetType::EXPENSE),
Expand All @@ -34,7 +35,7 @@ public function show(int $plan_id)

public function create(): RedirectResponse
{
$this->authorize('create', BudgetPlan::class);
Gate::authorize('create', BudgetPlan::class);
$plan = BudgetPlan::create(['state' => 'draft']);
$groups = $plan->budgetItems()->createMany([
['is_group' => 1, 'budget_type' => BudgetType::INCOME, 'position' => 0, 'short_name' => 'E1'],
Expand All @@ -51,8 +52,6 @@ public function create(): RedirectResponse
]);
});

return redirect()->route('budget-plan.edit', ['plan_id' => $plan->id]);
return to_route('budget-plan.edit', ['plan_id' => $plan->id]);
}
}


10 changes: 1 addition & 9 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

abstract class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
abstract class Controller {}
6 changes: 3 additions & 3 deletions app/Http/Controllers/Legacy/DeleteExpenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public function __invoke(int $expense_id)
$userPerm =
AuthHandler::getInstance()->hasGroup('ref-finanzen-hv')
|| $project->creator->id === \Auth::user()->id
|| explode(';', $expense->created)[1] === \Auth::user()->username;
|| explode(';', (string) $expense->created)[1] === \Auth::user()->username;
// authorize state
$deletableState = ! in_array(explode(';', $expense->state)[0], ['instructed', 'booked'], true);
$deletableState = ! in_array(explode(';', (string) $expense->state)[0], ['instructed', 'booked'], true);

if ($userPerm === false || $deletableState === false) {
abort(403);
Expand Down Expand Up @@ -53,6 +53,6 @@ public function __invoke(int $expense_id)
});
\DB::commit();

return redirect()->route('legacy.dashboard', ['sub' => 'mygremium']);
return to_route('legacy.dashboard', ['sub' => 'mygremium']);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Legacy/DeleteProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function __invoke(int $project_id)
$project->posts()->delete();
$project->delete();

return redirect()->route('legacy.dashboard', ['sub' => 'mygremium']);
return to_route('legacy.dashboard', ['sub' => 'mygremium']);
}
}
8 changes: 4 additions & 4 deletions app/Http/Controllers/Legacy/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Exports\LegacyBudgetExport;
use App\Http\Controllers\Controller;
use App\Models\Legacy\LegacyBudgetPlan;
use Carbon\Carbon;
use Illuminate\Support\Facades\Date;
use Maatwebsite\Excel\Excel;

class ExportController extends Controller
Expand All @@ -18,10 +18,10 @@ public function budgetPlan(int $id, string $filetype)
};
$plan = LegacyBudgetPlan::findOrFail($id);
$today = today()->format('Y-m-d');
$start = Carbon::make($plan->von)?->format('y-m');
$end = Carbon::make($plan->bis)?->format('y-m');
$start = Date::make($plan->von)?->format('y-m');
$end = Date::make($plan->bis)?->format('y-m');
$fileName = "$today HHP $start".($end ? " bis $end" : '').".$filetype";

return (new LegacyBudgetExport($plan))->download($fileName, $writerType);
return new LegacyBudgetExport($plan)->download($fileName, $writerType);
}
}
4 changes: 3 additions & 1 deletion app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\Legacy\Project;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;

class ProjectController extends Controller
{
Expand Down Expand Up @@ -36,7 +37,8 @@ public function store(Request $request)
*/
public function show(Project $project)
{
$this->authorize('view', $project);
Gate::authorize('view', $project);

return view('project.show', compact('project'));
}

Expand Down
9 changes: 5 additions & 4 deletions app/Livewire/ChatPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ChatPanel extends Component
{
public $content = "";
public $content = '';

public $targetType;

Expand All @@ -30,11 +30,12 @@ public function render()
return view('livewire.chat-panel', ['messages' => $messages]);
}

public function save() {
public function save()
{

$this->validate(['content' => 'required|min:1']);

$cleanContent = strip_tags($this->content, '<p><br><strong><em><ul><ol><li><a><h1><h2><h3>');
$cleanContent = strip_tags((string) $this->content, '<p><br><strong><em><ul><ol><li><a><h1><h2><h3>');

ChatMessage::create([
'text' => $cleanContent,
Expand All @@ -46,6 +47,6 @@ public function save() {
'timestamp' => now(),
]);

$this->content = "";
$this->content = '';
}
}
5 changes: 2 additions & 3 deletions app/Livewire/CreateAntrag.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use App\Livewire\Forms\ActorForm;
use App\Livewire\Forms\FundingRequestForm;
use App\Livewire\Forms\ProjectBudgetForm;
use App\Livewire\Forms\ProjectForm;
use App\Models\Actor;
use App\Models\PtfProject\Actor;
use Livewire\Attributes\Url;
use Livewire\Component;

Expand All @@ -19,7 +18,7 @@ class CreateAntrag extends Component

public ActorForm $organisationForm;

public ProjectForm $projectForm;
public $projectForm; // might have been deleted at the rework of the project view

public ProjectBudgetForm $projectBudgetForm;

Expand Down
2 changes: 1 addition & 1 deletion app/Livewire/Forms/ActorForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Livewire\Forms;

use App\Models\Actor;
use App\Models\PtfProject\Actor;
use Intervention\Validation\Rules\Bic;
use Intervention\Validation\Rules\Iban;
use Intervention\Validation\Rules\Postalcode;
Expand Down
4 changes: 2 additions & 2 deletions app/Livewire/Forms/FundingRequestForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Livewire\Forms;

use App\Models\Application;
use App\Models\Project;
use App\Models\Legacy\Project;
use App\Models\PtfProject\Application;
use Livewire\Form;

class FundingRequestForm extends Form
Expand Down
Loading
Loading