示例#1
0
    echo '<p>You might want to <a href="install.php">install moonmoon</a>.<br/>If not, <strong>delete</strong> <code>install.php</code>.</p>';
    die;
}
$bench['start'] = microtime(true);
$debug = isset($_GET['debug']) ? $_GET['debug'] : 0;
if ($debug) {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}
include_once dirname(__FILE__) . '/app/classes/Planet.class.php';
include_once dirname(__FILE__) . '/app/lib/Cache.php';
//Load configuration
if (is_file(dirname(__FILE__) . '/custom/config.yml')) {
    $conf = Spyc::YAMLLoad(dirname(__FILE__) . '/custom/config.yml');
    $PlanetConfig = new PlanetConfig($conf);
} else {
    die('Config file (custom/config.yml) is missing.');
}
//Instantiate app
$Planet = new Planet($PlanetConfig);
$bench['codeloaded'] = microtime(true);
//Load from cache
$items = array();
if (0 < $Planet->loadOpml(dirname(__FILE__) . '/custom/people.opml')) {
    $Planet->loadFeeds();
    $items = $Planet->getItems();
}
$bench['contentloaded'] = microtime(true);
//Prepare output cache
Cache::$enabled = false;
示例#2
0
<?php

//Debug ?
$debug = isset($_GET['debug']) ? $_GET['debug'] : 0;
if ($debug) {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}
require_once __DIR__ . '/../vendor/autoload.php';
$savedConfig = __DIR__ . '/../custom/config.yml';
$moon_version = file_get_contents(__DIR__ . '/../VERSION');
if (is_file($savedConfig)) {
    $conf = Spyc::YAMLLoad($savedConfig);
    // this is a check to upgrade older config file without l10n
    if (!isset($conf['locale'])) {
        $resetPlanetConfig = new PlanetConfig($conf);
        file_put_contents($savedConfig, $resetPlanetConfig->toYaml());
        $conf = Spyc::YAMLLoad($savedConfig);
    }
    $PlanetConfig = new PlanetConfig($conf);
    $Planet = new Planet($PlanetConfig);
}
$l10n = new Simplel10n($conf['locale']);
// this is an helper function. We will usually use that function and not Simplel10n::getString()
function _g($str, $comment = '')
{
    return Simplel10n::getString($str);
}
示例#3
0
<?php

require_once dirname(__FILE__) . '/inc/auth.inc.php';
include_once dirname(__FILE__) . '/../app/classes/Planet.class.php';
include_once dirname(__FILE__) . '/../app/lib/spyc-0.2.3/spyc.php';
require_once dirname(__FILE__) . '/../app/lib/lib.opml.php';
require_once dirname(__FILE__) . '/../app/lib/simplepie/simplepie.inc';
function removeSlashes(&$item, $key)
{
    $item = stripslashes($item);
}
if (isset($_POST['opml']) || isset($_POST['add'])) {
    // Load config and old OPML
    $conf = Spyc::YAMLLoad(dirname(__FILE__) . '/../custom/config.yml');
    $PlanetConfig = new PlanetConfig($conf);
    if ($PlanetConfig->getName() === '') {
        $PlanetConfig->setName($oldOpml->getTitle());
    }
    $oldOpml = OpmlManager::load(dirname(__FILE__) . '/../custom/people.opml');
    $newOpml = new opml();
    $newOpml->title = $PlanetConfig->getName();
    // Remove slashes if needed
    if (get_magic_quotes_gpc() && isset($_POST['opml'])) {
        array_walk_recursive($_POST['opml'], 'removeSlashes');
    }
    // Delete/Save feeds
    if (isset($_POST['delete']) || isset($_POST['save'])) {
        foreach ($_POST['opml'] as $person) {
            if (isset($_POST['delete'])) {
                //delete mode, check if to be deleted
                if (!isset($person['delete'])) {
示例#4
0
require_once __DIR__ . '/app/app.php';
// This is an helper function returning an html table row to avoid code duplication
function installStatus($str, $msg, $result)
{
    $class = $result ? 'ok' : 'fail';
    return '<tr><td>' . $str . '</td><td class="' . $class . '">' . $msg . '</td></tr>';
}
// If the config file exists and the auth variables are set, moonmoon is already installed
include dirname(__FILE__) . '/admin/inc/pwd.inc.php';
if (file_exists(dirname(__FILE__) . '/custom/config.yml') && isset($login) && isset($password)) {
    $status = 'installed';
} elseif (isset($_REQUEST['url'])) {
    $save = array();
    //Save config file
    $config = array('url' => filter_var($_REQUEST['url'], FILTER_SANITIZE_ENCODED), 'name' => filter_var($_REQUEST['title'], FILTER_SANITIZE_SPECIAL_CHARS), 'locale' => filter_var($_REQUEST['locale'], FILTER_SANITIZE_SPECIAL_CHARS), 'items' => 10, 'shuffle' => 0, 'refresh' => 240, 'cache' => 10, 'nohtml' => 0, 'postmaxlength' => 0, 'cachedir' => './cache');
    $CreatePlanetConfig = new PlanetConfig($config);
    $save['config'] = file_put_contents(__DIR__ . '/custom/config.yml', $CreatePlanetConfig->toYaml());
    //Save password
    $save['password'] = file_put_contents(__DIR__ . '/admin/inc/pwd.inc.php', '<?php $login="******"; $password="******"; ?>');
    if (0 != $save['config'] + $save['password']) {
        $status = 'installed';
    }
} else {
    // We start by malking sure we have PHP5 as a base requirement
    if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
        $strInstall = installStatus('Server is running at least PHP 5.4', 'OK', true);
        $strRecommendation = '';
    } else {
        $strInstall = installStatus('Server is running at least PHP 5.4', 'FAIL', false);
        $strRecommendation = '<li>Check your server documentation to activate at least PHP 5.4</li>';
    }