当前位置: 首页>>代码示例>>PHP>>正文


PHP Attachment::confirmFolder方法代码示例

本文整理汇总了PHP中Attachment::confirmFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::confirmFolder方法的具体用法?PHP Attachment::confirmFolder怎么用?PHP Attachment::confirmFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attachment的用法示例。


在下文中一共展示了Attachment::confirmFolder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array_push

            @chmod(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/favicon.ico", 0666);
            array_push($errorText, _t('파비콘을 변경하였습니다.'));
        }
    }
}
// 블로그 아이콘 처리.
if ($_POST['deleteBlogIcon'] == "yes") {
    unlink(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/index.gif");
    array_push($errorText, _t('블로그 아이콘을 초기화 하였습니다.'));
}
if (!empty($_FILES['blogIcon']['tmp_name'])) {
    $fileExt = Path::getExtension($_FILES['blogIcon']['name']);
    if (!in_array($fileExt, array('.gif', '.jpg', '.jpeg', '.png'))) {
        array_push($errorText, _t('블로그 아이콘을 변경하지 못했습니다.'));
    } else {
        Attachment::confirmFolder();
        if (move_uploaded_file($_FILES['blogIcon']['tmp_name'], __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/index.gif")) {
            @chmod(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/index.gif", 0666);
            array_push($errorText, _t('블로그 아이콘을 변경하였습니다.'));
        } else {
        }
    }
}
Setting::setBlogSettingGlobal('useBlogIconAsIphoneShortcut', $_POST['useBlogIconAsIphoneShortcut']);
if (!empty($errorText)) {
    $errorText = urlencode(implode('<br />', $errorText));
} else {
    $errorText = urlencode(_T('저장되었습니다'));
}
$url = $_SERVER['HTTP_REFERER'];
$pos = strpos($url, '?message=');
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例2: importer

function importer($path, $node, $line)
{
    global $blogid, $migrational, $items, $item;
    switch ($path) {
        case '/blog/setting':
            setProgress($item++ / $items * 100, _t('블로그 설정을 복원하고 있습니다.'));
            $setting = new BlogSetting();
            if (isset($node['title'][0]['.value'])) {
                $setting->title = $node['title'][0]['.value'];
            }
            if (isset($node['description'][0]['.value'])) {
                $setting->description = $node['description'][0]['.value'];
            }
            if (isset($node['banner'][0]['name'][0]['.value'])) {
                $setting->banner = $node['banner'][0]['name'][0]['.value'];
            }
            if (isset($node['useSloganOnPost'][0]['.value'])) {
                $setting->useSloganOnPost = $node['useSloganOnPost'][0]['.value'];
            }
            if (isset($node['postsOnPage'][0]['.value'])) {
                $setting->postsOnPage = $node['postsOnPage'][0]['.value'];
            }
            if (isset($node['postsOnList'][0]['.value'])) {
                $setting->postsOnList = $node['postsOnList'][0]['.value'];
            }
            if (isset($node['postsOnFeed'][0]['.value'])) {
                $setting->postsOnFeed = $node['postsOnFeed'][0]['.value'];
            }
            if (isset($node['publishWholeOnFeed'][0]['.value'])) {
                $setting->publishWholeOnFeed = $node['publishWholeOnFeed'][0]['.value'];
            }
            if (isset($node['acceptGuestComment'][0]['.value'])) {
                $setting->acceptGuestComment = $node['acceptGuestComment'][0]['.value'];
            }
            if (isset($node['acceptcommentOnGuestComment'][0]['.value'])) {
                $setting->acceptcommentOnGuestComment = $node['acceptcommentOnGuestComment'][0]['.value'];
            }
            if (isset($node['language'][0]['.value'])) {
                $setting->language = $node['language'][0]['.value'];
            }
            if (isset($node['timezone'][0]['.value'])) {
                $setting->timezone = $node['timezone'][0]['.value'];
            }
            if (!$setting->save()) {
                user_error(__LINE__ . $setting->error);
            }
            if (!empty($setting->banner) && !empty($node['banner'][0]['content'][0]['.stream'])) {
                Attachment::confirmFolder();
                Utils_Base64Stream::decode($node['banner'][0]['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $setting->banner));
                Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $setting->banner));
                fclose($node['banner'][0]['content'][0]['.stream']);
                unset($node['banner'][0]['content'][0]['.stream']);
            }
            return true;
        case '/blog/category':
            setProgress($item++ / $items * 100, _t('분류를 복원하고 있습니다.'));
            $category = new Category();
            $category->name = $node['name'][0]['.value'];
            $category->priority = $node['priority'][0]['.value'];
            if (isset($node['root'][0]['.value'])) {
                $category->id = 0;
            }
            if (!$category->add()) {
                user_error(__LINE__ . $category->error);
            }
            if (isset($node['category'])) {
                for ($i = 0; $i < count($node['category']); $i++) {
                    $childCategory = new Category();
                    $childCategory->parent = $category->id;
                    $cursor =& $node['category'][$i];
                    $childCategory->name = $cursor['name'][0]['.value'];
                    $childCategory->priority = $cursor['priority'][0]['.value'];
                    if (!$childCategory->add()) {
                        user_error(__LINE__ . $childCategory->error);
                    }
                }
            }
            return true;
        case '/blog/post':
            setProgress($item++ / $items * 100, _t('글을 복원하고 있습니다.'));
            $post = new Post();
            $post->id = $node['id'][0]['.value'];
            $post->slogan = @$node['.attributes']['slogan'];
            $post->visibility = $node['visibility'][0]['.value'];
            if (isset($node['starred'][0]['.value'])) {
                $post->starred = $node['starred'][0]['.value'];
            } else {
                $post->starred = 0;
            }
            $post->title = $node['title'][0]['.value'];
            $post->content = $node['content'][0]['.value'];
            $post->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : 'ttml';
            $post->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : 'modern';
            $post->location = $node['location'][0]['.value'];
            $post->password = isset($node['password'][0]['.value']) ? $node['password'][0]['.value'] : null;
            $post->acceptcomment = $node['acceptComment'][0]['.value'];
            $post->accepttrackback = $node['acceptTrackback'][0]['.value'];
            $post->published = $node['published'][0]['.value'];
            if (isset($node['longitude'][0]['.value'])) {
                $post->longitude = $node['longitude'][0]['.value'];
//.........这里部分代码省略.........
开发者ID:webhacking,项目名称:Textcube,代码行数:101,代码来源:index.php

示例3: getAddAttachment

function getAddAttachment($file)
{
    global $database, $serviceURL;
    requireComponent('Textcube.Function.misc');
    requireComponent('Textcube.Data.Attachment');
    Attachment::confirmFolder();
    if (empty($file['name']) || $file['error'] != 0) {
        return false;
    }
    $attachment = array();
    $attachment['ext'] = Misc::getFileExtension(Path::getBaseName($file['name']));
    $path = __TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/team";
    if (!is_dir($path)) {
        mkdir($path);
        if (!is_dir($path)) {
            return false;
        }
        @chmod($path, 0777);
    }
    do {
        $attachment['name'] = rand(1000000000, 9999999999.0) . "." . $attachment['ext'];
        $attachment['path'] = "{$path}/{$attachment['name']}";
    } while (file_exists($attachment['path']));
    if (!move_uploaded_file($file['tmp_name'], $attachment['path'])) {
        return false;
    }
    @chmod($attachment['path'], 0666);
    $tmpImage = POD::queryCell("SELECT image FROM {$database['prefix']}TeamUserSettings WHERE blogid=" . getBlogId() . " and userid=" . getUserId());
    if (!POD::execute("UPDATE {$database['prefix']}TeamUserSettings SET image='" . $attachment['name'] . "', updated=UNIX_TIMESTAMP() WHERE blogid=" . getBlogId() . " and userid=" . getUserId())) {
        @unlink($attachment['path']);
        $result = "{$serviceURL}/resources/image/spacer.gif";
    } else {
        $result = "{$serviceURL}/attach/" . getBlogId() . "/team/" . $attachment['name'];
    }
    if (!empty($tmpImage)) {
        @unlink($path . "/" . $tmpImage);
    }
    return $result;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:39,代码来源:index.php

示例4: getAddAttachment

function getAddAttachment($file)
{
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    Attachment::confirmFolder();
    if (empty($file['name']) || $file['error'] != 0) {
        return false;
    }
    $attachment = array();
    $attachment['ext'] = Utils_Misc::getFileExtension(Path::getBaseName($file['name']));
    $path = __TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/team";
    if (!is_dir($path)) {
        mkdir($path);
        if (!is_dir($path)) {
            return false;
        }
        @chmod($path, 0777);
    }
    do {
        $attachment['name'] = rand(1000000000, 9999999999) . "." . $attachment['ext'];
        $attachment['path'] = "{$path}/{$attachment['name']}";
    } while (file_exists($attachment['path']));
    if (!move_uploaded_file($file['tmp_name'], $attachment['path'])) {
        return false;
    }
    @chmod($attachment['path'], 0666);
    $pool->reset("TeamUserSettings");
    $pool->setQualifier("blogid", "eq", getBlogId());
    $pool->setQualifier("userid", "eq", getUserId());
    $tmpImage = $pool->getCell("image");
    $pool->reset("TeamUserSettings");
    $pool->setAttribute("image", $attachment['name'], true);
    $pool->setAttribute("updated", Timestamp::getUNIXtime());
    $pool->setQualifier("blogid", "eq", getBlogId());
    $pool->setQualifier("userid", "eq", getUserId());
    if (!$pool->update()) {
        @unlink($attachment['path']);
        $result = $context->getProperty("uri.service") . "/resources/image/spacer.gif";
    } else {
        $result = $context->getProperty("uri.service") . "/attach/" . getBlogId() . "/team/" . $attachment['name'];
    }
    if (!empty($tmpImage)) {
        @unlink($path . "/" . $tmpImage);
    }
    return $result;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:46,代码来源:index.php


注:本文中的Attachment::confirmFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。