trying getting note through pdf

This commit is contained in:
2014-10-28 01:03:01 +01:00
parent e7d45b4d3c
commit 60e2f0dfc8
2 changed files with 19 additions and 6 deletions

23
inc/note.php Normal file → Executable file
View File

@@ -19,6 +19,19 @@ class Note extends PhpObject
$sContent = '';
if($this->sNote!='')
{
$this->sUrl = 'http://service.sap.com/sap/support/notes/convert2pdf/000'.$this->sNote.'?sap-language=EN';
$sContent = $this->getPageRecursive();
header('Content-Description: File Transfer');
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="note_'.$this->sNote.'.pdf"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Content-Length: '.strlen($sContent));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
/*
$this->sUrl = 'http://service.sap.com/sap/support/notes/'.$this->sNote;
$this->getPageRecursive();
$sSapPath = substr($this->sUrl, 0, strpos($this->sUrl, '/bc/bsp/sno/ui_entry/entry.htm'));
@@ -47,7 +60,7 @@ class Note extends PhpObject
//Deleting auto resize
//$sContent = str_replace('lv_diff = 210','lv_diff = 0', $sContent);
$sContent = str_replace(array('setHeight();', 'window.onresize = setHeight; '), '', $sContent);
*/
}
else $this->addError('Empty note number');
@@ -71,8 +84,8 @@ class Note extends PhpObject
private function getPageRecursive()
{
$sheader = $this->getPage(true);
$asLines = explode("\n", $sheader);
$sHeader = $this->getPage(true);
$asLines = array_filter(explode("\n", $sHeader));
foreach($asLines as $sLine) $asInfo[strtolower(strstr($sLine, ':', true))] = trim(substr(strstr($sLine, ':'), 1));
if(array_key_exists('set-cookie', $asInfo)) $this->parseSetCookie($asInfo['set-cookie']);
@@ -83,7 +96,7 @@ class Note extends PhpObject
$this->sUrl = ((substr($asInfo['location'], 0, 4)!='http')?self::getDomain($this->sUrl):'').$asInfo['location'];
return $this->getPageRecursive();
}
else return substr($sheader, strpos($sheader, '<html>'));
else return implode("\n", $asLines);
}
private function parseSetCookie($sCookie)
@@ -94,7 +107,7 @@ class Note extends PhpObject
//Parse FIXME
$asCookieInfo = explode('; ', $sCookie);
foreach($asCookieInfo as $sCookieInfo) $asCookie[strstr($sCookieInfo, '=', true)] = substr(strstr($sCookieInfo, '='), 1);
setcookie('sap-appcontext', $asCookie['sap-appcontext'], time()+3600, $asCookie['path']);
if(array_key_exists('sap-appcontext', $asCookie)) setcookie('sap-appcontext', $asCookie['sap-appcontext'], time()+3600, $asCookie['path']);
}
private function getCredentials()

2
masks/note.html Normal file → Executable file
View File

@@ -23,7 +23,7 @@ databap.pageInit = function()
if(isNumeric(iNote) && iNote > 0 && iNote!=databap.tmp('note'))
{
$('#note_id').val(iNote).focus();
self.addBufferIcon();
//self.addBufferIcon();
$('#note_frame').attr('src', 'index.php?a=note&id='+iNote);
databap.tmp('note', iNote);
}