1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-11 07:16:10 +01:00
vichan/tools/inc/cli.php

51 lines
1.0 KiB
PHP
Raw Normal View History

2012-03-14 06:45:59 +01:00
<?php
/*
* This script will look for Tinyboard in the following places (in order):
2012-03-14 16:11:38 +01:00
* - $TINYBOARD_PATH environment varaible
* - ./
* - ./Tinyboard/
* - ../
*/
ini_set('display_errors', 1);
error_reporting(E_ALL);
set_time_limit(0);
$shell_path = getcwd();
if (php_sapi_name() != 'cli') {
die("This script is executable only from Command Line Interface.");
}
2012-03-14 16:11:38 +01:00
if(getenv('TINYBOARD_PATH') !== false)
$dir = getenv('TINYBOARD_PATH');
elseif(file_exists('inc/functions.php'))
$dir = false;
elseif(file_exists('Tinyboard') && is_dir('Tinyboard') && file_exists('Tinyboard/inc/functions.php'))
$dir = 'Tinyboard';
elseif(file_exists('../inc/functions.php'))
$dir = '..';
else
2012-03-17 14:36:51 +01:00
die("Could not locate Tinyboard directory!\n");
if($dir && !chdir($dir))
2012-03-17 14:36:51 +01:00
die("Could not change directory to {$dir}\n");
2012-03-14 16:11:38 +01:00
if(!getenv('TINYBOARD_PATH')) {
// follow symlink
chdir(realpath('inc') . '/..');
}
putenv('TINYBOARD_PATH=' . getcwd());
2021-02-14 09:22:44 +01:00
require 'inc/bootstrap.php';
2012-03-14 06:45:59 +01:00
$mod = Array(
'id' => -1,
'type' => ADMIN,
'username' => '?',
'boards' => Array('*')
);