server/onyx/include/common.php

48 lines
1.3 KiB
PHP
Raw Normal View History

2013-10-09 13:40:23 +00:00
<?php
if(!defined('ONYX')) exit;
if (empty($sess->values["connected"]) && !defined("xCSRF"))
define("xCSRF", true);
require_once("functions.php"); //Inclusion des principales fonctions
2013-10-10 02:47:02 +00:00
require_once("common/Exercice.class.php");
require_once("common/Member.class.php");
2013-10-22 06:16:02 +00:00
require_once("common/Team.class.php");
2013-10-10 02:47:02 +00:00
require_once("common/Theme.class.php");
2013-10-09 13:40:23 +00:00
$template = new Template();
$template->assign("ERRmessage", false);
2014-01-14 18:45:56 +00:00
2015-01-13 16:58:33 +00:00
if (is_file($VAR["misc_dir"]."/shared/challenge_started"))
2014-01-14 18:45:56 +00:00
{
2015-01-13 16:58:33 +00:00
$VAR["start_challenge"] = intval(file_get_contents($VAR["misc_dir"]."/shared/challenge_started"));
2014-01-14 18:45:56 +00:00
$VAR["end_challenge"] = $VAR["start_challenge"] + 14400;
$template->assign("END", $VAR['end_challenge']);
}
2013-10-09 13:40:23 +00:00
function pipe_backend_scheduler($instruct)
{
2014-12-28 10:13:50 +00:00
global $VAR;
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
if (is_writable($VAR["scheduler_socket"]) && socket_connect($socket, $VAR["scheduler_socket"]))
{
2015-01-13 06:46:27 +00:00
socket_write($socket, $instruct."\r\n") or die(socket_strerror(socket_last_error()));
sleep(1);
socket_shutdown($socket);
socket_close($socket);
}
2014-12-28 10:13:50 +00:00
else if(defined("DEBUG") && DEBUG)
{
print("Socket '".$VAR["scheduler_socket"]."' is not writable by ".$_SERVER["USER"]." user!");
exit(1);
}
}
if (!empty($VAR['misc_dir']))
$template->assign("MISC_DIR", $VAR['misc_dir']);
2013-10-09 13:40:23 +00:00
if (!empty($LANG))
2014-12-28 10:13:50 +00:00
$template->assign("LANG", $LANG);