示例#1
0
 function removeAll($removeAttachments = true)
 {
     global $database;
     $blogid = getBlogId();
     POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}");
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
         unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
     }
     if ($removeAttachments) {
         Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
     }
 }
示例#2
0
 /**
  * @param $name
  * @return Directory|DirectoryEntry
  */
 public function createSubdirectory($name)
 {
     $dir = new Directory(Path::combine($this->path, $name));
     if (!$dir->isExists()) {
         mkdir($dir->getPhysicalPath(), BX_DIR_PERMISSIONS, true);
     }
     return $dir;
 }
 public static function vue($chemin, $vue = "normal")
 {
     if ($vue == "normal") {
         $ret = '';
         if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
             $ret .= '<form class="galerie infos" method="post" action="' . $chemin->get_url() . '">';
             $ret .= '<h2><input type="text" name="titre" value="' . Stockage::get_prop($chemin, "titre") . '" /></h2>';
             $ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "description");
             $ret .= '<p><input type="submit" value="appliquer" /></p>';
             $ret .= '</form>';
         } else {
             $ret .= '<h2>' . Stockage::get_prop($chemin, "titre") . '</h2>';
             $ret .= '<p class="galerie index description affichage">' . Stockage::get_prop($chemin, "description") . '</p>';
         }
         $ret .= '<div class="galerie photos index">';
         $ret .= '<ul>';
         foreach (Stockage::liste_enfants($chemin) as $k) {
             $mini = Modules::vue($k, 'miniature');
             $ret .= '<li>';
             $ret .= '<a href="' . $k->get_url() . '">';
             // TODO : escape l'url !
             $ret .= '<span class="miniature">';
             $ret .= $mini->contenu;
             // TODO : escape l'url !
             $ret .= '</span>';
             $ret .= '<span class="titre">';
             $ret .= $mini->titre;
             $ret .= '</span>';
             $ret .= '</a>';
             $ret .= '</li>';
         }
         if (Permissions::vérifier_permission($chemin, "nouvelle_page", Authentification::get_utilisateur())) {
             $ret .= '<li>';
             $ret .= '<div class="miniature">';
             $ret .= '<img alt="nouvelle période" src="' . $chemin->get_url("?vue=image_nouvelle_periode") . '" />';
             $ret .= '</div>';
             $ret .= '<div class="titre">';
             $ret .= '<form class="galerie nouvelle_page" method="post" action="' . $chemin->get_url() . '">';
             $ret .= '<p>';
             $ret .= '<input type="hidden" name="action" value="nouvelle_page"/>';
             $ret .= '<input type="submit" value="Nouvelle période"/>';
             $ret .= '</p>';
             $ret .= '</form>';
             $ret .= '</div>';
             $ret .= '</li>';
         }
         $ret .= '</ul>';
         $ret .= '<div class="clearboth"></div>';
         $ret .= '</div>';
         return new Page($ret, Stockage::get_prop($chemin, "titre"));
     } else {
         if ($vue == "image_nouvelle_periode") {
             // Houlàlà ça sent le hack pas beau !
             return new Page(Path::combine(Config::get("chemin_base"), "/code/site/nouvelle_image.jpg"), null, "sendfile");
         }
     }
 }
 function removeAll($removeAttachments = true)
 {
     global $database;
     $blogid = getBlogId();
     $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
     //POD::query("DELETE FROM {$database['prefix']}UserSettings WHERE user = $blogid");
     POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid} AND id <> 0");
     if (count($tags) > 0) {
         $tagliststr = implode(', ', $tags);
         $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
         if (count($nottargets) > 0) {
             $nottargetstr = implode(', ', $nottargets);
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
         } else {
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
         }
     }
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
         unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
     }
     if ($removeAttachments) {
         Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
         POD::query("UPDATE {$database['prefix']}BlogSettings SET logo = '' WHERE blogid = {$blogid}");
     }
 }
示例#5
0
 private function getInfosHelper($currentPath, $infoKind, $searchOptions, &$infos)
 {
     $paths = array_diff(scandir($currentPath), array('..', '.'));
     foreach ($paths as $path) {
         $path = Path::combine($currentPath, $path);
         if (Path::isDir($path)) {
             if (($infoKind & self::DIRECTORY) != 0) {
                 $directoryInfo = new DirectoryInfo($path);
                 array_push($infos, $directoryInfo);
             }
             if ($searchOptions === self::ALL_DIRECTORIES) {
                 $this->getInfosHelper($path, $infoKind, $searchOptions, $infos);
             }
         } else {
             if (($infoKind & self::FILE) != 0) {
                 $fileInfo = new FileInfo($path);
                 array_push($infos, $fileInfo);
             }
         }
     }
 }
示例#6
0
function removeBlog($blogid)
{
    $pool = DBModel::getInstance();
    $ctx = Model_Context::getInstance();
    if (Setting::getServiceSetting("defaultBlogId", 1, true) == $blogid) {
        return false;
    }
    $targets = array('Attachments', 'BlogSettings', 'BlogStatistics', 'Categories', 'Comments', 'CommentsNotified', 'CommentsNotifiedQueue', 'DailyStatistics', 'Entries', 'EntriesArchive', 'FeedGroups', 'FeedReads', 'FeedStarred', 'FeedSettings', 'Filters', 'Links', 'LinkCategories', 'PageCacheLog', 'Plugins', 'RefererLogs', 'RefererStatistics', 'RemoteResponses', 'RemoteResponseLogs', 'SkinSettings', 'TagRelations', 'Privileges', 'XMLRPCPingSettings');
    //Clear Tables
    foreach ($targets as $t) {
        $pool->reset($t);
        $pool->setQualifier('blogid', 'eq', $blogid);
        $pool->delete();
    }
    //Delete Tags
    $tags = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE blogid = {$blogid}");
    if (count($tags) > 0) {
        $tagliststr = implode(', ', $tags);
        // Tag id used at deleted blog.
        $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE tag in ( {$tagliststr} )");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $nottargetstr = implode(', ', $nottargets);
            POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
        } else {
            POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) ");
        }
    }
    //Delete Feeds
    $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM " . $ctx->getProperty('database.prefix') . "FeedGroupRelations WHERE blogid = {$blogid}");
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $query = "SELECT name, value FROM " . $ctx->getProperty('database.prefix') . "ServiceSettings WHERE name like 'Database\\_%'";
    $plugintablesraw = POD::queryAll($query);
    foreach ($plugintablesraw as $table) {
        $dbname = $ctx->getProperty('database.prefix') . substr($table['name'], 9);
        POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "{$dbname} WHERE blogid = {$blogid}");
    }
    //Clear RSS Cache
    if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
        unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
 public function get_fs_public()
 {
     return Path::combine(Config::get("chemin_base_public"), $this->get());
 }
示例#8
0
function removeBlog($blogid)
{
    $pool = DBModel::getInstance();
    $context = Model_Context::getInstance();
    if (Setting::getServiceSetting("defaultBlogId", 1, true) == $blogid) {
        return false;
    }
    $targets = array('Attachments', 'BlogSettings', 'BlogStatistics', 'Categories', 'Comments', 'CommentsNotified', 'CommentsNotifiedQueue', 'DailyStatistics', 'Entries', 'EntriesArchive', 'FeedGroups', 'FeedReads', 'FeedStarred', 'FeedSettings', 'Filters', 'Links', 'LinkCategories', 'PageCacheLog', 'Plugins', 'RefererLogs', 'RefererStatistics', 'RemoteResponses', 'RemoteResponseLogs', 'SkinSettings', 'TagRelations', 'Privileges', 'XMLRPCPingSettings');
    //Clear Tables
    foreach ($targets as $t) {
        $pool->reset($t);
        $pool->setQualifier('blogid', 'eq', $blogid);
        $pool->delete();
    }
    //Delete Tags
    $pool->reset("TagRelations");
    $pool->setQualifier("blogid", "eq", $blogid);
    $tags = $pool->getColumn("tag", "DISTINCT");
    if (count($tags) > 0) {
        $pool->reset("TagRelations");
        // Tag id used at deleted blog.
        $pool->setQualifier("tag", "hasoneof", $tags);
        $nottargets = $pool->getColumn("tag", "DISTINCT");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $pool->reset("Tags");
            $pool->setQualifier("id", "hasoneof", $tags);
            $pool->setQualifier("id", "hasnoneof", $nottargets);
            $pool->delete();
        } else {
            $pool->reset("Tags");
            $pool->setQualifier("id", "hasoneof", $tags);
            $pool->delete();
        }
    }
    //Delete Feeds
    $pool->reset("FeedGroupRelations");
    $pool->setQualifier("blogid", "eq", $blogid);
    $feeds = $pool->getColumn("feeds", "DISTINCT");
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $pool->reset("ServiceSettings");
    $pool->setQualifier("name", "like", "Database_");
    $plugintablesraw = $pool->getAll();
    foreach ($plugintablesraw as $table) {
        $pool->reset(substr($table['name'], 9));
        $pool->setQualifier("blogid", "eq", $blogid);
        $pool->delete();
    }
    //Clear RSS Cache
    if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
        unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
示例#9
0
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'];
            }
            if (isset($node['latitude'][0]['.value'])) {
                $post->latitude = $node['latitude'][0]['.value'];
            }
            $post->created = @$node['created'][0]['.value'];
            $post->modified = @$node['modified'][0]['.value'];
            if ($post->visibility == 'private' && intval($post->published) > $_SERVER['REQUEST_TIME'] || !empty($node['appointed'][0]['.value']) && $node['appointed'][0]['.value'] == 'true') {
                // for compatibility of appointed entries
                $post->visibility = 'appointed';
            }
            if ($post->slogan == '') {
                $post->slogan = 'Untitled' . $post->id;
            }
            if (!empty($node['category'][0]['.value'])) {
                $post->category = Category::getId($node['category'][0]['.value']);
            }
            if (isset($node['tag'])) {
                $post->tags = array();
                for ($i = 0; $i < count($node['tag']); $i++) {
                    if (!empty($node['tag'][$i]['.value'])) {
                        array_push($post->tags, $node['tag'][$i]['.value']);
                    }
                }
            }
            if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) {
                $post->content = nl2brWithHTML($post->content);
            }
            if (!$post->add()) {
                user_error(__LINE__ . $post->error);
            }
            if (isset($node['attachment'])) {
                for ($i = 0; $i < count($node['attachment']); $i++) {
                    $attachment = new Attachment();
                    $attachment->parent = $post->id;
                    $cursor =& $node['attachment'][$i];
                    $attachment->name = $cursor['name'][0]['.value'];
                    $attachment->label = $cursor['label'][0]['.value'];
                    $attachment->mime = @$cursor['.attributes']['mime'];
                    $attachment->size = $cursor['.attributes']['size'];
                    $attachment->width = $cursor['.attributes']['width'];
                    $attachment->height = $cursor['.attributes']['height'];
                    $attachment->enclosure = @$cursor['enclosure'][0]['.value'];
                    $attachment->attached = $cursor['attached'][0]['.value'];
                    $attachment->downloads = @$cursor['downloads'][0]['.value'];
                    if (!$attachment->add()) {
                        user_error(__LINE__ . $attachment->error);
                    } else {
                        if ($cursor['name'][0]['.value'] != $attachment->name) {
                            $post2 = new Post();
                            if ($post2->open($post->id, 'id, content')) {
                                $post2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $post2->content);
                                $post2->loadTags();
                                $post2->update();
                                $post2->close();
                            }
                            unset($post2);
                        }
                    }
                    if (!empty($cursor['content'][0]['.stream'])) {
                        Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        fclose($cursor['content'][0]['.stream']);
                        unset($cursor['content'][0]['.stream']);
                    }
                }
            }
            if (isset($node['comment'])) {
                for ($i = 0; $i < count($node['comment']); $i++) {
                    $comment = new Comment();
                    $comment->entry = $post->id;
                    $cursor =& $node['comment'][$i];
                    $comment->name = $cursor['commenter'][0]['name'][0]['.value'];
                    if (!empty($cursor['id'][0]['.value'])) {
                        $comment->id = $cursor['id'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['.attributes']['id'])) {
                        $comment->commenter = $cursor['commenter'][0]['.attributes']['id'];
                    }
                    if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) {
                        $comment->homepage = $cursor['commenter'][0]['homepage'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) {
                        $comment->ip = $cursor['commenter'][0]['ip'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) {
                        $comment->openid = $cursor['commenter'][0]['openid'][0]['.value'];
                    }
                    $comment->password = $cursor['password'][0]['.value'];
                    $comment->secret = $cursor['secret'][0]['.value'];
                    $comment->written = $cursor['written'][0]['.value'];
                    if (isset($cursor['longitude'][0]['.value'])) {
                        $comment->longitude = $cursor['longitude'][0]['.value'];
                    }
                    if (isset($cursor['latitude'][0]['.value'])) {
                        $comment->latitude = $cursor['latitude'][0]['.value'];
                    }
                    $comment->content = $cursor['content'][0]['.value'];
                    if (!empty($cursor['isFiltered'][0]['.value'])) {
                        $comment->isfiltered = $cursor['isFiltered'][0]['.value'];
                    }
                    if (!$comment->add()) {
                        user_error(__LINE__ . $comment->error);
                    }
                    if (isset($node['comment'][$i]['comment'])) {
                        for ($j = 0; $j < count($node['comment'][$i]['comment']); $j++) {
                            $childComment = new Comment();
                            $childComment->entry = $post->id;
                            $childComment->parent = $comment->id;
                            $cursor =& $node['comment'][$i]['comment'][$j];
                            if (!empty($cursor['id'][0]['.value'])) {
                                $childComment->id = $cursor['id'][0]['.value'];
                            }
                            if (!empty($cursor['commenter'][0]['.attributes']['id'])) {
                                $childComment->commenter = $cursor['commenter'][0]['.attributes']['id'];
                            }
                            $childComment->name = $cursor['commenter'][0]['name'][0]['.value'];
                            if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) {
                                $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value'];
                            }
                            if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) {
                                $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value'];
                            }
                            if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) {
                                $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value'];
                            }
                            $childComment->password = $cursor['password'][0]['.value'];
                            $childComment->secret = $cursor['secret'][0]['.value'];
                            $childComment->written = $cursor['written'][0]['.value'];
                            if (isset($cursor['longitude'][0]['.value'])) {
                                $comment->longitude = $cursor['longitude'][0]['.value'];
                            }
                            if (isset($cursor['latitude'][0]['.value'])) {
                                $comment->latitude = $cursor['latitude'][0]['.value'];
                            }
                            $childComment->content = $cursor['content'][0]['.value'];
                            if (!empty($cursor['isFiltered'][0]['.value'])) {
                                $childComment->isfiltered = $cursor['isFiltered'][0]['.value'];
                            }
                            if (!$childComment->add()) {
                                user_error(__LINE__ . $childComment->error);
                            }
                        }
                    }
                }
            }
            if (isset($node['trackback'])) {
                for ($i = 0; $i < count($node['trackback']); $i++) {
                    $trackback = new Trackback();
                    $trackback->entry = $post->id;
                    $cursor =& $node['trackback'][$i];
                    $trackback->url = $cursor['url'][0]['.value'];
                    $trackback->site = $cursor['site'][0]['.value'];
                    $trackback->title = $cursor['title'][0]['.value'];
                    $trackback->excerpt = @$cursor['excerpt'][0]['.value'];
                    if (!empty($cursor['ip'][0]['.value'])) {
                        $trackback->ip = $cursor['ip'][0]['.value'];
                    }
                    if (!empty($cursor['received'][0]['.value'])) {
                        $trackback->received = $cursor['received'][0]['.value'];
                    }
                    if (!empty($cursor['isFiltered'][0]['.value'])) {
                        $trackback->isFiltered = $cursor['isFiltered'][0]['.value'];
                    }
                    if (!$trackback->add()) {
                        user_error(__LINE__ . $trackback->error);
                    }
                }
            }
            if (isset($node['logs'][0]['trackback'])) {
                for ($i = 0; $i < count($node['logs'][0]['trackback']); $i++) {
                    $log = new TrackbackLog();
                    $log->entry = $post->id;
                    $cursor =& $node['logs'][0]['trackback'][$i];
                    $log->url = $cursor['url'][0]['.value'];
                    if (!empty($cursor['sent'][0]['.value'])) {
                        $log->sent = $cursor['sent'][0]['.value'];
                    }
                    if (!$log->add()) {
                        user_error(__LINE__ . $log->error);
                    }
                }
            }
            return true;
        case '/blog/page':
            setProgress($item++ / $items * 100, _t('페이지를 복원하고 있습니다.'));
            $page = new Page();
            $page->id = $node['id'][0]['.value'];
            $page->slogan = @$node['.attributes']['slogan'];
            $page->visibility = $node['visibility'][0]['.value'];
            if (isset($node['starred'][0]['.value'])) {
                $page->starred = $node['starred'][0]['.value'];
            } else {
                $page->starred = 0;
            }
            $page->title = $node['title'][0]['.value'];
            $page->content = $node['content'][0]['.value'];
            $page->contentformatter = isset($node['content']['.attributes']['formatter']) ? $node['content']['.attributes']['formatter'] : getDefaultFormatter();
            $page->contenteditor = isset($node['content']['.attributes']['editor']) ? $node['content']['.attributes']['editor'] : getDefaultEditor();
            $page->published = $node['published'][0]['.value'];
            $page->created = @$node['created'][0]['.value'];
            $page->modified = @$node['modified'][0]['.value'];
            if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) {
                $page->content = nl2brWithHTML($page->content);
            }
            if (!$page->add()) {
                user_error(__LINE__ . $page->error);
            }
            if (isset($node['attachment'])) {
                for ($i = 0; $i < count($node['attachment']); $i++) {
                    $attachment = new Attachment();
                    $attachment->parent = $page->id;
                    $cursor =& $node['attachment'][$i];
                    $attachment->name = $cursor['name'][0]['.value'];
                    $attachment->label = $cursor['label'][0]['.value'];
                    $attachment->mime = @$cursor['.attributes']['mime'];
                    $attachment->size = $cursor['.attributes']['size'];
                    $attachment->width = $cursor['.attributes']['width'];
                    $attachment->height = $cursor['.attributes']['height'];
                    $attachment->enclosure = @$cursor['enclosure'][0]['.value'];
                    $attachment->attached = $cursor['attached'][0]['.value'];
                    $attachment->downloads = @$cursor['downloads'][0]['.value'];
                    if (Attachment::doesExist($attachment->name)) {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                        $page2 = new Page();
                        if ($page2->open($page->id, 'id, content')) {
                            $page2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $page2->content);
                            $page2->update();
                            $page2->close();
                        }
                        unset($page2);
                    } else {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                    }
                    if (!empty($cursor['content'][0]['.stream'])) {
                        Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        fclose($cursor['content'][0]['.stream']);
                        unset($cursor['content'][0]['.stream']);
                    }
                }
            }
            return true;
        case '/blog/notice':
            setProgress($item++ / $items * 100, _t('공지를 복원하고 있습니다.'));
            $notice = new Notice();
            $notice->id = $node['id'][0]['.value'];
            $notice->slogan = @$node['.attributes']['slogan'];
            $notice->visibility = $node['visibility'][0]['.value'];
            if (isset($node['starred'][0]['.value'])) {
                $notice->starred = $node['starred'][0]['.value'];
            } else {
                $notice->starred = 0;
            }
            $notice->title = $node['title'][0]['.value'];
            $notice->content = $node['content'][0]['.value'];
            $notice->contentformatter = isset($node['content'][0]['.attributes']['formatter']) ? $node['content'][0]['.attributes']['formatter'] : getDefaultFormatter();
            $notice->contenteditor = isset($node['content'][0]['.attributes']['editor']) ? $node['content'][0]['.attributes']['editor'] : getDefaultEditor();
            $notice->published = intval($node['published'][0]['.value']);
            $notice->created = @$node['created'][0]['.value'];
            $notice->modified = @$node['modified'][0]['.value'];
            if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) {
                $notice->content = nl2brWithHTML($notice->content);
            }
            if (!$notice->add()) {
                user_error(__LINE__ . $notice->error);
            }
            if (isset($node['attachment'])) {
                for ($i = 0; $i < count($node['attachment']); $i++) {
                    $attachment = new Attachment();
                    $attachment->parent = $notice->id;
                    $cursor =& $node['attachment'][$i];
                    $attachment->name = $cursor['name'][0]['.value'];
                    $attachment->label = $cursor['label'][0]['.value'];
                    $attachment->mime = @$cursor['.attributes']['mime'];
                    $attachment->size = $cursor['.attributes']['size'];
                    $attachment->width = $cursor['.attributes']['width'];
                    $attachment->height = $cursor['.attributes']['height'];
                    $attachment->enclosure = @$cursor['enclosure'][0]['.value'];
                    $attachment->attached = $cursor['attached'][0]['.value'];
                    $attachment->downloads = @$cursor['downloads'][0]['.value'];
                    if (Attachment::doesExist($attachment->name)) {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                        $notice2 = new Notice();
                        if ($notice2->open($notice->id, 'id, content')) {
                            $notice2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $notice2->content);
                            $notice2->update();
                            $notice2->close();
                        }
                        unset($notice2);
                    } else {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                    }
                    if (!empty($cursor['content'][0]['.stream'])) {
                        Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        fclose($cursor['content'][0]['.stream']);
                        unset($cursor['content'][0]['.stream']);
                    }
                }
            }
            return true;
        case '/blog/keyword':
            setProgress($item++ / $items * 100, _t('키워드를 복원하고 있습니다.'));
            $keyword = new Keyword();
            $keyword->id = $node['id'][0]['.value'];
            $keyword->visibility = $node['visibility'][0]['.value'];
            if (isset($node['starred'][0]['.value'])) {
                $keyword->starred = $node['starred'][0]['.value'];
            } else {
                $keyword->starred = 0;
            }
            $keyword->name = $node['name'][0]['.value'];
            $keyword->description = $node['description'][0]['.value'];
            $keyword->descriptionEditor = isset($node['description'][0]['.attributes']['editor']) ? $node['description'][0]['.attributes']['editor'] : getDefaultEditor();
            $keyword->descriptionFormatter = isset($node['description'][0]['.attributes']['formatter']) ? $node['description'][0]['.attributes']['formatter'] : getDefaultFormatter();
            $keyword->published = intval($node['published'][0]['.value']);
            $keyword->created = @$node['created'][0]['.value'];
            $keyword->modified = @$node['modified'][0]['.value'];
            if (floatval(Setting::getServiceSettingGlobal('newlineStyle')) >= 1.1 && floatval(@$node['.attributes']['format']) < 1.1) {
                $keyword->description = nl2brWithHTML($keyword->description);
            }
            if (!$keyword->add()) {
                user_error(__LINE__ . $keyword->error);
            }
            if (isset($node['attachment'])) {
                for ($i = 0; $i < count($node['attachment']); $i++) {
                    $attachment = new Attachment();
                    $attachment->parent = $keyword->id;
                    $cursor =& $node['attachment'][$i];
                    $attachment->name = $cursor['name'][0]['.value'];
                    $attachment->label = $cursor['label'][0]['.value'];
                    $attachment->mime = @$cursor['.attributes']['mime'];
                    $attachment->size = $cursor['.attributes']['size'];
                    $attachment->width = $cursor['.attributes']['width'];
                    $attachment->height = $cursor['.attributes']['height'];
                    $attachment->enclosure = @$cursor['enclosure'][0]['.value'];
                    $attachment->attached = $cursor['attached'][0]['.value'];
                    $attachment->downloads = @$cursor['downloads'][0]['.value'];
                    if (Attachment::doesExist($attachment->name)) {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                        $keyword2 = new Keyword();
                        if ($keyword2->open($keyword->id, 'id, content')) {
                            $keyword2->content = str_replace($cursor['name'][0]['.value'], $attachment->name, $keyword2->content);
                            $keyword2->update();
                            $keyword2->close();
                        }
                        unset($keyword2);
                    } else {
                        if (!$attachment->add()) {
                            user_error(__LINE__ . $attachment->error);
                        }
                    }
                    if (!empty($cursor['content'][0]['.stream'])) {
                        Utils_Base64Stream::decode($cursor['content'][0]['.stream'], Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        Attachment::adjustPermission(Path::combine(ROOT, 'attach', $blogid, $attachment->name));
                        fclose($cursor['content'][0]['.stream']);
                        unset($cursor['content'][0]['.stream']);
                    }
                }
            }
            return true;
        case '/blog/linkCategories':
            setProgress($item++ / $items * 100, _t('링크 카테고리를 복원하고 있습니다.'));
            $linkCategory = new LinkCategories();
            $linkCategory->name = $node['name'][0]['.value'];
            $linkCategory->priority = $node['priority'][0]['.value'];
            $linkCategory->visibility = !isset($node['visibility'][0]['.value']) || empty($node['visibility'][0]['.value']) ? 2 : $node['visibility'][0]['.value'];
            $linkCategory->id = LinkCategories::getId($linkCategory->name);
            if ($linkCategory->id) {
                if (!$linkCategory->update()) {
                    user_error(__LINE__ . $linkCategory->error);
                }
            } else {
                if (!$linkCategory->add()) {
                    user_error(__LINE__ . $linkCategory->error);
                }
            }
            return true;
        case '/blog/link':
            setProgress($item++ / $items * 100, _t('링크를 복원하고 있습니다.'));
            $link = new Link();
            $link->category = empty($node['category'][0]['.value']) ? 0 : $node['category'][0]['.value'];
            $link->url = $node['url'][0]['.value'];
            $link->title = $node['title'][0]['.value'];
            if (!empty($node['feed'][0]['.value'])) {
                $link->feed = $node['feed'][0]['.value'];
            }
            if (!empty($node['registered'][0]['.value'])) {
                $link->registered = $node['registered'][0]['.value'];
            }
            if (!empty($node['xfn'][0]['.value'])) {
                $link->xfn = $node['xfn'][0]['.value'];
            }
            $link->id = Link::getId($link->url);
            if ($link->id) {
                if (!$link->update()) {
                    user_error(__LINE__ . $link->error);
                }
            } else {
                if (!$link->add()) {
                    user_error(__LINE__ . $link->error);
                }
            }
            return true;
        case '/blog/logs/referer':
            setProgress($item++ / $items * 100, _t('리퍼러 로그를 복원하고 있습니다.'));
            $log = new RefererLog();
            if (isset($node['path'][0]['.value'])) {
                $log->url = $node['path'][0]['.value'];
            } else {
                $log->url = $node['url'][0]['.value'];
            }
            $log->referred = $node['referred'][0]['.value'];
            if (!$log->add(false)) {
                user_error(__LINE__ . $log->error);
            }
            return true;
        case '/blog/commentsNotified/comment':
            setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.'));
            $cmtNotified = new CommentNotified();
            $cmtNotified->id = $node['id'][0]['.value'];
            $cursor =& $node['commenter'][0];
            $cmtNotified->name = $cursor['name'][0]['.value'];
            $cmtNotified->homepage = $cursor['homepage'][0]['.value'];
            $cmtNotified->ip = $cursor['ip'][0]['.value'];
            $cmtNotified->entry = $node['entry'][0]['.value'];
            $cmtNotified->password = $node['password'][0]['.value'];
            $cmtNotified->content = $node['content'][0]['.value'];
            $cmtNotified->parent = $node['parent'][0]['.value'];
            $cmtNotified->secret = $node['secret'][0]['.value'];
            $cmtNotified->written = $node['written'][0]['.value'];
            $cmtNotified->modified = $node['modified'][0]['.value'];
            $cmtNotified->url = $node['url'][0]['.value'];
            $cmtNotified->isnew = $node['isNew'][0]['.value'];
            $site = new CommentNotifiedSiteInfo();
            if (!$site->open("url = '{$node['site'][0]['.value']}'")) {
                $site->title = '';
                $site->name = '';
                $site->modified = 31536000;
                $site->url = $node['site'][0]['.value'];
                $site->add();
            }
            $cmtNotified->siteid = $site->id;
            $site->close();
            $cmtNotified->remoteid = $node['remoteId'][0]['.value'];
            $cmtNotified->entrytitle = !isset($node['entryTitle'][0]['.value']) || empty($node['entryTitle'][0]['.value']) ? 'No title' : $node['entryTitle'][0]['.value'];
            $cmtNotified->entryurl = $node['entryUrl'][0]['.value'];
            if (!$cmtNotified->add()) {
                user_error(__LINE__ . $cmtNotified->error);
            }
            return true;
        case '/blog/commentsNotifiedSiteInfo/site':
            setProgress($item++ / $items * 100, _t('댓글 알리미 내용을 복원하고 있습니다.'));
            $cmtNotifiedSite = new CommentNotifiedSiteInfo();
            if ($cmtNotifiedSite->open("url = '{$node['url'][0]['.value']}'")) {
                if (intval($node['modified'][0]['.value']) > intval($cmtNotifiedSite->modified)) {
                    $cmtNotifiedSite->title = $node['title'][0]['.value'];
                    $cmtNotifiedSite->name = $node['name'][0]['.value'];
                    $cmtNotifiedSite->modified = $node['modified'][0]['.value'];
                }
                if (!$cmtNotifiedSite->update()) {
                    user_error(__LINE__ . $cmtNotifiedSite->error);
                }
            } else {
                $cmtNotifiedSite->url = $node['url'][0]['.value'];
                $cmtNotifiedSite->title = $node['title'][0]['.value'];
                $cmtNotifiedSite->name = $node['name'][0]['.value'];
                $cmtNotifiedSite->modified = $node['modified'][0]['.value'];
                if (!$cmtNotifiedSite->add()) {
                    user_error(__LINE__ . $cmtNotifiedSite->error);
                }
            }
            return true;
        case '/blog/statistics/referer':
            setProgress($item++ / $items * 100, _t('리퍼러 통계를 복원하고 있습니다.'));
            $statistics = new RefererStatistics();
            $statistics->host = $node['host'][0]['.value'];
            $statistics->count = $node['count'][0]['.value'];
            if (!$statistics->add()) {
                user_error(__LINE__ . $statistics->error);
            }
            return true;
        case '/blog/statistics/visits':
            setProgress($item++ / $items * 100, _t('블로그 통계 정보를 복원하고 있습니다.'));
            $statistics = new BlogStatistics();
            $statistics->visits = $node['.value'];
            if (!$statistics->add()) {
                user_error(__LINE__ . $statistics->error);
            }
            return true;
        case '/blog/statistics/daily':
            setProgress($item++ / $items * 100, _t('일별 통계 정보를 복원하고 있습니다.'));
            $statistics = new DailyStatistics();
            $statistics->date = $node['date'][0]['.value'];
            $statistics->visits = $node['visits'][0]['.value'];
            if (!$statistics->add()) {
                user_error(__LINE__ . $statistics->error);
            }
            return true;
        case '/blog/skin':
            setProgress($item++ / $items * 100, _t('스킨 설정을 복원하고 있습니다.'));
            $setting = new SkinSetting();
            if (false) {
                $setting->skin = $node['name'][0]['.value'];
                if (!$setting->save()) {
                    user_error(__LINE__ . $setting->error);
                }
                $setting->skin = null;
            }
            $setting->entriesOnRecent = $node['entriesOnRecent'][0]['.value'];
            $setting->commentsOnRecent = $node['commentsOnRecent'][0]['.value'];
            $setting->trackbacksOnRecent = $node['trackbacksOnRecent'][0]['.value'];
            $setting->commentsOnGuestbook = $node['commentsOnGuestbook'][0]['.value'];
            $setting->tagsOnTagbox = $node['tagsOnTagbox'][0]['.value'];
            $setting->alignOnTagbox = $node['alignOnTagbox'][0]['.value'];
            $setting->expandComment = $node['expandComment'][0]['.value'];
            $setting->expandTrackback = $node['expandTrackback'][0]['.value'];
            if (!empty($node['recentNoticeLength'][0]['.value'])) {
                $setting->recentNoticeLength = $node['recentNoticeLength'][0]['.value'];
            }
            $setting->recentEntryLength = $node['recentEntryLength'][0]['.value'];
            $setting->recentTrackbackLength = $node['recentTrackbackLength'][0]['.value'];
            $setting->linkLength = $node['linkLength'][0]['.value'];
            $setting->showListOnCategory = $node['showListOnCategory'][0]['.value'];
            $setting->showListOnArchive = $node['showListOnArchive'][0]['.value'];
            if (isset($node['tree'])) {
                $cursor =& $node['tree'][0];
                $setting->tree = $cursor['name'][0]['.value'];
                $setting->colorOnTree = $cursor['color'][0]['.value'];
                $setting->bgcolorOnTree = $cursor['bgColor'][0]['.value'];
                $setting->activecolorOnTree = $cursor['activeColor'][0]['.value'];
                $setting->activebgcolorOnTree = $cursor['activeBgColor'][0]['.value'];
                $setting->labelLengthOnTree = $cursor['labelLength'][0]['.value'];
                $setting->showValueOnTree = $cursor['showValue'][0]['.value'];
            }
            if (!$setting->save()) {
                user_error(__LINE__ . $setting->error);
            }
            return true;
        case '/blog/plugin':
            //			setProgress($item++ / $items * 100, _t('플러그인 설정을 복원하고 있습니다.'));
            //			$setting = new PluginSetting();
            //			$setting->name = $node['name'][0]['.value'];
            //			$setting->setting = $node['setting'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            return true;
        case '/blog/personalization':
            //			setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다.'));
            //			$setting = new UserSetting();
            //			$setting->name = 'rowsPerPage';
            //			$setting->value = $node['rowsPerPage'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            //			$setting->name = 'readerPannelVisibility';
            //			$setting->value = $node['readerPannelVisibility'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            //			$setting->name = 'readerPannelHeight';
            //			$setting->value = $node['readerPannelHeight'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            //			$setting->name = 'lastVisitNotifiedPage';
            //			$setting->value = $node['lastVisitNotifiedPage'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            return true;
        case '/blog/userSetting':
            //			setProgress($item++ / $items * 100, _t('사용자 편의 설정을 복원하고 있습니다'));
            //			$setting = new UserSetting();
            //			$setting->name = $node['name'][0]['.value'];
            //			$setting->value = $node['value'][0]['.value'];
            //			if (!$setting->add())
            //				user_error(__LINE__ . $setting->error);
            return true;
        case '/blog/guestbook/comment':
            setProgress($item++ / $items * 100, _t('방명록을 복원하고 있습니다.'));
            $comment = new GuestComment();
            $comment->name = $node['commenter'][0]['name'][0]['.value'];
            if (!empty($node['id'][0]['.value'])) {
                $comment->id = $node['id'][0]['.value'];
            }
            if (!empty($node['commenter'][0]['.attributes']['id'])) {
                $comment->commenter = $node['commenter'][0]['.attributes']['id'];
            }
            if (!empty($node['commenter'][0]['homepage'][0]['.value'])) {
                $comment->homepage = $node['commenter'][0]['homepage'][0]['.value'];
            }
            if (!empty($node['commenter'][0]['ip'][0]['.value'])) {
                $comment->ip = $node['commenter'][0]['ip'][0]['.value'];
            }
            if (!empty($node['commenter'][0]['openid'][0]['.value'])) {
                $comment->openid = $node['commenter'][0]['openid'][0]['.value'];
            }
            $comment->password = $node['password'][0]['.value'];
            $comment->secret = @$node['secret'][0]['.value'];
            $comment->written = $node['written'][0]['.value'];
            $comment->content = $node['content'][0]['.value'];
            if (!$comment->add()) {
                user_error(__LINE__ . $comment->error);
            }
            if (isset($node['comment'])) {
                for ($j = 0; $j < count($node['comment']); $j++) {
                    $childComment = new GuestComment();
                    $childComment->parent = $comment->id;
                    $cursor =& $node['comment'][$j];
                    $childComment->name = $cursor['commenter'][0]['name'][0]['.value'];
                    if (!empty($cursor['id'][0]['.value'])) {
                        $comment->id = $cursor['id'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['.attributes']['id'])) {
                        $childComment->commenter = $cursor['commenter'][0]['.attributes']['id'];
                    }
                    if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) {
                        $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) {
                        $childComment->ip = $cursor['commenter'][0]['ip'][0]['.value'];
                    }
                    if (!empty($cursor['commenter'][0]['openid'][0]['.value'])) {
                        $childComment->openid = $cursor['commenter'][0]['openid'][0]['.value'];
                    }
                    $childComment->password = $cursor['password'][0]['.value'];
                    $childComment->secret = @$cursor['secret'][0]['.value'];
                    $childComment->written = $cursor['written'][0]['.value'];
                    $childComment->content = $cursor['content'][0]['.value'];
                    if (!$childComment->add()) {
                        user_error(__LINE__ . $childComment->error);
                    }
                }
            }
            return true;
        case '/blog/filter':
            setProgress($item++ / $items * 100, _t('필터 설정을 복원하고 있습니다.'));
            $filter = new Filter();
            $filter->type = $node['.attributes']['type'];
            $filter->pattern = $node['pattern'][0]['.value'];
            if (!$filter->add()) {
                user_error(__LINE__ . $filter->error);
            }
            return true;
        case '/blog/feed':
            setProgress($item++ / $items * 100, _t('리더 데이터를 복원하고 있습니다.'));
            $feed = new Feed();
            if (!empty($node['group'][0]['.value'])) {
                $feed->group = FeedGroup::getId($node['group'][0]['.value'], true);
            }
            $feed->url = $node['url'][0]['.value'];
            if (!$feed->add()) {
                user_error(__LINE__ . $feed->error);
            }
            return true;
        case '/blog/line':
            setProgress($item++ / $items * 100, _t('라인을 복원하고 있습니다.'));
            $line = Model_Line::getInstance();
            $line->reset();
            if (!empty($node['author'][0]['.value'])) {
                $line->author = $node['author'][0]['.value'];
            }
            if (!empty($node['category'][0]['.value'])) {
                $line->category = $node['category'][0]['.value'];
            }
            if (!empty($node['root'][0]['.value'])) {
                $line->root = $node['root'][0]['.value'];
            }
            if (!empty($node['permalink'][0]['.value'])) {
                $line->permalink = $node['permalink'][0]['.value'];
            }
            if (!empty($node['content'][0]['.value'])) {
                $line->content = $node['content'][0]['.value'];
            }
            if (!empty($node['created'][0]['.value'])) {
                $line->created = intval($node['created'][0]['.value']);
            }
            if ($line->add()) {
                return true;
            } else {
                user_error(__LINE__ . $line->_error);
            }
    }
}
示例#10
0
function removeBlog($blogid)
{
    global $database;
    if (getServiceSetting("defaultBlogId", 1) == $blogid) {
        return false;
    }
    $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
    $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
    //Clear Tables
    POD::execute("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}BlogSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}BlogStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}EntriesArchive WHERE blogid = {$blogid}");
    //	POD::execute("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = $blogid");
    POD::execute("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}PageCacheLog WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}SkinSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Privileges WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}XMLRPCPingSettings WHERE blogid = {$blogid}");
    //Delete Tags
    if (count($tags) > 0) {
        $tagliststr = implode(', ', $tags);
        // Tag id used at deleted blog.
        $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $nottargetstr = implode(', ', $nottargets);
            POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
        } else {
            POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
        }
    }
    //Delete Feeds
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $query = "SELECT name, value FROM {$database['prefix']}ServiceSettings WHERE name like 'Database\\_%'";
    $plugintablesraw = POD::queryAll($query);
    foreach ($plugintablesraw as $table) {
        $dbname = $database['prefix'] . substr($table['name'], 9);
        POD::execute("DELETE FROM {$database['prefix']}{$dbname} WHERE blogid = {$blogid}");
    }
    //Clear RSS Cache
    if (file_exists(ROOT . "/cache/rss/{$blogid}.xml")) {
        unlink(ROOT . "/cache/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
示例#11
0
 static function removeFiles($directory)
 {
     if (!is_dir($directory)) {
         return false;
     }
     $dir = dir($directory);
     while (($file = $dir->read()) !== false) {
         if (is_file(Path::combine($directory, $file))) {
             unlink(Path::combine($directory, $file));
         }
     }
     return true;
 }
示例#12
0
<?php

// ========== CONFIGURATION =========
// Addresse de courriel de l'administrateur.
Config::set('courriel_admin', "*****@*****.**");
// URL de la racine du site. Ex: http://www.monsite.com/cms/
// Doit se terminer par '/'.
Config::set('url_base', "http://127.0.0.1/2010-moteur-site-simple/");
// Chemin absolu vers le dossier '__cms__'.
// dirname(__FILE__) peut retourner un chemin relatif (PHP < 4.0.2),
// donc utiliser realpath si on s'en sert.
Config::set('chemin_base', realpath(dirname(__FILE__)));
// Chemin vers le stockage interne des données.
// En général, c'est le chemin ..../__cms__/modele
Config::set('chemin_base_stockage', Path::combine(Config::get("chemin_base"), "donnees"));
// Chemin vers la partie visible du site.
// En général, c'est le chemin vers le dossier contenant __cms__
Config::set('chemin_base_public', Path::combine(Config::get("chemin_base"), "/.."));
// ======== FIN CONFIGURATION =======
示例#13
0
 /**
  * @return null|string
  */
 private function readMercurial()
 {
     $hgDir = Path::combine($this->repositoryRoot, '.hg');
     if (!is_dir($hgDir) || !OS::hasBinary('hg')) {
         return null;
     }
     $hg = Exec::create('hg', '--repository', $this->repositoryRoot);
     // Removes everything but the tag if distance is zero.
     $hg->run('log', '-r', '.', '--template', '{latesttag}{sub(\'^-0-m.*\', \'\', \'-{latesttagdistance}-m{node|short}\')}');
     $tag = Dot::get($hg->getOutput(), 0);
     // Actual null if no lines were returned or `hg log` returned actual "null".
     // Either way, need to fall back to the revision id.
     if ($tag === null || $tag === 'null' || Strings::startsWith($tag, 'null-')) {
         $hg->run('id', '-i');
         $tag = Dot::get($hg->getOutput(), 0);
         // Remove 'dirty' plus from revision id
         $tag = rtrim($tag, '+');
     }
     $summary = $hg->run('summary')->getOutput();
     $isDirty = 0 === count(array_filter($summary, function ($line) {
         return preg_match('/^commit: .*\\(clean\\)$/', $line) === 1;
     }));
     if ($isDirty) {
         $tag .= '-dirty';
     }
     return $tag;
 }
 private static function fichier_prop($chemin, $prop)
 {
     return Path::combine($chemin->get_fs_stockage(), '__prop__' . $prop);
 }