Example #1
0
            } else {
                $file_path = POST('fn');
            }
            if (POST_EMPTY('fsize')) {
                $file_size = $_FILES["filename"]["size"];
            } else {
                $file_size = POST('fsize');
            }
            $no_copyright = POST('nocopyright');
            if (POST('ok') == 'OK') {
                if (POST_EMPTY('nocopyright')) {
                    display_error("Copyrighted content is forbidden", array('<a href="">Add File</a>', 'Error'), $LSP_URL . '?content=add');
                    return;
                }
                $file_extension = parse_extension($file_path);
                $categories = get_categories_for_ext($file_extension);
                if ($categories != false) {
                    if (isset($_FILES["filename"]["tmp_name"])) {
                        echo '<div class="col-md-9">';
                        create_title(array('<a href="">Add File</a>', $file_path));
                        $tmp_path = $_FILES["filename"]["tmp_name"];
                        $tmp_ext = trim(pathinfo($tmp_path, PATHINFO_EXTENSION));
                        $tmp_name_only = pathinfo($tmp_path, PATHINFO_FILENAME) . ($tmp_ext == "" ? '' : '.' . $tmp_ext);
                        move_uploaded_file($tmp_path, $TMP_DIR . $tmp_name_only);
                        //echo "<code>moving $tmp_path to $TMP_DIR$tmp_name_only</code>";
                        ?>
					<?php 
                        $form = new form($LSP_URL . '?content=add', 'File Details', 'fa-upload');
                        ?>
					<div class="form-group">
					<label for="category">Category</label>
Example #2
0
<?php

require_once 'utils.php';
require_once 'dbo.php';
require_once 'xhtml.php';
global $LSP_URL;
if (get_user_id(SESSION()) == get_object_by_id("files", GET('file'), 'user_id') || is_admin(get_user_id(SESSION()))) {
    if (!POST('updateok', false)) {
        $file_name = get_file_name(GET('file'));
        $file_extension = parse_extension($file_name);
        $categories = get_categories_for_ext($file_extension, get_file_category(GET('file')) . ' - ' . get_file_subcategory(GET('file')));
        echo '<div class="col-md-9">';
        create_title(array('Edit', get_file_url()));
        $form = new form($LSP_URL . '?content=update&file=' . GET('file'), $title = 'Edit File', 'fa-pencil');
        ?>
		<div class="form-group">
			<label for="category">Category</label>
			<select name="category" class="form-control">
			<?php 
        echo $categories;
        ?>
	
			</select>
		</div>
		<div class="form-group">
			<label for="license">License</label>
			<select name="license" class="form-control">
			<?php 
        echo get_licenses(get_license_name(get_file_license(GET('file'))));
        ?>
			</select>