if (!isset($description) || !is_scalar($description)) { $description = ''; } if (!isset($creatable_rooms) || !is_scalar($creatable_rooms)) { $creatable_rooms = 'n'; } $errortext = array(); if (!empty($current_user->id) && $current_user->is_admin === 'y' && $session->_s_user_id == $current_user->id) { $xmlwriter->setHeaderStatus(1); $xmlwriter->setHeaderMessage($l->g('error')); if (!empty($category_id) && $category->_db_getList('id = ' . $category_id)) { // Category exists $xmlwriter->setHeaderStatus(0); $xmlwriter->setHeaderMessage('OK'); $category_data = $category->_db_list[0]; $category->_db_freelist(); switch ($action) { case 'change_listpos': if (empty($dir)) { // Move up if ($category->_db_getList('id,listpos', 'parent_id = ' . $category_data['parent_id'], 'listpos < ' . $category_data['listpos'], 'listpos DESC', 1)) { $higher_cat_id = $category->_db_list[0]['id']; $higher_cat_listpos = $category->_db_list[0]['listpos']; // Update category $category->updateCategory($category_id, false, true, null, null, null, null, $higher_cat_listpos); // Update higher category $category->updateCategory($higher_cat_id, false, true, null, null, null, null, $category_data['listpos']); } } else { // Move down if ($category->_db_getList('id,listpos', 'parent_id = ' . $category_data['parent_id'], 'listpos > ' . $category_data['listpos'], 'listpos ASC', 1)) {