-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapi.php
135 lines (124 loc) · 4.36 KB
/
api.php
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
$proxytype = trim($_GET['proxytype']);
$proxyval = urldecode(trim($_GET['proxyvalue']));
$fdl = trim($_POST['fdl']);
$fdlid = trim($_GET['fdlid']);
$emode = trim($_POST['mode']);
$preview = trim($_POST['preview']);
$shownotes = urldecode($_POST['shownotes']);
if (isset($proxytype)) {
if ($proxytype == 'list') {
if ($proxyval == '*') {
echo file_get_contents('http://cdn.simon.waldherr.eu/projects/showpad-api/getList/');
die();
}
echo file_get_contents('http://cdn.simon.waldherr.eu/projects/showpad-api/getList/?search='.$proxyval);
die();
} elseif ($proxytype == 'pad') {
echo file_get_contents('http://cdn.simon.waldherr.eu/projects/showpad-api/getPad/?id='.$proxyval);
die();
}
}
if (isset($fdlid)) {
if (is_numeric($fdlid)) {
if ($_GET['fdname'] != '') {
$fdname = $_GET['fdname'] . '.mp4chaps.txt';
} else {
$fdname = $fdlid . '.mp4chaps.txt';
}
header('Content-Disposition: attachment; filename="' . $fdname . '"');
$filecontent = file_get_contents('./cache/' . $fdlid . '.mp4chaps.txt');
unlink('./cache/' . $fdlid . '.mp4chaps.txt');
echo $filecontent;
die();
}
}
include_once './OSFphp/osf.php';
$amazon = '';
$thomann = '';
$tradedoubler = '';
$fullmode = 'false';
$fullmode = 'true';
$fullint = 2;
$tags = explode(' ', 'chapter section spoiler topic embed video audio image shopping glossary source app title quote link podcast news');
$data = array(
'amazon' => $amazon,
'thomann' => $thomann,
'tradedoubler' => $tradedoubler,
'fullmode' => $fullmode,
'tagsmode' => 1,
'tags' => $tags
);
$shownotes = htmlspecialchars_decode(str_replace('<br />', '', str_replace('<p>', '', str_replace('</p>', '', $shownotes))));
$shownotesArray = osf_parser($shownotes, $data);
if ($emode == '') {
$emode = 'block style';
} elseif ($emode == 'html') {
$emode = 'block style';
} elseif ($emode == 'block') {
$emode = 'block style';
} elseif ($emode == 'list') {
$emode = 'list style';
} elseif ($emode == 'osf') {
$emode = 'clean osf';
}
function get_the_ID() {
return 1;
}
function is_feed() {
return false;
}
if (($emode == 'block style') || ($emode == 'button style')) {
$export = osf_export_block($shownotesArray['export'], $fullint, $emode);
} elseif ($emode == 'list style') {
$export = osf_export_list($shownotesArray['export'], $fullint, $emode);
} elseif ($emode == 'clean osf') {
$export = osf_export_osf($shownotesArray['export'], $fullint, $emode);
} elseif ($emode == 'glossary') {
$export = osf_export_glossary($shownotesArray['export'], $fullint);
} elseif (($emode == 'shownoter') || ($emode == 'podcaster')) {
if (isset($shownotesArray['header'])) {
if ($emode == 'shownoter') {
$export = osf_get_persons('shownoter', $shownotesArray['header']);
} elseif ($emode == 'podcaster') {
$export = osf_get_persons('podcaster', $shownotesArray['header']);
}
}
} else {
$export = osf_export_chapterlist($shownotesArray['export'], $fullint);
}
if (isset($preview) && ($preview != 'false')) {
if (($emode == 'clean osf')||($emode == 'chapter')) {
$export = '<!DOCTYPE html><html><head><meta charset="utf-8"><title>Kapitelmarken</title></head><body><pre>' . $export . '</pre></body></html>';
} else {
$export = '<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>tinyOSF.js</title>
<link rel="icon" href="http://shownotes.github.io/tinyOSF.js/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="http://shownotes.github.io/tinyOSF.js/shownotes.css" type="text/css" media="screen">
<link rel="stylesheet" href="http://shownotes.github.io/tinyOSF.js/style.css" type="text/css" media="screen">
<script src="http://shownotes.github.io/tinyOSF.js/tinyosf_exportmodules.js"></script>
<script src="http://shownotes.github.io/tinyOSF.js/tinyosf.js"></script>
<style>.osf_chaptertime, .osf_chapter {vertical-align: middle !important;}</style>
</head>
<body>
<div id="parsedBox">
<div id="parsed">' . $export . '</div>
<div id="footer"> <span>© 2015 <a href="http://shownot.es/">shownot.es</a></span></div>
</div>
</body>
</html>';
}
}
if (isset($fdl)) {
$fdlid = round(rand(10000,900000000)*time()/300000);
if (!is_dir('./cache/')) {
mkdir('./cache/', 0666);
}
file_put_contents('./cache/' . $fdlid . '.mp4chaps.txt', $export);
echo $fdlid;
} else {
echo $export;
}
?>