]> git.mxchange.org Git - friendica.git/commitdiff
added invitation module
authorMike Macgirvin <mike@macgirvin.com>
Wed, 28 Jul 2010 23:28:39 +0000 (16:28 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Wed, 28 Jul 2010 23:28:39 +0000 (16:28 -0700)
INSTALL
mod/invite.php [new file with mode: 0644]
view/invite.tpl [new file with mode: 0644]

diff --git a/INSTALL b/INSTALL
index 35417ed0d94a2738f6b670bd1d28bb219cfe23d4..5be33a75177297d983404b764ca40cde9b0bed68 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,26 +1,38 @@
 Installation guide
 
-The following notes apply to pre-alpha releases. Some manual installation is required at this time. 
+The following notes apply to alpha/beta releases. Some manual installation is 
+required at this time. 
 
 
 1. Requirements
-       - Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
-       - PHP > 5.1. The later the better. You'll need 5.3 for full openssl encryption support
-       - PHP command line access with register_argc_argv set to true in the php.ini file
+       - Apache with mod-rewrite enabled and "Options All" so you can use a 
+local .htaccess file
+       - PHP > 5.1. The later the better. You'll need 5.3 for full openssl 
+encryption support
+       - PHP *command line* access with register_argc_argv set to true in the 
+php.ini file
        - Mysql 5.x
+       - cron
+       
+       [Dreamhost.com offers all of the necessary hosting features at a 
+reasonable price. If your hosting provider doesn't allow Unix shell access, 
+you might have trouble getting everything to work.] 
 
 2. Edit htconfig.php and change system settings. Rename to .htconfig.php
 
 3. Import database.sql into your database with mysql command line or via phpmyadmin
 
-4. Import updates.sql to catch any late-breaking devel changes
+4. Import updates.sql (if it exists) to catch any late-breaking devel changes
 
 5. Put this directory into the root of your web server document area.
        - To use a subdir of your main site, set the 
        config variable $a->path to the relative subdir
-       For example to use http://example.com/test - 
+       in .htconfig.php - for example to use http://example.com/test - 
        set $a->path to 'test'.
+       - Everything will work much better if you can dedicate a domain 
+       or subdomain so that you don't require an extra server path. 
 
 6. Navigate to your site with a web browser and register an account.
 
+7. Set up a cron task to run "php include/poller.php http://my.domain.name" once every 5-10 minutes. 
 
diff --git a/mod/invite.php b/mod/invite.php
new file mode 100644 (file)
index 0000000..c63eb56
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+
+
+function invite_post(&$a) {
+       if(! local_user()) {
+               notice( t('Permission denied.') . EOL);
+               return;
+       }
+
+
+       $recips = explode("\n",$_POST['recipients']);
+       $message = $_POST['message'];
+
+       $total = 0;
+
+       foreach($recips as $recip) {
+
+               $recip = trim($recip);
+
+               if(!eregi('[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,6}', $recip)) {
+                       notice(  $recip . t(' : ') . t('Not a valid email address.') . EOL);
+                       continue;
+               }
+
+                $res = mail($recip, t('Please join my network on ') . $a->config['sitename'], $message, "From: " . $a->user['email']);
+               if($res) {
+                       $total ++;
+               }
+               else {
+                       notice( $recip . t(' : ') . t('Message delivery failed.') . EOL);
+               }
+
+       }
+       notice( $total . t(' messages sent.') . EOL);
+
+
+
+}
+
+
+function invite_content(&$a) {
+       if(! local_user()) {
+               notice( t('Permission denied.') . EOL);
+               return;
+       }
+
+       $tpl = file_get_contents('view/invite.tpl');
+       
+       $o = replace_macros($tpl, array(
+               '$invite' => t('Send invitations'),
+               '$addr_text' => t('Enter email addresses, one per line:'),
+               '$msg_text' => t('Your message:'),
+               '$default_message' => t('Please join my social network on ') . $a->config['sitename'] . t("\r\n") . t("\r\n")
+                       . t('To accept this invitation, please visit:') . t("\r\n") . t("\r\n") . $a->get_baseurl()
+                       . t("\r\n") . t("\r\n") . t('Once you have registered, please make an introduction via my profile page at:') 
+                       . t("\r\n") . t("\r\n") . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
+               '$submit' => t('Submit')
+       ));
+
+       return $o;
+
+
+}
\ No newline at end of file
diff --git a/view/invite.tpl b/view/invite.tpl
new file mode 100644 (file)
index 0000000..01a45c7
--- /dev/null
@@ -0,0 +1,26 @@
+<form action="invite" method="post" id="invite-form" >
+<div id="invite-wrapper">
+
+<h3>$invite</h3>
+
+<div id="invite-recipient-text">
+$addr_text
+</div>
+
+<div id="invite-recipient-textarea">
+<textarea id="invite-recipients" name="recipients" rows="8" cols="32" ></textarea>
+</div>
+
+<div id="invite-message-text">
+$msg_text
+</div>
+
+<div id="invite-message-textarea">
+<textarea id="invite-message" name="message" rows="10" cols="72" >$default_message</textarea>
+</div>
+
+<div id="invite-submit-wrapper">
+<input type="submit" name="submit" value="$submit" />
+</div>
+
+</form>
\ No newline at end of file