about summary refs log tree commit diff stats
path: root/central/trunk/includes/instadisc.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-06 21:42:34 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-06 21:42:34 +0000
commitfe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0 (patch)
treeef4aca9adde8522de8d3e6f56107045be00799f1 /central/trunk/includes/instadisc.php
parent0b80d600e22ac218a59e1c09967a3caee91b1981 (diff)
downloadinstadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.gz
instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.tar.bz2
instadisc-fe678d3e0ed345aa5edbc9dd0ae98faa7cc322c0.zip
Central: Started moving to Series
Refs #28
Diffstat (limited to 'central/trunk/includes/instadisc.php')
-rw-r--r--central/trunk/includes/instadisc.php142
1 files changed, 0 insertions, 142 deletions
diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index d00893b..3f3922a 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php
@@ -271,148 +271,6 @@ function instaDisc_getConfig($key)
271 return $getconfig3['value']; 271 return $getconfig3['value'];
272} 272}
273 273
274function instaDisc_listSubscriptions($username)
275{
276 $getsubs = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND owner = \"true\"";
277 $getsubs2 = mysql_query($getsubs);
278 $i=0;
279 while ($getsubs3[$i] = mysql_fetch_array($getsubs2))
280 {
281 $subs[$i] = $getsubs3[$i]['url'];
282
283 $i++;
284 }
285
286 $subs['size'] = $i;
287 return $subs;
288}
289
290function instaDisc_addSubscription($username, $url)
291{
292 $getcode = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\"";
293 $getcode2 = mysql_query($getcode);
294 $getcode3 = mysql_fetch_array($getcode2);
295 if ($getcode3['username'] == $username)
296 {
297 $c = curl_init();
298 curl_setopt($c, CURLOPT_URL, $url);
299 curl_setopt($c, CURLOPT_HEADER, false);
300 curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
301 $page_data = curl_exec($c);
302 curl_close($c);
303
304 $headers = split("\n", $page_data);
305 foreach ($headers as $name => $value)
306 {
307 $header = split(": ", $value);
308 $headerMap[$header[0]] = $header[1];
309 }
310
311 if (isset($headerMap['Subscription']))
312 {
313 if (isset($headerMap['Title']))
314 {
315 if (isset($headerMap['Category']))
316 {
317 if (isset($headerMap['Key']))
318 {
319 if ($headerMap['Key'] == $getcode3['code'])
320 {
321 $inssub = "INSERT INTO subscriptions (username,url,owner,category) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($headerMap['Subscription']) . "\", \"true\", \"" . mysql_real_escape_string($headerMap['Category']) . "\")";
322 $inssub2 = mysql_query($inssub);
323
324 $delcode = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\"";
325 $delcode2 = mysql_query($delcode);
326
327 return 0;
328 } else {
329 return 4;
330 }
331 } else {
332 return 3;
333 }
334 } else {
335 return 3;
336 }
337 } else {
338 return 3;
339 }
340 } else {
341 return 3;
342 }
343 } else {
344 return 2;
345 }
346
347 return 1;
348}
349
350function instaDisc_listPendingSubscriptions($username)
351{
352 $getsubs = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\"";
353 $getsubs2 = mysql_query($getsubs);
354 $i=0;
355 while ($getsubs3[$i] = mysql_fetch_array($getsubs2))
356 {
357 $subs[$i] = array('url' => $getsubs3[$i]['url'], 'code' => $getsubs3[$i]['code']);
358
359 $i++;
360 }
361
362 $subs['size'] = $i;
363 return $subs;
364}
365
366function instaDisc_generateSubscriptionActivation($username, $url)
367{
368 $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\"";
369 $getuser2 = mysql_query($getuser);
370 $getuser3 = mysql_fetch_array($getuser2);
371 if ($getuser3['username'] == $username)
372 {
373 $key = md5(rand(1,2147483647));
374
375 $inspending = "INSERT INTO pending2 (username, url, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($url) . "\", \"" . mysql_real_escape_string($key) . "\")";
376 $inspending2 = mysql_query($inspending);
377
378 return $key;
379 }
380
381 return false;
382}
383
384function instaDisc_deleteSubscription($username, $url)
385{
386 $getsub = "SELECT * FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")";
387 $getsub2 = mysql_query($getsub);
388 $getsub3 = mysql_fetch_array($getsub2);
389 if ($getsub3['username'] == $username)
390 {
391 $delsub = "DELETE FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")";
392 $delsub2 = mysql_query($delsub);
393
394 return true;
395 }
396
397 return false;
398}
399
400function instaDisc_cancelSubscription($username, $url)
401{
402 $getsub = "SELECT * FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")";
403 $getsub2 = mysql_query($getsub);
404 $getsub3 = mysql_fetch_array($getsub2);
405 if ($getsub3['username'] == $username)
406 {
407 $delsub = "DELETE FROM pending2 WHERE username = \"" . mysql_real_escape_string($username) . "\" AND url = \"" . mysql_real_escape_string($url) . "\")";
408 $delsub2 = mysql_query($delsub);
409
410 return true;
411 }
412
413 return false;
414}
415
416function instaDisc_changePassword($username, $password) 274function instaDisc_changePassword($username, $password)
417{ 275{
418 $setpass = "UPDATE users WHERE username = \"" . mysql_real_escape_string($username) . "\" SET password = \"" . mysql_real_escape_string(md5($password)) . "\""; 276 $setpass = "UPDATE users WHERE username = \"" . mysql_real_escape_string($username) . "\" SET password = \"" . mysql_real_escape_string(md5($password)) . "\"";