blob: f2d93bf0b54faf5f060abe5b042a0e6ae4ff6f36 (
plain)
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
|
<?php
require('config.php');
global $dir;
global $title;
$title = 'Copy/Paste quotes from MS Word';
include('header.php');
$set = isset($_POST['word_data']) && isset($_POST['filename']);
if ($set) {
$tmp = $dir.'/'.rawurlencode($_POST['filename']).'.tmp';
$fd = fopen($tmp, 'w');
fwrite($fd, $_POST['word_data']);
fclose($fd);
$filename = $dir.'/'.rawurlencode($_POST['filename']).'.org';
$cmd = "< '$tmp' dos2unix | ".dirname(__FILE__)."/word2org.sh 2>&1 > '$filename'";
echo '<pre>'.htmlentities($cmd).'</pre>';
echo '<pre>';
system($cmd, $status);
echo '</pre>';
unlink($tmp);
if ($status != 0) {
unlink($filename);
echo '<p>error</p>';
}
} else {
?>
<form method="post" action="upload-msword.php">
Filename:
<input type="text" name="filename" />
Text:
<textarea name="word_data"></textarea>
<input type="submit" value="upload" />
</form>
<?php
}
include('footer.php');
|