function action_find() { global $pagestore, $find, $branch_search; $doFindOne = 1; // avoid findOne search if empty string, full text search, or branch search if (trim($find) == '' || $find[0] == '!' || $branch_search) { $doFindOne = 0; } // remove leading ! if full text search if ($find[0] == '!') { $find = substr($find, 1); } // try to find one page by its name if ($doFindOne && ($findOne = $pagestore->findOne(trim($find)))) { header('Location: ' . viewURL($findOne)); } else { $list = $pagestore->find($find); if ($branch_search) { $branch_nodes = $pagestore->getTree($branch_search, '', 'FLAT'); $list = array_intersect($list, $branch_nodes); } $text = ''; foreach ($list as $page) { if ($page != $find) { $text .= html_ref($page, $page) . html_newline(); } } template_find(array('find' => $find, 'pages' => $text, 'branch_search' => $branch_search)); } }
function _drawTree($tree, $smallFont, $page, $previousEdges) { global $HomePage, $WikiName; if (count($tree)) { // adjust the pictures of the previous edges $previousEdges = preg_replace("/2/", "0", $previousEdges); $previousEdges = preg_replace("/3/", "1", $previousEdges); $j = 0; foreach ($tree as $name => $node) { $j++; if ($j == count($tree)) { $currentEdges = $previousEdges . '2'; } else { $currentEdges = $previousEdges . '3'; } // above the last node of the branch $drawEdges = _drawEdges($currentEdges); $title = $name == $HomePage ? "<b>{$WikiName}</b>" : $name; $output = html_ref($name, $title); if ($name == $page) { $output = "<a name=\"{$name}\"></a><b>{$title}</b>"; } if ($smallFont) { $output = "<small>{$output}</small>"; } $output = "<tr><td nowrap>{$drawEdges}{$output}</td></tr>\n"; print $output; _drawTree($node, $smallFont, $page, $currentEdges); } } }
function template_find($args) { template_common_prologue(array('norobots' => 1, 'title' => 'Find ' . $args['find'], 'heading' => $args['find'] . ' and related pages', 'headlink' => '', 'headsufx' => '', 'toolbar' => 1, 'button_selected' => '', 'button_view' => 0, 'button_backlinks' => 0)); ?> <div class="content"> <?php $find = $args['find']; global $pagestore; $searchpage = $pagestore->page($find); $pageExists = $searchpage->exists(); if ($pageExists) { print "<h3>You're probably looking for " . html_ref($find, $find) . ".</h3>"; } else { print "<h3>'" . htmlentities($find) . "' isn't currently a page in the wiki.</h3>"; } if ($args['pages']) { print '<p>Search results for "' . htmlentities($find) . '":<ul>'; if ($args['branch_search']) { print 'Restricted to children of ' . $args['branch_search'] . '<br>'; } print $args['pages'] . "</ul>"; } global $HomePage; print "<p>(Back to " . html_ref($HomePage, $HomePage) . ".)"; ?> </div> <?php template_common_epilogue(array('twin' => '', 'edit' => '', 'editver' => -1, 'history' => '', 'timestamp' => '', 'headlink' => '', 'button_selected' => '', 'button_view' => 0, 'button_backlinks' => 0)); }
function html_ahref($arguments, $class = "") { $ahref = "<a "; if ($class != "") { $ahref .= "class=\"{$class}\" "; } $ahref .= "href=\""; return html_ref($arguments, $ahref); }
function action_find() { global $pagestore; $find = $_POST['find'] ? $_POST['find'] : $_GET['find']; $list = $pagestore->find($find); $text = ''; foreach ($list as $page) { $text .= html_ref($page, $page) . html_newline(); } template_find(array('find' => $find, 'pages' => $text)); }
function action_find() { global $pagestore, $find, $style, $SeparateLinkWords; $list = $pagestore->find($find); switch ($style) { case 'meta': $SeparateLinkWords = 0; break; } $text = ''; foreach ($list as $page) { $text = $text . html_ref($page, $page) . html_newline(); } template_find(array('find' => $find, 'pages' => $text)); }
function parse($args, $page) { global $pagestore, $LkTbl; $text = ''; $first = 1; $q1 = $pagestore->dbh->query("SELECT page, SUM(count) AS ct FROM {$LkTbl} " . "GROUP BY page ORDER BY ct DESC, page"); while ($result = $pagestore->dbh->result($q1)) { if (!$first) { $text = $text . "\n"; } else { $first = 0; } $text = $text . '(' . $result[1] . ') ' . html_ref($result[0], $result[0]); } return html_code($text); }
function parse($args, $page) { global $pagestore; $first = 1; $list = $pagestore->allpages(); usort($list, 'sizeSort'); $text = ''; foreach ($list as $page) { if (!$first) { $text = $text . "\n"; } else { $first = 0; } $text = $text . $page[4] . ' ' . html_ref($page[1], $page[1]); } return html_code($text); }
function parse($args, $page) { global $pagestore, $LkTbl; $lastpage = ''; $text = ''; $q1 = $pagestore->dbh->query("SELECT page, link FROM {$LkTbl} ORDER BY page"); while ($result = $pagestore->dbh->result($q1)) { if ($lastpage != $result[0]) { if ($lastpage != '') { $text = $text . "\n"; } $text = $text . html_ref($result[0], $result[0]) . ' |'; $lastpage = $result[0]; } $text = $text . ' ' . html_ref($result[1], $result[1]); } return html_code($text); }
function parse($args, $page) { global $pagestore, $LkTbl, $PgTbl; $text = ''; $first = 1; $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM {$LkTbl} " . "GROUP BY link ORDER BY ct DESC, link"); while ($result = $pagestore->dbh->result($q1)) { $q2 = $pagestore->dbh->query("SELECT lastversion FROM {$PgTbl} " . "WHERE title='{$result['0']}'"); if (!($r2 = $pagestore->dbh->result($q2)) || empty($r2[0])) { if (!$first) { $text = $text . "\n"; } else { $first = 0; } $text = $text . '(' . html_url(findURL($result[0]), $result[1]) . ') ' . html_ref($result[0], $result[0]); } } return html_code($text); }
function parse($args, $page) { global $pagestore, $LkTbl; $text = ''; $first = 1; $pages = $pagestore->allpages(); usort($pages, 'nameSort'); foreach ($pages as $page) { $q2 = $pagestore->dbh->query("SELECT page FROM {$LkTbl} " . "WHERE link='{$page['1']}' AND page!='{$page['1']}'"); if (!($r2 = $pagestore->dbh->result($q2)) || empty($r2[0])) { if (!$first) { $text = $text . "\n"; } else { $first = 0; } $text = $text . html_ref($page[1], $page[1]); } } return html_code($text); }
function html_summary_title($project, $branches) { global $branches, $tags, $nr_of_shortlog_lines; if ($_GET['a'] != "commitdiff") { echo html_ref(array('project' => $project, 'a' => "jump_to_tag"), "<form method=post action=\""); echo "<div class=\"gittitle\">Summary :: "; echo "<select name=\"branch\">"; echo "<option selected value=\"\">select a branch</option>"; foreach (array_keys($branches) as $br) { echo "<option value=\"" . $br . "\">" . $br . "</option>"; } echo "</select> or <select name=\"tag\">"; echo "<option selected value=\"\">select a tag</option>"; foreach (array_keys($tags) as $br) { echo "<option value=\"" . $br . "\">" . $br . "</option>"; } echo "</select> and press <input type=\"submit\" name=\"branch_or_tag\" value=\"GO\">"; echo " Lines to display <input type=\"text\" name=\"nr_of_shortlog_lines\" value=\"" . $nr_of_shortlog_lines . "\" size=\"3\"> <input type=\"submit\" name=\"branch_or_tag\" value=\"SET\"> \n"; echo "</div></form>"; } else { echo "<div class=\"gittitle\">Summary</div>\n"; } }
function send_the_submit_form() { html_spacer(); html_title("BUNDLE INFORMATION"); html_spacer(); echo "<div id=\"git-submit\">\n"; echo html_ref(array('p' => $_GET['p'], 'a' => "jump_to_tag"), "<form method=post enctype=\"multipart/form-data\" action=\""); echo "<div class=\"optiontable\">"; echo "<table>\n"; echo "<tr><td class=\"descol\">Short MEANINGFUL description </td><td class=\"valcol\"><input type=\"text\" name=\"commiter name\" size=\"40\"></td></tr>\n"; echo "<tr><td class=\"descol\">Bundle file </td><td class=\"valcol\"><input type=\"file\" name=\"bundle_file\" size=\"40\"></td></tr>\n"; echo "<tr><td class=\"descol\">enter the value <img src=\"" . sanitized_url() . "dl=human_check\"/> here </td><td class=\"valcol\"><input type=\"text\" name=\"check\" size=\"40\"></td></tr>\n"; echo "<tr><td class=\"descol\">Submit </td><td class=\"valcol\"><input type=\"submit\" name=\"action\" value=\"commit\" size=\"10\"></td></tr>\n"; echo "</table></div>\n"; echo "</form>\n"; echo "</div>\n"; send_the_help_section_of_submit(); }
function template_conflict($args) { global $EditRows, $EditCols, $UserName, $PrefsScript; template_common_prologue(array('norobots' => 1, 'title' => lang('Editing') . ' ' . $args['page'], 'heading' => lang('Editing') . ' ', 'headlink' => $args['page'], 'headsufx' => '', 'toolbar' => 1)); ?> <div id="body"> <p class="warning"> <?php echo lang('Warning: since you started editing, this document has been changed by someone else. Please merge your edits into the current version of this document.'); ?> </p> <h1><?php echo lang('Current Version'); ?> </h1> <form method="post" action="<?php print saveURL($args['page']); ?> "> <div class="form"> <input type="submit" name="Save" value="<?php echo lang('Save'); ?> " /> <input type="submit" name="Preview" value="<?php echo lang('Preview'); ?> " /> <?php if ($UserName != '') { print lang('Your user name is "%1".', html_ref($UserName, $UserName)); } else { echo lang('Visit %1 to set your user name', '<a href="' . $PrefsScript . '">' . lang('Preferences') . '</a>'); } ?> <br /> <input type="hidden" name="nextver" value="<?php print $args['nextver']; ?> " /> <textarea name="document" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $args['text'])); ?> </textarea><br /> <?php echo lang('Summary of change'); ?> : <input type="text" name="comment" size="40" value="" /><br /> <?php echo lang('Add document to category'); ?> : <input type="text" name="categories" size="40" value="" /> <hr /> <h1><?php echo lang('Your changes'); ?> </h1> <textarea name="discard" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $args['usertext'])); ?> </textarea><br /> </div> </form> <h1><?php echo lang('Preview of Current Version'); ?> </h1> <?php print $args['html']; ?> </div> <?php template_common_epilogue(array('twin' => $args['page'], 'edit' => '', 'editver' => 0, 'history' => $args['page'], 'timestamp' => $args['timestamp'], 'nosearch' => 0)); }
function parse($args, $page) { global $HomePage; return html_ref($HomePage, $HomePage); }
function action_content() { global $page, $pagestore, $HomePage; // get all branches $tree = $pagestore->getTreeFromLeaves($HomePage); // get other nodes that could not fit in a branch $allPages = $pagestore->getAllPageNames(); $treePages = getAllNodesNames($tree); $otherPages = array_diff($allPages, $treePages); if ($tree[$HomePage]) { $content = array(); $content[$HomePage] = $tree[$HomePage]; unset($tree[$HomePage]); $drawFrontPage = 1; } if (count($tree)) { $drawOutside = 1; } if (count($otherPages)) { $drawOther = 1; } print "<html>\n"; print "<head>\n"; print "<meta name=\"ROBOTS\" content=\"NOINDEX, NOFOLLOW\">\n"; print "<link rel=\"SHORTCUT ICON\" href=\"images/niti-logo.ico\">\n"; print "<title>Wiki Content</title>\n"; print "</head>\n"; print "<body>"; if (isset($drawFrontPage)) { print '<a href="#content">Wiki Content</a><br>'; } if (isset($drawOutside)) { print '<a href="#outside">Singletons, Lost Branches and Cycles</a><br>'; } if (isset($drawOther)) { print '<a href="#other">Other Mysterious Cases</a><br>'; } if (isset($drawFrontPage)) { print '<a name="content"><h3>Wiki Content</h3></a>'; drawTree($content, false, $page); } if (isset($drawOutside)) { print '<a name="outside"><h3>Singletons, Lost Branches and Cycles</h3></a>'; drawTree($tree, false, $page); } if (isset($drawOther)) { print '<a name="other"><h3>Other Mysterious Cases</h3></a>'; foreach ($otherPages as $page) { print html_ref($page, $page) . '<br>'; } } print '<h3>Bad Parenting</h3>'; ob_flush(); $pages = $pagestore->getAllPageNames(); $found = 0; foreach ($pages as $page) { $backlinks = $pagestore->getBacklinks($page); $parents = $pagestore->getParents($page); foreach ($parents as $parent) { if (!in_array($parent, $backlinks)) { print '<a href="?action=backlinks&page=' . rawurlencode($page) . '">' . htmlspecialchars($page) . '</a> -- ' . htmlspecialchars($parent) . '<br>'; ob_flush(); $found = 1; } } } if (!$found) { print 'None'; } print '</body></html>'; }
function view_macro_refs() { global $pagestore, $LkTbl, $PgTbl; $text = ''; $first = 1; // It's not quite as straightforward as one would imagine to turn the // following code into a JOIN, since we want to avoid multiplying the // number of links to a page by the number of versions of that page that // exist. If anyone has some efficient suggestions, I'd be welcome to // entertain them. -- ScottMoonen $q1 = $pagestore->dbh->query("SELECT link, SUM(count) AS ct FROM {$LkTbl} " . "GROUP BY link ORDER BY ct DESC, link"); while ($result = $pagestore->dbh->result($q1)) { $esc_page = addslashes($result[0]); $q2 = $pagestore->dbh->query("SELECT MAX(version) FROM {$PgTbl} " . "WHERE title='{$esc_page}'"); if (($r2 = $pagestore->dbh->result($q2)) && !empty($r2[0])) { if (!$first) { $text = $text . "\n"; } else { $first = 0; } $text = $text . '(' . html_url(findURL($result[0]), $result[1]) . ') ' . html_ref($result[0], $result[0]); } } return html_code($text); }
function template_common_epilogue($args) { global $AdditionalFooter, $AllowAnonymousPosts, $EmailSuffix; global $EnableSubscriptions, $EnableCaptcha, $HomePage, $NickName, $page; global $pagestore, $PageTooLongLen, $PrefsScript, $UserName; $pg = $pagestore->page($page); $pagetext = $pg->text; if (isset($args["toolbar"])) { ?> <div class="toolbar" id="toolbar-bottom"><?php toolbar($page, $args); ?> </div> <?php } ?> </div> <NOINDEX> <div id="footer" class="printhide"> <div id="logininfo"> <?php if ($UserName) { print "Logged in as " . html_ref($UserName, $UserName); } else { print "Not <a href=\"login/?{$page}\">logged in</a>"; } if ($EnableSubscriptions && isset($EmailSuffix) && $UserName != '' && isset($args['subscribe']) && !empty($args['subscribe'])) { if ($pg->isSubscribed($UserName)) { $caption = 'Unsubscribe'; } else { $caption = 'Subscribe'; } print ' | <a href="' . pageSubscribeURL($args['subscribe']) . '">' . $caption . '</a>'; } if (!$UserName) { print ' | <a href="' . viewURL($page) . '&view_source=1">View source</a>'; } print "<br>"; print html_ref('RecentChanges', 'RecentChanges') . ', ' . '<a href="' . $PrefsScript . '">UserOptions</a>'; $help_page = $pagestore->page('HelpPage'); if ($help_page->exists()) { print ', ' . html_ref('HelpPage', 'HelpPage'); } ?> </div> <div id="comment"> <?php if (!in_array($page, array($HomePage, 'RecentChanges')) && ($UserName || $AllowAnonymousPosts)) { ?> <script language="javascript"> <!-- function epilogue_quickadd_validate(form) { if (form.quickadd.value == '') { alert('Please provide content for the text field.'); return false; } else if (form.validationcode && form.validationcode.value == '') { alert('The validation code is required.'); return false; } else { return true; } } //--> </script> <?php if ($args['edit']) { if ($args['page_length'] > $PageTooLongLen) { print '<div style="color:red;font-weight:bold">' . 'This page is too long. Comments are disabled.</div>'; } else { global $document; $document = $pg->read(); $document = str_replace('"', "\\\\'", $document); ?> <form method="post" action="<?php print saveURL($page); ?> "> <div class="form"> <input type="hidden" name="Save" value="1"> <input type="hidden" name="appending" value="1"> <?php if (!strcasecmp($page, 'annoyingquote') || !strcasecmp($page, 'accumulatedwisdom')) { // Tweaked "Add a Comment" for AnnoyingQuote page ?> <input type="hidden" name="comment" value="Add a Quote"> <input type="hidden" name="appendingQuote" value="1"> <table width="100%"> <tr valign="bottom"> <td align="right">Quote: </td> <td nowrap><textarea name="quickadd" rows="2" wrap="virtual"></textarea></td> </tr> <tr valign="bottom"> <td width="1%" align="right">Author: </td> <td width="99%" nowrap><input class="fullWidth" type="text" name="quoteAuthor" size="20" value=""></td> </tr> </table> <?php if (!$UserName && $EnableCaptcha) { print_captcha_box(); } ?> <input type="submit" name="append" value="Add a Quote" onClick="return epilogue_quickadd_validate(this.form)"> <?php } else { // Standard Add a Comment print '<input type="hidden" name="comment" value="Comment">'; print '<textarea name="quickadd" rows="4" cols="20">'; print "----\n'''"; if ($UserName) { print "[{$UserName}]"; } else { if ($NickName) { print htmlspecialchars($NickName); } else { print "Anonymous@" . $_SERVER["REMOTE_ADDR"]; } } print " (" . date('Y/m/d') . ")''': "; print "</textarea>\n"; if (!$UserName) { if ($EnableCaptcha) { print_captcha_box(); } if (!$NickName) { print '(Anonymous users, see <a href="' . $PrefsScript . '">UserOptions</a> to set a nickname.) '; } } print '<input type="submit" name="append" value="Add a Comment" onClick="return epilogue_quickadd_validate(this.form)">'; } ?> </div> </form> <?php } } ?> <?php } ?> </div> <div id="timestamp"> <?php if (isset($args['timestamp'])) { print '<i>Last edited ' . html_time($args['timestamp']); if ($args['timestamp'] != '') { if (isset($args['euser']) && $args['euser']) { print ' by ' . $args['euser']; } else { print ' anonymously'; } } } if (isset($args['twin']) && $args['twin'] != '') { if (count($twin = $pagestore->twinpages($args['twin']))) { print '<br>See twins of this page: '; for ($i = 0; $i < count($twin); $i++) { print html_twin($twin[$i][0], $twin[$i][1]) . ' '; } } } ?> </div> <?php if ($AdditionalFooter) { include $AdditionalFooter; } ?> </div> </NOINDEX> </body> </html> <?php }
function template_conflict($args) { global $categories, $comment, $EditCols, $EditRows, $MaxPostLen, $minoredit; global $PrefsScript, $ShowCategoryBox, $template, $UserName; template_common_prologue(array('norobots' => 1, 'title' => 'Editing ' . $args['page'], 'heading' => 'Editing ', 'headlink' => $args['page'], 'headsufx' => '', 'toolbar' => 1, 'button_selected' => '', 'button_view' => 1, 'timestamp' => $args['timestamp'], 'button_backlinks' => 1)); if ($args['merge']) { $conflictDoc = $args['merge']; $editBoxTitle = 'Merged Version With Conflicts'; $conflictWarning = 'Please merge the conflicts marked with brackets ' . 'in the box below.'; } else { $conflictDoc = $args['text']; $editBoxTitle = 'Current Version'; $conflictWarning = 'Please merge your edits into the current version ' . 'of this document.'; } ?> <div id="body"> <p class="warning"> <b>Warning! Since you started editing, this document has been changed by someone else. <?php print $conflictWarning; ?> </b> </p> <h1><?php print $editBoxTitle; ?> </h1> <form method="post" action="<?php print saveURL($args['page']); ?> "> <input type="hidden" name="pagesizelimit" value="<?php echo $MaxPostLen; ?> "> <div class="form"> <input type="submit" name="Save" value="Save" onClick="return sizeLimitCheck(this.form, 'document');"> <input type="submit" name="Preview" value="Preview" onClick="return sizeLimitCheck(this.form, 'document');"> <?php if ($UserName != '') { print 'Your user name is ' . html_ref($UserName, $UserName); } else { ?> Visit <a href="<?php print $PrefsScript; ?> ">Preferences</a> to set your user name<?php } ?> <br /> <input type="hidden" name="nextver" value="<?php print $args['nextver']; ?> " /> <textarea name="document" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $conflictDoc)); ?> </textarea><br /> <?php print '<input id="minoredit" type="checkbox" name="minoredit" value="1"'; if ($minoredit) { print ' CHECKED'; } print '><label for="minoredit">Minor edit</label> '; print '<input id="template" type="checkbox" name="template" value="1"'; if ($template) { print ' CHECKED'; } print '><label for="template">This page is a template</label> '; ?> <br> Summary of change: <input type="text" name="comment" size="40" maxlength="80" value="" /> <?php if ($ShowCategoryBox) { ?> <br /> Add document to category: <input type="text" name="categories" size="40" value="" /> <?php } ?> <?php if (!$args['merge']) { ?> <hr /> <h1>Your changes</h1> <textarea name="discard" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $args['usertext'])); ?> </textarea><br /> <?php } ?> </div> </form> <h1>Preview of Current Version</h1> <?php print $args['html']; ?> </div> <?php template_common_epilogue(array('twin' => $args['page'], 'edit' => '', 'editver' => 0, 'history' => $args['page'], 'timestamp' => $args['timestamp'], 'headlink' => $args['page'], 'button_selected' => '', 'button_view' => 1, 'button_backlinks' => 1)); }
function parse($args, $page) { global $CoTbl, $DiffScript, $HistMax, $pagestore, $PgTbl; static $overrides = array(); require_once 'lib/diff.php'; if (preg_match_all('/\\s*(\\d+)\\s(.*)/', $args, $words)) { $overrides[$words[1][0]] = $words[2][0]; return; } $dbName = str_replace('\\', '\\\\', $page); $dbName = str_replace('\'', '\\\'', $dbName); $filter = trim(strtolower($args)) != 'all'; $qry = "\r\n SELECT version, date_format(time, '%Y-%m-%d %H:%i:%s') time,\r\n minoredit, username, comment, lastversion\r\n FROM {$PgTbl}\r\n INNER JOIN {$CoTbl} ON page = id\r\n WHERE title = '{$dbName}'\r\n ORDER BY version"; $rs = $pagestore->dbh->query($qry); $history = array(); while ($row = $pagestore->dbh->result($rs)) { $row[1] = strtotime($row[1]); $history[$row[0]] = $row; if (isset($overrides[$row[0]])) { $history[$row[0]][4] = $overrides[$row[0]]; $history[$row[0]][2] = 2; // sets as an override } } $minVer = min(array_keys($history)); $maxVer = max(array_keys($history)); $return = "<table>\n"; $return .= "<tr><td><b>Date</b></td><td><b>Version</b></td>" . "<td><b>Description</b></td><td><b>Author</b></td></tr>\n"; foreach ($history as $row) { if ($row[0] > 1 && $filter && $this->filterRow($row)) { continue; } $date = date('Y-m-d', $row[1]); if ($row[0] > $minVer) { $ver1 = $row[0] - 1; $ver2 = $row[0]; if ($filter && $row[0] > 1) { // finds additional contiguous edits of the same author // that are filtered out but within 24 hours later $username = $history[$row[0]][3]; $time = $history[$row[0]][1]; while ($ver2 < $maxVer) { $nextTime = $history[$ver2 + 1][1]; if ($history[$ver2 + 1][3] == $username && $this->filterRow($history[$ver2 + 1]) && $nextTime - $time <= 86400) { $ver2++; } else { break; } } } $versionUrl = $DiffScript . '&page=' . $page . '&' . 'ver1=' . $ver1 . '&ver2=' . $ver2; if ($row[5] - $ver1 + 1 > $HistMax) { $versionUrl .= '&full=1'; } } else { $versionUrl = viewUrl($page, $row[0]); } $version = '<div align="right"><a href="' . $versionUrl . '">' . $row[0] . '</a> </div>'; $comment = $row[4]; if ($row[2] == 1) { $comment = '<small><i>(minor edit)</i></small> ' . $comment; } $author = $row[3] ? html_ref($row[3], $row[3]) : ''; $return .= '<tr>'; $return .= '<td>' . $date . '</td>'; $return .= '<td>' . $version . '</td>'; $return .= '<td>' . $comment . '</td>'; $return .= '<td>' . $author . '</td>'; $return .= "</tr>\n"; } $return .= '</table>'; return $return; }
function template_backlinks($args) { template_common_prologue(array('norobots' => 1, 'title' => 'Backlinks of ' . $args['page'], 'heading' => 'Backlinks of ', 'headlink' => $args['page'], 'headsufx' => '', 'toolbar' => 1, 'tree' => 1, 'button_selected' => 'backlinks', 'button_view' => 1, 'timestamp' => $args['timestamp'], 'editver' => $args['editver'], 'button_backlinks' => 1)); global $pagestore, $UserName; $page = $args['page']; $backlinks = $args['backlinks']; $parents = $args['parents']; $form_action = $UserName ? reparentURL($page) : '?'; ?> <div class="content"> <?php if ($args['haschildren']) { ?> <p>See <a href="<?php echo childrenURL($page); ?> ">children of <?php echo $page; ?> </a>. <?php } else { ?> <p>No children exist for <?php echo $page; ?> . <?php } ?> <form name="reparentForm" action="<?php print $form_action; ?> " method="POST"> <div class="form"> <p> <?php print html_ref($page, $page); ?> is linked on the following pages: <p> <table cellspacing="0" cellpadding="0" border="0"> <tr class="backlinksHeader"> <td><b>Parent?</b></td> <td> </td> <td><b>Backlink</b></td> </tr> <?php foreach ($backlinks as $backlink) { if ($backlink != $page) { if (in_array($backlink, $parents)) { $checked = " checked"; } else { $checked = ""; } print '<tr>'; print '<td align="center"><input type="checkbox" name="parents[]" value="' . $backlink . '"' . $checked . '></td>'; print '<td> </td>'; print '<td>' . html_ref($backlink, $backlink) . '</td>'; print '</tr>'; } } ?> </table> </p> <?php $tempText = ''; foreach ($parents as $parent) { if (!in_array($parent, $backlinks)) { $tempText .= '<tr>'; $tempText .= '<td align="center"><input type="checkbox" name="parents[]" value="' . $parent . '" checked></td>'; $tempText .= '<td> </td>'; $tempText .= '<td>' . html_ref($parent, $parent) . '</td>'; $tempText .= '</tr>'; } } if ($tempText) { print html_ref($page, $page) . ' is NOT linked on the following pages but is still referring to them as parents:'; print '<p>'; print '<table cellspacing="0" cellpadding="0" border="0">'; print '<tr class="notBacklinksHeader">'; print '<td><b>Parent?</b></td>'; print '<td> </td>'; print '<td><b>Not backlink</b></td>'; print '</tr>'; print $tempText; print '</table>'; print '</p>'; } ?> <?php if ($UserName) { ?> <p> <input type="submit" name="reparentButton" value="Reparent"> </p> <?php } ?> </div> </form> </div> <?php template_common_epilogue(array('twin' => '', 'edit' => '', 'editver' => 0, 'history' => '', 'euser' => $args['edituser'], 'timestamp' => $args['timestamp'], 'toolbar' => 1, 'headlink' => $args['page'], 'button_selected' => 'backlinks', 'button_view' => 1, 'button_backlinks' => 1)); }
function template_preview($args) { global $categories, $comment, $EditCols, $EditRows, $EnableWordDiff; global $MaxPostLen, $PrefsScript, $ShowCategoryBox, $UserName; $section_title = $args['section'] ? 'section of ' : ''; template_common_prologue(array('norobots' => 1, 'title' => 'Previewing ' . $section_title . $args['page'], 'heading' => 'Previewing ' . $section_title, 'headlink' => $args['page'], 'headsufx' => '', 'tree' => 1, 'toolbar' => 1, 'button_selected' => '', 'button_view' => 1, 'timestamp' => $args['timestamp'], 'button_backlinks' => 1)); if ($args['diff_mode'] == 1) { $regular_diff_checked = ''; $word_diff_checked = ' checked'; } else { $regular_diff_checked = ' checked'; $word_diff_checked = ''; } ?> <div class="editform"> <form method="post" action="<?php print saveURL($args['page']); ?> "> <input type="hidden" name="pagesizelimit" value="<?php echo $MaxPostLen; ?> "> <input type="hidden" name="nextver" value="<?php print $args['nextver']; ?> "> <input type="hidden" name="pagefrom" value="<?php print $args['pagefrom']; ?> "> <input type="hidden" name="section" value="<?php print intval($args['section']); ?> "> <input type="hidden" name="text_before" value="<?php print htmlspecialchars($args['text_before']); ?> "> <input type="hidden" name="text_after" value="<?php print htmlspecialchars($args['text_after']); ?> "> <?php if ($args['archive']) { ?> <input type="hidden" name="archive" value="1" /> <?php } ?> <textarea name="document" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $args['text'])); ?> </textarea> <p> <?php print '<input id="minoredit" type="checkbox" name="minoredit" value="1"'; if ($args['minoredit']) { print ' CHECKED'; } print '><label for="minoredit">Minor edit</label> '; print '<input id="template" type="checkbox" name="template" value="1"'; if ($args['template']) { print ' CHECKED'; } print '><label for="template">This page is a template</label> '; ?> <p> Summary of change: <input type="text" name="comment" size="40" maxlength="80" value="<?php print htmlspecialchars($comment); ?> " /><br /> <?php if ($ShowCategoryBox) { ?> Add document to category: <input type="text" name="categories" size="40" value="<?php print htmlspecialchars($categories); ?> " /><br /> <?php } ?> <p> <input type="submit" name="Save" value="Save" onClick="return sizeLimitCheck(this.form, 'document', 'text_before', 'text_after');"> <input type="submit" name="Preview" value="Preview" onClick="return sizeLimitCheck(this.form, 'document', 'text_before', 'text_after');"> <?php if ($UserName != '') { print 'Your user name is ' . html_ref($UserName, $UserName); } else { ?> Visit <a href="<?php print $PrefsScript; ?> ">Preferences</a> to set your user name<?php } if ($args['diff']) { ?> | <a href="#changes">View changes in this edit</a> <?php } ?> <div class="content"> <h1>Preview</h1> <hr /> <?php print $args['html']; ?> </div> <br> <strong>Confirm changes to above document?</strong><br> <input type="submit" name="Save" value="Save" onClick="return sizeLimitCheck(this.form.document);"> <input type="submit" name="Preview" value="Preview" onClick="return sizeLimitCheck(this.form.document);"> <p> <?php if ($args['diff']) { ?> <a name="changes"></a> <div class="content"> <h1>Changes in this edit</h1><p> <?php if ($EnableWordDiff) { ?> Diff method: <input type="radio" id="regular_diff" name="diff_mode" value="0"<?php echo $regular_diff_checked; ?> ><label for="regular_diff">Regular diff</label> <input type="radio" id="word_diff" name="diff_mode" value="1"<?php echo $word_diff_checked; ?> ><label for="word_diff">Word diff</label> <?php } ?> <?php if ($args['diff']) { print '<div class="diff">' . $args['diff'] . '</div>'; } else { print 'There were no changes made in this edit.'; } ?> </div> <?php } ?> </div> </form> <?php template_common_epilogue(array('twin' => $args['page'], 'edit' => '', 'editver' => -1, 'history' => $args['page'], 'euser' => $args['edituser'], 'timestamp' => $args['timestamp'], 'headlink' => $args['page'], 'button_selected' => '', 'button_view' => 1, 'button_backlinks' => 1)); }
function template_edit($args) { global $EditRows, $EditCols, $UserName, $PrefsScript; template_common_prologue(array('norobots' => 1, 'title' => TMPL_Editing . ' ' . $args['page'], 'heading' => TMPL_Editing . ' ', 'headlink' => $args['page'], 'headsufx' => '', 'toolbar' => 1)); ?> <div id="body"> <form method="post" action="<?php print saveURL($args['page']); ?> "> <div class="form"> <input type="submit" name="Save" value="<?php echo TMPL_ButtonSave; ?> " /> <input type="submit" name="Preview" value="<?php echo TMPL_ButtonPreview; ?> " /> <?php if ($UserName != '') { print TMPL_YourUsername . ' ' . html_ref($UserName, $UserName); } else { echo TMPL_VisitPrefs . "\n"; } ?> <br /> <input type="hidden" name="nextver" value="<?php print $args['nextver']; ?> " /> <?php if ($args['archive']) { ?> <input type="hidden" name="archive" value="1" /> <?php } ?> <textarea name="document" rows="<?php print $EditRows; ?> " cols="<?php print $EditCols; ?> " wrap="virtual"><?php print str_replace('<', '<', str_replace('&', '&', $args['text'])); ?> </textarea><br /> <?php echo TMPL_SummaryOfChange; ?> <input type="text" name="comment" size="40" value="" /><br /> <?php echo TMPL_AddToCategory; ?> <input type="text" name="categories" size="40" value="" /> </div> </form> </div> <?php template_common_epilogue(array('twin' => $args['page'], 'edit' => '', 'editver' => '', 'history' => $args['page'], 'timestamp' => $args['timestamp'], 'nosearch' => 0)); }
function template_edit($args) { global $EditCols, $EditRows, $MaxPostLen, $PrefsScript, $ShowCategoryBox; global $UserName; $section_title = $args['section'] ? 'section of ' : ''; template_common_prologue(array('norobots' => 1, 'title' => 'Editing ' . $section_title . $args['page'], 'heading' => 'Editing ' . $section_title, 'headlink' => $args['page'], 'headsufx' => '', 'tree' => 1, 'toolbar' => 1, 'button_selected' => 'edit', 'button_view' => 1, 'timestamp' => $args['timestamp'], 'editver' => $args['editver'], 'button_backlinks' => 1)); ?> <div class="editform"> <form method="post" action="<?php print saveURL($args['page']); ?> "> <input type="hidden" name="pagesizelimit" value="<?php echo $MaxPostLen; ?> "> <input type="hidden" name="nextver" value="<?php print $args['nextver']; ?> "> <input type="hidden" name="pagefrom" value="<?php print $args['pagefrom']; ?> "> <input type="hidden" name="section" value="<?php print intval($args['section']); ?> "> <input type="hidden" name="text_before" value="<?php print htmlspecialchars($args['text_before']); ?> "> <input type="hidden" name="text_after" value="<?php print htmlspecialchars($args['text_after']); ?> "> <?php if ($args['archive']) { print '<input type="hidden" name="archive" value="1">'; } ?> <div class="form"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td> </td> <td align="right"> </td> </tr> </table> <?php print "<textarea name=\"document\" rows=\"{$EditRows}\" cols=\"{$EditCols}\" wrap=\"virtual\">"; print htmlspecialchars($args['text']); print '</textarea>'; ?> <br> <div align=right> <?php if ($args['templates'] && !$args['section']) { print 'Templates: <select name="templateName">' . "\n"; print '<option value="">-- Select a template --' . "\n"; foreach ($args['templates'] as $template_name) { print '<option value="' . htmlspecialchars($template_name) . '"'; if ($template_name == $args['use_template']) { print ' selected'; } print '>' . htmlspecialchars($template_name) . "\n"; } print '</select>' . "\n"; $js_page = str_replace('\\', '\\\\', $args['page']); $js_page = str_replace('\'', '\\\'', $js_page); print '<input type="button" name="useTemplateButton" value="Use" ' . 'onClick="useTemplate(this.form.templateName, ' . "'{$js_page}'" . ')">' . "\n"; } ?> </div> <?php $minorEditChecked = substr($args['page'], -8) == 'Schedule' ? ' checked' : ''; print '<input id="minoredit" type="checkbox" name="minoredit" value="1"' . $minorEditChecked . '><label for="minoredit">Minor edit</label> '; print '<input id="template" type="checkbox" name="template" value="1"' . ($args['template'] ? ' checked' : '') . '>' . '<label for="template">This page is a template</label> '; ?> <p> Summary of change: <input type="text" name="comment" size="40" maxlength="80" value=""><br> <?php if ($ShowCategoryBox) { ?> Add document to category: <input type="text" name="categories" size="40" value=""><br> <?php } ?> <p> <input type="submit" name="Save" value="Save" onClick="return sizeLimitCheck(this.form, 'document', 'text_before', 'text_after');"> <input type="submit" name="Preview" value="Preview" onClick="return sizeLimitCheck(this.form, 'document', 'text_before', 'text_after');"> <?php if ($UserName != '') { print 'Your user name is ' . html_ref($UserName, $UserName); } else { print "Visit <a href=\"{$PrefsScript}\">Preferences</a> to set your user name"; } ?> <br> </div> <!-- Class form --> </form> </div> <!-- Body --> <?php template_common_epilogue(array('twin' => $args['page'], 'history' => $args['page'], 'euser' => $args['edituser'], 'timestamp' => $args['timestamp'], 'headlink' => $args['page'], 'button_selected' => 'edit', 'button_view' => 1, 'editver' => $args['editver'], 'button_backlinks' => 1)); }
function html_history_entry($page, $version, $time, $host, $user, $c1, $c2, $comment) { return "<tr><td>" . "<input type=\"radio\" name=\"ver1\" value=\"{$version}\"" . ($c1 ? ' checked="checked"' : '') . " /></td>\n" . " <td>" . "<input type=\"radio\" name=\"ver2\" value=\"{$version}\"" . ($c2 ? ' checked="checked"' : '') . " /></td>\n" . "<td><a href=\"" . viewURL($page, $version) . "\">" . html_time($time) . "</a> . . . . " . ($user == '' ? $host : html_ref($user, $user, $host)) . ($comment == '' ? '' : ' ' . html_bold_start() . '[' . str_replace('<', '<', str_replace('&', '&', $comment)) . ']' . html_bold_end()) . "</td></tr>\n"; }