Update table.php

The publish-function must take care for the field to use for its task. While today it is not only the 'published' field that holds a row's state, but also a field named 'state' (e.g. content-table), it must be taken care of which field to use. For that reason i added a first check for the field's general availability and a second check for the mentioned fields giving the most commonly use one - 'published' - priority. Also the query and value re-assignment were fixed to reference the field from the variable that holds the detected field name. This allows for more flexibility and less unchanged rows.