<?php require_once 'utils.php'; require_once 'dbo.php'; require_once 'xhtml.php'; global $LSP_URL; if (!SESSION_EMPTY() && (get_user_id(SESSION()) == get_file_owner(GET('file')) || is_admin(get_user_id(SESSION())))) { if (GET('confirmation') == "true") { if (delete_file(GET('file'))) { display_success('File deleted successfully', array('Delete')); } else { display_error('Sorry, file ' . GET('file') . ' could not be deleted', array('Delete')); } get_latest(); } else { display_warning('This will delete all comments and ratings.', array('Delete', get_file_url())); echo '<div class="col-md-9">'; $form = new form(null, 'Confirm Delete', 'fa-trash'); ?> <p class="lead">Confirm deletion of <strong><?php echo get_file_name(GET('file')); ?> </strong>?</p> <div class="form-group"> <a class="btn btn-danger" href="<?php echo "{$LSP_URL}?content=delete&confirmation=true&file=" . GET('file'); ?> "> <span class="fa fa-check"></span> Delete</a> <a class="btn btn-warning" href="<?php echo "{$LSP_URL}?action=show&file=" . GET('file');
function html_home() { global $repos, $repo_suffix; echo "<div class=\"git-home\">\n"; echo "<table>\n<tr>"; echo "<th>Project</th>"; echo "<th>Description</th>"; echo "<th>Owner</th>"; echo "<th>Last Changed</th>"; echo "<th>Download</th>"; echo "<th>Hits</th>"; echo "</tr>\n"; foreach ($repos as $repo) { $today = 0; $total = 0; stat_get_count($repo, $today, $total); $desc = short_desc(file_get_contents($repo . $repo_suffix . "/description")); $owner = get_file_owner($repo); $last = get_last($repo); $proj = get_project_link($repo); $dlt = get_project_link($repo, "targz"); $dlz = get_project_link($repo, "zip"); echo "<tr><td>{$proj}</td><td>{$desc}</td><td>{$owner}</td><td>{$last}</td><td>{$dlt} | {$dlz}</td><td> ({$today} / {$total}) </td></tr>\n"; } echo "</table>"; echo "</div>\n"; }
function read_dirs($dir_path) { echo ' <table> <tr class="banner"> <td width="400" >Filename</td> <td width="400" >Last modified</td> <td width="400" >Size</td> <td width="400" >Chmod/Perms</td> <td width="400" >Action</td> </tr>'; if (is_dir($dir_path)) { if (($dp = opendir($dir_path)) == false) { echo "open {$dir_path} failed.\n"; return -1; } while (($file_name = readdir($dp)) != false) { if ($file_name == "." || $file_name == "..") { continue; } $sub_path = $dir_path . "/" . $file_name; $last_modify_time = date("Y/m/d H:i:s", fileatime($file_name)); $file_size = filesize($file_name); $file_size_string = get_human_size($file_size); $file_perms = get_file_perms($file_name); $file_perms_string = get_human_file_perms($file_name); $file_owner = get_file_owner($file_name); echo '<tr class="directory"> <td width="400" ><a href=' . $file_name . '>' . $file_name . '</a></td> <td width="400" >' . $last_modify_time . '</td> <td width="400" >' . $file_size_string . '</td> <td width="400" >' . $file_perms . ' / ' . $file_perms_string . ' / ' . $file_owner . '</td> <td width="400" ><a href="webshell.php?delete=' . $file_name . '"' . '>Delete </a> <a href="webshell.php?edit=' . $file_name . '"' . '>Edit </a> <a href="webshell.php?download=' . $file_name . '"' . '>Download </a> <a href="webshell.php?rename=' . $file_name . '"' . '>Rename </a> </td> </tr>'; } } echo '</table>'; closedir($dp); return 0; }
function html_home($repos) { $str = ''; $str .= "<table>\n"; $str .= "<tr><th>Project</th><th>Description</th><th>Owner</th><th>Last Changed</th><th>Download</th></tr>\n"; foreach ($repos as $repo) { $desc = short_desc(file_get_contents("{$repo}/description")); $owner = get_file_owner($repo); $last = get_last($repo); $proj = get_project_link($repo); $dlt = get_project_link($repo, "targz"); $dlz = get_project_link($repo, "zip"); $str .= "<tr><td>{$proj}</td><td>{$desc}</td><td>{$owner}</td><td>{$last}</td><td>{$dlt} | {$dlz}</td></tr>\n"; } $str .= "</table>"; return $str; }