Exemplo n.º 1
0
    define('GWF_CONFIG_PATH', realpath(GWF_PATH . 'www/protected/config.php'));
    #TODO
}
# Is there a config file?
if (false === file_exists(GWF_CONFIG_PATH)) {
    $write_a_config = true;
    define('GWF_HAVE_CONFIG', true);
} else {
    GWF3::onLoadConfig(GWF_CONFIG_PATH);
}
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizard.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallFunctions.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallConfig.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizardLanguage.php';
GWF_InstallWizardLanguage::init();
GWF_Log::init(false, true, GWF_PATH . '/protected/installlog');
$lang = new GWF_LangTrans(GWF_CORE_PATH . 'lang/install/install');
if (isset($write_a_config)) {
    GWF_InstallConfig::writeConfig($lang);
    echo 'I have written a default config to protected/config.php' . PHP_EOL;
    echo 'Please edit that config.php, before installing gwf3.' . PHP_EOL;
    die(0);
}
if (false === gdo_db()) {
    file_put_contents('php://stderr', 'Cannot connect to the database. Check your protected/config.php!' . PHP_EOL);
    die(1);
}
echo "Installing gwf util core..." . PHP_EOL;
if (!GWF_InstallFunctions::core(false)) {
    file_put_contents('php://stderr', 'Cannot install core... giving up!');
    die(2);
Exemplo n.º 2
0
 /**
  * Initialize the GWF_Log
  * @param boolean $no_session 
  */
 public static function onStartLogging($no_session = false)
 {
     $username = false;
     if (false === $no_session) {
         if (false !== ($user = GWF_Session::getUser())) {
             $username = $user->getVar('user_name');
         }
     }
     GWF_Log::init($username, GWF_LOG_BITS, GWF_LOGGING_PATH);
     if (!self::getConfig('buffered_log')) {
         GWF_Log::disable(GWF_Log::BUFFERED);
     }
 }
Exemplo n.º 3
0
# Require config
$config_file = $argv[1];
require_once '../../../www/protected/' . $config_file;
# and gwf
require_once '../../../gwf3.class.php';
$gwf = new GWF3(NULL, array('init' => true, 'bootstrap' => false, 'website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'log_request' => false, 'blocking' => true, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false, 'kick_banned_ip' => false, 'env' => isset($argv[5]) ? $argv[5] : 'prod', 'unix_user' => isset($argv[6]) ? $argv[6] : 'root'));
# That´s all of GWF3 we will share with the worker.
GWF_HTML::init();
GWF_Debug::setDieOnError(false);
GWF_Debug::setMailOnError(false);
$_GET['ajax'] = 1;
# And this is the worker process
require 'dog_include/Dog_WorkerThread.php';
$worker = new Dog_WorkerThread();
$worker->start();
# Parent resources
GWF_Log::init(false, GWF_Log::_DEFAULT - GWF_Log::BUFFERED, GWF_PATH . 'www/protected/logs/dog');
gdo_db();
# Dog please
require_once 'Dog.php';
Dog::setUnixUsername(GWF3::getConfig('unix_user'));
# Dog installer
if (isset($argv[2]) && $argv[2] === 'install') {
    require_once 'mini_install.php';
}
# Dog init
Dog_Init::init($worker);
# Dog l(a)unch
if (!defined('DOG_NO_LAUNCH') && Dog_Init::validate()) {
    Dog::mainloop();
}
Exemplo n.º 4
0
<?php

chdir('../../../');
require_once 'core/inc/util/GWF_Log.php';
GWF_Log::init('Guest', true, dirname(__FILE__) . '/testlog');
GWF_Log::log('baim', 'THIS MC IS HACKED!');
Exemplo n.º 5
0
set_time_limit(0);
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'log_request' => false, 'blocking' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => true));
######################
### Security Check ###
######################
if (!GWF_IP6::isLocal()) {
    if ($_SERVER['REMOTE_ADDR'] !== $worker_ip) {
        GWF3::logDie(sprintf('You have no valid $worker_ip in %s line %s.', __FILE__, __LINE__));
    }
}
GWF_Debug::setDieOnError(false);
GWF_Language::initEnglish();
GWF_HTML::init();
GWF_Log::init(false, true, GWF_WWW_PATH . 'protected/logs');
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallFunctions.php';
if (false !== Common::getPost('core')) {
    $success = true;
    install_core(false, $success);
}
if (false !== Common::getPost('lang')) {
    install_createLanguage(true, true, false);
}
if (false !== Common::getPost('lang2')) {
    install_createLanguage(true, true, true);
}
if (false !== Common::getPost('mods')) {
    install_all_modules();
}
if (false !== Common::getPost('users')) {
Exemplo n.º 6
0
 private function setupChild()
 {
     self::$CHILD_INSTANCE = $this;
     declare (ticks=1);
     if (false === pcntl_signal(SIGINT, array(__CLASS__, 'SIGINT'))) {
         die('Cannot install SIGINT handler in ' . __FILE__ . PHP_EOL);
     }
     // 		chdir('../../../');
     GWF_Log::init(false, GWF_Log::_DEFAULT - GWF_Log::BUFFERED, GWF_PATH . 'www/protected/logs/dog/worker');
     GWF_Log::logCron('--================--');
     GWF_Log::logCron('-= Worker started =-');
     GWF_Log::logCron('--================--');
 }
Exemplo n.º 7
0
#!/usr/bin/php
<?php 
if (PHP_SAPI !== 'cli') {
    die('CLI Please');
}
# GWF_PATH
chdir('../../../www');
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(getcwd(), array('init' => true, 'bootstrap' => false, 'website_init' => true, 'autoload_modules' => false, 'load_module' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'buffered_log' => false, 'log_request' => false, 'blocking' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false, 'kick_banned_ip' => false));
require_once 'merge/mergefuncs.php';
GWF_Log::init(false, 0x7fffffff, 'protected/logs/merge');
if ($argc !== 6) {
    merge_usage();
}
GWF_Log::logCron('======================');
GWF_Log::logCron('=== STARTING MERGE ===');
GWF_Log::logCron('======================');
if (false === ($db_from = merge_db($argv))) {
    GWF_Log::logCritical('Connection to the import db failed!');
}
$db_to = gdo_db();
// Store some offsets, like highest user(sic) => 1234
$db_offsets = array();
$prefix = $argv[4];
$prevar = $argv[5];
$modules = GWF_ModuleLoader::loadModulesFS();
$modules = GWF_ModuleLoader::sortModules($modules, 'module_priority', 'ASC');
GWF_Log::logCron('=== LOADED MODULES ===');
GWF_Log::logCron('======================');
merge_core($db_from, $db_to, $db_offsets, $prefix, $prevar);