function plugin_bugtrack_write($base, $pagename, $summary, $name, $priority, $state, $category, $version, $body) { global $post; $base = strip_bracket($base); $pagename = strip_bracket($pagename); $postdata = plugin_bugtrack_template($base, $summary, $name, $priority, $state, $category, $version, $body); $id = $jump = 1; $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $id); while (is_page($page)) { $id = $jump; $jump += 50; $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $jump); } $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $id); while (is_page($page)) { $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, ++$id); } if ($pagename == '') { page_write($page, $postdata); } else { $pagename = get_fullname($pagename, $base); if (is_page($pagename) || !is_pagename($pagename)) { $pagename = $page; // Set default } else { page_write($page, 'move to [[' . $pagename . ']]'); } page_write($pagename, $postdata); } return $page; }
function plugin_bugtrack_write($base, $pagename, $summary, $name, $priority, $state, $category, $version, $body) { global $vars; $base = strip_bracket($base); $pagename = strip_bracket($pagename); $postdata = plugin_bugtrack_template($base, $summary, $name, $priority, $state, $category, $version, $body); $id = $jump = 1; $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $id); while (is_page($page)) { $id = $jump; $jump += 50; $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $jump); } $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, $id); while (is_page($page)) { $page = $base . '/' . sprintf(PLUGIN_BUGTRACK_NUMBER_FORMAT, ++$id); } if (empty($pagename)) { Factory::Wiki($page)->set($postdata); } else { $pagename = Utility::getPageName($pagename, $base); $wiki = Factory::Wiki($page); if ($wiki->isValied()) { $pagename = $page; // Set default } else { $wiki->set('move to [[' . $pagename . ']]'); } Factory::Wiki($pagename)->set($postdata); } return $page; }