예제 #1
0
<?php

require "utils.php";
require "convert.php";
require "steamauth/steamauth.php";
if (isset($_SESSION["steamid"])) {
    if (CanUpload($_SESSION["steamid"])) {
        if (isset($_FILES["musicfile"])) {
            $type = $_FILES["musicfile"]["type"];
            $sid = $_SESSION["steamid"];
            $name = "";
            if (isset($_POST["musicname"]) and !($_POST["musicname"] == "")) {
                $name = urlencode($_POST["musicname"]);
            } else {
                $name = "Untitled";
            }
            if ($type == "audio/mp3" or $type == "audio/mpeg") {
                $uid = uniqid();
                $url = $uid . ".mp3";
                move_uploaded_file($_FILES["musicfile"]["tmp_name"], "/home/sam/sterling/upload/" . $url);
                Query("INSERT INTO tracks (steamid, name, url) VALUES ('{$sid}', '{$name}', '{$url}');");
                header("Location: https://the-sterling.co.uk/index.php");
            } else {
                $converted = Convert($_FILES["musicfile"]["tmp_name"], $type);
                if ($converted == FALSE) {
                    echo "You must upload an MP3, WAV, M4A, FLAC, OGG or WMA file. Go back and upload a compatible file instead of whatever you uploaded this time. You uploaded a " . $type;
                } else {
                    Query("INSERT INTO tracks (steamid, name, url) VALUES ('{$sid}', '{$name}', '{$converted}');");
                    header("Location: https://the-sterling.co.uk/index.php");
                }
                //header("Location: http://the-sterling.co.uk/index.php");
예제 #2
0
require_once "security_utils.php";
require_once "page_blocks.php";
require_once "security.php";
require_once "not_a_power_user.php";
if (HasNoSpecificRights()) {
    die(GetNotAPowerUserPage());
}
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile("admin.tpl.html", true, true);
SetCommonLoginStatus($tpl);
SetAdminToolbar($tpl);
SetCommonFooter($tpl);
$projects = GetProjectsInfos();
$AtLeastOneSection = false;
// if user has rights to add files, then we show the section
if (CanUpload()) {
    $AtLeastOneSection = true;
    $tpl->setCurrentBlock("add_file_section");
    if (is_array($projects)) {
        $tpl->setCurrentBlock("add_file_project_list_section");
        foreach ($projects as $project) {
            // Assign data to the search option block
            $tpl->setCurrentBlock("add_file_project_name_section");
            $tpl->setVariable("PROJECT_ID", $project["Id"]);
            $tpl->setVariable("PROJECT_NAME", $project["Name"]);
            $tpl->parseCurrentBlock("add_file_project_name_section");
        }
        $tpl->parseCurrentBlock("add_file_project_list_section");
    } else {
        $tpl->setCurrentBlock("add_file_no_projects_section");
        $tpl->setVariable("NO_PROJECTS_MESSAGE", "There are no projects in the system. You must have at least one project to be able to add files.");
예제 #3
0
<?php

require_once "pear/HTML/Template/IT.php";
require_once "pclzip/pclzip.lib.php";
require_once "data_access.php";
require_once "security.php";
require_once "security_utils.php";
require_once "utils.php";
require_once "page_blocks.php";
require_once "not_a_power_user.php";
require_once "not_allowed.php";
if (!CanUpload()) {
    die(GetNotAllowedPage("You are not authorized to upload files"));
}
define("FILE_COOKIE_NAME", "jh_filecookie");
define("FILES_PER_ITERATION", 5);
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile("addfile.tpl.html", true, true);
SetCommonLoginStatus($tpl);
SetAdminToolbar($tpl);
SetCommonFooter($tpl);
// From the comments on php.net for sys_get_temp_dir
if (!function_exists('sys_get_temp_dir')) {
    function sys_get_temp_dir()
    {
        if (!empty($_ENV['TMP'])) {
            return realpath($_ENV['TMP']);
        }
        if (!empty($_ENV['TMPDIR'])) {
            return realpath($_ENV['TMPDIR']);
        }