zmodel = Mage::getModel('livechat/livechat')->load(1); $zoptions = $this->zmodel->_data; /* $object = Mage::getModel('livechat/livechat')->load(1); $object->setTitle('This is a changed title'); $object->save();*/ $password = ""; if ($zoptions['salt'] != "") { $password = "password"; } $authenticated = ""; $error = array(); $gotologin = 0; if ($this->getRequest()->getParam('deactivate')=="yes") { $this->zmodel->setSalt(''); $this->zmodel->setCode('zopim'); } else if ($this->getRequest()->getParam('zopimusername')!="") { // logging in if ($this->getRequest()->getParam('zopimUseSSL')!="") { $this->zmodel->setUseSSL('zopimUseSSL'); } else { $this->zmodel->setUseSSL(''); } $zopimusername = $this->getRequest()->getParam('zopimusername'); $zopimpassword = $this->getRequest()->getParam('zopimpassword'); $logindata = array("email" => $zopimusername, "password" => $zopimpassword); $loginresult = $this->do_post_request(ZOPIM_LOGIN_URL, $logindata); $loginresult = Zend_Json::decode($loginresult); if (isset($loginresult["error"])) { $error["login"] = "Could not log in to Zopim. Please check your login details. If problem persists, try connecting without SSL enabled."; $gotologin = 1; $this->zmodel->setSalt(''); } else if (isset($loginresult["salt"])) { $this->zmodel->setUsername($zopimusername); $this->zmodel->setSalt($loginresult["salt"]); $account = Zend_Json::decode($this->do_post_request(ZOPIM_GETACCOUNTDETAILS_URL, array("salt" => $loginresult["salt"]))); if (isset($account)) { $this->zmodel->setCode($account["account_key"]); if ($this->zmodel->getGreetings() == "") { $jsongreetings = Zend_Json::encode($account["settings"]["greetings"]); $this->zmodel->setGreetings($jsongreetings); } } } else { $this->zmodel->setSalt(''); $error["login"] = "Could not log in to Zopim. We were unable to contact Zopim servers. Please check with your server administrator to ensure that PHP Curl is installed and permissions are set correctly."; } } else if ($this->getRequest()->getParam('zopimfirstname')!="") { // signing up if ($this->getRequest()->getParam('zopimUseSSL')!="") { $this->zmodel->setUseSSL('zopimUseSSL'); } else { $this->zmodel->setUseSSL(''); } $createdata = array( "email" => $this->getRequest()->getParam('zopimnewemail'), "first_name" => $this->getRequest()->getParam('zopimfirstname'), "last_name" => $this->getRequest()->getParam('zopimlastname'), "display_name" => $this->getRequest()->getParam('zopimfirstname')." ".$this->getRequest()->getParam('zopimlastname'), "eref" => "", "source" => "magento", "recaptcha_challenge_field" => $this->getRequest()->getParam('recaptcha_challenge_field'), "recaptcha_response_field" => $this->getRequest()->getParam('recaptcha_response_field') ); $signupresult = Zend_Json::decode($this->do_post_request(ZOPIM_SIGNUP_URL, $createdata)); if (isset($signupresult["error"])) { $error["auth"] = "
You may now proceed to the dashboard to chat with customers, customize your widget or enable instant messaging integration through the menu.
'; // .$this->getRequest()->getParam('abc') $html .= '
Select A Setup
Give me a new account — absolutely free!
I already have a Zopim account
|