Esempio n. 1
0
 public static function &instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 2
0
define("TLDIR_INDEX", $_SERVER['DOCUMENT_ROOT']);
@(include_once TLDIR_INDEX . '/config/config.php.inc');
@(include_once TLDIR_INDEX . '/php/KSAuth.php');
@(include_once TLDIR_INDEX . '/php/KSJson.php');
@(include_once TLDIR_INDEX . '/php/KSServiceJson.php');
// User and Pass in _POST will be checked by KSAuth class
$_POST['user'] = trim(strip_tags(urldecode(stripslashes($_POST['user']))));
$_POST['pass'] = trim(strip_tags(urldecode(stripslashes($_POST['pass']))));
try {
    $_auth = new KSAuth();
    if ($_POST['user'] && $_POST['pass']) {
        $_auth->authenticate($_POST['user'], $_POST['pass']);
    } else {
        if ($_SESSION['KS_SID']) {
            $_auth->authenticate();
        } else {
            throw new RuntimeException('You are not authorized for this page.');
        }
    }
    $files = glob("{$_SERVER['DOCUMENT_ROOT']}{$_SERVER['PHP_SELF']}.inc") or array();
    if (1 != count($files)) {
        // INSUFFICIENT PRIVILEDGES
        throw new RuntimeException('Requested Page does not exit.');
    }
    // INCLUDE FILE
    @(require_once $files[0]);
} catch (Exception $exception) {
    KSServiceJson::instance()->chain(new KSJsonError($exception->getMessage()));
}
echo KSServiceJson::instance();
Esempio n. 3
0
//
// KSLog is freely distributable under the terms of an MIT-style license.
//
session_start();
define("TLDIR_INDEX", $_SERVER['DOCUMENT_ROOT']);
@(include_once TLDIR_INDEX . '/config/config.inc.php');
@(include_once TLDIR_INDEX . '/php/KSAuth.php');
@(include_once TLDIR_INDEX . '/php/KSPage.php');
@(include_once TLDIR_INDEX . '/php/KSJson.php');
@(include_once TLDIR_INDEX . '/php/KSMySQL.php');
@(include_once TLDIR_INDEX . '/php/KSServiceJson.php');
$_auth = new KSAuth();
try {
    $_auth->authenticate();
} catch (Exception $exception) {
    KSServiceJson::instance()->chain(new KSJsonError($exception->getMessage()));
}
class KSIndexPage extends KSPage
{
    public function head()
    {
        parent::head();
        ?>

  <title>KSLog (alpha)</title>

  <link href='./css/ksgrowl.css' rel='stylesheet' type='text/css'>

  <link href='./css/kslog.css'   rel='stylesheet' type='text/css'>

  <script type='text/javascript' src='./js/KSException.js'></script>