Ejemplo n.º 1
0
 /**
  * The HTML representation of this element
  *
  * @return string
  */
 protected function mainElementHTML()
 {
     if ($this->useInput) {
         $this->prefillInput();
     }
     return '<textarea ' . buildAttributes($this->attrs()) . '>' . formText($this->val()) . '</textarea>';
 }
Ejemplo n.º 2
0
function showSearch()
{
    printStyle();
    generateGoods();
    showSearchPrintOnLoad();
    formText();
    printGoodsTable();
}
Ejemplo n.º 3
0
 /**
  * Use a text area for input
  *
  * @param string $name
  * @param string $rawvalue
  * @return string
  */
 public function valueEditor($name, $rawvalue)
 {
     $class = 'struct_' . strtolower($this->getClass());
     $name = hsc($name);
     $rawvalue = formText($rawvalue);
     $html = "<textarea name=\"{$name}\" class=\"{$class}\">{$rawvalue}</textarea>";
     return "{$html}";
 }
Ejemplo n.º 4
0
/**
 * Helps building long attribute lists
 *
 * @deprecated Use buildAttributes instead
 * @author Andreas Gohr <*****@*****.**>
 */
function html_attbuild($attributes)
{
    $ret = '';
    foreach ($attributes as $key => $value) {
        $ret .= $key . '="' . formText($value) . '" ';
    }
    return trim($ret);
}
Ejemplo n.º 5
0
 /**
  * Build html for label and input of setting
  *
  * @param DokuWiki_Plugin $plugin object of config plugin
  * @param bool            $echo   true: show inputted value, when error occurred, otherwise the stored setting
  * @return string[] with content array(string $label_html, string $input_html)
  */
 public function html(&$plugin, $echo = false)
 {
     $disable = '';
     if ($this->is_protected()) {
         $value = $this->_protected;
         $disable = 'disabled="disabled"';
     } else {
         if ($echo && $this->_error) {
             $value = $this->_input;
         } else {
             $value = is_null($this->_local) ? $this->_default : $this->_local;
         }
     }
     $key = htmlspecialchars($this->_key);
     $value = formText($value);
     $label = '<label for="config___' . $key . '">' . $this->prompt($plugin) . '</label>';
     $input = '<textarea rows="3" cols="40" id="config___' . $key . '" name="config[' . $key . ']" class="edit" ' . $disable . '>' . $value . '</textarea>';
     return array($label, $input);
 }
Ejemplo n.º 6
0
 /**
  * The HTML representation of the whole form
  *
  * @return string
  */
 public function toHTML()
 {
     $this->balanceFieldsets();
     $html = '<form ' . buildAttributes($this->attrs()) . '>';
     foreach ($this->hidden as $name => $value) {
         $html .= '<input type="hidden" name="' . $name . '" value="' . formText($value) . '" />';
     }
     foreach ($this->elements as $element) {
         $html .= $element->toHTML();
     }
     $html .= '</form>';
     return $html;
 }
 /**
  * Build html for label and input of property
  *
  * @param DokuWiki_Plugin $plugin object of config plugin
  * @param bool            $echo   true: show inputted value, when error occurred, otherwise the stored property
  * @return string[] with content array(string $label_html, string $input_html)
  */
 public function html(&$plugin, $echo = false)
 {
     $disable = '';
     if ($echo && $this->_error) {
         $value = $this->_input;
     } else {
         $value = $this->_metavalue;
     }
     $key = htmlspecialchars($this->_key);
     $value = formText($value);
     $label = '<label for="config___' . $key . '">' . $this->prompt($plugin) . '</label>';
     $input = '<textarea rows="3" cols="40" id="config___' . $key . '" name="config[' . $key . ']" class="edit" ' . $disable . '>' . $value . '</textarea>';
     return array($label, $input);
 }
Ejemplo n.º 8
0
    /**
     * Outputs the comment form
     */
    function _form($raw = '', $act = 'add', $cid = NULL)
    {
        global $lang;
        global $conf;
        global $ID;
        global $INFO;
        // not for unregistered users when guest comments aren't allowed
        if (!$_SERVER['REMOTE_USER'] && !$this->getConf('allowguests')) {
            ?>
            <div class="comment_form">
                <?php 
            echo $this->getLang('noguests');
            ?>
            </div>
            <?php 
            return false;
        }
        // fill $raw with $_REQUEST['text'] if it's empty (for failed CAPTCHA check)
        if (!$raw && $_REQUEST['comment'] == 'show') {
            $raw = $_REQUEST['text'];
        }
        ?>

        <div class="comment_form">
          <form id="discussion__comment_form" 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="do" value="show" />
              <input type="hidden" name="comment" value="<?php 
        echo $act;
        ?>
" />
        <?php 
        // for adding a comment
        if ($act == 'add') {
            ?>
              <input type="hidden" name="reply" value="<?php 
            echo $cid;
            ?>
" />
        <?php 
            // for guest/adminimport: show name, e-mail and subscribe to comments fields
            if (!$_SERVER['REMOTE_USER'] or $this->getConf('adminimport') && auth_ismanager()) {
                ?>
              <input type="hidden" name="user" value="<?php 
                echo clientIP();
                ?>
" />
              <div class="comment_name">
                <label class="block" for="discussion__comment_name">
                  <span><?php 
                echo $lang['fullname'];
                ?>
:</span>
                  <input type="text" class="edit<?php 
                if ($_REQUEST['comment'] == 'add' && empty($_REQUEST['name'])) {
                    echo ' error';
                }
                ?>
" name="name" id="discussion__comment_name" size="50" tabindex="1" value="<?php 
                echo hsc($_REQUEST['name']);
                ?>
" />
                </label>
              </div>
              <div class="comment_mail">
                <label class="block" for="discussion__comment_mail">
                  <span><?php 
                echo $lang['email'];
                ?>
:</span>
                  <input type="text" class="edit<?php 
                if ($_REQUEST['comment'] == 'add' && empty($_REQUEST['mail'])) {
                    echo ' error';
                }
                ?>
" name="mail" id="discussion__comment_mail" size="50" tabindex="2" value="<?php 
                echo hsc($_REQUEST['mail']);
                ?>
" />
                </label>
              </div>
        <?php 
            }
            // allow entering an URL
            if ($this->getConf('urlfield')) {
                ?>
              <div class="comment_url">
                <label class="block" for="discussion__comment_url">
                  <span><?php 
                echo $this->getLang('url');
                ?>
:</span>
                  <input type="text" class="edit" name="url" id="discussion__comment_url" size="50" tabindex="3" value="<?php 
                echo hsc($_REQUEST['url']);
                ?>
" />
                </label>
              </div>
        <?php 
            }
            // allow entering an address
            if ($this->getConf('addressfield')) {
                ?>
              <div class="comment_address">
                <label class="block" for="discussion__comment_address">
                  <span><?php 
                echo $this->getLang('address');
                ?>
:</span>
                  <input type="text" class="edit" name="address" id="discussion__comment_address" size="50" tabindex="4" value="<?php 
                echo hsc($_REQUEST['address']);
                ?>
" />
                </label>
              </div>
        <?php 
            }
            // allow setting the comment date
            if ($this->getConf('adminimport') && auth_ismanager()) {
                ?>
              <div class="comment_date">
                <label class="block" for="discussion__comment_date">
                  <span><?php 
                echo $this->getLang('date');
                ?>
:</span>
                  <input type="text" class="edit" name="date" id="discussion__comment_date" size="50" />
                </label>
              </div>
        <?php 
            }
            // for saving a comment
        } else {
            ?>
              <input type="hidden" name="cid" value="<?php 
            echo $cid;
            ?>
" />
        <?php 
        }
        ?>
                <div class="comment_text">
                  <?php 
        echo $this->getLang('entercomment');
        echo $this->getConf('wikisyntaxok') ? "" : ":";
        if ($this->getConf('wikisyntaxok')) {
            echo '. ' . $this->getLang('wikisyntax') . ':';
        }
        ?>
                 
                  <!-- Fix for disable the toolbar when wikisyntaxok is set to false. See discussion's script.jss -->
                  <?php 
        if ($this->getConf('wikisyntaxok')) {
            ?>
                
                    <div id="discussion__comment_toolbar">
                  <?php 
        } else {
            ?>
                    <div id="discussion__comment_toolbar_disabled">
                  <?php 
        }
        ?>
                </div>
                <textarea class="edit<?php 
        if ($_REQUEST['comment'] == 'add' && empty($_REQUEST['text'])) {
            echo ' error';
        }
        ?>
" name="text" cols="80" rows="10" id="discussion__comment_text" tabindex="5"><?php 
        if ($raw) {
            echo formText($raw);
        } else {
            echo $_REQUEST['text'];
        }
        ?>
</textarea>
              </div>
        <?php 
        //bad and dirty event insert hook
        $evdata = array('writable' => true);
        trigger_event('HTML_EDITFORM_INJECTION', $evdata);
        ?>
              <input class="button comment_submit" id="discussion__btn_submit" type="submit" name="submit" accesskey="s" value="<?php 
        echo $lang['btn_save'];
        ?>
" title="<?php 
        echo $lang['btn_save'];
        ?>
 [S]" tabindex="7" />
              <input class="button comment_preview_button" id="discussion__btn_preview" type="button" name="preview" accesskey="p" value="<?php 
        echo $lang['btn_preview'];
        ?>
" title="<?php 
        echo $lang['btn_preview'];
        ?>
 [P]" />

        <?php 
        if ((!$_SERVER['REMOTE_USER'] || $_SERVER['REMOTE_USER'] && !$conf['subscribers']) && $this->getConf('subscribe')) {
            ?>
              <div class="comment_subscribe">
                <input type="checkbox" id="discussion__comment_subscribe" name="subscribe" tabindex="6" />
                <label class="block" for="discussion__comment_subscribe">
                  <span><?php 
            echo $this->getLang('subscribe');
            ?>
</span>
                </label>
              </div>
        <?php 
        }
        ?>

              <div class="clearer"></div>
              <div id="discussion__comment_preview">&nbsp;</div>
            </div>
          </form>
        </div>
        <?php 
        if ($this->getConf('usecocomment')) {
            echo $this->_coComment();
        }
    }
Ejemplo n.º 9
0
 /**
  * Create html for selection of namespace templates
  *
  * @param array $newpagetemplates array of namespace templates
  * @return string html of select or hidden input
  */
 public function _htmlTemplateInput($newpagetemplates)
 {
     $cnt = count($newpagetemplates);
     if ($cnt < 1 || $cnt == 1 && $newpagetemplates[0] == '') {
         $input = '';
     } else {
         if ($cnt == 1) {
             list($template, ) = $this->_parseNSTemplatePage($newpagetemplates[0]);
             $input = '<input type="hidden" name="newpagetemplate" value="' . formText($template) . '" />';
         } else {
             $first = true;
             $input = '<select name="newpagetemplate" tabindex="3">';
             foreach ($newpagetemplates as $template) {
                 $p = $first ? ' selected="selected"' : '';
                 $first = false;
                 list($template, $name) = $this->_parseNSTemplatePage($template);
                 $p .= ' value="' . formText($template) . '"';
                 $input .= "<option {$p}>" . formText($name) . "</option>";
             }
             $input .= '</select>';
         }
         $input = DOKU_TAB . DOKU_TAB . $input . DOKU_LF;
     }
     return $input;
 }
Ejemplo n.º 10
0
    /**
     * 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 
                }
                ?>
                  
             &nbsp;&nbsp;&nbsp;

<?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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     <td align="right">
      <a href="javascript:hide_backup_msg();void(0);" class="backup_msg_close">[ close ]</a>&nbsp;&nbsp;&nbsp;
     </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> 
      &nbsp;&nbsp;<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 
    }
Ejemplo n.º 11
0
                    <td><?php 
echo formRadio('ipcheck_bk', '0', $form['ipcheck_bk']);
?>
不使用 <?php 
echo formRadio('ipcheck_bk', '1', $form['ipcheck_bk']);
?>
要使用 , 
                        IP: <?php 
echo formText('webip_bk', 60, 70, $form['webip_bk']);
?>
<br> <font color=#ff0000>(先取得每筆交易的驗證檢核碼, 然後才一起送授權, 幕後授權一定要勾選)(多組IP請用逗點分隔,最多四組ip)</font></td>
                </tr>
                <tr>
                    <td bgcolor=#cccccc align=right>鎖定登入管理後台IP</td>
                    <td><?php 
echo formText('rootIP', 20, 40, $form['rootIP']);
?>
 <font color=#ff0000>(輸入即會馬上生效, 非此IP之電腦, 將無法登入後台, 不鎖定IP, 請清空)</font></td>
                </tr>
                <tr>
                    <td bgcolor=#cccccc align=right>連續盜刷保護</td>
                    <td>    
<?php 
echo formRadio('ipstop', '0', $form['ipstop']);
?>
開
<?php 
echo formRadio('ipstop', '1', $form['ipstop']);
?>
關
                    </td>
Ejemplo n.º 12
0
/**
 * Display the form to edit image meta data
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function media_metaform($id, $auth)
{
    if ($auth < AUTH_UPLOAD) {
        return false;
    }
    global $lang, $config_cascade;
    // load the field descriptions
    static $fields = null;
    if (is_null($fields)) {
        foreach (array('default', 'local') as $config_group) {
            if (empty($config_cascade['mediameta'][$config_group])) {
                continue;
            }
            foreach ($config_cascade['mediameta'][$config_group] as $config_file) {
                if (@file_exists($config_file)) {
                    include $config_file;
                }
            }
        }
    }
    $src = mediaFN($id);
    // output
    echo '<h1>' . hsc(noNS($id)) . '</h1>' . NL;
    echo '<form action="' . DOKU_BASE . 'lib/exe/mediamanager.php" accept-charset="utf-8" method="post" class="meta">' . NL;
    formSecurityToken();
    foreach ($fields as $key => $field) {
        // get current value
        $tags = array($field[0]);
        if (is_array($field[3])) {
            $tags = array_merge($tags, $field[3]);
        }
        $value = tpl_img_getTag($tags, '', $src);
        $value = cleanText($value);
        // prepare attributes
        $p = array();
        $p['class'] = 'edit';
        $p['id'] = 'meta__' . $key;
        $p['name'] = 'meta[' . $field[0] . ']';
        // put label
        echo '<div class="metafield">';
        echo '<label for="meta__' . $key . '">';
        echo $lang[$field[1]] ? $lang[$field[1]] : $field[1];
        echo ':</label>';
        // put input field
        if ($field[2] == 'text') {
            $p['value'] = $value;
            $p['type'] = 'text';
            $att = buildAttributes($p);
            echo "<input {$att}/>" . NL;
        } else {
            $att = buildAttributes($p);
            echo "<textarea {$att} rows=\"6\" cols=\"50\">" . formText($value) . '</textarea>' . NL;
        }
        echo '</div>' . NL;
    }
    echo '<div class="buttons">' . NL;
    echo '<input type="hidden" name="img" value="' . hsc($id) . '" />' . NL;
    echo '<input name="do[save]" type="submit" value="' . $lang['btn_save'] . '" title="' . $lang['btn_save'] . ' [S]" accesskey="s" class="button" />' . NL;
    echo '<input name="do[cancel]" type="submit" value="' . $lang['btn_cancel'] . '" title="' . $lang['btn_cancel'] . ' [C]" accesskey="c" class="button" />' . NL;
    echo '</div>' . NL;
    echo '</form>' . NL;
}
Ejemplo n.º 13
0
		( 對單一使用者有作交易次數的限制, 以免被盜刷集團作大量試卡 )
		</td>
		</tr>
		<tr>
		<td bgcolor=#cccccc align=right>鎖定幕前交易網站主機IP</td>
		<td>' . formRadio('ipcheck', '0', $form['ipcheck']) . '不使用 ' . formRadio('ipcheck', '1', $form['ipcheck']) . '要使用 , 
		IP: ' . formText('webip', 20, 40, $form['webip']) . ' <font color=#ff0000>(使用此一機制,交易全程都不會跳出中斷警告)</font></td>
		</tr>
		<tr>
		<td bgcolor=#cccccc align=right>鎖定幕後驗證觸發主機IP</td>
		<td>' . formRadio('ipcheck_bk', '0', $form['ipcheck_bk']) . '不使用 ' . formRadio('ipcheck_bk', '1', $form['ipcheck_bk']) . '要使用 , 
		IP: ' . formText('webip_bk', 60, 60, $form['webip_bk']) . '<br> <font color=#ff0000>(先取得每筆交易的驗證檢核碼, 然後才一起送授權, 幕後授權一定要勾選)(多組IP請用逗點分隔,最多四組ip)</font></td>
		</tr>
		<tr>
		<td bgcolor=#cccccc align=right>鎖定登入管理後台IP</td>
		<td>' . formText('rootIP', 20, 40, $form['rootIP']) . ' <font color=#ff0000>(輸入即會馬上生效, 非此IP之電腦, 將無法登入後台, 不鎖定IP, 請清空)</font></td>
		</tr>' . "\r\n";
if ($form['sps'] == 1) {
    //非大特店 是聯信分期, 才秀出來
    if (!$_SESSION['RootClientAllpayMID'] && ($form['bank'] == 4 || $form['bank'] == 10)) {
        echo '<tr>
				<td bgcolor=#cccccc align=right>聯信分期<br>銀行選擇</td>
				<td><font color=#ff0000>【請依您實際簽約之銀行增減家數,勾選可交易之銀行】</font><br>' . "\r\n";
        $bb = 0;
        $vv = 0;
        while (list($l, $r) = each($CardTitel)) {
            $bb++;
            $vv++;
            if (substr_count($form['sebank'], $r)) {
                echo '<input type="checkbox" name="sebank[' . $vv . ']" value="' . $r . '" checked>' . $r;
            } else {
Ejemplo n.º 14
0
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <*****@*****.**>
 */
function html_resendpwd()
{
    global $lang;
    global $conf;
    global $ID;
    print p_locale_xhtml('resendpwd');
    ?>
  <div class="centeralign">
  <form id="dw__resendpwd" action="<?php 
    echo wl($ID);
    ?>
" accept-charset="<?php 
    echo $lang['encoding'];
    ?>
" method="post">
    <fieldset>
      <br />
      <legend><?php 
    echo $lang['resendpwd'];
    ?>
</legend>
      <input type="hidden" name="do" value="resendpwd" />
      <input type="hidden" name="save" value="1" />
      <label class="block">
        <span><?php 
    echo $lang['user'];
    ?>
</span>
        <input type="text" name="login" value="<?php 
    echo formText($_POST['login']);
    ?>
" class="edit" /><br /><br />
      </label><br />
      <input type="submit" value="<?php 
    echo $lang['btn_resendpwd'];
    ?>
" class="button" />
    </fieldset>
  </form>
  </div>
<?php 
}
Ejemplo n.º 15
0
    /**
     * 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()"  
                  />&nbsp;&nbsp;&nbsp;
              
 <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     <td align="right">
      <a href="javascript:hide_backup_msg();void(0);" class="backup_msg_close">[ close ]</a>&nbsp;&nbsp;&nbsp;
     </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('&Agrave;', '&Aacute;', '&Acirc;', '&Atilde;', '&Auml;', '&Aring;', '&AElig;', '&Ccedil;', '&Egrave;', '&Eacute;', '&Ecirc;', '&Euml;', '&Igrave;', '&Iacute;', '&Icirc;', '&Iuml;', '&ETH;', '&Ntilde;', '&Ograve;', '&Oacute;', '&Ocirc;', '&Otilde;', '&Ouml;', '&Oslash;', '&Ugrave;', '&Uacute;', '&Ucirc;', '&Uuml;', '&Yacute;', '&THORN;', '&szlig;', '&agrave;', '&aacute;', '&acirc;', '&atilde;', '&auml;', '&aring;', '&aelig;', '&ccedil;', '&egrave;', '&eacute;', '&ecirc;', '&euml;', '&igrave;', '&iacute;', '&icirc;', '&iuml;', '&eth;', '&ntilde;', '&ograve;', '&oacute;', '&ocirc;', '&otilde;', '&ouml;', '&oslash;', '&ugrave;', '&uacute;', '&ucirc;', '&uuml;', '&yacute;', '&thorn;', '&yuml;', '&OElig;', '&oelig;', '&Scaron;', '&scaron;', '&Yuml;', '&fnof;');
            foreach ($fckgLPluginPatterns as $pat) {
                $pat[0] = preg_replace('/\\s+$/', "", $pat[0]);
                $pat[1] = str_replace('&', '&amp;', $pat[1]);
                $pat[0] = str_replace('&', '&amp;', $pat[0]);
                $pat[0] = str_replace('>', '&gt;', $pat[0]);
                $pat[0] = str_replace('<', '&lt;', $pat[0]);
                $pat[1] = str_replace('>', '&gt;', $pat[1]);
                $pat[1] = str_replace('<', '&lt;', $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("⁄\|&frasl;\|&#8260;\|&#x2044;",'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(/&amp;/)) {
                                  qs_set = true;
                                  matches[1] = matches[1].replace(/&amp;/,'?')
                            }
                        }
                        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(/^(&nbsp;)+/, '');
            text = text.replace(/(&nbsp;)+/, ' ');   
        }
        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&gt;/)) {  
	       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(/&lt;\s/g, '<');   
      text = text.replace(/\s&gt;/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,'&mdash;');
      text = text.replace(/--/g,'&ndash;');     
    }
    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(/&lt;/)) {
         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(/&quot;/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(/&lt;\s+/mg, "<");
        results = results.replace(/\s+&gt;/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(/\/\/&lt;\/\/\s*/g,'&lt;');
    }
   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(/&lt;\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(/(&lt;nowiki&gt;)(.*?)(&lt;\/nowiki&gt;)/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 
    }
Ejemplo n.º 16
0
/**
 * Display the form to edit image meta data
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_metaform($id, $auth)
{
    global $lang;
    if ($auth < AUTH_UPLOAD) {
        echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL;
        return false;
    }
    // load the field descriptions
    static $fields = null;
    if (is_null($fields)) {
        $config_files = getConfigFiles('mediameta');
        foreach ($config_files as $config_file) {
            if (@file_exists($config_file)) {
                include $config_file;
            }
        }
    }
    $src = mediaFN($id);
    // output
    $form = new Doku_Form(array('action' => media_managerURL(array('tab_details' => 'view'), '&'), 'class' => 'meta'));
    $form->addHidden('img', $id);
    $form->addHidden('mediado', 'save');
    foreach ($fields as $key => $field) {
        // get current value
        if (empty($field[0])) {
            continue;
        }
        $tags = array($field[0]);
        if (is_array($field[3])) {
            $tags = array_merge($tags, $field[3]);
        }
        $value = tpl_img_getTag($tags, '', $src);
        $value = cleanText($value);
        // prepare attributes
        $p = array();
        $p['class'] = 'edit';
        $p['id'] = 'meta__' . $key;
        $p['name'] = 'meta[' . $field[0] . ']';
        $p_attrs = array('class' => 'edit');
        $form->addElement('<div class="row">');
        if ($field[2] == 'text') {
            $form->addElement(form_makeField('text', $p['name'], $value, $lang[$field[1]] ? $lang[$field[1]] : $field[1] . ':', $p['id'], $p['class'], $p_attrs));
        } else {
            $att = buildAttributes($p);
            $form->addElement('<label for="meta__' . $key . '">' . $lang[$field[1]] . '</label>');
            $form->addElement("<textarea {$att} rows=\"6\" cols=\"50\">" . formText($value) . '</textarea>');
        }
        $form->addElement('</div>' . NL);
    }
    $form->addElement('<div class="buttons">');
    $form->addElement(form_makeButton('submit', '', $lang['btn_save'], array('accesskey' => 's', 'name' => 'mediado[save]')));
    $form->addElement('</div>' . NL);
    $form->printForm();
    return true;
}
Ejemplo n.º 17
0
/**
 * form_listboxfield
 *
 * Print the HTML for a list box.
 *   _options : Array of (value,text,selected) for the list.
 *              Text can be omitted. Text and value are passed to formText()
 *   _class : class attribute used on the label tag
 *   _text  : Text to display before the menu. Not escaped.
 * Other attributes are passed to buildAttributes() for the input tag.
 *
 * @author  Tom N Harris <*****@*****.**>
 */
function form_listboxfield($attrs)
{
    $s = '<label';
    if ($attrs['_class']) {
        $s .= ' class="' . $attrs['_class'] . '"';
    }
    if (!empty($attrs['id'])) {
        $s .= ' for="' . $attrs['id'] . '"';
    }
    $s .= '><span>' . $attrs['_text'] . '</span> ';
    $s .= '<select ' . buildAttributes($attrs, true) . '>' . DOKU_LF;
    if (!empty($attrs['_options'])) {
        foreach ($attrs['_options'] as $opt) {
            @(list($value, $text, $select) = $opt);
            $p = '';
            if (is_null($text)) {
                $text = $value;
            }
            $p .= ' value="' . formText($value) . '"';
            if (!empty($select)) {
                $p .= ' selected="selected"';
            }
            $s .= '<option' . $p . '>' . formText($text) . '</option>';
        }
    } else {
        $s .= '<option></option>';
    }
    $s .= DOKU_LF . '</select></label>';
    if (preg_match('/(^| )block($| )/', $attrs['_class'])) {
        $s .= '<br />';
    }
    return $s;
}
Ejemplo n.º 18
0
$aPriv = array(4 => '權限 D - 只能查詢(銀行專用)', 3 => '權限 C - 只能查詢', 2 => '權限 B - 可以關帳請款', 1 => '權限 A - 關帳請款退刷', 9 => '權限 S - 可開USER');
?>
	<div align="center">
	<form name="f" action="g_privPost.php" method="post">
	<table cellspacing="1" cellpadding="3">
	<tr>
	  <th>商代</th><th>使用者帳號</th><th>密碼(修改才要填)</th><th>權限</th><th>刪除</th>
	</tr>
<?php 
for ($i = 0; $i < $numUsers + 3; $i++) {
    echo "<tr>";
    echo "\t<td align=center>" . $form["client_{$i}"] . "</td>";
    echo "\t<td>" . formText("user_{$i}", 32, 32, $form["user_{$i}"]) . "</td>";
    if (!$_SESSION['RootLayer']) {
        //formText("pass_$i", 32, 32,$form["pass_$i"]);
        echo "<td>" . formText("pass_{$i}", 32, 32, '') . "</td>";
    } else {
        echo "<td>" . formPass("pass_{$i}", 32, 32, '') . "</td>";
    }
    ?>
	  <td><select name="priv_<?php 
    echo $i;
    ?>
">
	  <?php 
    echo SelEctOP($form["priv_{$i}"], 5, $aPriv[5]);
    ?>
	  <?php 
    echo SelEctOP($form["priv_{$i}"], 4, $aPriv[4]);
    ?>
	  <?php