Exemplo n.º 1
0
function protectEntry($id, $password)
{
    global $database;
    $password = POD::escapeString($password);
    $result = POD::queryCount("UPDATE {$database['prefix']}Entries SET password = '******', modified = UNIX_TIMESTAMP() WHERE blogid = " . getBlogId() . " AND id = {$id} AND visibility = 1");
    if ($result > 0) {
        CacheControl::flushEntry($id);
        CacheControl::flushDBCache('entry');
        CacheControl::flushDBCache('comment');
        CacheControl::flushDBCache('trackback');
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
0
function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSloganOnTag)
{
    $ctx = Model_Context::getInstance();
    $useSloganOnPost = $useSloganOnPost ? 1 : 0;
    $useSloganOnCategory = $useSloganOnCategory ? 1 : 0;
    $useSloganOnTag = $useSloganOnTag ? 1 : 0;
    if ($useSloganOnPost == $ctx->getProperty('blog.useSloganOnPost') && $useSloganOnCategory == $ctx->getProperty('blog.useSloganOnCategory') && $useSloganOnTag == $ctx->getProperty('blog.useSloganOnTag')) {
        return true;
    }
    /*	if(Setting::setBlogSettingGlobal('useSloganOnPost',$useSlogan) === false
    	|| Setting::setBlogSettingGlobal('useSloganOnCategory',$useSlogan) === false
    	|| Setting::setBlogSettingGlobal('useSloganOnTag',$useSlogan) === false
    		) {
    		return false;
    	}*/
    Setting::setBlogSettingGlobal('useSloganOnPost', $useSloganOnPost);
    Setting::setBlogSettingGlobal('useSloganOnCategory', $useSloganOnCategory);
    Setting::setBlogSettingGlobal('useSloganOnTag', $useSloganOnTag);
    $ctx->setProperty('blog.useSloganOnPost', $useSloganOnPost);
    $ctx->setProperty('blog.useSloganOnCategory', $useSloganOnCategory);
    $ctx->setProperty('blog.useSloganOnTag', $useSloganOnTag);
    requireModel('blog.feed');
    CacheControl::flushCategory();
    CacheControl::flushEntry();
    CacheControl::flushTag();
    fireEvent('ToggleBlogSlogan', null, $useSloganOnPost);
    clearFeed();
    return true;
}
Exemplo n.º 3
0
function updateCommentsOfEntry($blogid, $entryId)
{
    $pool = DBModel::getInstance();
    $pool->reset('Comments');
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('entry', 'eq', $entryId);
    $pool->setQualifier('isfiltered', 'eq', 0);
    $commentCount = $pool->getCell('COUNT(*)');
    $pool->reset('Entries');
    $pool->setAttribute('comments', $commentCount);
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('id', 'eq', $entryId);
    $pool->update();
    if ($entryId >= 0) {
        CacheControl::flushEntry($entryId);
    }
    return $commentCount;
}
Exemplo n.º 4
0
function updateCommentsOfEntry($blogid, $entryId)
{
    global $database;
    requireComponent('Needlworks.Cache.PageCache');
    $commentCount = POD::queryCell("SELECT COUNT(*)\n\t\tFROM {$database['prefix']}Comments\n\t\tWHERE blogid = {$blogid}\n\t\t\tAND entry = {$entryId}\n\t\t\tAND isfiltered = 0");
    POD::query("UPDATE {$database['prefix']}Entries\n\t\tSET comments = {$commentCount}\n\t\tWHERE blogid = {$blogid}\n\t\t\tAND id = {$entryId}");
    if ($entryId >= 0) {
        CacheControl::flushEntry($entryId);
    }
    return $commentCount;
}
Exemplo n.º 5
0
<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('useResamplingAsDefault' => array('string', 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
$isAjaxRequest = false;
// checkAjaxRequest();
// 기본 설정
if (isset($_POST['useResamplingAsDefault']) && $_POST['useResamplingAsDefault'] == "yes") {
    Setting::setBlogSettingGlobal("resamplingDefault", "yes");
} else {
    Setting::removeBlogSettingGlobal("resamplingDefault");
}
CacheControl::flushEntry();
$isAjaxRequest ? Respond::PrintResult($errorResult) : header("Location: " . $_SERVER['HTTP_REFERER']);
Exemplo n.º 6
0
function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSloganOnTag)
{
    global $blog;
    requireModel('blog.feed');
    $useSloganOnPost = $useSloganOnPost ? 1 : 0;
    $useSloganOnCategory = $useSloganOnCategory ? 1 : 0;
    $useSloganOnTag = $useSloganOnTag ? 1 : 0;
    if ($useSloganOnPost == $blog['useSloganOnPost'] && $useSloganOnCategory == $blog['useSloganOnCategory'] && $useSloganOnTag == $blog['useSloganOnTag']) {
        return true;
    }
    /*	if(Setting::setBlogSettingGlobal('useSloganOnPost',$useSlogan) === false
    	|| Setting::setBlogSettingGlobal('useSloganOnCategory',$useSlogan) === false
    	|| Setting::setBlogSettingGlobal('useSloganOnTag',$useSlogan) === false
    		) {
    		return false;
    	}*/
    Setting::setBlogSettingGlobal('useSloganOnPost', $useSloganOnPost);
    Setting::setBlogSettingGlobal('useSloganOnCategory', $useSloganOnCategory);
    Setting::setBlogSettingGlobal('useSloganOnTag', $useSloganOnTag);
    $blog['useSloganOnPost'] = $useSloganOnPost;
    $blog['useSloganOnCategory'] = $useSloganOnCategory;
    $blog['useSloganOnTag'] = $useSloganOnTag;
    CacheControl::flushCategory();
    CacheControl::flushEntry();
    CacheControl::flushTag();
    fireEvent('ToggleBlogSlogan', null, $blog['useSloganOnPost']);
    clearFeed();
    return true;
}
Exemplo n.º 7
0
function protectEntry($id, $password)
{
    $pool->init("Entries");
    $pool->setQualifier("blogid", "eq", getBlogId());
    $pool->setQualifier("id", "eq", $id);
    $pool->setQualifier("visibility", "eq", 1);
    $pool->setAttribute("password", $password, true);
    $pool->setAttribute("modified", Timestamp::getUNIXtime());
    $result = $pool->update();
    if ($result) {
        CacheControl::flushEntry($id);
        CacheControl::flushDBCache('entry');
        CacheControl::flushDBCache('comment');
        CacheControl::flushDBCache('trackback');
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 8
0
 function remove($id = null)
 {
     // attachment & category is own your risk!
     global $database, $gCacheStorage;
     $this->init();
     if (!empty($id)) {
         $this->id = $id;
     }
     // step 0. Get Information
     if (!isset($this->id) || !Validator::number($this->id, 1)) {
         return $this->_error('id');
     }
     if (!($query = $this->_buildQuery())) {
         return false;
     }
     if (!($entry = $query->getRow('category, visibility'))) {
         return $this->_error('id');
     }
     // step 1. Check Syndication
     if ($entry['visibility'] == 3) {
         requireComponent('Eolin.API.Syndication');
         Syndication::leave($this->getLink());
     }
     CacheControl::flushEntry($this->id);
     CacheControl::flushDBCache('entry');
     CacheControl::flushDBCache('comment');
     CacheControl::flushDBCache('trackback');
     $gCacheStorage->purge();
     // step 2. Delete Entry
     $sql = "DELETE FROM " . $database['prefix'] . "Entries WHERE blogid = " . $this->blogid . " AND id = " . $this->id;
     if (POD::queryCount($sql)) {
         // step 3. Delete Comment
         POD::execute("DELETE FROM {$database['prefix']}Comments WHERE blogid = " . $this->blogid . " AND entry = " . $this->id);
         // step 4. Delete Trackback
         POD::execute("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = " . $this->blogid . " AND entry = " . $this->id);
         // step 5. Delete Trackback Logs
         POD::execute("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = " . $this->blogid . " AND entry = " . $this->id);
         // step 6. update Category
         if (isset($entry['category'])) {
             $target = ($parentCategory = Category::getParent($entry['category'])) ? '(id = ' . $entry['category'] . ' OR id = ' . $parentCategory . ')' : 'id = ' . $entry['category'];
             if (isset($entry['visibility']) && $entry['visibility'] != 1) {
                 POD::query("UPDATE {$database['prefix']}Categories SET entries = entries - 1, entriesinlogin = entriesinlogin - 1 WHERE blogid = " . $this->blogid . " AND " . $target);
             } else {
                 POD::query("UPDATE {$database['prefix']}Categories SET entriesinlogin = entriesinlogin - 1 WHERE blogid = " . $this->blogid . " AND " . $target);
             }
         }
         // step 7. Delete Attachment
         $attachNames = POD::queryColumn("SELECT name FROM {$database['prefix']}Attachments\n\t\t\t\tWHERE blogid = " . getBlogId() . " AND parent = " . $this->id);
         if (POD::execute("DELETE FROM {$database['prefix']}Attachments WHERE blogid = " . getBlogId() . " AND parent = " . $this->id)) {
             foreach ($attachNames as $attachName) {
                 if (file_exists(__TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/{$attachName}")) {
                     @unlink(__TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/{$attachName}");
                 }
             }
         }
         // step 8. Delete Tags
         $this->deleteTags();
         // step 9. Clear RSS
         requireComponent('Textcube.Control.RSS');
         RSS::refresh();
         return true;
     }
     return false;
 }
Exemplo n.º 9
0
function protectEntry($id, $password)
{
    $ctx = Model_Context::getInstance();
    $password = POD::escapeString($password);
    $result = POD::queryCount("UPDATE " . $ctx->getProperty('database.prefix') . "Entries SET password = '******', modified = UNIX_TIMESTAMP() WHERE blogid = " . getBlogId() . " AND id = {$id} AND visibility = 1");
    if ($result > 0) {
        CacheControl::flushEntry($id);
        CacheControl::flushDBCache('entry');
        CacheControl::flushDBCache('comment');
        CacheControl::flushDBCache('trackback');
        return true;
    } else {
        return false;
    }
}