security update devel, metatag
This commit is contained in:
@@ -4,12 +4,15 @@ namespace Drupal\devel;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Session\AccountProxyInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* Class DevelDumperManager
|
||||
* Class DevelDumperManager.
|
||||
*/
|
||||
class DevelDumperManager implements DevelDumperManagerInterface {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
/**
|
||||
* The devel config.
|
||||
*
|
||||
@@ -100,7 +103,7 @@ class DevelDumperManager implements DevelDumperManagerInterface {
|
||||
// The temp directory does vary across multiple simpletest instances.
|
||||
$file = file_directory_temp() . '/drupal_debug.txt';
|
||||
if (file_put_contents($file, $output, FILE_APPEND) === FALSE && $this->hasAccessToDevelInformation()) {
|
||||
drupal_set_message(t('Devel was unable to write to %file.', ['%file' => $file]), 'error');
|
||||
drupal_set_message($this->t('Devel was unable to write to %file.', ['%file' => $file]), 'error');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ class ThemeInfoRebuildSubscriber implements EventSubscriberInterface {
|
||||
protected function triggerWarningIfNeeded(Request $request) {
|
||||
if ($this->account && $this->account->hasPermission('access devel information')) {
|
||||
$session = $request->getSession();
|
||||
if (!$session->has($this->notificationFlag)) {
|
||||
if ($session && !$session->has($this->notificationFlag)) {
|
||||
$session->set($this->notificationFlag, TRUE);
|
||||
$message = $this->t('The theme information is being rebuilt on every request. Remember to <a href=":url">turn off</a> this feature on production websites.', [':url' => Url::fromRoute('devel.admin_settings')->toString()]);
|
||||
drupal_set_message($message, 'warning', TRUE);
|
||||
|
||||
@@ -69,11 +69,11 @@ class ConfigEditor extends FormBase {
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
$form['actions'] = array('#type' => 'actions');
|
||||
$form['actions']['submit'] = array(
|
||||
$form['actions'] = ['#type' => 'actions'];
|
||||
$form['actions']['submit'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Save'),
|
||||
);
|
||||
];
|
||||
$form['actions']['cancel'] = array(
|
||||
'#type' => 'link',
|
||||
'#title' => $this->t('Cancel'),
|
||||
|
||||
@@ -35,10 +35,11 @@ class ConfigsList extends FormBase {
|
||||
'#title_display' => 'invisible',
|
||||
'#default_value' => $filter,
|
||||
);
|
||||
$form['filter']['show'] = array(
|
||||
$form['filter']['actions'] = ['#type' => 'actions'];
|
||||
$form['filter']['actions']['show'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Filter'),
|
||||
);
|
||||
];
|
||||
|
||||
$header = array(
|
||||
'name' => array('data' => $this->t('Name')),
|
||||
|
||||
@@ -116,11 +116,11 @@ class DevelReinstall extends FormBase {
|
||||
|
||||
$form['#attached']['library'][] = 'system/drupal.system.modules';
|
||||
|
||||
$form['actions'] = array('#type' => 'actions');
|
||||
$form['actions']['submit'] = array(
|
||||
$form['actions'] = ['#type' => 'actions'];
|
||||
$form['actions']['submit'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Reinstall'),
|
||||
);
|
||||
];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Defines a form that allows privileged users to execute arbitrary PHP code.
|
||||
*/
|
||||
class ExecutePHP extends FormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'devel_execute_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form = array(
|
||||
'#title' => $this->t('Execute PHP Code'),
|
||||
'#description' => $this->t('Execute some PHP code'),
|
||||
);
|
||||
$form['execute']['code'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('PHP code to execute'),
|
||||
'#description' => t('Enter some code. Do not use <code><?php ?></code> tags.'),
|
||||
'#default_value' => (isset($_SESSION['devel_execute_code']) ? $_SESSION['devel_execute_code'] : ''),
|
||||
'#rows' => 20,
|
||||
);
|
||||
$form['execute']['op'] = array('#type' => 'submit', '#value' => t('Execute'));
|
||||
$form['#redirect'] = FALSE;
|
||||
if (isset($_SESSION['devel_execute_code'])) {
|
||||
unset($_SESSION['devel_execute_code']);
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
ob_start();
|
||||
$code = $form_state->getValue('code');
|
||||
print eval($code);
|
||||
$_SESSION['devel_execute_code'] = $code;
|
||||
dpm(ob_get_clean());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class SettingsForm extends ConfigFormBase {
|
||||
$form['page_alter'] = array('#type' => 'checkbox',
|
||||
'#title' => t('Display $page array'),
|
||||
'#default_value' => $devel_config->get('page_alter'),
|
||||
'#description' => t('Display $page array from <a href="http://api.drupal.org/api/function/hook_page_alter/7">hook_page_alter()</a> in the messages area of each page.'),
|
||||
'#description' => t('Display $page array from <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_page_attachments_alter/8">hook_page_attachments_alter()</a> in the messages area of each page.'),
|
||||
);
|
||||
$form['raw_names'] = array('#type' => 'checkbox',
|
||||
'#title' => t('Display machine names of permissions and modules'),
|
||||
|
||||
@@ -108,17 +108,17 @@ class SystemStateEdit extends FormBase {
|
||||
'#rows' => 15,
|
||||
);
|
||||
|
||||
$form['actions'] = array('#type' => 'actions');
|
||||
$form['actions']['submit'] = array(
|
||||
$form['actions'] = ['#type' => 'actions'];
|
||||
$form['actions']['submit'] = [
|
||||
'#type' => 'submit',
|
||||
'#value' => $this->t('Save'),
|
||||
'#disabled' => $disabled,
|
||||
);
|
||||
$form['actions']['cancel'] = array(
|
||||
];
|
||||
$form['actions']['cancel'] = [
|
||||
'#type' => 'link',
|
||||
'#title' => $this->t('Cancel'),
|
||||
'#url' => Url::fromRoute('devel.state_system_page')
|
||||
);
|
||||
];
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\devel\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
|
||||
/**
|
||||
* Provides a block for executing PHP code.
|
||||
*
|
||||
* @Block(
|
||||
* id = "devel_execute_php",
|
||||
* admin_label = @Translation("Execute PHP")
|
||||
* )
|
||||
*/
|
||||
class DevelExecutePHP extends BlockBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function blockAccess(AccountInterface $account) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'execute php code');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build() {
|
||||
return \Drupal::formBuilder()->getForm('Drupal\devel\Form\ExecutePHP');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user