Esempio n. 1
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $file_statuses;
    pagetop(gTxt('file'), $message);
    extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($permissions == '') {
            $permissions = '-1';
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'upload', 'file_replace', $id))) : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created'])) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']));
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf(gTxt('file_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))));
        } else {
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'upload', 'file_replace', $id) . form(graf(gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $condition) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . $downloads))), $form, $replace, endTable();
    }
}
Esempio n. 2
0
</tr>

<tr>
<td>URL</td>
<td>
<input type='text' name='url' size='60' value="{$form['url']}">
</td>
</tr>
EOS;
$items = array(array('GET', 'GET'), array('POST', 'POST'));
$name = 'op_X';
$preset = $form['op_X'];
if ($preset == '') {
    $preset = 'GET';
}
$html = radio_list($name, $items, $preset);
print <<<EOS
<tr>
<td>-X/--request</td>
<td>
{$html}
</td>
</tr>
EOS;
$title = 'Include protocol headers in the output (H/F)';
$name = 'op_i';
$checked = $form['op_i'];
$html = checkbox($name, $title, $checked);
print <<<EOS
<tr>
<td>-i</td>
Esempio n. 3
0
function file_edit($message = '', $id = '')
{
    global $file_base_path, $levels, $file_statuses, $txp_user, $event;
    extract(gpsa(array('name', 'title', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        $filename = sanitizeForFile($filename);
        if (!has_privs('file.edit') && !($author == $txp_user && has_privs('file.edit.own'))) {
            file_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('file'), $message);
        if ($permissions == '') {
            $permissions = '-1';
        }
        if (!has_privs('file.publish') && $status >= 4) {
            $status = 3;
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'file_replace', 'file_replace', $id, 'file-replace')), ' class="replace-file"') : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>', ' class="publish-now"') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp'), ' class="publish-at"') . n . graf('<span class="label">' . gtxt('date') . '</span>' . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created']), ' class="date posted created"') . n . graf('<span class="label">' . gTxt('time') . '</span>' . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']), ' class="time posted created"');
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf('<label for="file_title">' . gTxt('title') . '</label>: ' . fInput('text', 'title', $title, '', '', '', 40, '', 'file_title'), ' class="title"') . graf('<label for="category">' . gTxt('file_category') . '</label>' . br . treeSelectInput('category', $categories, $category), ' class="category"') . graf('<label for="description">' . gTxt('description') . '</label>' . br . text_area('description', '100', '400', $description, 'description'), ' class="description text"') . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method), '', '', 'post', 'edit-form', '', 'file_details')), ' class="file-detail exists"');
        } else {
            $ef_select = empty($existing_files) ? '' : gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1);
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'file_reassign', 'file_replace', $id, 'file-reassign') . form(graf($ef_select . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('title', $title) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method)), '', '', 'post', 'edit-form', '', 'assign_file'), ' colspan="4" style="border:0"'), ' class="file-detail not-exists"');
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(graf(gTxt('file_status') . ': ' . $condition, ' class="condition"') . graf(gTxt('file_name') . ': ' . $downloadlink, ' class="name"') . graf(gTxt('file_download_count') . ': ' . $downloads, ' class="downloads"')), ' class="file-info"'), $form, $replace, endTable() . n . '</div>';
    }
}
Esempio n. 4
0
 function edit_view($id = '')
 {
     global $txpcfg, $file_base_path, $levels;
     extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'method', 'publish_now')));
     if (!$id) {
         $id = gps('id');
     }
     $categories = tree_get('txp_category', NULL, "type='file'");
     $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = '{$id}'");
     if ($rs) {
         extract($rs);
         if ($permissions == '') {
             $permissions = '-1';
         }
         $file_exists = file_exists(build_file_path($file_base_path, $filename));
         $existing_files = $this->get_filenames();
         $condition = '<span class="';
         $condition .= $file_exists ? 'ok' : 'not-ok';
         $condition .= '">';
         $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
         $condition .= '</span>';
         $downloadlink = $file_exists ? $this->make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
         $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created'])) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']));
         $form = '';
         #categorySelectInput($type, $name, $val, $id
         $form = tr(td(form(graf(gTxt('file_category') . br . categorySelectInput('file', 'category', $category, 'file_category')) . graf(gTxt('filename') . br . fInput('text', 'filename', $filename, 'edit')) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $this->file_statuses(), $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput($this->event) . sInput('save') . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('method', $method))));
         echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $condition) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . $downloads))), $form, tr(td($this->file_upload_form(gTxt('file_replace'), 'file_replace', 'new_replace', $id))), endTable();
     }
 }