/** * * @param $option */ function save($option, $section, $task, $redirect = 1) { global $database, $mainframe, $my; $row = new rdRssData($database); if (!$row->bind($_POST)) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $params = mosGetParam($_POST, 'params', ''); if (is_array($params)) { $txt = array(); foreach ($params as $k => $v) { $txt[] = "{$k}={$v}"; } $row->params = implode("\n", $txt); } $catids = mosGetParam($_POST, 'catid', array()); $row->catids = implode(',', $catids); $isNew = $row->id < 1; if ($isNew) { $row->created = $row->created ? $row->created : date("Y-m-d H:i:s"); $row->created_by = $row->created_by ? $row->created_by : $my->id; $row->modified = date("Y-m-d H:i:s"); $row->modified_by = $my->id; } else { $row->modified = date("Y-m-d H:i:s"); $row->modified_by = $my->id; $row->checkin(); } if (!$row->store()) { echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n"; exit; } $msg = $row->name . _RDRSS_SCSA; if ($redirect) { mosRedirect("index2.php?option={$option}&task=list", $msg); } else { return $row->id; } }