Last change
on this file since 7642 was 7640, checked in by Pieter Naber, 15 years ago |
KMLFile can read from the node location file provided. It parses the file into nodes.
|
File size:
1.1 KB
|
Line | |
---|
1 | <?
|
---|
2 | /*
|
---|
3 | * Project: NodeMap2.0
|
---|
4 | * File: FileHandler.class.php
|
---|
5 | * Purpose: Checking and reading node files from the server
|
---|
6 | */
|
---|
7 |
|
---|
8 | class FileHandler {
|
---|
9 | private $file;
|
---|
10 |
|
---|
11 | /*
|
---|
12 | * Function: __construct (constructor)
|
---|
13 | * Parameters: string $filename
|
---|
14 | * Function: Handling with a node file
|
---|
15 | */
|
---|
16 | public function __construct($filename) {
|
---|
17 | try {
|
---|
18 | trigger_log(SYSLOG_DEBUG, 'Opening the file "' . $filename . '"', __FILE__, __LINE__);
|
---|
19 | $handle = fopen($filename, 'r');
|
---|
20 |
|
---|
21 | trigger_log(SYSLOG_DEBUG, 'Reading from file "' . $filename . '"', __FILE__, __LINE__);
|
---|
22 | $this->file = '';
|
---|
23 | while (!feof($handle)) {
|
---|
24 | $this->file .= fread($handle, 8192);
|
---|
25 | }
|
---|
26 |
|
---|
27 | trigger_log(SYSLOG_DEBUG, 'Closing file "' . $filename . '"', __FILE__, __LINE__);
|
---|
28 | fclose($handle);
|
---|
29 |
|
---|
30 | trigger_log(SYSLOG_INFO, 'Reading from file "' . $filename . '" is done', __FILE__, __LINE__);
|
---|
31 | } catch (Exception $err) {
|
---|
32 | trigger_log(SYSLOG_ERR, 'Reading from file "' . $filename . '" failed', __FILE__, __LINE__);
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | public function getFile() {
|
---|
37 | return $this->file;
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.