예제 #1
0
파일: PWEUnitTests.php 프로젝트: undera/pwe
 static function getTestPWECore()
 {
     $pwe = new PWECore();
     PWEAutoloader::setPWE($pwe);
     $temp = PWEUnitTests::utGetCleanTMP();
     $pwe->setDataDirectory($temp);
     $pwe->setTempDirectory($temp);
     $pwe->setXMLDirectory($temp);
     PWELogger::debug("Finished creating test PWE Core");
     return $pwe;
 }
예제 #2
0
파일: cfg.php 프로젝트: undera/pwe
<?php

use PWE\Core\PWELogger;
use PWE\Core\PWEAutoloader;
header('Server: Apache');
header('X-Powered-By: PWE');
$root = str_replace('\\', '/', __DIR__);
PWELogger::setLevel(PWELogger::WARNING);
$PWECore->setStaticDirectory($root . '/img');
$PWECore->setStaticHref('/img');
$PWECore->setDataDirectory($root . '/dat');
$PWECore->setTempDirectory($root . '/dat/tmp');
PWEAutoloader::addSourceRoot($root . '/PWE');
예제 #3
0
파일: index.php 프로젝트: undera/pwe
    PWEAutoloader::setPWE($PWECore);
    if (!isset($opts['j'])) {
        throw new InvalidArgumentException("-j option with full job class name required");
    }
    $job = new $opts['j']($PWECore);
    if (!$job instanceof PWECMDJob) {
        throw new InvalidArgumentException("Job class must implement PWECMDJob");
    }
    $job->run();
} else {
    require_once __DIR__ . '/PWE/Lib/Smarty/SmartyAssociative.php';
    require_once __DIR__ . '/PWE/Modules/Outputable.php';
    require_once __DIR__ . '/PWE/Core/PWEURL.php';
    require_once __DIR__ . '/PWE/Auth/PWEUserAuthController.php';
    $PWECore = new PWECore();
    PWEAutoloader::setPWE($PWECore);
    $uri = $_SERVER['REDIRECT_URL'] ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI'];
    $started = microtime(true);
    try {
        require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/cfg.php';
        echo $PWECore->process($uri);
        PWELogger::debug('Response headers: %s', headers_list());
    } catch (\Exception $e) {
        try {
            if ($e->getCode() >= 500 || $e->getCode() <= 100) {
                PWELogger::error('Exception occured at page %s: %s', $uri, $e);
            } elseif ($e->getCode() >= 400) {
                PWELogger::info('Exception occured at page %s: %s', $uri, $e);
            }
            $PWECore->sendHTTPHeader("Content-Type: text/html");
            $PWECore->sendHTTPStatusCode($e->getCode());