/** * @param int $userId * @return AccountDiv */ function AccountDiv($userId, $accountId, $skinName) { $this->_account_id = $accountId; $this->_skin = $skinName; $user = new CalendarUser(); $acctArray = $user->SelectAccounts($userId); if (count($acctArray) > 0) { $this->_accounts =& $acctArray; } else { $this->_accounts[$accountId] = ''; } }
public static function getOwners($user_id, $permission = null) { $permission_array = array(Calendar::PERMISSION_READABLE, Calendar::PERMISSION_WRITABLE); if (!$permission) { $permission = $permission_array; } else { if (!in_array($permission, $permission_array)) { throw new InvalidArgumentException('Calendar permission must be of type PERMISSION_READABLE or PERMISSION_WRITABLE.'); } else { $permission = array($permission); } } return SimpleORMapCollection::createFromArray(CalendarUser::findBySQL('user_id = ? AND permission IN(?)', array($user_id, $permission))); }
private function getUserCalendarPermission($user_id) { $permission = Event::PERMISSION_FORBIDDEN; $accessibility = $this->getAccessibility(); if ($this->user->id) { if ($user_id != $this->user->id) { if ($accessibility == 'PUBLIC') { $permission = Event::PERMISSION_READABLE; } $calendar_user = CalendarUser::find(array($this->user->getId(), $user_id)); if ($calendar_user) { if ($accessibility == 'CONFIDENTIAL') { if ($this->event->calendars->findOneBy('range_id', $user_id)) { if ($calendar_user->permission == Calendar::PERMISSION_WRITABLE) { $permission = Event::PERMISSION_WRITABLE; } else { $permission = Event::PERMISSION_READABLE; } } else { $permission = Event::PERMISSION_CONFIDENTIAL; } } else { if ($calendar_user->permission == Calendar::PERMISSION_WRITABLE) { $permission = Event::PERMISSION_WRITABLE; } else { $permission = Event::PERMISSION_READABLE; } } } } else { $permission = Event::PERMISSION_WRITABLE; } } return $permission; }
/** * Returns the permission of the given user for this calendar. * * @param string $user_id User id. * @return int The calendar permission. */ public function getPermissionByUser($user_id = null) { static $user_permission = array(); $user_id = $user_id ?: $GLOBALS['user']->id; $id = $user_id . $this->getRangeId(); if ($user_permission[$id]) { return $user_permission[$id]; } // own calendar if ($this->range == Calendar::RANGE_USER && $this->getRangeId() == $user_id) { $user_permission[$id] = Calendar::PERMISSION_OWN; return $user_permission[$id]; } switch ($this->type) { case 'User': // alle Dozenten haben gegenseitig schreibenden Zugriff, ab dozent immer schreibenden Zugriff /* if ($GLOBALS['perm']->have_perm('dozent') && $GLOBALS['perm']->get_perm($this->range_object->getId()) == 'dozent') { return Calendar::PERMISSION_WRITABLE; } * */ $cal_user = CalendarUser::find(array($this->getRangeId(), $user_id)); if ($cal_user) { switch ($cal_user->permission) { case 1: $user_permission[$id] = Calendar::PERMISSION_FORBIDDEN; break; case 2: $user_permission[$id] = Calendar::PERMISSION_READABLE; break; case 4: $user_permission[$id] = Calendar::PERMISSION_WRITABLE; break; default: $user_permission[$id] = Calendar::PERMISSION_FORBIDDEN; } } else { $user_permission[$id] = Calendar::PERMISSION_FORBIDDEN; } break; /* case 'group' : $stmt = DBManager::get()->prepare('SELECT range_id FROM statusgruppen WHERE statusgruppe_id = ?'); $stmt->execute(array($range_id)); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result) { if ($result['range_id'] == $user_id) { return Calendar::PERMISSION_OWN; } } return Calendar::PERMISSION_FORBIDDEN; * */ /* case 'group' : $stmt = DBManager::get()->prepare('SELECT range_id FROM statusgruppen WHERE statusgruppe_id = ?'); $stmt->execute(array($range_id)); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result) { if ($result['range_id'] == $user_id) { return Calendar::PERMISSION_OWN; } } return Calendar::PERMISSION_FORBIDDEN; * */ case 'Course': switch ($GLOBALS['perm']->get_studip_perm($this->range_object->getId(), $user_id)) { case 'user': case 'autor': $user_permission[$id] = Calendar::PERMISSION_READABLE; break; case 'tutor': case 'dozent': case 'admin': case 'root': $user_permission[$id] = Calendar::PERMISSION_WRITABLE; break; default: $user_permission[$id] = Calendar::PERMISSION_FORBIDDEN; } break; case 'Institute': switch ($GLOBALS['perm']->get_studip_perm($this->range_object->getId(), $user_id)) { case 'user': $user_permission[$id] = Calendar::PERMISSION_READABLE; break; case 'autor': $user_permission[$id] = Calendar::PERMISSION_READABLE; break; case 'tutor': case 'dozent': case 'admin': case 'root': $user_permission[$id] = Calendar::PERMISSION_WRITABLE; break; default: // readable for all $user_permission[$id] = Calendar::PERMISSION_READABLE; } break; default: $user_permission[$id] = Calendar::PERMISSION_FORBIDDEN; } return $user_permission[$id]; }
/** * Retrieves all contact groups (statusgruppen) owned by the given user * where at least one member has granted access to his calender for the user. * * @param string $user_id User id of the owner. * @return type */ public static function getGroups($user_id) { $groups = array(); $calendar_owners = CalendarUser::getOwners($user_id)->pluck('owner_id'); $sg_groups = SimpleORMapCollection::createFromArray(Statusgruppen::findByRange_id($user_id))->orderBy('position')->pluck('statusgruppe_id'); if (sizeof($calendar_owners)) { $sg_users = StatusgruppeUser::findBySQL('statusgruppe_id IN(?) AND user_id IN(?)', array($sg_groups, $calendar_owners)); foreach ($sg_users as $sg_user) { $groups[$sg_user->group->id] = $sg_user->group; } } return $groups; }
public function edit_action($range_id = null, $event_id = null) { $this->range_id = $range_id ?: $this->range_id; // get group and the calendars of the members // the first calendar is the calendar of the actual user $this->calendar = new SingleCalendar($GLOBALS['user']->id); $group = $this->getGroup($this->calendar); if ($group) { $calendar_owners = CalendarUser::getOwners($GLOBALS['user']->id, Calendar::PERMISSION_WRITABLE)->pluck('owner_id'); $members = $group->members->pluck('user_id'); $user_id = Request::option('user_id'); $this->attendee_ids = array_intersect($calendar_owners, $members); $this->attendee_ids[] = $GLOBALS['user']->id; if ($user_id && in_array($user_id, $this->attendee_ids)) { $this->attendee_ids = array($user_id); } } $this->event = $this->calendar->getEvent($event_id); if ($this->event->isNew()) { $this->event = $this->calendar->getNewEvent(); if (Request::get('isdayevent')) { $this->event->setStart(mktime(0, 0, 0, date('n', $this->atime), date('j', $this->atime), date('Y', $this->atime))); $this->event->setEnd(mktime(23, 59, 59, date('n', $this->atime), date('j', $this->atime), date('Y', $this->atime))); } else { $this->event->setStart($this->atime); $this->event->setEnd($this->atime + 3600); } $this->event->setAuthorId($GLOBALS['user']->id); $this->event->setEditorId($GLOBALS['user']->id); $this->event->setAccessibility('PRIVATE'); if ($this->attendee_ids) { foreach ($this->attendee_ids as $attendee_id) { $attendee_event = clone $this->event; $attendee_event->range_id = $attendee_id; $this->attendees[] = $attendee_event; } } if (!Request::isXhr()) { PageLayout::setTitle($this->getTitle($this->calendar, _('Neuer Termin'))); } } else { // open read only events and course events not as form // show information in dialog instead if (!$this->event->havePermission(Event::PERMISSION_WRITABLE) || $this->event instanceof CourseEvent) { $this->redirect($this->url_for('calendar/single/event/' . implode('/', array($this->range_id, $this->event->event_id)))); return null; } $this->attendees = $this->event->getAttendees(); if (!Request::isXhr()) { PageLayout::setTitle($this->getTitle($this->calendar, _('Termin bearbeiten'))); } } if (get_config('CALENDAR_GROUP_ENABLE') && $this->calendar->getRange() == Calendar::RANGE_USER) { $search_obj = new SQLSearch("SELECT auth_user_md5.user_id, {$GLOBALS['_fullname_sql']['full_rev']} as fullname, username, perms " . "FROM calendar_user " . "LEFT JOIN auth_user_md5 ON calendar_user.owner_id = auth_user_md5.user_id " . "LEFT JOIN user_info ON (auth_user_md5.user_id = user_info.user_id) " . 'WHERE calendar_user.user_id = ' . DBManager::get()->quote($GLOBALS['user']->id) . ' AND calendar_user.permission > ' . Event::PERMISSION_READABLE . ' AND (username LIKE :input OR Vorname LIKE :input ' . "OR CONCAT(Vorname,' ',Nachname) LIKE :input " . "OR CONCAT(Nachname,' ',Vorname) LIKE :input " . "OR Nachname LIKE :input OR {$GLOBALS['_fullname_sql']['full_rev']} LIKE :input " . ") ORDER BY fullname ASC", _('Person suchen'), 'user_id'); $this->quick_search = QuickSearch::get('user_id', $search_obj)->fireJSFunctionOnSelect('STUDIP.Messages.add_adressee'); // $default_selected_user = array($this->calendar->getRangeId()); $this->mps = MultiPersonSearch::get('add_adressees')->setLinkText(_('Mehrere Teilnehmer hinzufügen'))->setTitle(_('Mehrere Teilnehmer hinzufügen'))->setExecuteURL($this->url_for($this->base . 'edit'))->setJSFunctionOnSubmit('STUDIP.Messages.add_adressees')->setSearchObject($search_obj); $owners = SimpleORMapCollection::createFromArray(CalendarUser::findByUser_id($this->calendar->getRangeId()))->pluck('owner_id'); foreach (Calendar::getGroups($GLOBALS['user']->id) as $group) { $this->mps->addQuickfilter($group->name, $group->members->filter(function ($member) use($owners) { if (in_array($member->user_id, $owners)) { return $member; } })->pluck('user_id')); } } $stored = false; if (Request::submitted('store')) { $stored = $this->storeEventData($this->event, $this->calendar); } if ($stored !== false) { // switch back to group context $this->range_id = $group->getId(); if ($stored === 0) { if (Request::isXhr()) { header('X-Dialog-Close: 1'); exit; } else { PageLayout::postMessage(MessageBox::success(_('Der Termin wurde nicht geändert.'))); $this->relocate('calendar/group/' . $this->last_view, array('atime' => $this->atime)); } } else { PageLayout::postMessage(MessageBox::success(_('Der Termin wurde gespeichert.'))); $this->relocate('calendar/group/' . $this->last_view, array('atime' => $this->atime)); } } else { $this->createSidebar('edit', $this->calendar); $this->createSidebarFilter(); $this->render_template('calendar/single/edit', $this->layout); } }
public function store_permissions_action($range_id = null) { $this->range_id = $range_id ?: $this->range_id; $this->calendar = new SingleCalendar($this->range_id); $deleted = 0; $read = 0; $write = 0; $submitted_permissions = Request::intArray('perm'); foreach ($submitted_permissions as $user_id => $new_perm) { $calendar_user = new CalendarUser(array($this->calendar->getRangeId(), $user_id)); if (!$calendar_user->isNew() && $new_perm == 1) { $deleted += $calendar_user->delete(); $new_perm = 0; } if ($new_perm >= Calendar::PERMISSION_READABLE && $calendar_user->permission != $new_perm) { $calendar_user->permission = $new_perm; if ($calendar_user->store()) { if ($new_perm == Calendar::PERMISSION_READABLE) { $read++; } else { $write++; } } } } $sum = $deleted + $read + $write; if ($sum) { if ($deleted) { $details[] = sprintf(ngettext('Einer Person wurde die Berechtigungen entzogen.', '%s Personen wurden die Berechtigungen entzogen.', $deleted), $deleted); } if ($read) { $details[] = sprintf(ngettext('Eine Person wurde auf leseberechtigt gesetzt.', '%s Personen wurden auf leseberechtigt gesetzt.', $read), $read); } if ($write) { $details[] = sprintf(ngettext('Eine Person wurde auf schreibberechtigt gesetzt.', '%s Personen wurden auf schreibberechtigt gesetzt.', $write), $write); } PageLayout::postMessage(MessageBox::success(sprintf(ngettext('Die Berechtigungen von einer Person wurde geändert.', 'Die Berechtigungen von %s Personen wurden geändert.', $sum), $sum), $details)); // no message if the group was changed } else { if (!Request::submitted('calendar_group_submit')) { PageLayout::postMessage(MessageBox::success(_('Es wurden keine Berechtigungen geändert.'))); } } $this->redirect($this->url_for('calendar/single/manage_access/' . $this->calendar->getRangeId(), array('group_filter' => Request::option('group_filter', 'list')))); }
/** * Delete an existing user from the database and tidy up * * @access public * @param bool delete all documents belonging to the user * @return bool Removal successful? */ function deleteUser($delete_documents = true) { global $perm; // Do we have permission to do so? if (!$perm->have_perm("admin")) { $this->msg .= "error§" . _("Sie haben keine Berechtigung Accounts zu löschen.") . "§"; return FALSE; } if (!$perm->have_perm("root")) { if ($this->user_data['auth_user_md5.perms'] == "root") { $this->msg .= "error§" . _("Sie haben keine Berechtigung <em>Root-Accounts</em> zu löschen.") . "§"; return FALSE; } if ($this->user_data['auth_user_md5.perms'] == "admin" && !$this->adminOK()) { $this->msg .= "error§" . _("Sie haben keine Berechtigung diesen Admin-Account zu löschen.") . "§"; return FALSE; } } $status = studygroup_sem_types(); // active dozent? if (empty($status)) { $active_count = 0; } else { $query = "SELECT SUM(c) AS count FROM (\n SELECT COUNT(*) AS c\n FROM seminar_user AS su1\n INNER JOIN seminar_user AS su2 ON (su1.seminar_id = su2.seminar_id AND su2.status = 'dozent')\n INNER JOIN seminare ON (su1.seminar_id = seminare.seminar_id AND seminare.status NOT IN (?))\n WHERE su1.user_id = ? AND su1.status = 'dozent'\n GROUP BY su1.seminar_id\n HAVING c = 1\n ORDER BY NULL\n ) AS sub"; $statement = DBManager::get()->prepare($query); $statement->execute(array(studygroup_sem_types(), $this->user_data['auth_user_md5.user_id'])); $active_count = $statement->fetchColumn(); } if ($active_count) { $this->msg .= sprintf("error§" . _("<em>%s</em> ist Lehrkraft in %s aktiven Veranstaltungen und kann daher nicht gelöscht werden.") . "§", $this->user_data['auth_user_md5.username'], $active_count); return FALSE; //founder of studygroup? } elseif (get_config('STUDYGROUPS_ENABLE')) { $status = studygroup_sem_types(); if (empty($status)) { $group_ids = array(); } else { $query = "SELECT Seminar_id\n FROM seminare AS s\n LEFT JOIN seminar_user AS su USING (Seminar_id)\n WHERE su.status = 'dozent' AND su.user_id = ? AND s.status IN (?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'], studygroup_sem_types())); $group_ids = $statement->fetchAll(PDO::FETCH_COLUMN); } foreach ($group_ids as $group_id) { $sem = Seminar::GetInstance($group_id); if (StudygroupModel::countMembers($group_id) > 1) { // check whether there are tutors or even autors that can be promoted $tutors = $sem->getMembers('tutor'); $autors = $sem->getMembers('autor'); if (count($tutors) > 0) { $new_founder = current($tutors); StudygroupModel::promote_user($new_founder['username'], $sem->getId(), 'dozent'); continue; } elseif (count($autors) > 0) { $new_founder = current($autors); StudygroupModel::promote_user($new_founder['username'], $sem->getId(), 'dozent'); continue; } // since no suitable successor was found, we are allowed to remove the studygroup } else { $sem->delete(); } unset($sem); } } // store user preferred language for sending mail $user_language = getUserLanguagePath($this->user_data['auth_user_md5.user_id']); // delete documents of this user if ($delete_documents) { // Remove private file space of this user if (Config::get()->PERSONALDOCUMENT_ENABLE) { $root_dir = new RootDirectory($this->user_data['auth_user_md5.user_id']); $root_dir->delete(); } // Remove other files $temp_count = 0; $query = "SELECT dokument_id FROM dokumente WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); while ($document_id = $statement->fetchColumn()) { if (delete_document($document_id)) { $temp_count++; } } if ($temp_count) { $this->msg .= "info§" . sprintf(_("%s Dokumente gelöscht."), $temp_count) . "§"; } // delete empty folders of this user $temp_count = 0; $query = "SELECT COUNT(*) FROM folder WHERE range_id = ?"; $count_content = DBManager::get()->prepare($query); $query = "DELETE FROM folder WHERE folder_id = ?"; $delete_folder = DBManager::get()->prepare($query); $query = "SELECT folder_id FROM folder WHERE user_id = ? ORDER BY mkdate DESC"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); while ($folder_id = $statement->fetchColumn()) { $count_content->execute(array($folder_id)); $count = $count_content->fetchColumn(); $count_content->closeCursor(); if (!$count && !doc_count($folder_id)) { $delete_folder->execute(array($folder_id)); $temp_count += $delete_folder->rowCount(); } } if ($temp_count) { $this->msg .= "info§" . sprintf(_("%s leere Ordner gelöscht."), $temp_count) . "§"; } // folder left? $query = "SELECT COUNT(*) FROM folder WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); $count = $statement->fetchColumn(); if ($count) { $this->msg .= sprintf("info§" . _("%s Ordner konnten nicht gelöscht werden, da sie noch Dokumente anderer BenutzerInnen enthalten.") . "§", $count); } } // kill all the ressources that are assigned to the user (and all the linked or subordinated stuff!) if (Config::get()->RESOURCES_ENABLE) { $killAssign = new DeleteResourcesUser($this->user_data['auth_user_md5.user_id']); $killAssign->delete(); } $this->re_sort_position_in_seminar_user(); // delete user from seminars (postings will be preserved) $query = "DELETE FROM seminar_user WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus Veranstaltungen gelöscht."), $db_ar) . "§"; } // delete user from waiting lists $query = "SELECT seminar_id FROM admission_seminar_user WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); $seminar_ids = $statement->fetchAll(PDO::FETCH_COLUMN); $query = "DELETE FROM admission_seminar_user WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus Wartelisten gelöscht."), $db_ar) . "§"; array_map('update_admission', $seminar_ids); } // delete user from instituts $this->logInstUserDel($this->user_data['auth_user_md5.user_id']); $query = "DELETE FROM user_inst WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus MitarbeiterInnenlisten gelöscht."), $db_ar) . "§"; } // delete user from Statusgruppen if ($db_ar = RemovePersonFromAllStatusgruppen(get_username($this->user_data['auth_user_md5.user_id'])) > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus Funktionen / Gruppen gelöscht."), $db_ar) . "§"; } // delete user from archiv $query = "DELETE FROM archiv_user WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus den Zugriffsberechtigungen für das Archiv gelöscht."), $db_ar) . "§"; } // delete all personal news from this user if ($db_ar = StudipNews::DeleteNewsByAuthor($this->user_data['auth_user_md5.user_id'])) { $this->msg .= "info§" . sprintf(_("%s Einträge aus den Ankündigungen gelöscht."), $db_ar) . "§"; } if ($db_ar = StudipNews::DeleteNewsRanges($this->user_data['auth_user_md5.user_id'])) { $this->msg .= "info§" . sprintf(_("%s Verweise auf Ankündigungen gelöscht."), $db_ar) . "§"; } //delete entry in news_rss_range StudipNews::UnsetRssId($this->user_data['auth_user_md5.user_id']); // delete 'Studiengaenge' $query = "DELETE FROM user_studiengang WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Zuordnungen zu Studiengängen gelöscht."), $db_ar) . "§"; } // delete all private appointments of this user if (get_config('CALENDAR_ENABLE')) { $appkills = CalendarEvent::deleteBySQL('range_id = ?', array($this->user_data['auth_user_md5.user_id'])); if ($appkills) { $this->msg .= "info§" . sprintf(_("%s Einträge aus den Terminen gelöscht."), $appkills) . "§"; } // delete membership in group calendars if (get_config('CALENDAR_GROUP_ENABLE')) { $membershipkills = CalendarUser::deleteBySQL('owner_id = :user_id OR user_id = :user_id', array(':user_id' => $this->user_data['auth_user_md5.user_id'])); if ($membershipkills) { $this->msg .= 'info§' . sprintf(_('%s Verknüpfungen mit Gruppenterminkalendern gelöscht.')); } } } // delete all messages send or received by this user $messaging = new messaging(); $messaging->delete_all_messages($this->user_data['auth_user_md5.user_id']); // delete user from all foreign adressbooks and empty own adressbook $buddykills = Contact::deleteBySQL('user_id = ?', array($this->user_data['auth_user_md5.user_id'])); if ($buddykills > 0) { $this->msg .= "info§" . sprintf(_("%s Einträge aus Adressbüchern gelöscht."), $buddykills) . "§"; } $contactkills = Contact::deleteBySQL('owner_id = ?', array($this->user_data['auth_user_md5.user_id'])); if ($contactkills) { $this->msg .= sprintf(_('Adressbuch mit %d Einträgen gelöscht.'), $contactkills); } // delete users groups Statusgruppen::deleteBySQL('range_id = ?', array($this->user_data['auth_user_md5.user_id'])); // remove user from any groups StatusgruppeUser::deleteBySQL('user_id = ?', array($this->user_data['auth_user_md5.user_id'])); // delete all blubber entrys $query = "DELETE FROM blubber WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (($db_ar = $statement->rowCount()) > 0) { $this->msg .= "info§" . sprintf(_("%s Blubber gelöscht."), $db_ar) . "§"; } // delete the datafields $localEntries = DataFieldEntry::removeAll($this->user_data['auth_user_md5.user_id']); UserConfigEntry::deleteByUser($this->user_data['auth_user_md5.user_id']); // delete all remaining user data $queries = array("DELETE FROM kategorien WHERE range_id = ?", "DELETE FROM user_info WHERE user_id = ?", "DELETE FROM user_visibility WHERE user_id = ?", "DELETE FROM user_online WHERE user_id = ?", "DELETE FROM auto_insert_user WHERE user_id = ?", "DELETE FROM roles_user WHERE userid = ?", "DELETE FROM schedule WHERE user_id = ?", "DELETE FROM schedule_seminare WHERE user_id = ?", "DELETE FROM termin_related_persons WHERE user_id = ?", "DELETE FROM user_userdomains WHERE user_id = ?"); foreach ($queries as $query) { DBManager::get()->prepare($query)->execute(array($this->user_data['auth_user_md5.user_id'])); } object_kill_visits($this->user_data['auth_user_md5.user_id']); object_kill_views($this->user_data['auth_user_md5.user_id']); // delete picture $avatar = Avatar::getAvatar($this->user_data["auth_user_md5.user_id"]); if ($avatar->is_customized()) { $avatar->reset(); $this->msg .= "info§" . _("Bild gelöscht.") . "§"; } // delete visibility settings Visibility::removeUserPrivacySettings($this->user_data['auth_user_md5.user_id']); //delete connected users if (get_config('ELEARNING_INTERFACE_ENABLE')) { if (ELearningUtils::initElearningInterfaces()) { foreach ($GLOBALS['connected_cms'] as $cms) { if ($cms->auth_necessary && $cms->user instanceof ConnectedUser) { $user_auto_create = $cms->USER_AUTO_CREATE; $cms->USER_AUTO_CREATE = false; $userclass = strtolower(get_class($cms->user)); $connected_user = new $userclass($cms->cms_type, $this->user_data['auth_user_md5.user_id']); if ($ok = $connected_user->deleteUser()) { if ($connected_user->is_connected) { $this->msg .= "info§" . sprintf(_("Der verknüpfte Nutzer %s wurde im System %s gelöscht."), $connected_user->login, $connected_user->cms_type) . "§"; } } $cms->USER_AUTO_CREATE = $user_auto_create; } } } } // delete deputy entries if necessary $query = "DELETE FROM deputies WHERE ? IN (user_id, range_id)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); $deputyEntries = $statement->rowCount(); if ($deputyEntries) { $this->msg .= "info§" . sprintf(_("%s Einträge in den Vertretungseinstellungen gelöscht."), $deputyEntries) . "§"; } // delete Stud.IP account $query = "DELETE FROM auth_user_md5 WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user_data['auth_user_md5.user_id'])); if (!$statement->rowCount()) { $this->msg .= "error§<em>" . _("Fehler:") . "</em> " . $query . "§"; return FALSE; } else { $this->msg .= "msg§" . sprintf(_("Benutzer \"%s\" gelöscht."), $this->user_data['auth_user_md5.username']) . "§"; } log_event("USER_DEL", $this->user_data['auth_user_md5.user_id'], NULL, sprintf("%s %s (%s)", $this->user_data['auth_user_md5.Vorname'], $this->user_data['auth_user_md5.Nachname'], $this->user_data['auth_user_md5.username'])); //log with Vorname Nachname (username) as info string // Can we reach the email? if ($this->checkMail($this->user_data['auth_user_md5.Email'])) { // include language-specific subject and mailbody $Zeit = date("H:i:s, d.m.Y", time()); include "locale/{$user_language}/LC_MAILS/delete_mail.inc.php"; // send mail StudipMail::sendMessage($this->user_data['auth_user_md5.Email'], $subject, $mailbody); } unset($this->user_data); return TRUE; }
<? foreach ($groups as $group) : ?> <option value="<?php echo $group->getId(); ?> "<?php echo $range_id == $group->getId() ? ' selected' : ''; ?> > <?php echo htmlReady($group->name); ?> </option> <? endforeach ?> </optgroup> <? endif; ?> <? $calendar_users = CalendarUser::getOwners($GLOBALS['user']->id); ?> <? if (count($calendar_users)) : ?> <optgroup style="font-weight:bold;" label="<?php echo _('Einzelkalender:'); ?> "> <? foreach ($calendar_users as $calendar_user) : ?> <option value="<?php echo $calendar_user->owner_id; ?> "<?php echo $range_id == $calendar_user->owner_id ? ' selected' : ''; ?> > <?php echo htmlReady($calendar_user->owner->getFullname());
if (!isset($_SESSION[USER_ID]) || !isset($_SESSION[ACCOUNT_ID])) { exit('<script type="text/javascript">if (parent) { parent.HideCalendar(\'error\', 1); } else { document.write("session error")}</script>'); } $id_user = (int) $_SESSION[USER_ID]; $id_acct = (int) $_SESSION[ACCOUNT_ID]; require_once WM_ROOTPATH . 'class_settings.php'; require_once WM_ROOTPATH . 'calendar/class_settings.php'; require_once WM_ROOTPATH . 'calendar/class_calendar_account.php'; require_once WM_ROOTPATH . 'calendar/class_accountmenu.php'; $wm_settings =& Settings::CreateInstance(); if (!$wm_settings || !$wm_settings->isLoad || !$wm_settings->IncludeLang()) { exit('<script type="text/javascript">if (parent) { parent.HideCalendar(\'error\', 3); } else { document.write("settings error")}</script>'); } $settings = new CalSettings($wm_settings); SQL::init($settings->DbHost, $settings->DbLogin, $settings->DbPassword, $settings->DbName); $user = new CalendarUser(); if (!$user->CheckUserExist($id_user)) { $arr = array('user_id' => $id_user, 'timeformat' => $settings->DefaultTimeFormat, 'dateformat' => $settings->DefaultDateFormat, 'showweekends' => $settings->ShowWeekends, 'workdaystarts' => $settings->WorkdayStarts, 'workdayends' => $settings->WorkdayEnds, 'showworkday' => $settings->ShowWorkDay, 'weekstartson' => $settings->WeekStartsOn, 'defaulttab' => $settings->DefaultTab, 'country' => $settings->DefaultCountry, 'timezone' => $settings->DefaultTimeZone, 'alltimezones' => $settings->AllTimeZones); $user->Id = 0; $user->CreateUpdateUserSettings($arr); } if (isset($_SESSION[DEMO_SES][DEMO_S_DefaultLanguage]) && isset($_SESSION[DEMO_SES][DEMO_S_DefaultSkin])) { $skin = $_SESSION[DEMO_SES][DEMO_S_DefaultSkin]; $lang = $_SESSION[DEMO_SES][DEMO_S_DefaultLanguage]; } else { list($skin, $lang) = $user->GetLiteAccountDataByUserId($id_user); } $accountDiv = new AccountDiv($id_user, $id_acct, $skin); $hideContacts = !$wm_settings->AllowContacts ? '' : '<span class="wm_accountslist_contacts"> <a href="#" onclick="parent.HideCalendar(\'contacts\'); return false;">' . JS_LANG_Contacts . '</a> </span>';
$userArray = array(); $tzone = 0; $log =& CLog::CreateInstance(); $log->WriteLine('>>> calendar GET:' . "\r\n" . dumpGet()); if (isset($_SESSION[USER_ID])) { $user_id = (int) $_SESSION[USER_ID]; $userArray = SQL::Select($settings->DbPrefix, 'acal_users_data', 'user_id', $user_id); if ($userArray && count($userArray) > 0 && count($userArray[0]) > 0) { $userArray = $userArray[0]; $tz = isset($userArray['timezone'], $TimeZones[$userArray['timezone']][0]) ? $TimeZones[$userArray['timezone']][0] : null; $tzs = $tz ? explode(':', $tz) : null; if ($tzs && count($tzs) > 1) { $tzone = 60 * (intval($tzs[1]) + 60 * intval($tzs[0])); } } else { $user = new CalendarUser(); $userArray = array('user_id' => $user_id, 'timeformat' => $settings->DefaultTimeFormat, 'dateformat' => $settings->DefaultDateFormat, 'showweekends' => $settings->ShowWeekends, 'workdaystarts' => $settings->WorkdayStarts, 'workdayends' => $settings->WorkdayEnds, 'showworkday' => $settings->ShowWorkDay, 'weekstartson' => $settings->WeekStartsOn, 'defaulttab' => $settings->DefaultTab, 'country' => $settings->DefaultCountry, 'timezone' => $settings->DefaultTimeZone, 'alltimezones' => $settings->AllTimeZones); $user->Id = 0; $user->CreateUpdateUserSettings($userArray); $tz = isset($userArray['timezone'], $TimeZones[$userArray['timezone']][0]) ? $TimeZones[$userArray['timezone']][0] : null; $tzs = $tz ? explode(':', $tz) : null; if ($tzs && count($tzs) > 1) { $tzone = 60 * (intval($tzs[1]) + 60 * intval($tzs[0])); } unset($userArray['user_id']); } } else { $log->WriteLine('calendar error: ' . PROC_SESSION_ERROR); exit(getErrorJson(0, PROC_SESSION_ERROR)); } if (isset($_GET['calendar_id'])) {