示例#1
0
function doesExistTable($tablename)
{
    global $database;
    static $tables = array();
    if (empty($tables)) {
        $tables = POD::tableList($database['prefix']);
    }
    $dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', null, 'global');
    if ($dbCaseInsensitive === null) {
        if (in_array(POD::dbms(), array('MySQL', 'MySQLi'))) {
            $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'");
            $dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0;
        } else {
            $dbCaseInsensitive = 1;
        }
        Setting::setServiceSetting('lowercaseTableNames', $dbCaseInsensitive, true);
    }
    if ($dbCaseInsensitive == 1) {
        $tablename = strtolower($tablename);
    }
    if (in_array($tablename, $tables)) {
        return true;
    }
    return false;
}
示例#2
0
function getBlogVersion()
{
    if (defined('__TEXTCUBE_GAE__')) {
        $version = Setting::getServiceSetting('blogVersion', null, true);
        if (is_null($version)) {
            $version = '0';
        }
        return $version;
    }
    if (!file_exists(__TEXTCUBE_CHECKUP_FILE__)) {
        return '0.0';
    }
    return trim(file_get_contents(__TEXTCUBE_CHECKUP_FILE__));
}
示例#3
0
function dumbCronScheduler($checkOnly = true)
{
    $context = Model_Context::getInstance();
    $now = Timestamp::getUNIXtime();
    $dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize(array('1m' => 0, '5m' => 0, '30m' => 0, '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0)), true);
    $dumbCronStamps = unserialize($dumbCronStamps);
    $schedules = array('1m' => 60, '5m' => 60 * 5, '10m' => 60 * 10, '30m' => 60 * 30, '1h' => 60 * 60, '2h' => 60 * 60 * 2, '6h' => 60 * 60 * 6, '12h' => 60 * 60 * 12, '24h' => 60 * 60 * 24, 'Daily' => 60 * 60 * 24, '1w' => 60 * 60 * 24 * 7);
    /* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */
    $log_file = __TEXTCUBE_CACHE_DIR__ . '/cronlog.txt';
    $log = fopen($log_file, "a");
    foreach ($schedules as $d => $diff) {
        if (!isset($dumbCronStamps[$d])) {
            $dumbCronStamps[$d] = 0;
        }
        if ($now > $diff + $dumbCronStamps[$d]) {
            if ($checkOnly && eventExists("Cron{$d}")) {
                fclose($log);
                return true;
            }
            fireEvent("Cron{$d}", null, $now);
            if ($d == '6h') {
                importlib('model.blog.trash');
                trashVan();
            }
            fwrite($log, date('Y-m-d H:i:s') . ' ' . $context->getProperty('blog.name') . " Cron{$d} executed ({$_SERVER['REQUEST_URI']})\r\n");
            $dumbCronStamps[$d] = $now;
        }
    }
    fclose($log);
    /* Keep just 1000 lines */
    $logcontent = explode("\r\n", file_get_contents($log_file));
    $logcontent = implode("\r\n", array_slice($logcontent, -1000));
    $log = fopen($log_file, "w");
    fwrite($log, $logcontent);
    fclose($log);
    Setting::setServiceSetting('dumbCronStamps', serialize($dumbCronStamps), true);
    return false;
}
示例#4
0
function removeBlog($blogid)
{
    $pool = DBModel::getInstance();
    $ctx = Model_Context::getInstance();
    if (Setting::getServiceSetting("defaultBlogId", 1, true) == $blogid) {
        return false;
    }
    $targets = array('Attachments', 'BlogSettings', 'BlogStatistics', 'Categories', 'Comments', 'CommentsNotified', 'CommentsNotifiedQueue', 'DailyStatistics', 'Entries', 'EntriesArchive', 'FeedGroups', 'FeedReads', 'FeedStarred', 'FeedSettings', 'Filters', 'Links', 'LinkCategories', 'PageCacheLog', 'Plugins', 'RefererLogs', 'RefererStatistics', 'RemoteResponses', 'RemoteResponseLogs', 'SkinSettings', 'TagRelations', 'Privileges', 'XMLRPCPingSettings');
    //Clear Tables
    foreach ($targets as $t) {
        $pool->reset($t);
        $pool->setQualifier('blogid', 'eq', $blogid);
        $pool->delete();
    }
    //Delete Tags
    $tags = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE blogid = {$blogid}");
    if (count($tags) > 0) {
        $tagliststr = implode(', ', $tags);
        // Tag id used at deleted blog.
        $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE tag in ( {$tagliststr} )");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $nottargetstr = implode(', ', $nottargets);
            POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
        } else {
            POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) ");
        }
    }
    //Delete Feeds
    $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM " . $ctx->getProperty('database.prefix') . "FeedGroupRelations WHERE blogid = {$blogid}");
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $query = "SELECT name, value FROM " . $ctx->getProperty('database.prefix') . "ServiceSettings WHERE name like 'Database\\_%'";
    $plugintablesraw = POD::queryAll($query);
    foreach ($plugintablesraw as $table) {
        $dbname = $ctx->getProperty('database.prefix') . substr($table['name'], 9);
        POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "{$dbname} WHERE blogid = {$blogid}");
    }
    //Clear RSS Cache
    if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
        unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
示例#5
0
function getScriptsOnFoot()
{
    $context = Model_Context::getInstance();
    ob_start();
    if ($context->getProperty('service.reader') != false && gmmktime() - Setting::getServiceSetting('lastFeedUpdate', 0, true) > 180) {
        ?>
        <script type="text/javascript">
            updateFeed();
        </script>
        <?php 
        $view = ob_get_contents();
        ob_end_clean();
        return $view;
    } else {
        return '';
    }
}
示例#6
0
function getPluginTableName()
{
    importlib('model.common.setting');
    $context = Model_Context::getInstance();
    $likeEscape = array('/_/', '/%/');
    $likeReplace = array('\\_', '\\%');
    $escapename = preg_replace($likeEscape, $likeReplace, $context->getProperty('database.prefix'));
    $dbtables = POD::tableList($escapename);
    $dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', true);
    if ($dbCaseInsensitive === null) {
        doesExistTable('');
        // determine the table name rule. (lowercase only / mixed cases)
    }
    $definedTables = getDefinedTableNames();
    $dbtables = array_values(array_diff($dbtables, $definedTables));
    if ($dbCaseInsensitive == 1) {
        $tempTables = $definedTables;
        $definedTables = array();
        foreach ($tempTables as $table) {
            $table = strtolower($table);
            array_push($definedTables, $table);
        }
        $tempTables = $dbtables;
        $dbtables = array();
        foreach ($tempTables as $table) {
            $table = strtolower($table);
            array_push($dbtables, $table);
        }
        $dbtables = array_values(array_diff($dbtables, $definedTables));
    }
    return $dbtables;
}
示例#7
0
function removeBlog($blogid)
{
    $pool = DBModel::getInstance();
    $context = Model_Context::getInstance();
    if (Setting::getServiceSetting("defaultBlogId", 1, true) == $blogid) {
        return false;
    }
    $targets = array('Attachments', 'BlogSettings', 'BlogStatistics', 'Categories', 'Comments', 'CommentsNotified', 'CommentsNotifiedQueue', 'DailyStatistics', 'Entries', 'EntriesArchive', 'FeedGroups', 'FeedReads', 'FeedStarred', 'FeedSettings', 'Filters', 'Links', 'LinkCategories', 'PageCacheLog', 'Plugins', 'RefererLogs', 'RefererStatistics', 'RemoteResponses', 'RemoteResponseLogs', 'SkinSettings', 'TagRelations', 'Privileges', 'XMLRPCPingSettings');
    //Clear Tables
    foreach ($targets as $t) {
        $pool->reset($t);
        $pool->setQualifier('blogid', 'eq', $blogid);
        $pool->delete();
    }
    //Delete Tags
    $pool->reset("TagRelations");
    $pool->setQualifier("blogid", "eq", $blogid);
    $tags = $pool->getColumn("tag", "DISTINCT");
    if (count($tags) > 0) {
        $pool->reset("TagRelations");
        // Tag id used at deleted blog.
        $pool->setQualifier("tag", "hasoneof", $tags);
        $nottargets = $pool->getColumn("tag", "DISTINCT");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $pool->reset("Tags");
            $pool->setQualifier("id", "hasoneof", $tags);
            $pool->setQualifier("id", "hasnoneof", $nottargets);
            $pool->delete();
        } else {
            $pool->reset("Tags");
            $pool->setQualifier("id", "hasoneof", $tags);
            $pool->delete();
        }
    }
    //Delete Feeds
    $pool->reset("FeedGroupRelations");
    $pool->setQualifier("blogid", "eq", $blogid);
    $feeds = $pool->getColumn("feeds", "DISTINCT");
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $pool->reset("ServiceSettings");
    $pool->setQualifier("name", "like", "Database_");
    $plugintablesraw = $pool->getAll();
    foreach ($plugintablesraw as $table) {
        $pool->reset(substr($table['name'], 9));
        $pool->setQualifier("blogid", "eq", $blogid);
        $pool->delete();
    }
    //Clear RSS Cache
    if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
        unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
示例#8
0
function getDefaultCenterPanel($mapping)
{
    $ctx = Model_Context::getInstance();
    $blogid = $ctx->getProperty('blog.id');
    ?>
									<div id="<?php 
    echo $mapping['plugin'];
    ?>
" class="section">
									<h3 class="caption<?php 
    echo isset($_REQUEST['edit']) ? ' visible' : ' invisible';
    ?>
">
											<span><?php 
    echo _t('알림판');
    if (isset($_REQUEST['edit'])) {
        ?>
											<a id="<?php 
        echo $mapping['plugin'];
        ?>
widgetup" href="<?php 
        echo $ctx->getProperty('uri.blog');
        ?>
/owner/center/dashboard?edit&pos=<?php 
        echo $positionCounter;
        ?>
&amp;rel=-1&edit"><?php 
        echo _t('위로');
        ?>
</a>
											<a id="<?php 
        echo $mapping['plugin'];
        ?>
widgetdown" href="<?php 
        echo $ctx->getProperty('uri.blog');
        ?>
/owner/center/dashboard?edit&pos=<?php 
        echo $positionCounter;
        ?>
&amp;rel=1&edit"><?php 
        echo _t('아래로');
        ?>
</a>
<?php 
    }
    ?>
											</span>
										</h3>
<?php 
    if (isset($_REQUEST['edit'])) {
        ?>
									</div>
<?php 
        return true;
    } else {
        // Get default data
        $stats = Statistics::getStatistics($blogid);
        $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
        $comments = getRecentComments($blogid, 10);
        $guestbooks = getRecentGuestbook($blogid, 10);
        list($commentNotifies, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, 0, null, null, null, 1, 10);
        $trackbacks = getRecentTrackbacks($blogid, 10);
        $recents = array();
        // title, date, link, category
        foreach ($comments as $comment) {
            array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $comment['entry'] . "#comment" . $comment['id'], 'category' => 'comment'));
        }
        foreach ($commentNotifies as $comment) {
            array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/owner/communication/notify", 'category' => 'commentNotify'));
        }
        foreach ($guestbooks as $guestbook) {
            array_push($recents, array('title' => $guestbook['comment'], 'date' => $guestbook['written'], 'link' => $ctx->getProperty('uri.blog') . "/guestbook/" . $guestbook['id'] . "#guestbook" . $guestbook['id'], 'category' => 'guestbook'));
        }
        foreach ($trackbacks as $trackback) {
            array_push($recents, array('title' => $trackback['subject'], 'date' => $trackback['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $trackback['entry'] . "#trackback" . $trackback['id'], 'category' => 'trackback'));
        }
        $sort_array = array();
        foreach ($recents as $uniqid => $row) {
            // Sorting.
            foreach ($row as $key => $value) {
                if (!array_key_exists($key, $sort_array)) {
                    $sort_array[$key] = array();
                }
                $sort_array[$key][$uniqid] = $value;
            }
        }
        if (!empty($sort_array)) {
            array_multisort($sort_array['date'], SORT_DESC, $recents);
        }
        $recents = array_slice($recents, 0, 14);
        ?>
										<div id="shortcut-collection">
											<h4 class="caption"><span><?php 
        echo _t('바로가기');
        ?>
</span></h4>

											<ul>
												<li class="newPost"><a class="newPost" href="<?php 
        echo $ctx->getProperty('uri.blog');
        ?>
/owner/entry/post"><span><?php 
        echo _t('새 글 쓰기');
        ?>
</span></a></li>
<?php 
        if ($latestEntryId !== 0) {
            $latestEntry = getEntry($blogid, $latestEntryId);
            if (!is_null($latestEntry)) {
                ?>
												<li class="modifyPost"><a href="<?php 
                echo $ctx->getProperty('uri.blog');
                ?>
/owner/entry/edit/<?php 
                echo $latestEntry['id'];
                ?>
"><?php 
                echo _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10)));
                ?>
</a></li>
<?php 
            }
        }
        if ($ctx->getProperty('service.reader') == true) {
            ?>
												<li class="rssReader"><a href="<?php 
            echo $ctx->getProperty('uri.blog');
            ?>
/owner/network/reader"><?php 
            echo _t('RSS로 등록한 이웃 글 보기');
            ?>
</a></li>
<?php 
        }
        if (Acl::check("group.administrators")) {
            ?>
												<li class="deleteCache"><a href="<?php 
            echo $ctx->getProperty('uri.blog');
            ?>
/owner/center/dashboard/cleanup" onclick="cleanupCache();return false;"><?php 
            echo _t('캐시 지우기');
            ?>
</a></li>
<?php 
            if (Acl::check("group.creators")) {
                ?>
												<li class="optimizeStorage"><a href="<?php 
                echo $ctx->getProperty('uri.blog');
                ?>
/owner/data" onclick="optimizeData();return false;"><?php 
                echo _t('저장소 최적화');
                ?>
</a></li>
<?php 
            }
        }
        ?>
												<li class="clear"></li>
											</ul>
										</div>

										<div id="total-information">
											<h4 class="caption"><span><?php 
        echo _t('요약');
        ?>
</span></h4>

											<table class="posts-line">
												<caption><?php 
        echo _t('글');
        ?>
</caption>
												<thead>
													<th>type</th>
													<th>sum</th>
												</thead>
												<tbody>
													<tr>
														<td class="type"><?php 
        echo _t('글');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format(getEntriesTotalCount($blogid));
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('댓글');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format(getCommentCount($blogid));
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('방명록');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format(getGuestbookCount($blogid));
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('걸린 글');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format(getTrackbackCount($blogid));
        ?>
</td>
													</tr>
												</tbody>
											</table>
											<table class="visitors-line">
												<caption><?php 
        echo _t('방문자');
        ?>
</caption>
												<thead>
													<th>type</th>
													<th>sum</th>
												</thead>
												<tbody>
													<tr>
														<td class="type"><?php 
        echo _t('오늘');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format($stats['today']);
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('어제');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format($stats['yesterday']);
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('7일 평균');
        ?>
</td>
														<td class="sum"><?php 
        $weekly = Statistics::getWeeklyStatistics();
        $weeklycount = 0;
        foreach ($weekly as $day) {
            $weeklycount += $day['visits'];
        }
        echo number_format($weeklycount / 7);
        unset($weekly);
        unset($weeklycount);
        ?>
</td>
													</tr>
													<tr>
														<td class="type"><?php 
        echo _t('총방문자');
        ?>
</td>
														<td class="sum"><?php 
        echo number_format($stats['total']);
        ?>
</td>
													</tr>
												</tbody>
											</table>
										</div>

										<div id="myBlogInfo">
											<h4 class="caption"><span><a href="<?php 
        echo $ctx->getProperty('uri.blog') . '/owner/communication/comment';
        ?>
"><?php 
        echo _t('알림판');
        ?>
</a></span></h4>
											<table class="recent">
												<caption>asdasd</caption>
												<thead>
													<tr>
														<th scope="col" class="date"><?php 
        echo _t('날짜');
        ?>
</th>
														<th scope="col" class="category"><?php 
        echo _t('종류');
        ?>
</th>
														<th scope="col"><?php 
        echo _t('내용');
        ?>
</th>
													</tr>
												</thead>
												<tbody>
<?php 
        foreach ($recents as $item) {
            ?>
													<tr class="<?php 
            echo $item['category'];
            ?>
">
														<td class="date"><?php 
            echo Timestamp::format('%m/%d', $item['date']);
            ?>
</td>
														<td class="category">
															<?php 
            switch ($item['category']) {
                case 'trackback':
                    echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/trackback?status=received">' . _t('걸린글') . '</a>';
                    break;
                case 'comment':
                    echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=comment">' . _t('댓글') . '</a>';
                    break;
                case 'commentNotify':
                    echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/notify">' . _t('알리미') . '</a>';
                    break;
                case 'guestbook':
                    echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=guestbook">' . _t('방명록') . '</a>';
                    break;
            }
            ?>
														</td>
														<td class="title"><a href="<?php 
            echo $item['link'];
            ?>
"><?php 
            echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20));
            ?>
</a></td>
													</tr>
<?php 
        }
        ?>
												</tbody>
											</table>
										</div>

<?php 
        $noticeURL = TEXTCUBE_NOTICE_URL;
        $noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss";
        $noticeEntries = array();
        if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) {
            $noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')));
        } else {
            list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS);
            if ($result == 0) {
                $xmls = new XMLStruct();
                $xmls->setXPathBaseIndex(1);
                $noticeEntries = array();
                if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) {
                    if ($xmls->getAttribute('/rss', 'version')) {
                        for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) {
                            $item = array('permalink' => rawurldecode($link));
                            $item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title");
                            if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) {
                                $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate"));
                            } else {
                                if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) {
                                    $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date"));
                                } else {
                                    $item['written'] = 0;
                                }
                            }
                            array_push($noticeEntries, $item);
                        }
                    }
                }
                Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries));
            }
        }
        ?>
										<div id="textcube-notice">
											<h4 class="caption"><span><a href="<?php 
        echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko");
        ?>
"><?php 
        echo _t('공지사항');
        ?>
</a></span></h4>
<?php 
        if (count($noticeEntries) > 0) {
            array_splice($noticeEntries, 3, count($noticeEntries) - 3);
            ?>
											<table>
												<tbody>
<?php 
            foreach ($noticeEntries as $item) {
                ?>
													<tr>
														<td class="date"><?php 
                echo Timestamp::format2($item['written']);
                ?>
</td>
														<td class="title"><a href="<?php 
                echo $item['permalink'];
                ?>
" onclick="return openLinkInNewWindow(this);" ><?php 
                echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35));
                ?>
</a></td>
													</tr>
<?php 
            }
            ?>
												</tbody>
											</table>

<?php 
        } else {
            ?>
											<div id="fail-notice">
												<?php 
            echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.');
            ?>
											</div>
<?php 
        }
        ?>
										</div>
<?php 
    }
    ?>
									</div>
<?php 
}
示例#9
0
function trashVan()
{
    $context = Model_Context::getInstance();
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 43200) {
        $pool = DBModel::getInstance();
        $pool->reset('Comments');
        $pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - $context->getProperty('service.trashtimelimit', 302400));
        $pool->setQualifier('isfiltered', 'b', 0);
        $pool->delete();
        $pool->reset('RemoteResponses');
        $pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - $context->getProperty('service.trashtimelimit', 302400));
        $pool->setQualifier('isfiltered', 'b', 0);
        $pool->delete();
        $pool->reset('RefererLogs');
        $pool->setQualifier('referred', 's', Timestamp::getUNIXtime() - 604800);
        $pool->delete();
        Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
    }
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
        Setting::removeServiceSetting('TextcubeNotice', true);
        Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
    }
}
示例#10
0
</span></h2>
							
							<div id="team-blog-about" class="container">
								<h3><?php 
echo empty($blogsetting['title']) ? '<em>' . _t('비어 있는 타이틀') . '</em>' : '<a href="' . getDefaultUrl($bid) . '">' . $blogsetting['title'] . '</a>';
?>
</h3>
								
								<div class="main-explain-box">
									<p class="explain"><?php 
echo empty($blogsetting['description']) ? '<em>' . _t('비어 있는 블로그 설명') . '</em>' : $blogsetting['description'];
?>
</p>
								</div>
<?php 
$isRepBlog = $bid == Setting::getServiceSetting("defaultBlogId", 1, true) ? true : false;
$pool->reset('Entries');
$pool->setQualifier('blogid', 'eq', $bid);
$pool->setQualifier('draft', 'eq', 0);
$numberOfEntries = $pool->getCount();
$pool->reset('RemoteResponses');
$pool->setQualifier('blogid', 'eq', $bid);
$pool->setQualifier('responsetype', 'eq', 'trackback', true);
$pool->setQualifier('isfiltered', 'eq', 0);
$numberOfTrackbacks = $pool->getCount();
$pool->reset('Comments');
$pool->setQualifier('blogid', 'eq', $bid);
$pool->setQualifier('isfiltered', 'eq', 0);
$numberOfComments = $pool->getCount();
$pool->reset('Attachments');
$pool->setQualifier('blogid', 'eq', $bid);
示例#11
0
function trashVan()
{
    global $database;
    requireModel('common.setting');
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 86400) {
        //		var_dump(Timestamp::getUNIXtime());
        //		var_dump(Setting::getServiceSetting('lastTrashSweep',0, true));
        POD::execute("DELETE FROM {$database['prefix']}Comments where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
        POD::execute("DELETE FROM {$database['prefix']}RemoteResponses where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
        POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < " . Timestamp::getUNIXtime() . " - 604800");
        Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
    }
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
        Setting::removeServiceSetting('TextcubeNotice', true);
        Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
    }
}
示例#12
0
function getPluginTableName()
{
    requireModel('common.setting');
    $ctx = Model_Context::getInstance();
    $likeEscape = array('/_/', '/%/');
    $likeReplace = array('\\_', '\\%');
    $escapename = preg_replace($likeEscape, $likeReplace, $ctx->getProperty('database.prefix'));
    $dbtables = POD::tableList($escapename);
    $dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', true);
    if ($dbCaseInsensitive === null) {
        $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'");
        $dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0;
        Setting::setServiceSetting('lowercaseTableNames', $dbCaseInsensitive, true);
    }
    $definedTables = getDefinedTableNames();
    $dbtables = array_values(array_diff($dbtables, $definedTables));
    if ($dbCaseInsensitive == 1) {
        $tempTables = $definedTables;
        $definedTables = array();
        foreach ($tempTables as $table) {
            $table = strtolower($table);
            array_push($definedTables, $table);
        }
        $tempTables = $dbtables;
        $dbtables = array();
        foreach ($tempTables as $table) {
            $table = strtolower($table);
            array_push($dbtables, $table);
        }
        $dbtables = array_values(array_diff($dbtables, $definedTables));
    }
    return $dbtables;
}
示例#13
0
function trashVan()
{
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 86400) {
        $pool = DBModel::getInstance();
        $pool->reset('Comments');
        $pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - 1296000);
        $pool->setQualifier('isfiltered', 'b', 0);
        $pool->delete();
        $pool->reset('RemoteResponses');
        $pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - 1296000);
        $pool->setQualifier('isfiltered', 'b', 0);
        $pool->delete();
        $pool->reset('RefererLogs');
        $pool->setQualifier('referred', 's', Timestamp::getUNIXtime() - 604800);
        $pool->delete();
        Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
    }
    if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
        Setting::removeServiceSetting('TextcubeNotice', true);
        Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
    }
}
示例#14
0
								</form>
							</div>
						</div>
<?php 
}
if ($service['type'] != 'single' && Acl::check("group.creators")) {
    $urlRule = getBlogURLRule();
    ?>
						<div id="part-setting-invite" class="part">
							<h2 class="caption"><span class="main-text"><?php 
    echo _t('친구를 초대합니다');
    ?>
</span></h2>
							
<?php 
    if (!function_exists('mail') && !Setting::getServiceSetting('useCustomSMTP', 0, true)) {
        ?>
							<div class="main-explain-box">
								<p class="explain"><?php 
        echo _t('시스템에 자체에서 메일을 보낼 수가 없습니다. 외부 메일 서버를 지정해주세요.');
        ?>
 <a href="<?php 
        echo $context->getProperty('uri.blog');
        ?>
/owner/control/server"><?php 
        echo _t('메일 서버 설정 바로가기');
        ?>
</a></p>
							</div>
<?php 
    } else {
示例#15
0
 public function getNotify($type)
 {
     $type = strtolower($type);
     switch ($type) {
         case "google":
             return 1 === (int) Setting::getServiceSetting("SitemapNotifyGoogle") ? true : false;
             break;
         case "yahoo":
             return 1 === (int) Setting::getServiceSetting("SitemapNotifyYahoo") ? true : false;
             break;
         case "msn":
             return 1 === (int) Setting::getServiceSetting("SitemapNotifyMSN") ? true : false;
             break;
         case "ask":
             return 1 === (int) Setting::getServiceSetting("SitemapNotifyASK") ? true : false;
             break;
         case "bing":
             return 1 === (int) Setting::getServiceSetting("SitemapNotifyBing") ? true : false;
             break;
         default:
             return false;
     }
 }
示例#16
0
 function getServiceSetting($name, $default = null)
 {
     return Setting::getServiceSetting($name, $default, true);
 }
示例#17
0
         showCheckupMessage(true);
     } else {
         showCheckupMessage(false);
     }
 }
 /* From Textcube 1.8.4 */
 if (!POD::queryExistence("DESC {$database['prefix']}RemoteResponseLogs responsetype")) {
     $changed = true;
     echo '<li>', _text('트랙백과 핑백의 출력을 위하여 필드 속성을 변경합니다.'), ': ';
     if (POD::execute("ALTER TABLE {$database['prefix']}RemoteResponseLogs CHANGE type responsetype ENUM('trackback','pingback') NOT NULL DEFAULT 'trackback'")) {
         showCheckupMessage(true);
     } else {
         showCheckupMessage(false);
     }
 }
 if (Setting::getServiceSetting('useNewPluginSetting', false, true) != true) {
     $changed = true;
     echo '<li>', _text('플러그인 환경 설정 저장 방식을 변경합니다.'), ': ';
     $query = DBModel::getInstance();
     $query->reset('Plugins');
     if ($candidates = $query->getAll()) {
         foreach ($candidates as $c) {
             if (!is_null($c['settings'])) {
                 $query->reset('Plugins');
                 $query->setQualifier('blogid', 'equals', $c['blogid']);
                 $query->setQualifier('name', 'equals', $c['name'], true);
                 $query->setAttribute('settings', serialize(Setting::fetchConfigXML($c['settings'])), true);
                 $query->update();
             }
         }
         Setting::setServiceSetting('useNewPluginSetting', true, true);