$filename = rawurlencode($_GET['picture']); if ( $disc_manager->existsFile($_GET['picture']) ) { header('Content-type: image'); header('Pragma: no-cache'); header('Expires: 0'); readfile($disc_manager->getFilePath().$filename); exit; } } // portfolio context if ( !empty($_GET["picture"]) ) { $environment->changeContextToPrivateRoom(); $disc_manager = $environment->getDiscManager(); $filename = withUmlaut($_GET["picture"]) ? rawurlencode($_GET["picture"]) : $_GET["picture"]; if ( $disc_manager->existsFile($_GET['picture']) ) { header('Content-type: image'); header('Pragma: no-cache'); header('Expires: 0'); readfile($disc_manager->getFilePath().$filename); exit; } } exit(); ?>
public function save($form_data, $additional = array()) { $current_context = $this->_environment->getCurrentContextItem(); $current_portal_item = $this->_environment->getCurrentPortalItem(); // check context if (false) { } else { if (false) { } else { $tab = $additional['part']; switch ($tab) { /**** ACCOUNT ****/ case 'account_merge': if ($this->_popup_controller->checkFormData('merge')) { $authentication = $this->_environment->getAuthenticationObject(); global $c_annonymous_account_array; $currentUser = $this->_environment->getCurrentUserItem(); if (!empty($c_annonymous_account_array[mb_strtolower($currentUser->getUserID(), 'UTF-8') . '_' . $currentUser->getAuthSource()]) && $currentUser->isOnlyReadUser()) { $this->_popup_controller->setErrorReturn("1014", "anonymous account"); exit; } else { if ($currentUser->getUserID() == $form_data['merge_user_id'] && (empty($form_data['auth_source']) || $currentUser->getAuthSource() == $form_data['auth_source'])) { $this->_popup_controller->setErrorReturn("1015", "invalid account"); } else { $user_manager = $this->_environment->getUserManager(); $user_manager->setUserIDLimitBinary($form_data['merge_user_id']); $user_manager->select(); $user = $user_manager->get(); $first_user = $user->getFirst(); $current_user = $this->_environment->getCurrentUserItem(); if (!empty($first_user)) { if (empty($form_data['auth_source'])) { $authManager = $authentication->getAuthManager($current_user->getAuthSource()); } else { $authManager = $authentication->getAuthManager($form_data['auth_source']); } if (!$authManager->checkAccount($form_data['merge_user_id'], $form_data['merge_user_password'])) { $this->_popup_controller->setErrorReturn("1016", "authentication error"); exit; } } else { $this->_popup_controller->setErrorReturn("1015", "invalid account"); exit; } } } $currentUser = $this->_environment->getCurrentUserItem(); if (isset($form_data['auth_source'])) { $authSourceOld = $form_data['auth_source']; } else { $authSourceOld = $this->_environment->getCurrentPortalItem()->getAuthDefault(); } ini_set('display_errors', 'on'); error_reporting(E_ALL); $authentication->mergeAccount($currentUser->getUserID(), $currentUser->getAuthSource(), $form_data['merge_user_id'], $authSourceOld); // set return $this->_popup_controller->setSuccessfullItemIDReturn($currentUser->getItemID()); } break; case "account_lock_room": $current_user = $this->_environment->getCurrentUserItem(); $current_user->reject(); $current_user->save(); // set return $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID()); break; case "account_delete_room": $current_user = $this->_environment->getCurrentUserItem(); $current_user->delete(); // remove link from group room if ($current_context->isGroupRoom()) { $group_item = $current_context->getLinkedGroupItem(); $group_item->removeMember($current_user->getRelatedUserItemInContext($group_item->getContextID())); } // set return $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID()); break; case "account_lock_portal": $current_user = $this->_environment->getCurrentUserItem(); $portalUser_item = $current_user->getRelatedCommSyUserItem(); $portalUser_item->reject(); $portalUser_item->save(); // delete session $session_manager = $this->_environment->getSessionManager(); $session = $this->_environment->getSessionItem(); $session_manager->delete($session->getSessionID()); $this->_environment->setSessionItem(null); // return $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID()); break; case "account_delete_portal": $current_user = $this->_environment->getCurrentUserItem(); $portalUser_item = $current_user->getRelatedCommSyUserItem(); $authentication = $this->_environment->getAuthenticationObject(); $authentication->delete($portalUser_item->getItemID()); // delete session $session_manager = $this->_environment->getSessionManager(); $session = $this->_environment->getSessionItem(); $session_manager->delete($session->getSessionID()); $this->_environment->setSessionItem(null); // return $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID()); break; case 'account': if ($this->_popup_controller->checkFormData('account')) { $authentication = $this->_environment->getAuthenticationObject(); $currentUser = $this->_environment->getCurrentUserItem(); // get portal user if in room context if (!$this->_environment->inPortal()) { $portalUser = $this->_environment->getPortalUserItem(); } else { $portalUser = $this->_environment->getCurrentUserItem(); } $translator = $this->_environment->getTranslationObject(); // Datenschutz if ($current_portal_item->getPasswordGeneration() > 0) { if (!$portalUser->isPasswordInGeneration(md5($form_data['new_password']))) { // password if (!empty($form_data['new_password'])) { $auth_manager = $authentication->getAuthManager($currentUser->getAuthSource()); $auth_source = $currentUser->getAuthSource(); $old_password = $auth_manager->getItem($form_data['user_id'])->getPasswordMD5(); if ($old_password == md5($form_data['old_password'])) { $change_pw = true; // if password options are set, check password $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($currentUser->getAuthSource()); $error_array = array(); if ($auth_source_item->getPasswordLength() > 0) { if (strlen($form_data['new_password']) < $auth_source_item->getPasswordLength()) { $error_array[] = $translator->getMessage('PASSWORD_INFO_LENGTH', $auth_source_item->getPasswordLength()); //$this->_popup_controller->setErrorReturn('1022', 'new password too short'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureBigchar() == 1) { if (!preg_match('~[A-Z]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_BIG'); //$this->_popup_controller->setErrorReturn('1023', 'new password no big character'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureSmallchar() == 1) { if (!preg_match('~[a-z]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_SMALL'); //$this->_popup_controller->setErrorReturn('1026', 'new password no small character'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureNumber() == 1) { if (!preg_match('~[0-9]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_NUMBER'); //$this->_popup_controller->setErrorReturn('1027', 'new password no number'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureSpecialchar() == 1) { if (!preg_match('~[^a-zA-Z0-9]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_SPECIAL'); //$this->_popup_controller->setErrorReturn('1024', 'new password no special character'); $change_pw = false; } } unset($auth_source); if ($change_pw) { $portalUser->setPasswordExpireDate($current_portal_item->getPasswordExpiration()); $portalUser->save(); $auth_manager->changePassword($form_data['user_id'], $form_data['new_password']); } else { $this->_popup_controller->setErrorReturn('1022', $error_array); } } else { $error_array[] = $translator->getMessage('PASSWORD_OLD_NOT_EQUAL'); $this->_popup_controller->setErrorReturn('1023', $error_array); #$this->_popup_controller->setErrorReturn('1009', 'password change error'); } $error_number = $auth_manager->getErrorNumber(); if (!empty($error_number)) { // TODO:$error_string .= $translator->getMessage('COMMON_ERROR_DATABASE').$error_number.'<br />'; } else { $portalUser->setNewGenerationPassword($old_password); } } } else { $this->_popup_controller->setErrorReturn('1025', 'password generation error'); } } else { if (!empty($form_data['new_password'])) { $auth_manager = $authentication->getAuthManager($currentUser->getAuthSource()); $old_password = $auth_manager->getItem($form_data['user_id'])->getPasswordMD5(); if ($old_password == md5($form_data['old_password'])) { $change_pw = true; // if password options are set, check password $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($currentUser->getAuthSource()); $error_array = array(); if ($auth_source_item->getPasswordLength() > 0) { if (strlen($form_data['new_password']) < $auth_source_item->getPasswordLength()) { $error_array[] = $translator->getMessage('PASSWORD_INFO_LENGTH', $auth_source_item->getPasswordLength()) . '<br>'; //$this->_popup_controller->setErrorReturn('1022', 'new password too short'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureBigchar() == 1) { if (!preg_match('~[A-Z]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_BIG'); //$this->_popup_controller->setErrorReturn('1023', 'new password no big character'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureSmallchar() == 1) { if (!preg_match('~[a-z]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_SMALL'); //$this->_popup_controller->setErrorReturn('1026', 'new password no small character'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureNumber() == 1) { if (!preg_match('~[0-9]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_NUMBER'); //$this->_popup_controller->setErrorReturn('1027', 'new password no number'); $change_pw = false; } } if ($auth_source_item->getPasswordSecureSpecialchar() == 1) { if (!preg_match('~[^a-zA-Z0-9]+~u', $form_data['new_password'])) { $error_array[] = $translator->getMessage('PASSWORD_INFO_SPECIAL'); //$this->_popup_controller->setErrorReturn('1024', 'new password no special character'); $change_pw = false; } } unset($auth_source); if ($change_pw) { $portalUser->setPasswordExpireDate($current_portal_item->getPasswordExpiration()); $portalUser->save(); $auth_manager->changePassword($form_data['user_id'], $form_data['new_password']); } else { $this->_popup_controller->setErrorReturn('1022', $error_array); } } else { $error_array[] = $translator->getMessage('PASSWORD_OLD_NOT_EQUAL'); $this->_popup_controller->setErrorReturn('1023', $error_array); #$this->_popup_controller->setErrorReturn('1008', 'password change error'); } $error_number = $auth_manager->getErrorNumber(); if (!empty($error_number)) { // TODO:$error_string .= $translator->getMessage('COMMON_ERROR_DATABASE').$error_number.'<br />'; } else { $portalUser->setNewGenerationPassword($old_password); } } } // user id if (!empty($form_data['user_id']) && $form_data['user_id'] != $portalUser->getUserID()) { $check = true; $auth_source = $portalUser->getAuthSource(); if (!empty($auth_source)) { $authentication = $this->_environment->getAuthenticationObject(); if (!$authentication->is_free($form_data['user_id'], $auth_source)) { $this->_popup_controller->setErrorReturn("1011", "user id error(duplicated)", array()); $check = false; } elseif (withUmlaut($form_data['user_id'])) { $this->_popup_controller->setErrorReturn("1012", "user id error(umlaut)", array()); $check = false; } } else { $this->_popup_controller->setErrorReturn("1013", "user id error(auth source error)", array()); $check = false; } if ($check === true) { if ($authentication->changeUserID($form_data['user_id'], $portalUser)) { $session_manager = $this->_environment->getSessionManager(); $session = $this->_environment->getSessionItem(); $session_id_old = $session->getSessionID(); $session_manager->delete($session_id_old, true); $session->createSessionID($form_data['user_id']); $cookie = $session->getValue('cookie'); if ($cookie == 1) { $session->setValue('cookie', 2); } $session_manager->save($session); unset($session_manager); $portalUser->setUserID($form_data['user_id']); $currentUser->setUserID($form_data['user_id']); require_once 'functions/misc_functions.php'; plugin_hook('user_save', $portalUser); } } else { $this->_popup_controller->setErrorReturn("117", "user id error(duplicated, umlaut, etc)", array()); } } else { // $success_1 = true } $save = false; // language if (!empty($form_data['language']) && $form_data['language'] != $portalUser->getLanguage()) { $portalUser->setLanguage($form_data['language']); $save = true; if ($this->_environment->inPrivateRoom()) { $currentUser->setLanguage($form_data['language']); $currentUser->save(); } } if (isset($form_data['mail_account'])) { $currentUser->setAccountWantMail('yes'); $currentUser->save(); #$save = true; } else { $currentUser->setAccountWantMail('no'); $currentUser->save(); #$save = true; } if (isset($form_data['mail_room'])) { $currentUser->setOpenRoomWantMail('yes'); $currentUser->save(); #$save = true; } else { $currentUser->setOpenRoomWantMail('no'); $currentUser->save(); #$save = true; } // mail settings // if(!empty($form_data['mail_account'])) { // if($portalUser->getAccountWantMail() == 'no') { // $portalUser->setAccountWantMail('yes'); // $save = true; // } // } else { // if($portalUser->getAccountWantMail() == 'yes') { // $portalUser->setAccountWantMail('no'); // $save = true; // } // } // if(!empty($form_data['mail_room'])) { // if($portalUser->getOpenRoomWantMail() == 'no') { // $portalUser->setOpenRoomWantMail('yes'); // $save = true; // } // } else { // if($portalUser->getOpenRoomWantMail() == 'yes') { // $portalUser->setOpenRoomWantMail('no'); // $save = true; // } // } /* if(!empty($form_data['mail_delete_entry'])) { if($portalUser->getDeleteEntryWantMail() == 'no') { $portalUser->setDeleteEntryWantMail('yes'); $save = true; } } else { if($portalUser->getDeleteEntryWantMail() == 'yes') { $portalUser->setDeleteEntryWantMail('no'); $save = true; } } */ $change_name = false; $text_converter = $this->_environment->getTextConverter(); $form_data['forname'] = $text_converter->sanitizeHTML($form_data['forname']); $form_data['surname'] = $text_converter->sanitizeHTML($form_data['surname']); // forname if (!empty($form_data['forname']) && $portalUser->getFirstName() != $form_data['forname']) { $portalUser->setFirstName($form_data['forname']); $change_name = true; $save = true; } // surname if (!empty($form_data['surname']) && $portalUser->getLastName() != $form_data['surname']) { $portalUser->setLastName($form_data['surname']); $change_name = true; $save = true; } // auto save if (!empty($form_data['auto_save'])) { if ($form_data['auto_save'] == 'on') { $portalUser->turnAutoSaveOn(); } else { $portalUser->turnAutoSaveOff(); } $save = true; } else { $portalUser->turnAutoSaveOff(); $save = true; } global $c_email_upload; if ($c_email_upload && !$portalUser->isRoot()) { $own_room = $currentUser->getOwnRoom(); if (isset($form_data['email_to_commsy']) and !empty($form_data['email_to_commsy'])) { $own_room->setEmailToCommSy(); } else { $own_room->unsetEmailToCommSy(); } if (isset($form_data['email_to_commsy_secret']) and !empty($form_data['email_to_commsy_secret'])) { $own_room->setEmailToCommSySecret($form_data['email_to_commsy_secret']); } else { $own_room->setEmailToCommSySecret(''); } $own_room->save(); $save = true; } if ($save === true) { $portalUser->save(); } // change firstname and lastname in all other user_items of this user if ($change_name === true) { $user_manager = $this->_environment->getUserManager(); $dummy_user = $user_manager->getNewItem(); // forname $value = $form_data['forname']; if (empty($value)) { $value = -1; } $dummy_user->setFirstName($value); // surname $value = $form_data['surname']; if (empty($value)) { $value = -1; } $dummy_user->setLastName($value); $portalUser->changeRelatedUser($dummy_user); } // set return $this->_popup_controller->setSuccessfullItemIDReturn($portalUser->getItemID()); } break; /**** IMPORT ****/ /**** IMPORT ****/ case 'import': if ($this->_popup_controller->checkFormData('upload_import_private_room')) { if (!empty($additional["fileInfo"])) { $temp_stamp = time(); rename($additional["fileInfo"]["file"], 'var/temp/upload_' . $temp_stamp . '.zip'); $zip = new ZipArchive(); $res = $zip->open('var/temp/upload_' . $temp_stamp . '.zip'); if ($res === TRUE) { $zip->extractTo('var/temp/' . $temp_stamp); $zip->close(); $commsy_work_dir = getcwd(); chdir('var/temp/' . $temp_stamp); foreach (glob("commsy_xml_export_import_*.xml") as $filename) { $xml = simplexml_load_file($filename, null, LIBXML_NOCDATA); //el($xml); $dom = new DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($xml->asXML()); //el($dom->saveXML()); $options = array(); chdir($commsy_work_dir); $room_manager = $this->_environment->getRoomManager(); $room_manager->import_item($xml, null, $options); chdir('var/temp/' . $temp_stamp); $files = scandir('.'); foreach ($files as $file) { if (strpos($file, 'files') === 0) { $directory_name_array = explode('_', $file); $directory_old_id = $directory_name_array[1]; $disc_manager = $this->_environment->getDiscManager(); $disc_manager->setPortalID($this->_environment->getCurrentPortalID()); $directory_new_id = $options[$directory_old_id]; if ($directory_new_id != '') { $disc_manager->setContextID($directory_new_id); $new_file_path = $disc_manager->getFilePath(); chdir($file); $files_to_copy = glob('./*'); foreach ($files_to_copy as $file_to_copy) { if (!(strpos($file, 'default_cs_gradient') === 0)) { $file_to_copy = str_ireplace('./', '', $file_to_copy); $file_name_array = explode('.', $file_to_copy); $file_old_id = $file_name_array[0]; $file_new_id = $options[$file_old_id]; if ($file_new_id != '') { $file_to_copy_temp = str_ireplace($file_old_id . '.', $file_new_id . '.', $file_to_copy); $file_to_copy_temp = './' . $file_to_copy_temp; $file_to_go = str_replace('./', $commsy_work_dir . '/' . $new_file_path, $file_to_copy_temp); copy($file_to_copy, $file_to_go); } } } chdir('..'); } } } } chdir($commsy_work_dir); } } } break; /**** USER PICTURE ****/ /**** USER PICTURE ****/ case 'user_picture': if ($this->_popup_controller->checkFormData('user_picture')) { /* handle user picture upload */ if (!empty($additional["fileInfo"])) { $currentUser = $this->_environment->getCurrentUserItem(); $portalUser = $currentUser->getRelatedCommSyUserItem(); $srcfile = $additional["fileInfo"]["file"]; $targetfile = $srcfile . "_converted"; $session = $this->_environment->getSessionItem(); $session->unsetValue("add_files"); // resize image to a maximum width of 150px and keep ratio $size = getimagesize($srcfile); list($x_orig, $y_orig, $type) = $size; $verhaeltnis = $y_orig / $x_orig; $max_width = 150; $ratio = 1.334; // 3:4 if ($verhaeltnis < $ratio) { // wider than 1:$ratio $source_width = $y_orig * $max_width / ($max_width * $ratio); $source_height = $y_orig; $source_x = ($x_orig - $source_width) / 2; $source_y = 0; } else { // higher than 1:$ratio $source_width = $x_orig; $source_height = $x_orig * ($max_width * $ratio) / $max_width; $source_x = 0; $source_y = ($y_orig - $source_height) / 2; } // create image switch ($type) { case '1': $im = imagecreatefromgif($srcfile); break; case '2': $im = imagecreatefromjpeg($srcfile); break; case '3': $im = imagecreatefrompng($srcfile); break; } $newimg = imagecreatetruecolor($max_width, $max_width * $ratio); imagecopyresampled($newimg, $im, 0, 0, $source_x, $source_y, $max_width, ceil($max_width * $ratio), $source_width, $source_height); imagepng($newimg, $targetfile); // clean up imagedestroy($im); imagedestroy($newimg); // determ new file name $filename_info = pathinfo($additional["fileInfo"]["name"]); $filename = 'cid' . $this->_environment->getCurrentContextID() . '_' . $currentUser->getItemID() . '.' . $filename_info['extension']; // copy file and set picture $disc_manager = $this->_environment->getDiscManager(); $disc_manager->copyFile($targetfile, $filename, true); $currentUser->setPicture($filename); $modifier = $this->_environment->getCurrentUserItem(); if (isset($portalUser)) { if ($disc_manager->copyImageFromRoomToRoom($filename, $portalUser->getContextID())) { $value_array = explode('_', $filename); $old_room_id = $value_array[0]; $old_room_id = str_replace('cid', '', $old_room_id); $valu_array[0] = 'cid' . $portalUser->getContextID(); $new_picture_name = implode('_', $value_array); $portalUser->setPicture($new_picture_name); $portalUser->setModificatorItem($modifier); $portalUser->setModificationDate(getCurrentDateTimeInMySQL()); $portalUser->save(); } } // save $currentUser->setModificatorItem($modifier); $currentUser->setModificationDate(getCurrentDateTimeInMySQL()); $currentUser->save(); } // set return $this->_popup_controller->setSuccessfullDataReturn($filename); } break; /**** USER ****/ /**** USER ****/ case 'user': $currentUser = $this->_environment->getCurrentUserItem(); $portalUser = $currentUser->getRelatedCommSyUserItem(); $text_converter = $this->_environment->getTextConverter(); $currentContext = $this->_environment->getCurrentContextItem(); if ($this->_popup_controller->checkFormData('user')) { function setValue($currentUser, $portalUser_item, $method, $value) { if (isset($value)) { // set for user call_user_func_array(array($currentUser, $method), array($value)); if (isset($portalUser_item)) { // set for portal user call_user_func_array(array($portalUser_item, $method), array($value)); } } } setValue($currentUser, $portalUser, 'setTitle', $text_converter->sanitizeHTML($form_data['title'])); setValue($currentUser, $portalUser, 'setBirthday', $text_converter->sanitizeHTML($form_data['birthday'])); $email_old = $portalUser->getEmail(); setValue($currentUser, $portalUser, 'setEmail', $text_converter->sanitizeHTML($form_data['mail'])); if ($portalUser->hasToChangeEmail() and $email_old != $form_data['mail']) { $portalUser->unsetHasToChangeEmail(); $form_data['mail_all'] = 1; } unset($email_old); if ($currentContext->isPortal()) { if ($form_data['mail_hide']) { $portalUser->setDefaultMailNotVisible(); } else { $portalUser->setDefaultMailVisible(); } if ($form_data['mail_hide_all']) { $user_list = $currentUser->getRelatedUserList(); $user_item = $user_list->getFirst(); while ($user_item) { if ($form_data['mail_hide']) { $user_item->setEmailNotVisible(); } else { $user_item->setEmailVisible(); } $user_item->save(); $user_item = $user_list->getNext(); } $currentUser->setDefaultMailNotVisible(); $currentUser->save(); } } else { if ($form_data['mail_hide']) { $currentUser->setEmailNotVisible(); } else { $currentUser->setEmailVisible(); } if ($form_data['mail_hide_all']) { $user_list = $currentUser->getRelatedUserList(); $user_item = $user_list->getFirst(); while ($user_item) { if ($form_data['mail_hide']) { $user_item->setEmailNotVisible(); } else { $user_item->setEmailVisible(); } $user_item->save(); $user_item = $user_list->getNext(); } $currentUser->setDefaultMailNotVisible(); $currentUser->save(); } } // im portal nur default wert // im raum default wert und raum wert? setValue($currentUser, $portalUser, 'setTelephone', $text_converter->sanitizeHTML($form_data['telephone'])); setValue($currentUser, $portalUser, 'setCellularphone', $text_converter->sanitizeHTML($form_data['cellularphone'])); setValue($currentUser, $portalUser, 'setStreet', $text_converter->sanitizeHTML($form_data['street'])); setValue($currentUser, $portalUser, 'setZipcode', $text_converter->sanitizeHTML($form_data['zipcode'])); setValue($currentUser, $portalUser, 'setCity', $text_converter->sanitizeHTML($form_data['city'])); setValue($currentUser, $portalUser, 'setRoom', $text_converter->sanitizeHTML($form_data['room'])); setValue($currentUser, $portalUser, 'setOrganisation', $text_converter->sanitizeHTML($form_data['organisation'])); setValue($currentUser, $portalUser, 'setPosition', $text_converter->sanitizeHTML($form_data['position'])); setValue($currentUser, $portalUser, 'setICQ', $text_converter->sanitizeHTML($form_data['icq'])); setValue($currentUser, $portalUser, 'setMSN', $text_converter->sanitizeHTML($form_data['msn'])); setValue($currentUser, $portalUser, 'setSkype', $text_converter->sanitizeHTML($form_data['skype'])); setValue($currentUser, $portalUser, 'setYahoo', $text_converter->sanitizeHTML($form_data['yahoo'])); setValue($currentUser, $portalUser, 'setJabber', $text_converter->sanitizeHTML($form_data['jabber'])); setValue($currentUser, $portalUser, 'setHomepage', $text_converter->sanitizeHTML($form_data['homepage'])); setValue($currentUser, $portalUser, 'setDescription', $form_data['description']); // delete picture handling if (isset($form_data['delete_picture']) && $currentUser->getPicture()) { $disc_manager = $this->_environment->getDiscManager(); // unlink file if ($disc_manager->existsFile($currentUser->getPicture())) { $disc_manager->unlinkFile($currentUser->getPicture()); } // set non picture $currentUser->setPicture(''); if (isset($portalUser)) { $portalUser->setPicture(''); } } // set modificator and modification date and save $modifier = $this->_environment->getCurrentUserItem(); $currentUser->setModificatorItem($modifier); $currentUser->setModificationDate(getCurrentDateTimeInMySQL()); $currentUser->save(); if (isset($portalUser)) { $portalUser->setModificatorItem($modifier); $portalUser->setModificationDate(getCurrentDateTimeInMySQL()); $portalUser->save(); } /* change all option */ // get a dummy user $user_manager = $this->_environment->getUserManager(); $dummy_user = $user_manager->getNewItem(); $changeAll = false; function setChangeAllValue($currentUser, $dummy_user_item, $method_set, $method_get, $checked) { if (isset($checked)) { $value = call_user_func_array(array($currentUser, $method_get), array()); if (empty($value)) { $value = -1; } call_user_func_array(array($dummy_user_item, $method_set), array($value)); } return $checked; } $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setTitle', 'getTitle', $form_data['title_all']); $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setBirthday', 'getBirthday', $form_data['birthday_all']); $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setEmail', 'getEmail', $form_data['mail_all']); if (isset($form_data['mail_all'])) { $changeAll = true; if (!$currentUser->isEmailVisible()) { $dummy_user->setEmailNotVisible(); } else { $dummy_user->setEmailVisible(); } } $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setTelephone', 'getTelephone', $form_data['telephone_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setCellularphone', 'getCellularphone', $form_data['cellularphone_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setStreet', 'getStreet', $form_data['street_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setZipcode', 'getZipcode', $form_data['zipcode_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setCity', 'getCity', $form_data['city_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setRoom', 'getRoom', $form_data['room_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setOrganisation', 'getOrganisation', $form_data['organisation_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setPosition', 'getPosition', $form_data['position_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setICQ', 'getICQ', $form_data['messenger_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setMSN', 'getMSN', $form_data['messenger_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setSkype', 'getSkype', $form_data['messenger_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setYahoo', 'getYahoo', $form_data['messenger_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setJabber', 'getJabber', $form_data['messenger_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setHomepage', 'getHomepage', $form_data['homepage_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setDescription', 'getDescription', $form_data['description_all']) || $changeAll; $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setPicture', 'getPicture', $form_data['picture_all']) || $changeAll; if ($changeAll === true) { $currentUser->changeRelatedUser($dummy_user); } $manager = $this->_environment->getLinkModifierItemManager(); $manager->markEdited($currentUser->getItemID()); // set return $this->_popup_controller->setSuccessfullItemIDReturn($currentUser->getItemID()); } break; /**** NEWSLETTER ****/ /**** NEWSLETTER ****/ case 'newsletter': if ($this->_popup_controller->checkFormData('newsletter')) { $currentUser = $this->_environment->getCurrentUserItem(); $room_item = $currentUser->getOwnRoom(); $set_to = 'none'; if (isset($form_data['newsletter']) && !empty($form_data['newsletter'])) { if ($form_data['newsletter'] == 2) { $set_to = 'weekly'; } elseif ($form_data['newsletter'] == 3) { $set_to = 'daily'; } } // set $room_item->setPrivateRoomNewsletterActivity($set_to); // save $room_item->save(); // set return $this->_popup_controller->setSuccessfullItemIDReturn($room_item->getItemID()); } break; case 'cs_bar': if ($this->_popup_controller->checkFormData('cs_bar')) { $currentUser = $this->_environment->getCurrentUserItem(); $room_item = $currentUser->getOwnRoom(); //--- $wordpress_manager = $this->_environment->getWordpressManager(); $wiki_manager = $this->_environment->getWikiManager(); if ($additional['action'] == 'create_wordpress') { if (isset($form_data['use_comments']) and !empty($form_data['use_comments']) and $form_data['use_comments'] == 'yes') { $room_item->setWordpressUseComments(); } else { $room_item->unsetWordpressUseComments(); } if (isset($form_data['use_comments_moderation']) and !empty($form_data['use_comments_moderation']) and $form_data['use_comments_moderation'] == 'yes') { $room_item->setWordpressUseCommentsModeration(); } else { $room_item->unsetWordpressUseCommentsModeration(); } if (isset($form_data['wordpresslink']) and !empty($form_data['wordpresslink']) and $form_data['wordpresslink'] == 'yes') { $room_item->setWordpressHomeLink(); } else { $room_item->unsetWordpressHomeLink(); } if (isset($form_data['skin_choice']) and !empty($form_data['skin_choice'])) { $room_item->setWordpressSkin($form_data['skin_choice']); } if (isset($form_data['wordpresstitle']) and !empty($form_data['wordpresstitle'])) { $room_item->setWordpressTitle($form_data['wordpresstitle']); } else { $room_item->setWordpressTitle($room_item->getTitle()); } if (isset($form_data['wordpressdescription']) and !empty($form_data['wordpressdescription'])) { $room_item->setWordpressDescription($form_data['wordpressdescription']); } else { $room_item->setWordpressDescription(''); } if (isset($form_data['member_role']) and !empty($form_data['member_role'])) { $room_item->setWordpressMemberRole($form_data['member_role']); } else { $room_item->setWordpressMemberRole(); } $room_item->setWithWordpressFunctions(); $room_item->setWordpressExists(); $room_item->setWordpressActive(); // save $room_item->save(); // create or change new wordpress $success = $wordpress_manager->createWordpress($room_item); } else { if ($additional['action'] == 'delete_wordpress') { if ($wordpress_manager->deleteWordpress($room_item->getWordpressId())) { $current_user = $this->_environment->getCurrentUserItem(); $room_item->setModificatorItem($current_user); $room_item->setModificationDate(getCurrentDateTimeInMySQL()); $room_item->unsetWordpressExists(); $room_item->setWordpressInActive(); $room_item->setWordpressSkin('twentyten'); $room_item->setWordpressTitle($room_item->getTitle()); $room_item->setWordpressDescription(''); $room_item->setWordpressId(0); // Save item $room_item->save(); } } else { if ($additional['action'] == 'create_wiki') { // Set modificator and modification date #if ( isset($form_data['wikilink']) and !empty($form_data['wikilink']) and $form_data['wikilink'] == 'yes') { $room_item->setWikiHomeLink(); #} else { # $room_item->unsetWikiHomeLink(); #} if (isset($form_data['wikilink2']) and !empty($form_data['wikilink2']) and $form_data['wikilink2'] == 'yes') { $room_item->setWikiPortalLink(); } else { $room_item->unsetWikiPortalLink(); } if (isset($form_data['wiki_skin_choice']) and !empty($form_data['wiki_skin_choice'])) { $room_item->setWikiSkin($form_data['wiki_skin_choice']); } if (isset($form_data['wikititle']) and !empty($form_data['wikititle'])) { $room_item->setWikiTitle($form_data['wikititle']); } else { $room_item->setWikiTitle($room_item->getTitle()); } if (isset($form_data['admin']) and !empty($form_data['admin'])) { $room_item->setWikiAdminPW($form_data['admin']); } if (isset($form_data['edit']) and !empty($form_data['edit'])) { $room_item->setWikiEditPW($form_data['edit']); } else { $room_item->setWikiEditPW(''); } if (isset($form_data['read']) and !empty($form_data['read'])) { $room_item->setWikiReadPW($form_data['read']); } else { $room_item->setWikiReadPW(''); } #if ( isset($form_data['use_commsy_login']) ) { $room_item->setWikiUseCommSyLogin(); #} else { # $room_item->unsetWikiUseCommSyLogin(); #} if (isset($form_data['community_read_access'])) { $room_item->setWikiCommunityReadAccess(); } else { $room_item->unsetWikiCommunityReadAccess(); } if (isset($form_data['community_write_access'])) { $room_item->setWikiCommunityWriteAccess(); } else { $room_item->unsetWikiCommunityWriteAccess(); } if (isset($form_data['portal_read_access'])) { $room_item->setWikiPortalReadAccess(); } else { $room_item->unsetWikiPortalReadAccess(); } if (isset($form_data['room_mod_write_access'])) { $room_item->setWikiRoomModWriteAccess(); } else { $room_item->unsetWikiRoomModWriteAccess(); } if (isset($form_data['show_login_box'])) { $room_item->setWikiShowCommSyLogin(); } else { $room_item->unsetWikiShowCommSyLogin(); } #if ( isset($form_data['enable_fckeditor']) ) { $room_item->setWikiEnableFCKEditor(); #} else { # $room_item->unsetWikiEnableFCKEditor(); #} #if ( isset($form_data['enable_sitemap']) ) { $room_item->setWikiEnableSitemap(); #} else { # $room_item->unsetWikiEnableSitemap(); #} #if ( isset($form_data['enable_statistic']) ) { $room_item->setWikiEnableStatistic(); #} else { # $room_item->unsetWikiEnableStatistic(); #} #if ( isset($form_data['enable_search']) ) { $room_item->setWikiEnableSearch(); #} else { # $room_item->unsetWikiEnableSearch(); #} #if ( isset($form_data['enable_rss']) ) { $room_item->setWikiEnableRss(); #} else { # $room_item->unsetWikiEnableRss(); #} if (isset($form_data['enable_calendar'])) { $room_item->setWikiEnableCalendar(); } else { $room_item->unsetWikiEnableCalendar(); } if (isset($form_data['enable_gallery'])) { $room_item->setWikiEnableGallery(); } else { $room_item->unsetWikiEnableGallery(); } if (isset($form_data['enable_notice'])) { $room_item->setWikiEnableNotice(); } else { $room_item->unsetWikiEnableNotice(); } #if ( isset($form_data['enable_pdf']) ) { $room_item->setWikiEnablePdf(); #} else { # $room_item->unsetWikiEnablePdf(); #} if (isset($form_data['enable_rater'])) { $room_item->setWikiEnableRater(); } else { $room_item->unsetWikiEnableRater(); } #if ( isset($form_data['enable_listcategories']) ) { $room_item->setWikiEnableListCategories(); #} else { # $room_item->unsetWikiEnableListCategories(); #} if (isset($form_data['new_page_template']) && $_POST['new_page_template'] != '') { $room_item->setWikiNewPageTemplate($_POST['new_page_template']); } else { $room_item->unsetWikiNewPageTemplate(); } if (isset($form_data['enable_swf'])) { $room_item->setWikiEnableSwf(); } else { $room_item->unsetWikiEnableSwf(); } if (isset($form_data['enable_wmplayer'])) { $room_item->setWikiEnableWmplayer(); } else { $room_item->unsetWikiEnableWmplayer(); } if (isset($form_data['enable_quicktime'])) { $room_item->setWikiEnableQuicktime(); } else { $room_item->unsetWikiEnableQuicktime(); } if (isset($form_data['enable_youtube_google_vimeo'])) { $room_item->setWikiEnableYoutubeGoogleVimeo(); } else { $room_item->unsetWikiEnableYoutubeGoogleVimeo(); } include_once 'functions/development_functions.php'; // Discussion #if ( isset($form_data['enable_discussion']) ) { $room_item->setWikiEnableDiscussion(); if (isset($form_data['new_discussion'])) { $_POST['new_discussion'] = $form_data['new_discussion']; $room_item->WikiSetNewDiscussion($form_data['new_discussion']); } #} else { # $room_item->unsetWikiEnableDiscussion(); #} $enable_discussion_discussions = array(); $form_data_keys = array_keys($form_data); foreach ($form_data_keys as $form_data_key) { if (stristr($form_data_key, 'enable_discussion_discussions_')) { $enable_discussion_discussions[] = $form_data[$form_data_key]; } } $_POST['enable_discussion_discussions'] = $enable_discussion_discussions; if (isset($form_data['enable_discussion_notification'])) { $room_item->setWikiEnableDiscussionNotification(); } else { $room_item->unsetWikiEnableDiscussionNotification(); } if (isset($form_data['enable_discussion_notification_groups'])) { $room_item->setWikiEnableDiscussionNotificationGroups(); } else { $room_item->unsetWikiEnableDiscussionNotificationGroups(); } if (isset($form_data['wiki_section_edit'])) { $room_item->setWikiWithSectionEdit(); } else { $room_item->setWikiWithoutSectionEdit(); } if (isset($form_data['wiki_section_edit_header'])) { $room_item->setWikiWithHeaderForSectionEdit(); } else { $room_item->setWikiWithoutHeaderForSectionEdit(); } $room_item->setWikiExists(); $room_item->setWikiActive(); $wiki_manager->createWiki($room_item); // Save item - after createWiki() -> old discussions might be deleted $room_item->save(); $enable_wiki_groups = array(); $form_data_keys = array_keys($form_data); foreach ($form_data_keys as $form_data_key) { if (stristr($form_data_key, 'enable_wiki_groups_')) { $enable_wiki_groups[] = $form_data[$form_data_key]; } } // WSDL-xml hier noch nicht zugreifbar, daher weiterhin die alte Variante if (!empty($enable_wiki_groups)) { //global $c_use_soap_for_wiki; //if(!$c_use_soap_for_wiki){ $wiki_manager->setWikiGroupsAsPublic($enable_wiki_groups); //} else { // $wiki_manager->setWikiGroupsAsPublic_soap($_POST['enable_wiki_groups']); //} } else { //global $c_use_soap_for_wiki; //if(!$c_use_soap_for_wiki){ $wiki_manager->setWikiGroupsAsPublic(array()); //} else { // $wiki_manager->setWikiGroupsAsPublic_soap(array()); //} } } else { if ($additional['action'] == 'delete_wiki') { $room_item->setModificatorItem($currentUser); $room_item->setModificationDate(getCurrentDateTimeInMySQL()); $room_item->unsetWikiExists(); $room_item->setWikiInActive(); $room_item->setWikiSkin('pmwiki'); $room_item->setWikiTitle($room_item->getTitle()); $room_item->unsetWikiEnableDiscussion(); $room_item->unsetWikiEnableDiscussionNotification(); $room_item->unsetWikiEnableDiscussionNotificationGroups(); $room_item->unsetWikiDiscussionArray(); // Save item $room_item->save(); // delete wiki $wiki_manager->deleteWiki($room_item); } else { if ($additional['action'] == 'chat') { if (isset($form_data['chatlink']) and !empty($form_data['chatlink']) and $form_data['chatlink'] == 'yes') { $room_item->setChatLinkActive(); } else { $room_item->setChatLinkInactive(); } $room_item->save(); } elseif (substr($additional['action'], 0, 7) == 'plugin_') { $plugin = substr($additional['action'], 7); $plugin_class = $this->_environment->getPluginClass($plugin); if (!empty($plugin_class) and method_exists($plugin_class, 'isConfigurableInPortal')) { if ($this->_environment->inPortal() and $plugin_class->isConfigurableInPortal() or !$this->_environment->inServer() and method_exists($plugin_class, 'isConfigurableInRoom') and $plugin_class->isConfigurableInRoom(CS_PRIVATEROOM_TYPE) or !$this->_environment->inServer() and method_exists($plugin_class, 'isConfigurableInRoom') and $plugin_class->isConfigurableInRoom() and $plugin == 'voyeur') { if (!empty($form_data[$plugin . '_on']) and $form_data[$plugin . '_on'] == 'yes') { $room_item->setPluginOn($plugin); } else { $room_item->setPluginOff($plugin); } $values = $form_data; $values['current_context_item'] = $room_item; if ($this->_environment->inPortal() and method_exists($plugin_class, 'configurationAtPortal')) { $plugin_class->configurationAtPortal('save_config', $values); } elseif (!$this->_environment->inServer() and method_exists($plugin_class, 'configurationAtRoom')) { $plugin_class->configurationAtRoom('save_config', $values); } } } $room_item->save(); } else { if ($additional['action'] == 'export_private_room') { $currentUserItem = $this->_environment->getCurrentUserItem(); $privateroom_manager = $this->_environment->getPrivateRoomManager(); $privateroom_item = $privateroom_manager->getRelatedOwnRoomForUser($currentUserItem, $this->_environment->getCurrentPortalID()); $room_manager = $this->_environment->getRoomManager(); $xml = $room_manager->export_item($privateroom_item->getItemID()); //$xml = $room_manager->export_item(488); $dom = new DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($xml->asXML()); //el($dom->saveXML()); $filename = 'var/temp/commsy_xml_export_import_' . $privateroom_item->getItemID() . '.xml'; if (file_exists($filename)) { unlink($filename); } $xmlfile = fopen($filename, 'a'); fputs($xmlfile, $dom->saveXML()); fclose($xmlfile); //Location where export is saved $zipfile = 'var/temp/commsy_export_import_' . $privateroom_item->getItemID() . '.zip'; if (file_exists($zipfile)) { unlink($zipfile); } //Location that will be backuped $disc_manager = $this->_environment->getDiscManager(); $disc_manager->setPortalID($this->_environment->getCurrentPortalID()); $backup_paths = array(); $room_item = $privateroom_manager->getItem($privateroom_item->getItemID()); $disc_manager->setContextID($room_item->getItemId()); $backup_paths[$room_item->getItemId()] = $disc_manager->getFilePath(); if (class_exists('ZipArchive')) { include_once 'functions/misc_functions.php'; $zip = new ZipArchive(); $filename_zip = $zipfile; if ($zip->open($filename_zip, ZIPARCHIVE::CREATE) !== TRUE) { include_once 'functions/error_functions.php'; trigger_error('can not open zip-file ' . $filename_zip, E_USER_WARNNG); } $temp_dir = getcwd(); foreach ($backup_paths as $item_id => $backup_path) { chdir($backup_path); $zip = addFolderToZip('.', $zip, 'files_' . $item_id); chdir($temp_dir); } $zip->addFile($filename, basename($filename)); $zip->close(); unset($zip); #header('Content-disposition: attachment; filename=commsy_export_import_'.$_POST['room'].'.zip'); #header('Content-type: application/zip'); #readfile($zipfile); //export_privateroom $this->_popup_controller->setSuccessfullDataReturn(array('commsy_export' => '/commsy.php?cid=' . $this->_environment->getCurrentPortalID() . '&mod=export_privateroom&fct=getfile')); } else { include_once 'functions/error_functions.php'; trigger_error('can not initiate ZIP class, please contact your system administrator', E_USER_WARNNG); } } } } } } } //--- if (isset($form_data['show_widget_view']) && !empty($form_data['show_widget_view'])) { if ($form_data['show_widget_view'] == 'yes') { $room_item->setCSBarShowWidgets('1'); } else { $room_item->setCSBarShowWidgets('-1'); } } else { $room_item->setCSBarShowWidgets('-1'); } if (isset($form_data['show_roomwide_search']) && !empty($form_data['show_roomwide_search'])) { if ($form_data['show_roomwide_search'] == 'yes') { $room_item->setPortletShowRoomWideSearchBox('1'); } else { $room_item->setPortletShowRoomWideSearchBox('-1'); } } else { $room_item->setPortletShowRoomWideSearchBox('-1'); } if (isset($form_data['show_newest_entries']) && !empty($form_data['show_newest_entries'])) { if ($form_data['show_newest_entries'] == 'yes') { $room_item->setPortletShowNewEntryList('1'); } else { $room_item->setPortletShowNewEntryList('-1'); } } else { $room_item->setPortletShowNewEntryList('-1'); } if (isset($form_data['show_active_rooms']) && !empty($form_data['show_active_rooms'])) { if ($form_data['show_active_rooms'] == 'yes') { $room_item->setPortletShowActiveRoomList('1'); } else { $room_item->setPortletShowActiveRoomList('-1'); } } else { $room_item->setPortletShowActiveRoomList('-1'); } if (isset($form_data['show_calendar_view']) && !empty($form_data['show_calendar_view'])) { if ($form_data['show_calendar_view'] == 'yes') { $room_item->setCSBarShowCalendar('1'); } else { $room_item->setCSBarShowCalendar('-1'); } } else { $room_item->setCSBarShowCalendar('-1'); } if (isset($form_data['show_stack_view']) && !empty($form_data['show_stack_view'])) { if ($form_data['show_stack_view'] == 'yes') { $room_item->setCSBarShowStack('1'); } else { $room_item->setCSBarShowStack('-1'); } } else { $room_item->setCSBarShowStack('-1'); } if (isset($form_data['show_portfolio_view']) && !empty($form_data['show_portfolio_view'])) { if ($form_data['show_portfolio_view'] == 'yes') { $room_item->setCSBarShowPortfolio('1'); } else { $room_item->setCSBarShowPortfolio('-1'); } } else { $room_item->setCSBarShowPortfolio('-1'); } // portal2portal if (isset($form_data['show_connection_view']) && !empty($form_data['show_connection_view'])) { if ($form_data['show_connection_view'] == 'yes') { $room_item->setCSBarShowConnection('1'); } else { $room_item->setCSBarShowConnection('-1'); } } else { $room_item->setCSBarShowConnection('-1'); } if (isset($form_data['show_old_room_switcher']) && !empty($form_data['show_old_room_switcher'])) { if ($form_data['show_old_room_switcher'] == 'yes') { $room_item->setCSBarShowOldRoomSwitcher('1'); } else { $room_item->setCSBarShowOldRoomSwitcher('-1'); } } else { $room_item->setCSBarShowOldRoomSwitcher('-1'); } // save $room_item->save(); // set return $this->_popup_controller->setSuccessfullItemIDReturn($room_item->getItemID()); } break; } } // // save user // else { // $room_item = $environment->getCurrentContextItem(); // // Define rubric connections // $rubric_connection = array(); // $current_rubrics = $room_item->getAvailableRubrics(); // foreach ( $current_rubrics as $rubric ) { // switch ( $rubric ) { // case CS_GROUP_TYPE: // $rubric_connection[] = CS_GROUP_TYPE; // break; // case CS_INSTITUTION_TYPE: // $rubric_connection[] = CS_INSTITUTION_TYPE; // break; // } // } // $profile_view->setRubricConnections($rubric_connection); // $params = $environment->getCurrentParameterArray(); // unset($params['is_saved']); // $profile_view->setAction(curl($environment->getCurrentContextID(),$environment->getCurrentModule(),$environment->getCurrentFunction(),$params)); // if (!$currentUser->mayEditRegular($current_user)) { // $profile_view->warnChanger(); // $params = array(); // $params['environment'] = $environment; // $params['with_modifying_actions'] = true; // $params['width'] = 500; // $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); // unset($params); // $errorbox->setText($translator->getMessage('COMMON_EDIT_AS_MODERATOR')); // } // $profile_view->setForm($form); // } } }
/** specific check the values of the form * this methods check the entered values */ function _checkValues() { // check email adresses for equality if ($this->_form_post['email'] != $this->_form_post['email_confirmation']) { $this->_error_array[] = $this->_translator->getMessage('USER_EMAIL_ERROR'); $this->_form->setFailure('email', ''); $this->_form->setFailure('email_confirmation', ''); } else { //check emails for validity if (isEmailValid($this->_form_post['email']) == false) { $this->_error_array[] = $this->_translator->getMessage('USER_EMAIL_VALID_ERROR'); $this->_form->setFailure('email', ''); $this->_form->setFailure('email_confirmation', ''); } } if ($this->_environment->getCurrentContextItem()->withAGB() and $this->_environment->getCurrentContextItem()->withAGBDatasecurity()) { if (!isset($this->_form_post['terms_of_use'])) { $this->_error_array[] = $this->_translator->getMessage('CONFIGURATION_AGB_ACCEPT_ERROR'); $this->_form->setFailure('terms_of_use', ''); } } // password check if ($this->_form_post['password'] != $this->_form_post['password2']) { $this->_error_array[] = $this->_translator->getMessage('USER_PASSWORD_ERROR'); $this->_form->setFailure('password', ''); $this->_form->setFailure('password2', ''); } if (isset($this->_form_post['auth_source'])) { $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($this->_form_post['auth_source']); if ($auth_source_item->getPasswordLength() > 0) { if (strlen($this->_form_post['password']) < $auth_source_item->getPasswordLength()) { $this->_error_array[] = $this->_translator->getMessage('USER_NEW_PASSWORD_LENGTH_ERROR', $auth_source_item->getPasswordLength()); } } if ($auth_source_item->getPasswordSecureBigchar() == 1) { if (!preg_match('~[A-Z]+~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessage('USER_NEW_PASSWORD_BIGCHAR_ERROR'); } } if ($auth_source_item->getPasswordSecureSpecialchar() == 1) { if (!preg_match('~[^a-zA-Z0-9]+~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessage('USER_NEW_PASSWORD_SPECIALCHAR_ERROR'); } } if ($auth_source_item->getPasswordSecureNumber() == 1) { if (!preg_match('~[0-9]+~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessage('USER_NEW_PASSWORD_NUMBER_ERROR'); } } if ($auth_source_item->getPasswordSecureSmallchar() == 1) { if (!preg_match('~[a-z]+~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessage('USER_NEW_PASSWORD_SMALLCHAR_ERROR'); } } unset($auth_source_manager); } // is user id free? if (!empty($this->_form_post['auth_source']) and is_numeric($this->_form_post['auth_source'])) { $authentication = $this->_environment->getAuthenticationObject(); if (!$authentication->is_free($this->_form_post['user_id'], $this->_form_post['auth_source'])) { $error_array = $authentication->getErrorArray(); if (count($error_array) > 0) { $this->_error_array = array_merge($this->_error_array, $error_array); } else { $this->_error_array[] = $this->_translator->getMessage('USER_USER_ID_ERROR', $this->_form_post['user_id']); } $this->_form->setFailure('user_id', ''); } elseif (withUmlaut($this->_form_post['user_id'])) { $this->_error_array[] = $this->_translator->getMessage('USER_USER_ID_ERROR_UMLAUT', $this->_form_post['user_id']); $this->_form->setFailure('user_id', ''); } } elseif (!empty($this->_form_post['auth_source'])) { $this->_error_array[] = $this->_translator->getMessage('USER_AUTH_SOURCE_ERROR_NOT_AVAILABLE', $this->_form_post['auth_source']); } else { $this->_error_array[] = $this->_translator->getMessage('USER_AUTH_SOURCE_ERROR'); } }
/** specific check the values of the form * this methods check the entered values */ function _checkValues() { if (!empty($this->_form_post['email']) and !isEmailValid($this->_form_post['email'])) { $this->_error_array[] = $this->_translator->getMessage('USER_EMAIL_VALID_ERROR'); $this->_form->setFailure('email', ''); } // exists user id? if (!empty($this->_form_post['user_id'])) { $current_user = $this->_environment->getCurrentUserItem(); $auth_source = $current_user->getAuthSource(); if (!empty($auth_source)) { $authentication = $this->_environment->getAuthenticationObject(); $this->_user = $this->_environment->getPortalUserItem(); if ($this->_user->getUserID() != $this->_form_post['user_id'] and !$authentication->is_free($this->_form_post['user_id'], $auth_source)) { $this->_error_array[] = $this->_translator->getMessage('USER_USER_ID_ERROR', $this->_form_post['user_id']); $this->_form->setFailure('user_id', ''); } elseif (withUmlaut($this->_form_post['user_id'])) { $this->_error_array[] = $this->_translator->getMessage('USER_USER_ID_ERROR_UMLAUT', $this->_form_post['user_id']); $this->_form->setFailure('user_id', ''); } } else { $this->_error_array[] = $this->_translator->getMessage('USER_AUTH_SOURCE_ERROR'); } } }
public function registerUser($session_id, $context_id, $firstname, $lastname, $email, $identification, $password, $tou) { $xml = ""; $valid = true; $errorArray = array(); if ($this->_isSessionValid($session_id)) { $this->_environment->setCurrentContextID($context_id); $contextItem = $this->_environment->getCurrentContextItem(); $translator = $this->_environment->getTranslationObject(); // check email if (!isEmailValid($email)) { $valid = false; $errorArray['email'] = $translator->getMessage('USER_EMAIL_ERROR'); } // check tou if ($contextItem->withAGB() && $contextItem->withAGBDatasecurity()) { if (!$tou) { $valid = false; $errorArray['tou'] = $translator->getMessage('CONFIGURATION_AGB_ACCEPT_ERROR'); } } // get the commsy authentication source $authSourceList = $contextItem->getAuthSourceList(); if (isset($authSourceList) && !empty($authSourceList)) { $authSourceItem = $authSourceList->getFirst(); $found = false; while ($authSourceItem and !$found) { if ($authSourceItem->isCommSyDefault()) { $found = true; } else { $authSourceItem = $authSourceList->getNext(); } } } //$authSourceItem = $contextItem->getAuthDefault(); // check password security if ($authSourceItem->getPasswordLength() > 0) { if (mb_strlen($password) < $authSourceItem->getPasswordLength()) { $valid = false; $errorArray['password_length'] = $translator->getMessage('USER_NEW_PASSWORD_LENGTH_ERROR', $authSourceItem->getPasswordLength()); } } if ($authSourceItem->getPasswordSecureBigchar() == 1) { if (!preg_match('~[A-Z]+~u', $password)) { $valid = false; $errorArray['password_bigchar'] = $translator->getMessage('USER_NEW_PASSWORD_BIGCHAR_ERROR'); } } if ($authSourceItem->getPasswordSecureSpecialchar() == 1) { if (!preg_match('~[^a-zA-Z0-9]+~u', $password)) { $valid = false; $errorArray['password_specialchar'] = $translator->getMessage('USER_NEW_PASSWORD_SPECIALCHAR_ERROR'); } } if ($authSourceItem->getPasswordSecureNumber() == 1) { if (!preg_match('~[0-9]+~u', $password)) { $valid = false; $errorArray['password_number'] = $translator->getMessage('USER_NEW_PASSWORD_NUMBER_ERROR'); } } if ($authSourceItem->getPasswordSecureSmallchar() == 1) { if (!preg_match('~[a-z]+~u', $password)) { $valid = false; $errorArray['password_smallchar'] = $translator->getMessage('USER_NEW_PASSWORD_SMALLCHAR_ERROR'); } } // check for unique user id $authentication = $this->_environment->getAuthenticationObject(); if (!$authentication->is_free($identification, $authSourceItem->getItemId())) { $valid = false; $errorArray['user_id'] = $translator->getMessage('USER_USER_ID_ERROR', $identification); } else { if (withUmlaut($identification)) { $valid = false; $errorArray['user_id'] = $translator->getMessage('USER_USER_ID_ERROR_UMLAUT', $identification); } } if ($valid) { // create user $textConverter = $this->_environment->getTextConverter(); $firstname = $textConverter->sanitizeHTML($firstname); $lastname = $textConverter->sanitizeHTML($lastname); $newAccount = $authentication->getNewItem(); $newAccount->setUserID($identification); $newAccount->setPassword($password); $newAccount->setFirstname($firstname); $newAccount->setLastname($lastname); $newAccount->setLanguage("browser"); $newAccount->setEmail($email); $newAccount->setPortalID($context_id); $newAccount->setAuthSourceId($authSourceItem->getItemId()); $authentication->save($newAccount, false); if ($authentication->getErrorMessage() == "") { $portalUserItem = $authentication->getUserItem(); // tou if ($contextItem->withAGB() && $contextItem->withAGBDatasecurity()) { if ($tou) { $portalUserItem->setAGBAcceptance(); } } // password expiration if ($contextItem->isPasswordExpirationActive()) { $portalUser->setPasswordExpireDate($contextItem->getPasswordExpiration()); } // send mail to moderators $savedLanguage = $translator->getSelectedLanguage(); $moderatorList = $contextItem->getModeratorList(); $emailArray = array(); $moderatorItem = $moderatorList->getFirst(); $recipients = ""; $language = $contextItem->getLanguage(); while ($moderatorItem) { $wantMail = $moderatorItem->getAccountWantMail(); if (!empty($wantMail) && $wantMail == 'yes') { if ($language == "user" && $moderatorItem->getLanguage() != "browser") { $emailArray[$moderatorItem->getLanguage()][] = $moderatorItem->getEmail(); } else { if ($language == "user" && $moderatorItem->getLanguage() == "browser") { $emailArray[$language][] = $moderatorItem->getEmail(); } } $recipients .= $moderatorItem->getFullname() . LF; } $moderatorItem = $moderatorList->getNext(); } foreach ($emailArray as $language => $addresses) { $translator->setSelectedLanguage($language); if (sizeof($addresses) > 0) { include_once 'classees/cs_mail.php'; $mail = new cs_mail(); $mail->set_to(implode(',', $addresses)); $serverItem = $this->environment->getServerItem(); $defaultSenderAddress = $serverItem->getDefaultSenderAddress(); if (!empty($defaultSenderAddress)) { $mail->set_from_email($defaultSenderAddress); } else { $mail->set_from_mail('@'); } $mail->set_from_name($translator->getMessage("SYSTEM_MAIL_MESSAGE", $contextItem->getTitle())); $mail->set_reply_to_name($portalUser->getFullname()); $mail->set_reply_to_email($portalUser->getEmail()); $mail->set_subject($translator->getMessage("USER_GET_MAIL_SUBJECT", $portalUser->getFullname())); $body = $translator->getMessage("MAIL_AUTO", $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $tempLanguage = $portalUser->getLanguage(); if ($tempLanguage == "browser") { $tempLanguage = $this->_environment->getSelectedLanguage(); } // data security if ($contextItem->getHideAccountname()) { $userId = "XXX " . $translator->getMessage("COMMON_DATASECURITY"); } else { $userId = $portalUser->getUserID(); } $body .= $translator->getMessage("USER_GET_MAIL_BODY", $portalUser->getFullname(), $userid, $portalUser->getEmail(), $translator->getLanguageLabelTranslated($tempLanguage)); $body .= LF . LF; $body .= $translator->getMessage("USER_GET_MAIL_STATUS_NO"); $body .= LF . LF; $body .= $translator->getMessage("MAIL_SEND_TO", $recipients); $body .= LF; $body .= "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"] . "?cid=" . $contextItem->getItemID() . "&mod=account&fct=index&selstatus=1"; $mail->set_message($body); $mail->send(); $translator->setSelectedLanguage($savedLanguage); // activate user $portalUser->makeUser(); $portalUser->save(); $this->_environment->setcurrentUserItem($portalUser); // send mail to user if ($portalUser->isUser()) { $modText = ""; $modList = $contextItem->getContactModeratorList(); if ($modList->isEmpty()) { $modItem = $modList->getFirst(); $contactModerator = $modItem; while ($modItem) { if (!empty($modText)) { $modText .= ',' . LF; } $modText .= $modItem->getFullname(); $modText .= " (" . $modItem->getEmail() . ")"; $modItem = $modList->getNext(); } } $language = getSelectedLanguage(); $translator->setSelectedLanguage($language); include_once "classes/cs_mail.php"; $mail = new cs_mail(); $mail->set_to($portalUser->getEmail()); $mail->set_from_name($translator->getMessage("SYSTEM_MAIL_MESSAGE", $contextItem->getTitle())); $serverItem = $this->_environment->getServerItem(); $defaultSenderAddress = $serverItem->getDefaultSenderAddress(); if (!empty($defaultSenderAddress)) { $mail->set_from_email($defaultSenderAddress); } else { $userManager = $this->_environment->getUserManager(); $rootUser = $userManager->getRootUser(); $rootMailAddress = $rootUser->getEmail(); if (!empty($rootMailAddress)) { $mail->set_from_email($rootMailAddress); } else { $mail->set_from_email('@'); } } if (!empty($contactModerator)) { $mail->set_reply_to_email($contactModerator->getEmail()); $mail->set_reply_to_name($contactModerator->getFullname()); } $mail->set_subject($translator->getMessage("MAIL_SUBJECT_USER_ACCOUNT_FREE", $contextItem->getTitle())); $body = $translator->getMessage("MAIL_AUTO", $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $translator->getEmailMEssage("MAIL_BODY_HELLO", $portalUser->getFullname()); $body .= LF . LF; $body .= $translator->getEmailMessage("MAIL_BODY_USER_STATUS_USER", $portalUser->getUserID(), $contextItem->getTitle()); $body .= LF . LF; if (empty($contactModerator)) { $body .= $translator->getMessage("SYSTEM_MAIL_REPLY_INFO") . LF; $body .= $modText; $body .= LF . LF; } else { $body .= $translator->getEmailMessage("MAIL_BODY_CIAO", $contactModerator->getFullname(), $contextItem->getTitle()); $body .= LF . LF; } $body .= "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"] . "?cid=" . $this->_environment->getCurrentContextID(); $mail->set_message($body); $mail->send(); } } } } else { $errorArray['account'] = ''; } } if (sizeof($errorArray) > 0) { $xml = "<errors>\n"; foreach ($errorArray as $code => $description) { $xml .= "<" . $code . "><![CDATA[" . $description . "]]></" . $code . ">\n"; } $xml .= "</errors>"; } else { $xml = "<success></success>"; } $xml = $this->_encode_output($xml); } else { return new SoapFault('ERROR', 'Session (' . $session_id . ') not valid!'); } return $xml; }
private function _createUser($mail, $user_info, $id_manager) { $return_array = array("error" => 0, "value" => ''); $manager = $this->_environment->getUserManager(); $source = $user_info->getSourceSystem(); $stine_user_id = $user_info->getStineId(); $commsy_user_id = $id_manager->getCommsyID($source, $stine_user_id); $context_id = $id_manager->getCommsyId($source, $user_info->getPortalId()); $this->_environment->setCurrentContextId($context_id); $auth_object = $this->_environment->getAuthenticationObject(); if (!empty($auth_object)) { $auth_object->setCommSyIdLimit($context_id); if (empty($commsy_user_id)) { $stine_portal_id = $user_info->getPortalId(); //check if provided id is a valid portal id $portal_manager = $this->_environment->getPortalManager(); if ($portal_manager->getItem($stine_portal_id) != NULL) { $commsy_portal_id = $stine_portal_id; } else { $commsy_portal_id = $id_manager->getCommsyId($source, $stine_portal_id); } $portal_item = $portal_manager->getItem($commsy_portal_id); //No user, so wrong portal id, so fix it $auth_object->setCommSyIDLimit($commsy_portal_id); $this->_environment->setCurrentContextId($commsy_portal_id); if (!empty($commsy_portal_id)) { include_once 'functions/text_functions.php'; $user_id_to_check = $user_info->getUserID(); if (!withUmlaut($user_id_to_check)) { include_once 'classes/cs_auth_item.php'; $auth_item = new cs_auth_item(); $auth_item->setUserID($user_info->getUserID()); $auth_item->setFirstname($user_info->getGivenName()); $auth_item->setLastname($user_info->getFamilyName()); $auth_item->setEmail($user_info->getEmail()); $auth_item->setPortalID($commsy_portal_id); $auth_item->setAuthSourceID($portal_item->getAuthIMS()); $password = $user_info->getPassword(); if (!empty($password)) { $encryption_method = $user_info->getPasswordEncryptionMethod(); if (empty($encryption_method)) { //Plain text PW, MD5 it $auth_item->setPassword($user_info->getPassword()); } elseif ($encryption_method == 'MD5') { //just set it $auth_item->setPasswordMD5($user_info->getPassword()); } else { //unknown encryption, produce error $info_text = 'Could not set Password. Only accepted encryption method is MD5, plaintext is possible but not recommended! User not created!'; $return_array = array("error" => 1, "value" => $info_text); } } if ($return_array['error'] == 0) { //crate user if no error occured $auth_object->save($auth_item); $user_item = $auth_object->getUserItem(); if (!empty($user_item)) { $user_item->makeUser(); $user_item->save(); $return_array = array("error" => 0, "value" => 'User succesfully created! CommSy Id: ' . $user_item->getItemId() . ', external-id: ' . $stine_user_id); $this->_log('IMS', 'createUser', 'User succesfully created! CommSy Id: ' . $user_item->getItemId() . ', external-id: ' . $stine_user_id); $id_manager->addIDsToDB($source, $stine_user_id, $user_item->getItemId()); //Mail handling for user $portal_user = $user_item; $translator = $this->_environment->getTranslationObject(); $translator->initFromContext($portal_item); $contact_list = $portal_item->getContactModeratorList(); $contact = $contact_list->getFirst(); $mail->set_from_name($translator->getMessage('SYSTEM_MAIL_MESSAGE', $portal_item->getTitle())); $mail->set_to($user_item->getEmail()); $mail->set_reply_to_name($contact->getFullname()); $mail->set_reply_to_email($contact->getEmail()); $mail->set_subject($translator->getMessage('MAIL_SUBJECT_USER_ACCOUNT_FREE', $portal_item->getTitle())); $link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; global $c_single_entry_point; $link = str_replace('soap.php', $c_single_entry_point . '?cid=' . $portal_item->getItemId(), $link); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_HELLO', $portal_user->getFullname()); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_USER_STATUS_USER', $portal_user->getUserID(), $portal_item->getTitle()); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_CIAO', $contact->getFullname(), $portal_item->getTitle()); $body .= LF . LF; $body .= $link; $mail->set_message($body); $mail->send(); // mail handling for portal moderators $user_list = $portal_item->getModeratorList(); $email_addresses = array(); $user_item = $user_list->getFirst(); $recipients = ''; $language = $portal_item->getLanguage(); while ($user_item) { $want_mail = $user_item->getAccountWantMail(); if (!empty($want_mail) and $want_mail == 'yes') { if ($language == 'user' and $user_item->getLanguage() != 'browser') { $email_addresses[$user_item->getLanguage()][] = $user_item->getEmail(); } elseif ($language == 'user' and $user_item->getLanguage() == 'browser') { $email_addresses[$this->_environment->getSelectedLanguage()][] = $user_item->getEmail(); } else { $email_addresses[$language][] = $user_item->getEmail(); } $recipients .= $user_item->getFullname() . LF; } $user_item = $user_list->getNext(); } $save_language = $translator->getSelectedLanguage(); foreach ($email_addresses as $key => $value) { $translator->setSelectedLanguage($key); if (count($value) > 0) { include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to(implode(',', $value)); $server_item = $this->_environment->getServerItem(); $default_sender_address = $server_item->getDefaultSenderAddress(); if (!empty($default_sender_address)) { $mail->set_from_email($default_sender_address); } else { $mail->set_from_email('@'); } $mail->set_from_name($translator->getMessage('SYSTEM_MAIL_MESSAGE', $portal_item->getTitle())); $mail->set_reply_to_name($portal_user->getFullname()); $mail->set_reply_to_email($portal_user->getEmail()); $mail->set_subject($translator->getMessage('USER_GET_MAIL_SUBJECT', $portal_user->getFullname())); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $temp_language = $portal_user->getLanguage(); if ($temp_language == 'browser') { $temp_language = $this->_environment->getSelectedLanguage(); } $body .= $translator->getMessage('USER_GET_MAIL_BODY', $portal_user->getFullname(), $portal_user->getUserID(), $portal_user->getEmail(), $translator->getMessage('COMMON_UNKNOWN')); unset($temp_language); $body .= LF . LF; $check_message = 'NO'; switch ($check_message) { case 'YES': $body .= $translator->getMessage('USER_GET_MAIL_STATUS_YES'); break; case 'NO': $body .= $translator->getMessage('USER_GET_MAIL_STATUS_NO'); break; default: break; } $body .= LF . LF; $body .= $translator->getMessage('MAIL_COMMENT_BY', 'IMS', $translator->getMessage('MAIL_COMMENT_IMS', $source)); $body .= LF . LF; $body .= $translator->getMessage('MAIL_SEND_TO', $recipients); $body .= LF; $body .= $link; $mail->set_message($body); $mail->send(); } } $translator->setSelectedLanguage($save_language); } else { $info_text = 'Can not save user item! - ' . __FILE__ . ' - ' . __LINE__; $return_array = array("error" => 1, "value" => $info_text); } } } else { $info_text = 'user id is not valid: user id has umlauts ' . $stine_user_id . '!'; $return_array = array("error" => 1, "value" => $info_text); } } else { $info_text = 'Trying to add a person to an unknown portal: ' . $stine_portal_id . ' !'; $return_array = array("error" => 1, "value" => $info_text); } } else { $info_text = 'Trying to add an allready created person: ' . $stine_user_id . '!'; $return_array = array("error" => 1, "value" => $info_text); } } else { $info_text = 'Can not get auth_object - ' . __FILE__ . ' - ' . __LINE__; $return_array = array("error" => 1, "value" => $info_text); } return $return_array; }
function _checkValues() { if ($this->getProfilePageName() == 'account') { if (!empty($this->_form_post['option']) and isOption($this->_form_post['option'], $this->_translator->getMessageInLang($this->_language, 'ACCOUNT_MERGE_BUTTON'))) { if (empty($this->_form_post['user_id_merge'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'COMMON_ERROR_SELECT', $this->_translator->getMessage('COMMON_ACCOUNT')); $this->_form->setFailure('user_id_merge'); } if (empty($this->_form_post['password_merge'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'COMMON_ERROR_SELECT', $this->_translator->getMessage('USER_PASSWORD')); $this->_form->setFailure('password_merge'); } if (!empty($this->_form_post['user_id_merge']) and !empty($this->_form_post['password_merge'])) { global $c_annonymous_account_array; $current_user = $this->_environment->getCurrentUserItem(); if (!empty($c_annonymous_account_array[mb_strtolower($current_user->getUserID(), 'UTF-8') . '_' . $current_user->getAuthSource()]) and $current_user->isOnlyReadUser()) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'ACCOUNT_MERGE_ERROR_ANNONYMOUS', $current_user->getUserID()); } elseif (!empty($c_annonymous_account_array[mb_strtolower($this->_form_post['user_id_merge'], 'UTF-8') . '_' . $this->_form_post['auth_source']]) and !empty($c_read_account_array[mb_strtolower($this->_form_post['user_id_merge'], 'UTF-8') . '_' . $this->_form_post['auth_source']])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'ACCOUNT_MERGE_ERROR_ANNONYMOUS', $this->_form_post['user_id_merge']); } elseif (!empty($this->_form_post['user_id_merge']) and !empty($this->_form_post['password_merge'])) { if ($current_user->getUserID() == $this->_form_post['user_id_merge'] and (empty($this->_form_post['auth_source']) or $current_user->getAuthSource() == $this->_form_post['auth_source'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'ACCOUNT_MERGE_ERROR_USER_ID', $this->_form_post['user_id_merge']); $this->_form->setFailure('user_id_merge', ''); } elseif (!empty($this->_form_post['auth_source'])) { $authentication = $this->_environment->getAuthenticationObject(); $auth_manager = $authentication->getAuthManager($this->_form_post['auth_source']); if (!$auth_manager->checkAccount($this->_form_post['user_id_merge'], $this->_form_post['password_merge'])) { $this->_error_array = array_merge($this->_error_array, $auth_manager->getErrorArray()); $this->_form->setFailure('user_id_merge', ''); $this->_form->setFailure('password_merge', ''); } } else { $authentication = $this->_environment->getAuthenticationObject(); if (!$authentication->checkAccount($this->_form_post['user_id_merge'], $this->_form_post['password_merge'])) { $this->_error_array = array_merge($this->_error_array, $authentication->getErrorArray()); $this->_form->setFailure('user_id_merge', ''); $this->_form->setFailure('password_merge', ''); } } } } } else { if (!empty($this->_form_post['password_old'])) { $current_user = $this->_environment->getCurrentUserItem(); $authentication = $this->_environment->getAuthenticationObject(); $auth_success = $authentication->isAccountGranted($current_user->getUserID(), $this->_form_post['password_old'], $current_user->getAuthSource()); if (!$auth_success) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_OLD_PASSWORD_ERROR'); $this->_form->setFailure('password_old'); } } if (empty($this->_form_post['password_old']) and !empty($this->_form_post['password']) and !empty($this->_form_post['password2'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_OLD_PASSWORD_ERROR2'); $this->_form->setFailure('password_old'); } if (isset($this->_form_post['password']) and $this->_form_post['password'] != $this->_form_post['password2']) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_PASSWORD_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } // password security if (!empty($this->_form_post['password_old']) and isset($auth_success) and $auth_success and !empty($this->_form_post['password']) and !empty($this->_form_post['password2']) and $this->_form_post['password'] == $this->_form_post['password2']) { if (isset($this->_form_post['auth_source'])) { $auth_source_manager = $this->_environment->getAuthSourceManager(); $auth_source_item = $auth_source_manager->getItem($this->_form_post['auth_source']); if ($auth_source_item->getPasswordLength() > 0) { if (strlen($this->_form_post['password']) < $auth_source_item->getPasswordLength()) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_NEW_PASSWORD_LENGTH_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } } if ($auth_source_item->getPasswordSecureBigchar() == 1) { if (!preg_match('~[A-Z]~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_NEW_PASSWORD_BIGCHAR_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } } if ($auth_source_item->getPasswordSecureSmallchar() == 1) { if (!preg_match('~[a-z]~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_NEW_PASSWORD_SMALLCHAR_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } } if ($auth_source_item->getPasswordSecureNumber() == 1) { if (!preg_match('~[0-9]~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_NEW_PASSWORD_NUMBER_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } } if ($auth_source_item->getPasswordSecureSpecialchar() == 1) { if (!preg_match('~[^a-zA-Z0-9]+~u', $this->_form_post['password'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_NEW_PASSWORD_SPECIALCHAR_ERROR'); $this->_form->setFailure('password'); $this->_form->setFailure('password2'); } } } } } } elseif ($this->getProfilePageName() == 'user') { $portal_user = $this->_environment->getPortalUserItem(); if (isset($portal_user) and !empty($this->_form_post['email']) and $portal_user->hasToChangeEmail() and $portal_user->getEmail() == $this->_form_post['email']) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'COMMON_ERROR_FIELD_CORRECT', $this->_translator->getMessageInLang($this->_language, 'USER_EMAIL')); $this->_form->setFailure('email'); } if (!empty($this->_form_post['icq'])) { if (!preg_match('~^[0-9]+$~u', $this->_form_post['icq'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_ICQ_ERROR'); $this->_form->setFailure('icq'); } } } if (!empty($this->_form_post['user_id'])) { $this->_user = $this->_environment->getPortalUserItem(); if (isset($this->_user) and $this->_user->getUserID() != $this->_form_post['user_id']) { $auth_source = $this->_user->getAuthSource(); if (!empty($auth_source)) { $authentication = $this->_environment->getAuthenticationObject(); if (!$authentication->is_free($this->_form_post['user_id'], $auth_source)) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_USER_ID_ERROR', $this->_form_post['user_id']); $this->_form->setFailure('user_id', ''); } elseif (withUmlaut($this->_form_post['user_id'])) { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_USER_ID_ERROR_UMLAUT', $this->_form_post['user_id']); $this->_form->setFailure('user_id', ''); } } else { $this->_error_array[] = $this->_translator->getMessageInLang($this->_language, 'USER_AUTH_SOURCE_ERROR'); } } } }
// // CommSy is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // CommSy is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You have received a copy of the GNU General Public License // along with CommSy. $disc_manager = $environment->getDiscManager(); if (!empty($_GET['file']) and $disc_manager->existsFile($_GET['file'])) { header('Content-type: application/x-shockwave-flash'); header('Pragma: no-cache'); header('Expires: 0'); readfile($disc_manager->getFilePath().$_GET['file']); } else if(!empty($_GET['file']) and withUmlaut($_GET['file'])) { $filename = rawurlencode($_GET['file']); if (file_exists($disc_manager->_getFilePath().$filename)) { header('Content-type: application/x-shockwave-flash'); header('Pragma: no-cache'); header('Expires: 0'); readfile($disc_manager->getFilePath().$filename); } } exit(); ?>