ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatServerConfig Class Reference

Class ilChatServerConfig. More...

+ Collaboration diagram for ilChatServerConfig:

Public Member Functions

 __construct ()
 Constructor public.
 setInternalIp ($ip)
 getInternalIp ()
 setExternalIp ($ip)
 getExternalIp ()
 setPort ($port)
 getPort ()
 setSSLStatus ($ssl_status=0)
 getSSLStatus ()
 setSSLPort ($ssl_port)
 getSSLPort ()
 setModeratorPassword ($a_passwd)
 getModeratorPassword ()
 setLogfile ($logfile)
 getLogfile ()
 setLogLevel ($loglevel)
 getLogLevel ()
 setAllowedHosts ($hosts)
 getAllowedHosts ()
 getErrorMessage ()
 setActiveStatus ($status)
 getActiveStatus ()
 getNic ()
 validate ()
 update ()
 updateStatus ()
 read ()
 isAlive ()

Static Public Member Functions

static _isActive ()

Data Fields

 $ilias
 $lng
 $internal_ip
 $external_ip
 $port
 $ssl_status
 $ssl_port
 $moderator
 $logfile
 $loglevel
 $hosts
 $active
 $nic
 $error_message

Private Member Functions

 parseAllowedHosts ()
 writeConfigFile ()

Detailed Description

Class ilChatServerConfig.

Author
Stefan Meyer
Version
Id:
lass.ilChatServerConfig.php 12853 2006-12-15 13:36:31 +0000 (Fr, 15 Dez 2006) smeyer

Definition at line 32 of file class.ilChatServerConfig.php.

Constructor & Destructor Documentation

ilChatServerConfig::__construct ( )

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 58 of file class.ilChatServerConfig.php.

References $ilias, $lng, and read().

{
global $ilias,$lng;
$this->ilias =& $ilias;
$this->lng =& $lng;
$this->lng->loadLanguageModule("chat");
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilChatServerConfig::_isActive ( )
static

Definition at line 70 of file class.ilChatServerConfig.php.

References $ilias.

Referenced by ilUsersOnlineBlockGUI\fillRow().

{
global $ilias;
return (bool) $ilias->getSetting("chat_active");
}

+ Here is the caller graph for this function:

ilChatServerConfig::getActiveStatus ( )

Definition at line 179 of file class.ilChatServerConfig.php.

References $active.

Referenced by updateStatus().

{
return $this->active;
}

+ Here is the caller graph for this function:

ilChatServerConfig::getAllowedHosts ( )

Definition at line 164 of file class.ilChatServerConfig.php.

References $hosts.

Referenced by parseAllowedHosts(), update(), and validate().

{
return $this->hosts;
}

+ Here is the caller graph for this function:

ilChatServerConfig::getErrorMessage ( )

Definition at line 169 of file class.ilChatServerConfig.php.

References $error_message.

{
}
ilChatServerConfig::getExternalIp ( )

Definition at line 94 of file class.ilChatServerConfig.php.

References $internal_ip.

Referenced by update(), and validate().

{
return $this->external_ip ? $this->external_ip : $this->internal_ip;
}

+ Here is the caller graph for this function:

ilChatServerConfig::getInternalIp ( )

Definition at line 84 of file class.ilChatServerConfig.php.

References $internal_ip.

Referenced by isAlive(), update(), and validate().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::getLogfile ( )

Definition at line 144 of file class.ilChatServerConfig.php.

References $logfile.

Referenced by update(), and writeConfigFile().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::getLogLevel ( )

Definition at line 154 of file class.ilChatServerConfig.php.

References $loglevel.

Referenced by update().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::getModeratorPassword ( )

Definition at line 134 of file class.ilChatServerConfig.php.

References $moderator.

Referenced by update(), and validate().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::getNic ( )

Definition at line 184 of file class.ilChatServerConfig.php.

{
return substr($this->nic,0,6);
}
ilChatServerConfig::getPort ( )

Definition at line 104 of file class.ilChatServerConfig.php.

References $port.

Referenced by isAlive(), update(), and validate().

{
return $this->port;
}

+ Here is the caller graph for this function:

ilChatServerConfig::getSSLPort ( )

Definition at line 124 of file class.ilChatServerConfig.php.

References $ssl_port.

Referenced by update(), and validate().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::getSSLStatus ( )

Definition at line 114 of file class.ilChatServerConfig.php.

References $ssl_status.

Referenced by update(), and validate().

{
}

+ Here is the caller graph for this function:

ilChatServerConfig::isAlive ( )

Definition at line 282 of file class.ilChatServerConfig.php.

References getInternalIp(), and getPort().

{
if($this->getInternalIp() and $this->getPort())
{
if( $sp = @fsockopen($this->getInternalIp(),$this->getPort(), $errno, $errstr, 100))
{
fclose($sp);
return true;
}
return false;
}
return false;
}

+ Here is the call graph for this function:

ilChatServerConfig::parseAllowedHosts ( )
private

Definition at line 296 of file class.ilChatServerConfig.php.

References getAllowedHosts(), and setAllowedHosts().

Referenced by validate().

{
$hosts_arr2 = array();
$hosts_arr = explode(',',$this->getAllowedHosts());
for($i = 0;$i < count($hosts_arr); ++$i)
{
if(trim($hosts_arr[$i]))
{
$hosts_arr2[] = trim($hosts_arr[$i]);
}
}
$this->setAllowedHosts(implode(',',$hosts_arr2));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilChatServerConfig::read ( )

Definition at line 267 of file class.ilChatServerConfig.php.

Referenced by __construct().

{
$this->internal_ip = $this->ilias->getSetting("chat_internal_ip");
$this->external_ip = $this->ilias->getSetting("chat_external_ip");
$this->port = $this->ilias->getSetting("chat_port");
$this->ssl_status = $this->ilias->getSetting("chat_ssl_status");
$this->ssl_port = $this->ilias->getSetting("chat_ssl_port");
$this->moderator = $this->ilias->getSetting("chat_moderator_password");
$this->loglevel = $this->ilias->getSetting("chat_loglevel");
$this->logfile = $this->ilias->getSetting("chat_logfile");
$this->hosts = $this->ilias->getSetting("chat_hosts");
$this->active = $this->ilias->getSetting("chat_active");
$this->nic = $this->ilias->getSetting("nic_key");
}

+ Here is the caller graph for this function:

ilChatServerConfig::setActiveStatus (   $status)

Definition at line 174 of file class.ilChatServerConfig.php.

{
$this->active = $status;
}
ilChatServerConfig::setAllowedHosts (   $hosts)

Definition at line 159 of file class.ilChatServerConfig.php.

References $hosts.

Referenced by parseAllowedHosts().

{
$this->hosts = $hosts;
}

+ Here is the caller graph for this function:

ilChatServerConfig::setExternalIp (   $ip)

Definition at line 89 of file class.ilChatServerConfig.php.

{
$this->external_ip = $ip;
}
ilChatServerConfig::setInternalIp (   $ip)

Definition at line 79 of file class.ilChatServerConfig.php.

{
$this->internal_ip = $ip;
}
ilChatServerConfig::setLogfile (   $logfile)

Definition at line 139 of file class.ilChatServerConfig.php.

References $logfile.

{
$this->logfile = $logfile;
}
ilChatServerConfig::setLogLevel (   $loglevel)

Definition at line 149 of file class.ilChatServerConfig.php.

References $loglevel.

{
$this->loglevel = $loglevel;
}
ilChatServerConfig::setModeratorPassword (   $a_passwd)

Definition at line 129 of file class.ilChatServerConfig.php.

{
$this->moderator = $a_passwd;
}
ilChatServerConfig::setPort (   $port)

Definition at line 99 of file class.ilChatServerConfig.php.

References $port.

{
$this->port = $port;
}
ilChatServerConfig::setSSLPort (   $ssl_port)

Definition at line 119 of file class.ilChatServerConfig.php.

References $ssl_port.

{
$this->ssl_port = $ssl_port;
}
ilChatServerConfig::setSSLStatus (   $ssl_status = 0)

Definition at line 109 of file class.ilChatServerConfig.php.

References $ssl_status.

{
$this->ssl_status = $ssl_status;
}
ilChatServerConfig::update ( )

Definition at line 246 of file class.ilChatServerConfig.php.

References getAllowedHosts(), getExternalIp(), getInternalIp(), getLogfile(), getLogLevel(), getModeratorPassword(), getPort(), getSSLPort(), getSSLStatus(), and writeConfigFile().

{
$this->ilias->setSetting("chat_internal_ip",$this->getInternalIp());
$this->ilias->setSetting("chat_external_ip",$this->getExternalIp());
$this->ilias->setSetting("chat_port",$this->getPort());
$this->ilias->setSetting("chat_ssl_status",$this->getSSLStatus());
$this->ilias->setSetting("chat_ssl_port",$this->getSSLPort());
$this->ilias->setSetting("chat_logfile",$this->getLogfile());
$this->ilias->setSetting("chat_loglevel",$this->getLogLevel());
$this->ilias->setSetting("chat_hosts",$this->getAllowedHosts());
$this->ilias->setSetting("chat_moderator_password",$this->getModeratorPassword());
return $this->writeConfigFile();
}

+ Here is the call graph for this function:

ilChatServerConfig::updateStatus ( )

Definition at line 261 of file class.ilChatServerConfig.php.

References getActiveStatus().

{
$this->ilias->setSetting("chat_active",$this->getActiveStatus());
}

+ Here is the call graph for this function:

ilChatServerConfig::validate ( )

Definition at line 189 of file class.ilChatServerConfig.php.

References getAllowedHosts(), getExternalIp(), getInternalIp(), getModeratorPassword(), getPort(), getSSLPort(), getSSLStatus(), and parseAllowedHosts().

{
$this->error_message = "";
if(!$this->getInternalIp())
{
$this->error_message .= $this->lng->txt("chat_add_internal_ip");
}
if(!$this->getExternalIp())
{
if($this->error_message)
{
$this->error_message .= "<br />";
}
$this->error_message .= $this->lng->txt("chat_add_external_ip");
}
if(!$this->getPort())
{
if($this->error_message)
{
$this->error_message .= "<br />";
}
$this->error_message .= $this->lng->txt("chat_add_port");
}
if($this->getSSLStatus() && !$this->getSSLPort())
{
if($this->error_message)
{
$this->error_message .= "<br />";
}
$this->error_message .= $this->lng->txt("chat_add_ssl_port");
}
if(!$this->getModeratorPassword())
{
if($this->error_message)
{
$this->error_message .= "<br />";
}
$this->error_message .= $this->lng->txt("chat_add_moderator_password");
}
if(!$this->getAllowedHosts())
{
if($this->error_message)
{
$this->error_message .= "<br />";
}
$this->error_message .= $this->lng->txt("chat_add_allowed_hosts");
}
if($this->getAllowedHosts())
{
}
return $this->error_message ? false : true;
}

+ Here is the call graph for this function:

ilChatServerConfig::writeConfigFile ( )
private

Definition at line 313 of file class.ilChatServerConfig.php.

References ilUtil\getDataDir(), getLogfile(), and ilUtil\makeDir().

Referenced by update().

{
if(!@is_dir(ilUtil::getDataDir().'/chat'))
{
}
if(!($fp = @fopen(ilUtil::getDataDir().'/chat/server.ini',"w")))
{
$this->error_message = ilUtil::getDataDir().'/chat/server.ini ' .$this->lng->txt("chat_no_write_perm");
return false;
}
$content = "LogLevel = ".$this->getLogLevel()."\n";
if($this->getLogfile())
{
$content .= "LogFile = ".$this->getLogfile()."\n";
}
$content .= "IpAddress = ".$this->getInternalIp()."\n";
$content .= "ExternalIpAddress = ".$this->getExternalIp()."\n";
$content .= "Port = ".$this->getPort()."\n";
#$content .= "SSLStatus = ".($this->getSSLStatus() ? $this->getSSLStatus() : 0)."\n";
#$content .= "SSLPort = ".$this->getSSLPort()."\n";
$content .= "ModeratorPassword = ".$this->getModeratorPassword()."\n";
$content .= "HeaderFileName = ".ILIAS_ABSOLUTE_PATH."/Modules/Chat/templates/default/header.html\n";
$content .= "FooterFileName = ".ILIAS_ABSOLUTE_PATH."/Modules/Chat/templates/default/footer.html\n";
$content .= "Authentication = 1\n";
$content .= "ConnectionsFrom = ".$this->getAllowedHosts()."\n";
if(!@fwrite($fp,$content))
{
$this->error_message = ilUtil::getDataDir().'/chat/server.ini '.$this->lng->txt("chat_no_write_perm");
fclose($fp);
return false;
}
fclose($fp);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilChatServerConfig::$active

Definition at line 46 of file class.ilChatServerConfig.php.

Referenced by getActiveStatus().

ilChatServerConfig::$error_message

Definition at line 49 of file class.ilChatServerConfig.php.

Referenced by getErrorMessage().

ilChatServerConfig::$external_ip

Definition at line 38 of file class.ilChatServerConfig.php.

ilChatServerConfig::$hosts

Definition at line 45 of file class.ilChatServerConfig.php.

Referenced by getAllowedHosts(), and setAllowedHosts().

ilChatServerConfig::$ilias

Definition at line 34 of file class.ilChatServerConfig.php.

Referenced by __construct(), and _isActive().

ilChatServerConfig::$internal_ip

Definition at line 37 of file class.ilChatServerConfig.php.

Referenced by getExternalIp(), and getInternalIp().

ilChatServerConfig::$lng

Definition at line 35 of file class.ilChatServerConfig.php.

Referenced by __construct().

ilChatServerConfig::$logfile

Definition at line 43 of file class.ilChatServerConfig.php.

Referenced by getLogfile(), and setLogfile().

ilChatServerConfig::$loglevel

Definition at line 44 of file class.ilChatServerConfig.php.

Referenced by getLogLevel(), and setLogLevel().

ilChatServerConfig::$moderator

Definition at line 42 of file class.ilChatServerConfig.php.

Referenced by getModeratorPassword().

ilChatServerConfig::$nic

Definition at line 47 of file class.ilChatServerConfig.php.

ilChatServerConfig::$port

Definition at line 39 of file class.ilChatServerConfig.php.

Referenced by getPort(), and setPort().

ilChatServerConfig::$ssl_port

Definition at line 41 of file class.ilChatServerConfig.php.

Referenced by getSSLPort(), and setSSLPort().

ilChatServerConfig::$ssl_status

Definition at line 40 of file class.ilChatServerConfig.php.

Referenced by getSSLStatus(), and setSSLStatus().


The documentation for this class was generated from the following file: