Example #1
0
    exit;
}
if (isset($_GET["create-folder"])) {
    folder_create();
    exit;
}
if (isset($_GET["folder-remove"])) {
    folder_delete();
    exit;
}
if (isset($_GET["file-content"])) {
    file_content();
    exit;
}
if (isset($_GET["file-remove"])) {
    file_remove();
    exit;
}
//CLUSTERS
if (isset($_GET["notify-clusters"])) {
    CLUSTER_NOTIFY();
    exit;
}
if (isset($_GET["cluster-restart-notify"])) {
    CLUSTER_CLIENT_RESTART_NOTIFY();
    exit;
}
if (isset($_GET["cluster-client-list"])) {
    CLUSTER_CLIENT_LIST();
    exit;
}
Example #2
0
<?php

/**
* HIVE - Copyleft Open Source Mind, GP
* Last Modified: Date: 07-18-2009 19:15:01 -0500 (Jul-Sat-2009) $ @ Revision: $Rev: 11 $
* @package Hive
*/
session_start();
require_once '../../bootstrap.php';
require_once 'upload.func.php';
if (!$_SESSION['logged']) {
    echo 'LOGOUT';
    exit(0);
}
$fn = $_GET['fn'];
switch ($fn) {
    case 'file_remove':
        print file_remove($_GET);
        break;
}
Example #3
0
/**
 * File upload handling. Available options are:
 *
 * - size: Exact file size in bytes.
 * - min_size: Minimum file size in bytes.
 * - max_size: Maximum file size in bytes.
 * - types: Allowed mime types, e.g., "image/gif", "image/png".
 * - basename: Base name sans extension.
 * - validator: Callable to file upload validator.
 * - callback: Callable to call instead of having the file automatically moved.
 *
 * @param string $name File input field name
 * @param string $path Either a directory or the destination file path
 * @param array  $opts Rules and options
 *
 * @return string|bool Path to uploaded file on success, boolean false otherwise
 */
function file_upload($name, $path, array $opts = array())
{
    if (!isset($_FILES[$name])) {
        return false;
    }
    if (isset($opts['size'])) {
        $min_size = $max_size = $opts['size'];
    } else {
        $min_size = isset($opts['min_size']) ? $opts['min_size'] : null;
        $max_size = isset($opts['max_size']) ? $opts['max_size'] : null;
    }
    $types = $extensions = array();
    if (isset($opts['types']) && is_array($opts['types'])) {
        foreach ($opts['types'] as $key => $val) {
            if (is_int($key)) {
                $types[] = $val;
            } else {
                $types[] = $key;
                $extensions[$key] = $val;
            }
        }
    }
    $validator = isset($opts['validator']) && is_callable($opts['validator']) ? $opts['validator'] : null;
    $callback = isset($opts['callback']) && is_callable($opts['callback']) ? $opts['callback'] : null;
    $file = $_FILES[$name];
    if (is_dir($path)) {
        if (substr($path, strlen($path) - 1, 1) != DIRECTORY_SEPARATOR) {
            $path .= DIRECTORY_SEPARATOR;
        }
        if (isset($opts['basename'])) {
            if (isset($extensions[$file['type']])) {
                $ext = $extensions[$file['type']];
            } else {
                $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
            }
            $dest = $path . $opts['basename'] . '.' . $ext;
        } else {
            $dest = $path . basename($file['name']);
        }
    } else {
        $dest = $path;
    }
    if ($file['error'] != 0) {
        goto error;
    }
    if (isset($min_size) && $file['size'] < $min_size) {
        goto error;
    }
    if (isset($max_size) && $file['size'] > $max_size) {
        goto error;
    }
    if ($types && !in_array($file['type'], $types)) {
        goto error;
    }
    if (isset($validator) && !call_user_func($validator, $file, $dest, $opts)) {
        goto error;
    }
    if (isset($callback)) {
        return call_user_func($callback, $file, $dest, $opts);
    }
    if (move_uploaded_file($file['tmp_name'], $dest)) {
        return $dest;
    }
    error:
    file_remove($file['tmp_name']);
    return false;
}
Example #4
0
if(isset($_GET["testnotif"])){testnotif();exit;}
if(isset($_GET["ComputerRemoteRessources"])){ComputerRemoteRessources();exit;}
if(isset($_GET["free-cache"])){FreeCache();exit;}
if(isset($_GET["DumpPostfixQueue"])){DumpPostfixQueue();exit;}
if(isset($_GET["smtp-whitelist"])){SMTP_WHITELIST();exit;}
if(isset($_GET["LaunchNetworkScanner"])){LaunchNetworkScanner();exit;}
if(isset($_GET["idofUser"])){idofUser();exit;}
if(isset($_GET["php-rewrite"])){rewrite_php();exit;}

if(isset($_GET["B64-dirdir"])){dirdirBase64();exit;}
if(isset($_GET["Dir-Files"])){Dir_Files();exit;}
if(isset($_GET["filestat"])){filestat();exit;}
if(isset($_GET["create-folder"])){folder_create();exit;}
if(isset($_GET["folder-remove"])){folder_delete();exit;}
if(isset($_GET["file-content"])){file_content();exit;}
if(isset($_GET["file-remove"])){file_remove();exit;}

//CLUSTERS
if(isset($_GET["notify-clusters"])){CLUSTER_NOTIFY();exit;}
if(isset($_GET["cluster-restart-notify"])){CLUSTER_CLIENT_RESTART_NOTIFY();exit;}
if(isset($_GET["cluster-client-list"])){CLUSTER_CLIENT_LIST();exit;}
if(isset($_GET["cluster-delete"])){CLUSTER_DELETE();exit;}
if(isset($_GET["cluster-add"])){CLUSTER_ADD();exit;}

//computers
if(isset($_GET["computers-import-nets"])){COMPUTERS_IMPORT_ARTICA();exit;}
if(isset($_GET["smbclientL"])){smbclientL();exit;}

//paths 
if(isset($_GET["SendmailPath"])){SendmailPath();exit;}
if(isset($_GET["release-quarantine"])){release_quarantine();exit;}