-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lupo49
committed
Nov 6, 2011
0 parents
commit 2f2b002
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
====== sendpagecontent Plugin for DokuWiki ====== | ||
|
||
All documentation for the sendpagecontent Plugin is available online at: | ||
|
||
* http://dokuwiki.org/plugin:sendpagecontent | ||
|
||
(c) 2011 by Matthias Schulte <dokuwiki@lupo49.de> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||
* @author Matthias Schulte <dokuwiki@lupo49.de> | ||
*/ | ||
|
||
// must be run within Dokuwiki | ||
if (!defined('DOKU_INC')) die(); | ||
|
||
if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); | ||
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); | ||
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); | ||
|
||
require_once(DOKU_PLUGIN.'action.php'); | ||
|
||
class action_plugin_sendpagecontent extends DokuWiki_Action_Plugin{ | ||
|
||
function register(&$controller) { | ||
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_act_preprocess', array()); | ||
$controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, 'handle_tpl_act_unknown'); | ||
} | ||
|
||
/** | ||
* Handles sendmail action | ||
*/ | ||
function handle_act_preprocess(&$event, $param) { | ||
global $ID; | ||
global $INFO; | ||
global $conf; | ||
|
||
if ($event->data == 'sendmail') { | ||
// we can handle it -> prevent others | ||
$event->preventDefault(); | ||
$event->stopPropagation(); | ||
|
||
// fetch raw wiki code | ||
$raw = rawWiki($ID); | ||
$err = mail_send('HIER E-MAIL-ADRESSE EINTRAGEN', 'Automatic Mail from DokuWiki at ...', $raw, $this->getConf('mailfrom')); | ||
|
||
if($err) { | ||
msg('Mail sent.'); | ||
} else { | ||
msg('Mail failed'); | ||
} | ||
|
||
// We are done. Output normal page content. | ||
$event->data = 'show'; | ||
|
||
return true; | ||
} | ||
return true; | ||
} | ||
|
||
function handle_tpl_act_unknown(&$event, $param) { | ||
global $ID; | ||
if($event->data != 'sendmail') return false; | ||
$event->preventDefault(); | ||
$event->stopPropagation(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
author Matthias Schulte | ||
email dokuwiki@lupo49.de | ||
date 2011-11-06 | ||
name sendpagecontent | ||
desc Send the raw page content to a given mail address | ||
url http://dokuwiki.org/plugin:sendpagecontent |