function getImagePath() { $dir = $this->_uploadPath . $this->_itemname; if (!file_exists($dir)) { smart_admin_mkdir($dir); } return $dir . "/"; }
function smartpartner_create_upload_folders() { $hanlder =& xoops_getmodulehandler('offer', 'smartpartner'); smart_admin_mkdir($hanlder->getImagePath()); smart_admin_mkdir(XOOPS_ROOT_PATH . '/uploads/smartpartner/images/category'); }
/** * Thanks to the NewBB2 Development Team */ function smart_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 (smart_admin_mkdir(substr($target, 0, strrpos($target, '/')))) { if (!file_exists($target)) { $res = mkdir($target, 0777); // crawl back up & create dir tree smart_admin_chmod($target); return $res; } } $res = is_dir($target); return $res; }