summaryrefslogtreecommitdiff
path: root/inc/actions.php
diff options
context:
space:
mode:
authorSteven Danz <steven-danz@kc.rr.com>2005-06-27 04:17:48 +0200
committerSteven Danz <steven-danz@kc.rr.com>2005-06-27 04:17:48 +0200
commitb158d625b53833ef391800a991ad93d965d9425e (patch)
tree56913261bea090738c5b862fc3f2da06a7d6ca68 /inc/actions.php
parent7131b6688badc1c1e9685aba4b222f147bc1df83 (diff)
downloadrpg-b158d625b53833ef391800a991ad93d965d9425e.tar.gz
rpg-b158d625b53833ef391800a991ad93d965d9425e.tar.bz2
track_changes.patch
Second go at including changes to allow users to sign up on mailing lists so they may receive emails each time the page they are interested in is updated. darcs-hash:20050627021748-3ed6d-5f6993f51ab649e3928a513b0fbe7c421d880325.gz
Diffstat (limited to 'inc/actions.php')
-rw-r--r--inc/actions.php38
1 files changed, 37 insertions, 1 deletions
diff --git a/inc/actions.php b/inc/actions.php
index f6c00f14a..5818993c9 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -34,6 +34,10 @@ function act_dispatch(){
//login stuff
if(in_array($ACT,array('login','logout')))
$ACT = act_auth($ACT);
+
+ //check if user is asking to track a page
+ if($ACT == 'track' || $ACT == 'ignore')
+ $ACT = act_track($ACT);
//check permissions
$ACT = act_permcheck($ACT);
@@ -102,7 +106,7 @@ function act_clean($act){
if(array_search($act,array('login','logout','register','save','edit',
'preview','search','show','check','index','revisions',
- 'diff','recent','backlink','admin',)) === false
+ 'diff','recent','backlink','admin','track','ignore',)) === false
&& substr($act,0,7) != 'export_' ) {
msg('Unknown command: '.htmlspecialchars($act),-1);
return 'show';
@@ -268,5 +272,37 @@ function act_export($act){
return 'show';
}
+/**
+ * Handle 'track', 'ignore'
+ *
+ * @author Steven Danz <steven-danz@kc.rr.com>
+ */
+function act_track($act){
+ global $ID;
+ global $INFO;
+
+ $tracking = tracking($ID, $_SERVER['REMOTE_USER']);
+ $file=wikiMN($ID);
+ if ($act=='track' && !$tracking){
+ if ($INFO['userinfo']['mail']){
+ if (io_appendFile($file,$_SERVER['REMOTE_USER']."\n")) {
+ msg('Added '.$INFO['userinfo']['name'].' to tracking list for '.$ID,0);
+ } else {
+ msg('Error adding '.$INFO['userinfo']['name'].' to tracking list for '.$ID,0);
+ }
+ } else {
+ msg('There is no address associated with your login, you cannot be added to the tracking list',-1);
+ }
+ } elseif ($act=='ignore' && $tracking){
+ if (io_deleteFromFile($file,$_SERVER['REMOTE_USER']."\n")) {
+ msg('Removed '.$INFO['userinfo']['name'].' from the tracking list for '.$ID,0);
+ } else {
+ msg('Error removing '.$INFO['userinfo']['name'].' to tracking list for '.$ID,0);
+ }
+ }
+
+ return 'show';
+}
+
//Setup VIM: ex: et ts=2 enc=utf-8 :