Exemplo n.º 1
0
 private function __URIParser()
 {
     if (!isset($this->uri)) {
         $this->__URIInterpreter();
     }
     $this->context->useNamespace('service');
     $url = $this->uri['fullpath'];
     $defaultblogid = $this->context->getProperty('defaultBlogId', 1);
     $this->suri = array('url' => $url, 'value' => '');
     $this->blogid = null;
     $this->uri['isStrictBlogURL'] = true;
     $depth = substr_count($this->context->getProperty('path'), '/');
     if ($depth > 0) {
         if (preg_match('@^((/+[^/]+){' . $depth . '})(.*)$@', $url, $matches) !== FALSE) {
             $url = $matches[3];
         } else {
             Respond::NotFoundPage();
         }
     }
     if ($this->context->getProperty('type') == 'single') {
         $this->blogid = $defaultblogid;
     } else {
         if ($this->context->getProperty('type') == 'domain') {
             // Domain-based service
             if ($_SERVER['HTTP_HOST'] == $this->context->getProperty('domain')) {
                 $this->blogid = $defaultblogid;
             } else {
                 $domain = explode('.', $_SERVER['HTTP_HOST'], 2);
                 if ($domain[1] == $this->context->getProperty('domain')) {
                     $this->blogid = $this->__getBlogIdByName($domain[0]);
                     if ($this->blogid === null) {
                         $this->blogid = $this->__getBlogIdBySecondaryDomain($_SERVER['HTTP_HOST']);
                     }
                 } else {
                     $this->blogid = $this->__getBlogIdBySecondaryDomain($_SERVER['HTTP_HOST']);
                 }
             }
         } else {
             // Path-based service
             if ($url == '/') {
                 $this->blogid = $defaultblogid;
             } else {
                 if (preg_match('@^/+([^/]+)(.*)$@', $url, $matches)) {
                     $this->blogid = $this->__getBlogIdByName(strtok($matches[1], '?'));
                     if ($this->blogid === null) {
                         $this->blogid = $defaultblogid;
                         $this->uri['isStrictBlogURL'] = false;
                     }
                     $url = $matches[2];
                 } else {
                     Respond::NotFoundPage();
                 }
             }
         }
         if ($this->blogid === null) {
             Respond::NotFoundPage();
         }
     }
     if (isset($this->uri['interfacePath'])) {
         if (strpos($this->uri['interfacePath'], 'interface/blog/comment') === 0 || strpos($this->uri['interfacePath'], 'interface/blog/trackback') === 0) {
             $depth = substr_count($this->uri['interfacePath'], '/') - 2;
         } else {
             $depth = substr_count($this->uri['interfacePath'], '/') - 1;
         }
     } else {
         $depth = substr_count(ROOT, '/');
     }
     if ($depth > 0) {
         if ($this->context->getProperty('fancyURL') === 0 || $this->context->getProperty('fancyURL') === 1) {
             $url = '/' . $this->uri['input'];
         }
         // Exclude /blog path.
         if (preg_match('@^((/+[^/]+){' . $depth . '})/*(.*)$@', $url, $matches)) {
             $this->suri['directive'] = $matches[1];
             if ($matches[3] !== false) {
                 $this->suri['value'] = $matches[3];
             }
         } else {
             Respond::NotFoundPage();
         }
     } else {
         $this->suri['directive'] = '/';
         $this->suri['value'] = ltrim($url, '/');
     }
     if (strpos($this->suri['value'], '?') === 0) {
         $this->suri['value'] = '';
     } else {
         $this->suri['value'] = strtok($this->suri['value'], '?');
     }
     $this->suri['directive'] = strtok($this->suri['directive'], '?');
     if (is_numeric($this->suri['value'])) {
         $this->suri['id'] = $this->suri['value'];
     } else {
         $this->suri['value'] = URL::decode(str_replace('index.php', '', $this->suri['value']));
         if (is_numeric($isValue = strtok($this->suri['value'], '&'))) {
             $this->suri['id'] = $isValue;
         }
         unset($isValue);
     }
     // Parse page.
     $this->suri['page'] = empty($_POST['page']) ? empty($_GET['page']) ? true : $_GET['page'] : $_POST['page'];
 }
Exemplo n.º 2
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)
require ROOT . '/library/preprocessor.php';
fireEvent($suri['directive'] . '/' . $suri['value']);
if (!headers_sent()) {
    Respond::NotFoundPage();
}
Exemplo n.º 3
0
		'viewMode' => array('string','default'=>'')
	)
);*/
require ROOT . '/library/preprocessor.php';
requireLibrary('blog.skin');
requireModel("blog.sidebar");
requireStrictRoute();
$ctx = Model_Context::getInstance();
$skin = new Skin($ctx->getProperty('skin.skin'));
$sidebarCount = count($skin->sidebarBasicModules);
$sidebarOrderData = getSidebarModuleOrderData($sidebarCount);
if (!isset($_REQUEST['sidebarNumber']) || !is_numeric($_REQUEST['sidebarNumber'])) {
    Respond::NotFoundPage($ajaxcall);
}
if (!isset($_REQUEST['modulePos']) || !is_numeric($_REQUEST['modulePos'])) {
    Respond::NotFoundPage($ajaxcall);
}
$sidebarNumber = $_REQUEST['sidebarNumber'];
$modulePos = $_REQUEST['modulePos'];
if ($sidebarNumber < 0 || $sidebarNumber >= $sidebarCount) {
    Respond::ErrorPage(null, null, null, $ajaxcall);
}
if (!isset($sidebarOrderData[$sidebarNumber]) || !isset($sidebarOrderData[$sidebarNumber][$modulePos])) {
    Respond::ErrorPage(null, null, null, $ajaxcall);
}
$pluginData = $sidebarOrderData[$sidebarNumber][$modulePos];
if ($pluginData['type'] != 3) {
    Respond::ErrorPage(null, null, null, $ajaxcall);
}
$plugin = $pluginData['id']['plugin'];
$handler = $pluginData['id']['handler'];