function getContentWidth()
 {
     $context = Model_Context::getInstance();
     if ($context->getProperty('skin.contentWidth') == NULL) {
         // Legacy code. ( < 1.8.4 does not have contentWidth information in DB)
         $contentWidth = 550;
         if ($skin = $context->getProperty('skin.skin')) {
             if ($xml = @file_get_contents(ROOT . "/skin/blog/{$skin}/index.xml")) {
                 $xmls = new XMLStruct();
                 $xmls->open($xml, $context->getProperty('service.encoding'));
                 if ($xmls->getValue('/skin/default/contentWidth')) {
                     $contentWidth = $xmls->getValue('/skin/default/contentWidth');
                 }
             }
         }
         Setting::setSkinSetting('contentWidth', $contentWidth);
         return $contentWidth;
     } else {
         return $context->getProperty('skin.contentWidth');
     }
 }
 public function save()
 {
     if (isset($this->skin)) {
         if (strncmp($this->skin, 'customize/', 10) == 0) {
             if (strcmp($this->skin, "customize/" . getBlogId()) != 0) {
                 return $this->_error('skin');
             }
         } else {
             if (!Validator::filename($this->skin)) {
                 return $this->_error('skin');
             }
         }
         if (!Validator::path($this->skin) || !file_exists(ROOT . '/skin/' . $this->skin)) {
             return $this->_error('skin');
         }
         Setting::setSkinSetting('skin', $this->skin);
     }
     if (isset($this->entriesOnRecent)) {
         if (!Validator::number($this->entriesOnRecent, 1)) {
             return $this->_error('entriesOnRecent');
         }
         Setting::setSkinSetting('entriesOnRecent', $this->entriesOnRecent);
     }
     if (isset($this->commentsOnRecent)) {
         if (!Validator::number($this->commentsOnRecent, 1)) {
             return $this->_error('commentsOnRecent');
         }
         Setting::setSkinSetting('commentsOnRecent', $this->commentsOnRecent);
     }
     if (isset($this->trackbacksOnRecent)) {
         if (!Validator::number($this->trackbacksOnRecent, 1)) {
             return $this->_error('trackbacksOnRecent');
         }
         Setting::setSkinSetting('trackbacksOnRecent', $this->trackbacksOnRecent);
     }
     if (isset($this->commentsOnGuestbook)) {
         if (!Validator::number($this->commentsOnGuestbook, 1)) {
             return $this->_error('commentsOnGuestbook');
         }
         Setting::setSkinSetting('commentsOnGuestbook', $this->commentsOnGuestbook);
     }
     if (isset($this->tagsOnTagbox)) {
         if (!Validator::number($this->tagsOnTagbox, 1)) {
             return $this->_error('tagsOnTagbox');
         }
         Setting::setSkinSetting('tagsOnTagbox', $this->tagsOnTagbox);
     }
     if (isset($this->alignOnTagbox)) {
         if (!Validator::number($this->alignOnTagbox, 1, 3)) {
             return $this->_error('alignOnTagbox');
         }
         Setting::setSkinSetting('tagboxAlign', $this->alignOnTagbox);
     }
     if (isset($this->expandComment)) {
         Setting::setSkinSetting('expandComment', Validator::getBit($this->expandComment));
     }
     if (isset($this->expandTrackback)) {
         Setting::setSkinSetting('expandTrackback', Validator::getBit($this->expandTrackback));
     }
     if (isset($this->recentNoticeLength)) {
         if (!Validator::number($this->recentNoticeLength, 0)) {
             return $this->_error('recentNoticeLength');
         }
         Setting::setSkinSetting('recentNoticeLength', $this->recentNoticeLength);
     }
     if (isset($this->recentPageLength)) {
         if (!Validator::number($this->recentPageLength, 0)) {
             return $this->_error('recentPageLength');
         }
         Setting::setSkinSetting('recentPageLength', $this->recentPageLength);
     }
     if (isset($this->recentTrackbackLength)) {
         if (!Validator::number($this->recentTrackbackLength, 0)) {
             return $this->_error('recentTrackbackLength');
         }
         Setting::setSkinSetting('recentTrackbackLength', $this->recentTrackbackLength);
     }
     if (isset($this->linkLength)) {
         if (!Validator::number($this->linkLength, 0)) {
             return $this->_error('linkLength');
         }
         Setting::setSkinSetting('linkLength', $this->linkLength);
     }
     if (isset($this->showListOnCategory)) {
         Setting::setSkinSetting('showListOnCategory', Validator::getBit($this->showListOnCategory));
     }
     if (isset($this->showListOnArchive)) {
         Setting::setSkinSetting('showListOnArchive', Validator::getBit($this->showListOnArchive));
     }
     if (isset($this->tree)) {
         if (!Validator::directory($this->tree) || !file_exists(ROOT . '/skin/tree/' . $this->tree)) {
             return $this->_error('tree');
         }
         Setting::setSkinSetting('tree', $this->tree);
     }
     if (isset($this->colorOnTree)) {
         Setting::setSkinSetting('colorOnTree', $this->colorOnTree);
     }
     if (isset($this->bgcolorOnTree)) {
         Setting::setSkinSetting('bgcolorOnTree', $this->bgcolorOnTree);
     }
     if (isset($this->activecolorOnTree)) {
         Setting::setSkinSetting('activecolorOnTree', $this->activecolorOnTree);
     }
     if (isset($this->activebgcolorOnTree)) {
         Setting::setSkinSetting('activebgcolorOnTree', $this->activebgcolorOnTree);
     }
     if (isset($this->labelLengthOnTree)) {
         if (!Validator::number($this->labelLengthOnTree, 0)) {
             return $this->_error('labelLengthOnTree');
         }
         Setting::setSkinSetting('labelLengthOnTree', $this->labelLengthOnTree);
     }
     if (isset($this->showValueOnTree)) {
         Setting::setSkinSetting('showValueOnTree', Validator::getBit($this->showValueOnTree));
     }
     return true;
 }
Beispiel #3
0
function setSkinSetting($blogid, $setting)
{
    global $skinSetting;
    // Legacy global support. TODO: DELETE THIS LINE AFTER CHECK EVERY REFERENCES IN WHOLE SOURCE
    importlib('blogskin');
    $blogid = getBlogId();
    if (strncmp($context->getProperty('skin.skin'), 'customize/', 10) == 0) {
        if (strcmp($context->getProperty('skin.skin'), "customize/{$blogid}") != 0) {
            return false;
        }
    } else {
        $skinSetting['skin'] = Path::getBaseName($context->getProperty('skin.skin'));
        // Legacy global support. TODO: DELETE THIS LINE AFTER CHECK EVERY REFERENCES IN WHOLE SOURCE
        $context->setProperty('skin.skin', $skinSetting['skin']);
        if ($context->getProperty('skin.skin') === '.' || $context->getProperty('skin.skin') === '..') {
            return _t('실패 했습니다');
        }
    }
    $skinpath = getSkinPath($context->getProperty('skin.skin'));
    if (!is_dir($skinpath)) {
        return _t('실패 했습니다');
    }
    foreach ($setting as $key => $value) {
        Setting::setSkinSetting($key, $value, $blogid);
    }
    Setting::setSkinSetting('skin', $context->getProperty('skin.skin'), $blogid);
    Setting::setBlogSetting('useMicroformat', $setting['useMicroformat'], true);
    Setting::setBlogSetting('useAjaxComment', $setting['useAjaxComment'], true);
    Setting::setBlogSetting('useFOAF', $setting['useFOAF'] == 1 ? 1 : 0, true);
    Setting::setBlogSetting('entriesOnPage', $setting['entriesOnPage'], true);
    Setting::setBlogSetting('entriesOnList', $setting['entriesOnList'], true);
    CacheControl::flushCategory();
    CacheControl::flushTag();
    CacheControl::flushSkin();
    Setting::getSkinSettings($blogid, true);
    // refresh skin cache
    return true;
}
Beispiel #4
0
function setSkinSetting($blogid, $setting)
{
    global $database;
    global $skinSetting;
    requireLibrary('blog.skin');
    $blogid = getBlogId();
    if (strncmp($skinSetting['skin'], 'customize/', 10) == 0) {
        if (strcmp($skinSetting['skin'], "customize/{$blogid}") != 0) {
            return false;
        }
    } else {
        $skinSetting['skin'] = Path::getBaseName($skinSetting['skin']);
        if ($skinSetting['skin'] === '.' || $skinSetting['skin'] === '..') {
            return _t('실패 했습니다');
        }
    }
    $skinpath = ROOT . '/skin/blog/' . $skinSetting['skin'];
    if (!is_dir($skinpath)) {
        return _t('실패 했습니다');
    }
    foreach ($setting as $key => $value) {
        Setting::setSkinSetting($key, $value, $blogid);
    }
    Setting::setSkinSetting('skin', $skinSetting['skin'], $blogid);
    Setting::setBlogSetting('useMicroformat', $setting['useMicroformat'], true);
    Setting::setBlogSetting('useAjaxComment', $setting['useAjaxComment'], true);
    Setting::setBlogSetting('useFOAF', $setting['useFOAF'] == 1 ? 1 : 0, true);
    Setting::setBlogSetting('entriesOnPage', $setting['entriesOnPage'], true);
    Setting::setBlogSetting('entriesOnList', $setting['entriesOnList'], true);
    CacheControl::flushCategory();
    CacheControl::flushTag();
    CacheControl::flushSkin();
    Setting::getSkinSettings($blogid, true);
    // refresh skin cache
    return true;
}