Skip to content
This repository
tree: 0e8cc234ee
Fetching contributors…

Cannot retrieve contributors at this time

executable file 41 lines (34 sloc) 0.955 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
<?php if(PHP_SAPI !== 'cli') die();
/**
* CLI
*
* This file is the command-line interface (CLI) entry point for the system
*
* @package MicroMVC
* @author David Pennington
* @copyright (c) 2010 MicroMVC Framework
* @license http://micromvc.com/license
********************************** 80 Columns *********************************
*/

// Include bootstrap
require('Bootstrap.php');

// Require a CLI path
if(empty($argv[1]))
{
die("Please enter a path to the CLI file.\nExample: " . colorize('php cli file.php', 'blue') . "\n");
}

// Build path to file
$file = SP . 'Command/' . str_replace(EXT, '', trim($argv[1], '/')) . EXT;

// Does the file exist?
if( ! is_file($file)) die("Please enter a valid file path\n");

// Require a valid, safe path
if( ! preg_match('/^[\w\-~\/\.+]{1,600}/', $argv[1])) die(colorize("Invalid path given", 'red'). "\n");

try
{
require($file);
}
catch (Exception $e)
{
\Core\Error::exception($e);
}

// End
Something went wrong with that request. Please try again.