function publish($cid, $published) { global $my, $mainframe, $database, $option, $priTask, $subTask; global $WBG_CONFIG, $wbGalleryDB_cat; foreach ($cid as $id) { $row = new wbGalleryDB_cat($database); $row->load($id); $row->published = $published; if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } } mosRedirect('index2.php?option=' . $option . '&task=category'); }