Example #1
0
function _getRecentEntriesView($entries, $template)
{
    $context = Model_Context::getInstance();
    ob_start();
    foreach ($entries as $entry) {
        $view = $template;
        Utils_Misc::dress('rctps_rep_link', $context->getProperty('uri.blog') . "/" . $entry['id'], $view);
        Utils_Misc::dress('rctps_rep_edit_link', $context->getProperty('uri.blog') . "/owner/entry/edit/" . $entry['id'], $view);
        Utils_Misc::dress('rctps_rep_title', htmlspecialchars(Utils_Unicode::lessenAsEm($entry['title'], 30)), $view);
        Utils_Misc::dress('rctps_rep_rp_cnt', "<span id=\"commentCountOnRecentEntries{$entry['id']}\">" . ($entry['comments'] > 0 ? "({$entry['comments']})" : '') . '</span>', $view);
        print $view;
    }
    $view = ob_get_contents();
    ob_end_clean();
    return $view;
}
Example #2
0
function RecentRP_getRecentCommentsView($comments, $template)
{
    global $contentContainer;
    $context = Model_Context::getInstance();
    ob_start();
    foreach ($comments as $comment) {
        $view = "{$template}";
        Utils_Misc::dress('rctrp_rep_link', $context->getProperty('uri.blog') . "/{$comment['entry']}#comment{$comment['id']}", $view);
        $contentContainer["recent_comment_{$comment['id']}"] = htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30));
        Utils_Misc::dress('rctrp_rep_desc', setTempTag("recent_comment_{$comment['id']}"), $view);
        Utils_Misc::dress('rctrp_rep_desc', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['comment']), 30)), $view);
        Utils_Misc::dress('rctrp_rep_time', fireEvent('ViewRecentCommentDate', Timestamp::format3($comment['written'])), $view);
        Utils_Misc::dress('rctrp_rep_name', htmlspecialchars(Utils_Unicode::lessenAsEm(strip_tags($comment['name']), 10)) . $comment['secret'] . $comment['replier'], $view);
        print $view;
    }
    $view = ob_get_contents();
    ob_end_clean();
    return $view;
}
Example #3
0
function getEntryContentView($blogid, $id, $content, $formatter, $keywords = array(), $type = 'Post', $useAbsolutePath = true, $bRssMode = false)
{
    $context = Model_Context::getInstance();
    importlib('model.blog.attachment');
    importlib('model.blog.keyword');
    importlib('blogskin');
    $context = Model_Context::getInstance();
    $cacheKey = 'entry-' . $id . '-' . $type . ($bRssMode ? 'format' : 'summarize') . ($useAbsolutePath ? 'absoultePath' : 'relativePath') . $context->getProperty('blog.displaymode', 'desktop');
    $cache = pageCache::getInstance();
    $cache->reset($cacheKey);
    if (!defined('__TEXTCUBE_NO_ENTRY_CACHE__') && $cache->load()) {
        // If cached content exists.
        $view = $cache->contents;
    } else {
        // No cache is found.
        $content = fireEvent('Format' . $type . 'Content', $content, $id);
        $func = $bRssMode ? 'summarizeContent' : 'formatContent';
        $view = $func($blogid, $id, $content, $formatter, $keywords, $useAbsolutePath);
        if ($context->getProperty('blog.displaymode', 'desktop') == 'mobile') {
            $view = stripHTML($view, array('a', 'abbr', 'acronym', 'address', 'b', 'blockquote', 'br', 'caption', 'cite', 'code', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'iframe', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 'q', 's', 'samp', 'span', 'strike', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u', 'ul', 'var'));
        }
        if (!$useAbsolutePath) {
            $view = avoidFlashBorder($view);
        }
        if (!empty($keywords) && is_array($keywords)) {
            $view = bindKeywords($keywords, $view);
        }
        // image resampling
        if (Setting::getBlogSettingGlobal('resamplingDefault') == true) {
            preg_match_all("@<img.+src=['\"](.+)['\"](.*)/?>@Usi", $view, $images, PREG_SET_ORDER);
            $view = preg_replace("@<img.+src=['\"].+['\"].*/?>@Usi", '[#####_#####_#####_image_#####_#####_#####]', $view);
            $contentWidth = Utils_Misc::getContentWidth();
            if (count($images) > 0) {
                for ($i = 0; $i < count($images); $i++) {
                    if (strtolower(Utils_Misc::getFileExtension($images[$i][1])) == 'gif') {
                        $view = preg_replace('@\\[#####_#####_#####_image_#####_#####_#####\\]@', $images[$i][0], $view, 1);
                        continue;
                    }
                    $attributes = preg_match('/(style="cursor: pointer;" onclick="open_img\\((.[^"]+)\\); return false;")/si', $images[$i][2], $matches) ? ' ' . $matches[1] : '';
                    $attributes .= preg_match('/(alt="([^"]*)")/si', $images[$i][2], $matches) ? ' ' . $matches[1] : ' alt="resize"';
                    $attributes .= preg_match('/(title="([^"]*)")/si', $images[$i][2], $matches) ? $title = ' ' . $matches[1] : '';
                    $tempFileName = array_pop(explode('/', $images[$i][1]));
                    if (preg_match('/(.+)\\.w(\\d{1,})\\-h(\\d{1,})\\.(.+)/', $tempFileName, $matches)) {
                        $tempFileName = $matches[1] . '.' . $matches[4];
                    }
                    $newImage = $images[$i][0];
                    if (file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$tempFileName}")) {
                        $tempAttributes = Utils_Misc::getAttributesFromString($images[$i][2]);
                        $tempOriginInfo = getimagesize(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$tempFileName}");
                        if (isset($tempAttributes['width']) && $tempOriginInfo[0] > $tempAttributes['width']) {
                            $image = Utils_Image::getInstance();
                            list($tempImageURL, $tempImageWidth, $tempImageHeight, $tempImageSrc) = $image->getImageResizer($tempFileName, array('width' => $tempAttributes['width']));
                            $newImage = "<img src=\"{$tempImageURL}\" width=\"{$tempImageWidth}\" height=\"{$tempImageHeight}\"{$attributes}/>";
                        }
                    }
                    $view = preg_replace('@\\[#####_#####_#####_image_#####_#####_#####\\]@', $newImage, $view, 1);
                }
            }
        }
        $cache->contents = $view;
        $cache->update();
    }
    $cache->reset();
    $view = fireEvent('View' . $type . 'Content', $view, $id);
    return $view;
}
Example #4
0
function getRemoteFeed($url)
{
    global $service, $serviceURL;
    $xml = fireEvent('GetRemoteFeed', null, $url);
    if (empty($xml)) {
        $request = new HTTPRequest($url);
        $request->referer = $serviceURL;
        $request->timeout = 3;
        if (!$request->send()) {
            return array(2, null, null);
        }
        $xml = $request->responseText;
    }
    $feed = array('xmlurl' => isset($request) ? $request->url : $url);
    $xmls = new XMLStruct();
    if (!$xmls->open($xml, $service['encoding'])) {
        if (preg_match_all('/<link .*?rel\\s*=\\s*[\'"]?alternate.*?>/i', $xml, $matches)) {
            foreach ($matches[0] as $link) {
                $attributes = Utils_Misc::getAttributesFromString($link);
                if (isset($attributes['href'])) {
                    $urlInfo = parse_url($url);
                    $rssInfo = parse_url($attributes['href']);
                    $rssURL = false;
                    if (isset($rssInfo['scheme']) && $rssInfo['scheme'] == 'http') {
                        $rssURL = $attributes['href'];
                    } else {
                        if (isset($rssInfo['path'])) {
                            if ($rssInfo['path'][0] == '/') {
                                $rssURL = "{$urlInfo['scheme']}://{$urlInfo['host']}{$rssInfo['path']}";
                            } else {
                                $rssURL = "{$urlInfo['scheme']}://{$urlInfo['host']}" . (isset($urlInfo['path']) ? rtrim($urlInfo['path'], '/') : '') . '/' . $rssInfo['path'];
                            }
                        }
                    }
                    if ($rssURL && $url != $rssURL) {
                        return getRemoteFeed($rssURL);
                    }
                }
            }
        }
        return array(3, null, null);
    }
    if ($xmls->getAttribute('/rss', 'version')) {
        $feed['blogURL'] = $xmls->getValue('/rss/channel/link');
        $feed['title'] = $xmls->getValue('/rss/channel/title');
        $feed['description'] = $xmls->getValue('/rss/channel/description');
        if (Validator::language($xmls->getValue('/rss/channel/language'))) {
            $feed['language'] = $xmls->getValue('/rss/channel/language');
        } else {
            if (Validator::language($xmls->getValue('/rss/channel/dc:language'))) {
                $feed['language'] = $xmls->getValue('/rss/channel/dc:language');
            } else {
                $feed['language'] = 'en-US';
            }
        }
        $feed['modified'] = gmmktime();
    } else {
        if ($xmls->doesExist('/feed')) {
            $feed['blogURL'] = $xmls->getAttribute('/feed/link', 'href');
            $feed['title'] = $xmls->getValue('/feed/title');
            $feed['description'] = $xmls->getValue('/feed/tagline');
            if (Validator::language($xmls->getAttribute('/feed', 'xml:lang'))) {
                $feed['language'] = $xmls->getAttribute('/feed', 'xml:lang');
            } else {
                $feed['language'] = 'en-US';
            }
            $feed['modified'] = gmmktime();
        } else {
            if ($xmls->getAttribute('/rdf:RDF', 'xmlns')) {
                if ($xmls->getAttribute('/rdf:RDF/channel/link', 'href')) {
                    $feed['blogURL'] = $xmls->getAttribute('/rdf:RDF/channel/link', 'href');
                } else {
                    if ($xmls->getValue('/rdf:RDF/channel/link')) {
                        $feed['blogURL'] = $xmls->getValue('/rdf:RDF/channel/link');
                    } else {
                        $feed['blogURL'] = '';
                    }
                }
                $feed['title'] = $xmls->getValue('/rdf:RDF/channel/title');
                $feed['description'] = $xmls->getValue('/rdf:RDF/channel/description');
                if (Validator::language($xmls->getValue('/rdf:RDF/channel/dc:language'))) {
                    $feed['language'] = $xmls->getValue('/rdf:RDF/channel/dc:language');
                } else {
                    if (Validator::language($xmls->getAttribute('/rdf:RDF', 'xml:lang'))) {
                        $feed['language'] = $xmls->getAttribute('/rdf:RDF', 'xml:lang');
                    } else {
                        $feed['language'] = 'en-US';
                    }
                }
                $feed['modified'] = gmmktime();
            } else {
                return array(3, null, null);
            }
        }
    }
    $feed['xmlurl'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['xmlurl'])));
    $feed['blogURL'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['blogURL'])));
    $feed['title'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['title'])));
    $feed['description'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct(stripHTML($feed['description']))));
    $feed['language'] = POD::escapeString(Utils_Unicode::lessenAsEncoding(Utils_Unicode::correct($feed['language']), 255));
    return array(0, $feed, $xml);
}
Example #5
0
													<option value="1"<?php 
echo $blog['publishWholeOnRSS'] ? ' selected="selected"' : '';
?>
><?php 
echo _t('전체공개');
?>
</option>
													<option value="0"<?php 
echo $blog['publishWholeOnRSS'] ? '' : ' selected="selected"';
?>
><?php 
echo _t('부분공개');
?>
</option>
												</select><?php 
echo Utils_Misc::getArrayValue(explode('%1', _t('RSS 파일의 글 본문은 %1를 원칙으로 합니다.')), 1);
?>
											</dd>

										</dl>
									</fieldset>
								</div>
<?php 
echo setDetailPanel('panelEtcSetting', 'button');
?>
								
								<div id="panelEtcSetting" class="section folding">
									<fieldset class="container">
										<legend><?php 
echo _t('기타');
?>
Example #6
0
function FM_TTML_getAttachmentBinder($filename, $property, $folderPath, $folderURL, $imageBlocks = 1, $useAbsolutePath = true, $bRssMode = false, $onclickFlag = false)
{
    $context = Model_Context::getInstance();
    $blogid = getBlogId();
    $path = "{$folderPath}/{$filename}";
    if ($useAbsolutePath) {
        $url = $context->getProperty('uri.service') . "/attach/{$blogid}/{$filename}";
    } else {
        $url = "{$folderURL}/{$filename}";
    }
    $fileInfo = getAttachmentByOnlyName($blogid, $filename);
    switch (Utils_Misc::getFileExtension($filename)) {
        case 'jpg':
        case 'jpeg':
        case 'gif':
        case 'png':
        case 'bmp':
            $bPassing = false;
            /*			if ($context->getProperty('blog.displaymode','desktop')=='mobile') {
            				if (!is_null(Setting::getBlogSettingGlobal("resamplingDefault"))) {
            					$waterMarkOn = Setting::getBlogSettingGlobal("waterMarkDefault", "no");
            					$exist = preg_match('/class="tt-watermark"/i', $property);
            					if (($waterMarkOn == 'yes') && ($exist == 1)) $bPassing = true;
            				}
            				if ($bPassing == false)
            					return fireEvent('ViewAttachedImageMobile', "<img class=\"img-responsive\" src=\"".$context->getProperty('uri.blog')."/imageResizer/?f=" . urlencode($filename) . "\" alt=\"\" />", $path);
            			}*/
            if ($context->getProperty('blog.displaymode', 'desktop') == 'mobile') {
                $resizeClass = "class=\"img-responsive\" ";
            } else {
                $resizeClass = "";
            }
            if ($context->getProperty('blog.displaymode', 'desktop') == 'mobile' || $onclickFlag == true && $bRssMode == false && $bPassing == false) {
                $imageStr = '<img ' . $resizeClass . 'src="' . $url . '" ' . $property . ' style="cursor: pointer;" onclick="open_img(\'' . $url . '\'); return false;" />';
            } else {
                $imageStr = '<img ' . $resizeClass . 'src="' . $url . '" ' . $property . ' />';
            }
            return fireEvent('ViewAttachedImage', $imageStr, $path);
            break;
        case 'swf':
            $id = md5($url) . rand(1, 10000);
            if ($useAbsolutePath && strncasecmp($url, 'http://', 7) == 0) {
                $url = substr($url, 7);
            }
            return "<span id=\"{$id}\"><script type=\"text/javascript\">//<![CDATA[" . CRLF . "writeCode(getEmbedCode('{$url}','300','400','{$id}','#FFFFFF',''), \"{$id}\");//]]></script></span>";
            break;
        case 'wmv':
        case 'avi':
        case 'asf':
        case 'mpg':
        case 'mpeg':
            $id = md5($url) . rand(1, 10000);
            if ($useAbsolutePath && strncasecmp($url, 'http://', 7) == 0) {
                $url = substr($url, 7);
            }
            return "<span id=\"{$id}\"><script type=\"text/javascript\">//<![CDATA[" . CRLF . "writeCode('<embed {$property} autostart=\"0\" src=\"{$url}\"></embed>', \"{$id}\")//]]></script></span>";
            break;
        case 'mp3':
        case 'mp2':
        case 'wma':
        case 'wav':
        case 'mid':
        case 'midi':
            $id = md5($url) . rand(1, 10000);
            if ($useAbsolutePath && strncasecmp($url, 'http://', 7) == 0) {
                $url = substr($url, 7);
            }
            return "<span id=\"{$id}\"><script type=\"text/javascript\">//<![CDATA[" . CRLF . "writeCode('<embed {$property} autostart=\"0\" height=\"45\" src=\"{$url}\"></embed>', \"{$id}\")//]]></script></span>";
            break;
        case 'mov':
            $id = md5($url) . rand(1, 10000);
            return "<span id=\"{$id}\"><script type=\"text/javascript\">//<![CDATA[" . CRLF . "writeCode(" . '\'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="400px" height="300px"><param name="src" value="' . $url . '" /><param name="controller" value="true" /><param name="pluginspage" value="http://www.apple.com/QuickTime/download/" /><!--[if !IE]> <--><object type="video/quicktime" data="' . $url . '" width="400px" height="300px" class="mov"><param name="controller" value="true" /><param name="pluginspage" value="http://www.apple.com/QuickTime/download/" /></object><!--> <![endif]--></object>\'' . ", \"{$id}\")//]]></script></span>";
            break;
        default:
            if (file_exists(ROOT . '/resources/image/extension/' . Utils_Misc::getFileExtension($fileInfo['label']) . '.gif')) {
                return '<a class="extensionIcon" href="' . ($useAbsolutePath ? $context->getProperty('uri.host') : '') . $context->getProperty('uri.blog') . '/attachment/' . $filename . '">' . fireEvent('ViewAttachedFileExtension', '<img src="' . ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('service.path')) . '/resources/image/extension/' . Utils_Misc::getFileExtension($fileInfo['label']) . '.gif" alt="" />') . ' ' . htmlspecialchars($fileInfo['label']) . '</a>';
            } else {
                return '<a class="extensionIcon" href="' . ($useAbsolutePath ? $context->getProperty('uri.host') : '') . $context->getProperty('uri.blog') . '/attachment/' . $filename . '">' . fireEvent('ViewAttachedFileExtension', '<img src="' . ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('service.path')) . '/resources/image/extension/unknown.gif" alt="" />') . ' ' . htmlspecialchars($fileInfo['label']) . '</a>';
            }
            break;
    }
}
Example #7
0
function api_addAttachment($blogid, $parent, $file)
{
    $pool = DBModel::getInstance();
    $attachment = array();
    $attachment['parent'] = $parent ? $parent : 0;
    $attachment['label'] = Path::getBaseName($file['name']);
    $label = Utils_Unicode::lessenAsEncoding($attachment['label'], 64);
    $attachment['size'] = $file['size'];
    $extension = Path::getExtension($attachment['label']);
    switch (strtolower($extension)) {
        case '.exe':
        case '.php':
        case '.sh':
        case '.com':
        case '.bat':
            $extension = '.xxx';
            break;
    }
    /* Create directory for owner */
    $path = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}";
    if (!is_dir($path)) {
        mkdir($path);
        if (!is_dir($path)) {
            return false;
        }
        @chmod($path, 0777);
    }
    $pool->reset('Attachments');
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('parent', 'eq', $parent);
    $pool->setQualifier('label', 'eq', $label, true);
    $oldFile = $pool->getCell('name');
    if ($oldFile !== null) {
        $attachment['name'] = $oldFile;
    } else {
        $attachment['name'] = rand(1000000000, 9999999999) . $extension;
        while (Attachment::doesExist($attachment['name'])) {
            $attachment['name'] = rand(1000000000, 9999999999) . $extension;
        }
    }
    $attachment['path'] = "{$path}/{$attachment['name']}";
    deleteAttachment($blogid, -1, $attachment['name']);
    if ($file['content']) {
        $f = fopen($attachment['path'], "w");
        if (!$f) {
            return false;
        }
        $attachment['size'] = fwrite($f, $file['content']);
        fclose($f);
        $file['tmp_name'] = $attachment['path'];
    }
    if ($imageAttributes = @getimagesize($file['tmp_name'])) {
        $attachment['mime'] = $imageAttributes['mime'];
        $attachment['width'] = $imageAttributes[0];
        $attachment['height'] = $imageAttributes[1];
    } else {
        $attachment['mime'] = Utils_Misc::getMIMEType($extension);
        $attachment['width'] = 0;
        $attachment['height'] = 0;
    }
    $attachment['mime'] = Utils_Unicode::lessenAsEncoding($attachment['mime'], 32);
    @chmod($attachment['path'], 0666);
    $pool->reset('Attachments');
    $pool->setAttribute('blogid', $blogid);
    $pool->setAttribute('parent', $attachment['parent']);
    $pool->setAttribute('name', $attachment['name'], true);
    $pool->setAttribute('label', $label, true);
    $pool->setAttribute('mime', $attachment['mime'], true);
    $pool->setAttribute('size', $attachment['size'], true);
    $pool->setAttribute('width', $attachment['width']);
    $pool->setAttribute('height', $attachment['height']);
    $pool->setAttribute('attached', Timestamp::getUNIXtime());
    $pool->setAttribute('downloads', 0);
    $pool->setAttribute('enclosure', 0);
    $result = $pool->insert();
    if (!$result) {
        @unlink($attachment['path']);
        return false;
    }
    return $attachment;
}
Example #8
0
function checkStep($step, $check = true)
{
    global $root, $path;
    $error = 0;
    if ($step == 1) {
        if ($check) {
            return true;
        }
    } else {
        if ($step == 2) {
            if ($check) {
                if (!empty($_POST['mode'])) {
                    switch ($_POST['mode']) {
                        case 'install':
                        case 'setup':
                        case 'uninstall':
                            return true;
                    }
                }
            }
            ?>
  <input type="hidden" name="step" value="2" />
  <input id="setupMode" type="hidden" name="mode" value="" />
  <div id="inner">
    <h2><span class="step"><?php 
            echo _f('%1단계', 2);
            ?>
</span> : <?php 
            echo _t('작업 유형을 선택해 주십시오.');
            ?>
</h2>
    <div style="text-align:center">
      <div style="width:100%; padding:40px 0px 40px 0px">
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('새로운 텍스트큐브를 설정합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('install');return false;" /></div>
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('텍스트큐브를 다시 설정합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('setup');return false;" /></div>
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('텍스트큐브 테이블을 삭제합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('uninstall');return false;" /></div>
      </div>
    </div>
  </div>
<?php 
        } else {
            if ($step == 3) {
                if ($check) {
                    switch ($_POST['mode']) {
                        case 'install':
                        case 'setup':
                            if (!empty($_POST['dbServer']) && !empty($_POST['dbName']) && !empty($_POST['dbUser']) && isset($_POST['dbPassword']) && isset($_POST['dbPrefix'])) {
                                $dbTemp = array('server' => $_POST['dbServer'], 'username' => $_POST['dbUser'], 'password' => $_POST['dbPassword'], 'port' => $_POST['dbPort']);
                                if (!empty($_POST['dbName'])) {
                                    $dbTemp['database'] = $_POST['dbName'];
                                }
                                global $dbms;
                                $dbms = $_POST['dbms'];
                                if (!POD::bind($dbTemp)) {
                                    $error = 1;
                                } else {
                                    if (!empty($_POST['dbPrefix']) && !preg_match('/^[a-zA-Z0-9_]+$/', $_POST['dbPrefix'])) {
                                        $error = 3;
                                    } else {
                                        return true;
                                    }
                                }
                            }
                            break;
                        case 'uninstall':
                            if (!empty($_POST['dbServer']) && !empty($_POST['dbName']) && !empty($_POST['dbUser']) && isset($_POST['dbPassword']) && !empty($_POST['dbPort'])) {
                                $dbTemp = array('server' => $_POST['dbServer'], 'username' => $_POST['dbUser'], 'password' => $_POST['dbPassword'], 'port' => $_POST['dbPort']);
                                if (!empty($_POST['dbName'])) {
                                    $dbTemp['database'] = $_POST['dbName'];
                                }
                                global $dbms;
                                $dbms = $_POST['dbms'];
                                if (!POD::bind($dbTemp)) {
                                    $error = 1;
                                } else {
                                    return true;
                                }
                            }
                            break;
                    }
                }
                ?>
  <input type="hidden" name="step" value="3" />
  <input type="hidden" name="mode" value="<?php 
                echo $_POST['mode'];
                ?>
" />
  <script type="text/javascript">
    //<![CDATA[
     function suggestDefaultPort(db) {
		switch(db) {
			case 'MySQLi':
			default:
				port = 3306;
				break;
			case 'Cubrid':
				port = 30000;
				break;
			case 'PostgreSQL':
				port = 5432;
				break;
			default:
				port = '';
				break;
		}
		document.getElementById('dbPort').value = port;
		document.getElementById('dbms'+db).checked = checked;
		return true;
	 }
    //]]>
  </script>
  <div id="inner">
    <h2><span class="step"><?php 
                echo _f('%1단계', 3);
                ?>
</span> : <?php 
                echo _t('작업 정보를 입력해 주십시오.');
                ?>
</h2>
    <div id="userinput">
    <table class="inputs">
	  <tr>
        <th><?php 
                echo _t('데이터베이스 관리 시스템');
                ?>
 :</th>
        <td>
<?php 
                $dbmsSupport = array();
                if (function_exists('mysqli_connect')) {
                    array_push($dbmsSupport, 'MySQLi');
                }
                if (function_exists('pg_connect')) {
                    array_push($dbmsSupport, 'PostgreSQL');
                }
                if (class_exists('SQLite3')) {
                    array_push($dbmsSupport, 'SQLite3');
                }
                if (function_exists('cubrid_connect')) {
                    array_push($dbmsSupport, 'Cubrid');
                }
                foreach ($dbmsSupport as $dbms) {
                    ?>
	      <input type="radio" id="dbms<?php 
                    echo $dbms;
                    ?>
" name="dbms" value="<?php 
                    echo $dbms;
                    ?>
" <?php 
                    echo isset($_POST['dbms']) && $_POST['dbms'] == $dbms || !isset($_POST['dbms']) && $dbms == $dbmsSupport[0] ? 'checked' : '';
                    ?>
 onclick="suggestDefaultPort('<?php 
                    echo $dbms;
                    ?>
');return false;" /> <?php 
                    echo $dbms;
                }
                ?>
         </td>
      </tr>
	  <tr>
        <th><?php 
                echo _t('데이터베이스 서버');
                ?>
 :</th>
        <td>
          <input type="text" name="dbServer" value="<?php 
                echo isset($_POST['dbServer']) ? $_POST['dbServer'] : 'localhost';
                ?>
" class="input<?php 
                echo $check && (empty($_POST['dbServer']) || $error == 1) ? ' input_error' : '';
                ?>
" />
        </td>
      </tr>
      <tr>
        <th><?php 
                echo _t('데이터베이스 포트');
                ?>
 :</th>
        <td>
          <input type="text" id="dbPort" name="dbPort" value="<?php 
                echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '3306';
                ?>
" class="input<?php 
                echo $check && (empty($_POST['dbPort']) || $error == 1) ? ' input_error' : '';
                ?>
" />
        </td>
      </tr>
	  <tr>
        <th><?php 
                echo _t('데이터베이스 이름');
                ?>
 :</th>
        <td>
          <input type="text" name="dbName" value="<?php 
                echo isset($_POST['dbName']) ? $_POST['dbName'] : NULL;
                ?>
" class="input<?php 
                echo $check && (empty($_POST['dbName']) || $error == 2) ? ' input_error' : '';
                ?>
" />
        </td>
      </tr>
      <tr>
        <th><?php 
                echo _t('데이터베이스 사용자명');
                ?>
 :</th>
        <td>
          <input type="text" name="dbUser" value="<?php 
                echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                ?>
" class="input<?php 
                echo $check && (empty($_POST['dbUser']) || $error) ? ' input_error' : '';
                ?>
" />
        </td>
      </tr>
      <tr>
        <th><?php 
                echo _t('데이터베이스 암호');
                ?>
 :</th>
        <td>
          <input type="password" name="dbPassword" value="<?php 
                echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                ?>
" class="input<?php 
                echo $check && $error == 1 ? ' input_error' : '';
                ?>
" />
        </td>
      </tr>
<?php 
                switch ($_POST['mode']) {
                    case 'install':
                    case 'setup':
                        ?>
      <tr>
        <th><?php 
                        echo _t('테이블 식별자');
                        ?>
 :</th>
        <td>
          <input type="text" name="dbPrefix" value="<?php 
                        echo isset($_POST['dbPrefix']) ? $_POST['dbPrefix'] : 'tc_';
                        ?>
" class="input <?php 
                        echo $check && $error == 3 ? ' input_error' : '';
                        ?>
" />
        </td>
      </tr>
<?php 
                        break;
                    case 'uninstall':
                        break;
                }
                ?>
    </table>
    </div>
    <div id="content">
      <ol>
        <li><?php 
                echo _t('데이터베이스가 해당 호스트에 먼저 생성되어 있어야 합니다.');
                ?>
</li>
		<li><?php 
                echo _t('테이블식별자는 텍스트큐브가 사용하는 테이블이름 앞에 붙는 문자열입니다. 데이터 베이스내에 다른 어플리케이션이 사용하는 테이블이 있을 경우 구별하기 위해 사용합니다');
                ?>
 <?php 
                echo _t('테이블식별자를 입력하지 않을 경우 자동으로 tc_ 를 사용합니다.');
                ?>
</li>
      </ol>
    </div>
    <div id="warning"><?php 
                if ($error == 1) {
                    echo _t('데이터베이스 서버에 연결할 수 없습니다. 정보를 다시 입력해 주십시오.');
                } else {
                    if ($error == 2) {
                        echo _t('데이터베이스를 사용할 수가 없습니다. 정보를 다시 입력해 주십시오.');
                    } else {
                        if ($error == 3) {
                            echo _t('테이블 식별자가 올바르지 않습니다. 다시 입력해 주십시오.');
                        } else {
                            if ($error == 6) {
                                echo _t('데이터베이스에 연결할 수 없습니다.');
                            } else {
                                if ($error == 7) {
                                    echo _t('데이터베이스에 접근할 수 없습니다.');
                                } else {
                                    if ($error == 8) {
                                        echo _t('새로운 테이블 식별자가 올바르지 않습니다. 다시 입력해 주십시오.');
                                    } else {
                                        if ($check) {
                                            echo _t('표시된 정보가 부족합니다.');
                                        } else {
                                            echo '&nbsp;';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                ?>
</div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                echo _t('이전');
                ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                echo _t('이전');
                ?>
" /></a>
    <a href="#" onclick="next(); return false;" title="<?php 
                echo _t('다음');
                ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                echo _t('다음');
                ?>
" /></a>
  </div>
  </div>
<?php 
            } else {
                if ($step == 4 || $step == 33) {
                    if ($check) {
                        if ($_POST['mode'] == 'uninstall') {
                            if (empty($_POST['target'])) {
                                checkStep(2, false);
                                return false;
                            } else {
                                checkStep(205, false);
                                return false;
                            }
                        }
                        if (!empty($_POST['checked']) && $_POST['checked'] == 'yes') {
                            return true;
                        }
                    }
                    if ($_POST['mode'] == 'uninstall') {
                        return checkStep(204, false);
                    }
                    ?>
  <input type="hidden" name="step" value="4" />
  <input type="hidden" name="mode" value="<?php 
                    echo $_POST['mode'];
                    ?>
" />
  <input type="hidden" name="dbms" value="<?php 
                    echo isset($_POST['dbms']) ? $_POST['dbms'] : '';
                    ?>
" />
  <input type="hidden" name="dbServer" value="<?php 
                    echo isset($_POST['dbServer']) ? $_POST['dbServer'] : '';
                    ?>
" />
  <input type="hidden" name="dbName" value="<?php 
                    echo isset($_POST['dbName']) ? $_POST['dbName'] : '';
                    ?>
" />
  <input type="hidden" name="dbPort" value="<?php 
                    echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '';
                    ?>
" />
  <input type="hidden" name="dbUser" value="<?php 
                    echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                    ?>
" />
  <input type="hidden" name="dbPassword" value="<?php 
                    echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                    ?>
" />
  <input type="hidden" name="dbPrefix" value="<?php 
                    echo isset($_POST['dbPrefix']) ? $_POST['dbPrefix'] : '';
                    ?>
" />
  <input type="hidden" name="disableRewrite" value="<?php 
                    echo isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : '';
                    ?>
" />
  <div id="inner">
    <h2><span class="step"><?php 
                    echo _f('%1단계', 4);
                    ?>
</span> : <?php 
                    echo _t('설치 요구 사항을 확인하고 있습니다.');
                    ?>
 </h2>
    <div id="content-box">
    <h3><?php 
                    echo _t('환경');
                    ?>
</h3>
    <ul>
      <li><?php 
                    echo _t('하드웨어');
                    ?>
: <?php 
                    echo @exec('uname -mp');
                    ?>
</li>
      <li><?php 
                    echo _t('운영체제');
                    ?>
: <?php 
                    echo @exec('uname -sir');
                    ?>
</li>
      <li><?php 
                    echo _t('웹서버');
                    ?>
: <?php 
                    echo $_SERVER['SERVER_SOFTWARE'];
                    ?>
 <?php 
                    echo isset($_SERVER['SERVER_SIGNATURE']) ? $_SERVER['SERVER_SIGNATURE'] : '(no signature)';
                    ?>
</li>
      <li><?php 
                    echo _t('PHP 버전');
                    ?>
: <?php 
                    echo phpversion();
                    ?>
</li>
      <li><?php 
                    echo _t('데이터베이스 종류');
                    ?>
: <?php 
                    echo POD::dbms();
                    ?>
</li>
      <li><?php 
                    echo _f('%1 버전', POD::dbms());
                    ?>
: <?php 
                    echo POD::version();
                    ?>
</li>
    </ul>
    <h3>PHP</h3>
    <ul>
<?php 
                    $functions = "\naddslashes\narray_flip\narray_key_exists\narray_pop\narray_push\narray_shift\narray_slice\nbase64_encode\nceil\ncheckdate\nclosedir\ncopy\ncount\ndechex\ndir\nexplode\nfclose\nfeof\nfgets\nfile_exists\nfile_get_contents\nfilesize\nfopen\nfputs\nfread\nfsockopen\nfunction_exists\nfwrite\nget_magic_quotes_gpc\ngetimagesize\ngmdate\ngmmktime\ngmstrftime\nheader\nhtml_entity_decode\nhtmlspecialchars\nimplode\nini_set\nintval\nis_dir\nis_file\nis_null\nis_numeric\nis_writable\nksort\nltrim\nmax\nmd5\nmicrotime\nmin\nmkdir\nmktime\nmove_uploaded_file\nnl2br\nnumber_format\nob_end_clean\nob_get_contents\nob_start\nopendir\nord\nparse_url\npreg_match\npreg_replace\nrand\nrawurlencode\nreaddir\nrmdir\nrtrim\nsession_cache_expire\nsession_destroy\nsession_id\nsession_name\nsession_set_cookie_params\nsession_set_save_handler\nsession_start\nsetcookie\nsizeof\nsprintf\nstr_replace\nstrftime\nstripslashes\nstrlen\nstrncasecmp\nstrncmp\nstrpos\nstrrev\nstrtolower\nstrval\nsubstr\nsubstr_count\nsubstr_replace\ntime\ntrim\nunlink\nurlencode\nxml_get_error_code\nxml_parse\nxml_parser_create\nxml_parser_free\nxml_parser_set_option\nxml_set_character_data_handler\nxml_set_default_handler\nxml_set_element_handler\nxml_set_object\n";
                    $required = array();
                    foreach (explode("\n", str_replace("\r", '', trim($functions))) as $function) {
                        if (!function_exists($function)) {
                            array_push($required, $function);
                        }
                    }
                    if (version_compare(PHP_VERSION, '5.4.0') === -1 && (!isset($service['forceinstall']) || $service['forceinstall'] == false)) {
                        $error = 4;
                        ?>
                <span style="color:red"><?php 
                        echo _f('PHP 버전이 낮습니다. 설치를 위해서는 최소한 %1 이상의 버전이 필요합니다.', '5.4.0');
                        ?>
</span>
<?php 
                    } else {
                        if (count($required) == 0) {
                            ?>
                  <li>OK</li>
<?php 
                        } else {
                            $error = 4;
                            ?>
                <span style="color:red"><?php 
                            echo _t('함수가 설치되어야 합니다.');
                            ?>
</span>
<?php 
                            foreach ($required as $function) {
                                ?>
                  <li style="color:red"><?php 
                                echo $function;
                                ?>
</li>
<?php 
                            }
                        }
                    }
                    ?>
    </ul>
    <h3><?php 
                    echo POD::dbms();
                    ?>
</h3>
    <ul>
<?php 
                    if (POD::charset() == 'utf8') {
                        echo '<li>Character Set: OK</li>';
                    } else {
                        echo '<li style="color:navy">Character Set: ', _t('UTF8 미지원 (경고: 한글 지원이 불완전할 수 있습니다.)'), '</li>';
                    }
                    if (POD::query("CREATE TABLE {$_POST['dbPrefix']}Setup (a INT NOT NULL)")) {
                        POD::query("DROP TABLE {$_POST['dbPrefix']}Setup");
                        echo '<li>', _t('테이블 생성 권한'), ': OK</li>';
                    } else {
                        $error = 6;
                        echo '<li style="color:red">', _t('테이블 생성 권한'), ': ', _t('없음'), '</li>';
                    }
                    ?>
    </ul>
<?php 
                    $tables = array();
                    if ($result = POD::tableList()) {
                        foreach ($result as $table) {
                            if (strncmp($table, $_POST['dbPrefix'], strlen($_POST['dbPrefix']))) {
                                continue;
                            }
                            switch (strtolower(substr($table, strlen($_POST['dbPrefix'])))) {
                                case 'attachments':
                                case 'blogsettings':
                                case 'blogstatistics':
                                case 'categories':
                                case 'comments':
                                case 'commentsnotified':
                                case 'commentsnotifiedqueue':
                                case 'commentsnotifiedsiteinfo':
                                case 'dailystatistics':
                                case 'entries':
                                case 'entriesarchive':
                                case 'feedgrouprelations':
                                case 'feedgroups':
                                case 'feeditems':
                                case 'feedreads':
                                case 'feedsettings':
                                case 'feedstarred':
                                case 'feeds':
                                case 'filters':
                                case 'linkcategories':
                                case 'links':
                                case 'openidusers':
                                case 'pagecachelog':
                                case 'plugins':
                                case 'refererlogs':
                                case 'refererstatistics':
                                case 'reservedwords':
                                case 'servicesetting':
                                case 'sessionvisits':
                                case 'sessions':
                                case 'skinsettings':
                                case 'tagrelations':
                                case 'tags':
                                case 'teamblog':
                                case 'trackbacklogs':
                                case 'trackbacks':
                                case 'usersettings':
                                case 'users':
                                case 'xmlrpcpingsettings':
                                    $tables[count($tables)] = $table;
                                    break;
                            }
                        }
                    }
                    switch ($_POST['mode']) {
                        case 'install':
                            echo '<h3>', _t('새 데이터베이스 테이블'), '</h3>';
                            if (count($tables) == 0) {
                                echo '<ul><li>OK</li></ul>';
                            } else {
                                $error = 7;
                                echo '<ul style="color:red">', _t('테이블이 이미 존재합니다.');
                                foreach ($tables as $table) {
                                    echo '<li>', $table, '</li>';
                                }
                                echo '</ul>';
                            }
                            break;
                        case 'setup':
                            echo '<h3>', _t('데이터베이스 테이블 확인'), '</h3>';
                            if (count($tables) < 40 && count($tables) > 35 || count($tables) == 35 && !in_array('Filters', $tables)) {
                                echo '<ul><li>OK</li></ul>';
                            } else {
                                $error = 7;
                                echo '<ul style="color:red">', _t('테이블이 존재하지 않습니다.');
                                foreach ($tables as $table) {
                                    echo '<li>', $table, '</li>';
                                }
                                echo '</ul>';
                            }
                    }
                    ?>
    <h3><?php 
                    echo _t('파일 시스템 권한');
                    ?>
</h3>
    <ul>
<?php 
                    $commands = array();
                    $filename = $root . '/.htaccess';
                    if (file_exists($filename)) {
                        if (is_writable($filename)) {
                            if (filesize($filename)) {
                                echo '<li style="color:navy">', _f('설정 파일: OK (경고: "%1" 파일을 덮어 쓰게 됩니다.)', $filename), '</li>';
                            } else {
                                echo '<li>', _t('웹 설정 파일'), ': OK</li>';
                            }
                        } else {
                            $error = 8;
                            echo '<li style="color:red">', _t('웹 설정 파일'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0666'), '</li>';
                            array_push($commands, 'chmod 0666 ' . $filename);
                        }
                    } else {
                        if (is_writable($root)) {
                            echo '<li>', _t('웹 설정 파일'), ': OK</li>';
                        } else {
                            $error = 9;
                            echo '<li style="color:red">', _t('웹 설정 파일'), ': ', _f('"%1"에 %2 파일을 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, '.htaccess', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $root);
                        }
                    }
                    $filename = $root . '/config.php';
                    if (file_exists($filename)) {
                        if (is_writable($filename)) {
                            if (filesize($filename)) {
                                echo '<li style="color:navy">', _f('설정 파일: OK (경고: "%1" 파일을 덮어 쓰게 됩니다.)', $filename), '</li>';
                            } else {
                                echo '<li>', _t('설정 파일'), ': OK</li>';
                            }
                        } else {
                            $error = 10;
                            echo '<li style="color:red">', _t('설정 파일'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0666'), '</li>';
                            array_push($commands, 'chmod 0666 ' . $filename);
                        }
                    } else {
                        if (is_writable($root)) {
                            echo '<li>', _t('설정 파일'), ': OK</li>';
                        } else {
                            $error = 11;
                            echo '<li style="color:red">', _t('설정 파일'), ': ', _f('"%1"에 %2 파일을 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, 'config.php', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $root);
                        }
                    }
                    $filename = $root . '/user';
                    if (file_exists($filename)) {
                        if (is_dir($filename) && is_writable($filename)) {
                            echo '<li>', _t('사용자 데이터 디렉토리'), ': OK</li>';
                        } else {
                            $error = 12;
                            echo '<li style="color:red">', _t('사용자 데이터 디렉토리'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $filename);
                        }
                    } else {
                        if (mkdir($filename)) {
                            @chmod($filename, 0777);
                            echo '<li>', _t('사용자 데이터 디렉토리'), ': OK</li>';
                        } else {
                            $error = 13;
                            echo '<li style="color:red">', _t('사용자 데이터 디렉토리'), ': ', _f('"%1"에 %2 디렉토리를 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, 'user', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $root);
                        }
                    }
                    $filename = $root . '/user/attach';
                    if (file_exists($filename)) {
                        if (is_dir($filename) && is_writable($filename)) {
                            echo '<li>', _t('첨부 디렉토리'), ': OK</li>';
                        } else {
                            $error = 12;
                            echo '<li style="color:red">', _t('첨부 디렉토리'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $filename);
                        }
                    } else {
                        if (mkdir($filename)) {
                            @chmod($filename, 0777);
                            echo '<li>', _t('첨부 디렉토리'), ': OK</li>';
                        } else {
                            $error = 13;
                            echo '<li style="color:red">', _t('첨부 디렉토리'), ': ', _f('"%1"에 %2 디렉토리를 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, 'attach', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $root);
                        }
                    }
                    $filename = $root . '/user/cache';
                    if (is_dir($filename)) {
                        if (is_writable($filename)) {
                            echo '<li>', _t('캐시 디렉토리'), ': OK</li>';
                        } else {
                            $error = 12;
                            echo '<li style="color:red">', _t('캐시 디렉토리'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $filename);
                        }
                    } else {
                        if (mkdir($filename)) {
                            @chmod($filename, 0777);
                            echo '<li>', _t('캐시 디렉토리'), ': OK</li>';
                        } else {
                            $error = 13;
                            echo '<li style="color:red">', _t('캐시 디렉토리'), ': ', _f('"%1"에 %2 디렉토리를 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, 'cache', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $root);
                        }
                    }
                    /*        $filename = $root . '/remote';
                            if (is_dir($filename)) {
                                if (is_writable($filename))
                                   echo '<li>', _t('원격 설치 디렉토리'), ': OK</li>';
                                else {
                                    $error = 12;
                                   echo '<li style="color:red">', _t('원격 설치 디렉토리'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0777'), '</li>';
                                }
                            } else if (mkdir($filename)) {
                    			@chmod($filename, 0777);
                               echo '<li>', _t('원격 설치 디렉토리'), ': OK</li>';
                            } else {
                                $error = 13;
                               echo '<li style="color:red">', _t('원격 설치 디렉토리'), ': ', _f('"%1"에 %2 디렉토리를 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', $root, 'cache', '0777'), '</li>';
                            }*/
                    $filename = $root . '/user/skin/blog/customize';
                    if (is_dir($filename)) {
                        if (is_writable($filename)) {
                            echo '<li>', _t('스킨 디렉토리'), ': OK</li>';
                        } else {
                            $error = 14;
                            echo '<li style="color:red">', _t('스킨 디렉토리'), ': ', _f('"%1"에 접근할 수 없습니다. 퍼미션을 %2(으)로 수정해 주십시오.', $filename, '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . $filename);
                        }
                    } else {
                        if (mkdir($filename)) {
                            @chmod($filename, 0777);
                            echo '<li>', _t('스킨 디렉토리'), ': OK</li>';
                        } else {
                            $error = 15;
                            echo '<li style="color:red">', _t('스킨 디렉토리'), ': ', _f('"%1"에 %2 디렉토리를 생성할 수 없습니다. "%1"의 퍼미션을 %3(으)로 수정해 주십시오.', "{$root}/user/skin/blog", 'customize', '0777'), '</li>';
                            array_push($commands, 'chmod 0777 ' . "{$root}/user/skin/blog");
                        }
                    }
                    ?>
    </ul>
<?php 
                    if (!empty($commands)) {
                        echo '<span class="instruction">' . _t("퍼미션 수정은 FTP 프로그램을 사용하시거나 다음의 명령을 터미널에 붙여 넣으시면 됩니다.") . "</span>";
                        echo '<ul class="instruction">';
                        $commands = array_unique($commands);
                        foreach ($commands as $command) {
                            echo "<li>" . $command . "</li>";
                        }
                        echo '</ul>';
                    }
                    if ($step == 33) {
                        $error = 16;
                        if (checkIIS()) {
                            ?>
	<h3><?php 
                            echo _t('IIS Rewrite Module');
                            ?>
</h3>
	<ul style="color:red">
		<li><?php 
                            echo _t('현재 IIS에서의 설치는 실험적으로만 지원하고 있으며 별도의 Rewrite 모듈을 사용해야 합니다.') . ' ' . _t('만약 이 페이지를 보고 계시다면 Apache mod_rewrite와 호환되지 않는 Rewrite 모듈을 사용 중이거나 아예 모듈이 없는 경우입니다.');
                            ?>
</li>
		<li><?php 
                            echo _t('IIS 7.0을 사용하시는 경우 공식 URL Rewrite Module을 사용하려면 <a href="http://www.iis.net/extensions/URLRewrite">이곳에서 다운로드</a>받아 설치하시고, 계속 진행·설치 후 생성되는 <b>.htaccess</b> 파일 내용을 그대로 import해주시면 됩니다.');
                            ?>
</li>
		<li><?php 
                            echo _t('IIS 6.0 이전 버전을 사용하시는 경우 Rewrite 모듈을 설치하려면, 오픈스소 무료 모듈을 제공하고 있는 <a href="http://www.codeplex.com/IIRF" target="_blank">Ionics Isapi Rewrite Filter 홈페이지</a>를 방문하여 설치하신 후, 계속 진행·설치 후 생성되는 <b>.htaccess</b> 파일의 내용을 위 모듈의 설정파일(<b>IsapiRewrite4.ini</b>)에 복사하시기 바랍니다.');
                            ?>
</li>
	</ul>
	<p>
		<input type="radio" name="rewriteIIS" value="IISRewrite" id="rewriteIIS_Option1"><label for="rewriteIIS_Option1"><?php 
                            echo _t('IIS 7.0용 공식 URL Rewrite 모듈을 사용합니다.');
                            ?>
</label><br />
		<input type="radio" name="rewriteIIS" value="ISAPI" id="rewriteIIS_Option2"><label for="rewriteIIS_Option2"><?php 
                            echo _t('IIS 6.0 및 그 이전 버전을 위한 오픈소스 Rewrite 모듈을 사용합니다.');
                            ?>
</label>
	</p>
<?php 
                            $error = 0;
                        } else {
                            ?>
    <h3><?php 
                            echo _t('Apache Rewrite Engine');
                            ?>
</h3>
    <ul style="color:red">
      <li><?php 
                            echo _t('Rewrite를 사용할 수 없습니다.');
                            ?>
<br /><span style="color:black"><?php 
                            echo _t('다음 항목을 확인하십시오.');
                            ?>
</span></li>
      <input type="checkbox" id="disableRewrite" name="disableRewrite" />
	  <label for="disableRewrite"><?php 
                            echo _t('rewrite 모듈을 사용하지 않습니다.') . ' ' . _t('만약 rewrite 모듈 설정을 올바르게 했는데도 모듈 사용 여부의 검사에 문제가 있는 경우 rewrite 모듈을 사용하지 않음을 선택하시고 이 부분을 건너 뛰시기 바랍니다.') . ' ' . _t('지금 설정하지 않아도 설치 이후에 관리 패널의 서비스설정-서버 에서 rewrite 관련 설정을 할 수 있습니다.');
                            ?>
</label>
      <ol style="color:blue">
        <li><?php 
                            echo _t('웹서버 설정에 <b>mod_rewrite</b>의 로딩이 포함되어야 합니다.');
                            ?>
<br />
          <samp><?php 
                            echo _t('예: LoadModule <b>rewrite_module</b> modules/<b>mod_rewrite</b>.so');
                            ?>
</samp>
        </li>
        <li><?php 
                            echo _t('웹서버 설정의 이 디렉토리에 대한 <em>Options</em> 항목에 <b>FollowSymLinks</b>가 포함되거나 <b>All</b>이어야 합니다.');
                            ?>
          <samp><br /><?php 
                            echo _t('예: Options <b>FollowSymLinks</b>');
                            ?>
</samp>
          <samp><br /><?php 
                            echo _t('예: Options <b>All</b>');
                            ?>
</samp>
        </li>
        <li><?php 
                            echo _t('웹서버 설정의 이 디렉토리에 대한 <em>AllowOverride</em> 항목에 <b>FileInfo</b>가 포함되거나 <b>All</b>이어야 합니다.');
                            ?>
          <samp><br /><?php 
                            echo _t('예: AllowOverride <b>FileInfo</b>');
                            ?>
</samp>
          <samp><br /><?php 
                            echo _t('예: AllowOverride <b>All</b>');
                            ?>
</samp>
        </li>
        <li><b><?php 
                            echo _t('위 2와 3의 문제는 아래 내용을 웹서버 설정에 포함시켜 해결할 수 있습니다.');
                            ?>
</b>
          <samp style="color:black"><br />
          &lt;Directory &quot;<?php 
                            echo $root;
                            ?>
&quot;&gt;<br />
          &nbsp;&nbsp;Options FollowSymLinks<br />
          &nbsp;&nbsp;AllowOverride FileInfo<br />
          &lt;/Directory&gt;
          </samp>
        </li>
      </ul>
    </ul>
<?php 
                        }
                    }
                    ?>
  </div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                    echo _t('이전');
                    ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                    echo _t('이전');
                    ?>
" /></a>
    <a href="#" onclick="next(); return false;" title="<?php 
                    echo _t('다음');
                    ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                    echo _t('다음');
                    ?>
" /></a>
  </div>
  </div>
  <input type="hidden" name="checked" value="<?php 
                    echo $error > 0 ? 'no' : 'yes';
                    ?>
" />
<?php 
                } else {
                    if ($step == 5) {
                        if ($check) {
                            if (!empty($_POST['domain']) && !empty($_POST['type'])) {
                                return true;
                            }
                        }
                        // mod_rewrite routine.
                        if (empty($_POST['disableRewrite']) && empty($_POST['rewriteIIS'])) {
                            $filename = $root . '/.htaccess';
                            $fp = fopen($filename, 'w+');
                            if (!$fp) {
                                checkStep($step - 1, false);
                                return false;
                            }
                            fwrite($fp, "RewriteEngine On\nRewriteBase {$path}/\nRewriteRule ^testrewrite\$ setup.php [L]");
                            fclose($fp);
                            @chmod($filename, 0666);
                            if (testMyself('blog' . substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.')), $path . '/testrewrite?test=now', $_SERVER['SERVER_PORT'])) {
                                $rewrite = 3;
                            } else {
                                if (testMyself('blog.' . $_SERVER['HTTP_HOST'], $path . '/testrewrite?test=now', $_SERVER['SERVER_PORT'])) {
                                    $rewrite = 2;
                                } else {
                                    if (testMyself($_SERVER['HTTP_HOST'], $path . '/testrewrite?test=now', $_SERVER['SERVER_PORT'])) {
                                        $rewrite = 1;
                                    } else {
                                        $rewrite = 0;
                                        @unlink($filename);
                                        checkStep(33, false);
                                        return false;
                                    }
                                }
                            }
                            @unlink($filename);
                        } else {
                            if (!empty($_POST['rewriteIIS'])) {
                                switch ($_POST['rewriteIIS']) {
                                    case 'ISAPI':
                                        $rewrite = -1;
                                        break;
                                    case 'IISRewrite':
                                    default:
                                        $rewrite = -2;
                                }
                            } else {
                                $rewrite = 0;
                            }
                        }
                        $domain = $rewrite == 3 ? substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.') + 1) : $_SERVER['HTTP_HOST'];
                        $blogProtocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
                        $blogDefaultPort = isset($_SERVER['HTTPS']) ? 443 : 80;
                        ?>
  <input type="hidden" name="step" value="<?php 
                        echo $step;
                        ?>
" />
  <input type="hidden" name="mode" value="<?php 
                        echo $_POST['mode'];
                        ?>
" />
  <input type="hidden" name="dbms" value="<?php 
                        echo isset($_POST['dbms']) ? $_POST['dbms'] : '';
                        ?>
" />
  <input type="hidden" name="dbServer" value="<?php 
                        echo isset($_POST['dbServer']) ? $_POST['dbServer'] : '';
                        ?>
" />
  <input type="hidden" name="dbPort" value="<?php 
                        echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '';
                        ?>
" />
  <input type="hidden" name="dbName" value="<?php 
                        echo isset($_POST['dbName']) ? $_POST['dbName'] : '';
                        ?>
" />
  <input type="hidden" name="dbUser" value="<?php 
                        echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                        ?>
" />
  <input type="hidden" name="dbPassword" value="<?php 
                        echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                        ?>
" />
  <input type="hidden" name="dbPrefix" value="<?php 
                        echo isset($_POST['dbPrefix']) ? $_POST['dbPrefix'] : '';
                        ?>
" />
  <input type="hidden" name="checked" value="<?php 
                        echo isset($_POST['checked']) ? $_POST['checked'] : '';
                        ?>
" />
  <input type="hidden" name="domain" value="<?php 
                        echo $domain;
                        ?>
" />
  <input type="hidden" name="disableRewrite" value="<?php 
                        echo isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : '';
                        ?>
" />
  <input type="hidden" name="rewriteMode" value="<?php 
                        echo $rewrite <= -1 ? $_POST['rewriteIIS'] : 'mod_rewrite';
                        ?>
" />
  <div id="inner">
  <h2><span class="step"><?php 
                        echo _f('%1단계', $step);
                        ?>
</span> : <?php 
                        echo _t('사용 가능한 운영 방법은 다음과 같습니다. 선택하여 주십시오.');
                        ?>
</h2>
  <div id="userinput">
    <table class="inputs">
<?php 
                        if ($rewrite != 0) {
                            ?>
      <tr>
        <th width="120"><strong><?php 
                            echo _t('다중 사용자');
                            ?>
 : </strong></th>
        <td>
<?php 
                            if ($rewrite >= 2) {
                                ?>
        <label for="type1"><input type="radio" id="type1" name="type" value="domain" checked="checked" onclick="show('typeDomain');" />
                      <?php 
                                echo _t('도메인네임(DNS)으로 블로그 식별');
                                ?>
</label>
        <br />
<?php 
                            }
                            ?>
        <label for="type2"><input type="radio" id="type2" name="type" value="path"<?php 
                            echo $rewrite == 1 || $rewrite == -1 ? ' checked="checked"' : '';
                            ?>
 onclick="show('typePath');" />
        <?php 
                            echo _t('하위 경로(Path)로 블로그 식별');
                            ?>
</label></td>
      </tr>
<?php 
                        }
                        ?>
      <tr>
        <th style="padding-top:10px"><strong><?php 
                        echo _t('단일 사용자');
                        ?>
 : </strong></th>
        <td style="padding-top:10px">
          <label for="type3"><input type="radio" id="type3" name="type" value="single" onclick="show('typeSingle');" <?php 
                        echo empty($_POST['disableRewrite']) ? '' : 'checked="checked"';
                        ?>
 /><?php 
                        echo _t('단일 블로그');
                        ?>
</label></td>
      </tr>
      <tr>
        <th style="padding-top:20px"><?php 
                        echo _t('블로그 주소 예시');
                        ?>
</th>
        <td style="padding-top:20px; height:100px">
        <ul id="typeDomain"<?php 
                        echo $rewrite >= 2 ? '' : ' style="display:none"';
                        ?>
>
          <li><?php 
                        echo $blogProtocol;
                        ?>
://<b>blog1</b>.<?php 
                        echo $domain;
                        echo $_SERVER['SERVER_PORT'] == $blogDefaultPort ? '' : ":{$_SERVER['SERVER_PORT']}";
                        echo $path;
                        ?>
/</li>
          <li><?php 
                        echo $blogProtocol;
                        ?>
://<b>blog2</b>.<?php 
                        echo $domain;
                        echo $_SERVER['SERVER_PORT'] == $blogDefaultPort ? '' : ":{$_SERVER['SERVER_PORT']}";
                        echo $path;
                        ?>
/</li>
        </ul>
        <ul id="typePath"<?php 
                        echo $rewrite == 1 ? '' : ' style="display:none"';
                        ?>
>
          <li><?php 
                        echo $blogProtocol;
                        ?>
://<?php 
                        echo $domain;
                        echo $_SERVER['SERVER_PORT'] == $blogDefaultPort ? '' : ":{$_SERVER['SERVER_PORT']}";
                        echo $path;
                        ?>
/<b>blog1</b></li>
          <li><?php 
                        echo $blogProtocol;
                        ?>
://<?php 
                        echo $domain;
                        echo $_SERVER['SERVER_PORT'] == $blogDefaultPort ? '' : ":{$_SERVER['SERVER_PORT']}";
                        echo $path;
                        ?>
/<b>blog2</b></li>
        </ul>
        <ul id="typeSingle" <?php 
                        echo empty($_POST['disableRewrite']) ? 'style="display:none"' : '';
                        ?>
>
          <li><?php 
                        echo $blogProtocol;
                        ?>
://<?php 
                        echo $domain;
                        echo $_SERVER['SERVER_PORT'] == $blogDefaultPort ? '' : ":{$_SERVER['SERVER_PORT']}";
                        echo $path;
                        ?>
/<?php 
                        echo empty($_POST['disableRewrite']) ? '' : 'blog/';
                        ?>
</li>
        </ul>
        </td>
      </tr>
    </table>
  </div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                        echo _t('이전');
                        ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                        echo _t('이전');
                        ?>
" /></a>
    <a href="#" onclick="next(); return false;" title="<?php 
                        echo _t('다음');
                        ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                        echo _t('다음');
                        ?>
" /></a>
  </div>
  </div>
<?php 
                    } else {
                        if ($step == 6) {
                            if ($check) {
                                if (!empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['password2']) && ($_POST['type'] == 'single' || !empty($_POST['blog'])) && isset($_POST['name'])) {
                                    if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $_POST['email'])) {
                                        $error = 51;
                                    } else {
                                        if ($_POST['password'] != $_POST['password2']) {
                                            $error = 52;
                                        } else {
                                            if ($_POST['type'] != 'single' && !preg_match('/^[a-zA-Z0-9]+$/', $_POST['blog'])) {
                                                $error = 53;
                                            } else {
                                                if (strlen($_POST['password']) < 6 || strlen($_POST['password2']) < 6) {
                                                    $error = 54;
                                                } else {
                                                    return true;
                                                }
                                            }
                                        }
                                    }
                                }
                            } else {
                                @POD::query('SET CHARACTER SET utf8');
                                if ($result = @POD::query("SELECT loginid, password, name FROM {$_POST['dbPrefix']}Users WHERE userid = 1")) {
                                    @(list($_POST['email'], $_POST['password'], $_POST['name']) = POD::fetch($result, 'row'));
                                    $_POST['password2'] = $_POST['password'];
                                    POD::free($result);
                                }
                                if ($result = @POD::queryCell("SELECT value FROM {$_POST['dbPrefix']}BlogSettings\n\t\t\t\t\t\tWHERE blogid = 1\n\t\t\t\t\t\t\tAND name = 'name'")) {
                                    $_POST['blog'] = $result;
                                }
                            }
                            ?>
  <input type="hidden" name="step" value="<?php 
                            echo $step;
                            ?>
" />
  <input type="hidden" name="mode" value="<?php 
                            echo $_POST['mode'];
                            ?>
" />
  <input type="hidden" name="dbms" value="<?php 
                            echo isset($_POST['dbms']) ? $_POST['dbms'] : '';
                            ?>
" />
  <input type="hidden" name="dbServer" value="<?php 
                            echo isset($_POST['dbServer']) ? $_POST['dbServer'] : '';
                            ?>
" />
  <input type="hidden" name="dbPort" value="<?php 
                            echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '';
                            ?>
" />
  <input type="hidden" name="dbName" value="<?php 
                            echo isset($_POST['dbName']) ? $_POST['dbName'] : '';
                            ?>
" />
  <input type="hidden" name="dbUser" value="<?php 
                            echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                            ?>
" />
  <input type="hidden" name="dbPassword" value="<?php 
                            echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                            ?>
" />
  <input type="hidden" name="dbPrefix" value="<?php 
                            echo isset($_POST['dbPrefix']) ? $_POST['dbPrefix'] : '';
                            ?>
" />
  <input type="hidden" name="checked" value="<?php 
                            echo isset($_POST['checked']) ? $_POST['checked'] : '';
                            ?>
" />
  <input type="hidden" name="domain" value="<?php 
                            echo isset($_POST['domain']) ? $_POST['domain'] : '';
                            ?>
" />
  <input type="hidden" name="disableRewrite" value="<?php 
                            echo isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : '';
                            ?>
" />
  <input type="hidden" name="rewriteMode" value="<?php 
                            echo isset($_POST['rewriteMode']) ? $_POST['rewriteMode'] : '';
                            ?>
" />
  <input type="hidden" name="type" value="<?php 
                            echo isset($_POST['type']) ? $_POST['type'] : '';
                            ?>
" />
  <div id="inner">
    <h2><span class="step"><?php 
                            echo _f('%1단계', $step);
                            ?>
</span> : <?php 
                            echo _t('관리자 정보 입력');
                            ?>
</h2>
    <div id="userinput">
      <table class="inputs">
        <tr>
          <th style="width:100px"><?php 
                            echo _t('이메일');
                            ?>
 : </th>
          <td>
            <input type="text" id="email" name="email" value="<?php 
                            echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : '';
                            ?>
" class="input_email"<?php 
                            echo $check && (empty($_POST['email']) || $error == 51) ? ' style="border-color:red"' : '';
                            ?>
 />
          </td>
        </tr>
        <tr>
          <th><?php 
                            echo _t('비밀번호');
                            ?>
 : </th>
          <td>
            <input type="password" name="password" value="<?php 
                            echo isset($_POST['password']) ? htmlspecialchars($_POST['password']) : '';
                            ?>
" class="input_password"<?php 
                            echo $check && empty($_POST['password']) ? ' style="border-color:red"' : '';
                            ?>
 /><br />
			<em class="password"><?php 
                            echo _t('비밀번호는 최소 6자 이상이어야 합니다.');
                            ?>
</em>
          </td>
        </tr>
        <tr>
          <th><?php 
                            echo _t('비밀번호 확인');
                            ?>
 : </th>
          <td>
            <input type="password" name="password2" value="<?php 
                            echo isset($_POST['password2']) ? htmlspecialchars($_POST['password2']) : '';
                            ?>
" class="input_password"<?php 
                            echo $check && empty($_POST['password2']) ? ' style="border-color:red"' : '';
                            ?>
 />
          </td>
        </tr>
        <tr>
          <th><?php 
                            echo _t('블로그 식별자');
                            ?>
 : </th>
          <td>
            <input type="text" name="blog" value="<?php 
                            echo isset($_POST['blog']) ? htmlspecialchars($_POST['blog']) : '';
                            ?>
" class="input_password"<?php 
                            echo $check && (empty($_POST['blog']) || $error == 53) ? ' style="border-color:red"' : '';
                            ?>
 />
          </td>
        </tr>
        <tr>
          <th><?php 
                            echo _t('필명');
                            ?>
 : </th>
          <td>
            <input type="text" name="name" value="<?php 
                            echo isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
                            ?>
" class="input_password" />
          </td>
        </tr>
      </table>
      <div id="warning"><?php 
                            if ($error == 51) {
                                echo _t('이메일이 올바르지 않습니다.');
                            } else {
                                if ($error == 52) {
                                    echo _t('비밀번호가 일치하지 않습니다.');
                                } else {
                                    if ($error == 53) {
                                        echo _t('블로그 식별자가 올바르지 않습니다.');
                                    } else {
                                        if ($error == 54) {
                                            echo _t('비밀번호는 최소 6자 이상이어야 합니다.');
                                        } else {
                                            if ($check) {
                                                echo _t('표시된 정보가 부족합니다.');
                                            } else {
                                                echo '&nbsp;';
                                            }
                                        }
                                    }
                                }
                            }
                            ?>
</div>
    </div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                            echo _t('이전');
                            ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                            echo _t('이전');
                            ?>
" /></a>
    <a href="#" onclick="next(); return false;" title="<?php 
                            echo _t('다음');
                            ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                            echo _t('다음');
                            ?>
" /></a>
  </div>
  </div>
  <script type="text/javascript">
    //<![CDATA[
      document.getElementById('email').focus();
    //]]>
  </script>
<?php 
                        } else {
                            if ($step == 7) {
                                if ($check) {
                                    return true;
                                }
                                ?>
  <input type="hidden" name="step" value="<?php 
                                echo $step;
                                ?>
" />
  <input type="hidden" name="mode" value="<?php 
                                echo $_POST['mode'];
                                ?>
" />
  <input type="hidden" name="dbms" value="<?php 
                                echo isset($_POST['dbms']) ? $_POST['dbms'] : '';
                                ?>
" />
  <input type="hidden" name="dbServer" value="<?php 
                                echo isset($_POST['dbServer']) ? $_POST['dbServer'] : '';
                                ?>
" />
  <input type="hidden" name="dbPort" value="<?php 
                                echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '';
                                ?>
" />
  <input type="hidden" name="dbName" value="<?php 
                                echo isset($_POST['dbName']) ? $_POST['dbName'] : '';
                                ?>
" />
  <input type="hidden" name="dbUser" value="<?php 
                                echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                                ?>
" />
  <input type="hidden" name="dbPassword" value="<?php 
                                echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                                ?>
" />
  <input type="hidden" name="dbPrefix" value="<?php 
                                echo isset($_POST['dbPrefix']) ? $_POST['dbPrefix'] : '';
                                ?>
" />
  <input type="hidden" name="checked" value="<?php 
                                echo isset($_POST['checked']) ? $_POST['checked'] : '';
                                ?>
" />
  <input type="hidden" name="domain" value="<?php 
                                echo isset($_POST['domain']) ? $_POST['domain'] : '';
                                ?>
" />
  <input type="hidden" name="disableRewrite" value="<?php 
                                echo isset($_POST['disableRewrite']) ? $_POST['disableRewrite'] : false;
                                ?>
" />
  <input type="hidden" name="rewriteMode" value="<?php 
                                echo isset($_POST['rewriteMode']) ? $_POST['rewriteMode'] : '';
                                ?>
" />
  <input type="hidden" name="type" value="<?php 
                                echo isset($_POST['type']) ? $_POST['type'] : '';
                                ?>
" />
  <input type="hidden" name="blog" value="<?php 
                                echo isset($_POST['blog']) ? $_POST['blog'] : '';
                                ?>
" />
  <div id="inner">
    <h2><span class="step"><?php 
                                echo _f('%1단계', $step);
                                ?>
</span> : <?php 
                                echo _t('데이터베이스를 준비하고 있습니다. 잠시만 기다려 주십시오.');
                                ?>
</h2>
    <div id="content-box" style="text-align:center">
	<p></p>
    </div>
  </div><!-- inner -->
  </form>
</div><!-- container -->
<?php 
                                function fail($msg)
                                {
                                    flush();
                                    if ($_POST['mode'] == 'install') {
                                    }
                                    exit;
                                }
                                $loginid = POD::escapeString($_POST['email']);
                                $password = md5($_POST['password']);
                                $name = POD::escapeString($_POST['name']);
                                $blog = POD::escapeString($_POST['blog']);
                                $baseLanguage = POD::escapeString($_POST['Lang']);
                                $baseTimezone = POD::escapeString(substr(_t('default:Asia/Seoul'), 8));
                                if (POD::dbms() == 'MySQLi') {
                                    $charset = 'DEFAULT CHARSET=utf8';
                                    //    	    if (!@POD::query('SET CHARACTER SET utf8'))
                                    //      	    $charset = 'TYPE=MyISAM';
                                    //    @POD::query('SET SESSION collation_connection = \'utf8_general_ci\'');
                                } else {
                                    $charset = '';
                                }
                                if ($_POST['mode'] == 'install') {
                                    $schema = '';
                                    // Compatibility layer load
                                    if (file_exists(ROOT . '/resources/setup/compatibility.' . POD::dbms() . '.sql')) {
                                        $schema = file_get_contents(ROOT . '/resources/setup/compatibility.' . POD::dbms() . '.sql');
                                        $query = explode(';', trim($schema));
                                        foreach ($query as $sub) {
                                            @POD::query($sub);
                                        }
                                        $schema = '';
                                        $query = array();
                                    }
                                    // Loading create schema from sql file. (DBMS specific)
                                    if (POD::dbms() == 'MySQLi') {
                                        $dbSelector = 'MySQL';
                                    } else {
                                        $dbSelector = POD::dbms();
                                    }
                                    $schema .= file_get_contents(ROOT . '/resources/setup/initialize.' . $dbSelector . '.sql');
                                    $schema = str_replace('[##_dbPrefix_##]', $_POST['dbPrefix'], $schema);
                                    $schema = str_replace('[##_charset_##]', $charset, $schema);
                                    $schema .= "\nINSERT INTO {$_POST['dbPrefix']}Users VALUES (1, '{$loginid}', '{$password}', '{$name}', " . Timestamp::getUNIXtime() . ", 0, 0);\nINSERT INTO {$_POST['dbPrefix']}Privileges VALUES (1, 1, 16, " . Timestamp::getUNIXtime() . ", 0);\nINSERT INTO {$_POST['dbPrefix']}ServiceSettings VALUES ('newlineStyle', '1.1');\nINSERT INTO {$_POST['dbPrefix']}ServiceSettings VALUES ('useNewPluginSetting', 1);\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'name', '{$blog}');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'language', '{$baseLanguage}');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'blogLanguage', '{$baseLanguage}');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'timezone', '{$baseTimezone}');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'defaultEditor', 'tinyMCE');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'defaultFormatter', 'ttml');\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'acceptTrackbacks', 1);\nINSERT INTO {$_POST['dbPrefix']}BlogSettings VALUES (1, 'acceptComments', 1);\nINSERT INTO {$_POST['dbPrefix']}Plugins VALUES (1, 'CL_OpenID', null);\nINSERT INTO {$_POST['dbPrefix']}SkinSettings VALUES (1,'skin','periwinkle');\nINSERT INTO {$_POST['dbPrefix']}FeedSettings (blogid) values(1);\nINSERT INTO {$_POST['dbPrefix']}FeedGroups (blogid) values(1);\nINSERT INTO {$_POST['dbPrefix']}Entries (blogid, userid, id, category, visibility, location, title, slogan, contentformatter, contenteditor, starred, acceptcomment, accepttrackback, created, published, modified, content) VALUES (1, 1, 1, 0, 2, '/', '" . POD::escapeString(_t('환영합니다')) . "', 'welcome', 'ttml', 'tinyMCE', 0, 1, 1, " . Timestamp::getUNIXtime() . ", " . Timestamp::getUNIXtime() . "," . Timestamp::getUNIXtime() . ",'" . POD::escapeString(getDefaultPostContent()) . "')";
                                    $query = explode(';', trim($schema));
                                    foreach ($query as $sub) {
                                        if (!empty($sub) && !POD::query($sub, false)) {
                                            $tables = getTables('2.0', $_POST['dbPrefix']);
                                            foreach ($tables as $table) {
                                                if (POD::dbms() == 'Cubrid') {
                                                    @POD::query("DROP " . $table);
                                                } else {
                                                    @POD::query("DROP TABLE " . $table);
                                                }
                                            }
                                            /*		@POD::query(
                                            					"DROP TABLE
                                            						{$_POST['dbPrefix']}Attachments,
                                            						{$_POST['dbPrefix']}BlogSettings,
                                            						{$_POST['dbPrefix']}BlogStatistics,
                                            						{$_POST['dbPrefix']}Categories,
                                            						{$_POST['dbPrefix']}Comments,
                                            						{$_POST['dbPrefix']}CommentsNotified,
                                            						{$_POST['dbPrefix']}CommentsNotifiedQueue,
                                            						{$_POST['dbPrefix']}CommentsNotifiedSiteInfo,
                                            						{$_POST['dbPrefix']}ContentFilters,
                                            						{$_POST['dbPrefix']}DailyStatistics,
                                            						{$_POST['dbPrefix']}Entries,
                                            						{$_POST['dbPrefix']}EntriesArchive,
                                            						{$_POST['dbPrefix']}FeedGroupRelations,
                                            						{$_POST['dbPrefix']}FeedGroups,
                                            						{$_POST['dbPrefix']}FeedItems,
                                            						{$_POST['dbPrefix']}FeedReads,
                                            						{$_POST['dbPrefix']}FeedSettings,
                                            						{$_POST['dbPrefix']}FeedStarred,
                                            						{$_POST['dbPrefix']}Feeds,
                                            						{$_POST['dbPrefix']}Filters,
                                            						{$_POST['dbPrefix']}Links,
                                            						{$_POST['dbPrefix']}LinkCategories,
                                            						{$_POST['dbPrefix']}OpenIDUsers,
                                            						{$_POST['dbPrefix']}PageCacheLog,
                                            						{$_POST['dbPrefix']}Plugins,
                                            						{$_POST['dbPrefix']}Privileges,
                                            						{$_POST['dbPrefix']}RefererLogs,
                                            						{$_POST['dbPrefix']}RefererStatistics,
                                            						{$_POST['dbPrefix']}RemoteResponseLogs,
                                            						{$_POST['dbPrefix']}RemoteResponses,
                                            						{$_POST['dbPrefix']}ReservedWords,
                                            						{$_POST['dbPrefix']}ServiceSettings,
                                            						{$_POST['dbPrefix']}SessionVisits,
                                            						{$_POST['dbPrefix']}Sessions,
                                            						{$_POST['dbPrefix']}SkinSettings,
                                            						{$_POST['dbPrefix']}TagRelations,
                                            						{$_POST['dbPrefix']}Tags,
                                            						{$_POST['dbPrefix']}UserSettings,
                                            						{$_POST['dbPrefix']}Users,
                                            						{$_POST['dbPrefix']}XMLRPCPingSettings"
                                            				);*/
                                            echo '<script type="text/javascript">//<![CDATA[' . CRLF . 'alert("', _t('테이블을 생성하지 못했습니다.'), '")//]]></script>';
                                            $error = 1;
                                            break;
                                        }
                                    }
                                } else {
                                    $ctx = Model_Context::getInstance();
                                    $ctx->setProperty('database.prefix', $_POST['dbPrefix']);
                                    $pool = DBModel::getInstance();
                                    $pool->reset('Users');
                                    $pool->setAttribute('loginid', $loginid, true);
                                    $pool->setAttribute('name', $name, true);
                                    $pool->setQualifier('userid', 'equals', 1);
                                    $pool->update();
                                    $pool->reset('Users');
                                    $pool->setAttribute('password', $password, true);
                                    $pool->setQualifier('userid', 'equals', 1);
                                    $pool->setQualifier('password', 'not', $password2, true);
                                    $pool->update();
                                    $pool->reset('BlogSettings');
                                    $pool->setAttribute('value', $_POST['blog'], true);
                                    $pool->setQualifier('blogid', 'equals', 1);
                                    $pool->setQualifier('name', 'equals', 'name', true);
                                    $pool->update();
                                    $pool->reset('BlogSettings');
                                    $pool->setAttribute('value', $baseLanguage, true);
                                    $pool->setQualifier('blogid', 'equals', 1);
                                    $pool->setQualifier('name', 'equals', 'language', true);
                                    $pool->update();
                                    $pool->reset('BlogSettings');
                                    $pool->setAttribute('value', $baseTimezone, true);
                                    $pool->setQualifier('blogid', 'equals', 1);
                                    $pool->setQualifier('name', 'equals', 'timezone', true);
                                    $pool->update();
                                    $pool->reset('BlogSettings');
                                    $pool->setAttribute('value', Timestamp::getUNIXtime());
                                    $pool->setQualifier('blogid', 'equals', 1);
                                    $pool->setQualifier('name', 'equals', 'created', true);
                                    $pool->update();
                                }
                                if (!$error) {
                                    POD::unbind();
                                    echo '<script type="text/javascript">//<![CDATA[' . CRLF . 'next() //]]></script>';
                                }
                                ?>
</body>
</html>
<?php 
                            } else {
                                if ($step == 8) {
                                    if ($check) {
                                        return true;
                                    }
                                    $useSSL = Utils_Misc::isSecureProtocol() ? 'true' : 'false';
                                    $filename = $root . '/config.php';
                                    $fp = fopen($filename, 'w+');
                                    // For first entry addition
                                    $database = array('server' => $_POST['dbServer'], 'database' => $_POST['dbName'], 'username' => $_POST['dbUser'], 'port' => $_POST['dbPort'], 'password' => $_POST['dbPassword'], 'prefix' => $_POST['dbPrefix']);
                                    if ($fp) {
                                        fwrite($fp, "<?php\nini_set('display_errors', 'off');\n\$database['server'] = '{$_POST['dbServer']}';\n\$database['dbms'] = '{$_POST['dbms']}';\n\$database['database'] = '{$_POST['dbName']}';\n\$database['port'] = '{$_POST['dbPort']}';\n\$database['username'] = '******'dbUser']}';\n\$database['password'] = '******'dbPassword']}';\n\$database['prefix'] = '{$_POST['dbPrefix']}';\n\$service['type'] = '{$_POST['type']}';\n\$service['domain'] = '{$_POST['domain']}';\n\$service['path'] = '{$path}';\n\$service['skin'] = 'periwinkle';\n\$service['favicon_daily_traffic'] = 10; // 10MB\n\$service['useSSL'] = {$useSSL};  // Force SSL protocol (via https)\n//\$serviceURL = 'http://{$_POST['domain']}{$path}' ; // for path of Skin, plugin and etc.\n//\$service['reader'] = true; // Use Textcube reader. You can set it to false if you do not use Textcube reader, and want to decrease DB load.\n//\$service['debugmode'] = true; // uncomment for debugging, e.g. displaying DB Query or Session info\n//\$service['pagecache'] = false; // uncomment if you want to disable page cache feature.\n//\$service['codecache'] = true; // uncomment if you want to enable code cache feature.\n//\$service['debug_session_dump'] = true; // session info debuging.\n//\$service['debug_rewrite_module'] = true; // rewrite handling module debuging.\n//\$service['session_cookie_path'] = \$service['path']; // for avoiding spoiling other textcube's session id sharing root.\n//\$service['allowBlogVisibilitySetting'] = true; // Allow service users to change blog visibility.\n//\$service['externalresources'] = false;  // Loads resources from external storage.\n//\$service['resourcepath'] = 'http://example.com/resource';\t// Specify the full URI of external resource.\n//\$service['autologinTimeout'] = 1209600;\t// Automatic login timeout (sec.)\n//\$service['favicon_daily_traffic'] = 10; // Set favicon traffic limitation. default is 10MB.\n//\$service['skincache'] = true;        // Use skin pre-fetching. Textcube will parse static elements (blog name, title…) only when you change skin. Reduces CPU loads.\n//\$service['cookie_prefix'] = '';        // Service cookie prefix. Default cookie prefix is Textcube_[VERSION_NUMBER].\n//\$database['port'] = 3639;            // Database port number\n//\$database['dbms'] = 'MySQLi';         // DBMS. (MySQL, MySQLi, PostgreSQL, Cubrid.)\n//\$service['memcached'] = true;       // Using memcache to handle session and cache\n//\$memcached['server'] = 'localhost';  // Where memcache server is.\n//\$service['requirelogin'] = false;    // Force log-in process to every blogs. (for private blog service)\n//\$service['jqueryURL'] = '';\t\t// Add URL if you want to use external jquery via CDN. e.g.) Microsoft's CDN: http://ajax.aspnetcdn.com/ajax/jQuery/\n//\$service['lodashURL'] = '';\t\t// Add URL if you want to use external lo-dash via CDN. e.g.) CDNJS' CDN: https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/\n?>");
                                        fclose($fp);
                                        @chmod($filename, 0666);
                                    }
                                    if (!isset($_POST['disableRewrite']) || !$_POST['disableRewrite']) {
                                        $filename = $root . '/.htaccess';
                                        $fp = fopen($filename, 'w+');
                                        switch ($_POST['rewriteMode']) {
                                            case 'ISAPI':
                                                // Users must copy these rules to IsapiRewrite4.ini
                                                $htaccessContent = <<<EOF
RewriteRule ^{$path}/(thumbnail)/([0-9]+/.+)\$ {$path}/cache/\$1/\$2 [L,U]
RewriteRule ^{$path}/attach/([0-9]+/.+)\$ {$path}/user/attach/\$1 [L,U]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^{$path}/user+/+(cache)+/+(.+[^/]).(cache|xml|txt|log)\$ - [NC,F,L,U]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^{$path}/([^?]+[^/])\$ {$path}/\$1/ [L,U]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} ^\$
RewriteRule ^{$path}/(.*)\$ {$path}/rewrite.php [L,U]
RewriteRule ^{$path}/(.*)\$ {$path}/rewrite.php?%{QUERY_STRING} [L,U]
EOF;
                                                break;
                                            case 'IISRewrite':
                                                // Users must import these rules into URL Rewrite module.
                                                $htaccessContent = <<<EOF
RewriteRule ^{$path}/(thumbnail)/([0-9]+/.+)\$ {$path}/cache/\$1/\$2 [L]
RewriteRule ^{$path}/attach/([0-9]+/.+)\$ {$path}/user/attach/\$1 [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^{$path}/user+/+(cache)+/+(.+[^/]).(cache|xml|txt|log)\$ - [NC,F,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^{$path}/([^?]+[^/])\$ {$path}/\$1/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^{$path}/(.*)\$ {$path}/rewrite.php [L,QSA]
EOF;
                                                break;
                                            case 'mod_rewrite':
                                            default:
                                                $htaccessContent = <<<EOF
#<IfModule mod_url.c>
#CheckURL Off
#</IfModule>
#SetEnv PRELOAD_CONFIG 1
RewriteEngine On
RewriteBase {$path}/
RewriteRule ^(thumbnail)/([0-9]+/.+)\$ cache/\$1/\$2 [L]
RewriteRule ^attach/([0-9]+/.+)\$ user/attach/\$1 [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^user+/+(cache)+/+(.+[^/]).(cache|xml|txt|log)\$ - [NC,F,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])\$ \$1/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\$ rewrite.php [L,QSA]
EOF;
                                        }
                                        if ($fp) {
                                            fwrite($fp, $htaccessContent);
                                            fclose($fp);
                                            @chmod($filename, 0666);
                                        }
                                    }
                                    $blogProtocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
                                    $blogDefaultPort = isset($_SERVER['HTTPS']) ? 443 : 80;
                                    switch ($_POST['type']) {
                                        case 'domain':
                                            $blogURL = "{$blogProtocol}://{$_POST['blog']}.{$_POST['domain']}" . ($_SERVER['SERVER_PORT'] != $blogDefaultPort ? ":{$_SERVER['SERVER_PORT']}" : '') . "{$path}" . (empty($_POST['disableRewrite']) ? '' : '/index.php?');
                                            break;
                                        case 'path':
                                            $blogURL = "{$blogProtocol}://{$_POST['domain']}" . ($_SERVER['SERVER_PORT'] != $blogDefaultPort ? ":{$_SERVER['SERVER_PORT']}" : '') . "{$path}" . (empty($_POST['disableRewrite']) ? '' : '/index.php?') . "/{$_POST['blog']}";
                                            break;
                                        case 'single':
                                            $blogURL = "{$blogProtocol}://{$_POST['domain']}" . ($_SERVER['SERVER_PORT'] != $blogDefaultPort ? ":{$_SERVER['SERVER_PORT']}" : '') . "{$path}" . (empty($_POST['disableRewrite']) ? '' : '/index.php?');
                                            break;
                                    }
                                    ?>
  <div id="inner">
    <h2><span class="step"><?php 
                                    echo _t('설치완료');
                                    ?>
</span> : <?php 
                                    echo _t('텍스트큐브가 성공적으로 설치되었습니다.');
                                    ?>
</h2>
    <div id="content-box">
      <p>
      </p>
      <ul>
        <li><?php 
                                    echo _t('텍스트큐브 주소');
                                    ?>
<br />
          <a href="<?php 
                                    echo $blogURL . '/';
                                    ?>
"><?php 
                                    echo $blogURL . '/';
                                    ?>
</a><br />
          <br />
        </li>
        <li><?php 
                                    echo _t('텍스트큐브 관리 툴 주소');
                                    ?>
<br />
          <a href="<?php 
                                    echo $blogURL . '/';
                                    ?>
owner"><?php 
                                    echo $blogURL . '/';
                                    ?>
owner</a></li>
      </ul>
      <p>
		<?php 
                                    if (checkIIS()) {
                                        echo _t('새로 IIS용 Rewrite 모듈을 설치하셨다면 <b>.htaccess 내용을 모듈 설정에 적용</b>해주십시오.<br />');
                                    }
                                    ?>
		<?php 
                                    echo '<li style="color:red">', _t('보안 관련 안내'), ': ', '<br /><span class="instruction">', _t('보안을 위하여 설치때 필요했던 권한 중 일부를 제거해주세요. FTP 프로그램으로 권한을 수정하시거나 다음의 명령을 터미널에 붙여 넣으시면 됩니다'), '<br />', 'chmod 0755 ' . $root, '</span></li>';
                                    ?>
        <?php 
                                    echo _t('텍스트큐브 관리 툴로 로그인 하신 후 필요사항을 수정해 주십시오.');
                                    ?>
<br />
        <?php 
                                    echo _t('텍스트큐브를 이용해 주셔서 감사합니다.');
                                    ?>
      </p>
    </div>
  </div>
<?php 
                                } else {
                                    if ($step == 204) {
                                        ?>
  <input type="hidden" name="step" value="4" />
  <input type="hidden" name="mode" value="<?php 
                                        echo $_POST['mode'];
                                        ?>
" />
  <input type="hidden" name="dbms" value="<?php 
                                        echo isset($_POST['dbms']) ? $_POST['dbms'] : '';
                                        ?>
" />
  <input type="hidden" name="dbServer" value="<?php 
                                        echo isset($_POST['dbServer']) ? $_POST['dbServer'] : '';
                                        ?>
" />
  <input type="hidden" name="dbPort" value="<?php 
                                        echo isset($_POST['dbPort']) ? $_POST['dbPort'] : '';
                                        ?>
" />
  <input type="hidden" name="dbName" value="<?php 
                                        echo isset($_POST['dbName']) ? $_POST['dbName'] : '';
                                        ?>
" />
  <input type="hidden" name="dbUser" value="<?php 
                                        echo isset($_POST['dbUser']) ? $_POST['dbUser'] : '';
                                        ?>
" />
  <input type="hidden" name="dbPassword" value="<?php 
                                        echo isset($_POST['dbPassword']) ? htmlspecialchars($_POST['dbPassword']) : '';
                                        ?>
" />
  <div id="inner">
    <h2><span class="step"><?php 
                                        echo _f('%1단계', 4);
                                        ?>
</span> : <?php 
                                        echo _t('삭제하고자 하는 테이블을 선택하여 주십시오.');
                                        ?>
</h2>
    <div id="userinput">
    <table id="info">
      <tr>
        <th><?php 
                                        echo _t('식별자');
                                        ?>
</th>
        <th><?php 
                                        echo _t('버전');
                                        ?>
</th>
        <th><?php 
                                        echo _t('테이블');
                                        ?>
</th>
 	    <th></th>
     </tr>
<?php 
                                        $tables = array();
                                        $ckeckedString = 'checked ';
                                        if ($result = POD::tableList()) {
                                            foreach ($result as $table) {
                                                //$table = $table[0];
                                                $entriesMatched = preg_match('/Entries$/', $table);
                                                if ($entriesMatched && checkTables('2.0', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                    ?>
      <tr>
        <th><?php 
                                                    echo $prefix;
                                                    ?>
</th>
        <th>2.0</th>
        <td><?php 
                                                    echo implode(', ', getTables('2.0', $prefix));
                                                    ?>
</td>
	    <th><input type="radio" name="target" value="2.0_<?php 
                                                    echo $prefix;
                                                    ?>
" <?php 
                                                    echo $ckeckedString;
                                                    ?>
/></th>
      </tr>
<?php 
                                                    $ckeckedString = '';
                                                } else {
                                                    if ($entriesMatched && checkTables('1.9', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                        ?>
      <tr>
        <th><?php 
                                                        echo $prefix;
                                                        ?>
</th>
        <th>1.9</th>
        <td><?php 
                                                        echo implode(', ', getTables('1.9', $prefix));
                                                        ?>
</td>
	    <th><input type="radio" name="target" value="1.9_<?php 
                                                        echo $prefix;
                                                        ?>
" <?php 
                                                        echo $ckeckedString;
                                                        ?>
/></th>
      </tr>
<?php 
                                                        $ckeckedString = '';
                                                    } else {
                                                        if ($entriesMatched && checkTables('1.8', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                            ?>
      <tr>
        <th><?php 
                                                            echo $prefix;
                                                            ?>
</th>
        <th>1.8</th>
        <td><?php 
                                                            echo implode(', ', getTables('1.8', $prefix));
                                                            ?>
</td>
	    <th><input type="radio" name="target" value="1.8_<?php 
                                                            echo $prefix;
                                                            ?>
" <?php 
                                                            echo $ckeckedString;
                                                            ?>
/></th>
      </tr>
<?php 
                                                            $ckeckedString = '';
                                                        } else {
                                                            if ($entriesMatched && checkTables('1.7', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                ?>
      <tr>
        <th><?php 
                                                                echo $prefix;
                                                                ?>
</th>
        <th>1.7</th>
        <td><?php 
                                                                echo implode(', ', getTables('1.7', $prefix));
                                                                ?>
</td>
	    <th><input type="radio" name="target" value="1.7_<?php 
                                                                echo $prefix;
                                                                ?>
" <?php 
                                                                echo $ckeckedString;
                                                                ?>
/></th>
      </tr>
<?php 
                                                                $ckeckedString = '';
                                                            } else {
                                                                if ($entriesMatched && checkTables('1.6', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                    ?>
      <tr>
        <th><?php 
                                                                    echo $prefix;
                                                                    ?>
</th>
        <th>1.6</th>
        <td><?php 
                                                                    echo implode(', ', getTables('1.6', $prefix));
                                                                    ?>
</td>
	    <th><input type="radio" name="target" value="1.6_<?php 
                                                                    echo $prefix;
                                                                    ?>
" <?php 
                                                                    echo $ckeckedString;
                                                                    ?>
/></th>
      </tr>
<?php 
                                                                    $ckeckedString = '';
                                                                } else {
                                                                    if ($entriesMatched && checkTables('1.5', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                        ?>
      <tr>
        <th><?php 
                                                                        echo $prefix;
                                                                        ?>
</th>
        <th>1.5</th>
        <td><?php 
                                                                        echo implode(', ', getTables('1.5', $prefix));
                                                                        ?>
</td>
	    <th><input type="radio" name="target" value="1.5_<?php 
                                                                        echo $prefix;
                                                                        ?>
" <?php 
                                                                        echo $ckeckedString;
                                                                        ?>
/></th>
      </tr>
<?php 
                                                                        $ckeckedString = '';
                                                                    } else {
                                                                        if ($entriesMatched && checkTables('1.1', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                            ?>
      <tr>
        <th><?php 
                                                                            echo $prefix;
                                                                            ?>
</th>
        <th>1.1</th>
        <td><?php 
                                                                            echo implode(', ', getTables('1.1', $prefix));
                                                                            ?>
</td>
	    <th><input type="radio" name="target" value="1.1_<?php 
                                                                            echo $prefix;
                                                                            ?>
" <?php 
                                                                            echo $ckeckedString;
                                                                            ?>
/></th>
      </tr>
<?php 
                                                                            $ckeckedString = '';
                                                                        } else {
                                                                            if ($entriesMatched && checkTables('1.0.2', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                                ?>
      <tr>
        <th><?php 
                                                                                echo $prefix;
                                                                                ?>
</th>
        <th>1.0.2</th>
        <td><?php 
                                                                                echo implode(', ', getTables('1.0.2', $prefix));
                                                                                ?>
</td>
	    <th><input type="radio" name="target" value="1.0.2_<?php 
                                                                                echo $prefix;
                                                                                ?>
" <?php 
                                                                                echo $ckeckedString;
                                                                                ?>
/></th>
      </tr>
<?php 
                                                                                $ckeckedString = '';
                                                                            } else {
                                                                                if ($entriesMatched && checkTables('1.0.0', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                                    ?>
      <tr>
        <th><?php 
                                                                                    echo $prefix;
                                                                                    ?>
</th>
        <th>1.0.0</th>
        <td><?php 
                                                                                    echo implode(', ', getTables('1.0.0', $prefix));
                                                                                    ?>
</td>
	    <th><input type="radio" name="target" value="1.0.0_<?php 
                                                                                    echo $prefix;
                                                                                    ?>
" <?php 
                                                                                    echo $ckeckedString;
                                                                                    ?>
/></th>
      </tr>
<?php 
                                                                                    $ckeckedString = '';
                                                                                } else {
                                                                                    if ($entriesMatched && checkTables('1.0.b2', $prefix = substr($table, 0, strlen($table) - 7))) {
                                                                                        ?>
      <tr>
        <th><?php 
                                                                                        echo $prefix;
                                                                                        ?>
</th>
        <th>1.0 Beta 2</th>
        <td><?php 
                                                                                        echo implode(', ', getTables('1.0.b2', $prefix));
                                                                                        ?>
</td>
	    <th><input type="radio" name="target" value="1.0.b2_<?php 
                                                                                        echo $prefix;
                                                                                        ?>
" <?php 
                                                                                        echo $ckeckedString;
                                                                                        ?>
/></th>
      </tr>
<?php 
                                                                                        $ckeckedString = '';
                                                                                    } else {
                                                                                        if (preg_match('/^t3_(.*)_10ofmg$/', $table) && checkTables('0.97', $prefix = substr($table, 3, strlen($table) - 10))) {
                                                                                            ?>
      <tr>
        <th><?php 
                                                                                            echo $prefix;
                                                                                            ?>
</th>
        <th>0.97 (Classic)</th>
        <td><?php 
                                                                                            echo implode(', ', getTables('0.97', $prefix));
                                                                                            ?>
</td>
	    <th><input type="radio" name="target" value="0.97_<?php 
                                                                                            echo $prefix;
                                                                                            ?>
" <?php 
                                                                                            echo $ckeckedString;
                                                                                            ?>
/></th>
      </tr>
<?php 
                                                                                            $ckeckedString = '';
                                                                                        } else {
                                                                                            if (preg_match('/^t3_(.*)_ct1$/', $table) && checkTables('0.96', $prefix = substr($table, 3, strlen($table) - 7))) {
                                                                                                ?>
      <tr>
        <th><?php 
                                                                                                echo $prefix;
                                                                                                ?>
</th>
        <th>0.96x</th>
        <td><?php 
                                                                                                echo implode(', ', getTables('0.96', $prefix));
                                                                                                ?>
</td>
	    <th><input type="radio" name="target" value="0.96_<?php 
                                                                                                echo $prefix;
                                                                                                ?>
" <?php 
                                                                                                echo $ckeckedString;
                                                                                                ?>
/></th>
      </tr>
<?php 
                                                                                                $ckeckedString = '';
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        ?>
    </table>
    </div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                                        echo _t('이전');
                                        ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                                        echo _t('이전');
                                        ?>
" /></a>
    <a href="#" onclick="if (confirm('<?php 
                                        echo _t('삭제하시겠습니까?');
                                        ?>
') && confirm('<?php 
                                        echo _t('정말 삭제하시겠습니까?');
                                        ?>
')) next(); return false;" title="<?php 
                                        echo _t('다음');
                                        ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                                        echo _t('다음');
                                        ?>
" /></a>
  </div>
  </div>
<?php 
                                    } else {
                                        if ($step == 205) {
                                            ?>
  <input type="hidden" name="step" value="1" />
  <div id="inner">
    <h2><span class="step"><?php 
                                            echo _f('%1단계', 5);
                                            ?>
</span> : <?php 
                                            echo _t('선택된 테이블을 삭제하고 있습니다.');
                                            ?>
</h2>
    <div id="userinput">
    <table id="info">
      <tr>
        <th><?php 
                                            echo _t('식별자');
                                            ?>
</th>
        <th><?php 
                                            echo _t('버전');
                                            ?>
</th>
        <th><?php 
                                            echo _t('테이블');
                                            ?>
</th>
     </tr>
<?php 
                                            list($version, $prefix) = explode('_', $_POST['target'], 2);
                                            $result = false;
                                            if (checkTables($version, $prefix)) {
                                                ?>
      <tr>
        <th><?php 
                                                echo $prefix;
                                                ?>
</th>
        <th><?php 
                                                echo $version;
                                                ?>
</th>
        <td><?php 
                                                echo implode(', ', getTables($version, $prefix));
                                                ?>
</td>
      </tr>
<?php 
                                                $result = @POD::query('DROP TABLE ' . implode(', ', getTables($version, $prefix)));
                                            }
                                            ?>
    </table>
	<p><?php 
                                            echo $result ? _t('삭제하였습니다.') : '<span style="color:red">' . _t('삭제하지 못했습니다.') . '</span>';
                                            ?>
</p>
    </div>
  <div id="navigation">
    <a href="#" onclick="window.history.back()" title="<?php 
                                            echo _t('이전');
                                            ?>
"><img src="./resources/style/setup/image/icon_prev.gif" width="74" height="24" alt="<?php 
                                            echo _t('이전');
                                            ?>
" /></a>
    <a href="#" onclick="next(); return false;" title="<?php 
                                            echo _t('다음');
                                            ?>
"><img src="./resources/style/setup/image/icon_next.gif" width="74" height="24" alt="<?php 
                                            echo _t('다음');
                                            ?>
" /></a>
  </div>
  </div>
<?php 
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Example #9
0
echo _f('이 블로그에는 총 %1개의 글이 있습니다.', $numberOfEntries);
?>
</li>
                                    <li><?php 
echo _f('이 블로그에는 총 %1개의 걸린글(트랙백)이 있습니다.', $numberOfTrackbacks);
?>
</li>
                                    <li><?php 
echo _f('이 블로그에는 총 %1개의 댓글이 있습니다.', $numberOfComments);
?>
</li>
                                    <li><?php 
if (empty($attachmentSum)) {
    echo _t('이 블로그에는 첨부파일이 없습니다.');
} else {
    echo _f('이 블로그가 사용중인 첨부파일의 총 용량은 %1입니다.', Utils_Misc::getSizeHumanReadable($attachmentSum));
}
?>
</li>
                                </ul>
							</div>
								
							<div id="team-member-list" class="container">
								<h4><span class="text"><?php 
echo _t('팀블로그 멤버 목록');
?>
</span></h4>
								
								<table class="data-inbox">
									<thead>
										<tr>
Example #10
0
 function resizeImageToContent($property, $originSrc, $imageWidth)
 {
     if (!is_readable($originSrc)) {
         return array($property, false);
     }
     list($originWidth, $originHeight, $type, $attr) = getimagesize($originSrc);
     $attributes = Utils_Misc::getAttributesFromString($property, false);
     // 단위 변환.
     $onclickFlag = false;
     if (array_key_exists('width', $attributes)) {
         if (preg_match('/(.+)(%?)/', $attributes['width'], $matches)) {
             if ($matches[2] == '%') {
                 $attributes['width'] = round($originWidth * $matches[1] / 100);
             } else {
                 $attributes['width'] = intval($matches[1]);
             }
         }
     }
     if (array_key_exists('height', $attributes)) {
         if (preg_match('/(.+)(%?)/', $attributes['height'], $matches)) {
             if ($matches[2] == '%') {
                 $attributes['height'] = round($originHeight * $matches[1] / 100);
             } else {
                 $attributes['height'] = intval($matches[1]);
             }
         }
     }
     // 가로, 세로 어느 쪽이든 0이면 이미지는 표시되지 않음. 따라서 계산할 필요 없음.
     if (isset($attributes['width']) && $attributes['width'] <= 0 || isset($attributes['height']) && $attributes['height'] <= 0) {
         return array($property, false);
     }
     // 가로만 지정된 이미지의 경우.
     if (isset($attributes['width']) && !isset($attributes['height'])) {
         // 비어있는 세로를 가로의 크기를 이용하여 계산.
         $attributes['height'] = floor($originHeight * $attributes['width'] / $originWidth);
         // 세로만 지정된 이미지의 경우.
     } else {
         if (!isset($attributes['width']) && isset($attributes['height'])) {
             // 비어있는 가로를 세로의 크기를 이용하여 계산.
             $attributes['width'] = floor($originWidth * $attributes['height'] / $originHeight);
             // 둘 다 지정되지 않은 이미지의 경우.
         } else {
             if (!isset($attributes['width']) && !isset($attributes['height'])) {
                 // 둘 다 비어 있을 경우는 오리지널 사이즈로 대치.
                 $attributes['width'] = $originWidth;
                 $attributes['height'] = $originHeight;
             }
         }
     }
     if ($attributes['width'] > $imageWidth) {
         $attributes['height'] = floor($attributes['height'] * $imageWidth / $attributes['width']);
         $attributes['width'] = $imageWidth;
     }
     if ($attributes['width'] < $originWidth || $attributes['height'] < $originHeight) {
         $onclickFlag = true;
     } else {
         $onclickFlag = false;
     }
     $properties = array();
     ksort($attributes);
     foreach ($attributes as $key => $value) {
         array_push($properties, "{$key}=\"{$value}\"");
     }
     return array(implode(' ', $properties), $onclickFlag);
 }
Example #11
0
function refererkeyword()
{
    $context = Model_Context::getInstance();
    $data = $context->getProperty('plugin.config');
    $showURL = 0;
    $limitRank = 5;
    $Filtering = array();
    if (!is_null($data)) {
        $showURL = $data['showURL'];
        $limitRank = $data['limitRank'];
        $Filtering = preg_split("/[\\s,]+/", $data['WordFiltering']);
    }
    if (!empty($_POST['showURL'])) {
        $showURL = $_POST['showURL'];
    }
    if (!empty($_POST['showKeywordlistLight'])) {
        $limitRank = $_POST['showKeywordlistLight'];
    }
    $refereres = Statistics::getRefererLogs();
    $keywordlist = array();
    $wordlist = array();
    $record = array();
    $refererURL = array();
    $totalpassedkeyword = 0;
    for ($i = 0; $i < sizeof($refereres); $i++) {
        $record = $refereres[$i];
        if ($i == 0) {
            $referredend = $record['referred'];
        }
        $keyword = "";
        $passthiskeyword = 0;
        list($keyword, ) = bringSearchWord($record['url'], $record['host']);
        foreach ($Filtering as $FilterWord) {
            if (strpos($keyword, $FilterWord) !== false) {
                $passthiskeyword = 1;
                $totalpassedkeyword++;
                break 1;
            }
        }
        if ($passthiskeyword == 0) {
            if (array_key_exists($keyword, $keywordlist)) {
                $refererURL[$keyword][$keywordlist[$keyword]] = $record['url'];
                $keywordlist[$keyword]++;
            } elseif ($keyword) {
                $keywordlist[$keyword] = 1;
                $refererURL[$keyword][0] = $record['url'];
            }
            $word = explode(" ", $keyword);
            foreach ($word as $maira) {
                if (array_key_exists($maira, $wordlist)) {
                    $wordlist[$maira]++;
                } elseif ($maira) {
                    $wordlist[$maira] = 1;
                }
            }
        }
    }
    $referredstart = array_key_exists('referred', $record) ? $record['referred'] : null;
    ?>
    <h2 class="caption"><span
            class="main-text"><?php 
    echo _t('리퍼러 검색어 통계') . " (" . Timestamp::formatDate($referredstart) . " ~ " . Timestamp::formatDate($referredend) . ")";
    ?>
</span>
    </h2>

    <div id="statistics-counter-inbox" class="data-inbox">
        <div class="title">
            <span class="label"><span class="text"><?php 
    echo _t('총 검색어 개수');
    ?>
</span></span>
            <span class="divider"> : </span>
            <span id="total"><?php 
    echo count($keywordlist);
    ?>
</span>
            <span class="divider"> : </span>
            <span class="label"><span class="text"><?php 
    echo _t('총 리퍼러 개수');
    ?>
</span></span>
            <span class="divider"> : </span>
            <span id="total"><?php 
    echo sizeof($refereres);
    ?>
</span>
            <span class="divider"> : </span>
            <?php 
    if ($totalpassedkeyword > 0) {
        ?>
                <span class="label"><span class="text"><?php 
        echo _t('필터링된 리퍼러 개수');
        ?>
</span></span>
                <span class="divider"> : </span>
                <span id="total"><?php 
        echo $totalpassedkeyword;
        ?>
</span>
                <span class="divider"> : </span>
            <?php 
    }
    ?>
        </div>
        <form id="refererkeyword-option" class="part" method="post" action="<?php 
    echo $context->getProperty('plugin.uri.menu');
    ?>
">
            <div class="title">
                <span class="label"><?php 
    echo _t('검색어 순위 출력은');
    ?>
</span>
										<span class="label"><select name="showKeywordlistLight"
                                                                    onchange="document.getElementById('refererkeyword-option').submit()">
                                                <option
                                                    value="5"<?php 
    if ($limitRank == 5 || $limitRank == 0) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('5위까지만 출력합니다');
    ?>
</option>
                                                <option
                                                    value="10"<?php 
    if ($limitRank == 10) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('10위까지만 출력합니다');
    ?>
</option>
                                                <option
                                                    value="15"<?php 
    if ($limitRank == 15) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('15위까지만 출력합니다');
    ?>
</option>
                                                <option
                                                    value="3939"<?php 
    if ($limitRank == 3939) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('모든 순위를 출력합니다');
    ?>
</option>
                                            </select></span>
            </div>
            <div class="title">
                <span class="label"><span class="text"><?php 
    echo _t('각 검색어가 검출된 주소를');
    ?>
</span></span>
										<span class="label"><select name="showURL"
                                                                    onchange="document.getElementById('refererkeyword-option').submit()">
                                                <option
                                                    value="0"<?php 
    if ($showURL == 0 || $showURL == "") {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('출력하지 않습니다');
    ?>
</option>
                                                <option
                                                    value="1"<?php 
    if ($showURL == 1) {
        echo " selected=\"selected\"";
    }
    ?>
><?php 
    echo _t('출력합니다');
    ?>
</option>
                                            </select></span>

            </div>
        </form>
    </div>

    <hr class="hidden"/>

    <div id="part-statistics-cloud" class="part">
        <table class="data-inbox" cellspacing="0" cellpadding="0">
            <thead>
            <tr>
                <th class="site"><span class="text"><?php 
    echo _t('검색어에 주로 쓰인 단어');
    ?>
</span></th>
            </tr>
            </thead>
            <tbody>
            <tr class="even-line inactive-class">
                <td class="keywordcloud">
                    <?php 
    srand((double) microtime() * 1000000);
    $wordlist = array_sort($wordlist, 'desc');
    $original_wordlist = $wordlist;
    $wordkeys = array_keys($wordlist);
    $i = 0;
    $cloudstyle = array();
    foreach ($wordkeys as $wordwork) {
        if ($wordlist[$wordwork] < 2) {
            unset($wordlist[$wordwork]);
            unset($wordkeys[$i]);
            $cloudstyle[$i] = "cloud5";
            $i++;
            continue;
        }
        if ($wordlist[$wordwork] > 50) {
            $cloudstyle[$i] = "cloud1";
        } elseif ($wordlist[$wordwork] > 25) {
            $cloudstyle[$i] = "cloud2";
        } elseif ($wordlist[$wordwork] > 15) {
            $cloudstyle[$i] = "cloud3";
        } elseif ($wordlist[$wordwork] > 6) {
            $cloudstyle[$i] = "cloud4";
        } else {
            $cloudstyle[$i] = "cloud5";
        }
        $i++;
    }
    if (count($wordkeys) <= 10) {
        $wordlist = $original_wordlist;
        $wordkeys = array_keys($wordlist);
    }
    //shuffle ($wordkeys);
    $beforewordvalue = '';
    $wordrank = 0;
    for ($i = 0; $i < sizeof($wordlist); $i++) {
        $wordkey = $wordkeys[$i];
        $wordvalue = $wordlist[$wordkey];
        $wordkey = str_replace("\"", "&quot;", $wordkeys[$i]);
        if ($wordvalue != $beforewordvalue) {
            if ($wordrank == 15) {
                break;
            }
            $wordrank++;
            $beforewordvalue = $wordvalue;
        }
        $wordclassName = $i % 2 == 1 ? 'even-line' : 'odd-line';
        $wordclassName .= $i == sizeof($wordlist) - 1 ? ' last-line' : '';
        echo "<a class=\"" . $cloudstyle[$i] . "\">" . htmlspecialchars($wordkey) . "</a>&nbsp;&nbsp;";
    }
    ?>
                </td>
            </tr>
            </tbody>
        </table>
    </div>

    <hr class="hidden"/>


    <div id="part-statistics-log" class="part">
        <table class="data-inbox" cellspacing="0" cellpadding="0">
            <thead>
            <tr>
                <th class="number"><span class="text"><?php 
    echo _t('순위');
    ?>
</span></th>
                <th class="number"><span class="text"><?php 
    echo _t('개수');
    ?>
</span></th>
                <th class="searchwordtitle"><span class="text"><?php 
    echo _t('검색어명');
    ?>
</span></th>
            </tr>
            </thead>
            <tbody>
            <?php 
    $keywordlist = array_sort($keywordlist, 'desc');
    $keywordkeys = array_keys($keywordlist);
    $beforekeywordvalue = '';
    $rank = array();
    $samerank = 1;
    $rankcount = 0;
    // 머리가 나빠서 죄송합니다... orz
    for ($i = 0; $i < sizeof($keywordlist); $i++) {
        $keywordkey = $keywordkeys[$i];
        $keywordvalue = $keywordlist[$keywordkey];
        //	$keywordkey = str_replace("\"", "&quot;",$keywordkeys[$i]);
        if ($keywordvalue != $beforekeywordvalue) {
            $rankcount++;
            $rank[$i] = $rankcount;
            $beforekeywordvalue = $keywordvalue;
        } else {
            $rank[$i] = $rankcount;
        }
    }
    $eversamerankTotal = array_count_values($rank);
    $rankcount = 0;
    for ($i = 0; $i < sizeof($keywordlist); $i++) {
        $keywordkey = $keywordkeys[$i];
        $keywordvalue = $keywordlist[$keywordkey];
        //	$keywordkey = str_replace("\"", "&quot;",$keywordkeys[$i]);
        if ($keywordvalue != $beforekeywordvalue) {
            $rankcount++;
            $beforekeywordvalue = $keywordvalue;
            $samerank = 1;
        } else {
            $samerank++;
        }
        if ($limitRank != 3939) {
            if ($rankcount >= 6 && $limitRank == 5) {
                break;
            }
            if ($rankcount >= 11 && $limitRank == 10) {
                break;
            }
            if ($rankcount >= 16 && $limitRank == 15) {
                break;
            }
        }
        $RefererURLthiskeyword = $refererURL[$keywordkey];
        if ($eversamerankTotal[$rankcount] == 1) {
            $viewSameRank = '';
        } else {
            $viewSameRank = " (" . $samerank . "/" . $eversamerankTotal[$rankcount] . ")";
        }
        ?>
                <tr onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')">
                    <td class="rank"><?php 
        echo $rankcount . _t('위') . $viewSameRank;
        ?>
</td>
                    <td class="rank"><?php 
        echo $keywordvalue . _t('개');
        ?>
</td>
                    <td class="address"><?php 
        echo htmlspecialchars($keywordkey);
        ?>
</td>
                </tr>
                <?php 
        if ($showURL == 1) {
            $j = 0;
            foreach (array_unique($RefererURLthiskeyword) as $splitRefererURL) {
                $urlClassName = $j == sizeof(array_unique($RefererURLthiskeyword)) - 1 ? '' : 'noBorderBottom';
                list(, $decodeURL) = bringSearchWord($splitRefererURL);
                ?>
                        <tr>
                        <td class="<?php 
                echo $urlClassName;
                ?>
"></td>
                        <td class="<?php 
                echo $urlClassName;
                ?>
"></td>
                        <td class="refererurl">
                        <?php 
                echo "<a href=\"" . Utils_Misc::escapeJSInAttribute($splitRefererURL) . "\" onclick=\"window.open(this.href); return false;\">" . Utils_Unicode::lessenAsEm(htmlspecialchars($decodeURL), 90) . "</a>";
                $j++;
            }
        }
        ?>
                </td>
                </tr>
            <?php 
    }
    ?>
            </tbody>
        </table>
    </div>
    <div class="clear"></div>
<?php 
}
Example #12
0
function getAddAttachment($file)
{
    $context = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    Attachment::confirmFolder();
    if (empty($file['name']) || $file['error'] != 0) {
        return false;
    }
    $attachment = array();
    $attachment['ext'] = Utils_Misc::getFileExtension(Path::getBaseName($file['name']));
    $path = __TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/team";
    if (!is_dir($path)) {
        mkdir($path);
        if (!is_dir($path)) {
            return false;
        }
        @chmod($path, 0777);
    }
    do {
        $attachment['name'] = rand(1000000000, 9999999999) . "." . $attachment['ext'];
        $attachment['path'] = "{$path}/{$attachment['name']}";
    } while (file_exists($attachment['path']));
    if (!move_uploaded_file($file['tmp_name'], $attachment['path'])) {
        return false;
    }
    @chmod($attachment['path'], 0666);
    $pool->reset("TeamUserSettings");
    $pool->setQualifier("blogid", "eq", getBlogId());
    $pool->setQualifier("userid", "eq", getUserId());
    $tmpImage = $pool->getCell("image");
    $pool->reset("TeamUserSettings");
    $pool->setAttribute("image", $attachment['name'], true);
    $pool->setAttribute("updated", Timestamp::getUNIXtime());
    $pool->setQualifier("blogid", "eq", getBlogId());
    $pool->setQualifier("userid", "eq", getUserId());
    if (!$pool->update()) {
        @unlink($attachment['path']);
        $result = $context->getProperty("uri.service") . "/resources/image/spacer.gif";
    } else {
        $result = $context->getProperty("uri.service") . "/attach/" . getBlogId() . "/team/" . $attachment['name'];
    }
    if (!empty($tmpImage)) {
        @unlink($path . "/" . $tmpImage);
    }
    return $result;
}
Example #13
0
function copyAttachments($blogid, $originalEntryId, $targetEntryId)
{
    $path = __TEXTCUBE_ATTACH_DIR__ . "/{$blogid}";
    $attachments = getAttachments($blogid, $originalEntryId);
    if (empty($attachments)) {
        return true;
    }
    $pool = DBModel::getInstance();
    $pool->reset('Entries');
    $pool->setQualifier('blogid', 'equals', $blogid);
    $pool->setQualifier('id', 'equals', $originalEntryId);
    if (!$pool->getCell('id')) {
        return 2;
    }
    // original entry does not exists;
    $pool->setQualifier('id', 'equals', $targetEntryId);
    if (!$pool->getCell('id')) {
        return 3;
    }
    // target entry does not exists;
    foreach ($attachments as $attachment) {
        $extension = Utils_Misc::getFileExtension($attachment['label']);
        $originalPath = "{$path}/{$attachment['name']}";
        do {
            $attachment['name'] = rand(1000000000, 9999999999) . ".{$extension}";
            $attachment['path'] = "{$path}/{$attachment['name']}";
        } while (file_exists($attachment['path']));
        if (!copy($originalPath, $attachment['path'])) {
            return 4;
        }
        // copy failed.
        $pool->reset('Attachments');
        $pool->setAttribute('blogid', $blogid);
        $pool->setAttribute('parent', $targetEntryId);
        $pool->setAttribute('name', $attachment['name'], true);
        $pool->setAttribute('label', $attachment['label'], true);
        $pool->setAttribute('mime', $attachment['mime'], true);
        $pool->setAttribute('size', $attachment['size'], true);
        $pool->setAttribute('width', $attachment['width']);
        $pool->setAttribute('height', $attachment['height']);
        $pool->setAttribute('attached', Timestamp::getUNIXtime());
        $pool->setAttribute('downloads', 0);
        $pool->setAttribute('enclosure', 0);
        if (!$pool->insert()) {
            return false;
        }
    }
    return true;
}
Example #14
0
function GoogleMapUI_InsertMap()
{
    $context = Model_Context::getInstance();
    $config = $context->getProperty('plugin.config');
    $lat = $config['latitude'];
    $lng = $config['longitude'];
    $default_type = 'ROADMAP';
    $default_width = min(Utils_Misc::getContentWidth(), 500);
    $default_height = 400;
    $zoom = 10;
    _GMap_printHeaderForUI(_t('구글맵 삽입하기'), 'insert', $config['useSensor'] ? 'true' : 'false');
    ?>
	<div id="controls">
		<button id="toggleMarkerAddingMode"><?php 
    echo _t("마커 표시 모드");
    ?>
</button>
		<button id="doInsert"><?php 
    echo _t("본문에 삽입하기");
    ?>
</button>
	</div>
	<div style="text-align:center;">
		<div class="ui-widget-content" id="GoogleMapPreview" style="width:<?php 
    echo $default_width;
    ?>
px; height:<?php 
    echo $default_height;
    ?>
px; margin:0 auto;"></div>
	</div>
	<script type="text/javascript">
	//<![CDATA[
	GMapOnLoadCallbacks.push(function() {
		map = new google.maps.Map($('#GoogleMapPreview')[0], {
			'center':new google.maps.LatLng(<?php 
    echo $lat;
    ?>
, <?php 
    echo $lng;
    ?>
),
			'zoom': <?php 
    echo $zoom;
    ?>
,
			'mapTypeId': google.maps.MapTypeId.<?php 
    echo $default_type;
    ?>
,
			'mapTypeControl': true,
			'navigationControl': true,
			'scaleControl': true
		});
		google.maps.event.addListenerOnce(map, 'idle', initializeCustomizableMap);
	});
	//]]>
	</script>
	<h2><?php 
    echo _t("지도 검색");
    ?>
</h2>
	<div class="accordion-elem">
		<p><label><?php 
    echo _t("위치 검색");
    ?>
 : <input type="text" class="editControl" id="inputQuery" value="" /></label><button id="queryLocation"><?php 
    echo _t("찾기");
    ?>
</button></p>
	</div>
	<h2><?php 
    echo _t("기본 설정");
    ?>
</h2>
	<div class="accordion-elem">
		<p><label><?php 
    echo _t("가로");
    ?>
(px) : <input type="text" class="editControl" id="inputWidth" value="<?php 
    echo $default_width;
    ?>
" /></label></p>
		<p><label><?php 
    echo _t("세로");
    ?>
(px) : <input type="text" class="editControl" id="inputHeight" value="<?php 
    echo $default_height;
    ?>
" /></label></p>
		<p><button id="applyBasicSettings"><?php 
    echo _t("적용");
    ?>
</button></p>
	</div>
<?php 
    // TODO: 주소 추출 UI
    // - TODO: 포스트 내용 텍스트 얻어오기 및 주소 정보 추출
    _GMap_printFooterForUI('insert');
}
 static function getPagingView(&$paging, &$template, &$itemTemplate, $useCache = false, $mode = 'href')
 {
     $ctx = Model_Context::getInstance();
     if ($paging === false || empty($paging['page'])) {
         $paging['url'] = NULL;
         $paging['onclick'] = NULL;
         $paging['prefix'] = NULL;
         $paging['postfix'] = NULL;
         $paging['total'] = NULL;
         $paging['pages'] = 1;
         $paging['page'] = 1;
         $paging['next'] = NULL;
     }
     $url = str_replace('/%3F/', '/?/', URL::encode($paging['url'], $ctx->getProperty('service.useEncodedURL')));
     $prefix = $paging['prefix'];
     $postfix = isset($paging['postfix']) ? $paging['postfix'] : '';
     ob_start();
     if (isset($paging['first'])) {
         $itemView = "{$itemTemplate} <span class=\"interword\">...</span> ";
         Utils_Misc::dress('paging_rep_link_num', '<span>1</span>', $itemView, $useCache);
         Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$paging['first']}{$postfix}'", $itemView, $useCache);
         print $itemView;
     } else {
         if ($paging['page'] > 5) {
             $itemView = "{$itemTemplate} <span class=\"interword\">...</span> ";
             Utils_Misc::dress('paging_rep_link_num', '<span>1</span>', $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}1{$postfix}'", $itemView, $useCache);
             print $itemView;
         }
     }
     if (isset($paging['before'])) {
         $page = $paging['page'] - count($paging['before']);
     } else {
         $page = $paging['page'] < 5 ? 1 : $paging['page'] - 4;
     }
     if (isset($paging['before'])) {
         foreach ($paging['before'] as $value) {
             $itemView = $itemTemplate;
             Utils_Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$value}{$postfix}'", $itemView, $useCache);
             print $itemView;
             $page++;
         }
     } else {
         for ($i = 0; $i < 4 && $page < $paging['page']; $i++) {
             $itemView = $itemTemplate;
             Utils_Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$page}{$postfix}'", $itemView, $useCache);
             print $itemView;
             $page++;
         }
     }
     if ($page == $paging['page'] && $page <= $paging['pages']) {
         $itemView = $itemTemplate;
         Utils_Misc::dress('paging_rep_link_num', "<span class=\"selected\" >{$page}</span>", $itemView, $useCache);
         Utils_Misc::dress('paging_rep_link', '', $itemView, $useCache);
         print $itemView;
         $page++;
     }
     if (isset($paging['before'])) {
         foreach ($paging['after'] as $value) {
             $itemView = $itemTemplate;
             Utils_Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$value}{$postfix}'", $itemView, $useCache);
             print $itemView;
             $page++;
         }
     } else {
         for ($i = 0; $i < 4 && $page <= $paging['pages']; $i++) {
             $itemView = $itemTemplate;
             Utils_Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$page}{$postfix}'", $itemView, $useCache);
             print $itemView;
             $page++;
         }
     }
     if (isset($paging['last'])) {
         $itemView = " <span class=\"interword\">...</span> {$itemTemplate}";
         Utils_Misc::dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useCache);
         Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$paging['last']}{$postfix}'", $itemView, $useCache);
         print $itemView;
     } else {
         if ($paging['pages'] - $paging['page'] > 4) {
             $itemView = " <span class=\"interword\">...</span> {$itemTemplate}";
             Utils_Misc::dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useCache);
             Utils_Misc::dress('paging_rep_link', ($mode == 'href' ? "href='" : "href='#' onclick='") . "{$url}{$prefix}{$paging['pages']}{$postfix}'", $itemView, $useCache);
             print $itemView;
         }
     }
     $itemsView = ob_get_contents();
     ob_end_clean();
     $view = $template;
     Utils_Misc::dress('prev_page', isset($paging['prev']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"") . "{$url}{$prefix}{$paging['prev']}{$postfix}\" rel=\"prev\"" : '', $view, $useCache);
     Utils_Misc::dress('prev_page_title', isset($paging['prev_title']) ? $paging['prev_title'] : '', $view, $useCache);
     Utils_Misc::dress('paging_rep', $itemsView, $view, $useCache);
     Utils_Misc::dress('next_page', isset($paging['next']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"") . "{$url}{$prefix}{$paging['next']}{$postfix}\" rel=\"next\"" : '', $view, $useCache);
     Utils_Misc::dress('next_page_title', isset($paging['next_title']) ? $paging['next'] : '', $view, $useCache);
     Utils_Misc::dress('no_more_prev', isset($paging['prev']) ? '' : 'no-more-prev', $view, $useCache);
     Utils_Misc::dress('no_more_next', isset($paging['next']) ? '' : 'no-more-next', $view, $useCache);
     return $view;
 }
Example #16
0
function MT_Cover_getRemoteImageFilename($filename)
{
    $filename = md5($filename) . "." . Utils_Misc::getFileExtension($filename);
    return $filename;
}
Example #17
0
    } else {
        ?>
												<option value="<?php 
        echo $i;
        ?>
"><?php 
        echo $i;
        ?>
</option>
<?php 
    }
}
?>
											</select>
											<?php 
echo Utils_Misc::getArrayValue(explode('%1', _t('한 페이지에 글 %1건 표시')), 1) . CRLF;
?>
										</div>
									</div>
								</div>
							</form>

							<hr class="hidden" />

							<form id="search-form" class="data-subbox" method="post" action="<?php 
echo $context->getProperty('uri.blog');
?>
/owner/entry">
								<h2><?php 
echo _t('검색');
?>
Example #18
0
								</p>
							</div>
							<div id="DBImportDialog" class="dialog" style="position: absolute; display: none; z-index: 100;">
								<form id="dataImporter" method="post" action="<?php 
echo $context->getProperty('uri.blog');
?>
/owner/data/import" enctype="multipart/form-data" target="blackhole">
									<h3><?php 
echo _t('데이터 복원을 시작합니다');
?>
</h3>
									
									<div class="message-body">
										<div class="explain">
											<?php 
echo _f('이 계정의 업로드 허용 용량은 <em>%1</em> 바이트로 백업파일의 크기가 이를 초과하는 경우 <acronym title="File Transfer Protocol">FTP</acronym> 등으로 원하시는 사이트에 업로드하신 후 이 파일의 웹 주소를 입력해서 진행하십시오. 이 경우, 보안을 위해 복원이 끝나면 반드시 그 백업파일을 웹 상에서 지우실 것을 권장합니다.', Utils_Misc::getNumericValue(ini_get('post_max_size')) < Utils_Misc::getNumericValue(ini_get('upload_max_filesize')) ? ini_get('post_max_size') : ini_get('upload_max_filesize'));
?>
										</div>
<?php 
if ($backup) {
    ?>
										<p class="message">
											<?php 
    echo _f('서버에 <em>%1</em>에 저장된 백업파일이 있습니다.', Timestamp::format5($backup));
    ?>
										</p>
<?php 
}
?>
										<div class="selection">
<?php 
Example #19
0
function PN_Visitor_Default()
{
    global $pluginMenuURL, $pluginHandlerURL;
    $blogid = getBlogId();
    $stats = Statistics::getStatistics($blogid);
    $date = isset($_GET['date']) ? $_GET['date'] : date('Ym', strtotime("now"));
    ?>
<!-- This tab space below this line is inserted for the indentation of original admin page -->
						<script type="text/javascript">
							//<![CDATA[
<?php 
    if (Acl::check('group.owners')) {
        ?>
								function setTotalStatistics() {
									if (confirm("방문자의 수를 초기화하면 방문객의 수가 0이 됩니다.\n정말 초기화하시겠습니까?")) {
										var request = new HTTPRequest("GET", "<?php 
        echo $pluginHandlerURL;
        ?>
/PN_Visitor_Default_set&ajaxcall");
										request.onSuccess = function() {
											//document.getElementById("total").innerHTML = 0;
											window.location = '<?php 
        echo $pluginMenuURL;
        ?>
';
											return true;
										}
										request.onError = function() {
											alert("저장하지 못했습니다.");
											return false;
										}
										request.send();
									}
								}
<?php 
    }
    ?>
								
								function addCommas(nStr) {
									nStr += '';
									x = nStr.split('.');
									x1 = x[0];
									x2 = x.length > 1 ? '.' + x[1] : '';
									var rgx = /(\d+)(\d{3})/;
									while (rgx.test(x1)) {
										x1 = x1.replace(rgx, '$1' + ',' + '$2');
									}
									return x1 + x2;
								}
								
								window.addEventListener("load", execLoadFunction, false);
								
								function execLoadFunction() {
									tempDiv = document.createElement("DIV");
									tempDiv.style.clear = "both";
									document.getElementById("part-statistics-visitor").appendChild(tempDiv);
								}
							//]]>
						</script>
					 		
					 	<form method="post" action="<?php 
    echo $pluginHandlerURL;
    ?>
PN_Visitor_Default_set">
					 		<div id="part-statistics-visitor" class="part">
					 			<h2 class="caption"><span class="main-text">방문자 통계정보를 보여줍니다</span></h2>
					 			
						 		<div id="statistics-counter-inbox" class="data-inbox">
									<div class="title">
										<span class="label"><span class="text">현재까지의 방문자 수</span></span>
										<span class="divider"> : </span>
										<span id="total"><?php 
    echo number_format($stats['total']);
    ?>
</span>
									</div>
<?php 
    if (Acl::check('group.owners')) {
        ?>
									<a class="init-button button" href="<?php 
        echo $pluginHandlerURL;
        ?>
/PN_Visitor_Default_set" onclick="setTotalStatistics(); return false;"><span class="text">초기화</span></a>
<?php 
    }
    ?>
								</div>
							
								<hr class="hidden" />
								
								<table id="statistics-month-inbox" class="data-inbox" cellspacing="0" cellpadding="0">
									<thead>
										<tr>
											<th colspan="2"><span class="text">월별 방문자 수</span></th>
										</tr>
									</thead>
									<tbody>
<?php 
    $temp = Statistics::getMonthlyStatistics($blogid);
    for ($i = 0; $i < sizeof($temp); $i++) {
        $record = $temp[$i];
        $className = $i % 2 == 1 ? 'even-line' : 'odd-line';
        $className .= $i == sizeof($temp) - 1 ? ' last-line' : '';
        ?>
										<tr class="<?php 
        echo $className;
        ?>
 inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')" onclick="window.location.href='<?php 
        echo $pluginMenuURL;
        ?>
&amp;date=<?php 
        echo $record['datemark'];
        ?>
'">
											<td class="date"><a href="<?php 
        echo $pluginMenuURL;
        ?>
&amp;date=<?php 
        echo $record['datemark'];
        ?>
"><?php 
        echo Timestamp::formatDate2(Utils_Misc::getTimeFromPeriod($record['datemark']));
        ?>
</a></td>
											<td class="count"><a href="<?php 
        echo $pluginMenuURL;
        ?>
&amp;date=<?php 
        echo $record['datemark'];
        ?>
"><?php 
        echo $record['visits'];
        ?>
</a></td>
										</tr>
<?php 
    }
    ?>
									</tbody>
								</table>
								
								<hr class="hidden" />
								
								<table id="statistics-day-inbox" class="data-inbox" cellspacing="0" cellpadding="0">
									<thead>
										<tr>
											<th colspan="2"><span class="text">일별 방문자 수</span></th>
										</tr>
									</thead>
									<tbody>
<?php 
    if (isset($date)) {
        $temp = Statistics::getDailyStatistics($date);
        for ($i = 0; $i < sizeof($temp); $i++) {
            $record = $temp[$i];
            $className = $i % 2 == 1 ? 'even-line' : 'odd-line';
            $className .= $i == sizeof($temp) - 1 ? ' last-line' : '';
            ?>
										<tr class="<?php 
            echo $className;
            ?>
 inactive-class">
											<td class="date"><?php 
            echo Timestamp::formatDate(Utils_Misc::getTimeFromPeriod($record['datemark']));
            ?>
</td>
											<td class="count"><?php 
            echo $record['visits'];
            ?>
</td>
										</tr>
<?php 
        }
    }
    ?>
									</tbody>
								</table>
								
							</div>
						</form>
						
<?php 
}
Example #20
0
function PN_Referer_Default()
{
    global $pluginMenuURL, $pluginSelfParam;
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['page'])) {
        $_GET['page'] = $_POST['page'];
    }
    $page = Setting::getBlogSetting('RowsPerPageReferer', 20);
    if (empty($_POST['perPage'])) {
        $perPage = $page;
    } else {
        if ($page != $_POST['perPage']) {
            Setting::setBlogSetting('RowsPerPageReferer', $_POST['perPage']);
            $perPage = $_POST['perPage'];
        } else {
            $perPage = $_POST['perPage'];
        }
    }
    ?>
						<div id="part-statistics-rank" class="part">
							<h2 class="caption"><span class="main-text"><?php 
    echo _t("리퍼러 순위");
    ?>
</span></h2>
							
							<table class="data-inbox" cellspacing="0" cellpadding="0">
								<thead>
									<tr>
										<th class="number"><span class="text"><?php 
    echo _t("순위");
    ?>
</span></th>
										<th class="site"><span class="text"><?php 
    echo _t("리퍼러");
    ?>
</span></th>
									</tr>
								</thead>
								<tbody>
<?php 
    $temp = Statistics::getRefererStatistics(getBlogId());
    for ($i = 0; $i < count($temp); $i++) {
        $record = $temp[$i];
        $className = $i % 2 == 1 ? 'even-line' : 'odd-line';
        $className .= $i == sizeof($temp) - 1 ? ' last-line' : '';
        ?>
									<tr class="<?php 
        echo $className;
        ?>
 inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')">
										<td class="rank"><?php 
        echo $i + 1;
        ?>
.</td>
										<td class="site"><a href="http://<?php 
        echo Utils_Misc::escapeJSInAttribute($record['host']);
        ?>
" onclick="window.open(this.href); return false;"><?php 
        echo htmlspecialchars($record['host']);
        ?>
</a> <span class="count">(<?php 
        echo $record['count'];
        ?>
)</span></td>
									</tr>
<?php 
    }
    ?>
								</tbody>
							</table>
						</div>
						
						<hr class="hidden" />
						
						<form id="part-statistics-log" class="part" method="post" action="<?php 
    echo $pluginMenuURL;
    ?>
">
							<h2 class="caption"><span class="main-text"><?php 
    echo _t("리퍼러 로그");
    ?>
</span></h2>
							
							<table class="data-inbox" cellspacing="0" cellpadding="0">
								<thead>
									<tr>
										<th class="number"><span class="text">날짜</span></th>
										<th class="site"><span class="text">주소</span></th>
									</tr>
								</thead>
								<tbody>
<?php 
    $more = false;
    list($referers, $paging) = Statistics::getRefererLogsWithPage($_GET['page'], $perPage);
    for ($i = 0; $i < count($referers); $i++) {
        $record = $referers[$i];
        $className = $i % 2 == 1 ? 'even-line' : 'odd-line';
        $className .= $i == sizeof($referers) - 1 ? ' last-line' : '';
        ?>
									<tr class="<?php 
        echo $className;
        ?>
 inactive-class" onmouseover="rolloverClass(this, 'over')" onmouseout="rolloverClass(this, 'out')">
										<td class="date"><?php 
        echo Timestamp::formatDate($record['referred']);
        ?>
</td>
										<td class="address"><a href="<?php 
        echo Utils_Misc::escapeJSInAttribute($record['url']);
        ?>
" onclick="window.open(this.href); return false;" title="<?php 
        echo htmlspecialchars($record['url']);
        ?>
"><?php 
        echo fireEvent('ViewRefererURL', htmlspecialchars(Utils_Unicode::lessenAsEm($record['url'], 70)), $record);
        ?>
</a></td>
									</tr>
<?php 
    }
    ?>
								</tbody>
							</table>
							
							<div class="data-subbox">
								<div id="page-section" class="section">
									<div id="page-navigation">
										<span id="page-list">
<?php 
    $paging['prefix'] = $pluginSelfParam . '&page=';
    $pagingTemplate = '[##_paging_rep_##]';
    $pagingItemTemplate = '<a [##_paging_rep_link_##]>[[##_paging_rep_link_num_##]]</a>';
    echo str_repeat("\t", 8) . Paging::getPagingView($paging, $pagingTemplate, $pagingItemTemplate) . CRLF;
    ?>
										</span>
									</div>
									<div class="page-count">
										<?php 
    echo Utils_Misc::getArrayValue(explode('%1', '한 페이지에 목록 %1건 표시'), 0);
    ?>
										<select name="perPage" onchange="document.getElementById('part-statistics-log').submit()">					
<?php 
    for ($i = 10; $i <= 30; $i += 5) {
        if ($i == $perPage) {
            ?>
											<option value="<?php 
            echo $i;
            ?>
" selected="selected"><?php 
            echo $i;
            ?>
</option>
<?php 
        } else {
            ?>
											<option value="<?php 
            echo $i;
            ?>
"><?php 
            echo $i;
            ?>
</option>
<?php 
        }
    }
    ?>
										</select>
										<?php 
    echo Utils_Misc::getArrayValue(explode('%1', '한 페이지에 목록 %1건 표시'), 1);
    ?>
									</div>
								</div>
							</div>
						</form>
						
						<div class="clear"></div>
<?php 
}
Example #21
0
function getPrettyAttachmentLabel($attachment)
{
    if (strpos($attachment['mime'], 'image') === 0) {
        return "{$attachment['label']} ({$attachment['width']}x{$attachment['height']} / " . Utils_Misc::getSizeHumanReadable($attachment['size']) . ')';
    } else {
        if (strpos($attachment['mime'], 'audio') !== 0 && strpos($attachment['mime'], 'video') !== 0) {
            if ($attachment['downloads'] > 0) {
                return "{$attachment['label']} (" . Utils_Misc::getSizeHumanReadable($attachment['size']) . ' / ' . _t('다운로드') . ':' . $attachment['downloads'] . ')';
            }
        }
    }
    return "{$attachment['label']} (" . Utils_Misc::getSizeHumanReadable($attachment['size']) . ')';
}
Example #22
0
 static function getFileListByRegExp($path, $pattern, $deepScan = false)
 {
     $path = preg_replace('@/$@', '', $path);
     $fileList = array();
     if ($dirHandle = @dir($path)) {
         while (false !== ($tempSrc = $dirHandle->read())) {
             if ($tempSrc == '.' || $tempSrc == '..' || preg_match('@^\\.@', $tempSrc)) {
                 continue;
             }
             if (is_dir($path . '/' . $tempSrc)) {
                 $tempList = Utils_Misc::getFileListByRegExp($path . '/' . $tempSrc, $pattern, $deepScan);
                 if (is_array($tempList)) {
                     $fileList = array_merge($fileList, $tempList);
                 }
             }
             if (is_file($path . '/' . $tempSrc)) {
                 if ($pattern == '' || preg_match("@{$pattern}@", $tempSrc)) {
                     array_push($fileList, $path . '/' . $tempSrc);
                 }
             }
         }
         $dirHandle->close();
     }
     return $fileList;
 }
Example #23
0
<?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)
require ROOT . '/library/preprocessor.php';
// get style files list in current skin.
$styleFileList = array();
$tempStyleFileList = Utils_Misc::getFileListByRegExp(getSkinPath($skinSetting['skin']), '\\.css$', true);
foreach ($tempStyleFileList as $styleFile) {
    $styleFileList[basename($styleFile)] = $styleFile;
}
@ksort($styleFileList);
unset($tempStyleFileList);
// set current css.
if (isset($_GET['style'])) {
    $currentStyleFile = $_GET['style'];
} else {
    $tempKeys = array_keys($styleFileList);
    $currentStyleFile = str_replace(getSkinPath($skinSetting['skin']) . '/', '', $styleFileList[$tempKeys[0]]);
}
$skin = '';
if (file_exists(getSkinPath($skinSetting['skin']) . "/skin.html")) {
    $skin = @file_get_contents(getSkinPath($skinSetting['skin']) . "/skin.html");
}
$skin_keyword = '';
if (file_exists(getSkinPath($skinSetting['skin']) . "/skin_keyword.html")) {
    $skin_keyword = @file_get_contents(getSkinPath($skinSetting['skin']) . "/skin_keyword.html");
}
$htmlFilePerms = preg_replace('@^[0-9]{2}|[0-9]{2}$@', '', strrev(decoct(fileperms(getSkinPath($skinSetting['skin']) . "/skin.html"))));
$styleFilePerms = preg_replace('@^[0-9]{2}|[0-9]{2}$@', '', $temp = strrev(decoct(fileperms(getSkinPath($skinSetting['skin']) . "/" . $currentStyleFile))));
Example #24
0
    if (!empty($_GET['name1']) && !empty($_GET['name2'])) {
        $depth = 2;
    } else {
        if (!empty($_GET['name1']) && empty($_GET['name2'])) {
            $depth = 1;
        } else {
            $depth = 0;
        }
    }
}
if (empty($_GET['entries']) || $_GET['entries'] == 0) {
    $entries = 0;
} else {
    $entries = $_GET['entries'];
}
if (!empty($_POST['newCategory']) && Utils_Misc::isSpace($_POST['newCategory']) || !empty($_POST['modifyCategoryName']) && Utils_Misc::isSpace($_POST['modifyCategoryName'])) {
    $history = '';
    $errorMessage = _t('공백문자는 카테고리 이름으로 사용할 수 없습니다');
} elseif (!empty($_POST['newCategory']) && strpos($_POST['newCategory'], '/') !== false || !empty($_POST['modifyCategoryName']) && strpos($_POST['modifyCategoryName'], '/') !== false) {
    $history = '';
    $errorMessage = _t('슬래시가 들어간 카테고리 이름은 사용할 수 없습니다');
    /*} elseif ((!empty($_POST['newCategory']) && strpos($_POST['newCategory'], '&') !== false) || (!empty($_POST['modifyCategoryName']) && strpos($_POST['modifyCategoryName'], '&') !== false)) {
    	$history = '';
    	$errorMessage = _t('앰퍼샌드(&)가 들어간 카테고리 이름은 사용할 수 없습니다');*/
} elseif (!empty($_POST['newCategory']) && strpos($_POST['newCategory'], '?') !== false || !empty($_POST['modifyCategoryName']) && strpos($_POST['modifyCategoryName'], '?') !== false) {
    $history = '';
    $errorMessage = _t('물음표가 들어간 카테고리 이름은 사용할 수 없습니다');
} elseif (!empty($_POST['newCategory'])) {
    $history = addCategory($blogid, $selected == 0 ? null : $_POST['id'], trim($_POST['newCategory'])) ? 'document.getElementById("newCategory").select();' : '';
    if (empty($history)) {
        $errorMessage = _t('같은 이름의 카테고리가 이미 존재합니다');