diff options
Diffstat (limited to 'modules/block')
-rw-r--r-- | modules/block/block.admin.inc | 4 | ||||
-rw-r--r-- | modules/block/block.module | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 5fcfbdbe8..c99973f47 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -190,7 +190,7 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) { '#collapsed' => TRUE, ); - $access = user_access('use PHP for block visibility'); + $access = user_access('use PHP for settings'); if ($edit['visibility'] == 2 && !$access) { $form['page_vis_settings'] = array(); $form['page_vis_settings']['visibility'] = array('#type' => 'value', '#value' => 2); @@ -200,7 +200,7 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) { $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.')); $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')); - if ($access) { + if (module_exists('php') && $access) { $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).'); $description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>')); } diff --git a/modules/block/block.module b/modules/block/block.module index ae79d143e..9a46ba7d4 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -113,10 +113,6 @@ function block_perm() { 'title' => t('Administer blocks'), 'description' => t('Select which blocks are displayed, and arrange them on the page.'), ), - 'use PHP for block visibility' => array( - 'title' => t('Use PHP for block visibility'), - 'description' => t('Enter PHP code in the field for block visibility settings. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), - ), ); } @@ -608,8 +604,11 @@ function _block_load_blocks() { // is displayed only on those pages listed in $block->pages. $page_match = !($block->visibility xor $page_match); } + elseif (module_exists('php')) { + $page_match = php_eval($block->pages); + } else { - $page_match = drupal_eval($block->pages); + $page_match = FALSE; } } else { |