summaryrefslogtreecommitdiffstats
path: root/mediawiki/WsgiInjectableSpecialPage.php
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-01-24 19:53:00 -0500
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-01-24 20:03:21 -0500
commit2156804d24b5a8a877f1ea36674ac7fe078be9a0 (patch)
treeebea9e231463d878ff869e4a74ecd4620e743a95 /mediawiki/WsgiInjectableSpecialPage.php
parentdacc2f261b8b0419cc0a2af4cc737a33933d1ca9 (diff)
downloadaskbot-2156804d24b5a8a877f1ea36674ac7fe078be9a0.tar.gz
askbot-2156804d24b5a8a877f1ea36674ac7fe078be9a0.tar.bz2
askbot-2156804d24b5a8a877f1ea36674ac7fe078be9a0.zip
recaptcha for conventional registration\n\
simpler email subscription form at registration\n\ fixed urls in rss feed\n\ added experimental remote password login api (cleartext password for remote site entered locally)\n\ included example for Mediawiki Authentication plugin\n\ very simple message to everyone management command
Diffstat (limited to 'mediawiki/WsgiInjectableSpecialPage.php')
-rw-r--r--mediawiki/WsgiInjectableSpecialPage.php80
1 files changed, 80 insertions, 0 deletions
diff --git a/mediawiki/WsgiInjectableSpecialPage.php b/mediawiki/WsgiInjectableSpecialPage.php
new file mode 100644
index 00000000..d23f22e8
--- /dev/null
+++ b/mediawiki/WsgiInjectableSpecialPage.php
@@ -0,0 +1,80 @@
+<?php
+
+class WsgiInjectableSpecialPage extends SpecialPage {
+ var $default_wsgi_command;
+ function __construct($page_name,$default_wsgi_command,$css='',$scripts='',$wsgi_prefix=''){
+ parent::__construct($page_name);
+ wfLoadExtensionMessages($page_name);
+ $this->default_wsgi_command = $default_wsgi_command;
+ $this->css = $css;
+ $this->scripts = $scripts;
+ $this->wsgi_prefix = $wsgi_prefix;
+ }
+ function execute($par){
+ global $wgWsgiScriptPath, $wgRequest, $wgOut, $wgHeader;
+ $wgWsgiScriptPath = '';
+ if ($this->wsgi_prefix != ''){
+ $wsgi_call = $this->wsgi_prefix;
+ }
+ else {
+ $wsgi_call = $wgWsgiScriptPath;
+ }
+
+ $this->setHeaders();
+
+ if ($this->css != ''){
+ if (is_array($this->css)){
+ foreach($this->css as $css){
+ $wgHeader->addCSS($css);
+ }
+ }
+ else{
+ $wgHeader->addCSS($this->css);
+ }
+ }
+ if ($this->scripts != ''){
+ if (is_array($this->scripts)){
+ foreach($this->scripts as $script){
+ $wgHeader->addScript($script);
+ }
+ }
+ else{
+ $wgHeader->addScript($this->css);
+ }
+ }
+
+ #add command
+ if (!is_null($wgRequest->getVal('command'))){
+ $wsgi_call .= $wgRequest->getVal('command');
+ }
+ else {
+ #why is this not working?
+ $wsgi_call .= $this->default_wsgi_command;
+ }
+ #add session key
+ $session_name = ini_get('session.name');#session_name();
+ $session = '';
+ if (array_key_exists($session_name, $_COOKIE)){
+ $session = $_COOKIE[$session_name];
+ }
+ $wsgi_call .= "?session=${session}";
+
+ #add posted request variables
+ if ($wgRequest->wasPosted()){
+ $data = $wgRequest->data;
+ foreach ($data as $key => $value){
+ if ($key != 'title'){
+ $wsgi_call .= "&${key}=${value}";
+ }
+ }
+ $wsgi_call .= '&was_posted=true';
+ }
+ else {
+ $wsgi_call .= '&was_posted=false';
+ }
+
+ #print the include statement called as GET request
+ $wgOut->addHTML("<!--#include virtual=\"${wsgi_call}\"-->");
+ #$wgOut->addHTML("<!-- ${wsgi_call} -->"); #print this only for debugging
+ }
+}