Ejemplo n.º 1
0
 /**
  * @dataProvider userAgentProvider
  */
 public function testUserAgent($testAgent, $userAgent, $matches)
 {
     $_SERVER['HTTP_USER_AGENT'] = $testAgent;
     $this->assertEquals($matches, OC_Request::isUserAgent($userAgent));
 }
Ejemplo n.º 2
0
 /**
  * Sets the content disposition header (with possible workarounds)
  * @param string $filename file name
  * @param string $type disposition type, either 'attachment' or 'inline'
  */
 public static function setContentDispositionHeader($filename, $type = 'attachment')
 {
     if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME, OC_Request::USER_AGENT_FREEBOX))) {
         header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"');
     } else {
         header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"');
     }
 }