Example #1
0
/**
 * Injects the necessary trackingcodes for piwik tracking (v2.x) into DOM
 * like specified in the plugin manager fields
 */
function piwik_code()
{
	global $conf;

	if (isset($conf['plugin']['piwik2']['js_tracking_code'])
        || (isset($conf['plugin']['piwik2']['img_tracking_code']))
    ) {
		// Config does not contain keys if they are default;
		// so check whether they are set & to non-default value
		
		// default 0, so check if it's not set or 0
		if (!isset($conf['plugin']['piwik2']['track_admin_user']) || $conf['plugin']['piwik2']['track_admin_user'] == 0) {
			if (isset($_SERVER['REMOTE_USER']) && auth_isadmin()) { return; }
		}
		
		// default 1, so check if it's set and 0
		if (isset($conf['plugin']['piwik2']['track_user']) && $conf['plugin']['piwik2']['track_user'] == 0) {
			if (isset($_SERVER['REMOTE_USER'])) { return; }
		}

        //changes made by Marcel Lange (info@bravehartk2.de)
        $trackingCode = (isset($conf['plugin']['piwik2']['js_tracking_code']))? $conf['plugin']['piwik2']['js_tracking_code'] : '';
        if(isset($conf['plugin']['piwik2']['use_img_tracking']) && $conf['plugin']['piwik2']['use_img_tracking'] == 1 && isset($conf['plugin']['piwik2']['img_tracking_code'])){
            $trackingCode = $conf['plugin']['piwik2']['img_tracking_code'];
        }
        ptln($trackingCode);
	} else {
		// Show configuration tip for admin
		if (isset($_SERVER['REMOTE_USER']) && auth_isadmin()) {
			msg('Please configure the piwik2 plugin');
		}
	}
}
 /**
  * Hook js code after page loading.
  */
 public function _hookjsprocessing(Doku_Event &$event, $param)
 {
     global $ID;
     global $INFO;
     //this ensures that code will be written only on base page
     //not on other inlined wiki pages (e.g. when using monobook template)
     if ($ID != $INFO["id"]) {
         return;
     }
     ptln("");
     ptln("<script type='text/javascript'>");
     ptln("window.onload = function () {");
     ptln("  hljs.configure({");
     ptln("    tabReplace: '    ',");
     ptln("    classPrefix: 'hljs-',");
     // ptln("    useBR: false");
     ptln("  });");
     ptln("  hljs.initHighlighting()");
     // ptln("  var blocks = document.querySelectorAll('pre.hljs-wrap code');");
     trim($token, '<>');
     // ptln("  var i, len;");
     // ptln("  for (i = 0, len = blocks.length; i < len; i++) {");
     // ptln("    hljs.highlightBlock(blocks[i]);");
     // ptln("  }");
     ptln("};");
     ptln("</script>");
 }
 /**
  * Output appropriate html
  *
  */
 function html()
 {
     global $ID;
     global $conf;
     // Display the text about this plugin from "fblogin/lang/$lang/intro.txt"
     print $this->locale_xhtml('intro');
     ptln('<div id="fblofin__manager">');
     // If not installed, it displays the install menu
     // if installed, it displays the uninstall menu
     ptln('<form action_="' . wl($ID) . '" method="post">');
     if ($this->is_installed()) {
         if ($this->is_used()) {
             ptln('<p> ' . $this->getLang('is_used') . '</p>');
         } else {
             ptln('<p> ' . $this->getLang('uninstall') . ' </p>');
             ptln('<p> <input type="hidden" name="action_" value="uninstall" />');
             ptln('    <input type="submit" name="submit" class="button" value="' . $this->getLang('btn_uninstall') . '" /> </p>');
         }
     } else {
         ptln('<p> ' . $this->getLang('install') . ' </p>');
         ptln('<p> <input type="hidden" name="action_" value="install" />');
         ptln('    <input type="submit" name="submit" class="button" value="' . $this->getLang('btn_install') . '" /> </p>');
     }
     ptln('  <p> <input type="hidden" name="do"     value="admin" />');
     ptln('      <input type="hidden" name="page"   value="fblogin" /> </p>');
     ptln('</form>');
     ptln('</div>');
 }
 /**
  * Print results of the download
  */
 function html()
 {
     parent::html();
     ptln('<div class="pm_info">');
     ptln('<h2>' . $this->lang['downloading'] . '</h2>');
     if ($this->manager->error) {
         ptln('<div class="error">' . str_replace("\n", "<br />", $this->manager->error) . '</div>');
     } else {
         if (count($this->downloaded) == 1) {
             ptln('<p>' . sprintf($this->lang['downloaded'], $this->downloaded[0]) . '</p>');
         } else {
             if (count($this->downloaded)) {
                 // more than one plugin in the download
                 ptln('<p>' . $this->lang['downloads'] . '</p>');
                 ptln('<ul>');
                 foreach ($this->downloaded as $plugin) {
                     ptln('<li><div class="li">' . $plugin . '</div></li>', 2);
                 }
                 ptln('</ul>');
             } else {
                 // none found in download
                 ptln('<p>' . $this->lang['download_none'] . '</p>');
             }
         }
     }
     ptln('</div>');
 }
 public function html()
 {
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     $log = $this->loadHelper('log404');
     $log->load();
     ptln('<ol class=' . $this->getPluginName() . '>');
     foreach ($log->getRecords() as $id => $detail) {
         ptln($this->getHtml($id, $detail));
     }
     ptln('</ol>');
 }
Example #6
0
 /**
  * Render HTML output, e.g. helpful text and a form
  */
 public function html()
 {
     $class = 'nopopup';
     if ($this->ispopup) {
         $class = 'ispopup page';
     }
     echo '<div id="plugin__styling" class="' . $class . '">';
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     $this->form();
     echo '</div>';
 }
Example #7
0
 function metaheaders_after(&$event, $param)
 {
     global $ACT;
     if ($ACT !== 'register') {
         return;
     }
     if ($this->captcha == 'none' || $this->captcha == 'builtin') {
         ptln("\n<style type='text/css'>\n   /*<![CDATA[*/");
         ptln("#plugin__captcha_wrapper{ display:none; }\n   /*]]>*/\n</style>");
     }
 }
Example #8
0
 function html()
 {
     parent::html();
     ptln('<div class="pm_info">');
     ptln('<h2>' . $this->lang['deleting'] . '</h2>');
     if ($this->manager->error) {
         ptln('<div class="error">' . str_replace("\n", "<br />", $this->manager->error) . '</div>');
     } else {
         ptln('<p>' . sprintf($this->lang['deleted'], $this->plugin) . '</p>');
     }
     ptln('</div>');
 }
Example #9
0
 /** output appropriate html */
 function html()
 {
     $this->handleAction();
     ptln('<form action="' . wl($ID) . '" method="post">');
     // output hidden values to ensure dokuwiki will return back to this plugin
     ptln('  <input type="hidden" name="do"   value="admin" />');
     ptln('  <input type="hidden" name="page" value="' . $this->getPluginName() . '" />');
     formSecurityToken();
     ptln($this->formOutput);
     ptln('</form><br>');
     ptln($this->htmlOutput);
 }
Example #10
0
 function debug(&$event, $param)
 {
     global $ID;
     ptln('<h1>Publish plug-in debug</h1>');
     ptln('<h1>Metadata</h1>');
     ptln('<pre>');
     ptln(print_r(p_get_metadata($ID), true));
     ptln('</pre>');
     ptln('<h1>pageinfo</h1>');
     ptln('<pre>');
     ptln(print_r(pageinfo(), true));
     ptln('</pre>');
 }
Example #11
0
 /**
  * output appropriate html
  */
 function html()
 {
     ptln('<a href="javascript:prereg_Inf.toggle();void 0"><span style="line-height: 175%">Toggle info</span></a><br />');
     ptln('<div id="prereg_info" style="border: 1px solid silver; padding:4px;">' . $this->locale_xhtml('info') . '</div><br>');
     ptln('<form action="' . wl($ID) . '" method="post">');
     // output hidden values to ensure dokuwiki will return back to this plugin
     ptln('  <input type="hidden" name="do"   value="admin" />');
     ptln('  <input type="hidden" name="page" value="' . $this->getPluginName() . '" />');
     formSecurityToken();
     ptln('  <input type="submit" name="cmd[confirm]"  value="' . $this->getLang('btn_confirm') . '" />&nbsp;&nbsp;');
     ptln('  <input type="submit" name="cmd[secure]"  value="' . $this->getLang('btn_secure') . '" />');
     ptln('<br /><br /><div>');
     echo $this->getConfirmList();
     ptln('</div>');
     ptln('</form>');
     $this->js();
 }
 /**
  * output appropriate html
  */
 function html()
 {
     global $ID, $auth;
     $filter['grps'] = "user";
     if ($auth->canDo('getUsers')) {
         // is this feature available?
         $users = $auth->retrieveUsers(0, 0);
     }
     $html = '<p>' . $this->getLang("intro_message") . '</p>
         <form class="admin-form" action="' . wl($ID) . '" method="post">
         <label class="block">' . $this->getLang("question_name") . ': <input name="problem_name" type="text" /></label>
         <label class="block">' . $this->getLang("sender") . ':
         <select name="user">
         <option value="">' . $this->getLang("all_users") . '</option>';
     while ($user = current($users)) {
         $html .= '<option value="' . key($users) . '">' . $user["name"] . '</option>';
         next($users);
     }
     $html .= '
         </select>
         </label>
         <label class="block">
         <input type="radio" name="type" value="test-case"> ' . $this->getLang('programming_questions') . '<br />
         <input type="radio" name="type" value="output-only"> ' . $this->getLang('outputonly_questions') . '
         </label>';
     // output hidden values to ensure dokuwiki will return back to this plugin
     $html .= '<input type="hidden" name="do"   value="admin" />' . '<input type="hidden" name="page" value="' . $this->getPluginName() . '" />';
     ptln($html);
     formSecurityToken();
     $html = '
     <input type="submit" name="cmd[get]"  value="' . $this->getLang('btn_get_submissions') . '" />
     <input type="submit" name="cmd[delete]"  value="' . $this->getLang('btn_delete_submissions') . '" />
     </form><h1 class="sectionedit1"></h1>
     ';
     $html .= $this->output;
     ptln($html);
 }
Example #13
0
 /**
  * Displays links to older newer discussions
  */
 function _browseDiscussionLinks($more, $first, $num)
 {
     global $ID;
     if ($first == 0 && !$more) {
         return true;
     }
     $params = array('do' => 'admin', 'page' => 'discussion');
     $last = $first + $num;
     ptln('<div class="level1">', 8);
     if ($first > 0) {
         $first -= $num;
         if ($first < 0) {
             $first = 0;
         }
         $params['first'] = $first;
         ptln('<p class="centeralign">', 8);
         $ret = '<a href="' . wl($ID, $params) . '" class="wikilink1">&lt;&lt; ' . $this->getLang('newer') . '</a>';
         if ($more) {
             $ret .= ' | ';
         } else {
             ptln($ret, 10);
             ptln('</p>', 8);
         }
     } else {
         if ($more) {
             ptln('<p class="centeralign">', 8);
         }
     }
     if ($more) {
         $params['first'] = $last;
         $ret .= '<a href="' . wl($ID, $params) . '" class="wikilink1">' . $this->getLang('older') . ' &gt;&gt;</a>';
         ptln($ret, 10);
         ptln('</p>', 8);
     }
     ptln('</div>', 6);
     // class="level1"
     return true;
 }
Example #14
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();
        }
    }
 function html()
 {
     // output the standard menu stuff
     parent::html();
     // sanity check
     if (!$this->manager->plugin) {
         return;
     }
     ptln('<div class="pm_info">');
     ptln("<h2>" . $this->manager->getLang('plugin') . " {$this->manager->plugin}</h2>");
     // collect pertinent information from the log
     $installed = $this->plugin_readlog($this->manager->plugin, 'installed');
     $source = $this->plugin_readlog($this->manager->plugin, 'url');
     $updated = $this->plugin_readlog($this->manager->plugin, 'updated');
     if (strrpos($updated, "\n") !== false) {
         $updated = substr($updated, strrpos($updated, "\n") + 1);
     }
     ptln("<dl>", 2);
     ptln("<dt>" . $this->manager->getLang('source') . '</dt><dd>' . ($source ? $source : $this->manager->getLang('unknown')) . "</dd>", 4);
     ptln("<dt>" . $this->manager->getLang('installed') . '</dt><dd>' . ($installed ? $installed : $this->manager->getLang('unknown')) . "</dd>", 4);
     if ($updated) {
         ptln("<dt>" . $this->manager->getLang('lastupdate') . '</dt><dd>' . $updated . "</dd>", 4);
     }
     ptln("</dl>", 2);
     if (count($this->details) == 0) {
         ptln("<p>" . $this->manager->getLang('noinfo') . "</p>", 2);
     } else {
         ptln("<dl>", 2);
         if ($this->plugin_info['name']) {
             ptln("<dt>" . $this->manager->getLang('name') . "</dt><dd>" . $this->out($this->plugin_info['name']) . "</dd>", 4);
         }
         if ($this->plugin_info['date']) {
             ptln("<dt>" . $this->manager->getLang('date') . "</dt><dd>" . $this->out($this->plugin_info['date']) . "</dd>", 4);
         }
         if ($this->plugin_info['type']) {
             ptln("<dt>" . $this->manager->getLang('type') . "</dt><dd>" . $this->out($this->plugin_info['type']) . "</dd>", 4);
         }
         if ($this->plugin_info['desc']) {
             ptln("<dt>" . $this->manager->getLang('desc') . "</dt><dd>" . $this->out($this->plugin_info['desc']) . "</dd>", 4);
         }
         if ($this->plugin_info['author']) {
             ptln("<dt>" . $this->manager->getLang('author') . "</dt><dd>" . $this->manager->email($this->plugin_info['email'], $this->plugin_info['author']) . "</dd>", 4);
         }
         if ($this->plugin_info['url']) {
             ptln("<dt>" . $this->manager->getLang('www') . "</dt><dd>" . $this->manager->external_link($this->plugin_info['url'], '', 'urlextern') . "</dd>", 4);
         }
         ptln("</dl>", 2);
         if (count($this->details) > 1) {
             ptln("<h3>" . $this->manager->getLang('components') . "</h3>", 2);
             ptln("<div>", 2);
             foreach ($this->details as $info) {
                 ptln("<dl>", 4);
                 ptln("<dt>" . $this->manager->getLang('name') . "</dt><dd>" . $this->out($info['name'] . ' ' . $info['compname']) . "</dd>", 6);
                 if (!$this->plugin_info['date']) {
                     ptln("<dt>" . $this->manager->getLang('date') . "</dt><dd>" . $this->out($info['date']) . "</dd>", 6);
                 }
                 if (!$this->plugin_info['type']) {
                     ptln("<dt>" . $this->manager->getLang('type') . "</dt><dd>" . $this->out($info['type']) . "</dd>", 6);
                 }
                 if (!$this->plugin_info['desc']) {
                     ptln("<dt>" . $this->manager->getLang('desc') . "</dt><dd>" . $this->out($info['desc']) . "</dd>", 6);
                 }
                 if (!$this->plugin_info['author']) {
                     ptln("<dt>" . $this->manager->getLang('author') . "</dt><dd>" . $this->manager->email($info['email'], $info['author']) . "</dd>", 6);
                 }
                 if (!$this->plugin_info['url']) {
                     ptln("<dt>" . $this->manager->getLang('www') . "</dt><dd>" . $this->manager->external_link($info['url'], '', 'urlextern') . "</dd>", 6);
                 }
                 ptln("</dl>", 4);
             }
             ptln("</div>", 2);
         }
     }
     ptln("</div>");
 }
Example #16
0
 /**
  *  Show a banner when viewing pages that are not published.
  *
  *  @author Jon Magne Bøe <*****@*****.**>
  */
 function show_banner(&$event, $param)
 {
     global $AUTH_ACL, $ID, $INFO;
     $autorizationList = $AUTH_ACL;
     $pageIdentification = $ID;
     $allUsers = auth_nameencode('@ALL', true);
     //all users
     $additional = 'DAFTDRAFTS';
     $autorizationList = $AUTH_ACL;
     if (empty($authorizationList)) {
         $authorizationList = file(DOKU_CONF . 'acl.auth.php');
     }
     $daftAuthorizationList = file(dirname(__FILE__) . '/daft.auth.php');
     $additional = '\\t#' . $additional;
     $acl_pattern_nocomment = '^' . preg_quote($pageIdentification, '/') . '\\s+.*\\s+[0-8].*$';
     //pattern for searching acl.auth.php
     $authorizationHits = preg_grep("/{$acl_pattern_nocomment}/", $authorizationList);
     $numberOfAuthorizations = count($authorizationHits);
     $daftHits = preg_grep("/{$acl_pattern_nocomment}/", $daftAuthorizationList);
     $numberOfDaftauthorizations = count($daftHits);
     //If both acl.auth.php and daft.auth.php contains restrictions of authorization, it's safe to assume it's not published.
     if ($numberOfAuthorizations != 0 && $numberOfDaftauthorizations != 0) {
         $published = false;
     } else {
         //Ideally the acl.auth.php and the daft.auth.php-files should be in sync, meaning we don't need to check anything else.
         $published = true;
     }
     $htmlcode = array();
     //This code runs if the page is unpublished, i.e. tagged as a draft and hidden from unregistered users.
     if (!$published && isset($INFO['userinfo'])) {
         $htmlcode[] = '<div class="unpublished">';
         $htmlcode[] = '<span class="draft">';
         $htmlcode[] = $this->getLang('unpublished');
         $htmlcode[] = '<br>';
         $htmlcode[] = $this->getLang('howtopublish') . ' ~~' . $this->getLang('code') . '~~';
         $htmlcode[] = '</span>';
         $htmlcode[] = '</div>';
         ptln(implode($htmlcode));
         return true;
     } else {
         return;
     }
 }
Example #17
0
 /**
  * Close the html form
  *
  * @author Samuele Tognini <*****@*****.**>
  */
 function _form_close($act)
 {
     ptln('      <input type="submit" name="btn" ' . $this->repos['status'][$n] . ' value="' . $this->getLang($act) . '" />');
     ptln('     </form>');
 }
Example #18
0
 /**
  * Display the indexmenu sort number.
  *
  * @author Samuele Tognini <*****@*****.**>
  */
 function _showsort(&$event, $param)
 {
     global $ID, $ACT;
     if ($ACT != 'show' || $this->_notadmin()) {
         return;
     }
     if ($n = p_get_metadata($ID, 'indexmenu_n')) {
         ptln('<div class="info">');
         ptln($this->getLang('showsort') . $n);
         ptln('</div>');
     }
 }
Example #19
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>');
     }
 }
Example #20
0
/**
 * List available Administration Tasks
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Håkan Sandell <*****@*****.**>
 */
function html_admin()
{
    global $ID;
    global $INFO;
    global $lang;
    global $conf;
    global $auth;
    // build menu of admin functions from the plugins that handle them
    $pluginlist = plugin_list('admin');
    $menu = array();
    foreach ($pluginlist as $p) {
        if (($obj =& plugin_load('admin', $p)) === null) {
            continue;
        }
        // check permissions
        if ($obj->forAdminOnly() && !$INFO['isadmin']) {
            continue;
        }
        $menu[$p] = array('plugin' => $p, 'prompt' => $obj->getMenuText($conf['lang']), 'sort' => $obj->getMenuSort());
    }
    // data security check
    // @todo: could be checked and only displayed if $conf['savedir'] is under the web root
    echo '<a style="border:none; float:right;"
            href="http://www.dokuwiki.org/security#web_access_security">
            <img src="data/security.png" alt="Your data directory seems to be protected properly."
             onerror="this.parentNode.style.display=\'none\'" /></a>';
    print p_locale_xhtml('admin');
    // Admin Tasks
    if ($INFO['isadmin']) {
        ptln('<ul class="admin_tasks">');
        if ($menu['usermanager'] && $auth && $auth->canDo('getUsers')) {
            ptln('  <li class="admin_usermanager"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'usermanager')) . '">' . $menu['usermanager']['prompt'] . '</a></div></li>');
        }
        unset($menu['usermanager']);
        if ($menu['acl']) {
            ptln('  <li class="admin_acl"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'acl')) . '">' . $menu['acl']['prompt'] . '</a></div></li>');
        }
        unset($menu['acl']);
        if ($menu['plugin']) {
            ptln('  <li class="admin_plugin"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'plugin')) . '">' . $menu['plugin']['prompt'] . '</a></div></li>');
        }
        unset($menu['plugin']);
        if ($menu['config']) {
            ptln('  <li class="admin_config"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'config')) . '">' . $menu['config']['prompt'] . '</a></div></li>');
        }
        unset($menu['config']);
    }
    ptln('</ul>');
    // Manager Tasks
    ptln('<ul class="admin_tasks">');
    if ($menu['revert']) {
        ptln('  <li class="admin_revert"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'revert')) . '">' . $menu['revert']['prompt'] . '</a></div></li>');
    }
    unset($menu['revert']);
    if ($menu['popularity']) {
        ptln('  <li class="admin_popularity"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'popularity')) . '">' . $menu['popularity']['prompt'] . '</a></div></li>');
    }
    unset($menu['popularity']);
    // print DokuWiki version:
    ptln('</ul>');
    echo '<div id="admin__version">';
    echo getVersion();
    echo '</div>';
    // print the rest as sorted list
    if (count($menu)) {
        usort($menu, 'p_sort_modes');
        // output the menu
        ptln('<div class="clearer"></div>');
        print p_locale_xhtml('adminplugins');
        ptln('<ul>');
        foreach ($menu as $item) {
            if (!$item['prompt']) {
                continue;
            }
            ptln('  <li><div class="li"><a href="' . wl($ID, 'do=admin&amp;page=' . $item['plugin']) . '">' . $item['prompt'] . '</a></div></li>');
        }
        ptln('</ul>');
    }
}
Example #21
0
/**
 * prints the namespace tree in the mediamanger popup
 *
 * Only allowed in mediamanager.php
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function tpl_mediaTree()
{
    global $NS;
    ptln('<div id="media__tree">');
    media_nstree($NS);
    ptln('</div>');
}
Example #22
0
/**
 * List available Administration Tasks
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Håkan Sandell <*****@*****.**>
 */
function html_admin()
{
    global $ID;
    global $INFO;
    global $conf;
    /** @var DokuWiki_Auth_Plugin $auth */
    global $auth;
    // build menu of admin functions from the plugins that handle them
    $pluginlist = plugin_list('admin');
    $menu = array();
    foreach ($pluginlist as $p) {
        /** @var DokuWiki_Admin_Plugin $obj */
        if (($obj = plugin_load('admin', $p)) === null) {
            continue;
        }
        // check permissions
        if ($obj->forAdminOnly() && !$INFO['isadmin']) {
            continue;
        }
        $menu[$p] = array('plugin' => $p, 'prompt' => $obj->getMenuText($conf['lang']), 'sort' => $obj->getMenuSort());
    }
    // data security check
    // simple check if the 'savedir' is relative and accessible when appended to DOKU_URL
    // it verifies either:
    //   'savedir' has been moved elsewhere, or
    //   has protection to prevent the webserver serving files from it
    if (substr($conf['savedir'], 0, 2) == './') {
        echo '<a style="border:none; float:right;"
                href="http://www.dokuwiki.org/security#web_access_security">
                <img src="' . DOKU_URL . $conf['savedir'] . '/security.png" alt="Your data directory seems to be protected properly."
                onerror="this.parentNode.style.display=\'none\'" /></a>';
    }
    print p_locale_xhtml('admin');
    // Admin Tasks
    if ($INFO['isadmin']) {
        ptln('<ul class="admin_tasks">');
        if ($menu['usermanager'] && $auth && $auth->canDo('getUsers')) {
            ptln('  <li class="admin_usermanager"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'usermanager')) . '">' . $menu['usermanager']['prompt'] . '</a></div></li>');
        }
        unset($menu['usermanager']);
        if ($menu['acl']) {
            ptln('  <li class="admin_acl"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'acl')) . '">' . $menu['acl']['prompt'] . '</a></div></li>');
        }
        unset($menu['acl']);
        if ($menu['extension']) {
            ptln('  <li class="admin_plugin"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'extension')) . '">' . $menu['extension']['prompt'] . '</a></div></li>');
        }
        unset($menu['extension']);
        if ($menu['config']) {
            ptln('  <li class="admin_config"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'config')) . '">' . $menu['config']['prompt'] . '</a></div></li>');
        }
        unset($menu['config']);
        if ($menu['styling']) {
            ptln('  <li class="admin_styling"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'styling')) . '">' . $menu['styling']['prompt'] . '</a></div></li>');
        }
        unset($menu['styling']);
    }
    ptln('</ul>');
    // Manager Tasks
    ptln('<ul class="admin_tasks">');
    if ($menu['revert']) {
        ptln('  <li class="admin_revert"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'revert')) . '">' . $menu['revert']['prompt'] . '</a></div></li>');
    }
    unset($menu['revert']);
    if ($menu['popularity']) {
        ptln('  <li class="admin_popularity"><div class="li">' . '<a href="' . wl($ID, array('do' => 'admin', 'page' => 'popularity')) . '">' . $menu['popularity']['prompt'] . '</a></div></li>');
    }
    unset($menu['popularity']);
    // print DokuWiki version:
    ptln('</ul>');
    echo '<div id="admin__version">';
    echo getVersion();
    echo '</div>';
    // print the rest as sorted list
    if (count($menu)) {
        // sort by name, then sort
        usort($menu, function ($a, $b) {
            $strcmp = strcasecmp($a['prompt'], $b['prompt']);
            if ($strcmp != 0) {
                return $strcmp;
            }
            if ($a['sort'] == $b['sort']) {
                return 0;
            }
            return $a['sort'] < $b['sort'] ? -1 : 1;
        });
        // output the menu
        ptln('<div class="clearer"></div>');
        print p_locale_xhtml('adminplugins');
        ptln('<ul>');
        foreach ($menu as $item) {
            if (!$item['prompt']) {
                continue;
            }
            ptln('  <li><div class="li"><a href="' . wl($ID, 'do=admin&amp;page=' . $item['plugin']) . '">' . $item['prompt'] . '</a></div></li>');
        }
        ptln('</ul>');
    }
}
Example #23
0
 function subfeed_options()
 {
     $dir = DOKU_INC . 'data/meta/newsfeed/';
     if ($this->subfeed_selected == 0 && isset($_REQUEST['subfeed_dir'])) {
         $sbname_check = $_REQUEST['subfeed_dir'];
     } else {
         $sbname_check = 'NotSet';
     }
     $index = 1;
     if ($dh = opendir($dir)) {
         while (($file = readdir($dh)) !== false) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if (is_dir($dir . $file)) {
                 if ($this->subfeed_selected == $index || $file == $sbname_check) {
                     ptln("<option value='{$file}' selected>{$file}</option>");
                 } else {
                     ptln("<option value='{$file}' >{$file}</option>");
                 }
                 $index++;
             }
         }
     }
     closedir($dh);
 }
Example #24
0
/**
 * prints the namespace tree in the mediamanger popup
 *
 * Only allowed in mediamanager.php
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function bootstrap_tpl_mediaTree()
{
    global $NS;
    ptln('<div id="media__tree" class="well well-sm">');
    bootstrap_media_nstree($NS);
    ptln('</div>');
}
Example #25
0
 /**
  * Render HTML output
  */
 public function html()
 {
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     ptln('<div id="extension__manager">');
     $this->gui->tabNavigation();
     switch ($this->gui->currentTab()) {
         case 'search':
             $this->gui->tabSearch();
             break;
         case 'templates':
             $this->gui->tabTemplates();
             break;
         case 'install':
             $this->gui->tabInstall();
             break;
         case 'plugins':
         default:
             $this->gui->tabPlugins();
     }
     ptln('</div>');
 }
Example #26
0
function html_admin()
{
    global $ID;
    global $INFO;
    global $lang;
    global $conf;
    print p_locale_xhtml('admin');
    // build menu of admin functions from the plugins that handle them
    $pluginlist = plugin_list('admin');
    $menu = array();
    foreach ($pluginlist as $p) {
        if (($obj =& plugin_load('admin', $p)) === NULL) {
            continue;
        }
        // check permissions
        if ($obj->forAdminOnly() && !$INFO['isadmin']) {
            continue;
        }
        $menu[] = array('plugin' => $p, 'prompt' => $obj->getMenuText($conf['lang']), 'sort' => $obj->getMenuSort());
    }
    usort($menu, 'p_sort_modes');
    // output the menu
    ptln('<ul>');
    foreach ($menu as $item) {
        if (!$item['prompt']) {
            continue;
        }
        ptln('  <li><div class="li"><a href="' . wl($ID, 'do=admin&amp;page=' . $item['plugin']) . '">' . $item['prompt'] . '</a></div></li>');
    }
    ptln('</ul>');
}
Example #27
0
 function _print_h1($id, $text)
 {
     ptln('<h1><a name="' . $id . '" id="' . $id . '">' . $text . '</a></h1>');
 }
Example #28
0
 function html_button($plugin, $btn, $disabled = false, $indent = 0)
 {
     $disabled = $disabled ? 'disabled="disabled"' : '';
     ptln('<input type="submit" class="button" ' . $disabled . ' name="fn[' . $btn . '][' . $plugin . ']" value="' . $this->lang['btn_' . $btn] . '" />', $indent);
 }
Example #29
0
 function _htmlFilterSettings($indent = 0)
 {
     ptln("<input type=\"hidden\" name=\"start\" value=\"" . $this->_start . "\" />", $indent);
     foreach ($this->_filter as $key => $filter) {
         ptln("<input type=\"hidden\" name=\"filter[" . $key . "]\" value=\"" . hsc($filter) . "\" />", $indent);
     }
 }
Example #30
0
 /**
  * Print import form and summary of previous import
  *
  * @param int $indent
  */
 protected function _htmlImportForm($indent = 0)
 {
     global $ID;
     $failure_download_link = wl($ID, array('do' => 'admin', 'page' => 'usermanager', 'fn[importfails]' => 1));
     ptln('<div class="level2 import_users">', $indent);
     print $this->locale_xhtml('import');
     ptln('  <form action="' . wl($ID) . '" method="post" enctype="multipart/form-data">', $indent);
     formSecurityToken();
     ptln('    <label>' . $this->lang['import_userlistcsv'] . '<input type="file" name="import" /></label>', $indent);
     ptln('    <input type="submit" name="fn[import]" value="' . $this->lang['import'] . '" />', $indent);
     ptln('    <input type="hidden" name="do"    value="admin" />', $indent);
     ptln('    <input type="hidden" name="page"  value="usermanager" />', $indent);
     $this->_htmlFilterSettings($indent + 4);
     ptln('  </form>', $indent);
     ptln('</div>');
     // list failures from the previous import
     if ($this->_import_failures) {
         $digits = strlen(count($this->_import_failures));
         ptln('<div class="level3 import_failures">', $indent);
         ptln('  <h3>' . $this->lang['import_header'] . '</h3>');
         ptln('  <table class="import_failures">', $indent);
         ptln('    <thead>', $indent);
         ptln('      <tr>', $indent);
         ptln('        <th class="line">' . $this->lang['line'] . '</th>', $indent);
         ptln('        <th class="error">' . $this->lang['error'] . '</th>', $indent);
         ptln('        <th class="userid">' . $this->lang['user_id'] . '</th>', $indent);
         ptln('        <th class="username">' . $this->lang['user_name'] . '</th>', $indent);
         ptln('        <th class="usermail">' . $this->lang['user_mail'] . '</th>', $indent);
         ptln('        <th class="usergroups">' . $this->lang['user_groups'] . '</th>', $indent);
         ptln('      </tr>', $indent);
         ptln('    </thead>', $indent);
         ptln('    <tbody>', $indent);
         foreach ($this->_import_failures as $line => $failure) {
             ptln('      <tr>', $indent);
             ptln('        <td class="lineno"> ' . sprintf('%0' . $digits . 'd', $line) . ' </td>', $indent);
             ptln('        <td class="error">' . $failure['error'] . ' </td>', $indent);
             ptln('        <td class="field userid"> ' . hsc($failure['user'][0]) . ' </td>', $indent);
             ptln('        <td class="field username"> ' . hsc($failure['user'][2]) . ' </td>', $indent);
             ptln('        <td class="field usermail"> ' . hsc($failure['user'][3]) . ' </td>', $indent);
             ptln('        <td class="field usergroups"> ' . hsc($failure['user'][4]) . ' </td>', $indent);
             ptln('      </tr>', $indent);
         }
         ptln('    </tbody>', $indent);
         ptln('  </table>', $indent);
         ptln('  <p><a href="' . $failure_download_link . '">' . $this->lang['import_downloadfailures'] . '</a></p>');
         ptln('</div>');
     }
 }