function display($tpl = null)
 {
     $config = SroHelper::getConfig();
     $app = JFactory::getApplication();
     $this->lame = JRequest::getVar("lame", false);
     if (!SroHelper::checkIP(true)) {
         $this->timeout = $config->get("timeout_text", "");
     } else {
         $state = $this->get("state");
         $this->dbextra = $state->get("dbextra");
         if (empty($this->dbextra)) {
             $this->dbextra = "main";
         }
         $this->items = $this->get("items");
         if (count($errors = $this->get('Errors'))) {
             $this->error = implode('<br />', $errors);
         }
         $strings = new SroStrings();
         foreach ($strings as $var => &$value) {
             $value = $config->get($var, "");
         }
         $this->strings = $strings;
     }
     $this->setLayout("response2");
     parent::display($tpl);
 }
 public function display($tpl = null)
 {
     $img = self::randomCaptcha();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $config = SroHelper::getConfig();
     $remote_addr = $_SERVER["REMOTE_ADDR"];
     $whitelist = SroHelper::getWhitelist();
     $this->timeout = false;
     $this->configwhite = 0;
     if (in_array($remote_addr, $whitelist)) {
         $this->configwhite = 1;
     } elseif (!SroHelper::checkIP(false)) {
         $this->timeout = $config->get("timeout_text", "");
     }
     $this->introtext = $config->get("introtext", "");
     $this->field_label = $config->get("field_label", "");
     $this->field_label_former = $config->get("field_label_former", "");
     $this->field_label_cert = $config->get("field_label_cert", "");
     $this->field_label_code = $config->get("field_label_code", "");
     $this->field_label_captcha = $config->get("field_label_captcha", "");
     $this->button_label = $config->get("button_label", "");
     $this->button_label_generate = $config->get("button_label_generate", "");
     $this->button_label_apply = $config->get("button_label_apply", "");
     $this->field_label_currcode = $config->get("field_label_currcode", JText::_("COM_SRO_SEARCH_FORM_CURRCODE_HEADING"));
     $this->searchtimeout = $config->get("searchtimeout", "");
     $this->codetimeout = $config->get("codetimeout", "");
     $this->timeout_text = $config->get("timeout_text", "");
     $this->error_captcha = $config->get("error_captcha", "");
     if ($config->get("update_time_enabled", "") > 0) {
         $this->LastUpdateTime = SroHelper::GetUpdateTime();
         $this->LastUpdateTitle = $config->get("update_time_title", "");
     }
     if ($config->get("check_js_enabled", "") > 0) {
         $this->check_js_enabled = '<noscript><meta http-equiv="refresh" content="0; url=/javascriptdisabled.html"></noscript>';
     }
     $this->header_generate_code = $config->get("header_generate_code", JText::_("COM_SRO_CONFIG_STRINGS_HEADING_FOLD_GENERATE_CODE_DESC"));
     $this->heading_fold_main = $config->get("heading_fold_main", JText::_("COM_SRO_SEARCH_FORM_MAIN_HEADING"));
     $this->heading_fold_former = $config->get("heading_fold_former", JText::_("COM_SRO_SEARCH_FORM_FORMER_HEADING"));
     $this->heading_fold_oldcert = $config->get("heading_fold_oldcert", JText::_("COM_SRO_SEARCH_FORM_OLDCERT_HEADING"));
     $this->heading_fold_applyphonecode = $config->get("heading_fold_applyphonecode", JText::_("COM_SRO_SEARCH_FORM_APPLYCODE_HEADING"));
     $this->heading_fold_captcha = $config->get("heading_fold_captcha", JText::_("COM_SRO_SEARCH_FORM_CAPTCHA_HEADING"));
     $this->heading_fold_botcode = $config->get("heading_fold_botcode", JText::_("COM_SRO_SEARCH_FORM_GETCODE_HEADING"));
     //INTROTEXT
     $this->introtext_generatecode = $config->get("introtext_generatecode", "");
     $this->introtext_main = $config->get("introtext_main", "");
     $this->introtext_botcode = $config->get("introtext_botcode", "");
     $this->introtext_applycode = $config->get("introtext_applycode", "");
     $this->introtext_former = $config->get("introtext_former", "");
     $this->introtext_oldcert = $config->get("introtext_oldcert", "");
     $this->introtext_captcha = $config->get("introtext_captcha", "");
     //AFTERTEXT
     $this->aftertext_generatecode = $config->get("aftertext_generatecode", "");
     $this->aftertext_main = $config->get("aftertext_main", "");
     $this->aftertext_botcode = $config->get("aftertext_botcode", "");
     $this->aftertext_applycode = $config->get("aftertext_applycode", "");
     $this->aftertext_former = $config->get("aftertext_former", "");
     $this->aftertext_oldcert = $config->get("aftertext_oldcert", "");
     $this->aftertext_captcha = $config->get("aftertext_captcha", "");
     $this->rand_captcha = '/media/com_sro/images/captcha/' . $img[basename];
     if (!empty($_COOKIE['botcode'])) {
         $this->curr_botcode = $_COOKIE['botcode'];
     }
     $this->setDocument();
     if ($this->getLayout() == "lame") {
         require_once JPATH_COMPONENT . "/views/strings.class.php";
         $strings = new SroStrings();
         foreach ($strings as $var => &$value) {
             $value = $config->get($var, "");
         }
         $this->strings = $strings;
         $one = JRequest::getVar("one");
         if ($one == '') {
             $this->one = array("update_time", "main", "former", "oldcert");
         }
         if ($one == 'main') {
             $this->one = array("update_time", "phonecode", "main", "botcode", "applyphonecode", "captcha", "former", "oldcert");
         }
     }
     parent::display($tpl);
 }