function execute() { $form = $this->_class_factory->getClass(ACCOUNT_MERGE_FORM, array('environment' => $this->_environment)); // Load form data from postvars if (!empty($this->_post_vars) and isOption($this->_command, $this->_translator->getMessage('ACCOUNT_MERGE_BUTTON'))) { $form->setFormPost($this->_post_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON'))) { $this->_redirect_back(); } // Save item if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('ACCOUNT_MERGE_BUTTON'))) { $correct = $form->check(); if ($correct) { $authentication = $this->_environment->getAuthenticationObject(); $current_user = $this->_environment->getCurrentUserItem(); if (isset($this->_post_vars['auth_source']) and !empty($this->_post_vars['auth_source'])) { $auth_source_old = $this->_post_vars['auth_source']; } else { $current_context = $this->_environment->getCurrentContextItem(); $auth_source_old = $current_context->getAuthDefault(); } $authentication->mergeAccount($current_user->getUserID(), $current_user->getAuthSource(), $this->_post_vars['user_id'], $auth_source_old); $this->_redirect_back(); } } return $this->_show_form($form); }
function execute() { $success = false; $class_params = array(); $class_params['environment'] = $this->_environment; $form = $this->_class_factory->getClass(PASSWORD_CHANGE_FORM, $class_params); unset($class_params); // Load form data from postvars if (!empty($this->_post_vars)) { $form->setFormPost($this->_post_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON'))) { $this->_redirect_back(); } // Save item if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('PASSWORD_CHANGE_BUTTON'))) { $correct = $form->check(); if ($correct) { $current_user = $this->_environment->getCurrentUserItem(); $authentication = $this->_environment->getAuthenticationObject(); if (!$current_user->isRoot()) { $session_item = $this->_environment->getSessionItem(); $auth_manager = $authentication->getAuthManager($current_user->getAuthSource()); } else { $server_item = $this->_environment->getServerItem(); $auth_manager = $authentication->getAuthManagerByAuthSourceItem($server_item->getDefaultAuthSourceItem()); } $auth_manager->changePassword($current_user->getUserID(), $this->_post_vars['password']); $error_number = $auth_manager->getErrorNumber(); if (empty($error_number)) { $success = true; $session = $this->_environment->getSessionItem(); if ($session->issetValue('password_forget_ip')) { $session->unsetValue('password_forget_ip'); $session->unsetValue('password_forget_time'); } } } } if (!$success) { return $this->_show_form($form); } else { $this->_redirect_back(); } }
/** init data for form, INTERNAL * this methods init the data for the form, for example groups */ function _initForm() { // auth source $current_portal = $this->_environment->getCurrentPortalItem(); $auth_source_list = $current_portal->getAuthSourceListEnabled(); $this->_count_auth_source_list_add_account = 0; if (isset($auth_source_list) and !$auth_source_list->isEmpty()) { $this->_count_auth_source_list_enabled = $auth_source_list->getCount(); $auth_source_item = $auth_source_list->getFirst(); while ($auth_source_item) { $temp_array = array(); if ($auth_source_item->isCommSyDefault() and $auth_source_item->allowChangePassword() or $auth_source_item->allowAddAccount() or $auth_source_item->getContactFon() != '' or $auth_source_item->getContactEMail() != '' or $auth_source_item->getPasswordChangeLink() != '') { $temp_array['value'] = $auth_source_item->getItemID(); $this->_count_auth_source_list_add_account++; } else { $this->_count_auth_source_list_add_account++; $temp_array['value'] = 'disabled'; } $temp_array['text'] = $auth_source_item->getTitle(); $this->_auth_source_array[] = $temp_array; unset($temp_array); $auth_source_item = $auth_source_list->getNext(); } } else { $this->_count_auth_source_list_enabled = 0; } if ($this->_count_auth_source_list_add_account == 1) { $this->_default_auth_source_entry = $this->_auth_source_array[0]['value']; } if (!empty($this->_form_post) and isOption($this->_form_post['option'], $this->_translator->getMessage('PASSWORD_CHOOSE_BUTTON')) and !empty($this->_form_post['auth_source'])) { $this->_default_auth_source_entry = $this->_form_post['auth_source']; $this->_count_auth_source_list_add_account = 1; } if (empty($this->_default_auth_source_entry)) { $this->_default_auth_source_entry = $current_portal->getAuthDefault(); } }
if (isset($get_params['search'])){ $params['search'] = $get_params['search']; } if (isset($get_params['seltime'])){ $params['seltime'] = $get_params['seltime']; } if (isset($get_params['selroom'])){ $params['selroom'] = $get_params['selroom']; } if (isset($get_params['sel_archive_room'])){ $params['sel_archive_room'] = $get_params['sel_archive_room']; } redirect($environment->getCurrentContextID(), 'home', 'index', $params); } if (isOption($option, $translator->getMessage('ACCOUNT_GET_MEMBERSHIP_BUTTON'))) { include_once('classes/cs_mail.php'); $room_manager = $environment->getRoomManager(); $room_item = $room_manager->getItem($current_item_id); $portal_item = $environment->getCurrentPortalItem(); if($portal_item->withAGBDatasecurity() and $room_item->getAGBStatus() == 1){ $agb_acceptance = false; if($room_item->getAGBStatus() == 1 AND isset($_POST['agb_acceptance']) and $_POST['agb_acceptance'] == 1){ $agb_acceptance = true; } else { $error = 'agb'; $account_mode = 'member'; } } else { $agb_acceptance = true;
else { include_once('functions/error_functions.php'); trigger_error('annotation_edit was called in an unknown manner', E_USER_ERROR); } if ($session->issetValue($environment->getCurrentModule().'_add_files')) { $form->setSessionFileArray($session->getValue($environment->getCurrentModule().'_add_files')); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and (isOption($command, $translator->getMessage('ANNOTATION_SAVE_BUTTON')) or isOption($command, $translator->getMessage('ANNOTATION_CHANGE_BUTTON')) or isOption($command, $translator->getMessage('ANNOTATION_ADD_NEW_BUTTON')) ) ) { $correct = $form->check(); if ( $correct ) { // Create new item if ( !isset($annotation_item) ) { $annotation_manager = $environment->getAnnotationManager(); $annotation_item = $annotation_manager->getNewItem(); $annotation_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $annotation_item->setCreatorItem($user); $annotation_item->setCreationDate(getCurrentDateTimeInMySQL()); } // Set modificator and modification date
$command = ''; } // Initialize the form $form = $class_factory->getClass(CONFIGURATION_LISTVIEW_FORM,array('environment' => $environment)); // Display form $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(CONFIGURATION_FORM_VIEW,$params); unset($params); // Save item if ( !empty($command) and isOption($command, $translator->getMessage('PREFERENCES_SAVE_BUTTON')) ) { $correct = $form->check(); if ( $correct and isOption($command, $translator->getMessage('PREFERENCES_SAVE_BUTTON')) ) { if (!empty($_POST['length'])){ $length = $_POST['length']; if ($length =='3'){ $value = '50'; }elseif ($length =='4'){ $value = 'all'; }else { $value = '20'; } $room_item->setListLength($value); $session_item = $environment->getSessionItem(); $session_item->unsetValue('interval'); $environment->setSessionItem($session_item); }
} elseif(!empty($iid) and $iid == $delete_id) { $context_item = $environment->getCurrentContextItem(); $status_array = $context_item->getExtraToDoStatusArray(); unset($status_array[$iid]); $context_item->setExtraToDoStatusArray($status_array); $context_item->save(); } } } $params = array(); if (empty($delete_id)) { $params['focus_element_onload'] = $change_id; } redirect($environment->getCurrentContextID(),'configuration', 'rubric_extras', $params); }elseif (!empty($command) and isOption($command, $translator->getMessage('CONFIGURATION_TODO_NEW_STATUS_BUTTON'))){ if (isset($_POST['new_status']) and !empty($_POST['new_status'])){ $context_item = $environment->getCurrentContextItem(); $status_array = $context_item->getExtraToDoStatusArray(); $status_number = 5; foreach ($status_array as $key => $value){ if ($key >= $status_number){ $status_number = $key+1; } } $status_array[$status_number] = $_POST['new_status']; $context_item->setExtraToDoStatusArray($status_array); $context_item->save(); $params = array(); $params['focus_element_onload'] = 'new_status'; redirect($environment->getCurrentContextID(),
$params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('MEMBER_EDIT_ERROR_ID')); $page->add($errorbox); $command = 'error'; } } else { if ( isOption($command_delete,$translator->getMessage('COMMON_USER_REJECT_BUTTON')) ) { $_POST['status'] = 'close'; } else { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(CONFIGURATION_FORM_VIEW,$params); unset($params); $form_view->setAction(curl($environment->getCurrentContextID(),'account','assignroom','')); $form_view->setForm($form); if ( $environment->inServer() or $environment->inPortal() ) { $page->addForm($form_view); } else { $page->add($form_view); }
public function actionAction() { $environment = $this->_environment; $class_factory = $environment->getClassFactory(); $translator = $environment->getTranslationObject(); $session_item = $environment->getSessionItem(); $action_array = $session_item->getValue('index_action'); #pr($action_array); // option contains the name of the submit button, if this // script is called as result of a form post if (!empty($_POST['option'])) { $command = $_POST['option']; } else { $command = ''; } if ($command != 'error') { #pr(1); if (isOption($command, $translator->getMessage('COMMON_CANCEL_BUTTON'))) { redirect($action_array['backlink']['cid'], $action_array['backlink']['mod'], $action_array['backlink']['fct'], $action_array['backlink']['par']); } else { #pr(2); $form = $class_factory->getClass(ACCOUNT_ACTION_FORM, array('environment' => $environment)); // init display data if (!empty($_POST)) { // second call of form: set post data $form->setFormPost($_POST); } $form->setActionArray($action_array); $form->prepareForm(); $form->loadValues(); $temp = $action_array['action']; $tempMessage = ""; switch ($temp) { case 'USER_ACCOUNT_DELETE': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_ACCOUNT_DELETE_BUTTON'); break; case 'USER_ACCOUNT_FREE': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_ACCOUNT_FREE_BUTTON'); break; case 'USER_ACCOUNT_LOCK': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_ACCOUNT_LOCK_BUTTON'); break; case 'USER_MAKE_CONTACT_PERSON': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_MAKE_CONTACT_PERSON_BUTTON'); break; case 'USER_STATUS_MODERATOR': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_STATUS_MODERATOR_BUTTON'); break; case 'USER_STATUS_USER': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_STATUS_USER_BUTTON'); break; case 'USER_UNMAKE_CONTACT_PERSON': $tempMessage = $translator->getMessage('INDEX_ACTION_PERFORM_USER_UNMAKE_CONTACT_PERSON_BUTTON'); break; default: $tempMessage = $translator->getMessage('COMMON_MESSAGETAG_ERROR'); break; } if (!empty($command) and (isOption($command, $tempMessage) or isOption(strtolower($command), strtolower($translator->getMessage('INDEX_ACTION_SEND_MAIL_BUTTON'))))) { #pr(4); $correct = $form->check(); if ($correct or !isset($_POST['with_mail'])) { $this->performAction($environment, $action_array, $_POST); if ($environment->getCurrentModule() != 'user') { redirect($action_array['backlink']['cid'], $action_array['backlink']['mod'], $action_array['backlink']['fct'], $action_array['backlink']['par']); } else { if ($mail_success) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = false; $detail_view = $class_factory->getClass(MAIL_VIEW, $params); unset($params); $detail_view->setFormalData($formal_data); ### $page->add($detail_view); } else { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW, $params); unset($params); if (!empty($mail_error_array)) { $error_string = $translator->getMessage('ERROR_SEND_EMAIL_TO'); foreach ($mail_error_array as $error) { $error = htmlentities($error, ENT_NOQUOTES, 'UTF-8'); $error = str_replace(',', BRLF, $error); $error_string .= BRLF . $error; } } else { $error_string = $translator->getMessage('ERROR_SEND_MAIL'); } $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = false; $detail_view = $class_factory->getClass(MAIL_VIEW, $params); unset($params); $detail_view->setFormalData($formal_data); $errorbox->setText($error_string); ### $page->add($errorbox); ### $page->add($detail_view); } } } } else { // display form if ($environment->getCurrentModule() == 'account') { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(CONFIGURATION_FORM_VIEW, $params); unset($params); } else { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(FORM_VIEW, $params); unset($params); } $params = array(); $form_view->setAction(curl($environment->getCurrentContextID(), $environment->getCurrentModule(), 'action', $params)); $form_view->setForm($form); if ($environment->inPortal() or $environment->inServer()) { ### $page->addForm($form_view); } else { ### $page->add($form_view); } } } } }
} } else { $idx = array_search($shown_key, $selected_ids); if ( $idx !== false ) { unset($selected_ids[$idx]); } } } } /////////////////////////////////////// // perform list actions // /////////////////////////////////////// #pr($_POST); if ( isOption($option,$translator->getMessage('COMMON_LIST_ACTION_BUTTON_GO')) and $_POST['index_view_action'] != '-1' and !empty($selected_ids) ) { // prepare action process switch ($_POST['index_view_action']) { case 1: $action = 'ENTRY_MARK_AS_READ'; $error = false; $user_manager = $environment->getUserManager(); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $user_item = $user_manager->getItem($id); $version_id = $user_item->getVersionID(); // Nur die UserItemID in die noticed DB einfügen?? $noticed_manager->markNoticed($id, $version_id );
} elseif ($status == 'moderator') { $subject = $translator->getMessage('MAIL_SUBJECT_USER_STATUS_MODERATOR',$context_item->getTitle()); $body = $translator->getEmailMessage('MAIL_BODY_HELLO',$user->getFullname()); $body .= LF.LF; $body .= $translator->getEmailMessage('MAIL_BODY_USER_STATUS_MODERATOR',$userid,$context_item->getTitle()); $body .= LF.LF; $body .= $translator->getEmailMessage('MAIL_BODY_CIAO',$current_user->getFullname(),$context_item->getTitle()); } else { include_once('functions/error_functions.php');trigger_error('lost change status',E_USER_ERROR); } $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?cid='.$environment->getCurrentContextID(); $body .= LF.LF.$url; $_POST['content'] = $body; } if ( !empty($command) AND isOption($command,$translator->getMessage('MAIL_SEND_BUTTON')) ) { $correct = $form->check(); if ( $correct ) { include_once('classes/cs_mail.php'); $mail = new cs_mail(); $mail->set_from_email($_POST['senderAddress']); $mail->set_from_name($_POST['senderName']); $mail->set_reply_to_email($_POST['senderAddress']); $mail->set_reply_to_name($_POST['senderName']); $mail->set_subject($_POST['subject']); $mail->set_message($_POST['content']); if ( is_array($_POST['receivers']) ) { $receivers = implode(",",$_POST['receivers']); } else { $receivers = $_POST['receivers']; }
}elseif (!empty($command) and isOption($command, $translator->getMessage('BUZZWORDS_NEW_BUTTON'))){ if (isset($_POST['new_buzzword']) and !empty($_POST['new_buzzword'])){ $buzzword_manager = $environment->getLabelManager(); $buzzword_item = $buzzword_manager->getNewItem(); $buzzword_item->setLabelType('buzzword'); $buzzword_item->setName($_POST['new_buzzword']); $buzzword_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $buzzword_item->setCreatorItem($user); $buzzword_item->setCreationDate(getCurrentDateTimeInMySQL()); $buzzword_item->save(); $params = array(); $params['focus_element_onload'] = 'new_buzzword'; redirect($environment->getCurrentContextID(), 'buzzwords', 'edit', $params); } }elseif (!empty($command) and isOption($command, $translator->getMessage('BUZZWORDS_COMBINE_BUTTON'))){ if ( (isset($_POST['sel1']) and !empty($_POST['sel1'])) and (isset($_POST['sel2']) and !empty($_POST['sel2'])) and (isset($_POST['sel1']) and isset($_POST['sel2']) and $_POST['sel1'] !=$_POST['sel2']) ){ $link_manager = $environment->getLinkManager(); $link_manager->combineBuzzwords($_POST['sel1'],$_POST['sel2']); $buzzword_manager = $environment->getLabelManager(); $buzzword_item1 = $buzzword_manager->getItem($_POST['sel1']); $buzzword_item2 = $buzzword_manager->getItem($_POST['sel2']); $buzzword_item1->setName($buzzword_item1->getName().'/'.$buzzword_item2->getName()); $buzzword_item1->setModificationDate(getCurrentDateTimeInMySQL()); $buzzword_item1->save(); $buzzword_item2->delete(); $params = array();
$session_item->setValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name',$_FILES['dates_upload']['name']); } } $values = array_merge($_POST,$_FILES); } else { $values = $_POST; } $form->setFormPost($values); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and isOption($command, $translator->getMessage('CONFIGURATION_AUTOACCOUNTS_UPLOAD_FILE_BUTTON')) ) { $correct = $form->check(); if ( $correct and empty($_FILES['dates_upload']['tmp_name']) and !empty($_POST['hidden_dates_upload_name']) ) { $session_item = $environment->getSessionItem(); if ( isset($session_item) ) { $current_iid = $environment->getCurrentContextID(); $_FILES['dates_upload']['tmp_name'] = $session_item->getValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_temp_name'); $_FILES['dates_upload']['name'] = $session_item->getValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name'); $session_item->unsetValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_temp_name'); $session_item->unsetValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name');
} else { $from = 1; } // Find current browsing interval // The browsing interval is applied to all rubrics! if ( isset($_GET['interval']) ) { $interval = $_GET['interval']; } elseif ( isset($_POST['interval']) ) { $interval = $_POST['interval']; } else { $interval = CS_LIST_INTERVAL; } if ( !empty($option) and (isOption($option, $translator->getMessage('COMMON_ITEM_ATTACH'))) ) { $entry_array = array(); $entry_new_array = array(); if ($session->issetValue('cid'.$environment->getCurrentContextID(). '_linked_items_index_selected_ids')) { $entry_array = $session->getValue('cid'.$environment->getCurrentContextID(). '_linked_items_index_selected_ids'); } if (isset($_POST['itemlist'])){ $selected_id_array = $_POST['itemlist']; foreach($selected_id_array as $id => $value){ $entry_new_array[] = $id; } } $entry_array = array_merge($entry_array,$entry_new_array);
function execute() { $success = false; $form = $this->_class_factory->getClass(ACCOUNT_FORGET_FORM, array('environment' => $this->_environment)); // Load form data from postvars if (!empty($this->_post_vars)) { $form->setFormPost($this->_post_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and (isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON')) or isOption($this->_command, $this->_translator->getMessage('COMMON_FORWARD_BUTTON')))) { $this->_redirect_back(); } // get accounts if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('ACCOUNT_SEND_BUTTON'))) { $correct = $form->check(); if ($correct) { $user_manager = $this->_environment->getUserManager(); $user_manager->resetLimits(); $user_manager->setContextLimit($this->_environment->getCurrentPortalID()); /* * email must match(not only be like) database entry to avoid finding to much identifications */ //$user_manager->setSearchLimit($this->_post_vars['email']); $user_manager->setEmailLimit($this->_post_vars['email']); $user_manager->select(); $user_list = $user_manager->get(); $account_text = ''; $user_fullname = ' '; $portal_item = $this->_environment->getCurrentPortalItem(); $user_item = $user_list->getFirst(); $show_auth_source = false; while ($user_item) { if (isset($auth_source_id) and $auth_source_id != $user_item->getAuthSource()) { $show_auth_source = true; break; } else { $auth_source_id = $user_item->getAuthSource(); } $user_item = $user_list->getNext(); } $first = true; $user_item = $user_list->getFirst(); while ($user_item) { if ($first) { $first = false; } else { $account_text .= LF; } $account_text .= $user_item->getUserID(); if ($show_auth_source) { $auth_souce_item = $portal_item->getAuthSource($user_item->getAuthSource()); $account_text .= ' (' . $auth_souce_item->getTitle() . ')'; } $user_fullname = $user_item->getFullname(); $user_item = $user_list->getNext(); } $user_email = $this->_post_vars['email']; // send email $context_item = $this->_environment->getCurrentPortalItem(); $mod_text = ''; $mod_list = $context_item->getContactModeratorList(); if (!$mod_list->isEmpty()) { $mod_item = $mod_list->getFirst(); $contact_moderator = $mod_item; while ($mod_item) { if (!empty($mod_text)) { $mod_text .= ',' . LF; } $mod_text .= $mod_item->getFullname(); $mod_text .= ' (' . $mod_item->getEmail() . ')'; $mod_item = $mod_list->getNext(); } } $translator = $this->_environment->getTranslationObject(); include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to($user_email); $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('@'); } if (isset($contact_moderator)) { $mail->set_reply_to_email($contact_moderator->getEmail()); $mail->set_reply_to_name($contact_moderator->getFullname()); } $mail->set_from_name($this->_translator->getMessage('SYSTEM_MAIL_MESSAGE', $context_item->getTitle())); $mail->set_subject($translator->getMessage('USER_ACCOUNT_FORGET_MAIL_SUBJECT', $context_item->getTitle())); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_HELLO', $user_fullname); $body .= LF . LF; $body .= $this->_translator->getMessage('USER_ACCOUNT_FORGET_MAIL_BODY', $context_item->getTitle(), $account_text); $body .= LF . LF; if (empty($contact_moderator)) { $body .= $translator->getMessage('SYSTEM_MAIL_REPLY_INFO') . LF; $body .= $mod_text; $body .= LF . LF; } else { $body .= $translator->getEmailMessage('MAIL_BODY_CIAO', $contact_moderator->getFullname(), $context_item->getTitle()); $body .= LF . LF; } $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID(); $mail->set_message($body); if ($mail->send()) { // show little status page that mail was sent successful $form->showMailSent($user_email); } else { // show little status page that mail was not sent successful $form->showMailFailure(); } } } return $this->_show_form($form); }
$context_item = $environment->getCurrentContextItem(); /* setup the form */ // Construct the form $form = $class_factory->getClass(ACCOUNT_PASSWORD_ADMIN_FORM,array('environment' => $environment)); /* we are not called as a result of a form post, so just display the form */ if ( empty($command) and !empty($_GET['iid']) ) { $form->setItem($user); $form->prepareForm(); $form->loadValues(); } /* we called ourself as result of a form post */ elseif ( isOption($command,$translator->getMessage('PASSWORD_CHANGE_BUTTON_LONG')) ) { $error_string = ''; $form->setFormPost($_POST); $form->prepareForm(); $form->loadValues(); if ( $form->check() ) { // change password if (empty($error_string)) { $auth_manager = $authentication->getAuthManager($user->getAuthSource()); $auth_manager->changePassword($_POST['user_id'],$_POST['password']); // set new expire date $portal_manager = $environment->getPortalManager(); $portal_item = $portal_manager->getItem($user->getContextID()); $user->setPasswordExpireDate($portal_item->getPasswordExpiration()); $user->save(); unset($portal_manager);
} if (($seldisplay_mode=='calendar' or $seldisplay_mode == 'calendar_month') and !($mode == 'formattach' or $mode == 'detailattach') ){ $count_all_shown = $list->getCount(); } if (isset($_GET['select']) and $_GET['select']=='all'){ $item = $list->getFirst(); while($item){ if ( !in_array($item->getItemID(), $selected_ids) ) { $selected_ids[] = $item->getItemID(); } $item = $list->getNext(); } } if (isOption($option,$translator->getMessage('COMMON_LIST_ACTION_BUTTON_GO')) and $_POST['index_view_action'] != '3'){ $selected_ids = array(); } $id_array = array(); $item = $list->getFirst(); while ($item){ $id_array[] = $item->getItemID(); $item = $list->getNext(); } $noticed_manager = $environment->getNoticedManager(); $noticed_manager->getLatestNoticedByIDArray($id_array); $noticed_manager->getLatestNoticedAnnotationsByIDArray($id_array); $link_manager = $environment->getLinkManager(); $file_id_array = $link_manager->getAllFileLinksForListByIDs($id_array); $file_manager = $environment->getFileManager();
else { include_once('functions/error_functions.php'); trigger_error('group_edit was called in an unknown manner', E_USER_ERROR); } if ($session->issetValue($current_iid.'_discussion_notification')) { $form->setSessionDiscussionNotificationArray($session->getValue($current_iid.'_discussion_notification')); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and (isOption($command, $translator->getMessage('GROUP_SAVE_BUTTON')) or isOption($command, $translator->getMessage('GROUP_CHANGE_BUTTON'))) ) { $correct = $form->check(); if ( $correct and empty($_FILES['picture_upload']['tmp_name']) and !empty($_POST['hidden_picture_upload_name']) ) { $session_item = $environment->getSessionItem(); if ( isset($session_item) ) { $_FILES['picture_upload']['tmp_name'] = $session_item->getValue($environment->getCurrentContextID().'_group_'.$current_iid.'_picture_temp_name'); $_FILES['picture_upload']['name'] = $session_item->getValue($environment->getCurrentContextID().'_group_'.$current_iid.'_picture_name'); $session_item->unsetValue($environment->getCurrentContextID().'_group_'.$current_iid.'_picture_temp_name'); $session_item->unsetValue($environment->getCurrentContextID().'_group_'.$current_iid.'_picture_name'); } } if ( $correct
} } // delete item if ( !empty($command) and isOption($command, $translator->getMessage('WIKI_DELETE_BUTTON')) ) { $params = $environment->getCurrentParameterArray(); $page->addDeleteBox(curl($environment->getCurrentContextID(),module2type($environment->getCurrentModule()),$environment->getCurrentFunction(),$params)); } // Save item elseif ( !empty($command) and (isOption($command, $translator->getMessage('WIKI_SAVE_BUTTON')) or isOption($command, $translator->getMessage('COMMON_CHANGE_BUTTON')) ) ) { if ( $form->check() ) { // Set modificator and modification date $current_user = $environment->getCurrentUserItem(); $item->setModificatorItem($current_user); $item->setModificationDate(getCurrentDateTimeInMySQL()); if ( isset($_POST['wikilink']) and !empty($_POST['wikilink']) and $_POST['wikilink'] == 1) { $item->setWikiHomeLink(); } else { $item->unsetWikiHomeLink(); } if ( isset($_POST['wikilink2']) and !empty($_POST['wikilink2']) and $_POST['wikilink2'] == 1) { $item->setWikiPortalLink();
public function actionEdit() { //$this->assign('detail', 'content', $this->getDetailContent()); $session = $this->_environment->getSessionItem(); // get post data $this->getPostData(); /* * * // Linked item from "NEW" dropdown-menu if(isset($_GET['linked_item'])){ $entry_new_array = array(); $entry_new_array[] = $_GET['linked_item']; $session->setValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids',$entry_new_array); } if(isset($_GET['mylist_id'])){ $session->setValue('cid'.$environment->getCurrentContextID().'_linked_items_mylist_id',$_GET['mylist_id']); } // Function used for redirecting to connected rubrics if (isset($_GET['return_attach_buzzword_list'])){ $_POST = $session->getValue('buzzword_post_vars'); unset($_POST['option']); unset($_POST['right_box_option']); } if (isset($_GET['return_attach_tag_list'])){ $_POST = $session->getValue('tag_post_vars'); unset($_POST['option']); unset($_POST['right_box_option']); } if (isset($_GET['return_attach_item_list'])){ $_POST = $session->getValue('linked_items_post_vars'); unset($_POST['option']); unset($_POST['right_box_option']); } // Function used for cleaning up the session. This function // deletes ALL session variables this page writes. function cleanup_session ($current_iid) { global $session,$environment; $session->unsetValue($environment->getCurrentModule().'_add_buzzwords'); $session->unsetValue($environment->getCurrentModule().'_add_tags'); $session->unsetValue($environment->getCurrentModule().'_add_files'); $session->unsetValue($current_iid.'_post_vars'); } // Get the current user and context $current_user = $environment->getCurrentUserItem(); $context_item = $environment->getCurrentContextItem(); // Get the translator object $translator = $environment->getTranslationObject(); // Get item to be edited if ( !empty($_GET['iid']) ) { $current_iid = $_GET['iid']; } elseif ( !empty($_POST['iid']) ) { $current_iid = $_POST['iid']; } else { $current_iid = 'NEW'; } $with_anchor = false; // Coming back from attaching something if ( !empty($_GET['backfrom']) ) { $backfrom = $_GET['backfrom']; } else { $backfrom = false; } // Load item from database if ( $current_iid == 'NEW' ) { $discussion_item = NULL; } else { $discussion_manager = $environment->getDiscussionManager(); $discussion_item = $discussion_manager->getItem($current_iid); if(empty($_POST)){ $buzzword_array = array(); $buzzwords = $discussion_item->getBuzzwordList(); $buzzword = $buzzwords->getFirst(); while($buzzword){ $buzzword_array[] = $buzzword->getItemID(); $buzzword = $buzzwords->getNext(); } $session->setValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids',$buzzword_array); } if(empty($_POST)){ $tag_array = array(); $tags = $discussion_item->getTagList(); $tag = $tags->getFirst(); while($tag){ $tag_array[] = $tag->getItemID(); $tag = $tags->getNext(); } $session->setValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids',$tag_array); } if(empty($_POST)){ $link_item_array = array(); $link_item_array = $discussion_item->getAllLinkedItemIDArray(); $session->setValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids',$link_item_array); } } // Check access rights if ( $context_item->isProjectRoom() and $context_item->isClosed() ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('PROJECT_ROOM_IS_CLOSED', $context_item->getTitle())); $page->add($errorbox); } elseif ( $current_iid != 'NEW' and !isset($discussion_item) ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('ITEM_DOES_NOT_EXIST', $current_iid)); $page->add($errorbox); } elseif ( !(($current_iid == 'NEW' and $current_user->isUser()) or ($current_iid != 'NEW' and isset($discussion_item) and $discussion_item->mayEditIgnoreClose($current_user))) ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED')); $page->add($errorbox); } // Access granted else { // Find out what to do if ( isset($_POST['option']) ) { $command = $_POST['option']; } else { $command = ''; } // Cancel editing if ( isOption($command, $translator->getMessage('COMMON_CANCEL_BUTTON')) ) { $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids'); $session->unsetValue('buzzword_post_vars'); $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids'); $session->unsetValue('tag_post_vars'); $session->unsetValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids'); $session->unsetValue('linked_items_post_vars'); cleanup_session($current_iid); if ( $current_iid == 'NEW' ) { redirect($environment->getCurrentContextID(), 'discussion', 'index', ''); } else { $params = array(); $params['iid'] = $current_iid; redirect($environment->getCurrentContextID(), 'discussion', 'detail', $params); } } // Show form and/or save item else { // Initialize the form $class_params= array(); $class_params['environment'] = $environment; $form = $class_factory->getClass(DISCUSSION_FORM,$class_params); unset($class_params); include_once('include/inc_fileupload_edit_page_handling.php'); include_once('include/inc_right_boxes_handling.php'); // Load form data from postvars if ( !empty($_POST) ) { if (empty($session_post_vars)){ $session_post_vars = $_POST; } if ( isset($post_file_ids) AND !empty($post_file_ids) ) { $session_post_vars['filelist'] = $post_file_ids; } if ( isset($post_buzzword_ids) AND !empty($post_buzzword_ids) ) { $session_post_vars['buzzwordlist'] = $post_buzzword_ids; } if ( isset($post_tag_ids) AND !empty($post_tag_ids) ) { $session_post_vars['taglist'] = $post_tag_ids; } $form->setFormPost($session_post_vars); } // Back from multi upload elseif ( $from_multiupload ) { $session_post_vars = array(); if ( isset($post_file_ids) AND !empty($post_file_ids) ) { $session_post_vars['filelist'] = $post_file_ids; } $form->setFormPost($session_post_vars); } // Load form data from database elseif ( isset($discussion_item) ) { $form->setItem($discussion_item); // Files $file_list = $discussion_item->getFileList(); if ( !$file_list->isEmpty() ) { $file_array = array(); $file_item = $file_list->getFirst(); while ( $file_item ) { $temp_array = array(); $temp_array['name'] = $file_item->getDisplayName(); $temp_array['file_id'] = (int)$file_item->getFileID(); $file_array[] = $temp_array; $file_item = $file_list->getNext(); } if ( !empty($file_array)) { $session->setValue($environment->getCurrentModule().'_add_files', $file_array); } } } // Create data for a new item elseif ( $current_iid == 'NEW' ) { cleanup_session($current_iid); } else { include_once('functions/error_functions.php');trigger_error('discussion_edit was called in an unknown manner', E_USER_ERROR); } // If it is a new discussion, also show the text field for // the initial discussion article if ( $current_iid == 'NEW' ) { $form->setNewDiscussion(true); } else { $form->setNewDiscussion(false); } if ($session->issetValue($environment->getCurrentModule().'_add_files')) { $form->setSessionFileArray($session->getValue($environment->getCurrentModule().'_add_files')); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and (isOption($command, $translator->getMessage('DISCUSSIONS_SAVE_BUTTON')) or isOption($command, $translator->getMessage('DISCUSSIONS_CHANGE_BUTTON'))) ) { $correct = $form->check(); if ( $correct ) { $item_is_new = false; // New Item? if ( !isset($discussion_item) ) { $new_discussion = true; } else { $new_discussion = false; } if ($new_discussion) { $discussion_manager = $environment->getDiscussionManager(); $discussion_item = $discussion_manager->getNewItem(); $discussion_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $discussion_item->setCreatorItem($user); $discussion_item->setCreationDate(getCurrentDateTimeInMySQL()); $item_is_new = true; } // Set modificator and modification date $user = $environment->getCurrentUserItem(); $discussion_item->setModificatorItem($user); // Set attributes if ( isset($_POST['title']) ) { $discussion_item->setTitle($_POST['title']); } if ( isset($_POST['public']) ) { if ( $discussion_item->isPublic() != $_POST['public'] ) { $discussion_item->setPublic($_POST['public']); } } else { if ( isset($_POST['private_editing']) ) { $discussion_item->setPrivateEditing('0'); } else { $discussion_item->setPrivateEditing('1'); } } if ( isset($_POST['external_viewer']) and isset($_POST['external_viewer_accounts']) ) { $user_ids = explode(" ",$_POST['external_viewer_accounts']); $discussion_item->setExternalViewerAccounts($user_ids); }else{ $discussion_item->unsetExternalViewerAccounts(); } if ( isset($_POST['hide']) ) { // variables for datetime-format of end and beginning $dt_hiding_time = '00:00:00'; $dt_hiding_date = '9999-00-00'; $dt_hiding_datetime = ''; $converted_day_start = convertDateFromInput($_POST['dayStart'],$environment->getSelectedLanguage()); if ($converted_day_start['conforms'] == TRUE) { $dt_hiding_datetime = $converted_day_start['datetime'].' '; $converted_time_start = convertTimeFromInput($_POST['timeStart']); if ($converted_time_start['conforms'] == TRUE) { $dt_hiding_datetime .= $converted_time_start['datetime']; }else{ $dt_hiding_datetime .= $dt_hiding_time; } }else{ $dt_hiding_datetime = $dt_hiding_date.' '.$dt_hiding_time; } $discussion_item->setModificationDate($dt_hiding_datetime); }else{ if($discussion_item->isNotActivated()){ $discussion_item->setModificationDate(getCurrentDateTimeInMySQL()); } } if ($session->issetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids')){ $discussion_item->setBuzzwordListByID($session->getValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids')); $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids'); } if ($session->issetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids')){ $discussion_item->setTagListByID($session->getValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids')); $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids'); } if ($session->issetValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids')){ $discussion_item->setLinkedItemsByIDArray(array_unique($session->getValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids'))); $session->unsetValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids'); } // Save item $discussion_item->save(); if ($session->issetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_index_ids')){ $id_array = array_reverse($session->getValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_index_ids')); }else{ $id_array = array(); } if ($item_is_new){ $id_array[] = $discussion_item->getItemID(); $id_array = array_reverse($id_array); $session->setValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_index_ids',$id_array); } // Also save the initial discussion article if ( $new_discussion ) { $discarticle_manager = $environment->getDiscussionArticlesManager(); $discarticle_item = $discarticle_manager->getNewItem(); $discarticle_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $discarticle_item->setCreatorItem($user); $discarticle_item->setCreationDate(getCurrentDateTimeInMySQL()); $discarticle_item->setDiscussionID($discussion_item->getItemId()); if (isset($_POST['subject'])) { $discarticle_item->setSubject($_POST['subject']); } if ( isset($_POST['description'])) { $discarticle_item->setDescription($_POST['description']); } if (isset($_POST['discussion_type']) and $_POST['discussion_type']==2){ $discarticle_item->setPosition('1'); } $item_files_upload_to = $discarticle_item; include_once('include/inc_fileupload_edit_page_save_item.php'); $discarticle_item->save(); // ... and update the discussion item $discussion_item->setLatestArticleID($discarticle_item->getItemID()); $discussion_item->setLatestArticleModificationDate($discarticle_item->getCreationDate()); $discussion_status = $context_item->getDiscussionStatus(); if ($discussion_status == 3){ if ($_POST['discussion_type']==2){ $discussion_item->setDiscussionType('threaded'); }else{ $discussion_item->setDiscussionType('simple'); } }elseif($discussion_status == 2){ $discussion_item->setDiscussionType('threaded'); }else{ $discussion_item->setDiscussionType('simple'); } $discussion_item->save(); } if ($session->issetValue('cid'.$environment->getCurrentContextID().'_linked_items_mylist_id')){ $mylist_manager = $environment->getMylistManager(); $mylist_item = $mylist_manager->getItem($session->getValue('cid'.$environment->getCurrentContextID().'_linked_items_mylist_id')); $id_array = $mylist_item->getAllLinkedItemIDArrayLabelVersion(); if (!in_array($discussion_item->getItemID(),$id_array)){ $id_array[] = $discussion_item->getItemID(); } $mylist_item->saveLinksByIDArray($id_array); } $session->unsetValue('cid'.$environment->getCurrentContextID().'_linked_items_mylist_id'); // Redirect cleanup_session($current_iid); $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_buzzword_ids'); $session->unsetValue('buzzword_post_vars'); $session->unsetValue('cid'.$environment->getCurrentContextID().'_'.$environment->getCurrentModule().'_tag_ids'); $session->unsetValue('tag_post_vars'); $session->unsetValue('cid'.$environment->getCurrentContextID().'_linked_items_index_selected_ids'); $session->unsetValue('linked_items_post_vars'); $params = array(); $params['iid'] = $discussion_item->getItemID();; redirect($environment->getCurrentContextID(), 'discussion', 'detail', $params); } } // Display form $class_params = array(); $class_params['environment'] = $environment; $class_params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(FORM_VIEW,$class_params); unset($class_params); if ($with_anchor){ $form_view->withAnchor(); } if (!mayEditRegular($current_user, $discussion_item)) { $form_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')); $page->add($errorbox); } $form_view->setAction(curl($environment->getCurrentContextID(),'discussion','edit','')); $form_view->setForm($form); $page->add($form_view); } } ?> */ if ($this->_item_id !== null) { $discarticle_manager = $this->_environment->getDiscussionArticlesManager(); $this->_item = $discarticle_manager->getItem($this->_item_id); } // find the discussion this article belongs to if ($this->_item !== NULL) { $discussion_id = $this->_item->getDiscussionID(); $ref_position = $this->_item->getPosition(); } else { if (!empty($_GET['did'])) { $discussion_id = $_GET['did']; } elseif (!empty($_POST['discussion_id'])) { $discussion_id = $_POST['discussion_id']; } elseif (!empty($_GET['discussion_id'])) { $discussion_id = $_GET['discussion_id']; } else { /* if ( $session->issetValue($current_iid.'_post_vars') ) { $session_postvars = $session->getValue($current_iid.'_post_vars'); if ( isset($session_postvars['discussion_id']) ) { $discussion_id = $session_postvars['discussion_id']; } else { include_once('functions/error_functions.php');trigger_error('A discussion id must be given for new discussion articles.', E_USER_ERROR); } } elseif ( $session->issetValue($environment->getCurrentModule().'_multi_upload_post_vars') ) { $session_postvars = $session->getValue($environment->getCurrentModule().'_multi_upload_post_vars'); if ( isset($session_postvars['discussion_id']) ) { $discussion_id = $session_postvars['discussion_id']; } else { include_once('functions/error_functions.php');trigger_error('Lost discussion id for discussion articles.', E_USER_ERROR); } } else { include_once('functions/error_functions.php');trigger_error('A discussion id must be given for new discussion articles.', E_USER_ERROR); } */ } /* $discussion_manager = $this->_environment->getDiscussionManager(); $discussion = $discussion_manager->getItem($discussion_id); /* * $discussion_type = $discussion->getDiscussionType(); $ref_position = '1'; if ( $discussion_type == 'threaded' ) { if ( !empty($_GET['ref_position']) ) { $ref_position = $_GET['ref_position']; } elseif ( !empty($_POST['ref_position']) ) { $ref_position = $_POST['ref_position']; } elseif ( !empty($_GET['ref_position']) ) { $ref_position = $_GET['ref_position']; } else { if ( $session->issetValue($current_iid.'_post_vars') ) { $session_postvars = $session->getValue($current_iid.'_post_vars'); if ( isset($session_postvars['ref_position']) ) { $ref_position = $session_postvars['ref_position']; } else { include_once('functions/error_functions.php');trigger_error('A ref_position id must be given for new discussion articles.', E_USER_ERROR); } } elseif ( $session->issetValue($environment->getCurrentModule().'_multi_upload_post_vars') ) { $session_postvars = $session->getValue($environment->getCurrentModule().'_multi_upload_post_vars'); if ( isset($session_postvars['ref_position']) ) { $ref_position = $session_postvars['ref_position']; } else { include_once('functions/error_functions.php');trigger_error('A ref_position id must be given for new discussion articles.', E_USER_ERROR); } } else { include_once('functions/error_functions.php');trigger_error('A ref_position id must be given for new discussion articles.', E_USER_ERROR); } } if ( !empty($_GET['ref_did']) ) { $ref_did = $_GET['ref_did']; } elseif ( !empty($_POST['ref_did']) ) { $ref_did = $_POST['ref_did']; }elseif ( !empty($_GET['ref_did']) ) { $ref_did = $_GET['ref_did']; } } */ } /* // Check access rights if ( $context_item->isProjectRoom() and $context_item->isClosed() ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('PROJECT_ROOM_IS_CLOSED', $context_item->getTitle())); $page->add($errorbox); } elseif ( $current_iid != 'NEW' and !isset($discarticle_item) ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('ITEM_DOES_NOT_EXIST', $current_iid)); $page->add($errorbox); } elseif ( !(($current_iid == 'NEW' and $current_user->isUser()) or ($current_iid != 'NEW' and isset($discarticle_item) and $discarticle_item->mayEdit($current_user))) ) { $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED')); $page->add($errorbox); } // Access granted else { */ $translator = $this->_environment->getTranslationObject(); // cancel editing if (isOption($this->_command, $translator->getMessage('COMMON_CANCEL_BUTTON'))) { /* if (isset($discarticle_item) and !empty($discarticle_item)){ $discarticle_id = 'anchor'.$discarticle_item->getItemID(); } else { $discarticle_id = ''; } cleanup_session($current_iid); if ( $current_iid == 'NEW' and empty($discussion_id) ) { redirect($environment->getCurrentContextID(), 'discussion', 'index', ''); } else { $params = array(); $params['iid'] = $discussion_id; redirect($environment->getCurrentContextID(), 'discussion', 'detail', $params, $discarticle_id); } */ // show form and/or save item } else { if (isset($_GET['back_to_discussion_detail_view']) && !empty($command) && !(isOption($command, $translator->getMessage('DISCARTICLE_SAVE_BUTTON')) || isOption($command, $translator->getMessage('DISCARTICLE_CHANGE_BUTTON')))) { /* // Handle requests from discussion_detail_view if( isset($_GET['back_to_discussion_detail_view']) && !empty($command) && !(isOption($command, $translator->getMessage('DISCARTICLE_SAVE_BUTTON')) || isOption($command, $translator->getMessage('DISCARTICLE_CHANGE_BUTTON'))) ) { $session_item = $environment->getSessionItem(); if( (!$session_item->issetValue($environment->getCurrentModule().'_add_files') && isset($discarticle_item))) { // get files from database $file_list = $discarticle_item->getFileList(); if ( !$file_list->isEmpty() ) { $file_array = array(); $file_item = $file_list->getFirst(); while ( $file_item ) { $temp_array = array(); $temp_array['name'] = $file_item->getDisplayName(); $temp_array['file_id'] = (int)$file_item->getFileID(); $file_array[] = $temp_array; $file_item = $file_list->getNext(); } if ( !empty($file_array)) { $session->setValue($environment->getCurrentModule().'_add_files', $file_array); } } } include_once('include/inc_fileupload_edit_page_handling.php'); */ $post_file_ids = array(); if (isset($_POST['filelist'])) { $post_file_ids = $_POST['filelist']; } // set session post vars $session_post_vars = $_POST; if (isset($post_file_ids) && !empty($post_file_ids)) { $session_post_vars['filelist'] = $post_file_ids; } $session_item->setValue('back_to_discussion_detail_view_postvars', $session_post_vars); if (isset($discarticle_item)) { $session_item->setValue('back_to_discussion_detail_view_last_upload', 'edit' . $discarticle_item->getItemID()); } else { $session_item->setValue('back_to_discussion_detail_view_last_upload', 'new' . $_GET['answer_to']); } // redirect //cleanup_session($current_iid); /* * // Redirect //cleanup_session($current_iid); $params = array(); $params['iid'] = $_POST['discussion_id']; $anchor = ''; if($_GET['back_to_discussion_detail_view'] == 'new') { // new $params['ref_position'] = $_POST['ref_position']; $params['answer_to'] = $_GET['answer_to']; } else { // edit $params['discarticle_action'] = 'edit'; $params['discarticle_iid'] = $discarticle_item->getItemID(); } redirect( $environment->getCurrentContextID(), 'discussion', 'detail', $params, 'discarticle_form'); * * */ } /* // Initialize the form $class_params= array(); $class_params['environment'] = $environment; $form = $class_factory->getClass(DISCARTICLE_FORM,$class_params); unset($class_params); $form->setDiscussionID($discussion_id); $form->setRefPosition($ref_position); if (isset($ref_did)){ $form->setRefDid($ref_did); } */ $post_file_ids = array(); if (isset($_POST['filelist'])) { $post_file_ids = $_POST['filelist']; } // load form data from postvars if (!empty($_POST)) { $session_post_vars = $_POST; if (isset($post_file_ids) && !empty($post_file_ids)) { $session_post_vars['filelist'] = $post_file_ids; } //$form->setFormPost($session_post_vars); } elseif (isset($this->_item)) { /* * $form->setItem($discarticle_item); // Files $file_list = $discarticle_item->getFileList(); if ( !$file_list->isEmpty() ) { $file_array = array(); $file_item = $file_list->getFirst(); while ( $file_item ) { $temp_array = array(); $temp_array['name'] = $file_item->getDisplayName(); $temp_array['file_id'] = (int)$file_item->getFileID(); $file_array[] = $temp_array; $file_item = $file_list->getNext(); } if ( !empty($file_array)) { $session->setValue($environment->getCurrentModule().'_add_files', $file_array); } } */ } elseif ($this->_item_id === null) { $this->cleanup_session($this->_item_id); } else { include_once 'functions/error_functions.php'; trigger_error('discarticle_edit was called in an unknown manner', E_USER_ERROR); } if ($session->issetValue($this->_environment->getCurrentModule() . '_add_files')) { //$form->setSessionFileArray($session->getValue($environment->getCurrentModule().'_add_files')); //die("UPLOAD"); } // save item if ($this->_command === 'new') { // TODO: implement form check $correct = true; if ($correct) { // create new item if (!isset($this->_item)) { $discarticle_manager = $this->_environment->getDiscussionArticlesManager(); $discarticle_item = $discarticle_manager->getNewItem(); $discarticle_item->setContextID($this->_environment->getCurrentContextID()); $user = $this->_environment->getCurrentUserItem(); $discarticle_item->setCreatorItem($user); $discarticle_item->setCreationDate(getCurrentDateTimeInMySQL()); $discarticle_item->setDiscussionID($discussion_id); $discussion_manager = $this->_environment->getDiscussionManager(); $discussion_item = $discussion_manager->getItem($discussion_id); $discussion_type = $discussion_item->getDiscussionType(); if ($discussion_type === 'threaded') { // load discussion articles /* $discussionarticles_manager = $environment->getDiscussionArticlesManager(); $discussionarticles_manager->setDiscussionLimit($discussion_id,''); $discussionarticles_manager->select(); $articles_list = $discussionarticles_manager->get(); $article = $articles_list->getFirst(); $position_array = array(); while($article){ $article_position = $article->getPosition(); if ($article_position > $ref_position){ $position_array[]= $article_position; } $article= $articles_list->getNext(); } sort($position_array); $in = in_array($ref_position.'.1001',$position_array); if (!$in){ $discarticle_item->setPosition($ref_position.'.1001'); } else { $ref_pos_array = explode('.',$ref_position); $compare_array = array(); $end = count($position_array)-1; for ($i = 0; $i <= $end; $i++){ $value_array = explode('.',$position_array[$i]); $in = true; $end2 = count($ref_pos_array)-1; for ($j = 0; $j <= $end2; $j++){ if ( isset($value_array[$j]) and $ref_pos_array[$j] != $value_array[$j]){ $in = false; } } if ($in and count($value_array) == count($ref_pos_array)+1){ $compare_array[] = $value_array[count($ref_pos_array)]; } } $lenght = count($compare_array)-1; $result = $compare_array[$lenght]; $end_result = $result+1; $discarticle_item->setPosition($ref_position.'.'.$end_result); */ } else { $discarticle_item->setPosition('1'); } } // set modificator and modification date $user = $this->_environment->getCurrentUserItem(); $discarticle_item->setModificatorItem($user); $discarticle_item->setModificationDate(getCurrentDateTimeInMySQL()); // set attributes if (isset($_POST['form_data']['title'])) { $discarticle_item->setSubject($_POST['form_data']['title']); } if (isset($_POST['form_data']['description'])) { $discarticle_item->setDescription($_POST['form_data']['description']); } // set links to connected rubrics if (isset($_POST[CS_MATERIAL_TYPE])) { $discarticle_item->setMaterialListByID($_POST[CS_MATERIAL_TYPE]); } else { $discarticle_item->setMaterialListByID(array()); } $this->setFilesForItem($discarticle_item, $post_file_ids); // save item $discarticle_item->save(); // redirect $this->cleanup_session($this->_item_id); $params = array(); $params['iid'] = $discarticle_item->getDiscussionID(); redirect($this->_environment->getCurrentContextID(), 'discussion', 'detail', $params, 'disc_article_' . $discarticle_item->getItemID()); } } /* // Display form $class_params = array(); $class_params['environment'] = $environment; $class_params['with_modifying_actions'] = true; $form_view = $class_factory->getClass(FORM_VIEW,$class_params); unset($class_params); if ($with_anchor){ $form_view->withAnchor(); } $discussion_manager = $environment->getDiscussionManager(); if ( isset($discarticle_item) ){ $discussion_item = $discussion_manager->getItem($discarticle_item->getDiscussionID()); if (!mayEditRegular($current_user, $discarticle_item)) { $form_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')); $page->add($errorbox); } } $form_view->setAction(curl($environment->getCurrentContextID(),'discarticle','edit','')); $form_view->setForm($form); $page->add($form_view);*/ } /* } */ // mark as read and noticed //$this->markRead(); //$this->markNoticed(); // set list actions //$this->assign('list', 'actions', $this->getListActions()); /* // set paging information $paging = array( 'num_pages' => ceil($this->_num_entries / $this->_paging['limit']), 'actual_page' => floor($this->_paging['offset'] / $this->_paging['limit']) + 1, 'from' => $this->_paging['offset'] + 1, 'to' => $this->_paging['offset'] + $this->_paging['limit'] ); $this->assign('list', 'paging', $paging); $this->assign('list', 'num_entries', $this->_num_entries); */ }
} } $values['show'] = true; $array = $room_item->_getExtra('USAGE_INFO'); if ( !empty($array) and in_array($values['info_text'].'_no',$room_item->_getExtra('USAGE_INFO')) ){ $values['show'] = false; } $values['title'] = $room_item->getUsageInfoHeaderForRubric($values['info_text']); $values['text'] = $room_item->getUsageInfoTextForRubricInForm($values['info_text']); $values['text_form'] = $room_item->getUsageInfoTextForRubricFormInForm($values['info_text']); // Load form data from postvars $form->setFormPost($values); } // Save item if ( !empty($command) and isOption($command, $translator->getMessage('PREFERENCES_SAVE_BUTTON')) ) { $correct = $form->check(); if ( $correct ) { $info_array = array(); if (is_array($room_item->_getExtra('USAGE_INFO'))) { $info_array = $room_item->_getExtra('USAGE_INFO'); } $do_not_show = false; if (!empty($_POST['info_text'])){ if (empty($_POST['show'])) { $do_not_show = true; } if ( empty($info_array) and $do_not_show ){ $info_array[] = $_POST['info_text']; $room_item->setUsageInfoArray($info_array); }
function execute() { $success = false; $class_params = array(); $class_params['environment'] = $this->_environment; $form = $this->_class_factory->getClass(HOME_MEMBER2_FORM, $class_params); unset($class_params); // Load form data from postvars if (!empty($this->_post_vars)) { $form->setFormPost($this->_post_vars); } if (!empty($this->_get_vars)) { $form->setFormGet($this->_get_vars); } $form->prepareForm(); $form->loadValues(); // cancel if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('COMMON_CANCEL_BUTTON'))) { $this->_redirect_back(); } // Save item if (!empty($this->_command) and isOption($this->_command, $this->_translator->getMessage('ACCOUNT_GET_BUTTON'))) { $correct = $form->check(); if ($correct) { if (isset($this->_post_vars['auth_source']) and !empty($this->_post_vars['auth_source'])) { $auth_source = $this->_post_vars['auth_source']; } else { include_once 'functions/error_functions.php'; trigger_error('lost auth source', E_USER_ERROR); } $portal_item = $this->_environment->getCurrentPortalItem(); $auth_source_item = $portal_item->getAuthSource($auth_source); $redirect_to_login = true; // CAS if ($auth_source_item->getSourceType() == 'CAS') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'Typo3') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'Joomla') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'MYSQL') { $redirect_to_login = false; } elseif ($auth_source_item->getSourceType() == 'LDAP') { $redirect_to_login = false; } elseif ($auth_source_item->isCommSyDefault()) { $redirect_to_login = false; } if ($redirect_to_login) { // if someting is wrong $params = $this->_environment->getCurrentParameterArray(); unset($params['cs_modus']); redirect($this->_environment->getCurrentContextID(), 'home', 'index', $params); exit; } // Create new item $authentication = $this->_environment->getAuthenticationObject(); $new_account = $authentication->getNewItem(); $new_account->setUserID($this->_post_vars['user_id']); $new_account->setFirstname($this->_post_vars['firstname']); $new_account->setLastname($this->_post_vars['lastname']); $new_account->setLanguage($this->_post_vars['language']); $new_account->setEmail($this->_post_vars['email']); $new_account->setPortalID($this->_environment->getCurrentPortalID()); $new_account->setAuthSourceID($auth_source); $save_only_user = true; $authentication->save($new_account, $save_only_user); $portal_user = $authentication->getUserItem(); $error = $authentication->getErrorMessage(); if (empty($error)) { $success = true; $portal_item = $this->_environment->getCurrentPortalItem(); if ($this->_environment->getCurrentContextItem()->withAGB() and $this->_environment->getCurrentContextItem()->withAGBDatasecurity()) { if ($this->_post_vars['terms_of_use']) { $portal_user->setAGBAcceptance(); } } if ($portal_item->getConfigurationHideMailByDefault()) { // hide $portal_user->setDefaultMailNotVisible(); } else { $portal_user->setDefaultMailVisible(); } #if ( $portal_item->checkNewMembersAlways() # or $portal_item->checkNewMembersSometimes() # ) { # // portal: generate and save task # $task_manager = $environment->getTaskManager(); # $task_item = $task_manager->getNewItem(); # $task_item->setContextID($portal_item->getItemID()); # $task_item->getCreatorItem($portal_user); # $task_item->setTitle('TASK_USER_REQUEST'); # $task_item->setStatus('REQUEST'); # $task_item->setItem($portal_user); # $task_item->save(); #} // portal: send mail to moderators in different languages $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 = $this->_translator->getSelectedLanguage(); foreach ($email_addresses as $key => $value) { $this->_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($this->_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($this->_translator->getMessage('USER_GET_MAIL_SUBJECT', $portal_user->getFullname())); $body = $this->_translator->getMessage('MAIL_AUTO', $this->_translator->getDateInLang(getCurrentDateTimeInMySQL()), $this->_translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $temp_language = $portal_user->getLanguage(); if ($temp_language == 'browser') { $temp_language = $this->_environment->getSelectedLanguage(); } $body .= $this->_translator->getMessage('USER_GET_MAIL_BODY', $portal_user->getFullname(), $portal_user->getUserID(), $portal_user->getEmail(), $this->_translator->getLanguageLabelTranslated($temp_language)); unset($temp_language); $body .= LF . LF; # if ( !$portal_item->checkNewMembersNever() # or $portal_item->checkNewMembersSometimes() # ) { # $check_message = 'YES'; # } else { $check_message = 'NO'; # } switch ($check_message) { case 'YES': $body .= $this->_translator->getMessage('USER_GET_MAIL_STATUS_YES'); break; case 'NO': $body .= $this->_translator->getMessage('USER_GET_MAIL_STATUS_NO'); break; default: break; } $body .= LF . LF; if (!empty($_POST['explanation'])) { $body .= $this->_translator->getMessage('MAIL_COMMENT_BY', $portal_user->getFullname(), ''); $body .= LF . LF; } $body .= $this->_translator->getMessage('MAIL_SEND_TO', $recipients); $body .= LF; $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $portal_item->getItemID() . '&mod=account&fct=index' . '&selstatus=1'; $mail->set_message($body); $mail->send(); } } $this->_translator->setSelectedLanguage($save_language); // activate user #$login = false; #if ($portal_item->checkNewMembersNever()) { $portal_user->makeUser(); $portal_user->save(); $current_user = $portal_user; $this->_environment->setCurrentUserItem($current_user); #$this->setCurrentUser($this->_environment->getCurrentUserItem()); #$login = true; #} // send email to user if ($current_user->isUser()) { if (!$this->_environment->inPortal()) { // change translation context $this->_translator->setContext('portal'); $current_portal = $this->_environment->getCurrentPortalItem(); $this->_translator->setEmailTextArray($current_portal->getEmailTextArray()); $this->_translator->setSelectedLanguage($current_portal->getLanguage()); } $mod_text = ''; $mod_list = $portal_item->getContactModeratorList(); if (!$mod_list->isEmpty()) { $mod_item = $mod_list->getFirst(); $contact_moderator = $mod_item; while ($mod_item) { if (!empty($mod_text)) { $mod_text .= ',' . LF; } $mod_text .= $mod_item->getFullname(); $mod_text .= ' (' . $mod_item->getEmail() . ')'; $mod_item = $mod_list->getNext(); } } $language = getSelectedLanguage(); $this->_translator->setSelectedLanguage($language); include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to($current_user->getEmail()); $mail->set_from_name($this->_translator->getMessage('SYSTEM_MAIL_MESSAGE', $portal_item->getTitle())); $server_item = $this->_environment->getServerItem(); $default_sender_address = $server_item->getDefaultSenderAddress(); if (!empty($default_sender_address)) { $mail->set_from_email($default_sender_address); } else { $user_manager = $this->_environment->getUserManager(); $root_user = $user_manager->getRootUser(); $root_mail_address = $root_user->getEmail(); if (!empty($root_mail_address)) { $mail->set_from_email($root_mail_address); } else { $mail->set_from_email('@'); } } if (!empty($contact_moderator)) { $mail->set_reply_to_email($contact_moderator->getEmail()); $mail->set_reply_to_name($contact_moderator->getFullname()); } $mail->set_subject($this->_translator->getMessage('MAIL_SUBJECT_USER_ACCOUNT_FREE', $portal_item->getTitle())); $body = $this->_translator->getMessage('MAIL_AUTO', $this->_translator->getDateInLang(getCurrentDateTimeInMySQL()), $this->_translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $this->_translator->getEmailMessage('MAIL_BODY_HELLO', $current_user->getFullname()); $body .= LF . LF; $body .= $this->_translator->getEmailMessage('MAIL_BODY_USER_STATUS_USER', $portal_user->getUserID(), $portal_item->getTitle()); $body .= LF . LF; if (empty($contact_moderator)) { $body .= $this->_translator->getMessage('SYSTEM_MAIL_REPLY_INFO') . LF; $body .= $mod_text; $body .= LF . LF; } else { $body .= $this->_translator->getEmailMessage('MAIL_BODY_CIAO', $contact_moderator->getFullname(), $portal_item->getTitle()); $body .= LF . LF; } $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID(); $mail->set_message($body); $mail->send(); if (!$this->_environment->inPortal()) { // change translation context back $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->isProjectRoom()) { $this->_translator->setContext('project'); } else { $this->_translator->setContext('community'); } $this->_translator->setEmailTextArray($current_context->getEmailTextArray()); $this->_translator->setSelectedLanguage($current_context->getLanguage()); } } // login in user #if ($login) { $session = $this->_environment->getSessionItem(); #if ($session->issetValue('last_step')) { #$last_step = $session->getValue('last_step'); #$session->unsetValue('last_step'); #} $cookie = $session->getValue('cookie'); include_once 'classes/cs_session_item.php'; global $session; // for PHP5 and TBD !!!!!!!!!! $session = new cs_session_item(); $session->createSessionID($_POST['user_id']); if ($cookie == '1') { $session->setValue('cookie', 2); } else { $session->setValue('cookie', 0); } // save portal id in session to be sure, that user didn't // switch between portals $session->setValue('commsy_id', $this->_environment->getCurrentPortalID()); // auth_source if (empty($auth_source)) { $auth_source = $authentication->getAuthSourceItemID(); } $session->setValue('auth_source', $auth_source); $this->_environment->setSessionItem($session); } } } if (!$success) { return $this->_show_form($form); } else { $this->_redirect_back(); } }
public function actionDetail() { $session = $this->_environment->getSessionItem(); $environment = $this->_environment; $translator = $this->_environment->getTranslationObject(); // try to set the item $this->setItem(); # if($this->_item->isA(CS_LABEL_TYPE) && $this->_item->getLabelType() === CS_GROUP_TYPE && $this->_item->isGroupRoomActivated()) { # $this->_show_content_without_window = true; # } $this->setupInformation(); // TODO: include_once('include/inc_delete_entry.php'); $label_manager = $this->_environment->getGroupManager(); $account_mode = 'none'; if (!empty($_GET['account'])) { $account_mode = $_GET['account']; } // use agb datasecurity $portal_item = $this->_environment->getCurrentPortalItem(); $agb_checked = $_GET['agb']; // true or false if ($portal_item->getAGBStatus() == 2 and $portal_item->withAGBDatasecurity()) { if ($agb_checked == "true") { $check_agb_ds = true; } else { $check_agb_ds = false; } } else { $check_agb_ds = true; } $option = 'none'; if (isset($_POST['option'])) { $option = $_POST['option']; } if (isOption($option, CS_OPTION_JOIN)) { } $type = $this->_item->getItemType(); // check for correct type if ($type !== CS_GROUP_TYPE) { throw new cs_detail_item_type_exception('wrong item type', 0); } else { // used to signal which "craetor infos" of annotations are expanded... $creatorInfoStatus = array(); if (!empty($_GET['creator_info_max'])) { $creatorInfoStatus = explode('-', $_GET['creator_info_max']); } // initialize $current_user = $this->_environment->getCurrentUser(); // check for deleted if ($this->_item->isDeleted()) { throw new cs_detail_item_type_exception('item deleted', 1); } elseif (!$this->_item->maySee($current_user)) { // TODO: implement error handling /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED')); $page->add($errorbox); */ } else { // enter or leave group if (!empty($_GET['group_option'])) { if ($_GET['group_option'] === '1') { $room_item = $this->_item->getGroupRoomItem(); if (isset($room_item) and !empty($room_item)) { $session = $environment->getSessionItem(); $params['iid'] = $this->_item->getItemID(); // build new user_item if ((!$room_item->checkNewMembersWithCode() or $room_item->getCheckNewMemberCode() == $_GET['code']) and $check_agb_ds) { $current_user = $environment->getCurrentUserItem(); $user_item = $current_user->cloneData(); $picture = $current_user->getPicture(); $user_item->setContextID($room_item->getItemID()); if (!empty($picture)) { $value_array = explode('_', $picture); $value_array[0] = 'cid' . $user_item->getContextID(); $new_picture_name = implode('_', $value_array); $disc_manager = $environment->getDiscManager(); $disc_manager->copyImageFromRoomToRoom($picture, $user_item->getContextID()); $user_item->setPicture($new_picture_name); } if (isset($_POST['description_user'])) { $user_item->setUserComment($_POST['description_user']); } //check room_settings if (!$room_item->checkNewMembersNever() and !$room_item->checkNewMembersWithCode()) { $user_item->request(); $check_message = 'YES'; // for mail body $account_mode = 'info'; } else { $user_item->makeUser(); // for mail body $check_message = 'NO'; $account_mode = 'to_room'; } if ($portal_item->getAGBStatus() == 2 and $portal_item->withAGBDatasecurity()) { if ($agb_checked) { $user_item->setAGBAcceptance(); } } // test if user id allready exist (reload page) $user_id = $user_item->getUserID(); $user_test_item = $room_item->getUserByUserID($user_id, $user_item->getAuthSource()); if (!isset($user_test_item) and mb_strtoupper($user_id, 'UTF-8') != 'GUEST' and mb_strtoupper($user_id, 'UTF-8') != 'ROOT') { $user_item->save(); $user_item->setCreatorID2ItemID(); // save task if (!$room_item->checkNewMembersNever() and !$room_item->checkNewMembersWithCode()) { $task_manager = $environment->getTaskManager(); $task_item = $task_manager->getNewItem(); $current_user = $environment->getCurrentUserItem(); $task_item->setCreatorItem($current_user); $task_item->setContextID($room_item->getItemID()); $task_item->setTitle('TASK_USER_REQUEST'); $task_item->setStatus('REQUEST'); $task_item->setItem($user_item); $task_item->save(); } // send email to moderators if necessary $user_list = $room_item->getModeratorList(); $email_addresses = array(); $moderator_item = $user_list->getFirst(); $recipients = ''; while ($moderator_item) { $want_mail = $moderator_item->getAccountWantMail(); if (!empty($want_mail) and $want_mail == 'yes') { $email_addresses[] = $moderator_item->getEmail(); $recipients .= $moderator_item->getFullname() . LF; } $moderator_item = $user_list->getNext(); } // language $language = $room_item->getLanguage(); if ($language == 'user') { $language = $user_item->getLanguage(); if ($language == 'browser') { $language = $environment->getSelectedLanguage(); } } if (count($email_addresses) > 0) { $save_language = $translator->getSelectedLanguage(); $translator->setSelectedLanguage($language); $subject = $translator->getMessage('USER_JOIN_CONTEXT_MAIL_SUBJECT', $user_item->getFullname(), $room_item->getTitle()); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; // Datenschutz if ($this->_environment->getCurrentPortalItem()->getHideAccountname()) { $userid = 'XXX (aus Datenschutzgründen verborgen)'; } else { $userid = $user_item->getUserID(); } $body .= $translator->getMessage('GROUPROOM_USER_JOIN_CONTEXT_MAIL_BODY', $user_item->getFullname(), $userid, $user_item->getEmail(), $room_item->getTitle()); $body .= LF . LF; 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; if (!empty($_POST['description_user'])) { $body .= $translator->getMessage('MAIL_COMMENT_BY', $user_item->getFullname(), $_POST['description_user']); $body .= LF . LF; } $body .= $translator->getMessage('MAIL_SEND_TO', $recipients); if (!$room_item->checkNewMembersNever()) { $body .= LF; $body .= $translator->getMessage('MAIL_USER_FREE_LINK') . LF; $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $room_item->getItemID() . '&mod=account&fct=index&selstatus=1'; } else { $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $room_item->getItemID(); } include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to(implode(',', $email_addresses)); $server_item = $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('@'); } $current_context = $environment->getCurrentContextItem(); $mail->set_from_name($translator->getMessage('SYSTEM_MAIL_MESSAGE', $current_context->getTitle())); $mail->set_reply_to_name($user_item->getFullname()); $mail->set_reply_to_email($user_item->getEmail()); $mail->set_subject($subject); $mail->set_message($body); $mail->send(); $translator->setSelectedLanguage($save_language); } // send email to user when account is free automatically // and make member of the group in the group room if ($user_item->isUser()) { // make member $this->_item->addMember($current_user); // get contact moderator (TBD) now first contect moderator $user_list = $room_item->getContactModeratorList(); $contact_moderator = $user_list->getFirst(); // change context to group room $translator->setEmailTextArray($room_item->getEmailTextArray()); $translator->setContext(CS_GROUPROOM_TYPE); $save_language = $translator->getSelectedLanguage(); // language $language = $room_item->getLanguage(); if ($language == 'user') { $language = $user_item->getLanguage(); if ($language == 'browser') { $language = $environment->getSelectedLanguage(); } } $translator->setSelectedLanguage($language); // email texts $subject = $translator->getMessage('MAIL_SUBJECT_USER_STATUS_USER', $room_item->getTitle()); $body = $translator->getMessage('MAIL_AUTO', $translator->getDateInLang(getCurrentDateTimeInMySQL()), $translator->getTimeInLang(getCurrentDateTimeInMySQL())); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_HELLO', $user_item->getFullname()); $body .= LF . LF; // Datenschutz if ($this->_environment->getCurrentPortalItem()->getHideAccountname()) { $userid = ' '; } else { $userid = $user_item->getUserID(); } $body .= $translator->getEmailMessage('MAIL_BODY_USER_STATUS_USER', $userid, $room_item->getTitle()); $body .= LF . LF; $body .= $translator->getEmailMessage('MAIL_BODY_CIAO', $contact_moderator->getFullname(), $room_item->getTitle()); $body .= LF . LF; $body .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $environment->getCurrentContextID(); // send mail to user include_once 'classes/cs_mail.php'; $mail = new cs_mail(); $mail->set_to($user_item->getEmail()); $mail->set_from_name($translator->getMessage('SYSTEM_MAIL_MESSAGE', $room_item->getTitle())); $server_item = $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_reply_to_email($contact_moderator->getEmail()); $mail->set_reply_to_name($contact_moderator->getFullname()); $mail->set_subject($subject); $mail->set_message($body); $mail->send(); } } } elseif ($room_item->checkNewMembersWithCode() and $room_item->getCheckNewMemberCode() != $_GET['code']) { $account_mode = 'member'; $error = 'code'; } if ($account_mode == 'to_room') { redirect($room_item->getItemID(), 'home', 'index', ''); } else { $params['account'] = $account_mode; if (isset($error) and !empty($error)) { $params['error'] = $error; } redirect($environment->getCurrentContextID(), $environment->getCurrentModule(), 'detail', $params); } } else { $this->_item->addMember($current_user); if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussionNotificationGroups() === '1') { $wiki_manager = $this->_environment->getWikiManager(); $wiki_manager->updateNotification(); } } } elseif ($_GET['group_option'] === '2') { $this->_item->removeMember($current_user); if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussionNotificationGroups() === '1') { $wiki_manager = $this->_environment->getWikiManager(); $wiki_manager->updateNotification(); } if ($this->_item->isGroupRoomActivated()) { $grouproom_item = $this->_item->getGroupRoomItem(); if (isset($grouproom_item) && !empty($grouproom_item)) { $group_room_user_item = $grouproom_item->getUserByUserID($current_user->getUserID(), $current_user->getAuthSource()); $group_room_user_item->reject(); $group_room_user_item->save(); } } } } else { if ($this->_item->isGroupRoomActivated()) { $grouproom_item = $this->_item->getGroupRoomItem(); if (isset($grouproom_item) && !empty($grouproom_item)) { if ($grouproom_item->checkNewMembersWithCode()) { $this->assign("join", "code", true); } if ($grouproom_item->getAGBStatus() != 2) { $this->assign("join", "agb", true); } } } } // mark as read and noticed $this->markRead(); $this->markNoticed(); /* * // Create view $context_item = $environment->getCurrentContextItem(); $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = $context_item->isOpen(); $params['creator_info_status'] = $creatorInfoStatus; $detail_view = $class_factory->getClass(GROUP_DETAIL_VIEW,$params); unset($params); $detail_view->setItem($group_item); ####################################### # FLAG: group room ####################################### $detail_view->setAccountMode($account_mode); ####################################### # FLAG: group room ####################################### */ /* * // Set up rubric connections and browsing if ( $context_item->withRubric(CS_USER_TYPE) ) { $ids = $group_item->getLinkedItemIDArray(CS_USER_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_user_index_ids', $ids); } $rubric_connections = array(); if ( $context_item->withRubric(CS_TOPIC_TYPE) ) { $ids = $group_item->getLinkedItemIDArray(CS_TOPIC_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_topics_index_ids', $ids); $rubric_connections = array(CS_TOPIC_TYPE); } $current_room_modules = $context_item->getHomeConf(); if ( !empty($current_room_modules) ){ $room_modules = explode(',',$current_room_modules); } else { $room_modules = $default_room_modules; } $first = ''; foreach ( $room_modules as $module ) { $link_name = explode('_', $module); if ( $link_name[1] != 'none' ) { switch ($link_name[0]) { case CS_ANNOUNCEMENT_TYPE: $ids = $group_item->getLinkedItemIDArray(CS_ANNOUNCEMENT_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_announcement_index_ids', $ids); $rubric_connections[] = CS_ANNOUNCEMENT_TYPE; break; case 'todo': $context = $environment->getCurrentContextItem(); if ($context->withRubric(CS_TODO_TYPE)){ $ids = $group_item->getLinkedItemIDArray(CS_TODO_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_todo_index_ids', $ids); $rubric_connections[] = CS_TODO_TYPE; } break; case CS_DATE_TYPE: $ids = $group_item->getLinkedItemIDArray(CS_DATE_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_dates_index_ids', $ids); $rubric_connections[] = CS_DATE_TYPE; break; case 'material': $ids = $group_item->getLinkedItemIDArray(CS_MATERIAL_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_material_index_ids', $ids); $rubric_connections[] = CS_MATERIAL_TYPE; break; case 'discussion': $ids = $group_item->getLinkedItemIDArray(CS_DISCUSSION_TYPE); $session->setValue('cid'.$environment->getCurrentContextID().'_discussion_index_ids', $ids); $rubric_connections[] = CS_DISCUSSION_TYPE; break; } } } $detail_view->setRubricConnections($rubric_connections); // highlight search words in detail views $session_item = $environment->getSessionItem(); if ( $session->issetValue('cid'.$environment->getCurrentContextID().'_campus_search_parameter_array') ) { $search_array = $session->getValue('cid'.$environment->getCurrentContextID().'_campus_search_parameter_array'); if ( !empty($search_array['search']) ) { $detail_view->setSearchText($search_array['search']); } unset($search_array); } // Add view to page ... and done $page->add($detail_view); */ $this->assign('detail', 'content', $this->getDetailContent()); } } }
$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); exit; } else { include_once('functions/error_functions.php'); trigger_error('can not initiate ZIP class, please contact your system administrator',E_USER_WARNNG); } } } } else if (!empty($command) and (isOption($command, $translator->getMessage('PREFERENCES_EXPORT_COMMON_UPLOAD')))) { if ( $form->check() ) { if ( !empty($_FILES['upload']['tmp_name']) ) { $temp_stamp = time(); //$files = file_get_contents($_FILES['upload']['tmp_name']); move_uploaded_file($_FILES['upload']['tmp_name'], '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);
$tag_item = $tag_manager->getItem($change_id); if(!empty($tag_item)) { $tag_item->setTitle($_POST['tag#' . $change_id]); $tag_item->save(); } unset($change_id); unset($tag_item); } unset($tag_manager); $params = array(); if ( empty($delete_id) ) { $params['focus_element_onload'] = $change_id; } redirect($environment->getCurrentContextID(),'tag', 'edit', $params); } elseif (!empty($command) and isOption($command, $translator->getMessage('COMMON_ADD_BUTTON'))){ if ( isset($_POST['new_tag']) and !empty($_POST['new_tag']) and isset($_POST['father_id']) and !empty($_POST['father_id']) ) { $tag_manager = $environment->getTagManager(); $tag_item = $tag_manager->getNewItem(); $tag_item->setTitle($_POST['new_tag']); $tag_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $tag_item->setCreatorItem($user); unset($user); $tag_item->setCreationDate(getCurrentDateTimeInMySQL()); $tag_item->setPosition($_POST['father_id'],1); $tag_item->save();
} elseif ( isset($room_item) ) { $form->setItem($room_item); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and isOption($command, $translator->getMessage('COMMON_SAVE_BUTTON')) and ( !isset($error_on_upload) or !$error_on_upload ) ) { $correct = $form->check(); if ( $correct and isOption($command, $translator->getMessage('COMMON_SAVE_BUTTON')) ) { // show ads if ( isset($_POST['show_ads']) and !empty($_POST['show_ads']) ) { if ( $_POST['show_ads'] == 1 ) { $room_item->setShowAds(); } elseif ( $_POST['show_ads'] == -1 ) { $room_item->setNotShowAds(); } } if ( isset($_POST['show_google_ads']) and !empty($_POST['show_google_ads']) ) { if ( $_POST['show_google_ads'] == 1 ) { $room_item->setShowGoogleAds(); } elseif ( $_POST['show_google_ads'] == -1 ) { $room_item->setNotShowGoogleAds();
$session_item->setValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name',$_FILES['dates_upload']['name']); } } $values = array_merge($_POST,$_FILES); } else { $values = $_POST; } $form->setFormPost($values); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and isOption($command, $translator->getMessage('DATES_IMPORT_BUTTON')) ) { $correct = $form->check(); if ( $correct and empty($_FILES['dates_upload']['tmp_name']) and !empty($_POST['hidden_dates_upload_name']) ) { $session_item = $environment->getSessionItem(); if ( isset($session_item) ) { $current_iid = $environment->getCurrentContextID(); $_FILES['dates_upload']['tmp_name'] = $session_item->getValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_temp_name'); $_FILES['dates_upload']['name'] = $session_item->getValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name'); $session_item->unsetValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_temp_name'); $session_item->unsetValue($environment->getCurrentContextID().'_dates_'.$current_iid.'_upload_name');
public function actionEdit() { $session = $this->_environment->getSessionItem(); $translator = $this->_environment->getTranslationObject(); // get the current user and room $current_user = $this->_environment->getCurrentUserItem(); $current_context = $this->_environment->getCurrentContextItem(); // get post data $this->getPostData(); // check access rights if ($current_context->isProjectRoom() && $current_context->isClosed()) { /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('PROJECT_ROOM_IS_CLOSED', $context_item->getTitle())); $page->add($errorbox); */ } elseif ($this->_item_id !== "NEW" && !isset($this->_item)) { /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('ITEM_DOES_NOT_EXIST', $current_iid)); $page->add($errorbox); */ } elseif (!($this->_item_id === "NEW" && $current_user->isUser() || $this->_item_id !== "NEW" && isset($this->_item) && $this->_item->mayEdit($current_user))) { /* * $params = array(); $params['environment'] = $environment; $params['with_modifying_actions'] = true; $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params); unset($params); $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED')); $page->add($errorbox); */ } else { if ($this->_command !== null && (isOption($this->_command, CS_OPTION_SAVE) || isOption($this->_command, CS_OPTION_CHANGE) || isOption($this->_command, CS_OPTION_NEW))) { if ($this->checkFormData()) { if (!isset($step_item)) { $step_manager = $this->_environment->getStepManager(); $step_item = $step_manager->getNewItem(); $step_item->setContextID($this->_environment->getCurrentContextID()); $user = $this->_environment->getCurrentUserItem(); $step_item->setCreatorItem($user); $step_item->setCreationDAte(getCurrentDateTimeInMySQL()); $step_item->setTodoID($_POST["todo_id"]); } $todo_manager = $this->_environment->getTodoManager(); $todo_item = $todo_manager->getItem($_POST["todo_id"]); // set modificator and modification date $user = $this->_environment->getCurrentUserItem(); $step_item->setModificatorItem($user); $step_item->setModificationDate(getCurrentDateTimeInMySQL()); // set attributes if (isset($_POST["form_data"]["title"])) { $step_item->setTitle($_POST["form_data"]["title"]); } if (isset($_POST["form_data"]["ckeditor_step"])) { $step_item->setDescription($_POST["form_data"]["ckeditor_step"]); } if (isset($_POST["form_data"]["minutes"])) { $minutes = $_POST["form_data"]["minutes"]; $minutes = str_replace(",", ".", $minutes); if (isset($_POST["form_data"]["time_type"])) { $step_item->setTimeType($_POST["form_data"]["time_type"]); switch ($_POST["form_data"]["time_type"]) { case 2: $minutes = $minutes * 60; break; case 3: $minutes = $minutes * 60 * 8; break; } } $step_item->setMinutes($minutes); } // save $step_item->save(); $status = $todo_item->getStatus(); if ($status == $translator->getMessage("TODO_NOT_STARTED")) { $todo_item->setStatus(2); } $todo_item->setModificationDate(getCurrentDateTimeInMySQL()); $todo_item->save(); /* // Set links to connected rubrics if ( isset($_POST[CS_MATERIAL_TYPE]) ) { $step_item->setMaterialListByID($_POST[CS_MATERIAL_TYPE]); } else { $step_item->setMaterialListByID(array()); } $item_files_upload_to = $step_item; include_once('include/inc_fileupload_edit_page_save_item.php'); */ // redirect $this->cleanup_session($this->_item_id); redirect($this->_environment->getCurrentContextID(), "todo", "detail", array("iid" => $step_item->getTodoID()), "step" . $step_item->getItemID()); } else { // store description in session $sessionKey = 'cid' . $this->_environment->getCurrentContextID() . '_step_last_description'; $session->setValue($sessionKey, $_POST['form_data']['ckeditor_step']); redirect($this->_environment->getCurrentContextID(), "todo", "detail", array("iid" => $_POST["todo_id"], "step_exception" => "mandatory"), "step_new"); } } } }
} else { include_once('functions/error_functions.php');trigger_error('topic_edit was called in an unknown manner', E_USER_ERROR); } if ($session->issetValue($environment->getCurrentModule().'_add_files')) { $form->setSessionFileArray($session->getValue($environment->getCurrentModule().'_add_files')); } $form->prepareForm(); $form->loadValues(); // Save item if ( !empty($command) and ( isOption($command, $translator->getMessage('TOPIC_SAVE_BUTTON')) or isOption($command, $translator->getMessage('TOPIC_CHANGE_BUTTON')) ) ) { $correct = $form->check(); if ( $correct ) { // Create new item $item_is_new = false; if ( !isset($topic_item) ) { $topic_manager = $environment->getTopicManager(); $topic_item = $topic_manager->getNewItem(); $topic_item->setContextID($context_item->getItemID()); $user = $environment->getCurrentUserItem(); $topic_item->setCreatorItem($user); $topic_item->setCreationDate(getCurrentDateTimeInMySQL());
$infoBox_forAutoNewVersion = ""; $correct = $form->check(); if ($correct) { // Create new item if ( !isset($section_item) ) { $section_manager = $environment->getSectionManager(); $section_item = $section_manager->getNewItem(); $section_item->setContextID($environment->getCurrentContextID()); $user = $environment->getCurrentUserItem(); $section_item->setCreatorItem($user); $section_item->setCreationDate(getCurrentDateTimeInMySQL()); } // new version? if ((!empty($command) AND isOption($command,$translator->getMessage('MATERIAL_VERSION_BUTTON'))) or ($_POST['material_modification_date'] != $material_item->getModificationDate())) { $version = $material_item->getVersionID()+1; $material_item->save(); $material_item = $material_item->cloneCopy(); $material_item->setVersionID($version); $infoBox_forAutoNewVersion = "&autoVersion=true"; } // Set modificator and modification date $user = $environment->getCurrentUserItem(); $section_item->setModificatorItem($user); $section_item->setModificationDate(getCurrentDateTimeInMySQL()); // Set attributes if (isset($_POST['title'])) {