diff --git a/config.dist.php b/config.dist.php index 545a5e9..642371c 100644 --- a/config.dist.php +++ b/config.dist.php @@ -1,19 +1,30 @@ "", + "port" => 465, + "auth" => true, + "username" => "", + "password" => "")), + array(\config_ids::DEMOCRACY_EMAIL_CONTACT, array( "host" => "", + "port" => 465, + "auth" => true, + "username" => "", + "password" => "")) + ); } \ No newline at end of file diff --git a/democracy/api/api_democracy.php b/democracy/api/api_democracy.php index 18bcc9b..f567732 100644 --- a/democracy/api/api_democracy.php +++ b/democracy/api/api_democracy.php @@ -1,34 +1,48 @@ ".implode("",$b)."";}); - $thead = "" . implode("", array_keys($rows[0])) . ""; - - $new_data = "\n$thead\n$tbody\n
";*/ - if(array_key_exists('files', $data)){ - $data['files'] = json_decode($data['files']);} - $new_data = str_replace('\/', '/',json_encode($data,JSON_PRETTY_PRINT)); - //SendMail + + private static function mailcannon($from,$subject,$html_file,$text_file,$to,$images,$replacements,$smtp){ $bcc = null; $delay = 0; - $from = 'Website | DEMOCRACY '; - $subject = '📱 DEMOCRACY: EMail from democracy-deutschland.de'; + $silent = true; + $unsubscribe_list = null; + $attachments = []; + \mailcannon::fire( $bcc, + $delay, + $from, + $subject, + $html_file, + $text_file, + $to, + $unsubscribe_list, + $images, + $attachments, + $replacements, + $smtp, + $silent); + } + + public static function call_send_mail($data){ + if(array_key_exists('files', $data)){ + $data['files'] = json_decode($data['files']);} + $data_json = str_replace('\/', '/',json_encode($data,JSON_PRETTY_PRINT)); + //SendMail + $from = 'Website | DEMOCRACY <'.(array_key_exists('email',$data) ? $data['email'] : 'contact@democracy-deutschland.de').'>'; + $to = 'contact@democracy-deutschland.de'; + //$to = 'ulf.gebhardt@webcraft-media.de'; + $subject = '📱 DEMOCRACY Website: '.((array_key_exists('type',$data) && array_key_exists('email',$data)) ? $data['type'].' from '.$data['email'] : 'EMail from democracy-deutschland.de'); $html_file = (new \PAPI('tpl/send_mail.tpl'))->SERVERPATH(); $text_file = (new \PAPI('tpl/send_mail.txt'))->SERVERPATH(); - $to = 'contact@democracy-deutschland.de'; - $unsubscribe_list = null; + $replacements = [ 'data_json' => ['value' => ['text' => $data_json]], + 'type' => ['value' => ['text' => array_key_exists('type',$data) ? $data['type'] : 'No Type given']], + 'email' => ['value' => ['text' => array_key_exists('email',$data) ? $data['email'] : 'No EMail given']], + 'name' => ['value' => ['text' => array_key_exists('name',$data) ? $data['name'] : + (array_key_exists('vorname',$data) && array_key_exists('nachname',$data)) ? + $data['vorname'].' '.$data['nachname'] : 'No Name given']], + 'text' => ['value' => ['text' => array_key_exists('text',$data) ? $data['text'] : 'No Text given']]]; $images = ["democracy_logo" => (new \PAPI('img/logo.png'))->SERVERPATH()]; - $attachments = []; - $replacements = ['data' => ['value' => ['text' => $new_data]]]; - $smtp = [ "host" => "ssl://atmanspacher.eu", - "port" => 465, - "auth" => true, - "username" => "prototyping@democracy-deutschland.de", - "password" => "7$7ar0pZ" - ]; - $silent = true; - \mailcannon::fire($bcc, $delay, $from, $subject, $html_file, $text_file, $to, $unsubscribe_list, $images, $attachments, $replacements,$smtp, $silent); - + $smtp = \SYSTEM\CONFIG\config::get(\config_ids::DEMOCRACY_EMAIL_CONTACT); + self::mailcannon($from,$subject,$html_file,$text_file,$to,$images,$replacements,$smtp); return \SYSTEM\LOG\JsonResult::ok(); } @@ -121,12 +135,7 @@ class api_democracy extends \SYSTEM\API\api_system { $images = ["democracy_logo" => (new \PAPI('img/logo.png'))->SERVERPATH()]; $attachments = []; $replacements = []; - $smtp = [ "host" => "ssl://atmanspacher.eu", - "port" => 465, - "auth" => true, - "username" => "prototyping@democracy-deutschland.de", - "password" => "7$7ar0pZ" - ]; + $smtp = \SYSTEM\CONFIG\config::get(\config_ids::DEMOCRACY_EMAIL_PROTOTYPING); $silent = true; \mailcannon::fire($bcc, $delay, $from, $subject, $html_file, $text_file, $to, $unsubscribe_list, $images, $attachments, $replacements,$smtp, $silent); diff --git a/democracy/api/sql/BETA_CODES_COUNT.php b/democracy/api/sql/BETA_CODES_COUNT.php new file mode 100644 index 0000000..e44e0b6 --- /dev/null +++ b/democracy/api/sql/BETA_CODES_COUNT.php @@ -0,0 +1,9 @@ + + table, th, td { + border: 1px solid black; + border-collapse: collapse; + } + Eine Nachricht ist über die Website eingegangen:

-
${data}
+

Type: ${type}

+ + + + + + + + + + + + + + + + + +
EMail${email}
Name${name}
Type${type}
Text
${text}
+

Raw Data:

+
${data_json}

-Achtung: Diese EMail ist die einzige Kopie dieser Daten
-
- \ No newline at end of file + diff --git a/democracy/api/tpl/send_mail.txt b/democracy/api/tpl/send_mail.txt index 0569ae1..616884f 100644 --- a/democracy/api/tpl/send_mail.txt +++ b/democracy/api/tpl/send_mail.txt @@ -1,5 +1,5 @@ Eine Nachricht ist über die Website eingegangen: -${data} +${data_json} Achtung: Diese EMail ist die einzige Kopie dieser Daten \ No newline at end of file diff --git a/democracy/autoload.inc b/democracy/autoload.inc index 98a4dc2..ca1ffd7 100644 --- a/democracy/autoload.inc +++ b/democracy/autoload.inc @@ -4,4 +4,5 @@ require_once dirname(__FILE__).'/page/autoload.inc'; require_once dirname(__FILE__).'/files/autoload.inc'; require_once dirname(__FILE__).'/api/autoload.inc'; require_once dirname(__FILE__).'/sql/autoload.inc'; -require_once dirname(__FILE__).'/sai/autoload.inc'; \ No newline at end of file +require_once dirname(__FILE__).'/sai/autoload.inc'; +require_once dirname(__FILE__).'/config/autoload.inc'; \ No newline at end of file diff --git a/democracy/config/autoload.inc b/democracy/config/autoload.inc new file mode 100644 index 0000000..8fd92c5 --- /dev/null +++ b/democracy/config/autoload.inc @@ -0,0 +1,2 @@ +SERVERPATH(), $vars); + } public function html(){ $vars = array(); - //Donations - $vars['donation_paten'] = 7; - $vars['donation_value'] = 55; - $vars['donation_date'] = '14.05.2018 * 18:45 Uhr'; - $vars['donation_percentage'] = round($vars['donation_value']/100,0); + //donate box + $vars['donate_box'] = self::donate_box(); //team $vars['team'] = ''; $team = array( array( 'name' => 'Marius Krüger', 'text' => 'Mädchen für alles
Initiator & UI', 'img' => './files/wir/marius_krueger.jpg', 'aktiv' => 'lightgreen', diff --git a/democracy/page/default_donate/tpl/default_donate.tpl b/democracy/page/default_donate/tpl/default_donate.tpl index e316380..7eed612 100644 --- a/democracy/page/default_donate/tpl/default_donate.tpl +++ b/democracy/page/default_donate/tpl/default_donate.tpl @@ -9,81 +9,7 @@
-
- - -
- - ${donation_paten} VON 2.000 - - PATENSCHAFTEN ERREICHT! -
- - ${donation_value}€ von 10.000€ - - (min. Finanzierungsziel/Monat) - Stand: ${donation_date} - DEMOCRACY Logo - -
-
+ ${donate_box}
\ No newline at end of file diff --git a/democracy/sai/saimod_donate/autoload.inc b/democracy/sai/saimod_donate/autoload.inc new file mode 100644 index 0000000..b6ff6c1 --- /dev/null +++ b/democracy/sai/saimod_donate/autoload.inc @@ -0,0 +1,4 @@ +SERVERPATH(),$vars);} + + public static function sai_mod__SAI_saimod_donate_action_update($paten,$value){ + \SYSTEM\PAGE\text::save('donation_paten', 'donation_paten', 'deDE', ['donation'], $paten); + \SYSTEM\PAGE\text::save('donation_value', 'donation_value', 'deDE', ['donation'], $value); + \SYSTEM\PAGE\text::save('donation_date', 'donation_date', 'deDE', ['donation'], date('d.m.Y * H:i').' Uhr'); + return \SYSTEM\LOG\JsonResult::ok(); + } + public static function menu(){ + return new \SYSTEM\SAI\sai_module_menu( 100, + \SYSTEM\SAI\sai_module_menu::POISITION_LEFT, + \SYSTEM\SAI\sai_module_menu::DIVIDER_LEFT, + \SYSTEM\PAGE\replace::replaceFile((new \PSAI('saimod_donate/tpl/menu.tpl'))->SERVERPATH()));} + public static function right_public(){return false;} + public static function right_right(){return \SYSTEM\SECURITY\security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} + + public static function js(){ + return array(new \PSAI('saimod_donate/js/saimod_donate.js'));} +} \ No newline at end of file diff --git a/democracy/sai/saimod_donate/sql/DATA_SAIMOD_DONATE.php b/democracy/sai/saimod_donate/sql/DATA_SAIMOD_DONATE.php new file mode 100644 index 0000000..ddbf352 --- /dev/null +++ b/democracy/sai/saimod_donate/sql/DATA_SAIMOD_DONATE.php @@ -0,0 +1,9 @@ +SERVERPATH(), + (new \PSAI('/saimod_donate/sql/mysql/system_api.sql'))->SERVERPATH()); + } +} \ No newline at end of file diff --git a/democracy/sai/saimod_donate/sql/autoload.inc b/democracy/sai/saimod_donate/sql/autoload.inc new file mode 100644 index 0000000..3927db9 --- /dev/null +++ b/democracy/sai/saimod_donate/sql/autoload.inc @@ -0,0 +1,3 @@ + + + + +   Donate + + \ No newline at end of file diff --git a/democracy/sai/saimod_donate/tpl/saimod_donate.tpl b/democracy/sai/saimod_donate/tpl/saimod_donate.tpl new file mode 100644 index 0000000..b77121f --- /dev/null +++ b/democracy/sai/saimod_donate/tpl/saimod_donate.tpl @@ -0,0 +1,26 @@ +
+
+

   Donate

+
+
+ + + + + + + + + + + + + +
Paten
Value
+ +
+
+
+ ${donate_box} +
+
\ No newline at end of file diff --git a/democracy/sql/mysql/system_text.sql b/democracy/sql/mysql/system_text.sql index 41c5098..30c81e7 100644 --- a/democracy/sql/mysql/system_text.sql +++ b/democracy/sql/mysql/system_text.sql @@ -175,4 +175,11 @@ INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('faq_q_07', 'faq'); INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('faq_q_08', 'faq'); INSERT IGNORE INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('donate_notice', 'deDE', 'Für Spenden unter 200€ jährlich genügt der » Vereinfachte Zuwendungsnachweis Â«

Spendenquittung auf Â» Anfrage Â«', '1', '1', '2017-12-28 16:42:29', '2017-12-28 16:42:29'); -INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('donate_notice', 'democracy'); \ No newline at end of file +INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('donate_notice', 'democracy'); + +INSERT IGNORE INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('donation_paten', 'deDE', '9', '1', '1', '2017-12-28 16:42:29', '2017-12-28 16:42:29'); +INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('donation_paten', 'donation'); +INSERT IGNORE INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('donation_value', 'deDE', '61', '1', '1', '2017-12-28 16:42:29', '2017-12-28 16:42:29'); +INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('donation_value', 'donation'); +INSERT IGNORE INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('donation_date', 'deDE', '14.05.2018 * 18:45 Uhr', '1', '1', '2017-12-28 16:42:29', '2017-12-28 16:42:29'); +INSERT IGNORE INTO `system_text_tag` (`id`, `tag`) VALUES ('donation_date', 'donation'); \ No newline at end of file