2012-03-14 01:45:59 -04:00
|
|
|
<?php
|
|
|
|
|
2012-03-14 10:44:29 -04:00
|
|
|
/*
|
|
|
|
* This script will look for Tinyboard in the following places (in order):
|
2012-03-14 11:11:38 -04:00
|
|
|
* - $TINYBOARD_PATH environment varaible
|
2012-03-14 10:44:29 -04:00
|
|
|
* - ./
|
|
|
|
* - ./Tinyboard/
|
|
|
|
* - ../
|
|
|
|
*/
|
|
|
|
|
2013-12-25 17:08:19 -05:00
|
|
|
ini_set('display_errors', 1);
|
|
|
|
error_reporting(E_ALL);
|
2012-03-14 12:14:09 -04:00
|
|
|
set_time_limit(0);
|
2012-03-14 10:44:29 -04:00
|
|
|
$shell_path = getcwd();
|
|
|
|
|
2014-09-20 18:56:00 -04:00
|
|
|
if (php_sapi_name() != 'cli') {
|
2014-01-31 17:37:55 -05:00
|
|
|
die("This script is executable only from Command Line Interface.");
|
|
|
|
}
|
|
|
|
|
2012-03-14 11:11:38 -04:00
|
|
|
if(getenv('TINYBOARD_PATH') !== false)
|
|
|
|
$dir = getenv('TINYBOARD_PATH');
|
|
|
|
elseif(file_exists('inc/functions.php'))
|
2012-03-14 10:44:29 -04:00
|
|
|
$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 09:36:51 -04:00
|
|
|
die("Could not locate Tinyboard directory!\n");
|
2012-03-14 10:44:29 -04:00
|
|
|
|
|
|
|
if($dir && !chdir($dir))
|
2012-03-17 09:36:51 -04:00
|
|
|
die("Could not change directory to {$dir}\n");
|
2012-03-14 10:44:29 -04:00
|
|
|
|
2012-03-14 11:11:38 -04:00
|
|
|
if(!getenv('TINYBOARD_PATH')) {
|
|
|
|
// follow symlink
|
|
|
|
chdir(realpath('inc') . '/..');
|
|
|
|
}
|
|
|
|
|
2012-03-15 07:16:26 -04:00
|
|
|
putenv('TINYBOARD_PATH=' . getcwd());
|
2012-03-14 10:44:29 -04:00
|
|
|
|
|
|
|
require 'inc/functions.php';
|
|
|
|
|
2012-03-14 01:45:59 -04:00
|
|
|
$mod = Array(
|
|
|
|
'id' => -1,
|
|
|
|
'type' => ADMIN,
|
|
|
|
'username' => '?',
|
|
|
|
'boards' => Array('*')
|
|
|
|
);
|
|
|
|
|
|
|
|
|