예제 #1
0
 private function submitTwengaLogin()
 {
     if (!self::$obj_twenga->setHashkey($_POST['twenga_hashkey'])) {
         $this->_errors[] = $this->l('Your hashkey is invalid. Please check the e-mail already sent by Twenga.');
     }
     if (!self::$obj_twenga->setUserName($_POST['twenga_user_name'])) {
         $this->_errors[] = $this->l('Your user name is invalid. Please check the e-mail already sent by Twenga.');
     }
     if (!self::$obj_twenga->setPassword($_POST['twenga_password'])) {
         $this->_errors[] = $this->l('Your password is invalid. Please check the e-mail already sent by Twenga.');
     }
     if (empty($this->_errors)) {
         $bool_save = false;
         try {
             $bool_save = self::$obj_twenga->saveMerchantLogin();
             self::$obj_ps_stats->validateSubscription();
             if (!$bool_save) {
                 $this->_errors[] = $this->l('Authentication failed.') . "<br />\n" . $this->l('Please review the e-mail sent by Twenga after subscription. If error still occurred, contact Twenga service.');
             } else {
                 self::$obj_twenga->addFeed(array('feed_url' => $this->feed_url));
             }
         } catch (Exception $e) {
             $this->_errors[] = nl2br($e->getMessage());
         }
     }
 }
예제 #2
0
    private function submitTwengaLogin()
    {
        if (!self::$obj_twenga->setHashkey($_POST['twenga_hashkey'])) {
            $this->_errors[] = $this->l('Your hashkey is invalid. Please check the e-mail already sent by Twenga.');
        }
        if (!self::$obj_twenga->setUserName($_POST['twenga_user_name'])) {
            $this->_errors[] = $this->l('Your user name is invalid. Please check the e-mail already sent by Twenga.');
        }
        if (!self::$obj_twenga->setPassword($_POST['twenga_password'])) {
            $this->_errors[] = $this->l('Your password is invalid. Please check the e-mail already sent by Twenga.');
        }
        if (empty($this->_errors)) {
            $bool_save = false;
            try {
                $bool_save = self::$obj_twenga->saveMerchantLogin();
                self::$obj_ps_stats->validateSubscription();
                if (!$bool_save) {
                    $this->_errors[] = $this->l('Authentication failed.') . "<br />\n" . $this->l('Please review the e-mail sent by Twenga after subscription. If error still occurred, contact Twenga service.');
                } else {
                    self::$obj_twenga->addFeed(array('feed_url' => $this->feed_url));
                    $this->_html = '
						<div class="conf feed_url">
						' . $this->l('Your product export URL has successfully been created and shared with the Twenga team:') . '<br /> <a href="' . $this->feed_url . '" target="_blank">' . $this->feed_url . '</a>
						</div>
					';
                    Configuration::updateValue('TWENGA_CONFIGURATION_OK', true);
                }
            } catch (Exception $e) {
                $this->_errors[] = nl2br($e->getMessage());
            }
        }
    }