function testwriteLine() { $line = $this->getTestLine(); $length = strlen($line) + 1; $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); $this->assertEquals($length, File::writeLine('test.txt', $line)); }
function ns() { global $_CONFIG; $data = array(); $data['cs'] = count($_CONFIG['stats.xml']); $data['serv'] = array(); if (count($_CONFIG['serv_names']) == count($_CONFIG['stats.xml'])) { for ($i = 0; $i <= $data['cs'] - 1; $i++) { $data['serv'][$i]['name'] = $_CONFIG['serv_names'][$i]; $data['serv'][$i]['sid'] = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9); if (count($_CONFIG['serv_names']) == count($_CONFIG['MySQL']) and is_array($_CONFIG['MySQL'][$i])) { $data['serv'][$i]['ismysql'] = true; } else { $data['serv'][$i]['ismysql'] = false; } } } $fh = new File("./Cache/sess_system.php", "w"); if ($fh->exists()) { $fh->delete(); } $fh->open(); $fh->writeLine('<?php require_once "../config.php"; require_once "../inc/subsystem.php";'); #0 $fh->writeLine('$system=new subsystem; $system->setup_auth(); $system->auth->start();'); #1 $fh->writeLine('if(!$system->auth->getAuth()) die("Error 401"); ?>'); #2 $fh->writeLine(serialize($data)); #3 return $data; }