Beispiel #1
0
 * Module: SmartClient
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
include_once "admin_header.php";
$myts =& MyTextSanitizer::getInstance();
$op = isset($_GET['op']) ? $_GET['op'] : '';
switch ($op) {
    case "createdir":
        $path = isset($_GET['path']) ? $_GET['path'] : false;
        if ($path) {
            if ($path == 'root') {
                $path = '';
            }
            $thePath = smartclient_getUploadDir(true, $path);
            $res = smartclient_admin_mkdir($thePath);
            if ($res) {
                $source = SMARTCLIENT_ROOT_PATH . "images/blank.png";
                $dest = $thePath . "blank.png";
                smartclient_copyr($source, $dest);
            }
            $msg = $res ? _AM_SCLIENT_DIRCREATED : _AM_SCLIENT_DIRNOTCREATED;
        } else {
            $msg = _AM_SCLIENT_DIRNOTCREATED;
        }
        redirect_header('index.php', 2, $msg . ': ' . $thePath);
        exit;
        break;
}
$pick = isset($_GET['pick']) ? intval($_GET['pick']) : 0;
$pick = isset($_POST['pick']) ? intval($_POST['pick']) : $pick;
Beispiel #2
0
/**
 * Thanks to the NewBB2 Development Team
 */
function smartclient_admin_mkdir($target)
{
    // http://www.php.net/manual/en/function.mkdir.php
    // saint at corenova.com
    // bart at cdasites dot com
    if (is_dir($target) || empty($target)) {
        return true;
    }
    // best case check first
    if (file_exists($target) && !is_dir($target)) {
        return false;
    }
    if (smartclient_admin_mkdir(substr($target, 0, strrpos($target, '/')))) {
        if (!file_exists($target)) {
            return mkdir($target);
        }
    }
    // crawl back up & create dir tree
    return true;
}