<?php
// check the files in lva_timed and move them to lva if
// activation time is reached
// todo: make required fields in "LVA erfassen" and depending files.
// copyright 2004 reinhard . lins @fahrvergnuegen. at

//
include ("./a_config.php");
include ("./getfilelist.inc.php");
$now = time();

// get list of lva_timed files
$timedlvafiles = getfilelist($lvatimeddir);

if (sizeof($timedlvafiles) == "0") die(); //do nothing if there are no timed files

// now get the start date entry of each lva
$t=0;
  foreach ($timedlvafiles as $datei)
   {

   $lvaline[0]=file($lvatimeddir."/".$datei);
   $lva[]=explode(",",$lvaline[0][0]);
      $startdate[]=$lva[$t][5];
      $starttime[]=$lva[$t][6];

      $starttc[] = mktime(substr($starttime[$t],0,2),substr($starttime[$t],3,2),0,substr($startdate[$t],5,2),substr($startdate[$t],8,2),substr($startdate[$t],0,4));
      if ($now >= $starttc[$t]) // copy the file to lvadir and delete  timed file
         {
         @copy("$lvatimeddir/$datei","$lvadir/$datei");
         unlink("$lvatimeddir/$datei");
         }
       $t++;
   }


?>
