Public Member Functions | |
ilChatServerConfig () | |
Constructor public. | |
_isActive () | |
setInternalIp ($ip) | |
getInternalIp () | |
setExternalIp ($ip) | |
getExternalIp () | |
setPort ($port) | |
getPort () | |
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 | |
$moderator | |
$logfile | |
$loglevel | |
$hosts | |
$active | |
$nic | |
$error_message |
Definition at line 33 of file class.ilChatServerConfig.php.
ilChatServerConfig::__parseAllowedHosts | ( | ) |
Definition at line 241 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; }
ilChatServerConfig::__writeConfigFile | ( | ) |
Definition at line 257 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 .= "ModeratorPassword = ".$this->getModeratorPassword()."\n"; $content .= "HeaderFileName = ".ILIAS_ABSOLUTE_PATH."/chat/templates/default/header.html\n"; $content .= "FooterFileName = ".ILIAS_ABSOLUTE_PATH."/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; }
ilChatServerConfig::_isActive | ( | ) |
Definition at line 69 of file class.ilChatServerConfig.php.
References $ilias.
Referenced by ilPersonalDesktopGUI::displayUsersOnline().
{ global $ilias; return (bool) $ilias->getSetting("chat_active"); }
ilChatServerConfig::getActiveStatus | ( | ) |
Definition at line 143 of file class.ilChatServerConfig.php.
Referenced by updateStatus().
{
return $this->active;
}
ilChatServerConfig::getAllowedHosts | ( | ) |
Definition at line 130 of file class.ilChatServerConfig.php.
Referenced by __parseAllowedHosts(), update(), and validate().
{
return $this->hosts;
}
ilChatServerConfig::getErrorMessage | ( | ) |
Definition at line 135 of file class.ilChatServerConfig.php.
{
return $this->error_message;
}
ilChatServerConfig::getExternalIp | ( | ) |
Definition at line 90 of file class.ilChatServerConfig.php.
Referenced by update(), and validate().
{
return $this->external_ip ? $this->external_ip : $this->internal_ip;
}
ilChatServerConfig::getInternalIp | ( | ) |
Definition at line 82 of file class.ilChatServerConfig.php.
Referenced by isAlive(), update(), and validate().
{
return $this->internal_ip;
}
ilChatServerConfig::getLogfile | ( | ) |
Definition at line 114 of file class.ilChatServerConfig.php.
Referenced by __writeConfigFile(), and update().
{
return $this->logfile;
}
ilChatServerConfig::getLogLevel | ( | ) |
Definition at line 122 of file class.ilChatServerConfig.php.
Referenced by update().
{
return $this->loglevel;
}
ilChatServerConfig::getModeratorPassword | ( | ) |
Definition at line 106 of file class.ilChatServerConfig.php.
Referenced by update(), and validate().
{
return $this->moderator;
}
ilChatServerConfig::getNic | ( | ) |
Definition at line 147 of file class.ilChatServerConfig.php.
{
return substr($this->nic,0,6);
}
ilChatServerConfig::getPort | ( | ) |
Definition at line 98 of file class.ilChatServerConfig.php.
Referenced by isAlive(), update(), and validate().
{
return $this->port;
}
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 57 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(); }
ilChatServerConfig::isAlive | ( | ) |
Definition at line 226 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; }
ilChatServerConfig::read | ( | ) |
Definition at line 213 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->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"); }
ilChatServerConfig::setActiveStatus | ( | $ | status | ) |
Definition at line 139 of file class.ilChatServerConfig.php.
{ $this->active = $status; }
ilChatServerConfig::setAllowedHosts | ( | $ | hosts | ) |
Definition at line 126 of file class.ilChatServerConfig.php.
References $hosts.
Referenced by __parseAllowedHosts().
{ $this->hosts = $hosts; }
ilChatServerConfig::setExternalIp | ( | $ | ip | ) |
Definition at line 86 of file class.ilChatServerConfig.php.
{ $this->external_ip = $ip; }
ilChatServerConfig::setInternalIp | ( | $ | ip | ) |
Definition at line 78 of file class.ilChatServerConfig.php.
{ $this->internal_ip = $ip; }
ilChatServerConfig::setLogfile | ( | $ | logfile | ) |
Definition at line 110 of file class.ilChatServerConfig.php.
References $logfile.
{ $this->logfile = $logfile; }
ilChatServerConfig::setLogLevel | ( | $ | loglevel | ) |
Definition at line 118 of file class.ilChatServerConfig.php.
References $loglevel.
{ $this->loglevel = $loglevel; }
ilChatServerConfig::setModeratorPassword | ( | $ | a_passwd | ) |
Definition at line 102 of file class.ilChatServerConfig.php.
{ $this->moderator = $a_passwd; }
ilChatServerConfig::setPort | ( | $ | port | ) |
Definition at line 94 of file class.ilChatServerConfig.php.
References $port.
{ $this->port = $port; }
ilChatServerConfig::update | ( | ) |
Definition at line 196 of file class.ilChatServerConfig.php.
References __writeConfigFile(), getAllowedHosts(), getExternalIp(), getInternalIp(), getLogfile(), getLogLevel(), getModeratorPassword(), and getPort().
{ $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_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(); }
ilChatServerConfig::updateStatus | ( | ) |
Definition at line 208 of file class.ilChatServerConfig.php.
References getActiveStatus().
{ $this->ilias->setSetting("chat_active",$this->getActiveStatus()); }
ilChatServerConfig::validate | ( | ) |
Definition at line 152 of file class.ilChatServerConfig.php.
References __parseAllowedHosts(), getAllowedHosts(), getExternalIp(), getInternalIp(), getModeratorPassword(), and getPort().
{ $this->error_message = ""; if(!$this->getInternalIp()) { $this->error_message .= $this->lng->txt("chat_add_internal_ip"); } if(!$this->getExternalIp()) { $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->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; }
ilChatServerConfig::$active |
Definition at line 45 of file class.ilChatServerConfig.php.
ilChatServerConfig::$error_message |
Definition at line 48 of file class.ilChatServerConfig.php.
ilChatServerConfig::$external_ip |
Definition at line 39 of file class.ilChatServerConfig.php.
ilChatServerConfig::$hosts |
Definition at line 44 of file class.ilChatServerConfig.php.
Referenced by setAllowedHosts().
ilChatServerConfig::$ilias |
Definition at line 35 of file class.ilChatServerConfig.php.
Referenced by _isActive(), and ilChatServerConfig().
ilChatServerConfig::$internal_ip |
Definition at line 38 of file class.ilChatServerConfig.php.
ilChatServerConfig::$lng |
Definition at line 36 of file class.ilChatServerConfig.php.
Referenced by ilChatServerConfig().
ilChatServerConfig::$logfile |
Definition at line 42 of file class.ilChatServerConfig.php.
Referenced by setLogfile().
ilChatServerConfig::$loglevel |
Definition at line 43 of file class.ilChatServerConfig.php.
Referenced by setLogLevel().
ilChatServerConfig::$moderator |
Definition at line 41 of file class.ilChatServerConfig.php.
ilChatServerConfig::$nic |
Definition at line 46 of file class.ilChatServerConfig.php.
ilChatServerConfig::$port |
Definition at line 40 of file class.ilChatServerConfig.php.
Referenced by setPort().