Example #1
0
     if ($return_code < 0) {
         $role->delete();
         $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
     }
 } elseif ($_POST['date_registration_possible'] == 0 && $date->getValue('dat_rol_id') > 0) {
     // date participation was deselected -> delete flag in event and than delete role
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $date->setValue('dat_rol_id', '');
     $date->save();
     $role->delete();
 } elseif ($_POST['date_registration_possible'] == 1 && $date->getValue('dat_rol_id') > 0) {
     // if event exists and you could register to this event then we must check
     // if the data of the role must be changed
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     // only change name of role if no custom name was set
     if (strpos($role->getValue('rol_name'), $gL10n->get('DAT_DATE')) !== false) {
         $roleName = $gL10n->get('DAT_DATE') . ' ' . $date->getValue('dat_begin', 'Y-m-d H:i') . ' - ' . $date->getValue('dat_id');
     } else {
         $roleName = $role->getValue('rol_name');
     }
     if ($role->getValue('rol_max_members') != $date->getValue('dat_max_members') || $role->getValue('role_name' != $roleName)) {
         $role->setValue('rol_name', $roleName);
         $role->setValue('rol_max_members', $date->getValue('dat_max_members'));
         $role->save();
     }
 }
 // check if flag is set that current user wants to participate as leader to the date
 if (isset($_POST['date_current_user_assigned']) && $_POST['date_current_user_assigned'] == 1 && !$gCurrentUser->isLeaderOfRole($date->getValue('dat_rol_id'))) {
     // user wants to participate -> add him to date
     $member = new TableMembers($gDb);
     $member->startMembership($role->getValue('rol_id'), $gCurrentUser->getValue('usr_id'), true);
Example #2
0
// only users with the special right are allowed to manage roles
if (!$gCurrentUser->manageRoles()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if ($getRoleId > 0) {
    $headline = $gL10n->get('ROL_EDIT_ROLE');
} else {
    $headline = $gL10n->get('SYS_CREATE_ROLE');
}
$gNavigation->addUrl(CURRENT_URL, $headline);
// Rollenobjekt anlegen
$role = new TableRoles($gDb);
if ($getRoleId > 0) {
    $role->readDataById($getRoleId);
    // Pruefung, ob die Rolle zur aktuellen Organisation gehoert
    if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    // Rolle Webmaster darf nur vom Webmaster selber erstellt oder gepflegt werden
    if ($role->getValue('rol_webmaster') == 1 && !$gCurrentUser->isWebmaster()) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    // hidden roles can also see hidden categories
    if ($role->getValue('cat_system') == 1) {
        $showSystemCategory = true;
    }
} else {
    $role->setValue('rol_this_list_view', '1');
    $role->setValue('rol_mail_this_role', '2');
}
if (isset($_SESSION['roles_request'])) {
Example #3
0
 /** Creates all necessary data for a new organization. This method can only be
  *  called once for an organization. It will create the basic categories, lists,
  *  roles, systemmails etc.
  *  @param $userId The id of the webmaster who creates the new organization.
  *                 This will be the first valid user of the new organization.
  */
 public function createBasicData($userId)
 {
     global $gL10n, $gProfileFields;
     // read id of system user from database
     $sql = 'SELECT usr_id FROM ' . TBL_USERS . '
              WHERE usr_login_name LIKE \'' . $gL10n->get('SYS_SYSTEM') . '\' ';
     $this->db->query($sql);
     $row = $this->db->fetch_array();
     $systemUserId = $row['usr_id'];
     // create all systemmail texts and write them into table adm_texts
     $systemmailsTexts = array('SYSMAIL_REGISTRATION_USER' => $gL10n->get('SYS_SYSMAIL_REGISTRATION_USER'), 'SYSMAIL_REGISTRATION_WEBMASTER' => $gL10n->get('SYS_SYSMAIL_REGISTRATION_WEBMASTER'), 'SYSMAIL_REFUSE_REGISTRATION' => $gL10n->get('SYS_SYSMAIL_REFUSE_REGISTRATION'), 'SYSMAIL_NEW_PASSWORD' => $gL10n->get('SYS_SYSMAIL_NEW_PASSWORD'), 'SYSMAIL_ACTIVATION_LINK' => $gL10n->get('SYS_SYSMAIL_ACTIVATION_LINK'));
     $text = new TableText($this->db);
     foreach ($systemmailsTexts as $key => $value) {
         // convert <br /> to a normal line feed
         $value = preg_replace('/<br[[:space:]]*\\/?[[:space:]]*>/', chr(13) . chr(10), $value);
         $text->clear();
         $text->setValue('txt_org_id', $this->getValue('org_id'));
         $text->setValue('txt_name', $key);
         $text->setValue('txt_text', $value);
         $text->save();
     }
     // create default category for roles, events and weblinks
     $sql = 'INSERT INTO ' . TBL_CATEGORIES . ' (cat_org_id, cat_type, cat_name_intern, cat_name, cat_hidden, cat_default, cat_sequence, cat_usr_id_create, cat_timestamp_create)
                                            VALUES (' . $this->getValue('org_id') . ', \'ROL\', \'COMMON\', \'SYS_COMMON\', 0, 1, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')';
     $this->db->query($sql);
     $categoryCommon = $this->db->insert_id();
     $sql = 'INSERT INTO ' . TBL_CATEGORIES . ' (cat_org_id, cat_type, cat_name_intern, cat_name, cat_hidden, cat_default, cat_system, cat_sequence, cat_usr_id_create, cat_timestamp_create)
                                      VALUES (' . $this->getValue('org_id') . ', \'ROL\', \'GROUPS\',  \'INS_GROUPS\', 0, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'ROL\', \'COURSES\', \'INS_COURSES\', 0, 0, 0, 3, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'ROL\', \'TEAMS\',   \'INS_TEAMS\', 0, 0, 0, 4, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'LNK\', \'COMMON\',  \'SYS_COMMON\', 0, 1, 0, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'LNK\', \'INTERN\',  \'INS_INTERN\', 1, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'COMMON\',  \'SYS_COMMON\', 0, 1, 0, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'TRAINING\',\'INS_TRAINING\', 0, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'COURSES\', \'INS_COURSES\', 0, 0, 0, 3, ' . $systemUserId . ',\'' . DATETIME_NOW . '\') ';
     $this->db->query($sql);
     // create default folder for download module in database
     $sql = 'INSERT INTO ' . TBL_FOLDERS . ' (fol_org_id, fol_type, fol_name, fol_path,
                                            fol_locked, fol_public, fol_timestamp)
                                     VALUES (' . $this->getValue('org_id') . ', \'DOWNLOAD\', \'download\', \'/adm_my_files\',
                                             0,1,\'' . DATETIME_NOW . '\')';
     $this->db->query($sql);
     // now create default roles
     // Create role webmaster
     $roleWebmaster = new TableRoles($this->db);
     $roleWebmaster->setValue('rol_cat_id', $categoryCommon);
     $roleWebmaster->setValue('rol_name', $gL10n->get('SYS_WEBMASTER'));
     $roleWebmaster->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_WEBMASTER'));
     $roleWebmaster->setValue('rol_assign_roles', 1);
     $roleWebmaster->setValue('rol_approve_users', 1);
     $roleWebmaster->setValue('rol_announcements', 1);
     $roleWebmaster->setValue('rol_dates', 1);
     $roleWebmaster->setValue('rol_download', 1);
     $roleWebmaster->setValue('rol_guestbook', 1);
     $roleWebmaster->setValue('rol_guestbook_comments', 1);
     $roleWebmaster->setValue('rol_photo', 1);
     $roleWebmaster->setValue('rol_weblinks', 1);
     $roleWebmaster->setValue('rol_edit_user', 1);
     $roleWebmaster->setValue('rol_mail_to_all', 1);
     $roleWebmaster->setValue('rol_mail_this_role', 3);
     $roleWebmaster->setValue('rol_profile', 1);
     $roleWebmaster->setValue('rol_this_list_view', 1);
     $roleWebmaster->setValue('rol_all_lists_view', 1);
     $roleWebmaster->setValue('rol_webmaster', 1);
     $roleWebmaster->setValue('rol_inventory', 1);
     $roleWebmaster->save();
     // Create role member
     $roleMember = new TableRoles($this->db);
     $roleMember->setValue('rol_cat_id', $categoryCommon);
     $roleMember->setValue('rol_name', $gL10n->get('SYS_MEMBER'));
     $roleMember->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_MEMBER'));
     $roleMember->setValue('rol_mail_this_role', 2);
     $roleMember->setValue('rol_profile', 1);
     $roleMember->setValue('rol_this_list_view', 1);
     $roleMember->setValue('rol_default_registration', 1);
     $roleMember->save();
     // Create role board
     $roleManagement = new TableRoles($this->db);
     $roleManagement->setValue('rol_cat_id', $categoryCommon);
     $roleManagement->setValue('rol_name', $gL10n->get('INS_BOARD'));
     $roleManagement->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_BOARD'));
     $roleManagement->setValue('rol_announcements', 1);
     $roleManagement->setValue('rol_dates', 1);
     $roleManagement->setValue('rol_weblinks', 1);
     $roleManagement->setValue('rol_edit_user', 1);
     $roleManagement->setValue('rol_mail_to_all', 1);
     $roleManagement->setValue('rol_mail_this_role', 2);
     $roleManagement->setValue('rol_profile', 1);
     $roleManagement->setValue('rol_this_list_view', 1);
     $roleManagement->setValue('rol_all_lists_view', 1);
     $roleManagement->save();
     // Create membership for user in role 'Webmaster' and 'Members'
     $member = new TableMembers($this->db);
     $member->startMembership($roleWebmaster->getValue('rol_id'), $userId);
     $member->startMembership($roleMember->getValue('rol_id'), $userId);
     // create object with current user field structure
     $gProfileFields = new ProfileFields($this->db, $this->getValue('org_id'));
     // create default list configurations
     $addressList = new ListConfiguration($this->db);
     $addressList->setValue('lst_name', $gL10n->get('INS_ADDRESS_LIST'));
     $addressList->setValue('lst_org_id', $this->getValue('org_id'));
     $addressList->setValue('lst_global', 1);
     $addressList->setValue('lst_default', 1);
     $addressList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $addressList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $addressList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $addressList->addColumn(4, $gProfileFields->getProperty('ADDRESS', 'usf_id'));
     $addressList->addColumn(5, $gProfileFields->getProperty('POSTCODE', 'usf_id'));
     $addressList->addColumn(6, $gProfileFields->getProperty('CITY', 'usf_id'));
     $addressList->save();
     $phoneList = new ListConfiguration($this->db);
     $phoneList->setValue('lst_name', $gL10n->get('INS_PHONE_LIST'));
     $phoneList->setValue('lst_org_id', $this->getValue('org_id'));
     $phoneList->setValue('lst_global', 1);
     $phoneList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $phoneList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $phoneList->addColumn(3, $gProfileFields->getProperty('PHONE', 'usf_id'));
     $phoneList->addColumn(4, $gProfileFields->getProperty('MOBILE', 'usf_id'));
     $phoneList->addColumn(5, $gProfileFields->getProperty('EMAIL', 'usf_id'));
     $phoneList->addColumn(6, $gProfileFields->getProperty('FAX', 'usf_id'));
     $phoneList->save();
     $contactList = new ListConfiguration($this->db);
     $contactList->setValue('lst_name', $gL10n->get('SYS_CONTACT_DETAILS'));
     $contactList->setValue('lst_org_id', $this->getValue('org_id'));
     $contactList->setValue('lst_global', 1);
     $contactList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $contactList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $contactList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $contactList->addColumn(4, $gProfileFields->getProperty('ADDRESS', 'usf_id'));
     $contactList->addColumn(5, $gProfileFields->getProperty('POSTCODE', 'usf_id'));
     $contactList->addColumn(6, $gProfileFields->getProperty('CITY', 'usf_id'));
     $contactList->addColumn(7, $gProfileFields->getProperty('PHONE', 'usf_id'));
     $contactList->addColumn(8, $gProfileFields->getProperty('MOBILE', 'usf_id'));
     $contactList->addColumn(9, $gProfileFields->getProperty('EMAIL', 'usf_id'));
     $contactList->save();
     $formerList = new ListConfiguration($this->db);
     $formerList->setValue('lst_name', $gL10n->get('INS_MEMBERSHIP'));
     $formerList->setValue('lst_org_id', $this->getValue('org_id'));
     $formerList->setValue('lst_global', 1);
     $formerList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'));
     $formerList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'));
     $formerList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $formerList->addColumn(4, 'mem_begin');
     $formerList->addColumn(5, 'mem_end', 'DESC');
     $formerList->save();
 }
Example #4
0
// nur berechtigte User duerfen User importieren
if (!$gCurrentUser->editUsers()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if (strlen($_FILES['userfile']['tmp_name'][0]) == 0) {
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_FILE')));
} elseif ($_FILES['userfile']['error'][0] == 1) {
    //Dateigroesse ueberpruefen Servereinstellungen
    $gMessage->show($gL10n->get('SYS_FILE_TO_LARGE_SERVER', $gPreferences['max_file_upload_size']));
} elseif ($postRoleId == 0) {
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_ROLE')));
}
// Rolle einlesen und pruefen, ob der User diese selektieren kann und dadurch nicht
// evtl. ein Rollenzuordnungsrecht bekommt, wenn er es vorher nicht hatte
$role = new TableRoles($gDb, $postRoleId);
if ($gCurrentUser->hasRightViewRole($role->getValue('rol_id')) == false || $gCurrentUser->manageRoles() == false && $role->getValue('rol_assign_roles') == false) {
    $gMessage->show($gL10n->get('MEM_ROLE_SELECT_RIGHT', $role->getValue('rol_name')));
}
// read file in an array; auto-detect the line endings of different os
ini_set('auto_detect_line_endings', 1);
$_SESSION['file_lines'] = file($_FILES['userfile']['tmp_name'][0]);
$_SESSION['rol_id'] = $role->getValue('rol_id');
$_SESSION['user_import_mode'] = $postUserImportMode;
if ($postImportCoding == 'iso-8859-1') {
    // Daten der Datei erst einmal in UTF8 konvertieren, damit es damit spaeter keine Probleme gibt
    foreach ($_SESSION['file_lines'] as $key => $value) {
        $_SESSION['file_lines'][$key] = utf8_encode($value);
    }
}
// CSV-Import (im Moment gibt es nur diesen, spaeter muss hier dann unterschieden werden)
header('Location: ' . $g_root_path . '/adm_program/modules/members/import_csv_config.php');
Example #5
0
            WHERE rol_cat_id  = cat_id
                AND cat_type    = \'ROL\'
                    ' . $sqlRolesStatus . '
                AND (  cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . '
                     OR cat_org_id IS NULL )
            ORDER BY cat_sequence ASC, rol_name ASC ';
$rol_result = $gDb->query($sql);
// Create role object
$role = new TableRoles($gDb);
while ($row = $gDb->fetch_array($rol_result)) {
    $assignRoles = '';
    $listView = '';
    $linkAdministration = '';
    // Add data to role object
    $role->setArray($row);
    $categoryName = $role->getValue('cat_name');
    if ($role->getValue('cat_hidden') == 1) {
        $categoryName .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/user_key.png"
                             alt="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $gL10n->get('SYS_ROLE')) . '" title="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $gL10n->get('SYS_ROLE')) . '" />';
    }
    if ($role->getValue('rol_assign_roles') == 1) {
        $assignRoles .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/roles.png"
                            alt="' . $gL10n->get('ROL_RIGHT_ASSIGN_ROLES') . '" title="' . $gL10n->get('ROL_RIGHT_ASSIGN_ROLES') . '" />';
    }
    if ($role->getValue('rol_approve_users') == 1) {
        $assignRoles .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/new_registrations.png"
                            alt="' . $gL10n->get('ROL_RIGHT_APPROVE_USERS') . '" title="' . $gL10n->get('ROL_RIGHT_APPROVE_USERS') . '" />';
    }
    if ($role->getValue('rol_edit_user') == 1) {
        $assignRoles .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/group.png"
                            alt="' . $gL10n->get('ROL_RIGHT_EDIT_USER') . '" title="' . $gL10n->get('ROL_RIGHT_EDIT_USER') . '" />';
Example #6
0
require_once '../../system/common.php';
require_once '../../system/login_valid.php';
// Initialize and check the parameters
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'int');
$getMode = admFuncVariableIsValid($_GET, 'mode', 'int', array('requireValue' => true));
// only members who are allowed to create and edit roles should have access to
// most of these functions
if (!$gCurrentUser->manageRoles() && $getMode != 9) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// Rollenobjekt anlegen
$role = new TableRoles($gDb);
if ($getRoleId > 0) {
    $role->readDataById($getRoleId);
    // Pruefung, ob die Rolle zur aktuellen Organisation gehoert
    if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
}
$_SESSION['roles_request'] = $_POST;
if ($getMode === 1) {
    // create html page object
    $page = new HtmlPage($gL10n->get('ROL_ROLE_DELETE'));
    // add back link to module menu
    $messageMenu = $page->getMenu();
    $messageMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
    $page->addHtml('
        <div class="message">
            <p class="lead">
                <img src="' . THEME_PATH . '/icons/roles_gray.png" alt="' . $gL10n->get('ROL_INACTIV_ROLE') . '" />
                ' . $gL10n->get('ROL_INACTIV_ROLE_DESC') . '<br /><br />
Example #7
0
foreach ($listConfigurations as &$rowConfigurations) {
    if ($rowConfigurations[2] == 0) {
        $rowConfigurations[2] = $gL10n->get('LST_YOUR_LISTS');
    } else {
        $rowConfigurations[2] = $gL10n->get('LST_GENERAL_LISTS');
    }
}
// add list item for own list
$listConfigurations[] = array('mylist', $gL10n->get('LST_CREATE_OWN_LIST'), $gL10n->get('LST_CONFIGURATION'));
// Create role object
$role = new TableRoles($gDb);
foreach ($listsResult['recordset'] as $row) {
    // Put data to Roleobject
    $role->setArray($row);
    // if category is different than previous, close old and open new one
    if ($previousCategoryId != $role->getValue('cat_id')) {
        // close only if previous category is not 0
        if ($previousCategoryId != 0) {
            $page->addHtml('</div></div></div>');
        }
        $page->addHtml('<div class="panel panel-primary">
            <div class="panel-heading">' . $role->getValue('cat_name') . '</div>
            <div class="panel-body">
                <div class="panel-group" id="accordion_' . $role->getValue('cat_id') . '">');
        $previousCategoryId = $role->getValue('cat_id');
    }
    $page->addHtml('
    <div class="panel panel-default" id="role_details_panel_' . $role->getValue('rol_id') . '">
        <div class="panel-heading">
            <div class="pull-left">
                <h4 class="panel-title">
Example #8
0
require_once '../../system/login_valid.php';
if (isset($_GET['mode']) && $_GET['mode'] === 'assign') {
    // ajax mode then only show text if error occurs
    $gMessage->showTextOnly(true);
}
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('defaultValue' => 'html', 'validValues' => array('html', 'assign')));
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'numeric', array('requireValue' => true, 'directOutput' => true));
$getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'numeric', array('directOutput' => true));
$getFilterRoleId = admFuncVariableIsValid($_GET, 'filter_rol_id', 'numeric');
$getMembersShowAll = admFuncVariableIsValid($_GET, 'mem_show_all', 'boolean');
$_SESSION['set_rol_id'] = $getRoleId;
// create object of the commited role
$role = new TableRoles($gDb, $getRoleId);
// roles of other organizations can't be edited
if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// check if user is allowed to assign members to this role
if (!$role->allowedToAssignMembers($gCurrentUser)) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if ($getMembersShowAll == 1) {
    $getFilterRoleId = 0;
}
if ($getFilterRoleId > 0) {
    if (!$gCurrentUser->hasRightViewRole($getFilterRoleId)) {
        $gMessage->show($gL10n->get('LST_NO_RIGHTS_VIEW_LIST'));
    }
}
if ($getMode === 'assign') {
require_once '../../system/login_valid.php';
if (isset($_GET['mode']) && $_GET['mode'] === 'assign') {
    // ajax mode then only show text if error occurs
    $gMessage->showTextOnly(true);
}
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('defaultValue' => 'html', 'validValues' => array('html', 'assign')));
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'int', array('requireValue' => true, 'directOutput' => true));
$getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'int', array('directOutput' => true));
$getFilterRoleId = admFuncVariableIsValid($_GET, 'filter_rol_id', 'int');
$getMembersShowAll = admFuncVariableIsValid($_GET, 'mem_show_all', 'bool');
$_SESSION['set_rol_id'] = $getRoleId;
// create object of the commited role
$role = new TableRoles($gDb, $getRoleId);
// roles of other organizations can't be edited
if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// check if user is allowed to assign members to this role
if (!$role->allowedToAssignMembers($gCurrentUser)) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if ($getMembersShowAll) {
    $getFilterRoleId = 0;
}
if ($getFilterRoleId > 0) {
    if (!$gCurrentUser->hasRightViewRole($getFilterRoleId)) {
        $gMessage->show($gL10n->get('LST_NO_RIGHTS_VIEW_LIST'));
    }
}
if ($getMode === 'assign') {
Example #10
0
                 AND rol_cat_id     = cat_id
                 AND (  cat_org_id  = ' . $gCurrentOrganization->getValue('org_id') . '
                     OR cat_org_id IS NULL )
             ORDER BY cat_sequence, cat_id, rol_name';
}
$statement = $gDb->query($sql);
$category = '';
$role = new TableRoles($gDb);
while ($row = $statement->fetch()) {
    $columnValues = array();
    $memberChecked = '';
    $memberDisabled = '';
    $leaderChecked = '';
    $leaderDisabled = '';
    $role->setArray($row);
    if ($role->getValue('rol_visible') == 1) {
        // if user is assigned to this role
        // or if user is created in members.php of list module
        if ($row['mem_usr_id'] > 0 || $role->getValue('rol_id') == $setRoleId) {
            $memberChecked = ' checked="checked" ';
        }
        // if role is webmaster than only webmaster can add new user,
        // but don't change their own membership, because there must be at least one webmaster
        if ($role->getValue('rol_webmaster') == 1 && (!$gCurrentUser->isWebmaster() || $gCurrentUser->isWebmaster() && $getUserId == $gCurrentUser->getValue('usr_id'))) {
            $memberDisabled = ' disabled="disabled" ';
        }
        // if user is flagged as leader than check the ckeckbox ;)
        if ($row['mem_leader'] > 0) {
            $leaderChecked = ' checked="checked" ';
        }
        // the leader of webmaster role can only be set by a webmaster
Example #11
0
function getRoleMemberships($htmlListId, $user, $result_role, $count_role, $directOutput)
{
    global $gDb, $gL10n, $gCurrentUser, $gPreferences, $g_root_path, $gProfileFields;
    $countShowRoles = 0;
    $member = new TableMembers($gDb);
    $role = new TableRoles($gDb);
    $roleMemHTML = '<ul class="list-group admidio-list-roles-assign" id="' . $htmlListId . '">';
    while ($row = $gDb->fetch_array($result_role)) {
        if ($gCurrentUser->hasRightViewRole($row['mem_rol_id']) && $row['rol_visible'] == 1) {
            $formerMembership = false;
            $futureMembership = false;
            $showRoleEndDate = false;
            $deleteMode = 'pro_role';
            $member->clear();
            $member->setArray($row);
            $role->clear();
            $role->setArray($row);
            // if membership will not end, then don't show end date
            if (strcmp($member->getValue('mem_end', 'Y-m-d'), '9999-12-31') != 0) {
                $showRoleEndDate = true;
            }
            // check if membership ends in the past
            if (strcmp(DATE_NOW, $member->getValue('mem_end', 'Y-m-d')) > 0) {
                $formerMembership = true;
                $deleteMode = 'pro_former';
            }
            // check if membership starts in the future
            if (strcmp($member->getValue('mem_begin', 'Y-m-d'), DATE_NOW) > 0) {
                $futureMembership = true;
                $deleteMode = 'pro_future';
            }
            // create list entry for one role
            $roleMemHTML .= '
            <li class="list-group-item" id="role_' . $row['mem_rol_id'] . '">
                <ul class="list-group admidio-list-roles-assign-pos">
                    <li class="list-group-item">
                        <span>' . $role->getValue('cat_name') . ' - ';
            if ($gCurrentUser->hasRightViewRole($member->getValue('mem_rol_id'))) {
                $roleMemHTML .= '<a href="' . $g_root_path . '/adm_program/modules/lists/lists_show.php?mode=html&amp;rol_id=' . $member->getValue('mem_rol_id') . '" title="' . $role->getValue('rol_description') . '">' . $role->getValue('rol_name') . '</a>';
            } else {
                echo $role->getValue('rol_name');
            }
            if ($member->getValue('mem_leader') == 1) {
                $roleMemHTML .= ' - ' . $gL10n->get('SYS_LEADER');
            }
            $roleMemHTML .= '&nbsp;
                        </span>
                        <span class="pull-right text-right">';
            if ($showRoleEndDate == true) {
                $roleMemHTML .= $gL10n->get('SYS_SINCE_TO', $member->getValue('mem_begin', $gPreferences['system_date']), $member->getValue('mem_end', $gPreferences['system_date']));
            } elseif ($futureMembership == true) {
                $roleMemHTML .= $gL10n->get('SYS_FROM', $member->getValue('mem_begin', $gPreferences['system_date']));
            } else {
                $roleMemHTML .= $gL10n->get('SYS_SINCE', $member->getValue('mem_begin', $gPreferences['system_date']));
            }
            if ($role->allowedToAssignMembers($gCurrentUser)) {
                // You are not allowed to delete your own webmaster membership, other roles could be deleted
                if ($role->getValue('rol_webmaster') == 1 && $gCurrentUser->getValue('usr_id') != $user->getValue('usr_id') || $role->getValue('rol_webmaster') == 0) {
                    $roleMemHTML .= '
                                    <a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
                                        href="' . $g_root_path . '/adm_program/system/popup_message.php?type=' . $deleteMode . '&amp;element_id=role_' . $role->getValue('rol_id') . '&amp;database_id=' . $member->getValue('mem_id') . '&amp;name=' . urlencode($role->getValue('rol_name')) . '"><img
                                        src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('PRO_CANCEL_MEMBERSHIP') . '" title="' . $gL10n->get('PRO_CANCEL_MEMBERSHIP') . '" /></a>';
                } else {
                    $roleMemHTML .= '
                                    <a class="admidio-icon-link"><img src="' . THEME_PATH . '/icons/dummy.png" alt=""/></a>';
                }
                // do not edit webmaster role
                if ($row['rol_webmaster'] == 0) {
                    $roleMemHTML .= '<a class="admidio-icon-link" style="cursor:pointer;" onclick="profileJS.toggleDetailsOn(' . $member->getValue('mem_id') . ')"><img
                                        src="' . THEME_PATH . '/icons/edit.png" alt="' . $gL10n->get('PRO_CHANGE_DATE') . '" title="' . $gL10n->get('PRO_CHANGE_DATE') . '" /></a>';
                } else {
                    $roleMemHTML .= '<a class="admidio-icon-link"><img src="' . THEME_PATH . '/icons/dummy.png" alt=""/></a>';
                }
            }
            // only show info if system setting is activated
            if ($gPreferences['system_show_create_edit'] > 0) {
                $roleMemHTML .= '<a class="admidio-icon-link admMemberInfo" id="member_info_' . $member->getValue('mem_id') . '" href="javascript:"><img src="' . THEME_PATH . '/icons/info.png" alt="' . $gL10n->get('SYS_INFORMATIONS') . '" title="' . $gL10n->get('SYS_INFORMATIONS') . '"/></a>';
            }
            $roleMemHTML .= '</span>
                    </li>
                    <li class="list-group-item" id="membership_period_' . $member->getValue('mem_id') . '" style="visibility: hidden; display: none;"><div class="collapse navbar-collapse">';
            $form = new HtmlForm('membership_period_form_' . $member->getValue('mem_id'), $g_root_path . '/adm_program/modules/profile/profile_function.php?mode=7&amp;user_id=' . $user->getValue('usr_id') . '&amp;mem_id=' . $row['mem_id'], null, array('type' => 'navbar', 'setFocus' => false, 'class' => 'admidio-form-membership-period'));
            $form->addInput('membership_start_date_' . $member->getValue('mem_id'), $gL10n->get('SYS_START'), $member->getValue('mem_begin', $gPreferences['system_date']), array('type' => 'date', 'maxLength' => 10));
            $form->addInput('membership_end_date_' . $member->getValue('mem_id'), $gL10n->get('SYS_END'), $member->getValue('mem_end', $gPreferences['system_date']), array('type' => 'date', 'maxLength' => 10));
            $form->addSubmitButton('btn_send_' . $member->getValue('mem_id'), $gL10n->get('SYS_OK'));
            $roleMemHTML .= $form->show(false);
            $roleMemHTML .= '</div></li>
                    <li class="list-group-item" id="member_info_' . $member->getValue('mem_id') . '_Content" style="display: none;">';
            // show informations about user who creates the recordset and changed it
            $roleMemHTML .= admFuncShowCreateChangeInfoById($member->getValue('mem_usr_id_create'), $member->getValue('mem_timestamp_create'), $member->getValue('mem_usr_id_change'), $member->getValue('mem_timestamp_change')) . '
                    </li>
                </ul>
            </li>';
            $countShowRoles++;
        }
    }
    if ($countShowRoles == 0) {
        $roleMemHTML = '<div class="block-padding">' . $gL10n->get('PRO_NO_ROLES_VISIBLE') . '</div>';
    } else {
        $roleMemHTML .= '</ul>';
    }
    if ($directOutput) {
        echo $roleMemHTML;
        return '';
    } else {
        return $roleMemHTML;
    }
}
Example #12
0
    if ($rowConfigurations[2] == 0) {
        $rowConfigurations[2] = $gL10n->get('LST_YOUR_LISTS');
    } else {
        $rowConfigurations[2] = $gL10n->get('LST_GENERAL_LISTS');
    }
}
// add list item for own list
// @ptabaden: Removed myList item
// $listConfigurations[] = array('mylist', $gL10n->get('LST_CREATE_OWN_LIST'), $gL10n->get('LST_CONFIGURATION'));
// Create role object
$role = new TableRoles($gDb);
foreach ($listsResult['recordset'] as $row) {
    // Put data to Roleobject
    $role->setArray($row);
    // if category is different than previous, close old and open new one
    if ($previousCategoryId != $role->getValue('cat_id')) {
        // close only if previous category is not 0
        if ($previousCategoryId != 0) {
            $page->addHtml('</div></div></div>');
        }
        $page->addHtml('<div class="panel panel-primary">
            <div class="panel-heading">' . $role->getValue('cat_name') . '</div>
            <div class="panel-body">
                <div class="panel-group" id="accordion_' . $role->getValue('cat_id') . '">');
        $previousCategoryId = $role->getValue('cat_id');
    }
    // @ptabaden: #possibleError May not collapse panel
    $page->addHtml('
    <div class="panel panel-default lists-panel" id="role_details_panel_' . $role->getValue('rol_id') . '">
        <div class="panel-heading">
            <div class="pull-left">
Example #13
0
    // add form to html page
    $page->addHtml($form->show(false));
} elseif (!isset($messageStatement)) {
    if ($getUserId > 0) {
        // besitzt der User eine gueltige E-Mail-Adresse
        if (!strValidCharacters($user->getValue('EMAIL'), 'email')) {
            $gMessage->show($gL10n->get('SYS_USER_NO_EMAIL', $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME')));
        }
    } elseif ($getRoleId > 0) {
        // wird eine bestimmte Rolle aufgerufen, dann pruefen, ob die Rechte dazu vorhanden sind
        $role = new TableRoles($gDb);
        $role->readDataById($getRoleId);
        // Ausgeloggte duerfen nur an Rollen mit dem Flag "alle Besucher der Seite" Mails schreiben
        // Eingeloggte duerfen nur an Rollen Mails schreiben, zu denen sie berechtigt sind
        // Rollen muessen zur aktuellen Organisation gehoeren
        if (!$gValidLogin && $role->getValue('rol_mail_this_role') != 3 || $gValidLogin && !$gCurrentUser->hasRightSendMailToRole($getRoleId) || $role->getValue('rol_id') == null) {
            $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW'));
        }
        $rollenName = $role->getValue('rol_name');
    }
    $formParam = '';
    // if subject was set as param then send this subject to next script
    if ($getSubject !== '') {
        $formParam .= 'subject=' . $getSubject . '&';
    }
    // show form
    $form = new HtmlForm('mail_send_form', $g_root_path . '/adm_program/modules/messages/messages_send.php?' . $formParam, $page, array('enableFileUpload' => true));
    $form->openGroupBox('gb_mail_contact_details', $gL10n->get('SYS_CONTACT_DETAILS'));
    $preloadData = array();
    $sqlRoleIds = '';
    $sqlUserIds = '';
Example #14
0
     if ($return_code < 0) {
         $role->delete();
         $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
     }
 } elseif ($_POST['date_registration_possible'] == 0 && $date->getValue('dat_rol_id') > 0) {
     // date participation was deselected -> delete flag in event and than delete role
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $date->setValue('dat_rol_id', '');
     $date->save();
     $role->delete();
 } elseif ($_POST['date_registration_possible'] == 1 && $date->getValue('dat_rol_id') > 0) {
     // if event exists and you could register to this event then we must check
     // if the data of the role must be changed
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $roleName = $gL10n->get('DAT_DATE') . ' ' . $date->getValue('dat_begin', 'Y-m-d H:i') . ' - ' . $date->getValue('dat_id');
     if ($role->getValue('rol_max_members') != $date->getValue('dat_max_members') || $role->getValue('role_name' != $roleName)) {
         $role->setValue('rol_name', $roleName);
         $role->setValue('rol_max_members', $date->getValue('dat_max_members'));
         $role->save();
     }
 }
 // check if flag is set that current user wants to participate as leader to the date
 if (isset($_POST['date_current_user_assigned']) && $_POST['date_current_user_assigned'] == 1 && $gCurrentUser->isLeaderOfRole($date->getValue('dat_rol_id')) == false) {
     // user wants to participate -> add him to date
     $member = new TableMembers($gDb);
     $member->startMembership($role->getValue('rol_id'), $gCurrentUser->getValue('usr_id'), 1);
 } elseif (isset($_POST['date_current_user_assigned']) == false && $gCurrentUser->isMemberOfRole($date->getValue('dat_rol_id')) == true) {
     // user does't want to participate as leader -> remove his participation as leader from the event,
     // dont remove the participation itself!
     $member = new TableMembers($gDb);
     $member->readDataByColumns(array('mem_rol_id' => $role->getValue('rol_id'), 'mem_usr_id' => $gCurrentUser->getValue('usr_id')));
Example #15
0
                $role->clear();
                $role->setArray($row);
                if (!$showRolesOtherOrganizations) {
                    $page->addHtml('
                    <div class="panel panel-default" id="profile_other_orga_roles_box">
                        <div class="panel-heading">' . $gL10n->get('PRO_ROLE_MEMBERSHIP_OTHER_ORG') . HtmlForm::getHelpTextIcon('PRO_VIEW_ROLES_OTHER_ORGAS') . '
                        </div>
                        <div class="panel-body" id="profile_other_orga_roles_box_body">
                            <ul class="list-group admidio-list-roles-assign">');
                    $showRolesOtherOrganizations = true;
                }
                $startDate = new DateTimeExtended($row['mem_begin'], 'Y-m-d');
                // jede einzelne Rolle anzeigen
                $page->addHtml('
                <li class="list-group-item">
                    <span>' . $row['org_shortname'] . ' - ' . $role->getValue('cat_name') . ' - ' . $role->getValue('rol_name'));
                if ($row['mem_leader'] == 1) {
                    $page->addHtml(' - ' . $gL10n->get('SYS_LEADER'));
                }
                $page->addHtml('&nbsp;
                    </span>
                    <span class="pull-right">' . $gL10n->get('SYS_SINCE', $startDate->format($gPreferences['system_date'])) . '</span>
                </li>');
            }
        }
        $gCurrentUser->setOrganization($gCurrentOrganization->getValue('org_id'));
        if ($showRolesOtherOrganizations) {
            $page->addHtml('</ul></div></div>');
        }
    }
}
        // If start-date is later/bigger or on same day than end-date we show an error
        if ($formatedStartDate > $formatedEndDate) {
            exit($gL10n->get('SYS_DATE_END_BEFORE_BEGIN'));
        }
    } else {
        $formatedEndDate = '9999-12-31';
    }
    // save role membership
    $user->editRoleMembership($getMemberId, $formatedStartDate, $formatedEndDate);
    echo 'success';
} elseif ($getMode === 8) {
    // Export every member of a role into one vCard file
    if ($gCurrentUser->hasRightViewRole($getRoleId)) {
        // create filename of organization name and role name
        $role = new TableRoles($gDb, $getRoleId);
        $filename = $gCurrentOrganization->getValue('org_shortname') . '-' . str_replace('.', '', $role->getValue('rol_name')) . '.vcf';
        // for IE the filename must have special chars in hexadecimal
        if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
            $filename = urlencode($filename);
        }
        header('Content-Type: text/x-vcard; charset=iso-8859-1');
        header('Content-Disposition: attachment; filename="' . $filename . '"');
        // necessary for IE, because without it the download with SSL has problems
        header('Cache-Control: private');
        header('Pragma: public');
        // Ein Leiter darf nur Rollen zuordnen, bei denen er auch Leiter ist
        $sql = 'SELECT
                    bm.mem_usr_id
                FROM
                    ' . TBL_MEMBERS . ' bm
                WHERE
Example #17
0
}
if ($gPreferences['enable_auto_login'] == 1) {
    $form->addCheckbox('auto_login', $gL10n->get('SYS_REMEMBER_ME'), '0');
}
$form->addSubmitButton('btn_login', $gL10n->get('SYS_LOGIN'), array('icon' => THEME_PATH . '/icons/key.png'));
$page->addHtml($form->show(false));
if ($gPreferences['registration_mode'] > 0) {
    $page->addHtml('
        <div id="login_registration_link">
            <small><a href="' . $g_root_path . '/adm_program/modules/registration/registration.php">' . $gL10n->get('SYS_WANT_REGISTER') . '</a></small>
        </div>');
}
// Link bei Loginproblemen
if ($gPreferences['enable_password_recovery'] == 1 && $gPreferences['enable_system_mails'] == 1) {
    // neues Passwort zusenden
    $mail_link = $g_root_path . '/adm_program/system/lost_password.php';
} elseif ($gPreferences['enable_mail_module'] == 1 && $roleWebmaster->getValue('rol_mail_this_role') == 3) {
    // Mailmodul aufrufen mit Webmaster als Ansprechpartner
    $mail_link = $g_root_path . '/adm_program/modules/messages/messages_write.php?rol_id=' . $roleWebmaster->getValue('rol_id') . '&amp;subject=' . $gL10n->get('SYS_LOGIN_PROBLEMS');
} else {
    // direkte Mail an den Webmaster ueber einen externen Mailclient
    $mail_link = 'mailto:' . $gPreferences['email_administrator'] . '?subject=' . $gL10n->get('SYS_LOGIN_PROBLEMS');
}
$page->addHtml('
    <div id="login_forgot_password_link">
        <small><a href="' . $mail_link . '">' . $gL10n->get('SYS_FORGOT_MY_PASSWORD') . '</a></small>
    </div>
    <div id="login_admidio_link">
        <small>Powered by <a href="http://www.admidio.org/">Admidio</a></small>
    </div>');
$page->show();
Example #18
0
    $rolesData = $rolesStatement->fetchAll();
    // check if user has right to view all roles
    foreach ($rolesData as $role) {
        if (!$gCurrentUser->hasRightViewRole($role['rol_id'])) {
            $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
        }
        $htmlSubHeadline .= ', ' . $role['rol_name'];
    }
    $htmlSubHeadline = substr($htmlSubHeadline, 2);
} else {
    $role = new TableRoles($gDb, $roleIds[0]);
    // check if user has right to view role
    if (!$gCurrentUser->hasRightViewRole($roleIds[0])) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    $roleName = $role->getValue('rol_name');
    $htmlSubHeadline .= $role->getValue('cat_name');
}
// if no list parameter is set then load role default list configuration or system default list configuration
if ($numberRoles === 1 && $getListId === 0) {
    // set role default list configuration
    $getListId = $role->getDefaultList();
    if ($getListId === 0) {
        $gMessage->show($gL10n->get('LST_DEFAULT_LIST_NOT_SET_UP'));
    }
}
// initialize some special mode parameters
$separator = '';
$valueQuotes = '';
$charset = '';
$classTable = '';
Example #19
0
     } elseif ($act_or === 2) {
         $act_group = $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_FORMER_MEMBERS') . ')';
         $act_group_short = '(' . $gL10n->get('MSG_ACTIVE_FORMER_SHORT') . ')';
         $act_number = '-2';
     } else {
         $act_group = $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_MEMBERS') . ')';
         $act_number = '';
     }
     // list array with all roles where user is allowed to send mail to
     $send_roles = $gCurrentUser->getAllMailRoles();
     foreach ($send_roles as &$allowed_role) {
         // Rollenobjekt anlegen
         $role = new TableRoles($gDb);
         $role->readDataById($allowed_role);
         if ($act_number == '' || $role->hasFormerMembers($allowed_role) > 0 && $gPreferences['mail_show_former'] == 1) {
             $list[] = array('groupID: ' . $allowed_role . $act_number, $role->getValue('rol_name') . ' ' . $act_group_short, $act_group);
             $list_rol_id_array[] = $allowed_role;
         }
     }
 }
 foreach (array_unique($list_rol_id_array) as $key) {
     if (isset($list_rol_id)) {
         $list_rol_id .= ", '" . $key . "'";
     } else {
         $list_rol_id = "'" . $key . "'";
     }
 }
 // select Users
 $sql = 'SELECT usr_id, first_name.usd_value as first_name, last_name.usd_value as last_name,
                rol_mail_this_role, rol_id, mem_begin, mem_end
           FROM ' . TBL_MEMBERS . ', ' . TBL_ROLES . ', ' . TBL_USERS . '