db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'",$block['status'],$block['weight'],$block['region'],isset($block['throttle'])?$block['throttle']:0,$block['module'],$block['delta'],$block['theme']);
}
drupal_set_message(t('The block settings have been updated.'));
cache_clear_all();
}
/**
* Helper function for sorting blocks on admin/build/block.
*
* Active blocks are sorted by region, then by weight.
* Disabled blocks are sorted by name.
*/
function_block_compare($a,$b){
$status=$b['status']-$a['status'];
// Separate enabled from disabled.
if($status){
return$status;
}
// Enabled blocks
if($a['status']){
$place=strcmp($a['region'],$b['region']);
return$place?$place:($a['weight']-$b['weight']);
}
// Disabled blocks
else{
returnstrcmp($a['info'],$b['info']);
}
}
/**
* Menu callback; displays the block configuration form.
$edit=db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s'",$module,$delta));
$form['block_settings']=array(
'#type'=>'fieldset',
'#title'=>t('Block specific settings'),
'#collapsible'=>TRUE,
);
$form['block_settings']['title']=array(
'#type'=>'textfield',
'#title'=>t('Block title'),
'#maxlength'=>64,
'#description'=>$module=='block'?t('The title of the block as shown to the user.'):t('Override the default title for the block. Use <em><none></em> to display no title, or leave blank to use the default block title.'),
$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){
$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 ?>'));
if(empty($form_state['values']['info'])||db_num_rows(db_query("SELECT bid FROM {boxes} WHERE bid != %d AND info = '%s'",$form_state['values']['delta'],$form_state['values']['info']))){
form_set_error('info',t('Please ensure that each block description is unique.'));
returnconfirm_form($form,t('Are you sure you want to delete the block %name?',array('%name'=>$box['info'])),'admin/build/block','',t('Delete'),t('Cancel'));
db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'",$block['status'],$block['weight'],$block['region'],isset($block['throttle'])?$block['throttle']:0,$block['module'],$block['delta'],$block['theme']);
}
drupal_set_message(t('The block settings have been updated.'));
cache_clear_all();
}
/**
* Theme main block administration form submission.
*
...
...
@@ -376,211 +293,6 @@ function block_box_get($bid) {
returndb_fetch_array(db_query("SELECT bx.*, bl.title FROM {boxes} bx INNER JOIN {blocks} bl ON bx.bid = bl.delta WHERE bl.module = 'block' AND bx.bid = %d",$bid));
}
/**
* Menu callback; displays the block configuration form.
$edit=db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s'",$module,$delta));
$form['block_settings']=array(
'#type'=>'fieldset',
'#title'=>t('Block specific settings'),
'#collapsible'=>TRUE,
);
$form['block_settings']['title']=array(
'#type'=>'textfield',
'#title'=>t('Block title'),
'#maxlength'=>64,
'#description'=>$module=='block'?t('The title of the block as shown to the user.'):t('Override the default title for the block. Use <em><none></em> to display no title, or leave blank to use the default block title.'),
$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){
$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 ?>'));
if(empty($form_state['values']['info'])||db_num_rows(db_query("SELECT bid FROM {boxes} WHERE bid != %d AND info = '%s'",$form_state['values']['delta'],$form_state['values']['info']))){
form_set_error('info',t('Please ensure that each block description is unique.'));