Esempio n. 1
0
function createDir()
{
    // auto crate folders
    $thePath = PublisherUtils::getUploadDir();
    if (PublisherUtils::getPathStatus('root', true) < 0) {
        $thePath = PublisherUtils::getUploadDir();
        $res = PublisherUtils::mkdir($thePath);
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images', true) < 0) {
        $thePath = PublisherUtils::getImageDir();
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . "/images/blank.png";
            $dest = $thePath . "blank.png";
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images/category', true) < 0) {
        $thePath = PublisherUtils::getImageDir('category');
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . '/images/blank.png';
            $dest = $thePath . 'blank.png';
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images/item', true) < 0) {
        $thePath = PublisherUtils::getImageDir('item');
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . '/images/blank.png';
            $dest = $thePath . 'blank.png';
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('content', true) < 0) {
        $thePath = PublisherUtils::getUploadDir(true, 'content');
        $res = PublisherUtils::mkdir($thePath);
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
}