public function preDispatch() { $result = parent::preDispatch(); $helper = $this->getDataHelper(); if (!Itoris_Installer_Client::isAdminRegistered($helper->getAlias())) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); $register = $this->getLayout()->createBlock('itoris_viewmoreproducts/admin_register'); $register->setMessage($helper->__('Your copy of the component is not registered! All functions are disabled. Please register. Enter your S/N to register:')); Mage::getSingleton('adminhtml/session')->addError($register->toHtml()); $this->loadLayout(); $this->getLayout()->getBlock('left')->unsetChildren(); $this->getLayout()->getBlock('content')->unsetChildren(); $this->renderLayout(); } return $result; }
public function tryRegister() { $this->request = Mage::app()->getRequest(); if ($this->request->isPost()) { $sn = $this->request->getPost('sn', null); if ($sn == null) { return false; } $sn = trim($sn); try { $response = Itoris_Installer_Client::registerCurrentStoreHost($this->getAlias(), $sn); if ($response == 0) { $this->getAdminhtmlSession()->addSuccess($this->__('The component has been registered!')); Mage::app()->cleanCache(); } else { $this->getAdminhtmlSession()->addError($this->__('Invalid serial number!')); } } catch (Exception $e) { $this->getAdminhtmlSession()->addError($e->getMessage()); } } }
public function isRegistered($website) { return Itoris_Installer_Client::isRegistered($this->getAlias(), $website); }