function adminService($action = null, $serviceID = null){ ///Validate if the user has been loggen in if (parent::allowAccess()){ $service_name = ''; $server_name = ''; $TCPport = ''; //Log Stuff $message1 = ''; $message2 = ''; if ($serviceID > 0) $TCPport = $this->getFormatterTCPPort($serviceID); else $TCPport = $this->getServerTCPPort(0); switch($serviceID){ case 0: $server_name = 'Servidor CONRED ' . $this->getFileVersion($this->config->item('server_exe_path')) . ' [TCP ' . $TCPport . ']'; $service_name = str_replace('.exe', '', end(explode('\\', $this->config->item('server_exe_path')))); //'jTranServer_Conred'; break; case 1: $server_name = 'Formateador COMCEL ' . $this->getFileVersion($this->config->item('comcel_formatter_exe_path')) . ' [TCP ' . $TCPport . ']'; $service_name = str_replace('.exe', '', end(explode('\\', $this->config->item('comcel_formatter_exe_path')))); //'jTranServer_ComcelFormatter'; break; case 2: $server_name = 'Formateador MOVILRED ' . $this->getFileVersion($this->config->item('movilred_formatter_exe_path')) . ' [TCP ' . $TCPport . ']'; $service_name = str_replace('.exe', '', end(explode('\\', $this->config->item('movilred_formatter_exe_path')))); //'jTranServer_MovilredFormatter'; break; case 3: $server_name = 'Formateador TIGO ' . $this->getFileVersion($this->config->item('tigo_formatter_exe_path')) . ' [TCP ' . $TCPport . ']'; $service_name = str_replace('.exe', '', end(explode('\\', $this->config->item('tigo_formatter_exe_path')))); //'jTranServer_TigoFormatter'; break; } $service= new WSM_Service($service_name); switch($action){ //Start Service case 1: $service->start(); sleep(1); $service->start(); $message1 = $server_name . ' Iniciado.'; break; //Stop Service case 2: $service->stop(); sleep(1); $service->stop(); $message1 = $server_name . ' Detenido.'; break; //Restart Service case 3: $service->stop(); sleep(1); $service->start(); $service->start(); sleep(1); $message1 = $server_name . ' Reiniciado.'; break; } if ($action > 0 ){ //Log Action, Web Form $this->saveLog($message1, $message2); } $image = ''; $text = ''; if ($service->status() == SERVICE_RUNNING){ $image = '<img src=\'images/start.png\' />'; $text = 'Iniciado'; } else { $image = '<img src=\'images/stop.png\' />'; $text = 'Detenido'; } echo "<h4>" . $server_name . "</h4> <p>Estado Servicio: " . $text . " " . $image . "</p> <br /> "; } else{ //Deny Hacking Access parent::destroySession(); } }