Example #1
0
    public function initialise()
    {
        global $PRISM;
        $this->telnetVars = array('ip' => '', 'port' => 0);
        if ($this->loadIniFile($this->telnetVars, false)) {
            if ($PRISM->config->cvars['debugMode'] & PRISM_DEBUG_CORE) {
                console('Loaded ' . $this->iniFile);
            }
        } else {
            # We ask the client to manually input the connection details here.
            require_once ROOTPATH . '/modules/prism_interactive.php';
            Interactive::queryTelnet($this->telnetVars);
            # Then build a telnet.ini file based on these details provided.
            $extraInfo = <<<ININOTES
;
; Telnet listen details (for remote console access).
; 0.0.0.0 (default) will bind the socket to all available network interfaces.
; To limit the bind to one interface only, you can enter its IP address here.
; If you do not want to use the telnet feature, you can comment or remove the 
; lines, or enter "" and 0 for the ip and port.
;

ININOTES;
            if ($this->createIniFile('Telnet Configuration (remote console)', array('telnet' => &$this->telnetVars), $extraInfo)) {
                console('Generated config/' . $this->iniFile);
            }
        }
        // Setup telnet socket to listen on
        if (!$this->setupListenSocket()) {
            return false;
        }
        return true;
    }