* Module: SmartSection * 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 = ss_getUploadDir(true, $path); $res = ss_admin_mkdir($thePath); if ($res) { $source = SMARTSECTION_ROOT_PATH . "images/blank.png"; $dest = $thePath . "blank.png"; ss_copyr($source, $dest); } $msg = $res ? _AM_SS_DIRCREATED : _AM_SS_DIRNOTCREATED; } else { $msg = _AM_SS_DIRNOTCREATED; } redirect_header('index.php', 2, $msg . ': ' . $thePath); exit; break; } $itemid = isset($_POST['itemid']) ? intval($_POST['itemid']) : 0; $pick = isset($_GET['pick']) ? intval($_GET['pick']) : 0;
/** * Thanks to the NewBB2 Development Team */ function ss_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 (ss_admin_mkdir(substr($target, 0, strrpos($target, '/')))) { if (!file_exists($target)) { $res = mkdir($target, 0777); // crawl back up & create dir tree ss_admin_chmod($target); return $res; } } $res = is_dir($target); return $res; }