function activate_group($group_id)
{
    global $feedback;
    $group =& group_get_object($group_id);
    if (!$group || !is_object($group)) {
        $feedback .= _('Error creating group object') . '<br />';
        return false;
    } else {
        if ($group->isError()) {
            $feedback .= $group->getErrorMessage() . '<br />';
            return false;
        }
    }
    $feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()) . '<br />';
    if (!$group->approve(session_get_user())) {
        $feedback .= $group->getErrorMessage() . '<br />';
        return false;
    }
    $hook_params = array();
    $hook_params['group_id'] = $group_id;
    plugin_hook("group_approved", $hook_params);
    //plugin webcalendar
    //create webcal group
    plugin_hook('add_cal_group', $group_id);
    return true;
}
 /**
  *	getSCMs - get an array of Plugin SCM objects.
  *
  *	@return	array	The array of SCM objects.
  */
 function &getSCMs()
 {
     $scm_plugins = array();
     if ($this->scms) {
         return $this->scms;
     }
     $hookParams['scm_plugins'] =& $scm_plugins;
     plugin_hook("scm_plugin", $hookParams);
     $this->scms = $scm_plugins;
     return $this->scms;
 }
Beispiel #3
0
//
//    CommSy is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    CommSy is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.

// CommSy-Plugin logout-hook
plugin_hook('logout');

// delete session
$session = $environment->getSessionItem();
$history = $session->getValue('history');
$cookie = $session->getValue('cookie');
$javascript = $session->getValue('javascript');
$https = $session->getValue('https');
$flash = $session->getValue('flash');
if ( $session->issetValue('root_session_id') ) {
   $root_session_id = $session->getValue('root_session_id');
}
$config = $environment->getConfiguration('c_shibboleth_redirect_url');
if ($environment->getConfiguration('c_shibboleth_direct_login') and !empty($config)){
	if ($_SERVER['Shib_userId']){
		$session_manager->delete($SID,true);
Beispiel #4
0
function profile_update($profile_new)
{
    global $CFG;
    global $data;
    global $messages;
    global $page_owner;
    global $profile_name;
    $profiledetails = optional_param('profiledetails', array());
    if (count($profiledetails) > 0) {
        // delete_records('profile_data','owner',$page_owner);
        $insertvalues = array();
        $requiredmissing = array();
        foreach ($profiledetails as $field => $value) {
            $field = trim($field);
            $value = trim($value);
            if (!empty($value)) {
                //TODO get rid of variable duplication here. (Penny)
                if (!empty($data['profile:details'][$field]->invisible)) {
                    $access = 'user' . $page_owner;
                } else {
                    $access = $_POST['profileaccess'][$field];
                }
                $pd = new StdClass();
                $pd->name = $field;
                $pd->value = $value;
                $pd->access = $access;
                $pd->owner = $page_owner;
                // $insert_id  = insert_record('profile_data',$pd);
                $insertvalues[] = $pd;
            } else {
                foreach ($data['profile:details'] as $datatype) {
                    if (is_array($datatype)) {
                        $fname = !empty($datatype[1]) ? $datatype[1] : '';
                        $flabel = !empty($field[0]) ? $field[0] : '';
                        $frequired = false;
                        $fcat = __gettext("Main");
                        // Otherwise map things the new way!
                    } else {
                        $fname = $datatype->internal_name;
                        $flabel = $datatype->name;
                        $frequired = $datatype->required;
                        if (empty($datatype->category)) {
                            $fcat = __gettext("Main");
                        } else {
                            $fcat = $datatype->category;
                        }
                    }
                    if ($fname == $field) {
                        if ($frequired == true) {
                            $requiredmissing[] = sprintf(__gettext("%s (in category %s)"), $flabel, $fcat);
                        } else {
                            delete_records('profile_data', 'owner', $page_owner, 'name', $fname);
                        }
                    }
                }
            }
        }
        if (sizeof($requiredmissing) == 0) {
            $updatedok = true;
            foreach ($insertvalues as $insertvalue) {
                delete_records('profile_data', 'owner', $page_owner, 'name', $insertvalue->name);
                $insertvalue = plugin_hook("profile_data", "create", $insertvalue);
                if (!empty($insertvalue)) {
                    $insert_id = insert_record('profile_data', $insertvalue);
                    $insertvalue->ident = $insert_id;
                    plugin_hook("profile_data", "publish", $insertvalue);
                    foreach ($data['profile:details'] as $datatype) {
                        if (is_array($datatype)) {
                            $fname = !empty($datatype[1]) ? $datatype[1] : '';
                            $ftype = !empty($datatype[2]) ? $datatype[2] : '';
                            // Otherwise map things the new way!
                        } else {
                            $fname = $datatype->internal_name;
                            $ftype = $datatype->field_type;
                        }
                        if ($fname == $insertvalue->name && $ftype == "keywords") {
                            delete_records('tags', 'tagtype', $insertvalue->name, 'owner', $page_owner);
                            $value = insert_tags_from_string($insertvalue->value, $insertvalue->name, $insert_id, $insertvalue->access, $page_owner);
                        }
                        if (isset($CFG->display_field_module[$ftype])) {
                            $callback = $CFG->display_field_module[$ftype] . "_validate_input_field";
                            $updatedok = $callback($insertvalue);
                        }
                    }
                }
            }
            $messages[] = __gettext("Profile updated.");
        } else {
            $savedata = array();
            foreach ($insertvalues as $insertvalue) {
                $savedata['profile:preload'][$insertvalue->name] = $insertvalue->value;
                $savedata['profile:preload:access'][$insertvalue->name] = $insertvalue->access;
            }
            foreach ($requiredmissing as $key => $missinglabel) {
                $message = "";
                if ($key > 0) {
                    $message .= ", ";
                }
                $message .= $missinglabel;
            }
            $messages[] = sprintf(__gettext("You need to fill in the following required fields: %s"), $message);
            $updatedok = false;
            $_SESSION['profile:preload'] = $savedata['profile:preload'];
            $_SESSION['profile:preload:access'] = $savedata['profile:preload:access'];
        }
    }
    // Changes saved successfully, update RSS feeds
    $rssresult = run("weblogs:rss:publish", array(1, false));
    $rssresult = run("profile:rss:publish", array(1, false));
    $_SESSION['messages'] = $messages;
    // redirect("{$CFG->wwwroot}{$profile_name}", get_string("changessaved"));
    if ($updatedok) {
        redirect("{$CFG->wwwroot}{$profile_name}/profile/", "");
    } else {
        redirect("{$CFG->wwwroot}profile/edit.php?profile_id=" . $page_owner, "");
    }
}
 public function save($form_data, $additional = array())
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $current_portal_item = $this->_environment->getCurrentPortalItem();
     // check context
     if (false) {
     } else {
         if (false) {
         } else {
             $tab = $additional['part'];
             switch ($tab) {
                 /**** ACCOUNT ****/
                 case 'account_merge':
                     if ($this->_popup_controller->checkFormData('merge')) {
                         $authentication = $this->_environment->getAuthenticationObject();
                         global $c_annonymous_account_array;
                         $currentUser = $this->_environment->getCurrentUserItem();
                         if (!empty($c_annonymous_account_array[mb_strtolower($currentUser->getUserID(), 'UTF-8') . '_' . $currentUser->getAuthSource()]) && $currentUser->isOnlyReadUser()) {
                             $this->_popup_controller->setErrorReturn("1014", "anonymous account");
                             exit;
                         } else {
                             if ($currentUser->getUserID() == $form_data['merge_user_id'] && (empty($form_data['auth_source']) || $currentUser->getAuthSource() == $form_data['auth_source'])) {
                                 $this->_popup_controller->setErrorReturn("1015", "invalid account");
                             } else {
                                 $user_manager = $this->_environment->getUserManager();
                                 $user_manager->setUserIDLimitBinary($form_data['merge_user_id']);
                                 $user_manager->select();
                                 $user = $user_manager->get();
                                 $first_user = $user->getFirst();
                                 $current_user = $this->_environment->getCurrentUserItem();
                                 if (!empty($first_user)) {
                                     if (empty($form_data['auth_source'])) {
                                         $authManager = $authentication->getAuthManager($current_user->getAuthSource());
                                     } else {
                                         $authManager = $authentication->getAuthManager($form_data['auth_source']);
                                     }
                                     if (!$authManager->checkAccount($form_data['merge_user_id'], $form_data['merge_user_password'])) {
                                         $this->_popup_controller->setErrorReturn("1016", "authentication error");
                                         exit;
                                     }
                                 } else {
                                     $this->_popup_controller->setErrorReturn("1015", "invalid account");
                                     exit;
                                 }
                             }
                         }
                         $currentUser = $this->_environment->getCurrentUserItem();
                         if (isset($form_data['auth_source'])) {
                             $authSourceOld = $form_data['auth_source'];
                         } else {
                             $authSourceOld = $this->_environment->getCurrentPortalItem()->getAuthDefault();
                         }
                         ini_set('display_errors', 'on');
                         error_reporting(E_ALL);
                         $authentication->mergeAccount($currentUser->getUserID(), $currentUser->getAuthSource(), $form_data['merge_user_id'], $authSourceOld);
                         // set return
                         $this->_popup_controller->setSuccessfullItemIDReturn($currentUser->getItemID());
                     }
                     break;
                 case "account_lock_room":
                     $current_user = $this->_environment->getCurrentUserItem();
                     $current_user->reject();
                     $current_user->save();
                     // set return
                     $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID());
                     break;
                 case "account_delete_room":
                     $current_user = $this->_environment->getCurrentUserItem();
                     $current_user->delete();
                     // remove link from group room
                     if ($current_context->isGroupRoom()) {
                         $group_item = $current_context->getLinkedGroupItem();
                         $group_item->removeMember($current_user->getRelatedUserItemInContext($group_item->getContextID()));
                     }
                     // set return
                     $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID());
                     break;
                 case "account_lock_portal":
                     $current_user = $this->_environment->getCurrentUserItem();
                     $portalUser_item = $current_user->getRelatedCommSyUserItem();
                     $portalUser_item->reject();
                     $portalUser_item->save();
                     // delete session
                     $session_manager = $this->_environment->getSessionManager();
                     $session = $this->_environment->getSessionItem();
                     $session_manager->delete($session->getSessionID());
                     $this->_environment->setSessionItem(null);
                     // return
                     $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID());
                     break;
                 case "account_delete_portal":
                     $current_user = $this->_environment->getCurrentUserItem();
                     $portalUser_item = $current_user->getRelatedCommSyUserItem();
                     $authentication = $this->_environment->getAuthenticationObject();
                     $authentication->delete($portalUser_item->getItemID());
                     // delete session
                     $session_manager = $this->_environment->getSessionManager();
                     $session = $this->_environment->getSessionItem();
                     $session_manager->delete($session->getSessionID());
                     $this->_environment->setSessionItem(null);
                     // return
                     $this->_popup_controller->setSuccessfullItemIDReturn($current_user->getItemID());
                     break;
                 case 'account':
                     if ($this->_popup_controller->checkFormData('account')) {
                         $authentication = $this->_environment->getAuthenticationObject();
                         $currentUser = $this->_environment->getCurrentUserItem();
                         // get portal user if in room context
                         if (!$this->_environment->inPortal()) {
                             $portalUser = $this->_environment->getPortalUserItem();
                         } else {
                             $portalUser = $this->_environment->getCurrentUserItem();
                         }
                         $translator = $this->_environment->getTranslationObject();
                         // Datenschutz
                         if ($current_portal_item->getPasswordGeneration() > 0) {
                             if (!$portalUser->isPasswordInGeneration(md5($form_data['new_password']))) {
                                 // password
                                 if (!empty($form_data['new_password'])) {
                                     $auth_manager = $authentication->getAuthManager($currentUser->getAuthSource());
                                     $auth_source = $currentUser->getAuthSource();
                                     $old_password = $auth_manager->getItem($form_data['user_id'])->getPasswordMD5();
                                     if ($old_password == md5($form_data['old_password'])) {
                                         $change_pw = true;
                                         // if password options are set, check password
                                         $auth_source_manager = $this->_environment->getAuthSourceManager();
                                         $auth_source_item = $auth_source_manager->getItem($currentUser->getAuthSource());
                                         $error_array = array();
                                         if ($auth_source_item->getPasswordLength() > 0) {
                                             if (strlen($form_data['new_password']) < $auth_source_item->getPasswordLength()) {
                                                 $error_array[] = $translator->getMessage('PASSWORD_INFO_LENGTH', $auth_source_item->getPasswordLength());
                                                 //$this->_popup_controller->setErrorReturn('1022', 'new password too short');
                                                 $change_pw = false;
                                             }
                                         }
                                         if ($auth_source_item->getPasswordSecureBigchar() == 1) {
                                             if (!preg_match('~[A-Z]+~u', $form_data['new_password'])) {
                                                 $error_array[] = $translator->getMessage('PASSWORD_INFO_BIG');
                                                 //$this->_popup_controller->setErrorReturn('1023', 'new password no big character');
                                                 $change_pw = false;
                                             }
                                         }
                                         if ($auth_source_item->getPasswordSecureSmallchar() == 1) {
                                             if (!preg_match('~[a-z]+~u', $form_data['new_password'])) {
                                                 $error_array[] = $translator->getMessage('PASSWORD_INFO_SMALL');
                                                 //$this->_popup_controller->setErrorReturn('1026', 'new password no small character');
                                                 $change_pw = false;
                                             }
                                         }
                                         if ($auth_source_item->getPasswordSecureNumber() == 1) {
                                             if (!preg_match('~[0-9]+~u', $form_data['new_password'])) {
                                                 $error_array[] = $translator->getMessage('PASSWORD_INFO_NUMBER');
                                                 //$this->_popup_controller->setErrorReturn('1027', 'new password no number');
                                                 $change_pw = false;
                                             }
                                         }
                                         if ($auth_source_item->getPasswordSecureSpecialchar() == 1) {
                                             if (!preg_match('~[^a-zA-Z0-9]+~u', $form_data['new_password'])) {
                                                 $error_array[] = $translator->getMessage('PASSWORD_INFO_SPECIAL');
                                                 //$this->_popup_controller->setErrorReturn('1024', 'new password no special character');
                                                 $change_pw = false;
                                             }
                                         }
                                         unset($auth_source);
                                         if ($change_pw) {
                                             $portalUser->setPasswordExpireDate($current_portal_item->getPasswordExpiration());
                                             $portalUser->save();
                                             $auth_manager->changePassword($form_data['user_id'], $form_data['new_password']);
                                         } else {
                                             $this->_popup_controller->setErrorReturn('1022', $error_array);
                                         }
                                     } else {
                                         $error_array[] = $translator->getMessage('PASSWORD_OLD_NOT_EQUAL');
                                         $this->_popup_controller->setErrorReturn('1023', $error_array);
                                         #$this->_popup_controller->setErrorReturn('1009', 'password change error');
                                     }
                                     $error_number = $auth_manager->getErrorNumber();
                                     if (!empty($error_number)) {
                                         // TODO:$error_string .= $translator->getMessage('COMMON_ERROR_DATABASE').$error_number.'<br />';
                                     } else {
                                         $portalUser->setNewGenerationPassword($old_password);
                                     }
                                 }
                             } else {
                                 $this->_popup_controller->setErrorReturn('1025', 'password generation error');
                             }
                         } else {
                             if (!empty($form_data['new_password'])) {
                                 $auth_manager = $authentication->getAuthManager($currentUser->getAuthSource());
                                 $old_password = $auth_manager->getItem($form_data['user_id'])->getPasswordMD5();
                                 if ($old_password == md5($form_data['old_password'])) {
                                     $change_pw = true;
                                     // if password options are set, check password
                                     $auth_source_manager = $this->_environment->getAuthSourceManager();
                                     $auth_source_item = $auth_source_manager->getItem($currentUser->getAuthSource());
                                     $error_array = array();
                                     if ($auth_source_item->getPasswordLength() > 0) {
                                         if (strlen($form_data['new_password']) < $auth_source_item->getPasswordLength()) {
                                             $error_array[] = $translator->getMessage('PASSWORD_INFO_LENGTH', $auth_source_item->getPasswordLength()) . '<br>';
                                             //$this->_popup_controller->setErrorReturn('1022', 'new password too short');
                                             $change_pw = false;
                                         }
                                     }
                                     if ($auth_source_item->getPasswordSecureBigchar() == 1) {
                                         if (!preg_match('~[A-Z]+~u', $form_data['new_password'])) {
                                             $error_array[] = $translator->getMessage('PASSWORD_INFO_BIG');
                                             //$this->_popup_controller->setErrorReturn('1023', 'new password no big character');
                                             $change_pw = false;
                                         }
                                     }
                                     if ($auth_source_item->getPasswordSecureSmallchar() == 1) {
                                         if (!preg_match('~[a-z]+~u', $form_data['new_password'])) {
                                             $error_array[] = $translator->getMessage('PASSWORD_INFO_SMALL');
                                             //$this->_popup_controller->setErrorReturn('1026', 'new password no small character');
                                             $change_pw = false;
                                         }
                                     }
                                     if ($auth_source_item->getPasswordSecureNumber() == 1) {
                                         if (!preg_match('~[0-9]+~u', $form_data['new_password'])) {
                                             $error_array[] = $translator->getMessage('PASSWORD_INFO_NUMBER');
                                             //$this->_popup_controller->setErrorReturn('1027', 'new password no number');
                                             $change_pw = false;
                                         }
                                     }
                                     if ($auth_source_item->getPasswordSecureSpecialchar() == 1) {
                                         if (!preg_match('~[^a-zA-Z0-9]+~u', $form_data['new_password'])) {
                                             $error_array[] = $translator->getMessage('PASSWORD_INFO_SPECIAL');
                                             //$this->_popup_controller->setErrorReturn('1024', 'new password no special character');
                                             $change_pw = false;
                                         }
                                     }
                                     unset($auth_source);
                                     if ($change_pw) {
                                         $portalUser->setPasswordExpireDate($current_portal_item->getPasswordExpiration());
                                         $portalUser->save();
                                         $auth_manager->changePassword($form_data['user_id'], $form_data['new_password']);
                                     } else {
                                         $this->_popup_controller->setErrorReturn('1022', $error_array);
                                     }
                                 } else {
                                     $error_array[] = $translator->getMessage('PASSWORD_OLD_NOT_EQUAL');
                                     $this->_popup_controller->setErrorReturn('1023', $error_array);
                                     #$this->_popup_controller->setErrorReturn('1008', 'password change error');
                                 }
                                 $error_number = $auth_manager->getErrorNumber();
                                 if (!empty($error_number)) {
                                     // TODO:$error_string .= $translator->getMessage('COMMON_ERROR_DATABASE').$error_number.'<br />';
                                 } else {
                                     $portalUser->setNewGenerationPassword($old_password);
                                 }
                             }
                         }
                         // user id
                         if (!empty($form_data['user_id']) && $form_data['user_id'] != $portalUser->getUserID()) {
                             $check = true;
                             $auth_source = $portalUser->getAuthSource();
                             if (!empty($auth_source)) {
                                 $authentication = $this->_environment->getAuthenticationObject();
                                 if (!$authentication->is_free($form_data['user_id'], $auth_source)) {
                                     $this->_popup_controller->setErrorReturn("1011", "user id error(duplicated)", array());
                                     $check = false;
                                 } elseif (withUmlaut($form_data['user_id'])) {
                                     $this->_popup_controller->setErrorReturn("1012", "user id error(umlaut)", array());
                                     $check = false;
                                 }
                             } else {
                                 $this->_popup_controller->setErrorReturn("1013", "user id error(auth source error)", array());
                                 $check = false;
                             }
                             if ($check === true) {
                                 if ($authentication->changeUserID($form_data['user_id'], $portalUser)) {
                                     $session_manager = $this->_environment->getSessionManager();
                                     $session = $this->_environment->getSessionItem();
                                     $session_id_old = $session->getSessionID();
                                     $session_manager->delete($session_id_old, true);
                                     $session->createSessionID($form_data['user_id']);
                                     $cookie = $session->getValue('cookie');
                                     if ($cookie == 1) {
                                         $session->setValue('cookie', 2);
                                     }
                                     $session_manager->save($session);
                                     unset($session_manager);
                                     $portalUser->setUserID($form_data['user_id']);
                                     $currentUser->setUserID($form_data['user_id']);
                                     require_once 'functions/misc_functions.php';
                                     plugin_hook('user_save', $portalUser);
                                 }
                             } else {
                                 $this->_popup_controller->setErrorReturn("117", "user id error(duplicated, umlaut, etc)", array());
                             }
                         } else {
                             // $success_1 = true
                         }
                         $save = false;
                         // language
                         if (!empty($form_data['language']) && $form_data['language'] != $portalUser->getLanguage()) {
                             $portalUser->setLanguage($form_data['language']);
                             $save = true;
                             if ($this->_environment->inPrivateRoom()) {
                                 $currentUser->setLanguage($form_data['language']);
                                 $currentUser->save();
                             }
                         }
                         if (isset($form_data['mail_account'])) {
                             $currentUser->setAccountWantMail('yes');
                             $currentUser->save();
                             #$save = true;
                         } else {
                             $currentUser->setAccountWantMail('no');
                             $currentUser->save();
                             #$save = true;
                         }
                         if (isset($form_data['mail_room'])) {
                             $currentUser->setOpenRoomWantMail('yes');
                             $currentUser->save();
                             #$save = true;
                         } else {
                             $currentUser->setOpenRoomWantMail('no');
                             $currentUser->save();
                             #$save = true;
                         }
                         // mail settings
                         // 							if(!empty($form_data['mail_account'])) {
                         // 								if($portalUser->getAccountWantMail() == 'no') {
                         // 									$portalUser->setAccountWantMail('yes');
                         // 									$save = true;
                         // 								}
                         // 							} else {
                         // 								if($portalUser->getAccountWantMail() == 'yes') {
                         // 									$portalUser->setAccountWantMail('no');
                         // 									$save = true;
                         // 								}
                         // 							}
                         // 							if(!empty($form_data['mail_room'])) {
                         // 								if($portalUser->getOpenRoomWantMail() == 'no') {
                         // 									$portalUser->setOpenRoomWantMail('yes');
                         // 									$save = true;
                         // 								}
                         // 							} else {
                         // 								if($portalUser->getOpenRoomWantMail() == 'yes') {
                         // 									$portalUser->setOpenRoomWantMail('no');
                         // 									$save = true;
                         // 								}
                         // 							}
                         /*							if(!empty($form_data['mail_delete_entry'])) {
                         								if($portalUser->getDeleteEntryWantMail() == 'no') {
                         									$portalUser->setDeleteEntryWantMail('yes');
                         									$save = true;
                         								}
                         							} else {
                         								if($portalUser->getDeleteEntryWantMail() == 'yes') {
                         									$portalUser->setDeleteEntryWantMail('no');
                         									$save = true;
                         								}
                         							}
                         */
                         $change_name = false;
                         $text_converter = $this->_environment->getTextConverter();
                         $form_data['forname'] = $text_converter->sanitizeHTML($form_data['forname']);
                         $form_data['surname'] = $text_converter->sanitizeHTML($form_data['surname']);
                         // forname
                         if (!empty($form_data['forname']) && $portalUser->getFirstName() != $form_data['forname']) {
                             $portalUser->setFirstName($form_data['forname']);
                             $change_name = true;
                             $save = true;
                         }
                         // surname
                         if (!empty($form_data['surname']) && $portalUser->getLastName() != $form_data['surname']) {
                             $portalUser->setLastName($form_data['surname']);
                             $change_name = true;
                             $save = true;
                         }
                         // auto save
                         if (!empty($form_data['auto_save'])) {
                             if ($form_data['auto_save'] == 'on') {
                                 $portalUser->turnAutoSaveOn();
                             } else {
                                 $portalUser->turnAutoSaveOff();
                             }
                             $save = true;
                         } else {
                             $portalUser->turnAutoSaveOff();
                             $save = true;
                         }
                         global $c_email_upload;
                         if ($c_email_upload && !$portalUser->isRoot()) {
                             $own_room = $currentUser->getOwnRoom();
                             if (isset($form_data['email_to_commsy']) and !empty($form_data['email_to_commsy'])) {
                                 $own_room->setEmailToCommSy();
                             } else {
                                 $own_room->unsetEmailToCommSy();
                             }
                             if (isset($form_data['email_to_commsy_secret']) and !empty($form_data['email_to_commsy_secret'])) {
                                 $own_room->setEmailToCommSySecret($form_data['email_to_commsy_secret']);
                             } else {
                                 $own_room->setEmailToCommSySecret('');
                             }
                             $own_room->save();
                             $save = true;
                         }
                         if ($save === true) {
                             $portalUser->save();
                         }
                         // change firstname and lastname in all other user_items of this user
                         if ($change_name === true) {
                             $user_manager = $this->_environment->getUserManager();
                             $dummy_user = $user_manager->getNewItem();
                             // forname
                             $value = $form_data['forname'];
                             if (empty($value)) {
                                 $value = -1;
                             }
                             $dummy_user->setFirstName($value);
                             // surname
                             $value = $form_data['surname'];
                             if (empty($value)) {
                                 $value = -1;
                             }
                             $dummy_user->setLastName($value);
                             $portalUser->changeRelatedUser($dummy_user);
                         }
                         // set return
                         $this->_popup_controller->setSuccessfullItemIDReturn($portalUser->getItemID());
                     }
                     break;
                     /**** IMPORT ****/
                 /**** IMPORT ****/
                 case 'import':
                     if ($this->_popup_controller->checkFormData('upload_import_private_room')) {
                         if (!empty($additional["fileInfo"])) {
                             $temp_stamp = time();
                             rename($additional["fileInfo"]["file"], 'var/temp/upload_' . $temp_stamp . '.zip');
                             $zip = new ZipArchive();
                             $res = $zip->open('var/temp/upload_' . $temp_stamp . '.zip');
                             if ($res === TRUE) {
                                 $zip->extractTo('var/temp/' . $temp_stamp);
                                 $zip->close();
                                 $commsy_work_dir = getcwd();
                                 chdir('var/temp/' . $temp_stamp);
                                 foreach (glob("commsy_xml_export_import_*.xml") as $filename) {
                                     $xml = simplexml_load_file($filename, null, LIBXML_NOCDATA);
                                     //el($xml);
                                     $dom = new DOMDocument('1.0');
                                     $dom->preserveWhiteSpace = false;
                                     $dom->formatOutput = true;
                                     $dom->loadXML($xml->asXML());
                                     //el($dom->saveXML());
                                     $options = array();
                                     chdir($commsy_work_dir);
                                     $room_manager = $this->_environment->getRoomManager();
                                     $room_manager->import_item($xml, null, $options);
                                     chdir('var/temp/' . $temp_stamp);
                                     $files = scandir('.');
                                     foreach ($files as $file) {
                                         if (strpos($file, 'files') === 0) {
                                             $directory_name_array = explode('_', $file);
                                             $directory_old_id = $directory_name_array[1];
                                             $disc_manager = $this->_environment->getDiscManager();
                                             $disc_manager->setPortalID($this->_environment->getCurrentPortalID());
                                             $directory_new_id = $options[$directory_old_id];
                                             if ($directory_new_id != '') {
                                                 $disc_manager->setContextID($directory_new_id);
                                                 $new_file_path = $disc_manager->getFilePath();
                                                 chdir($file);
                                                 $files_to_copy = glob('./*');
                                                 foreach ($files_to_copy as $file_to_copy) {
                                                     if (!(strpos($file, 'default_cs_gradient') === 0)) {
                                                         $file_to_copy = str_ireplace('./', '', $file_to_copy);
                                                         $file_name_array = explode('.', $file_to_copy);
                                                         $file_old_id = $file_name_array[0];
                                                         $file_new_id = $options[$file_old_id];
                                                         if ($file_new_id != '') {
                                                             $file_to_copy_temp = str_ireplace($file_old_id . '.', $file_new_id . '.', $file_to_copy);
                                                             $file_to_copy_temp = './' . $file_to_copy_temp;
                                                             $file_to_go = str_replace('./', $commsy_work_dir . '/' . $new_file_path, $file_to_copy_temp);
                                                             copy($file_to_copy, $file_to_go);
                                                         }
                                                     }
                                                 }
                                                 chdir('..');
                                             }
                                         }
                                     }
                                 }
                                 chdir($commsy_work_dir);
                             }
                         }
                     }
                     break;
                     /**** USER PICTURE ****/
                 /**** USER PICTURE ****/
                 case 'user_picture':
                     if ($this->_popup_controller->checkFormData('user_picture')) {
                         /* handle user picture upload */
                         if (!empty($additional["fileInfo"])) {
                             $currentUser = $this->_environment->getCurrentUserItem();
                             $portalUser = $currentUser->getRelatedCommSyUserItem();
                             $srcfile = $additional["fileInfo"]["file"];
                             $targetfile = $srcfile . "_converted";
                             $session = $this->_environment->getSessionItem();
                             $session->unsetValue("add_files");
                             // resize image to a maximum width of 150px and keep ratio
                             $size = getimagesize($srcfile);
                             list($x_orig, $y_orig, $type) = $size;
                             $verhaeltnis = $y_orig / $x_orig;
                             $max_width = 150;
                             $ratio = 1.334;
                             // 3:4
                             if ($verhaeltnis < $ratio) {
                                 // wider than 1:$ratio
                                 $source_width = $y_orig * $max_width / ($max_width * $ratio);
                                 $source_height = $y_orig;
                                 $source_x = ($x_orig - $source_width) / 2;
                                 $source_y = 0;
                             } else {
                                 // higher than 1:$ratio
                                 $source_width = $x_orig;
                                 $source_height = $x_orig * ($max_width * $ratio) / $max_width;
                                 $source_x = 0;
                                 $source_y = ($y_orig - $source_height) / 2;
                             }
                             // create image
                             switch ($type) {
                                 case '1':
                                     $im = imagecreatefromgif($srcfile);
                                     break;
                                 case '2':
                                     $im = imagecreatefromjpeg($srcfile);
                                     break;
                                 case '3':
                                     $im = imagecreatefrompng($srcfile);
                                     break;
                             }
                             $newimg = imagecreatetruecolor($max_width, $max_width * $ratio);
                             imagecopyresampled($newimg, $im, 0, 0, $source_x, $source_y, $max_width, ceil($max_width * $ratio), $source_width, $source_height);
                             imagepng($newimg, $targetfile);
                             // clean up
                             imagedestroy($im);
                             imagedestroy($newimg);
                             // determ new file name
                             $filename_info = pathinfo($additional["fileInfo"]["name"]);
                             $filename = 'cid' . $this->_environment->getCurrentContextID() . '_' . $currentUser->getItemID() . '.' . $filename_info['extension'];
                             // copy file and set picture
                             $disc_manager = $this->_environment->getDiscManager();
                             $disc_manager->copyFile($targetfile, $filename, true);
                             $currentUser->setPicture($filename);
                             $modifier = $this->_environment->getCurrentUserItem();
                             if (isset($portalUser)) {
                                 if ($disc_manager->copyImageFromRoomToRoom($filename, $portalUser->getContextID())) {
                                     $value_array = explode('_', $filename);
                                     $old_room_id = $value_array[0];
                                     $old_room_id = str_replace('cid', '', $old_room_id);
                                     $valu_array[0] = 'cid' . $portalUser->getContextID();
                                     $new_picture_name = implode('_', $value_array);
                                     $portalUser->setPicture($new_picture_name);
                                     $portalUser->setModificatorItem($modifier);
                                     $portalUser->setModificationDate(getCurrentDateTimeInMySQL());
                                     $portalUser->save();
                                 }
                             }
                             // save
                             $currentUser->setModificatorItem($modifier);
                             $currentUser->setModificationDate(getCurrentDateTimeInMySQL());
                             $currentUser->save();
                         }
                         // set return
                         $this->_popup_controller->setSuccessfullDataReturn($filename);
                     }
                     break;
                     /**** USER ****/
                 /**** USER ****/
                 case 'user':
                     $currentUser = $this->_environment->getCurrentUserItem();
                     $portalUser = $currentUser->getRelatedCommSyUserItem();
                     $text_converter = $this->_environment->getTextConverter();
                     $currentContext = $this->_environment->getCurrentContextItem();
                     if ($this->_popup_controller->checkFormData('user')) {
                         function setValue($currentUser, $portalUser_item, $method, $value)
                         {
                             if (isset($value)) {
                                 // set for user
                                 call_user_func_array(array($currentUser, $method), array($value));
                                 if (isset($portalUser_item)) {
                                     // set for portal user
                                     call_user_func_array(array($portalUser_item, $method), array($value));
                                 }
                             }
                         }
                         setValue($currentUser, $portalUser, 'setTitle', $text_converter->sanitizeHTML($form_data['title']));
                         setValue($currentUser, $portalUser, 'setBirthday', $text_converter->sanitizeHTML($form_data['birthday']));
                         $email_old = $portalUser->getEmail();
                         setValue($currentUser, $portalUser, 'setEmail', $text_converter->sanitizeHTML($form_data['mail']));
                         if ($portalUser->hasToChangeEmail() and $email_old != $form_data['mail']) {
                             $portalUser->unsetHasToChangeEmail();
                             $form_data['mail_all'] = 1;
                         }
                         unset($email_old);
                         if ($currentContext->isPortal()) {
                             if ($form_data['mail_hide']) {
                                 $portalUser->setDefaultMailNotVisible();
                             } else {
                                 $portalUser->setDefaultMailVisible();
                             }
                             if ($form_data['mail_hide_all']) {
                                 $user_list = $currentUser->getRelatedUserList();
                                 $user_item = $user_list->getFirst();
                                 while ($user_item) {
                                     if ($form_data['mail_hide']) {
                                         $user_item->setEmailNotVisible();
                                     } else {
                                         $user_item->setEmailVisible();
                                     }
                                     $user_item->save();
                                     $user_item = $user_list->getNext();
                                 }
                                 $currentUser->setDefaultMailNotVisible();
                                 $currentUser->save();
                             }
                         } else {
                             if ($form_data['mail_hide']) {
                                 $currentUser->setEmailNotVisible();
                             } else {
                                 $currentUser->setEmailVisible();
                             }
                             if ($form_data['mail_hide_all']) {
                                 $user_list = $currentUser->getRelatedUserList();
                                 $user_item = $user_list->getFirst();
                                 while ($user_item) {
                                     if ($form_data['mail_hide']) {
                                         $user_item->setEmailNotVisible();
                                     } else {
                                         $user_item->setEmailVisible();
                                     }
                                     $user_item->save();
                                     $user_item = $user_list->getNext();
                                 }
                                 $currentUser->setDefaultMailNotVisible();
                                 $currentUser->save();
                             }
                         }
                         // im portal nur default wert
                         // im raum default wert und raum wert?
                         setValue($currentUser, $portalUser, 'setTelephone', $text_converter->sanitizeHTML($form_data['telephone']));
                         setValue($currentUser, $portalUser, 'setCellularphone', $text_converter->sanitizeHTML($form_data['cellularphone']));
                         setValue($currentUser, $portalUser, 'setStreet', $text_converter->sanitizeHTML($form_data['street']));
                         setValue($currentUser, $portalUser, 'setZipcode', $text_converter->sanitizeHTML($form_data['zipcode']));
                         setValue($currentUser, $portalUser, 'setCity', $text_converter->sanitizeHTML($form_data['city']));
                         setValue($currentUser, $portalUser, 'setRoom', $text_converter->sanitizeHTML($form_data['room']));
                         setValue($currentUser, $portalUser, 'setOrganisation', $text_converter->sanitizeHTML($form_data['organisation']));
                         setValue($currentUser, $portalUser, 'setPosition', $text_converter->sanitizeHTML($form_data['position']));
                         setValue($currentUser, $portalUser, 'setICQ', $text_converter->sanitizeHTML($form_data['icq']));
                         setValue($currentUser, $portalUser, 'setMSN', $text_converter->sanitizeHTML($form_data['msn']));
                         setValue($currentUser, $portalUser, 'setSkype', $text_converter->sanitizeHTML($form_data['skype']));
                         setValue($currentUser, $portalUser, 'setYahoo', $text_converter->sanitizeHTML($form_data['yahoo']));
                         setValue($currentUser, $portalUser, 'setJabber', $text_converter->sanitizeHTML($form_data['jabber']));
                         setValue($currentUser, $portalUser, 'setHomepage', $text_converter->sanitizeHTML($form_data['homepage']));
                         setValue($currentUser, $portalUser, 'setDescription', $form_data['description']);
                         // delete picture handling
                         if (isset($form_data['delete_picture']) && $currentUser->getPicture()) {
                             $disc_manager = $this->_environment->getDiscManager();
                             // unlink file
                             if ($disc_manager->existsFile($currentUser->getPicture())) {
                                 $disc_manager->unlinkFile($currentUser->getPicture());
                             }
                             // set non picture
                             $currentUser->setPicture('');
                             if (isset($portalUser)) {
                                 $portalUser->setPicture('');
                             }
                         }
                         // set modificator and modification date and save
                         $modifier = $this->_environment->getCurrentUserItem();
                         $currentUser->setModificatorItem($modifier);
                         $currentUser->setModificationDate(getCurrentDateTimeInMySQL());
                         $currentUser->save();
                         if (isset($portalUser)) {
                             $portalUser->setModificatorItem($modifier);
                             $portalUser->setModificationDate(getCurrentDateTimeInMySQL());
                             $portalUser->save();
                         }
                         /* change all option */
                         // get a dummy user
                         $user_manager = $this->_environment->getUserManager();
                         $dummy_user = $user_manager->getNewItem();
                         $changeAll = false;
                         function setChangeAllValue($currentUser, $dummy_user_item, $method_set, $method_get, $checked)
                         {
                             if (isset($checked)) {
                                 $value = call_user_func_array(array($currentUser, $method_get), array());
                                 if (empty($value)) {
                                     $value = -1;
                                 }
                                 call_user_func_array(array($dummy_user_item, $method_set), array($value));
                             }
                             return $checked;
                         }
                         $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setTitle', 'getTitle', $form_data['title_all']);
                         $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setBirthday', 'getBirthday', $form_data['birthday_all']);
                         $changeAll = $changeAll || setChangeAllValue($currentUser, $dummy_user, 'setEmail', 'getEmail', $form_data['mail_all']);
                         if (isset($form_data['mail_all'])) {
                             $changeAll = true;
                             if (!$currentUser->isEmailVisible()) {
                                 $dummy_user->setEmailNotVisible();
                             } else {
                                 $dummy_user->setEmailVisible();
                             }
                         }
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setTelephone', 'getTelephone', $form_data['telephone_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setCellularphone', 'getCellularphone', $form_data['cellularphone_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setStreet', 'getStreet', $form_data['street_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setZipcode', 'getZipcode', $form_data['zipcode_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setCity', 'getCity', $form_data['city_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setRoom', 'getRoom', $form_data['room_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setOrganisation', 'getOrganisation', $form_data['organisation_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setPosition', 'getPosition', $form_data['position_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setICQ', 'getICQ', $form_data['messenger_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setMSN', 'getMSN', $form_data['messenger_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setSkype', 'getSkype', $form_data['messenger_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setYahoo', 'getYahoo', $form_data['messenger_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setJabber', 'getJabber', $form_data['messenger_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setHomepage', 'getHomepage', $form_data['homepage_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setDescription', 'getDescription', $form_data['description_all']) || $changeAll;
                         $changeAll = setChangeAllValue($currentUser, $dummy_user, 'setPicture', 'getPicture', $form_data['picture_all']) || $changeAll;
                         if ($changeAll === true) {
                             $currentUser->changeRelatedUser($dummy_user);
                         }
                         $manager = $this->_environment->getLinkModifierItemManager();
                         $manager->markEdited($currentUser->getItemID());
                         // set return
                         $this->_popup_controller->setSuccessfullItemIDReturn($currentUser->getItemID());
                     }
                     break;
                     /**** NEWSLETTER ****/
                 /**** NEWSLETTER ****/
                 case 'newsletter':
                     if ($this->_popup_controller->checkFormData('newsletter')) {
                         $currentUser = $this->_environment->getCurrentUserItem();
                         $room_item = $currentUser->getOwnRoom();
                         $set_to = 'none';
                         if (isset($form_data['newsletter']) && !empty($form_data['newsletter'])) {
                             if ($form_data['newsletter'] == 2) {
                                 $set_to = 'weekly';
                             } elseif ($form_data['newsletter'] == 3) {
                                 $set_to = 'daily';
                             }
                         }
                         // set
                         $room_item->setPrivateRoomNewsletterActivity($set_to);
                         // save
                         $room_item->save();
                         // set return
                         $this->_popup_controller->setSuccessfullItemIDReturn($room_item->getItemID());
                     }
                     break;
                 case 'cs_bar':
                     if ($this->_popup_controller->checkFormData('cs_bar')) {
                         $currentUser = $this->_environment->getCurrentUserItem();
                         $room_item = $currentUser->getOwnRoom();
                         //---
                         $wordpress_manager = $this->_environment->getWordpressManager();
                         $wiki_manager = $this->_environment->getWikiManager();
                         if ($additional['action'] == 'create_wordpress') {
                             if (isset($form_data['use_comments']) and !empty($form_data['use_comments']) and $form_data['use_comments'] == 'yes') {
                                 $room_item->setWordpressUseComments();
                             } else {
                                 $room_item->unsetWordpressUseComments();
                             }
                             if (isset($form_data['use_comments_moderation']) and !empty($form_data['use_comments_moderation']) and $form_data['use_comments_moderation'] == 'yes') {
                                 $room_item->setWordpressUseCommentsModeration();
                             } else {
                                 $room_item->unsetWordpressUseCommentsModeration();
                             }
                             if (isset($form_data['wordpresslink']) and !empty($form_data['wordpresslink']) and $form_data['wordpresslink'] == 'yes') {
                                 $room_item->setWordpressHomeLink();
                             } else {
                                 $room_item->unsetWordpressHomeLink();
                             }
                             if (isset($form_data['skin_choice']) and !empty($form_data['skin_choice'])) {
                                 $room_item->setWordpressSkin($form_data['skin_choice']);
                             }
                             if (isset($form_data['wordpresstitle']) and !empty($form_data['wordpresstitle'])) {
                                 $room_item->setWordpressTitle($form_data['wordpresstitle']);
                             } else {
                                 $room_item->setWordpressTitle($room_item->getTitle());
                             }
                             if (isset($form_data['wordpressdescription']) and !empty($form_data['wordpressdescription'])) {
                                 $room_item->setWordpressDescription($form_data['wordpressdescription']);
                             } else {
                                 $room_item->setWordpressDescription('');
                             }
                             if (isset($form_data['member_role']) and !empty($form_data['member_role'])) {
                                 $room_item->setWordpressMemberRole($form_data['member_role']);
                             } else {
                                 $room_item->setWordpressMemberRole();
                             }
                             $room_item->setWithWordpressFunctions();
                             $room_item->setWordpressExists();
                             $room_item->setWordpressActive();
                             // save
                             $room_item->save();
                             // create or change new wordpress
                             $success = $wordpress_manager->createWordpress($room_item);
                         } else {
                             if ($additional['action'] == 'delete_wordpress') {
                                 if ($wordpress_manager->deleteWordpress($room_item->getWordpressId())) {
                                     $current_user = $this->_environment->getCurrentUserItem();
                                     $room_item->setModificatorItem($current_user);
                                     $room_item->setModificationDate(getCurrentDateTimeInMySQL());
                                     $room_item->unsetWordpressExists();
                                     $room_item->setWordpressInActive();
                                     $room_item->setWordpressSkin('twentyten');
                                     $room_item->setWordpressTitle($room_item->getTitle());
                                     $room_item->setWordpressDescription('');
                                     $room_item->setWordpressId(0);
                                     // Save item
                                     $room_item->save();
                                 }
                             } else {
                                 if ($additional['action'] == 'create_wiki') {
                                     // Set modificator and modification date
                                     #if ( isset($form_data['wikilink']) and !empty($form_data['wikilink']) and $form_data['wikilink'] == 'yes') {
                                     $room_item->setWikiHomeLink();
                                     #} else {
                                     #   $room_item->unsetWikiHomeLink();
                                     #}
                                     if (isset($form_data['wikilink2']) and !empty($form_data['wikilink2']) and $form_data['wikilink2'] == 'yes') {
                                         $room_item->setWikiPortalLink();
                                     } else {
                                         $room_item->unsetWikiPortalLink();
                                     }
                                     if (isset($form_data['wiki_skin_choice']) and !empty($form_data['wiki_skin_choice'])) {
                                         $room_item->setWikiSkin($form_data['wiki_skin_choice']);
                                     }
                                     if (isset($form_data['wikititle']) and !empty($form_data['wikititle'])) {
                                         $room_item->setWikiTitle($form_data['wikititle']);
                                     } else {
                                         $room_item->setWikiTitle($room_item->getTitle());
                                     }
                                     if (isset($form_data['admin']) and !empty($form_data['admin'])) {
                                         $room_item->setWikiAdminPW($form_data['admin']);
                                     }
                                     if (isset($form_data['edit']) and !empty($form_data['edit'])) {
                                         $room_item->setWikiEditPW($form_data['edit']);
                                     } else {
                                         $room_item->setWikiEditPW('');
                                     }
                                     if (isset($form_data['read']) and !empty($form_data['read'])) {
                                         $room_item->setWikiReadPW($form_data['read']);
                                     } else {
                                         $room_item->setWikiReadPW('');
                                     }
                                     #if ( isset($form_data['use_commsy_login']) ) {
                                     $room_item->setWikiUseCommSyLogin();
                                     #} else {
                                     #   $room_item->unsetWikiUseCommSyLogin();
                                     #}
                                     if (isset($form_data['community_read_access'])) {
                                         $room_item->setWikiCommunityReadAccess();
                                     } else {
                                         $room_item->unsetWikiCommunityReadAccess();
                                     }
                                     if (isset($form_data['community_write_access'])) {
                                         $room_item->setWikiCommunityWriteAccess();
                                     } else {
                                         $room_item->unsetWikiCommunityWriteAccess();
                                     }
                                     if (isset($form_data['portal_read_access'])) {
                                         $room_item->setWikiPortalReadAccess();
                                     } else {
                                         $room_item->unsetWikiPortalReadAccess();
                                     }
                                     if (isset($form_data['room_mod_write_access'])) {
                                         $room_item->setWikiRoomModWriteAccess();
                                     } else {
                                         $room_item->unsetWikiRoomModWriteAccess();
                                     }
                                     if (isset($form_data['show_login_box'])) {
                                         $room_item->setWikiShowCommSyLogin();
                                     } else {
                                         $room_item->unsetWikiShowCommSyLogin();
                                     }
                                     #if ( isset($form_data['enable_fckeditor']) ) {
                                     $room_item->setWikiEnableFCKEditor();
                                     #} else {
                                     #   $room_item->unsetWikiEnableFCKEditor();
                                     #}
                                     #if ( isset($form_data['enable_sitemap']) ) {
                                     $room_item->setWikiEnableSitemap();
                                     #} else {
                                     #   $room_item->unsetWikiEnableSitemap();
                                     #}
                                     #if ( isset($form_data['enable_statistic']) ) {
                                     $room_item->setWikiEnableStatistic();
                                     #} else {
                                     #   $room_item->unsetWikiEnableStatistic();
                                     #}
                                     #if ( isset($form_data['enable_search']) ) {
                                     $room_item->setWikiEnableSearch();
                                     #} else {
                                     #   $room_item->unsetWikiEnableSearch();
                                     #}
                                     #if ( isset($form_data['enable_rss']) ) {
                                     $room_item->setWikiEnableRss();
                                     #} else {
                                     #   $room_item->unsetWikiEnableRss();
                                     #}
                                     if (isset($form_data['enable_calendar'])) {
                                         $room_item->setWikiEnableCalendar();
                                     } else {
                                         $room_item->unsetWikiEnableCalendar();
                                     }
                                     if (isset($form_data['enable_gallery'])) {
                                         $room_item->setWikiEnableGallery();
                                     } else {
                                         $room_item->unsetWikiEnableGallery();
                                     }
                                     if (isset($form_data['enable_notice'])) {
                                         $room_item->setWikiEnableNotice();
                                     } else {
                                         $room_item->unsetWikiEnableNotice();
                                     }
                                     #if ( isset($form_data['enable_pdf']) ) {
                                     $room_item->setWikiEnablePdf();
                                     #} else {
                                     #   $room_item->unsetWikiEnablePdf();
                                     #}
                                     if (isset($form_data['enable_rater'])) {
                                         $room_item->setWikiEnableRater();
                                     } else {
                                         $room_item->unsetWikiEnableRater();
                                     }
                                     #if ( isset($form_data['enable_listcategories']) ) {
                                     $room_item->setWikiEnableListCategories();
                                     #} else {
                                     #   $room_item->unsetWikiEnableListCategories();
                                     #}
                                     if (isset($form_data['new_page_template']) && $_POST['new_page_template'] != '') {
                                         $room_item->setWikiNewPageTemplate($_POST['new_page_template']);
                                     } else {
                                         $room_item->unsetWikiNewPageTemplate();
                                     }
                                     if (isset($form_data['enable_swf'])) {
                                         $room_item->setWikiEnableSwf();
                                     } else {
                                         $room_item->unsetWikiEnableSwf();
                                     }
                                     if (isset($form_data['enable_wmplayer'])) {
                                         $room_item->setWikiEnableWmplayer();
                                     } else {
                                         $room_item->unsetWikiEnableWmplayer();
                                     }
                                     if (isset($form_data['enable_quicktime'])) {
                                         $room_item->setWikiEnableQuicktime();
                                     } else {
                                         $room_item->unsetWikiEnableQuicktime();
                                     }
                                     if (isset($form_data['enable_youtube_google_vimeo'])) {
                                         $room_item->setWikiEnableYoutubeGoogleVimeo();
                                     } else {
                                         $room_item->unsetWikiEnableYoutubeGoogleVimeo();
                                     }
                                     include_once 'functions/development_functions.php';
                                     // Discussion
                                     #if ( isset($form_data['enable_discussion']) ) {
                                     $room_item->setWikiEnableDiscussion();
                                     if (isset($form_data['new_discussion'])) {
                                         $_POST['new_discussion'] = $form_data['new_discussion'];
                                         $room_item->WikiSetNewDiscussion($form_data['new_discussion']);
                                     }
                                     #} else {
                                     #   $room_item->unsetWikiEnableDiscussion();
                                     #}
                                     $enable_discussion_discussions = array();
                                     $form_data_keys = array_keys($form_data);
                                     foreach ($form_data_keys as $form_data_key) {
                                         if (stristr($form_data_key, 'enable_discussion_discussions_')) {
                                             $enable_discussion_discussions[] = $form_data[$form_data_key];
                                         }
                                     }
                                     $_POST['enable_discussion_discussions'] = $enable_discussion_discussions;
                                     if (isset($form_data['enable_discussion_notification'])) {
                                         $room_item->setWikiEnableDiscussionNotification();
                                     } else {
                                         $room_item->unsetWikiEnableDiscussionNotification();
                                     }
                                     if (isset($form_data['enable_discussion_notification_groups'])) {
                                         $room_item->setWikiEnableDiscussionNotificationGroups();
                                     } else {
                                         $room_item->unsetWikiEnableDiscussionNotificationGroups();
                                     }
                                     if (isset($form_data['wiki_section_edit'])) {
                                         $room_item->setWikiWithSectionEdit();
                                     } else {
                                         $room_item->setWikiWithoutSectionEdit();
                                     }
                                     if (isset($form_data['wiki_section_edit_header'])) {
                                         $room_item->setWikiWithHeaderForSectionEdit();
                                     } else {
                                         $room_item->setWikiWithoutHeaderForSectionEdit();
                                     }
                                     $room_item->setWikiExists();
                                     $room_item->setWikiActive();
                                     $wiki_manager->createWiki($room_item);
                                     // Save item - after createWiki() -> old discussions might be deleted
                                     $room_item->save();
                                     $enable_wiki_groups = array();
                                     $form_data_keys = array_keys($form_data);
                                     foreach ($form_data_keys as $form_data_key) {
                                         if (stristr($form_data_key, 'enable_wiki_groups_')) {
                                             $enable_wiki_groups[] = $form_data[$form_data_key];
                                         }
                                     }
                                     // WSDL-xml hier noch nicht zugreifbar, daher weiterhin die alte Variante
                                     if (!empty($enable_wiki_groups)) {
                                         //global $c_use_soap_for_wiki;
                                         //if(!$c_use_soap_for_wiki){
                                         $wiki_manager->setWikiGroupsAsPublic($enable_wiki_groups);
                                         //} else {
                                         //   $wiki_manager->setWikiGroupsAsPublic_soap($_POST['enable_wiki_groups']);
                                         //}
                                     } else {
                                         //global $c_use_soap_for_wiki;
                                         //if(!$c_use_soap_for_wiki){
                                         $wiki_manager->setWikiGroupsAsPublic(array());
                                         //} else {
                                         //   $wiki_manager->setWikiGroupsAsPublic_soap(array());
                                         //}
                                     }
                                 } else {
                                     if ($additional['action'] == 'delete_wiki') {
                                         $room_item->setModificatorItem($currentUser);
                                         $room_item->setModificationDate(getCurrentDateTimeInMySQL());
                                         $room_item->unsetWikiExists();
                                         $room_item->setWikiInActive();
                                         $room_item->setWikiSkin('pmwiki');
                                         $room_item->setWikiTitle($room_item->getTitle());
                                         $room_item->unsetWikiEnableDiscussion();
                                         $room_item->unsetWikiEnableDiscussionNotification();
                                         $room_item->unsetWikiEnableDiscussionNotificationGroups();
                                         $room_item->unsetWikiDiscussionArray();
                                         // Save item
                                         $room_item->save();
                                         // delete wiki
                                         $wiki_manager->deleteWiki($room_item);
                                     } else {
                                         if ($additional['action'] == 'chat') {
                                             if (isset($form_data['chatlink']) and !empty($form_data['chatlink']) and $form_data['chatlink'] == 'yes') {
                                                 $room_item->setChatLinkActive();
                                             } else {
                                                 $room_item->setChatLinkInactive();
                                             }
                                             $room_item->save();
                                         } elseif (substr($additional['action'], 0, 7) == 'plugin_') {
                                             $plugin = substr($additional['action'], 7);
                                             $plugin_class = $this->_environment->getPluginClass($plugin);
                                             if (!empty($plugin_class) and method_exists($plugin_class, 'isConfigurableInPortal')) {
                                                 if ($this->_environment->inPortal() and $plugin_class->isConfigurableInPortal() or !$this->_environment->inServer() and method_exists($plugin_class, 'isConfigurableInRoom') and $plugin_class->isConfigurableInRoom(CS_PRIVATEROOM_TYPE) or !$this->_environment->inServer() and method_exists($plugin_class, 'isConfigurableInRoom') and $plugin_class->isConfigurableInRoom() and $plugin == 'voyeur') {
                                                     if (!empty($form_data[$plugin . '_on']) and $form_data[$plugin . '_on'] == 'yes') {
                                                         $room_item->setPluginOn($plugin);
                                                     } else {
                                                         $room_item->setPluginOff($plugin);
                                                     }
                                                     $values = $form_data;
                                                     $values['current_context_item'] = $room_item;
                                                     if ($this->_environment->inPortal() and method_exists($plugin_class, 'configurationAtPortal')) {
                                                         $plugin_class->configurationAtPortal('save_config', $values);
                                                     } elseif (!$this->_environment->inServer() and method_exists($plugin_class, 'configurationAtRoom')) {
                                                         $plugin_class->configurationAtRoom('save_config', $values);
                                                     }
                                                 }
                                             }
                                             $room_item->save();
                                         } else {
                                             if ($additional['action'] == 'export_private_room') {
                                                 $currentUserItem = $this->_environment->getCurrentUserItem();
                                                 $privateroom_manager = $this->_environment->getPrivateRoomManager();
                                                 $privateroom_item = $privateroom_manager->getRelatedOwnRoomForUser($currentUserItem, $this->_environment->getCurrentPortalID());
                                                 $room_manager = $this->_environment->getRoomManager();
                                                 $xml = $room_manager->export_item($privateroom_item->getItemID());
                                                 //$xml = $room_manager->export_item(488);
                                                 $dom = new DOMDocument('1.0');
                                                 $dom->preserveWhiteSpace = false;
                                                 $dom->formatOutput = true;
                                                 $dom->loadXML($xml->asXML());
                                                 //el($dom->saveXML());
                                                 $filename = 'var/temp/commsy_xml_export_import_' . $privateroom_item->getItemID() . '.xml';
                                                 if (file_exists($filename)) {
                                                     unlink($filename);
                                                 }
                                                 $xmlfile = fopen($filename, 'a');
                                                 fputs($xmlfile, $dom->saveXML());
                                                 fclose($xmlfile);
                                                 //Location where export is saved
                                                 $zipfile = 'var/temp/commsy_export_import_' . $privateroom_item->getItemID() . '.zip';
                                                 if (file_exists($zipfile)) {
                                                     unlink($zipfile);
                                                 }
                                                 //Location that will be backuped
                                                 $disc_manager = $this->_environment->getDiscManager();
                                                 $disc_manager->setPortalID($this->_environment->getCurrentPortalID());
                                                 $backup_paths = array();
                                                 $room_item = $privateroom_manager->getItem($privateroom_item->getItemID());
                                                 $disc_manager->setContextID($room_item->getItemId());
                                                 $backup_paths[$room_item->getItemId()] = $disc_manager->getFilePath();
                                                 if (class_exists('ZipArchive')) {
                                                     include_once 'functions/misc_functions.php';
                                                     $zip = new ZipArchive();
                                                     $filename_zip = $zipfile;
                                                     if ($zip->open($filename_zip, ZIPARCHIVE::CREATE) !== TRUE) {
                                                         include_once 'functions/error_functions.php';
                                                         trigger_error('can not open zip-file ' . $filename_zip, E_USER_WARNNG);
                                                     }
                                                     $temp_dir = getcwd();
                                                     foreach ($backup_paths as $item_id => $backup_path) {
                                                         chdir($backup_path);
                                                         $zip = addFolderToZip('.', $zip, 'files_' . $item_id);
                                                         chdir($temp_dir);
                                                     }
                                                     $zip->addFile($filename, basename($filename));
                                                     $zip->close();
                                                     unset($zip);
                                                     #header('Content-disposition: attachment; filename=commsy_export_import_'.$_POST['room'].'.zip');
                                                     #header('Content-type: application/zip');
                                                     #readfile($zipfile);
                                                     //export_privateroom
                                                     $this->_popup_controller->setSuccessfullDataReturn(array('commsy_export' => '/commsy.php?cid=' . $this->_environment->getCurrentPortalID() . '&mod=export_privateroom&fct=getfile'));
                                                 } else {
                                                     include_once 'functions/error_functions.php';
                                                     trigger_error('can not initiate ZIP class, please contact your system administrator', E_USER_WARNNG);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         //---
                         if (isset($form_data['show_widget_view']) && !empty($form_data['show_widget_view'])) {
                             if ($form_data['show_widget_view'] == 'yes') {
                                 $room_item->setCSBarShowWidgets('1');
                             } else {
                                 $room_item->setCSBarShowWidgets('-1');
                             }
                         } else {
                             $room_item->setCSBarShowWidgets('-1');
                         }
                         if (isset($form_data['show_roomwide_search']) && !empty($form_data['show_roomwide_search'])) {
                             if ($form_data['show_roomwide_search'] == 'yes') {
                                 $room_item->setPortletShowRoomWideSearchBox('1');
                             } else {
                                 $room_item->setPortletShowRoomWideSearchBox('-1');
                             }
                         } else {
                             $room_item->setPortletShowRoomWideSearchBox('-1');
                         }
                         if (isset($form_data['show_newest_entries']) && !empty($form_data['show_newest_entries'])) {
                             if ($form_data['show_newest_entries'] == 'yes') {
                                 $room_item->setPortletShowNewEntryList('1');
                             } else {
                                 $room_item->setPortletShowNewEntryList('-1');
                             }
                         } else {
                             $room_item->setPortletShowNewEntryList('-1');
                         }
                         if (isset($form_data['show_active_rooms']) && !empty($form_data['show_active_rooms'])) {
                             if ($form_data['show_active_rooms'] == 'yes') {
                                 $room_item->setPortletShowActiveRoomList('1');
                             } else {
                                 $room_item->setPortletShowActiveRoomList('-1');
                             }
                         } else {
                             $room_item->setPortletShowActiveRoomList('-1');
                         }
                         if (isset($form_data['show_calendar_view']) && !empty($form_data['show_calendar_view'])) {
                             if ($form_data['show_calendar_view'] == 'yes') {
                                 $room_item->setCSBarShowCalendar('1');
                             } else {
                                 $room_item->setCSBarShowCalendar('-1');
                             }
                         } else {
                             $room_item->setCSBarShowCalendar('-1');
                         }
                         if (isset($form_data['show_stack_view']) && !empty($form_data['show_stack_view'])) {
                             if ($form_data['show_stack_view'] == 'yes') {
                                 $room_item->setCSBarShowStack('1');
                             } else {
                                 $room_item->setCSBarShowStack('-1');
                             }
                         } else {
                             $room_item->setCSBarShowStack('-1');
                         }
                         if (isset($form_data['show_portfolio_view']) && !empty($form_data['show_portfolio_view'])) {
                             if ($form_data['show_portfolio_view'] == 'yes') {
                                 $room_item->setCSBarShowPortfolio('1');
                             } else {
                                 $room_item->setCSBarShowPortfolio('-1');
                             }
                         } else {
                             $room_item->setCSBarShowPortfolio('-1');
                         }
                         // portal2portal
                         if (isset($form_data['show_connection_view']) && !empty($form_data['show_connection_view'])) {
                             if ($form_data['show_connection_view'] == 'yes') {
                                 $room_item->setCSBarShowConnection('1');
                             } else {
                                 $room_item->setCSBarShowConnection('-1');
                             }
                         } else {
                             $room_item->setCSBarShowConnection('-1');
                         }
                         if (isset($form_data['show_old_room_switcher']) && !empty($form_data['show_old_room_switcher'])) {
                             if ($form_data['show_old_room_switcher'] == 'yes') {
                                 $room_item->setCSBarShowOldRoomSwitcher('1');
                             } else {
                                 $room_item->setCSBarShowOldRoomSwitcher('-1');
                             }
                         } else {
                             $room_item->setCSBarShowOldRoomSwitcher('-1');
                         }
                         // save
                         $room_item->save();
                         // set return
                         $this->_popup_controller->setSuccessfullItemIDReturn($room_item->getItemID());
                     }
                     break;
             }
         }
         // 			// save user
         // 			else {
         // 				$room_item = $environment->getCurrentContextItem();
         // 				// Define rubric connections
         // 				$rubric_connection = array();
         // 				$current_rubrics = $room_item->getAvailableRubrics();
         // 				foreach ( $current_rubrics as $rubric ) {
         // 					switch ( $rubric ) {
         // 						case CS_GROUP_TYPE:
         // 							$rubric_connection[] = CS_GROUP_TYPE;
         // 							break;
         // 						case CS_INSTITUTION_TYPE:
         // 							$rubric_connection[] = CS_INSTITUTION_TYPE;
         // 							break;
         // 					}
         // 				}
         // 				$profile_view->setRubricConnections($rubric_connection);
         // 				$params = $environment->getCurrentParameterArray();
         // 				unset($params['is_saved']);
         // 				$profile_view->setAction(curl($environment->getCurrentContextID(),$environment->getCurrentModule(),$environment->getCurrentFunction(),$params));
         // 				if (!$currentUser->mayEditRegular($current_user)) {
         // 					$profile_view->warnChanger();
         // 					$params = array();
         // 					$params['environment'] = $environment;
         // 					$params['with_modifying_actions'] = true;
         // 					$params['width'] = 500;
         // 					$errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params);
         // 					unset($params);
         // 					$errorbox->setText($translator->getMessage('COMMON_EDIT_AS_MODERATOR'));
         // 				}
         // 				$profile_view->setForm($form);
         // 			}
     }
 }
Beispiel #6
0
" /></td>
			</tr></form>
		
		<?php 
    }
}
//
//	RBAC Editing Functions
//
echo $HTML->boxMiddle(_('Edit Roles'));
echo '<form action="roleedit.php?group_id=' . $group_id . '" method="POST">';
echo role_box($group_id, 'role_id', '');
echo '<input type="submit" name="edit" value="' . _('Edit Role') . '"></form>';
echo '<p><a href="roleedit.php?group_id=' . $group_id . '">' . _('Add Role') . '</a>';
//
//	Project hierarchy functions
plugin_hook('admin_project_link', $group_id);
echo $HTML->boxBottom();
?>

		</td>
	</tr>

</table>

<?php 
project_admin_footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
/**
 * Delete a user from a friends list
 *
 * @param integer $user_id the user id
 * @param integer $friend_id the friend id
 * @return mixed an ADODB RecordSet object with the results or false
 * @author Misja Hoebe <*****@*****.**>
 */
function user_friend_delete($user_id, $friend_id)
{
    if (empty($user_id) || empty($friend_id)) {
        trigger_error(__FUNCTION__ . ": invalid arguments (user id: {$user_id}, friend id: {$friend_id})", E_ERROR);
    }
    $result = delete_records('friends', 'owner', $user_id, 'friend', $friend_id);
    if ($result != false) {
        $obj = new StdClass();
        $obj->owner = $user_id;
        $obj->friend = $friend_id;
        plugin_hook("friendship", "delete", $obj);
    }
    return $result;
}
Beispiel #8
0
 /**
  *	projectTabs() - Prints out the project tabs, contained here in case
  *		we want to allow it to be overriden
  *
  *	@param	string	Is the tab currently selected
  *	@param	string	Is the group we should look up get title info
  */
 function projectTabs($toptab, $group)
 {
     // get group info using the common result set
     $project =& group_get_object($group);
     if (!$project || !is_object($project)) {
         return;
     }
     if ($project->isError()) {
         //wasn't found or some other problem
         return;
     }
     if (!$project->isProject()) {
         return;
     }
     // Summary
     if (isset($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
         $TABS_DIRS[] = '/project/?group_id=' . $project->getId();
     } else {
         $TABS_DIRS[] = '/projects/' . $project->getUnixName() . '/';
     }
     $TABS_TITLES[] = _('Summary');
     $toptab == 'home' ? $selected = count($TABS_TITLES) - 1 : '';
     // Project Admin
     $perm =& $project->getPermission(session_get_user());
     if ($perm->isAdmin()) {
         $TABS_DIRS[] = '/project/admin/?group_id=' . $group;
         $TABS_TITLES[] = _('Admin');
         $toptab == 'admin' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     /* Homepage
     		$TABS_DIRS[]='http://'. $project->getHomePage();
     		$TABS_TITLES[]=_('Home Page');
     		*/
     // Project Activity tab
     $TABS_DIRS[] = '/activity/?group_id=' . $group;
     $TABS_TITLES[] = _('Activity');
     $toptab == 'activity' ? $selected = count($TABS_TITLES) - 1 : '';
     // Forums
     if ($project->usesForum()) {
         $TABS_DIRS[] = '/forum/?group_id=' . $group;
         $TABS_TITLES[] = _('Forums');
         $toptab == 'forums' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Artifact Tracking
     if ($project->usesTracker()) {
         $TABS_DIRS[] = '/tracker/?group_id=' . $group;
         $TABS_TITLES[] = _('Tracker');
         $toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Mailing Lists
     if ($project->usesMail()) {
         $TABS_DIRS[] = '/mail/?group_id=' . $group;
         $TABS_TITLES[] = _('Lists');
         $toptab == 'mail' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Project Manager
     if ($project->usesPm()) {
         $TABS_DIRS[] = '/pm/?group_id=' . $group;
         $TABS_TITLES[] = _('Tasks');
         $toptab == 'pm' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Doc Manager
     if ($project->usesDocman()) {
         $TABS_DIRS[] = '/docman/?group_id=' . $group;
         $TABS_TITLES[] = _('Docs');
         $toptab == 'docman' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Surveys
     if ($project->usesSurvey()) {
         $TABS_DIRS[] = '/survey/?group_id=' . $group;
         $TABS_TITLES[] = _('Surveys');
         $toptab == 'surveys' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     //newsbytes
     if ($project->usesNews()) {
         $TABS_DIRS[] = '/news/?group_id=' . $group;
         $TABS_TITLES[] = _('News');
         $toptab == 'news' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // SCM systems
     if ($project->usesSCM()) {
         $TABS_DIRS[] = '/scm/?group_id=' . $group;
         $TABS_TITLES[] = _('SCM');
         $toptab == 'scm' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // groupmenu_after_scm hook
     $hookParams['DIRS'] =& $TABS_DIRS;
     $hookParams['TITLES'] =& $TABS_TITLES;
     $hookParams['toptab'] =& $toptab;
     $hookParams['selected'] =& $selected;
     $hookParams['group_id'] = $group;
     plugin_hook("groupmenu_scm", $hookParams);
     // Downloads
     if ($project->usesFRS()) {
         $TABS_DIRS[] = '/frs/?group_id=' . $group;
         $TABS_TITLES[] = _('Files');
         $toptab == 'frs' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // groupmenu hook
     $hookParams['DIRS'] =& $TABS_DIRS;
     $hookParams['TITLES'] =& $TABS_TITLES;
     $hookParams['toptab'] =& $toptab;
     $hookParams['selected'] =& $selected;
     $hookParams['group'] = $group;
     plugin_hook("groupmenu", $hookParams);
     echo $this->tabGenerator($TABS_DIRS, $TABS_TITLES, true, $selected, 'white', '100%');
 }
 /**
  * constructor
  */
 public function __construct(cs_environment $environment)
 {
     // CommSy-Plugin logout-hook
     plugin_hook('logout');
     // delete session
     $session_manager = $environment->getSessionManager();
     $session = $environment->getSessionItem();
     $history = $session->getValue('history');
     $cookie = $session->getValue('cookie');
     $javascript = $session->getValue('javascript');
     $https = $session->getValue('https');
     $flash = $session->getValue('flash');
     if ($session->issetValue('root_session_id')) {
         $root_session_id = $session->getValue('root_session_id');
     }
     $session_manager->delete($session->getSessionID(), true);
     $session->reset();
     include_once 'classes/cs_session_item.php';
     $session = new cs_session_item();
     $session->createSessionID('guest');
     if ($cookie == '1') {
         $session->setValue('cookie', 2);
     } else {
         $session->setValue('cookie', 0);
     }
     if ($javascript == '1') {
         $session->setValue('javascript', 1);
     } elseif ($javascript == '-1') {
         $session->setValue('javascript', -1);
     }
     if ($https == '1') {
         $session->setValue('https', 1);
     } elseif ($https == '-1') {
         $session->setValue('https', -1);
     }
     if ($flash == '1') {
         $session->setValue('flash', 1);
     } elseif ($flash == '-1') {
         $session->setValue('flash', -1);
     }
     if (!empty($_GET['back_tool'])) {
         $back_tool = $_GET['back_tool'];
         $back_file = $back_tool . '.php';
     } else {
         $back_tool = '';
         $back_file = '';
     }
     if (mb_stristr($_SERVER['PHP_SELF'], 'homepage.php')) {
         $session->setToolName('homepage');
     }
     $environment->setSessionItem($session);
     // redirect
     $current_context = $environment->getCurrentContextItem();
     if (isset($root_session_id) and !empty($root_session_id)) {
         // change cookie
         if ($cookie == '1') {
             $session_manager = $environment->getSessionManager();
             $session = $session_manager->get($root_session_id);
             $session->setValue('cookie', 2);
             unset($session_manager);
             $environment->setSessionItem($session);
         }
         $params = $history[0]['parameter'];
         $params['SID'] = $root_session_id;
         redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $params, '', '', $back_tool);
     } elseif (!$current_context->isOpenForGuests() and (empty($back_tool) or !empty($back_tool) and $back_tool == 'commsy')) {
         if (!$current_context->isServer()) {
             $parent_context = $current_context->getContextItem();
             if ($parent_context->isOpenForGuests()) {
                 if ($parent_context->isPortal()) {
                     $params = array();
                     $params['room_id'] = $current_context->getItemID();
                     if ($current_context->isGroupRoom()) {
                         $project_room_item_id = $current_context->getLinkedProjectItemID();
                         if (!empty($project_room_item_id)) {
                             $params['room_id'] = $project_room_item_id;
                         }
                     }
                     redirect($parent_context->getItemID(), 'home', 'index', $params, '', '', $back_tool);
                     unset($params);
                 } else {
                     redirect($parent_context->getItemID(), 'home', 'index', '', '', '', $back_tool);
                 }
             }
         } else {
             redirect($current_context->getItemID(), 'home', 'index', '', '', '', $back_tool);
         }
     } else {
         redirect($history[0]['context'], $history[0]['module'], $history[0]['function'], $history[0]['parameter'], '', '', $back_tool);
     }
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
     redirect_with_url($url);
 }
Beispiel #10
0
		<input type="hidden" name="approve" value="y" />
		<input type="hidden" name="post_changes" value="y" />
		<input type="radio" name="status" value="1" /> ' . _('Approve For Front Page') . '<br />
		<input type="radio" name="status" value="0" /> ' . _('Do Nothing') . '<br />
		<input type="radio" name="status" value="2" checked="checked" /> ' . _('Reject') . '<br />
		<strong>' . _('Subject') . ':</strong><br />
		<input type="text" name="summary" value="' . db_result($result, 0, 'summary') . '" size="30" maxlength="60" /><br />
		<strong>' . _('Details') . ':</strong><br />';
            $GLOBALS['editor_was_set_up'] = false;
            $params = array();
            $params['name'] = 'details';
            $params['width'] = "600";
            $params['height'] = "300";
            $params['group'] = db_result($result, 0, 'group_id');
            $params['body'] = db_result($result, 0, 'details');
            plugin_hook("text_editor", $params);
            if (!$GLOBALS['editor_was_set_up']) {
                //if we don't have any plugin for text editor, display a simple textarea edit box
                echo '<textarea name="details" rows="5" cols="50" wrap="soft">' . db_result($result, 0, 'details') . '</textarea><br />';
            }
            unset($GLOBALS['editor_was_set_up']);
            echo '<br />
		<input type="submit" name="submit" value="' . _('Submit') . '" />
		</form>';
        } else {
            /*
            	Show list of waiting news items
            */
            $old_date = time() - 60 * 60 * 24 * 30;
            $sql_pending = "\n\t\t\tSELECT groups.group_id,id,post_date,summary,\n\t\t\t\tgroup_name,unix_group_name\n\t\t\tFROM news_bytes,groups\n\t\t\tWHERE is_approved=0\n\t\t\tAND news_bytes.group_id=groups.group_id\n\t\t\tAND post_date > '{$old_date}'\n\t\t\tAND groups.is_public=1\n\t\t\tAND groups.status='A'\n\t\t\tORDER BY post_date\n\t\t";
            $old_date = time() - 60 * 60 * 24 * 7;
Beispiel #11
0
 function save()
 {
     $user_manager = $this->_environment->getUserManager();
     $this->_save($user_manager);
     $item_id = $this->getItemID();
     if (empty($item_id)) {
         $this->setItemID($user_mananger->getCreateID());
     }
     plugin_hook('user_save', $this);
     // ContactPersonString
     $context_item = $this->getContextItem();
     // get grouproom
     if ($context_item->getType() == 'group') {
         $grouproom_array = $context_item->_getItemData();
         $grouproom_id = $grouproom_array['extras']['GROUP_ROOM_ID'];
         $room_manager = $this->_environment->getRoomManager();
         $context_item = $room_manager->getItem($grouproom_id);
     }
     if (isset($context_item) and !$context_item->isPortal() and !$context_item->isServer() and $this->getUserID() and mb_strtoupper($this->getUserID()) != 'GUEST' and (!isset($this->_old_status) or !isset($this->_old_contact) or $this->_old_status != $this->getStatus() or $this->_old_contact != $this->getContactStatus())) {
         $context_item->renewContactPersonString();
         unset($context_item);
     }
     // set old status to current status
     $this->_old_status = $this->getStatus();
     $this->_old_contact = $this->getContactStatus();
     if ($this->getStatus() == 2 or $this->getStatus() == 3) {
         // wenn $this->getStatus() einen freigeschalteten Benutzer angibt
         // 2 = normaler Benutzer
         // 3 = Moderator
         if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussion() == "1") {
             $this->updateWikiProfile();
         }
         if ($this->_environment->getCurrentContextItem()->WikiEnableDiscussionNotification() == "1") {
             $this->updateWikiNotification();
         }
     } else {
         // Wenn der Benutzer gesperrt oder geloescht ist, müssen Profile und
         // Notification entsprechend angepasst werden
         // 0 = gesperrt & geloescht (+ deletion_date)
         //
         // Entscheidung 30.09.2008 - Eintraege bleiben unveraendert im Forum
         //$this->updateWikiRemoveUser();
     }
 }
Beispiel #12
0
session_require(array('group' => '1', 'admin_flags' => 'A'));
$group_id = getIntFromGet('group_id');
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
    exit_error('Error', 'Could Not Get Group');
} elseif ($group->isError()) {
    exit_error('Error', $group->getErrorMessage());
}
if (getStringFromPost('submit')) {
    $sure = getIntFromPost('sure');
    $reallysure = getIntFromPost('reallysure');
    $reallyreallysure = getIntFromPost('reallyreallysure');
    if (!$group->delete($sure, $reallysure, $reallyreallysure)) {
        exit_error('Error', $group->getErrorMessage());
    } else {
        plugin_hook('delete_link', $_GET['group_id']);
        header("Location: " . util_make_url("/admin/?feedback=DELETED"));
    }
}
site_admin_header(array('title' => _('Permanently Delete Project')));
echo '<h2>' . _('Permanently and irretrievably delete project') . ': ' . $group->getPublicName() . '</h2>';
?>

<p>
<form action="<?php 
echo getStringFromServer('PHP_SELF') . '?group_id=' . $group_id;
?>
" method="post">
<input type="checkbox" value="1" name="sure"> <?php 
echo _('Confirm Delete');
?>
Beispiel #13
0
 public static function getInstance()
 {
     if (isset(self::$_instance)) {
         return self::$_instance;
     }
     $c = __CLASS__;
     self::$_instance = new $c();
     $res = db_query_params('SELECT r.role_id FROM pfo_role r, pfo_role_class c WHERE r.role_class = c.class_id AND c.class_name = "$1"', array('PFO_RoleLoggedIn'));
     if (!$res || !db_numrows($res)) {
         throw new Exception("No PFO_RoleLoggedIn role in the database");
     }
     self::$_instance->_role_id = db_result($res, 0, 'role_id');
     $hook_params = array();
     $hook_params['role'] =& self::$_instance;
     plugin_hook("role_get", $hook_params);
     self::$_instance->fetchData(self::$_instance->_role_id);
     return self::$_instance;
 }
Beispiel #14
0
}
// Administrative functions
$group_id = getIntFromRequest('group_id');
$action = getStringFromRequest('action');
$user_id = getStringFromRequest('user_id');
if ($action == 'delete') {
    performAction('D', "DELETED", $user_id);
    //plugin webcal
    //del webcal user
    plugin_hook('del_cal_user', $user_id);
} else {
    if ($action == 'activate') {
        performAction('A', "ACTIVE", $user_id);
        //plugin webcal
        //create webcal user
        plugin_hook('add_cal_user', $user_id);
    } else {
        if ($action == 'suspend') {
            performAction('S', "SUSPENDED", $user_id);
        }
    }
}
// Add a user to this group
if (getStringFromRequest('action') == 'add_to_group') {
    echo "ACTION NOT SUPPORTED";
}
//	Show list of users
print "<p>" . _('User list for group:');
if (!$group_id) {
    $user_name_search = getStringFromRequest('user_name_search');
    print "<strong>" . _('All Groups') . "</strong>";
Beispiel #15
0
			<?php 
echo $pt->showRelatedArtifacts();
?>
		</td>
	</tr>

	<tr>
		<td colspan="2">
			<?php 
echo $pt->showMessages();
?>
		</td>
	</tr>
	<?php 
$hookParams['task_id'] = $project_task_id;
plugin_hook("task_extra_detail", $hookParams);
?>
	<tr>
		<td colspan="2">
			<?php 
echo $pt->showHistory();
?>
		</td>
	</tr>

</table>
<?php 
pm_footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"
Beispiel #16
0
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
Header("Cache-Control: no-cache");
Header("Cache-Control: must-revalidate");
require_once '../env.inc.php';
require_once $gfwww . 'include/pre.php';
$return_to = getStringFromRequest('return_to');
//
//      Validate return_to
//
if ($return_to) {
    $tmpreturn = explode('?', $return_to);
    if (!@is_file($sys_urlroot . $tmpreturn[0]) && !@is_dir($sys_urlroot . $tmpreturn[0]) && !(strpos($tmpreturn[0], 'projects') == 1) && !(strpos($tmpreturn[0], 'mediawiki') == 1)) {
        $return_to = '';
    }
}
session_logout();
plugin_hook('before_logout_redirect');
if ($return_to) {
    header('Location: ' . $return_to);
} else {
    header('Location: ' . util_make_url('/'));
}
Beispiel #17
0
 function mainMenu($params)
 {
     global $sys_use_trove, $sys_use_snippet, $sys_use_people;
     $TABS_DIRS[] = '/';
     $TABS_DIRS[] = '/my/';
     if ($sys_use_trove) {
         $TABS_DIRS[] = '/softwaremap/';
     }
     if ($sys_use_snippet) {
         $TABS_DIRS[] = '/snippet/';
     }
     if ($sys_use_people) {
         $TABS_DIRS[] = '/people/';
     }
     $TABS_TITLES[] = _('Home');
     $TABS_TITLES[] = _('My&nbsp;Page');
     if ($sys_use_trove) {
         $TABS_TITLES[] = _('Project&nbsp;Tree');
     }
     if ($sys_use_snippet) {
         $TABS_TITLES[] = _('Code&nbsp;Snippets');
     }
     if ($sys_use_people) {
         $TABS_TITLES[] = _('Project&nbsp;Openings');
     }
     // outermenu hook
     $PLUGIN_TABS_DIRS = array();
     $hookParams['DIRS'] =& $PLUGIN_TABS_DIRS;
     $hookParams['TITLES'] =& $TABS_TITLES;
     plugin_hook("outermenu", $hookParams);
     $TABS_DIRS = array_merge($TABS_DIRS, $PLUGIN_TABS_DIRS);
     if (user_ismember(1, 'A')) {
         $TABS_DIRS[] = '/admin/';
         $TABS_TITLES[] = _('Admin');
     }
     if (user_ismember($GLOBALS['sys_stats_group'])) {
         $TABS_DIRS[] = '/reporting/';
         $TABS_TITLES[] = _('Reporting');
     }
     if (isset($params['group']) && $params['group']) {
         // get group info using the common result set
         $project =& group_get_object($params['group']);
         if ($project && is_object($project)) {
             if ($project->isError()) {
             } elseif (!$project->isProject()) {
             } else {
                 if (isset($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
                     $TABS_DIRS[] = '/project/?group_id=' . $params['group'];
                 } else {
                     $TABS_DIRS[] = '/projects/' . $project->getUnixName() . '/';
                 }
                 $TABS_TITLES[] = $project->getPublicName();
                 $selected = count($TABS_DIRS) - 1;
             }
         }
     } elseif (strstr(getStringFromServer('REQUEST_URI'), '/my/') || strstr(getStringFromServer('REQUEST_URI'), '/account/') || strstr(getStringFromServer('REQUEST_URI'), '/themes/')) {
         $selected = array_search("/my/", $TABS_DIRS);
     } elseif (strstr(getStringFromServer('REQUEST_URI'), 'softwaremap')) {
         $selected = array_search("/softwaremap/", $TABS_DIRS);
     } elseif (strstr(getStringFromServer('REQUEST_URI'), '/snippet/')) {
         $selected = array_search("/snippet/", $TABS_DIRS);
     } elseif (strstr(getStringFromServer('REQUEST_URI'), '/people/')) {
         $selected = array_search("/people/", $TABS_DIRS);
     } elseif (strstr(getStringFromServer('REQUEST_URI'), '/reporting/')) {
         $selected = array_search('/reporting/', $TABS_DIRS);
     } elseif (strstr(getStringFromServer('REQUEST_URI'), '/admin/') && user_ismember(1, 'A')) {
         $selected = array_search('/admin/', $TABS_DIRS);
     } elseif (count($PLUGIN_TABS_DIRS) > 0) {
         foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
             if (strstr($GLOBALS['REQUEST_URI'], $PLUGIN_TABS_DIRS_VALUE)) {
                 $selected = array_search($PLUGIN_TABS_DIRS_VALUE, $TABS_DIRS);
                 break;
             }
         }
     } else {
         $selected = 0;
     }
     if (!isset($this->COLOR_SELECTED_TAB)) {
         $this->COLOR_SELECTED_TAB = '#e0e0e0';
     }
     echo $this->tabGenerator($TABS_DIRS, $TABS_TITLES, false, $selected, $this->COLOR_SELECTED_TAB, '100%');
 }
     $name = translate("Unnamed Event");
 }
 $sql .= "'" . $name . "', ";
 if (strlen($description) == 0) {
     $description = $name;
 }
 $sql .= "'" . $description . "' )";
 if (empty($error)) {
     if (!dbi_query($sql)) {
         $error = translate("Database error") . ": " . dbi_error();
     } else {
         //mettre le plugin
         //add father
         $params[0] = $user;
         $params[1] = $id;
         plugin_hook('add_cal_link_father_event', $params);
     }
 }
 // log add/update
 activity_log($id, $login, $is_assistant || $is_nonuser_admin ? $user : $login, $newevent ? $LOG_CREATE : $LOG_UPDATE, "");
 if ($single_user == "Y") {
     $participants[0] = $single_user_login;
 }
 // check if participants have been removed and send out emails
 if (!$newevent && count($old_status) > 0) {
     // nur bei Update!!!
     while (list($old_participant, $dummy) = each($old_status)) {
         $found_flag = false;
         for ($i = 0; $i < count($participants); $i++) {
             if ($participants[$i] == $old_participant) {
                 $found_flag = true;
Beispiel #19
0
 /**
  *	setPasswd - Changes user's password.
  *
  *	@param	string	The plaintext password.
  *	@return boolean success.
  */
 function setPasswd($passwd)
 {
     global $SYS;
     if (!account_pwvalid($passwd)) {
         $this->setError('Error: ' . $GLOBALS['register_error']);
         return false;
     }
     db_begin();
     $unix_pw = account_genunixpw($passwd);
     $res = db_query("\n\t\t\tUPDATE users\n\t\t\tSET user_pw='" . md5($passwd) . "',\n\t\t\tunix_pw='{$unix_pw}'\n\t\t\tWHERE user_id='" . $this->getID() . "'\n\t\t");
     if (!$res || db_affected_rows($res) < 1) {
         $this->setError('ERROR - Could Not Change User Password: '******'{crypt}' . $unix_pw)) {
                 $this->setError($SYS->getErrorMessage());
                 db_rollback();
                 return false;
             }
         }
     }
     $hook_params = array();
     $hook_params['user'] = $this;
     $hook_params['user_id'] = $this->getID();
     $hook_params['user_password'] = $passwd;
     plugin_hook("user_setpasswd", $hook_params);
     db_commit();
     return true;
 }
Beispiel #20
0
 /**
  *	projectTabs() - Prints out the project tabs, contained here in case
  *		we want to allow it to be overriden
  *
  *	@param	string	Is the tab currently selected
  *	@param	string	Is the group we should look up get title info
  */
 function projectTabs($toptab, $group)
 {
     // get group info using the common result set
     $project =& group_get_object($group);
     if (!$project || !is_object($project)) {
         return;
     }
     if ($project->isError()) {
         //wasn't found or some other problem
         return;
     }
     if (!$project->isProject()) {
         return;
     }
     //		$TABS_DIRS[]='/projects/'.$project->getUnixName().'/';
     //		$TABS_TITLES[]=$project->getPublicName();
     // Summary
     if (isset($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
         $TABS_DIRS[] = '/project/?group_id=' . $group;
     } else {
         $TABS_DIRS[] = '/projects/' . $project->getUnixName();
     }
     $TABS_IDS[] = 'gforge-project-summary';
     $TABS_TITLES[] = _('Summary');
     $toptab == 'home' ? $selected = count($TABS_TITLES) - 1 : '';
     if (user_ismember($group, 'A')) {
         // Project Admin
         $TABS_DIRS[] = '/project/admin/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-admin';
         $TABS_TITLES[] = _('Admin');
         $toptab == 'admin' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     /* Homepage */
     /*		$TABS_DIRS[]='http://'. $project->getHomePage();
     		$TABS_TITLES[]=_('Home Page');
     		*/
     $TABS_DIRS[] = '/activity/?group_id=' . $group;
     $TABS_IDS[] = 'gforge-project-activity';
     $TABS_TITLES[] = _('Activity');
     $toptab == 'activity' ? $selected = count($TABS_TITLES) - 1 : '';
     // Forums
     if ($project->usesForum()) {
         $TABS_DIRS[] = '/forum/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-forum';
         $TABS_TITLES[] = _('Forums');
         $toptab == 'forums' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Artifact Tracking
     if ($project->usesTracker()) {
         $TABS_DIRS[] = '/tracker/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-tracker';
         $TABS_TITLES[] = _('Tracker');
         $toptab == 'tracker' || $toptab == 'bugs' || $toptab == 'support' || $toptab == 'patch' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Mailing Lists
     if ($project->usesMail()) {
         $TABS_DIRS[] = '/mail/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-mail';
         $TABS_TITLES[] = _('Lists');
         $toptab == 'mail' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Project Manager
     if ($project->usesPm()) {
         $TABS_IDS[] = 'gforge-project-task';
         $TABS_DIRS[] = '/pm/?group_id=' . $group;
         $TABS_TITLES[] = _('Tasks');
         $toptab == 'pm' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Doc Manager
     if ($project->usesDocman()) {
         $TABS_DIRS[] = '/docman/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-docman';
         $TABS_TITLES[] = _('Docs');
         $toptab == 'docman' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // Surveys
     if ($project->usesSurvey()) {
         $TABS_DIRS[] = '/survey/?group_id=' . $group;
         $TABS_IDS[] = 'gforge-project-survey';
         $TABS_TITLES[] = _('Surveys');
         $toptab == 'surveys' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     //newsbytes
     if ($project->usesNews()) {
         $TABS_IDS[] = 'gforge-project-news';
         $TABS_DIRS[] = '/news/?group_id=' . $group;
         $TABS_TITLES[] = _('News');
         $toptab == 'news' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // SCM systems
     if ($project->usesSCM()) {
         $TABS_IDS[] = 'gforge-project-scm';
         $TABS_DIRS[] = '/scm/?group_id=' . $group;
         $TABS_TITLES[] = _('SCM');
         $toptab == 'scm' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // groupmenu_after_scm hook
     $hookParams['DIRS'] =& $TABS_DIRS;
     $hookParams['TITLES'] =& $TABS_TITLES;
     $hookParams['toptab'] =& $toptab;
     $hookParams['selected'] =& $selected;
     $hookParams['group_id'] = $group;
     plugin_hook("groupmenu_scm", $hookParams);
     // Downloads
     if ($project->usesFRS()) {
         $TABS_IDS[] = 'gforge-project-frs';
         $TABS_DIRS[] = '/frs/?group_id=' . $group;
         $TABS_TITLES[] = _('Files');
         $toptab == 'frs' ? $selected = count($TABS_TITLES) - 1 : '';
     }
     // groupmenu hook
     $hookParams['DIRS'] =& $TABS_DIRS;
     $hookParams['TITLES'] =& $TABS_TITLES;
     $hookParams['toptab'] =& $toptab;
     $hookParams['selected'] =& $selected;
     $hookParams['group'] = $group;
     plugin_hook("groupmenu", $hookParams);
     $return = '';
     $c = count($TABS_TITLES) - 1;
     for ($i = 0; $i <= $c; $i++) {
         if ($selected == $i) {
             $this->selected_title = $TABS_TITLES[$i];
             $this->selected_dir = $TABS_DIRS[$i];
             //$this->selected_id = $TABS_IDS[$i];
             $return .= util_make_link($TABS_DIRS[$i], $TABS_TITLES[$i], array('id' => 'gforge-project-selected'));
         } else {
             if (!isset($TABS_IDS[$i]) || $TABS_IDS[$i] == '') {
                 $return .= util_make_link($TABS_DIRS[$i], $TABS_TITLES[$i], array('id' => 'gforge-project-std', 'title' => $TABS_TITLES[$i]));
             } else {
                 $return .= util_make_link($TABS_DIRS[$i], $TABS_TITLES[$i], array('id' => $TABS_IDS[$i], 'title' => $TABS_TITLES[$i]));
             }
         }
     }
     return $return;
 }
Beispiel #21
0
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once $gfwww . 'include/pre.php';
$group_id = getIntFromRequest('group_id');
$sub_group_id = getIntFromRequest('sub_group_id');
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
//plugin webcal
$params[0] = $sub_group_id;
$params[1] = $group_id;
plugin_hook('del_cal_link_father', $params);
//del link between two projects
$sql = "DELETE FROM plugin_projects_hierarchy WHERE project_id  = '" . $group_id . "' AND sub_project_id = '" . $sub_group_id . "'";
//print "<br>".$sql;
db_begin();
db_query($sql) or die(db_error());
db_commit();
header("Location: " . util_make_url('/project/admin/index.php?group_id=' . $sub_group_id));
Beispiel #22
0
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
    exit_error('Error', 'Could Not Get Group');
} elseif ($group->isError()) {
    exit_error('Error', $group->getErrorMessage());
}
if (getStringFromRequest('finished')) {
    $addrole = getStringFromRequest('addrole');
    $keys = array_keys($addrole);
    for ($i = 0; $i < count($keys); $i++) {
        $group->addUser($keys[$i], $addrole[$keys[$i]]);
        //plugin webcal
        //change assistant for webcal
        $params[0] = $keys[$i];
        $params[1] = $group_id;
        plugin_hook('change_cal_permission', $params);
    }
    Header("Location: index.php?group_id={$group_id}&feedback=Successful");
}
if (!$accumulated_ids) {
    exit_error('Error', 'No IDs Were Passed');
} else {
    $arr = explode(',', $accumulated_ids);
    $res = db_query("SELECT user_id,user_name,realname FROM users\n\t\tWHERE status='A' and type_id='1' and user_id IN ('" . implode('\',\'', $arr) . "') \n\t\tORDER BY realname ASC");
}
project_admin_header(array('title' => _('Edit Role'), 'group' => $group_id));
echo '
<h2>' . _('Add Users From List') . '</h2>
<p>
' . _('Choose the role for each user and then press &quot;Add All&quot;.') . '
<p>
             header("Content-type: text/xml");
             echo "<ajax>\n<message>{$msg}</message>\n{$ok}</ajax>\n";
             exit;
         } else {
             define('redirect_url', $redirect_url);
         }
     }
     break;
     // Delete a comment
 // Delete a comment
 case "comment:delete":
     $comment_id = optional_param('comment_delete', 0, PARAM_INT);
     require_confirm(__gettext('Are you sure you want to permanently delete this comment?'));
     if (logged_on && !empty($comment_id)) {
         $comment = get_record('comments', 'ident', $comment_id);
         $comment = plugin_hook("comment", "delete", $comment);
         if (!empty($comment)) {
             if ($comment->owner == $USER->ident || run("permissions:check", array("comment:delete", $_SESSION['userid'], $comment->object_id, $comment->object_type))) {
                 delete_records('comments', 'ident', $comment_id);
                 $messages[] = __gettext("Your comment was deleted.");
             }
         }
         if ($comment_form_type == 'integrated' || $comment_form_type == 'inline') {
             $redirect_url = get_url($comment->object_id, $comment->object_type);
         } elseif ($comment_form_type == 'separate') {
             $redirect_url = $CFG->wwwroot . "mod/generic_comments/comment_page.php?object_id={$comment->object_id}&object_type={$comment->object_type}";
         }
         define('redirect_url', $redirect_url);
     }
     break;
     // Edit a comment
Beispiel #24
0
function file_user_delete($object_type, $event, $object)
{
    global $CFG;
    if (!empty($object->ident) && $object_type == "user" && $event == "delete") {
        if ($files = get_records_sql("select * from {$CFG->prefix}files where owner = {$object->ident} or files_owner = {$object->ident}")) {
            foreach ($files as $file) {
                $file = plugin_hook("file", "delete", $file);
                if (!empty($file)) {
                    @unlink(stripslashes($CFG->dataroot . $file->location));
                    delete_records('files', 'ident', $file->ident);
                    delete_records('tags', 'tagtype', 'file', 'ref', $file->ident);
                }
            }
        }
        @unlink($CFG->dataroot . "files/" . substr($object->username, 0, 1) . "/" . $object->username);
        if ($folders = get_records_sql("select * from {$CFG->prefix}file_folders where owner = {$object->ident} or files_owner = {$object->ident}")) {
            foreach ($folders as $folder) {
                $folder = plugin_hook("folder", "delete", $folder);
                if (!empty($folder)) {
                    set_field('file_folders', 'parent', -1, 'parent', $folder->ident);
                    set_field('files', 'folder', -1, 'folder', $folder->ident);
                    delete_records('file_folders', 'ident', $folder->ident);
                    delete_records('tags', 'tagtype', 'folder', 'ref', $folder->ident);
                }
            }
        }
    }
    return $object;
}
Beispiel #25
0
    /**
     *	header() - "steel theme" top of page
     *
     * @param	array	Header parameters array
     */
    function header($params)
    {
        global $sys_name;
        $this->headerStart($params);
        ?>

<link rel="stylesheet" type="text/css" href="<?php 
        echo util_make_url('/themes/osx/css/theme.css');
        ?>
" />
<body>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

	<tr>
		<td><a href="<?php 
        echo util_make_url('/');
        ?>
"
			onmouseover="imgOver('logo')"
			onmouseout="imgOff('logo')"><img name="logo" border="0" height="60" width="180"
				src="<?php 
        echo $this->imgroot . 'logo.png';
        ?>
" alt="GForge Logo" /></a></td>
		<td><?php 
        echo $this->searchBox();
        ?>
</td>
		<td style="text-align:right"><?php 
        if (session_loggedin()) {
            ?>
				<b><?php 
            echo util_make_link('/account/logout.php', _('Log Out'));
            ?>
</b><br />
				<b><?php 
            echo util_make_link('/account/', _('My Account'));
            ?>
</b><?php 
        } else {
            ?>
				<b><?php 
            echo util_make_link('/account/login.php', _('Log In'));
            ?>
</b><br />
				<b><?php 
            echo util_make_link('/account/register.php', _('New Account'));
            ?>
</b><?php 
        }
        $params['template'] = '<br/><b>{menu}</b>';
        plugin_hook('headermenu', $params);
        ?>
</td>
		<td>&nbsp;&nbsp;</td>
	</tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

	<tr>
		<td>&nbsp;</td>
		<td colspan="3">

<?php 
        echo $this->outerTabs($params);
        ?>

		</td>
		<td>&nbsp;</td>

	</tr>
	<tr>
		<td>&nbsp;</td>
		<td valign="top" width="99%" colspan="3">
			<!-- Inner Tabs / Shell -->

			<table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php 
        if (isset($params['group']) && $params['group']) {
            ?>
			<tr>
				<td>&nbsp;</td>
				<td>
				<?php 
            echo $this->projectTabs($params['toptab'], $params['group']);
            ?>
				</td>
				<td>&nbsp;</td>
			</tr>
			<?php 
        }
        ?>
			<tr>
				<td><img
					src="<?php 
        echo $this->imgroot;
        ?>
clear.png" width="99%" height="10" alt="" /></td>
			</tr>

			<tr>
				<td><img
					src="<?php 
        echo $this->imgroot;
        ?>
clear.png" width="10" height="1" alt="" /></td>
				<td valign="top" width="99%">
	<?php 
    }
Beispiel #26
0
    /**
     *	header() - "steel theme" top of page
     *
     * @param	array	Header parameters array
     */
    function header($params)
    {
        if (isset($_POST['selectmenu']) && $_POST['selectmenu'] == "yes") {
            header("Location:" . $_POST['menuList']);
        }
        global $sys_name;
        if (!$params['title']) {
            $params['title'] = "{$sys_name}";
        } else {
            $params['title'] = "{$sys_name}: " . $params['title'];
        }
        print '<?xml version="1.0" encoding="utf-8"';
        ?>
		<!DOCTYPE html
		PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        echo _('en');
        ?>
" lang="<?php 
        echo _('en');
        ?>
">
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><?php 
        echo $params['title'];
        ?>
</title>
		</head>
		
		<body>
		<p align=left>
		<?php 
        echo util_make_link('/', _('Home'));
        ?>
</h2></a>
		</p>
		<p align=right>
		<?php 
        if (session_loggedin()) {
            ?>
		<b><?php 
            echo util_make_link('/account/logout.php', _('Log Out'));
            ?>
</b>
		<b><?php 
            echo util_make_link('/account/', _('My Account'));
            ?>
</b>
		<?php 
        } else {
            ?>
		<b><?php 
            echo util_make_link('/account/login.php', _('Log In'));
            ?>
</b>
		<b><?php 
            echo util_make_link('/account/register.php', _('New Account'));
            ?>
</b>
		<?php 
        }
        $params['template'] = '<b>{menu}</b>';
        plugin_hook('headermenu', $params);
        ?>
		</p>

		<p align=left>
		<?php 
        echo $this->searchBox();
        ?>
		</p>

		<p align=left>
		<?php 
        echo $this->outerTabs($params);
        ?>
		<?php 
        if (isset($params['group']) && $params['group']) {
            ?>
		<?php 
            echo $this->projectTabs($params['toptab'], $params['group']);
            ?>
		<?php 
        }
        ?>
		</p>
		<?php 
    }
Beispiel #27
0
        foreach ($scm_plugins as $plugin) {
            $myPlugin = plugin_get_object($plugin);
            echo '<td><input type="radio" name="scmradio" ';
            echo 'value="' . $myPlugin->name . '"';
            if ($group->usesPlugin($myPlugin->name)) {
                $scm = $myPlugin->name;
                echo ' checked="checked"';
            }
            echo '>' . $myPlugin->text . '</td>';
        }
        echo '</tr></tbody></table>' . "\n";
    }
} else {
    echo '<p>' . _('Error - Site has SCM but no plugins registered') . '</p>';
}
plugin_hook("scm_admin_page", $hook_params);
?>
<input type="hidden" name="group_id" value="<?php 
echo $group_id;
?>
">
<input type="submit" name="submit" value="<?php 
echo _('Update');
?>
">
</form>
<?php 
scm_footer();
// Local Variables:
// mode: php
// c-file-style: "bsd"
                        $u->email = $new_email[$i];
                        $u->password = $md5password;
                        $u->active = 'yes';
                        $u->user_type = 'person';
                        $u = plugin_hook("user", "create", $u);
                        if (!empty($u)) {
                            $newid = insert_record('users', $u);
                            $u->ident = $newid;
                            // Calendar code shouldn't go here! But its here anyways so just checking
                            // the global function array to check to see if calendar module is loaded.
                            global $function;
                            if (isset($function["calendar:init"])) {
                                $c = new StdClass();
                                $c->owner = $newid;
                                insert_record('calendar', $c);
                            }
                            $u = plugin_hook("user", "publish", $u);
                            $rssresult = run("weblogs:rss:publish", array($newid, false));
                            $rssresult = run("files:rss:publish", array($newid, false));
                            $rssresult = run("profile:rss:publish", array($newid, false));
                            $sitename = sitename;
                            $username = $new_username[$i];
                            email_to_user($u, null, sprintf(__gettext("Your new %s account"), sitename), sprintf(__gettext("You have been added to %s!\n\nFor your records, your %s username and password are:\n\n\tUsername: %s\n\tPassword: %s\n\nYou can log in at any time by visiting %s and entering these details into the login form.\n\nWe hope you enjoy using the system.\n\nRegards,\n\nThe %s Team"), $sitename, $sitename, $username, $password, url, $sitename));
                            $messages[] = sprintf(__gettext("User %s was created."), $username);
                        }
                    }
                }
                break;
        }
    }
}
Beispiel #29
0
} else {
    echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle(0) . '><td colspan=3>' . _('No Files Currently Attached') . '</td></tr>';
}
echo $GLOBALS['HTML']->listTableBottom();
?>
	</td></tr>
</table>
</div>
<div class="tabbertab" title="<?php 
echo _('Commits');
?>
">
<table border="0" width="80%">
	<?php 
$hookParams['artifact_id'] = $aid;
plugin_hook("artifact_extra_detail", $hookParams);
?>
</table>
</div>
<div class="tabbertab" title="<?php 
echo _('Changes');
?>
">
<table border="0" width="80%">
	<tr><td colspan="2">
		<h3><?php 
echo _('Change Log');
?>
:</h3>
		<?php 
echo $ah->showHistory();
Beispiel #30
0
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once $gfwww . 'include/pre.php';
$group_id = getIntFromRequest('group_id');
$sub_group_id = getIntFromRequest('sub_group_id');
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
//update the link when the son allow the father
$sql = "UPDATE plugin_projects_hierarchy SET activated = true WHERE project_id  = '" . $group_id . "' AND sub_project_id = '" . $sub_group_id . "'";
//print "<br>".$sql;
db_begin();
db_query($sql) or die(db_error());
db_commit();
//plugin webcal
$params[0] = $sub_group_id;
$params[1] = $group_id;
plugin_hook('add_cal_link_father', $params);
header("Location: " . util_make_url('/project/admin/index.php?group_id=' . $sub_group_id));