function fetchConfigXML($DATA) { $xmls = new XMLStruct(); // else, parse them... $outVal = array(); if (!$xmls->open($DATA)) { unset($xmls); return null; } if (is_null($xmls->selectNodes('/config/field'))) { unset($xmls); return null; } foreach ($xmls->selectNodes('/config/field') as $field) { if (empty($field['.attributes']['name']) || empty($field['.attributes']['type'])) { unset($xmls); return null; } $outVal[$field['.attributes']['name']] = $field['.value']; } unset($xmls); return $outVal; }
<?php define('ROOT', '../../..'); include ROOT . '/lib/includeForAdmin.php'; requireAdmin(); include ROOT. '/lib/piece/adminHeader.php'; $exports = array(); $xmls = new XMLStruct; $exportXmls = new XMLStruct; $dir = dir(ROOT . '/exports/'); while (($file = $dir->read()) !== false) { if (!preg_match('/^[A-Za-z0-9 _-]+$/', $file)) continue; if (!is_dir(ROOT . '/exports/' . $file)) continue; if (!file_exists(ROOT . '/exports/'.$file.'/index.xml')) continue; if (!$xmls->openFile(ROOT . '/exports/'.$file.'/index.xml')) continue; $export = array(); $export['name'] = $file; $export['title'] = $xmls->getValue('/export/information/name[lang()]'); $export['description'] = $xmls->getValue('/export/information/description[lang()]'); $exportAuthor = $xmls->selectNode('/export/information/author[lang()]'); $export['author'] = array('name'=>$exportAuthor['.value'], 'link'=>$exportAuthor['.attributes']['link'], 'email'=>$exportAuthor['.attributes']['email']); if ($exportConf = $xmls->selectNode('/export/config[lang()]')) { $export['config'] = 'y'; $export['window'] = $exportConf['window'][0]['.attributes']; } else {
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'); } }
function flushItemsByPlugin($pluginName) { global $databases; $xmls = new XMLStruct(); $manifest = @file_get_contents(ROOT . "/plugins/{$pluginName}/index.xml"); if ($manifest && $xmls->open($manifest)) { if ($xmls->doesExist('/plugin/binding/listener')) { //event listener가 있는 경우 foreach ($xmls->selectNodes('/plugin/binding/listener') as $listener) { if (!empty($listener['.attributes']['event']) && !empty($listener['.value'])) { // Event가 있는 경우 if (strpos(strtolower($listener['.attributes']['event']), 'view') !== false) { CacheControl::flushCategory(); } } } unset($listener); } if ($xmls->doesExist('/plugin/binding/tag')) { foreach ($xmls->selectNodes('/plugin/binding/tag') as $tag) { if (!empty($tag['.attributes']['name']) && !empty($tag['.attributes']['handler'])) { CacheControl::flushCategory(); CacheControl::flushTag(); } } unset($tag); } // if ($xmls->doesExist('/plugin/binding/sidebar')) { // TODO: 사이드바 캐시때 처리하도록 하지요. // } if ($xmls->doesExist('/plugin/binding/formatter[lang()]')) { CacheControl::flushCategory(); } } }
function receive($xml = null) { if (empty($xml)) { if (empty($_SERVER['CONTENT_TYPE']) || empty($GLOBALS['HTTP_RAW_POST_DATA']) || ($_SERVER['CONTENT_TYPE'] != 'text/xml')) return false; $xmls = new XMLStruct(); if ($xmls->open($GLOBALS['HTTP_RAW_POST_DATA']) == false) { return false; } } else { $xmls = new XMLStruct(); if ($xmls->open($xml) == false) { return false; } } if ($xmls->error) { return false; } if (!isset($xmls->struct['methodCall'][0]['methodName'][0]['.value'])) { return false; } $this->methodName = $xmls->struct['methodCall'][0]['methodName'][0]['.value']; $params = $xmls->selectNodes('/methodCall/params/param'); $this->params = array(); for ($i = 0; $i < count($params); $i++) { if (!isset($params[$i]['value'])) return false; array_push($this->params, $this->_decodeValue($params[$i]['value'][0])); } if (isset($this->_registry[$this->methodName])) { $result = call_user_func_array($this->_registry[$this->methodName], $this->params); if (is_a($result, 'XMLRPCFault')) $this->sendFault($result->code, $result->string); else $this->sendResponse($result); } else { $this->sendFault(1, 'Method was not found'); } return true; }
function notifyComment() { global $database, $service, $blog, $defaultURL; $blogid = getBlogId(); $sql = "SELECT\n\t\t\t\tCN.*,\n\t\t\t\tCNQ.id AS queueId,\n\t\t\t\tCNQ.commentid AS commentid,\n\t\t\t\tCNQ.sendstatus AS sendstatus,\n\t\t\t\tCNQ.checkdate AS checkdate,\n\t\t\t\tCNQ.written AS queueWritten\n\t\t\tFROM\n\t\t\t\t{$database['prefix']}CommentsNotifiedQueue AS CNQ\n\t\t\tLEFT JOIN\n\t\t\t\t{$database['prefix']}Comments AS CN ON CNQ.commentid = CN.id\n\t\t\tWHERE\n\t\t\t\tCNQ.sendstatus = 0\n\t\t\t\tand CN.parent is not null\n\t\t\tORDER BY CNQ.id ASC LIMIT 1 OFFSET 0"; $queue = POD::queryRow($sql); if (empty($queue) && empty($queue['queueId'])) { return false; } $comments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$queue['commentid']}"); if (empty($comments['parent']) || $comments['secret'] == 1) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $parentComments = POD::queryRow("SELECT * FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$comments['parent']}"); if (empty($parentComments['homepage'])) { POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); return false; } $entry = POD::queryRow("SELECT * FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id={$comments['entry']}"); if (is_null($entry)) { $r1_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $parentComments['id'] . "#guestbook" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/guestbook/" . $comments['id'] . "#guestbook" . $comments['id']); $entry['title'] = _textf('%1 블로그의 방명록', $blog['title']); $entryPermaLink = "{$defaultURL}/guestbook/"; $entry['id'] = 0; } else { $r1_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $parentComments['id']); $r2_comment_check_url = rawurlencode("{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $comments['id']); $entryPermaLink = "{$defaultURL}/" . ($blog['useSloganOnPost'] ? "entry/{$entry['slogan']}" : $entry['id']); } $data = "url=" . rawurlencode($defaultURL) . "&mode=fb" . "&s_home_title=" . rawurlencode($blog['title']) . "&s_post_title=" . rawurlencode($entry['title']) . "&s_name=" . rawurlencode($comments['name']) . "&s_no=" . rawurlencode($comments['entry']) . "&s_url=" . rawurlencode($entryPermaLink) . "&r1_name=" . rawurlencode($parentComments['name']) . "&r1_no=" . rawurlencode($parentComments['id']) . "&r1_pno=" . rawurlencode($comments['entry']) . "&r1_rno=0" . "&r1_homepage=" . rawurlencode($parentComments['homepage']) . "&r1_regdate=" . rawurlencode($parentComments['written']) . "&r1_url=" . $r1_comment_check_url . "&r2_name=" . rawurlencode($comments['name']) . "&r2_no=" . rawurlencode($comments['id']) . "&r2_pno=" . rawurlencode($comments['entry']) . "&r2_rno=" . rawurlencode($comments['parent']) . "&r2_homepage=" . rawurlencode($comments['homepage']) . "&r2_regdate=" . rawurlencode($comments['written']) . "&r2_url=" . $r2_comment_check_url . "&r1_body=" . rawurlencode($parentComments['comment']) . "&r2_body=" . rawurlencode($comments['comment']); if (strpos($parentComments['homepage'], "http://") === false) { $homepage = 'http://' . $parentComments['homepage']; } else { $homepage = $parentComments['homepage']; } $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { $xmls = new XMLStruct(); if ($xmls->open($request->responseText)) { $result = $xmls->selectNode('/response/error/'); if ($result['.value'] != '1' && $result['.value'] != '0') { $homepage = rtrim($homepage, '/') . '/index.php'; $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { } } } } else { } POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE id={$queue['queueId']}"); }
<?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('Name' => array('string'), 'Tab' => array('string', 'default' => 'about'))); require ROOT . '/library/preprocessor.php'; $targetURL = $context->getProperty('uri.host') . preg_replace('/(currentSetting)$/', 'receiveConfig', $context->getProperty('uri.folder')); $pluginName = $_GET['Name']; $tabName = $_GET['Tab']; $active = in_array($pluginName, $activePlugins); $result = handleConfig($pluginName); if (is_null($result)) { Respond::NotFoundPage(); } $xmls = new XMLStruct(); if (!$xmls->open(file_get_contents(ROOT . "/plugins/{$pluginName}/index.xml"))) { Respond::NotFoundPage(); } else { $pluginAttrs = array("link" => $xmls->getValue('/plugin/link[lang()]'), "title" => htmlspecialchars($xmls->getValue('/plugin/title[lang()]')), "version" => htmlspecialchars($xmls->getValue('/plugin/version[lang()]')), "requirements" => $xmls->doesExist('/plugin/requirements/tattertools') ? $xmls->getValue('/plugin/requirements/tattertools') : $xmls->getValue('/plugin/requirements/textcube'), "description" => htmlspecialchars($xmls->getValue('/plugin/description[lang()]')), "authorLink" => $xmls->getAttribute('/plugin/author[lang()]', 'link'), "author" => htmlspecialchars($xmls->getValue('/plugin/author[lang()]')), "license" => htmlspecialchars($xmls->getValue('/plugin/license[lang()]')), "scope" => array()); if ($xmls->doesExist('/plugin/binding/adminMenu')) { array_push($pluginAttrs['scope'], '관리자'); } if ($xmls->doesExist('/plugin/binding/tag')) { array_push($pluginAttrs['scope'], '블로그'); } if ($xmls->doesExist('/plugin/binding/center')) { array_push($pluginAttrs['scope'], '대시보드'); } if ($xmls->doesExist('/plugin/binding/listener')) { array_push($pluginAttrs['scope'], '분류없음');
function handleConfig($plugin) { global $service, $typeSchema, $pluginURL, $pluginPath, $pluginName, $configMappings, $configVal, $adminSkinSetting; $typeSchema = array('text', 'textarea', 'select', 'checkbox', 'radio'); $manifest = @file_get_contents(ROOT . "/plugins/{$plugin}/index.xml"); $xmls = new XMLStruct(); $CDSPval = ''; $i = 0; $dfVal = Setting::fetchConfigVal(getCurrentSetting($plugin)); $name = ''; $clientData = '['; $title = $plugin; if ($manifest && $xmls->open($manifest)) { $title = $xmls->getValue('/plugin/title[lang()]'); //설정 핸들러가 존재시 바꿈 $config = $xmls->selectNode('/plugin/binding/config[lang()]'); unset($xmls); if (!empty($config['.attributes']['manifestHandler'])) { $handler = $config['.attributes']['manifestHandler']; $oldconfig = $config; $pluginURL = "{$service['path']}/plugins/{$plugin}"; $pluginPath = ROOT . "/plugins/{$plugin}"; $pluginName = $plugin; include_once ROOT . "/plugins/{$plugin}/index.php"; if (function_exists($handler)) { if (!empty($configMappings[$plugin]['config'])) { $configVal = getCurrentSetting($plugin); } else { $configVal = ''; } $manifest = call_user_func($handler, $plugin); if (!is_null($languageDomain)) { $locale->domain = $languageDomain; } } $newXmls = new XMLStruct(); if ($newXmls->open($manifest)) { unset($config); $config = $newXmls->selectNode('/config[lang()]'); } unset($newXmls); } if (is_null($config['fieldset'])) { return array('code' => _t('설정 값이 없습니다.'), 'script' => '[]'); } foreach ($config['fieldset'] as $fieldset) { $legend = !empty($fieldset['.attributes']['legend']) ? htmlspecialchars($fieldset['.attributes']['legend']) : ''; $CDSPval .= CRLF . TAB . "<fieldset>" . CRLF . TAB . TAB . "<legend><span class=\"text\">{$legend}</span></legend>" . CRLF; if (!empty($fieldset['field'])) { foreach ($fieldset['field'] as $field) { if (empty($field['.attributes']['name'])) { continue; } $name = $field['.attributes']['name']; $clientData .= getFieldName($field, $name); $CDSPval .= TreatType($field, $dfVal, $name); } } $CDSPval .= TAB . "</fieldset>" . CRLF; } } else { $CDSPval = _t('설정 값이 없습니다.'); } $clientData .= ']'; return array('code' => $CDSPval, 'script' => $clientData, 'title' => $title); }
} else { $("#plugin_config_wrap").height($(document.body).height() - buttonHeight); var h = $("#plugin_information_wrap").height(); if(h<$("#plugin_config_wrap").height()) { h = $("#plugin_config_wrap").height(); } var height = h + buttonHeight; } parent.resizePluginConfig('<?php echo $pluginName;?>',height); }); </script> </head> <body class="plugin_body"> <?php $plugConfig = new XMLStruct; $plugSettings = array(); $plugSettingsStr = $db->queryCell("SELECT settings FROM {$database['prefix']}Plugins WHERE name='{$pluginName}'"); if ($plugConfig->open($plugSettingsStr)) { $pluginConfigs = $plugConfig->selectNode('/config'); if(isset($pluginConfigs['field'])) { foreach ($pluginConfigs['field'] as $field) { $name = $field['.attributes']['name']; $type = $field['.attributes']['type']; $value = $field['.value']; $plugSettings[$name] = array(); $plugSettings[$name]['value'] = $value; $plugSettings[$name]['type'] = $type; } }
function makeWelcomeMsg($msgPack = 'default') { $useClockBase = false; $xmls=new XMLStruct(); if (!$xmls->openFile(ROOT . '/language/welcome/'.$msgPack.'.xml')) return msg::getRandomMsg('welcome'); if ($useClockBase) { $hour = date("H"); switch(true) { case (($hour >= 2) && ($hour <= 5)): $tick = 'daybreak'; break; case (($hour >= 6) && ($hour <= 11)): $tick = 'morning'; break; case (($hour >= 12) && ($hour <= 17)): $tick = 'afternoon'; case (($hour >= 18) && ($hour <= 19)): $tick = 'evening'; case (($hour >= 20) || ($hour <= 1)): $tick = 'night'; } } else { // common $tick = 'common'; } $max = $xmls->getNodeCount("/welcome/$tick/item"); $bingo = mt_rand(1, $max); return $xmls->getValue("/welcome/$tick/item[$bingo]"); }
function selectSkin($blogid, $skinName) { global $database, $service; requireComponent('Needlworks.Cache.PageCache'); requireLibrary('blog.skin'); $blogid = getBlogId(); if (empty($skinName)) { return _t('실패했습니다.'); } if (strncmp($skinName, 'customize/', 10) == 0) { if (strcmp($skinName, "customize/{$blogid}") != 0) { return _t('실패 했습니다'); } } else { $skinName = Path::getBaseName($skinName); if ($skinName === '.' || $skinName === '..') { return _t('실패 했습니다'); } } if (file_exists(ROOT . "/skin/blog/{$skinName}/index.xml")) { $xml = file_get_contents(ROOT . "/skin/blog/{$skinName}/index.xml"); $xmls = new XMLStruct(); if (!$xmls->open($xml, $service['encoding'])) { return _t('실패했습니다.'); } $assignments = array('skin' => $skinName); $value = $xmls->getValue('/skin/default/recentEntries'); if (!empty($value) || is_numeric($value)) { $assignments['entriesOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/recentComments'); if (!empty($value) || is_numeric($value)) { $assignments['commentsOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/itemsOnGuestbook'); if (!empty($value) || is_numeric($value)) { $assignments['commentsOnGuestbook'] = $value; } $value = $xmls->getValue('/skin/default/tagsInCloud'); if (!empty($value) || is_numeric($value)) { $assignments['tagsOnTagbox'] = $value; } $value = $xmls->getValue('/skin/default/sortInCloud'); if (!empty($value) || is_numeric($value)) { $assignments['tagboxAlign'] = $value; } $value = $xmls->getValue('/skin/default/recentTrackbacks'); if (!empty($value) || is_numeric($value)) { $assignments['trackbacksOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/expandComment'); if (isset($value)) { $assignments['expandComment'] = $value ? '1' : '0'; } $value = $xmls->getValue('/skin/default/expandTrackback'); if (isset($value)) { $assignments['expandTrackback'] = $value ? '1' : '0'; } $value = $xmls->getValue('/skin/default/lengthOfRecentNotice'); if (!empty($value) || is_numeric($value)) { $assignments['recentNoticeLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentEntry'); if (!empty($value) || is_numeric($value)) { $assignments['recentEntryLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentComment'); if (!empty($value) || is_numeric($value)) { $assignments['recentCommentLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentTrackback'); if (!empty($value) || is_numeric($value)) { $assignments['recentTrackbackLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfLink'); if (!empty($value) || is_numeric($value)) { $assignments['linkLength'] = $value; } $value = $xmls->getValue('/skin/default/contentWidth'); if (!empty($value) || is_numeric($value)) { $assignments['contentWidth'] = $value; } $value = $xmls->getValue('/skin/default/showListOnCategory'); if (isset($value)) { $assignments['showListOnCategory'] = $value; } $value = $xmls->getValue('/skin/default/showListOnArchive'); if (isset($value)) { $assignments['showListOnArchive'] = $value; } $value = $xmls->getValue('/skin/default/showListOnTag'); if (isset($value)) { $assignments['showListOnTag'] = $value; } $value = $xmls->getValue('/skin/default/showListOnSearch'); if (isset($value)) { $assignments['showListOnSearch'] = $value; } $value = $xmls->getValue('/skin/default/showListOnAuthor'); if (isset($value)) { $assignments['showListOnAuthor'] = $value; } $value = $xmls->getValue('/skin/default/tree/color'); if (isset($value)) { $assignments['colorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/bgColor'); if (isset($value)) { $assignments['bgcolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/activeColor'); if (isset($value)) { $assignments['activecolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/activeBgColor'); if (isset($value)) { $assignments['activebgcolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/labelLength'); if (!empty($value) || is_numeric($value)) { $assignments['labelLengthOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/showValue'); if (isset($value)) { $assignments['showValueOnTree'] = $value ? '1' : '0'; } foreach ($assignments as $name => $value) { Setting::setSkinSetting($name, $value, $blogid); } // none/single/multiple $value = $xmls->getValue('/skin/default/commentMessage/none'); if (is_null($value)) { Setting::setBlogSetting('noneCommentMessage', NULL, true); } else { Setting::setBlogSetting('noneCommentMessage', $value, true); } $value = $xmls->getValue('/skin/default/commentMessage/single'); if (is_null($value)) { Setting::setBlogSetting('singleCommentMessage', NULL, true); } else { Setting::setBlogSetting('singleCommentMessage', $value, true); } $value = $xmls->getValue('/skin/default/trackbackMessage/none'); if (is_null($value)) { Setting::setBlogSetting('noneTrackbackMessage', NULL, true); } else { Setting::setBlogSetting('noneTrackbackMessage', $value, true); } $value = $xmls->getValue('/skin/default/trackbackMessage/single'); if (is_null($value)) { Setting::setBlogSetting('singleTrackbackMessage', NULL, true); } else { Setting::setBlogSetting('singleTrackbackMessage', $value, true); } } else { Setting::setBlogSetting('noneCommentMessage', NULL, true); Setting::setBlogSetting('singleCommentMessage', NULL, true); Setting::setBlogSetting('noneTrackbackMessage', NULL, true); Setting::setBlogSetting('singleTrackbackMessage', NULL, true); Setting::setSkinSetting('skin', $skinName, $blogid); } Setting::removeBlogSetting("sidebarOrder", true); CacheControl::flushAll(); CacheControl::flushSkin(); Path::removeFiles(ROOT . "/skin/blog/customize/" . getBlogId() . "/"); Setting::getSkinSettings($blogid, true); // refresh skin cache return true; }
function getFeedItems($xml) { if (preg_match('/^<\?xml[^<]*\s+encoding=["\']?([\w-]+)["\']?/', $xml, $matches)) // kor env $encoding = $matches[1]; if (strcasecmp($encoding, 'euc-kr') == 0) { $xml = UTF8::bring($xml, $encoding); $xml = preg_replace('/^(<\?xml[^<]*\s+encoding=)["\']?[\w-]+["\']?/', '$1"utf-8"', $xml, 1); } $xmls=new XMLStruct(); if (!$xmls->open($xml)) return false; $items = array(); if ($xmls->getAttribute('/rss','version')){ // rss element must have version attribute for ($i=1;$link=$xmls->getValue("/rss/channel/item[$i]/link");$i++){ $item=array('permalink'=>rawurldecode($link)); if (!$item['author']=$xmls->getValue("/rss/channel/item[$i]/author")) $item['author']=$xmls->getValue("/rss/channel/item[$i]/dc:creator"); $item['title']=$xmls->getValue("/rss/channel/item[$i]/title"); if (!$item['description']=$xmls->getValue("/rss/channel/item[$i]/content:encoded")) $item['description']=htmlspecialchars_decode($xmls->getValue("/rss/channel/item[$i]/description")); $item['tags']=array(); for ($j=1;$tag=$xmls->getValue("/rss/channel/item[$i]/category[$j]");$j++) if (!empty($tag)) { // array_push($item['tags'],$tag); $tags = explode('/', $tag); // allblog, blogkorea types foreach($tags as $tag) { array_push($item['tags'], trim($tag)); } } for ($j=1;$tag=$xmls->getValue("/rss/channel/item[$i]/subject[$j]");$j++) if (!empty($tag)) array_push($item['tags'],$tag); if ($youtubeTags = $xmls->getValue("/rss/channel/item[$i]/media:category")) { // for Youtube,Flickr Feed array_push($item['tags'], ''); // blank. first tag not equals category foreach (explode(' ', $youtubeTags) as $tag) { $tag = trim($tag); if(!empty($tag)) array_push($item['tags'], $tag); } } $item['enclosures']=array(); for ($j=1;$result=$xmls->getAttributes("/rss/channel/item[$i]/enclosure[$j]",array('url','type'));$j++) { if (!empty($result)) { array_push($item['enclosures'],array('url'=>$result[0],'type'=>$result[1])); } } $flickrContent=$xmls->getAttributes("/rss/channel/item[$i]/media:content[$j]",array('url','type')); // for flickr feed if(!empty($flickrContent)) { array_push($item['enclosures'],array('url'=>$flickrContent[0],'type'=>$flickrContent[1])); } if ($xmls->getValue("/rss/channel/item[$i]/pubDate")) $item['written']=Feed::parseDate($xmls->getValue("/rss/channel/item[$i]/pubDate")); elseif ($xmls->getValue("/rss/channel/item[$i]/dc:date")) $item['written']=Feed::parseDate($xmls->getValue("/rss/channel/item[$i]/dc:date")); else $item['written']=0; if (!$item['generator']=$xmls->getValue("/rss/channel/generator")) { if (strpos($item['permalink'], 'tvpot.daum.net') !== false) $item['generator'] = 'Daum Tvpot'; else $item['generator'] = 'Unknown'; } if (!$item['guid']=$xmls->getValue("/rss/channel/item[$i]/guid")) $item['guid'] = $item['permalink']; array_push($items, $item); } } elseif ($xmls->doesExist('/feed')){ // atom 0.3 for ($i=1;$link=$xmls->getValue("/feed/entry[$i]/id");$i++){ $item['enclosures']=array(); for ($j=1;$rel=$xmls->getAttribute("/feed/entry[$i]/link[$j]",'rel');$j++){ if ($rel=='alternate'){ $link=$xmls->getAttribute("/feed/entry[$i]/link[$j]",'href'); } else if($rel=='enclosure' || $rel=='image') { $result = $xmls->getAttributes("/feed/entry[$i]/link[$j]",array('href','type')); if($result) { array_push($item['enclosures'],array('url'=>$result[0],'type'=>$result[1])); } } } $item=array('permalink'=>rawurldecode($link),'enclosures'=>$item['enclosures']); $item['author']=$xmls->getValue("/feed/entry[$i]/author/name"); $item['title']=$xmls->getValue("/feed/entry[$i]/title"); if (!$item['description']=htmlspecialchars_decode($xmls->getValue("/feed/entry[$i]/content"))) $item['description']=htmlspecialchars_decode($xmls->getValue("/feed/entry[$i]/summary")); $item['tags']=array(); for ($j=1;$tag=$xmls->getValue("/feed/entry[$i]/dc:subject[$j]");$j++) { if (!empty($tag)) array_push($item['tags'],trim($tag)); } for ($j=1;$tag=$xmls->getAttribute("/feed/entry[$i]/category[$j]", 'term');$j++) { if (!empty($tag)) array_push($item['tags'],trim($tag)); } if (!$item['written']= $xmls->getValue("/feed/entry[$i]/issued")) { if (!$item['written'] = $xmls->getValue("/feed/entry[$i]/published")) { $item['written'] = $xmls->getValue("/feed/entry[$i]/updated"); } } $item['written'] = Feed::parseDate($item['written']); if (!$item['generator'] = $xmls->getValue("/feed/generator")) $item['generator'] = 'Unknown'; array_push($items, $item); } } elseif ($xmls->getAttribute('/rdf:RDF','xmlns')){ // rss 1.0, rdf for ($i=1;$link=$xmls->getValue("/rdf:RDF/item[$i]/link");$i++){ $item=array('permalink'=>rawurldecode($link)); if (!$item['author']=$xmls->getValue("/rdf:RDF/item[$i]/dc:creator")) $item['author']=$xmls->getValue("/rdf:RDF/item[$i]/author"); // for NaverBlog rss 1.0 $item['title']=$xmls->getValue("/rdf:RDF/item[$i]/title"); if (!$item['description']=$xmls->getValue("/rdf:RDF/item[$i]/content:encoded")) $item['description']=htmlspecialchars_decode($xmls->getValue("/rdf:RDF/item[$i]/description")); $item['tags']=array(); $item['enclosures']=array(); $item['written']=Feed::parseDate($xmls->getValue("/rdf:RDF/item[$i]/dc:date")); array_push($items, $item); } } else return false; return $items; }
function getConfig($domainName, $field = null) { global $database, $db; if (empty($domainName)) return false; if ($settings = $db->queryCell('SELECT settings FROM '.$database['prefix'].'Exports WHERE domain="'.$db->escape($domainName).'"')) { requireComponent('LZ.PHP.XMLStruct'); $xmls = new XMLStruct; if (!$xmls->open($settings)) return false; $resultConfig = array(); $configs = $xmls->selectNode("/config"); foreach ($configs as $config) { if(!empty($config)) { foreach ($config as $field) { if(is_array($field)) { $name = isset($field['.attributes']['name'])?$field['.attributes']['name']:''; $value= $field['.value']=='true'?true:($field['.value']=='false'?false:$field['.value']); if (!empty($name)) { $resultConfig[$name] = $value; } } } } } return $resultConfig; } return null; }
foreach($xmlURLs as $xmlURL) { if (empty($xmlURL)) continue; $_feeder->add($xmlURL); } @unlink($opmlCacheDir.'/'.$tmpFilename); } } else { // URL 로부터 가져올 경우 requireComponent('LZ.PHP.HTTPRequest'); $request = new HTTPRequest; if (!$cont = $request->getPage($_POST['importURL'])) { echo '<script type="text/javascript">alert("'._t('파일을 가져올 수 없습니다.\n정확한 주소가 맞는지 확인해 주세요.').'");</script>'; exit; } $xmls = new XMLStruct(); $xmls->open($cont, true); if (!$n = $xmls->getNodeCount("/opml/body/outline")) { echo '<script type="text/javascript">alert("'._t('바른 형식의 OPML 파일이 아닙니다.').'");</script>'; exit; } echo '<script type="text/javascript">"'._t('피드를 추가하고 있습니다').'";</script>'; flush(); $_feeder = new Feed; for ($i=1; $i <= $n; $i++) { $xmlURL = $xmls->getAttribute("/opml/body/outline[$i]", "xmlUrl"); if (empty($xmlURL)) continue; $_feeder->add($xmlURL); }
} if (!is_dir(__TEXTCUBE_CACHE_DIR__ . '/import')) { finish(_t('백업파일을 저장할 공간에 권한이 없습니다.')); } $request = new HTTPRequest($_POST['backupURL']); $backup = __TEXTCUBE_CACHE_DIR__ . "/import/{$blogid}.xml"; $request->pathToSave = $backup; if (!$request->send()) { finish(_t('백업파일이 손상되었거나 가져올 수 없습니다.')); } break; } $migrational = false; $items = 0; $item = 0; $xmls = new XMLStruct(); set_time_limit(0); setProgress(0, _t('백업파일을 확인하고 있습니다.')); $xmls->setStream('/blog/setting/banner/content'); $xmls->setStream('/blog/post/attachment/content'); $xmls->setStream('/blog/notice/attachment/content'); $xmls->setStream('/blog/keyword/attachment/content'); $xmls->setConsumer('scanner'); if (!$xmls->openFile($backup, Validator::getBool(@$_POST['correctData']))) { finish(_f('백업파일의 %1번째 줄이 올바르지 않습니다.', $xmls->error['line'])); } $xmls->close(); if ($items == 0) { finish(_t('백업파일에 복원할 데이터가 없습니다.')); } if (!$migrational) {
requireAdmin(); include ROOT. '/lib/piece/adminHeader.php'; $skinlist = array(); $dir = opendir(ROOT . '/skin/meta/'); while ($file = readdir($dir)) { if (!file_exists(ROOT . '/skin/meta/'.$file.'/index.xml')) continue; array_push($skinlist, $file); } // 현재 사용중인 스킨 $n_skinname = Settings::get('metaskin'); $n_skinpath = ROOT . '/skin/meta/'.$n_skinname; $xmls = new XMLStruct(); if (file_exists($n_skinpath.'/index.xml')) { // 스킨 없음 $xml = file_get_contents($n_skinpath.'/index.xml'); $xmls->open($xml); } $pageCount = 15; // 페이지갯수 $page = isset($_GET['page']) ? $_GET['page'] : 1; if(!isset($page) || empty($page)) $page = 1; $paging = Func::makePaging($page, $pageCount, count($skinlist)); ?> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/admin_design.css" type="text/css" />
function notifyComment() { $blogid = getBlogId(); $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); $pool->init("CommentsNotifiedQueue"); $pool->setAlias("CommentsNotifiedQueue", "CNQ"); $pool->setAlias("Comments", "CN"); $pool->join("Comments", "left", array(array("CNQ.commentid", "eq", "CN.id"))); $pool->setQualifier("CNQ.sendstatus", "eq", 0); $pool->setQualifier("CN.parent", "neq", null); $pool->setOrder("CNQ.id", "asc"); $pool->setLimit(1); $queue = $pool->getRow("CN.*,\n\t\t\t\tCNQ.id AS queueId,\n\t\t\t\tCNQ.commentid AS commentid,\n\t\t\t\tCNQ.sendstatus AS sendstatus,\n\t\t\t\tCNQ.checkdate AS checkdate,\n\t\t\t\tCNQ.written AS queueWritten"); if (empty($queue) && empty($queue['queueId'])) { return false; } $pool->init("Comments"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $queue['commentid']); $comments = $pool->getRow(); if (empty($comments['parent']) || $comments['secret'] == 1) { $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); return false; } $pool->init("Comments"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $queue['parent']); $parentComments = $pool->getRow(); if (empty($parentComments['homepage'])) { $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); return false; } $pool->init("Entries"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("id", "eq", $comments['entry']); $entry = $pool->getRow(); if (is_null($entry)) { $r1_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/guestbook/" . $parentComments['id'] . "#guestbook" . $parentComments['id']); $r2_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/guestbook/" . $comments['id'] . "#guestbook" . $comments['id']); $entry['title'] = _textf('%1 블로그의 방명록', $context->getProperty('blog.title')); $entryPermaLink = $context->getProperty('uri.default') . "/guestbook/"; $entry['id'] = 0; } else { $r1_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $parentComments['id']); $r2_comment_check_url = rawurlencode($context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']) . "#comment" . $comments['id']); $entryPermaLink = $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$entry['slogan']}" : $entry['id']); } $data = "url=" . rawurlencode($context->getProperty('uri.default')) . "&mode=fb" . "&s_home_title=" . rawurlencode($context->getProperty('blog.title')) . "&s_post_title=" . rawurlencode($entry['title']) . "&s_name=" . rawurlencode($comments['name']) . "&s_no=" . rawurlencode($comments['entry']) . "&s_url=" . rawurlencode($entryPermaLink) . "&r1_name=" . rawurlencode($parentComments['name']) . "&r1_no=" . rawurlencode($parentComments['id']) . "&r1_pno=" . rawurlencode($comments['entry']) . "&r1_rno=0" . "&r1_homepage=" . rawurlencode($parentComments['homepage']) . "&r1_regdate=" . rawurlencode($parentComments['written']) . "&r1_url=" . $r1_comment_check_url . "&r2_name=" . rawurlencode($comments['name']) . "&r2_no=" . rawurlencode($comments['id']) . "&r2_pno=" . rawurlencode($comments['entry']) . "&r2_rno=" . rawurlencode($comments['parent']) . "&r2_homepage=" . rawurlencode($comments['homepage']) . "&r2_regdate=" . rawurlencode($comments['written']) . "&r2_url=" . $r2_comment_check_url . "&r1_body=" . rawurlencode($parentComments['comment']) . "&r2_body=" . rawurlencode($comments['comment']); if (strpos($parentComments['homepage'], "http://") === false) { $homepage = 'http://' . $parentComments['homepage']; } else { $homepage = $parentComments['homepage']; } $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { $xmls = new XMLStruct(); if ($xmls->open($request->responseText)) { $result = $xmls->selectNode('/response/error/'); if ($result['.value'] != '1' && $result['.value'] != '0') { $homepage = rtrim($homepage, '/') . '/index.php'; $request = new HTTPRequest('POST', $homepage); $request->contentType = 'application/x-www-form-urlencoded; charset=utf-8'; $request->content = $data; if ($request->send()) { } } } } $pool->init("CommentsNotifiedQueue"); $pool->setQualifier("id", "eq", $queue['queueId']); $pool->delete(); }
$activePlugins = $pool->getColumn('name'); $gCacheStorage->setContent('activePlugins', $activePlugins); } $pageCache = pageCache::getInstance(); $pageCache->reset('PluginSettings'); $pageCache->load(); $pluginSettings = $pageCache->contents; $storageList = array('activePlugins', 'eventMappings', 'tagMappings', 'sidebarMappings', 'coverpageMappings', 'centerMappings', 'adminMenuMappings', 'adminHandlerMappings', 'configMappings', 'editorMappings', 'formatterMappings', 'editorCount', 'formatterCount'); $p = array(); if (!empty($pluginSettings)) { $p = unserialize($pluginSettings); foreach ($storageList as $s) { ${$s} = $p[$s]; } } else { $xmls = new XMLStruct(); $editorCount = 0; $formatterCount = 0; if (!empty($activePlugins)) { if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/code/plugins-" . getBlogId() . ".php")) { require_once __TEXTCUBE_CACHE_DIR__ . "/code/plugins-" . getBlogId() . ".php"; // TODO : set the editor / formatter count while using plugin php cache. } else { foreach ($activePlugins as $plugin) { $version = ''; $disablePlugin = false; $manifest = @file_get_contents(ROOT . "/plugins/{$plugin}/index.xml"); if ($manifest && $xmls->open($manifest)) { $requiredTattertoolsVersion = $xmls->getValue('/plugin/requirements/tattertools'); $requiredTextcubeVersion = $xmls->getValue('/plugin/requirements/textcube'); if (is_null($requiredTextcubeVersion) && !is_null($requiredTattertoolsVersion)) {
function importOPMLFromFile($blogid, $xml) { global $database, $service; $xmls = new XMLStruct(); if (!$xmls->open($xml, $service['encoding'])) { return array(1, null); } if ($xmls->getAttribute('/opml/body/outline', 'title')) { $result = array(0, 0); for ($i = 0; $xmls->getAttribute("/opml/body/outline[{$i}]", 'title'); $i++) { if ($xmls->getAttribute("/opml/body/outline[{$i}]", 'xmlUrl')) { $result[addFeed($blogid, $group = 0, $xmls->getAttribute("/opml/body/outline[{$i}]", 'xmlUrl'), false, $xmls->getAttribute("/opml/body/outline[{$i}]", 'htmlUrl'), $xmls->getAttribute("/opml/body/outline[{$i}]", 'title'), $xmls->getAttribute("/opml/body/outline[{$i}]", 'description'))] += 1; } for ($j = 0; $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'title'); $j++) { if ($xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'xmlUrl')) { $result[addFeed($blogid, $group = 0, $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'xmlUrl'), false, $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'htmlUrl'), $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'title'), $xmls->getAttribute("/opml/body/outline[{$i}]/outline[{$j}]", 'description'))] += 1; } } } } else { return array(2, null); } return array(0, array('total' => array_sum($result), 'success' => $result[0])); }
function getDefaultCenterPanel($mapping) { $ctx = Model_Context::getInstance(); $blogid = $ctx->getProperty('blog.id'); ?> <div id="<?php echo $mapping['plugin']; ?> " class="section"> <h3 class="caption<?php echo isset($_REQUEST['edit']) ? ' visible' : ' invisible'; ?> "> <span><?php echo _t('알림판'); if (isset($_REQUEST['edit'])) { ?> <a id="<?php echo $mapping['plugin']; ?> widgetup" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=-1&edit"><?php echo _t('위로'); ?> </a> <a id="<?php echo $mapping['plugin']; ?> widgetdown" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=1&edit"><?php echo _t('아래로'); ?> </a> <?php } ?> </span> </h3> <?php if (isset($_REQUEST['edit'])) { ?> </div> <?php return true; } else { // Get default data $stats = Statistics::getStatistics($blogid); $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0); $comments = getRecentComments($blogid, 10); $guestbooks = getRecentGuestbook($blogid, 10); list($commentNotifies, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, 0, null, null, null, 1, 10); $trackbacks = getRecentTrackbacks($blogid, 10); $recents = array(); // title, date, link, category foreach ($comments as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $comment['entry'] . "#comment" . $comment['id'], 'category' => 'comment')); } foreach ($commentNotifies as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/owner/communication/notify", 'category' => 'commentNotify')); } foreach ($guestbooks as $guestbook) { array_push($recents, array('title' => $guestbook['comment'], 'date' => $guestbook['written'], 'link' => $ctx->getProperty('uri.blog') . "/guestbook/" . $guestbook['id'] . "#guestbook" . $guestbook['id'], 'category' => 'guestbook')); } foreach ($trackbacks as $trackback) { array_push($recents, array('title' => $trackback['subject'], 'date' => $trackback['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $trackback['entry'] . "#trackback" . $trackback['id'], 'category' => 'trackback')); } $sort_array = array(); foreach ($recents as $uniqid => $row) { // Sorting. foreach ($row as $key => $value) { if (!array_key_exists($key, $sort_array)) { $sort_array[$key] = array(); } $sort_array[$key][$uniqid] = $value; } } if (!empty($sort_array)) { array_multisort($sort_array['date'], SORT_DESC, $recents); } $recents = array_slice($recents, 0, 14); ?> <div id="shortcut-collection"> <h4 class="caption"><span><?php echo _t('바로가기'); ?> </span></h4> <ul> <li class="newPost"><a class="newPost" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/post"><span><?php echo _t('새 글 쓰기'); ?> </span></a></li> <?php if ($latestEntryId !== 0) { $latestEntry = getEntry($blogid, $latestEntryId); if (!is_null($latestEntry)) { ?> <li class="modifyPost"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/edit/<?php echo $latestEntry['id']; ?> "><?php echo _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))); ?> </a></li> <?php } } if ($ctx->getProperty('service.reader') == true) { ?> <li class="rssReader"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/network/reader"><?php echo _t('RSS로 등록한 이웃 글 보기'); ?> </a></li> <?php } if (Acl::check("group.administrators")) { ?> <li class="deleteCache"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard/cleanup" onclick="cleanupCache();return false;"><?php echo _t('캐시 지우기'); ?> </a></li> <?php if (Acl::check("group.creators")) { ?> <li class="optimizeStorage"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/data" onclick="optimizeData();return false;"><?php echo _t('저장소 최적화'); ?> </a></li> <?php } } ?> <li class="clear"></li> </ul> </div> <div id="total-information"> <h4 class="caption"><span><?php echo _t('요약'); ?> </span></h4> <table class="posts-line"> <caption><?php echo _t('글'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('글'); ?> </td> <td class="sum"><?php echo number_format(getEntriesTotalCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('댓글'); ?> </td> <td class="sum"><?php echo number_format(getCommentCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('방명록'); ?> </td> <td class="sum"><?php echo number_format(getGuestbookCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('걸린 글'); ?> </td> <td class="sum"><?php echo number_format(getTrackbackCount($blogid)); ?> </td> </tr> </tbody> </table> <table class="visitors-line"> <caption><?php echo _t('방문자'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('오늘'); ?> </td> <td class="sum"><?php echo number_format($stats['today']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('어제'); ?> </td> <td class="sum"><?php echo number_format($stats['yesterday']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('7일 평균'); ?> </td> <td class="sum"><?php $weekly = Statistics::getWeeklyStatistics(); $weeklycount = 0; foreach ($weekly as $day) { $weeklycount += $day['visits']; } echo number_format($weeklycount / 7); unset($weekly); unset($weeklycount); ?> </td> </tr> <tr> <td class="type"><?php echo _t('총방문자'); ?> </td> <td class="sum"><?php echo number_format($stats['total']); ?> </td> </tr> </tbody> </table> </div> <div id="myBlogInfo"> <h4 class="caption"><span><a href="<?php echo $ctx->getProperty('uri.blog') . '/owner/communication/comment'; ?> "><?php echo _t('알림판'); ?> </a></span></h4> <table class="recent"> <caption>asdasd</caption> <thead> <tr> <th scope="col" class="date"><?php echo _t('날짜'); ?> </th> <th scope="col" class="category"><?php echo _t('종류'); ?> </th> <th scope="col"><?php echo _t('내용'); ?> </th> </tr> </thead> <tbody> <?php foreach ($recents as $item) { ?> <tr class="<?php echo $item['category']; ?> "> <td class="date"><?php echo Timestamp::format('%m/%d', $item['date']); ?> </td> <td class="category"> <?php switch ($item['category']) { case 'trackback': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/trackback?status=received">' . _t('걸린글') . '</a>'; break; case 'comment': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=comment">' . _t('댓글') . '</a>'; break; case 'commentNotify': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/notify">' . _t('알리미') . '</a>'; break; case 'guestbook': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=guestbook">' . _t('방명록') . '</a>'; break; } ?> </td> <td class="title"><a href="<?php echo $item['link']; ?> "><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20)); ?> </a></td> </tr> <?php } ?> </tbody> </table> </div> <?php $noticeURL = TEXTCUBE_NOTICE_URL; $noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss"; $noticeEntries = array(); if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) { $noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'))); } else { list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS); if ($result == 0) { $xmls = new XMLStruct(); $xmls->setXPathBaseIndex(1); $noticeEntries = array(); if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) { if ($xmls->getAttribute('/rss', 'version')) { for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) { $item = array('permalink' => rawurldecode($link)); $item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title"); if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate")); } else { if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date")); } else { $item['written'] = 0; } } array_push($noticeEntries, $item); } } } Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries)); } } ?> <div id="textcube-notice"> <h4 class="caption"><span><a href="<?php echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko"); ?> "><?php echo _t('공지사항'); ?> </a></span></h4> <?php if (count($noticeEntries) > 0) { array_splice($noticeEntries, 3, count($noticeEntries) - 3); ?> <table> <tbody> <?php foreach ($noticeEntries as $item) { ?> <tr> <td class="date"><?php echo Timestamp::format2($item['written']); ?> </td> <td class="title"><a href="<?php echo $item['permalink']; ?> " onclick="return openLinkInNewWindow(this);" ><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35)); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <div id="fail-notice"> <?php echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.'); ?> </div> <?php } ?> </div> <?php } ?> </div> <?php }
function selectSkin($blogid, $skinName) { $context = Model_Context::getInstance(); importlib('blogskin'); $blogid = getBlogId(); if (empty($skinName)) { return _t('실패했습니다.'); } if (strncmp($skinName, 'customize/', 10) == 0) { if (strcmp($skinName, "customize/{$blogid}") != 0) { return _t('실패 했습니다'); } } else { $skinName = Path::getBaseName($skinName); if ($skinName === '.' || $skinName === '..') { return _t('실패 했습니다'); } } if (file_exists(getSkinPath($skinName) . "/index.xml")) { $xml = file_get_contents(getSkinPath($skinName) . "/index.xml"); $xmls = new XMLStruct(); if (!$xmls->open($xml, $context->getProperty('service.encoding'))) { return _t('실패했습니다.'); } $assignments = array('skin' => $skinName); $value = $xmls->getValue('/skin/default/recentEntries'); if (!empty($value) || is_numeric($value)) { $assignments['entriesOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/recentComments'); if (!empty($value) || is_numeric($value)) { $assignments['commentsOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/itemsOnGuestbook'); if (!empty($value) || is_numeric($value)) { $assignments['commentsOnGuestbook'] = $value; } $value = $xmls->getValue('/skin/default/tagsInCloud'); if (!empty($value) || is_numeric($value)) { $assignments['tagsOnTagbox'] = $value; } $value = $xmls->getValue('/skin/default/sortInCloud'); if (!empty($value) || is_numeric($value)) { $assignments['tagboxAlign'] = $value; } $value = $xmls->getValue('/skin/default/recentTrackbacks'); if (!empty($value) || is_numeric($value)) { $assignments['trackbacksOnRecent'] = $value; } $value = $xmls->getValue('/skin/default/expandComment'); if (isset($value)) { $assignments['expandComment'] = $value ? '1' : '0'; } $value = $xmls->getValue('/skin/default/expandTrackback'); if (isset($value)) { $assignments['expandTrackback'] = $value ? '1' : '0'; } $value = $xmls->getValue('/skin/default/lengthOfRecentNotice'); if (!empty($value) || is_numeric($value)) { $assignments['recentNoticeLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentPage'); if (!empty($value) || is_numeric($value)) { $assignments['recentPageLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentEntry'); if (!empty($value) || is_numeric($value)) { $assignments['recentEntryLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentComment'); if (!empty($value) || is_numeric($value)) { $assignments['recentCommentLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfRecentTrackback'); if (!empty($value) || is_numeric($value)) { $assignments['recentTrackbackLength'] = $value; } $value = $xmls->getValue('/skin/default/lengthOfLink'); if (!empty($value) || is_numeric($value)) { $assignments['linkLength'] = $value; } $value = $xmls->getValue('/skin/default/contentWidth'); if (!empty($value) || is_numeric($value)) { $assignments['contentWidth'] = $value; } $value = $xmls->getValue('/skin/default/showListOnCategory'); if (isset($value)) { $assignments['showListOnCategory'] = $value; } $value = $xmls->getValue('/skin/default/showListOnArchive'); if (isset($value)) { $assignments['showListOnArchive'] = $value; } $value = $xmls->getValue('/skin/default/showListOnTag'); if (isset($value)) { $assignments['showListOnTag'] = $value; } $value = $xmls->getValue('/skin/default/showListOnSearch'); if (isset($value)) { $assignments['showListOnSearch'] = $value; } $value = $xmls->getValue('/skin/default/showListOnAuthor'); if (isset($value)) { $assignments['showListOnAuthor'] = $value; } $value = $xmls->getValue('/skin/default/tree/color'); if (isset($value)) { $assignments['colorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/bgColor'); if (isset($value)) { $assignments['bgcolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/activeColor'); if (isset($value)) { $assignments['activecolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/activeBgColor'); if (isset($value)) { $assignments['activebgcolorOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/labelLength'); if (!empty($value) || is_numeric($value)) { $assignments['labelLengthOnTree'] = $value; } $value = $xmls->getValue('/skin/default/tree/showValue'); if (isset($value)) { $assignments['showValueOnTree'] = $value ? '1' : '0'; } foreach ($assignments as $name => $value) { Setting::setSkinSetting($name, $value, $blogid); } if ($xmls->doesExist('/skin/support')) { foreach ($xmls->selectNodes('/skin/support') as $support) { if (!empty($support['.attributes']['mobile']) && $support['.attributes']['mobile'] == "yes") { /// Main skin supports mobile, too. Setting::setBlogSetting('useiPhoneUI', 0, true); } else { Setting::setBlogSetting('useiPhoneUI', 1, true); } } } else { Setting::setBlogSetting('useiPhoneUI', 1, true); } // none/single/multiple $value = $xmls->getValue('/skin/default/commentMessage/none'); if (is_null($value)) { Setting::setBlogSetting('noneCommentMessage', NULL, true); } else { Setting::setBlogSetting('noneCommentMessage', $value, true); } $value = $xmls->getValue('/skin/default/commentMessage/single'); if (is_null($value)) { Setting::setBlogSetting('singleCommentMessage', NULL, true); } else { Setting::setBlogSetting('singleCommentMessage', $value, true); } $value = $xmls->getValue('/skin/default/trackbackMessage/none'); if (is_null($value)) { Setting::setBlogSetting('noneTrackbackMessage', NULL, true); } else { Setting::setBlogSetting('noneTrackbackMessage', $value, true); } $value = $xmls->getValue('/skin/default/trackbackMessage/single'); if (is_null($value)) { Setting::setBlogSetting('singleTrackbackMessage', NULL, true); } else { Setting::setBlogSetting('singleTrackbackMessage', $value, true); } } else { Setting::setBlogSetting('noneCommentMessage', NULL, true); Setting::setBlogSetting('singleCommentMessage', NULL, true); Setting::setBlogSetting('noneTrackbackMessage', NULL, true); Setting::setBlogSetting('singleTrackbackMessage', NULL, true); Setting::setSkinSetting('skin', $skinName, $blogid); } Setting::removeBlogSetting("sidebarOrder", true); CacheControl::flushAll(); CacheControl::flushSkin(); Path::removeFiles(getSkinPath('customize/' . getBlogId()) . "/"); Setting::getSkinSettings($blogid, true); // refresh skin cache return true; }
} else { $("#export_config_wrap").height($(document.body).height() - buttonHeight); var h = $("#export_information_wrap").height(); if(h<$("#export_config_wrap").height()) { h = $("#export_config_wrap").height(); } var height = h + buttonHeight; } parent.resizeExportConfig('<?php echo $domainName;?>',height); }); </script> </head> <body class="export_body"> <?php $exportConfig = new XMLStruct; $exportSettings = array(); $exportSettingsStr = $db->queryCell("SELECT settings FROM {$database['prefix']}Exports WHERE domain='{$domainName}'"); if ($exportConfig->open($exportSettingsStr)) { $exportConfigs = $exportConfig->selectNode('/config'); if(isset($exportConfigs['field'])) { foreach ($exportConfigs['field'] as $field) { $name = $field['.attributes']['name']; $type = $field['.attributes']['type']; $value = $field['.value']; $exportSettings[$name] = array(); $exportSettings[$name]['value'] = $value; $exportSettings[$name]['type'] = $type; } }
function checkResponseXML($responseText) { global $service; $xmls = new XMLStruct(); if (!$xmls->open(trim($responseText), $service['encoding'])) { return false; } if (($error = $xmls->getValue('/response/error')) !== null) { return intval($error); } else { return false; } }
function detectMovieIMGsrc($str) { if (!isset($str) || empty($str)) return false; $response_text = $this->getRemotePostPage('http://openapi.itcanus.net/detectMovieImages/', 'source=' . rawurlencode($str)); requireComponent('LZ.PHP.XMLStruct'); $result = array(); $xmls = new XMLStruct(); if ($xmls->open($response_text)) { $captures = $xmls->selectNode("/itcanus/captures"); if(isset($captures['capture'])) { foreach($captures['capture'] as $capture) { foreach( $capture['image'] as $source ) { $source = $source['.attributes']; array_push($result, array('id'=>rawurldecode($source['id']), 'via' => rawurldecode($source['via']), 'url' => rawurldecode($source['url']))); } } } } return $result; }
echo _t('스킨 미리보기'); ?> " /> <?php } } ?> </div> <div class="information"> <?php if (file_exists(ROOT . "/skin/admin/{$currentAdminSkin}/index.xml")) { ?> <div id="currentInfo"> <?php $xml = file_get_contents(ROOT . "/skin/admin/{$currentAdminSkin}/index.xml"); $xmls = new XMLStruct(); $xmls->open($xml, $service['encoding']); writeValue('<span class="skin-name">' . $xmls->getValue('/adminSkin/information/name') . '</span> <span class="version">ver.' . $xmls->getValue('/adminSkin/information/version') . '</span>', _t('제목'), "title"); writeValue($xmls->getValue('/adminSkin/information/license'), _t('저작권'), "license"); writeValue($xmls->getValue('/adminSkin/author/name'), _t('만든이'), "maker"); writeValue($xmls->getValue('/adminSkin/author/homepage'), _t('홈페이지'), "homepage"); writeValue($xmls->getValue('/adminSkin/author/email'), _t('e-mail'), "email"); writeValue($xmls->getValue('/adminSkin/information/description'), _t('설명'), "explain"); ?> </div> <?php } else { ?> <div id="currentInfo"> <div id="customizedTable"> <?php
<?php define('ROOT', '../../..'); include ROOT . '/lib/includeForAdmin.php'; requireAdmin(); include ROOT. '/lib/piece/adminHeader.php'; $plugins = array(); $xmls = new XMLStruct; $pluginXmls = new XMLStruct; $dir = dir(ROOT . '/plugins/'); while (($file = $dir->read()) !== false) { if (!preg_match('/^[A-Za-z0-9 _-]+$/', $file)) continue; if (!is_dir(ROOT . '/plugins/' . $file)) continue; if (!file_exists(ROOT . '/plugins/'.$file.'/index.xml')) continue; if (!$xmls->openFile(ROOT . '/plugins/'.$file.'/index.xml')) continue; $plugin = array(); $plugin['name'] = $file; $plugin['title'] = $xmls->getValue('/plugin/information/name[lang()]'); $plugin['description'] = $xmls->getValue('/plugin/information/description[lang()]'); $pluginAuthor = $xmls->selectNode('/plugin/information/author[lang()]'); $plugin['author'] = array('name'=>$pluginAuthor['.value'], 'link'=>$pluginAuthor['.attributes']['link'], 'email'=>$pluginAuthor['.attributes']['email']); $pluginTings = $xmls->selectNode('/plugin/ting[lang()]'); $plugin['ting'] = array(); if(isset($pluginTings['pop'])) { foreach ($pluginTings['pop'] as $pop) { $event = $pop['.attributes']['event'];
$n_skinpath = ROOT . '/skin/meta/'.$n_skinname; if(!file_exists($n_skinpath.'/index.xml')) { ?> <div class="accept_wrap wrap"> <?php echo drawGrayBoxBegin();?> <div class="accept_messages"> <?php echo _t('현재 사용중인 스킨이 없습니다.');?> </div> <?php echo drawGrayBoxEnd();?> </div> <?php } else { $xml = file_get_contents($n_skinpath.'/index.xml'); $xmls = new XMLStruct(); $xmls->open($xml); ?> <link rel="stylesheet" href="<?php echo $service['path'];?>/style/admin_design.css" type="text/css" /> <script type="text/javascript"> function saveSkinSettings() { $.ajax({ type: "POST", url: _path +'/service/design/setting.php', data: "postList="+$('#postList').val()+ "&postListDivision="+$('#postListDivision').val()+ "&postListDirection="+$('#postListDirection').val()+ "&postTitleLength="+$('#postTitleLength').val()+ "&postDescLength="+$('#postDescLength').val()+ "&postNewLife="+$('#postNewLife').val()+ "&feedList="+$('#feedList').val()+
<dl class="normal comments"> <dt></dt> <dd class="text"> <?php echo _t('전체에서 사용되는 언어구성을 설정합니다.');?> </dd> </dl> <dl class="normal"> <dt></dt> <dd> <?php ob_start(); ?> <select name="welcomePack" id="welcomePack"> <?php $xmls=new XMLStruct(); $dir = opendir(ROOT . '/language/welcome'); while ($file = readdir($dir)) { if (func::getExt($file)=='xml') { $filename = substr($file, 0, strpos($file, '.xml')); $xmls->openFile(ROOT . '/language/welcome/'.$file); $name = $xmls->getValue('/welcome/information/name'); $author = $xmls->getValue('/welcome/information/author/name'); ?> <option value="<?php echo $filename;?>" <?php if ($filename == $config->welcomePack){?>selected="selected"<?php } ?>><?php echo $name;?> (<?php echo $author;?>)</option> <?php } } ?> </select> <?php
<?php } ?> /* ToDo : CSS 속성제어용 자바스크립트 에디터 window.addEventListener("load", execLoadFunction, false); function execLoadFunction() { var CSSeditor = new SkinEditor(); CSSeditor.initialize('style'); }*/ //]]> </script> <?php if (file_exists(getSkinPath($skinSetting['skin']) . "/index.xml")) { $xml = file_get_contents(getSkinPath($skinSetting['skin']) . "/index.xml"); $xmls = new XMLStruct(); $xmls->open($xml, $service['encoding']); $skinName = $xmls->getValue('/skin/information/name') . ($skinSetting['skin'] == "customize/{$blogid}" ? _t('(수정한 스킨)') : NULL); } else { $skinName = $skinSetting['skin']; } ?> <div id="part-skin-edit" class="part"> <h2 class="caption"><span class="main-text"><?php echo _f('스킨을 편집합니다 : "%1"', $skinName); ?> </span></h2> <div class="data-inbox"> <div class="main-explain-box"> <p class="explain"><?php
function createPluginTable($pluginName) { requireComponent('LZ.PHP.XMLStruct'); $xmls = new XMLStruct; if (!$xmls->openFile(ROOT . '/plugins/'. $pluginName .'/index.xml')) return ''; if ($xmls->doesExist('/plugin/storage')) { foreach ($xmls->selectNodes('/plugin/storage/table') as $table) { $storageMappings = array(); $storageKeymappings = array(); if(empty($table['name'][0]['.value'])) continue; $tableName = htmlspecialchars($table['name'][0]['.value']); if (!empty($table['fields'][0]['field'])) { foreach($table['fields'][0]['field'] as $field) { if (!isset($field['name'])) continue; // Error? maybe loading fail, so skipping is needed. $fieldName = $field['name'][0]['.value']; if (!isset($field['attribute'])) continue; // Error? maybe loading fail, so skipping is needed. $fieldAttribute = $field['attribute'][0]['.value']; $fieldLength = isset($field['length']) ? $field['length'][0]['.value'] : -1; $fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1; $fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null; $fieldAutoIncrement = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] : 0; array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault, 'autoincrement' => $fieldAutoIncrement)); } } if (!empty($table['key'][0]['.value'])) { foreach($table['key'] as $key) { array_push($storageKeymappings, $key['.value']); } } plugin::treatPluginTable($pluginName, $tableName,$storageMappings,$storageKeymappings, $version); unset($tableName); unset($storageMappings); unset($storageKeymappings); } } }