forked from srsoftware-de/TWiki2MediaWiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
82 lines (72 loc) · 2.9 KB
/
index.php
File metadata and controls
82 lines (72 loc) · 2.9 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
include_once "init.php";
include_once "functions.php";
include_once "display_functions.php";
$bottom.=display_session();
if (isset($_SESSION['current']) && isset($_SESSION['current']['namespace']) && $_SESSION['current']['namespace']=='TWiki'){
$top='Warning! The current namespace is '.$_SESSION['current']['namespace'].' which is a default'.
' Mediawiki interwiki namespace. To create pages in that namespace, you first have to remove the '.
'respective interwiki association. For more information, visit <a href="http://www.mediawiki.org/wiki/Manual:Interwiki">'.
'http://www.mediawiki.org/wiki/Manual:Interwiki</a>.';
}
if (isset($_POST['revision'])){
$_SESSION['current']['revision']=$_POST['revision'];
$revision_code=get_twiki_code($_SESSION['current']['namespace'],$_SESSION['current']['page'],$_SESSION['current']['revision']);
$top='<pre>'.$revision_code.'</pre>';
if (strpos($revision_code,'topic does not exist')!==false){
pageDone();
$bottom=t('This page is not existent. Thus, it can not be transferred!');
} else {
$media_wiki_code=convert_t2m($revision_code);
addLinks($media_wiki_code);
$bottom=show_submit_form($media_wiki_code);
}
}
if (isset($_POST['submission'])){
$content=$_POST['submission'];
if (isset($_POST['submitaddtodo'])){
$content='[[Category:ConversionToDo]] Converted from '.$_SESSION['source']['url'].'/'.$_SESSION['current']['namespace'].'/'.$_SESSION['current']['page']."\n".$content;
}
submit_content($content);
$top='<iframe src="'.$_SESSION['destination']['url'].'/index.php?title='.$_SESSION['current']['namespace'].':'.$_SESSION['current']['page'].'"></iframe>';
}
if (isset($_SESSION['destination']['url'])){
if (empty($_SESSION['links_open'])){
$namespaces=get_destination_namespaces();
foreach ($namespaces as $namespace){
$_SESSION['links_open'][$namespace]=array('WebHome');
}
}
$left.=show_links_open();
}
if (isset($_SESSION['current']['revisions'])){
$right.=show_revisions();
}
if (!isset($_SESSION['source'])) {
$top=ask_for_source();
} else {
$left.=add_session_closer();
if (!isset($_SESSION['destination']['url'])){
$top=ask_for_destination();
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>TWiki to Mediawiki converter</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="left"><?php print $left;?></div>
<div class="center">
<div class="top"><?php print $top; ?></div>
<div class="bottom"><?php print $bottom; ?></div>
</div>
<div class="right"><?php print $right; ?></div>
<?php if (isset($_SESSION['autoscript']) && $_SESSION['autoscript']==true){
print '<script type="text/javascript" src="autofeed.js"></script>'.PHP_EOL;
}
?>
</body>
</html>