function import_csv($window) { global $statusbar; $filename = wb_sys_dlg_open($window, "Import CSV", "CSV files (*.csv, *.txt)*.csv;*.txtAll files (*.*)*.*" . ""); if ($filename) { $csv = file($filename); } else { return false; } $n = 0; foreach ($csv as $line) { $line = trim($line); if ($line) { $entry = csv_explode(stripcslashes($line)); if (edit_record("item", 0, "name\ndescription\ncat\npriority\nseverity", $entry)) { $n++; } } } wb_set_text($statusbar, basename($filename) . " imported successfully ({$n} items added)."); return true; }
$perm_meta_edit = "all"; } elseif (do_hook('verify_permission', 'zone_meta_edit_own')) { $perm_meta_edit = "own"; } else { $perm_meta_edit = "none"; } $zid = get_zone_id_from_record_id($_GET['id']); $user_is_zone_owner = do_hook('verify_user_is_owner_zoneid', $zid); $zone_type = get_domain_type($zid); $zone_name = get_zone_name_from_id($zid); if (isset($_POST["commit"])) { if ($zone_type == "SLAVE" || $perm_content_edit == "none" || ($perm_content_edit == "own" || $perm_content_edit == "own_as_client") && $user_is_zone_owner == "0") { error(ERR_PERM_EDIT_RECORD); } else { $old_record_info = get_record_from_id($_POST["rid"]); $ret_val = edit_record($_POST); if ($ret_val == "1") { if ($_POST['type'] != "SOA") { update_soa_serial($zid); } success(SUC_RECORD_UPD); $new_record_info = get_record_from_id($_POST["rid"]); log_info(sprintf('client_ip:%s user:%s operation:edit_record' . ' old_record_type:%s old_record:%s old_content:%s old_ttl:%s old_priority:%s' . ' record_type:%s record:%s content:%s ttl:%s priority:%s', $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $old_record_info['type'], $old_record_info['name'], $old_record_info['content'], $old_record_info['ttl'], $old_record_info['prio'], $new_record_info['type'], $new_record_info['name'], $new_record_info['content'], $new_record_info['ttl'], $new_record_info['prio'])); if ($pdnssec_use) { if (dnssec_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); } } } } }
} if (isset($_POST['commit'])) { $error = false; $one_record_changed = false; if (isset($_POST['record'])) { foreach ($_POST['record'] as $record) { $old_record_info = get_record_from_id($record['rid']); // Check if a record changed and save the state $log = new RecordLog(); $log->log_prior($record['rid']); if (!$log->has_changed($record)) { continue; } else { $one_record_changed = true; } $edit_record = edit_record($record); if (false === $edit_record) { $error = true; } else { // Log the state after saving and write it to logging table $log->log_after($record['rid']); $log->write(); } } } edit_zone_comment($_GET['id'], $_POST['comment']); if (false === $error) { update_soa_serial($_GET['id']); if ($one_record_changed) { success(SUC_ZONE_UPD); } else {
* along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "inc/toolkit.inc.php"; include_once "inc/header.inc.php"; $zone_id = "-1"; if (isset($_GET['id']) && v_num($_GET['id'])) { $zone_id = $_GET['id']; } if ($zone_id == "-1") { error(ERR_INV_INPUT); include_once "inc/footer.inc.php"; exit; } if (isset($_POST['commit'])) { foreach ($_POST['record'] as $record) { edit_record($record); } } if (verify_permission('zone_content_view_others')) { $perm_view = "all"; } elseif (verify_permission('zone_content_view_own')) { $perm_view = "own"; } else { $perm_view = "none"; } if (verify_permission('zone_content_edit_others')) { $perm_content_edit = "all"; } elseif (verify_permission('zone_content_edit_own')) { $perm_content_edit = "own"; } else { $perm_content_edit = "none";
if ($courseid == 0) { print 0; exit; } require_login($courseid); $context = get_context_instance(CONTEXT_COURSE, $courseid); if (!has_capability('block/tts:lexicon', $context)) { print 0; exit; } switch ($operation) { case 'get': get_table_records($courseid); break; case 'edit': edit_record(); break; case 'del': del_record(); break; case 'add': add_record($courseid); break; default: break; } /** * Add a record to the lexicon table * @global moodle_database $DB * @param int $courseid The course ID to the lexicon * @return null Return nothing. The result is printed