function handleConfig($plugin) { global $service, $typeSchema, $pluginURL, $pluginPath, $pluginName, $configMappings, $configVal, $adminSkinSetting; $context = Model_Context::getInstance(); $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; $context->setProperty('plugin.uri', $context->getProperty('service.path') . "/plugins/{$plugin}"); $context->setProperty('plugin.path', ROOT . "/plugins/{$plugin}"); $context->setProperty('plugin.name', $plugin); $pluginURL = $context->getProperty('plugin.uri'); // Legacy plugin support. $pluginPath = $context->getProperty('plugin.path'); $pluginName = $context->getProperty('plugin.name'); include_once ROOT . "/plugins/{$plugin}/index.php"; if (function_exists($handler)) { if (!empty($configMappings[$plugin]['config'])) { $configVal = getCurrentSetting($plugin); $context->setProperty('plugin.config', Setting::fetchConfigVal($configVal)); } else { $configVal = ''; $context->setProperty('plugin.config', array()); } $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); }
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(); }
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']}"); }
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; }
$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']; $type = $pop['.attributes']['type']; $text = $pop['.value']; array_push($plugin['ting'], array('event'=>$event, 'type'=>$type, 'text'=>trim($text))); } } if ($pluginConf = $xmls->selectNode('/plugin/config[lang()]')) { $plugin['config'] = 'y';
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; } } } ?> <div id="export_wrap">
if (!empty($coverpage['.attributes']['handler'])) { // parameter parsing $parameters = array(); if (isset($coverpage['params']) && isset($coverpage['params'][0]) && isset($coverpage['params'][0]['param'])) { foreach ($coverpage['params'][0]['param'] as $param) { $parameter = array('name' => $param['name'][0]['.value'], 'type' => $param['type'][0]['.value'], 'title' => XMLStruct::getValueByLocale($param['title'])); array_push($parameters, $parameter); } } array_push($coverpageMappings, array('plugin' => $plugin, 'title' => $coverpage['.attributes']['title'], 'display' => $title, 'handler' => $coverpage['.attributes']['handler'], 'parameters' => $parameters)); } } unset($coverpage); } if ($xmls->doesExist('/plugin/binding/config[lang()]')) { $config = $xmls->selectNode('/plugin/binding/config[lang()]'); if (!empty($config['.attributes']['dataValHandler'])) { $configMappings[$plugin] = array('config' => 'ok', 'dataValHandler' => $config['.attributes']['dataValHandler']); } else { $configMappings[$plugin] = array('config' => 'ok'); } } if (doesHaveOwnership() && $xmls->doesExist('/plugin/binding/adminMenu')) { $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); if ($xmls->doesExist('/plugin/binding/adminMenu/viewMethods')) { foreach ($xmls->selectNodes('/plugin/binding/adminMenu/viewMethods/method') as $adminViewMenu) { $menutitle = htmlspecialchars(XMLStruct::getValueByLocale($adminViewMenu['title'])); if (empty($menutitle)) { continue; } if (isset($adminViewMenu['topMenu'][0]['.value'])) {
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; } } } ?> <div id="plugin_wrap"> <div id="plugin_information_wrap">
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; }
$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 { $export['config'] = 'n'; } if(!isset($export['window']['height']) || $export['window']['height']=='auto') { $export['window']['height'] = 0; } $exports[$file] = $export; unset($export); }