Beispiel #1
0
function clearPluginSettingCache()
{
    $gCacheStorage = globalCacheStorage::getInstance();
    $context = Model_Context::getInstance();
    $context->unsetProperty('plugin.setting');
    $gCacheStorage->purge();
    $pageCache = pageCache::getInstance();
    $pageCache->reset('PluginSettings');
    $pageCache->purge();
}
Beispiel #2
0
function deleteSidebarModuleOrderData($dataArray, $sidebarNumber, $modulePos)
{
    $gCacheStorage = globalCacheStorage::getInstance();
    if (!isset($dataArray[$sidebarNumber])) {
        $dataArray[$sidebarNumber] = array();
    }
    array_splice($dataArray[$sidebarNumber], $modulePos, 1);
    CacheControl::flushSkin();
    $gCacheStorage->purge();
    return $dataArray;
}
Beispiel #3
0
 function purgeCache()
 {
     $gCacheStorage = globalCacheStorage::getInstance();
     $this->cache->purge();
     $gCacheStorage->purge();
 }
Beispiel #4
0
        clearFeed();
        $result = true;
    }
}
if (isset($_POST['acceptComments'])) {
    if (Setting::setBlogSettingGlobal('acceptComments', $_POST['acceptComments'])) {
        $result = true;
    }
}
if (isset($_POST['acceptTrackbacks'])) {
    if (Setting::setBlogSettingGlobal('acceptTrackbacks', $_POST['acceptTrackbacks'])) {
        $result = true;
    }
}
if (isset($_POST['useiPhoneUI'])) {
    if ($_POST['useiPhoneUI'] == 1) {
        $useiPhoneUI = true;
    } else {
        $useiPhoneUI = false;
    }
    if (Setting::setBlogSettingGlobal('useiPhoneUI', $useiPhoneUI)) {
        $result = true;
    }
}
if ($result) {
    $gCacheStorage = globalCacheStorage::getInstance();
    $gCacheStorage->purge();
    Respond::ResultPage(0);
} else {
    Respond::ResultPage(-1);
}
 static function setSkinSetting($name, $value, $blogid = null)
 {
     global $__gCacheSkinSettings;
     global $__gCacheBlogSettings;
     $gCacheStorage = globalCacheStorage::getInstance();
     if (is_null($blogid)) {
         $blogid = getBlogId();
     }
     if (!is_numeric($blogid)) {
         return null;
     }
     if (!array_key_exists($blogid, $__gCacheSkinSettings)) {
         // force loading
         Setting::getSkinSettings($blogid, false);
     }
     if ($__gCacheBlogSettings[$blogid] === false) {
         return null;
     }
     $gCacheStorage->purge();
     if (array_key_exists($name, $__gCacheSkinSettings[$blogid])) {
         // overwrite value
         $__gCacheSkinSettings[$blogid][$name] = $value;
         $query = DBModel::getInstance();
         $query->reset('SkinSettings');
         $query->setQualifier('blogid', 'equals', $blogid);
         $query->setQualifier('name', 'equals', $name, true);
         $query->setAttribute('blogid', $blogid);
         $query->setAttribute('name', $name, true);
         $query->setAttribute('value', $value, true);
         return $query->replace();
     }
     // insert new value
     $__gCacheSkinSettings[$blogid][$name] = $value;
     $query = DBModel::getInstance();
     $query->reset('SkinSettings');
     $query->setAttribute('blogid', $blogid);
     $query->setAttribute('name', $name, true);
     $query->setAttribute('value', $value, true);
     return $query->insert();
 }
Beispiel #6
0
 private function __URIvariableParser()
 {
     global $suri, $blog, $blogid, $skinSetting, $gCacheStorage;
     // To support legacy for global variables.
     $blogid = $this->blogid;
     $gCacheStorage = globalCacheStorage::getInstance();
     // Initialize global cache
     $suri = $this->suri;
     $blog = Setting::getBlogSettingsGlobal($this->blogid);
     $blog['id'] = $this->blogid;
     $skinSetting = Setting::getSkinSettings($this->blogid);
     if (!is_null($this->context->getProperty('service.serviceURL'))) {
         $this->uri['service'] = $this->context->getProperty('service.serviceURL');
     }
     if (!isset($this->uri['service'])) {
         $this->uri['service'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $this->context->getProperty('service.domain') . (!is_null($this->context->getProperty('service.port')) ? ':' . $this->context->getProperty('service.port') : '') . $this->context->getProperty('service.path');
     }
     $this->context->useNamespace('service');
     switch ($this->context->getProperty('service.type')) {
         case 'domain':
             $this->uri['path'] = $this->context->getProperty('path');
             $blog['primaryBlogURL'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $blog['name'] . '.' . $this->context->getProperty('domain') . (!is_null($this->context->getProperty('port')) ? ':' . $this->context->getProperty('port') : '') . $this->uri['path'];
             if (!empty($blog['secondaryDomain'])) {
                 $blog['secondaryBlogURL'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $blog['secondaryDomain'] . (!is_null($this->context->getProperty('port')) ? ':' . $this->context->getProperty('port') : '') . $this->uri['path'];
             } else {
                 $blog['secondaryBlogURL'] = null;
             }
             if ($blog['defaultDomain']) {
                 $this->uri['default'] = $blog['secondaryBlogURL'];
                 if ($_SERVER['HTTP_HOST'] == $blog['secondaryDomain']) {
                     $this->uri['base'] = $this->context->getProperty('path');
                 } else {
                     $this->uri['base'] = $this->uri['default'];
                 }
             } else {
                 $this->uri['default'] = $blog['primaryBlogURL'];
                 if ($_SERVER['HTTP_HOST'] == $blog['name'] . '.' . $this->context->getProperty('domain')) {
                     $this->uri['base'] = $this->context->getProperty('path');
                 } else {
                     $this->uri['base'] = $this->uri['default'];
                 }
             }
             break;
         case 'path':
             $this->uri['path'] = $this->context->getProperty('path') . '/' . $blog['name'];
             $blog['primaryBlogURL'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $this->context->getProperty('domain') . (!is_null($this->context->getProperty('port')) ? ':' . $this->context->getProperty('port') : '') . $this->uri['path'];
             $blog['secondaryBlogURL'] = null;
             $this->uri['default'] = $blog['primaryBlogURL'];
             if ($_SERVER['HTTP_HOST'] == $this->context->getProperty('domain')) {
                 $this->uri['base'] = $this->context->getProperty('path') . '/' . $blog['name'];
             } else {
                 $this->uri['base'] = $this->uri['default'];
             }
             break;
         case 'single':
         default:
             $this->uri['path'] = $this->context->getProperty('path');
             $blog['primaryBlogURL'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $this->context->getProperty('domain') . (!is_null($this->context->getProperty('port')) ? ':' . $this->context->getProperty('port') : '') . $this->uri['path'];
             $blog['secondaryBlogURL'] = null;
             $this->uri['default'] = $blog['primaryBlogURL'] . $this->__getFancyURLpostfix();
             if ($_SERVER['HTTP_HOST'] == $this->context->getProperty('domain')) {
                 $this->uri['base'] = $this->context->getProperty('path');
             } else {
                 $this->uri['base'] = $this->uri['default'];
             }
             break;
     }
     $this->uri['host'] = ($this->context->getProperty('service.useSSL', false) ? 'https://' : '//') . $_SERVER['HTTP_HOST'] . (!is_null($this->context->getProperty('port')) ? ':' . $this->context->getProperty('port') : '');
     $this->uri['blog'] = $this->uri['path'] . $this->__getFancyURLpostfix();
     $this->uri['folder'] = rtrim($this->uri['blog'] . $suri['directive'], '/');
     $this->uri['permalink'] = rtrim($this->uri['default'] . rtrim($this->suri['directive'], '/') . (empty($this->suri['id']) ? '/' . $this->suri['value'] : '/' . $this->suri['id']), '/');
     $this->uri['basicblog'] = $this->uri['blog'];
     if (defined('__TEXTCUBE_MOBILE__')) {
         $this->uri['blog'] .= '/m';
         $_SESSION['mode'] = 'mobile';
     } else {
         if (defined('__TEXTCUBE_IPHONE__')) {
             $this->uri['blog'] .= '/i';
             $_SESSION['mode'] = 'mobile';
         }
     }
     $this->blog = $blog;
     $this->skin = $skinSetting;
     $this->updateContext();
 }
Beispiel #7
0
function deleteEntry($blogid, $id)
{
    $gCacheStorage = globalCacheStorage::getInstance();
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    importlib("model.blog.feed");
    importlib("model.blog.category");
    importlib("model.blog.attachment");
    importlib("model.blog.tag");
    $target = getEntry($blogid, $id);
    if (is_null($target)) {
        return false;
    }
    $pool->init("Entries");
    $pool->setQualifier("blogid", "eq", $blogid);
    $pool->setQualifier("id", "eq", $id);
    if ($pool->getCell("visibility") == 3) {
        syndicateEntry($id, 'delete');
    }
    CacheControl::flushEntry($id);
    CacheControl::flushDBCache('entry');
    CacheControl::flushDBCache('comment');
    CacheControl::flushDBCache('trackback');
    $gCacheStorage->purge();
    $pool->init("Entries");
    $pool->setQualifier("blogid", "eq", $blogid)->setQualifier("id", "eq", $id);
    $result = $pool->delete();
    if ($result) {
        $pool->init("Comments")->setQualifier("blogid", "eq", $blogid)->setQualifier("entry", "eq", $id)->delete();
        $pool->init("RemoteResponses")->setQualifier("blogid", "eq", $blogid)->setQualifier("entry", "eq", $id)->delete();
        $pool->init("RemoteResponseLogs")->setQualifier("blogid", "eq", $blogid)->setQualifier("entry", "eq", $id)->delete();
        updateCategoryByEntryId($blogid, $id, 'delete', array('entry' => $target));
        deleteAttachments($blogid, $id);
        Tag::deleteTagsWithEntryId($blogid, $id);
        clearFeed();
        fireEvent('DeletePost', $id, null);
        return true;
    }
    return false;
}
 function remove($id = null)
 {
     // attachment & category is own your risk!
     global $database;
     $gCacheStorage = globalCacheStorage::getInstance();
     $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) {
         Utils_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
         RSS::refresh();
         ATOM::refresh();
         return true;
     }
     return false;
 }