xref: /plugin/zwidoku/encycOpen.php (revision f82bbc904bd835fc66a3f52ffaef251433904ec2)
1<?php
2/**
3 * Encycloed Plugin: Open the article.
4 *
5 * @license  LGPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author   S.Chekanov
7 * @based_on "pageindex" plugin by Kite <Kite@puzzlers.org>
8 * @based_on "externallink" plugin by Otto Vainio <plugins@valjakko.net>
9 * @based_on "pagelist" plugin by Esther Brunner <wikidesign@gmail.com>
10 *
11 */
12
13
14if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/');
15if(!defined('DOKU_LIB')) define('DOKU_LIB',realpath(dirname(__FILE__).'/../../').'/');
16if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_LIB.'plugins/');
17//define('DOKU_MAIN',realpath(dirname(__FILE__).'/../../../').'/');
18
19// must be run within Dokuwiki
20if(!defined('DOKU_INC')) die("Cannot find installed DokuWiki");
21
22
23
24//require_once(DOKU_INC.'/inc/pageutils.php');
25require_once(DOKU_INC.'/inc/init.php');
26require_once(DOKU_INC.'/inc/template.php');
27
28
29///echo $_GET['p'];
30//echo DOKU_MAIN;
31//die();
32
33
34    $CURRENT_URL="https://enhub.org/dokuwiki";
35
36    $ID = cleanID(getID());
37    $onlyCode = $INPUT->str('onlyCode');
38    $insideTag = $INPUT->str('insideTag');
39
40    if (empty($conf['useacl']) || auth_quickaclcheck($ID) >= AUTH_READ) {
41        $file = rawWiki($ID);
42        $fileLastMod = wikiFN($ID);
43        $lastMod     = @filemtime($fileLastMod); // from page
44        $NS=getNS($ID);
45
46        $filepath = str_replace(":", "/", $ID);
47        // list all revisions
48        $path="data/attic/". $filepath."*";
49        $files = glob($path);
50
51
52        $changes="data/meta/".$filepath .".changes";
53        $indexed="data/meta/".$filepath .".indexed";
54        $meta="data/meta/".$filepath .".meta";
55
56        //$pagemeta=pageinfo();
57        //print_r($pagemeta);
58        //echo "Open this article to edit: " . $ID . " NS:" . $NS ."  (not implemented) " . $lastMod;
59
60  /*
61  if ($_FILES["file"]["error"] > 0)
62  {
63  echo "Error: " . $_FILES["file"]["error"] . "<br>";
64  }
65else
66  {
67  echo "Upload: " . $_FILES["file"]["name"] . "<br>";
68  echo "Type: " . $_FILES["file"]["type"] . "<br>";
69  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
70  echo "Stored in: " . $_FILES["file"]["tmp_name"];
71  }
72 */
73
74$OpenS="/dokuwiki/lib/plugins/zwidoku/open_file.php";
75$str = <<<EOD
76<h2></h2>
77<center>
78<h2>Submit ZWI file</h2>
79<form action="$OpenS" method="post" enctype="multipart/form-data">
80 <input type="file" name="fileToUpload" id="fileToUpload" accept=".zwi" />
81 <input type="submit" name="submit" value=" Upload ZWI file " />
82</form>
83</center>
84EOD;
85
86echo file_get_contents(DOKU_INC.'/lib/plugins/zwidoku/html_start');
87
88if (!empty($_SERVER['REMOTE_USER'])) {
89                                                                echo '<li class="nav-item nav-link"> ';
90                                                                tpl_userinfo();
91                                                                echo '</li>';
92                                                                echo $str;
93
94
95} else {
96  echo "<center><b>Please  <a href='/enhub.org/doku.php?id=start&do=login'> login to this editor</a> in order to upload a ZWI file.</b></center>";
97}
98
99
100echo file_get_contents(DOKU_INC.'/lib/plugins/zwi_doku/html_end');
101
102
103
104
105
106
107     } // end
108
109
110
111
112
113
114
115
116
117?>
118