function handle($match, $state, $pos, &$handler) { global $ID; $match = substr($match, 7, -2); // strip {{blog> from start and }} from end list($match, $flags) = explode('&', $match, 2); $flags = explode('&', $flags); $flags[] = 'link'; // always make the first header of a blog entry a permalink list($match, $refine) = explode(' ', $match, 2); list($ns, $num) = explode('?', $match, 2); if (!is_numeric($num)) { if (is_numeric($ns)) { $num = $ns; $ns = ''; } else { $num = 5; } } if ($ns == '') { $ns = cleanID($this->getConf('namespace')); } elseif ($ns == '*' || $ns == ':') { $ns = ''; } elseif ($ns == '.') { $ns = getNS($ID); } else { $ns = cleanID($ns); } return array($ns, $num, $flags, $refine); }
function handle($match, $state, $pos, &$handler) { global $INFO; $match = substr($match, 4, -6); //default options $opt = array('hdr_rows' => 1, 'hdr_cols' => 0, 'span_empty_cols' => 0, 'file' => '', 'delim' => ',', 'content' => ''); list($optstr, $opt['content']) = explode('>', $match, 2); unset($match); // parse options $optsin = explode(' ', $optstr); foreach ($optsin as $o) { $o = trim($o); if (preg_match("/(\\w+)=(.*)/", $o, $matches)) { $opt[$matches[1]] = $matches[2]; } elseif ($o) { if (preg_match('/^https?:\\/\\//i', $o)) { $opt['file'] = $o; } else { $opt['file'] = cleanID($o); if (!strlen(getNS($opt['file']))) { $opt['file'] = $INFO['namespace'] . ':' . $opt['file']; } } } } if ($opt['delim'] == 'tab') { $opt['delim'] = "\t"; } return $opt; }
function _handle_tpl_act(&$event, $param) { if ($event->data != 'editx') { return; } $event->preventDefault(); switch ($_REQUEST['work']) { case 'rename': $opts['oldpage'] = cleanID($_REQUEST['oldpage']); $opts['newpage'] = cleanID($_REQUEST['newpage']); $opts['summary'] = $_REQUEST['summary']; $opts['nr'] = $_REQUEST['rp_nr']; $this->_rename_page($opts); break; case 'delete': $opts['oldpage'] = cleanID($_REQUEST['oldpage']); $opts['summary'] = $_REQUEST['summary']; $opts['purge'] = $_REQUEST['dp_purge']; $this->_delete_page($opts); break; default: $this->_print_form(); break; } }
/** * Handle the match */ function handle($match, $state, $pos, &$handler) { global $ID; $match = substr($match, 9, -11); // strip markup list($flags, $match) = explode('>', $match, 2); $flags = explode('&', substr($flags, 1)); $items = explode('*', $match); $pages = array(); $c = count($items); for ($i = 0; $i < $c; $i++) { if (!preg_match('/\\[\\[(.+?)\\]\\]/', $items[$i], $match)) { continue; } list($id, $title, $description) = explode('|', $match[1], 3); list($id, $section) = explode('#', $id, 2); if (!$id) { $id = $ID; } resolve_pageid(getNS($ID), $id, $exists); // page has an image title if ($title && preg_match('/\\{\\{(.+?)\\}\\}/', $title, $match)) { list($image, $title) = explode('|', $match[1], 2); list($ext, $mime) = mimetype($image); if (!substr($mime, 0, 5) == 'image') { $image = ''; } $pages[] = array('id' => $id, 'section' => cleanID($section), 'title' => trim($title), 'image' => trim($image), 'description' => trim($description), 'exists' => $exists); // text title (if any) } else { $pages[] = array('id' => $id, 'section' => cleanID($section), 'title' => trim($title), 'description' => trim($description), 'exists' => $exists); } } return array($flags, $pages); }
/** * Saves data for a given page (creates a new revision) * * If this call succeeds you can assume your data has either been saved or it was * not necessary to save it because the data already existed in the wanted form or * the given schemas are no longer assigned to that page. * * Important: You have to check write permissions for the given page before calling * this function yourself! * * this duplicates a bit of code from entry.php - we could also fake post data and let * entry handle it, but that would be rather unclean and might be problematic when multiple * calls are done within the same request. * * @todo should this try to lock the page? * * * @param string $page * @param array $data ('schema' => ( 'fieldlabel' => 'value', ...)) * @param string $summary * @throws StructException */ public function saveData($page, $data, $summary = '') { $page = cleanID($page); $summary = trim($summary); if (!$summary) { $summary = $this->getLang('summary'); } if (!page_exists($page)) { throw new StructException("Page does not exist. You can not attach struct data"); } // validate and see if anything changes $valid = AccessDataValidator::validateDataForPage($data, $page, $errors); if ($valid === false) { throw new StructException("Validation failed:\n%s", join("\n", $errors)); } if (!$valid) { return; } // empty array when no changes were detected $newrevision = self::createPageRevision($page, $summary); // save the provided data $assignments = new Assignments(); foreach ($valid as $v) { $v->saveData($newrevision); // make sure this schema is assigned $assignments->assignPageSchema($page, $v->getAccessTable()->getSchema()->getTable()); } }
/** * 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)); } }
/** * get a list of namespace / page files * * @param string $folder an already converted filesystem folder of the current namespace */ function getTree($folder = ':') { global $conf; global $ID; // read tree structure from pages and media $ofolder = $folder; if ($folder == '*' || $folder == '') { $folder = ':'; } if ($folder[0] != ':') { $folder = resolve_id($folder, $ID); } $dir = strtr(cleanID($folder), ':', '/'); if (!($this->cache() && is_array($data = $this->cache()->get('explorertree_cache_' . $dir)))) { $data = array(); search($data, $conf['datadir'], 'search_index', array('ns' => getNS($ID)), $dir, $dir == '' ? 1 : count(explode('/', $dir)) + 1); $count = count($data); if ($count > 0) { for ($i = 1; $i < $count; $i++) { if ($data[$i - 1]['id'] == $data[$i]['id'] && $data[$i - 1]['type'] == $data[$i]['type']) { unset($data[$i]); $i++; // duplicate found, next $i can't be a duplicate, so skip forward one } } } if ($this->cache()) { $this->cache()->set($cache_id = 'explorertree_cache_' . $dir, $data, 60); // store the data itself (cache for one minute) } } return $data; }
function __construct($texit_obj) { $this->texit = $texit_obj; $this->_pageid = cleanID($pageid); $this->_doku_file = wikiFN($this->_pageid); $this->_texit_conf =& $this->texit->conf; }
/** * handle user request * * Initializes internal vars and handles modifications * * @author Andreas Gohr <*****@*****.**> */ function handle() { global $AUTH_ACL; global $ID; global $auth; // fresh 1:1 copy without replacements $AUTH_ACL = loadModlist(); // namespace given? if (empty($_REQUEST['ns']) || $_REQUEST['ns'] == '*') { $this->ns = '*'; } else { $this->ns = cleanID($_REQUEST['ns']); } // handle modifications if (isset($_REQUEST['cmd']) && checkSecurityToken()) { // scope for modifications if ($this->ns == '*') { $scope = '*'; } else { $scope = $this->ns . ':*'; } if (isset($_REQUEST['cmd']['save']) && $scope && isset($_REQUEST['modgroup'])) { // handle additions or single modifications $this->_acl_del($scope); $this->_acl_add($scope, trim($_REQUEST['modgroup'])); } elseif (isset($_REQUEST['cmd']['del']) && $scope) { // handle single deletions $this->_acl_del($scope); } elseif (isset($_REQUEST['cmd']['update'])) { // handle update of the whole file foreach ((array) $_REQUEST['del'] as $where) { // remove all rules marked for deletion unset($_REQUEST['acl'][$where]); } // prepare lines $lines = array(); // keep header foreach ($AUTH_ACL as $line) { if ($line[0] == '#') { $lines[] = $line; } else { break; } } foreach ((array) $_REQUEST['acl'] as $where => $who) { $who = $auth->cleanGroup($who); $who = auth_nameencode($who, true); $lines[] = "{$where}\t{$who}\n"; } // save it io_saveFile(DOKUTRANSLATE_MODLIST, join('', $lines)); } // reload ACL config $AUTH_ACL = loadModlist(); } // initialize ACL array $this->_init_acl_config(); }
/** * Return a page id based on the given format and title. * * @param $format string the format of the id to generate * @param $title string the title of the page to create * @return string a page id */ public static function mkpostid($format, $title) { global $conf; $replace = array('%{title}' => str_replace(':', $conf['sepchar'], $title), '%{user}' => $_SERVER['REMOTE_USER']); $out = $format; $out = str_replace(array_keys($replace), array_values($replace), $out); $out = strftime($out); return cleanID($out); }
/** * Create output */ function render($mode, &$renderer, $data) { global $ID; global $conf; $ns = $data[0]; if ($ns == '') { $ns = cleanID($this->getConf('namespace')); } elseif ($ns == '*') { $ns = ''; } elseif ($ns == '.') { $ns = getNS($ID); } $pages = $this->_monthArchive($ns, $data[1], $data[2]); if (!count($pages)) { return true; } // nothing to display if ($mode == 'xhtml') { // prevent caching to ensure content is always fresh $renderer->info['cache'] = false; $renderer->doc .= '<table class="archive">'; foreach ($pages as $page) { $renderer->doc .= '<tr><td class="page">'; // page title $id = $page['id']; $title = $page['title']; if (!$title) { $title = str_replace('_', ' ', noNS($id)); } $renderer->doc .= $renderer->internallink(':' . $id, $title) . '</td>'; // author if ($this->getConf('archive_showuser')) { if ($page['user']) { $renderer->doc .= '<td class="user">' . $page['user'] . '</td>'; } else { $renderer->doc .= '<td class="user"> </td>'; } } // creation date if ($this->getConf('archive_showdate')) { $renderer->doc .= '<td class="date">' . date($conf['dformat'], $page['date']) . '</td>'; } $renderer->doc .= '</tr>'; } $renderer->doc .= '</table>'; return true; // for metadata renderer } elseif ($mode == 'metadata') { foreach ($pages as $page) { $id = $page['id']; $renderer->meta['relation']['references'][$id] = true; } return true; } return false; }
/** * @param int|string $value * @param \Doku_Renderer $R * @param string $mode * @return bool */ public function renderValue($value, \Doku_Renderer $R, $mode) { $context = $this->getContext(); $filter = SearchConfigParameters::$PARAM_FILTER . '[' . $context->getTable() . '.' . $context->getLabel() . '*~]=' . $value; $page = trim($this->config['page']); if (!$page) { $page = cleanID($context->getLabel()); } $R->internallink($page . '?' . $filter, $value); return true; }
function handle_act_preprocess(&$event, $param) { if ($event->data != 'plugin_do') { return true; } $hlp = plugin_load('helper', 'do'); $hlp->toggleTaskStatus(cleanID($_REQUEST['do_page']), $_REQUEST['do_md5']); global $ACT; $ACT = 'show'; return true; }
/** * Extend query string with namespace, if it doesn't contain a namespace expression * * @param string &$query (reference) search query string */ private function _addNamespace2query(&$query) { global $INPUT; $ns = cleanID($INPUT->str('ns')); if ($ns) { //add namespace if user hasn't already provide one if (!preg_match('/(?:^| )(?:@|ns:)[\\w:]+/u', $query, $matches)) { $query .= ' @' . $ns; } } }
/** * Handler to prepare matched data for the rendering process * * @param string $match The text matched by the patterns * @param int $state The lexer state for the match * @param int $pos The character position of the matched text * @param Doku_Handler $handler Reference to the Doku_Handler object * @return array Return an array with all data you want to use in render */ public function handle($match, $state, $pos, &$handler) { $match = trim(substr($match, 15, -1)); //strip {datasearchform (length 15) from start and } from end list($key, $value) = explode('=', $match, 2); $options['filter'] = null; if (isset($key) && $key == 'flt') { $options['filter'] = cleanID($value); } return array($options, $state, $pos); }
/** * Redirects to the calendar page */ function handle_redirect(&$event, $param) { if (array_key_exists('plugin_wikicalendar_redirect_id', $_REQUEST)) { @session_start(); $_SESSION[DOKU_COOKIE]['plugin_wikicalendar_month'] = $_REQUEST['plugin_wikicalendar_month']; $_SESSION[DOKU_COOKIE]['plugin_wikicalendar_year'] = $_REQUEST['plugin_wikicalendar_year']; @session_write_close(); $event->data['id'] = cleanID($_REQUEST['plugin_wikicalendar_redirect_id']); $event->data['title'] = ''; } }
/** * Send a zipped theme * * @author Samuele Tognini <*****@*****.**> */ function send_theme($file) { require_once DOKU_PLUGIN . 'indexmenu/syntax/indexmenu.php'; $idxm = new syntax_plugin_indexmenu_indexmenu(); //clean the file name $file = cleanID($file); //check config if (!$idxm->getConf('be_repo') || empty($file)) { return false; } $repodir = INDEXMENU_IMG_ABSDIR . "/repository"; $zipfile = $repodir . "/{$file}.zip"; $localtheme = INDEXMENU_IMG_ABSDIR . "/{$file}/"; //theme does not exists if (!file_exists($localtheme)) { return false; } if (!io_mkdir_p($repodir)) { return false; } $lm = @filemtime($zipfile); //no cached zip or older than 1 day if ($lm < time() - 60 * 60 * 24) { //create the zip require_once DOKU_PLUGIN . "indexmenu/inc/pclzip.lib.php"; @unlink($zipfile); $zip = new PclZip($zipfile); $status = $zip->add($localtheme, PCLZIP_OPT_REMOVE_ALL_PATH); //error if ($status == 0) { return false; } } $len = (int) filesize($zipfile); //don't send large zips if ($len > 2 * 1024 * 1024) { return false; } //headers header('Cache-Control: must-revalidate, no-transform, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . basename($zipfile) . '";'); header("Content-Transfer-Encoding: binary"); //send zip $fp = @fopen($zipfile, 'rb'); if ($fp) { $ct = @fread($fp, $len); print $ct; } @fclose($fp); return true; }
function handle($match, $state, $pos, &$handler) { global $ID; $match = substr($match, 10, -2); // strip {{archive> from start and }} from end list($match, $flags) = explode('&', $match, 2); $flags = explode('&', $flags); list($match, $refine) = explode(' ', $match, 2); list($ns, $rest) = explode('?', $match, 2); if (!$rest) { $rest = $ns; $ns = ''; } if ($ns == '') { $ns = cleanID($this->getConf('namespace')); } elseif ($ns == '*' || $ns == ':') { $ns = ''; } elseif ($ns == '.') { $ns = getNS($ID); } else { $ns = cleanID($ns); } // daily archive if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $rest)) { list($year, $month, $day) = explode('-', $rest, 3); $start = mktime(0, 0, 0, $month, $day, $year); $end = $start + 24 * 60 * 60; // monthly archive } elseif (preg_match("/\\d{4}-\\d{2}/", $rest)) { list($year, $month) = explode('-', $rest, 2); // calculate start and end times $nextmonth = $month + 1; $year2 = $year; if ($nextmonth > 12) { $nextmonth = 1; $year2 = $year + 1; } $start = mktime(0, 0, 0, $month, 1, $year); $end = mktime(0, 0, 0, $nextmonth, 1, $year2); // a whole year } elseif (preg_match("/\\d{4}/", $rest)) { $start = mktime(0, 0, 0, 1, 1, $rest); $end = mktime(0, 0, 0, 1, 1, $rest + 1); // all entries from that namespace up to now } elseif ($rest == '*') { $start = 0; $end = time(); // unknown format } else { return false; } return array($ns, $start, $end, $flags, $refine); }
public function save($id) { $datetime = date('Y-m-d H:i:s'); $page = cleanID($id); $ipAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $logline = $datetime . ',' . $page . ',' . $ipAddress . ',"' . $referer . '","' . $agent . '"' . PHP_EOL; if (!io_saveFile($this->filename(), $logline, true)) { msg("Unable to write log404 file."); } }
public function printCronDataList($configuration) { require_once DOKU_INC . 'inc/JSON.php'; $json = new JSON(); $output = array(); foreach ($configuration as $name => $value) { list($path, $query) = explode('?', $value, 2); $output[$name] = $this->functions->parseStringToRequestArray($query, true); $output[$name]['ns'] = cleanID($path); } print $json->encode($output); }
/** * Handle the user input [required] * * @param helper_plugin_bureaucracy_field[] $fields the list of fields in the form * @param string $thanks the thank you message as defined in the form * or default one. Might be modified by the action * before returned * @param array $argv additional arguments passed to the action * @return bool|string false on error, $thanks on success */ public function run($fields, $thanks, $argv) { global $ID; // prepare replacements $this->prepareNamespacetemplateReplacements(); $this->prepareDateTimereplacements(); $this->prepareLanguagePlaceholder(); $this->prepareNoincludeReplacement(); $this->prepareFieldReplacements($fields); //handle arguments $page_to_modify = array_shift($argv); if ($page_to_modify === '_self') { # shortcut to modify the same page as the submitter $page_to_modify = $ID; } else { //resolve against page which contains the form resolve_pageid(getNS($ID), $page_to_modify, $ignored); } $template_section_id = cleanID(array_shift($argv)); if (!page_exists($page_to_modify)) { msg(sprintf($this->getLang('e_pagenotexists'), html_wikilink($page_to_modify)), -1); return false; } // check auth // // This is an important point. In order to be able to modify a page via this method ALL you need is READ access to the page // This is good for admins to be able to only allow people to modify a page via a certain method. If you want to protect the page // from people to WRITE via this method, deny access to the form page. $auth = $this->aclcheck($page_to_modify); // runas if ($auth < AUTH_READ) { msg($this->getLang('e_denied'), -1); return false; } // fetch template $template = rawWiki($page_to_modify); if (empty($template)) { msg(sprintf($this->getLang('e_template'), $page_to_modify), -1); return false; } // do the replacements $template = $this->updatePage($template, $template_section_id); if (!$template) { msg(sprintf($this->getLang('e_failedtoparse'), $page_to_modify), -1); return false; } // save page saveWikiText($page_to_modify, $template, sprintf($this->getLang('summary'), $ID)); //thanks message with redirect $link = wl($page_to_modify); return sprintf($this->getLang('pleasewait'), "<script type='text/javascript' charset='utf-8'>location.replace('{$link}')</script>", html_wikilink($page_to_modify)); }
/** * Saves data for a given page (creates a new revision) * * If this call succeeds you can assume your data has either been saved or it was * not necessary to save it because the data already existed in the wanted form or * the given schemas are no longer assigned to that page. * * @param string $page * @param array $data ('schema' => ( 'fieldlabel' => 'value', ...)) * @param string $summary * @return bool returns always true * @throws RemoteAccessDeniedException * @throws RemoteException */ public function saveData($page, $data, $summary) { $page = cleanID($page); if (!auth_quickaclcheck($page) < AUTH_EDIT) { throw new RemoteAccessDeniedException('no permissions to save data for that page'); } try { $this->hlp->saveData($page, $data, $summary); return true; } catch (StructException $e) { throw new RemoteException($e->getMessage(), 0, $e); } }
public function handle_ajax_call_unknown(Doku_Event &$event, $param) { if ($event->data != 'plugin_imgpaste') { return; } global $lang; // get data global $INPUT; $data = $INPUT->post->str('data'); list($type, $data) = explode(';', $data); if (!$data) { $this->fail(400, $this->getLang('e_nodata')); } // process data encoding $type = strtolower(substr($type, 5)); // strip 'data:' prefix $data = substr($data, 7); // strip 'base64,' prefix $data = base64_decode($data); // check for supported mime type $mimetypes = array_flip(getMimeTypes()); if (!isset($mimetypes[$type])) { $this->fail(415, $lang['uploadwrong']); } // prepare file names $tempname = $this->storetemp($data); $filename = $this->getConf('filename'); $filename = str_replace(array('@NS@', '@ID@', '@USER@'), array(getNS($INPUT->post->str('id')), $INPUT->post->str('id'), $_SERVER['REMOTE_USER']), $filename); $filename = strftime($filename); $filename .= '.' . $mimetypes[$type]; $filename = cleanID($filename); // check ACLs $auth = auth_quickaclcheck($filename); if ($auth < AUTH_UPLOAD) { $this->fail(403, $lang['uploadfail']); } // do the actual saving $result = media_save(array('name' => $tempname, 'mime' => $type, 'ext' => $mimetypes[$type]), $filename, false, $auth, 'copy'); if (is_array($result)) { $this->fail(500, $result[0]); } //Still here? We had a successful upload $this->clean(); header('Content-Type: application/json'); $json = new JSON(); echo $json->encode(array('message' => $lang['uploadsucc'], 'id' => $result)); $event->preventDefault(); $event->stopPropagation(); }
public function createTOCFiles($data) { global $conf; // Split Tree for translation $translationHSFiles = array(); for ($i = 0; $i < count($data); $i++) { $lang = ''; if ($this->translation) { $this->translation->tns = $this->translation->setupTNS($data[$i]['id']); $lang = $this->translation->getLangPart($data[$i]['id']); } // get all the relative URLs $translationHSFiles[$lang][] = $data[$i]; } $toc = new siteexport_toc($this->functions); if ($this->translation) { $translationRoot = curNS($this->translation->tns); } $hsPrename = curNS(getNS($this->translation->tns)) . '_' . $translationRoot; $check = array(); foreach ($translationHSFiles as $lang => $data) { if (count($translationHSFiles) == 1 && $lang == $conf['lang']) { // If there is only one language and it is the system language - there is no language $lang = ''; } // Prepare Translations if (!empty($lang)) { $toc->translation =& $this->translation; $rootNode = cleanID($this->translation->tns . $lang) . ':'; } else { $toc->translation = null; $rootNode = ''; } $tsRootPath = $this->translationRootPath($translationRoot); // Create toc and map for each lang list($tocData, $mapData, $startPageID) = $toc->__getJavaHelpTOCXML($data, $tsRootPath); $this->functions->debug->message("Generating JavaHelpDocZip for language '{$lang}'", null, 2); $this->filewriter->__moveDataToZip($tocData, $tsRootPath . $lang . '/' . $this->tocName); $this->filewriter->__moveDataToZip($mapData, $tsRootPath . $lang . '/' . $this->mapName); // Create HS File // array_shift($toc->getMapID($rootNode, &$check)) $HS = $this->getHSXML($startPageID, $this->functions->getSiteTitle($rootNode), $lang, $tsRootPath); $this->filewriter->__moveDataToZip($HS, $hsPrename . '_' . $lang . '.hs'); // Default Lang if ($lang == $conf['lang']) { $this->filewriter->__moveDataToZip($HS, $hsPrename . '.hs'); } } }
/** * In case of read or write of a page, this function is triggered. * * @author Gerry Weissbach <*****@*****.**> * @author Jon Magne Bøe <*****@*****.**> */ function _daftdrafts(&$event, $param) { global $INFO, $auth, $ID; $id = cleanID(empty($event->data['page']) ? $ID : $event->data['page']); $isDraft = false; $value = $event->data['current']['type']; $isDraft = !empty($value) && $value == 'daftdrafts'; //triggered when the text contains this plugin's syntax. if ($isDraft) { $this->_daftdrafts_add_acl($id, $event->data['current']['last_change']['user']); } else { $this->_daftdrafts_del_acl($id); } $INFO['perm'] = $this->_auth_quickaclcheck($id); }
protected function call($params) { $id = cleanID($params['id']); if (!file_exists(wikiFN($id))) { // return an error and exit; $this->error(404); } $range = $params['range']; if (!isset($range['from']) || !isset($range['to'])) { // an error with a specific message, and exit $this->error(400, "range must have a from proterty and a to property"); } // return the slice return rawWikiSlices($range['from'] . '-' . $range['to'], $id)[1]; }
function __construct($id, $namespace_mode, $conf, $nsbpc_obj) { $this->id = cleanID($id); $this->ns = getNS(cleanID($id)); $this->namespace_mode = $namespace_mode; $this->nsbpc = $nsbpc_obj; $this->conf = $conf; $this->set_prefix(); $this->_set_texit_dir(); $this->_set_media_dir(); $this->bibfn = $this->generate_bib(); $this->get_all_files(); $this->conf['latexentities'] = false; // we generate it at compile time $this->texit_render_obj = false; }
function handle($match, $state, $pos, &$handler) { global $ID; $match = substr($match, 10, -2); // strip {{threads> from start and }} from end list($match, $flags) = explode('&', $match, 2); $flags = explode('&', $flags); list($ns, $refine) = explode(' ', $match, 2); if ($ns == '*' || $ns == ':') { $ns = ''; } elseif ($ns == '.') { $ns = getNS($ID); } else { $ns = cleanID($ns); } return array($ns, $flags, $refine); }
/** * Log page edits actions */ function logedits(Doku_Event $event, $param) { if ($event->data[3]) { return; } // no revision if (file_exists($event->data[0][0])) { if ($event->data[0][1] == '') { $type = 'D'; } else { $type = 'E'; } } else { $type = 'C'; } /** @var helper_plugin_statistics $hlp */ $hlp = plugin_load('helper', 'statistics'); $hlp->Logger()->log_edit(cleanID($event->data[1] . ':' . $event->data[2]), $type); }
function handle($match, $state, $pos, &$handler) { global $ID; $match = substr($match, 14, -2); // strip {{autoarchive> from start and }} from end list($match, $flags) = explode('?', $match, 2); $flags = explode('&', $flags); list($ns, $refine) = explode(' ', $match, 2); if ($ns == '') { $ns = cleanID($this->getConf('namespace')); } elseif ($ns == '*' || $ns == ':') { $ns = ''; } elseif ($ns == '.') { $ns = getNS($ID); } else { $ns = cleanID($ns); } return array($ns, $flags, $refine, $pos); }