4require_once 
'Modules/Chatroom/classes/class.ilChatroom.php';
 
   32                $this->commonSettings = 
new ilSetting(
'common');
 
   38        private function showSoapWarningIfNeeded()
 
   45                if(!$this->commonSettings->get(
'soap_user_administration'))
 
   54        public function saveSettings()
 
   62                require_once 
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
 
   64                $form    = $factory->getGeneralSettingsForm();
 
   66                if(!$form->checkInput())
 
   68                        $form->setValuesByPost();
 
   69                        $this->serversettings($form);
 
   75                        $form->setValuesByPost();
 
   77                        $this->serversettings($form);
 
   82                        'protocol'   => $form->getInput(
'protocol'),
 
   83                        'instance'   => $form->getInput(
'instance'),
 
   84                        'port'       => $form->getInput(
'port'),
 
   85                        'address'    => $form->getInput(
'address'),
 
   86                        'priv_hosts' => $form->getInput(
'priv_hosts'),
 
   87                        'keystore'   => $form->getInput(
'keystore'),
 
   88                        'keypass'    => $form->getInput(
'keypass'),
 
   89                        'storepass'  => $form->getInput(
'storepass')
 
   92                require_once 
'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
 
   94                $adminSettings->saveGeneralSettings((
object)$settings);
 
   99                $ilCtrl->redirect($this->gui, 
'view-serversettings');
 
  105        public function saveClientSettings()
 
  113                require_once 
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
 
  115                $form    = $factory->getClientSettingsForm();
 
  117                if(!$form->checkInput())
 
  119                        $form->setValuesByPost();
 
  120                        $this->clientsettings($form);
 
  125                        'hash'                  => $form->getInput(
'name'),
 
  126                        'name'                  => $form->getInput(
'name'),
 
  127                        'url'                   => $form->getInput(
'url'),
 
  128                        'user'                  => $form->getInput(
'user'),
 
  129                        'password'              => $form->getInput(
'password'),
 
  130                        'client'                => CLIENT_ID,
 
  131                        'enable_osd'            => (
boolean)$form->getInput(
'enable_osd'),
 
  132                        'osd_intervall'         => (
int)$form->getInput(
'osd_intervall'),
 
  133                        'chat_enabled'          => ((
boolean)$form->getInput(
'chat_enabled')) && ((
boolean)$this->commonSettings->get(
'soap_user_administration')),
 
  134                        'enable_smilies'        => (
boolean)$form->getInput(
'enable_smilies'),
 
  135                        'play_invitation_sound' => (
boolean)$form->getInput(
'play_invitation_sound')
 
  138                $notificationSettings = 
new ilSetting(
'notifications');
 
  139                $notificationSettings->set(
'osd_polling_intervall', (
int)$form->getInput(
'osd_intervall'));
 
  140                $notificationSettings->set(
'enable_osd', (
boolean)$form->getInput(
'enable_osd'));
 
  142                $chatSettings = 
new ilSetting(
'chatroom');
 
  143                $chatSettings->set(
'chat_enabled', $settings[
'chat_enabled']);
 
  144                $chatSettings->set(
'play_invitation_sound', (
boolean)$form->getInput(
'play_invitation_sound'));
 
  146                require_once 
'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
 
  148                $adminSettings->saveClientSettings((
object)$settings);
 
  154                $ilCtrl->redirect($this->gui, 
'view-clientsettings');
 
  166                        $handle = fopen($srv_prp_path . 
'client.properties', 
'w');
 
  170                                throw new Exception(
'Cannot write to file');
 
  186                $content = 
'hash = ' . $settings[
'hash'] . $linebreak;
 
  187                $content .= 
'name = ' . $settings[
'name'] . $linebreak;
 
  188                $content .= 
'url = ' . $settings[
'url'] . $linebreak;
 
  189                $content .= 
'user = ' . $settings[
'user'] . $linebreak;
 
  190                $content .= 
'password = ' . $settings[
'password'] . $linebreak;
 
  191                $content .= 
'client = ' . $settings[
'client'];
 
  205                        $handle = fopen($srv_prp_path . 
'server.properties', 
'w');
 
  209                                throw new Exception(
'Cannot write to file');
 
  225                $content = 
'host = ' . $settings[
'address'] . $linebreak;
 
  226                $content .= 
'port = ' . $settings[
'port'] . $linebreak;
 
  227                $content .= 
'privileged_hosts = ' . $settings[
'priv_hosts'] . $linebreak;
 
  229                $settings[
'protocol'] == 
'https' ? 
$https = 1 : 
$https = 0;
 
  231                $content .= 
'https = ' . 
$https . $linebreak;
 
  232                $content .= 
'keystore = ' . $settings[
'keystore'] . $linebreak;
 
  233                $content .= 
'keypass = ' . $settings[
'keypass'] . $linebreak;
 
  234                $content .= 
'storepass = ' . $settings[
'storepass'];
 
  248                if(!file_exists($srv_prp_path))
 
  252                                throw new Exception(
'Directory cannot be created');
 
  256                return $srv_prp_path;
 
  268                $ipnumbers = preg_replace(
"/[^0-9.,]+/", 
"", $ipnumbers);
 
  269                $ips       = explode(
',', $ipnumbers);
 
  273                        $ip_parts = explode(
'.', $ip);
 
  275                        if(!($ip_parts[0] <= 255 && $ip_parts[1] <= 255 && $ip_parts[2] <= 255 && $ip_parts[3] <= 255 &&
 
  276                                preg_match(
"!^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$!", $ip))
 
  300                include_once 
'Modules/Chatroom/classes/class.ilChatroom.php';
 
  305                $this->gui->switchToVisibleMode();
 
  306                $this->showSoapWarningIfNeeded();
 
  308                require_once 
'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
 
  313                        require_once 
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
 
  315                        $form    = $factory->getGeneralSettingsForm();
 
  325                require_once 
'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
 
  332                $form->setTitle(
$lng->txt(
'chatserver_settings_title'));
 
  333                $form->addCommandButton(
'view-saveSettings', 
$lng->txt(
'save'));
 
  334                $form->setFormAction(
$ilCtrl->getFormAction($this->gui, 
'view-saveSettings'));
 
  335                $serverTpl = 
new ilTemplate(
'tpl.chatroom_serversettings.html', 
true, 
true, 
'Modules/Chatroom');
 
  337                $serverTpl->setVariable(
'VAL_SERVERSETTINGS_FORM', $form->getHTML());
 
  338                $serverTpl->setVariable(
'LBL_SERVERSETTINGS_FURTHER_INFORMATION', sprintf(
$lng->txt(
'server_further_information'), 
ilUtil::_getHttpPath() . 
'/Modules/Chatroom/server/README.txt'));
 
  340                $tpl->setVariable(
'ADM_CONTENT', $serverTpl->get());
 
  354                $ilCtrl->redirect($this->gui, 
'view-clientsettings');
 
  373                $this->gui->switchToVisibleMode();
 
  375                $this->showSoapWarningIfNeeded();
 
  377                require_once 
'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
 
  382                        require_once 
'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
 
  384                        $form    = $factory->getClientSettingsForm();
 
  386                        if(!$this->commonSettings->get(
'soap_user_administration'))
 
  388                                $form->getItemByPostVar(
'chat_enabled')->setDisabled(!(
boolean)$this->commonSettings->get(
'soap_user_administration'));
 
  389                                $form->getItemByPostVar(
'chat_enabled')->setChecked(0);
 
  392                        $data = (array)$adminSettings->loadClientSettings();
 
  394                        if(!
$data[
'osd_intervall'])
 
  396                                $data[
'osd_intervall'] = 60;
 
  411                                $data[
'client'] = CLIENT_ID;
 
  415                        $form->setValuesByArray(
$data);
 
  418                require_once 
'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
 
  426                $form->setTitle(
$lng->txt(
'general_settings_title'));
 
  427                $form->addCommandButton(
'view-saveClientSettings', 
$lng->txt(
'save'));
 
  428                $form->setFormAction(
$ilCtrl->getFormAction($this->gui, 
'view-saveClientSettings'));
 
  430                $settingsTpl = 
new ilTemplate(
'tpl.chatroom_serversettings.html', 
true, 
true, 
'Modules/Chatroom');
 
  432                $settingsTpl->setVariable(
'VAL_SERVERSETTINGS_FORM', $form->getHTML());
 
  433                $settingsTpl->setVariable(
'LBL_SERVERSETTINGS_FURTHER_INFORMATION', sprintf(
$lng->txt(
'server_further_information'), 
ilUtil::_getHttpPath() . 
'/Modules/Chatroom/server/README.txt'));
 
  435                $tpl->setVariable(
'ADM_CONTENT', $settingsTpl->get());
 
  443                $chatSettings = 
new ilSetting(
'chatroom');
 
  444                if($chatSettings->get(
'chat_enabled', 
false))
 
  458                        $this->createPublicRoom();
 
  465                        $this->createPublicRoom();
 
  472                        $this->createPublicRoom();
 
  478                        $this->createPublicRoom();
 
  482                require_once 
'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
 
  483                ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation(
$ref_id);
 
  489        public function createPublicRoom()
 
  496                require_once 
'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
 
  497                ilChatroomInstaller::createDefaultPublicRoom(
true);
 
static checkServerConnection()
executeDefault($requestedMethod)
Class ilChatroomViewTask.
writeClientSettingsToFile(array $settings)
Writes client settings to client.properties file.
getFileContent(array $settings)
Builds and formats content tot write in server.properties file.
getClientFileContent(array $settings)
Formats content for client settings file.
checkPrivHosts($ipnumbers)
Checks if a valid IP number or a comma-separated string of valid IP numbers is given.
checkDirectory()
Checks if external chatroom directory exists or can be created.
writeDataToFile(array $settings)
Writes server settings to server.properties file.
__construct(ilChatroomObjectGUI $gui)
Constructor Sets $this->gui using given $gui.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId($a_id)
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
special template class to simplify handling of ITX/PEAR
static getDataDir()
get data directory (outside webspace)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...