Пример #1
0
 } elseif (policy_totally_frozen($dreamid)) {
     $feedback = "<p>This policy is being used on TheyWorkForYou during the Election campaign. Please contact us if you think it needs editing.";
 } elseif ($submiteditpolicy && !$just_logged_in && $submiteditpolicy == 'Save') {
     if ($name == "" or $description == "") {
         $feedback = "Please name the policy, and give a definition.";
     } else {
         if ($legacy_dream) {
             $new_private = 1;
         } else {
             $new_private = $form_provisional ? 2 : 0;
         }
         $db = new DB();
         list($prev_name, $prev_description) = $db->query_one_row("select name, description from pw_dyn_dreammp where dream_id = '{$dreamid}'");
         $name_diff = format_linediff($prev_name, stripslashes($name), false);
         # always have link
         $description_diff = format_linediff($prev_description, $description, true);
         dream_post_forum_action($db, $dreamid, "Changed name and/or definition of policy.\n\n[b]Name:[/b] " . $name_diff . "\n[b]Definition:[/b] " . $description_diff);
         if ($new_private != $private) {
             if ($new_private == 0) {
                 $new_private_name = "public";
             } elseif ($new_private == 1) {
                 $new_private_name = "legacy Dream MP";
             } elseif ($new_private == 2) {
                 $new_private_name = "provisional";
             }
             dream_post_forum_action($db, $dreamid, "Policy is now [b]" . $new_private_name . "[/b]");
         }
         $ret = $db->query_errcheck("update pw_dyn_dreammp set name='{$name}', description='" . mysql_real_escape_string($description) . "', private='" . $new_private . "' where dream_id='{$dreamid}'");
         notify_dream_mp_updated($db, intval($dreamid));
         if ($ret) {
             $ok = true;
Пример #2
0
$db->query($query);
$rows = array();
while ($row = $db->fetch_row_assoc()) {
    //    print "<p><pre>";print_r($previous);print "</pre></p>";
    $row['previous'] = $previous[$row['division_date'] . "-" . $row['division_number'] . "-" . $row['house']];
    array_unshift($rows, $row);
    $previous[$row['division_date'] . "-" . $row['division_number'] . "-" . $row['house']] = $row['text_body'];
}
//   print "<p><pre>";print_r($previous);print "</pre></p>";
$prettyrow = 0;
foreach ($rows as $row) {
    $prettyrow = pretty_row_start($prettyrow);
    print "<td valign=\"top\" width=\"16%\">";
    if ($type == 'motion') {
        print "<a href=\"division.php?date=" . $row['division_date'] . "&number=" . $row['division_number'] . "&house=" . $row['house'] . "\">" . $row['house'] . " vote " . $row['division_date'] . "#" . $row['division_number'] . "</a>";
    } else {
        print "wikiid" . $row['wiki_id'];
    }
    print "<p>Edited by " . pretty_user_name($db, html_scrub($row['user_name']));
    print "<p>on " . $row['edit_date'] . "\n";
    print "</td>";
    $marked_text_diff = format_linediff(extract_motion_text_from_wiki_text($row['previous']), extract_motion_text_from_wiki_text($row['text_body']), true);
    $marked_title_diff = format_linediff(extract_title_from_wiki_text($row['previous']), extract_title_from_wiki_text($row['text_body']), false);
    print "<td>" . "<b>" . $marked_title_diff . "</b><br>" . $marked_text_diff . "</td>";
    print "</td></tr>";
}
print "</table>\n";
?>

<?php 
pw_footer();
Пример #3
0
 $debate_gid = str_replace("uk.org.publicwhip/lords/", "", $debate_gid);
 if ($type == "motion") {
     $motion_data = get_wiki_current_value($db, "motion", array($params[0], $params[1], $params[2]));
     $prev_name = extract_title_from_wiki_text($motion_data['text_body']);
     $prev_description = extract_motion_text_from_wiki_text($motion_data['text_body']);
     $prev_description_editable = extract_motion_text_from_wiki_text_for_edit($motion_data['text_body']);
 }
 if ($submit && !$just_logged_in) {
     if ($submit == "Save") {
         if ($type == 'motion') {
             $newtext = add_motion_missing_wrappers($newdescription, $newtitle);
             $curr_name = extract_title_from_wiki_text($newtext);
             $curr_description = extract_motion_text_from_wiki_text($newtext);
             $name_diff = format_linediff(trim($prev_name), trim($curr_name), false);
             # always have link
             $description_diff = format_linediff(trim($prev_description), trim($curr_description), true);
             # forum escapes <, > and the like already
             $description_diff = html_entity_decode(html_entity_decode($description_diff, ENT_QUOTES), ENT_QUOTES);
             $name_diff = html_entity_decode(html_entity_decode($name_diff, ENT_QUOTES), ENT_QUOTES);
             global $domain_name;
             divisionvote_post_forum_action($db, $params[0], $params[1], $params[2], "Changed title and/or description of division.\n\n[b]Title:[/b] " . "[url=http://{$domain_name}/division.php?date=" . $division_details['division_date'] . "&number=" . $division_details['division_number'] . "&house=" . $division_details['house'] . "]" . $name_diff . "[/url]\n[b]Description:[/b] " . $description_diff);
         }
         $db->query_errcheck("insert into pw_dyn_wiki_motion\n                (division_date, division_number, house, text_body, user_id, edit_date) values\n                ('{$params['0']}', '{$params['1']}', '{$params['2']}', '" . mysql_real_escape_string($newtext) . "', '" . user_getid() . "', now())");
         audit_log("Edited {$type} wiki text {$params['0']} {$params['1']} {$params['2']}");
         if ($type == 'motion') {
             notify_motion_updated($db, $params[0], $params[1], $params[2]);
         }
     }
     header("Location: " . $rr);
     exit;
 } else {