$id, 'name' => getlocal_($id, "names")); } $page['locales'] = $locales_with_label; $lang = verifyparam("lang", "/^[\w-]{2,5}$/", ""); if (!$lang || !in_array($lang, $all_locales)) { $lang = in_array($current_locale, $all_locales) ? $current_locale : $all_locales[0]; } # groups $groupid = ""; $groupid = verifyparam("group", "/^\d{0,8}$/", ""); if ($groupid) { $group = group_by_id($groupid); if (!$group) { $errors[] = getlocal("page.group.no_such"); $groupid = ""; } } $allgroups = in_isolation($operator)?get_all_groups_for_operator($operator):get_all_groups(); $page['groups'] = array(); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach ($allgroups as $g) { $page['groups'][] = $g; } # delete if (isset($_GET['act']) && $_GET['act'] == 'delete') { $key = isset($_GET['key']) ? $_GET['key'] : ""; if (!preg_match("/^\d+$/", $key)) { $errors[] = "Wrong key"; } if (count($errors) == 0) { $db = Database::getInstance(); $db->query("delete from {chatresponses} where id = ?", array($key)); header("Location: $webimroot/operator/canned.php?lang=$lang&group=$groupid"); exit; } } # get messages $messages = load_canned_messages($lang, $groupid); setup_pagination($messages); # form values $page['formlang'] = $lang; $page['formgroup'] = $groupid; prepare_menu($operator); start_html_output(); require('../view/canned.php'); ?>