コード例 #1
0
 public static function Authorize()
 {
     $auth = CAuthorizer::singleton();
     if (!$auth->IsValid()) {
         $auth->clear();
         if (strpos($_SERVER['SCRIPT_NAME'], '/view/') !== FALSE) {
             echo json_encode(array('login_timeout' => 1));
         } else {
             header("location:/login.php");
         }
         die;
     }
 }
コード例 #2
0
ファイル: auth.php プロジェクト: kopytov/openlitespeed
<?php

require_once 'global.php';
CAuthorizer::Authorize();
コード例 #3
0
ファイル: login.php プロジェクト: Acidburn0zzz/openlitespeed
<?

require_once('view/inc/global.php');

$authorizer = CAuthorizer::singleton();

if(isset($_GET['generateKeypair'])) {
	$keypair = $authorizer->GenKeyPair();
	echo $keypair;
	exit;
}

$is_https = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on'));
if (!$authorizer->ShowLogin($is_https, $msg)) {
	header('location:/index.php');
	exit();
}

$no_main_header = true;
include 'view/inc/header.php';

if (!$is_https) {
?>
<script type="text/javascript" src="/res/js/jcryption/jquery.jcryption.min.js" ></script>

<script type="text/javascript">

$(document).ready(function() {
	$("#login").jCryption();
	$("input,select,textarea").removeAttr("disabled");
});
コード例 #4
0
 public static function getCommandSocket($cmd)
 {
     $ADMSOCK = $_SERVER['LSWS_ADMIN_SOCK'];
     if (strncmp($ADMSOCK, 'uds://', 6) == 0) {
         $sock = socket_create(AF_UNIX, SOCK_STREAM, 0);
         $chrootOffset = isset($_SERVER['LS_CHROOT']) ? strlen($_SERVER['LS_CHROOT']) : 0;
         $addr = substr($ADMSOCK, 5 + $chrootOffset);
         if (!socket_connect($sock, $addr)) {
             error_log('cmd ' . $cmd . ' failed to connect to server! socket_connect() failed: ' . socket_strerror(socket_last_error()) . " {$ADMSOCK}\n");
             return false;
         }
     } else {
         $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
         $addr = explode(":", $ADMSOCK);
         if (!socket_connect($sock, $addr[0], intval($addr[1]))) {
             error_log('cmd ' . $cmd . ' failed to connect to server! socket_connect() failed: ' . socket_strerror(socket_last_error()) . " {$ADMSOCK}\n");
             return false;
         }
     }
     $cauth = CAuthorizer::singleton();
     $outBuf = $cauth->GetCmdHeader() . $cmd . "\nend of actions";
     socket_write($sock, $outBuf);
     socket_shutdown($sock, 1);
     return $sock;
 }