$category_object->right_id = $row['right_id'] + 1; } else { $sql = 'SELECT MAX(right_id) AS right_id FROM ' . TITANIA_CATEGORIES_TABLE; $result = phpbb::$db->sql_query($sql); $row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); $category_object->left_id = $row['right_id'] + 1; $category_object->right_id = $row['right_id'] + 2; } } else { $category_check = new titania_category(); $category_check->load($category_id); if ($category_check->parent_id != $category_object->parent_id) { if ($category_check->category_id != $category_object->parent_id) { $errors_extra = $category_object->move_category($category_object->parent_id); // Check for errors from moving the category if (sizeof($errors_extra)) { $error = array_merge($error, $errors_extra); } } else { $category_object->parent_id = $category_check->parent_id; } } } // Only update category if no errors occurred from moving it if (!sizeof($error)) { // Now we submit the category information... $category_object->submit(); // Redirect back to the previous category redirect(titania_url::build_url('manage/categories', array('c' => $category_object->parent_id)));