function handleSidebars(&$sval, &$obj, $previewMode) { global $service, $pluginURL, $pluginPath, $pluginName, $configVal, $configMappings; importlib('model.blog.sidebar'); $newSidebarAllOrders = array(); // [sidebar id][element id](type, id, parameters) // type : 1=skin text, 2=default handler, 3=plug-in // id : type1=sidebar i, type2=handler id, type3=plug-in handler name // parameters : type1=sidebar j, blah blah~ $sidebarCount = count($obj->sidebarBasicModules); $sidebarAllOrders = getSidebarModuleOrderData($sidebarCount); if ($previewMode == true) { $sidebarAllOrders = null; } else { if (is_null($sidebarAllOrders)) { $sidebarAllOrders = array(); } } for ($i = 0; $i < $sidebarCount; $i++) { $str = ""; if (!is_null($sidebarAllOrders) && array_key_exists($i, $sidebarAllOrders)) { $currentSidebarOrder = $sidebarAllOrders[$i]; for ($j = 0; $j < count($currentSidebarOrder); $j++) { if ($currentSidebarOrder[$j]['type'] == 1) { // skin text $skini = $currentSidebarOrder[$j]['id']; $skinj = $currentSidebarOrder[$j]['parameters']; if (isset($obj->sidebarBasicModules[$skini]) && isset($obj->sidebarBasicModules[$skini][$skinj])) { $str .= $obj->sidebarBasicModules[$skini][$skinj]['body']; } } else { if ($currentSidebarOrder[$j]['type'] == 2) { // default handler // TODO : implement } else { if ($currentSidebarOrder[$j]['type'] == 3) { // plugin $plugin = $currentSidebarOrder[$j]['id']['plugin']; $handler = $currentSidebarOrder[$j]['id']['handler']; include_once ROOT . "/plugins/{$plugin}/index.php"; if (function_exists($handler)) { $str .= "[##_temp_sidebar_element_{$i}_{$j}_##]"; $parameter = $currentSidebarOrder[$j]['parameters']; $obj->sidebarStorage["temp_sidebar_element_{$i}_{$j}"]['plugin'] = $plugin; $obj->sidebarStorage["temp_sidebar_element_{$i}_{$j}"]['handler'] = $handler; $obj->sidebarStorage["temp_sidebar_element_{$i}_{$j}"]['parameters'] = $parameter; } else { $obj->sidebarStorage["temp_sidebar_element_{$i}_{$j}"] = ""; } } else { // WHAT? } } } } } else { $newSidebarAllOrders[$i] = array(); for ($j = 0; $j < count($obj->sidebarBasicModules[$i]); $j++) { $str .= $obj->sidebarBasicModules[$i][$j]['body']; array_push($newSidebarAllOrders[$i], array('type' => '1', 'id' => "{$i}", 'parameters' => "{$j}")); } if (!is_null($sidebarAllOrders)) { $sidebarAllOrders[$i] = $newSidebarAllOrders[$i]; } } dress("sidebar_{$i}", $str, $sval); } if (count($newSidebarAllOrders) > 0) { if ($previewMode == false && !is_null($sidebarAllOrders)) { Setting::setBlogSettingGlobal("sidebarOrder", serialize($sidebarAllOrders)); CacheControl::flushSkin(); } } }
<?php /// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) $IV = array('GET' => array('sidebarNumber' => array('int'), 'modulePos' => array('int'), 'viewMode' => array('string', 'default' => ''))); require ROOT . '/library/preprocessor.php'; importlib('blogskin'); importlib("model.blog.sidebar"); $ctx = Model_Context::getInstance(); $skin = new Skin($ctx->getProperty('skin.skin')); $sidebarCount = count($skin->sidebarBasicModules); $sidebarOrder = deleteSidebarModuleOrderData(getSidebarModuleOrderData($sidebarCount), $_GET['sidebarNumber'], $_GET['modulePos']); Setting::setBlogSettingGlobal("sidebarOrder", serialize($sidebarOrder)); $skin->purgeCache(); //Respond::ResultPage(0); if ($_GET['viewMode'] != '') { $_GET['viewMode'] = '?' . $_GET['viewMode']; } header('Location: ' . $context->getProperty('uri.blog') . '/owner/skin/sidebar' . $_GET['viewMode']);
list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep'); dress('link_rep', getLinksView($pd_link, $s_link_rep), $view); dress('rss_url', "{$context->getProperty}('uri.blog')/rss", $view); dress('owner_url', "{$context->getProperty}('uri.blog')/owner", $view); dress('textcube_name', TEXTCUBE_NAME, $view); dress('textcube_version', TEXTCUBE_VERSION, $view); $tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU'); $tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>'); $view = preg_replace($tagSearches, $tagReplaces, $view); return correctSidebarImage($view); } $skin = new Skin($skinSetting['skin']); $sidebarCount = count($skin->sidebarBasicModules); getBlogContentForSideBar(); if ($_REQUEST['sidebarNumber'] >= 0 && $_REQUEST['sidebarNumber'] < $sidebarCount) { $sidebarOrder = getSidebarModuleOrderData($sidebarCount); $target = $sidebarOrder[$_REQUEST['sidebarNumber']][$_REQUEST['modulePos']]; $sidebarPluginArray = array(); for ($i = 0; $i < count($sidebarMappings); $i++) { $sidebarPluginArray[$sidebarMappings[$i]['plugin'] . '/' . $sidebarMappings[$i]['handler']] = array('type' => 3, 'id' => $sidebarMappings[$i]['handler'], 'plugin' => $sidebarMappings[$i]['plugin'], 'title' => $sidebarMappings[$i]['title'], 'display' => $sidebarMappings[$i]['display'], 'identifier' => implode(':', array(3, $sidebarMappings[$i]['plugin'], $sidebarMappings[$i]['handler'])), 'parameters' => $sidebarMappings[$i]['parameters']); } if ($target['type'] == 3) { $sidbarPluginIndex = $target['id']['plugin'] . '/' . $target['id']['handler']; if (array_key_exists($sidbarPluginIndex, $sidebarPluginArray)) { $pluginURL = $context->getProperty('service.path') . "/plugins/{$target['id']['plugin']}"; include_once ROOT . "/plugins/{$target['id']['plugin']}/index.php"; if (!empty($configMappings[$target['id']['plugin']]['config'])) { $configVal = getCurrentSetting($target['id']['plugin']); } else { $configVal = ''; }
</ul> <div id="sidebar-box-disabled" class="data-inbox"> <p><?php echo _t('사용중인 스킨이 사이드바 기능을 지원하지 않습니다.'); ?> </p> </div> </form> <?php require ROOT . '/interface/common/owner/footer.php'; exit; } // 사용중인 사이드바 모듈 리스트 출력. $bFirstRadio = true; $sidebarConfig = getSidebarModuleOrderData($sidebarCount); if (is_null($sidebarConfig)) { for ($i = 0; $i < $sidebarCount; $i++) { $sidebarConfig[$i] = array(); } } ?> <ul id="sidebar-tabs-box" class="tabs-box second-tab"> <li class="default-mode-button<?php echo $defaultModeSelected ? ' selected' : NULL; ?> "><a href="<?php echo $context->getProperty('uri.blog'); ?> /owner/skin/sidebar" title="<?php echo _t('실제 출력되는 내용을 직접 볼 수 있는 기본 모드입니다.');