Skip to content

Commit

Permalink
[no ticket] Updated Terms of Use pages. Use tou@bewelcome.org as send…
Browse files Browse the repository at this point in the history
…er for ToU mailing.
  • Loading branch information
thisismeonmounteverest committed Jan 13, 2016
1 parent 6d94943 commit e41d258
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 166 deletions.
310 changes: 160 additions & 150 deletions build/about/about.ctrl.php
Original file line number Diff line number Diff line change
@@ -1,150 +1,160 @@
<?php

/**
* Aboutus controller
*
* @package about
* @author Andreas (lemon-head)
* @copyright hmm
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
* @version $Id$
*/
class AboutController extends RoxControllerBase
{
public function index($args = false)
{
$request = $args->request;

if (!isset($request[0])) {
// then who activated the about controller?
$page = new AboutTheideaPage();
} else if ($request[0] != 'about') {
$page = $this->_getPageByKeyword($request[0], isset($request[1]) ? $request[1] : false);
} else if (!isset($request[1])) {
$page = new AboutTheideaPage();
} else {
$page = $this->_getPageByKeyword($request[1], isset($request[2]) ? $request[2] : false);
}
return $page;
}

private function _getPageByKeyword($keyword, $keyword_2)
{
switch ($keyword) {
case 'thepeople':
return new AboutThepeoplePage();
case 'getactive':
return new AboutGetactivePage();
case 'newsletters':
case 'missions':
case 'bod':
case 'help':
case 'terms':
case 'commentguidelines':
case 'impressum':
case 'affiliations':
case 'privacy':
$page = new AboutGenericPage($keyword);
$page->setModel(new AboutModel());
return $page;
case 'stats':
case 'statistics':
if (!empty($keyword_2)) {
// return the given image
header('Content-type: image/png');
$statsDir = new PDataDir('statimages');
$statsDir->readFile($keyword_2);
PPHP::PExit();
}
$statsModel = new StatsModel();
// Generate new statsImages if needed
$statsModel->generateStatsImages();
$page = new AboutStatisticsPage();
$page->setModel($statsModel);
return $page;
case 'feedback':
case 'contact':
case 'contactus':
case 'support':
if (isset($keyword_2) && $keyword_2 == "submit") {
return new FeedbackSentPage;
}
$page = new FeedbackPage();
$page->model = new FeedbackModel();
return $page;
case 'faq':
case 'faqs':
$model = new AboutModel;
$faq_categories = $model->getFaqsCategorized();
if ($faq_section = $model->getFaqSection($keyword_2)) {
$page = new AboutFaqsectionPage;
$page->faq_section = $faq_section;
$page->key = $keyword_2;
} else {
$page = new AboutFaqPage;
}
$page->faq_categories = $faq_categories;
return $page;
case 'idea':
case 'theidea':
default:
return new AboutTheideaPage();
}
}

public function feedbackCallback($args, $action, $mem_redirect, $mem_resend)
{
if (isset($args->post))
{
$request = $args->request;
$model = new FeedbackModel;
$mem_redirect->post = $args->post;
if (!$model->getLoggedInMember() && !filter_var($args->post['FeedbackEmail'], FILTER_VALIDATE_EMAIL))
{
$mem_redirect->errors = array('FeedbackErrorBadEmail');
return false;
}
if (isset($args->post['IdCategory']) && $args->post['FeedbackQuestion'] != '')
{
if ($model->sendFeedback($args->post))
{
// Redirect if "redirect" GET parameter was set when first
// calling the feedback form.
if (isset($args->post['redirect'])
&& !empty($args->post['redirect'])) {
return $args->post['redirect'];
} else {
return 'feedback/submit';
}
}
else
{
$mem_redirect->errors = array('FeedbackErrorSendfailed');
return false;
}
}
else
{
$mem_redirect->errors = array('FeedbackErrorDataMissing');
return false;
}
}
else
{
return false;
}
}

public function updateStatistics() {
if ($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') {
header("Location: http://www.bewelcome.org");
exit(0);
}
ob_start();
$statsModel = new StatsModel();
echo $statsModel->updateStatistics();
ob_end_clean();
echo "success";
exit(0);
}
}
<?php

/**
* Aboutus controller
*
* @package about
* @author Andreas (lemon-head)
* @copyright hmm
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
* @version $Id$
*/
class AboutController extends RoxControllerBase
{
public function index($args = false)
{
$request = $args->request;

if (!isset($request[0])) {
// then who activated the about controller?
$page = new AboutTheideaPage();
} else if ($request[0] != 'about') {
$page = $this->_getPageByKeyword($request[0], isset($request[1]) ? $request[1] : false);
} else if (!isset($request[1])) {
$page = new AboutTheideaPage();
} else {
$page = $this->_getPageByKeyword($request[1], isset($request[2]) ? $request[2] : false);
}
return $page;
}

private function _getPageByKeyword($keyword, $keyword_2)
{
switch ($keyword) {
case 'thepeople':
return new AboutThepeoplePage();
case 'getactive':
return new AboutGetactivePage();
case 'newsletters':
case 'missions':
case 'bod':
case 'help':
case 'commentguidelines':
case 'impressum':
case 'affiliations':
case 'privacy':
$page = new AboutGenericPage($keyword);
$page->setModel(new AboutModel());
return $page;
case 'stats':
case 'statistics':
if (!empty($keyword_2)) {
// return the given image
header('Content-type: image/png');
$statsDir = new PDataDir('statimages');
$statsDir->readFile($keyword_2);
PPHP::PExit();
}
$statsModel = new StatsModel();
// Generate new statsImages if needed
$statsModel->generateStatsImages();
$page = new AboutStatisticsPage();
$page->setModel($statsModel);
return $page;
case 'feedback':
case 'contact':
case 'contactus':
case 'support':
if (isset($keyword_2) && $keyword_2 == "submit") {
return new FeedbackSentPage;
}
$page = new FeedbackPage();
$page->model = new FeedbackModel();
return $page;
case 'faq':
case 'faqs':
$model = new AboutModel;
$faq_categories = $model->getFaqsCategorized();
if ($faq_section = $model->getFaqSection($keyword_2)) {
$page = new AboutFaqsectionPage;
$page->faq_section = $faq_section;
$page->key = $keyword_2;
} else {
$page = new AboutFaqPage;
}
$page->faq_categories = $faq_categories;
return $page;
case 'idea':
case 'theidea':
default:
return new AboutTheideaPage();
}
}

public function feedbackCallback($args, $action, $mem_redirect, $mem_resend)
{
if (isset($args->post))
{
$request = $args->request;
$model = new FeedbackModel;
$mem_redirect->post = $args->post;
if (!$model->getLoggedInMember() && !filter_var($args->post['FeedbackEmail'], FILTER_VALIDATE_EMAIL))
{
$mem_redirect->errors = array('FeedbackErrorBadEmail');
return false;
}
if (isset($args->post['IdCategory']) && $args->post['FeedbackQuestion'] != '')
{
if ($model->sendFeedback($args->post))
{
// Redirect if "redirect" GET parameter was set when first
// calling the feedback form.
if (isset($args->post['redirect'])
&& !empty($args->post['redirect'])) {
return $args->post['redirect'];
} else {
return 'feedback/submit';
}
}
else
{
$mem_redirect->errors = array('FeedbackErrorSendfailed');
return false;
}
}
else
{
$mem_redirect->errors = array('FeedbackErrorDataMissing');
return false;
}
}
else
{
return false;
}
}

public function updateStatistics() {
if ($_SERVER['REMOTE_ADDR'] !== '127.0.0.1') {
header("Location: http://www.bewelcome.org");
exit(0);
}
ob_start();
$statsModel = new StatsModel();
echo $statsModel->updateStatistics();
ob_end_clean();
echo "success";
exit(0);
}

public function termsOfUse() {
$lang = null;
if (isset($this->route_vars['language'])) {
$lang = $this->route_vars['language'];
}
$page = new AboutGenericPage('terms', $lang);
$page->lang = $lang;
$page->setModel(new AboutModel());
return $page;
}
}
6 changes: 5 additions & 1 deletion build/about/aboutgeneric.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
*/
class AboutGenericPage extends AboutBasePage
{
public function __construct($pagename) {
private $_pagename;
private $_lang;

public function __construct($pagename, $lang) {
$this->_pagename = $pagename;
$this->_lang = $lang;
}

protected function getPageTitle() {
Expand Down
11 changes: 6 additions & 5 deletions build/about/templates/terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
*/

$words = new MOD_words();
?>
<p><?= $words->getFormatted('TermsOfUseWarning') ?></p>
<?php if ($this->_lang === null) { ?>
<p><?= $words->getFormatted('TermsOfUseTranslation', $_SESSION['lang']) ?></p>
<?php }?>

if ($_SESSION['lang'] <> 'fr') {
echo '<p>' . $words->getFormatted('TermsOfUseWarning') . '</p>';
}

echo $words->getFormatted('TermsOfUseFullText');
<?= $words->getInLang('TermsOfUseFullText', $this->_lang === null ? 'fr' : $this->_lang); ?>
6 changes: 5 additions & 1 deletion routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,8 @@
$this->addRoute('dataretention', 'members/dataretention', 'MembersController', 'dataRetention');

$this->addRoute('admin_subscriptions', 'admin/subscriptions', 'AdminSubscriptionsController', 'manage');
$this->addRoute('login_message_close', 'close/:id:', 'LoginController', 'close');
$this->addRoute('login_message_close', 'close/:id:', 'LoginController', 'close');

// Terms of use
$this->addRoute('terms_french', 'terms', 'AboutController', 'termsOfUse');
$this->addRoute('terms_language', 'terms/:language:', 'AboutController', 'termsOfUse');
16 changes: 7 additions & 9 deletions tools/mailbot/mailbot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ protected function getSingleRow($queryString)
}

/**
* log all mailbot(s) activities
*
* @param string $msg the text to log
*
* @return nothing
* @param $msg
*/
protected function log($msg)
{
Expand All @@ -126,10 +122,9 @@ protected function log($msg)
* @param string $from the email address of the sender
* @param string $to the email address of the recipient
* @param string $body the plaintext body of the message
* @param string $title an optional title to show in the message (HTML H1 tag) (default: false)
* @param string $body_html the html version of the body (default: false)
* @param array $attach an array of attachments (default: array())
* @param string $language the language code used in the message (default: 'en')
* @param string $title an optional title to show in the message (HTML H1 tag)
* @param string $language the language code used in the message
* @param bool $html HTML preference: false -> text-only, true -> multi part (text, html)
*
* @return object the result from the MOD_mail::sendEmail call
*/
Expand Down Expand Up @@ -304,6 +299,9 @@ public function run()
case "SuggestionReminder":
$sender_mail="suggestions@bewelcome.org" ;
break;
case "TermsOfUse":
$sender_mail="tou@bewelcome.org";
break;
default:
$sender_mail="newsletter@bewelcome.org" ;
}
Expand Down

0 comments on commit e41d258

Please sign in to comment.