Commit 57f8eda04057a1dd29847d5ba00b09941fe3344e
1 parent
59f99ad2
Exists in
master
and in
111 other branches
Fix some errors detected from apache log file
Showing
3 changed files
with
13 additions
and
14 deletions
Show diff stats
php/classes/AmdaObjectMgr.php
... | ... | @@ -124,8 +124,8 @@ class AmdaObjectMgr |
124 | 124 | |
125 | 125 | foreach($obj as $key => $value) |
126 | 126 | { |
127 | - if ($key != 'id' && $key != 'leaf' && $key != 'nodeType') | |
128 | - { | |
127 | + if ($key != 'id' && $key != 'leaf' && $key != 'nodeType' && !is_array($value)) | |
128 | + { | |
129 | 129 | $node = $this->objectDom->createElement($key,htmlspecialchars($value)); |
130 | 130 | $root -> appendChild($node); |
131 | 131 | } |
... | ... |
php/classes/BaseManager.php
... | ... | @@ -15,7 +15,8 @@ class BaseManager |
15 | 15 | |
16 | 16 | function __construct() |
17 | 17 | { |
18 | - define("DELTA", 120); // minumum file size in secs | |
18 | + if (!defined("DELTA")) | |
19 | + define("DELTA", 120); // minumum file size in secs | |
19 | 20 | |
20 | 21 | if (getenv('USER_DATA_PATH') != "") |
21 | 22 | $this->baseDomName = getenv('USER_DATA_PATH')."base.xml"; |
... | ... | @@ -154,8 +155,6 @@ class BaseManager |
154 | 155 | */ |
155 | 156 | public function delFile($fileObj) |
156 | 157 | { |
157 | - $start = $fileObj->getAttribute($start); | |
158 | - $stop = $fileObj->getAttribute($stop); | |
159 | 158 | $vi = $fileObj->parentNode; |
160 | 159 | $vi->removeChild($fileObj); |
161 | 160 | $mask = $vi->getElementsByTagName("mask")->item(0)->nodeValue; |
... | ... |
php/classes/FilesMgr.php
... | ... | @@ -272,7 +272,7 @@ class FilesMgr extends AmdaObjectMgr |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | - if (feof($handle)) return -10; | |
275 | + if (feof($handler)) return -10; | |
276 | 276 | |
277 | 277 | $oneLine = trim(fgets($handler)); |
278 | 278 | $elems = explode(" ",$oneLine); |
... | ... | @@ -353,7 +353,7 @@ class FilesMgr extends AmdaObjectMgr |
353 | 353 | $handler = fopen($this->fileName, 'r'); |
354 | 354 | if ($handler) |
355 | 355 | { |
356 | - $offset = ftell($handle); | |
356 | + $offset = ftell($handler); | |
357 | 357 | $i = 0; |
358 | 358 | while (!$StartTime && !feof($handler)) |
359 | 359 | { |
... | ... | @@ -361,7 +361,7 @@ class FilesMgr extends AmdaObjectMgr |
361 | 361 | $elems = explode(" ", preg_replace('/\s+/', ' ', $oneLine)); |
362 | 362 | if (!($time = strtotime($elems[0]))) |
363 | 363 | { |
364 | - $offset = ftell($handle); | |
364 | + $offset = ftell($handler); | |
365 | 365 | $i++; |
366 | 366 | continue; |
367 | 367 | } |
... | ... | @@ -668,7 +668,7 @@ class FilesMgr extends AmdaObjectMgr |
668 | 668 | $newFile->setAttribute('mask', $this->fileId); |
669 | 669 | |
670 | 670 | $newFile->nodeValue = date('Y-m-d',$start)."T".date('H:i:s',$start)."-".date('Y-m-d',$stop)."T".date('H:i:s',$stop); |
671 | - if ($desc != '') | |
671 | + if (!empty($desc)) | |
672 | 672 | $newFile->nodeValue .= (PHP_EOL.$desc); |
673 | 673 | |
674 | 674 | return $newFile; |
... | ... | @@ -915,7 +915,7 @@ class FilesMgr extends AmdaObjectMgr |
915 | 915 | // WS/Files.xml |
916 | 916 | if ($theFile) |
917 | 917 | { |
918 | - if ($desc) | |
918 | + if (isset($desc)) | |
919 | 919 | $theFile->parentNode->setAttribute('info', $desc); |
920 | 920 | $theFile->parentNode->removeChild($theFile); |
921 | 921 | $this->contentDom->save($this->xmlName); |
... | ... | @@ -948,17 +948,17 @@ class FilesMgr extends AmdaObjectMgr |
948 | 948 | } |
949 | 949 | } |
950 | 950 | // No more files for myDataParams |
951 | - if ($paramsToDelete) | |
951 | + if (isset($paramsToDelete)) | |
952 | 952 | return array('id' => $obj->id, 'params' => $paramsToDelete); |
953 | 953 | |
954 | 954 | // update info for myDataParams Start Stop were changed |
955 | - return array('id' => $obj->id, 'mask' => $mask, 'maskDesc' => $desc); | |
955 | + return array('id' => $obj->id, 'mask' => isset($mask) ? $mask : NULL, 'maskDesc' => isset($desc) ? $desc : NULL); | |
956 | 956 | } |
957 | 957 | |
958 | 958 | /* |
959 | 959 | * recombine files in Files.xml according to new Mask |
960 | 960 | */ |
961 | - public function addMask($fileMask, $type) | |
961 | + public function addMask($fileMask) | |
962 | 962 | { |
963 | 963 | if ($this->contentDom ->getElementById($fileMask) != null) return false; |
964 | 964 | $filesInRoot = $this->xp->query("/ws/fileList/file"); |
... | ... | @@ -1190,7 +1190,7 @@ class FilesMgr extends AmdaObjectMgr |
1190 | 1190 | |
1191 | 1191 | //create new file tag with all attributes and add it to the content DOM |
1192 | 1192 | $newFile = $this->createFile($format); |
1193 | - if ($newFile < 0) | |
1193 | + if (is_int($newFile) && ($newFile < 0)) | |
1194 | 1194 | { |
1195 | 1195 | unlink($this->fileName); |
1196 | 1196 | return array( 'success' => false, 'file' => $fileName); |
... | ... |