Format code using php-cs-fixer
This commit is contained in:
parent
43d7dc92cd
commit
d52c6184b9
352 changed files with 17473 additions and 17041 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
class Application_Form_Login extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
@ -19,73 +18,73 @@ class Application_Form_Login extends Zend_Form
|
|||
foreach (CORSHelper::getAllowedOrigins($request) as $safeOrigin) {
|
||||
if ($this->startsWith($safeOrigin, $refererUrl)) {
|
||||
$originIsSafe = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$originIsSafe) {
|
||||
$this->addElement('hash', 'csrf', array(
|
||||
'salt' => 'unique'
|
||||
));
|
||||
$this->addElement('hash', 'csrf', [
|
||||
'salt' => 'unique',
|
||||
]);
|
||||
}
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/login.phtml'))
|
||||
));
|
||||
$this->setDecorators([
|
||||
['ViewScript', ['viewScript' => 'form/login.phtml']],
|
||||
]);
|
||||
|
||||
// Add username element
|
||||
$username = new Zend_Form_Element_Text("username");
|
||||
$username = new Zend_Form_Element_Text('username');
|
||||
$username->setLabel(_('Username:'))
|
||||
->setAttribs(array(
|
||||
->setAttribs([
|
||||
'autofocus' => 'true',
|
||||
'class' => 'input_text',
|
||||
'required' => 'true'))
|
||||
->setValue((isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'')
|
||||
'required' => 'true', ])
|
||||
->setValue((isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) ? 'admin' : '')
|
||||
->addFilter('StringTrim')
|
||||
->setDecorators(array('ViewHelper'))
|
||||
->setValidators(array('NotEmpty'));
|
||||
->setDecorators(['ViewHelper'])
|
||||
->setValidators(['NotEmpty'])
|
||||
;
|
||||
$this->addElement($username);
|
||||
|
||||
// Add password element
|
||||
$this->addElement('password', 'password', array(
|
||||
'label' => _('Password:'),
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
$this->addElement('password', 'password', [
|
||||
'label' => _('Password:'),
|
||||
'class' => 'input_text',
|
||||
'required' => true,
|
||||
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) ? 'admin' : '',
|
||||
'filters' => ['StringTrim'],
|
||||
'validators' => [
|
||||
'NotEmpty',
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$locale = new Zend_Form_Element_Select("locale");
|
||||
$locale->setLabel(_("Language:"));
|
||||
],
|
||||
'decorators' => [
|
||||
'ViewHelper',
|
||||
],
|
||||
]);
|
||||
|
||||
$locale = new Zend_Form_Element_Select('locale');
|
||||
$locale->setLabel(_('Language:'));
|
||||
$locale->setMultiOptions(Application_Model_Locale::getLocales());
|
||||
$locale->setDecorators(array('ViewHelper'));
|
||||
$locale->setDecorators(['ViewHelper']);
|
||||
$this->addElement($locale);
|
||||
$this->setDefaults(array(
|
||||
"locale" => Application_Model_Locale::getUserLocale()
|
||||
));
|
||||
$this->setDefaults([
|
||||
'locale' => Application_Model_Locale::getUserLocale(),
|
||||
]);
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('submit', 'submit', array(
|
||||
'ignore' => true,
|
||||
'label' => _('Login'),
|
||||
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('submit', 'submit', [
|
||||
'ignore' => true,
|
||||
'label' => _('Login'),
|
||||
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
|
||||
'decorators' => [
|
||||
'ViewHelper',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* tests if a string starts with a given string
|
||||
* tests if a string starts with a given string.
|
||||
*
|
||||
* This method was pinched as is from phing since it was the only line of code
|
||||
* actually used from phing. I'm not 100% convinced why it was deemed necessary
|
||||
|
@ -102,10 +101,10 @@ class Application_Form_Login extends Zend_Form
|
|||
*/
|
||||
private function startsWith($check, $string)
|
||||
{
|
||||
if ($check === "" || $check === $string) {
|
||||
if ($check === '' || $check === $string) {
|
||||
return true;
|
||||
} else {
|
||||
return (strpos($string, $check) === 0) ? true : false;
|
||||
}
|
||||
|
||||
return (strpos($string, $check) === 0) ? true : false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue