Ejemplo n.º 1
0
<?php

/// Copyright (c) 2004-2012, 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('skinName' => array('directory', 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
$isAjaxRequest = checkAjaxRequest();
$result = $isAjaxRequest ? selectSkin($blogid, $_POST['skinName']) : selectSkin($blogid, $_GET['skinName']);
if ($result === true) {
    $isAjaxRequest ? Respond::PrintResult(array('error' => 0)) : header("Location: " . $_SERVER['HTTP_REFERER']);
} else {
    $isAjaxRequest ? Respond::PrintResult(array('error' => 1, 'msg' => _t('스킨을 변경하지 못했습니다.'))) : header("Location: " . $_SERVER['HTTP_REFERER']);
}
Ejemplo n.º 2
0
 */
/**
 * Nucleus Atom Syndication
 * @license http://nucleuscms.org/license.txt GNU General Public License
 * @copyright Copyright (C) 2002-2011 The Nucleus Group
 * @version $Id: atom.php 1131 2011-02-01 06:19:31Z sakamocchi $
 * $NucleusJP: atom.php,v 1.6 2006/07/12 07:11:45 kimitake Exp $
 */
header('Pragma: no-cache');
$CONF = array();
$CONF['Self'] = 'atom.php';
include './config.php';
if (!$CONF['DisableSite']) {
    // get feed into $feed
    ob_start();
    selectSkin('feeds/atom');
    selector();
    $feed = ob_get_contents();
    ob_end_clean();
    // create ETAG (hash of feed)
    // (HTTP_IF_NONE_MATCH has quotes around it)
    $eTag = '"' . md5($feed) . '"';
    header('Etag: ' . $eTag);
    // compare Etag to what we got
    if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) {
        header('HTTP/1.0 304 Not Modified');
        header('Content-Length: 0');
    } else {
        if (strtolower(_CHARSET) != 'utf-8') {
            $feed = mb_convert_encoding($feed, "UTF-8", _CHARSET);
        }
Ejemplo n.º 3
0
function selector()
{
    global $itemid, $blogid, $memberid, $query, $amount, $archivelist, $maxresults;
    global $archive, $skinid, $blog, $memberinfo, $CONF, $member;
    global $imagepopup, $catid, $special;
    global $manager;
    $actionNames = array('addcomment', 'sendmessage', 'createaccount', 'forgotpassword', 'votepositive', 'votenegative', 'plugin');
    $action = requestVar('action');
    if (in_array($action, $actionNames)) {
        global $DIR_LIBS, $errormessage;
        include_once $DIR_LIBS . 'ACTION.php';
        $a = new ACTION();
        $errorInfo = $a->doAction($action);
        if ($errorInfo) {
            $errormessage = $errorInfo['message'];
        }
    }
    // show error when headers already sent out
    if (headers_sent() && $CONF['alertOnHeadersSent']) {
        // try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)
        if (function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=')) {
            headers_sent($hsFile, $hsLine);
            $extraInfo = sprintf(_GFUNCTIONS_HEADERSALREADYSENT_FILE, $hsFile, $hsLine);
        } else {
            $extraInfo = '';
        }
        startUpError(sprintf(_GFUNCTIONS_HEADERSALREADYSENT_TXT, $extraInfo), _GFUNCTIONS_HEADERSALREADYSENT_TITLE);
        exit;
    }
    // make is so ?archivelist without blogname or blogid shows the archivelist
    // for the default weblog
    if (serverVar('QUERY_STRING') == 'archivelist') {
        $archivelist = $CONF['DefaultBlog'];
    }
    // now decide which type of skin we need
    if ($itemid) {
        // itemid given -> only show that item
        $type = 'item';
        if (!$manager->existsItem($itemid, intval($CONF['allowFuture']), intval($CONF['allowDrafts']))) {
            doError(_ERROR_NOSUCHITEM);
        }
        global $itemidprev, $itemidnext, $catid, $itemtitlenext, $itemtitleprev;
        // 1. get timestamp, blogid and catid for item
        $query = 'SELECT itime, iblog, icat FROM ' . sql_table('item') . ' WHERE inumber=' . intval($itemid);
        $res = sql_query($query);
        $obj = sql_fetch_object($res);
        // if a different blog id has been set through the request or selectBlog(),
        // deny access
        if ($blogid && intval($blogid) != $obj->iblog) {
            if (!headers_sent()) {
                $b =& $manager->getBlog($obj->iblog);
                $CONF['ItemURL'] = $b->getURL();
                if ($CONF['URLMode'] == 'pathinfo' and substr($CONF['ItemURL'], -1) == '/') {
                    $CONF['ItemURL'] = substr($CONF['ItemURL'], 0, -1);
                }
                $correctURL = createItemLink($itemid, '');
                redirect($correctURL);
                exit;
            } else {
                doError(_ERROR_NOSUCHITEM);
            }
        }
        // if a category has been selected which doesn't match the item, ignore the
        // category. #85
        if ($catid != 0 && $catid != $obj->icat) {
            $catid = 0;
        }
        $blogid = $obj->iblog;
        $timestamp = strtotime($obj->itime);
        $b =& $manager->getBlog($blogid);
        if ($b->isValidCategory($catid)) {
            $catextra = ' and icat=' . $catid;
        } else {
            $catextra = '';
        }
        // get previous itemid and title
        $query = 'SELECT inumber, ititle FROM ' . sql_table('item') . ' WHERE itime<' . mysqldate($timestamp) . ' and idraft=0 and iblog=' . $blogid . $catextra . ' ORDER BY itime DESC LIMIT 1';
        $res = sql_query($query);
        $obj = sql_fetch_object($res);
        if ($obj) {
            $itemidprev = $obj->inumber;
            $itemtitleprev = $obj->ititle;
        }
        // get next itemid and title
        $query = 'SELECT inumber, ititle FROM ' . sql_table('item') . ' WHERE itime>' . mysqldate($timestamp) . ' and itime <= ' . mysqldate($b->getCorrectTime()) . ' and idraft=0 and iblog=' . $blogid . $catextra . ' ORDER BY itime ASC LIMIT 1';
        $res = sql_query($query);
        $obj = sql_fetch_object($res);
        if ($obj) {
            $itemidnext = $obj->inumber;
            $itemtitlenext = $obj->ititle;
        }
    } elseif ($archive) {
        // show archive
        $type = 'archive';
        // get next and prev month links ...
        global $archivenext, $archiveprev, $archivetype, $archivenextexists, $archiveprevexists;
        // sql queries for the timestamp of the first and the last published item
        $query = "SELECT UNIX_TIMESTAMP(itime) as result FROM " . sql_table('item') . " WHERE idraft=0 AND iblog=" . (int) ($blogid ? $blogid : $CONF['DefaultBlog']) . " ORDER BY itime ASC";
        $first_timestamp = quickQuery($query);
        $query = "SELECT UNIX_TIMESTAMP(itime) as result FROM " . sql_table('item') . " WHERE idraft=0 AND iblog=" . (int) ($blogid ? $blogid : $CONF['DefaultBlog']) . " ORDER BY itime DESC";
        $last_timestamp = quickQuery($query);
        sscanf($archive, '%d-%d-%d', $y, $m, $d);
        if ($d != 0) {
            $archivetype = _ARCHIVETYPE_DAY;
            $t = mktime(0, 0, 0, $m, $d, $y);
            // one day has 24 * 60 * 60 = 86400 seconds
            $archiveprev = strftime('%Y-%m-%d', $t - 86400);
            // check for published items
            if ($t > $first_timestamp) {
                $archiveprevexists = true;
            } else {
                $archiveprevexists = false;
            }
            // one day later
            $t += 86400;
            $archivenext = strftime('%Y-%m-%d', $t);
            if ($t < $last_timestamp) {
                $archivenextexists = true;
            } else {
                $archivenextexists = false;
            }
        } elseif ($m == 0) {
            $archivetype = _ARCHIVETYPE_YEAR;
            $t = mktime(0, 0, 0, 12, 31, $y - 1);
            // one day before is in the previous year
            $archiveprev = strftime('%Y', $t);
            if ($t > $first_timestamp) {
                $archiveprevexists = true;
            } else {
                $archiveprevexists = false;
            }
            // timestamp for the next year
            $t = mktime(0, 0, 0, 1, 1, $y + 1);
            $archivenext = strftime('%Y', $t);
            if ($t < $last_timestamp) {
                $archivenextexists = true;
            } else {
                $archivenextexists = false;
            }
        } else {
            $archivetype = _ARCHIVETYPE_MONTH;
            $t = mktime(0, 0, 0, $m, 1, $y);
            // one day before is in the previous month
            $archiveprev = strftime('%Y-%m', $t - 86400);
            if ($t > $first_timestamp) {
                $archiveprevexists = true;
            } else {
                $archiveprevexists = false;
            }
            // timestamp for the next month
            $t = mktime(0, 0, 0, $m + 1, 1, $y);
            $archivenext = strftime('%Y-%m', $t);
            if ($t < $last_timestamp) {
                $archivenextexists = true;
            } else {
                $archivenextexists = false;
            }
        }
    } elseif ($archivelist) {
        $type = 'archivelist';
        if (is_numeric($archivelist)) {
            $blogid = intVal($archivelist);
        } else {
            $blogid = getBlogIDFromName($archivelist);
        }
        if (!$blogid) {
            doError(_ERROR_NOSUCHBLOG);
        }
    } elseif ($query) {
        global $startpos;
        $type = 'search';
        $query = stripslashes($query);
        if (preg_match("/^(¡{2}|ã€{2}| )+\$/", $query)) {
            $type = 'index';
        }
        //		$order = (_CHARSET == 'EUC-JP') ? 'EUC-JP, UTF-8,' : 'UTF-8, EUC-JP,';
        //		$query = mb_convert_encoding($query, _CHARSET, $order . ' JIS, SJIS, ASCII');
        switch (strtolower(_CHARSET)) {
            case 'utf-8':
                $order = 'ASCII, UTF-8, EUC-JP, JIS, SJIS, EUC-CN, ISO-8859-1';
                break;
            case 'gb2312':
                $order = 'ASCII, EUC-CN, EUC-JP, UTF-8, JIS, SJIS, ISO-8859-1';
                break;
            case 'shift_jis':
                // Note that shift_jis is only supported for output.
                // Using shift_jis in DB is prohibited.
                $order = 'ASCII, SJIS, EUC-JP, UTF-8, JIS, EUC-CN, ISO-8859-1';
                break;
            default:
                // euc-jp,iso-8859-x,windows-125x
                $order = 'ASCII, EUC-JP, UTF-8, JIS, SJIS, EUC-CN, ISO-8859-1';
                break;
        }
        $query = mb_convert_encoding($query, _CHARSET, $order);
        if (is_numeric($blogid)) {
            $blogid = intVal($blogid);
        } else {
            $blogid = getBlogIDFromName($blogid);
        }
        if (!$blogid) {
            doError(_ERROR_NOSUCHBLOG);
        }
    } elseif ($memberid) {
        $type = 'member';
        if (!MEMBER::existsID($memberid)) {
            doError(_ERROR_NOSUCHMEMBER);
        }
        $memberinfo = $manager->getMember($memberid);
    } elseif ($imagepopup) {
        // media object (images etc.)
        $type = 'imagepopup';
        // TODO: check if media-object exists
        // TODO: set some vars?
    } else {
        // show regular index page
        global $startpos;
        $type = 'index';
    }
    // any type of skin with catid
    if ($catid && !$blogid) {
        $blogid = getBlogIDFromCatID($catid);
    }
    // decide which blog should be displayed
    if (!$blogid) {
        $blogid = $CONF['DefaultBlog'];
    }
    $b =& $manager->getBlog($blogid);
    $blog = $b;
    // references can't be placed in global variables?
    if (!$blog->isValid) {
        doError(_ERROR_NOSUCHBLOG);
    }
    // set catid if necessary
    if ($catid) {
        // check if the category is valid
        if (!$blog->isValidCategory($catid)) {
            doError(_ERROR_NOSUCHCATEGORY);
        } else {
            $blog->setSelectedCategory($catid);
        }
    }
    // decide which skin should be used
    if ($skinid != '' && $skinid == 0) {
        selectSkin($skinid);
    }
    if (!$skinid) {
        $skinid = $blog->getDefaultSkin();
    }
    //$special = requestVar('special'); //get at top of file as global
    if (!empty($special) && isValidShortName($special)) {
        $type = strtolower($special);
    }
    $skin = new SKIN($skinid);
    if (!$skin->isValid) {
        doError(_ERROR_NOSUCHSKIN);
    }
    // set global skinpart variable so can determine quickly what is being parsed from any plugin or phpinclude
    global $skinpart;
    $skinpart = $type;
    // parse the skin
    $skin->parse($type);
    // check to see we should throw JustPosted event
    $blog->checkJustPosted();
}
Ejemplo n.º 4
0
<?php

/*
 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
 * Copyright (C) 2002-2011 The Nucleus Group
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * (see nucleus/documentation/index.html#license for more info)
 */
/**
 * RSD API
 *
 * @license http://nucleuscms.org/license.txt GNU General Public License
 * @copyright Copyright (C) 2002-2011 The Nucleus Group
 * @version $Id: rsd.php 1131 2011-02-01 06:19:31Z sakamocchi $
 */
// RSD file (http://archipelago.phrasewise.com/rsd)
$CONF = array();
include './config.php';
selectSkin('xml/rsd');
selector();
Ejemplo n.º 5
0
 */
/**
 * Nucleus RSS syndication channel skin
 * @license http://nucleuscms.org/license.txt GNU General Public License
 * @copyright Copyright (C) 2002-2011 The Nucleus Group
 * @version $Id: xml-rss2.php 1131 2011-02-01 06:19:31Z sakamocchi $
 * $NucleusJP: xml-rss2.php,v 1.7 2006/07/17 19:59:46 kimitake Exp $
 */
header('Pragma: no-cache');
$CONF = array();
$CONF['Self'] = 'xml-rss2.php';
include './config.php';
if (!$CONF['DisableSite']) {
    // get feed into $feed
    ob_start();
    selectSkin('feeds/rss20');
    selector();
    $feed = ob_get_contents();
    ob_end_clean();
    // create ETAG (hash of feed)
    // (HTTP_IF_NONE_MATCH has quotes around it)
    $eTag = '"' . md5($feed) . '"';
    header('Etag: ' . $eTag);
    // compare Etag to what we got
    if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) {
        header('HTTP/1.0 304 Not Modified');
        header('Content-Length: 0');
    } else {
        if (strtolower(_CHARSET) != 'utf-8') {
            $feed = mb_convert_encoding($feed, "UTF-8", _CHARSET);
        }