public static function rfts($strFileName, &$strRet, $intLines = 0, $intBytes = 4096, $booErrorRep = true)
    {
        if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
            $out = self::_parse_log_file("Reading: ".$strFileName);
            if ($out == false) {
                if (substr(PSI_LOG, 0, 1)=="-") {
                    $strRet = '';

                    return false;
                }
            } else {
                $strRet = $out;

                return true;
            }
        }

        $strFile = "";
        $intCurLine = 1;
        $error = PSI_Error::singleton();
        if (file_exists($strFileName)) {
            if (is_readable($strFileName)) {
                if ($fd = fopen($strFileName, 'r')) {
                    while (!feof($fd)) {
                        $strFile .= fgets($fd, $intBytes);
                        if ($intLines <= $intCurLine && $intLines != 0) {
                            break;
                        } else {
                            $intCurLine++;
                        }
                    }
                    fclose($fd);
                    $strRet = $strFile;
                    if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) {
                        if ((strlen($strRet)>0)&&(substr($strRet, -1)!="\n")) {
                            error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet."\n", 3, PSI_LOG);
                        } else {
                            error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet, 3, PSI_LOG);
                        }
                    }
                } else {
                    if ($booErrorRep) {
                        $error->addError('fopen('.$strFileName.')', 'file can not read by phpsysinfo');
                    }

                    return false;
                }
            } else {
                if ($booErrorRep) {
                    $error->addError('fopen('.$strFileName.')', 'file permission error');
                }

                return false;
            }
        } else {
            if ($booErrorRep) {
                $error->addError('file_exists('.$strFileName.')', 'the file does not exist on your machine');
            }

            return false;
        }

        return true;
    }
public static function rfts($strFileName, &$strRet, $intLines = 0, $intBytes = 4096, $booErrorRep = true)
    {
        if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) {
            $out = self::_parse_log_file("Reading: ".$strFileName);
            if ($out == false) {
                if (substr(PSI_LOG, 0, 1)=="-") {
                    $strRet = '';

                    return false;
                }
            } else {
                $strRet = $out;

                return true;
            }
        }

        $strFile = "";
        $intCurLine = 1;
        $error = PSI_Error::singleton();
        if (file_exists($strFileName)) {
            if (is_readable($strFileName)) {
                if ($fd = fopen($strFileName, 'r')) {
                    while (!feof($fd)) {
                        $strFile .= fgets($fd, $intBytes);
                        if ($intLines <= $intCurLine && $intLines != 0) {
                            break;
                        } else {
                            $intCurLine++;
                        }
                    }
                    fclose($fd);
                    $strRet = $strFile;
                    if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) {
                        if ((strlen($strRet)>0)&&(substr($strRet, -1)!="\n")) {
                            error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet."\n", 3, PSI_LOG);
                        } else {
                            error_log("---".gmdate('r T')."--- Reading: ".$strFileName."\n".$strRet, 3, PSI_LOG);
                        }
                    }
                } else {
                    if ($booErrorRep) {
                        $error->addError('fopen('.$strFileName.')', 'file can not read by phpsysinfo');
                    }

                    return false;
                }
            } else {
                if ($booErrorRep) {
                    $error->addError('fopen('.$strFileName.')', 'file permission error');
                }

                return false;
            }
        } else {
            if ($booErrorRep) {
                $error->addError('file_exists('.$strFileName.')', 'the file does not exist on your machine');
            }

            return false;
        }

        return true;
    }
public static function rfts ( $ strFileName , & $ strRet , $ intLines = 0 , $ intBytes = 4096 , $ booErrorRep = true ) { if ( defined ( 'PSI_LOG' ) && is_string ( PSI_LOG ) && ( strlen ( PSI_LOG ) > 0 ) && ( ( substr ( PSI_LOG , 0 , 1 ) == "-" ) || ( substr ( PSI_LOG , 0 , 1 ) == "+" ) ) ) { $ out = self :: _parse_log_file ( "Reading: " . $ strFileName ) ; if ( $ out == false ) { if ( substr ( PSI_LOG , 0 , 1 ) == "-" ) { $ strRet = '' ; return false ; } } else { $ strRet = $ out ; return true ; } } $ strFile = "" ; $ intCurLine = 1 ; $ error = PSI_Error :: singleton ( ) ; if ( file_exists ( $ strFileName ) ) { if ( is_readable ( $ strFileName ) ) { if ( $ fd = fopen ( $ strFileName , 'r' ) ) { while ( ! feof ( $ fd ) ) { $ strFile .= fgets ( $ fd , $ intBytes ) ; if ( $ intLines <= $ intCurLine && $ intLines != 0 ) { break ; } else { $ intCurLine ++ ; } } fclose ( $ fd ) ; $ strRet = $ strFile ; if ( defined ( 'PSI_LOG' ) && is_string ( PSI_LOG ) && ( strlen ( PSI_LOG ) > 0 ) && ( substr ( PSI_LOG , 0 , 1 ) != "-" ) && ( substr ( PSI_LOG , 0 , 1 ) != "+" ) ) { if ( ( strlen ( $ strRet ) > 0 ) && ( substr ( $ strRet , - 1 ) != "\n" ) ) { error_log ( "---" . gmdate ( 'r T' ) . "--- Reading: " . $ strFileName . "\n" . $ strRet . "\n" , 3 , PSI_LOG ) ; } else { error_log ( "---" . gmdate ( 'r T' ) . "--- Reading: " . $ strFileName . "\n" . $ strRet , 3 , PSI_LOG ) ; } } } else { if ( $ booErrorRep ) { $ error -> addError ( 'fopen(' . $ strFileName . ')' , 'file can not read by phpsysinfo' ) ; } return false ; } } else { if ( $ booErrorRep ) { $ error -> addError ( 'fopen(' . $ strFileName . ')' , 'file permission error' ) ; } return false ; } } else { if ( $ booErrorRep ) { $ error -> addError ( 'file_exists(' . $ strFileName . ')' , 'the file does not exist on your machine' ) ; } return false ; } return true ; }
read a file and return the content as a string

@param string  $strFileName name of the file which should be read
@param string  &$strRet     content of the file (reference)
@param integer $intLines    control how many lines should be read
@param integer $intBytes    control how many bytes of each line should be read
@param boolean $booErrorRep en- or disables the reporting of errors which should be logged

@return boolean command successfull or not
read a file and return the content as a string