Пример #1
0
 public function test3()
 {
     $URL = new URL("http://abc.com/目录1/目录2/index.php?cat=科技&rate= 非常好");
     $URL->encode();
     $newUrl = $URL->build();
     echo $newUrl;
     //http://abc.com/%E7_%AE%E5%BD_1/%E7_%AE%E5%BD_2/index.php?cat=%E7%A7_%E6__&rate=+%E9__%E5%B8%B8%E5%A5%BD
 }
Пример #2
0
function KeywordUI_bindTag($target, $mother)
{
    global $blogURL, $pluginURL, $configVal;
    requireModel('blog.keyword');
    $blogid = getBlogId();
    if (isset($mother) && isset($target)) {
        $tagsWithKeywords = array();
        $keywordNames = getKeywordNames($blogid);
        foreach ($target as $tag => $tagLink) {
            if (in_array($tag, $keywordNames) == true) {
                $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>";
            } else {
                $tagsWithKeywords[$tag] = $tagLink;
            }
        }
        $target = $tagsWithKeywords;
    }
    return $target;
}
Пример #3
0
function KeywordUI_bindTag($target, $mother)
{
    $context = Model_Context::getInstance();
    importlib('model.blog.keyword');
    $blogid = getBlogId();
    $blogURL = $context->getProperty("uri.blog");
    $pluginURL = $context->getProperty("plugin.uri");
    if (isset($mother) && isset($target)) {
        $tagsWithKeywords = array();
        $keywordNames = getKeywordNames($blogid);
        foreach ($target as $tag => $tagLink) {
            if (in_array($tag, $keywordNames) == true) {
                $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>";
            } else {
                $tagsWithKeywords[$tag] = $tagLink;
            }
        }
        $target = $tagsWithKeywords;
    }
    return $target;
}
Пример #4
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)
if (!empty($listView)) {
    dress('list', $listView, $view);
} else {
    if (isset($list) && isset($skin)) {
        $listView = $skin->list;
        $itemsView = '';
        foreach ($list['items'] as $item) {
            $author = User::getName($item['userid']);
            $itemsView .= str_replace(array('[##_list_rep_regdate_##]', '[##_list_rep_name_##]', '[##_list_rep_author_##]', '[##_list_rep_link_##]', '[##_list_rep_title_##]', '[##_list_rep_rp_cnt_##]'), array(fireEvent('ViewListDate', Timestamp::formatDate($item['published']), $item['published']), fireEvent('ViewListName', htmlspecialchars($author)), fireEvent('ViewListName', htmlspecialchars($author)), (!empty($skinSetting['showListWithTotalEntries']) ? "#entry_" . $item['id'] : $context->getProperty('uri.blog') . "/" . ($context->getProperty('blog.useSloganOnPost') ? 'entry/' . URL::encode($item['slogan'], $service['useEncodedURL']) : $item['id'])) . (isset($list['category']) ? '?category=' . $list['category'] : ''), fireEvent('ViewListTitle', htmlspecialchars($item['title'])), $item['comments'] > 0 ? "{$item['comments']}" : ''), $skin->listItem);
        }
        dress('list_rep', $itemsView, $listView);
        dress('list_conform', fireEvent('ViewListHeadTitle', htmlspecialchars($list['title'])), $listView);
        dress('list_count', isset($list['count']) ? $list['count'] : '0', $listView);
        dress('list_rss_url', $context->getProperty('uri.default') . '/rss/' . $listFeedURL, $listView);
        dress('list_atom_url', $context->getProperty('uri.default') . '/atom/' . $listFeedURL, $listView);
        $listView = fireEvent('ViewList', $listView, $list);
        if (empty($entries)) {
            $listView = $listView . CRLF . '[##_paging_list_##]';
        }
        dress('list', $listView, $view);
        if (isset($cache)) {
            $cache->contents = $listView;
            $cache->dbContents = $paging;
            $cache->update();
        }
    }
Пример #5
0
function encode_url($url)
{
    depricated_warning();
    return URL::encode($url);
}
Пример #6
0
function pretty_dress($view)
{
    global $blogid, $blog, $database, $service, $stats, $skinSetting;
    /* local static */
    global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry;
    global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList;
    if (isset($_REQUEST['safe'])) {
        // safe mode
        return '<div class="sidebar-element-safebox">&hellip;</div>';
    }
    if (isset($_REQUEST['tag'])) {
        // safe mode
        return '<div class="sidebar-element-safebox"><p>' . nl2br(htmlspecialchars($view, ENT_QUOTES)) . '</p></div>';
    }
    $writer = POD::queryCell("SELECT name FROM {$database['prefix']}Users WHERE userid = " . User::getBlogOwner($blogid));
    $pageTitle = _t('페이지 제목');
    dress('page_title', htmlspecialchars($pageTitle), $view);
    dress('blogger', htmlspecialchars($writer), $view);
    dress('title', htmlspecialchars($context->getProperty('blog.title')), $view);
    dress('desc', htmlspecialchars($context->getProperty('blog.description')), $view);
    if (!empty($context->getProperty('blog.logo'))) {
        dress('image', "{$context->getProperty('service.path')}/attach/{$blogid}/{$context->getProperty('blog.logo')}", $view);
    } else {
        dress('image', "{$context->getProperty('service.path')}/resources/image/spacer.gif", $view);
    }
    dress('blog_link', "{$context->getProperty}('uri.blog')/", $view);
    dress('keylog_link', "{$context->getProperty}('uri.blog')/keylog", $view);
    dress('localog_link', "{$context->getProperty}('uri.blog')/location", $view);
    dress('taglog_link', "{$context->getProperty}('uri.blog')/tag", $view);
    dress('guestbook_link', "{$context->getProperty}('uri.blog')/guestbook", $view);
    list($view, $searchView) = Skin::cutSkinTag($view, 'search');
    dress('search_name', 'search', $searchView);
    dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView);
    dress('search_onclick_submit', 'searchBlog()', $searchView);
    dress('search', '<form id="TTSearchForm" action="' . $context->getProperty('uri.blog') . '/search/" method="get" onsubmit="return searchBlog()">' . $searchView . '</form>', $view);
    dress('category', $pd_category, $view);
    dress('category_list', $pd_categoryXhtml, $view);
    dress('count_total', $stats['total'], $view);
    dress('count_today', $stats['today'], $view);
    dress('count_yesterday', $stats['yesterday'], $view);
    list($view, $archiveView) = Skin::cutSkinTag($view, 'archive_rep');
    dress('archive_rep', getArchivesView($pd_archive, $archiveView), $view);
    dress('calendar', $pd_calendar, $view);
    list($view, $randomView) = Skin::cutSkinTag($view, 'random_tags');
    dress('random_tags', getRandomTagsView($pd_tags, $randomView), $view);
    list($view, $recentNoticeItem) = Skin::cutSkinTag($view, 'rct_notice_rep');
    list($view, $noticeView) = Skin::cutSkinTag($view, 'rct_notice');
    $notices = $pd_notices;
    if (sizeof($notices) == 0) {
        $notices = array(array('title' => _t('공지 제목'), 'id' => -1));
    }
    if (sizeof($notices) > 0) {
        $itemsView = '';
        foreach ($notices as $notice) {
            $itemView = $recentNoticeItem;
            dress('notice_rep_title', htmlspecialchars(fireEvent('ViewNoticeTitle', Utils_Unicode::lessenAsEm($notice['title'], $skinSetting['recentNoticeLength']), $notice['id'])), $itemView);
            dress('notice_rep_link', "{$context->getProperty}('uri.blog')/notice/" . ($blog['useSloganOnPost'] ? URL::encode($notice['slogan'], $itemView) : $notice['id']), $itemView);
            $itemsView .= $itemView;
        }
        dress('rct_notice_rep', $itemsView, $noticeView);
        dress('rct_notice', $noticeView, $view);
    }
    list($view, $authorList) = Skin::cutSkinTag($view, 'author_rep');
    dress('author_rep', getAuthorListView($pd_authorList, $authorList), $view);
    list($view, $recentEntry) = Skin::cutSkinTag($view, 'rctps_rep');
    dress('rctps_rep', getRecentEntriesView($pd_recentEntry, $recentEntry), $view);
    list($view, $recentComments) = Skin::cutSkinTag($view, 'rctrp_rep');
    dress('rctrp_rep', getRecentCommentsView($pd_recentComment, $recentComments), $view);
    list($view, $recentTrackback) = Skin::cutSkinTag($view, 'rcttb_rep');
    dress('rcttb_rep', getRecentTrackbacksView($pd_recentTrackback, $recentTrackback), $view);
    list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep');
    dress('link_rep', getLinksView($pd_link, $s_link_rep), $view);
    dress('rss_url', "{$context->getProperty}('uri.blog')/rss", $view);
    dress('owner_url', "{$context->getProperty}('uri.blog')/owner", $view);
    dress('textcube_name', TEXTCUBE_NAME, $view);
    dress('textcube_version', TEXTCUBE_VERSION, $view);
    $tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU');
    $tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>');
    $view = preg_replace($tagSearches, $tagReplaces, $view);
    return correctSidebarImage($view);
}
Пример #7
0
function MT_Cover_getRecentEntries($parameters)
{
    global $skin;
    $context = Model_Context::getInstance();
    $data = $context->getProperty('plugin.config');
    importlib("model.blog.entry");
    importlib("model.blog.tag");
    $data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
    if (Utils_Misc::isMetaBlog() != true) {
        $data['coverMode'] = 1;
    }
    $data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
    $data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
    $data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
    $data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
    if (isset($parameters['preview'])) {
        // preview mode
        $retval = '표지에 최신 글 목록을 추가합니다.';
        return htmlspecialchars($retval);
    }
    $entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'))) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'));
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id'), 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . $context->getProperty('blog.id') . "/coverPostThumbnail/", 0777);
    }
    $page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cache = new PageCache();
    $cache->name = 'MT_Cover_RecentPS';
    if ($cache->load()) {
        //If successful loads
        $cache->contents = unserialize($cache->contents);
        // If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
        if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
            return $cache->contents[$page];
        }
    }
    $pool = DBModel::getInstance();
    $pool->reset("BlogSettings");
    $pool->setQualifier("name", "eq", 'visibility', true);
    $pool->setQualifier("value", "<", 2);
    $privateBlogId = $pool->getCell("blogid");
    $pool->reset("Entries");
    $pool->join("Categories", "left", array(array("e.blogid", "eq", "c.blogid"), array("e.category", "eq", "c.id")));
    $pool->setQualifier("e.draft", "eq", 0);
    $pool->setQualifier("e.category", "beq", 0);
    if ($privateBlogId) {
        $pool->setQualifier("e.blogid", "hasnoneof", $privateBlogId);
    }
    if (Utils_Misc::isMetaBlog() == true && doesHaveOwnership() && $context->getProperty('service.type', 'single') != 'single') {
        $pool->setQualifier("e.visibility", ">", 1);
        $pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
    } else {
        if (!doesHaveOwnership()) {
            $pool->setQualifier("e.visibility", ">", 1);
            $pool->setQualifierSet(array("c.visibility", ">", 1), "OR", array("e.category", "eq", 0));
        }
    }
    if ($data['coverMode'] != 2) {
        $pool->setQualifier("e.blogid", "eq", $context->getProperty("blog.id"));
    }
    list($entries, $paging) = Paging::fetch($pool, $page, $entryLength);
    $html = '';
    foreach ((array) $entries as $entry) {
        $tagLabelView = "";
        $blogid = $data['coverMode'] == 2 ? $entry['blogid'] : $context->getProperty('blog.id');
        $entryTags = getTags($blogid, $entry['id']);
        $defaultURL = getDefaultURL($blogid);
        if (sizeof($entryTags) > 0) {
            $tags = array();
            foreach ($entryTags as $entryTag) {
                $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
            }
            $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
        }
        if (empty($entry['category'])) {
            $entry['label'] = _text('분류없음');
            $entry['link'] = "{$defaultURL}/category";
        } else {
            $entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
        }
        $permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $context->getProperty('service.useEncodedURL', false)) : $entry['id']);
        $html .= '<div class="coverpost">' . CRLF;
        if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
            if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
                $html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
            }
        }
        $html .= '	<div class="content_box">';
        $html .= '		<h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
        $html .= '		<div class="post_info">' . CRLF;
        $html .= '			<span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
        $html .= '			<span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
        $html .= '			<span class="author"><span class="preposition">by </span>' . User::getName($entry['userid']) . '</span>' . CRLF;
        $html .= '		</div>' . CRLF;
        $html .= '		<div class="post_content">' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($entry['content'])), $data['contentLength'])) . '</div>' . CRLF;
        $html .= $tagLabelView;
        $html .= '		<div class="clear"></div>' . CRLF;
        $html .= '	</div>';
        $html .= '</div>' . CRLF;
    }
    if ($data['paging'] == '1') {
        $paging['page'] = $page;
        $paging['total'] = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries e WHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0");
        $html .= Paging::getPagingView($paging, $skin->paging, $skin->pagingItem) . CRLF;
        $html .= '<script type="text/javascript">' . CRLF;
        $html .= '//<![CDATA[' . CRLF;
        if ($paging['page'] > 1) {
            $html .= 'var prevURL = "' . $paging['url'] . '?page=' . ($paging['page'] - 1) . '"' . CRLF;
        }
        if ($paging['page'] < $paging['total']) {
            $html .= 'var nextURL = "' . $paging['url'] . '?page=' . ($paging['page'] + 1) . '"' . CRLF;
        }
        $html .= '//]]>' . CRLF;
        $html .= '</script>';
    }
    $target = $html;
    $cache->contents[$page] = $target;
    $cache->contents = serialize($cache->contents);
    $cache->dbContents = Timestamp::getUNIXtime();
    $cache->update();
    unset($cache);
    return $target;
}
Пример #8
0
require ROOT . '/library/preprocessor.php';
$param = array();
if (isset($_REQUEST['trashType'])) {
    array_push($param, 'trashType=' . URL::encode($_REQUEST['trashType'], $service['useEncodedURL']));
}
if (isset($_REQUEST['category'])) {
    array_push($param, 'category=' . URL::encode($_REQUEST['category'], $service['useEncodedURL']));
}
if (isset($_REQUEST['name'])) {
    array_push($param, 'name=' . URL::encode($_REQUEST['name'], $service['useEncodedURL']));
}
if (isset($_REQUEST['ip'])) {
    array_push($param, 'ip=' . URL::encode($_REQUEST['ip']));
}
if (isset($_REQUEST['withSearch'])) {
    array_push($param, 'withSearch=' . URL::encode($_REQUEST['withSearch'], $service['useEncodedURL']));
}
if (isset($_REQUEST['search'])) {
    array_push($param, 'search=' . URL::encode($_REQUEST['search'], $service['useEncodedURL']));
}
$paramStr = implode('&', $param);
if (strlen($paramStr) > 0) {
    $paramStr = '?' . $paramStr;
}
$location = $context->getProperty('uri.blog') . 'owner/center';
if (empty($_REQUEST['trashType']) || $_REQUEST['trashType'] == "comment") {
    $location = 'trash/comment';
} else {
    $location = 'trash/trackback';
}
header("Location: {$location}{$paramStr}");
Пример #9
0
 function getPagingView(&$paging, &$template, &$itemTemplate, $useCache = false, $mode = 'href')
 {
     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 = URL::encode($paging['url']);
     $prefix = $paging['prefix'];
     $postfix = isset($paging['postfix']) ? $paging['postfix'] : '';
     ob_start();
     if (isset($paging['first'])) {
         $itemView = "{$itemTemplate} <span class=\"interword\">...</span> ";
         Misc::dress('paging_rep_link_num', '<span>1</span>', $itemView, $useCache);
         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> ";
             Misc::dress('paging_rep_link_num', '<span>1</span>', $itemView, $useCache);
             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;
             Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             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;
             Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             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;
         Misc::dress('paging_rep_link_num', "<span class=\"selected\" >{$page}</span>", $itemView, $useCache);
         Misc::dress('paging_rep_link', '', $itemView, $useCache);
         print $itemView;
         $page++;
     }
     if (isset($paging['before'])) {
         foreach ($paging['after'] as $value) {
             $itemView = $itemTemplate;
             Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             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;
             Misc::dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useCache);
             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}";
         Misc::dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useCache);
         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}";
             Misc::dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useCache);
             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;
     Misc::dress('prev_page', isset($paging['prev']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"") . "{$url}{$prefix}{$paging['prev']}{$postfix}\" rel=\"prev\"" : '', $view, $useCache);
     Misc::dress('prev_page_title', isset($paging['prev_title']) ? $paging['prev_title'] : '', $view, $useCache);
     Misc::dress('paging_rep', $itemsView, $view, $useCache);
     Misc::dress('next_page', isset($paging['next']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"") . "{$url}{$prefix}{$paging['next']}{$postfix}\" rel=\"next\"" : '', $view, $useCache);
     Misc::dress('next_page_title', isset($paging['next_title']) ? $paging['next'] : '', $view, $useCache);
     Misc::dress('no_more_prev', isset($paging['prev']) ? '' : 'no-more-prev', $view, $useCache);
     Misc::dress('no_more_next', isset($paging['next']) ? '' : 'no-more-next', $view, $useCache);
     return $view;
 }
Пример #10
0
if (isset($_POST['page'])) {
    $_GET['page'] = $_POST['page'];
}
if (!empty($_POST['mode']) && $_POST['mode'] == 'fb') {
    $IV = array('GET' => array('page' => array('int', 1, 'default' => 1), 'category' => array('int', 0, 'mandatory' => false)), 'POST' => array('mode' => array(array('fb')), 'partial' => array('bool', 'default' => false), 's_home_title' => array('string', 'default' => ''), 's_name' => array('string', 'default' => ''), 's_no' => array('int'), 'url' => array('string', 'default' => ''), 's_url' => array('string', 'default' => ''), 's_post_title' => array('string', 'default' => ''), 'r1_no' => array('int'), 'r1_name' => array('string', 'default' => ''), 'r1_rno' => array('int'), 'r1_homepage' => array('string', 'default' => ''), 'r1_regdate' => array('timestamp'), 'r1_body' => array('string'), 'r1_url' => array('string', 'default' => ''), 'r2_no' => array('int'), 'r2_name' => array('string', 'default' => ''), 'r2_rno' => array('int'), 'r2_homepage' => array('string', 'default' => ''), 'r2_regdate' => array('timestamp'), 'r2_body' => array('string'), 'r2_url' => array('string', 'default' => '')));
} else {
    $IV = array('GET' => array('page' => array('int', 1, 'default' => 1), 'mode' => array(array('mobile', 'desktop', 'tablet'), 'mandatory' => false), 'category' => array('int', 0, 'mandatory' => false)));
}
require ROOT . '/library/preprocessor.php';
// Redirect for ipod touch / iPhone
$browserUtil = Utils_Browser::getInstance();
if (Setting::getBlogSettingGlobal('useiPhoneUI', true) && $browserUtil->isMobile() == true && (!isset($_GET['mode']) || $_GET['mode'] != 'desktop') && (!isset($_SESSION['mode']) || !in_array($_SESSION['mode'], array('desktop')))) {
    if (isset($suri['id'])) {
        $slogan = getSloganById($blogid, $suri['id']);
        if (!empty($slogan)) {
            header("Location: " . $context->getProperty('uri.blog') . "/i/entry/" . URL::encode($slogan));
            exit;
        }
    } else {
        header("Location: " . $context->getProperty('uri.blog') . "/i");
        exit;
    }
}
$_SESSION['mode'] = 'desktop';
publishEntries();
if (!empty($_POST['mode']) && $_POST['mode'] == 'fb') {
    // Treat comment notifier.
    $result = receiveNotifiedComment($_POST);
    if ($result > 0) {
        echo '<?xml version="1.0" encoding="utf-8"?><response><error>1</error><message>error(' . $result . ')</message></response>';
    } else {
Пример #11
0
function getTrackbackFeedByEntryId($blogid = null, $entryId, $rawMode = false, $mode = 'rss')
{
    global $database, $serviceURL, $defaultURL, $blogURL, $blog, $service;
    if (empty($blogid)) {
        $blogid = getBlogId();
    }
    $entry = POD::queryRow("SELECT slogan, visibility, category FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$entryId}");
    if (empty($entry)) {
        return false;
    }
    if ($entry['visibility'] < 2) {
        return false;
    }
    if (in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) {
        return false;
    }
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    $channel['title'] = RSSMessage($blog['title'] . ': ' . _textf('%1 에 달린 트랙백', $entry['slogan']));
    if ($blog['useSloganOnPost']) {
        $channel['link'] = $defaultURL . "/entry/" . URL::encode($entry['slogan'], true);
    } else {
        $channel['link'] = $defaultURL . "/" . $entryId;
    }
    $result = POD::queryAll("SELECT * \n\t\tFROM {$database['prefix']}RemoteResponses\n\t\tWHERE blogid = " . $blogid . " \n\t\t\tAND entry = " . $entryId . "\n\t\t\tAND isfiltered = 0\n\t\t\tAND type = 'trackback'");
    if (!$result) {
        $result = array();
    }
    $channel['items'] = array();
    foreach ($result as $row) {
        $trackbackURL = $channel['link'] . "#trackback";
        $content = htmlspecialchars($row['excerpt']);
        $item = array('id' => $row['id'], 'title' => RSSMessage($row['subject']), 'link' => $trackbackURL . $row['id'], 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage(htmlspecialchars($row['site'])), 'pubDate' => $row['written'], 'comments' => $trackbackURL, 'guid' => $trackbackURL . $row['id']);
        array_push($channel['items'], $item);
    }
    if ($rawMode == true) {
        return $channel['items'];
    }
    $rss = array('channel' => $channel);
    if ($mode == 'rss') {
        return publishRSS($blogid, $rss);
    } else {
        if ($mode == 'atom') {
            return publishATOM($blogid, $rss);
        }
    }
    return false;
}
Пример #12
0
 static function getHomepage($userid = null)
 {
     if (!isset($userid) || empty($userid)) {
         $userid = getUserId();
     }
     $info = unserialize(Setting::getUserSettingGlobal('userLinkInfo', '', $userid));
     if (is_null($info)) {
         $info = array('type' => 'default');
     }
     switch ($info['type']) {
         case "external":
             $homepage = $info['url'];
             break;
         case "internal":
             $homepage = getDefaultURL($info['blogid']);
             break;
         case "author":
             $homepage = getDefaultURL($info['blogid']) . "/author/" . URL::encode(User::getName($userid));
             break;
         case "default":
         default:
             $homepage = null;
     }
     return $homepage;
 }
Пример #13
0
        if (isset($cache) && strpos($cache->name, 'Paging') !== false) {
            if ($cache->load()) {
                $pagingView = $cache->contents;
            } else {
                $pagingView = Paging::getPagingView($paging, $skin->paging, $skin->pagingItem);
                $cache->contents = $pagingView;
                $cache->update();
            }
        } else {
            $pagingView = Paging::getPagingView($paging, $skin->paging, $skin->pagingItem);
        }
        dress('paging_list', $pagingView, $view, false, true);
        if (!empty($entries) || $suri['directive'] == '/guestbook') {
            dress('paging', $pagingView, $view, false, true);
        }
        $url = URL::encode($paging['url'], $service['useEncodedURL']);
        $prefix = $paging['prefix'];
        $postfix = isset($paging['postfix']) ? $paging['postfix'] : '';
        // prev_page, next_page for legacy support.
        dress('prev_page', isset($paging['prev']) ? "href='{$url}{$prefix}{$paging['prev']}{$postfix}'" : '', $view);
        dress('prev_page_title', isset($paging['prev_title']) ? $paging['prev_title'] : '', $view);
        dress('next_page', isset($paging['next']) ? "href='{$url}{$prefix}{$paging['next']}{$postfix}'" : '', $view);
        dress('next_page_title', isset($paging['next_title']) ? $paging['next_title'] : '', $view);
    } else {
        if (isset($cache) && strpos($cache->name, 'Paging') !== false && $cache->load()) {
            dress('paging', $cache->contents, $view, false, true);
        }
    }
}
// Sidebar dressing
$sidebarElements = array_keys($skin->sidebarStorage);
Пример #14
0
<?php

/// Copyright (c) 2004-2012, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$commentListView = $skin->commentList;
$itemsView = '';
foreach ($commentList['items'] as $item) {
    $itemView = $skin->commentListItem;
    dress('rplist_rep_regdate', fireEvent('ViewCommentListDate', Timestamp::format3($item['written']), $item['written']), $itemView);
    dress('rplist_rep_link', $context->getProperty('uri.blog') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/" . URL::encode($item['slogan'], $service['useEncodedURL']) : $item['entry']) . "#comment{$item['id']}", $itemView);
    dress('rplist_rep_name', htmlspecialchars($item['name']), $itemView);
    dress('rplist_rep_body', htmlspecialchars(fireEvent('ViewCommentListTitle', Utils_Unicode::lessenAsEm($item['comment'], 70))), $itemView);
    $itemsView .= $itemView;
}
dress('rplist_rep', $itemsView, $commentListView);
dress('rplist_conform', htmlspecialchars(fireEvent('ViewCommentListHeadTitle', $commentList['title'])), $commentListView);
dress('rplist_count', count($commentList['items']), $commentListView);
dress('rplist', $commentListView, $view);
Пример #15
0
$authorId = User::getUserIdByName($author);
if (empty($authorId)) {
    exit;
}
if ($skinSetting['showListOnAuthor'] != 0) {
    $cache->name = 'authorList-' . $authorId . "-" . $suri['page'] . "-";
    if (!$cache->load()) {
        if (!($listWithPaging = getEntryListWithPagingByAuthor($blogid, $author, $suri['page'], $blog['entriesOnList']))) {
            $listWithPaging = array(array(), array('total' => 0));
        }
        $list = array('title' => $author, 'items' => $listWithPaging[0], 'count' => $listWithPaging[1]['total']);
        $paging = $listWithPaging[1];
        $listView = null;
    } else {
        $paging = $cache->dbContents;
        $listView = $cache->contents;
    }
    require ROOT . '/interface/common/blog/begin.php';
    $listFeedURL = 'author/' . URL::encode($author);
    require ROOT . '/interface/common/blog/list.php';
}
$entries = array();
if ($skinSetting['showListOnAuthor'] != 2) {
    unset($cache);
    list($entries, $paging) = getEntriesWithPagingByAuthor($blogid, $author, $suri['page'], $blog['entriesOnList'], $skinSetting['showListOnAuthor'] == 3 ? $blog['entriesOnPage'] : $blog['entriesOnList']);
    if ($skinSetting['showListOnAuthor'] == 0) {
        require ROOT . '/interface/common/blog/begin.php';
    }
    require ROOT . '/interface/common/blog/entries.php';
}
require ROOT . '/interface/common/blog/end.php';
Пример #16
0
 dress('article_rep_link', $permalink, $entryView);
 dress('article_rep_rp_rssurl', $context->getProperty('uri.default') . '/rss/comment/' . $entry['id'], $entryView);
 dress('article_rep_tb_rssurl', $context->getProperty('uri.default') . '/rss/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_rssurl', $context->getProperty('uri.default') . '/rss/response/' . $entry['id'], $entryView);
 dress('article_rep_rp_atomurl', $context->getProperty('uri.default') . '/atom/comment/' . $entry['id'], $entryView);
 dress('article_rep_tb_atomurl', $context->getProperty('uri.default') . '/atom/trackback/' . $entry['id'], $entryView);
 dress('article_rep_response_atomurl', $context->getProperty('uri.default') . '/atom/response/' . $entry['id'], $entryView);
 dress('article_rep_category_body_id', getCategoryBodyIdById($blogid, $entry['category']) ? getCategoryBodyIdById($blogid, $entry['category']) : 'tt-body-category', $entryView);
 dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $entryView);
 // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치.
 $contentContainer["article_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid));
 dress('article_rep_desc', setTempTag("article_{$entry['id']}"), $entryView);
 dress('article_rep_category', htmlspecialchars(empty($entry['category']) ? _text('분류없음') : $entry['categoryLabel'], $entry['id']), $entryView);
 dress('article_rep_category_link', $context->getProperty('uri.blog') . "/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_rssurl', $context->getProperty('uri.default') . "/rss/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_category_atomurl', $context->getProperty('uri.default') . "/atom/category/" . (empty($entry['category']) ? "" : ($blog['useSloganOnCategory'] ? URL::encode($entry['categoryLabel'], $service['useEncodedURL']) : $entry['category'])), $entryView);
 dress('article_rep_microformat_published', Timestamp::getISO8601($entry['published']), $entryView);
 dress('article_rep_microformat_updated', Timestamp::getISO8601($entry['modified']), $entryView);
 dress('article_rep_date', fireEvent('ViewPostDate', Timestamp::format5($entry['published']), $entry['published']), $entryView);
 dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView);
 dress('entry_archive_link', $context->getProperty('uri.blog') . "/archive/" . Timestamp::getDate($entry['published']), $entryView);
 if ($entry['acceptcomment'] || $entry['comments'] > 0) {
     dress('article_rep_rp_link', "loadComment({$entry['id']},1,false,false); return false", $entryView);
 } else {
     dress('article_rep_rp_link', "return false", $entryView);
 }
 dress('article_rep_rp_cnt_id', "commentCount{$entry['id']}", $entryView);
 list($tempTag, $commentView) = getCommentCountPart($entry['comments'], $skin);
 dress($tempTag, $commentView, $entryView);
 if ($entry['accepttrackback'] || $entry['trackbacks'] > 0) {
     dress('article_rep_tb_link', "toggleLayer('entry{$entry['id']}Trackback'); return false", $entryView);
Пример #17
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)
$locativeView = '[##_SKIN_local_rep_start_##]';
$prevPath = array();
foreach ($locatives as $locative) {
    $path = explode('/', $locative['location']);
    array_shift($path);
    for ($depth = $i = 0; $i < count($path); $i++, $depth += 20) {
        $spotView = $skin->locativeSpot;
        dress('local_spot_depth', $depth, $spotView);
        dress('local_spot', htmlspecialchars($path[$i]), $spotView);
        if (empty($prevPath[$i]) || $path[$i] != $prevPath[$i]) {
            $locativeView .= $spotView;
        }
    }
    $entryView = $skin->locativeEntry;
    dress('local_info_depth', $depth + 20, $entryView);
    dress('local_info_link', $context->getProperty('uri.blog') . "/" . ($context->getProperty('blog.useSloganOnPost') ? 'entry/' . URL::encode($locative['slogan'], $service['useEncodedURL']) : $locative['id']), $entryView);
    dress('local_info_title', htmlspecialchars($locative['title']), $entryView);
    dress('local_info_author', User::getName($locative['userid']), $entryView);
    $locativeView .= $entryView;
    $prevPath = $path;
}
dress('local', '[##_SKIN_local_start_##]' . str_replace('[##_local_spot_rep_##]', $locativeView, $skin->locative) . '[##_SKIN_local_end_##]', $view);
Пример #18
0
function getRandomTagsView($tags, $template)
{
    $context = Model_Context::getInstance();
    ob_start();
    list($maxTagFreq, $minTagFreq) = getTagFrequencyRange();
    foreach ($tags as $tag) {
        $view = $template;
        dress('tag_link', $context->getProperty('uri.blog') . "/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($tag['name'], $context->getProperty('service.useEncodedURL')) : $tag['id']), $view);
        dress('tag_name', htmlspecialchars($tag['name']), $view);
        dress('tag_class', "cloud" . getTagFrequency($tag, $maxTagFreq, $minTagFreq), $view);
        print $view;
    }
    $view = ob_get_contents();
    ob_end_clean();
    return $view;
}
Пример #19
0
function myPlurk_UpdatePlurk($target, $mother)
{
    global $blogid, $service, $database, $configVal;
    requireComponent('Textcube.Function.misc');
    require_once "libs/plurk_api.php";
    $data = misc::fetchConfigVal($configVal);
    $autoPlurkEntries = (int) $data['autoPlurkEntries'];
    $plurkwithslogan = (int) $data['plurkwithslogan'];
    $plurklang = Setting::getBlogSettingGlobal('blogLanguage', '');
    $plurk = new plurk_api();
    $googl = new googleURLShortner();
    $plurkNickname = isset($data['plurknickname']) ? $data['plurknickname'] : "";
    $plurkPassword = isset($data['plurkpassword']) ? $data['plurkpassword'] : "";
    $plurk_api = 'iMCH3JDDda7c4bs0qiOchZcxAx7t8PA7';
    if ($mother['category'] >= 0 && ($autoPlurkEntries == 1 && $mother['visibility'] >= 2 || $autoPlurkEntries == 2 && $mother['visibility'] >= 3) && !empty($plurkNickname) && !empty($plurkPassword) && $plurk->login($plurk_api, $plurkNickname, $plurkPassword) && !POD::queryCount("UPDATE {$database['prefix']}PlurkEntries SET lastaccess = UNIX_TIMESTAMP() WHERE blogid={$blogid} AND id={$target}")) {
        $slogan = POD::queryCell("SELECT `slogan` FROM `{$database['prefix']}Entries` WHERE `id`={$target}");
        $permalink = getBlogURL() . "/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($slogan, $service['useEncodedURL']) : $target);
        $url = $googl->shortner($permalink);
        $url = $url !== false ? $url : $permalink;
        $lang = "en";
        switch ($plurklang) {
            case "zh-TW":
                $lang = "tr_ch";
                break;
            case "zh-CN":
                $lang = "cn";
            default:
                $lang = "en";
        }
        if (1 === $plurkwithslogan) {
            $content = $url . " (" . $mother['title'] . ") via " . Setting::getBlogSettingGlobal('title', '') . " with Textcube Plurk-API.";
        } else {
            $content = $mother['title'] . " via " . $url . " (" . Setting::getBlogSettingGlobal('title', '') . ") with Textcube Plurk-API.";
        }
        $acceptComment = $mother['acceptComment'] == 1 ? true : false;
        $response = $plurk->add_plurk($lang, "shares", $content, NULL, $acceptComment);
        if (isset($response->plurk_id) && $response->plurk_id > 0) {
            $plurk_id = $response->plurk_id;
            POD::query("INSERT INTO {$database['prefix']}PlurkEntries (blogid, id, plurkid, lastaccess) VALUES ('{$blogid}', '{$target}', '{$plurk_id}', UNIX_TIMESTAMP())");
        }
    }
    return $target;
}
Пример #20
0
function getTrackbackFeedByEntryId($blogid = null, $entryId, $rawMode = false, $mode = 'rss')
{
    $context = Model_Context::getInstance();
    if (empty($blogid)) {
        $blogid = getBlogId();
    }
    $pool = DBModel::getInstance();
    $pool->reset("Entries");
    $pool->setQualifier("blogid", "eq", $blogid);
    $pool->setQualifier("id", "eq", $entryId);
    $entry = $pool->getRow("slogan,visibility,category");
    if (empty($entry)) {
        return false;
    }
    if ($entry['visibility'] < 2) {
        return false;
    }
    if (in_array($entry['category'], getCategoryVisibilityList($blogid, 'private'))) {
        return false;
    }
    $channel = array();
    $channel = initializeRSSchannel($blogid);
    $channel['title'] = RSSMessage($context->getProperty('blog.title') . ': ' . _textf('%1 에 달린 트랙백', $entry['slogan']));
    if ($context->getProperty('blog.useSloganOnPost')) {
        $channel['link'] = $context->getProperty('uri.default') . "/entry/" . URL::encode($entry['slogan'], true);
    } else {
        $channel['link'] = $context->getProperty('uri.default') . "/" . $entryId;
    }
    $pool->reset("RemoteResponses");
    $pool->setQualifier("blogid", "eq", $blogid);
    $pool->setQualifier("entry", "eq", $entryId);
    $pool->setQualifier("isfiltered", "eq", 0);
    $pool->setQualifier("type", "eq", "trackback", true);
    $result = $pool->getAll();
    if (!$result) {
        $result = array();
    }
    $channel['items'] = array();
    foreach ($result as $row) {
        $trackbackURL = $channel['link'] . "#trackback";
        $content = htmlspecialchars($row['excerpt']);
        $item = array('id' => $row['id'], 'title' => RSSMessage($row['subject']), 'link' => $trackbackURL . $row['id'], 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage(htmlspecialchars($row['site'])), 'pubDate' => $row['written'], 'comments' => $trackbackURL, 'guid' => $trackbackURL . $row['id']);
        array_push($channel['items'], $item);
    }
    if ($rawMode == true) {
        return $channel['items'];
    }
    $rss = array('channel' => $channel);
    if ($mode == 'rss') {
        return publishRSS($blogid, $rss);
    } else {
        if ($mode == 'atom') {
            return publishATOM($blogid, $rss);
        }
    }
    return false;
}
Пример #21
0
dress('SKIN_head_end', $automaticLink . $canonicalLink . "[##_SKIN_head_end_##]", $view);
$view = str_replace('[##_SKIN_head_end_##]', getScriptsOnHead(isset($paging) ? $paging : null, $entryIds) . '[##_SKIN_head_end_##]', $view);
// TO DO : caching this part.
$view = str_replace('[##_SKIN_body_start_##]', getUpperView() . '[##_SKIN_body_start_##]', $view);
$view = str_replace('[##_SKIN_body_end_##]', getLowerView() . getScriptsOnFoot() . '[##_SKIN_body_end_##]', $view);
// care the order for js function overloading issue.
$browserUtil = Utils_Browser::getInstance();
if (Setting::getBlogSettingGlobal('useiPhoneUI', true) && $browserUtil->isMobile() == true) {
    if ($context->getProperty('suri.id', null) != null) {
        $mobileDestinationItem = $context->getProperty('suri.id');
        if ($context->getProperty('suri.directive') == '/') {
            $mobileDestinationItem = 'entry/' . $mobileDestinationItem;
        }
    } else {
        if ($context->getProperty('suri.value', null) != null) {
            $mobileDestinationItem = URL::encode($context->getProperty('suri.value'));
        } else {
            $mobileDestinationItem = '';
        }
    }
    if ($context->getProperty('blog.displaymode', 'desktop') == 'mobile') {
        $modeChangeLink = $context->getProperty('uri.permalink') . '?mode=desktop';
        $modeChangeText = _text('데스크탑 화면으로 이동');
    } else {
        $modeChangeLink = $context->getProperty('uri.permalink') . '?mode=mobile';
        $modeChangeText = _text('모바일 화면으로 이동');
    }
    $backToMobileButton = '<a href="' . $modeChangeLink . '" id="TCmobileScreenButton">' . $modeChangeText . '</a>';
    dress('SKIN_body_end', "[##_SKIN_body_end_##]" . $backToMobileButton, $view);
}
if ($context->getProperty('blog.useBlogIconAsIphoneShortcut') == true && file_exists(__TEXTCUBE_ATTACH_DIR__ . "/" . $context->getProperty('blog.id') . "/index.gif")) {
Пример #22
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)
if (isset($cache->contents)) {
    $tagView = $cache->contents;
} else {
    $tagView = $skin->siteTag;
    list($maxTagFreq, $minTagFreq) = getTagFrequencyRange();
    $itemsView = '';
    foreach ($siteTags as $siteTag) {
        $itemView = $skin->siteTagItem;
        dress('tag_name', htmlspecialchars($siteTag['name']), $itemView);
        dress('tag_link', $context->getProperty('uri.blog') . "/tag/" . ($context->getProperty('blog.useSloganOnTag', true) ? URL::encode($siteTag['name'], $service['useEncodedURL']) : $siteTag['id']), $itemView);
        dress('tag_class', "cloud" . getTagFrequency($siteTag['name'], $maxTagFreq, $minTagFreq), $itemView);
        $itemsView .= $itemView;
    }
    dress('tag_rep', $itemsView, $tagView);
    if (isset($cache)) {
        $cache->contents = $tagView;
        $cache->update();
    }
}
dress('tag', $tagView, $view);
Пример #23
0
function MT_Cover_getRecentEntries($parameters)
{
    global $database, $blog, $service, $serviceURL, $suri, $configVal, $defaultURL, $skin;
    requireModel("blog.entry");
    requireModel("blog.tag");
    $data = Setting::fetchConfigVal($configVal);
    $data['coverMode'] = !isset($data['coverMode']) ? 1 : $data['coverMode'];
    if (Misc::isMetaBlog() != true) {
        $data['coverMode'] = 1;
    }
    $data['screenshot'] = !isset($data['screenshot']) ? 1 : $data['screenshot'];
    $data['screenshotSize'] = !isset($data['screenshotSize']) ? 90 : $data['screenshotSize'];
    $data['paging'] = !isset($data['paging']) ? '2' : $data['paging'];
    $data['contentLength'] = !isset($data['contentLength']) ? 250 : $data['contentLength'];
    if (isset($parameters['preview'])) {
        // preview mode
        $retval = '표지에 최신 글 목록을 추가합니다.';
        return htmlspecialchars($retval);
    }
    $entryLength = isset($parameters['entryLength']) ? $parameters['entryLength'] : 10;
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail", 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId())) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId());
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId(), 0777);
    }
    if (!is_dir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/")) {
        @mkdir(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/");
        @chmod(__TEXTCUBE_CACHE_DIR__ . "/thumbnail/" . getBlogId() . "/coverPostThumbnail/", 0777);
    }
    $page = $data['paging'] == '1' && !empty($_GET['page']) ? intval($_GET['page']) : 1;
    $cache = new PageCache();
    $cache->name = 'MT_Cover_RecentPS';
    if ($cache->load()) {
        //If successful loads
        $cache->contents = unserialize($cache->contents);
        // If coverpage is single mode OR coverpage is coverblog and cache is not expired, return cache contents.
        if (($data['coverMode'] == 1 || $data['coverMode'] == 2) && array_key_exists($page, $cache->contents) && Timestamp::getUNIXtime() - $cache->dbContents < 300) {
            return $cache->contents[$page];
        }
    }
    if (Misc::isMetaBlog() == true && doesHaveOwnership() && $service['type'] != 'single') {
        $visibility = 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    } else {
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 1 AND (c.visibility > 1 OR e.category = 0)';
    }
    $multiple = $data['coverMode'] == 2 ? '' : 'e.blogid = ' . getBlogId() . ' AND';
    $privateBlogId = POD::queryColumn("SELECT blogid \n\t\tFROM {$database['prefix']}BlogSettings\n\t\tWHERE name = 'visibility'\n\t\tAND value < 2");
    if (!empty($privateBlogId)) {
        $privateBlogs = ' AND e.blogid NOT IN (' . implode(',', $privateBlogId) . ')';
    } else {
        $privateBlogs = '';
    }
    list($entries, $paging) = Paging::fetch("SELECT e.blogid, e.id, e.userid, e.title, e.content, e.slogan, e.category, e.published, e.contentformatter, c.label\n\t\tFROM {$database['prefix']}Entries e\n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.blogid = c.blogid AND e.category = c.id\n\t\tWHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0 {$privateBlogs}\n\t\tORDER BY published DESC", $page, $entryLength);
    $html = '';
    foreach ((array) $entries as $entry) {
        $tagLabelView = "";
        $blogid = $data['coverMode'] == 2 ? $entry['blogid'] : getBlogId();
        $entryTags = getTags($blogid, $entry['id']);
        $defaultURL = getDefaultURL($blogid);
        if (sizeof($entryTags) > 0) {
            $tags = array();
            foreach ($entryTags as $entryTag) {
                $tags[$entryTag['name']] = "<a href=\"{$defaultURL}/tag/" . (Setting::getBlogSettingGlobal('useSloganOnTag', true) ? URL::encode($entryTag['name'], $service['useEncodedURL']) : $entryTag['id']) . '">' . htmlspecialchars($entryTag['name']) . '</a>';
            }
            $tagLabelView = "<div class=\"post_tags\"><span>TAG : </span>" . implode(",\r\n", array_values($tags)) . "</div>";
        }
        if (empty($entry['category'])) {
            $entry['label'] = _text('분류없음');
            $entry['link'] = "{$defaultURL}/category";
        } else {
            $entry['link'] = "{$defaultURL}/category/" . (Setting::getBlogSettingGlobal('useSloganOnCategory', true) ? URL::encode($entry['label'], $service['useEncodedURL']) : $entry['category']);
        }
        $permalink = "{$defaultURL}/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($entry['slogan'], $service['useEncodedURL']) : $entry['id']);
        $html .= '<div class="coverpost">' . CRLF;
        if ($imageName = MT_Cover_getAttachmentExtract($entry['content'])) {
            if (($tempImageSrc = MT_Cover_getImageResizer($blogid, $imageName, $data['screenshotSize'])) && $data['screenshot'] == 1) {
                $html .= '<div class="img_preview"><a href="' . $permalink . '"><img src="' . $tempImageSrc . '" alt="" /></a></div>' . CRLF;
            }
        }
        $html .= '	<div class="content_box">';
        $html .= '		<h2><a href="' . $permalink . '">' . htmlspecialchars($entry['title']) . '</a></h2>' . CRLF;
        $html .= '		<div class="post_info">' . CRLF;
        $html .= '			<span class="category"><a href="' . htmlspecialchars($entry['link']) . '">' . htmlspecialchars($entry['label']) . '</a></span>' . CRLF;
        $html .= '			<span class="date">' . Timestamp::format5($entry['published']) . '</span>' . CRLF;
        $html .= '			<span class="author"><span class="preposition">by </span>' . User::getName($entry['userid']) . '</span>' . CRLF;
        $html .= '		</div>' . CRLF;
        $html .= '		<div class="post_content">' . htmlspecialchars(Utils_Unicode::lessenAsEm(removeAllTags(stripHTML($entry['content'])), $data['contentLength'])) . '</div>' . CRLF;
        $html .= $tagLabelView;
        $html .= '		<div class="clear"></div>' . CRLF;
        $html .= '	</div>';
        $html .= '</div>' . CRLF;
    }
    if ($data['paging'] == '1') {
        $paging['page'] = $page;
        $paging['total'] = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}Entries e WHERE {$multiple} e.draft = 0 {$visibility} AND e.category >= 0");
        $html .= getPagingView($paging, $skin->paging, $skin->pagingItem) . CRLF;
        $html .= '<script type="text/javascript">' . CRLF;
        $html .= '//<![CDATA[' . CRLF;
        if ($paging['page'] > 1) {
            $html .= 'var prevURL = "' . $paging['url'] . '?page=' . ($paging['page'] - 1) . '"' . CRLF;
        }
        if ($paging['page'] < $paging['total']) {
            $html .= 'var nextURL = "' . $paging['url'] . '?page=' . ($paging['page'] + 1) . '"' . CRLF;
        }
        $html .= '//]]>' . CRLF;
        $html .= '</script>';
    }
    $target = $html;
    $cache->contents[$page] = $target;
    $cache->contents = serialize($cache->contents);
    $cache->dbContents = Timestamp::getUNIXtime();
    $cache->update();
    unset($cache);
    return $target;
}
Пример #24
0
function GoogleMap_LocationLogView($target)
{
    $ctx = Model_Context::getInstance();
    $blogId = $ctx->getProperty('blog.id');
    $blogURL = $ctx->getProperty('uri.blog');
    $serviceURL = $ctx->getProperty('uri.service');
    global $pluginURL, $configVal;
    $ctx->setProperty('is_used', true);
    $config = Setting::fetchConfigVal($configVal);
    $locatives = getEntries($blogId, 'id, title, slogan, location, longitude, latitude', '(length(location)>1 AND category > -1) OR (`longitude` IS NOT NULL AND `latitude` IS NOT NULL)', 'location');
    $width = Misc::getContentWidth();
    $height = intval($width * 1.2);
    $default_type = isset($config['locative_maptype']) ? _GMap_convertLegacyMapType($config['locative_maptype']) : 'ROADMAP';
    $id = 'LocationMap';
    $lat = $config['latitude'];
    $lng = $config['longitude'];
    $zoom = 10;
    ob_start();
    ?>
	<div style="text-align:center;">
		<div id="<?php 
    echo $id;
    ?>
" style="margin:0 auto;"></div>
	</div>
	<script type="text/javascript">
	//<![CDATA[
	var process_count = 0;
	var polling_interval = 100; // ms
	var query_interval = 500; // ms
	var query_interval_handle = null;
	var progress = null;
	var boundary = null;
	var locationMap = null;
	function locationFetch(tofind) {
		if (tofind.length == 0) {
			window.clearInterval(query_interval_handle);
			return;
		}
		GMap_addLocationMark.apply(this, tofind.pop());
	}
	function locationFetchPoller(target_count) {
		if (process_count != target_count) {
			progress.setProgress(process_count / target_count);
			window.setTimeout('locationFetchPoller('+target_count+');', polling_interval);
			return;
		}
		progress.setProgress(1.0);
		window.setTimeout(function() {progress.remove();}, 200); // eyecandy
		locationMap.fitBounds(boundary);
	}
	GMapOnLoadCallbacks.push(function() {
		var c = document.getElementById('<?php 
    echo $id;
    ?>
');
		c.style.width = "<?php 
    echo $width;
    ?>
px"
		c.style.height = "<?php 
    echo $height;
    ?>
px";
		locationMap = new google.maps.Map(c, {
			'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
		});
		progress = new GProgressControl(locationMap);
		google.maps.event.addListenerOnce(locationMap, 'idle', function() {
			boundary = locationMap.getBounds();
			var locations = new Array();
			var tofind = new Array();
<?php 
    $count = 0;
    $countRemoteQuery = 0;
    $dbPrefix = $ctx->getProperty('database.prefix');
    foreach ($locatives as $locative) {
        //if ($count == 10) break; // for testing purpose
        $locative['link'] = "{$blogURL}/" . ($ctx->getProperty('blog.useSloganOnPost') ? 'entry/' . URL::encode($locative['slogan'], $ctx->getProperty('service.useEncodedURL')) : $locative['id']);
        $found = false;
        if ($locative['longitude'] != NULL && $locative['latitude'] != NULL) {
            $found = true;
            $lat = $locative['latitude'];
            $lng = $locative['longitude'];
            $locative['location'] = _t("위도") . " : " . $lat . ", " . _t("경도") . " : " . $lng;
        } else {
            $row = POD::queryRow("SELECT * FROM {$dbPrefix}GMapLocations WHERE blogid = {$blogId} AND original_address = '" . POD::escapeString($locative['location']) . "'");
            if ($row == null || empty($row)) {
                $found = false;
            } else {
                $lat = $row['latitude'];
                $lng = $row['longitude'];
                $found = true;
            }
        }
        if ($found) {
            // found, just output
            echo "\t\t\tGMap_addLocationMarkDirect(locationMap, {address:plugin.gmap.normalizeAddress('{$locative['location']}'), path:'{$locative['location']}', original_path:'{$locative['location']}'}, '" . str_replace("'", "\\'", $locative['title']) . "', encodeURI('" . str_replace("'", "\\'", $locative['link']) . "'), new google.maps.LatLng({$lat}, {$lng}), boundary, locations, false);\n";
        } else {
            // try to find in the client
            echo "\t\t\ttofind.push([locationMap, '{$locative['location']}', '" . str_replace("'", "\\'", $locative['title']) . "', encodeURI('" . str_replace("'", "\\'", $locative['link']) . "'), boundary, locations]);\n";
        }
        $count++;
    }
    ?>
			progress.setLabel('Loading locations...');
			query_interval_handle = window.setInterval(function() {locationFetch(tofind);}, query_interval);
			window.setTimeout(function() {locationFetchPoller(<?php 
    echo $count;
    ?>
);}, polling_interval);
		});
	});
	//]]>
	</script>
<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
         <a href="<?php 
echo $_SERVER['SCRIPT_NAME'];
?>
?<?php 
echo URL::encode('?param1=1&param2=2&ajsdajsd=adshgads');
?>
">
            Envia URL - <strong>?param1=1&param2=2</strong>
         </a>

      <hr>

      <a href="<?php 
echo $_SERVER['SCRIPT_NAME'];
?>
?<?php 
echo URL::encode('?param3=1abcde&param3=eeeee');
?>
">
         Envia URL - <strong>?param3=1abcde&param3=eeeee</strong>
      </a>
   </p>

   <p>--------------------------------------------------</p>  
   <?php 
foreach ($_GET as $nome => $valor) {
    printf("<p><strong>\$_GET['%s']</strong> = %s</p>", $nome, $valor);
}
?>
</body>
</html>
Пример #26
0
function getPagingView(&$paging, &$template, &$itemTemplate, $useSkinCache = false)
{
    $ctx = Model_Context::getInstance();
    if ($paging === false || empty($paging['page'])) {
        $paging['url'] = 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> ";
        dress('paging_rep_link_num', '<span>1</span>', $itemView, $useSkinCache);
        dress('paging_rep_link', "href='{$url}{$prefix}{$paging['first']}{$postfix}'", $itemView, $useSkinCache);
        print $itemView;
    } else {
        if ($paging['page'] > 5) {
            $itemView = "{$itemTemplate} <span class=\"interword\">...</span> ";
            dress('paging_rep_link_num', '<span>1</span>', $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}1{$postfix}'", $itemView, $useSkinCache);
            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;
            dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}{$value}{$postfix}'", $itemView, $useSkinCache);
            print $itemView;
            $page++;
        }
    } else {
        for ($i = 0; $i < 4 && $page < $paging['page']; $i++) {
            $itemView = $itemTemplate;
            dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}{$page}{$postfix}'", $itemView, $useSkinCache);
            print $itemView;
            $page++;
        }
    }
    if ($page == $paging['page'] && $page <= $paging['pages']) {
        $itemView = $itemTemplate;
        dress('paging_rep_link_num', "<span class=\"selected\" >{$page}</span>", $itemView, $useSkinCache);
        dress('paging_rep_link', '', $itemView, $useSkinCache);
        print $itemView;
        $page++;
    }
    if (isset($paging['before'])) {
        foreach ($paging['after'] as $value) {
            $itemView = $itemTemplate;
            dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}{$value}{$postfix}'", $itemView, $useSkinCache);
            print $itemView;
            $page++;
        }
    } else {
        for ($i = 0; $i < 4 && $page <= $paging['pages']; $i++) {
            $itemView = $itemTemplate;
            dress('paging_rep_link_num', "<span>{$page}</span>", $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}{$page}{$postfix}'", $itemView, $useSkinCache);
            print $itemView;
            $page++;
        }
    }
    if (isset($paging['last'])) {
        $itemView = " <span class=\"interword\">...</span> {$itemTemplate}";
        dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useSkinCache);
        dress('paging_rep_link', "href='{$url}{$prefix}{$paging['last']}{$postfix}'", $itemView, $useSkinCache);
        print $itemView;
    } else {
        if ($paging['pages'] - $paging['page'] > 4) {
            $itemView = " <span class=\"interword\">...</span> {$itemTemplate}";
            dress('paging_rep_link_num', "<span>{$paging['pages']}</span>", $itemView, $useSkinCache);
            dress('paging_rep_link', "href='{$url}{$prefix}{$paging['pages']}{$postfix}'", $itemView, $useSkinCache);
            print $itemView;
        }
    }
    $itemsView = ob_get_contents();
    ob_end_clean();
    $view = $template;
    dress('prev_page', isset($paging['prev']) ? "href='{$url}{$prefix}{$paging['prev']}{$postfix}'" : '', $view, $useSkinCache);
    dress('paging_rep', $itemsView, $view, $useSkinCache);
    dress('next_page', isset($paging['next']) ? "href='{$url}{$prefix}{$paging['next']}{$postfix}'" : '', $view, $useSkinCache);
    dress('no_more_prev', isset($paging['prev']) ? '' : 'no-more-prev', $view, $useSkinCache);
    dress('no_more_next', isset($paging['next']) ? '' : 'no-more-next', $view, $useSkinCache);
    return $view;
}
Пример #27
0
function printMobileHTMLFooter()
{
    global $blogURL;
    $context = Model_Context::getInstance();
    if (!is_null($context->getProperty('suri.id'))) {
        $slogan = getSloganById($context->getProperty('blog.id'), $context->getProperty('suri.id'));
    } else {
        if (!is_null($context->getProperty('suri.value'))) {
            $slogan = $context->getProperty('suri.value');
        }
    }
    $link = $context->getProperty('uri.basicblog') . substr($context->getProperty('suri.directive'), 2) . '/' . URL::encode($slogan) . "?mode=desktop";
    ?>
	<div data-role="content" class="ui-bar" data-theme="c"><span class="footer_text"><?php 
    echo _textf('이 페이지는 %1 %2 로 구동됩니다', TEXTCUBE_NAME, TEXTCUBE_VERSION);
    ?>
</span>
		<a href="<?php 
    echo $link;
    ?>
" data-role="button" data-theme="d" data-inline="false" data-icon="refresh" rel="external"><?php 
    echo _text('데스크탑 화면');
    ?>
</a>
	</div>

	</body>
</html>
<?php 
}