Example #1
0
function markAsReadAll($blogid)
{
    global $database;
    $registeredFeeds = POD::queryColumn("SELECT feed\n\t\tFROM {$database['prefix']}FeedGroupRelations\n\t\tWHERE blogid = {$blogid}");
    if (isset($registeredFeeds)) {
        $feedItems = array();
        foreach ($registeredFeeds as $feed) {
            /// Gather feed information
            $feedIds = POD::queryColumn("SELECT id FROM {$database['prefix']}FeedItems WHERE feed = {$feed}");
            if (!empty($feedIds)) {
                $feedItems = array_merge($feedItems, $feedIds);
            }
        }
        if (!empty($feedItems)) {
            $readFeedItems = POD::queryColumn("SELECT item FROM {$database['prefix']}FeedReads\n\t\t\t\tWHERE blogid = {$blogid}");
            $unreadFeedItems = array_diff($feedItems, $readFeedItems);
            if (!empty($unreadFeedItems)) {
                foreach ($unreadFeedItems as $item) {
                    POD::execute("INSERT INTO {$database['prefix']}FeedReads (blogid, item) VALUES ({$blogid}, {$item})");
                }
            }
        }
    }
    return true;
}
function getRemoteResponseLogsWithPagingForOwner($blogid, $category, $site, $ip, $search, $page, $count, $type = null)
{
    global $database;
    if (!is_null($type)) {
        $typeFilter = " AND t.responsetype = '" . POD::escapeString($type) . "'";
    } else {
        $typeFilter = '';
    }
    $postfix = '&status=sent';
    $sql = "SELECT t.*, e.title AS subject, c.name AS categoryName \n\t\tFROM {$database['prefix']}RemoteResponseLogs t \n\t\tLEFT JOIN {$database['prefix']}Entries e ON t.blogid = e.blogid AND t.entry = e.id AND e.draft = 0 \n\t\tLEFT JOIN {$database['prefix']}Categories c ON t.blogid = c.blogid AND e.category = c.id \n\t\tWHERE t.blogid = {$blogid} {$typeFilter}";
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = {$blogid} AND parent = {$category}");
        array_push($categories, $category);
        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
        $postfix .= '&category=' . rawurlencode($category);
    } else {
        $sql .= ' AND e.category >= 0';
    }
    if (!empty($search)) {
        $search = escapeSearchString($search);
        $sql .= " AND (e.title LIKE '%{$search}%' OR e.content LIKE '%{$search}%')";
        $postfix .= '&search=' . rawurlencode($search);
    }
    $sql .= ' ORDER BY t.written DESC';
    list($responses, $paging) = Paging::fetch($sql, $page, $count);
    if (strlen($postfix) > 0) {
        $paging['postfix'] .= $postfix . '&withSearch=on';
    }
    return array($responses, $paging);
}
Example #3
0
function getTrashCommentsWithPagingForOwner($blogid, $category, $name, $ip, $search, $page, $count)
{
    global $database;
    $sql = "SELECT c.*, e.title, c2.name AS parentName \n\t\tFROM {$database['prefix']}Comments c \n\t\tLEFT JOIN {$database['prefix']}Entries e ON c.blogid = e.blogid AND c.entry = e.id AND e.draft = 0 \n\t\tLEFT JOIN {$database['prefix']}Comments c2 ON c.parent = c2.id AND c.blogid = c2.blogid \n\t\tWHERE c.blogid = {$blogid} AND c.isfiltered > 0";
    $postfix = '';
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE parent = {$category}");
        array_push($categories, $category);
        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
        $postfix .= '&category=' . rawurlencode($category);
    } else {
        $sql .= ' AND (e.category >= 0 OR c.entry = 0)';
    }
    if (!empty($name)) {
        $sql .= ' AND c.name = \'' . POD::escapeString($name) . '\'';
        $postfix .= '&name=' . rawurlencode($name);
    }
    if (!empty($ip)) {
        $sql .= ' AND c.ip = \'' . POD::escapeString($ip) . '\'';
        $postfix .= '&ip=' . rawurlencode($ip);
    }
    if (!empty($search)) {
        $search = escapeSearchString($search);
        $sql .= " AND (c.name LIKE '%{$search}%' OR c.homepage LIKE '%{$search}%' OR c.comment LIKE '%{$search}%')";
        $postfix .= '&search=' . rawurlencode($search);
    }
    $sql .= ' ORDER BY c.written DESC';
    list($comments, $paging) = Paging::fetch($sql, $page, $count);
    if (strlen($postfix) > 0) {
        $paging['postfix'] .= $postfix . '&withSearch=on';
    }
    return array($comments, $paging);
}
Example #4
0
function getKeywordNames($blogid)
{
    global $database;
    $names = array();
    $visibility = doesHaveOwnership() ? '' : 'AND visibility > 0';
    $names = POD::queryColumn("SELECT title FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND draft = 0 {$visibility} AND category = -1 ORDER BY char_length(title) DESC");
    return $names;
}
Example #5
0
 public static function queryColumnWithDBCache($query, $prefix = null, $type = 'both', $count = -1)
 {
     $cache = queryCache::getInstance();
     $cache->reset($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryColumn($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Example #6
0
function finish($error = null)
{
    global $migrational, $blogid, $database;
    ?>
	<script type="text/javascript">
		//<![CDATA[
<?php 
    if ($error) {
        ?>
			//pi.style.backgroundColor = "red";
			alert("<?php 
        echo $error;
        ?>
");
<?php 
    } else {
        ?>
			alert("<?php 
        echo $migrational ? _t('성공적으로 이주되었습니다.') : _t('성공적으로 복원되었습니다.');
        ?>
");
<?php 
    }
    ?>
			window.parent.document.getElementById("progressDialog").style.display = "none";
			window.parent.document.getElementById("progressDialogTitle").innerHTML = "";
			window.parent.document.getElementById("progressText").innerHTML = "";
			window.parent.document.getElementById("progressTextSub").innerHTML = "";
		//]]>
	</script>
<?php 
    $activeEditors = POD::queryColumn("SELECT DISTINCT contenteditor FROM {$database}Entries WHERE blogid = {$blogid}");
    $activeFormatters = POD::queryColumn("SELECT DISTINCT contentformatter FROM {$database}Entries WHERE blogid = {$blogid}");
    if (!empty($activeEditors)) {
        foreach ($activeEditors as $editor) {
            activatePlugin($editor);
        }
    }
    if (!empty($activeFormatters)) {
        foreach ($activeFormatters as $formatter) {
            activatePlugin($formatter);
        }
    }
    echo _t('완료.');
    ?>
</body>
</html>
<?php 
    exit;
}
 function removeAll($removeAttachments = true)
 {
     global $database;
     $blogid = getBlogId();
     $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
     //POD::query("DELETE FROM {$database['prefix']}UserSettings WHERE user = $blogid");
     POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid} AND id <> 0");
     if (count($tags) > 0) {
         $tagliststr = implode(', ', $tags);
         $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
         if (count($nottargets) > 0) {
             $nottargetstr = implode(', ', $nottargets);
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
         } else {
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
         }
     }
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
         unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
     }
     if ($removeAttachments) {
         Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
         POD::query("UPDATE {$database['prefix']}BlogSettings SET logo = '' WHERE blogid = {$blogid}");
     }
 }
Example #8
0
function clearCache()
{
    global $database, $changed, $errorlog, $memcache;
    static $isCleared = false;
    if ($isCleared == true) {
        return;
    }
    if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': ';
        foreach ($blogids as $ids) {
            if (CacheControl::flushAll($ids) == false) {
                $errorlog = true;
            }
        }
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    if (!is_null($memcache)) {
        echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': ';
        if ($memcache->flush()) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': ';
    if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) {
        echo '<span class="result success">', _text('성공'), '</span></li>';
    } else {
        echo '<span class="result fail">', _text('실패'), '</span></li>';
    }
    $isCleared = true;
}
Example #9
0
 function queryColumnWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1)
 {
     //		requireComponent('Needlworks.Cache.PageCache');
     $cache = new queryCache($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryColumn($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Example #10
0
$IV = array('REQUEST' => array('name' => array('string'), 'type' => array('int', 'min' => 1, 'max' => 2)));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
if ($blogid != 1) {
    Respond::ResultPage(1);
    exit;
}
requireModel('common.setting');
$definedTables = getDefinedTableNames();
if ($_REQUEST['type'] == 1) {
    // type 1, plugin
    $values = explode('/', $_REQUEST['name'], 2);
    $pluginname = $values[0];
    $version = $values[1];
    $query = "select name from {$database['prefix']}ServiceSettings WHERE value = '" . POD::escapeString($_REQUEST['name']) . "'";
    $plugintablesraw = POD::queryColumn($query);
    if (count($plugintablesraw) <= 0) {
        Respond::ResultPage(1);
        exit;
    }
    $plugintables = array();
    foreach ($plugintablesraw as $dbname) {
        $origname = $dbname;
        $dbname = $database['prefix'] . substr($dbname, 9);
        if (!doesExistTable($dbname)) {
            Respond::ResultPage(1);
            exit;
        }
        if (in_array($dbname, $definedTables)) {
            Respond::ResultPage(1);
            exit;
Example #11
0
function updateLink($blogid, $link)
{
    global $database;
    $id = $link['id'];
    $name = UTF8::lessenAsEncoding(trim($link['name']), 255);
    $url = UTF8::lessenAsEncoding(trim($link['url']), 255);
    if (empty($name) || empty($url)) {
        return false;
    }
    $category = isset($link['category']) ? $link['category'] : 0;
    $name = POD::escapeString($name);
    $url = POD::escapeString($url);
    if (isset($link['newCategory']) && !empty($link['newCategory'])) {
        // Add new category information
        $newCategoryTitle = UTF8::lessenAsEncoding(trim($link['newCategory']), 255);
        $newCategoryId = addLinkCategory($blogid, $newCategoryTitle);
        if (!empty($newCategoryId)) {
            $category = $newCategoryId;
        }
    }
    $rss = isset($link['rss']) ? POD::escapeString(UTF8::lessenAsEncoding(trim($link['rss']), 255)) : '';
    $result = POD::execute("UPDATE {$database['prefix']}Links\n\t\t\t\tSET\n\t\t\t\t\tcategory = {$category},\n\t\t\t\t\tname = '{$name}',\n\t\t\t\t\turl = '{$url}',\n\t\t\t\t\trss = '{$rss}',\n\t\t\t\t\twritten = UNIX_TIMESTAMP()\n\t\t\t\tWHERE\n\t\t\t\t\tblogid = {$blogid} and id = {$link['id']}");
    // Garbage correction
    $existCategories = POD::queryColumn("SELECT DISTINCT category FROM {$database['prefix']}Links\n\t\t\tWHERE blogid = {$blogid}");
    @POD::execute("DELETE FROM {$database['prefix']}LinkCategories\n\t\t\tWHERE blogid = {$blogid} AND id NOT IN (" . implode(",", $existCategories) . ")");
    return $result;
}
Example #12
0
function getFeedItemByEntries($entries)
{
    global $database, $serviceURL, $defaultURL, $blog, $service;
    $channelItems = array();
    foreach ($entries as $row) {
        $entryURL = $defaultURL . '/' . ($blog['useSloganOnPost'] ? 'entry/' . rawurlencode($row['slogan']) : $row['id']);
        $content = getEntryContentView($row['blogid'], $row['id'], $row['content'], $row['contentformatter'], true, 'Post', true, true);
        $content = preg_replace('/<a href=("|\')(#[^\\1]+)\\1/i', '<a href=$1' . htmlspecialchars($entryURL) . '$2$1', $content);
        if (!$blog['publishWholeOnRSS']) {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "\">" . _t('글 전체보기') . "</a></strong></p>";
        } else {
            $content .= "<p><strong><a href=\"" . htmlspecialchars($entryURL) . "?commentInput=true#entry" . $row['id'] . "WriteComment\">" . _t('댓글 쓰기') . "</a></strong></p>";
        }
        $row['repliesCount'] = $row['comments'] + $row['trackbacks'];
        $item = array('id' => $row['id'], 'title' => RSSMessage($row['title']), 'link' => $entryURL, 'categories' => array(), 'description' => RSSMessage($content), 'author' => RSSMessage($row['author']), 'pubDate' => $row['published'], 'updDate' => $row['modified'], 'comments' => $entryURL . '#entry' . $row['id'] . 'comment', 'guid' => "{$defaultURL}/" . $row['id'], 'replies' => array('count' => $row['repliesCount']));
        if (!empty($row['email'])) {
            $item['email'] = RSSMessage($row['email']);
        }
        if (isset($service['useNumericURLonRSS'])) {
            if ($service['useNumericURLonRSS'] == true) {
                $item['link'] = $defaultURL . "/" . $row['id'];
            }
        }
        if (!empty($row['id'])) {
            $sql = "SELECT name, size, mime FROM {$database['prefix']}Attachments WHERE parent= {$row['id']} AND blogid = {$row['blogid']} AND enclosure = 1";
            $attaches = POD::queryRow($sql);
            if (count($attaches) > 0) {
                $item['enclosure'] = array('url' => "{$serviceURL}/attach/{$blogid}/{$attaches['name']}", 'length' => $attaches['size'], 'type' => $attaches['mime']);
            }
        }
        array_push($item['categories'], $row['categoryName']);
        $tag_result = POD::queryColumn("SELECT name \n\t\t\t\tFROM {$database['prefix']}Tags, \n\t\t\t\t\t{$database['prefix']}TagRelations \n\t\t\t\tWHERE id = tag \n\t\t\t\t\tAND entry = {$row['id']}\n\t\t\t\t\tAND blogid = {$row['blogid']}\n\t\t\t\tORDER BY name");
        foreach ($tag_result as $tag) {
            array_push($item['categories'], $tag);
        }
        array_push($channelItems, $item);
    }
    return $channelItems;
}
Example #13
0
function getEntriesWithPagingForOwner($blogid, $category, $search, $page, $count, $visibility = null, $starred = null, $draft = null, $tag = null)
{
    global $database, $suri;
    $teamMemberFilter = "";
    if (!Acl::check("group.editors", "entry.list")) {
        $teamMemberFilter = " AND e.userid = " . getUserId();
    }
    $sqlTable = "SELECT e.*, c.label AS categoryLabel, d.id AS draft \n\t\tFROM {$database['prefix']}Entries e \n\t\tLEFT JOIN {$database['prefix']}Categories c ON e.category = c.id AND e.blogid = c.blogid \n\t\tLEFT JOIN {$database['prefix']}Entries d ON e.blogid = d.blogid AND e.id = d.id AND d.draft = 1 ";
    $sql = " WHERE e.blogid = {$blogid} AND e.draft = 0" . $teamMemberFilter;
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = {$blogid} AND parent = {$category}");
        array_push($categories, $category);
        $sql .= ' AND e.category IN (' . implode(', ', $categories) . ')';
    } else {
        if ($category == -3) {
            $sql .= ' AND e.category = 0';
        } else {
            if ($category == -5) {
                $sql .= ' AND e.category >= -2';
            } else {
                if ($category == 0) {
                    $sql .= ' AND e.category >= 0';
                } else {
                    $sql .= ' AND e.category = ' . $category;
                }
            }
        }
    }
    if (isset($visibility)) {
        if (Validator::isInteger($visibility, 0, 3)) {
            $sql .= ' AND e.visibility = ' . $visibility;
        } else {
            $sql .= ' AND e.visibility ' . $visibility;
        }
    }
    if (isset($starred)) {
        if (Validator::isInteger($starred, 0, 3)) {
            $sql .= ' AND e.starred = ' . $starred;
        } else {
            $sql .= ' AND e.starred ' . $starred;
        }
    }
    if (!empty($search)) {
        $search = escapeSearchString($search);
        $sql .= " AND (e.title LIKE '%{$search}%' OR e.content LIKE '%{$search}%')";
    }
    if (!empty($tag)) {
        $sqlTable .= " LEFT JOIN {$database['prefix']}TagRelations t ON e.id = t.entry AND e.blogid = t.blogid ";
        $sql .= ' AND t.tag = ' . $tag;
    }
    $sql .= ' ORDER BY e.published DESC';
    return Paging::fetch($sqlTable . $sql, $page, $count);
}
Example #14
0
 function deleteTagsWithEntryId($blogid, $entry)
 {
     global $database;
     $taglist = POD::queryColumn("SELECT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid} AND entry = {$entry}");
     if (!is_null($taglist)) {
         $tagliststr = implode(',', $taglist);
         foreach ($taglist as $tagid) {
             CacheControl::flushTag($tagid);
         }
         POD::execute("DELETE FROM {$database['prefix']}TagRelations\n\t\t\t\tWHERE blogid = {$blogid} AND entry = {$entry}");
         $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
         if (count($nottargets) > 0) {
             $nottargetstr = implode(', ', $nottargets);
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
         } else {
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} )");
         }
     }
 }
Example #15
0
$IV = array('GET' => array('range' => array('int', 'min' => -1, 'max' => 64, 'default' => -1)));
require ROOT . '/library/preprocessor.php';
require ROOT . '/interface/common/control/header.php';
requirePrivilege('group.creators');
function getSymbolByQuantity($bytes)
{
    $symbols = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
    $exp = floor(log($bytes) / log(1024));
    return sprintf('%.2f ' . $symbols[$exp], $bytes / pow(1024, floor($exp)));
}
/* Current time */
$serverTime = strftime("Server Time: %Y-%m-%d %H:%M:%S %z (%Z)", time());
/* Database version */
$dbVersion = '';
//if( $service['dbms'] == 'mysql' ) {
$dbVersion = POD::queryColumn("SELECT VERSION()");
$dbVersion = "MySQL: " . $dbVersion[0];
$dbStat = preg_replace("/\\s{2,}/", "<br />", POD::stat());
//}
/* Webserver information */
$webServer = "Unknown";
if (function_exists('apache_get_version')) {
    $webServer = apache_get_version();
}
/* OS version */
$osVersion = "Unknown";
if (function_exists('php_uname')) {
    $osVersion = php_uname();
}
/* Disk space */
$totalSpace = getSymbolByQuantity(disk_total_space(dirname(__FILE__)));
Example #16
0
 function updateRemoteResponses($id = null)
 {
     global $database;
     $this->init();
     if (!is_null($id) && !is_numeric($id)) {
         return false;
     }
     $posts = is_null($id) ? POD::queryColumn("SELECT id FROM {$database['prefix']}Entries WHERE blogid = " . $this->blogid . " AND category >= 0 AND draft = 0") : array($id);
     if (!is_array($posts)) {
         return false;
     }
     $succeeded = true;
     foreach ($posts as $id) {
         $trackbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = " . $this->blogid . " AND entry = {$id} AND isfiltered = 0 AND responsetype = 'trackback'");
         if (!is_null($trackbacks)) {
             if (!POD::execute("UPDATE {$database['prefix']}Entries SET trackbacks = {$trackbacks} \n\t\t\t\t\tWHERE blogid = " . $this->blogid . " AND id = {$id}")) {
                 $succeeded = false;
             }
         }
         $pingbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = " . $this->blogid . " AND entry = {$id} AND isFiltered = 0 AND responsetype = 'pingback'");
         if (!is_null($pingbacks)) {
             if (!POD::execute("UPDATE {$database['prefix']}Entries SET pingbacks = {$pingbacks}\n\t\t\t\t\tWHERE blogid = " . $this->blogid . " AND id = {$id}")) {
                 $succeeded = false;
             }
         }
     }
     return $succeeded;
 }
Example #17
0
function getCommentPageById($blogid, $entryId, $commentId)
{
    global $database, $skinSetting;
    $totalGuestbookId = POD::queryColumn("SELECT id\n\t\tFROM {$database['prefix']}Comments\n\t\tWHERE\n\t\t\tblogid = {$blogid} AND entry = {$entryId} AND isfiltered = 0 AND parent is null\n\t\tORDER BY\n\t\t\twritten DESC");
    $order = array_search($commentId, $totalGuestbookId);
    if ($order == false) {
        $parentCommentId = POD::queryCell("SELECT parent\n\t\t\tFROM {$database['prefix']}Comments\n\t\t\tWHERE\n\t\t\t\tblogid = {$blogid} AND entry = {$entryId} AND isfiltered = 0 AND id = {$commentId}");
        if ($parentCommentId != false) {
            $order = array_search($parentCommentId, $totalGuestbookId);
        } else {
            return false;
        }
    }
    $base = $entryId == 0 ? $skinSetting['commentsOnGuestbook'] : $skinSetting['commentsOnEntry'];
    return intval($order / $base) + 1;
}
 function flushEntry($entryId = null)
 {
     global $database;
     if (empty($entryId)) {
         $entryId = '';
     } else {
         $entryId = intval($entryId);
     }
     $Entries = POD::queryColumn("SELECT name\n\t\t\tFROM {$database['prefix']}PageCacheLog\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND (name like 'entry-" . $entryId . "-%' OR name like '%RSS-" . $entryId . "' OR name like '%ATOM-" . $entryId . "')");
     if (!empty($Entries)) {
         CacheControl::purgeItems($Entries);
     }
     if (!empty($entryId)) {
         $entry = POD::queryRow("SELECT userid, category, published FROM {$database['prefix']}Entries\n\t\t\t\tWHERE blogid = " . getBlogId() . " AND id = {$entryId}");
         if (!empty($entry)) {
             $entry['period'] = Timestamp::getYearMonth($entry['published']);
             CacheControl::flushAuthor($entry['userid']);
             CacheControl::flushCategory($entry['category']);
             CacheControl::flushArchive($entry['period']);
             CacheControl::flushDBCache('entry');
         }
     } else {
         CacheControl::flushAuthor();
         CacheControl::flushCategory();
         CacheControl::flushDBCache('entry');
     }
     return true;
 }
Example #19
0
 public function getColumn($field = '*')
 {
     $field = $this->_treatReservedFields($field);
     return POD::queryColumn('SELECT ' . $field . ' FROM ' . $this->table . $this->_makeWhereClause());
 }
Example #20
0
function removeBlog($blogid)
{
    global $database;
    if (getServiceSetting("defaultBlogId", 1) == $blogid) {
        return false;
    }
    $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
    $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
    //Clear Tables
    POD::execute("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}BlogSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}BlogStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}EntriesArchive WHERE blogid = {$blogid}");
    //	POD::execute("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = $blogid");
    POD::execute("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}FeedSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}PageCacheLog WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}SkinSettings WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}Privileges WHERE blogid = {$blogid}");
    POD::execute("DELETE FROM {$database['prefix']}XMLRPCPingSettings WHERE blogid = {$blogid}");
    //Delete Tags
    if (count($tags) > 0) {
        $tagliststr = implode(', ', $tags);
        // Tag id used at deleted blog.
        $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
        // Tag id used at other blogs.
        if (count($nottargets) > 0) {
            $nottargetstr = implode(', ', $nottargets);
            POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
        } else {
            POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
        }
    }
    //Delete Feeds
    if (count($feeds) > 0) {
        foreach ($feeds as $feedId) {
            deleteFeed($blogid, $feedId);
        }
    }
    //Clear Plugin Database
    // TODO : encapsulate with 'value'
    $query = "SELECT name, value FROM {$database['prefix']}ServiceSettings WHERE name like 'Database\\_%'";
    $plugintablesraw = POD::queryAll($query);
    foreach ($plugintablesraw as $table) {
        $dbname = $database['prefix'] . substr($table['name'], 9);
        POD::execute("DELETE FROM {$database['prefix']}{$dbname} WHERE blogid = {$blogid}");
    }
    //Clear RSS Cache
    if (file_exists(ROOT . "/cache/rss/{$blogid}.xml")) {
        unlink(ROOT . "/cache/rss/{$blogid}.xml");
    }
    //Delete Attachments
    Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
    return true;
}
Example #21
0
 public function getColumn($field = '*', $options = null)
 {
     $field = $this->_treatReservedFields($field);
     $options = $this->_treatOptions($options);
     if ($options['usedbcache'] == true) {
         $result = POD::queryColumnWithDBCache('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause(), $options['cacheprefix']);
     } else {
         $result = POD::queryColumn('SELECT ' . $options['filter'] . $field . ' FROM ' . $this->_getTableName() . $this->_extendClause() . $this->_makeWhereClause());
     }
     $this->_manage_pool_stack();
     return $result;
 }
Example #22
0
 function queryColumnWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1)
 {
     $cache = new queryCache($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::queryColumn($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Example #23
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;
}
Example #24
0
function getCommentPageById($blogid, $entryId, $commentId)
{
    $ctx = Model_Context::getInstance();
    $totalGuestbookId = POD::queryColumn("SELECT id\n\t\tFROM " . $ctx->getProperty('database.prefix') . "Comments\n\t\tWHERE\n\t\t\tblogid = {$blogid} AND entry = {$entryId} AND isfiltered = 0 AND parent is null\n\t\tORDER BY\n\t\t\twritten DESC");
    $order = array_search($commentId, $totalGuestbookId);
    if ($order == false) {
        $parentCommentId = POD::queryCell("SELECT parent\n\t\t\tFROM " . $ctx->getProperty('database.prefix') . "Comments\n\t\t\tWHERE\n\t\t\t\tblogid = {$blogid} AND entry = {$entryId} AND isfiltered = 0 AND id = {$commentId}");
        if ($parentCommentId != false) {
            $order = array_search($parentCommentId, $totalGuestbookId);
        } else {
            return false;
        }
    }
    $base = $entryId == 0 ? $ctx->getProperty('skin.commentsOnGuestbook') : $ctx->getProperty('skin.commentsOnEntry');
    return intval($order / $base) + 1;
}
Example #25
0
 static function getOwnedBlogs($userid = null)
 {
     global $database;
     if (!isset($userid)) {
         $userid = getUserId();
     }
     return POD::queryColumn("SELECT blogid FROM {$database['prefix']}Privileges WHERE userid = {$userid} AND acl > 15");
 }
Example #26
0
function clearCache()
{
    global $database, $changed, $errorlog, $memcache;
    static $isCleared = false;
    $context = Model_Context::getInstance();
    if ($isCleared == true) {
        return;
    }
    if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': ';
        foreach ($blogids as $ids) {
            if (CacheControl::flushAll($ids) == false) {
                $errorlog = true;
            }
        }
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    if ($context->getProperty('service.codecache', false)) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('코드 캐시를 초기화합니다.'), ': ';
        $code = new CodeCache();
        $code->flush();
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    if (!is_null($memcache)) {
        echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': ';
        if ($memcache->flush()) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': ';
    if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) {
        echo '<span class="result success">', _text('성공'), '</span></li>';
    } else {
        echo '<span class="result fail">', _text('실패'), '</span></li>';
    }
    if (!is_null($blogids = POD::queryColumn("SELECT DISTINCT blogid FROM {$database['prefix']}BlogSettings"))) {
        $changed = true;
        $errorlog = false;
        echo '<li>', _textf('댓글 및 트랙백 휴지통을 비웁니다.'), ': ';
        foreach ($blogids as $ids) {
            emptyTrash(true, $ids);
            emptyTrash(false, $ids);
        }
        if ($errorlog == false) {
            echo '<span class="result success">', _text('성공'), '</span></li>';
        } else {
            echo '<span class="result fail">', _text('실패'), '</span></li>';
        }
    }
    $isCleared = true;
}
Example #27
0
<?php 
if ($service['type'] != "single") {
    ?>
				<th><?php 
    echo _t('바로 가기');
    ?>
</th>
<?php 
}
?>
				</tr>
			</thead>
			<tbody>
<?php 
$row = 25;
$bloglist = POD::queryColumn("SELECT blogid,name FROM `{$database['prefix']}BlogSettings` WHERE name = 'name' ORDER BY blogid ASC LIMIT " . ($page - 1) * $row . " ,{$row}");
$blogcount = POD::queryCount("SELECT blogid FROM `{$database['prefix']}BlogSettings` WHERE name = 'name'");
$pages = (int) (($blogcount - 0.5) / $row) + 1;
if ($pages < $page) {
    printRespond(array('error' => -2, 'result' => $pages));
}
if ($bloglist) {
    $tempString = "";
    foreach ($bloglist as $itemBlogId) {
        $result = POD::queryAll("SELECT * FROM `{$database['prefix']}BlogSettings` WHERE blogid = {$itemBlogId}");
        foreach ($result as $row) {
            $bsetting[$row['name']] = $row['value'];
        }
        $bsetting['owner'] = POD::queryCell("SELECT userid FROM `{$database['prefix']}Privileges` WHERE acl & " . BITWISE_OWNER . " != 0 AND blogid = " . $itemBlogId);
        ?>
				<tr id="table-blog-list_<?php 
Example #28
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;
}
 function flushEntry($entryId = null)
 {
     global $database;
     if (empty($entryId)) {
         $entryId = '';
     } else {
         $entryId = $entryId . '\\_';
     }
     $cache = pageCache::getInstance();
     $Entries = POD::queryColumn("SELECT name\n\t\t\tFROM {$database['prefix']}PageCacheLog\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND (name like 'entry\\_" . $entryId . "%' OR name = 'commentRSS_" . $entryId . "')");
     CacheControl::purgeItems($Entries);
     if (!empty($entryId)) {
         $entry = POD::queryCell("SELECT userid, category FROM {$database['prefix']}Entries\n\t\t\t\tWHERE blogid = " . getBlogId() . " AND id = {$entryId}");
         if (!empty($entry)) {
             CacheControl::flushAuthor($entry['userid']);
             CacheControl::flushCategory($entry['category']);
             CacheControl::flushDBCache();
         }
     } else {
         CacheControl::flushAuthor();
         CacheControl::flushCategory();
         CacheControl::flushDBCache();
     }
     unset($cache);
     return true;
 }
Example #30
0
function setChildCategoryVisibility($blogid, $id, $visibility)
{
    global $database;
    if ($id == 0) {
        return false;
    }
    $childCategories = POD::queryColumn("SELECT id\n\t\tFROM {$database['prefix']}Categories WHERE blogid = {$blogid} AND parent = {$id}");
    if ($childCategories != false) {
        foreach ($childCategories as $childCategory) {
            $result = POD::query("UPDATE {$database['prefix']}Categories\n\t\t\t\tSET visibility = {$visibility}\n\t\t\t\tWHERE blogid = {$blogid} AND id = {$childCategory}");
            if ($result == false) {
                return false;
            }
        }
        return $result ? $visibility : false;
    }
    return $visibility;
}