/** * save category information * @param $cat_id category id * @param $cat_name category name * @param return xml (<ret>0</ret>|<ret>1</ret>) */ function editCategorySubmit($cat_id, $cat_name) { if (!$this->_admin) { return '<ret>0</ret>'; } $cat_name = unicode_urldecode($cat_name); prepare_to_db($cat_name, 0); // cat_name check $db = new DbAdmin(); if ($cat_id) { return $db->editCategory((int) $cat_id, $cat_name) ? '<ret>1</ret>' : '<ret>0</ret>'; } else { global $f; $cat_uri = $f->uriGenerate($cat_name, TF_FORUM_CAT, 'cat_uri'); return $db->insertCategory($cat_name, $cat_uri) ? '<ret>1</ret>' : '<ret>0</ret>'; } }
/** * save category information * @param $cat_id category id * @param $cat_name category name * @param return xml (<ret>0</ret>|<ret>1</ret>) */ function editCategorySubmit($cat_id, $cat_name, $cat_order, $cat_expanded) { if (!$this->_admin || 0 != strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) { return '<ret>0</ret>'; } $cat_name = unicode_urldecode($cat_name); prepare_to_db($cat_name, 0); // cat_name check $db = new DbAdmin(); if ($cat_id) { return $db->editCategory((int) $cat_id, $cat_name, (int) $cat_order, $cat_expanded ? 1 : 0) ? '<ret>1</ret>' : '<ret>0</ret>'; } else { global $f; $cat_uri = $f->uriGenerate($cat_name, TF_FORUM_CAT, 'cat_uri'); return $db->insertCategory($cat_name, $cat_uri, (int) $cat_order, $cat_expanded ? 1 : 0) ? '<ret>1</ret>' : '<ret>0</ret>'; } }
/** * save category information * @param $cat_id category id * @param $cat_name category name * @param return xml (<ret>0</ret>|<ret>1</ret>) */ function editCategorySubmit($cat_id, $cat_name) { if (!$this->_admin) { return '<ret>0</ret>'; } $cat_name = unicode_urldecode($cat_name); prepare_to_db($cat_name, 0); // cat_name check $db = new DbAdmin(); if ($cat_id) { return $db->editCategory((int) $cat_id, $cat_name) ? '<ret>1</ret>' : '<ret>0</ret>'; } else { return $db->insertCategory($cat_name) ? '<ret>1</ret>' : '<ret>0</ret>'; } }