$action = isset($_GET['action']) ? $_GET['action'] : false; if ($action == 'start') { CMedialib::Start(array( 'site' => isset($_REQUEST['site']) ? $_REQUEST['site'] : false, 'lang' => isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en', 'types' => $_POST['types'] )); } elseif ($action == 'get_items') { CMedialib::GetItems(array( 'site' => isset($_REQUEST['site']) ? $_REQUEST['site'] : false, 'lang' => isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en', 'collectionId' => intVal($_POST['col_id']) )); } elseif ($action == 'edit_collection') { $parent = intVal($_POST['parent']); $id = CMedialib::EditCollection(array( 'id' => intVal($_POST['id']), 'name' => $APPLICATION->UnJSEscape($_POST['name']), 'desc' => $APPLICATION->UnJSEscape($_POST['desc']), 'keywords' => $APPLICATION->UnJSEscape($_POST['keywords']), 'parent' =>$parent, 'site' => $_GET['site'], 'type' => $_POST['type'] ));