예제 #1
0
         $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;
             $feedback = "Successfully edited policy '" . html_scrub($name) . "'.  \n                     To see the changes, go to <a href=\"../policy.php?id={$dreamid}\">the\n                     policy's page</a>.";
             audit_log("Edited definition policy '" . $name . "'");
         } else {
             $feedback = "Failed to edit policy. " . mysql_error();
         }
     }
 } elseif ($submiteditpolicy) {
     $feedback = "Cancelled";
     $ok = true;
     # redirect on cancel
 }
 if ($ok) {
     header("Location: /policy.php?id={$dreamid}\n");
예제 #2
0
function copy_vote_subset($db, $id_from, $id_to, $date_start, $date_end = "9999-12-31")
{
    $db->query("delete from pw_dyn_dreamvote where dream_id = {$id_to}");
    $db->query("insert into pw_dyn_dreamvote \n                    (division_date, division_number, dream_id, vote, house)\n                select division_date, division_number, {$id_to}, vote, house\n                       from pw_dyn_dreamvote where dream_id = {$id_from}\n                       and division_date > \"{$date_start}\"\n                       and division_date < \"{$date_end}\"");
    notify_dream_mp_updated($db, $id_to);
}