<? class mcFile { /** * * * @param string $param_filename * @param string $param_text * @param string $param_kindof -- r|r+|w|w+|a|a+ @see http://de3.php.net/manual/de/function.fopen.php * r - ptr at the beginning * w - ptr at the beginning and file size 0 * a - ptr at the end * @return bool */ public static function write($param_filename, $param_text, $param_kindof = null) { if($param_filename && $param_text) { if($param_kindof === null) { $param_kindof = 'a'; } try { @$var_file = fopen($param_filename,$param_kindof); if ($var_file === false) { return false; } else { fputs($var_file, $param_text); fputs($var_file, mcCONST::LINEBREAK.mcCONST::LINEBREAK); } fclose($var_file); return true; } catch (Exception $e) { mcException::handleException($e); } } else { return false; } } public static function getFileContent($param_filename) { if(is_readable($param_filename)) { try { $handle = fopen ($param_filename, "r"); $array_content = array(); while (!feof($handle)) { $array_content[] = fgets($handle); } fclose ($handle); return $array_content; } catch (Exception $e) { mcException::handleException($e); return false; } } else { return Error::newError('DevError', 'file could not read', $param_code); } } } ?>