예제 #1
0
파일: logs.php 프로젝트: skdong/nfs-ovd
function download_log($where_, $name_, $server_ = NULL)
{
    if ($where_ == 'sm') {
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=sessionmanager_' . $name_);
        $filename = SESSIONMANAGER_LOGS . '/main.log';
        $fp = @fopen($filename, 'r');
        if ($fp !== false) {
            while ($str = fgets($fp, 4096)) {
                echo $str;
            }
        }
        @fclose($fp);
    } elseif ($where_ == 'aps') {
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=slaveserver_' . $server_ . '.log');
        $server = Abstract_Server::load($server_);
        if (!$server) {
            Logger::error('main', '(admin/logs) download_log() - cannot load Server \'' . $server_ . '\'');
            redirect();
        }
        $buf = new Server_Logs($server);
        $buf->process();
        while ($str = $buf->getContent()) {
            echo $str;
        }
    }
    die;
}
예제 #2
0
파일: api.php 프로젝트: bloveing/openulteo
 public function log_download($log_)
 {
     $this->check_authorized('viewStatus');
     $filename = SESSIONMANAGER_LOGS . '/' . $log_ . '.log';
     if (file_exists($filename)) {
         $fp = @fopen($filename, 'r');
         if ($fp === false) {
             return null;
         }
         $buf = '';
         while ($str = fgets($fp, 4096)) {
             $buf .= $str;
         }
         fclose($fp);
         if (function_exists("iconv")) {
             $buf = iconv("UTF-8", "UTF-8//IGNORE", $buf);
         }
         return $buf;
     }
     $server = Abstract_Server::load($log_);
     if (!$server) {
         return null;
     }
     $l = new Server_Logs($server);
     $l->process();
     $buf = '';
     while ($str = $l->getContent()) {
         $buf .= $str;
     }
     if (function_exists("iconv")) {
         $buf = iconv("UTF-8", "UTF-8//IGNORE", $buf);
     }
     return $buf;
 }