function html() { ptln($this->locale_xhtml('admin_header')); $cache = $this->cache; $current_books = $this->cache['current_books']; unset($cache['current_books']); //ptln('<form action="'.wl($ID).'" method="post" onsubmit="return epub_admin_confirm(this);" id="epub_admin" name="epub_admin">' ); ptln('<form action="' . wl($ID) . '" method="post" id="epub_admin" name="epub_admin">'); echo "<ul>\n"; foreach ($cache as $md5 => $id) { $id = trim($id); if (!$id) { $id = '<undefined>'; } ptln('<li style="list-style-type:none; color: #333;"><input name="book_id[' . $md5 . ']" type="checkbox" value="' . $id . '"> ' . $id); ptln(' <ul><li style="color:#333">' . $current_books[$md5]['title'] . "\n" . ' <li style="color:#333">' . $current_books[$md5]['epub']); ptln(" <!--input type = 'hidden' name='{$md5}' value='" . $current_books[$md5]['epub'] . "'/ -->\n </ul>"); } echo " </ul>\n"; ptln(' <input type="hidden" name="do" value="admin" />'); ptln(' <input type="hidden" name="page" value="' . $this->getPluginName() . '" />'); formSecurityToken(); ptln(' <input type="submit" name="cmd[cache]" onclick="return epub_admin_confirm(\'cache\');" id="epub_cache_btn" value="' . $this->getLang('btn_submit') . '" />'); ptln(' <input type="submit" onclick="return epub_admin_confirm(\'media\');" name="cmd[media]" id="epub_media_btn" value="' . $this->getLang('btn_del') . '" />'); ptln('</form>'); if ($this->dbg) { echo $this->req . "<br />"; } if ($this->results) { ptln('<p><br />' . $this->results . '</p>'); } }
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>'; }
/** * form for slack invite * * */ function slackinvite_signinform() { global $ID; $html = ''; $params = array(); $params['id'] = 'slackinvite_plugin_id'; $params['action'] = wl($ID); $params['method'] = 'post'; $params['enctype'] = 'multipart/form-data'; $params['class'] = 'slackinvite_plugin'; // Modification of the default dw HTML upload form $form = new Doku_Form($params); $form->startFieldset($this->getLang('signup')); $form->addHidden('source', hsc("slackinvite")); //add source of call, used in action to ignore anything not from this form $form->addElement(form_makeTextField('first_name', '', $this->getLang('first_name'), 'first__name')); $form->addElement(form_makeTextField('last_name', '', $this->getLang('last_name'), 'last__name')); $form->addElement(form_makeTextField('email', '', $this->getLang('email'), 'email')); $form->addElement(form_makeButton('submit', 'slacksignup', $this->getLang('btn_signup'))); $form->endFieldset(); $html .= '<div class="dokuwiki"><p>' . NL; //$html .= '<h3>TEAM43 Slack Sign Up</h3>'; $html .= $form->getForm(); $html .= '</p></div>' . NL; return $html; }
public function render($mode, Doku_Renderer &$renderer, $data) { // $data is what the function handle return'ed. global $ID; if ($mode == 'xhtml') { /** @var Do ku_Renderer_xhtml $renderer */ list($state, $param) = $data; switch ($param['class']) { case "post": $renderer->doc .= $this->helper->facebook->CreatePost($param['href'], $param['width']); break; case "send": $href = $param['href'] == '' ? wl($ID, null, true) : wl($param['href']); $renderer->doc .= $this->helper->facebook->CreateSend($href); break; case "like": $href = $param['href'] == '' ? wl($ID, null, true) : wl($param['href']); $renderer->doc .= $this->helper->facebook->CreateLike($href); break; case "share": $href = $param['href'] == '' ? wl($ID, null, true) : wl($param['href']); $renderer->doc .= $this->helper->facebook->CreateShare($href); break; case "page": // $renderer->doc.= $this->helper->facebook->{'Create'.$param['class']}($param['href'],$param['width']); msg('not implement'); break; default: msg('No match'); } } return false; }
function action_randompage(&$event, $args) { global $conf; global $ID; $data = array(); $dir = $conf['savedir']; $data = file($dir . '/index/page.idx'); //We loops through ten random page... $i = 1; while ($i <= 10 & $i != "ok") { //echo $i; $i++; $id = rtrim($data[array_rand($data, 1)]); $testACL = auth_aclcheck($id, $_SERVER['REMOTE_USER'], $USERINFO['grps']); if ($testACL > 1 and file_exists(wikiFN($id))) { $i = "ok"; //echo $id; } } if ($testACL < 1) { $id = $ID; } header("Location: " . wl($id, '', true)); //echo wl($page,'',true); exit; }
/** * Handler for the TPL_ACT_RENDER event */ function handle_act_render(&$event, $params) { global $ID; // Action not 'show'? Quit if ($event->data != 'show') { return; } // Trackbacks disabled? Quit if (!$this->getConf('enable_trackback')) { return; } // Get linkback metadata $file = metaFN($ID, '.linkbacks'); $data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0); if (@file_exists($file)) { $data = unserialize(io_readFile($file, false)); } // Does not accept linkbacks? Quit if (!$data['receive']) { return; } // if trackbacks are enabled, insert RDF definition of trackback into output if ($this->getConf('enable_trackback')) { echo '<!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . NL . 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . NL . 'xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">' . NL . '<rdf:Description' . NL . 'rdf:about="' . wl($ID, '', true) . '"' . NL . 'dc:identifier="' . wl($ID, '', true) . '"' . NL . 'dc:title="' . tpl_pagetitle($ID, true) . '"' . NL . 'trackback:ping="' . DOKU_URL . 'lib/plugins/linkback/exe/trackback.php/' . $ID . '" />' . NL . '</rdf:RDF>-->'; } }
protected function getHtml($id, $data) { global $ID; $delUrl = wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'delete' => $id)); $ignoreUrl = wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'ignore' => $id)); $title = '<strong class="title">' . $data['count'] . ' <code>' . $id . '</code></strong> ' . ' <a href="' . wl($id) . '">[Go to page]</a>' . ' <a href="' . $delUrl . '">[Delete ' . $data['count'] . ' log entries]</a>' . ' <a href="' . $ignoreUrl . '">[Add to <em>ignore list</em>]</a>' . '</span>'; $out = $title . '<ol>'; foreach ($data['hits'] as $hit) { $line = $hit['date']; if (!empty($hit['ip'])) { $line .= ' <em>IP:</em> ' . $hit['ip']; } if (!empty($hit['referer'])) { $line .= ' <em>Referer:</em> <a href="' . $hit['referer'] . '">' . $hit['referer'] . '</a>'; } if (!empty($hit['user_agent'])) { $line .= ' <em>User Agent:</em> ' . $hit['user_agent']; } // The line should never actually be empty, but still... if (!empty($line)) { $out .= "<li>{$line}</li>"; } } $out .= '</ol>'; return "<li>{$out}</li>"; }
function siteexport_add_page_export(&$event) { global $ID; if ($this->getConf('allowallusers') || auth_isadmin() || auth_ismanager()) { $event->data['items'][] = '<li>' . tpl_link(wl($ID, array('do' => 'siteexport_addpage')), '<span>Export Page</span>', 'class="action siteexport_addpage" title="Add page"', 1) . '</li>'; } }
/** * handle event */ function handle_start(&$event, $param) { global $ID; global $ACT; if ($ACT != 'show') { return; } $redirects = confToHash($this->getsavedir() . '/shorturl.conf'); if ($redirects[$ID]) { if (preg_match('/^https?:\\/\\//', $redirects[$ID])) { send_redirect($redirects[$ID]); } else { if ($this->getConf('showmsg')) { msg(sprintf($this->getLang('redirected'), hsc($ID))); } send_redirect(wl($redirects[$ID], '', true)); } exit; } else { if ($_GET['generateShortURL'] != "" && auth_quickaclcheck($ID) >= AUTH_READ) { $shorturl =& plugin_load('helper', 'shorturl'); if ($shorturl) { $shortID = $shorturl->autoGenerateShortUrl($ID); } } } }
/** * Handles input from the newform and redirects to the edit mode * * @author Andreas Gohr <*****@*****.**> * @author Gina Haeussge <*****@*****.**> */ function handle_act_preprocess(&$event, $param) { global $TEXT; global $ID; if ($event->data != 'btngnew') { return true; } $tools =& plugin_load('helper', 'blogtng_tools'); if (!$tools->getParam('new/title')) { msg($this->getLang('err_notitle'), -1); $event->data = 'show'; return true; } $event->preventDefault(); $new = $tools->mkpostid($tools->getParam('new/format'), $tools->getParam('new/title')); if ($ID != $new) { send_redirect(wl($new, array('do' => 'btngnew', 'btng[post][blog]' => $tools->getParam('post/blog'), 'btng[new][format]' => $tools->getParam('new/format'), 'btng[new][title]' => $tools->getParam('new/title')), true, '&')); return false; //never reached } else { $TEXT = $this->_prepare_template($new, $tools->getParam('new/title')); $event->data = 'preview'; return false; } }
/** * Renders a permalink header. * * Code heavily copied from the header renderer from inc/parser/xhtml.php, just * added an href parameter to the anchor tag linking to the wikilink. */ function render($mode, &$renderer, $data) { list($headline, $lvl, $page, $sect, $flags) = $data; $hid = $renderer->_headerToLink($headline); if ($mode == 'xhtml') { $renderer->toc_additem($hid, $headline, $lvl); $url = $sect ? wl($page) . '#' . $sect : wl($page); $renderer->doc .= DOKU_LF . '<h' . $lvl; if ($flags['taglogos']) { $tag = $this->_get_firsttag($page); if ($tag) { $renderer->doc .= ' class="include_firsttag__' . $tag . '"'; } } $headline = $renderer->_xmlEntities($headline); $renderer->doc .= '><a name="' . $hid . '" id="' . $hid . '" href="' . $url . '" title="' . $headline . '">'; $renderer->doc .= $headline; $renderer->doc .= '</a></h' . $lvl . '>' . DOKU_LF; return true; } elseif ($mode == 'metadata') { $renderer->toc_additem($hid, $headline, $lvl); return true; } return false; }
/** * Builds a select box with all available templates * (unless excluded in 'excludeTemplates') * or show only two templates for mobile switcher: standard plus mobile template * * @author Anika Henke <*****@*****.**> */ public function showTemplateSwitcher() { global $conf; global $ID; global $ACT; if ($ACT != 'show') { return; } $mobileSwitch = $this->getConf('mobileSwitch'); $mobileTpl = $this->getConf('mobileTemplate'); if ($mobileSwitch && $mobileTpl) { // templates for mobile switcher $templates = array($mobileTpl => $this->getLang('switchMobile'), $this->origTpl => $this->getLang('switchFull')); } else { // all templates (minus excluded templates) $excludeTemplates = array_map('trim', explode(",", $this->getConf('excludeTemplates'))); $templates = array_diff($this->getTemplates(), $excludeTemplates); } $form = new Doku_Form(array('id' => 'tpl__switcher', 'title' => $this->getLang('switchTpl'), 'action' => wl($ID))); $form->addHidden('act', 'select'); $form->addElement(form_makeListboxField('tpl', $templates, $conf['template'], $this->getLang('template'), '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', '', $this->getLang('switch'), array('name' => 'switch'))); $out = '<div class="plugin_loadskin">'; $out .= $form->getForm(); $out .= '</div>'; return $out; }
function white_breadcrumbs() { global $lang; global $conf; //check if enabled if (!$conf['breadcrumbs']) { return false; } $crumbs = breadcrumbs(); //setup crumb trace $crumbs_sep = ' <span class="bcsep">' . $sep . '</span> '; //render crumbs, highlight the last one print '<h3>' . $lang['breadcrumb'] . '</h3>'; $last = count($crumbs); $i = 0; print '<ul>'; foreach ($crumbs as $id => $name) { $i++; print '<li>'; if ($i == $last) { print '<span class="curid">'; } tpl_link(wl($id), hsc($name), 'class="breadcrumbs" title="' . $id . '"'); if ($i == $last) { print '</span>'; } print '</li>'; } print '</ul>'; return true; }
function handle_start(&$event, $param) { global $ID; global $ACT; global $INFO; if ($ACT != 'show') { return; } if (!$INFO['exists']) { return; } # don't try to read an article that doesn't exist $all = rtrim(rawWiki($ID)); $inner = substr($all, 2, -2); if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) { if (!strpos($inner, '://') === false) { $url = $inner; # link is URL already } else { msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>')); $url = html_wikilink($inner, $name = null, $search = ''); $url = substr($url, strpos($url, '"') + 1); $url = substr($url, 0, strpos($url, '"')); } idx_addPage($ID); # ensure fulltext search indexing of referrer article - to put it on the backlink page of target article send_redirect($url); } }
function get_data($url, $form_properties) { /* IF CURL_EXEC RETURNS NOTHING and no errors are being generated, check the selinux configuration or disable selinux completely.*/ $timeout = 5; wl("in get data"); wl("url:" . $url); if ($form_properties == "") { $ch = curl_init(); wl("no form properties"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); } else { define('POSTURL', $url); define('POSTVARS', $form_properties); wl("with form properties"); //sample url and form properties //define('POSTURL', 'http://data.bls.gov/cgi-bin/surveymost'); //define('POSTVARS', 'series_id=LNS14000000&survey=ln&format=&html_tables=&delimiter=&catalog=&print_line_length=&lines_per_page=&row_stub_key=&year=&date=&net_change_start=&net_change_end=&percent_change_start=&percent_change_end='); $ch = curl_init(POSTURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, POSTVARS); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); } wl("Still here"); curl_error($ch); $data = curl_exec($ch); wl("still in get_data"); curl_close($ch); wl(strlen($data)); echo "<BR>Length of data returned from url: " . strlen($data) . "<BR>"; return $data; }
/** * Rename a single page */ public function handle_ajax(Doku_Event $event) { if ($event->data != 'plugin_move_rename') { return; } $event->preventDefault(); $event->stopPropagation(); global $MSG; global $INPUT; $src = cleanID($INPUT->str('id')); $dst = cleanID($INPUT->str('newid')); /** @var helper_plugin_move_op $MoveOperator */ $MoveOperator = plugin_load('helper', 'move_op'); $JSON = new JSON(); header('Content-Type: application/json'); if ($this->renameOkay($src) && $MoveOperator->movePage($src, $dst)) { // all went well, redirect echo $JSON->encode(array('redirect_url' => wl($dst, '', true, '&'))); } else { if (isset($MSG[0])) { $error = $MSG[0]; // first error } else { $error = $this->getLang('cantrename'); } echo $JSON->encode(array('error' => $error)); } }
/** * Creates a new, empty form with some default attributes * * @param array $attributes */ public function __construct($attributes = array()) { global $ID; parent::__construct('form', $attributes); // use the current URL as default action if (!$this->attr('action')) { $get = $_GET; if (isset($get['id'])) { unset($get['id']); } $self = wl($ID, $get, false, '&'); //attributes are escaped later $this->attr('action', $self); } // post is default if (!$this->attr('method')) { $this->attr('method', 'post'); } // we like UTF-8 if (!$this->attr('accept-charset')) { $this->attr('accept-charset', 'utf-8'); } // add the security token by default $this->setHiddenField('sectok', getSecurityToken()); // identify this as a new form based form in HTML $this->addClass('doku_form'); }
/** * Print the search form * * If the first parameter is given a div with the ID 'qsearch_out' will * be added which instructs the ajax pagequicksearch to kick in and place * its output into this div. The second parameter controls the propritary * attribute autocomplete. If set to false this attribute will be set with an * value of "off" to instruct the browser to disable it's own built in * autocompletion feature (MSIE and Firefox) * */ function amdy_tpl_searchform($ajax = true, $autocomplete = true) { global $lang; global $ACT; global $QUERY; // don't print the search form if search action has been disabled if (!actionOk('search')) { return false; } print '<form action="' . wl() . '" accept-charset="utf-8" class="search" id="dw__search" method="get"><div class="no">'; print '<input type="hidden" name="do" value="search" />'; print '<input type="text" '; if ($ACT == 'search') { print 'value="' . htmlspecialchars($QUERY) . '" '; } if (!$autocomplete) { print 'autocomplete="off" '; } print 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" />'; print '<input type="submit" value="' . $lang['btn_search'] . '" class="button" title="' . $lang['btn_search'] . '" />'; if ($ajax) { print '<div id="qsearch__out" class="ajax_qsearch JSpopup"></div>'; } print '</div></form>'; return true; }
/** * Fetch the an ID from request * * Uses either standard $_REQUEST variable or extracts it from * the full request URI when userewrite is set to 2 * * For $param='id' $conf['start'] is returned if no id was found. * If the second parameter is true (default) the ID is cleaned. * * @author Andreas Gohr <*****@*****.**> */ function getID($param = 'id', $clean = true) { global $INPUT; global $conf; $id = $INPUT->str($param); //construct page id from request URI if (empty($id) && $conf['userewrite'] == 2) { $request = $_SERVER['REQUEST_URI']; $script = ''; //get the script URL if ($conf['basedir']) { $relpath = ''; if ($param != 'id') { $relpath = 'lib/exe/'; } $script = $conf['basedir'] . $relpath . utf8_basename($_SERVER['SCRIPT_FILENAME']); } elseif ($_SERVER['PATH_INFO']) { $request = $_SERVER['PATH_INFO']; } elseif ($_SERVER['SCRIPT_NAME']) { $script = $_SERVER['SCRIPT_NAME']; } elseif ($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']) { $script = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/', '', $_SERVER['SCRIPT_FILENAME']); $script = '/' . $script; } //clean script and request (fixes a windows problem) $script = preg_replace('/\\/\\/+/', '/', $script); $request = preg_replace('/\\/\\/+/', '/', $request); //remove script URL and Querystring to gain the id if (preg_match('/^' . preg_quote($script, '/') . '(.*)/', $request, $match)) { $id = preg_replace('/\\?.*/', '', $match[1]); } $id = urldecode($id); //strip leading slashes $id = preg_replace('!^/+!', '', $id); } // Namespace autolinking from URL if (substr($id, -1) == ':' || $conf['useslash'] && substr($id, -1) == '/') { if (page_exists($id . $conf['start'])) { // start page inside namespace $id = $id . $conf['start']; } elseif (page_exists($id . noNS(cleanID($id)))) { // page named like the NS inside the NS $id = $id . noNS(cleanID($id)); } elseif (page_exists($id)) { // page like namespace exists $id = substr($id, 0, -1); } else { // fall back to default $id = $id . $conf['start']; } send_redirect(wl($id, '', true)); } if ($clean) { $id = cleanID($id); } if (empty($id) && $param == 'id') { $id = $conf['start']; } return $id; }
function render($mode, &$renderer, $data) { global $lang; if ($mode == 'xhtml') { $renderer->doc .= '<div id="searchform_plugin">' . "\n"; $renderer->doc .= '<form action="' . wl() . '" accept-charset="utf-8" class="search" id="dw__search"><div class="no">' . "\n"; $renderer->doc .= '<input type="hidden" name="do" value="search" />' . "\n"; $renderer->doc .= '<input type="text" '; if ($ACT == 'search') { $renderer->doc .= 'value="' . htmlspecialchars($_REQUEST['id']) . '" '; } if (!$autocomplete) { $renderer->doc .= 'autocomplete="off" '; } $renderer->doc .= 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[ALT+F]" />' . "\n"; $renderer->doc .= '<input type="submit" value="' . $lang['btn_search'] . '" class="button" title="' . $lang['btn_search'] . '" />' . "\n"; if ($ajax) { $renderer->doc .= '<div id="qsearch__out" class="ajax_qsearch JSpopup"></div>' . "\n"; } $renderer->doc .= '</div></form>' . "\n"; $renderer->doc .= '</div>' . "\n"; return true; } return false; }
/** * Renders a permalink header. * * Code heavily copied from the header renderer from inc/parser/xhtml.php, just * added an href parameter to the anchor tag linking to the wikilink. */ function render($mode, Doku_Renderer $renderer, $data) { global $conf; list($headline, $lvl, $pos, $page, $sect, $flags) = $data; if ($mode == 'xhtml') { /** @var Doku_Renderer_xhtml $renderer */ $hid = $renderer->_headerToLink($headline, true); $renderer->toc_additem($hid, $headline, $lvl); $url = $sect ? wl($page) . '#' . $sect : wl($page); $renderer->doc .= DOKU_LF . '<h' . $lvl; $classes = array(); if ($flags['taglogos']) { $tag = $this->_get_firsttag($page); if ($tag) { $classes[] = 'include_firsttag__' . $tag; } } // the include header instruction is always at the beginning of the first section edit inside the include // wrap so there is no need to close a previous section edit. if ($lvl <= $conf['maxseclevel']) { $classes[] = $renderer->startSectionEdit($pos, 'section', $headline); } if ($classes) { $renderer->doc .= ' class="' . implode(' ', $classes) . '"'; } $headline = $renderer->_xmlEntities($headline); $renderer->doc .= ' id="' . $hid . '"><a href="' . $url . '" title="' . $headline . '">'; $renderer->doc .= $headline; $renderer->doc .= '</a></h' . $lvl . '>' . DOKU_LF; return true; } else { $renderer->header($headline, $lvl, $pos); } return false; }
function addApproval() { global $USERINFO; global $ID; global $INFO; if (!$INFO['exists']) { msg($this->getLang('cannot approve a non-existing revision'), -1); return; } $approvalRevision = $this->helper->getRevision(); $approvals = $this->helper->getApprovals(); if (!isset($approvals[$approvalRevision])) { $approvals[$approvalRevision] = array(); } $approvals[$approvalRevision][$INFO['client']] = array($INFO['client'], $_SERVER['REMOTE_USER'], $USERINFO['mail'], time()); $success = p_set_metadata($ID, array('approval' => $approvals), true, true); if ($success) { msg($this->getLang('version approved'), 1); $data = array(); $data['rev'] = $approvalRevision; $data['id'] = $ID; $data['approver'] = $_SERVER['REMOTE_USER']; $data['approver_info'] = $USERINFO; if ($this->getConf('send_mail_on_approve') && $this->helper->isRevisionApproved($approvalRevision)) { /** @var action_plugin_publish_mail $mail */ $mail = plugin_load('action', 'publish_mail'); $mail->send_approve_mail(); } trigger_event('PLUGIN_PUBLISH_APPROVE', $data); } else { msg($this->getLang('cannot approve error'), -1); } send_redirect(wl($ID, array('rev' => $this->helper->getRevision()), true, '&')); }
/** * Display the rating tool in a template * * @param bool $inner used for AJAX updates */ public function tpl($inner = false) { global $ID; $sqlite = $this->getDBHelper(); if (!$sqlite) { return; } $sql = "SELECT sum(value) FROM ratings WHERE page = ?"; $res = $sqlite->query($sql, $ID); $current = (int) $sqlite->res2single($res); $sqlite->res_close($res); $sql = "SELECT value FROM ratings WHERE page = ? AND rater = ?"; $res = $sqlite->query($sql, $ID, $this->userID()); $self = (int) $sqlite->res2single($res); $sqlite->res_close($res); if (!$inner) { echo '<div class="plugin_rating">'; } echo '<span class="intro">' . $this->getLang('intro') . '</span>'; $class = $self == -1 ? 'act' : ''; echo '<a href="' . wl($ID, array('rating' => -1)) . '" class="plugin_rating_down ' . $class . ' plugin_feedback" data-rating="-1">-1</a>'; echo '<span class="current">' . $current . '</span>'; $class = $self == 1 ? 'act' : ''; echo '<a href="' . wl($ID, array('rating' => +1)) . '" class="plugin_rating_up ' . $class . '" data-rating="1">+1</a>'; if (!$inner) { echo '</div>'; } }
/** * 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>'); }
function handle_login_form(&$event, $param) { global $auth; global $conf; global $lang; global $ID; if ($conf['authtype'] == 'authplaincas') { if ($this->getConf('logourl') != '') { $caslogo = '<img src="' . $this->getConf('logourl') . '" alt="" style="vertical-align: middle;" /> '; } else { $caslogo = ''; } //var_dump($event->data->_content); $event->data->_content = array(); // remove the login form $event->data->insertElement(0, '<fieldset><legend>' . $this->getConf('name') . '</legend>'); $event->data->insertElement(1, '<p style="text-align: center;">' . $caslogo . '<a href="' . $this->_selfdo('caslogin') . '">Login</a></p>'); $event->data->insertElement(2, '</fieldset>'); //instead of removing, one could implement a local login here... // if ($this->getConf('jshidelocal')) { // $event->data->insertElement(3,'<p id="normalLoginToggle" style="display: none; text-align: center;"><a href="#" onClick="javascript:document.getElementById(\'normalLogin\').style.display = \'block\'; document.getElementById(\'normalLoginToggle\').style.display = \'none\'; return false;">Show '.$this->getConf('localname').'</a></p><p style="text-align: center;">Only use this if you cannot use the '.$this->getConf('name').' above.</p>'); // $event->data->replaceElement(4,'<fieldset id="normalLogin" style="display: block;"><legend>'.$this->getConf('localname').'</legend><script type="text/javascript">document.getElementById(\'normalLoginToggle\').style.display = \'block\'; document.getElementById(\'normalLogin\').style.display = \'none\';</script>'); // } else { // $event->data->replaceElement(3,'<fieldset><legend>'.$this->getConf('localname').'</legend>'); // } $insertElement = 3; if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) { $event->data->insertElement($insertElement, '<p>' . $lang['pwdforget'] . ': <a href="' . wl($ID, 'do=resendpwd') . '" rel="nofollow" class="wikilink1">' . $lang['btn_resendpwd'] . '</a></p>'); } } }
/** * Print the search form * * If the first parameter is given a div with the ID 'qsearch_out' will * be added which instructs the ajax pagequicksearch to kick in and place * its output into this div. The second parameter controls the propritary * attribute autocomplete. If set to false this attribute will be set with an * value of "off" to instruct the browser to disable it's own built in * autocompletion feature (MSIE and Firefox) * * @author Andreas Gohr <*****@*****.**> * @param bool $ajax * @param bool $autocomplete * @return bool */ function _tpl_searchform($ajax = true, $autocomplete = true) { global $lang; global $ACT; global $QUERY; // don't print the search form if search action has been disabled if (!actionOK('search')) { return false; } print '<form action="' . wl() . '" accept-charset="utf-8" class="navbar-form navbar-right" id="dw__search" method="get" role="search">'; print '<input type="hidden" name="do" value="search" />'; print '<div class="form-group">'; print '<input type="text" '; if ($ACT == 'search') { print 'value="' . htmlspecialchars($QUERY) . '" '; } print ' autocomplete="off" '; print 'id="qsearch__in" accesskey="f" name="id" class="form-control col-lg-3" title="[F]" placeholder="' . $lang['btn_search'] . '" /> '; print '</div>'; if ($ajax) { print '<div id="qsearch__out" class="ajax_qsearch"></div>'; } print '</form>'; return true; }
public function handle_loginform(&$event, $param) { global $conf; if ($conf['authtype'] != 'adfs') { return; } $event->data = new Doku_Form(array()); $event->data->addElement('<a href="' . wl('', array('do' => 'login')) . '">Login here</a>'); }
/** * used for move and delete buttons. not a generic function! * * NOTE: cannot extend tpl_action() because $unknown variable cannot be set, always true. so this method was created * * @param unknown $do * @param unknown $title * @param unknown $accesskey */ protected static function my_current_link_tpl($params = [], $type, $title, $accesskey, $action) { $pageId = $GLOBALS['INFO']['id']; if (empty($pageId) || !file_exists(wikiFN($pageId)) || auth_quickaclcheck($id) < AUTH_DELETE) { return false; } $link = wl($pageId, $params); return "<li><a href=\"{$link}\" class=\"action {$type}\" yk-page-id=\"{$pageId}\" yk-action=\"{$action}\" accesskey=\"{$accesskey}\" rel=\"nofollow\" title=\"{$title}\"><span>{$title}</span></a></li>"; }
/** * Add 'new page'-button to pagetools * * @param Doku_Event $event */ public function addbutton(Doku_Event $event) { global $ID, $INFO; $can_create = $INFO['perm']; if ($this->getConf('addpage_path') != '' && $can_create >= AUTH_CREATE && $event->data['view'] == 'main') { $params = array('id' => $this->getConf('addpage_path')); // insert button at position before last (up to top) $event->data['items'] = array_slice($event->data['items'], 0, -1, true) + array('addpage_path' => '<li>' . '<a href="' . wl($ID, $params) . '" class="action addnewpage" rel="nofollow" title="' . $this->getLang('okbutton') . '">' . '<span>' . $this->getLang('okbutton') . '</span>' . '</a>' . '</li>') + array_slice($event->data['items'], -1, 1, true); } }
/** * Add 'export odt'-button to pagetools * * @param Doku_Event $event */ public function addbutton(Doku_Event $event) { global $ID, $REV; if ($this->getConf('showexportbutton') && $event->data['view'] == 'main') { $params = array('do' => 'export_odt'); if ($REV) { $params['rev'] = $REV; } // insert button at position before last (up to top) $event->data['items'] = array_slice($event->data['items'], 0, -1, true) + array('export_odt' => '<li>' . '<a href="' . wl($ID, $params) . '" class="action export_odt" rel="nofollow" title="' . $this->getLang('export_odt_button') . '">' . '<span>' . $this->getLang('export_odt_button') . '</span>' . '</a>' . '</li>') + array_slice($event->data['items'], -1, 1, true); } }