Browse Source

Code style changes

pull/1/head
falkTX 11 years ago
parent
commit
61cc796510
2 changed files with 20 additions and 18 deletions
  1. +11
    -6
      paste/download.php
  2. +9
    -12
      paste/index.php

+ 11
- 6
paste/download.php View File

@@ -1,18 +1,21 @@
<?php

if (file_exists("/var/www/kxstudio/paste/"))
if (file_exists("/var/www/kxstudio/paste/")) {
$base_dir = "/var/www/kxstudio/paste/";
else
} else {
$base_dir = "/home/groups/k/kx/kxstudio/htdocs/paste/";
}

function downloadFile($fullPath) {
// Must be fresh start
if(headers_sent())
if (headers_sent()) {
die('Headers Sent');
}

// Required for some browsers
if(ini_get('zlib.output_compression'))
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}

$fsize = filesize($fullPath);

@@ -29,11 +32,13 @@ function downloadFile($fullPath) {
readfile($fullPath);
}

if (!empty($_GET["id"])) {
if (! empty($_GET["id"])) {
$paste_id = htmlspecialchars($_GET["id"]);
$paste_file = $base_dir . "repo/" . $paste_id;

if (!file_exists($paste_file)) die("File does not exist");
if (! file_exists($paste_file)) {
die("File does not exist");
}

downloadFile($paste_file);
}


+ 9
- 12
paste/index.php View File

@@ -1,13 +1,10 @@
<?php
include_once("geshi.php");

if (file_exists("/var/www/kxstudio/paste/"))
{
if (file_exists("/var/www/kxstudio/paste/")) {
$server_dir = "/paste/";
$base_dir = "/var/www/kxstudio/paste/";
}
else
{
} else {
$server_dir = "/paste/";
$base_dir = "/home/groups/k/kx/kxstudio/htdocs/paste/";
}
@@ -16,14 +13,14 @@ $show_paste = FALSE;
$show_numbers = FALSE;
$is_error = FALSE;

if (!empty($_GET["id"]))
if (! empty($_GET["id"]))
{
$paste_id = htmlspecialchars($_GET["id"]);
$show_paste = TRUE;

$paste_file = $base_dir . "repo/" . $paste_id;

if (!file_exists($paste_file)) {
if (! file_exists($paste_file)) {
$is_error = TRUE;
}

@@ -38,9 +35,9 @@ if (!empty($_GET["id"]))
include_once($paste_info);
}

$show_numbers = $paste_numbers == "Yes";
$show_numbers = ($paste_numbers == "Yes");
}
else if (!empty($_POST["paste_text"]))
else if (! empty($_POST["paste_text"]))
{
$paste_code = $_POST["paste_text"];
$paste_format = $_POST["paste_format"];
@@ -52,8 +49,8 @@ else if (!empty($_POST["paste_text"]))
die("Spam bot detected, get out of here!");
}

$paste_id = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',5)),0,5);
$paste_file = $base_dir . "repo/" . $paste_id;
$paste_id = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',5)),0,5);
$paste_file = $base_dir . "repo/" . $paste_id;

while (file_exists($paste_file)) {
$paste_id = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',5)),0,5);
@@ -130,7 +127,7 @@ if ($show_paste)
<?php
}
}
else
else // $show_paste
{
?>
<form enctype="multipart/form-data" method="post" action="" onsubmit="document.getElementById('paste_submit').disabled=true;document.getElementById('paste_submit').value='Please wait...';">


Loading…
Cancel
Save