diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-30 01:56:40 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-30 01:56:40 +0000 |
commit | 912c0cfdc2e5f103f10b2a5e15541b8e69f80753 (patch) | |
tree | eb5344a13e56a722a502510831b945d309c51f3b /update/sfgen | |
parent | d3f8ec21b897b2d410a618ef8ed1105508d039ca (diff) | |
download | instadisc-912c0cfdc2e5f103f10b2a5e15541b8e69f80753.tar.gz instadisc-912c0cfdc2e5f103f10b2a5e15541b8e69f80753.tar.bz2 instadisc-912c0cfdc2e5f103f10b2a5e15541b8e69f80753.zip |
Update: Wrote SFGen
Closes #58
Diffstat (limited to 'update/sfgen')
-rw-r--r-- | update/sfgen/trunk/index.php | 71 |
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 | |||
22 | if ($idusTitle == '') | ||
23 | { | ||
24 | die('$idusTitle is unset, please set it to your Subscription\'s Title'); | ||
25 | } | ||
26 | |||
27 | if ($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 | |||
34 | echo('<DIV STYLE="display: none">: ' . "\n"); | ||
35 | echo('Subscription: ' . $idusSubscriptionURL . "\n"); | ||
36 | echo('Title: ' . $idusTitle . "\n"); | ||
37 | echo('Category: ' . $idusCategory . "\n"); | ||
38 | |||
39 | if (($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 | |||
47 | echo('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 | |||
49 | if (($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 | |||
54 | function 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 | ?> | ||