พอเปลี่ยนขนาดความกว้างเป็น 800 แล้วตั้งค่าในฐานข้อมูลก็เปลี่ยนขนาด width เป็น 800 แต่ตัวแปรจาก global ยังเป็นค่าเก่าก่อนตั้งค่า
ลอง unset แล้วประกาศ global ใหม่ก็ไม่ได้คับ
โค้ด: เลือกทั้งหมด
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$this->config = $config;
$this->request = $request;
$this->tpl_name = 'acp_m_mtb_news';
$submit = (isset($_POST['submit'])) ? true : false;
$action = request_var('action', array(''),true);
$act = request_var('maction', '');
$actionform = '';
if($action){
$actionform = $action[0];
}else{
$actionform = $act;
}
switch ($mode)
{
case 'crop_size':
$template->assign_vars(array(
'S_WIDTH' => $config['mtb_crop_width'],
'S_HEIGHT' => $config['mtb_crop_height'],
'T_ACTION' => $this->u_action .'&action_m=save',
));
$action_m = request_var('action_m', '');
switch ($action_m)
{
case 'save':
$width = request_var('width','',0);
$height = request_var('height','',0);
$sql = 'UPDATE ' . CONFIG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
'config_value' => $width ,))
. " WHERE config_name = 'mtb_crop_width'" ;
$sql_query = $db->sql_query($sql);
$sql = 'UPDATE ' . CONFIG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
'config_value' => $height ,))
. " WHERE config_name = 'mtb_crop_height'" ;
$sql_query = $db->sql_query($sql);
meta_refresh(2, $this->u_action);
trigger_error($user->lang['SUCCESS_UPDATED'] . adm_back_link($this->u_action));
break;
}
$this->tpl_name = 'acp_crop_size';
$this->page_title = 'ACP_CROP_SIZE';
break;