function lastArtist() { $db = new DBHandler(); $stmt = $db->query("SELECT ar.id, ar.name, ar.uploadDate, ar.uploadUser FROM artist ar order by ar.uploadDate DESC limit 5;"); $data = ""; while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $data = $data . $row[0] . "," . $row[1] . ","; $tstamp = new Timestamp($row[2]); $udate = $tstamp->format("y-m-d"); $data = $data . $udate . "," . $row[3] . ";"; } $stmt->closeCursor(); echo $data; }
function getCalendarView($calendar) { $context = Model_Context::getInstance(); $current = $calendar['year'] . $calendar['month']; $previous = addPeriod($current, -1); $next = addPeriod($current, 1); $firstWeekday = date('w', mktime(0, 0, 0, $calendar['month'], 1, $calendar['year'])); $lastDay = date('t', mktime(0, 0, 0, $calendar['month'], 1, $calendar['year'])); $today = $current == Timestamp::get('Ym') ? Timestamp::get('j') : null; $currentMonthStr = fireEvent('ViewCalendarHead', Timestamp::format('%Y/%m', getTimeFromPeriod($current))); ob_start(); ?> <table class="tt-calendar" cellpadding="0" cellspacing="1" style="width: 100%; table-layout: fixed"> <caption class="cal_month"> <a href="<?php echo $context->getProperty('uri.blog'); ?> /archive/<?php echo $previous; ?> " title="<?php echo _text('1개월 앞의 달력을 보여줍니다.'); ?> ">«</a> <a href="<?php echo $context->getProperty('uri.blog'); ?> /archive/<?php echo $current; ?> " title="<?php echo _text('현재 달의 달력을 보여줍니다.'); ?> "><?php echo $currentMonthStr; ?> </a> <a href="<?php echo $context->getProperty('uri.blog'); ?> /archive/<?php echo $next; ?> " title="<?php echo _text('1개월 뒤의 달력을 보여줍니다.'); ?> ">»</a> </caption> <thead> <tr> <th class="cal_week2"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('일요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('월요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('화요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('수요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('목요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('금요일')); ?> </th> <th class="cal_week1"><?php echo fireEvent('ViewCalendarHeadWeekday', _text('토요일')); ?> </th> </tr> </thead> <tbody> <?php $day = 0; $totalDays = $firstWeekday + $lastDay; $lastWeek = ceil($totalDays / 7); for ($week = 0; $week < $lastWeek; $week++) { // 주중에 현재 날짜가 포함되어 있으면 주를 현재 주 class(tt-current-week)를 부여한다. if ($today + $firstWeekday > $week * 7 && $today + $firstWeekday <= ($week + 1) * 7) { echo ' <tr class="cal_week cal_current_week">' . CRLF; } else { echo ' <tr class="cal_week">' . CRLF; } for ($weekday = 0; $weekday < 7; $weekday++) { $day++; $dayString = isset($calendar['days'][$day]) ? '<a class="cal_click" href="' . $context->getProperty('uri.blog') . '/archive/' . $current . ($day > 9 ? $day : "0{$day}") . '">' . $day . '</a>' : $day; // 일요일, 평일, 토요일별로 class를 부여한다. switch ($weekday) { case 0: $className = " cal_day cal_day_sunday"; break; case 1: case 2: case 3: case 4: case 5: case 6: $className = " cal_day"; break; } // 오늘에 현재 class(tt-current-day)를 부여한다. $className .= $day == $today ? " cal_day4" : " cal_day3"; if ($week == 0) { if ($weekday < $firstWeekday) { $day--; // 달의 첫째날이 되기 전의 빈 칸. echo ' <td class="cal_day1"> </td>' . CRLF; } else { echo ' <td class="' . $className . '">' . $dayString . '</td>' . CRLF; } } else { if ($week == $lastWeek - 1) { if ($day <= $lastDay) { echo ' <td class="' . $className . '">' . $dayString . '</td>' . CRLF; } else { // 달의 마지막날을 넘어간 날짜 빈 칸. echo ' <td class="cal_day2"> </td>' . CRLF; } } else { echo ' <td class="' . $className . '">' . $dayString . '</td>' . CRLF; } } } echo ' </tr>' . CRLF; if ($day >= $lastDay) { break; } } ?> </tbody> </table> <?php $view = ob_get_contents(); ob_end_clean(); return $view; }
showCheckupMessage(false); } } } /***** Common parts. *****/ if (doesHaveOwnership()) { clearCache(); } if (!defined('__TEXTCUBE_GAE__')) { $filename = ROOT . '/.htaccess'; $fp = fopen($filename, "r"); $content = fread($fp, filesize($filename)); fclose($fp); if (preg_match('@rewrite\\.php@', $content) == 0 || strpos($content, '[OR]') !== false || strpos($content, ' -d') == false || strpos($content, '(cache|xml|txt|log)') == false || strpos($content, 'user/attach') == false) { echo '<li>', _textf('htaccess 규칙을 수정합니다.'), ': '; $fp = fopen($filename . '_backup_' . Timestamp::format('%Y%m%d'), "w"); fwrite($fp, $content); fclose($fp); $content = "#<IfModule mod_url.c>\n#CheckURL Off\n#</IfModule>\n#SetEnv PRELOAD_CONFIG 1\nRewriteEngine On\nRewriteBase " . $context->getProperty('service.path') . "/\nRewriteRule ^(thumbnail)/([0-9]+/.+)\$ user/cache/\$1/\$2 [L]\nRewriteRule ^attach/([0-9]+/.+)\$ user/attach/\$1 [L]\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule ^user/(cache)+/+(.+[^/])\\.(cache|xml|txt|log)\$ - [NC,F,L]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^(.+[^/])\$ \$1/ [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteRule ^(.*)\$ rewrite.php [L,QSA]\n"; $fp = fopen($filename, "w"); if (fwrite($fp, $content)) { fclose($fp); showCheckupMessage(true); } else { fclose($fp); showCheckupMessage(false); } } } if ($currentVersion != TEXTCUBE_VERSION && $succeed == true) { setBlogVersion();
function getDefaultCenterPanel($mapping) { $ctx = Model_Context::getInstance(); $blogid = $ctx->getProperty('blog.id'); ?> <div id="<?php echo $mapping['plugin']; ?> " class="section"> <h3 class="caption<?php echo isset($_REQUEST['edit']) ? ' visible' : ' invisible'; ?> "> <span><?php echo _t('알림판'); if (isset($_REQUEST['edit'])) { ?> <a id="<?php echo $mapping['plugin']; ?> widgetup" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=-1&edit"><?php echo _t('위로'); ?> </a> <a id="<?php echo $mapping['plugin']; ?> widgetdown" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard?edit&pos=<?php echo $positionCounter; ?> &rel=1&edit"><?php echo _t('아래로'); ?> </a> <?php } ?> </span> </h3> <?php if (isset($_REQUEST['edit'])) { ?> </div> <?php return true; } else { // Get default data $stats = Statistics::getStatistics($blogid); $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0); $comments = getRecentComments($blogid, 10); $guestbooks = getRecentGuestbook($blogid, 10); list($commentNotifies, $paging) = getCommentsNotifiedWithPagingForOwner($blogid, 0, null, null, null, 1, 10); $trackbacks = getRecentTrackbacks($blogid, 10); $recents = array(); // title, date, link, category foreach ($comments as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $comment['entry'] . "#comment" . $comment['id'], 'category' => 'comment')); } foreach ($commentNotifies as $comment) { array_push($recents, array('title' => $comment['comment'], 'date' => $comment['written'], 'link' => $ctx->getProperty('uri.blog') . "/owner/communication/notify", 'category' => 'commentNotify')); } foreach ($guestbooks as $guestbook) { array_push($recents, array('title' => $guestbook['comment'], 'date' => $guestbook['written'], 'link' => $ctx->getProperty('uri.blog') . "/guestbook/" . $guestbook['id'] . "#guestbook" . $guestbook['id'], 'category' => 'guestbook')); } foreach ($trackbacks as $trackback) { array_push($recents, array('title' => $trackback['subject'], 'date' => $trackback['written'], 'link' => $ctx->getProperty('uri.blog') . "/" . $trackback['entry'] . "#trackback" . $trackback['id'], 'category' => 'trackback')); } $sort_array = array(); foreach ($recents as $uniqid => $row) { // Sorting. foreach ($row as $key => $value) { if (!array_key_exists($key, $sort_array)) { $sort_array[$key] = array(); } $sort_array[$key][$uniqid] = $value; } } if (!empty($sort_array)) { array_multisort($sort_array['date'], SORT_DESC, $recents); } $recents = array_slice($recents, 0, 14); ?> <div id="shortcut-collection"> <h4 class="caption"><span><?php echo _t('바로가기'); ?> </span></h4> <ul> <li class="newPost"><a class="newPost" href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/post"><span><?php echo _t('새 글 쓰기'); ?> </span></a></li> <?php if ($latestEntryId !== 0) { $latestEntry = getEntry($blogid, $latestEntryId); if (!is_null($latestEntry)) { ?> <li class="modifyPost"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/entry/edit/<?php echo $latestEntry['id']; ?> "><?php echo _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))); ?> </a></li> <?php } } if ($ctx->getProperty('service.reader') == true) { ?> <li class="rssReader"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/network/reader"><?php echo _t('RSS로 등록한 이웃 글 보기'); ?> </a></li> <?php } if (Acl::check("group.administrators")) { ?> <li class="deleteCache"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/center/dashboard/cleanup" onclick="cleanupCache();return false;"><?php echo _t('캐시 지우기'); ?> </a></li> <?php if (Acl::check("group.creators")) { ?> <li class="optimizeStorage"><a href="<?php echo $ctx->getProperty('uri.blog'); ?> /owner/data" onclick="optimizeData();return false;"><?php echo _t('저장소 최적화'); ?> </a></li> <?php } } ?> <li class="clear"></li> </ul> </div> <div id="total-information"> <h4 class="caption"><span><?php echo _t('요약'); ?> </span></h4> <table class="posts-line"> <caption><?php echo _t('글'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('글'); ?> </td> <td class="sum"><?php echo number_format(getEntriesTotalCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('댓글'); ?> </td> <td class="sum"><?php echo number_format(getCommentCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('방명록'); ?> </td> <td class="sum"><?php echo number_format(getGuestbookCount($blogid)); ?> </td> </tr> <tr> <td class="type"><?php echo _t('걸린 글'); ?> </td> <td class="sum"><?php echo number_format(getTrackbackCount($blogid)); ?> </td> </tr> </tbody> </table> <table class="visitors-line"> <caption><?php echo _t('방문자'); ?> </caption> <thead> <th>type</th> <th>sum</th> </thead> <tbody> <tr> <td class="type"><?php echo _t('오늘'); ?> </td> <td class="sum"><?php echo number_format($stats['today']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('어제'); ?> </td> <td class="sum"><?php echo number_format($stats['yesterday']); ?> </td> </tr> <tr> <td class="type"><?php echo _t('7일 평균'); ?> </td> <td class="sum"><?php $weekly = Statistics::getWeeklyStatistics(); $weeklycount = 0; foreach ($weekly as $day) { $weeklycount += $day['visits']; } echo number_format($weeklycount / 7); unset($weekly); unset($weeklycount); ?> </td> </tr> <tr> <td class="type"><?php echo _t('총방문자'); ?> </td> <td class="sum"><?php echo number_format($stats['total']); ?> </td> </tr> </tbody> </table> </div> <div id="myBlogInfo"> <h4 class="caption"><span><a href="<?php echo $ctx->getProperty('uri.blog') . '/owner/communication/comment'; ?> "><?php echo _t('알림판'); ?> </a></span></h4> <table class="recent"> <caption>asdasd</caption> <thead> <tr> <th scope="col" class="date"><?php echo _t('날짜'); ?> </th> <th scope="col" class="category"><?php echo _t('종류'); ?> </th> <th scope="col"><?php echo _t('내용'); ?> </th> </tr> </thead> <tbody> <?php foreach ($recents as $item) { ?> <tr class="<?php echo $item['category']; ?> "> <td class="date"><?php echo Timestamp::format('%m/%d', $item['date']); ?> </td> <td class="category"> <?php switch ($item['category']) { case 'trackback': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/trackback?status=received">' . _t('걸린글') . '</a>'; break; case 'comment': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=comment">' . _t('댓글') . '</a>'; break; case 'commentNotify': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/notify">' . _t('알리미') . '</a>'; break; case 'guestbook': echo '<a href="' . $ctx->getProperty('uri.blog') . '/owner/communication/comment?status=guestbook">' . _t('방명록') . '</a>'; break; } ?> </td> <td class="title"><a href="<?php echo $item['link']; ?> "><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20)); ?> </a></td> </tr> <?php } ?> </tbody> </table> </div> <?php $noticeURL = TEXTCUBE_NOTICE_URL; $noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss"; $noticeEntries = array(); if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) { $noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'))); } else { list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS); if ($result == 0) { $xmls = new XMLStruct(); $xmls->setXPathBaseIndex(1); $noticeEntries = array(); if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) { if ($xmls->getAttribute('/rss', 'version')) { for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) { $item = array('permalink' => rawurldecode($link)); $item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title"); if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate")); } else { if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) { $item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date")); } else { $item['written'] = 0; } } array_push($noticeEntries, $item); } } } Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries)); } } ?> <div id="textcube-notice"> <h4 class="caption"><span><a href="<?php echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko"); ?> "><?php echo _t('공지사항'); ?> </a></span></h4> <?php if (count($noticeEntries) > 0) { array_splice($noticeEntries, 3, count($noticeEntries) - 3); ?> <table> <tbody> <?php foreach ($noticeEntries as $item) { ?> <tr> <td class="date"><?php echo Timestamp::format2($item['written']); ?> </td> <td class="title"><a href="<?php echo $item['permalink']; ?> " onclick="return openLinkInNewWindow(this);" ><?php echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35)); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <div id="fail-notice"> <?php echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.'); ?> </div> <?php } ?> </div> <?php } ?> </div> <?php }
function format($format, $time = null) { if ($time) { $d = new Timestamp($time); return $d->format($format); } return date($format, $this->_time); }
$tstamp = new Timestamp($row[3]); $date = $tstamp->format("y-m-d"); $data = $data . $date . ";"; } $stmt->closeCursor(); $data = convertToUTF8($data); echo $data; } if (isset($_GET['action']) && $_GET['action'] == 'comment') { $db = new DBHandler(); $stmt = $db->query("SELECT s.title, u.username, c.text, c.date,c.user,c.song\r\n\t\t\t\t\t\tFROM song s, user u, comment c\r\n\t\t\t\t\t\tWHERE c.song = s.id\r\n\t\t\t\t\t\tAND c.user = u.id\r\n\t\t\t\t\t\tORDER BY c.date DESC \r\n\t\t\t\t\t\tLIMIT 0 , 30"); $data = ""; while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $data = $data . $row[0] . "," . $row[1] . "," . $row[2] . ","; $tstamp = new Timestamp($row[3]); $date = $tstamp->format("y-m-d"); $data = $data . $date . "," . $row[4] . "," . $row[5] . ";"; } $stmt->closeCursor(); $data = convertToUTF8($data); echo $data; } //partie suppression if (isset($_GET['action']) && $_GET['action'] == 1) { $notarizealbum = new Notarizealbum($_GET['user'], $_GET['id']); $notarizealbum->delete($_GET['user'], $_GET['id']); } if (isset($_GET['action']) && $_GET['action'] == 2) { $notarizeartist = new Notarizeartist($_GET['user'], $_GET['id']); $notarizeartist->delete($_GET['user'], $_GET['id']); }
function getCalendarView($period = null) { global $service, $database, $db; if ((empty($period) === true) || !TimePeriod::checkPeriod($period)) $period = Timestamp::getYearMonth(); $calendar = array('days' => array()); $calendar['period'] = $period; $calendar['year'] = substr($period, 0, 4); $calendar['month'] = substr($period, 4, 2); if ($db->query("SELECT DISTINCT DAYOFMONTH(FROM_UNIXTIME(written)) FROM {$database['prefix']}FeedItems WHERE YEAR(FROM_UNIXTIME(written)) = {$calendar['year']} AND MONTH(FROM_UNIXTIME(written)) = {$calendar['month']}")) { while (list($day) = $db->fetchArray()) array_push($calendar['days'], $day); } $calendar['days'] = array_flip($calendar['days']); $current = $calendar['year'] . $calendar['month']; $previous = TimePeriod::addPeriod($current, - 1); $next = TimePeriod::addPeriod($current, 1); $firstWeekday = date('w', mktime(0, 0, 0, $calendar['month'], 1, $calendar['year'])); $lastDay = date('t', mktime(0, 0, 0, $calendar['month'], 1, $calendar['year'])); $today = ($current == Timestamp::get('Ym') ? Timestamp::get('j') : null); $currentMonthStr = Timestamp::format('%Y.%m', TimePeriod::getTimeFromPeriod($current)); define('CRLF', "\r\n"); ob_start(); ?> <table class="calendar" cellpadding="0" cellspacing="1" style="width: 100%; table-layout: fixed"> <caption class="cal_month"> <?php echo $currentMonthStr;?> </caption> <thead> <tr> <th class="cal_week2"><?php echo _t('일요일');?></th> <th class="cal_week1"><?php echo _t('월요일');?></th> <th class="cal_week1"><?php echo _t('화요일');?></th> <th class="cal_week1"><?php echo _t('수요일');?></th> <th class="cal_week1"><?php echo _t('목요일');?></th> <th class="cal_week1"><?php echo _t('금요일');?></th> <th class="cal_week1"><?php echo _t('토요일');?></th> </tr> </thead> <tbody> <?php $day = 0; $totalDays = $firstWeekday + $lastDay; $lastWeek = ceil($totalDays / 7); for ($week=0; $week<$lastWeek; $week++) { // 주중에 현재 날짜가 포함되어 있으면 주를 현재 주 class(tt-current-week)를 부여한다. if (($today + $firstWeekday) >= $week * 7 && ($today + $firstWeekday) < ($week + 1) * 7) { echo ' <tr class="cal_week cal_current_week">'.CRLF; } else { echo ' <tr class="cal_week">'.CRLF; } for($weekday=0; $weekday<7; $weekday++) { $day++; $dayString = isset($calendar['days'][$day]) ? '<a class="cal_click" href="'.$service['path'].'/?archive='.$current.($day > 9 ? $day : "0$day").'">'.$day.'</a>' : $day; // 일요일, 평일, 토요일별로 class를 부여한다. switch ($weekday) { case 0: $className = " cal_day cal_day_sunday"; break; case 1: case 2: case 3: case 4: case 5: case 6: $className = " cal_day"; break; } // 오늘에 현재 class(tt-current-day)를 부여한다. $className .= $day == $today ? " cal_day4" : " cal_day3"; if ($week == 0) { if ($weekday < $firstWeekday) { $day--; // 달의 첫째날이 되기 전의 빈 칸. echo ' <td class="cal_day1"> </td>'.CRLF; } else { echo ' <td class="'.$className.'">'.$dayString.'</td>'.CRLF; } } else if ($week == ($lastWeek - 1)) { if ($day <= $lastDay) { echo ' <td class="'.$className.'">'.$dayString.'</td>'.CRLF; } else { // 달의 마지막날을 넘어간 날짜 빈 칸. echo ' <td class="cal_day2"> </td>'.CRLF; } } else { echo ' <td class="'.$className.'">'.$dayString.'</td>'.CRLF; } } echo ' </tr>'.CRLF; if ($day >= $lastDay) { break; } } ?> </tbody> </table> <?php $view = ob_get_contents(); ob_end_clean(); return $view; }