Updated chatfiles
This commit is contained in:
parent
d7ee19306c
commit
ffa8c6f76e
3 changed files with 34 additions and 10 deletions
|
@ -38,21 +38,27 @@ class manage_chat_panel extends admin_module{
|
|||
if($istat['status']==2){
|
||||
shell_exec("kill -9 ".$istat['pid']);
|
||||
sleep(5);
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
shell_exec("sudo /bin/systemctl restart funchat");
|
||||
}else{
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
shell_exec("sudo /bin/systemctl restart funchat");
|
||||
}
|
||||
$panel->admin_message("Triggered", 'The Chatstart has been triggered. please refresh the page to see if it was successful.',TRUE,"manage_chat");
|
||||
}elseif(isset($_POST['emergency'])){
|
||||
}elseif(isset($_POST['restart'])){
|
||||
$istat = $this->get_status();
|
||||
if($istat['status']==1){
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
$this->sendRPC("restart");
|
||||
}elseif($istat['status']==2){
|
||||
shell_exec("kill -9 ".$istat['pid']);
|
||||
sleep(5);
|
||||
shell_exec("sudo /bin/systemctl restart austria");
|
||||
shell_exec("sudo /bin/systemctl restart funchat");
|
||||
}
|
||||
$panel->admin_message("Triggered", 'The Emergency Chatrestart has been triggered. please refresh the page to see if it was successful.',TRUE,"manage_chat");
|
||||
}elseif(isset($_POST['stop'])){
|
||||
$istat = $this->get_status();
|
||||
if($istat['status']==1){
|
||||
$this->sendRPC("stop");
|
||||
}
|
||||
$panel->admin_message("Triggered", 'The Chat has been stopped. please refresh the page to see if it was successful.',TRUE,"manage_chat");
|
||||
}else{
|
||||
$count=false;
|
||||
$panel->title="Manage Chat";
|
||||
|
@ -64,11 +70,15 @@ class manage_chat_panel extends admin_module{
|
|||
|
||||
$panel->content.=$status.'<br />';
|
||||
$extra = "";
|
||||
$extrastop = "";
|
||||
if($istat==1){
|
||||
$extra='disabled="disabled"';
|
||||
}elseif($istat==0){
|
||||
$extrastop='disabled="disabled"';
|
||||
}
|
||||
$panel->submit(array('name'=>'start'),'value="Start"'.$extra);
|
||||
$panel->submit(array('name'=>'emergency'),'value="Emergency Restart"');
|
||||
$panel->submit(array('name'=>'restart'),'value="Restart"');
|
||||
$panel->submit(array('name'=>'stop'),'value="Stop"'.$extrastop);
|
||||
$panel->formClose();
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +95,7 @@ class manage_chat_panel extends admin_module{
|
|||
}
|
||||
|
||||
function get_status(){
|
||||
$dat='/bin/systemctl status austria|grep "Main PID"';
|
||||
$dat='/bin/systemctl status funchat|grep "Main PID"';
|
||||
exec($dat,$cat);
|
||||
$data = explode(" ",$cat[0]);
|
||||
$r['pid'] = $data[5];
|
||||
|
@ -108,6 +118,20 @@ class manage_chat_panel extends admin_module{
|
|||
return $r;
|
||||
}
|
||||
|
||||
function sendRPC($type){
|
||||
global $config;
|
||||
$ch = curl_init();
|
||||
// setze die URL und andere Optionen
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://chat.funch.at/rpc?secret='.$config['chatsecret'].'&task='.$type);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
function removeEmptyValues($ar)
|
||||
{
|
||||
$result = array();
|
||||
|
|
|
@ -34,11 +34,11 @@ class module_chat extends admin_module{
|
|||
`categoryname`
|
||||
)
|
||||
VALUES (
|
||||
NULL , 'yac Chat'
|
||||
NULL , 'PT Chat'
|
||||
);");
|
||||
$cid=$db->last_id();
|
||||
$db->query("INSERT INTO `" . $config["prefix"] . "config` (`name`, `value`, `title`, `description`, `option`, `category`) VALUES
|
||||
('LOGINKEY', 'zuzfshgw8qitr813841492', 'Loginkey', 'Der Secure Key des Chats.', 'text', ".$cid."),
|
||||
('LOGINKEY', '', 'Loginkey', 'Der Secure Key des Chats.', 'text', ".$cid."),
|
||||
('SOCK_PORT', '8090', 'Chatport', 'Der Port auf dem der Server l<>uft.', 'text', ".$cid."),
|
||||
('ENABLE_WATCHSERVER', '', 'Watchserver einschalten', 'Soll der Watchserver aktiviert werden?.', 'select(Ja|true;Nein|false)', ".$cid."),
|
||||
('SMILIES_URL', 'http://forum.recensio.org/', 'Smilieurl', 'Die Url zu den Smiliebildern', 'text', ".$cid.");");
|
||||
|
|
|
@ -62,7 +62,7 @@ class chat extends module{
|
|||
$ch = curl_init();
|
||||
|
||||
// setze die URL und andere Optionen
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://chat.funch.at/login?uid='.$session->userdata['uid'].'&room='.$_POST['room'].'&ip=' . $_SERVER['REMOTE_ADDR'] . '&browser=' . urlencode($_SERVER['HTTP_USER_AGENT']) . '&loginkey=4de0345e1c2a6e4bcd26d6874b&template='.$rctemplate);
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://chat.funch.at/login?uid='.$session->userdata['uid'].'&room='.$_POST['room'].'&ip=' . $_SERVER['REMOTE_ADDR'] . '&browser=' . urlencode($_SERVER['HTTP_USER_AGENT']) . '&loginkey='.$config['LOGINKEY'].'&template='.$rctemplate);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue