Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fsfahrttool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fsini-informatik
fsfahrttool
Commits
bb83ad30
Commit
bb83ad30
authored
8 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
clean up commons.php
parent
02b57d55
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
registration-system/frameworks/commons.php
+2
-70
2 additions, 70 deletions
registration-system/frameworks/commons.php
with
2 additions
and
70 deletions
registration-system/frameworks/commons.php
+
2
−
70
View file @
bb83ad30
...
@@ -25,72 +25,6 @@ function comm_from_mysqlDate($date){
...
@@ -25,72 +25,6 @@ function comm_from_mysqlDate($date){
return date('
d
.
m
.
Y
', strtotime($date));
return date('
d
.
m
.
Y
', strtotime($date));
}
}
function comm_get_possible_dates($db, $fid){
$dates = $db->get("fahrten", ["von", "bis"], ["fahrt_id" => $fid]);
$end = new DateTime($dates['
bis
']);
$period = new DatePeriod(
new DateTime($dates['
von
']),
new DateInterval('
P1D
'),
$end->modify( '
+
1
day
' )
);
$ret = [];
foreach($period as $d){
array_push($ret, $d->format("d.m.Y"));
}
return $ret;
}
/*
* returns TRUE iff registration is allowed
*/
function comm_isopen_fid($db_handle, $fid){
$ret = comm_isopen_fid_helper($db_handle, $fid);
return $ret == 0;
}
/*
* returns value depending on registration status
* 0 = registration open (slots available)
* 1 = all slots taken -> waitlist open
* 2 = registration closed!
*/
function comm_isopen_fid_helper($db_handle, $fid){
comm_verbose(3,"checking if fid ". $fid . " is open");
$open = $db_handle->has('
fahrten
', ['
AND
' => ['
fahrt_id
'=>$fid, '
regopen
'=>1]]);
if(!$open)
return 2;
$cnt = $db_handle->count("bachelor", ["AND"=>
["backstepped" => NULL,
"fahrt_id" => $fid]]);
$max = $db_handle->get("fahrten", "max_bachelor", ["fahrt_id" => $fid]);
$wl = $db_handle->count('
waitlist
', ['
AND
' =>
["transferred" => NULL,
"fahrt_id" => $fid]]);
comm_verbose(3,"cnt: ".$cnt.", max: ".$max.", open: ".($open ? "yes" : "no"));
if ( $cnt < $max && $wl == 0 )
return 0;
return 1;
}
function comm_generate_key($db_handle, $check, $conditions){
again:
$bytes = openssl_random_pseudo_bytes(8);
$hex = bin2hex($bytes);
comm_verbose(3,"generated hex for test: ".$hex);
foreach($check as $table => $col){
if($db_handle->has($table, array("AND"=>[$col => $hex]))) goto again;
}
comm_verbose(2,"generated hex: ".$hex);
return $hex;
}
/*
/*
* sends mail
* sends mail
*
*
...
@@ -99,10 +33,8 @@ function comm_generate_key($db_handle, $check, $conditions){
...
@@ -99,10 +33,8 @@ function comm_generate_key($db_handle, $check, $conditions){
*
*
* returns true/false depending on success
* returns true/false depending on success
*/
*/
function comm_send_mail($db_handle, $addr, $cont, $from = NULL, $bcc = NULL){
function comm_send_mail($addr, $cont, $from = NULL, $bcc = NULL){
global $config_current_fahrt_id, $config_mailtag;
global $config_mailtag;
if(is_null($from))
$from = $db_handle->get("fahrten", "kontakt", array("fahrt_id"=>$config_current_fahrt_id));
$subj = "Wichtige Information";
$subj = "Wichtige Information";
$mess = $cont;
$mess = $cont;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment