24 require_once
"./classes/class.ilObjectGUI.php";
46 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
51 # parent::editObject();
53 $this->lng->loadLanguageModule(
"mail");
55 $this->tpl->addBlockFile(
"SYSTEMSETTINGS",
"systemsettings",
"tpl.mail_basicdata.html",
"Services/Mail");
56 $this->tpl->setCurrentBlock(
"systemsettings");
58 $settings = $this->ilias->getAllSettings();
60 if (isset($_POST[
"save_settings"]))
70 $settings[
"mail_server"] = $_POST[
"mail_server"];
71 $settings[
"mail_port"] = $_POST[
"mail_port"];
74 # $settings["mail_intern_enable"] = $_POST["mail_intern_enable"];
75 $settings[
"mail_maxsize_mail"] = $_POST[
"mail_maxsize_mail"];
76 $settings[
"mail_maxsize_attach"] = $_POST[
"mail_maxsize_attach"];
77 $settings[
"mail_maxsize_box"] = $_POST[
"mail_maxsize_box"];
78 $settings[
"mail_maxtime_mail"] = $_POST[
"mail_maxtime_mail"];
79 $settings[
"mail_maxtime_attach"] = $_POST[
"mail_maxtime_attach"];
80 $settings[
'mail_external_sender_noreply'] =
ilUtil::stripSlashes($_POST[
'mail_external_sender_noreply']);
89 $this->ilias->setSetting(
"mail_server",$_POST[
"mail_server"]);
90 $this->ilias->setSetting(
"mail_port",$_POST[
"mail_port"]);
93 $this->ilias->setSetting(
"mail_incoming_mail",$_POST[
"mail_incoming_mail"]);
95 # $this->ilias->setSetting("mail_intern_enable",$_POST["mail_intern_enable"]);
96 $this->ilias->setSetting(
"mail_maxsize_mail",$_POST[
"mail_maxsize_mail"]);
97 $this->ilias->setSetting(
"mail_maxsize_attach",$_POST[
"mail_maxsize_attach"]);
98 $this->ilias->setSetting(
"mail_maxsize_box",$_POST[
"mail_maxsize_box"]);
99 $this->ilias->setSetting(
"mail_maxtime_mail",$_POST[
"mail_maxtime_mail"]);
100 $this->ilias->setSetting(
"mail_maxtime_attach",$_POST[
"mail_maxtime_attach"]);
101 $this->ilias->setSetting(
"pear_mail_enable",$_POST[
"pear_mail_enable"]);
102 $this->ilias->setSetting(
'mail_external_sender_noreply',
ilUtil::stripSlashes($_POST[
'mail_external_sender_noreply']));
104 $settings = $this->ilias->getAllSettings();
115 $this->tpl->setVariable(
"TXT_DAYS",$this->lng->txt(
"days"));
116 $this->tpl->setVariable(
"TXT_KB",$this->lng->txt(
"kb"));
119 $this->tpl->setVariable(
"TXT_MAIL_SMTP", $this->lng->txt(
"mail").
" (".$this->lng->txt(
"smtp").
")");
120 $this->tpl->setVariable(
"TXT_MAIL_SERVER", $this->lng->txt(
"server"));
121 $this->tpl->setVariable(
"TXT_MAIL_PORT", $this->lng->txt(
"port"));
127 $is_pear_mail_installed = @include_once
'Mail/RFC822.php';
128 $this->tpl->setVariable(
"TXT_PEAR_MAIL", $this->lng->txt(
"mail_use_pear_mail"));
129 if ($settings[
'pear_mail_enable'] && $is_pear_mail_installed)
131 $this->tpl->setVariable(
"PEAR_MAIL_CHECKED",
'checked="checked"');
133 if ($is_pear_mail_installed)
135 $this->tpl->setVariable(
"TXT_PEAR_MAIL_INFO",
136 $this->lng->txt(
"mail_use_pear_mail_info")
141 $this->tpl->setVariable(
"TXT_PEAR_MAIL_INFO",
142 $this->lng->txt(
"mail_use_pear_mail_info").
'<br>'.
143 $this->lng->txt(
"mail_pear_mail_needed")
145 $this->tpl->setVariable(
"PEAR_MAIL_DISABLED",
'disabled="disabled"');
149 include_once
"Services/Mail/classes/class.ilMailOptions.php";
150 $this->tpl->setVariable(
"TXT_GENERAL_SETTINGS", $this->lng->txt(
"general_settings"));
151 $this->tpl->setVariable(
"TXT_MAIL_INCOMING", $this->lng->txt(
"mail_incoming"));
154 "name" => $this->lng->txt(
"mail_incoming_local"),
158 "name" => $this->lng->txt(
"mail_incoming_smtp"),
162 "name" => $this->lng->txt(
"mail_incoming_both"),
166 for ($i = 0; $i < count($types); $i++)
168 $this->tpl->setCurrentBlock(
"loop_incoming_mail");
169 $this->tpl->setVariable(
"LOOP_INCOMING_MAIL_VALUE", $types[$i][
"value"]);
170 $this->tpl->setVariable(
"LOOP_INCOMING_MAIL_NAME", $types[$i][
"name"]);
171 if ($settings[
"mail_incoming_mail"] == $types[$i][
"value"])
173 $this->tpl->setVariable(
"LOOP_INCOMING_MAIL_SELECTED",
"selected");
175 $this->tpl->parseCurrentBlock(
"loop_incoming_mail");
178 # $this->tpl->setVariable("TXT_MAIL_INTERN", $this->lng->txt("mail")." (".$this->lng->txt("internal_system").")");
179 $this->tpl->setVariable(
"TXT_MAIL_INTERN", $this->lng->txt(
"internal_system"));
180 # $this->tpl->setVariable("TXT_MAIL_INTERN_ENABLE", $this->lng->txt("mail_intern_enable"));
181 $this->tpl->setVariable(
"TXT_MAIL_MAXSIZE_MAIL", $this->lng->txt(
"mail_maxsize_mail"));
182 $this->tpl->setVariable(
"TXT_MAIL_MAXSIZE_ATTACH", $this->lng->txt(
"mail_maxsize_attach"));
183 $this->tpl->setVariable(
"TXT_MAIL_MAXSIZE_BOX", $this->lng->txt(
"mail_maxsize_box"));
184 $this->tpl->setVariable(
"TXT_MAIL_MAXTIME_MAIL", $this->lng->txt(
"mail_maxtime_mail"));
185 $this->tpl->setVariable(
"TXT_MAIL_MAXTIME_ATTACH", $this->lng->txt(
"mail_maxtime_attach"));
186 $this->tpl->setVariable(
"TXT_SAVE", $this->lng->txt(
"save"));
192 $this->tpl->setVariable(
"MAIL_SERVER",$settings[
"mail_server"]);
193 $this->tpl->setVariable(
"MAIL_PORT",$settings[
"mail_port"]);
196 # if ($settings["mail_intern_enable"] == "y")
198 # $this->tpl->setVariable("MAIL_INTERN_ENABLE","checked=\"checked\"");
201 $this->tpl->setVariable(
"MAIL_MAXSIZE_MAIL", $settings[
"mail_maxsize_mail"]);
202 $this->tpl->setVariable(
"MAIL_MAXSIZE_ATTACH", $settings[
"mail_maxsize_attach"]);
203 $this->tpl->setVariable(
"MAIL_MAXSIZE_BOX", $settings[
"mail_maxsize_box"]);
204 $this->tpl->setVariable(
"MAIL_MAXTIME_MAIL", $settings[
"mail_maxtime_mail"]);
205 $this->tpl->setVariable(
"MAIL_MAXTIME_ATTACH", $settings[
"mail_maxtime_attach"]);
208 $this->tpl->setVariable(
'TXT_MAIL_EXTERNAL_SENDER_NOREPLY', $this->lng->txt(
'mail_external_sender_noreply'));
209 $this->tpl->setVariable(
'MAIL_EXTERNAL_SENDER_NOREPLY', $settings[
'mail_external_sender_noreply']);
210 $this->tpl->setVariable(
'INFO_MAIL_EXTERNAL_SENDER_NOREPLY', $this->lng->txt(
'info_mail_external_sender_noreply'));
212 $this->tpl->parseCurrentBlock();
217 global $rbacsystem,
$lng;
219 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
221 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
223 #$this->getTemplateFile("import");
224 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_import.html",
"Services/Mail");
228 if($this->file_obj->findXMLFile())
230 $this->tpl->setVariable(
"TXT_IMPORTED_FILE",$lng->txt(
"checked_files"));
231 $this->tpl->setVariable(
"XML_FILE",basename($this->file_obj->getXMLFile()));
233 $this->tpl->setVariable(
"BTN_IMPORT",$this->lng->txt(
"import"));
236 $this->tpl->setVariable(
"FORMACTION",
237 $this->ctrl->getFormAction($this));
238 $this->tpl->setVariable(
"TXT_IMPORT_MAIL",$this->lng->txt(
"table_mail_import"));
239 $this->tpl->setVariable(
"TXT_IMPORT_FILE",$this->lng->txt(
"mail_import_file"));
240 $this->tpl->setVariable(
"BTN_CANCEL",$this->lng->txt(
"cancel"));
241 $this->tpl->setVariable(
"BTN_UPLOAD",$this->lng->txt(
"upload"));
248 global $rbacsystem,
$lng;
250 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
252 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
255 $this->file_obj->findXMLFile();
257 $this->parser_obj->startParsing();
258 $number = $this->parser_obj->getCountImported();
261 $this->ctrl->redirect($this,
"import");
268 global $rbacsystem,
$lng;
270 if (!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
272 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->WARNING);
276 if(!$this->file_obj->storeUploadedFile($_FILES[
"importFile"]))
278 $this->message = $lng->txt(
"import_file_not_valid");
279 $this->file_obj->unlinkLast();
281 else if(!$this->file_obj->unzip())
283 $this->message = $lng->txt(
"cannot_unzip_file");
284 $this->file_obj->unlinkLast();
286 else if(!$this->file_obj->findXMLFile())
288 $this->message = $lng->txt(
"cannot_find_xml");
289 $this->file_obj->unlinkLast();
293 $this->message = $lng->txt(
"error_parser");
295 else if(!$this->parser_obj->startParsing())
297 $this->message = $lng->txt(
"users_not_imported").
":<br/>";
298 $this->message .= $this->parser_obj->getNotAssignableUsers();
303 $this->message = $lng->txt(
"uploaded_and_checked");
307 $this->ctrl->redirect($this,
"import");
313 include_once
"./classes/class.ilFileDataImportMail.php";
321 include_once
"Services/Mail/classes/class.ilMailImportParser.php";
335 $next_class = $this->ctrl->getNextClass($this);
336 $cmd = $this->ctrl->getCmd();
341 case 'ilpermissiongui':
342 include_once(
"./classes/class.ilPermissionGUI.php");
344 $ret =& $this->ctrl->forwardCommand($perm_gui);
374 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
376 $tabs_gui->addTarget(
"settings",
377 $this->ctrl->getLinkTarget($this,
"view"), array(
"view",
""),
"",
"");
380 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
382 $tabs_gui->addTarget(
"perm_settings",
383 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
386 if ($rbacsystem->checkAccess(
'write',$this->object->getRefId()))
388 $tabs_gui->addTarget(
"import",
389 $this->ctrl->getLinkTarget($this,
"import"),
"import",
"",
"");