class_mcFile.inc.php 909 Bytes
<?
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;
		}
	}

}

?>