Exemple #1
0
function getDefaultURL($blogid)
{
    $context = Model_Context::getInstance();
    $blog = Setting::getBlogSettingsGlobal($blogid);
    // Load specific blog's setting
    switch ($context->getProperty('service.type')) {
        case 'domain':
            if (!empty($blog['defaultDomain']) && !empty($blog['secondaryDomain'])) {
                return 'http://' . $blog['secondaryDomain'] . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path');
            } else {
                return 'http://' . $blog['name'] . '.' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path');
            }
        case 'path':
            return 'http://' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path') . '/' . $blog['name'];
        case 'single':
        default:
            return 'http://' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path');
    }
}
 function getBlogSettingsGlobal($blogid = null)
 {
     return Setting::getBlogSettingsGlobal($blogid);
 }
Exemple #3
0
<?php

if (!defined('ROOT')) {
    header('HTTP/1.1 403 Forbidden');
    header("Connection: close");
    exit;
}
// TODO: generalize for multiple language support e.g. skin language
$setting = Setting::getBlogSettingsGlobal($blogid);
require 'owner/' . $setting['language'] . '.php';
echo "__text = {\n";
foreach ($__text as $key => $value) {
    $key = str_replace("\n", "\\n", addslashes($key));
    $value = str_replace("\n", "\\n", addslashes($value));
    echo "\t'{$key}': '{$value}',\n";
}
echo <<<EOT
\t'': '' // dummy
};

function _t(msg) {
\treturn __text[msg] || msg;
}
EOT
;
 function removeBlogSettingGlobal($name, $blogid = null)
 {
     global $database;
     global $__gCacheBlogSettings;
     // share blog.service.php
     global $gCacheStorage;
     if (is_null($blogid)) {
         $blogid = getBlogId();
     }
     if (!is_numeric($blogid)) {
         return null;
     }
     if (!array_key_exists($blogid, $__gCacheBlogSettings)) {
         // force loading
         Setting::getBlogSettingsGlobal($blogid);
     }
     if ($__gCacheBlogSettings[$blogid] === false) {
         return null;
     }
     $escape_name = POD::escapeString($name);
     if (array_key_exists($name, $__gCacheBlogSettings[$blogid])) {
         // overwrite value
         $gCacheStorage->purge();
         unset($__gCacheBlogSettings[$blogid][$name]);
         $query = DBModel::getInstance();
         $query->reset('BlogSettings');
         $query->setQualifier('blogid', 'equals', $blogid);
         $query->setQualifier('name', 'equals', $name);
         return $query->delete();
     }
     // already not exist
     return true;
 }
Exemple #5
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();
 }