b0VIM 7.3R|Hhrootnetbook/var/www/dokuwiki/lib/plugins/docimporter/action.phputf-8 3210#"! Utp]1^ad]C A X ,   r ? > j   c  U 9 32~e! |+*sSqg{zZ $myWikiContent = preg_replace("/----\n/", "",$myWikiContent); #Remove junk $myWikiContent = preg_replace("//", "\n",$myWikiContent); #Remove junk
tags $myWikiContent = preg_replace_callback("/(.*)<\/ref>/sU", "convert_footnote",$myWikiContent); #Transform references into footnotes $myWikiContent = str_replace($raw_tables, $good_tables, $myWikiContent); } array_push($good_tables, convert_table($match)); array_push($raw_tables, '{|'.$match.'|}'); foreach ($tables[1] as $match) { preg_match_all("/\{\|(.*)\|\}/sU", $myWikiContent, $tables); $good_tables = array(); $raw_tables = array(); #Convert tables $myWikiContent = get_images_from_html($myHTMLContent, $myWikiContent); #Get all the images from the html $myWikiContent = replace_from_list($myWikiContent, $italic_sentences, "italic"); $italic_sentences = get_tagged_from_html($myHTMLContent, "italic"); #Get italic sentences from html and replace them in the wiki text $myWikiContent = replace_from_list($myWikiContent, $underlined_sentences, "underlined"); $underlined_sentences = get_tagged_from_html($myHTMLContent, "underlined"); #Get undernlined sentences from html and replace them in the wiki text $myWikiContent = preg_replace("/\/\//", "",$myWikiContent); #Remove buggy // $myWikiContent = $converter->convert(); $converter = new MediaWiki2DokuWiki_MediaWiki_SyntaxConverter($myWikiContent); #Convert from MediaWiki to dokuwiki $myWikiContent = preg_replace("/\\[#_Toc.*\\]/", " \n",$myWikiContent); #Remove buggy Toc tags $myWikiContent = preg_replace("/<\/center>/", " \n",$myWikiContent); $myWikiContent = preg_replace("/
/", " ",$myWikiContent); #Remove center tags $myWikiContent = preg_replace("/ /", " ",$myWikiContent); #Replace nbsp by space $myHTMLContent = file_get_contents($tempDir."/".$agnosticFileName.".html"); $myWikiContent = file_get_contents($tempDir."/".$agnosticFileName.".txt"); #Load html and MediaWiki $result = exec("export HOME=/tmp && cd ".$tempDir." && convert_to_mediawiki ".$fileName); #Convert the doc to HTML and MediaWiki if(move_uploaded_file($_FILES['doc']['tmp_name'], $tempDir."/". $fileName)){ $agnosticFileName = $agnosticFileName[0]; $agnosticFileName = preg_split("/\./", $fileName); $fileName = preg_replace("/ /", "_", $fileName); $fileName = basename($_FILES['doc']['name']); $tempDir = System::mktemp("-d word_upload"); #Create temporary directory } $nameSpace = "wiki"; if (!$nameSpace) { $nameSpace = $_POST["ns"]; $pageName = $_POST["title"]; if ( $_FILES['doc'] ) { if ( $event->data != 'doc2dw' ) return; if ( auth_quickaclcheck( $ID ) < AUTH_EDIT ) return; function _importer(&$event, $param) { } $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_importer', array()); function register($controller) {class action_plugin_docimporter extends DokuWiki_Action_Plugin {if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');if(!defined('DOKU_INC')) die(); */ * @version 1.0 * @author Thibault Dory (thibault.dory@gmail.com) * @license GPL 3 (http://www.gnu.org/licenses/gpl.html) * * Action Plugin/**require_once('ImportUtils.php');require_once('SyntaxConverter.php');require_once "System.php"; w % $ # z :  o n b X P O  ???>} } } send_redirect(wl($nameSpace.':'.$pageName, '', true, '&')); $event->data = $this->getConf('parserPostDisplay'); } } } closedir($handle); } } $client->query('wiki.putAttachment', $entry, $image_data, $attrs); $attrs = array('ow' => true); $image_data = new IXR_Base64($image_data); //$image_data = base64_encode($image_data); $image_data = file_get_contents($tempDir."/".$entry, true); if (strpos($entry,'.png') !== false || strpos($entry,'.jpg') !== false || strpos($entry,'.gif') !== false) { while (false !== ($entry = readdir($handle))) { if ($handle = opendir($tempDir)) { #Send all the images as attachements $result = $client->query('wiki.putPage', $nameSpace.':'.$pageName, $myWikiContent, $attrs); $attrs = array('sum' => 'First try', 'minor' => false); if ($ok) { $ok = $client->query('dokuwiki.login', $username, $password); $client = new IXR_Client('http://localhost/dokuwiki/lib/exe/xmlrpc.php'); $password = $this->getConf('api_password'); $username = $this->getConf('api_username'); #Send the wiki page } $myWikiContent = $myWikiContent.$line."\n"; } } $line = preg_replace("/\*\*/U","",$line); if (!$second) { $second = strpos($line, "**", $first+2); if ($first) { $first = strpos($line, "**"); foreach ($content_lines as $line) { $myWikiContent = ""; $content_lines = explode(PHP_EOL, $myWikiContent); #Remove ** that does not have the corresponding closing **