$rc = 0; foreach ($template['records'] as $record) { if ($record['type'] == "NS") { if ($type == 'pri' && $rc == 0 or $type == 'sec' && $rc == 1) { echo $record['content']; exit(0); } $rc++; } } echo ""; } break; case "getformnameservers": $inputs = array(); foreach (user_template_list() as $template) { if ($template['name'] !== $_GET['template']) { continue; } foreach ($template['records'] as $record) { if ($record['type'] == "NS" and array_search($record['content'], $inputs) === false) { array_push($inputs, $record['content']); echo '<input type="text" name="nameserver[]" value="' . $record['content'] . '" readonly /><br />'; } } } break; default: jtable_respond(null, 'error', 'No such action'); break; }
function user_template_names() { $templatenames = array('None' => 'None'); foreach (user_template_list() as $template) { $templatenames[$template['name']] = $template['name']; } return $templatenames; }