58 lines
724 B
PHP
Executable File
58 lines
724 B
PHP
Executable File
<?php
|
|
|
|
namespace Vn\Lib;
|
|
|
|
require_once ('vn/lib/app.php');
|
|
|
|
/**
|
|
* Implements command line applications.
|
|
**/
|
|
class CliApp extends App
|
|
{
|
|
function run ()
|
|
{
|
|
$this->init ();
|
|
|
|
if ($lang = substr (getenv ('LANG'), 0, 2))
|
|
Locale::set ($lang);
|
|
|
|
try {
|
|
$options = getopt ('m:');
|
|
|
|
if (!empty ($options['m']))
|
|
$this->usage ();
|
|
|
|
switch ($options['m'])
|
|
{
|
|
default:
|
|
$this->usage ();
|
|
}
|
|
|
|
echo s('Action completed.')."\n";
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
echo $e->getMessage ()."\n";
|
|
exit (2);
|
|
}
|
|
}
|
|
|
|
function login ()
|
|
{
|
|
$this->conn = $this->getSysConn ();
|
|
}
|
|
|
|
function logout ()
|
|
{
|
|
$this->conn = NULL;
|
|
}
|
|
|
|
function usage ()
|
|
{
|
|
echo "app.php -m method\n";
|
|
exit (1);
|
|
}
|
|
}
|
|
|
|
?>
|