function draw_category($category) { $args = queryString(queryConstruct(array('view' => 'category', 'category' => $category['path']), array('categoryview'), array('referendum_search_'))); echo "<dt><a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$category['title']} ({$category['type']})</a></dt>\n"; echo "<dd>\n"; echo "{$category['text']}"; draw_category_list($category['children']); echo "</dd>\n"; }
function drawSelectCategoryView($view, $title, $reset = array(), $resetpattern = array()) { $url = $_SERVER["SCRIPT_NAME"] . "?" . queryString(queryConstruct(array('categoryview' => $view), $reset, $resetpattern)); $cls = 'viewmenu_non_current'; if ($_GET["categoryview"] == $view) { $cls = 'viewmenu_current'; } return "<a class='viewmenu {$cls}' href='{$url}'>{$title}</a>"; }
function drawSelectView($view, $title) { $url = $_SERVER["SCRIPT_NAME"] . "?" . queryString(queryConstruct(array('view' => $view))); $cls = 'menu_non_current'; if ($_GET["view"] == $view) { $cls = 'menu_current'; } return "<a class='menu {$cls}' href='{$url}'>{$title}</a>"; }
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ if (isset($_POST['save_login'])) { $username = pg_escape_string($_POST['login_user']); $row = pg_fetch_row(pg_query($dbconn, "select u.id, u.password from \"user\" as u where u.username='******'")) or die("You don't exist, go away."); if ($row[1] != md5($_POST['login_password'])) { die("You don't exist, go away."); } $_SESSION['user'] = $row[0]; header("Status: 303 See Other"); header("Location: " . $_SERVER["SCRIPT_NAME"] . '?' . queryString(queryConstruct(array('view' => 'categories')))); exit(1); } if (isset($_POST['save_logout'])) { session_start(); session_unset(); header("Status: 303 See Other"); header("Location: " . $_SERVER["SCRIPT_NAME"] . '?' . queryString(queryConstruct(array('view' => 'login')))); exit(1); }
function drawPrevNextPage($len, $page_start, $page_len, $page_start_name, $page_len_name) { $first = T_("First"); $prev = T_("Previous"); $next = T_("Next"); $last = T_("Last"); if ($page_start > 0) { $args = queryString(queryConstruct(array($page_start_name => 0))); $first = "<a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$first}</a>"; $newstart = $page_start - $page_len; if ($newstart <= 0) { $newstart = 0; } $args = queryString(queryConstruct(array($page_start_name => $newstart))); $prev = "<a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$prev}</a>"; } if ($page_start + $page_len < $len) { $args = queryString(queryConstruct(array($page_start_name => $page_start + $page_len))); $next = "<a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$next}</a>"; $args = queryString(queryConstruct(array($page_start_name => $len - $page_len))); $last = "<a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$last}</a>"; } return sprintf(T_("<div class='nextprevpage'>" . " <span class='prevpage'>" . " %s %s" . " </span>" . " <span class='nextpage'>" . " %s %s" . " </span>" . "</div>"), $first, $prev, $next, $last); }
Copyright (C) 2006 RedHog (Egil Möller) <*****@*****.**> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ?> <h2><?php E_("Sub-categories"); ?> </h2> <ul> <?php foreach ($subcategories as $category) { $args = queryString(queryConstruct(array('category' => $category_path_connect . $category), array('categoryview'), array('referendum_search_'))); echo "<li><a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$category}</a></li>"; } ?> </ul>
foreach (array_reverse($para['sub']) as $sub) { paraToSql($sub); } foreach (array_reverse($para['next']) as $next) { paraToSql($next); } } foreach (array_reverse($para_root) as $root) { paraToSql($root); } } } } $sql .= "end;"; pg_query($dbconn, $sql) or die('Unable to add referendum: ' . pg_last_error()); $row = pg_fetch_row(pg_query($dbconn, "select currval('referendum_id_seq');")) or die('Unable to fetch id of new referendum: ' . pg_last_error()); $referendum = $row[0]; if (in_array('vote', $_SESSION['privs'])) { $sql = "select cast_vote('{$referendum}', '{$_SESSION['user']}', '1');"; pg_query($dbconn, $sql) or die(T_('Unable to insert vote: ') . pg_last_error()); $messages .= "<div>" . sprintf(T_("Vote registered for referendum %s"), $referendum) . "</div>"; } $referendumurl = $_SERVER["SCRIPT_NAME"] . '?' . queryString(queryConstruct(array('view' => 'category', 'categoryview' => 'referendums', 'referendum_search_status__1_list' => 'on', 'referendum_search_status__0_list' => 'on', 'referendum_search_status__-1_list' => 'on', 'referendum_search_referendum_lower' => $referendum, 'referendum_search_referendum_upper' => $referendum, 'expanded_referendums' => $referendum), array(), array('referendum_search_'))); if (isset($fudinc)) { $fudid = fud_new_topic(sprintf(T_("%s:%s: %s"), $category_path, $referendum, $_POST['new_referendum_title']), sprintf("<h1><a href='%s' target='_blank'>" . T_("%s:%s: %s") . "</a></h1>" . T_("This thread is for discussions on the above DemoWave administered referendum."), $referendumurl, $category_path, $referendum, $_POST['new_referendum_title']), 3, $fuduser, $fudforum); pg_query($dbconn, "insert into referendum_fud (referendum, fudid) values('{$referendum}', '{$fudid}')") or die('Unable to add referendum FUDfudforum topic: ' . pg_last_error()); } header("Status: 303 See Other"); header("Location: " . $referendumurl); exit(1); }
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ?> <form action="<?php echo $_SERVER["SCRIPT_NAME"] . '?' . queryString(queryConstruct()); ?> " method="post" enctype="multipart/form-data"> <?php echo "<h2>" . T_("Name") . "</h2>\n"; echo "<table>\n"; echo drawInputRow(T_("Username"), $user_username); echo drawInputRow(T_("Given name"), "<input name='user_givenname' type='text' value='{$user_givenname}' />"); echo drawInputRow(T_("Surname"), "<input name='user_surname' type='text' value='{$user_surname}' />"); echo "</table>\n"; echo "<h2>" . T_("Password") . "</h2>\n"; echo "<table>\n"; echo drawInputRow(T_("New password"), "<input name='user_password1' type='password' />"); echo drawInputRow(T_("Retype password"), "<input name='user_password2' type='password' />"); echo "</table>\n"; ?>
} } } echo " </td>" . "</tr>"; } } if ($category_type == "law") { $proposals = array(); if (isset($_GET["law_proposal"]) && $_GET["law_proposal"]) { $proposals = explode(',', $_GET["law_proposal"]); } foreach ($referendums as $attr) { $proposals[] = $attr['referendum']; } $proposals = implode(",", $proposals); $url = '?' . queryString(queryConstruct(array('categoryview' => 'law', 'law_show__deleted_list' => 'on', 'law_date' => $attr['completed'], 'law_show__referendum_list' => '1', 'law_proposal' => $proposals))); ?> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td><?php printf("<a href='%s'>%s</a>\n", $url, T_("Law view")); ?> </td></tr> <?php } if ($_GET['categoryview'] == 'referendums') { ?> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="submit" name="save_referendums_vote" value="<?php E_("Cast votes"); ?> "></td></tr> <?php }
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ if ($is_category) { ?> <?php if (array_get($_GET, 'search_referendums_show', '')) { $status = "heading_expanded"; $args = queryString(queryConstruct(array(), array('search_referendums_show'))); } else { $status = "heading_collapsed"; $args = queryString(queryConstruct(array('search_referendums_show' => '1'), array())); } $title = T_("Search for referendums"); echo "<h2 class='{$status}'><a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$title}</a></h2>"; if (array_get($_GET, 'search_referendums_show', '')) { ?> <form action="<?php echo $_SERVER["SCRIPT_NAME"]; ?> " method="get" enctype="multipart/url-encoded"> <?php foreach ($_GET as $key => $value) { if (!beginsWith($key, 'referendum_search_')) { echo "<input name='{$key}' value='{$value}' type='hidden'>\n"; } }
} if (isset($node['path'])) { printf("<input\n\t class='law_edit_insert'\n\t name='law_edit_insert_%s'\n\t type='submit'\n\t value='Insert new paragraph after %s' />\n\t ", $node['path'], $node['path']); echo "</div>\n"; } } ?> <form method="post" enctype="multipart/form-data"> <input type='hidden' name='law_edit_continue' value='yes' /> <table class="law_importexport"> <?php echo drawInputRow(T_("Import from file"), "<input name='law_import_file' type='file'>"); echo drawInputRow('', "<input name='law_import' type='submit' value='" . T_("Import") . "'>"); $lawexporturl = '?' . queryString(queryConstruct(array('categoryview' => 'laweditor', 'format' => 'export', 'law_edit_continue' => 'yes'))); echo drawInputRow(T_("Export to file"), "<a href='{$lawexporturl}' target='demowave-export'>" . T_("Export") . "</a>"); ?> </table> <table> <?php $title = array_get($_SESSION["laweditor"], "title", ""); echo drawInputRow(T_("Change summary"), "<input type='text' name='law_title' value='{$title}' />"); echo drawInputRow('', "<input name='law_save' type='submit' value='" . T_("Save changes") . "'>"); ?> </table> <h3><?php E_("Contents"); ?>
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ ?> <span class="categorypath"> <?php if ($_GET["category"] == '') { $items = array(); } else { $items = explode('.', $_GET["category"]); } $res = array(); $subpath = array(); $args = queryString(queryConstruct(array('category' => ''), array('categoryview'), array('referendum_search_'))); $res = array("<span><a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>" . T_("Top") . "</a></span>\n"); foreach ($items as $item) { $subpath[] = $item; $args = queryString(queryConstruct(array('category' => implode('.', $subpath)), array('categoryview'), array('referendum_search_'))); $res[] = "<span><a href='{$_SERVER["SCRIPT_NAME"]}?{$args}'>{$item}</a></span>\n"; } echo implode(' >> ', $res); ?> </span>
function drawLawParagraph($level, $node) { if (isset($node['add']) && ($node['add'] == 't' || $_GET["law_show__deleted_list"])) { if (isset($_GET["law_show__referendum_list"])) { $dateurl = '?' . queryString(queryConstruct(array('law_date' => $node['changed'], 'law_proposal' => $node['referendum']))); $refurl = '?' . queryString(queryConstruct(array('view' => 'category', 'categoryview' => 'referendums', 'referendum_search_status__1_list' => 'on', 'referendum_search_status__0_list' => 'on', 'referendum_search_status__-1_list' => 'on', 'referendum_search_referendum_lower' => $node['referendum'], 'referendum_search_referendum_upper' => $node['referendum'], 'expanded_referendums' => $node['referendum']), array(), array('referendum_search_'))); printf("<div class='law_info law_info_%s'>", $this->referendumIntern($node['referendum'])); if ($node['changed'] == 'infinity') { printf("Proposed in: <a href='%s'>%s: %s</a><br />\n\t ", $refurl, $node['referendum'], $node['reftitle']); } else { if ($node['passed'] == 't') { printf("Last changed: <a href='%s'>%s</a><br />\n Changed by: <a href='%s'>%s: %s</a><br />\n \t ", $dateurl, $node['changed'], $refurl, $node['referendum'], $node['reftitle']); } else { printf("Rejected: <a href='%s'>%s</a><br />\n \t Proposed in: <a href='%s'>%s: %s</a><br />\n ", $dateurl, $node['changed'], $refurl, $node['referendum'], $node['reftitle']); } } printf("</div>"); } if ($node['add'] != 't' || $node['title'] != '' || isset($_GET["law_show__referendum_list"])) { if ($node['add'] == 't') { $title = sprintf(T_("%s: %s"), $node['path'], $node['title']); $cls = 'law_head_added'; } else { $title = sprintf(T_("Paragraph deleted: %s"), $node['path']); $cls = 'law_head_deleted'; } $refurl = '?' . queryString(queryConstruct(array('view' => 'category', 'categoryview' => 'referendums', 'referendum_search_status__1_list' => 'on', 'referendum_search_status__0_list' => 'on', 'referendum_search_status__-1_list' => 'on', 'referendum_search_path_multimatch' => $node['path']), array(), array('referendum_search_'))); printf(T_("<h%s class='law_head law_head_%s %s'><a href='%s'>%s</a></h%s>\n"), $level, $level, $cls, $refurl, $title, $level); } $node_text = $node['text']; // regexp change §para.para.para to a intra-document-link // regexp change §document.document/para.para.para to an inter-document-link if ($node['add'] == 't') { if ($node['title'] != '' || isset($_GET["law_show__referendum_list"])) { printf("<div class='law_text'>%s</div>", $node_text); } else { printf("<div class='law_text'><em>%s:</em> %s</div>", $node['path'], $node_text); } } } }
<input type="submit" name="search_referendumsglobal" value="<?php E_("Search"); ?> "> </form> <?php printf("<h2>" . T_("Referendums found in %s categories") . "</h2>\n", $globalreferendums_len); echo "<table class='list'>\n"; echo "<tr>\n"; echo drawSortHeader($globalreferendums_sort, 'globalreferendums_sort', 'path', T_('Category')); echo drawSortHeader($globalreferendums_sort, 'globalreferendums_sort', 'referendums', T_('Matches')); echo "</tr>\n"; foreach ($globalreferendums as $attr) { $args = array('view' => 'category', 'category' => $attr['path']); foreach ($_GET as $key => $value) { if (beginsWith($key, 'globalreferendum_')) { $args['referendum_' . substr($key, strlen('globalreferendum_'))] = $value; } } $url = $_SERVER["SCRIPT_NAME"] . "?" . queryString(queryConstruct($args, array(), array('globalreferendum_', 'referendum_'))); $title = $attr['path']; if ($title) { $title = 'Top.' . $title; } else { $title = 'Top'; } echo "<tr class='list_item list_item_collapsed list_item_globalreferendums'>\n" . " <td><a href='{$url}'>{$title}</a></td>\n" . " <td><a href='{$url}'>{$attr['referendums']}</a></td>\n" . "</tr>\n"; } echo "</table>\n"; echo drawPrevNextPage($globalreferendums_len, $globalreferendum_page_start, $globalreferendum_page_len, 'globalreferendum_page_start', 'globalreferendum_page_len');