Commit | Line | Data |
---|---|---|
cd274349 | 1 | <?PHP |
ae1c5e9a | 2 | include_once('../slack.php'); |
cd274349 | 3 | include_once('security.php'); |
ae1c5e9a PM |
4 | if ($_COOKIE['level'] == 'user'){ |
5 | slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); | |
6 | header('Location: user_home.php'); | |
7 | } | |
cd274349 | 8 | include_once('header.php'); |
1f39b6e9 | 9 | slack_general('ADMIN: petition manager Loaded ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); |
989fe01d | 10 | $group_id = $_COOKIE['group_id']; |
f42a6a73 PM |
11 | |
12 | if(empty($_POST['petition_id']) && isset($_POST['petition_name']) ){ // new | |
13fdcaf5 PM |
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') "); | |
bcf7da66 | 17 | header('Location: petitions.php'); |
13fdcaf5 | 18 | } |
f42a6a73 PM |
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']); | |
fa81a0b4 | 23 | $web_color_text = $petition->real_escape_string($_POST['web_color_text']); |
f42a6a73 PM |
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']); | |
ac70bf85 | 27 | $eligibleVoterListWarning = $petition->real_escape_string($_POST['eligibleVoterListWarning']); |
f42a6a73 | 28 | $eligibleVoterListEnforce = $petition->real_escape_string($_POST['eligibleVoterListEnforce']); |
12718bbe | 29 | $eligibleVoterListField = strtoupper($petition->real_escape_string($_POST['eligibleVoterListField'])); |
f42a6a73 | 30 | $eligibleVoterListEquals = $petition->real_escape_string($_POST['eligibleVoterListEquals']); |
ed37724d | 31 | $eligibleVoterSigMatch = $petition->real_escape_string($_POST['eligibleVoterSigMatch']); |
80f79a87 PM |
32 | $signature_goal = $petition->real_escape_string($_POST['signature_goal']); |
33 | ||
6acb809a PM |
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']); | |
39 | ||
fa81a0b4 | 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' "); |
bcf7da66 | 41 | header('Location: petitions.php'); |
f42a6a73 | 42 | } |
cd274349 | 43 | ?> |
989fe01d PM |
44 | <h1>Petitions</h1> |
45 | <?PHP | |
a7049cc9 PM |
46 | if($_COOKIE['level'] == 'admin'){ |
47 | $q="SELECT * FROM petitions"; | |
48 | }else{ | |
49 | $q="SELECT * FROM petitions where group_id = '$group_id'"; | |
50 | } | |
989fe01d PM |
51 | $r = $petition->query($q); |
52 | while($d = mysqli_fetch_array($r)){ | |
f42a6a73 | 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>"; |
989fe01d PM |
54 | } |
55 | ?> | |
f42a6a73 PM |
56 | |
57 | <?PHP | |
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); | |
63 | ?> | |
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> | |
66 | <form method='post'> | |
67 | <input type='hidden' name='petition_id' value='<?PHP echo $id;?>'> | |
3c0df38c | 68 | <table> |
6acb809a | 69 | <tr><td><b>Required</b></td><td> </td></tr> |
d326d17c | 70 | <tr><td>Web Short Name*</td><td><input name='web_short_name' value='<?PHP echo $d['web_short_name'];?>' required></td></tr> |
537a5199 | 71 | <tr><td>Web Color Background</td><td><input type="color" name='web_color' value='<?PHP echo $d['web_color'];?>' required></td></tr> |
55efd604 | 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> |
d326d17c PM |
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> | |
c3d9820a | 78 | <tr><td>eligibleVoterList Equals</td><td><input name='eligibleVoterListEquals' value="<?PHP echo $d['eligibleVoterListEquals'];?>" required></td></tr> |
ac70bf85 | 79 | <tr><td>eligibleVoterList Warning</td><td><textarea rows='5' cols='50' name='eligibleVoterListWarning' required><?PHP echo $d['eligibleVoterListWarning'];?></textarea></td></tr> |
b7832255 | 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> |
6acb809a | 81 | <tr><td><b>Not Required</b></td><td> </td></tr> |
614c3c74 | 82 | <tr><td>Signature Goal</td><td><input name='signature_goal' value="<?PHP echo $d['signature_goal'];?>"></td></tr> |
6acb809a PM |
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> | |
87 | ||
88 | ||
89 | ||
90 | <tr><td></td><td><input type='submit'></td></tr> | |
3c0df38c | 91 | </table> |
f42a6a73 PM |
92 | </form> |
93 | * changes may break already sent invites! | |
94 | ||
95 | <?PHP | |
96 | } | |
97 | ?> | |
13fdcaf5 PM |
98 | <h1>New Petition</h1> |
99 | <form method='post'> | |
100 | web_short_name <input name='web_short_name' required> | |
80f79a87 | 101 | web_color <input type="color" name='web_color' required> |
13fdcaf5 PM |
102 | petition_name <input name='petition_name' required> |
103 | <input type='submit'> | |
104 | </form> | |
1a9f9d8d | 105 | <br><br><br> |
cd274349 PM |
106 | <?PHP |
107 | include_once('footer.php'); | |
108 | ?> |