diff options
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/functions_quotes.php | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/includes/functions_quotes.php b/includes/functions_quotes.php deleted file mode 100755 index 7469152..0000000 --- a/includes/functions_quotes.php +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/functions_quotes.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | function quote_generation($query, $origin, $page = 1, $quote_limit = 50, $page_limit = 10) | ||
26 | { | ||
27 | $template = new FITemplate('quotes/browse'); | ||
28 | if ($page != -1) | ||
29 | { | ||
30 | $template->adds_block('PAGENUMBERS',array('exi'=>1)); | ||
31 | page_numbers($template, $origin, $quote_limit, $page, $page_limit); | ||
32 | $up_lim = ($quote_limit * $page); | ||
33 | $low_lim = $up_lim - $quote_limit; | ||
34 | $query .= "LIMIT $low_lim,$quote_limit"; | ||
35 | } | ||
36 | $template->add('ORIGIN',$origin); | ||
37 | |||
38 | $getquotes2 = mysql_query($query); | ||
39 | $i=0; | ||
40 | while ($getquotes3[$i] = mysql_fetch_array($getquotes2)) | ||
41 | { | ||
42 | $template->adds_block('QUOTES',array( 'NUMBER' => $getquotes3[$i]['id'], | ||
43 | 'RATING' => $getquotes3[$i]['rating'], | ||
44 | 'QUOTE' => parseSmilies(nl2br(stripslashes($getquotes3[$i]['quote']))))); | ||
45 | |||
46 | $i++; | ||
47 | } | ||
48 | |||
49 | $template->display(); | ||
50 | } | ||
51 | |||
52 | function page_numbers($template, $origin, $quote_limit, $page_default, $page_limit) | ||
53 | { | ||
54 | $numrows = countRows('rash_quotes'); | ||
55 | $testrows = $numrows; | ||
56 | $pagenum = (($testrows + 1) / ($quote_limit > 0 ? $quote_limit : 1)); | ||
57 | |||
58 | if (($page_limit % 2)) | ||
59 | { | ||
60 | $page_limit++; | ||
61 | } | ||
62 | if (($page_limit < 2) || (!$page_limit)) | ||
63 | { | ||
64 | $page_limit = 5; | ||
65 | } | ||
66 | |||
67 | $pagebase = 0; | ||
68 | do | ||
69 | { | ||
70 | $pagebase++; | ||
71 | $page_limit -= 2; | ||
72 | } while ($page_limit > 1); | ||
73 | |||
74 | $template->add('LORIGIN',strtolower($origin)); | ||
75 | $template->add('MINUSTEN',(($page_default - 10) > 1) ? ($page_default - 10) : 1); | ||
76 | |||
77 | if ($page_default - $pagebase > 1) | ||
78 | { | ||
79 | $template->add('BDDD','...'); | ||
80 | } | ||
81 | |||
82 | $i = $page_default - $pagebase; | ||
83 | do | ||
84 | { | ||
85 | if ($i > 0) | ||
86 | { | ||
87 | $template->adds_block('BPAGES',array('PAGENUM' => $i)); | ||
88 | } | ||
89 | $i++; | ||
90 | } while ($i < $page_default); | ||
91 | |||
92 | $template->add('CURPAGE',$page_default); | ||
93 | |||
94 | $i = $page_default + 1; | ||
95 | do | ||
96 | { | ||
97 | if ($i <= $pagenum) | ||
98 | { | ||
99 | $template->adds_block('APAGES',array('PAGENUM' => $i)); | ||
100 | } | ||
101 | $i++; | ||
102 | } while ($i < ($page_default + $pagebase + 1)); | ||
103 | |||
104 | if (($page_default + $pagebase) < $pagenum) | ||
105 | { | ||
106 | $template->add('ADDD','...'); | ||
107 | } | ||
108 | |||
109 | $template->add('PLUSTEN',(($page_default + 10) < $pagenum) ? ($page_default + 10) : $pagenum); | ||
110 | $template->add('LASTPAGE',$pagenum); | ||
111 | } | ||
112 | |||
113 | function user_quote_status($where, $quote_num, $template) | ||
114 | { | ||
115 | $tracking_verdict = ip_track($where, $quote_num); | ||
116 | if ($where != 'flag') | ||
117 | { | ||
118 | switch ($tracking_verdict) | ||
119 | { | ||
120 | case 1: | ||
121 | $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); | ||
122 | break; | ||
123 | case 2: | ||
124 | $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); | ||
125 | break; | ||
126 | case 3: | ||
127 | $template->add('TRACKING',"You have already voted on this quote, please try again later."); | ||
128 | break; | ||
129 | } | ||
130 | } | ||
131 | return $tracking_verdict; | ||
132 | } | ||
133 | |||
134 | function ip_track($where, $quote_num) | ||
135 | { | ||
136 | switch ($where) | ||
137 | { | ||
138 | case 'flag': | ||
139 | $where2 = 'vote'; | ||
140 | break; | ||
141 | case 'vote': | ||
142 | $where2 = 'flag'; | ||
143 | break; | ||
144 | } | ||
145 | |||
146 | $getip = "SELECT * FROM rash_tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
147 | $getip2 = mysql_query($getip); | ||
148 | $getip3 = mysql_fetch_array($getip2); | ||
149 | |||
150 | if ($getip3['ip'] == $_SERVER['REMOTE_ADDR']) | ||
151 | { | ||
152 | $quote_array = explode(",", $getip3['quote_id']); | ||
153 | $quote_place = array_search($quote_num, $quote_array); | ||
154 | if (in_array($quote_num, $quote_array)) | ||
155 | { | ||
156 | $where_result = explode(",", $getip3[$where]); | ||
157 | if (!isset($where_result[$quote_place])) | ||
158 | { | ||
159 | $where_result[$quote_place] = 1; | ||
160 | $where_result = implode(",", $where_result); | ||
161 | $setip = "UPDATE rash_tracking SET " . $where . " = \"" . $where_result . "\" WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
162 | $setip2 = mysql_query($getip); | ||
163 | return 1; | ||
164 | } else { | ||
165 | return 3; | ||
166 | } | ||
167 | } else { | ||
168 | $setip = "UPDATE rash_tracking SET " . $where . " = CONCAT(" . $where . ",\",1\"), " . $where2 . " = CONCAT(" . $where2 . ",\",0\"), quote_id = CONCAT(quote_id,\"," . $quote_num . "\") WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
169 | $setip2 = mysql_query($setip); | ||
170 | return 1; | ||
171 | } | ||
172 | } else { | ||
173 | $insip = "INSERT INTO rash_tracking (ip, quote_id, " . $where . ", " . $where2 . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\", \"" . $quote_num . "\", 1, 0)"; | ||
174 | $insip2 = mysql_query($insip); | ||
175 | return 2; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | function verify_int($subject) | ||
180 | { | ||
181 | $ymax = strlen($subject); | ||
182 | $y = 0; | ||
183 | while($y < $ymax) | ||
184 | { | ||
185 | if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) | ||
186 | { | ||
187 | $y++; | ||
188 | } else { | ||
189 | return false; | ||
190 | } | ||
191 | } | ||
192 | return true; | ||
193 | } | ||
194 | |||
195 | ?> | ||