function html() { ptln($this->locale_xhtml('admin_header')); $cache = $this->cache; $current_books = $this->cache['current_books']; unset($cache['current_books']); //ptln('<form action="'.wl($ID).'" method="post" onsubmit="return epub_admin_confirm(this);" id="epub_admin" name="epub_admin">' ); ptln('<form action="' . wl($ID) . '" method="post" id="epub_admin" name="epub_admin">'); echo "<ul>\n"; foreach ($cache as $md5 => $id) { $id = trim($id); if (!$id) { $id = '<undefined>'; } ptln('<li style="list-style-type:none; color: #333;"><input name="book_id[' . $md5 . ']" type="checkbox" value="' . $id . '"> ' . $id); ptln(' <ul><li style="color:#333">' . $current_books[$md5]['title'] . "\n" . ' <li style="color:#333">' . $current_books[$md5]['epub']); ptln(" <!--input type = 'hidden' name='{$md5}' value='" . $current_books[$md5]['epub'] . "'/ -->\n </ul>"); } echo " </ul>\n"; ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <input type="submit" name="cmd[cache]" onclick="return epub_admin_confirm(\'cache\');" id="epub_cache_btn" value="' . $this->getLang('btn_submit') . '" />'); ptln(' <input type="submit" onclick="return epub_admin_confirm(\'media\');" name="cmd[media]" id="epub_media_btn" value="' . $this->getLang('btn_del') . '" />'); ptln('</form>'); if ($this->dbg) { echo $this->req . "<br />"; } if ($this->results) { ptln('<p><br />' . $this->results . '</p>'); } }
/** output appropriate html */ function html() { $this->handleAction(); ptln('<form action="' . wl($ID) . '" method="post">'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln($this->formOutput); ptln('</form><br>'); ptln($this->htmlOutput); }
/** * output appropriate html */ function html() { ptln('<a href="javascript:prereg_Inf.toggle();void 0"><span style="line-height: 175%">Toggle info</span></a><br />'); ptln('<div id="prereg_info" style="border: 1px solid silver; padding:4px;">' . $this->locale_xhtml('info') . '</div><br>'); ptln('<form action="' . wl($ID) . '" method="post">'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <input type="submit" name="cmd[confirm]" value="' . $this->getLang('btn_confirm') . '" /> '); ptln(' <input type="submit" name="cmd[secure]" value="' . $this->getLang('btn_secure') . '" />'); ptln('<br /><br /><div>'); echo $this->getConfirmList(); ptln('</div>'); ptln('</form>'); $this->js(); }
/** * output appropriate html */ function html() { global $ID, $auth; $filter['grps'] = "user"; if ($auth->canDo('getUsers')) { // is this feature available? $users = $auth->retrieveUsers(0, 0); } $html = '<p>' . $this->getLang("intro_message") . '</p> <form class="admin-form" action="' . wl($ID) . '" method="post"> <label class="block">' . $this->getLang("question_name") . ': <input name="problem_name" type="text" /></label> <label class="block">' . $this->getLang("sender") . ': <select name="user"> <option value="">' . $this->getLang("all_users") . '</option>'; while ($user = current($users)) { $html .= '<option value="' . key($users) . '">' . $user["name"] . '</option>'; next($users); } $html .= ' </select> </label> <label class="block"> <input type="radio" name="type" value="test-case"> ' . $this->getLang('programming_questions') . '<br /> <input type="radio" name="type" value="output-only"> ' . $this->getLang('outputonly_questions') . ' </label>'; // output hidden values to ensure dokuwiki will return back to this plugin $html .= '<input type="hidden" name="do" value="admin" />' . '<input type="hidden" name="page" value="' . $this->getPluginName() . '" />'; ptln($html); formSecurityToken(); $html = ' <input type="submit" name="cmd[get]" value="' . $this->getLang('btn_get_submissions') . '" /> <input type="submit" name="cmd[delete]" value="' . $this->getLang('btn_delete_submissions') . '" /> </form><h1 class="sectionedit1"></h1> '; $html .= $this->output; ptln($html); }
function html_menu($listPlugins = true) { global $ID; ptln('<div class="pm_menu">'); ptln('<div class="common">'); ptln(' <h2>' . $this->lang['download'] . '</h2>'); ptln(' <form action="' . wl($ID) . '" method="post">'); ptln(' <fieldset class="hidden">', 4); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="plugin" />'); formSecurityToken(); ptln(' </fieldset>'); ptln(' <fieldset>'); ptln(' <legend>' . $this->lang['download'] . '</legend>'); ptln(' <label for="dw__url">' . $this->lang['url'] . '<input name="url" id="dw__url" class="edit" type="text" maxlength="200" /></label>'); ptln(' <input type="submit" class="button" name="fn[download]" value="' . $this->lang['btn_download'] . '" />'); ptln(' </fieldset>'); ptln(' </form>'); ptln('</div>'); if ($listPlugins) { ptln('<h2>' . $this->lang['manage'] . '</h2>'); ptln('<form action="' . wl($ID) . '" method="post" class="plugins">'); ptln(' <fieldset class="hidden">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="plugin" />'); formSecurityToken(); ptln(' </fieldset>'); $this->html_pluginlist(); ptln(' <fieldset class="buttons">'); ptln(' <input type="submit" class="button" name="fn[enable]" value="' . $this->lang['btn_enable'] . '" />'); ptln(' </fieldset>'); // ptln(' </div>'); ptln('</form>'); } ptln('</div>'); }
/** * output appropriate html */ function html() { ptln('<div style="width:90%;margin:auto;display:none;" class="news_info"><p>' . $this->getLang('instructions') . '</p></div>'); ptln('<form action="' . wl($ID) . '" method="post" name="news_data" onsubmit="newshandler(this);">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); ptln(' <input type="hidden" name="prev_del" id ="prev_del" value="' . $this->prev_deleted . '" />'); ptln(' <input type="hidden" name="subfeed_inx" id ="subfeed_inx" value="0" />'); ptln(' <input type="hidden" name="subfeed_dir" id ="subfeed_dir" value="" />'); formSecurityToken(); ptln(' <input type="submit" name="cmd[prune]" value="' . $this->getLang('btn_prune') . '" />'); ptln(' <input type="submit" name="cmd[restore]" value="' . $this->getLang('btn_restore') . '" />'); ptln(' <input type="submit" name="cmd[confirm]" onclick="return confirm_del();" value="' . $this->getLang('btn_confirm') . '" />'); ptln(' <input type="submit" name="cmd[generate]" value="' . $this->getLang('btn_generate') . '" />'); ptln(' <select id="subfeeds" name="subfeeds" onchange="subfeedshandler()" ><option value="NotSet">' . $this->getLang('select_feed') . '</option>'); $this->subfeed_options(); ptln('</select>'); ptln(' <input type="submit" id = "subfeedbtn" name="cmd[subfeed]" value="' . $this->getLang('btn_confirmfeed') . '" />'); ptln(' <input type="button" id = "news_infobtn" value="' . $this->getLang('btn_info') . '" />'); ptln('<div id="pagedata_news"><br />'); $this->table_header(); foreach ($this->pagedata as $md5 => $pageinfo) { $this->pagedata_row($md5, $pageinfo); } $this->table_footer(); ptln('</div>'); ptln('</form>'); if ($this->output) { ptln('<p><pre>'); echo print_r($this->output, true); echo $this->subfeed_name; ptln('</pre></p>'); } }
/** * output appropriate html */ function html() { echo <<<SCRIPTTEXT <style type="text/css"> td.right { padding-right: 20px; } </style> <script type='text/javascript'> //<![CDATA[ function newshandler() { var prev_del = document.getElementById('prev_del'); var inputs = document.getElementsByTagName('input'); \t var prev = ""; \t // var teststr = prev_del.value; \t \t for(var i=0; i<inputs.length;i++) { \t if(inputs[i].type == 'checkbox') {\t if(inputs[i].checked && inputs[i].name.match(/delete/)) {\t \t\t\t prev += inputs[i].value + ','; \t\t\t\t } \t\t }\t\t \t }\t \t \t if(prev_del.value && prev) { \t prev_del.value += ',' + prev; \t } \t else if (prev) prev_del.value = prev; \t prev_del.value = prev_del.value.replace(/\\s*,\$/,""); \t \t } function confirm_del() { if(window.confirm('The deleted feeds will be removed from the current news feed.')) return true; \t return false; } //]]> </script> SCRIPTTEXT; ptln('<div style="width:90%;margin:auto;"><p>' . $this->getLang('instructions') . '</p></div>'); ptln('<form action="' . wl($ID) . '" method="post" name="news_data" onsubmit="newshandler(this);">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); ptln(' <input type="hidden" name="prev_del" id ="prev_del" value="' . $this->prev_deleted . '" />'); formSecurityToken(); ptln(' <input type="submit" name="cmd[prune]" value="' . $this->getLang('btn_prune') . '" />'); ptln(' <input type="submit" name="cmd[restore]" value="' . $this->getLang('btn_restore') . '" />'); ptln(' <input type="submit" name="cmd[confirm]" onclick="return confirm_del();" value="' . $this->getLang('btn_confirm') . '" />'); ptln(' <input type="submit" name="cmd[generate]" value="' . $this->getLang('btn_generate') . '" />'); ptln('<div id="pagedata_news"><br />'); $this->table_header(); foreach ($this->pagedata as $md5 => $pageinfo) { $this->pagedata_row($md5, $pageinfo); } $this->table_footer(); ptln('</div>'); ptln('</form>'); if ($this->output) { ptln('<p><pre>'); echo print_r($this->output, true); ptln('</pre></p>'); } }
/** * output appropriate html */ function html() { //print current message and namespace global $lang; global $conf; print "<h1>".$this->getLang('mess_titre')."</h1>"; print $this->getLang('mess_texte'); print "<br /><br />"; ptln('<form action="'.wl($ID).'" method="post">'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="'.$this->getPluginName().'" />'); formSecurityToken(); //check for previous messages $filename = $conf['cachedir']."/nsmsg.xml"; $idx=0; $total_msg =0; if (file_exists($filename)) { try { $xml=simplexml_load_file($filename); //print existing messages echo "<strong>".$this->getLang('cur_title')."</strong><br>"; $total_msg = $xml->count(); foreach ($xml as $message) { print $this->getLang('mess_label')."<textarea name='msg$idx' style=\"width:100%; background-color: lightblue\">"; print $message->body."</textarea><br>"; print $this->getLang('link_label')."<textarea name='link$idx' style=\"width:100%; background-color: lightblue\">"; print $message->link."</textarea><br>"; print $this->getLang('ns_label')."<textarea name='ns$idx' style=\"width:100%; background-color: lightblue\">"; print $message->namespace."</textarea><br>"; print $this->getLang('type_label')."<br>"; $this->_printmsgbar($message->type, $idx); echo '<br><br>'; echo ("<input type='checkbox' name='del$idx'>".$this->getLang('btn_del')."<br><br>"); $idx++; } } catch (Exception $e) { echo $this->getLang('error_c'); } } ptln('<input type="hidden" name="total" value="'.$total_msg.'" />'); //get number of existing messages echo "<hr><strong>".$this->getLang('add_title')."</strong><br>"; //msg, link and namespace input field print $this->getLang('mess_label')."<textarea name='msg$idx' style=\"width:100%; background-color: lightgray\">"; print "</textarea>"; print "<br>"; print $this->getLang('link_label')."<textarea name='link$idx' style=\"width:100%; background-color: lightgray\">"; print "</textarea>"; print $this->getLang('ns_label')."<textarea name='ns$idx' style=\"width:100%; background-color: lightgray\">"; print "</textarea>"; print "<br><br>"; $this->_printmsgbar('-1', $idx); print "<br><br>"; ptln(' <input type="submit" name="cmd[change]" value="'.$this->getLang('btn_change').'" />'); ptln('</form>'); }
function render($mode, &$renderer, $data) { global $ID; global $conf; global $INFO; global $lang; list($type, $num, $order) = $data; if ($type == "book") { $renderer->info['cache'] = false; if ($mode == 'text' && (isset($_GET['do']) && $_GET['do'] == 'export_text')) { $mode = 'xhtml'; } if ($mode == 'xhtml') { // verifica che se l'utente può salvare/eliminare le selezioni $this->usercansave = auth_quickaclcheck($this->getConf('save_namespace') . ':*') >= AUTH_CREATE; // verifica che se l'utente può salvare/eliminare le selezioni if ($this->usercansave) { if (isset($_POST['task']) && $_POST['task'] == "save") { checkSecurityToken(); if (isset($_COOKIE['list-pagelist'])) { if (isset($_POST['bookcreator_title'])) { $list = explode("|", $_COOKIE['list-pagelist']); $content = "====== " . $_POST['bookcreator_title'] . " ======" . DOKU_LF; for ($n = 0; $n < count($list); $n++) { $page = $list[$n]; $content .= " * [[:{$page}]]" . DOKU_LF; } saveWikiText($this->getConf('save_namespace') . ":" . $_POST['bookcreator_title'], $content, "selection created"); msg($this->getLang('bookcreator_saved') . ": " . $this->getConf('save_namespace') . ":" . $_POST['bookcreator_title']); } else { msg($this->getLang('bookcreator_needtitle')); } } else { msg($this->getLang('bookcreator_empty')); } } elseif (isset($_POST['task']) && $_POST['task'] == "del") { saveWikiText($this->getConf('save_namespace') . ":" . $_POST['page'], '', "selection removed"); msg($this->getLang('bookcreator_deleted') . ": " . $this->getConf('save_namespace') . ":" . $_POST['page']); } } if (isset($_GET['do']) || isset($_GET['mddo'])) { if ($_GET['do'] == 'export_html' || $_GET['do'] == 'export_text') { if (isset($_COOKIE['list-pagelist'])) { $renderer->doc = ''; $list = explode("|", $_COOKIE['list-pagelist']); } $render_mode = 'xhtml'; $lf_subst = ''; if ($_GET['do'] == 'export_text') { $render_mode = 'text'; $lf_subst = '<br>'; } for ($n = 0; $n < count($list); $n++) { $page = $list[$n]; $renderer->doc .= str_replace(DOKU_LF, $lf_subst, p_cached_output(wikiFN($page), $render_mode)); //p_wiki_xhtml($page,$REV,false); } } } else { $renderer->info['cache'] = FALSE; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/core.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/events.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/css.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/coordinates.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/drag.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/dragsort.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/cookies.js"></script>'; $renderer->doc .= '<script language="JavaScript" type="text/javascript" src="' . DOKU_URL . 'lib/plugins/bookcreator/sorter/more.js"></script>'; if (isset($_COOKIE['bookcreator']) || isset($_POST['task']) && $_POST['task'] == "read") { $list = array(); $i = 0; // c'è una selezione salvata da recuperare if (isset($_POST['task']) && $_POST['task'] == "read") { checkSecurityToken(); $renderer->doc .= "\n <script type='text/javascript'><!--//--><![CDATA[//><!-- \n book_removeAllPages('bookcreator');\n //--><!]]></script>"; $select = rawWiki($this->getConf('save_namespace') . ":" . $_POST['page']); $lines = explode("\n", $select); $nr = count($lines); for ($n = 0; $n < $nr; $n++) { if (trim($lines[$n]) == '') { continue; } if ($n > 0 && substr($lines[$n], 0, 7) != " * [[:") { continue; } if ($n === 0) { $lines[$n] = str_replace("====== ", '', $lines[$n]); $lines[$n] = str_replace(" ======", '', $lines[$n]); $title = $lines[$i]; } else { $lines[$n] = str_replace(" * [[:", '', $lines[$n]); $lines[$n] = str_replace("]]", '', $lines[$n]); $list[$n] = $lines[$n]; $renderer->doc .= ' <script type="text/javascript"><!--//--><![CDATA[//><!-- book_changePage(\'bookcreator[' . $list[$n] . ']\', 1, new Date(\'July 21, 2099 00:00:00\'), \'/\'); //--><!]]></script>'; $i++; } } // oppure quella appena selezionata } elseif (isset($_COOKIE['bookcreator'])) { $fav = $_COOKIE['bookcreator']; //Se non ci sono pagine già inserite if ($fav == "" || count($fav) == 0) { $renderer->doc .= $this->getLang('bookcreator_empty'); return; } foreach ($fav as $page => $cpt) { list($cpt, $date) = explode(";", $cpt); if ($cpt < 1) { continue; } $i++; $list[$i] = $page; } } $renderer->doc .= "<table width='100%' border='0' ><tr>"; $renderer->doc .= "<td width='60%' valign='top'>"; // Pagine selezionate for ($n = 1; $n <= $i; $n++) { $page = $list[$n]; if ($n == 1) { $renderer->header($this->getLang('bookcreator_toprint'), 2, 0); $renderer->doc .= '<ul id="pagelist" class="boxes">'; } $lien = $this->createLink($page); $renderer->doc .= ' <li itemID="' . $page . '">'; $renderer->doc .= ' <a href="javascript:book_changePage(\'bookcreator[' . $page . ']\', 0, new Date(\'July 21, 2099 00:00:00\'), \'/\'); book_recharge();"><img src="' . DOKU_URL . 'lib/plugins/bookcreator/images/remove.png" title="' . $this->getLang('bookcreator_remove') . '" border="0" style="vertical-align:middle;" name="ctrl" /></a> '; $renderer->doc .= $lien; $renderer->doc .= '</li>'; if ($n == $i) { $renderer->doc .= '</ul>'; $renderer->doc .= "<br />"; } } // Pagine selezionate // Pagine escluse dal libro if (isset($fav)) { $i = 0; foreach ($fav as $page => $cpt) { list($cpt, $date) = explode(";", $cpt); if ($cpt == 0) { if (!$i) { $renderer->header($this->getLang('bookcreator_removed'), 2, 0); $renderer->listu_open(); } $lien = $this->createLink($page); $i++; $renderer->doc .= "<div id=\"ex__{$page}\">"; $renderer->listitem_open(1); $renderer->doc .= '<a href="javascript:book_changePage(\'bookcreator[' . $page . ']\', 1, new Date(\'July 21, 2099 00:00:00\'), \'/\'); book_recharge();"><img src="' . DOKU_URL . 'lib/plugins/bookcreator/images/include.png" title="' . $this->getLang('bookcreator_include') . '" border="0" style="vertical-align:middle;" name="ctrl" /></a> '; $renderer->doc .= $lien; $renderer->doc .= "</div>"; $renderer->listitem_close(); } } if ($i) { $renderer->listu_close(); } } // azzera selezione $renderer->doc .= "<div align='center'>"; $onclick = "javascript:if(confirm('" . $this->getLang('bookcreator_reserconfirm') . "')) {book_removeAllPages('bookcreator'); document.reset.submit();}"; $renderer->doc .= '<form name="reset" class="button" method="get" action="' . wl($ID) . '">'; $renderer->doc .= "<input type='button' value='" . $this->getLang('bookcreator_reset') . "' class='button' onclick=\"" . $onclick . "\">"; $renderer->doc .= "<input type='hidden' name='id' value='{$ID}'/>"; $renderer->doc .= formSecurityToken(false); $renderer->doc .= '</form>'; $renderer->doc .= '</div>'; // azzera selezione $renderer->doc .= "</td>"; $renderer->doc .= "<td width='40%' valign='top' >"; $renderer->doc .= "<div align='center'>"; //Esportazione PDF $renderer->doc .= '<form class="button" method="get" action="' . wl($ID) . '" accept-charset="' . $lang['encoding'] . '">'; $renderer->doc .= "<fieldset style=\"text-align:left;\"><legend><b>" . $this->getLang('bookcreator_export') . "</b></legend>"; $renderer->doc .= $this->getLang('bookcreator_title') . " "; $renderer->doc .= '<input type="text" class="edit" value="' . $title . '" name="pdfbook_title" size="40" />'; $renderer->doc .= '<select name="do" size="1">'; $renderer->doc .= '<option value="export_html" selected="selected">' . $this->getLang('bookcreator_exportprint') . '</option>'; if (file_exists(DOKU_PLUGIN . "text/renderer.php") && !plugin_isdisabled("text")) { $renderer->doc .= '<option value="export_text">' . $this->getLang('bookcreator_exporttext') . '</option>'; } if (file_exists(DOKU_PLUGIN . "dw2pdf/action.php") && !plugin_isdisabled("dw2pdf")) { $renderer->doc .= '<option value="export_pdfbook" selected="selected">' . $this->getLang('bookcreator_exportpdf') . '</option>'; } $renderer->doc .= '</select>'; $renderer->doc .= '<input type="submit" value="' . $this->getLang('bookcreator_create') . '" class="button"/> <input type="hidden" name="id" value="' . $ID . '" />'; $renderer->doc .= '</fieldset>'; $renderer->doc .= formSecurityToken(false); $renderer->doc .= '</form>'; //Esportazione PDF if ($this->usercansave) { //Salva selezione $renderer->doc .= '<form class="button" method="post" action="' . wl($ID) . '" accept-charset="' . $lang['encoding'] . '">'; $renderer->doc .= "<fieldset style=\"text-align:left;\"><legend><b>" . $this->getLang('bookcreator_saveselection') . "</b></legend>"; $renderer->doc .= '<input type="text" class="edit" value="' . $title . '" name="bookcreator_title" />'; $renderer->doc .= '<input type="submit" value="' . $this->getLang('bookcreator_save') . '" class="button"/>'; $renderer->doc .= '<input type="hidden" name="task" value="save" /> <input type="hidden" name="id" value="' . $ID . '" />'; $renderer->doc .= '</fieldset>'; $renderer->doc .= formSecurityToken(false); $renderer->doc .= '</form>'; //Salva selezione } $renderer->doc .= '</div>'; $renderer->doc .= "</tr></td>"; $renderer->doc .= "</table>"; } else { $renderer->doc .= $this->getLang('bookcreator_nocookies'); } // genera la lista delle selezioni salvate $result = $this->_getlist($order); if (sizeof($result) > 0) { $renderer->doc .= '<form class="button" id="bookcreator__selections__list" name="bookcreator__selections__list" method="post" action="' . wl($ID) . '">'; $renderer->doc .= "<fieldset style=\"text-align:left;\"><legend><b>" . $this->getLang('bookcreator_listselections') . "</b></legend>"; $this->_showlist($renderer, $result, true, true); $renderer->doc .= "<input type='hidden' name='task' value=''/>"; $renderer->doc .= "<input type='hidden' name='page' value=''/>"; $renderer->doc .= "<input type='hidden' name='id' value='{$ID}'/>"; $renderer->doc .= formSecurityToken(false); $renderer->doc .= '</fieldset>'; $renderer->doc .= '</form>'; } // genera la lista delle selezioni salvate } } return false; } else { if ($mode == 'xhtml') { // genera la lista delle selezioni salvate $result = $this->_getlist($order, $num); if (sizeof($result) > 0) { $renderer->doc .= '<form class="button" id="bookcreator__selections__list" name="bookcreator__selections__list" method="post" action="' . wl($this->getConf('book_page')) . '">'; $this->_showlist($renderer, $result); $renderer->doc .= "<input type='hidden' name='task' value=''/>"; $renderer->doc .= "<input type='hidden' name='page' value=''/>"; $renderer->doc .= "<input type='hidden' name='id' value='" . $this->getConf('book_page') . "'/>"; $renderer->doc .= formSecurityToken(false); $renderer->doc .= '</form>'; } // genera la lista delle selezioni salvate } return false; } }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function media_uploadform($ns, $auth, $fullscreen = false) { global $lang; global $conf; global $INPUT; if ($auth < AUTH_UPLOAD) { echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL; return; } $auth_ow = $conf['mediarevisions'] ? AUTH_UPLOAD : AUTH_DELETE; $update = false; $id = ''; if ($auth >= $auth_ow && $fullscreen && $INPUT->str('mediado') == 'update') { $update = true; $id = cleanID($INPUT->str('image')); } // The default HTML upload form $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data'); if (!$fullscreen) { $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php'; } else { $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&'); } $form = new Doku_Form($params); if (!$fullscreen) { echo '<div class="upload">' . $lang['mediaupload'] . '</div>'; } $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= $auth_ow) { $form->addElement(form_makeOpenTag('p')); $attrs = array(); if ($update) { $attrs['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs)); $form->addElement(form_makeCloseTag('p')); } echo NL . '<div id="mediamanager__uploader">' . NL; html_form('upload', $form); echo '</div>' . NL; echo '<p class="maxsize">'; printf($lang['maxuploadsize'], filesize_h(media_getuploadsize())); echo '</p>' . NL; }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? print '<div class="upload">' . $lang['mediaupload'] . '</div>'; $form = new Doku_Form('dw__upload', DOKU_BASE . 'lib/exe/mediamanager.php', false, 'multipart/form-data'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); }
/** * List recent edits matching the given filter */ function _list($filter) { global $conf; global $lang; echo '<hr /><br />'; echo '<form action="" method="post"><div class="no">'; echo '<input type="hidden" name="filter" value="' . hsc($filter) . '" />'; formSecurityToken(); $recents = getRecents(0, $this->max_lines); echo '<ul>'; $cnt = 0; foreach ($recents as $recent) { if ($filter) { if (strpos(rawWiki($recent['id']), $filter) === false) { continue; } } $cnt++; $date = strftime($conf['dformat'], $recent['date']); echo $recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT ? '<li class="minor">' : '<li>'; echo '<div class="li">'; echo '<input type="checkbox" name="revert[]" value="' . hsc($recent['id']) . '" checked="checked" id="revert__' . $cnt . '" />'; echo '<label for="revert__' . $cnt . '">' . $date . '</label> '; echo '<a href="' . wl($recent['id'], "do=diff") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/diff.png'; $p['width'] = 15; $p['height'] = 11; $p['title'] = $lang['diff']; $p['alt'] = $lang['diff']; $att = buildAttributes($p); echo "<img {$att} />"; echo '</a> '; echo '<a href="' . wl($recent['id'], "do=revisions") . '">'; $p = array(); $p['src'] = DOKU_BASE . 'lib/images/history.png'; $p['width'] = 12; $p['height'] = 14; $p['title'] = $lang['btn_revs']; $p['alt'] = $lang['btn_revs']; $att = buildAttributes($p); echo "<img {$att} />"; echo '</a> '; echo html_wikilink(':' . $recent['id'], useHeading('navigation') ? NULL : $recent['id']); echo ' – ' . htmlspecialchars($recent['sum']); echo ' <span class="user">'; echo $recent['user'] . ' ' . $recent['ip']; echo '</span>'; echo '</div>'; echo '</li>'; @set_time_limit(10); flush(); } echo '</ul>'; echo '<p>'; echo '<input type="submit" class="button" value="' . $this->getLang('revert') . '" /> '; printf($this->getLang('note2'), hsc($filter)); echo '</p>'; echo '</div></form>'; }
/** * output appropriate html */ function html() { $allow_debug = $GLOBALS['conf']['allowdebug']; // avoid global $conf; here. global $lang; global $ID; if (is_null($this->_config)) { $this->_config = new configuration($this->_file); } $this->setupLocale(true); print $this->locale_xhtml('intro'); ptln('<div id="config__manager">'); if ($this->_config->locked) { ptln('<div class="info">' . $this->getLang('locked') . '</div>'); } elseif ($this->_error) { ptln('<div class="error">' . $this->getLang('error') . '</div>'); } elseif ($this->_changed) { ptln('<div class="success">' . $this->getLang('updated') . '</div>'); } ptln('<form action="' . wl($ID) . '" method="post">'); formSecurityToken(); $this->_print_h1('dokuwiki_settings', $this->getLang('_header_dokuwiki')); $undefined_settings = array(); $in_fieldset = false; $first_plugin_fieldset = true; $first_template_fieldset = true; foreach ($this->_config->setting as $setting) { if (is_a($setting, 'setting_hidden')) { // skip hidden (and undefined) settings if ($allow_debug && is_a($setting, 'setting_undefined')) { $undefined_settings[] = $setting; } else { continue; } } else { if (is_a($setting, 'setting_fieldset')) { // config setting group if ($in_fieldset) { ptln(' </table>'); ptln(' </fieldset>'); } else { $in_fieldset = true; } if ($first_plugin_fieldset && substr($setting->_key, 0, 10) == 'plugin' . CM_KEYMARKER) { $this->_print_h1('plugin_settings', $this->getLang('_header_plugin')); $first_plugin_fieldset = false; } else { if ($first_template_fieldset && substr($setting->_key, 0, 7) == 'tpl' . CM_KEYMARKER) { $this->_print_h1('template_settings', $this->getLang('_header_template')); $first_template_fieldset = false; } } ptln(' <fieldset id="' . $setting->_key . '">'); ptln(' <legend>' . $setting->prompt($this) . '</legend>'); ptln(' <table class="inline">'); } else { // config settings list($label, $input) = $setting->html($this, $this->_error); $class = $setting->is_default() ? ' class="default"' : ($setting->is_protected() ? ' class="protected"' : ''); $error = $setting->error() ? ' class="value error"' : ' class="value"'; ptln(' <tr' . $class . '>'); ptln(' <td class="label">'); ptln(' <span class="outkey">' . $setting->_out_key(true) . '</span>'); ptln(' ' . $label); ptln(' </td>'); ptln(' <td' . $error . '>' . $input . '</td>'); ptln(' </tr>'); } } } ptln(' </table>'); if ($in_fieldset) { ptln(' </fieldset>'); } // show undefined settings list if ($allow_debug && !empty($undefined_settings)) { function _setting_natural_comparison($a, $b) { return strnatcmp($a->_key, $b->_key); } usort($undefined_settings, '_setting_natural_comparison'); $this->_print_h1('undefined_settings', $this->getLang('_header_undefined')); ptln('<fieldset>'); ptln('<table class="inline">'); $undefined_setting_match = array(); foreach ($undefined_settings as $setting) { if (preg_match('/^(?:plugin|tpl)' . CM_KEYMARKER . '.*?' . CM_KEYMARKER . '(.*)$/', $setting->_key, $undefined_setting_match)) { $undefined_setting_key = $undefined_setting_match[1]; } else { $undefined_setting_key = $setting->_key; } ptln(' <tr>'); ptln(' <td class="label"><span title="$meta[\'' . $undefined_setting_key . '\']">$' . $this->_config->_name . '[\'' . $setting->_out_key() . '\']</span></td>'); ptln(' <td>' . $this->getLang('_msg_' . get_class($setting)) . '</td>'); ptln(' </tr>'); } ptln('</table>'); ptln('</fieldset>'); } // finish up form ptln('<p>'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="config" />'); if (!$this->_config->locked) { ptln(' <input type="hidden" name="save" value="1" />'); ptln(' <input type="submit" name="submit" class="button" value="' . $lang['btn_save'] . '" accesskey="s" />'); ptln(' <input type="reset" class="button" value="' . $lang['btn_reset'] . '" />'); } ptln('</p>'); ptln('</form>'); ptln('</div>'); }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? // The default HTML upload form $form = new Doku_Form('dw__upload', DOKU_BASE . 'lib/exe/mediamanager.php', false, 'multipart/form-data'); $form->addElement('<div class="upload">' . $lang['mediaupload'] . '</div>'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); // prepare flashvars for multiupload $opt = array('L_gridname' => $lang['mu_gridname'], 'L_gridsize' => $lang['mu_gridsize'], 'L_gridstat' => $lang['mu_gridstat'], 'L_namespace' => $lang['mu_namespace'], 'L_overwrite' => $lang['txt_overwrt'], 'L_browse' => $lang['mu_browse'], 'L_upload' => $lang['btn_upload'], 'L_toobig' => $lang['mu_toobig'], 'L_ready' => $lang['mu_ready'], 'L_done' => $lang['mu_done'], 'L_fail' => $lang['mu_fail'], 'L_authfail' => $lang['mu_authfail'], 'L_progress' => $lang['mu_progress'], 'L_filetypes' => $lang['mu_filetypes'], 'O_ns' => ":{$ns}", 'O_backend' => 'mediamanager.php?' . session_name() . '=' . session_id(), 'O_size' => php_to_byte(ini_get('upload_max_filesize')), 'O_extensions' => join('|', array_keys(getMimeTypes())), 'O_overwrite' => $auth >= AUTH_DELETE, 'O_sectok' => getSecurityToken(), 'O_authtok' => auth_createToken()); $var = buildURLparams($opt); // output the flash uploader ?> <div id="dw__flashupload" style="display:none"> <div class="upload"><?php echo $lang['mu_intro']; ?> </div> <?php echo html_flashobject('multipleUpload.swf', '500', '190', null, $opt); ?> </div> <?php }
public function html() { global $ID; $conf = $this->loadCBData(); ptln('<h3>' . $this->getLang('btnslist') . '</h3>'); ptln('<form action="' . wl($ID) . '" method="post">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <table class="inline">'); ptln(' <tr><th>' . $this->getLang('btnslist_label') . '</th><th>' . $this->getLang('btnslist_code') . '</th><th>' . $this->getLang('btnslist_delete') . '</th></tr>'); if ($conf) { foreach ($conf as $key => $button) { if (!$button["type"]) { ptln(' <tr>'); ptln(' <td>' . hsc($button["label"]) . '</td>'); ptln(' <td>' . hsc($button["code"]) . '</td>'); ptln(' <td><center><input type="radio" name="delete" value="' . $key . '"/></center></td>'); # FIXME Del image ptln(' </tr>'); } else { $icon = ''; if ($button['icon']) { $icon = '<img src="' . DOKU_BASE . 'lib/plugins/custombuttons/ico/' . hsc($button['icon']) . '"> '; } ptln(' <tr>'); ptln(' <td>' . $icon . hsc($button["label"]) . '</td>'); ptln(' <td>' . hsc($button["pretag"]) . hsc($button["code"]) . hsc($button["posttag"]) . '</td>'); ptln(' <td><center><input type="radio" name="delete" value="' . $key . '"/></center></td>'); # FIXME Del image ptln(' </tr>'); } } } ptln(' </table>'); ptln('<input type="submit" class="button" value="' . $this->getLang('btn_delete') . '"/>'); ptln('</form>'); ptln('<br /><br />'); ptln('<h3>' . $this->getLang('addbtn') . '</h3>'); ptln('<form action="' . wl($ID) . '" method="post">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="add" value="1" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <table>'); ptln(' <tr><th>' . $this->getLang('addbtn_icon') . '</th><td>'); ptln('<select name="icon" class="custombutton_iconpicker">'); ptln('<option value="">' . $this->getLang('addbtn_textonly') . '</option>'); $files = glob(dirname(__FILE__) . '/ico/*.png'); foreach ($files as $file) { $file = hsc(basename($file)); ptln('<option value="' . $file . '" style="padding-left: 18px; background: #fff url(' . DOKU_BASE . 'lib/plugins/custombuttons/ico/' . $file . ') left center no-repeat">' . $file . '</option>'); } ptln('</select>'); ptln(' </td></tr>'); ptln(' <tr><th>' . $this->getLang('addbtn_label') . '</th><td><input type="text" name="label" /></td></tr>'); ptln(' <tr><th>' . $this->getLang('addbtn_pretag') . '</th><td><input type="text" name="pretag" /><b> *</b></td></tr>'); ptln(' <tr><th>' . $this->getLang('addbtn_posttag') . '</th><td><input type="text" name="posttag" /><b> *</b></td></tr>'); ptln(' <tr><th>' . $this->getLang('addbtn_code') . '</th><td><input type="text" name="code" /></td></tr>'); ptln(' </table>'); ptln(' <input type="submit" class="button" value="' . $this->getLang('btn_add') . '" />'); ptln('</form>'); ptln('<br><br>'); ptln('<div>' . $this->getLang('txt_comment') . '</div>'); }
/** * Displays the search form * * @author Michael Klier <*****@*****.**> */ function xhtml_search_form() { global $lang; ptln('<div class="level1">'); $blogs = $this->entryhelper->get_blogs(); $form = new Doku_Form(array('id' => 'blogtng__search_form')); $form->startFieldset($lang['btn_search']); $form->addHidden('page', 'blogtng'); $form->addHidden('btng[admin]', 'search'); $form->addElement(formSecurityToken()); $form->addElement(form_makeListBoxField('btng[query][blog]', $blogs, $_REQUEST['btng']['query']['blog'], $this->getLang('blog'))); $form->addElement(form_makeListBoxField('btng[query][filter]', array('entry_title', 'entry_author', 'comment', 'comment_ip', 'tags'), $_REQUEST['btng']['query']['filter'], $this->getLang('filter'))); $form->addElement(form_makeTextField('btng[query][string]', $_REQUEST['btng']['query']['string'], '')); $form->addElement(form_makeButton('submit', 'admin', $lang['btn_search'])); $form->endFieldset(); html_form('blogtng__search_form', $form); ptln('</div>'); }
/** * function _print * @author Myron Turner */ function _print() { global $INFO; global $lang; global $fckg_lang; global $ID; global $REV; global $DATE; global $PRE; global $SUF; global $SUM; $wr = $INFO['writable']; if ($wr) { if ($REV) { print p_locale_xhtml('editrev'); } $ro = false; } else { // check pseudo action 'source' if (!actionOK('source')) { msg('Command disabled: source', -1); return false; } print p_locale_xhtml('read'); $ro = 'readonly="readonly"'; } if (!$DATE) { $DATE = $INFO['lastmod']; } $guest_toolbar = $this->getConf('guest_toolbar'); $guest_media = $this->getConf('guest_media'); if (!isset($INFO['userinfo']) && !$guest_toolbar) { echo $this->helper->registerOnLoad(' fck = new FCKeditor("wiki__text", "100%", "600"); fck.BasePath = "' . DOKU_BASE . 'lib/plugins/fckg/' . $this->fck_location . '/"; fck.ToolbarSet = "DokuwikiNoGuest"; fck.ReplaceTextarea();'); } else { if (!isset($INFO['userinfo']) && !$guest_media) { echo $this->helper->registerOnLoad(' fck = new FCKeditor("wiki__text", "100%", "600"); fck.BasePath = "' . DOKU_BASE . 'lib/plugins/fckg/' . $this->fck_location . '/"; fck.ToolbarSet = "DokuwikiGuest"; fck.ReplaceTextarea();'); } else { echo $this->helper->registerOnLoad(' fck = new FCKeditor("wiki__text", "100%", "600"); fck.BasePath = "' . DOKU_BASE . 'lib/plugins/fckg/' . $this->fck_location . '/"; fck.ToolbarSet = "Dokuwiki"; fck.ReplaceTextarea();'); } } ?> <form id="dw__editform" method="post" action="<?php echo script(); ?> " accept-charset="<?php echo $lang['encoding']; ?> "> <div class="no"> <input type="hidden" name="id" value="<?php echo $ID; ?> " /> <input type="hidden" name="rev" value="<?php echo $REV; ?> " /> <input type="hidden" name="date" value="<?php echo $DATE; ?> " /> <input type="hidden" name="prefix" value="<?php echo formText($PRE); ?> " /> <input type="hidden" name="suffix" value="<?php echo formText($SUF); ?> " /> <input type="hidden" id="fckg_mode_type" name="mode" value="" /> <input type="hidden" id="fck_preview_mode" name="fck_preview_mode" value="nil" /> <input type="hidden" id="fck_wikitext" name="fck_wikitext" value="__false__" /> <?php if (function_exists('formSecurityToken')) { formSecurityToken(); } ?> </div> <textarea name="wikitext" id="wiki__text" <?php echo $ro; ?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n" . $this->xhtml; ?> </textarea> <?php $temp = array(); trigger_event('HTML_EDITFORM_INJECTION', $temp); $DW_EDIT_disabled = ''; $guest_perm = auth_quickaclcheck($_REQUEST['id']); $guest_group = false; $guest_user = false; if (isset($INFO['userinfo']) && isset($INFO['userinfo']['grps'])) { $user_groups = $INFO['userinfo']['grps']; if (is_array($user_groups) && $user_groups) { foreach ($user_groups as $group) { if (strcasecmp('guest', $group) == 0) { $guest_group = true; break; } } } if ($INFO['client'] == 'guest') { $guest_user = true; } } if (($guest_user || $guest_group) && $guest_perm <= 2) { $DW_EDIT_disabled = 'disabled'; } $DW_EDIT_hide = $this->dw_edit_displayed(); ?> <div id="wiki__editbar"> <div id="size__ctl"></div> <div id = "fck_size__ctl" style="display: none"> <img src = "<?php echo DOKU_BASE; ?> lib/images/smaller.gif" title="edit window smaller" onclick="dwfck_size_ctl('smaller');" /> <img src = "<?php echo DOKU_BASE; ?> lib/images/larger.gif" title="edit window larger" onclick="dwfck_size_ctl('larger');" /> </div> <?php if ($wr) { ?> <div class="editButtons"> <input type="checkbox" name="fckg" value="fckg" checked="checked" style="display: none"/> <input class="button" type="button" name="do[save]" value="<?php echo $lang['btn_save']; ?> " title="<?php echo $lang['btn_save']; ?> " <?php echo $DW_EDIT_disabled; ?> onmousedown="parse_wikitext('edbtn__save');" /> <input class="button" id="ebtn__delete" type="submit" <?php echo $DW_EDIT_disabled; ?> name="do[delete]" value="<?php echo $lang['btn_delete']; ?> " title="<?php echo $fckg_lang['title_dw_delete']; ?> " style = "font-size: 100%;" onmouseup="draft_delete();" onclick = "return confirm('<?php echo $fckg_lang['confirm_delete']; ?> ');" /> <input type="checkbox" name="fckg" value="fckg" style="display: none"/> <input class="button" <?php echo $DW_EDIT_disabled; ?> <?php echo $DW_EDIT_hide; ?> style = "font-size: 100%;" onclick ="setDWEditCookie(2, this);parse_wikitext('edbtn__save');this.form.submit();" type="submit" name="do[save]" value="<?php echo $fckg_lang['btn_dw_edit']; ?> " title="<?php echo $fckg_lang['title_dw_edit']; ?> " /> <?php global $INFO; $disabled = 'Disabled'; $inline = $this->test ? 'inline' : 'none'; $backup_btn = isset($fckg_lang['dw_btn_backup']) ? $fckg_lang['dw_btn_backup'] : $fckg_lang['dw_btn_refresh']; $backup_title = isset($fckg_lang['title_dw_backup']) ? $fckg_lang['title_dw_backup'] : $fckg_lang['title_dw_refresh']; $using_scayt = $this->getConf('scayt') == 'on'; ?> <input class="button" type="submit" name="do[draftdel]" value="<?php echo $lang['btn_cancel']; ?> " onmouseup="draft_delete();" style = "font-size: 100%;" title = "<?php echo $fckg_lang['title_dw_cancel']; ?> " /> <?php if (!$using_scayt) { ?> <input class="button" type="button" value = "<?php echo $fckg_lang['dw_btn_lang']; ?> " title="<?php echo $fckg_lang['title_dw_lang']; ?> " onclick="aspell_window();" /> <?php } ?> <input class="button" type="button" value = "Test" title="Test" style = 'display:<?php echo $inline; ?> ;' onmousedown="parse_wikitext('test');" /> <?php if ($this->draft_found) { ?> <input class="button" onclick ="fckg_get_draft();" style = "background-color: yellow" id="fckg_draft_btn" type="button" value="<?php echo $fckg_lang['btn_draft']; ?> " title="<?php echo $fckg_lang['title_draft']; ?> " /> <?php } else { ?> <input class="button" type="button" value="<?php echo $backup_btn; ?> " title="<?php echo $backup_title; ?> " onclick="renewLock(true);" /> <input class="button" type="button" value="<?php echo $fckg_lang['dw_btn_revert']; ?> " title="<?php echo $fckg_lang['title_dw_revert']; ?> " onclick="revert_to_prev()" /> <br /> <?php } ?> <?php if ($this->debug) { ?> <input class="button" type="button" value = "Debug" title="Debug" onclick="HTMLParser_debug();" /> <br /> <?php } ?> <div id = "backup_msg" class="backup_msg" style=" display:none;"> <table><tr><td class = "backup_msg_td"> <div id="backup_msg_area" class="backup_msg_area"></div> <td> <td align="right"> <a href="javascript:hide_backup_msg();void(0);" class="backup_msg_close">[ close ]</a> </table> </div> <input type="checkbox" name="fckg_timer" value="fckg_timer" id = "fckg_timer" style = 'display:none' onclick="disableDokuWikiLockTimer();" <?php echo $disabled; ?> /><span id='fckg_timer_label' style = 'display:none'>Disable editor time-out messsages </span> <?php //global $useComplexTables; if(!$useComplexTables) { ?> <label class="nowrap" for="complex_tables" > <input type="checkbox" name="complex_tables" value="complex_tables" id = "complex_tables" onclick="setComplexTables(1);" /><span id='complex_tables_label'> <?php echo $fckg_lang['complex_tables']; ?> (<a href="https://www.dokuwiki.org/plugin:fckglite#table_handling" target='_blank'><?php echo $fckg_lang['whats_this']; ?> </a>)</span></label> <?php //} ?> <input style="display:none;" class="button" id="edbtn__save" type="submit" name="do[save]" value="<?php echo $lang['btn_save']; ?> " onmouseup="draft_delete();" <?php echo $DW_EDIT_disabled; ?> title="<?php echo $lang['btn_save']; ?> " /> <!-- Not used by fckgLite but required to prevent null error when DW adds events --> <input type="button" id='edbtn__preview' style="display: none"/> <div id='saved_wiki_html' style = 'display:none;' ></div> <div id='fckg_draft_html' style = 'display:none;' > <?php echo $this->draft_text; ?> </div> <script type="text/javascript"> //<![CDATA[ var embedComplexTableMacro = false; <?php echo 'var backup_empty = "' . $fckg_lang['backup_empty'] . '";'; ?> function aspell_window() { var DURL = "<?php echo DOKU_URL; ?> "; window.open( DURL + "/lib/plugins/fckg/fckeditor/aspell.php?dw_conf_lang=<?php global $conf; echo $conf['lang']; ?> ", "smallwin", "width=600,height=500,scrollbars=yes"); } if(unsetDokuWikiLockTimer) unsetDokuWikiLockTimer(); function dwfck_size_ctl(which) { var height = parseInt(document.getElementById('wiki__text___Frame').style.height); if(which == 'smaller') { height -= 50; } else { height += 50; } document.getElementById('wiki__text___Frame').style.height = height + 'px'; } setComplexTables = (function() { var on=false; return function(b) { if(b) on = !on; embedComplexTableMacro = on; return on; }; })(); <?php global $useComplexTables; if ($useComplexTables) { ?> document.getElementById('complex_tables').click(); <?php } ?> var fckgLPluginPatterns = new Array(); <?php global $fckgLPluginPatterns; $utf8Chars = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'Œ', 'œ', 'Š', 'š', 'Ÿ', 'ƒ'); $utf8Replacments = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'Œ', 'œ', 'Š', 'š', 'Ÿ', 'ƒ'); foreach ($fckgLPluginPatterns as $pat) { $pat[0] = preg_replace('/\\s+$/', "", $pat[0]); $pat[1] = str_replace('&', '&', $pat[1]); $pat[0] = str_replace('&', '&', $pat[0]); $pat[0] = str_replace('>', '>', $pat[0]); $pat[0] = str_replace('<', '<', $pat[0]); $pat[1] = str_replace('>', '>', $pat[1]); $pat[1] = str_replace('<', '<', $pat[1]); $pat[0] = preg_replace('/\\s+/', '\\s+', $pat[0]); $pat[0] = str_replace('*', '%%\\*%%', $pat[0]); $pat[0] = str_replace($utf8Chars, $utf8Replacments, $pat[0]); $pat[0] = preg_quote($pat[0], "/"); echo "fckgLPluginPatterns.push({'pat': '{$pat['0']}', 'orig': '{$pat['1']}' });\n"; } global $fckLImmutables; echo "if(!fckLImmutables) var fckLImmutables = new Array();\n"; for ($i = 0; $i < count($fckLImmutables); $i++) { echo "fckLImmutables.push('{$fckLImmutables[$i]}');\n"; } $pos = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'); if ($pos === false) { echo "var isIE = false;"; } else { echo "var isIE = true;"; } echo "var doku_base = '" . DOKU_BASE . "'"; ?> var fckg_draft_btn = "<?php echo $fckg_lang['btn_exit_draft']; ?> "; var fckg_draft_btn_title = "<?php echo $fckg_lang['title_exit_draft']; ?> "; function fckg_get_draft() { var dom = GetE('fckg_draft_html'); var draft = dom.innerHTML; var dw_text = oDokuWiki_FCKEditorInstance.GetData( true ); oInst = oDokuWiki_FCKEditorInstance.get_FCK(); oInst =oInst.EditorDocument.body; oInst.innerHTML = draft; dom.innerHTML = dw_text; var btn = GetE('fckg_draft_btn'); var tmp = btn.value; btn.value = fckg_draft_btn; fckg_draft_btn = tmp; tmp = fckg_draft_btn_title; btn.title = fckg_draft_btn_title; fckg_draft_btn_title = tmp; } function safe_convert(value) { if(oDokuWiki_FCKEditorInstance.dwiki_fnencode && oDokuWiki_FCKEditorInstance.dwiki_fnencode == 'safe') { <?php global $updateVersion; if (!isset($updateVersion)) { $updateVersion = 0; } echo "updateVersion={$updateVersion};"; $list = plugin_list('action'); $safe_converted = false; if (in_array('safefnrecode', $list)) { $safe_converted = true; } ?> if(value.match(/%25/ && value.match(/%25[a-z0-9]/))) { value = value.replace(/%25/g,"%"); <?php if ($updateVersion > 30 || $safe_converted) { echo 'value = value.replace(/%5D/g,"]");'; } ?> value = dwikiUTF8_decodeFN(value,'safe'); } } return value; } RegExp.escape = function(str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); } var HTMLParser_DEBUG = ""; function parse_wikitext(id) { var useComplexTables = setComplexTables(); var this_debug; <?php if ($this->debug) { ?> function show_rowspans(rows) { if(!useComplexTables) return; var str = ""; for(var i=0; i < rows.length; i++) { str+="ROW" + i + "\n"; for(var col=0; col<rows[i].length; col++) { str += "[" + col + "]"; str+= "text="+rows[i][col].text + " "; str+=" type="+rows[i][col].type + " "; str+= " rowspan=" +rows[i][col].rowspan + " "; str+= " colspan=" +rows[i][col].colspan + " "; } str += "\n"; } this_debug(str,'show_rowspans'); str = ""; for(var i=0; i < rows.length; i++) { for(var col=0; col<rows[i].length; col++) { str+= "|"+rows[i][col].text + " "; } str += "|\n"; } this_debug(str,'show_rowspans'); } function debug_row(rows,row,col,which) { var not_found = ""; try { this_debug("row:"+row +",column:"+col +", rowspans:"+ rows[row][col].rowspan +", colspans:"+ rows[row][col].colspan +", text:"+rows[row][col].text, which); }catch(ex) { not_found+="row:"+row +",column:"+col; } if(not_found) this_debug(not_found,"not_found"); } <?php } ?> function check_rowspans(rows,start_row, ini) { var tmp=new Array(); for(var i=start_row; i < rows.length; i++) { for(var col=0; col<rows[i].length; col++) { if(rows[i][col].rowspan > 0) { var _text = rows[i][col].text; tmp.push({row:i,column:col, spans: rows[i][col].rowspan,text:_text}); if(!ini) break; } } } return tmp; } function insert_rowspan(row,col,spans,rows,shift) { var prev_colspans = rows[row][col].colspan ? rows[row][col].colspan: 0; rows[row][col].rowspan = 0; for(i=0; i<spans-1;i++) { //debug_row(rows,row,col,"insert_rowspan start"); rows[++row].splice(col, 0,{type:'td', rowspan:0,colspan:prev_colspans,prev_colspan:prev_colspans,text:" ::: "}); } } function reorder_span_rows(rows) { var tmp_start = check_rowspans(rows,0,true); var num_spans = tmp_start.length; if(!num_spans) return false; var row = tmp_start[0].row; var col = tmp_start[0].column; insert_rowspan(row,col,tmp_start[0].spans,rows); num_spans--; for(var i=0; i < num_spans; i++) { row++; var tmp = check_rowspans(rows,row,false); if(tmp.length) { insert_rowspan(tmp[0].row,tmp[0].column,tmp[0].spans,rows); } } return true; } function insert_table(rows) { if(!useComplexTables) return; for(var i=0; i<rows.length;i++) { if(!reorder_span_rows(rows)) break;; } results+="\n"; for(var i=0; i < rows.length; i++) { results+="\n"; for(var col=0; col<rows[i].length; col++) { var type = rows[i][col].type == 'td'? '|': '^'; results+= type; var align = rows[i][col].align ? rows[i][col].align : false; if(align == 'center' || align == 'right') { results += " "; } results += rows[i][col].text; if(align == 'center' || align == 'left') { results += " "; } if(rows[i][col].colspan) { for(var n=0; n < rows[i][col].colspan-1; n++) { results+=type; } } } results += '|'; } } window.dwfckTextChanged = false; if(id != 'bakup') draft_delete(); var line_break = "\nL_BR_K \n"; var markup = { 'b': '**', 'i':'//', 'em': '//', 'u': '__', 'br':line_break, 'del': '<del>', 'strike': '<del>', p: "\n\n" , 'a':'[[', 'img': '\{\{', 'h1': "\n====== ", 'h2': "\n===== ", 'h3': "\n==== ", 'h4': "\n=== ", 'h5': "\n== ", 'td': "|", 'th': "^", 'tr':" ", 'table': "\n\n", 'ol':" - ", 'ul': " * ", 'li': "", 'plugin': '<plugin ', 'code': "\'\'",'pre': "\n<", 'hr': "\n\n----\n\n", 'sub': '<sub>', 'font': "\n", 'sup': '<sup>', 'div':"\n\n", 'span': "\n", 'dl': "\n", 'dd': "\n", 'dt': "\n" }; var markup_end = { 'del': '</del>', 'strike': '</del>', 'p': " ", 'br':" ", 'a': ']]','img': '\}\}', 'h1': " ======\n", 'h2': " =====\n", 'h3': " ====\n", 'h4': " ===\n", 'h5': " ==\n", 'td': " ", 'th': " ", 'tr':"|\n", 'ol':" ", 'ul': " ", 'li': "\n", 'plugin': '</plugin>', 'pre': "\n</",'sub': '</sub>', 'sup': '</sup> ', 'div':"\n\n", 'p': "\n\n", 'font': "</font> " }; markup['blank'] = ""; markup['fn_start'] = '(('; markup['fn_end'] = '))'; markup['row_span'] = ":::"; markup['p_insert'] = '_PARA__TABLE_INS_'; markup['format_space'] = '_FORMAT_SPACE_'; markup['pre_td'] = '<'; //removes newline from before < which corrupts table var format_chars = {'b':true, 'i': true, 'em':true,'u':true, 'del':true,'strike':true, 'code':true}; var results=""; var HTMLParser_LBR = false; var HTMLParser_PRE = false; var HTMLParser_Geshi = false; var HTMLParser_TABLE = false; var HTMLParser_COLSPAN = false; var HTMLParser_PLUGIN = false; var HTMLParser_FORMAT_SPACE = false; var HTMLParser_MULTI_LINE_PLUGIN = false; var HTMLParser_NOWIKI = false; var HTMLFormatInList = false; var HTMLAcroInList = false; var CurrentTable; var HTMLParserTopNotes = new Array(); var HTMLParserBottomNotes = new Array(); var HTMLParserOpenAngleBracket = false; var HTMLParserParaInsert = markup['p_insert']; // var geshi_classes = 'br0|co0|co1|co2|co3|coMULTI|es0|kw1|kw2|kw3|kw4|kw5|me1|me2|nu0|re0|re1|re2|re3|re4|st0|sy0|sy1|sy2|sy3|sy4'; var geshi_classes = '(br|co|coMULTI|es|kw|me|nu|re|st|sy)[0-9]'; String.frasl = new RegExp("⁄\|⁄\|⁄\|⁄",'g'); geshi_classes = new RegExp(geshi_classes); HTMLParser(oDokuWiki_FCKEditorInstance.GetData( true ), { attribute: "", link_title: "", link_class: "", image_link_type: "", td_align: "", in_td: false, td_colspan: 0, td_rowspan: 0, rowspan_col: 0, last_column: -1, row:0, col:0, // table_start: false, td_no: 0, tr_no: 0, current_row:false, in_table: false, in_multi_plugin: false, is_rowspan: false, list_level: 0, prev_list_level: -1, list_started: false, xcl_markup: false, in_link: false, link_formats: new Array(), last_tag: "", code_type: false, in_endnotes: false, is_smiley: false, geshi: false, downloadable_code: false, export_code: false, code_snippet: false, downloadable_file: "", external_mime: false, in_header: false, is_acronym: false, curid: false, format_in_list: false, prev_li: new Array(), immutable_plugin: false, link_only: false, in_font: false, interwiki: false, bottom_url: false, backup: function(c1,c2) { var c1_inx = results.lastIndexOf(c1); // start position of chars to delete var c2_inx = results.indexOf(c2,c1_inx); // position of expected next character if(c1_inx == -1 || c2_inx == -1) return; if(c1.length + c2_inx == c2_inx) { var left_side = results.substring(0,c1_inx); //from 0 up to but not including c1 var right_side = results.substring(c2_inx); //from c2 to end of string results = left_side + right_side; return true; } return false; }, start: function( tag, attrs, unary ) { this_debug = this.dbg; if(markup[tag]) { if(format_chars[tag] && this.in_link) { this.link_formats.push(tag); return; } if(format_chars[tag] && this.in_font) { return; } else if(tag == 'acronym') { return; } if(tag == 'ol' || tag == 'ul') { this.prev_list_level = this.list_level; this.list_level++; if(this.list_level == 1) this.list_started = false; if(this.list_started) this.prev_li.push(markup['li']) ; markup['li'] = markup[tag]; return; } else if(!this.list_level) { markup['li'] = ""; this.prev_li = new Array(); } if(tag == 'img') { var img_size="?"; var width; var height; var style = false; var img_align = ''; var alt = ""; this.is_smiley = false; this.in_link = false; } if(tag == 'a') { var local_image = true; var type = ""; this.xcl_markup = false; // set to false in end() as well, double sure this.in_link = true; this.link_pos = results.length; this.link_formats = new Array(); this.footnote = false; var bottom_note = false; this.id = ""; this.external_mime = false; var media_class=false; this.export_code = false; this.code_snippet = false; this.downloadable_file = ""; var qs_set = false; this.link_only = false; save_url = ""; this.interwiki=false; this.bottom_url=false; this.link_class=""; } if(tag == 'p') { this.in_link = false; if(this.in_table) { tag = 'p_insert'; HTMLParser_TABLE=true; } } else if(tag=='span') { var font_family = "arial"; var font_size = "9pt"; var font_weight = "normal"; var font_color; var font_bgcolor; } if(tag == 'table') { this.td_no = 0; this.tr_no = 0; this.in_table = true; this.is_rowspan = false; this.row=-1; this.rows = new Array(); CurrentTable = this.rows; this.table_start = results.length; } else if(tag == 'tr') { this.tr_no++; this.td_no = 0; this.col=-1; this.row++; this.rows[this.row] = new Array(); this.current_row = this.rows[this.row]; } else if(tag == 'td' || tag == 'th') { this.td_no++; this.col++; this.current_row[this.col] = {type:tag, rowspan:0,colspan:0,text:""}; this.cell_start = results.length; this.current_cell = this.current_row[this.col]; if(this.td_rowspan && this.rowspan_col == this.td_no && this.td_no != this.last_column) { this.is_rowspan = true; this.td_rowspan --; } else { this.is_rowspan = false; } } var matches; this.attr=false; this.format_tag = false; if(format_chars[tag])this.format_tag = true; var dwfck_note = false; for ( var i = 0; i < attrs.length; i++ ) { // if(!confirm(tag + ' ' + attrs[i].name + '="' + attrs[i].escaped + '"')) exit; if(tag == 'td' || tag == 'th') { // if(!confirm(tag + ' ' + attrs[i].name + '="' + attrs[i].escaped + '"')) exit; if(attrs[i].name =='colspan') { this.current_row[this.col].colspan = attrs[i].value; } if(attrs[i].name =='class') { if((matches=attrs[i].value.match(/(left|center|right)/))) { this.current_row[this.col].align = matches[1]; } } if(attrs[i].name == 'rowspan') { this.current_row[this.col].rowspan= attrs[i].value } } if(attrs[i].escaped == 'u' && tag == 'em' ) { tag = 'u'; this.attr='u' break; } if(tag == 'div') { if(attrs[i].name == 'class' && attrs[i].value == 'footnotes') { tag = 'blank'; this.in_endnotes = true; } break; } if(tag == 'dl' && attrs[i].name == 'class' && attrs[i].value == 'file') { this.downloadable_code = true; HTMLParser_Geshi = true; return; } if(tag == 'span' && attrs[i].name == 'class') { if(attrs[i].value == 'np_break') return; } if(tag == 'span' && attrs[i].name == 'class') { if(attrs[i].value =='curid') { this.curid = true; return; } if(attrs[i].value == 'multi_p_open') { this.in_multi_plugin = true; HTMLParser_MULTI_LINE_PLUGIN = true; return; } if(attrs[i].value == 'multi_p_close') { this.in_multi_plugin = false; return; } if(attrs[i].value.match(geshi_classes)) { tag = 'blank'; this.geshi = true; break; } } if(tag == 'span' && attrs[i].name == 'id') { if((matches= attrs[i].value.match(/imm_(\d+)/))) { this.immutable_plugin = fckLImmutables[matches[1]]; } } else if(tag == 'span') { if(attrs[i].name == 'face') { this.in_font=true; font_family = attrs[i].value; } if(attrs[i].name == 'style') { matches = attrs[i].value.match(/font-size:\s*(\d+(\w+|%))/); if(matches){ font_size = matches[1]; } matches = attrs[i].value.match(/font-weight:\s*(\w+)/); if(matches) { font_weight = matches[1]; } matches = attrs[i].value.match(/[^\-]color:\s*([#\w\s\d,\(\)]+);?/); if(matches) { font_color = matches[1]; } matches = attrs[i].value.match(/background[-]color:\s*([#\w\s\d,\(\)]+);?/i); if(matches) { font_bgcolor = matches[1]; } } else if(attrs[i].name == 'color') { font_color = attrs[i].value; } } if(tag == 'td' || tag == 'th') { if(tag == 'td') { results = results.replace(/\^$/,'|'); } this.in_td = true; if(attrs[i].name == 'align') { this.td_align =attrs[i].escaped; } else if(attrs[i].name == 'class') { matches = attrs[i].value.match(/\s+(\w+)align/); if(matches) { this.td_align = matches[1]; } } else if(attrs[i].name == 'colspan') { HTMLParser_COLSPAN = true; this.td_colspan =attrs[i].escaped; } else if(attrs[i].name == 'rowspan') { this.td_rowspan =attrs[i].escaped-1; this.rowspan_col = this.td_no; } HTMLParser_TABLE=true; } if(tag == 'a') { if(attrs[i].name == 'title') { this.link_title = attrs[i].escaped; this.link_title = this.link_title.replace(/\s+.*$/,"") ; } else if(attrs[i].name == 'class') { if(attrs[i].value.match(/fn_top/)) { this.footnote = true; } else if(attrs[i].value.match(/fn_bot/)) { bottom_note = true; } else if(attrs[i].value.match(/mf_(png|gif|jpg|jpeg)/i)) { this.link_only=true; } this.link_class= attrs[i].escaped; media_class = this.link_class.match(/mediafile/); } else if(attrs[i].name == 'id') { this.id = attrs[i].value; } else if(attrs[i].name == 'type') { type = attrs[i].value; } else if(attrs[i].name == 'href' && !this.code_type) { var http = attrs[i].escaped.match(/https*:\/\//) ? true : false; if(http) save_url = attrs[i].escaped; if(attrs[i].escaped.match(/\/lib\/exe\/detail.php/)) { this.image_link_type = 'detail'; } else if(attrs[i].escaped.match(/exe\/fetch.php/)) { this.image_link_type = 'direct'; } else { // nice urls using .htaccess var regex = new RegExp(DOKU_BASE + '_detail'); if(attrs[i].escaped.match(regex)) { this.image_link_type = 'detail'; } } // required to distinguish external images from external mime types // that are on the wiki which also use {{url}} var media_type = attrs[i].escaped.match(/fetch\.php.*?media=.*?\.(png|gif|jpg|jpeg)$/i); if(media_type) media_type = media_type[1]; if(attrs[i].escaped.match(/^https*:/)) { this.attr = attrs[i].escaped; local_image = false; } if(attrs[i].escaped.match(/^ftp:/)) { this.attr = attrs[i].escaped; local_image = false; } else if(attrs[i].escaped.match(/do=export_code/)) { this.export_code = true; } else if(attrs[i].escaped.match(/^nntp:/)) { this.attr = attrs[i].escaped; local_image = false; } else if(attrs[i].escaped.match(/^mailto:/)) { this.attr = attrs[i].escaped.replace(/mailto:/,""); local_image = false; } else if(attrs[i].escaped.match(/^file:/)) { //samba share var url= attrs[i].value.replace(/file:[\/]+/,""); url = url.replace(/[\/]/g,'\\'); url = '\\\\' + url; this.attr = url; local_image = false; } // external mime types after they've been saved first time else if(http && !media_type && (matches = attrs[i].escaped.match(/fetch\.php(.*)/)) ) { if(matches[1].match(/media=/)) { elems = matches[1].split(/=/); this.attr = elems[1]; } else { // nice urls matches[1] = matches[1].replace(/^\//,""); this.attr = matches[1]; } local_image = false; this.attr = decodeURIComponent ? decodeURIComponent(this.attr) : unescape(this.attr); if(!this.attr.match(/^:/)) { this.attr = ':' +this.attr; } this.external_mime = true; } else { local_image = false; matches = attrs[i].escaped.match(/doku.php\?id=(.*)/); if(!matches) { matches = attrs[i].escaped.match(/doku.php\/(.*)/); } /* previously saved internal link with query string requires initial ? to be recognized by DW. In Anteater and later */ if(matches) { if(!matches[1].match(/\?/) && matches[1].match(/&/)) { qs_set = true; matches[1] = matches[1].replace(/&/,'?') } } if(matches && matches[1]) { if(!matches[1].match(/^:/)) { this.attr = ':' + matches[1]; } else { this.attr = matches[1]; } if(this.attr.match(/\.\w+$/)) { // external mime's first access if(type && type == 'other_mime') { this.external_mime = true; } else { for(var n = i+1; n < attrs.length; n++) { if(attrs[n].value.match(/other_mime/)) this.external_mime = true; break; } } } } else { matches = attrs[i].value.match(/\\\\/); // Windows share if(matches) { this.attr = attrs[i].escaped; local_image = false; } } } if(this.link_class == 'media') { if(attrs[i].value.match(/http:/)) { local_image = false; } } if(!this.attr && this.link_title) { if(this.link_class == 'media') { this.attr=this.link_title; local_image = true; } } if(this.attr.match && this.attr.match(/%[a-fA-F0-9]{2}/) && (matches = this.attr.match(/userfiles\/file\/(.*)/))) { matches[1] = matches[1].replace(/\//g,':'); if(!matches[1].match(/^:/)) { matches[1] = ':' + matches[1]; } this.attr = decodeURIComponent ? decodeURIComponent(matches[1]) : unescape(matches[1]); this.attr = decodeURIComponent ? decodeURIComponent(this.attr) : unescape(this.attr); this.external_mime = true; } // alert('title: ' + this.link_title + ' class: ' + this.link_class + ' export: ' +this.export_code); if(this.link_title.match(/Snippet/)) this.code_snippet = true; /* anchors to current page without prefixing namespace:page */ if(attrs[i].value.match(/^#/) && this.link_class.match(/wikilink/)) { this.attr = attrs[i].value; this.link_title = false; } /* These two conditions catch user_rewrite not caught above */ if(this.link_class.match(/wikilink/) && this.link_title) { this.external_mime = false; if(!this.attr){ this.attr = this.link_title; } if(!this.attr.match(/^:/)) { this.attr = ':' + this.attr; } if(this.attr.match(/\?.*?=/)){ var elems = this.attr.split(/\?/); elems[0] = elems[0].replace(/\//g,':'); this.attr = elems[0] + '?' + elems[1]; } else { this.attr = this.attr.replace(/\//g,':'); } /* catch query strings attached to internal links for .htacess nice urls */ if(!qs_set && attrs[i].name == 'href') { if(!this.attr.match(/\?.*?=/) && !attrs[i].value.match(/doku.php/)) { var qs = attrs[i].value.match(/(\?.*)$/); if(qs && qs[1]) this.attr += qs[1]; } } } else if(this.link_class.match(/mediafile/) && this.link_title && !this.attr) { this.attr = this.link_title; this.external_mime = true; if(!this.attr.match(/^:/)) { this.attr = ':' + this.attr; } } else if(this.link_class.match(/interwiki/)) { var iw_type = this.link_class.match(/iw_(\w+)/); var iw_title = this.link_title.split(/\//); var interwiki_label = iw_title[iw_title.length-1]; interwiki_label = interwiki_label.replace(String.frasl,"\/"); this.attr = iw_type[1] + '>' + interwiki_label; this.interwiki=true; } if(this.link_class == 'urlextern') { this.attr = save_url; this.external_mime=false; // prevents external links to images from being converted to image links } if(this.in_endnotes) { if(this.link_title) { this.bottom_url= this.link_title; //save for bottom urls } else if(this.attr) { this.bottom_url= this.attr; } } this.link_title = ""; this.link_class= ""; // break; } } if(tag == 'plugin') { if(isIE) HTMLParser_PLUGIN = true; if(attrs[i].name == 'title') { this.attr = ' title="' + attrs[i].escaped + '" '; break; } } if(tag == 'sup') { if(attrs[i].name == 'class') { matches = attrs[i].value.split(/\s+/); if(matches[0] == 'dwfcknote') { this.attr = matches[0]; tag = 'blank'; if(oDokuWiki_FCKEditorInstance.oinsertHtmlCodeObj.notes[matches[1]]) { dwfck_note = '(('+ oDokuWiki_FCKEditorInstance.oinsertHtmlCodeObj.notes[matches[1]] + '))'; } break; } } } if(tag == 'pre') { if(attrs[i].name == 'class') { var elems = attrs[i].escaped.split(/\s+/); if(elems.length > 1) { this.attr = attrs[i].value; this.code_type = elems[0]; } else { this.attr = attrs[i].escaped; this.code_type = this.attr; } if(this.downloadable_code) { this.attr = this.attr.replace(/\s*code\s*/,""); this.code_type='file'; } HTMLParser_PRE = true; if(this.in_table) tag = 'pre_td'; break; } } else if(tag == 'img') { if(attrs[i].name == 'alt') { alt=attrs[i].value; } if(attrs[i].name == 'type') { this.image_link_type = attrs[i].value; } if(attrs[i].name == 'src') { // alert(attrs[i].name + ' = ' + attrs[i].value + ', fnencode=' + oDokuWiki_FCKEditorInstance.dwiki_fnencode); var src = ""; // fetched by fetch.php if(matches = attrs[i].escaped.match(/fetch\.php.*?(media=.*)/)) { var elems = matches[1].split('='); src = elems[1]; if(matches = attrs[i].escaped.match(/(media.*)/)) { var elems = matches[1].split('='); var uri = elems[1]; src = decodeURIComponent ? decodeURIComponent(uri) : unescape(uri); } if(!src.match(/https?:/) && !src.match(/^:/)) src = ':' + src; } else if(attrs[i].escaped.match(/http:\/\//)){ src = attrs[i].escaped; } // url rewrite 1 else if(matches = attrs[i].escaped.match(/\/_media\/(.*)/)) { var elems = matches[1].split(/\?/); src = elems[0]; src = src.replace(/\//g,':'); if(!src.match(/^:/)) src = ':' + src; } // url rewrite 2 else if(matches = attrs[i].escaped.match(/\/lib\/exe\/fetch.php\/(.*)/)) { var elems = matches[1].split(/\?/); src = elems[0]; if(!src.match(/^:/)) src = ':' + src; } else { // first insertion from media mananger matches = attrs[i].escaped.match(/^.*?\/userfiles\/image\/(.*)/); if(!matches) { // windows style var regex = doku_base + 'data/media/'; regex = regex.replace(/([\/\\])/g, "\\$1"); regex = '^.*?' + regex + '(.*)'; regex = new RegExp(regex); matches = attrs[i].escaped.match(regex); } if(matches && matches[1]) { src = matches[1].replace(/\//g, ':'); src = ':' + src; src = safe_convert(src); } else { src = decodeURIComponent ? decodeURIComponent(attrs[i].escaped) : unescape(attrs[i].escaped); // src = unescape(attrs[i].escaped); // external image (or smiley) } if(src.match(/lib\/images\/smileys/)) { // src = 'http://' + window.location.host + src; this.is_smiley = true; } } this.attr = src; if(this.attr.match && this.attr.match(/%[a-fA-F0-9]{2}/)) { this.attr = decodeURIComponent ? decodeURIComponent(this.attr) : unescape(this.attr); this.attr = decodeURIComponent ? decodeURIComponent(this.attr) : unescape(this.attr); } } // src end else if (attrs[i].name == 'width' && !style) { width=attrs[i].value; } else if (attrs[i].name == 'height' && !style) { height=attrs[i].value; } else if(attrs[i].name == 'style') { var match = attrs[i].escaped.match(/width:\s*(\d+)/); if(match) { width=match[1]; var match = attrs[i].escaped.match(/height:\s*(\d+)/); if(match) height = match[1]; } } else if(attrs[i].name == 'align' || attrs[i].name == 'class') { if(attrs[i].escaped.match(/(center|middle)/)) { img_align = 'center'; } else if(attrs[i].escaped.match(/right/)) { img_align = 'right'; } else if(attrs[i].escaped.match(/left/)) { img_align = 'left'; } else { img_align = ''; } } } // End img } // End Attributes Loop if(this.is_smiley) { if(alt) { results += alt + ' '; alt = ""; } this.is_smiley = false; return; } if(this.link_only) tag = 'img'; if(tag == 'br') { if(this.in_multi_plugin) { results += "\n"; return; } if(!this.code_type) { HTMLParser_LBR = true; } else if(this.code_type) { results += "\n"; return; } if(this.in_table) { results += HTMLParserParaInsert; return; } if(this.list_started) { results += '_LIST_EOFL_'; /* enables newlines in lists: abc \\def */ } else { results += '\\\\ '; return; } } else if(tag.match(/^h(\d+|r)/)) { var str_len = results.length; if(tag.match(/h(\d+)/)) { this.in_header = true; } if(str_len) { if(results.charCodeAt(str_len -1) == 32) { results = results.replace(/\x20+$/,""); } } } else if(this.last_col_pipes) { if(format_chars[tag]) results += markup[tag]; tag = 'blank'; } else if(dwfck_note) { results += dwfck_note; return; } if(tag == 'b' || tag == 'i' && this.list_level) { if(results.match(/(\/\/|\*)(\x20)+/)) { results = results.replace(/(\/\/|\*)(\x20+)\-/,"$1\n"+"$2-"); } } if(tag == 'li' && this.list_level) { if(this.list_level == 1 & !this.list_started) { results += "\n"; this.list_started = true; } results = results.replace(/[\x20]+$/,""); for(var s=0; s < this.list_level; s++) { // this handles format characters at the ends of list lines if(results.match(/_FORMAT_SPACE_\s*$/)) { results = results.replace(/_FORMAT_SPACE_\s*$/,"\n"); } results += ' '; } if(this.prev_list_level > 0 && markup['li'] == markup['ol']) { this.prev_list_level = -1; } } if(tag == 'a' && local_image) { this.xcl_markup = true; return; } else if(tag == 'a' && (this.export_code || this.code_snippet)) { return; } else if (tag == 'a' && this.footnote) { tag = 'fn_start'; } else if(tag == 'a' && bottom_note) { HTMLParserTopNotes.push(this.id); } else if(tag == 'a' && this.external_mime) { if(this.in_endnotes) { this.link_class = 'media'; return; } results += markup['img']; if(this.attr) { results += this.attr + '|'; } return; } else if(this.in_font || tag == 'font') { /* <font 18pt:bold/garamond;;color;;background_color> */ if(!font_family) { return; } if(font_color) font_color = font_color.replace(/\s+/g,""); if(font_bgcolor) font_bgcolor = font_bgcolor.replace(/\s+/g,""); if(!font_color) font_color = "#000000"; if(!font_bgcolor) font_bgcolor = "#ffffff"; if(font_color) font_family = font_family + ';;'+ font_color; if(font_bgcolor) { font_family = font_family + ';;'+ font_bgcolor; } var font_tag = '<font ' + font_size + ':'+ font_weight + '/'+font_family+'>'; results += font_tag ; return; } if(this.in_endnotes && tag == 'a') return; if(this.code_type && tag == 'span') tag = 'blank'; results += markup[tag]; if(tag == 'td' || tag == 'th' || (this.last_col_pipes && this.td_align == 'center')) { if(this.is_rowspan) { results += markup['row_span'] + ' | '; this.is_rowspan = false; } if(this.td_align == 'center' || this.td_align == 'right') { results += ' '; } } else if(tag == 'a' && this.attr) { results += this.attr + '|'; } else if(tag == 'img') { var link_type = this.image_link_type; this.image_link_type=""; if(this.link_only) link_type = 'link_only'; if(!link_type){ link_type = 'nolink'; } else if(link_type == 'detail') { link_type = ""; } if(link_type == 'link_only') { img_size='?linkonly'; } else if(link_type) { img_size += link_type + '&'; } if(width && height) { img_size +=width + 'x' + height; } else if(width) { img_size +=width; } else if(!link_type) { img_size=""; } if(img_align && img_align != 'left') { results += ' '; } this.attr += img_size; if(img_align == 'center' || img_align == 'left') { this.attr += ' '; } results += this.attr + '}}'; this.attr = 'src'; } else if(tag == 'plugin' || tag == 'pre' || tag == 'pre_td') { if(this.downloadable_file) this.attr += ' ' + this.downloadable_file; if(!this.attr) this.attr = 'code'; results += this.attr + '>'; this.downloadable_file = ""; this.downloadable_code = false; } } // if markup tag }, end: function( tag ) { if(format_chars[tag] && this.in_font) { results+=' '; return; } if(this.in_endnotes && tag == 'a') return; if(this.link_only){ this.link_only=false; return; } if(!markup[tag]) return; if(tag == 'sup' && this.attr == 'dwfcknote') { return; } if(this.is_smiley) { this.is_smiley = false; if(tag !='li') return; } if(tag == 'span' && this.in_font) { tag = 'font'; this.in_font=false; } if(tag == 'span' && this.curid) { this.curid = false; return; } if(tag == 'dl' && this.downloadable_code) { this.downloadable_code = false; return; } if(useComplexTables && (tag == 'td' || tag == 'th')) { this.current_cell.text = results.substring(this.cell_start); this.current_cell.text = this.current_cell.text.replace(/:::/gm,""); this.current_cell.text = this.current_cell.text.replace(/^[\s\|\^]+/,""); } if(tag == 'a' && (this.export_code || this.code_snippet)) { this.export_code = false; this.code_snippet = false; return; } if(this.code_type && tag == 'span') tag = 'blank'; var current_tag = tag; if(this.footnote) { tag = 'fn_end'; this.footnote = false; } else if(tag == 'a' && this.xcl_markup) { this.xcl_markup = false; return; } else if(tag == 'table') { this.in_table = false; if(useComplexTables ) { results = results.substring(0, this.table_start); insert_table(this.rows); } } if(tag == 'p' && this.in_table) { tag = 'p_insert'; HTMLParser_TABLE=true; } if(this.geshi) { this.geshi = false; return; } if(tag == 'code' && ! this.list_started) { // empty code markup corrupts results if(results.match(/''\s*$/m)) { results = results.replace(/''\s*$/, "\n"); return; } } else if(tag == 'a' && this.attr == 'src') { // if local image without link content, as in <a . . .></a>, delete link markup if(this.backup('\[\[', '\{')) return; } if(tag == 'ol' || tag == 'ul') { this.list_level--; if(!this.list_level) this.format_in_list = false; if(this.prev_li.length) { markup['li']= this.prev_li.pop(); } tag = "\n\n"; } else if(tag == 'a' && this.external_mime) { tag = '}} '; this.external_mime = false; } else if(tag == 'pre') { tag = markup_end[tag]; if(this.code_type) { tag += this.code_type + ">"; } else { var codeinx = results.lastIndexOf('code'); var fileinx = results.lastIndexOf('file'); if(fileinx > codeinx) { this.code_type = 'file'; } else this.code_type = 'code'; tag += this.code_type + ">"; } this.code_type = false; } else if(markup_end[tag]) { tag = markup_end[tag]; } else if(this.attr == 'u' && tag == 'em' ) { tag = 'u'; } else if(tag == 'acronym') { } else { tag = markup[tag]; } if(current_tag == 'tr') { if(this.last_col_pipes) { tag = "\n"; this.last_col_pipes = ""; } if(this.td_rowspan && this.rowspan_col == this.td_no+1) { this.is_rowspan = false; this.last_column = this.td_no; this.td_rowspan --; tag = '|' + markup['row_span'] + "|\n"; } } else if(current_tag == 'td' || current_tag == 'th') { this.last_col_pipes = ""; this.in_td = false; } else if (current_tag.match(/h\d+/)) { this.in_header = false; } if(markup['li']) { if(results.match(/\n$/)) { tag = ""; } } if(this.in_link && format_chars[current_tag] && this.link_formats.length) { return; } results += tag; if(format_chars[current_tag]) { if(this.list_level) { this.format_in_list = true; HTMLFormatInList = true; } results += markup['format_space']; HTMLParser_FORMAT_SPACE = markup['format_space']; } this.last_tag = current_tag; if(this.td_colspan && !useComplexTables) { if(this.td_align == 'center') results += ' '; var _colspan = "|"; if(current_tag == 'th') _colspan = '^'; var colspan = _colspan; for(var i=1; i < this.td_colspan; i++) { colspan += _colspan; } this.last_col_pipes = colspan; results += colspan; this.td_colspan = false; } else if(this.td_align == 'center') { results += ' '; this.td_align = ''; } if(current_tag == 'a' && this.link_formats.length) { var end_str = results.substring(this.link_pos); var start_str = results.substring(0,this.link_pos); var start_format = ""; var end_format = ""; for(var i=0; i < this.link_formats.length; i++) { var fmt = markup[this.link_formats[i]]; var endfmt = markup_end[this.link_formats[i]] ? markup_end[this.link_formats[i]]: fmt; start_format += markup[this.link_formats[i]]; end_format = endfmt + end_format; } start_str += start_format; end_str += end_format; results = start_str + end_str; this.link_formats = new Array(); this.in_link = false; } else if(current_tag == 'a') { this.link_formats = new Array(); this.in_link = false; } else if(current_tag == 'span' ) { this.immutable_plugin = false; } }, chars: function( text ) { if(this.interwiki && results.match(/>\w+\s*\|$/)) { text = text.replace(String.frasl,"\/"); this.interwiki=false; if(this.attr) { results+= text; } else { results=results.replace(/>\w+\s*\|$/,'>'+text); } return; } else if(this.interwiki) { text = text.replace(String.frasl,"\/"); } //adjust spacing on multi-formatted strings results=results.replace(/([\/\*_])_FORMAT_SPACE_([\/\*_]{2})_FORMAT_SPACE_$/,"$1$2"); if(text.match(/^&\w+;/)) { results=results.replace(/_FORMAT_SPACE_\s*$/,""); // remove unwanted space after character entity } if(this.link_only) { if(text) { replacement = '|'+text + '}} '; results = results.replace(/\}\}\s*$/,replacement); } return; } if(!this.code_type) { if(! this.last_col_pipes) { text = text.replace(/\x20{6,}/, " "); text = text.replace(/^( )+/, ''); text = text.replace(/( )+/, ' '); } if(this.immutable_plugin) { text = this.immutable_plugin; text = text.replace(/\/\/<\/\//g,'<'); this.immutable_plugin = false; } if(this.format_tag) { if(!this.list_started || this.in_table) text = text.replace(/^\s+/, '@@_SP_@@'); } else if(this.last_tag=='a') { text=text.replace(/^\s{2,}/," "); } else text = text.replace(/^\s+/, ''); if(text.match(/nowiki>/)) { HTMLParser_NOWIKI=true; } if(this.is_acronym) { this.is_acronym = false; } if(this.format_in_list ) { text = text.replace(/^[\n\s]+$/g, ''); } if(this.in_td && !text) { text = "_FCKG_BLANK_TD_"; this.in_td = false; } } else { text = text.replace(/<\s/g, '<'); text = text.replace(/\s>/g, '>'); } if(this.attr && this.attr == 'dwfcknote') { if(text.match(/fckgL\d+/)) { return; } if(text.match(/^[\-,:;!_]/)) { results += text; } else { results += ' ' + text; } return; } if(this.downloadable_code && (this.export_code || this.code_snippet)) { this.downloadable_file = text; return; } /* remove space between link end markup and following punctuation */ if(this.last_tag == 'a' && text.match(/^[\.,;\:\!]/)) { results=results.replace(/\s$/,""); } if(this.in_header) { text = text.replace(/---/g,'—'); text = text.replace(/--/g,'–'); } if(this.list_started) { results=results.replace(/_LIST_EOFL_\s*L_BR_K\s*$/, '_LIST_EOFL_'); } if(!this.code_type) { // keep special character literals outside of code block // don't touch samba share or Windows path backslashes if(!results.match(/\[\[\\\\.*?\|$/) && !text.match(/\w:(\\(\w?))+/ )) { text = text.replace(/([\*\\])/g, '%%$1%%'); } } if(this.in_endnotes && HTMLParserTopNotes.length) { if(text.match(/\w/) && ! text.match(/^\s*\d\)\s*$/)) { text= text.replace(/\)\s*$/, "_FN_PAREN_C_"); var index = HTMLParserTopNotes.length-1; if(this.bottom_url) { if(this.link_class && this.link_class == 'media') { text = '{{' + this.bottom_url + '|' +text +'}}'; } else text = '[[' + this.bottom_url + '|' +text +']]'; } if(HTMLParserBottomNotes[HTMLParserTopNotes[index]]) { HTMLParserBottomNotes[HTMLParserTopNotes[index]] += ' ' + text; } else { HTMLParserBottomNotes[HTMLParserTopNotes[index]] = text; } } this.bottom_url = false; return; } if(HTMLParser_PLUGIN) { HTMLParser_PLUGIN=false; if(results.match(/>\s*<\/plugin>\s*$/)) { results = results.replace(/\s*<\/plugin>\s*$/, text + '<\/plugin>'); return; } } if(text && text.length) { results += text; } // remove space between formatted character entity and following character string results=results.replace(/(&\w+;)\s*([\*\/_]{2})_FORMAT_SPACE_(\w+)/,"$1$2$3"); if(this.list_level && this.list_level > 1) { results = results.replace(/(\[\[.*?\]\])([ ]+[\*\-].*)$/," $1\n$2"); } try { // in case regex throws error on dynamic regex creation var regex = new RegExp('([\*\/\_]{2,})_FORMAT_SPACE_([\*\/\_]{2,})(' + RegExp.escape(text) + ')$'); if(results.match(regex)) { // remove left-over space inside multiple format sequences results = results.replace(regex,"$1$2$3"); } } catch(ex){} if(!HTMLParserOpenAngleBracket) { if(text.match(/</)) { HTMLParserOpenAngleBracket = true; } } }, comment: function( text ) { // results += "<!--" + text + "-->"; }, dbg: function(text, heading) { <?php if ($this->debug) { ?> if(text.replace) { text = text.replace(/^\s+/g,""); text = text.replace(/^\n$/g,""); if(!text) return; } if(heading) { heading = '<b>'+heading+"</b>\n"; } HTMLParser_DEBUG += heading + text + "\n__________\n"; <?php } ?> } } ); //show_rowspans(CurrentTable); for(var i=0; i < fckgLPluginPatterns.length; i++) { fckgLPluginPatterns[i].pat = fckgLPluginPatterns[i].pat.replace(/\|/g,"\\|"); fckgLPluginPatterns[i].pat = fckgLPluginPatterns[i].pat.replace(/([\(\)\{\}\.\?\[\]])/g, "\\$1"); var pattern = new RegExp(fckgLPluginPatterns[i].pat,"gm"); results = results.replace(pattern, fckgLPluginPatterns[i].orig); } /* we allow escaping of troublesome characters in plugins by enclosing them withinback slashes, as in \*\ the escapes are removed here together with any DW percent escapes */ results = results.replace(/(\[\[\\\\)(.*?)\]\]/gm, function(match,brackets,block) { block=block.replace(/\\/g,"_SMB_"); return brackets+block + ']]'; }); results = results.replace(/%*\\%*([^\w]{1})%*\\%*/g, "$1"); results=results.replace(/_SMB_/g, "\\"); if(id == 'test') { if(!HTMLParser_test_result(results)) return; } if(HTMLParser_FORMAT_SPACE) { if(HTMLParser_COLSPAN) { results =results.replace(/\s*([\|\^]+)((\W\W_FORMAT_SPACE_)+)/gm,function(match,pipes,format) { format = format.replace(/_FORMAT_SPACE_/g,""); return(format + pipes); }); } results = results.replace(/"/g,'"'); var regex = new RegExp(HTMLParser_FORMAT_SPACE + '([\\-]{2,})', "g"); results = results.replace(regex," $1"); var regex = new RegExp("(\\w|\\d)(\\*\\*|\\/\\/|\\'\\'|__|<\/del>)" + HTMLParser_FORMAT_SPACE + '(\\w|\\d)',"g"); results = results.replace(regex,"$1$2$3"); var regex = new RegExp(HTMLParser_FORMAT_SPACE + '@@_SP_@@',"g"); results = results.replace(regex,' '); //spacing around entities with double format characters results=results.replace(/([\*\/_]{2})@@_SP_@@(&\w+;)/g,"$1 $2"); results = results.replace(/\n@@_SP_@@\n/g,''); results = results.replace(/@@_SP_@@\n/g,''); results = results.replace(/@@_SP_@@/g,''); var regex = new RegExp(HTMLParser_FORMAT_SPACE + '([^\\)\\]\\}\\{\\-\\.,;:\\!\?"\x94\x92\u201D\u2019' + "'" + '])',"g"); results = results.replace(regex," $1"); regex = new RegExp(HTMLParser_FORMAT_SPACE,"g"); results = results.replace(regex,''); if(HTMLFormatInList) { /* removes extra newlines from lists */ results = results.replace(/(\s+[\-\*_]\s*)([\*\/_\']{2})(.*?)(\2)([^\n]*)\n+/gm, function(match,list_type,format,text, list_type_close, rest) { return(list_type+format+text+list_type_close+rest +"\n"); }); } } var line_break_final = "\\\\"; if(HTMLParser_LBR) { results = results.replace(/(L_BR_K)+/g,line_break_final); results = results.replace(/L_BR_K/gm, line_break_final) ; results = results.replace(/(\\\\)\s+/gm, "$1 \n"); } if(HTMLParser_PRE) { results = results.replace(/\s+<\/(code|file)>/g, "\n</" + "$1" + ">"); if(HTMLParser_Geshi) { results = results.replace(/\s+;/mg, ";"); results = results.replace(/<\s+/mg, "<"); results = results.replace(/\s+>/mg, ">"); } } if(HTMLParser_TABLE) { results += "\n" + line_break_final + "\n"; var regex = new RegExp(HTMLParserParaInsert,"g"); results = results.replace(regex, ' ' +line_break_final + ' '); // fix for colspans which have had text formatting which cause extra empty cells to be created results = results.replace(/(\||\^)[ ]+(\||\^)\s$/g, "$1\n"); results = results.replace(/(\||\^)[ ]+(\||\^)/g, "$1"); // prevents valid empty td/th cells from being removed above results = results.replace(/_FCKG_BLANK_TD_/g, " "); } if(HTMLParserOpenAngleBracket) { results = results.replace(/\/\/<\/\/\s*/g,'<'); } if(HTMLParserTopNotes.length) { results = results.replace(/\(\(+(\d+)\)\)+/,"(($1))"); for(var i in HTMLParserBottomNotes) { // re-insert DW's bottom notes at text level var matches = i.match(/_(\d+)/); var pattern = new RegExp('(\<sup\>)*[\(]+' + matches[1] + '[\)]+(<\/sup>)*'); results = results.replace(pattern,'((' + HTMLParserBottomNotes[i].replace(/_FN_PAREN_C_/g, ") ") +'))'); } results = results.replace(/<sup><\/sup>/g, ""); } results = results.replace(/(={3,}.*?)(\{\{.*?\}\})(.*?={3,})/g,"$1$3\n\n$2"); // remove any empty footnote markup left after section re-edits results = results.replace(/(<sup>)*\s*\[\[\s*\]\]\s*(<\/sup>)*\n*/g,""); if(HTMLParser_MULTI_LINE_PLUGIN) { results = results.replace(/<\s+/g, '<'); results = results.replace(/<\s+/g, '<'); } if(HTMLParser_NOWIKI) { /* any characters escaped by DW %%<char>%% are replaced by NOWIKI_<char> <char> is restored in save.php */ var nowiki_escapes = '%'; //this technique allows for added chars to attach to NOWIKI_$1_ var regex = new RegExp('([' + nowiki_escapes + '])', "g"); results=results.replace(/(<nowiki>)(.*?)(<\/nowiki>)/mg, function(all,start,mid,close) { mid = mid.replace(/%%(.)%%/mg,"NOWIKI_$1_"); return start + mid.replace(regex,"NOWIKI_$1_") + close; }); } results = results.replace(/SWF(\s*)\[*/g,"{{$1"); results = results.replace(/\|.*?\]*(\s*)FWS/g,"$1}}"); results = results.replace(/(\s*)FWS/g,"$1}}"); results = results.replace(/\n{3,}/g,'\n\n'); results = results.replace(/_LIST_EOFL_/gm, " " + line_break_final + " "); if(embedComplexTableMacro) { if(results.indexOf('~~COMPLEX_TABLES~~') == -1) { results += "\n~~COMPLEX_TABLES~~\n" } } if(id == 'test') { if(HTMLParser_test_result(results)) { alert(results); } return; } var dwform = GetE('dw__editform'); dwform.elements.fck_wikitext.value = results; if(id == 'bakup') { //alert(results); return; } if(id) { var dom = GetE(id); dom.click(); return true; } } <?php if ($this->debug) { ?> function HTMLParser_debug() { HTMLParser_DEBUG = ""; parse_wikitext(""); /* for(var i in oDokuWiki_FCKEditorInstance) { HTMLParser_DEBUG += i + ' = ' + oDokuWiki_FCKEditorInstance[i] + "\n";; } */ var w = window.open(); w.document.write('<pre>' + HTMLParser_DEBUG + '</pre>'); w.document.close(); } <?php } ?> <?php $url = DOKU_URL . 'lib/plugins/fckg/scripts/script-cmpr.js'; echo "var script_url = '{$url}';"; // $safe_url = DOKU_URL . 'lib/plugins/fckg/scripts/safeFN_cmpr.js'; ?> try { if(!HTMLParserInstalled){ LoadScript(script_url); } } catch (ex) { LoadScript(script_url); } if(window.DWikifnEncode && window.DWikifnEncode == 'safe') { LoadScript(DOKU_BASE + 'lib/plugins/fckg/scripts/safeFN_cmpr.js' ); } //]]> </script> </div> <?php } ?> <?php if ($wr) { ?> <div class="summary"> <label for="edit__summary" class="nowrap"><?php echo $lang['summary']; ?> :</label> <input type="text" class="edit" name="summary" id="edit__summary" size="50" value="<?php echo formText($SUM); ?> " tabindex="2" /> <label class="nowrap" for="minoredit"><input type="checkbox" id="minoredit" name="minor" value="1" tabindex="3" /> <span><?php echo $fckg_lang['minor_changes']; ?> </span></label> </div> <?php } ?> </div> </form> <!-- draft messages from DW --> <div id="draft__status"></div> <?php }
/** * output appropriate html */ function html() { $this->macros_data = $this->get_macros(); $this->js(); if ($this->output) { ptln('<pre>' . $this->output . '</pre>'); } ptln('<div style="padding:4px" id="ti_info">'); ptln('<div style="text-align:right;">'); ptln('<button class="button" style="padding:0px;margin:0px;" onclick="replace_show(\'ti_info_btn\');">'); ptln($this->getLang('hide_info') . '</button> '); ptln('</div>'); ptln('<h2>Info</h2>'); ptln($this->locale_xhtml(intro) . '</div>'); ptln('<div style="padding-bottom:8px;">'); ptln('<button class="button" onclick="replace_show(\'macro_add\'); ">'); ptln($this->getLang('add_macros') . '</button> '); ptln('<button class="button" onclick="replace_show(\'macro_del\'); ">'); ptln($this->getLang('delete_macros') . '</button> '); ptln('<button class="button" onclick="replace_show(\'macro_edit\'); ">'); ptln($this->getLang('edit_macros') . '</button> '); ptln('<button class="button" onclick="ti_getEL(\'macro_list\').style.display=\'block\';ti_getEL(\'macro_list\').scrollIntoView();">'); ptln($this->getLang('view_macros') . '</button> '); ptln('<button class="button" onclick="ti_getEL(\'macro_list\').style.display=\'none\';">'); ptln($this->getLang('hide_macros') . '</button> '); ptln('<button class="button" id="ti_info_btn" style="display:none" onclick="ti_getEL(\'ti_info\').style.display=\'block\';">'); ptln($this->getLang('show_info') . '</button>'); ptln('</div>'); ptln('<form action="' . wl($ID) . '" method="post">'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln('<div id="macro_add" style="display:none">'); ptln('<h2>' . $this->getLang('label_add') . '</h2>'); ptln('<table cellspacing="8px"><tr><th>Macro</th><th>' . $this->getLang('col_subst') . '</th></tr>'); ptln('<tr><td> <input type="text" name="macro[A]" id="m_A" value="" /></td>'); ptln('<td> <input type="text" name="word[A]" size="80" id="w_A" value="" /></td></tr>'); ptln('<tr><td> <input type="text" name="macro[B]" id="m_B" value="" /></td>'); ptln('<td> <input type="text" name="word[B]" size="80" id="w_B" value="" /></td></tr>'); ptln('<tr><td> <input type="text" name="macro[C]" id="m_C" value="" /></td>'); ptln('<td> <input type="text" name="word[C]" size="80" id="w_C" value="" /></td></tr>'); ptln('<tr><td> <input type="text" name="macro[D]" id="m_D" value="" /></td>'); ptln('<td> <input type="text" name="word[D]" size="80" id="w_C" value="" /></td></tr>'); ptln('<tr><td> <input type="text" name="macro[E]" id="m_E" value="" /></td>'); ptln('<td> <input type="text" name="word[E]" size="80" id="w_E" value="" /></td>'); ptln('<tr><td> <input type="text" name="macro[F]" id="m_F" value="" /></td>'); ptln('<td> <textarea cols="45" name="word[F]" rows="4" id="w_F"></textarea></td>'); ptln('</table>'); ptln(' <input type="submit" name="cmd[add]" value="' . $this->getLang('btn_add') . '" />'); ptln('</div><br />'); ptln('<div id="macro_del" style="display:none">'); ptln('<h2>' . $this->getLang('label_del') . '</h2>'); $this->get_delete_list(); ptln('<br /><input type="submit" name="cmd[delete]" value="' . $this->getLang('btn_del') . '" />'); ptln('</div>'); ptln('<div id="macro_edit" style="display:none; padding: 8px;">'); ptln('<h2>' . $this->getLang('label_edit') . '</h2>'); $this->get_edit_list(); ptln('<br /><input type="submit" name="cmd[edit]" value="' . $this->getLang('btn_edit') . '" />'); ptln('</div>'); ptln('</form>'); ptln('<br /><div id="macro_list" style="overflow:auto;display:block;">'); ptln('<h2>' . $this->getLang('label_list') . '</h2>'); $this->view_entries(); ptln('</div>'); }
/** * Create the Editor for a new lookup row */ protected function lookup_new() { global $INPUT; global $lang; $tablename = $INPUT->str('schema'); $schema = new Schema($tablename); if (!$schema->isEditable()) { return; } // no permissions, no editor echo '<div class="struct_entry_form">'; echo '<fieldset>'; echo '<legend>' . $this->getLang('lookup new entry') . '</legend>'; /** @var action_plugin_struct_entry $entry */ $entry = plugin_load('action', 'struct_entry'); foreach ($schema->getColumns(false) as $column) { $label = $column->getLabel(); $field = new Value($column, ''); echo $entry->makeField($field, "entry[{$label}]"); } formSecurityToken(); // csrf protection echo '<input type="hidden" name="call" value="plugin_struct_lookup_save" />'; echo '<input type="hidden" name="schema" value="' . hsc($tablename) . '" />'; echo '<button type="submit">' . $lang['btn_save'] . '</button>'; echo '<div class="err"></div>'; echo '</fieldset>'; echo '</div>'; }
public function html() { global $ID; $conf = $this->loadCBData(); ptln('<h3>Buttons List</h3>'); ptln('<form action="' . wl($ID) . '" method="post">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <table class="inline">'); ptln(' <tr><th>Label</th><th>Code</th><th>Delete?</th></tr>'); if ($conf) { foreach ($conf as $key => $button) { if (!$button["type"]) { ptln(' <tr>'); ptln(' <td>' . hsc($button["label"]) . '</td>'); ptln(' <td>' . hsc($button["code"]) . '</td>'); ptln(' <td><center><input type="radio" name="delete" value="' . $key . '"/></center></td>'); # FIXME Del image ptln(' </tr>'); } else { $icon = ''; if ($button['icon']) { $icon = '<img src="' . DOKU_BASE . 'lib/plugins/custombuttons/ico/' . hsc($button['icon']) . '"> '; } ptln(' <tr>'); ptln(' <td>' . $icon . hsc($button["label"]) . '</td>'); ptln(' <td>' . hsc($button["pretag"]) . hsc($button["code"]) . hsc($button["posttag"]) . '</td>'); ptln(' <td><center><input type="radio" name="delete" value="' . $key . '"/></center></td>'); # FIXME Del image ptln(' </tr>'); } } } ptln(' </table>'); ptln('<input type="submit" class="button" value="Delete Selected"/>'); ptln('</form>'); ptln('<br /><br />'); ptln('<h3>Add Button</h3>'); ptln('<form action="' . wl($ID) . '" method="post">'); ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="add" value="1" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <table>'); ptln(' <tr><th>Icon:</th><td>'); ptln('<select name="icon" class="custombutton_iconpicker">'); ptln('<option value="">text only</option>'); $files = glob(dirname(__FILE__) . '/ico/*.png'); foreach ($files as $file) { $file = hsc(basename($file)); ptln('<option value="' . $file . '" style="padding-left: 18px; background: #fff url(' . DOKU_BASE . 'lib/plugins/custombuttons/ico/' . $file . ') left center no-repeat">' . $file . '</option>'); } ptln('</select>'); ptln(' </td></tr>'); ptln(' <tr><th>Label:</th><td><input type="text" name="label" /></td></tr>'); ptln(' <tr><th>Pre tag:</th><td><input type="text" name="pretag" /><b> *</b></td></tr>'); ptln(' <tr><th>Post tag:</th><td><input type="text" name="posttag" /><b> *</b></td></tr>'); ptln(' <tr><th>Code:</th><td><input type="text" name="code" /></td></tr>'); ptln(' </table>'); ptln(' <input type="submit" class="button" value="Add" />'); ptln('</form>'); ptln('<br><br>'); ptln('<div><b>*</b> If you dont want to add a shortcut button with pre and post code leave those fields empty.</div>'); }
/** * Print import form and summary of previous import * * @param int $indent */ protected function _htmlImportForm($indent = 0) { global $ID; $failure_download_link = wl($ID, array('do' => 'admin', 'page' => 'usermanager', 'fn[importfails]' => 1)); ptln('<div class="level2 import_users">', $indent); print $this->locale_xhtml('import'); ptln(' <form action="' . wl($ID) . '" method="post" enctype="multipart/form-data">', $indent); formSecurityToken(); ptln(' <label>' . $this->lang['import_userlistcsv'] . '<input type="file" name="import" /></label>', $indent); ptln(' <input type="submit" name="fn[import]" value="' . $this->lang['import'] . '" />', $indent); ptln(' <input type="hidden" name="do" value="admin" />', $indent); ptln(' <input type="hidden" name="page" value="usermanager" />', $indent); $this->_htmlFilterSettings($indent + 4); ptln(' </form>', $indent); ptln('</div>'); // list failures from the previous import if ($this->_import_failures) { $digits = strlen(count($this->_import_failures)); ptln('<div class="level3 import_failures">', $indent); ptln(' <h3>' . $this->lang['import_header'] . '</h3>'); ptln(' <table class="import_failures">', $indent); ptln(' <thead>', $indent); ptln(' <tr>', $indent); ptln(' <th class="line">' . $this->lang['line'] . '</th>', $indent); ptln(' <th class="error">' . $this->lang['error'] . '</th>', $indent); ptln(' <th class="userid">' . $this->lang['user_id'] . '</th>', $indent); ptln(' <th class="username">' . $this->lang['user_name'] . '</th>', $indent); ptln(' <th class="usermail">' . $this->lang['user_mail'] . '</th>', $indent); ptln(' <th class="usergroups">' . $this->lang['user_groups'] . '</th>', $indent); ptln(' </tr>', $indent); ptln(' </thead>', $indent); ptln(' <tbody>', $indent); foreach ($this->_import_failures as $line => $failure) { ptln(' <tr>', $indent); ptln(' <td class="lineno"> ' . sprintf('%0' . $digits . 'd', $line) . ' </td>', $indent); ptln(' <td class="error">' . $failure['error'] . ' </td>', $indent); ptln(' <td class="field userid"> ' . hsc($failure['user'][0]) . ' </td>', $indent); ptln(' <td class="field username"> ' . hsc($failure['user'][2]) . ' </td>', $indent); ptln(' <td class="field usermail"> ' . hsc($failure['user'][3]) . ' </td>', $indent); ptln(' <td class="field usergroups"> ' . hsc($failure['user'][4]) . ' </td>', $indent); ptln(' </tr>', $indent); } ptln(' </tbody>', $indent); ptln(' </table>', $indent); ptln(' <p><a href="' . $failure_download_link . '">' . $this->lang['import_downloadfailures'] . '</a></p>'); ptln('</div>'); } }
/** * function _print * @author Myron Turner */ function _print() { global $INFO; global $lang; global $ckgedit_lang; global $ID; global $REV; global $DATE; global $PRE; global $SUF; global $SUM; $wr = $INFO['writable']; if ($wr) { if ($REV) { print p_locale_xhtml('editrev'); } $ro = false; } else { // check pseudo action 'source' if (!actionOK('source')) { msg('Command disabled: source', -1); return false; } print p_locale_xhtml('read'); $ro = 'readonly="readonly"'; } if (!$DATE) { $DATE = $INFO['lastmod']; } $guest_toolbar = $this->getConf('guest_toolbar'); $guest_media = $this->getConf('guest_media'); if (!isset($INFO['userinfo']) && !$guest_toolbar) { $toolbar = "DokuwikiNoGuest"; } else { if (!isset($INFO['userinfo']) && !$guest_media) { $toolbar = "DokuwikiGuest"; } else { $toolbar = 'Dokuwiki'; } } $height = isset($_COOKIE['ckgEdht']) && $_COOKIE['ckgEdht'] ? $_COOKIE['ckgEdht'] : 250; $doku_url = rtrim(DOKU_URL, '/'); $ckeditor_replace = <<<CKEDITOR_REPLACE \t\t ckgeditCKInstance = CKEDITOR.replace('wiki__text', \t\t { toolbar: '{$toolbar}' , height: {$height}, filebrowserImageBrowseUrl : '{$doku_url}/lib/plugins/ckgedit/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector={$doku_url}/lib/plugins/ckgedit/fckeditor/editor/filemanager/connectors/php/connector.php', filebrowserBrowseUrl: '{$doku_url}/lib/plugins/ckgedit/fckeditor/editor/filemanager/browser/default/browser.html?Type=File&Connector={$doku_url}/lib/plugins/ckgedit/fckeditor/editor/filemanager/connectors/php/connector.php', } \t\t ); FCKeditor_OnComplete(ckgeditCKInstance); CKEDITOR_REPLACE; echo $this->helper->registerOnLoad($ckeditor_replace); global $skip_styling; ?> <form id="dw__editform" method="post" action="<?php echo script(); ?> " accept-charset="<?php echo $lang['encoding']; ?> "> <div class="no"> <input type="hidden" name="id" value="<?php echo $ID; ?> " /> <input type="hidden" name="rev" value="<?php echo $REV; ?> " /> <input type="hidden" name="date" value="<?php echo $DATE; ?> " /> <input type="hidden" name="prefix" value="<?php echo formText($PRE); ?> " /> <input type="hidden" name="suffix" value="<?php echo formText($SUF); ?> " /> <input type="hidden" id="ckgedit_mode_type" name="mode" value="" /> <input type="hidden" id="fck_preview_mode" name="fck_preview_mode" value="nil" /> <input type="hidden" id="fck_wikitext" name="fck_wikitext" value="__false__" /> <input type="hidden" id="styling" name="styling" value="styles" /> <?php if (function_exists('formSecurityToken')) { formSecurityToken(); } ?> </div> <textarea name="wikitext" id="wiki__text" <?php echo $ro; ?> cols="80" rows="10" class="edit" tabindex="1"><?php echo "\n" . $this->xhtml; ?> </textarea> <?php $temp = array(); trigger_event('HTML_EDITFORM_INJECTION', $temp); $DW_EDIT_disabled = ''; $guest_perm = auth_quickaclcheck($_REQUEST['id']); $guest_group = false; $guest_user = false; if (isset($INFO['userinfo']) && isset($INFO['userinfo']['grps'])) { $user_groups = $INFO['userinfo']['grps']; if (is_array($user_groups) && $user_groups) { foreach ($user_groups as $group) { if (strcasecmp('guest', $group) == 0) { $guest_group = true; break; } } } if ($INFO['client'] == 'guest') { $guest_user = true; } } if (($guest_user || $guest_group) && $guest_perm <= 2) { $DW_EDIT_disabled = 'disabled'; } $DW_EDIT_hide = $this->dw_edit_displayed(); $is_ckgeditChrome = false; if (stripos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false) { preg_match("/Chrome\\/(\\d+)/", $_SERVER['HTTP_USER_AGENT'], $cmatch); if ((int) $cmatch[1] < 26) { $is_ckgeditChrome = true; } } ?> <div id="wiki__editbar"> <div id="size__ctl" style="display: none"></div> <?php if ($wr) { ?> <div class="editButtons"> <input type="checkbox" name="ckgedit" value="ckgedit" checked="checked" style="display: none"/> <input class="button" type="button" id = "save_button" name="do[save]" value="<?php echo $lang['btn_save']; ?> " title="<?php echo $lang['btn_save']; ?> " <?php echo $DW_EDIT_disabled; ?> /> <input class="button" id="ebtn__delete" type="submit" <?php echo $DW_EDIT_disabled; ?> name="do[delete]" value="<?php echo $lang['btn_delete']; ?> " title="<?php echo $this->getLang('title_dw_delete'); ?> " style = "font-size: 100%;" /> <?php if (!$is_ckgeditChrome) { ?> <input class="button" id = "ebtn__dwedit" <?php echo $DW_EDIT_disabled; ?> <?php echo $DW_EDIT_hide; ?> style = "font-size: 100%;" type="submit" name="do[save]" value="<?php echo $this->getLang('btn_dw_edit'); ?> " title="<?php echo $this->getLang('title_dw_edit'); ?> " /> <?php } global $INFO; $disabled = 'Disabled'; $inline = $this->test ? 'inline' : 'none'; $chrome_dwedit_link = '<a href="' . wl($INFO['id'], array('do' => 'show')) . '" ' . 'onclick="draft_delete();setDWEditCookie(2);"class="action edit" rel="nofollow" title="DW Edit"><span>DW Edit</span></a>'; $backup_btn = $this->getLang('dw_btn_backup') ? $this->getLang('dw_btn_backup') : $this->getLang('dw_btn_refresh'); $backup_title = $this->getLang('title_dw_backup') ? $this->getLang('title_dw_backup') : $this->getLang('title_dw_refresh'); $using_scayt = $this->getConf('scayt') == 'on'; ?> <input class="button" type="submit" name="do[draftdel]" id = "ebut_cancel" value="<?php echo $lang['btn_cancel']; ?> " style = "font-size: 100%;" title = "<?php echo $this->getLang('title_dw_cancel'); ?> " /> <!-- aspell button removed, not supported --> <input class="button" type="button" value = "Test" title="Test" style = 'display:<?php echo $inline; ?> ;' onmousedown="parse_wikitext('test');" /> <?php if ($this->draft_found) { ?> <input class="button" style = "background-color: yellow" id="ckgedit_draft_btn" type="button" value="<?php echo $this->getLang('btn_draft'); ?> " title="<?php echo $this->getLang('title_draft'); ?> " /> <?php } else { ?> <input class="button" type="button" id = "backup_button" value="<?php echo $backup_btn; ?> " title="<?php echo $backup_title; ?> " /> <input class="button" type="button" id = "revert_to_prev_btn" value="<?php echo $this->getLang('dw_btn_revert'); ?> " title="<?php echo $this->getLang('title_dw_revert'); ?> " /> <?php if (!$skip_styling) { ?> <input class="button" type="submit" name ="do[edit]" id = "no_styling_btn" style = "font-size: 100%;" value="<?php echo $this->getLang('dw_btn_styling'); ?> " title="<?php echo $this->getLang('title_styling'); ?> " /> <?php } ?> <?php if ($is_ckgeditChrome) { echo $chrome_dwedit_link; } ?> <br /> <?php } ?> <?php if ($this->debug) { ?> <input class="button" type="button" value = "Debug" title="Debug" onclick="HTMLParser_debug();" /> <br /> <?php } ?> <div id = "backup_msg" class="backup_msg" style=" display:none;"> <table><tr><td class = "backup_msg_td"> <div id="backup_msg_area" class="backup_msg_area"></div> <td> <td align="right"> <a href="javascript:hide_backup_msg();void(0);" class="backup_msg_close">[ close ]</a> </table> </div> <label class="nowrap" for="complex_tables" > <input type="checkbox" name="complex_tables" value="complex_tables" id = "complex_tables" /><span id='complex_tables_label'> <?php echo $this->getLang('complex_tables'); ?> </span></label> <label class="nowrap" for="editor_height"><?php echo $this->getLang('editor_height'); ?> </label> <input type="text" size= "4" name="editor_height" title = "<?php echo $this->getLang('editor_height_title'); ?> " value="<?php echo $height; ?> " id = "editor_height" onchange="setEdHeight(this.value);" /> px <input style="display:none;" class="button" id="edbtn__save" type="submit" name="do[save]" value="<?php echo $lang['btn_save']; ?> " onmouseup="draft_delete();" <?php echo $DW_EDIT_disabled; ?> title="<?php echo $lang['btn_save']; ?> " /> <!-- Not used by ckgedit but required to prevent null error when DW adds events --> <input type="button" id='edbtn__preview' style="display: none"/> <div id='saved_wiki_html' style = 'display:none;' ></div> <div id='ckgedit_draft_html' style = 'display:none;' > <?php echo $this->draft_text; ?> </div> </div> <?php } ?> <?php if ($wr) { ?> <div class="summary"> <label for="edit__summary" class="nowrap"><?php echo $lang['summary']; ?> :</label> <input type="text" class="edit" name="summary" id="edit__summary" size="50" value="<?php echo formText($SUM); ?> " tabindex="2" /> <label class="nowrap" for="minoredit"><input type="checkbox" id="minoredit" name="minor" value="1" tabindex="3" /> <span><?php echo $this->getLang('minor_changes'); ?> </span></label> </div> <?php } ?> </div> </form> <!-- draft messages from DW --> <div id="draft__status"></div> <script type="text/javascript"> //<![CDATA[ <?php echo 'var backup_empty = "' . $this->getLang('backup_empty') . '";'; ?> /* aspell_window removed, not supported */ if(window.unsetDokuWikiLockTimer) window.unsetDokuWikiLockTimer(); function getComplexTables() { return document.getElementById('complex_tables').checked; } <?php global $useComplexTables; if ($useComplexTables) { ?> document.getElementById('complex_tables').click(); <?php } ?> <?php if ($this->getConf('complex_tables')) { ?> document.getElementById('complex_tables').disabled = true; <?php } ?> <?php if (preg_match("/MISIE|Trident/", $_SERVER['HTTP_USER_AGENT'])) { echo "var isIE = true;"; } else { echo "var isIE = false;"; } echo "var doku_base = '" . DOKU_BASE . "'"; ?> var ckgedit_draft_btn = "<?php echo $this->getLang('btn_exit_draft'); ?> "; var ckgedit_draft_btn_title = "<?php echo $this->getLang('title_exit_draft'); ?> "; function ckgedit_get_draft() { var dom = GetE('ckgedit_draft_html'); var draft = dom.innerHTML; var dw_text = CKEDITOR.instances.wiki__text.getData(); CKEDITOR.instances.wiki__text.setData(draft); dom.innerHTML = dw_text; var btn = GetE('ckgedit_draft_btn'); var tmp = btn.value; btn.value = ckgedit_draft_btn; ckgedit_draft_btn = tmp; tmp = ckgedit_draft_btn_title; btn.title = ckgedit_draft_btn_title; ckgedit_draft_btn_title = tmp; } function safe_convert(value) { if(oDokuWiki_FCKEditorInstance.dwiki_fnencode && oDokuWiki_FCKEditorInstance.dwiki_fnencode == 'safe') { <?php global $updateVersion; if (!isset($updateVersion)) { $updateVersion = 0; } echo "updateVersion={$updateVersion};"; $list = plugin_list('action'); $safe_converted = false; if (in_array('safefnrecode', $list)) { $safe_converted = true; } ?> if(value.match(/%25/ && value.match(/%25[a-z0-9]/))) { value = value.replace(/%25/g,"%"); <?php if ($updateVersion > 30 || $safe_converted) { echo 'value = value.replace(/%5D/g,"]");'; } ?> value = dwikiUTF8_decodeFN(value,'safe'); } } return value; } RegExp.escape = function(str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); } var ckgedit_xcl_fonts =parseInt ("<?php echo $this->getConf('font_options'); ?> "); var ckgedit_xcl_colors =parseInt("<?php echo $this->getConf('color_options'); ?> "); var ckgedit_xcl_styles = (ckgedit_xcl_fonts + ckgedit_xcl_colors ==2) ? true : false; var HTMLParser_DEBUG = ""; <?php if ($this->debug) { ?> function HTMLParser_debug() { HTMLParser_DEBUG = ""; parse_wikitext(""); /* for(var i in oDokuWiki_FCKEditorInstance) { HTMLParser_DEBUG += i + ' = ' + oDokuWiki_FCKEditorInstance[i] + "\n";; } */ var w = window.open(); w.document.write('<pre>' + HTMLParser_DEBUG + '</pre>'); w.document.close(); } <?php } ?> <?php $url = DOKU_URL . 'lib/plugins/ckgedit/scripts/script-cmpr.js'; echo "var script_url = '{$url}';"; if ($this->test) { $parse_url = DOKU_URL . 'lib/plugins/ckgedit/scripts/parse_wiki.js.unc'; } else { $parse_url = DOKU_URL . 'lib/plugins/ckgedit/scripts/parse_wiki-cmpr.js'; } echo "var parse_url = '{$parse_url}';"; // $safe_url = DOKU_URL . 'lib/plugins/ckgedit/scripts/safeFN_cmpr.js'; ?> LoadScript(parse_url); try { if(!window.HTMLParserInstalled){ LoadScript(script_url); } } catch (ex) { LoadScript(script_url); } if(window.DWikifnEncode && window.DWikifnEncode == 'safe') { LoadScript(DOKU_BASE + 'lib/plugins/ckgedit/scripts/safeFN_cmpr.js' ); } //]]> </script> <?php }
/** * Print the search field form * * @author Tobias Sarnowski <*****@*****.**> */ function media_searchform($ns, $query = '') { global $lang; // The default HTML search form $form = new Doku_Form(array('id' => 'dw__mediasearch', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php')); $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>'); $form->addElement(formSecurityToken()); $form->addHidden('ns', $ns); $form->addHidden('do', 'searchlist'); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*')))); $form->addElement(form_makeButton('submit', '', $lang['btn_search'])); $form->addElement(form_makeCloseTag('p')); html_form('searchmedia', $form); }
/** * Creates the inline editor */ protected function inline_editor() { // silently fail when editing not possible if (!$this->initFromInput()) { return; } if (auth_quickaclcheck($this->pid) < AUTH_EDIT) { return; } if (!$this->schemadata->getSchema()->isEditable()) { return; } if (checklock($this->pid)) { return; } // lock page lock($this->pid); // output the editor $value = $this->schemadata->getDataColumn($this->column); echo '<label data-column="' . hsc($this->column->getFullQualifiedLabel()) . '">'; echo $value->getValueEditor('entry'); echo '</label>'; $hint = $this->column->getType()->getTranslatedHint(); if ($hint) { echo '<div class="hint">'; echo hsc($hint); echo '</div>'; } // csrf protection formSecurityToken(); }
/** * @todo disable fields which the backend can't change */ function _htmlUserForm($cmd, $user = '', $userdata = array(), $indent = 0) { global $conf; global $ID; $name = $mail = $groups = ''; $notes = array(); if ($user) { extract($userdata); if (!empty($grps)) { $groups = join(',', $grps); } } else { $notes[] = sprintf($this->lang['note_group'], $conf['defaultgroup']); } ptln("<form action=\"" . wl($ID) . "\" method=\"post\">", $indent); formSecurityToken(); ptln(" <table class=\"inline\">", $indent); ptln(" <thead>", $indent); ptln(" <tr><th>" . $this->lang["field"] . "</th><th>" . $this->lang["value"] . "</th></tr>", $indent); ptln(" </thead>", $indent); ptln(" <tbody>", $indent); $this->_htmlInputField($cmd . "_userid", "userid", $this->lang["user_id"], $user, $this->_auth->canDo("modLogin"), $indent + 6); $this->_htmlInputField($cmd . "_userpass", "userpass", $this->lang["user_pass"], "", $this->_auth->canDo("modPass"), $indent + 6); $this->_htmlInputField($cmd . "_username", "username", $this->lang["user_name"], $name, $this->_auth->canDo("modName"), $indent + 6); $this->_htmlInputField($cmd . "_usermail", "usermail", $this->lang["user_mail"], $mail, $this->_auth->canDo("modMail"), $indent + 6); $this->_htmlInputField($cmd . "_usergroups", "usergroups", $this->lang["user_groups"], $groups, $this->_auth->canDo("modGroups"), $indent + 6); if ($this->_auth->canDo("modPass")) { $notes[] = $this->lang['note_pass']; if ($user) { $notes[] = $this->lang['note_notify']; } ptln("<tr><td><label for=\"" . $cmd . "_usernotify\" >" . $this->lang["user_notify"] . ": </label></td><td><input type=\"checkbox\" id=\"" . $cmd . "_usernotify\" name=\"usernotify\" value=\"1\" /></td></tr>", $indent); } ptln(" </tbody>", $indent); ptln(" <tbody>", $indent); ptln(" <tr>", $indent); ptln(" <td colspan=\"2\">", $indent); ptln(" <input type=\"hidden\" name=\"do\" value=\"admin\" />", $indent); ptln(" <input type=\"hidden\" name=\"page\" value=\"usermanager\" />", $indent); // save current $user, we need this to access details if the name is changed if ($user) { ptln(" <input type=\"hidden\" name=\"userid_old\" value=\"" . $user . "\" />", $indent); } $this->_htmlFilterSettings($indent + 10); ptln(" <input type=\"submit\" name=\"fn[" . $cmd . "]\" class=\"button\" value=\"" . $this->lang[$cmd] . "\" />", $indent); ptln(" </td>", $indent); ptln(" </tr>", $indent); ptln(" </tbody>", $indent); ptln(" </table>", $indent); foreach ($notes as $note) { ptln("<div class=\"fn\">" . $note . "</div>", $indent); } ptln("</form>", $indent); }
/** * output appropriate html */ function html() { ptln('<div id="qs_general_intro">'); ptln($this->locale_xhtml(general_intro)); ptln('</div>'); ptln('<button class="button" onclick=" toggle_panel(' . "'qs_cache_panel'" . ');">' . $this->getLang("btn_prune") . '</button>'); ptln(' <button class="button" onclick="toggle_panel(' . "'quick__stats'" . ');">' . $this->getLang("btn_queries") . '</button>'); ptln(' <button class="button" id="qs_query_info_button" onclick="qs_open_info(' . "'qs_query_intro'" . ');">' . $this->getLang("btn_qinfo") . '</button>'); /* Cache Pruning Panel */ if (isset($this->deletions) || isset($this->to_confirm)) { $qs_display = ' style="display:block; "'; } else { $qs_display = ""; } ptln('<div ' . $qs_display . ' id="qs_cache_panel">'); ptln($this->locale_xhtml(intro)); ptln('<form action="' . wl($ID) . '" method="post">'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); ptln(' <input type="hidden" name="confirm" value="' . $this->to_confirm . '" />'); formSecurityToken(); ptln('<table cellspacing = "4">'); foreach ($this->cache as $key => $id) { $this->get_item($key, $id); } ptln('</table>'); ptln(' <input type="submit" name="cmd[delete]" class="button" value="' . $this->getLang('btn_delete') . '" />'); ptln(' <input type="submit" name="cmd[restore]" class="button" value="' . $this->getLang('btn_restore') . '" />'); ptln(' <input type="submit" name="cmd[confirm]" class="button" value="' . $this->getLang('btn_confirm') . '" />'); ptln('</form></div>'); /* Stats Panel */ $today = getdate(); ptln('<div id="quick__stats" class="quick__stats">'); ptln('<div class="qs_query_intro" id="qs_query_intro">' . $this->locale_xhtml(query)); ptln('<button class="button" onclick="qs_close_panel(' . "'qs_query_intro'" . ');">' . $this->getLang('btn_close_info') . '</button>'); ptln('</div>'); ptln('<p> </p><p><form id="qs_stats_form" action="javascript:void 0;">'); ptln('<input type="hidden" name="meta_path" value="' . $this->meta_path . '" />'); ptln('<input type="hidden" id="qs_script_max_time" name="qs_script_max_time" value="' . $this->script_max_time . '" />'); ptln('<table border="0" STYLE="border: 1px solid black" cellspacing="0">'); //header row ptln('<tr><th class="thead"> ' . $this->getLang('label_qs_pages') . ' </th><th class="thead" colspan="1">' . $this->getLang('label_date') . '</th>'); ptln('<td></td><th class="thead">UserAgent</th><td></td><th class="thead">' . $this->getLang('label_search') . '</th>'); ptln('<th class="thead">Country</th></tr>'); /* Row 1 */ //row 1/col1 files popups select ptln('<tr><td rowspan="5" valign="top" class="padded"><select name="popups" id="popups" size="6" onchange="onChangeQS(this);">'); $this->get_Options('popups'); ptln('</select></td>'); //row 1 col2 months select ptln('<td rowspan="5" valign="top" class="padded" nowrap> <select name="month" multiple id="month" size="6">'); $this->get_Options('months', $today['mon']); ptln('</select></td><td rowspan="6" class="divider"></td><th class="padded" rowspan="6"nowrap valign="top">'); //row 1 col3 browser/useragent ptln('<select size="6" name="user_agent" id="user_agent">'); $this->get_Options('ua'); ptln('</select>'); ptln('<br /><a href="javascript:qs_agent_search();" style="text-decoration:underline; font-weight:normal;line-height:200%;">Search:</a><input type ="text" id="other_agent"></td>'); ptln('</th><td rowspan="6" class="divider"></td>'); //row 1 col4 IP ptln('<td class="padded" nowrap> ' . $this->getLang('label_ip') . ': <input type="text" name = "ip" id="ip" size="16" value=""' . NL . '</td>'); //row 1 col5 Countries ptln('<td rowspan="5" align="top" class="padded" nowrap> <select name="country_names" id="country_names" size="6">'); $this->get_Options('country'); ptln('</select></td>'); ptln('</tr>'); /* ROW 2 */ // col 1 -- below row 1 col 4 ptln('<tr><td class="padded" nowrap> ' . $this->getLang('label_page') . ': <input type="text" name = "page" id="page" size="36" value=""</td></tr>'); /* ROW 3 */ // col 1 -- below row 2 col 1 ptln('<tr><td class="padded place_holder"> ' . $this->getLang('label_brief') . ': <input type="checkbox" id="qs_p_brief" name="qs_p_brief"></td></tr>'); /* ROWS 4-5: under row 3 col1/row 1 col 4 */ ptln('<tr><td class="padded place_holder"> </td></tr>'); ptln('<tr><td class="padded" valign="bottom" nowrap> <b>Priority:</b> '); ptln('Page <input type="radio" checked value="page" name="qs_priority" id="qs_priority_page">'); ptln(' IP <input type="radio" value="ip" name="qs_priority" id="qs_priority_ip">'); ptln(' Country <input type="radio" value="country" name="qs_priority" id="qs_priority_country">'); ptln(' UserAgent: <input type="radio" value="agent" name="qs_priority" id="qs_priority_agent"></td></tr>'); //ptln('country, user agent</td></tr>'); /*ROW 6 */ ptln('<tr><td class="padded nowrap"> </td>'); ptln('<td class="padded"> Year: <input type="text" onchange="qs_check_year(this);" name="year" id="year" size="4" value="' . $today['year'] . '">' . NL . '</td>'); ptln('<td class="padded" valign="bottom" > ' . $this->getLang('label_no_secondary') . ': <input type="checkbox" checked id="qs_ignore"></td>'); ptln('<td class="padded" style="padding-top:2px;"><a href="javascript:qs_country_search();" style="text-decoration:underline">Search:</a> <input type="text" value ="" id="cc_extra" name="cc_extra" size="24"></td>'); ptln('</table>'); ptln('<p><input type="submit" onclick="getExtendedData(this.form,\'' . DOKU_INC . '\');" class="button" value="' . $this->getLang('btn_submit_query') . '" />'); ptln(' <input type="reset" class="button" value="' . $this->getLang('btn_reset') . '">'); ptln(' <span class="status">[ <b>' . $this->getLang('label_uniq_ip') . '</b> ' . $this->getLang('label_total') . ': ' . $this->uniqIPTotal . ' Current month: ' . $this->uniqIPCurrent . ' ]'); ptln(' [ <b>' . $this->getLang('label_page_access') . '</b> ' . $this->getLang('label_total') . ': ' . $this->page_accessesTotal . ' ' . $this->getLang('label_current_month') . ': ' . $this->page_accessesCurrent . ' ]</span>'); ptln('</p></form></p>'); ptln('<p> </p><div id="extended_data"></div>'); ptln('</div>'); //$this->debug(); }