public function pjActionStep6() { self::pjActionCheckConfig(); $this->pjActionCheckSession(); if (isset($_POST['step5'])) { $_POST = array_map('trim', $_POST); if (!isset($_POST['license_key']) || !pjValidation::pjActionNotEmpty($_POST['license_key'])) { $time = time(); $_SESSION[$this->defaultErrors][$time] = "License Key is required and can't be empty."; pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjInstaller&action=pjActionStep5&install=1&err=" . $time); } else { $_POST = pjSanitize::clean($_POST, array('encode' => false)); $_SESSION[$this->defaultInstaller] = array_merge($_SESSION[$this->defaultInstaller], $_POST); $Http = new pjHttp(); $Http->request(base64_decode("aHR0cDovL3N1cHBvcnQuc3RpdmFzb2Z0LmNvbS8=") . 'index.php?controller=Api&action=newInstall&key=' . urlencode($_POST['license_key']) . "&version=" . urlencode(PJ_SCRIPT_VERSION) . "&script_id=" . urlencode(PJ_SCRIPT_ID) . "&server_name=" . urlencode($_SERVER['SERVER_NAME']) . "&ip=" . urlencode($_SERVER['REMOTE_ADDR']) . "&referer=" . urlencode($_SERVER['HTTP_REFERER'])); $resp = $Http->getResponse(); $error = $Http->getError(); $time = time(); if ($resp === FALSE || !empty($error) && $error['code'] == 109) { $_SESSION[$this->defaultErrors][$time] = "Installation key cannot be verified. Please, make sure you install on a server which is connected to the internet."; pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjInstaller&action=pjActionStep5&install=1&err=" . $time); } else { $output = unserialize($resp); if (isset($output['hash']) && isset($output['code']) && $output['code'] == 200) { $_SESSION[$this->defaultInstaller]['private_key'] = $output['hash']; } else { $text = 'Key is wrong or not valid. Please check you data again.'; if (isset($output['code'])) { switch ((int) $output['code']) { case 101: $text = 'License key is not valid'; break; case 106: $text = 'Number of installations allowed has been reached'; break; } } $_SESSION[$this->defaultErrors][$time] = $text; pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjInstaller&action=pjActionStep5&install=1&err=" . $time); } } } } if (!isset($_SESSION[$this->defaultInstaller]['step5'])) { pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjInstaller&action=pjActionStep5&install=1"); } $this->appendJs('jquery.validate.min.js', $this->getConst('PLUGIN_LIBS_PATH')); $this->appendJs('pjInstaller.js', $this->getConst('PLUGIN_JS_PATH')); }