Beispiel #1
0
 /**
  * @param $sapeUser
  * @param $cacheDir
  * @param null $options
  * @throws \Exception
  */
 public function __construct($sapeUser, $cacheDir, $options = null)
 {
     $this->cacheDir = $cacheDir;
     if (!is_dir($cacheDir)) {
         if (!mkdir($cacheDir, 0777, true)) {
             throw new \Exception(sprintf("Unable to create directory '%s'", $cacheDir));
         }
     }
     if (!defined('_SAPE_USER')) {
         define('_SAPE_USER', $sapeUser);
     }
     // ugly hack to prevent 'Undefined index' notice outside of request scope
     if (!isset($_SERVER['SERVER_SOFTWARE'])) {
         $_SERVER['SERVER_SOFTWARE'] = 'Unknown';
     }
     if (!isset($_SERVER['REQUEST_URI'])) {
         $_SERVER['REQUEST_URI'] = '/';
     }
     if (!isset($_SERVER['HTTP_HOST'])) {
         $_SERVER['HTTP_HOST'] = 'localhost';
     }
     parent::SAPE_client($options);
 }
Beispiel #2
0
 function __construct()
 {
     parent::SAPE_client(array('charset' => 'UTF-8'));
 }