$ttrss_uses_https = parse_url(get_self_url_prefix(), PHP_URL_SCHEME) === 'https';
$rewrite_base_url = $site_url ? $site_url : SELF_URL_PATH;
- $entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src])');
+ $entries = $xpath->query('(//a[@href]|//img[@src]|//video/source[@src]|//audio/source[@src])');
foreach ($entries as $entry) {
if ($entry->hasAttribute('src')) {
$src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'));
-
- $extension = $entry->tagName == 'source' ? '.mp4' : '.png';
- $cached_filename = CACHE_DIR . '/images/' . sha1($src) . $extension;
+ $cached_filename = CACHE_DIR . '/images/' . sha1($src);
if (file_exists($cached_filename)) {
- $src = get_self_url_prefix() . '/public.php?op=cached_image&hash=' . sha1($src) . $extension;
+
+ // this is strictly cosmetic
+ if ($entry->tagName == 'img') {
+ $suffix = ".png";
+ } else if ($entry->parentNode && $entry->parentNode->tagName == "video") {
+ $suffix = ".mp4";
+ } else if ($entry->parentNode && $entry->parentNode->tagName == "audio") {
+ $suffix = ".ogg";
+ } else {
+ $suffix = "";
+ }
+
+ $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $suffix;
if ($entry->hasAttribute('srcset')) {
$entry->removeAttribute('srcset');
}
} // function encrypt_password
- function load_filters($feed_id, $owner_uid, $action_id = false) {
+ function load_filters($feed_id, $owner_uid) {
$filters = array();
$cat_id = (int)getFeedCategory($feed_id);
return true;
}
- function format_tags_string($tags, $id) {
+ function format_tags_string($tags) {
if (!is_array($tags) || count($tags) == 0) {
return __("no tags");
} else {
}
}
- function format_article_labels($labels, $id) {
+ function format_article_labels($labels) {
if (!is_array($labels)) return '';
if (db_num_rows($result) > 0) {
while ($line = db_fetch_assoc($result)) {
+
+ if (file_exists(CACHE_DIR . '/images/' . sha1($line["content_url"]))) {
+ $line["content_url"] = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($line["content_url"]);
+ }
+
array_push($rv, $line);
}
}
WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
- "\" $attributes onchange=\"labelSelectOnChange(this)\" >";
+ "\" $attributes>";
while ($line = db_fetch_assoc($result)) {
$rv .= $retval;
} else {
- if (preg_match("/image/", $entry["type"]) ||
- preg_match("/\.(jpg|png|gif|bmp)/i", $entry["filename"])) {
+ if (preg_match("/image/", $entry["type"])) {
if (!$hide_images) {
$encsize = '';
return $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
}
+ function cleanup_url_path($path) {
+ $path = str_replace("/./", "/", $path);
+ $path = str_replace("//", "/", $path);
+
+ return $path;
+ }
+
/**
* Converts a (possibly) relative URL to a absolute one.
*
} else if (strpos($rel_url, "/") === 0) {
$parts = parse_url($url);
$parts['path'] = $rel_url;
+ $parts['path'] = cleanup_url_path($parts['path']);
return build_url($parts);
$dir !== '/' && $dir .= '/';
}
$parts['path'] = $dir . $rel_url;
+ $parts['path'] = cleanup_url_path($parts['path']);
return build_url($parts);
}
return false;
}
+ /**
+ * @SuppressWarnings(unused)
+ */
function error_json($code) {
require_once "errors.php";