Esempio n. 1
0
function printIphoneCategoriesView($totalPosts, $categories)
{
    global $blogURL, $service, $blog;
    requireModel('blog.category');
    requireLibrary('blog.skin');
    $blogid = getBlogId();
    $categoryCount = 0;
    $categoryCountAll = 0;
    $parentCategoryCount = 0;
    $tree = array('id' => 0, 'label' => 'All Category', 'value' => $totalPosts, 'link' => "{$blogURL}/category/0", 'children' => array());
    foreach ($categories as $category1) {
        $children = array();
        if (doesHaveOwnership() || getCategoryVisibility($blogid, $category1['id']) > 1) {
            foreach ($category1['children'] as $category2) {
                if (doesHaveOwnership() || getCategoryVisibility($blogid, $category2['id']) > 1) {
                    array_push($children, array('id' => $category2['id'], 'label' => $category2['name'], 'value' => doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries'], 'link' => "{$blogURL}/category/" . $category2['id'], 'children' => array()));
                    $categoryCount = $categoryCount + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']);
                }
                $categoryCountAll = $categoryCountAll + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']);
            }
            $parentCategoryCount = doesHaveOwnership() ? $category1['entriesinlogin'] - $categoryCountAll : $category1['entries'] - $categoryCountAll;
            if ($category1['id'] != 0) {
                array_push($tree['children'], array('id' => $category1['id'], 'label' => $category1['name'], 'value' => $categoryCount + $parentCategoryCount, 'link' => "{$blogURL}/category/" . $category1['id'], 'children' => $children));
            }
            $categoryCount = 0;
            $categoryCountAll = 0;
            $parentCategoryCount = 0;
        }
    }
    return printIphonePrintTreeView($tree, true);
}
Esempio n. 2
0
requireModel('blog.category');
requireModel('blog.entry');
if (!empty($_POST['id'])) {
    $selected = $_POST['id'];
} else {
    if (empty($_GET['id'])) {
        $selected = 0;
    } else {
        $selected = $_GET['id'];
    }
}
if (!empty($_POST['visibility'])) {
    $setVisibility = $_POST['visibility'];
    $visibility = setCategoryVisibility($blogid, $selected, $setVisibility);
} else {
    $visibility = getCategoryVisibility($blogid, $selected);
}
if (!empty($_POST['deleteCategory'])) {
    $parent = getParentCategoryId($blogid, $_POST['deleteCategory']);
    $selected = is_null($parent) ? 0 : $parent;
    $_POST['modifyCategoryName'] = '';
    $_POST['modifyCategoryBodyId'] = '';
    deleteCategory($blogid, $_POST['deleteCategory']);
}
if (!empty($_POST['direction'])) {
    moveCategory($blogid, $selected, $_POST['direction']);
}
if ($selected == 0) {
    $depth = 0;
} else {
    if (!empty($_GET['name1']) && !empty($_GET['name2'])) {
Esempio n. 3
0
function getEntryListWithPagingByCategory($blogid, $category, $page, $count)
{
    global $database, $suri, $folderURL, $blog;
    if ($category === null) {
        return array();
    }
    if (!doesHaveOwnership() && getCategoryVisibility($blogid, $category) < 2 && $category != 0) {
        return array();
    }
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM {$database['prefix']}Categories WHERE blogid = {$blogid} AND parent = {$category}");
        array_push($categories, $category);
        if (!doesHaveOwnership()) {
            $categories = array_diff($categories, getCategoryVisibilityList($blogid, 'private'));
        }
        $cond = 'AND e.category IN (' . implode(', ', $categories) . ')';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0';
    } else {
        $cond = 'AND e.category >= 0';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
    }
    $visibility .= doesHaveOwnership() && !Acl::check('group.editors') ? ' AND (e.userid = ' . getUserId() . ' OR e.visibility > 0)' : '';
    $sql = "SELECT e.blogid,e.userid,e.id,e.title,e.comments,e.slogan,e.published\n\t\t\tFROM {$database['prefix']}Entries e \n\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} {$cond} \n\t\t\tORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, "{$folderURL}/" . (!getBlogSetting('useSloganOnCategory', true) && isset($suri['id']) ? $suri['id'] : $suri['value']));
}
Esempio n. 4
0
function getCategoriesViewInOwner($totalPosts, $categories, $selected)
{
    $context = Model_Context::getInstance();
    $blogid = getBlogId();
    importlib('model.blog.category');
    importlib('blogskin');
    // Initialize root category.
    $tree = array('id' => 0, 'label' => getCategoryNameById(getBlogId(), 0), 'value' => $totalPosts, 'link' => $context->getProperty('uri.blog') . "/owner/entry/category", 'children' => array());
    foreach ($categories as $category1) {
        $children = array();
        foreach ($category1['children'] as $category2) {
            if (getCategoryVisibility($blogid, $category1['id']) == 2) {
                array_push($children, array('id' => $category2['id'], 'label' => getCategoryVisibility($blogid, $category2['id']) == 2 ? $category2['name'] : _t('(비공개)') . ' ' . $category2['name'], 'value' => $category2['entriesinlogin'], 'link' => $context->getProperty('uri.blog') . "/owner/entry/category/?id={$category2['id']}&entries={$category2['entries']}&priority={$category1['priority']}&name1=" . rawurlencode($category2['name']) . "&name2=" . rawurlencode($category2['name']), 'children' => array()));
            } else {
                array_push($children, array('id' => $category2['id'], 'label' => '[!] ' . (getCategoryVisibility($blogid, $category2['id']) == 2 ? $category2['name'] : _t('(비공개)') . ' ' . $category2['name']), 'value' => $category2['entriesinlogin'], 'link' => $context->getProperty('uri.blog') . "/owner/entry/category/?id={$category2['id']}&entries={$category2['entries']}&priority={$category1['priority']}&name1=" . rawurlencode($category2['name']) . "&name2=" . rawurlencode($category2['name']), 'children' => array()));
            }
        }
        if ($category1['id'] != 0) {
            array_push($tree['children'], array('id' => $category1['id'], 'label' => getCategoryVisibility($blogid, $category1['id']) == 2 ? $category1['name'] : _t('(비공개)') . ' ' . $category1['name'], 'value' => $category1['entriesinlogin'], 'link' => $context->getProperty('uri.blog') . "/owner/entry/category/?&id={$category1['id']}&entries={$category1['entries']}&priority={$category1['priority']}&name1=" . rawurlencode($category1['name']), 'children' => $children));
        }
    }
    ob_start();
    printTreeView($tree, $selected);
    $view = ob_get_contents();
    ob_end_clean();
    return $view;
}
Esempio n. 5
0
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
$cache = pageCache::getInstance();
if (!isset($suri['id']) || Setting::getBlogSettingGlobal('useSloganOnCategory', 1) == 1) {
    $category = empty($suri['value']) ? 0 : getCategoryIdByLabel($blogid, $suri['value']);
    $listFeedURL = 'category/' . $suri['value'];
} else {
    $category = $suri['id'];
    $suri['value'] = getCategoryLabelById($blogid, $category);
    $listFeedURL = 'category/' . $suri['id'];
}
if (!doesHaveOwnership() && getCategoryVisibility($blogid, $category) < 2) {
    $category = null;
}
// Keylog as category description
$keylogEntry = null;
if (Setting::getBlogSettingGlobal('useKeywordAsCategory', true) == true) {
    $cache->reset();
    $cache->name = 'keyword-category-' . $category . '-';
    if ($cache->load()) {
        $keylogEntry = unserialize($cache->contents);
    } else {
        $entries = array();
        $entries[0] = getKeylogByTitle(getBlogId(), $suri['value']);
        if (!empty($entries[0])) {
            $keylogEntry = $entries;
            $cache->contents = serialize($entries);
Esempio n. 6
0
function getEntryListWithPagingByCategory($blogid, $category, $page, $count)
{
    if ($category === null) {
        return array();
    }
    if (!doesHaveOwnership() && getCategoryVisibility($blogid, $category) < 2 && $category != 0) {
        return array();
    }
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    if ($category > 0) {
        $pool->init("Categories");
        $pool->setQualifier("blogid", "eq", $blogid);
        $pool->setQualifier("parent", "eq", $category);
        $categories = $pool->getColumn("id");
        array_push($categories, $category);
        if (!doesHaveOwnership()) {
            $categories = array_diff($categories, getCategoryVisibilityList($blogid, 'private'));
        }
        $pool->init("Entries");
        $pool->setAlias("Entries", "e");
        $pool->setQualifier("e.category", "hasoneof", $categories);
        if (!doesHaveOwnership()) {
            $pool->setQualifier("e.visibility", ">", 0);
        }
    } else {
        $pool->init("Entries");
        $pool->setAlias("Entries", "e");
        $pool->setQualifier("e.category", ">=", 0);
        if (!doesHaveOwnership()) {
            $pool->setQualifier("e.visibility", ">", 0);
            $pool = getPrivateCategoryExclusionQualifier($pool, $blogid);
        }
    }
    if (doesHaveOwnership() && !Acl::check('group.editors')) {
        $pool->setQualifierSet(array("e.userid", "eq", getUserId()), "OR", array("e.visibility", ">", 0));
    }
    $pool->setProjection("e.blogid", "e.userid", "e.id", "e.title", "e.comments", "e.slogan", "e.published");
    $pool->setOrder("e.published", "desc");
    return Paging::fetch($pool, $page, $count, $ctx->getProperty('uri.folder') . "/" . (!$ctx->getProperty('blog.useSloganOnCategory', true) && $ctx->getProperty('suri.id', null) != null ? $ctx->getProperty('suri.id') : $ctx->getProperty('suri.value')));
}
Esempio n. 7
0
function getEntryListWithPagingByCategory($blogid, $category, $page, $count)
{
    $ctx = Model_Context::getInstance();
    if ($category === null) {
        return array();
    }
    if (!doesHaveOwnership() && getCategoryVisibility($blogid, $category) < 2 && $category != 0) {
        return array();
    }
    if ($category > 0) {
        $categories = POD::queryColumn("SELECT id FROM " . $ctx->getProperty('database.prefix') . "Categories WHERE blogid = {$blogid} AND parent = {$category}");
        array_push($categories, $category);
        if (!doesHaveOwnership()) {
            $categories = array_diff($categories, getCategoryVisibilityList($blogid, 'private'));
        }
        $cond = 'AND e.category IN (' . implode(', ', $categories) . ')';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0';
    } else {
        $cond = 'AND e.category >= 0';
        $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
    }
    $visibility .= doesHaveOwnership() && !Acl::check('group.editors') ? ' AND (e.userid = ' . getUserId() . ' OR e.visibility > 0)' : '';
    $sql = "SELECT e.blogid,e.userid,e.id,e.title,e.comments,e.slogan,e.published\n\t\t\tFROM " . $ctx->getProperty('database.prefix') . "Entries e \n\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} {$cond} \n\t\t\tORDER BY e.published DESC";
    return Paging::fetch($sql, $page, $count, $ctx->getProperty('uri.folder') . "/" . (!$ctx->getProperty('blog.useSloganOnCategory', true) && $ctx->getProperty('suri.id', null) != null ? $ctx->getProperty('suri.id') : $ctx->getProperty('suri.value')));
}
Esempio n. 8
0
function printMobileCategoriesView($totalPosts, $categories)
{
    $context = Model_Context::getInstance();
    requireModel('blog.category');
    requireLibrary('blog.skin');
    $blogid = $context->getProperty('blog.id');
    $categoryCount = 0;
    $categoryCountAll = 0;
    $parentCategoryCount = 0;
    $tree = array('id' => 0, 'label' => 'All Category', 'value' => $totalPosts, 'link' => $context->getProperty('uri.blog') . "/category/0", 'children' => array());
    foreach ($categories as $category1) {
        $children = array();
        if (doesHaveOwnership() || getCategoryVisibility($blogid, $category1['id']) > 1) {
            foreach ($category1['children'] as $category2) {
                if (doesHaveOwnership() || getCategoryVisibility($blogid, $category2['id']) > 1) {
                    array_push($children, array('id' => $category2['id'], 'label' => $category2['name'], 'value' => doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries'], 'link' => $context->getProperty('uri.blog') . "/category/" . $category2['id'], 'children' => array()));
                    $categoryCount = $categoryCount + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']);
                }
                $categoryCountAll = $categoryCountAll + (doesHaveOwnership() ? $category2['entriesinlogin'] : $category2['entries']);
            }
            $parentCategoryCount = doesHaveOwnership() ? $category1['entriesinlogin'] - $categoryCountAll : $category1['entries'] - $categoryCountAll;
            if ($category1['id'] != 0) {
                array_push($tree['children'], array('id' => $category1['id'], 'label' => $category1['name'], 'value' => $categoryCount + $parentCategoryCount, 'link' => $context->getProperty('uri.blog') . "/category/" . $category1['id'], 'children' => $children));
            }
            $categoryCount = 0;
            $categoryCountAll = 0;
            $parentCategoryCount = 0;
        }
    }
    return printMobilePrintTreeView($tree, true);
}