cli) {
return true;
}
$this->authUser = $this->getAuthUser();
if (!$this->authUser) {
return false;
}
return true;
}
function relPath($base, $url)
{
if (preg_match('/^(http|https|mailto):/',$url)) {
return $url;
}
$ui = parse_url($base);
if($ui['host'] == 'localhost'){
return $ui['scheme'] .'://'.$ui['host']. $ui['path'] . '/'. $url;
}
if (substr($url,0,2) == '//') {
return $ui['scheme'] .':' . $url;
}
if (substr($url,0,1) == '/') {
return $ui['scheme'] .'://'.$ui['host']. $url;
}
if (substr($ui['path'], -1) == '/') {
return $ui['scheme'] .'://'.$ui['host']. $ui['path'] . $url;
}
if (!strlen($ui['path'])) {
return $ui['scheme'] .'://'.$ui['host']. '/' . $url;
}
return $ui['scheme'] .'://'.$ui['host']. $ui['path'] . '/../'. $url;
}
function checkHeader($url)
{
if(strpos($url, 'https') !== false)
{
$this->jerr('accept HTTP url only!');
}
$headers = get_headers($url, 1);
if(strpos(is_array($headers['Content-Type']) ? $headers['Content-Type'][0] : $headers['Content-Type'], 'text/html') === false)
{
$this->jerr('accept html file only!');
}
return;
}
var $styleSheets = array();
function convertStyle($url, $file, $is_url = true)
{
$inLineCss = true;
if($is_url && !empty($url))
{
$host = parse_url($url);
require_once 'System.php';
$wget = System::which('wget');
if (!$wget) {
$this->jerr("no wget");
}
$cmd = $wget . ' -q -O - ' . escapeshellarg($url);
//echo $cmd; exit;
$data = `$cmd`;
if (!trim(strlen($data))) {
$this->jerr("url returned an empty string");
}
}
if(!$is_url){
$data = file_get_contents($file);
}
if(preg_match('/^