-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathext.php
More file actions
61 lines (61 loc) · 1.82 KB
/
ext.php
File metadata and controls
61 lines (61 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?
require("core.php");
$ok=true; //set to false and the html will output an error...
try {
if(!isset($_GET["f"]))
throw new Exception("Parameter f not specified");
$f=(int)$_GET["f"];
if(!isset($_GET["i"]))
throw new Exception("Parameter i not specified");
$i=(int)$_GET["i"];
$q=new DB_Query("select * from feed_items where feed_id=? and id=?",$f,$i);
if($q->numRows!=1)
throw new Exception("Item not found");
$r=$q->fetch();
$link=$config["url"]["defaultscheme"]."://".$config["url"]["host"].$config["url"]["base"]."#feed/$f/$i";
} catch (Exception $e) {
$ok=false;
}
function e($c) {
return htmlentities($c,ENT_QUOTES,"UTF-8");
}
?><!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="google" value="notranslate" />
<title><?= $config["site"]["name"] ?></title>
<?
if($ok==true) {
?>
<meta property="og:type" content="website" />
<meta property="og:title" content="<?=e($r["title"])?>" />
<meta property="og:site_name" content="<?=e($config["site"]["name"])?>" />
<meta property="og:description" content="<?=e($r["excerpt"])?>" />
<meta property="fb:app_id" content="<?=e($config["facebook"]["app_id"])?>" />
<meta property="og:updated_time" content="<?=e($r["time"])?>">
<meta name="twitter:card" content="summary">
<meta name="twitter:url" content="<?=e($link)?>" />
<meta name="twitter:title" content="<?=e($r["title"])?>" />
<meta name="twitter:description" content="<?=e($r["excerpt"])?>" />
<?
}
?>
</head>
<body>
<?
if($ok==true) {
?>
You'll be redirected to the item... click <a href="<?=e($link);?>">here</a> if not.
<script type="text/javascript">
location.href=<?=json_encode($link,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP);?>;
</script>
<?
} else {
?>
Error: <?= $e->getMessage() ?>
<?
}
?>
</body>
</html>