<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Core_Form_Admin_Index_LicenseKey extends Engine_Form
{
	public function init()
	{
		$this
			->setTitle('Update License Key');
		$this->setAttrib('class', 'global_form_popup');

		// Key
		$this->addElement('Text', 'key', array(
			'label' => 'New License Key:',
			'required' => true,
			'allowEmpty' => false,
			'value' => Engine_Api::_()->getApi('settings', 'core')->core_license_key,
			'validators' => array(
				array('NotEmpty', true),
			)
		));
		$this->getElement('key')->getValidator('NotEmpty')
			->setMessage('Please fill in the license key.', 'notEmptyInvalid')
			->setMessage('Please fill in the license key.', 'isEmpty');

		if (engine_in_array($_SERVER['SERVER_NAME'], ['localhost', '127.0.0.1'])) {
			$this->addElement('Text', 'domain_name', array(
				'label' => 'Domain Name',
				'required' => true,
				'allowEmpty' => false,
				'validators' => array(
					array('NotEmpty', true),
				)
			));
			$this->getElement('domain_name')->getValidator('NotEmpty')
				->setMessage('Please fill in the domain name.', 'notEmptyInvalid')
				->setMessage('Please fill in the domain name.', 'isEmpty');
		}

		$this->addElement('Button', 'submit', array(
			'label' => 'Save',
			'type' => 'submit',
			'ignore' => true,
			'decorators' => array('ViewHelper')
		));
	}
}
