diff --git a/inc/spot.php b/inc/spot.php index 62781da..05155a7 100755 --- a/inc/spot.php +++ b/inc/spot.php @@ -48,7 +48,8 @@ class Spot extends Main array('name'=>'project', 'project'=>true), array('name'=>'media', 'project'=>true), array('name'=>'converter', 'project'=>true), - array('name'=>'user', 'project'=>true) + array('name'=>'user', 'project'=>true), + array('name'=>'email', 'project'=>true) ); parent::__construct($oClassManagement, $sProcessPage, $asClasses, true, __FILE__, $sTimezone); @@ -172,7 +173,7 @@ class Spot extends Main } public function genCronFile() { - //$bResult = (file_put_contents('spot_cron.sh', '#!/bin/bash'."\n".'cd '.dirname($_SERVER['SCRIPT_FILENAME'])."\n".'php -f index.php a=update_feed')!==false); + //$bSuccess = (file_put_contents('spot_cron.sh', '#!/bin/bash'."\n".'cd '.dirname($_SERVER['SCRIPT_FILENAME'])."\n".'php -f index.php a=update_feed')!==false); $sFileName = 'spot_cron.sh'; $sContent = '#!/bin/bash'."\n". @@ -215,16 +216,16 @@ class Spot extends Main public function subscribe($sEmail) { $asResult = $this->oUser->addUser($sEmail, $this->oLang->getLanguage()); + $asUserInfo = $this->oUser->getUserInfo(); //Send Confirmation Email - if($asResult['result']) { - $this->oClassManagement->incClass('email', true); - $oConfEmail = new Email($this->asContext['serv_name'],'email_confirmation'); - $oConfEmail->setDestInfo($this->oUser->getUserInfo()); + if($asResult['result'] && $asResult['desc']=='lang:nl_subscribed') { + $oConfEmail = new Email($this->asContext['serv_name'], 'email_confirmation'); + $oConfEmail->setDestInfo($asUserInfo); $oConfEmail->send(); } - return self::getJsonResult($asResult['result'], $asResult['desc'], $asResult['data']); + return self::getJsonResult($asResult['result'], $asResult['desc'], $asUserInfo); } public function unsubscribe() { @@ -237,7 +238,7 @@ class Spot extends Main $this->oLang->setLanguage($this->oUser->getLang(), self::DEFAULT_LANG); $asResult = $this->oUser->removeUser(); - $sDesc = $asResult['desc']; + $sDesc = $asResult['desc']; if($sDesc=='') $sDesc = $this->oLang->getTranslation('nl_unsubscribed'); return $sDesc; } diff --git a/inc/user.php b/inc/user.php index 8f55704..74ccedf 100644 --- a/inc/user.php +++ b/inc/user.php @@ -59,7 +59,7 @@ class User extends PhpObject { $this->updateCookie(); } - return Spot::getResult($bSuccess, $sDesc, $this->getUserInfo()); + return Spot::getResult($bSuccess, $sDesc); } public function removeUser() {