2 include_once('../slack.php');
3 include_once('security.php');
4 if ($_COOKIE['level'] == 'user'){
5 slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
6 header('Location: user_home.php');
8 include_once('header.php');
9 slack_general('ADMIN: petition manager Loaded ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
10 $group_id = $_COOKIE['group_id'];
12 if(empty($_POST['petition_id']) && isset($_POST['petition_name']) ){ // new
13 $web_short_name = $petition->real_escape_string($_POST['web_short_name']);
14 $web_color = $petition->real_escape_string($_POST['web_color']);
15 $petition_name = $petition->real_escape_string($_POST['petition_name']);
16 $petition->query("insert into petitions (web_short_name,web_color,group_id,petition_name) values ('$web_short_name','$web_color','$group_id','$petition_name') ");
17 header('Location: petitions.php');
19 if(isset($_POST['petition_id']) && isset($_POST['petition_name']) ){ // edit
20 $petition_id = $petition->real_escape_string($_POST['petition_id']);
21 $web_short_name = $petition->real_escape_string($_POST['web_short_name']);
22 $web_color = $petition->real_escape_string($_POST['web_color']);
23 $web_color_text = $petition->real_escape_string($_POST['web_color_text']);
24 $petition_name = $petition->real_escape_string($_POST['petition_name']);
25 $petition_sign_text_box = $petition->real_escape_string($_POST['petition_sign_text_box']);
26 $petition_circulator_text_box = $petition->real_escape_string($_POST['petition_circulator_text_box']);
27 $eligibleVoterListWarning = $petition->real_escape_string($_POST['eligibleVoterListWarning']);
28 $eligibleVoterListEnforce = $petition->real_escape_string($_POST['eligibleVoterListEnforce']);
29 $eligibleVoterListField = strtoupper($petition->real_escape_string($_POST['eligibleVoterListField']));
30 $eligibleVoterListEquals = $petition->real_escape_string($_POST['eligibleVoterListEquals']);
31 $eligibleVoterSigMatch = $petition->real_escape_string($_POST['eligibleVoterSigMatch']);
32 $signature_goal = $petition->real_escape_string($_POST['signature_goal']);
34 // custom landing page - paid feature one day?
35 $tab_name = $petition->real_escape_string($_POST['tab_name']);
36 $text_title = $petition->real_escape_string($_POST['text_title']);
37 $text_block = $petition->real_escape_string($_POST['text_block']);
38 $logo_url = $petition->real_escape_string($_POST['logo_url']);
40 $petition->query("update petitions set web_color_text='$web_color_text', signature_goal='$signature_goal', logo_url='$logo_url', text_block='$text_block', text_title='$text_title', tab_name='$tab_name', eligibleVoterSigMatch='$eligibleVoterSigMatch', eligibleVoterListWarning='$eligibleVoterListWarning', web_short_name='$web_short_name', web_color='$web_color', petition_name='$petition_name', petition_sign_text_box='$petition_sign_text_box', petition_circulator_text_box='$petition_circulator_text_box', eligibleVoterListEnforce='$eligibleVoterListEnforce', eligibleVoterListField='$eligibleVoterListField', eligibleVoterListEquals='$eligibleVoterListEquals' where petition_id = '$petition_id' ");
41 header('Location: petitions.php');
46 if($_COOKIE['level'] == 'admin'){
47 $q="SELECT * FROM petitions";
49 $q="SELECT * FROM petitions where group_id = '$group_id'";
51 $r = $petition->query($q);
52 while($d = mysqli_fetch_array($r)){
53 echo "<li><a href='?edit=$d[petition_id]'>EDIT</a> $d[admin_status] $d[web_short_name] $d[web_color] $d[group_id] $d[petition_name] $d[eligibleVoterListField] $d[eligibleVoterListEquals] $d[eligibleVoterListEnforce]</li>";
58 if (isset($_GET['edit'])){
59 $id = intval($_GET['edit']);
60 $q = "SELECT * FROM petitions where petition_id = '$id' ";
61 $r = $petition->query($q);
62 $d = mysqli_fetch_array($r);
64 <h1
>Edit Petition Setup
</h1
>
65 <h3
>Please keep whatever text you
use in a word
or google doc that you control
, copy
and paste here
.</h3
>
67 <input type
='hidden' name
='petition_id' value
='<?PHP echo $id;?>'>
69 <tr
><td
><b
>Required
</b
></td
><td
> 
;</td
></tr
>
70 <tr
><td
>Web Short Name
*</td
><td
><input name
='web_short_name' value
='<?PHP echo $d['web_short_name
'];?>' required
></td
></tr
>
71 <tr
><td
>Web Color Background
</td
><td
><input type
="color" name
='web_color' value
='<?PHP echo $d['web_color
'];?>' required
></td
></tr
>
72 <tr
><td
>Web Color Text
</td
><td
><input type
="color" name
='web_color_text' value
='<?PHP echo $d['web_color_text
'];?>' required
></td
></tr
>
73 <tr
><td
>Petition Name
</td
><td
><input name
='petition_name' value
='<?PHP echo $d['petition_name
'];?>' required
></td
></tr
>
74 <tr
><td
>Petition Sign Text Box
</td
><td
><textarea rows
='5' cols
='50' name
='petition_sign_text_box' required
><?PHP
echo $d['petition_sign_text_box'];?
></textarea
></td
></tr
>
75 <tr
><td
>Petition Circulator Text Box
</td
><td
><textarea rows
='5' cols
='50' name
='petition_circulator_text_box' required
><?PHP
echo $d['petition_circulator_text_box'];?
></textarea
></td
></tr
>
76 <tr
><td
>eligibleVoterList Enforce
</td
><td
><select name
='eligibleVoterListEnforce'><option
><?PHP
echo $d['eligibleVoterListEnforce'];?
></option
><option
>NO
</option
><option
>YES
</option
></select
></td
></tr
>
77 <tr
><td
>eligibleVoterList Field
</td
><td
><input name
='eligibleVoterListField' value
='<?PHP echo $d['eligibleVoterListField
'];?>' required
></td
></tr
>
78 <tr
><td
>eligibleVoterList Equals
</td
><td
><input name
='eligibleVoterListEquals' value
="<?PHP echo $d['eligibleVoterListEquals'];?>" required
></td
></tr
>
79 <tr
><td
>eligibleVoterList Warning
</td
><td
><textarea rows
='5' cols
='50' name
='eligibleVoterListWarning' required
><?PHP
echo $d['eligibleVoterListWarning'];?
></textarea
></td
></tr
>
80 <tr
><td
>VoterList Signature Match Required
</td
><td
><select name
='eligibleVoterSigMatch' required
><option
><?PHP
echo $d['eligibleVoterSigMatch'];?
></option
><option
>NO
</option
><option
>YES
</option
></select
></td
></tr
>
81 <tr
><td
><b
>Not Required
</b
></td
><td
> 
;</td
></tr
>
82 <tr
><td
>Signature Goal
</td
><td
><input name
='signature_goal' value
="<?PHP echo $d['signature_goal'];?>"></td
></tr
>
83 <tr
><td
>Landing Page Title
</td
><td
><input name
='tab_name' value
="<?PHP echo $d['tab_name'];?>"></td
></tr
>
84 <tr
><td
>Landing Page Header
</td
><td
><input name
='text_title' value
="<?PHP echo $d['text_title'];?>"></td
></tr
>
85 <tr
><td
>Landing Page Body
</td
><td
><textarea rows
='5' cols
='50' name
='text_block'><?PHP
echo $d['text_block'];?
></textarea
></td
></tr
>
86 <tr
><td
>Logo URL
</td
><td
><input name
='logo_url' value
="<?PHP echo $d['logo_url'];?>"></td
></tr
>
90 <tr
><td
></td
><td
><input type
='submit'></td
></tr
>
93 * changes may
break already sent invites
!
100 web_short_name
<input name
='web_short_name' required
>
101 web_color
<input type
="color" name
='web_color' required
>
102 petition_name
<input name
='petition_name' required
>
103 <input type
='submit'>
107 include_once('footer.php');