示例#1
0
 $ok = false;
 if ($submit && !$just_logged_in) {
     if ($name == "" or $description == "") {
         $feedback = "Please name your policy, and give a definition.";
     } else {
         $db = new DB();
         $ret = $db->query_errcheck("insert into pw_dyn_dreammp (name, user_id, description, private) values\n                ('{$name}', '" . user_getid() . "', '{$description}', 2)");
         if ($ret) {
             $new_dreamid = mysql_insert_id();
             $ok = true;
             $feedback = "Successfully made new policy <a href=\"/policy.php?id={$new_dreamid}\">" . html_scrub($name) . "</a>.  To \n                    select votes for your new policy, <a href=\"../search.php\">search</a> or\n                    <a href=\"../divisions.php\">browse</a> for divisions.  On the page for\n                    each division you can choose how somebody supporting your policy would have voted.";
             if (user_getid()) {
                 $db->query("update pw_dyn_user set active_policy_id = {$new_dreamid} where user_id = " . user_getid());
             }
             audit_log("Added new policy '" . $name . "'");
             dream_post_forum_action($db, $new_dreamid, "Created brand new policy.\n\n[b]New Policy:[/b] [url=http://www.publicwhip.org.uk/policy.php?id=" . $new_dreamid . "]" . stripslashes($name) . "[/url]\n[b]Definition:[/b] " . stripslashes($description));
         } else {
             $feedback = "Failed to add new policy. " . mysql_error();
         }
     }
 }
 $title = "Make a new policy";
 pw_header();
 if ($feedback && !$just_logged_in) {
     if ($ok) {
         echo "<p>{$feedback}</p>";
     } else {
         echo "<div class=\"error\"><h2>Creating a new policy not complete, please try again\n                </h2><p>{$feedback}</div>";
     }
 } else {
     ?>
示例#2
0
    //}
    print "</div>";
    print "</p>";
}
if ($dismode["discussion"]) {
    pw_header();
    print '<h1>Sorry, discussions currently disabled</h1>';
    pw_footer();
    disabled('policy.php discussion');
    exit;
    $discuss_url = dream_post_forum_link($db, $dreamid);
    if (!$discuss_url) {
        // First time someone logged in comes along, add policy to the forum
        global $domain_name;
        if (user_getid()) {
            dream_post_forum_action($db, $dreamid, "Policy introduced to forum.\n\n[b]Name:[/b] [url=http://{$domain_name}/policy.php?id=" . $dreamid . "]" . $policyname . "[/url]\n[b]Definition:[/b] " . $voter['description']);
            $discuss_url = dream_post_forum_link($db, $dreamid);
        } else {
            $discuss_url = 'http://' . $domain_name . '/forum/viewforum.php?f=1';
        }
    }
    if ($discuss_url) {
        print '<iframe src="' . htmlspecialchars($discuss_url) . '" width="100%" height="10000" scrolling="no">';
        print '<a href="' . htmlspecialchars($discuss_url) . '">Click here for discussion</a>';
        print '</iframe>';
    }
}
if ($dismode["editdefinition"]) {
    pw_header();
    print '<h1>Sorry, edit definition currently disabled</h1>';
    pw_footer();