db_query("UPDATE {block} SET status = %d, weight = %d, region = '%s' WHERE module = '%s' AND delta = '%s' AND theme = '%s'",$block['status'],$block['weight'],$block['region'],$block['module'],$block['delta'],$block['theme']);
db_update('block')
->fields(array(
'status'=>$block['status'],
'weight'=>$block['weight'],
'region'=>$block['region'],
))
->condition('module',$block['module'])
->condition('delta',$block['delta'])
->condition('theme',$block['theme'])
->execute();
}
drupal_set_message(t('The block settings have been updated.'));
$box_exists=(bool)db_query_range('SELECT 1 FROM {box} WHERE bid <> :bid AND info = :info',array(':bid'=>$form_state['values']['delta'],':info'=>$form_state['values']['info']),0,1)->fetchField();
$box_exists=(bool)db_query_range('SELECT 1 FROM {box} WHERE bid <> :bid AND info = :info',array(
$result=db_query("SELECT DISTINCT b.* FROM {block} b LEFT JOIN {block_role} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom <> 0 AND (r.rid IN (:rids) OR r.rid IS NULL) ORDER BY b.weight, b.module",array(':rids'=>$rids));
@@ -568,8 +579,23 @@ function _block_load_blocks() {
$blocks=array();
$rids=array_keys($user->roles);
$result=db_query(db_rewrite_sql("SELECT DISTINCT b.* FROM {block} b LEFT JOIN {block_role} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (".db_placeholders($rids).") OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module",'b','bid'),array_merge(array($theme_key),$rids));
while($block=db_fetch_object($result)){
$query=db_select('block','b');
$query->leftJoin('block_role','r','b.module = r.module AND b.delta = r.delta');