summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2022-03-12 18:10:53 +0000
committerYaco <franco@reevo.org>2022-03-12 18:10:53 +0000
commit04ebfb3763ebcea91b698f35ac0f41f55f46762e (patch)
tree769d9658dbb0e81e700884e5f4b29d3157a0db32
parent29e9f0bc645d8534e06df9c2092bef49a59bb993 (diff)
adds crowdfunding
l---------conf/plugin1
-rw-r--r--conf/plugin/bureaucracy/crowdfunding.php93
-rw-r--r--conf/plugin/bureaucracy/subpagedb.php73
3 files changed, 166 insertions, 1 deletions
diff --git a/conf/plugin b/conf/plugin
deleted file mode 120000
index e23e968..0000000
--- a/conf/plugin
+++ /dev/null
@@ -1 +0,0 @@
-../../../platform/www/conf/plugin/ \ No newline at end of file
diff --git a/conf/plugin/bureaucracy/crowdfunding.php b/conf/plugin/bureaucracy/crowdfunding.php
new file mode 100644
index 0000000..4a6c18a
--- /dev/null
+++ b/conf/plugin/bureaucracy/crowdfunding.php
@@ -0,0 +1,93 @@
+<?php
+
+// Subpage Database script - stores all the data in a simple dokuwiki table
+// All data is stored in a page with extension .log and the same name than current page
+// How to use this:
+//
+// <form>
+// action script crowdfunding.php
+// thanks "Thank you for register in. You can join the call in [[https://meet.jit.si/GTA-Webinar|this link]]"
+// Fieldset "About you"
+// hidden "Lang" "=en"
+// hidden "Date" "=@DATE@"
+// Textbox "Name"
+// email "E-Mail" !
+// select "Country" "Afghanistan|Åland Islands|Albania|"
+// yesno "Subscribe me for e-mail updates?" "=true value" "!false value"
+// submit "Register in"
+// </form>
+
+ob_start();
+
+use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;
+
+class helper_plugin_bureaucracy_handler_crowdfunding implements bureaucracy_handler_interface {
+ /**
+ * Log the form fields to DokuWiki's debug log
+ */
+
+ public function redirect($url) {
+ ob_start();
+ header('Location: '.$url);
+ ob_end_flush();
+ die();
+ }
+
+ public function handleData($fields, $thanks)
+ {
+ ob_start();
+ global $INFO;
+
+ $n = 0;
+ $m = 0;
+
+ foreach($fields as $row){
+ if ($n != 0) {
+ if ($row->opt["label"] === 'E-Mail') {
+ $line = $line . ' | <' . $row->opt["value"] . '>';
+ } else {
+ $line = $line . ' | ' . $row->opt["value"];
+ }
+
+ if ($row->opt["label"] === 'Medio de Pago') {
+ $pago = $row->opt["value"] ;
+ }
+
+ if ($n === 1) {
+ $lang = $row->opt["value"];
+ }
+ }
+ $n++;
+ }
+ $filepath = $INFO['filepath'];
+
+ // unifica el registro si viene de idioma español
+ $store_tmp = str_replace("/es/","/",$filepath);
+ $store = str_replace(".txt",".log.txt",$store_tmp);
+ // // Abre el fichero para obtener el contenido existente
+ if(!is_file($store)){
+ foreach($fields as $row){
+ if ($m != 0) {
+ $header = $header . ' ^ ' . $row->opt["label"];
+ }
+ $m++;
+ }
+ $header = substr($header, 1);
+ file_put_contents($store, "$header\n"); // Save our content to the file.
+ }
+ $actual = file_get_contents($store);
+ $line = substr($line, 1);
+ $actual .= "$line\n";
+ // // Escribe el contenido al fichero
+ file_put_contents($store, $actual);
+ //
+ if ($pago === "PayPal") {
+ echo "<script type='text/javascript'>window.open('https://paypal.com', '_blank');</script>";
+ echo $thanks;
+ exit;
+ // exit;
+ }
+ // dbglog($line);
+ // return $thanks;
+ }
+}
diff --git a/conf/plugin/bureaucracy/subpagedb.php b/conf/plugin/bureaucracy/subpagedb.php
new file mode 100644
index 0000000..e2aa175
--- /dev/null
+++ b/conf/plugin/bureaucracy/subpagedb.php
@@ -0,0 +1,73 @@
+<?php
+
+// Subpage Database script - stores all the data in a simple dokuwiki table
+// All data is stored in a page with extension .log and the same name than current page
+// How to use this:
+//
+// <form>
+// action script subpagedb.php
+// thanks "Thank you for register in. You can join the call in [[https://meet.jit.si/GTA-Webinar|this link]]"
+// Fieldset "About you"
+// hidden "Lang" "=en"
+// hidden "Date" "=@DATE@"
+// Textbox "Name"
+// email "E-Mail" !
+// select "Country" "Afghanistan|Åland Islands|Albania|"
+// yesno "Subscribe me for e-mail updates?" "=true value" "!false value"
+// submit "Register in"
+// </form>
+
+use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;
+
+class helper_plugin_bureaucracy_handler_subpagedb implements bureaucracy_handler_interface {
+ /**
+ * Log the form fields to DokuWiki's debug log
+ */
+
+ public function handleData($fields, $thanks)
+ {
+ global $INFO;
+
+ $n = 0;
+ $m = 0;
+
+ foreach($fields as $row){
+ if ($n != 0) {
+ if ($row->opt["label"] === 'E-Mail') {
+ $line = $line . ' | <' . $row->opt["value"] . '>';
+ } else {
+ $line = $line . ' | ' . $row->opt["value"];
+ }
+ if ($n === 1) {
+ $lang = $row->opt["value"];
+ }
+ }
+ $n++;
+ }
+ $filepath = $INFO['filepath'];
+
+ // unifica el registro si viene de idioma español
+ $store_tmp = str_replace("/es/","/",$filepath);
+ $store = str_replace(".txt",".log.txt",$store_tmp);
+ // // Abre el fichero para obtener el contenido existente
+ if(!is_file($store)){
+ foreach($fields as $row){
+ if ($m != 0) {
+ $header = $header . ' ^ ' . $row->opt["label"];
+ }
+ $m++;
+ }
+ $header = substr($header, 1);
+ file_put_contents($store, "$header\n"); // Save our content to the file.
+ }
+ $actual = file_get_contents($store);
+ $line = substr($line, 1);
+ $actual .= "$line\n";
+ // // Escribe el contenido al fichero
+ file_put_contents($store, $actual);
+ //
+
+ // dbglog($line);
+ return $thanks;
+ }
+}