/** * Update Multiple column in central columns list if a chnage is requested * * @return true|PMA\libraries\Message */ function PMA_updateMultipleColumn() { $db = $_POST['db']; $col_name = $_POST['field_name']; $orig_col_name = $_POST['orig_col_name']; $col_default = $_POST['field_default_type']; $col_length = $_POST['field_length']; $col_attribute = $_POST['field_attribute']; $col_type = $_POST['field_type']; $collation = $_POST['field_collation']; $col_isNull = array(); $col_extra = array(); $num_central_fields = count($orig_col_name); for ($i = 0; $i < $num_central_fields; $i++) { $col_isNull[$i] = isset($_POST['field_null'][$i]) ? 1 : 0; $col_extra[$i] = isset($_POST['col_extra'][$i]) ? $_POST['col_extra'][$i] : ''; if ($col_default[$i] == 'NONE') { $col_default[$i] = ""; } else { if ($col_default[$i] == 'USER_DEFINED') { $col_default[$i] = $_POST['field_default_value'][$i]; } } $message = PMA_updateOneColumn($db, $orig_col_name[$i], $col_name[$i], $col_type[$i], $col_attribute[$i], $col_length[$i], $col_isNull[$i], $collation[$i], $col_extra[$i], $col_default[$i]); if (!is_bool($message)) { return $message; } } return true; }
/** * Test for PMA_updateOneColumn * * @return void */ public function testPMAUpdateOneColumn() { $this->assertTrue(PMA_updateOneColumn("phpmyadmin", "", "", "", "", "", "", "", "", "")); $this->assertTrue(PMA_updateOneColumn("phpmyadmin", "col1", "", "", "", "", "", "", "", "")); }
} $col_default = $_POST['col_default']; if ($col_default == 'NONE' && $_POST['col_default_sel'] != 'USER_DEFINED') { $col_default = ""; } $col_extra = isset($_POST['col_extra']) ? $_POST['col_extra'] : ''; $col_isNull = isset($_POST['col_isNull']) ? 1 : 0; $col_length = $_POST['col_length']; $col_attribute = $_POST['col_attribute']; $col_type = $_POST['col_type']; $collation = $_POST['collation']; if (isset($orig_col_name) && $orig_col_name) { echo PMA_updateOneColumn($db, $orig_col_name, $col_name, $col_type, $col_attribute, $col_length, $col_isNull, $collation, $col_extra, $col_default); exit; } else { $tmp_msg = PMA_updateOneColumn($db, "", $col_name, $col_type, $col_attribute, $col_length, $col_isNull, $collation, $col_extra, $col_default); } } if (isset($_POST['populateColumns'])) { $selected_tbl = $_POST['selectedTable']; echo PMA_getHTMLforColumnDropdown($db, $selected_tbl); exit; } if (isset($_POST['getColumnList'])) { echo PMA_getCentralColumnsListRaw($db, $_POST['cur_table']); exit; } if (isset($_POST['add_column'])) { $selected_col = array(); $selected_tbl = $_POST['table-select']; $selected_col[] = $_POST['column-select'];