Esempio n. 1
0
/**
 * Thanks to the NewBB2 Development Team
 */
function smartpartner_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 (smartpartner_admin_mkdir(substr($target, 0, strrpos($target, '/')))) {
        if (!file_exists($target)) {
            return mkdir($target);
        }
    }
    // crawl back up & create dir tree
    return true;
}
Esempio n. 2
0
* Module: SmartPartner
* 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 = smartpartner_getUploadDir(true, $path);
            $res = smartpartner_admin_mkdir($thePath);
            if ($res) {
                $source = SMARTPARTNER_ROOT_PATH . "images/blank.png";
                $dest = $thePath . "blank.png";
                smartpartner_copyr($source, $dest);
            }
            $msg = $res ? _AM_SPARTNER_DIRCREATED : _AM_SPARTNER_DIRNOTCREATED;
        } else {
            $msg = _AM_SPARTNER_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;