Class ilChatServerConfig. More...
Public Member Functions | |
| ilChatServerConfig () | |
| Constructor public. | |
| _isActive () | |
| 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 () | |
| __parseAllowedHosts () | |
| __writeConfigFile () | |
Data Fields | |
| $ilias | |
| $lng | |
| $internal_ip | |
| $external_ip | |
| $port | |
| $ssl_status | |
| $ssl_port | |
| $moderator | |
| $logfile | |
| $loglevel | |
| $hosts | |
| $active | |
| $nic | |
| $error_message | |
Class ilChatServerConfig.
Definition at line 32 of file class.ilChatServerConfig.php.
| ilChatServerConfig::__parseAllowedHosts | ( | ) |
Definition at line 274 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::__writeConfigFile | ( | ) |
Definition at line 290 of file class.ilChatServerConfig.php.
References ilUtil::getDataDir(), getLogfile(), and ilUtil::makeDir().
Referenced by update().
{
if(!@is_dir(ilUtil::getDataDir().'/chat'))
{
ilUtil::makeDir(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:| ilChatServerConfig::_isActive | ( | ) |
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 160 of file class.ilChatServerConfig.php.
Referenced by updateStatus().
{
return $this->active;
}
Here is the caller graph for this function:| ilChatServerConfig::getAllowedHosts | ( | ) |
Definition at line 147 of file class.ilChatServerConfig.php.
Referenced by __parseAllowedHosts(), update(), and validate().
{
return $this->hosts;
}
Here is the caller graph for this function:| ilChatServerConfig::getErrorMessage | ( | ) |
Definition at line 152 of file class.ilChatServerConfig.php.
{
return $this->error_message;
}
| ilChatServerConfig::getExternalIp | ( | ) |
Definition at line 91 of file class.ilChatServerConfig.php.
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 83 of file class.ilChatServerConfig.php.
Referenced by isAlive(), update(), and validate().
{
return $this->internal_ip;
}
Here is the caller graph for this function:| ilChatServerConfig::getLogfile | ( | ) |
Definition at line 131 of file class.ilChatServerConfig.php.
Referenced by __writeConfigFile(), and update().
{
return $this->logfile;
}
Here is the caller graph for this function:| ilChatServerConfig::getLogLevel | ( | ) |
Definition at line 139 of file class.ilChatServerConfig.php.
Referenced by update().
{
return $this->loglevel;
}
Here is the caller graph for this function:| ilChatServerConfig::getModeratorPassword | ( | ) |
Definition at line 123 of file class.ilChatServerConfig.php.
Referenced by update(), and validate().
{
return $this->moderator;
}
Here is the caller graph for this function:| ilChatServerConfig::getNic | ( | ) |
Definition at line 164 of file class.ilChatServerConfig.php.
{
return substr($this->nic,0,6);
}
| ilChatServerConfig::getPort | ( | ) |
Definition at line 99 of file class.ilChatServerConfig.php.
Referenced by isAlive(), update(), and validate().
{
return $this->port;
}
Here is the caller graph for this function:| ilChatServerConfig::getSSLPort | ( | ) |
Definition at line 115 of file class.ilChatServerConfig.php.
Referenced by update(), and validate().
{
return $this->ssl_port;
}
Here is the caller graph for this function:| ilChatServerConfig::getSSLStatus | ( | ) |
Definition at line 107 of file class.ilChatServerConfig.php.
Referenced by update(), and validate().
{
return $this->ssl_status;
}
Here is the caller graph for this function:| ilChatServerConfig::ilChatServerConfig | ( | ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat 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:| ilChatServerConfig::isAlive | ( | ) |
Definition at line 259 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::read | ( | ) |
Definition at line 244 of file class.ilChatServerConfig.php.
Referenced by ilChatServerConfig().
{
$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 156 of file class.ilChatServerConfig.php.
{
$this->active = $status;
}
| ilChatServerConfig::setAllowedHosts | ( | $ | hosts | ) |
Definition at line 143 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 87 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 127 of file class.ilChatServerConfig.php.
References $logfile.
{
$this->logfile = $logfile;
}
| ilChatServerConfig::setLogLevel | ( | $ | loglevel | ) |
Definition at line 135 of file class.ilChatServerConfig.php.
References $loglevel.
{
$this->loglevel = $loglevel;
}
| ilChatServerConfig::setModeratorPassword | ( | $ | a_passwd | ) |
Definition at line 119 of file class.ilChatServerConfig.php.
{
$this->moderator = $a_passwd;
}
| ilChatServerConfig::setPort | ( | $ | port | ) |
Definition at line 95 of file class.ilChatServerConfig.php.
References $port.
{
$this->port = $port;
}
| ilChatServerConfig::setSSLPort | ( | $ | ssl_port | ) |
Definition at line 111 of file class.ilChatServerConfig.php.
References $ssl_port.
{
$this->ssl_port = $ssl_port;
}
| ilChatServerConfig::setSSLStatus | ( | $ | ssl_status = 0 |
) |
Definition at line 103 of file class.ilChatServerConfig.php.
References $ssl_status.
{
$this->ssl_status = $ssl_status;
}
| ilChatServerConfig::update | ( | ) |
Definition at line 225 of file class.ilChatServerConfig.php.
References __writeConfigFile(), getAllowedHosts(), getExternalIp(), getInternalIp(), getLogfile(), getLogLevel(), getModeratorPassword(), getPort(), getSSLPort(), and getSSLStatus().
{
$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 239 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 169 of file class.ilChatServerConfig.php.
References __parseAllowedHosts(), getAllowedHosts(), getExternalIp(), getInternalIp(), getModeratorPassword(), getPort(), getSSLPort(), and getSSLStatus().
{
$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())
{
$this->__parseAllowedHosts();
}
return $this->error_message ? false : true;
}
Here is the call graph for this function:| ilChatServerConfig::$active |
Definition at line 46 of file class.ilChatServerConfig.php.
| ilChatServerConfig::$error_message |
Definition at line 49 of file class.ilChatServerConfig.php.
| 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 setAllowedHosts().
| ilChatServerConfig::$ilias |
Definition at line 34 of file class.ilChatServerConfig.php.
Referenced by _isActive(), and ilChatServerConfig().
| ilChatServerConfig::$internal_ip |
Definition at line 37 of file class.ilChatServerConfig.php.
| ilChatServerConfig::$lng |
Definition at line 35 of file class.ilChatServerConfig.php.
Referenced by ilChatServerConfig().
| ilChatServerConfig::$logfile |
Definition at line 43 of file class.ilChatServerConfig.php.
Referenced by setLogfile().
| ilChatServerConfig::$loglevel |
Definition at line 44 of file class.ilChatServerConfig.php.
Referenced by setLogLevel().
| ilChatServerConfig::$moderator |
Definition at line 42 of file class.ilChatServerConfig.php.
| ilChatServerConfig::$nic |
Definition at line 47 of file class.ilChatServerConfig.php.
| ilChatServerConfig::$port |
Definition at line 39 of file class.ilChatServerConfig.php.
Referenced by setPort().
| ilChatServerConfig::$ssl_port |
Definition at line 41 of file class.ilChatServerConfig.php.
Referenced by setSSLPort().
| ilChatServerConfig::$ssl_status |
Definition at line 40 of file class.ilChatServerConfig.php.
Referenced by setSSLStatus().
1.7.1