Beispiel #1
0
 /**
  * Intialize logger
  *
  * @static
  * @access public
  *
  * @throws \Exception        If log directory not exists or not writeable
  */
 public static function init()
 {
     self::$logdir = realpath(Config::read('log_dir'));
     self::$level = Config::read('log_level');
     if (!file_exists(self::$logdir)) {
         throw new Exception('Log directory "' . self::$logdir . '" does not exist.');
     }
     if (!is_writeable(self::$logdir)) {
         throw new Exception('Log directory "' . self::$logdir . '" is not writeable.');
     }
 }
Beispiel #2
0
            <link rel="stylesheet" type="text/css" href="res/css/<?php 
        echo $cssfile;
        ?>
" />
        <?php 
    }
    ?>
    <?php 
}
?>

	<script src="res/js/jquery.min.js" type="text/javascript"></script>
	<script src="res/jqueryui/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

    <?php 
if (Config::read('minify_js')) {
    ?>

        <script type="text/javascript" src="resources.php?js=<?php 
    echo join('|', $javascript);
    ?>
"></script>
    <?php 
} else {
    ?>

        <?php 
    foreach ($javascript as $jsfile) {
        ?>

            <script type="text/javascript" src="res/js/<?php 
Beispiel #3
0
        if (file_exists($filepath)) {
            $content .= "\n// " . $filename . "\n\n";
            $content .= file_get_contents($filepath);
        }
    }
    if (Config::read('minify_js')) {
    }
    header('Content-Type: application/javascript');
    echo trim($content);
}
if (isset($_GET['css'])) {
    $tmp = explode('|', $_GET['css']);
    $path = BASE_PATH . DS . 'res' . DS . 'css' . DS;
    $content = '';
    foreach ($tmp as $filename) {
        $filepath = $path . $filename;
        if (file_exists($filepath)) {
            $content .= "\n/* " . $filename . " */\n\n";
            $content .= file_get_contents($filepath);
        }
    }
    if (Config::read('minify_css')) {
        $content = preg_replace('#/\\*.*?\\*/#s', '', $content);
        $content = preg_replace('/\\s*([{}|:;,])\\s+/', '$1', $content);
        $content = preg_replace('/\\s\\s+(.*)/', '$1', $content);
        $content = str_replace(';}', '}', $content);
    }
    $content = str_replace('../', 'res/', $content);
    header('Content-Type: text/css');
    echo trim($content);
}
Beispiel #4
0
 /**
  * Subscribe to event notifies
  *
  * @access public
  *
  * @return string    Subscription ID
  */
 public function subscribe()
 {
     $url = $this->service->getEventSubUrl();
     $urldata = parse_url($url);
     $eventUrl = 'http://' . Config::read('host_name') . '/pupnp/event.php';
     $header = array('HOST: ' . $urldata['host'] . ':' . $urldata['port'], 'USER-AGENT: Linux/2.6.31-1.0 UPnP/1.0 pupnp/0.1', 'CALLBACK: <' . $eventUrl . '>', 'NT: upnp:event', 'TIMEOUT: 180');
     Logger::debug('Subscribe to ' . $this->device->getId() . ' with: ' . "\n" . print_r($header, true), 'subscription');
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $this->service->getEventSubUrl());
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'SUBSCRIBE');
     $result = curl_exec($ch);
     $tmp = explode("\r\n", trim($result));
     $response = array();
     foreach ($tmp as $line) {
         $tmp = explode(':', $line);
         $key = strtoupper(trim(array_shift($tmp)));
         $value = trim(join(':', $tmp));
         $response[$key] = $value;
     }
     if (isset($response['SID'])) {
         return $response['SID'];
     }
     return null;
 }