function numberingProcessNum() { $db = numberingDB(); $helper = plugin_load('helper', 'numbering'); $start = urldecode($helper->getConfValue('nstart')); $number = getNumberingNextNumber($db, $start); $padding = urldecode($helper->getConfValue('padding')); $len = (int) urldecode($helper->getConfValue('pad_length')); $set_date = $helper->getConfValue('set_date'); $format = urldecode($helper->getConfValue('format')); if ($helper->getConfValue('use_imgs')) { $imagestr = urldecode($helper->getConfValue('imgs')); $images = explode(',', $imagestr); $i_no = 0; foreach ($images as $img) { $nxt = '%i' . ++$i_no; $format = str_replace($nxt, '{{' . $img . '}}', $format); } } if ($set_date) { $dformat = urldecode($helper->getConfValue('datestyle')); $time = strftime($dformat); $format = str_replace('%d', $time, $format); } $n = str_pad((string) $number, (int) $len, $padding, STR_PAD_LEFT); $format = str_replace('%n', $n, $format); echo "{$format}\n\n"; }
/** * handle user request */ function handle() { if (!isset($_REQUEST['cmd'])) { return; // first time - nothing to do } if (!checkSecurityToken()) { return; } if (!is_array($_REQUEST['cmd'])) { return; } $crud = plugin_load('helper', 'judge_crud', true); // verify valid values switch (key($_REQUEST['cmd'])) { case 'get': $this->output = '<div class="table sectionedit1"> <table class="inline">'; $table = $crud->tableRender(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']), "html", 1, "timestamp"); if ($table["count"] == 0) { $this->output .= '<p>' . $this->getLang("empty_result") . '</p>'; break; } else { $this->output .= $table["submissions_table"]; } $this->output .= "</table></div>"; break; case 'delete': $this->output = $crud->delSubmissions(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user'])); break; } }
/** * Load a whole schema as fields * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool */ public function handle_schema(Doku_Event $event, $param) { $args = $event->data['args']; if ($args[0] != 'struct_schema') { return false; } $event->preventDefault(); $event->stopPropagation(); /** @var helper_plugin_bureaucracy_field $helper */ $helper = plugin_load('helper', 'bureaucracy_field'); $helper->initialize($args); $schema = new Schema($helper->opt['label']); if (!$schema->getId()) { msg('This schema does not exist', -1); return false; } foreach ($schema->getColumns(false) as $column) { /** @var helper_plugin_struct_field $field */ $field = plugin_load('helper', 'struct_field'); // we don't initialize the field but set the appropriate values $field->opt = $helper->opt; // copy all the settings to each field $field->opt['label'] = $column->getFullQualifiedLabel(); $field->column = $column; $event->data['fields'][] = $field; } return true; }
/** * 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)); } }
function handle() { global $lang; $cid = $_REQUEST['cid']; if (is_array($cid)) { $cid = array_keys($cid); } $action =& plugin_load('action', 'discussion'); if (!$action) { return; } // couldn't load action plugin component switch ($_REQUEST['comment']) { case $lang['btn_delete']: $action->_save($cid, ''); break; case $this->getLang('btn_show'): $action->_save($cid, '', 'show'); break; case $this->getLang('btn_hide'): $action->_save($cid, '', 'hide'); break; case $this->getLang('btn_change'): $this->_changeStatus($_REQUEST['status']); break; } }
function handle($match, $state, $pos, Doku_Handler $handler) { global $DOKU_PLUGINS; preg_match('/^\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', $match, $quotearg); $quoteinarg = preg_replace('/^\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', '', $match); if ($state == DOKU_LEXER_ENTER) { $ReWriter = new Doku_Handler_Markdown_Quote($handler->CallWriter); $handler->CallWriter =& $ReWriter; $handler->_addCall('quote_start', $quotearg, $pos); } elseif ($state == DOKU_LEXER_EXIT) { $handler->_addCall('quote_end', array(), $pos); $handler->CallWriter->process(); $ReWriter =& $handler->CallWriter; $handler->CallWriter =& $ReWriter->CallWriter; } if ($quoteinarg == '') { $handler->_addCall('quote_newline', $quotearg, $pos); /* ATX headers (headeratx) */ } elseif (preg_match('/^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*/', $quoteinarg)) { $plugin =& plugin_load('syntax', 'markdowku_headeratx'); $plugin->handle($quoteinarg, $state, $pos, $handler); /* Horizontal rulers (hr) */ } elseif (preg_match('/[ ]{0,2}(?:[ ]?_[ ]?){3,}[ \\t]*/', $quoteinarg) or preg_match('/[ ]{0,2}(?:[ ]?-[ ]?){3,}[ \\t]*/', $quoteinarg) or preg_match('/[ ]{0,2}(?:[ ]?\\*[ ]?){3,}[ \\t]*/', $quoteinarg)) { $plugin =& plugin_load('syntax', 'markdowku_hr'); $plugin->handle($quoteinarg, $state, $pos, $handler); /* Setext headers (headersetext) */ } elseif (preg_match('/^[^\\n]+?[ \\t]*\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?=+[ \\t]*/', $quoteinarg) or preg_match('/^[^\\n]+?[ \\t]*\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?-+[ \\t]*/', $quoteinarg)) { $quoteinarg = preg_replace('/(?<=\\n)[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', '', $quoteinarg); $plugin =& plugin_load('syntax', 'markdowku_headersetext'); $plugin->handle($quoteinarg, $state, $pos, $handler); } else { $handler->_addCall('cdata', array($quoteinarg), $pos); } return true; }
function handle() { global $lang; $lid = $_REQUEST['lid']; if (is_array($lid)) { $lid = array_keys($lid); } $action =& plugin_load('action', 'linkback_display'); if (!$action) { return; } // couldn't load action plugin component switch ($_REQUEST['linkback']) { case $lang['btn_delete']: $action->_deleteLinkbacks($lid); break; case $this->getLang('btn_show'): $action->_changeLinkbackVisibilities($lid, true); break; case $this->getLang('btn_hide'): $action->_changeLinkbackVisibilities($lid, false); break; case $this->getLang('btn_ham'): $action->_markLinkbacks($lid, false); break; case $this->getLang('btn_spam'): $action->_markLinkbacks($lid, true); break; case $this->getLang('btn_change'): $this->_changeStatus($_REQUEST['status']); break; } }
/** * Create the additional fields for the edit form */ function handle_editform_output(&$event, $param) { // check if source view -> no captcha needed if (!$param['oldhook']) { // get position of submit button $pos = $event->data->findElementByAttribute('type', 'submit'); if (!$pos) { return; } // no button -> source view mode } elseif ($param['editform'] && !$event->data['writable']) { if ($param['editform'] && !$event->data['writable']) { return; } } // do nothing if logged in user and no CAPTCHA required if (!$this->getConf('forusers') && $_SERVER['REMOTE_USER']) { return; } // get the CAPTCHA $helper = plugin_load('helper', 'captcha'); $out = $helper->getHTML(); if ($param['oldhook']) { // old wiki - just print echo $out; } else { // new wiki - insert at correct position $event->data->insertElement($pos++, $out); } }
public function setUp() { parent::setUp(); /** @var \helper_plugin_struct_db $sqlite */ $sqlite = plugin_load('helper', 'struct_db'); $this->sqlite = $sqlite->getDB(); }
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, '&')); }
/** * Step up * * @param Doku_Event $event */ public function handle_ajax(Doku_Event $event) { if ($event->data != 'plugin_move_progress') { return; } $event->preventDefault(); $event->stopPropagation(); global $INPUT; global $USERINFO; if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) { http_status(403); exit; } $return = array('error' => '', 'complete' => false, 'progress' => 0); /** @var helper_plugin_move_plan $plan */ $plan = plugin_load('helper', 'move_plan'); if (!$plan->isCommited()) { // There is no plan. Something went wrong $return['complete'] = true; } else { $todo = $plan->nextStep($INPUT->bool('skip')); $return['progress'] = $plan->getProgress(); $return['error'] = $plan->getLastError(); if ($todo === 0) { $return['complete'] = true; } } $json = new JSON(); header('Content-Type: application/json'); echo $json->encode($return); }
/** * AJAX Provider - check what is going to be done * @param $event * @param $args */ public function ajax_siteexport_cron_provider(&$event, $args) { // If this is not a siteexport call - and cron call, ignore it. if (!(strstr($event->data, '__siteexport') && strstr($event->data, 'cron'))) { return; } $this->__init_functions(); $cronOverwriteExisting = intval($_REQUEST['cronOverwriteExisting']) == 1; list($url, $combined) = $this->ajax_siteexport_prepareURL_and_POSTData($event); if (!($function =& plugin_load('cron', 'siteexport'))) { $this->functions->debug->message("Could not load Cron base", null, 4); return; } $this->functions->debug->message("Will write parameters to Cron:", $combined, 1); $status = null; switch ($event->data) { case '__siteexport_savecron': $status = $function->saveCronDataWithParameters($combined, $cronOverwriteExisting); break; case '__siteexport_deletecron': $status = $function->deleteCronDataWithParameters($combined); break; case '__siteexport_showcron': $status = $this->printCronDataList($function->configuration); break; default: $this->functions->debug->message("Uhoh. You did not say the magic word.", null, 4); } if (!empty($status)) { $this->functions->debug->message("Tried to do an action with siteexport/cron, but failed.", "Tried to do an action with siteexport/cron, but failed. ({$status})" . 4); } }
/** * Initialize the database * * @throws Exception */ protected function init() { /** @var helper_plugin_sqlite $sqlite */ $this->sqlite = plugin_load('helper', 'sqlite'); if (!$this->sqlite) { if (defined('DOKU_UNITTEST')) { throw new \Exception('Couldn\'t load sqlite.'); } msg('The struct plugin requires the sqlite plugin. Please install it', -1); return; } if ($this->sqlite->getAdapter()->getName() != DOKU_EXT_PDO) { if (defined('DOKU_UNITTEST')) { throw new \Exception('Couldn\'t load PDO sqlite.'); } msg('The struct plugin requires sqlite3 you\'re still using sqlite2', -1); $this->sqlite = null; return; } $this->sqlite->getAdapter()->setUseNativeAlter(true); // initialize the database connection if (!$this->sqlite->init('struct', DOKU_PLUGIN . 'struct/db/')) { if (defined('DOKU_UNITTEST')) { throw new \Exception('Couldn\'t init sqlite.'); } return; } // register our JSON function with variable parameters // todo this might be useful to be moved into the sqlite plugin $this->sqlite->create_function('STRUCT_JSON', array($this, 'STRUCT_JSON'), -1); }
function admin_plugin_blogtng() { $this->commenthelper =& plugin_load('helper', 'blogtng_comments'); $this->entryhelper =& plugin_load('helper', 'blogtng_entry'); $this->sqlitehelper =& plugin_load('helper', 'blogtng_sqlite'); $this->taghelper =& plugin_load('helper', 'blogtng_tags'); }
function render($mode, &$renderer, $indata) { if ($mode == 'xhtml') { list($state, $data) = $indata; switch ($state) { case DOKU_LEXER_ENTER: $pluginClass = $this->getConf('addStyling') ? 'blockquote-plugin' : ''; $attr = ''; if ($data && strlen($data) > 0 && !plugin_isdisabled('wrap')) { // get attributes from wrap helper plugin (if installed) $wrap =& plugin_load('helper', 'wrap'); $attr = $wrap->buildAttributes($data, $pluginClass); } else { if ($pluginClass) { $attr = 'class="' . $pluginClass . '"'; } } $renderer->doc .= '<cite ' . $attr . '>'; break; case DOKU_LEXER_UNMATCHED: $renderer->doc .= $renderer->_xmlEntities($data); break; case DOKU_LEXER_EXIT: $renderer->doc .= "</cite>"; break; } return true; } // unsupported $mode return false; }
/** * 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); } } } }
/** * Create output */ function render($format, &$renderer, $data) { global $INFO, $conf; $helper = plugin_load('helper', 'orphanswanted'); if ($format == 'xhtml') { // prevent caching to ensure content is always fresh $renderer->info['cache'] = false; // $data is an array // $data[1]..[x] are excluded namespaces, $data[0] is the report type //handle choices switch ($data[0]) { case 'orphans': $renderer->doc .= $helper->orphan_pages($data); break; case 'wanted': $renderer->doc .= $helper->wanted_pages($data); break; case 'valid': $renderer->doc .= $helper->valid_pages($data); break; case 'all': $renderer->doc .= $helper->all_pages($data); break; default: $renderer->doc .= "ORPHANSWANTED syntax error"; // $renderer->doc .= "syntax ~~ORPHANSWANTED:<choice>~~<optional_excluded> <choice> :: orphans|wanted|valid|all Ex: ~~ORPHANSWANTED:valid~~"; } return true; } return false; }
/** * Default teardown * * we always make sure the database is clear */ protected function tearDown() { parent::tearDown(); /** @var \helper_plugin_struct_db $db */ $db = plugin_load('helper', 'struct_db'); $db->resetDB(); }
/** * handle plugin rendering * * @param string $name Plugin name * @param mixed $data custom data set by handler * @param string $state matched state if any * @param string $match raw matched syntax */ function plugin($name, $data, $state = '', $match = '') { $plugin = plugin_load('syntax', $name); if ($plugin != null) { $plugin->render($this->getFormat(), $this, $data); } }
/** * Create output */ function render($mode, &$renderer, $data) { list($flags, $pages) = $data; // for XHTML output if ($mode == 'xhtml') { if (!($my =& plugin_load('helper', 'pagelist'))) { return false; } $my->setFlags($flags); $my->startList(); if ($my->sort) { // pages should be sorted by pagename $keys = array(); $fnc = create_function('$a, $b', 'return strcmp(noNS($a["id"]), noNS($b["id"])); '); usort($pages, $fnc); } foreach ($pages as $page) { $my->addPage($page); } $renderer->doc .= $my->finishList(); return true; // for metadata renderer } elseif ($mode == 'metadata') { foreach ($pages as $page) { $renderer->meta['relation']['references'][$page['id']] = $page['exists']; } return true; } return false; }
function process() { // sanity check if (!$this->manager->plugin) { return; } $component_list = $this->get_plugin_components($this->manager->plugin); usort($component_list, array($this, 'component_sort')); foreach ($component_list as $component) { if (($obj = plugin_load($component['type'], $component['name'], false, true)) === null) { continue; } $compname = explode('_', $component['name']); if ($compname[1]) { $compname = '[' . $compname[1] . ']'; } else { $compname = ''; } $this->details[] = array_merge($obj->getInfo(), array('type' => $component['type'], 'compname' => $compname)); unset($obj); } // review details to simplify things foreach ($this->details as $info) { foreach ($info as $item => $value) { if (!isset($this->plugin_info[$item])) { $this->plugin_info[$item] = $value; continue; } if ($this->plugin_info[$item] != $value) { $this->plugin_info[$item] = ''; } } } }
/** * 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; } }
public function test_initialize_obs_content() { // TODO: fix this test $this->markTestSkipped('The test needs fixed'); /** @var $thisPlugin action_plugin_door43obs_PopulateOBS */ $thisPlugin = plugin_load('action', 'door43obs_PopulateOBS'); if (ob_get_contents()) { ob_clean(); } $thisPlugin->initialize_obs_content(); $result = ob_get_clean(); // test the return value $expect = sprintf($thisPlugin->getLang('obsCreatedSuccess'), self::$destNs, '/' . self::$destNs . '/obs'); $this->assertEquals($expect, $result); // check for files $this->assertFileExists($this->destNsDir . '/home.txt'); $this->assertFileExists($this->destNsDir . '/obs.txt'); $this->assertFileExists($this->destNsDir . '/sidebar.txt'); $this->assertFileExists($this->destNsDir . '/obs/app_words.txt'); $this->assertFileExists($this->destNsDir . '/obs/back-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/front-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/cover-matter.txt'); $this->assertFileExists($this->destNsDir . '/obs/sidebar.txt'); $this->assertFileExists($this->destNsDir . '/obs/stories.txt'); // currently not checking all 50 files, just the first and last $this->assertFileExists($this->destNsDir . '/obs/01.txt'); $this->assertFileExists($this->destNsDir . '/obs/50.txt'); }
/** * Register the events * * @param $event DOKU event on ajax call * @param $param parameters, ignored */ function _ajax_call(&$event, $param) { if ($event->data !== 'plugin_explorertree') { return; } //no other ajax call handlers needed $event->stopPropagation(); $event->preventDefault(); //e.g. access additional request variables global $INPUT; //available since release 2012-10-13 "Adora Belle" if (!checkSecurityToken()) { $data = array('error' => true, 'msg' => 'invalid security token!'); } else { switch ($INPUT->str('operation')) { case 'explorertree_branch': if (!($helper = plugin_load('helper', 'explorertree'))) { $data = array('error' => true, 'msg' => "Can't load tree helper."); break; } if (!($route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader')))) { $data = array('error' => true, 'msg' => "Can't load route '" . $INPUT->str('route') . "'!"); } $data = array('html' => $helper->htmlExplorer($INPUT->str('route'), ltrim(':' . $INPUT->str('itemid')), ':')); if (!$data['html']) { $data['error'] = true; $data['msg'] = "Can't load tree html."; } break; case 'callback': if (!($helper = plugin_load('helper', 'explorertree'))) { $data = array('error' => true, 'msg' => "Can't load tree helper."); break; } $route = $helper->loadRoute($INPUT->str('route'), $INPUT->arr('loader')); if (!$route || !is_callable(@$route['callbacks'][$INPUT->str(event)])) { $data = array('error' => true, 'msg' => "Can't load callback '" . $INPUT->str('event') . "'for '" . $INPUT->str('route') . "'!"); } $data = @call_user_func_array($route['callbacks'][$INPUT->str(event)], array($INPUT->str('itemid'))); if (!is_array($data)) { $data = array('error' => true, 'msg' => "Callback for '" . $INPUT->str('event') . "' does not exists!"); } break; default: $data = array('error' => true, 'msg' => 'Unknown operation: ' . $INPUT->str('operation')); break; } //data //json library of DokuWiki } if (is_array($data)) { $data['token'] = getSecurityToken(); } require_once DOKU_INC . 'inc/JSON.php'; $json = new JSON(); //set content type header('Content-Type: application/json'); echo $json->encode($data); // $this->get_helper()->check_meta_changes(); }
function plugin($name, $data) { $plugin =& plugin_load('syntax', $name); if ($plugin != null) { $plugin->render($this->getFormat(), $this, $data); } }
/** * Constructor. Load helper plugin */ public function __construct() { $this->dthlp = plugin_load('helper', 'data'); if (!$this->dthlp) { msg('Loading the data helper failed. Make sure the data plugin is installed.', -1); } }
/** * Create the detail info for a single plugin * * @param Doku_Event $event * @param $param */ public function info(Doku_Event &$event, $param) { global $USERINFO; global $INPUT; if ($event->data != 'plugin_extension') { return; } $event->preventDefault(); $event->stopPropagation(); if (empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])) { http_status(403); echo 'Forbidden'; exit; } header('Content-Type: text/html; charset=utf-8'); $ext = $INPUT->str('ext'); if (!$ext) { echo 'no extension given'; return; } /** @var helper_plugin_extension_extension $extension */ $extension = plugin_load('helper', 'extension_extension'); $extension->setExtension($ext); /** @var helper_plugin_extension_list $list */ $list = plugin_load('helper', 'extension_list'); echo $list->make_info($extension); }
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>'; }
/** * Constructor. Load helper plugin */ function syntax_plugin_data_entry() { $this->dthlp =& plugin_load('helper', 'data'); if (!$this->dthlp) { msg('Loading the data helper failed. Make sure the data plugin is installed.', -1); } }
/** * Renames all occurances of a page ID in the database * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool */ public function handle_move(Doku_Event $event, $param) { /** @var helper_plugin_struct_db $hlp */ $hlp = plugin_load('helper', 'struct_db'); $db = $hlp->getDB(); if (!$db) { return false; } $old = $event->data['src_id']; $new = $event->data['dst_id']; // ALL data tables (we don't trust the assigments are still there) foreach (Schema::getAll() as $tbl) { $sql = "UPDATE data_{$tbl} SET pid = ? WHERE pid = ?"; $db->query($sql, array($new, $old)); $sql = "UPDATE multi_{$tbl} SET pid = ? WHERE pid = ?"; $db->query($sql, array($new, $old)); } // assignments $sql = "UPDATE schema_assignments SET pid = ? WHERE pid = ?"; $db->query($sql, array($new, $old)); // make sure assignments still match patterns; $assignments = new Assignments(); $assignments->reevaluatePageAssignments($new); return true; }