public function __construct()
 {
     //wczytanie danych z pliku textowego
     $fr = new FileReader("operacje.txt");
     //odczytanie wszystkich linii z pliku
     $this->daneZPliku = $fr->getAll();
     //utworzenie z danych obiektów Operacja
     foreach ($this->daneZPliku as $linia) {
         $model = new InteligentBuildingCommunicationModel();
         $dane = explode(';', $linia);
         $model->Operation = $this->getOperacja($dane);
         $model->HomeAddress = $dane[0];
         $model->DeviceName = $dane[1];
         $this->modele[] = $model;
     }
 }
 /**
  * @return null|string The next line to read, null on end
  */
 public function getLine()
 {
     if ($this->logFiles[$this->currentFile] != $this->lastFile) {
         $this->lastFile = $this->logFiles[$this->currentFile];
         return FileReader::getDateFromFilename($this->lastFile);
     }
     $line = fgets($this->currentHandle);
     if ($line == null) {
         fclose($this->currentHandle);
         $this->currentFile++;
         if ($this->currentFile == count($this->logFiles)) {
             return null;
         }
         $this->currentHandle = fopen($this->logFiles[$this->currentFile], "r");
         $this->lastFile = $this->logFiles[$this->currentFile];
         return FileReader::getDateFromFilename($this->lastFile);
     }
     return $line;
 }
Example #3
0
function vplan_single($pi = '')
{
    global $output;
    if ($_GET['key'] != 'kmyxl09') {
        $output->secure();
    }
    $user_pi = '0';
    if (isset($_GET['d'])) {
        $user_pi = $_GET['d'];
    }
    if (strlen($pi) == 0) {
        $pi = $user_pi;
    }
    (int) $pi;
    $vplan = get_vplan($pi);
    $vars = vplan2html_single($vplan['text']);
    $vars['%url%'] = sessionurl('single.php?d=' . $pi);
    $vars['%titel%'] = 'Vertretungsplan';
    echo FileReader::readFile('single.html', $vars);
}
Example #4
0
 function ServletContext($web_xml_file)
 {
     $web_xml_file = new File($web_xml_file);
     if (File::validClass($web_xml_file) && $web_xml_file->exists()) {
         $this->file =& $web_xml_file;
         $cache_file = new File($web_xml_file->getFilePath() . 'cached');
         $valid_cache = FALSE;
         if ($cache_file->exists() && $web_xml_file->lastModified() == $cache_file->lastModified()) {
             $this->config = @unserialize(FileReader::readFileContent($cache_file));
             if (ServletContext::validClass($this->config)) {
                 $valid_cache = TRUE;
             }
         }
         if (!$valid_cache) {
             $this->config =& ServletXMLConfigReader::readXMLConfig(new FileReader($web_xml_file));
             FileWriter::writeToFile($cache_file, serialize($this->config), $web_xml_file->lastModified());
         }
     }
     if (isset($this->config)) {
         $this->initServletContext();
     }
 }
Example #5
0
 /**
  * Gets the current Phing version based on VERSION.TXT file.
  * @return string
  * @throws BuildException - if unable to find version file.
  */
 public static function getPhingVersion()
 {
     $versionPath = self::getResourcePath("phing/etc/VERSION.TXT");
     if ($versionPath === null) {
         $versionPath = self::getResourcePath("etc/VERSION.TXT");
     }
     if ($versionPath === null) {
         throw new ConfigurationException("No VERSION.TXT file found; try setting phing.home environment variable.");
     }
     try {
         // try to read file
         $buffer = null;
         $file = new PhingFile($versionPath);
         $reader = new FileReader($file);
         $reader->readInto($buffer);
         $buffer = trim($buffer);
         //$buffer = "PHING version 1.0, Released 2002-??-??";
         $phingVersion = $buffer;
     } catch (IOException $iox) {
         throw new ConfigurationException("Can't read version information file");
     }
     return $phingVersion;
 }
Example #6
0
require_once './eagle/models/Comment.php';
require_once './eagle/models/Defense.php';
require_once './eagle/models/PitScouting.php';
$app->group('/team', function () {
    $this->get('/{url:.*\\/}', function ($req, $res, $args) {
        header('Location:/team/' . trim($args['url'], '/'));
        exit;
    });
    $this->get('/{team:[0-9]{1,4}}', function ($req, $res, $args) {
        Auth::redirectIfNotLoggedIn();
        $team = FileReader::getTeam($args['team']);
        if (!$team) {
            Downloader::getTeam($args['team']);
            header('Refresh:0');
        }
        $events = FileReader::getEventsForTeam($args['team']);
        if (!$events) {
            Downloader::getEventsForTeam($args['team']);
            header('Refresh:0');
        }
        $comments = Comment::where('team_id', $team->team_number);
        $defense = Defense::where('team_id', $args['team'])->orderBy('id', 'desc')->first();
        $defenses = array();
        $author = $defense ? $defense->author : false;
        if ($defense) {
            $defenses['Low Bar'] = $defense->low_bar;
            $defenses['Portcullis'] = $defense->portcullis;
            $defenses['Cheval de Frsie'] = $defense->cheval_de_frise;
            $defenses['Moat'] = $defense->moat;
            $defenses['Ramparts'] = $defense->ramparts;
            $defenses['Drawbridge'] = $defense->drawbridge;
Example #7
0
<?php

include 'var.php';
require_once $root . 'class_file.php';
$html_titel[] = 'FAQ';
$html_headline[] = '<a title="Frequently Asked Questions (H&auml;ufig gestellte Fragen)">FAQ</a>';
$inhalt = FileReader::readFile('faq.html');
$output->out('<h1><a title="Frequently Asked Questions (H&auml;ufig gestellte Fragen)">FAQ</a></h1>' . $inhalt);
Example #8
0
 /**
  * Execute the input script with Velocity
  *
  * @throws BuildException
  *                        BuildExceptions are thrown when required attributes are missing.
  *                        Exceptions thrown by Velocity are rethrown as BuildExceptions.
  */
 public function main()
 {
     // Make sure the template path is set.
     if (empty($this->templatePath)) {
         throw new BuildException("The template path needs to be defined!");
     }
     // Make sure the control template is set.
     if ($this->controlTemplate === null) {
         throw new BuildException("The control template needs to be defined!");
     }
     // Make sure the output directory is set.
     if ($this->outputDirectory === null) {
         throw new BuildException("The output directory needs to be defined!");
     }
     // Make sure there is an output file.
     if ($this->outputFile === null) {
         throw new BuildException("The output file needs to be defined!");
     }
     // Setup Smarty runtime.
     // Smarty uses one object to store properties and to store
     // the context for the template (unlike Velocity).  We setup this object, calling it
     // $this->context, and then initControlContext simply zeros out
     // any assigned variables.
     $this->context = new Capsule();
     if ($this->templatePath !== null) {
         $this->log("Using templatePath: " . $this->templatePath);
         $this->context->setTemplatePath($this->templatePath);
     }
     // Make sure the output directory exists, if it doesn't
     // then create it.
     $outputDir = new PhingFile($this->outputDirectory);
     if (!$outputDir->exists()) {
         $this->log("Output directory does not exist, creating: " . $outputDir->getAbsolutePath());
         $outputDir->mkdirs();
     }
     $this->context->setOutputDirectory($outputDir->getAbsolutePath());
     $path = $this->outputDirectory . DIRECTORY_SEPARATOR . $this->outputFile;
     $this->log("Generating to file " . $path);
     //$writer = new FileWriter($path);
     // The generator and the output path should
     // be placed in the init context here and
     // not in the generator class itself.
     $c = $this->initControlContext();
     // Set any variables that need to always
     // be loaded
     $this->populateInitialContext($c);
     // Feed all the options into the initial
     // control context so they are available
     // in the control/worker templates.
     if ($this->contextProperties !== null) {
         foreach ($this->contextProperties->keys() as $property) {
             $value = $this->contextProperties->getProperty($property);
             // Special exception (from Texen)
             // for properties ending in file.contents:
             // in that case we dump the contents of the file
             // as the "value" for the Property.
             if (preg_match('/file\\.contents$/', $property)) {
                 // pull in contents of file specified
                 $property = substr($property, 0, strpos($property, "file.contents") - 1);
                 // reset value, and then
                 // read in the contents of the file into that var
                 $value = "";
                 $f = new PhingFile($this->project->resolveFile($value)->getCanonicalPath());
                 if ($f->exists()) {
                     $fr = new FileReader($f);
                     $fr->readInto($value);
                 }
             }
             // if ends with file.contents
             if (StringHelper::isBoolean($value)) {
                 $value = StringHelper::booleanValue($value);
             }
             $c->put($property, $value);
         }
         // foreach property
     }
     // if contextProperties !== null
     try {
         $this->log("Parsing control template: " . $this->controlTemplate);
         $c->parse($this->controlTemplate, $path);
     } catch (Exception $ioe) {
         throw new BuildException("Cannot write parsed template: " . $ioe->getMessage());
     }
     $this->cleanup();
 }
Example #9
0
 public function getRenderedBody()
 {
     $reader = new FileReader($this->fileInputStream);
     return $reader->readAll();
 }
Example #10
0
    }
}
class INIFileReader
{
    public function read($filePath)
    {
        return fopen($filePath, 'r');
    }
}
class FileReader
{
    public function read($filePath)
    {
        $extension = substr($filePath, -3);
        switch ($extension) {
            case 'ini':
                $reader = new INIFileReader();
                break;
            case 'xml':
                $reader = new XMLFileReader();
                break;
            default:
                return false;
                break;
        }
        return $reader->read($filePath);
    }
}
$reader = new FileReader();
$reader->read("test.ini");
$reader = new INIFileReader();
Example #11
0
 /**
  * Gets the current Phing version based on VERSION.TXT file.
  *
  * @throws ConfigurationException
  *
  * @return string
  */
 public static function getPhingVersion()
 {
     $path = dirname(dirname(dirname(__FILE__)));
     $gitInformation = self::getGitInformation($path);
     if ($gitInformation) {
         return "Phing " . $gitInformation;
     }
     $versionPath = self::getResourcePath("phing/etc/VERSION.TXT");
     if ($versionPath === null) {
         $versionPath = self::getResourcePath("etc/VERSION.TXT");
     }
     if ($versionPath === null) {
         throw new ConfigurationException("No VERSION.TXT file found; try setting phing.home environment variable.");
     }
     try {
         // try to read file
         $file = new PhingFile($versionPath);
         $reader = new FileReader($file);
         $phingVersion = trim($reader->read());
     } catch (IOException $iox) {
         throw new ConfigurationException("Can't read version information file");
     }
     return "Phing " . $phingVersion;
 }
Example #12
0
 public function parseSpline(FileReader $iter, $matrix)
 {
     $line = $iter->current();
     echo "New Spline: " . $iter->key() . "\n";
     $d = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
     $total = $d[13];
     echo "Parsing {$total} points\n";
     $count = 0;
     $points = array();
     $state = 1;
     // fetch points
     $iter->next();
     // advance to next line
     foreach ($iter as $line) {
         $d = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
         //echo implode(",",$d)."\n";
         switch ($state) {
             case 1:
                 $points[] = transformPoint($matrix, (object) array('x' => $d[0], 'y' => $d[1]));
                 ++$count;
                 if ($count == $total) {
                     $state = 2;
                     $count = 0;
                 }
                 break;
             case 2:
                 $count += count($d);
                 if ($count >= $total) {
                     break 2;
                 }
                 break;
         }
     }
     // finished spline
     echo "Ending Spline: " . $iter->key() . "\n";
     return $points;
 }
Example #13
0
 /**
  * Reads stream, applies XSLT and returns resulting stream.
  * @return string transformed buffer.
  * @throws BuildException - if XSLT support missing, if error in xslt processing
  */
 function read($len = null)
 {
     if (!class_exists('XSLTProcessor')) {
         throw new BuildException("Could not find the XSLTProcessor class. Make sure PHP has been compiled/configured to support XSLT.");
     }
     if ($this->processed === true) {
         return -1;
         // EOF
     }
     if (!$this->getInitialized()) {
         $this->_initialize();
         $this->setInitialized(true);
     }
     // Read XML
     $_xml = null;
     while (($data = $this->in->read($len)) !== -1) {
         $_xml .= $data;
     }
     if ($_xml === null) {
         // EOF?
         return -1;
     }
     if (empty($_xml)) {
         $this->log("XML file is empty!", Project::MSG_WARN);
         return '';
         // return empty string, don't attempt to apply XSLT
     }
     // Read XSLT
     $_xsl = null;
     $xslFr = new FileReader($this->xslFile);
     $xslFr->readInto($_xsl);
     $this->log("Tranforming XML " . $this->in->getResource() . " using style " . $this->xslFile->getPath(), Project::MSG_VERBOSE);
     $out = '';
     try {
         $out = $this->process($_xml, $_xsl);
         $this->processed = true;
     } catch (IOException $e) {
         throw new BuildException($e);
     }
     return $out;
 }
 /**
  * Test for non existing file
  *
  * @return void
  */
 public function testForNonExistingFile()
 {
     $file = new FileReader('./path/for/no/file.txt');
     $this->assertFalse($file->FileReader('./path/for/no/file.txt'));
 }
 /**
  * @test
  * @dataProvider jsonFileProvider
  */
 public function executeTestCasesFor($file)
 {
     $this->fileReader->setFile($file);
     $this->runTestCaseFile(new JsonTestCaseFileHandler($this->fileReader));
 }
 /**
  * Return md5 signature of a file
  *
  * @param string $FilePath
  * @return string
  */
 function Read($FilePath)
 {
     $Content = parent::Read($FilePath);
     if ($Content !== false) {
         $Content = md5($Content);
     }
     return $Content;
 }
Example #17
0
 function loadFromStream($filename)
 {
     $buffers = new StringBuffer();
     $file = NULL;
     if (File::validClass($filename)) {
         $file = $filename;
     } else {
         $file = new File($filename);
     }
     $filereader = new FileReader($file);
     while ($c = $filereader->read()) {
         $buffers->append($c);
     }
     $this->str = $buffers->toString();
 }
Example #18
0
 function getPhingVersion()
 {
     $versionPath = self::getResourcePath("phing/etc/VERSION.TXT");
     if ($versionPath === null) {
         $versionPath = self::getResourcePath("etc/VERSION.TXT");
     }
     try {
         // try to read file
         $buffer = null;
         $file = new PhingFile($versionPath);
         $reader = new FileReader($file);
         $reader->readInto($buffer);
         $buffer = trim($buffer);
         //$buffer = "PHING version 1.0, Released 2002-??-??";
         $phingVersion = $buffer;
     } catch (IOException $iox) {
         print "Can't read version information file\n";
         throw new BuildException("Build failed");
     }
     return $phingVersion;
 }
 /**
  * Constructor of the class
  *
  * @param String $path2File path of the ldif file to read
  * @param boolean $continuous_mode 1 if continuous mode operation, 0 otherwise
  */
 function LdifReader($path2File, $continuous_mode = 0)
 {
     parent::FileReader($path2File);
     $this->continuous_mode = $continuous_mode;
     $this->_LdifReader();
 }
Example #20
0
 /**
  * Execute the input script with Velocity
  *
  * @throws BuildException
  *                        BuildExceptions are thrown when required attributes are missing.
  *                        Exceptions thrown by Velocity are rethrown as BuildExceptions.
  */
 public function main()
 {
     // Make sure the template path is set.
     if (empty($this->templatePath)) {
         throw new BuildException("The template path needs to be defined!");
     }
     // Make sure the control template is set.
     if ($this->controlTemplate === null) {
         throw new BuildException("The control template needs to be defined!");
     }
     // Make sure the output directory is set.
     if ($this->outputDirectory === null) {
         throw new BuildException("The output directory needs to be defined!");
     }
     // Make sure there is an output file.
     if ($this->outputFile === null) {
         throw new BuildException("The output file needs to be defined!");
     }
     // Setup Smarty runtime.
     // Smarty uses one object to store properties and to store
     // the context for the template (unlike Velocity).  We setup this object, calling it
     // $this->context, and then initControlContext simply zeros out
     // any assigned variables.
     //
     // Use the smarty backwards compatibility layer if existent.
     if (class_exists('SmartyBC')) {
         $this->context = new SmartyBC();
     } else {
         $this->context = new Smarty();
     }
     if ($this->compilePath !== null) {
         $this->log("Using compilePath: " . $this->compilePath);
         $this->context->compile_dir = $this->compilePath;
     }
     if ($this->configPath !== null) {
         $this->log("Using configPath: " . $this->configPath);
         $this->context->config_dir = $this->configPath;
     }
     if ($this->forceCompile !== null) {
         $this->context->force_compile = $this->forceCompile;
     }
     if ($this->leftDelimiter !== null) {
         $this->context->left_delimiter = $this->leftDelimiter;
     }
     if ($this->rightDelimiter !== null) {
         $this->context->right_delimiter = $this->rightDelimiter;
     }
     if ($this->templatePath !== null) {
         $this->log("Using templatePath: " . $this->templatePath);
         $this->context->template_dir = $this->templatePath;
     }
     $smartyCompilePath = new PhingFile($this->context->compile_dir);
     if (!$smartyCompilePath->exists()) {
         $this->log("Compile directory does not exist, creating: " . $smartyCompilePath->getPath(), Project::MSG_VERBOSE);
         if (!$smartyCompilePath->mkdirs()) {
             throw new BuildException("Smarty needs a place to compile templates; specify a 'compilePath' or create " . $this->context->compile_dir);
         }
     }
     // Make sure the output directory exists, if it doesn't
     // then create it.
     $file = new PhingFile($this->outputDirectory);
     if (!$file->exists()) {
         $this->log("Output directory does not exist, creating: " . $file->getAbsolutePath());
         $file->mkdirs();
     }
     $path = $this->outputDirectory . DIRECTORY_SEPARATOR . $this->outputFile;
     $this->log("Generating to file " . $path);
     $writer = new FileWriter($path);
     // The generator and the output path should
     // be placed in the init context here and
     // not in the generator class itself.
     $c = $this->initControlContext();
     // Set any variables that need to always
     // be loaded
     $this->populateInitialContext($c);
     // Feed all the options into the initial
     // control context so they are available
     // in the control/worker templates.
     if ($this->contextProperties !== null) {
         foreach ($this->contextProperties->keys() as $property) {
             $value = $this->contextProperties->getProperty($property);
             // Special exception (from Texen)
             // for properties ending in file.contents:
             // in that case we dump the contents of the file
             // as the "value" for the Property.
             if (StringHelper::endsWith("file.contents", $property)) {
                 // pull in contents of file specified
                 $property = substr($property, 0, strpos($property, "file.contents") - 1);
                 // reset value, and then
                 // read in teh contents of the file into that var
                 $value = "";
                 $f = new PhingFile($this->project->resolveFile($value)->getCanonicalPath());
                 if ($f->exists()) {
                     try {
                         $fr = new FileReader($f);
                         $fr->readInto($value);
                     } catch (Exception $e) {
                         throw $e;
                     }
                 }
             }
             // if ends with file.contents
             if (StringHelper::isBoolean($value)) {
                 $value = StringHelper::booleanValue($value);
             }
             $c->assign($property, $value);
         }
         // foreach property
     }
     // if contextProperties !== null
     try {
         //$c->display($this->controlTemplate);
         $writer->write($c->fetch($this->controlTemplate));
         $writer->close();
     } catch (IOException $ioe) {
         $writer->close();
         throw new BuildException("Cannot write parsed template.");
     }
     $this->cleanup();
 }
Example #21
-1
 public function testReader()
 {
     $reader = new FileReader(__DIR__ . '/data/error.log');
     $reader->next();
     $this->assertTrue($reader->valid());
     $this->assertEquals('Stack trace:', $reader->consumeLine(10));
 }
Example #22
-1
 /**
  * Fills up with the entries from MO file $filename
  *
  * @param  string $filename MO file to load
  * @return bool   Success
  */
 public function import_from_file($filename)
 {
     $reader = new FileReader($filename);
     if (!$reader->is_resource()) {
         return false;
     }
     return $this->import_from_reader($reader);
 }
Example #23
-1
 public function __construct(string $filename)
 {
     $fileReader = new FileReader($filename);
     $version = $fileReader->readPascalString(30);
     $this->title = trim($fileReader->readDelphiString());
     $this->subtitle = trim($fileReader->readDelphiString());
     $this->artist = trim($fileReader->readDelphiString());
     $this->album = trim($fileReader->readDelphiString());
     $this->composer = trim($fileReader->readDelphiString());
     $this->copyright = trim($fileReader->readDelphiString());
     $this->transcriber = trim($fileReader->readDelphiString());
     $this->instructions = trim($fileReader->readDelphiString());
 }
 private static function getEvents($lastDate)
 {
     $events = array();
     $fileReader = new FileReader($lastDate);
     while (($line = $fileReader->getLine()) != null) {
         if (is_a($line, "DateTime")) {
             $event = new ServerStartedEvent($line);
         } else {
             $event = Parser::parseLine($line);
         }
         if ($event && Utils::getTimestamp($event->date) > Utils::getTimestamp($lastDate)) {
             $events[] = $event;
         }
     }
     return $events;
 }
Example #25
-2
 /**
  * @TODO
  */
 public function fromRoute($route)
 {
     // $this->route = $route;
     // Find the files that match the route.
     $finder = new \Symfony\Component\Finder\Finder();
     $glob = '#^default\\.(?:md|markdown|textile|html|htm|txt)$#';
     if ($route !== '') {
         $glob = '#^(?:\\d\\d\\.)?' . implode('\\/(?:\\d\\d\\.)?', explode('/', $route)) . '(?:\\/default)?\\.(?:md|markdown|textile|html|htm|txt)' . '$#';
     }
     $finder->in($this->documentPath)->path($glob);
     $files = [];
     foreach ($finder as $file) {
         $files[] = $file->getRelativePathname();
     }
     // Work out if we have *any* matching documents.  If not, throw an
     // exception.
     if (empty($files)) {
         throw new Exceptions\NoCandidatesException($route);
     }
     // Sort functions.
     $indexSort = function ($a, $b) {
         // return 0;
         return $a > $b;
     };
     $extensionSort = function ($a, $b) {
         $allowedExtensions = explode('|', 'md|markdown|textile|html|htm|txt');
         $aExt = pathinfo($a, PATHINFO_EXTENSION);
         $bExt = pathinfo($b, PATHINFO_EXTENSION);
         $aExtPos = array_search($aExt, $allowedExtensions);
         $bExtPos = array_search($bExt, $allowedExtensions);
         return $aExtPos > $bExtPos;
     };
     $isDefaultSort = function ($a, $b) {
         $aHasDefault = strpos($a, 'default.');
         $bHasDefault = strpos($b, 'default.');
         return $aHasDefault < $bHasDefault;
     };
     // Sort the documents according to their priority.
     $complexSort = \pjdietz\ComplexSort\ComplexSort::makeComplexSortFunction([$indexSort, $extensionSort, $isDefaultSort]);
     usort($files, $complexSort);
     // Read the file content from the filesystem.
     $fileReader = new FileReader(new \League\Flysystem\Filesystem(new \League\Flysystem\Adapter\Local($this->documentPath)));
     $filepath = $files[0];
     $content = $fileReader->read($filepath);
     // Create a document from the file content.
     $document = new Document($content);
     $document->filepath = $filepath;
     $document->parse();
     return $document;
 }
 /**
  * @test
  * @dataProvider jsonFileProvider
  */
 public function executeTestCasesFor($file)
 {
     if (!$this->canExecuteTestCasesFor($file)) {
         $this->markTestSkipped($file . ' excluded from test run');
     }
     $this->fileReader->setFile($file);
     $this->runTestCaseFile(new JsonTestCaseFileHandler($this->fileReader));
 }
Example #27
-5
function htmlformat_menuitem($root, $s, $u, $c)
{
    $v['%sign%'] = $s;
    $v['%url%'] = $u;
    $v['%caption%'] = $c;
    $a = Path::absolute($u);
    $b = Path::absolute($root . substr($_SERVER['REQUEST_URI'], 1));
    if ($a == $b) {
        $item = FileReader::readFile($root . 'menulinkv.html', $v);
    } else {
        $item = FileReader::readFile($root . 'menulink.html', $v);
    }
    return $item;
}
Example #28
-5
function get_neu_person_form($person)
{
    $dir = $GLOBALS['root'] . 'benutzer/';
    if (isset($person['accept'])) {
        $person['accept'] = ' checked';
    } else {
        $person['accept'] = '';
    }
    if (!isset($person['vorname'])) {
        $person['vorname'] = '';
    }
    if (!isset($person['nachname'])) {
        $person['nachname'] = '';
    }
    if (!isset($person['gebtag'])) {
        $person['gebtag'] = '';
    }
    if (!isset($person['gebmon'])) {
        $person['gebmon'] = '';
    }
    if (!isset($person['mail'])) {
        $person['mail'] = '';
    }
    if (!isset($person['passwd1'])) {
        $person['passwd1'] = '';
    }
    if (!isset($person['passwd2'])) {
        $person['passwd2'] = '';
    }
    $vars['%bedingungen%'] = FileReader::readFile($dir . 'bedingungen.html');
    $vars['%accept%'] = $person['accept'];
    $vars['%vorname%'] = text2html($person['vorname']);
    $vars['%nachname%'] = text2html($person['nachname']);
    if (isset($person['gebjahr'])) {
        $gebjahr = $person['gebjahr'];
    } else {
        $gebjahr = date('Y') - 12;
    }
    $gebdat = get_select_int('person[gebtag]', 1, 32, $person['gebtag']);
    $gebdat .= get_select_int('person[gebmon]', 1, 13, $person['gebmon']);
    $gebdat .= get_select_int('person[gebjahr]', date('Y') - 65, date('Y') - 5, $gebjahr);
    $vars['%gebdat%'] = $gebdat;
    $vars['%mail%'] = $person['mail'];
    $vars['%passwd1%'] = text2html($person['passwd1']);
    $vars['%passwd2%'] = text2html($person['passwd2']);
    $form = FileReader::readFile($dir . 'neu_person.html', $vars);
    return $form;
}
Example #29
-7
 public static function getUnscoutedTeams($event)
 {
     $teams = array();
     foreach (FileReader::getTeamsAtEvent($event) as $team) {
         if (!PitScouting::where(array('team_id' => $team->team_number, 'event_id' => $event))->first()) {
             array_push($teams, $team);
         }
     }
     return $teams;
 }
Example #30
-7
 public function testWriteInNotExistingFile()
 {
     $filePath = __DIR__ . '/resources/none.txt';
     $dummyFileReader = new FileReader($filePath);
     $this->assertSame('', $dummyFileReader->read());
     $this->assertSame(3, $dummyFileReader->write('abc'));
     $this->assertSame('abc', $dummyFileReader->read());
     $this->assertSame(3, $dummyFileReader->write('def'));
     $this->assertSame('def', $dummyFileReader->read());
     unlink($filePath);
 }