about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--update/sfgen/trunk/index.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/update/sfgen/trunk/index.php b/update/sfgen/trunk/index.php new file mode 100644 index 0000000..fd9f241 --- /dev/null +++ b/update/sfgen/trunk/index.php
@@ -0,0 +1,71 @@
1<?php
2
3/**
4* InstaDisc Update (SF Generator) - A Four Island Project
5*
6* This is the InstaDisc SF Generator (part of the Update component),
7* which creates a Subscription File for you. For more information on
8* how to use this, please see:
9*
10* @url http://instadisc.org/Subscription_File_Generator
11*/
12
13/**
14* CONFIGURATION - You MUST edit this for the SF Generator to work
15*/
16$idusTitle = ''; // Subscription Title
17$idusCategory = ''; // Subscription Category
18$idusPassword = ''; // Encryption Keyword (OPTIONAL)
19
20/* END CONFIGURATION - Do NOT edit below this point */
21
22if ($idusTitle == '')
23{
24 die('$idusTitle is unset, please set it to your Subscription\'s Title');
25}
26
27if ($idusCategory == '')
28{
29 die('$idusCategory is unset, please set it to your Subscription\'s Category');
30}
31
32$idusSubscriptionURL = 'http://' . $_SERVER['SERVER_NAME'] . '/' . $idusCategory . '/' . generateSlug($idusTitle) . '/';
33
34echo('<DIV STYLE="display: none">: ' . "\n");
35echo('Subscription: ' . $idusSubscriptionURL . "\n");
36echo('Title: ' . $idusTitle . "\n");
37echo('Category: ' . $idusCategory . "\n");
38
39if (($idusPassword != '') && extension_loaded('mcrypt'))
40{
41 $verID = rand(1,2147483647);
42
43 echo('Verification: ' . md5($idusTitle . ':' . md5($idusPassword) . ':' . $verID) . "\n");
44 echo('Verification-ID: ' . $verID . "\n");
45}
46
47echo('End: </DIV><DIV STYLE="margin: 0 auto; margin-top: 5em; width: 500px; background-color: #FBEC5D; text-align: center; padding: 4px;"><B>This is an InstaDisc Subscription file.</B><P>If you would like to subscribe to the InstaDisc subscription:<BR><I>' . $idusTitle . '</I> (<U>' . $idusCategory . '</U>)<BR>Copy the address of this file to the "Add Subscription" form on your InstaDisc client.</DIV>' . "\n");
48
49if (($idusPassword != '') && extension_loaded('mcrypt'))
50{
51 echo('<!--Notice: --><CENTER><B>Please note that this is an <I>encrypted</I> subscription.</B><BR>To subscribe to it, you must know its password.</CENTER>' . "\n");
52}
53
54function generateSlug($title)
55{
56 $title = preg_replace('/[^A-Za-z0-9]/','-',$title);
57 $title = preg_replace('/-{2,}/','-',$title);
58 if (substr($title,0,1) == '-')
59 {
60 $title = substr($title,1);
61 }
62 if (substr($title,strlen($title)-1,1) == '-')
63 {
64 $title = substr($title,0,strlen($title)-1);
65 }
66 $title = strtolower($title);
67
68 return($title);
69}
70
71?>