function _render($act)
 {
     global $ID;
     $form = new Doku_Form(array('id' => 'forcessllogin1', 'action' => 'https://' . $this->host() . DOKU_BASE . DOKU_SCRIPT, 'method' => 'get'));
     $form->addHidden('id', $ID);
     $form->addHidden('do', $act);
     if ($this->getConf('cert')) {
         if (strpos($this->getLang('certinfo'), '{{name}}') !== false) {
             $form->addElement('<p>' . str_replace('{{name}}', $this->getConf('cert'), $this->getLang('certinfo')) . '</p>' . NL);
         } else {
             $form->addElement('<p>' . $this->getLang('certinfo') . " " . $this->getConf('cert') . '</p>' . NL);
         }
     }
     if ($this->getConf('ca')) {
         if (strpos($this->getLang('ca'), '{{name}}') !== false) {
             $form->addElement('<p>' . str_replace('{{name}}', $this->getConf('ca'), $this->getLang('cainfo')) . '</p>' . NL);
         } else {
             $form->addElement('<p>' . $this->getLang('cainfo') . " <a href='" . $this->getConf('ca') . "'>" . $this->getConf('ca') . "</a></p>" . NL);
         }
     }
     $form->addElement(form_makeButton('submit', '', $this->getLang('submit'), array('accesskey' => 'h', 'title' => $this->getLang('submittitle'), id => 'focus__this')));
     $form->printForm();
     $form = new Doku_Form(array('id' => 'forcessllogin2', 'method' => 'get'));
     $form->addElement(form_makeButton('submit', '', $this->getLang('cancel'), array('accesskey' => 'c', 'title' => $this->getLang('canceltitle'))));
     $form->printForm();
 }
Exemplo n.º 2
0
 public function html()
 {
     global $ID;
     echo $this->locale_xhtml('tree');
     echo '<noscript><div class="error">' . $this->getLang('noscript') . '</div></noscript>';
     echo '<div id="plugin_move__tree">';
     echo '<div class="tree_root tree_pages">';
     echo '<h3>' . $this->getLang('move_pages') . '</h3>';
     $this->htmlTree(self::TYPE_PAGES);
     echo '</div>';
     echo '<div class="tree_root tree_media">';
     echo '<h3>' . $this->getLang('move_media') . '</h3>';
     $this->htmlTree(self::TYPE_MEDIA);
     echo '</div>';
     /** @var helper_plugin_move_plan $plan */
     $plan = plugin_load('helper', 'move_plan');
     echo '<div class="controls">';
     if ($plan->isCommited()) {
         echo '<div class="error">' . $this->getLang('moveinprogress') . '</div>';
     } else {
         $form = new Doku_Form(array('action' => wl($ID), 'id' => 'plugin_move__tree_execute'));
         $form->addHidden('id', $ID);
         $form->addHidden('page', 'move_main');
         $form->addHidden('json', '');
         $form->addElement(form_makeCheckboxField('autoskip', '1', $this->getLang('autoskip'), '', '', $this->getConf('autoskip') ? array('checked' => 'checked') : array()));
         $form->addElement('<br />');
         $form->addElement(form_makeCheckboxField('autorewrite', '1', $this->getLang('autorewrite'), '', '', $this->getConf('autorewrite') ? array('checked' => 'checked') : array()));
         $form->addElement('<br />');
         $form->addElement('<br />');
         $form->addElement(form_makeButton('submit', 'admin', $this->getLang('btn_start')));
         $form->printForm();
     }
     echo '</div>';
     echo '</div>';
 }
Exemplo n.º 3
0
 function html()
 {
     echo $this->locale_xhtml('intro_clean');
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'data_clean');
     $form->addHidden('data_go', 'go');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit_clean')));
     $form->printForm();
 }
Exemplo n.º 4
0
 /**
  * Output HTML form
  */
 function html()
 {
     global $INPUT;
     global $conf;
     echo $this->locale_xhtml('intro');
     if (!$conf['mailfrom']) {
         msg($this->getLang('nofrom'), -1);
     }
     $form = new Doku_Form(array());
     $form->startFieldset('Testmail');
     $form->addHidden('send', 1);
     $form->addElement(form_makeField('text', 'to', $INPUT->str('to'), 'To:', '', 'block'));
     $form->addElement(form_makeField('text', 'cc', $INPUT->str('cc'), 'Cc:', '', 'block'));
     $form->addElement(form_makeField('text', 'bcc', $INPUT->str('bcc'), 'Bcc:', '', 'block'));
     $form->addElement(form_makeButton('submit', '', 'Send Email'));
     $form->printForm();
 }
Exemplo n.º 5
0
/**
 * 
 * Show diff
 * between current page version and provided $text
 * or between the revisions provided via GET or POST
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param  string $text  when non-empty: compare with this text with most current version
 * @param  bool   $intro display the intro text
 * @param  string $type  type of the diff (inline or sidebyside)
 */
function revisionsfull_html_diff($text = '', $intro = true, $type = null)
{
    global $ID;
    global $REV;
    global $lang;
    global $INPUT;
    global $INFO;
    $pagelog = new PageChangeLog($ID);
    /*
     * Determine diff type
     */
    if (!$type) {
        $type = $INPUT->str('difftype');
        if (empty($type)) {
            $type = get_doku_pref('difftype', $type);
            if (empty($type) && $INFO['ismobile']) {
                $type = 'inline';
            }
        }
    }
    if (!in_array($type, array('inline', 'sidebyside'))) {
        $type = 'full';
    }
    /*
     * Determine requested revision(s)
     */
    // we're trying to be clever here, revisions to compare can be either
    // given as rev and rev2 parameters, with rev2 being optional. Or in an
    // array in rev2.
    $rev1 = $REV;
    $rev2 = $INPUT->ref('rev2');
    if (is_array($rev2)) {
        $rev1 = (int) $rev2[0];
        $rev2 = (int) $rev2[1];
        if (!$rev1) {
            $rev1 = $rev2;
            unset($rev2);
        }
    } else {
        $rev2 = $INPUT->int('rev2');
    }
    /*
     * Determine left and right revision, its texts and the header
     */
    $r_minor = '';
    $l_minor = '';
    if ($text) {
        // compare text to the most current revision
        $l_rev = '';
        $l_text = rawWiki($ID, '');
        $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
        $r_rev = '';
        $r_text = cleanText($text);
        $r_head = $lang['yours'];
    } else {
        if ($rev1 && isset($rev2) && $rev2) {
            // two specific revisions wanted
            // make sure order is correct (older on the left)
            if ($rev1 < $rev2) {
                $l_rev = $rev1;
                $r_rev = $rev2;
            } else {
                $l_rev = $rev2;
                $r_rev = $rev1;
            }
        } elseif ($rev1) {
            // single revision given, compare to current
            $r_rev = '';
            $l_rev = $rev1;
        } else {
            // no revision was given, compare previous to current
            $r_rev = '';
            $revs = $pagelog->getRevisions(0, 1);
            $l_rev = $revs[0];
            $REV = $l_rev;
            // store revision back in $REV
        }
        // when both revisions are empty then the page was created just now
        if (!$l_rev && !$r_rev) {
            $l_text = '';
        } else {
            $l_text = rawWiki($ID, $l_rev);
        }
        $r_text = rawWiki($ID, $r_rev);
        list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev, null, false, $type == 'inline');
    }
    /*
     * Build navigation
     */
    $l_nav = '';
    $r_nav = '';
    if (!$text) {
        list($l_nav, $r_nav) = html_diff_navigation($pagelog, $type, $l_rev, $r_rev);
    }
    /*
     * Create diff object and the formatter
     */
    $diff = new Diff(explode("\n", $l_text), explode("\n", $r_text));
    if ($type == 'inline') {
        $diffformatter = new InlineDiffFormatter();
    } elseif ($type == 'sidebyside') {
        $diffformatter = new TableDiffFormatter();
    } else {
        $diffformatter = new FullTableDiffFormatter();
    }
    /*
     * Display intro
     */
    if ($intro) {
        print p_locale_xhtml('diff');
    }
    /*
     * Display type and exact reference
     */
    if (!$text) {
        ptln('<div class="diffoptions group">');
        $form = new Doku_Form(array('action' => wl()));
        $form->addHidden('id', $ID);
        $form->addHidden('rev2[0]', $l_rev);
        $form->addHidden('rev2[1]', $r_rev);
        $form->addHidden('do', 'diff');
        $form->addElement(form_makeListboxField('difftype', array('full' => 'Full Side by Side', 'sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect')));
        $form->addElement(form_makeButton('submit', 'diff', 'Go'));
        $form->printForm();
        ptln('<p>');
        // link to exactly this view FS#2835
        echo html_diff_navigationlink($type, 'difflink', $l_rev, $r_rev ? $r_rev : $INFO['currentrev']);
        ptln('</p>');
        ptln('</div>');
        // .diffoptions
    }
    /*
     * Display diff view table
     */
    ?>
    <div class="table">
    <table class="diff diff_<?php 
    echo $type;
    ?>
">

        <?php 
    //navigation and header
    if ($type == 'inline') {
        if (!$text) {
            ?>
                <tr>
                    <td class="diff-lineheader">-</td>
                    <td class="diffnav"><?php 
            echo $l_nav;
            ?>
</td>
                </tr>
                <tr>
                    <th class="diff-lineheader">-</th>
                    <th <?php 
            echo $l_minor;
            ?>
>
                        <?php 
            echo $l_head;
            ?>
                    </th>
                </tr>
            <?php 
        }
        ?>
            <tr>
                <td class="diff-lineheader">+</td>
                <td class="diffnav"><?php 
        echo $r_nav;
        ?>
</td>
            </tr>
            <tr>
                <th class="diff-lineheader">+</th>
                <th <?php 
        echo $r_minor;
        ?>
>
                    <?php 
        echo $r_head;
        ?>
                </th>
            </tr>
        <?php 
    } else {
        if (!$text) {
            ?>
                <tr>
                    <td colspan="2" class="diffnav"><?php 
            echo $l_nav;
            ?>
</td>
                    <td colspan="2" class="diffnav"><?php 
            echo $r_nav;
            ?>
</td>
                </tr>
            <?php 
        }
        ?>
            <tr>
                <th colspan="2" <?php 
        echo $l_minor;
        ?>
>
                    <?php 
        echo $l_head;
        ?>
                </th>
                <th colspan="2" <?php 
        echo $r_minor;
        ?>
>
                    <?php 
        echo $r_head;
        ?>
                </th>
            </tr>
        <?php 
    }
    //diff view
    echo html_insert_softbreaks($diffformatter->format($diff));
    ?>

    </table>
    </div>
<?php 
}
Exemplo n.º 6
0
/**
 * Shows difference between two revisions of image
 *
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax)
{
    global $lang;
    global $INPUT;
    $l_meta = new JpegMeta(mediaFN($image, $l_rev));
    $r_meta = new JpegMeta(mediaFN($image, $r_rev));
    $is_img = preg_match('/\\.(jpe?g|gif|png)$/', $image);
    if ($is_img) {
        $l_size = media_image_preview_size($image, $l_rev, $l_meta);
        $r_size = media_image_preview_size($image, $r_rev, $r_meta);
        $is_img = $l_size && $r_size && ($l_size[0] >= 30 || $r_size[0] >= 30);
        $difftype = $INPUT->str('difftype');
        if (!$fromajax) {
            $form = new Doku_Form(array('action' => media_managerURL(array(), '&'), 'method' => 'get', 'id' => 'mediamanager__form_diffview', 'class' => 'diffView'));
            $form->addHidden('sectok', null);
            $form->addElement('<input type="hidden" name="rev2[]" value="' . $l_rev . '" ></input>');
            $form->addElement('<input type="hidden" name="rev2[]" value="' . $r_rev . '" ></input>');
            $form->addHidden('mediado', 'diff');
            $form->printForm();
            echo NL . '<div id="mediamanager__diff" >' . NL;
        }
        if ($difftype == 'opacity' || $difftype == 'portions') {
            media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $difftype);
            if (!$fromajax) {
                echo '</div>';
            }
            return;
        }
    }
    list($l_head, $r_head) = html_diff_head($l_rev, $r_rev, $image, true);
    ?>
    <div class="table">
    <table>
      <tr>
        <th><?php 
    echo $l_head;
    ?>
</th>
        <th><?php 
    echo $r_head;
    ?>
</th>
      </tr>
    <?php 
    echo '<tr class="image">';
    echo '<td>';
    media_preview($image, $auth, $l_rev, $l_meta);
    echo '</td>';
    echo '<td>';
    media_preview($image, $auth, $r_rev, $r_meta);
    echo '</td>';
    echo '</tr>' . NL;
    echo '<tr class="actions">';
    echo '<td>';
    media_preview_buttons($image, $auth, $l_rev);
    echo '</td>';
    echo '<td>';
    media_preview_buttons($image, $auth, $r_rev);
    echo '</td>';
    echo '</tr>' . NL;
    $l_tags = media_file_tags($l_meta);
    $r_tags = media_file_tags($r_meta);
    // FIXME r_tags-only stuff
    foreach ($l_tags as $key => $l_tag) {
        if ($l_tag['value'] != $r_tags[$key]['value']) {
            $r_tags[$key]['highlighted'] = true;
            $l_tags[$key]['highlighted'] = true;
        } else {
            if (!$l_tag['value'] || !$r_tags[$key]['value']) {
                unset($r_tags[$key]);
                unset($l_tags[$key]);
            }
        }
    }
    echo '<tr>';
    foreach (array($l_tags, $r_tags) as $tags) {
        echo '<td>' . NL;
        echo '<dl class="img_tags">';
        foreach ($tags as $tag) {
            $value = cleanText($tag['value']);
            if (!$value) {
                $value = '-';
            }
            echo '<dt>' . $lang[$tag['tag'][1]] . '</dt>';
            echo '<dd>';
            if ($tag['highlighted']) {
                echo '<strong>';
            }
            if ($tag['tag'][2] == 'date') {
                echo dformat($value);
            } else {
                echo hsc($value);
            }
            if ($tag['highlighted']) {
                echo '</strong>';
            }
            echo '</dd>';
        }
        echo '</dl>' . NL;
        echo '</td>';
    }
    echo '</tr>' . NL;
    echo '</table>' . NL;
    echo '</div>' . NL;
    if ($is_img && !$fromajax) {
        echo '</div>';
    }
}
 public function html()
 {
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     //ptln('FIXME here should be form for editing');
     //echo $this->locale_xhtml('intro');
     $form = new Doku_Form(array('class' => 'safehtmlsnippets'));
     $form->startFieldset('HTML Snippets');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'admin');
     $form->addHidden('page', 'safehtmlsnippets');
     $form->addHidden('sectok', getSecurityToken());
     $form->addElement('<label for="key">' . hsc($this->getLang('key')) . ' </label><input name="key" type="text" value="' . hsc($_REQUEST['key']) . '" /><br/>');
     $form->addElement('<label for="snippet">' . hsc($this->getLang('snippet')) . '</label><br/><textarea name="snippet" class="edit">' . hsc($_REQUEST['snippet']) . '</textarea>');
     $form->addElement('<button name="button" type="submit" class="button" value="add">' . hsc($this->getLang('button_add')) . '</button>');
     $form->addElement('<button name="button" type="submit" class="button" value="remove">' . hsc($this->getLang('button_remove')) . '</button>');
     $form->endFieldset();
     $form->printForm();
     /*
             ptln('id<br/>'.hsc($_REQUEST['id']).'<br/>');
             ptln('do<br/>'.hsc($_REQUEST['do']).'<br/>');
             ptln('page<br/>'.hsc($_REQUEST['page']).'<br/>');
             ptln('key<br/>'.hsc($_REQUEST['key']).'<br/>');
             ptln('snippet<br/>'.hsc($_REQUEST['snippet']).'<br/>');
             ptln('button<br/>'.hsc($_REQUEST['button']).'<br/>');
             //*/
     $sqlite = plugin_load('helper', 'sqlite');
     if (!$sqlite) {
         msg('This plugin requires the sqlite plugin. Please install it');
         return $data;
     }
     // initialize the database connection
     if (!$sqlite->init('safehtmlsnippets', DOKU_PLUGIN . 'safehtmlsnippets/db/')) {
         return $data;
     }
     if ($_REQUEST['button'] && checkSecurityToken()) {
         $key = $_REQUEST['key'];
         if (!preg_match('/^[a-zA-Z0-9_.-]{1,10}$/i', $key)) {
             msg(sprintf($this->getLang('invalidkey'), hsc($key)));
             return;
         }
         if ($_REQUEST['button'] == 'add') {
             $res = $sqlite->query("DELETE FROM safesnippets WHERE key = ?;", $key);
             $res = $sqlite->query("INSERT INTO safesnippets (key,val) values (?,?);", $key, $_REQUEST['snippet']);
         } else {
             if ($_REQUEST['button'] == 'remove') {
                 $res = $sqlite->query("DELETE FROM safesnippets WHERE key = ?;", $key);
             }
         }
     }
     $res = $sqlite->query("SELECT key,val FROM safesnippets;");
     //if ($res === false) continue;
     //msg(sqlite_num_rows($res).' affected rows',1);
     $result = $sqlite->res2arr($res);
     if (count($result)) {
         echo '<p>';
         $ths = array_keys($result[0]);
         echo '<table class="inline">';
         echo '<tr>';
         foreach ($ths as $th) {
             echo '<th>' . hsc($th) . '</th>';
         }
         echo '</tr>';
         foreach ($result as $row) {
             echo '<tr>';
             $tds = array_values($row);
             foreach ($tds as $td) {
                 echo '<td>' . hsc($td) . '</td>';
             }
             echo '</tr>';
         }
         echo '</table>';
         echo '</p>';
     }
 }
Exemplo n.º 8
0
/**
 * show diff
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param  string $text - compare with this text with most current version
 * @param  bool   $intr - display the intro text
 */
function html_diff($text = '', $intro = true, $type = null)
{
    global $ID;
    global $REV;
    global $lang;
    global $conf;
    if (!$type) {
        $type = $_REQUEST['difftype'];
    }
    if ($type != 'inline') {
        $type = 'sidebyside';
    }
    // we're trying to be clever here, revisions to compare can be either
    // given as rev and rev2 parameters, with rev2 being optional. Or in an
    // array in rev2.
    $rev1 = $REV;
    if (is_array($_REQUEST['rev2'])) {
        $rev1 = (int) $_REQUEST['rev2'][0];
        $rev2 = (int) $_REQUEST['rev2'][1];
        if (!$rev1) {
            $rev1 = $rev2;
            unset($rev2);
        }
    } else {
        $rev2 = (int) $_REQUEST['rev2'];
    }
    $r_minor = '';
    $l_minor = '';
    if ($text) {
        // compare text to the most current revision
        $l_rev = '';
        $l_text = rawWiki($ID, '');
        $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
        $r_rev = '';
        $r_text = cleanText($text);
        $r_head = $lang['yours'];
    } else {
        if ($rev1 && $rev2) {
            // two specific revisions wanted
            // make sure order is correct (older on the left)
            if ($rev1 < $rev2) {
                $l_rev = $rev1;
                $r_rev = $rev2;
            } else {
                $l_rev = $rev2;
                $r_rev = $rev1;
            }
        } elseif ($rev1) {
            // single revision given, compare to current
            $r_rev = '';
            $l_rev = $rev1;
        } else {
            // no revision was given, compare previous to current
            $r_rev = '';
            $revs = getRevisions($ID, 0, 1);
            $l_rev = $revs[0];
            $REV = $l_rev;
            // store revision back in $REV
        }
        // when both revisions are empty then the page was created just now
        if (!$l_rev && !$r_rev) {
            $l_text = '';
        } else {
            $l_text = rawWiki($ID, $l_rev);
        }
        $r_text = rawWiki($ID, $r_rev);
        list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev);
    }
    $df = new Diff(explode("\n", htmlspecialchars($l_text)), explode("\n", htmlspecialchars($r_text)));
    if ($type == 'inline') {
        $tdf = new InlineDiffFormatter();
    } else {
        $tdf = new TableDiffFormatter();
    }
    if ($intro) {
        print p_locale_xhtml('diff');
    }
    if (!$text) {
        ptln('<div class="diffoptions">');
        $form = new Doku_Form(array('action' => wl()));
        $form->addHidden('id', $ID);
        $form->addHidden('rev2[0]', $l_rev);
        $form->addHidden('rev2[1]', $r_rev);
        $form->addHidden('do', 'diff');
        $form->addElement(form_makeListboxField('difftype', array('sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect')));
        $form->addElement(form_makeButton('submit', 'diff', 'Go'));
        $form->printForm();
        $diffurl = wl($ID, array('do' => 'diff', 'rev2[0]' => $l_rev, 'rev2[1]' => $r_rev, 'difftype' => $type));
        ptln('<p><a class="wikilink1" href="' . $diffurl . '">' . $lang['difflink'] . '</a></p>');
        ptln('</div>');
    }
    ?>
    <table class="diff diff_<?php 
    echo $type;
    ?>
">
    <tr>
    <th colspan="2" <?php 
    echo $l_minor;
    ?>
>
    <?php 
    echo $l_head;
    ?>
    </th>
    <th colspan="2" <?php 
    echo $r_minor;
    ?>
>
    <?php 
    echo $r_head;
    ?>
    </th>
    </tr>
    <?php 
    echo $tdf->format($df);
    ?>
    </table>
    <?php 
}
Exemplo n.º 9
0
 /**
  * output appropriate html
  */
 public function html()
 {
     global $lang;
     $helper = $this->loadHelper('loadskin', true);
     print '<div id="plugin__loadskin">';
     print $this->locale_xhtml('intro');
     $form = new Doku_Form(array());
     $form->startFieldSet('Add rule');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'admin');
     $form->addHidden('page', 'loadskin');
     $form->addHidden('act', 'add');
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeTextField('pattern', '', $this->getLang('pattern')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeListboxField('tpl', $helper->getTemplates(), '', $this->getLang('template')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
     $form->endFieldSet();
     $form->printForm();
     if (@file_exists($this->config)) {
         $data = unserialize(io_readFile($this->config, false));
         if (!empty($data)) {
             echo '<table class="inline">' . DOKU_LF;
             echo '  <tr>' . DOKU_LF;
             echo '    <th>' . $this->getLang('pattern') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('template') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('action') . '</th>' . DOKU_LF;
             echo '  </tr>' . DOKU_LF;
             foreach ($data as $key => $value) {
                 echo '  <tr>' . DOKU_LF;
                 echo '    <td>' . $key . '</td>' . DOKU_LF;
                 echo '    <td>' . $value . '</td>' . DOKU_LF;
                 echo '    <td>' . DOKU_LF;
                 $form = new Doku_Form(array());
                 $form->addHidden('do', 'admin');
                 $form->addHidden('page', 'loadskin');
                 $form->addHidden('act', 'del');
                 $form->addHidden('id', $ID);
                 $form->addHidden('pattern', $key);
                 $form->addElement(form_makeButton('submit', '', $lang['btn_delete']));
                 $form->printForm();
                 echo '    </td>' . DOKU_LF;
                 echo '  </tr>' . DOKU_LF;
             }
             echo '</table>' . DOKU_LF;
         }
     }
     print '</div>';
 }
Exemplo n.º 10
0
 /**
  * output appropriate html
  */
 function html()
 {
     global $ID;
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', $this->edit ? 'edit' : 'add');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     $form->startFieldset($this->getLang($this->edit ? 'edituser' : 'adduser'));
     if ($this->edit) {
         $form->addElement(form_makeField('text', 'user', $this->data['user'], $this->getLang('user'), '', '', array('disabled' => 'disabled')));
         $form->addHidden('uid', $this->data['user']);
         $form->addElement('<br />');
     } else {
         $form->addElement(form_makeField('text', 'uid', '', $this->getLang('user')));
         $form->addElement('<br />');
     }
     $form->addElement(form_makeField('text', 'grp', $this->edit ? implode(', ', $this->data['grp']) : '', $this->getLang('grp')));
     $form->addElement('<br />');
     $form->addElement(form_makeButton('submit', '', $this->getLang($this->edit ? 'change' : 'add')));
     $form->endFieldset();
     $form->printForm();
     ptln('<table class="inline" id="vg__show">');
     ptln('  <tr>');
     ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
     ptln('    <th class="grp">' . hsc($this->getLang('grps')) . '</th>');
     ptln('    <th> </th>');
     ptln('  </tr>');
     foreach ($this->users as $user => $grps) {
         //$userdata=$this->_auth->getUserData($user);
         ptln('  <tr>');
         ptln('    <td>' . hsc($user) . (isset($userdata['name']) ? hsc(' (' . $userdata['name'] . ')') : '') . '</td>');
         ptln('    <td>' . hsc(implode(', ', $grps)) . '</td>');
         ptln('    <td class="act">');
         ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
         ptln(' &bull; ');
         ptln('      <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'del', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>');
         ptln('    </td>');
         ptln('  </tr>');
     }
     ptln('</table>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', $this->editgroup ? 'editgroup' : 'addgroup');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     if ($this->editgroup) {
         $form->startFieldset($this->getLang('editgroup'));
         $form->addElement(form_makeField('text', 'group', $this->data['group'], $this->getLang('grp'), '', '', array('disabled' => 'disabled')));
         $form->addElement('<br />');
         $form->addHidden('uid', $this->data['group']);
         $form->addElement(form_makeField('text', 'users', implode(', ', $this->data['users']), $this->getLang('users')));
         $form->addElement('<br />');
     } else {
         $form->startFieldset($this->getLang('addgroup'));
         $form->addElement(form_makeField('text', 'uid', '', $this->getLang('grp')));
         $form->addElement('<br />');
         $form->addElement(form_makeField('text', 'users', '', $this->getLang('users')));
         $form->addElement('<br />');
     }
     $form->addElement(form_makeButton('submit', '', $this->getLang($this->editgroup ? 'change' : 'add')));
     $form->endFieldset();
     $form->printForm();
     ptln('<table class="inline" id="vg__show">');
     ptln('  <tr>');
     ptln('    <th class="grp">' . hsc($this->getLang('grps')) . '</th>');
     ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
     ptln('    <th class="act"> </th>');
     ptln('  </tr>');
     foreach ($this->groups as $group => $users) {
         ptln('  <tr>');
         ptln('    <td>' . hsc($group) . '</td>');
         ptln('    <td>' . hsc(implode(', ', $users)) . '</td>');
         ptln('    <td class="act">');
         ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'editgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
         ptln(' &bull; ');
         ptln('      <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'delgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>');
         ptln('    </td>');
         ptln('  </tr>');
     }
     ptln('</table>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', 'search');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     $form->startFieldset($this->getLang('searchuser'));
     $form->addElement(form_makeField('text', 'uid', '', $this->getLang('searchname')));
     $form->addElement(form_makeButton('submit', '', $this->getLang('search')));
     $form->printForm();
     if (!empty($this->_auth_userlist)) {
         ptln('<table class="inline" id="vg__show">');
         ptln('  <tr>');
         ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
         ptln('    <th class="act"> </th>');
         ptln('  </tr>');
         foreach ($this->_auth_userlist as $user => $userinfo) {
             ptln('  <tr>');
             ptln('    <td>' . hsc($user . ' (' . $userinfo['name'] . ')') . '</td>');
             ptln('    <td class="act">');
             ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
             ptln('    </td>');
             ptln('  </tr>');
         }
         ptln('</table>');
     }
 }
Exemplo n.º 11
0
 /**
  * Display a move workflow button
  *
  * continue, start, retry - continue next steps
  * abort - abort the whole move
  * skip - skip error and continue
  *
  * @param string $control
  * @param bool   $show should this control be visible?
  */
 protected function btn($control, $show = true)
 {
     global $ID;
     $skip = 0;
     $label = $this->getLang('btn_' . $control);
     $id = $control;
     if ($control == 'start') {
         $control = 'continue';
     }
     if ($control == 'retry') {
         $control = 'continue';
         $skip = 0;
     }
     $class = 'move__control ctlfrm-' . $id;
     if (!$show) {
         $class .= ' hide';
     }
     $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => $class));
     $form->addHidden('page', 'move_main');
     $form->addHidden('id', $ID);
     $form->addHidden('ctl', $control);
     $form->addHidden('skip', $skip);
     $form->addElement(form_makeButton('submit', 'admin', $label, array('class' => 'btn ctl-' . $control)));
     $form->printForm();
 }
Exemplo n.º 12
0
 function __siteexport_addpage()
 {
     global $ID, $conf;
     $templateSwitching = false;
     $pdfExport = false;
     $usenumberedheading = false;
     $cronEnabled = false;
     $translationAvailable = false;
     $usenumberedheading = true;
     if (($functions =& plugin_load('preload', 'siteexport')) && $functions->__create_preload_function()) {
         $templateSwitching = true;
     }
     if ($functions =& plugin_load('action', 'dw2pdf')) {
         $pdfExport = true;
     }
     // if ( $functions =& plugin_load('renderer', 'nodetailsxhtml' ) ) {
     // }
     if ($functions =& plugin_load('cron', 'siteexport')) {
         $cronEnabled = $functions->canWriteSettings();
     }
     if ($functions =& plugin_load('helper', 'translation')) {
         $translationAvailable = true;
     }
     $regenerateScript = '';
     print $this->locale_xhtml('intro');
     $form = new Doku_Form('siteexport', null, 'post');
     $form->startFieldset($this->getLang('startingNamespace'));
     $form->addElement(form_makeTextField('ns', $ID, $this->getLang('ns') . ':', 'ns'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeTextField('ens', $ID, $this->getLang('ens') . ':', 'ens'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeListboxField('depthType', array("0.0" => $this->getLang('depth.pageOnly'), "1.0" => $this->getLang('depth.allSubNameSpaces'), "2.0" => $this->getLang('depth.specifiedDepth')), empty($_REQUEST['depthType']) ? $this->getLang('depth.allSubNameSpaces') : $_REQUEST['depthType'], $this->getLang('depthType') . ':', 'depthType', null, array_merge(array('class' => 'edit'))));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeOpenTag("div", array('style' => 'display:' . ($_REQUEST['depthType'] == "2" ? "block" : "none") . ';', 'id' => 'depthContainer')));
     $form->addElement(form_makeTextField('depth', $this->getConf('depth'), $this->getLang('depth') . ':', 'depth'));
     $form->addElement(form_makeCloseTag("div"));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeOpenTag("div", array('style' => 'display:none;', 'id' => 'depthContainer')));
     $form->addElement(form_makeCheckboxField('exportLinkedPages', 1, $this->getLang('exportLinkedPages') . ':', 'exportLinkedPages'));
     $form->addElement(form_makeCloseTag("div"));
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     $form->startFieldset($this->getLang('selectYourOptions'));
     $form->addElement(form_makeCheckboxField('absolutePath', 1, $this->getLang('absolutePath') . ':', 'absolutePath'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('exportBody', 1, $this->getLang('exportBody') . ':', 'exportBody'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('disableCache', 1, $this->getLang('disableCache') . ':', 'disableCache'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('addParams', 1, $this->getLang('addParams') . ':', 'addParams', null, array_merge(array('checked' => $conf['userewrite'] != 1 ? 'checked' : ''))));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeListboxField('renderer', array_merge(array('', 'xhtml'), plugin_list('renderer')), '', $this->getLang('renderer') . ':', 'renderer', null, array_merge(array('class' => 'edit'))));
     $form->addElement(form_makeTag('br'));
     if ($templateSwitching) {
         $form->addElement(form_makeListboxField('template', $this->__getTemplates(), $conf['template'], $this->getLang('template') . ':', 'template', null, array_merge(array('class' => 'edit'))));
         $form->addElement(form_makeTag('br'));
     } else {
         $form->addElement(form_makeTag('br'));
         $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
         $form->addElement('Can\'t create preload file in \'inc\' directory. Template switching is not available. Plugin disabling is not available.');
         $form->addElement(form_makeCloseTag('p'));
     }
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('pdfExport', 1, $this->getLang('pdfExport') . ':', 'pdfExport', null, $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
     if (!$pdfExport) {
         $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
         $form->addElement('In order to use the PDF export, please ');
         $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:dw2pdf', 'alt' => 'install plugin', 'target' => '_blank')));
         $form->addElement('install the dw2pdf plugin.');
         $form->addElement(form_makeCloseTag('a'));
         $form->addElement(form_makeCloseTag('p'));
     }
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('usenumberedheading', 1, $this->getLang('usenumberedheading') . ':', 'usenumberedheading', null, $usenumberedheading && $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
     $form->addElement(form_makeTag('br'));
     if (!$usenumberedheading) {
         $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
         $form->addElement('In order to use numbered headings, please ');
         $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:nodetailsxhtml', 'alt' => 'install plugin', 'target' => '_blank')));
         $form->addElement('install the nodetailsxhtml plugin.');
         $form->addElement(form_makeCloseTag('a'));
         $form->addElement(form_makeCloseTag('p'));
     }
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     $form->startFieldset($this->getLang('helpCreationOptions'));
     $form->addElement(form_makeCheckboxField('eclipseDocZip', 1, $this->getLang('eclipseDocZip') . ':', 'eclipseDocZip'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('JavaHelpDocZip', 1, $this->getLang('JavaHelpDocZip') . ':', 'JavaHelpDocZip'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('useTocFile', 1, $this->getLang('useTocFile') . ':', 'useTocFile'));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeCheckboxField('emptyTocElem', 1, $this->getLang('emptyTocElem') . ':', 'emptyTocElem'));
     $form->addElement(form_makeTag('br'));
     if (!$translationAvailable) {
         $form->addElement(form_makeCheckboxField('TOCMapWithoutTranslation', 1, $this->getLang('TOCMapWithoutTranslation') . ':', 'TOCMapWithoutTranslation'));
         $form->addElement(form_makeTag('br'));
     }
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     if ($templateSwitching) {
         $form->startFieldset($this->getLang('disablePluginsOption'));
         $form->addElement(form_makeCheckboxField("disableall", 1, 'Disable All:', "disableall", 'forceVisible'));
         $form->addElement(form_makeTag('br'));
         $form->addElement(form_makeTag('br'));
         list($allPlugins, $enabledPlugins) = $this->__getPluginList();
         foreach ($allPlugins as $plugin) {
             $form->addElement(form_makeCheckboxField("disableplugin[]", $plugin, $plugin . ':', "disableplugin_{$plugin}", null, !in_array($plugin, $enabledPlugins) ? array('checked' => 'checked', 'disabled' => 'disabled') : array()));
             $form->addElement(form_makeTag('br'));
         }
         $form->endFieldset();
         $form->addElement(form_makeTag('br'));
     }
     $form->startFieldset($this->getLang('customOptions'));
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement($this->getLang('customOptionsDescription'));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeOpenTag('ul', array('id' => 'siteexport__customActions')));
     $form->addElement(form_makeCloseTag('ul'));
     $form->addElement(form_makeTag('br', array('class' => 'clear')));
     $form->addElement(form_makeButton('submit', 'addoption', $this->getLang('addCustomOption'), array('style' => 'float:right;')));
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     $form->startFieldset($this->getLang('startProcess'));
     $form->addElement(form_makeTextField('copyurl', "", $this->getLang('directDownloadLink') . ':', 'copyurl', null, array('readonly' => 'readonly')));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeTextField('wgeturl', "", $this->getLang('wgetURLLink') . ':', 'wgeturl', null, array('readonly' => 'readonly')));
     $form->addElement(form_makeTag('br'));
     $form->addElement(form_makeTextField('curlurl', "", $this->getLang('curlURLLink') . ':', 'curlurl', null, array('readonly' => 'readonly')));
     $form->addElement(form_makeTag('br', array('class' => 'clear')));
     $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('start'), array('style' => 'float:right;')));
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     $form->startFieldset($this->getLang('status'));
     $form->addElement(form_makeOpenTag('span', array('id' => 'siteexport__out')));
     $form->addElement(form_makeCloseTag('span'));
     $form->addElement(form_makeOpenTag('span', array('class' => 'siteexport__throbber')));
     $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/loading.gif', 'id' => 'siteexport__throbber')));
     $form->addElement(form_makeCloseTag('span'));
     $form->endFieldset();
     $form->addElement(form_makeTag('br'));
     if ($cronEnabled) {
         $form->startFieldset($this->getLang('cronSaveProcess'));
         $form->addElement(form_makeOpenTag('p'));
         $form->addElement($this->getLang('cronDescription'));
         $form->addElement(form_makeCloseTag('p'));
         $form->addElement(form_makeCheckboxField("cronOverwriteExisting", 1, $this->getLang('canOverwriteExisting'), "cronOverwriteExisting"));
         $form->addElement(form_makeTag('br', array('class' => 'clear')));
         $form->addElement(form_makeButton('submit', 'cronDeleteAction', $this->getLang('cronDeleteAction'), array('id' => 'cronDeleteAction', 'style' => 'float:left;display:none')));
         $form->addElement(form_makeButton('submit', 'cronSaveAction', $this->getLang('cronSaveAction'), array('id' => 'cronSaveAction', 'style' => 'float:right;')));
         $form->addElement(form_makeTag('br', array('class' => 'clear')));
         $form->addElement(form_makeOpenTag('a', array('href' => '#cronactions', 'alt' => 'show cron jobs', 'id' => 'showcronjobs', 'target' => '_blank', 'style' => 'float:right;')));
         $form->addElement('show all cron jobs');
         $form->addElement(form_makeCloseTag('a'));
         $form->endFieldset();
     }
     $form->printForm();
 }
Exemplo n.º 13
0
 /**
  * Wraps provided HTML code in a form sending form data to current wiki
  * page.
  *
  * @param string $code HTML code to embed
  * @param array $hiddens set of hidden values to be added
  * @param integer $maxUploadSize maximum size of supported uploads in bytes
  * @param boolean $isSingle set true on calling to render single-record editor
  * @return string
  */
 protected function wrapInForm($code, $hiddens = null, $maxUploadSize = null, $isSingle = false)
 {
     include_once DOKU_INC . 'inc/form.php';
     ob_start();
     $id = 'database2_' . ($isSingle ? 'single' : 'table') . '_' . $this->table . '_' . $this->getIndex();
     if ($maxUploadSize > 0) {
         $form = new Doku_Form($id, false, 'POST', 'multipart/form-data');
         $form->addHidden('MAX_FILE_SIZE', intval($maxUploadSize));
     } else {
         $form = new Doku_Form($id);
     }
     $form->addHidden('id', $this->getPageID());
     if (is_array($hiddens)) {
         foreach ($hiddens as $name => $value) {
             $form->addHidden($name, $value);
         }
     }
     $form->addElement($code);
     $form->printForm();
     return ob_get_clean();
 }
Exemplo n.º 14
0
 /**
  * Prints the comment form
  *
  * FIXME
  *  allow comments only for registered users
  *  add toolbar
  *
  * @param $page
  * @param $pid
  * @param $tplname
  */
 public function tpl_form($page, $pid, $tplname)
 {
     global $BLOGTNG;
     $form = new Doku_Form(array('id' => 'blogtng__comment_form', 'action' => wl($page) . '#blogtng__comment_form', 'data-tplname' => $tplname));
     $form->addHidden('pid', $pid);
     $form->addHidden('id', $page);
     $form->addHidden('btng[comment][source]', 'comment');
     foreach (array('name', 'mail', 'web') as $field) {
         $attr = $BLOGTNG['comment_submit_errors'][$field] ? array('class' => 'edit error') : array();
         if ($field == 'web' && !$this->getConf('comments_allow_web')) {
             continue;
         } else {
             $form->addElement(form_makeTextField('btng[comment][' . $field . ']', $BLOGTNG['comment'][$field], $this->getLang('comment_' . $field), 'blogtng__comment_' . $field, 'edit block', $attr));
         }
     }
     $form->addElement(form_makeOpenTag('div', array('class' => 'blogtng__toolbar')));
     $form->addElement(form_makeCloseTag('div'));
     if ($BLOGTNG['comment_submit_errors']['text']) {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text'], array('class' => 'edit error')));
     } else {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text']));
     }
     //add captcha if available
     /** @var helper_plugin_captcha $helper */
     $helper = null;
     if (@is_dir(DOKU_PLUGIN . 'captcha')) {
         $helper = plugin_load('helper', 'captcha');
     }
     if (!is_null($helper) && $helper->isEnabled()) {
         $form->addElement($helper->getHTML());
     }
     $form->addElement(form_makeButton('submit', 'comment_preview', $this->getLang('comment_preview'), array('class' => 'button', 'id' => 'blogtng__preview_submit')));
     $form->addElement(form_makeButton('submit', 'comment_submit', $this->getLang('comment_submit'), array('class' => 'button', 'id' => 'blogtng__comment_submit')));
     if ($this->getConf('comments_subscription')) {
         $form->addElement(form_makeCheckboxField('blogtng[subscribe]', 1, $this->getLang('comment_subscribe')));
     }
     print '<div id="blogtng__comment_form_wrap">' . DOKU_LF;
     $form->printForm();
     if (isset($BLOGTNG['comment_action']) && $BLOGTNG['comment_action'] == 'preview' && empty($BLOGTNG['comment_submit_errors'])) {
         print '<div id="blogtng__comment_preview">' . DOKU_LF;
         $comment = new blogtng_comment();
         $comment->data = $BLOGTNG['comment'];
         $comment->data['cid'] = 'preview';
         $comment->output($tplname);
         print '</div>' . DOKU_LF;
     }
     print '</div>' . DOKU_LF;
 }
Exemplo n.º 15
0
 function html()
 {
     global $ID;
     echo $this->locale_xhtml('intro');
     if ($_REQUEST['db'] && checkSecurityToken()) {
         echo '<h2>' . $this->getLang('db') . ' ' . hsc($_REQUEST['db']) . '</h2>';
         echo '<div class="level2">';
         echo '<ul>';
         echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'table\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('table') . '</a></div></li>';
         echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'index\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('index') . '</a></div></li>';
         echo '</ul>';
         $form = new Doku_Form(array());
         $form->startFieldset('SQL Command');
         $form->addHidden('id', $ID);
         $form->addHidden('do', 'admin');
         $form->addHidden('page', 'sqlite');
         $form->addHidden('db', $_REQUEST['db']);
         $form->addElement('<textarea name="sql" class="edit">' . hsc($_REQUEST['sql']) . '</textarea>');
         $form->addElement('<input type="submit" class="button" />');
         $form->endFieldset();
         $form->printForm();
         if ($_REQUEST['sql']) {
             $DBI =& plugin_load('helper', 'sqlite');
             if (!$DBI->init($_REQUEST['db'], '')) {
                 return;
             }
             $sql = explode(";", $_REQUEST['sql']);
             foreach ($sql as $s) {
                 $s = preg_replace('!^\\s*--.*$!m', '', $s);
                 $s = trim($s);
                 if (!$s) {
                     continue;
                 }
                 $res = $DBI->query("{$s};");
                 if ($res === false) {
                     continue;
                 }
                 msg(sqlite_num_rows($res) . ' affected rows', 1);
                 $result = $DBI->res2arr($res);
                 if (!count($result)) {
                     continue;
                 }
                 echo '<p>';
                 $ths = array_keys($result[0]);
                 echo '<table class="inline">';
                 echo '<tr>';
                 foreach ($ths as $th) {
                     echo '<th>' . hsc($th) . '</th>';
                 }
                 echo '</tr>';
                 foreach ($result as $row) {
                     echo '<tr>';
                     $tds = array_values($row);
                     foreach ($tds as $td) {
                         echo '<td>' . hsc($td) . '</td>';
                     }
                     echo '</tr>';
                 }
                 echo '</table>';
                 echo '</p>';
             }
         }
         echo '</div>';
     }
 }
Exemplo n.º 16
0
 function html()
 {
     $sqlite = $this->dthlp->_getDB();
     if (!$sqlite) {
         return false;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM aliases ORDER BY name";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'data_aliases');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('type') . '</th>' . '<th>' . $this->getLang('prefix') . '</th>' . '<th>' . $this->getLang('postfix') . '</th>' . '<th>' . $this->getLang('enum') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'type' => '', 'prefix' => '', 'postfix' => '', 'enum' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeMenuField('d[' . $cur . '][type]', array('', 'page', 'title', 'mail', 'url', 'dt', 'wiki'), $row['type'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][prefix]', $row['prefix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][postfix]', $row['postfix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][enum]', $row['enum'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }
Exemplo n.º 17
0
 /**
  * Display the template tab
  */
 public function tabInstall()
 {
     echo '<div class="panelHeader">';
     echo $this->locale_xhtml('intro_install');
     echo '</div>';
     $form = new Doku_Form(array('action' => $this->tabURL('', array(), '&'), 'enctype' => 'multipart/form-data', 'class' => 'install'));
     $form->addElement(form_makeTextField('installurl', '', $this->getLang('install_url'), '', 'block'));
     $form->addElement(form_makeFileField('installfile', $this->getLang('install_upload'), '', 'block'));
     $form->addElement(form_makeButton('submit', '', $this->getLang('btn_install')));
     $form->printForm();
 }
Exemplo n.º 18
0
    /**
     * show the move and/or rename a page form
     *
     * @author  Michael Hamann <*****@*****.**>
     * @author  Gary Owen <*****@*****.**>
     */
    function printForm() {
        global $ID;

        $ns = getNS($ID);

        $ns_select_data = $this->build_namespace_select_content($ns);

        $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
        $form->addHidden('page', $this->getPluginName());
        $form->addHidden('id', $ID);
        $form->addHidden('move_type', 'page');
        $form->startFieldset($this->getLang('movepage'));
        $form->addElement(form_makeMenuField('ns_for_page', $ns_select_data, $this->opts['ns_for_page'], $this->getLang('targetns'), '', 'block'));
        $form->addElement(form_makeTextField('newns', $this->opts['newns'], $this->getLang('newtargetns'), '', 'block'));
        $form->addElement(form_makeTextField('newname', $this->opts['newname'], $this->getLang('newname'), '', 'block'));
        $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
        $form->endFieldset();
        $form->printForm();

        if ($this->ns_opts !== false) {
            ptln('<fieldset>');
            ptln('<legend>');
            ptln($this->getLang('movens'));
            ptln('</legend>');
            ptln('<p>');
            ptln(sprintf($this->getLang('ns_move_in_progress'), $this->ns_opts['num_pages'], $this->ns_opts['num_media'], ':'.hsc($this->ns_opts['ns']), ':'.hsc($this->ns_opts['newns'])));
            ptln('</p>');
            ptln($this->helper->getNSMoveButton('continue'));
            ptln($this->helper->getNSMoveButton('abort'));
            ptln('</fieldset>');
        } else {
            $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
            $form->addHidden('page', $this->getPluginName());
            $form->addHidden('id', $ID);
            $form->addHidden('move_type', 'namespace');
            $form->startFieldset($this->getLang('movens'));
            $form->addElement(form_makeMenuField('targetns', $ns_select_data, $this->opts['targetns'], $this->getLang('targetns'), '', 'block'));
            $form->addElement(form_makeTextField('newnsname', $this->opts['newnsname'], $this->getLang('newnsname'), '', 'block'));
            $form->addElement(form_makeMenuField('contenttomove', array('pages' => $this->getLang('move_pages'), 'media' => $this->getLang('move_media'), 'both' => $this->getLang('move_media_and_pages')), $this->opts['contenttomove'], $this->getLang('content_to_move'), '', 'block'));
            $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
            $form->endFieldset();
            $form->printForm();
        }
    }
Exemplo n.º 19
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM fields";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_fields');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('title') . '</th>' . '<th>' . $this->getLang('defaultval') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'title' => '', 'defaultval' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addHidden('up[' . $cur . '][fid]', $row['fid']);
         $form->addElement(form_makeTextField('up[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][title]', $row['title'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][defaultval]', $row['defaultval'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }
Exemplo n.º 20
0
/**
 * Form print function.
 * Just calls printForm() on the data object.
 *
 * @param Doku_Form $data The form
 */
function html_form_output($data)
{
    $data->printForm();
}
Exemplo n.º 21
0
 function test_close_fieldset()
 {
     $form = new Doku_Form(array('id' => 'dw__testform', 'action' => '/test'));
     $form->startFieldset('Test');
     $form->addHidden('summary', 'changes &c');
     $form->addElement(form_makeTextField('t', 'v', 'Text', 'text__id', 'block'));
     $form->addElement(form_makeCheckboxField('r', '1', 'Check', 'check__id', 'simple'));
     $form->addElement(form_makeButton('submit', 'save', 'Save', array('accesskey' => 's')));
     $form->addElement(form_makeButton('submit', 'cancel', 'Cancel'));
     ob_start();
     $form->printForm();
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($this->_ignoreTagWS($output), $this->_ignoreTagWS($this->_realoutput()));
 }
Exemplo n.º 22
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     global $ID;
     global $INPUT;
     if (is_null($this->_auth)) {
         print $this->lang['badauth'];
         return false;
     }
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     $fn = $INPUT->param('fn');
     if (is_array($fn)) {
         $cmd = key($fn);
         $param = is_array($fn[$cmd]) ? key($fn[$cmd]) : null;
     } else {
         $cmd = $fn;
         $param = null;
     }
     $user_list = $this->_auth->retrieveUsers($this->_start, $this->_pagesize, $this->_filter);
     echo $this->locale_xhtml('admin_intro');
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_users');
     // List registered users
     $form->addElement('<table>' . '<tr>' . '<th>' . $this->getLang('username') . '</th>' . '<th>' . $this->getLang('realname') . '</th>' . '<th>' . $this->getLang('email') . '</th>' . '</tr>');
     foreach ($user_list as $user => $userinfo) {
         extract($userinfo);
         /**
          * @var string $name
          * @var string $pass
          * @var string $mail
          * @var array  $grps
          */
         if (!in_array('noprofile', $grps)) {
             $form->addElement('<tr>' . '<td><a href="' . wl($ID, array('fn[edit][' . $user . ']' => 1, 'do' => 'admin', 'page' => 'userprofile_users', 'sectok' => getSecurityToken())) . '" title="' . $this->lang['edit_prompt'] . '">' . hsc($user) . '</a></td>' . '<td>' . hsc($name) . '</td>' . '<td>' . hsc($mail) . '</td>' . '</tr>');
         }
     }
     $form->addElement('</table>');
     // Edit table
     if ($cmd == "edit") {
         $user = $param;
         $profile = $this->hlp->getProfile($user);
         // create hidden fields
         $form->addHidden('up[user][user]', $user);
         $form->addHidden('up[user][name]', $user_list[$user]['name']);
         $form->addHidden('up[user][email]', $user_list[$user]['mail']);
         $sql = "SELECT * FROM fields";
         $res = $sqlite->query($sql);
         $fields = $sqlite->res2arr($res);
         $form->addElement('<table>' . '<tr>' . '<th colspan="2">' . $this->getLang('th_edit') . '</th>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('realname') . '</td>' . '<td>' . hsc($user_list[$user]['name']) . '</td>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('email') . '</td>' . '<td>' . hsc($user_list[$user]['mail']) . '</td>' . '</tr>');
         foreach ($fields as $field) {
             $form->addElement('<tr>');
             $form->addElement('<td>' . hsc($field['title']) . '</td>');
             $form->addElement('<td>');
             $defaults_array = explode('|', $field['defaultval']);
             if (count($defaults_array) > 1) {
                 // create select field
                 $defaults_array = array_map('trim', $defaults_array);
                 $form->addElement(form_makeMenuField('up[data][' . $field['name'] . ']', $defaults_array, $profile[$field['name']], ''));
             } else {
                 // create regular text field
                 $form->addElement(form_makeTextField('up[data][' . $field['name'] . ']', $profile[$field['name']], ''));
             }
             $form->addElement('</td>');
             $form->addElement('</tr>');
         }
         $form->addElement('<tr>' . '<td colspan="2">');
         $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
         $form->addElement('</td>');
         $form->addElement('</table>');
     }
     $form->printForm();
 }
Exemplo n.º 23
0
 function html()
 {
     global $ID;
     global $conf;
     echo $this->locale_xhtml('intro');
     if (isset($_REQUEST['db']) && checkSecurityToken()) {
         echo '<h2>' . $this->getLang('db') . ' "' . hsc($_REQUEST['db']) . '"</h2>';
         echo '<div class="level2">';
         $sqlcommandform = true;
         /** @var $DBI helper_plugin_sqlite */
         $DBI =& plugin_load('helper', 'sqlite');
         if ($_REQUEST['version'] == 'sqlite2') {
             if (helper_plugin_sqlite_adapter::isSqlite3db($conf['metadir'] . '/' . $_REQUEST['db'] . '.sqlite')) {
                 msg('This is a database in sqlite3 format.', 2);
                 msg('This plugin needs your database file has the extension ".sqlite3"
                     instead of ".sqlite" before it will be recognized as sqlite3 database.', 2);
                 $form = new Doku_Form(array('method' => 'post'));
                 $form->addHidden('page', 'sqlite');
                 $form->addHidden('sqlite_rename', 'go');
                 $form->addHidden('db', $_REQUEST['db']);
                 $form->addElement(form_makeButton('submit', 'admin', sprintf($this->getLang('rename2to3'), hsc($_REQUEST['db']))));
                 $form->printForm();
                 if ($DBI->existsPDOSqlite()) {
                     $sqlcommandform = false;
                 }
             } else {
                 if ($DBI->existsPDOSqlite()) {
                     $sqlcommandform = false;
                     msg('This is a database in sqlite2 format.', 2);
                     if ($DBI->existsSqlite2()) {
                         $form = new Doku_Form(array('method' => 'post'));
                         $form->addHidden('page', 'sqlite');
                         $form->addHidden('sqlite_convert', 'go');
                         $form->addHidden('db', $_REQUEST['db']);
                         $form->addElement(form_makeButton('submit', 'admin', sprintf($this->getLang('convert2to3'), hsc($_REQUEST['db']))));
                         $form->printForm();
                     } else {
                         msg('Before PDO sqlite can handle this format, it needs a conversion to the sqlite3 format.
                             Because PHP sqlite extension is not available,
                             you should manually convert "' . hsc($_REQUEST['db']) . '.sqlite" in the meta directory to "' . hsc($_REQUEST['db']) . '.sqlite3".<br />
                             See for info about the conversion ' . $this->external_link('http://www.sqlite.org/version3.html') . '.', -1);
                     }
                 }
             }
         } else {
             if (!$DBI->existsPDOSqlite()) {
                 $sqlcommandform = false;
                 msg('A database in sqlite3 format needs the PHP PDO sqlite plugin.', -1);
             }
         }
         if ($sqlcommandform) {
             echo '<ul>';
             echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'version' => $_REQUEST['version'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'table\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('table') . '</a></div></li>';
             echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'version' => $_REQUEST['version'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'index\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('index') . '</a></div></li>';
             echo '</ul>';
             $form = new Doku_Form(array('class' => 'sqliteplugin'));
             $form->startFieldset('SQL Command');
             $form->addHidden('id', $ID);
             $form->addHidden('do', 'admin');
             $form->addHidden('page', 'sqlite');
             $form->addHidden('db', $_REQUEST['db']);
             $form->addHidden('version', $_REQUEST['version']);
             $form->addElement('<textarea name="sql" class="edit">' . hsc($_REQUEST['sql']) . '</textarea>');
             $form->addElement('<input type="submit" class="button" />');
             $form->endFieldset();
             $form->printForm();
             if ($_REQUEST['sql']) {
                 if (!$DBI->init($_REQUEST['db'], '')) {
                     return;
                 }
                 $sql = $DBI->SQLstring2array($_REQUEST['sql']);
                 foreach ($sql as $s) {
                     $s = preg_replace('!^\\s*--.*$!m', '', $s);
                     $s = trim($s);
                     if (!$s) {
                         continue;
                     }
                     $time_start = microtime(true);
                     $res = $DBI->query("{$s};");
                     if ($res === false) {
                         continue;
                     }
                     $result = $DBI->res2arr($res);
                     $time_end = microtime(true);
                     $time = $time_end - $time_start;
                     $cnt = $DBI->res2count($res);
                     msg($cnt . ' affected rows in ' . ($time < 0.0001 ? substr($time, 0, 5) . substr($time, -3) : substr($time, 0, 7)) . ' seconds', 1);
                     if (!$cnt) {
                         continue;
                     }
                     echo '<p>';
                     $ths = array_keys($result[0]);
                     echo '<table class="inline">';
                     echo '<tr>';
                     foreach ($ths as $th) {
                         echo '<th>' . hsc($th) . '</th>';
                     }
                     echo '</tr>';
                     foreach ($result as $row) {
                         echo '<tr>';
                         $tds = array_values($row);
                         foreach ($tds as $td) {
                             echo '<td>' . hsc($td) . '</td>';
                         }
                         echo '</tr>';
                     }
                     echo '</table>';
                     echo '</p>';
                 }
             }
         }
         echo '</div>';
     }
 }