Pico is a stupidly simple, blazing fast, flat file CMS. - Stupidly Simple: Pico makes creating and maintaining a website as simple as editing text files. - Blazing Fast: Pico is seriously lightweight and doesn't use a database, making it super fast. - No Database: Pico is a "flat file" CMS, meaning no database woes, no MySQL queries, nothing. - Markdown Formatting: Edit your website in your favourite text editor using simple Markdown formatting. - Twig Templates: Pico uses the Twig templating engine, for powerful and flexible themes. - Open Source: Pico is completely free and open source, released under the MIT license. See for more info.
Author: Gilbert Pellegrom
Author: Daniel Rudolf
Esempio n. 1
0
 public function handleError($app, $errno, $message, $file, $line)
 {
     $aError = compact('errno', 'message', 'file', 'line');
     Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email);
     Pico::cfg()->use_debug_log and dbglogr($aError);
     return $this->error($app, $aError, PICOWA_DEBUG_MODE);
 }
Esempio n. 2
0
 public static function cfg($oCfg = null)
 {
     if (is_null($oCfg)) {
         return self::$cfg;
     }
     self::$cfg = $oCfg;
 }
Esempio n. 3
0
 public function handleException($app, $exception)
 {
     $aError = array('type' => get_class($exception), 'code' => $exception->getCode(), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine());
     Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email);
     Pico::cfg()->use_debug_log and dbglogr($aError);
     $aError['trace'] = $exception->getTraceAsString();
     return $this->error($app, $aError, PICOWA_DEBUG_MODE);
 }
Esempio n. 4
0
 protected function initializeSession()
 {
     ini_set('session.serialize_handler', 'php');
     ini_set('session.name', Pico::cfg()->session_name);
     ini_set('session.cookie_lifetime', Pico::cfg()->cookie_lifetime);
     ini_set('session.auto_start', 0);
     ini_set('session.save_path', PICOWA_TEMP_PATH . 'sessions');
 }
Esempio n. 5
0
 public function handleError($errno, $message, $file, $line)
 {
     $aError = compact($errno, $message, $file, $line);
     Pico::cfg()->use_debug_mail and dbgmail(print_r($aError, true), Pico::cfg()->admin_email);
     Pico::cfg()->use_debug_log and dbglog(print_r($aError, true));
     header("HTTP/1.0 500 Server Error");
     PICOWA_DEBUG_MODE and print_r($aError);
     echo $this->render('500');
     die;
 }
Esempio n. 6
0
<?php

// @codingStandardsIgnoreFile
// load dependencies
if (is_file(__DIR__ . '/vendor/autoload.php')) {
    // composer root package
    require_once __DIR__ . '/vendor/autoload.php';
} elseif (is_file(__DIR__ . '/../../../vendor/autoload.php')) {
    // composer dependency package
    require_once __DIR__ . '/../../../vendor/autoload.php';
} else {
    die("Cannot find `vendor/autoload.php`. Run `composer install`.");
}
// instance Pico
$pico = new Pico(__DIR__, 'config/', 'plugins/', 'themes/');
// override configuration?
//$pico->setConfig(array());
// run application
echo $pico->run();
Esempio n. 7
0
    define('PICOWA_MOUNT_POINT', substr($reqUrl, 0, -strlen($url) - 1));
    define('PICOWA_REQUEST_URL', '/' . $url);
}
/**
 * Include Picowa Autoload
 */
if (!(include PICOWA_LIB_PATH . 'AutoLoad.php')) {
    trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'AutoLoad.php' . ".", E_USER_ERROR);
}
/**
 * Environment Constants
 */
$oCfg = PwComponentFactory::set('PwComponentBuilder')->build('PwConfig', array('production' => array('server' => '', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 1, 'use_debug_log' => 1, 'use_error_handler' => 1, 'builder' => 'PwComponentBuilder'), 'development' => array('server' => '127.0.0.1', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 0, 'use_debug_log' => 0, 'use_error_handler' => 0, 'builder' => 'PwComponentBuilder')), 'picowa_config');
// define debug mode
if (!defined('PICOWA_DEBUG_MODE')) {
    $devServer = $oCfg->development('server');
    $prdServer = $oCfg->production('server');
    $debugMode = 0;
    if ($devServer !== '' && ($_SERVER['SERVER_ADDR'] === $devServer || $_SERVER['SERVER_NAME'] === $devServer)) {
        $debugMode = 1;
    } else {
        if ($prdServer !== '' && ($_SERVER['SERVER_ADDR'] === $prdServer || $_SERVER['SERVER_NAME'] === $prdServer)) {
            $debugMode = 0;
        }
    }
    define('PICOWA_DEBUG_MODE', $debugMode);
}
$configKey = PICOWA_DEBUG_MODE ? 'development' : 'production';
PwComponentFactory::set($oCfg->{$configKey}('builder'));
Pico::cfg(PwComponentFactory::get('PwArrayWrapper', $oCfg->{$configKey}));
Esempio n. 8
0
/**
 * Include Picowa Autoload
 */
if (!(include PICOWA_LIB_PATH . 'PreLoad.php')) {
    trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'PreLoad.php' . ".", E_USER_ERROR);
}
if (!(include PICOWA_LIB_PATH . 'AutoLoad.php')) {
    trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'AutoLoad.php' . ".", E_USER_ERROR);
}
/**
 * Environment Constants
 */
$oCfg = Pw_Component_Factory::set('Pw_Component_Builder')->build('Pw_Config', array('production' => array('server' => '', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 1, 'use_debug_log' => 1, 'use_error_handler' => 1, 'builder' => 'Pw_Component_Builder'), 'development' => array('server' => '127.0.0.1', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 0, 'use_debug_log' => 0, 'use_error_handler' => 0, 'builder' => 'Pw_Component_Builder')), 'picowa_config');
// define debug mode
if (!defined('PICOWA_DEBUG_MODE')) {
    $devServer = $oCfg->development('server');
    $prdServer = $oCfg->production('server');
    $debugMode = 0;
    if ($devServer !== '' && ($_SERVER['SERVER_ADDR'] === $devServer || $_SERVER['SERVER_NAME'] === $devServer)) {
        $debugMode = 1;
    } else {
        if ($prdServer !== '' && ($_SERVER['SERVER_ADDR'] === $prdServer || $_SERVER['SERVER_NAME'] === $prdServer)) {
            $debugMode = 0;
        }
    }
    define('PICOWA_DEBUG_MODE', $debugMode);
}
$configKey = PICOWA_DEBUG_MODE ? 'development' : 'production';
Pw_Component_Factory::set($oCfg->{$configKey}('builder'));
Pico::cfg(Pw_Component_Factory::get('Pw_Wrapper_Array', $oCfg->{$configKey}));
define('PICOWA_BOOTSTRAP', true);
Esempio n. 9
0
 public function __construct($rootDir, $configDir, $pluginsDir, $themesDir)
 {
     parent::__construct($rootDir, $configDir, $pluginsDir, $themesDir);
     $this->loadConfig();
 }