Example #1
0
                }
                break;
            default:
                $errors[] = $loc->getText("Unrecognized command code: %cmd%", array('cmd' => H($command)));
                break;
        }
    }
    return $errors;
}
function layout_links()
{
    global $loc;
    echo '<a href="../shared/layout.php?name=offline_commands">' . $loc->getText('Command Sheet') . '</a>';
}
$form = array('title' => $loc->getText("Upload Offline Circulation"), 'name' => 'offline_circ', 'action' => '../circ/offline.php', 'enctype' => 'multipart/form-data', 'submit' => $loc->getText('Upload'), 'fields' => array(array('name' => 'date', 'title' => $loc->getText('Date:'), 'type' => 'date', 'default' => 'today'), array('name' => 'command_file', 'title' => $loc->getText('Command File:'), 'type' => 'file', 'required' => 1)));
list($values, $errs) = Form::getCgi_el($form['fields']);
if (!$values['_posted'] or $errs) {
    include_once "../shared/header.php";
    if (isset($_REQUEST['msg'])) {
        echo '<font class="error">' . H($_REQUEST['msg']) . '</font>';
    }
    $form['values'] = $values;
    $form['errors'] = $errs;
    Form::display($form);
    layout_links();
    include_once "../shared/footer.php";
    exit;
}
$lines = file($values['command_file']['tmp_name']);
if ($lines === false) {
    $errors = array("Couldn't read file: " . $values['command_file']['tmp_name']);