-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathFloatQuote.php
More file actions
117 lines (96 loc) · 2.9 KB
/
Copy pathFloatQuote.php
File metadata and controls
117 lines (96 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php $page_title = ' Quote Float'; ?>
<?php
$nav_selected = "LIST";
$left_buttons = "NO";
$left_selected = "";
require 'db_credentials.php';
include("./nav.php");
include("puzzlemaker.php");
include("rebuild-puzzle-form.php");
?>
<?php
error_reporting(0);
include_once 'db_credentials.php';
$sql = "SELECT * FROM quote_table
WHERE id = '-1'";
$flagged = true;
$spaces = array();
$touched = isset($_POST['ident']);
$db->set_charset("utf8");
if (!$touched) {
echo 'You need to select an entry. Go back and try again. <br>';
?>
<button><a class="btn btn-sm" href="admin.php">Go back</a></button>
<?php
} else {
$id = $_POST['ident'];
$sql = "SELECT * FROM quote_table
WHERE id = '$id'";
}
if (!$result = $db->query($sql)) {
die('There was an error running query[' . $connection->error . ']');
}
$norows = 16;
?>
<script type="text/javascript" src="js/html2canvas.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<form id="columnnumber_form" method="post">
<input type="submit" name="generate" id="generate" value="Generate" id="generate">
<!-- Width dropdown selector, default value is 10 -->
<label for="width">Columns:</label>
<select name="width" id="width" autocomplete="off">
<?php
if (isset($_POST['width'])) {
$width = $_POST['width'];
} else {
$width = get_preference('DEFAULT_COLUMN_COUNT');
if (is_null($width)) {
// if no datbase preference for width exists, default value is 16
$width = "12";
}
}
for ($i = 8; $i <= 13; $i++) {
echo '<option value="' . $i . '"' . (($i == $width) ? ' selected' : '' ) .'>' . $i . '</option>';
}
?>
</select>
<?php
echo '<input type="hidden" name="ident" value="'.$_POST["ident"].'"> ';
?>
</form>
<div id="convert-to-image">
<?php
echo '<h2 id="title">Float Quote</h2><br>';
$punctuation=TRUE;
$sqx = "SELECT * FROM preferences WHERE name = 'KEEP_PUNCTUATION_MARKS'";
$resultPunct = mysqli_query($db,$sqx);
while ($rowPunct =mysqli_fetch_array($resultPunct)){
$punctuation=$rowPunct["value"];
}
if (isset($_POST['width'])) {
$width = $_POST['width'];
} else {
$width = get_preference('DEFAULT_COLUMN_COUNT');
if (is_null($width)) {
// if no datbase preference for width exists, default value is 16
$width = "12";
}
}
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$quoteline = $row["quote"];
//makes an array from the line
}
}
if (isset($quoteline) == false){
exit(0);
}
else {
if ($punctuation == "FALSE"){
$quoteline = str_replace(['?', '!', "'", '.', '-', ';', ':', '[', ']',
',', '/','{', '}', ')', '('], '', $quoteline);
}
FloatMaker($quoteline, $width);
}
?>
</div>