Skip to content

Commit

Permalink
Correction $this par $this->core
Browse files Browse the repository at this point in the history
  • Loading branch information
Gvx- committed May 29, 2020
1 parent f7e09b3 commit 73e67bf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dcScript/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Changelog
=========

Version 2.2.0 (2020-04-xx)
Version 2.2.0 (2020-05-xx)
--------------------------

* Correctifs divers
Expand Down
2 changes: 1 addition & 1 deletion dcScript/_define.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/* Name */ 'dcScript',
/* Description*/ 'Add script for DC',
/* Author */ 'Gvx',
/* Version */ '2.2.0-dev-r0013',
/* Version */ '2.2.0-dev-r0015',
array(
/* standard plugin options dotclear */
'permissions' => 'dcScript.edit',
Expand Down
22 changes: 11 additions & 11 deletions dcScript/inc/class.dcScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ public function index() {
if(!defined('DC_CONTEXT_ADMIN')) { return; }
dcPage::check('dcScript.edit');
if(!$this->settings('enabled') && is_file(path::real($this->info('root').'/_config.php'))) {
if($this->auth->check('admin', $this->blog->id)) {
if($this->core->auth->check('admin', $this->core->blog->id)) {
$this->core->adminurl->redirect('admin.plugins', array(
'module' => $this->info('id'),'conf' => 1, 'redir' => $this->core->adminurl->get($this->info('adminUrl'))
));
} else {
$this->notices->addNotice('message', sprintf(__('%s plugin is not configured.'), $this->info('name')));
$this->core->notices->addNotice('message', sprintf(__('%s plugin is not configured.'), $this->info('name')));
$this->core->adminurl->redirect('admin.home');
}
}
Expand All @@ -228,43 +228,43 @@ public function index() {
$this->settings('header_code', dcScript::encrypt(trim($_POST['header_code']), $this->getCryptKey(), dcScript::OPENSSL));
$this->settings('footer_code', dcScript::encrypt(trim($_POST['footer_code']), $this->getCryptKey(), dcScript::OPENSSL));
$this->settings('crypt_lib', dcScript::OPENSSL);
$this->blog->triggerBlog();
$this->core->blog->triggerBlog();
dcPage::addSuccessNotice(__('Code successfully updated.'));
$this->core->adminurl->redirect($this->info('adminUrl'), array(), '#tab-1');
}
# submit tab 1 (standard page)
if (isset($_POST['update_header'])) {
$this->settings('header_code', dcScript::encrypt(trim($_POST['header_code'])."\n", $this->getCryptKey(), dcScript::OPENSSL));
$this->blog->triggerBlog();
$this->core->blog->triggerBlog();
dcPage::addSuccessNotice(__('Code successfully updated.'));
$this->core->adminurl->redirect($this->info('adminUrl'), array(), '#tab-1');
}
# submit tab 2 (standard page)
if (isset($_POST['update_footer'])) {
$this->settings('footer_code', dcScript::encrypt(trim($_POST['footer_code'])."\n", $this->getCryptKey(), dcScript::OPENSSL));
$this->blog->triggerBlog();
$this->core->blog->triggerBlog();
dcPage::addSuccessNotice(__('Code successfully updated.'));
$this->core->adminurl->redirect($this->info('adminUrl'), array(), '#tab-2');
}
} catch(exception $e) {
//$this->error->add($e->getMessage());
$this->error->add(__('Unable to save the code'));
//$this->core->error->add($e->getMessage());
$this->core->error->add(__('Unable to save the code'));
}
}

if (!empty($_GET)) {
try {
# download code (standard page)
if(isset($_GET['download']) && in_array($_GET['download'], array('header', 'footer'), true)) {
$filename = '"'.trim($this->blog->name).'_'.date('Y-m-d').'_'.$_GET['download'].'.'.trim($this->settings('backup_ext'),'.').'"';
$filename = '"'.trim($this->core->blog->name).'_'.date('Y-m-d').'_'.$_GET['download'].'.'.trim($this->settings('backup_ext'),'.').'"';
header('Content-Disposition: attachment;filename='.$filename);
header('Content-Type: text/plain; charset=UTF-8');
echo dcScript::decrypt($this->settings($_GET['download'].'_code'), $this->getCryptKey(), $this->getCryptLib());
exit;
}
} catch(exception $e) {
//$this->error->add($e->getMessage());
$this->error->add(__('Unable to save the file'));
//$this->core->error->add($e->getMessage());
$this->core->error->add(__('Unable to save the file'));
}
}

Expand Down Expand Up @@ -414,7 +414,7 @@ public function _admin() {
$this->core->auth->setPermissionType('dcScript.edit',__('Edit public scripts'));

# menu & dashboard
$this->core->addBehavior('adminDashboardFavorites', array($this->core->dcScript, 'adminDashboardFavs'));
$this->core->addBehavior('adminDashboardFavorites', array($this, 'adminDashboardFavs'));
$this->adminMenu('System');

if(!$this->core->auth->check('admin', $this->core->blog->id)) { return; }
Expand Down
1 change: 1 addition & 0 deletions dcScript/inc/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @copyright © 2014-2020 Gvx
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
'use strict';

/** @version 0.27.0 */

Expand Down
1 change: 1 addition & 0 deletions dcScript/inc/js/index_warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @copyright © 2014-2020 Gvx
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
'use strict';

/** @version 0.2.0 */

Expand Down

0 comments on commit 73e67bf

Please sign in to comment.