diff --git a/app/controllers/admin/courseplanning.php b/app/controllers/admin/courseplanning.php index 47c181d501669271c5fc0f0ae69ec36743680704..c07d6d9e0a2f3d6f6ced334856f6785acca024d1 100644 --- a/app/controllers/admin/courseplanning.php +++ b/app/controllers/admin/courseplanning.php @@ -38,6 +38,7 @@ class Admin_CourseplanningController extends AuthenticatedController if (in_array($action, ['index', 'weekday'])) { PageLayout::allowFullscreenMode(); } + $this->selected_weekday = ''; } private function getPlanTitle() diff --git a/app/controllers/admin/overlapping.php b/app/controllers/admin/overlapping.php index 97efe4e434d8855eddaf062249395510c5479a7c..8072ff59b4f402ab277f7998b7a3871c89327bac 100644 --- a/app/controllers/admin/overlapping.php +++ b/app/controllers/admin/overlapping.php @@ -69,7 +69,7 @@ class Admin_OverlappingController extends AuthenticatedController } $this->conflicts = MvvOverlappingSelection::getConflictsBySelection( $this->selection_id, - !$_SESSION['MVV_OVL_HIDDEN'] + empty($_SESSION['MVV_OVL_HIDDEN']) ); } diff --git a/app/controllers/calendar/contentbox.php b/app/controllers/calendar/contentbox.php index 134fe0cb04f14b679e6e499c640bbe3deb0985c3..f2689bfd1069e074f89469cdfce3508816cde862 100644 --- a/app/controllers/calendar/contentbox.php +++ b/app/controllers/calendar/contentbox.php @@ -12,17 +12,22 @@ * @category Stud.IP * @package calender */ -class Calendar_ContentboxController extends StudipController { - +class Calendar_ContentboxController extends StudipController +{ /** * Widget controller to produce the formally known show_dates() * * @param String $range_id range id (or array of range ids) of the news to get displayed */ - public function display_action($range_id, $timespan = 604800, $start = null) - { + public function display_action($range_id, $timespan = 604800, $start = null) + { + $this->admin = false; + $this->single = false; + $this->userRange = false; + $this->termine = []; + // Fetch time if needed - $this->start = $start ? : strtotime('today'); + $this->start = $start ?: strtotime('today'); $this->timespan = $timespan; // To array fallback of $range_id @@ -55,7 +60,7 @@ class Calendar_ContentboxController extends StudipController { } // Forge title - if ($this->termine) { + if (!empty($this->termine)) { $this->title = sprintf( _('Termine für die Zeit vom %s bis zum %s'), strftime('%d. %B %Y', $this->start), @@ -75,6 +80,7 @@ class Calendar_ContentboxController extends StudipController { { $course = Course::find($id); $dates = $course->getDatesWithExdates()->findBy('end_time', [$this->start, $this->start + $this->timespan], '><'); + foreach ($dates as $courseDate) { // Build info $info = []; @@ -116,8 +122,6 @@ class Calendar_ContentboxController extends StudipController { ); // Prepare termine - $this->termine = []; - foreach ($events as $termin) { // Exclude events that begin after the given time range if ($termin->getStart() > $this->start + $this->timespan) { diff --git a/app/controllers/course/admission.php b/app/controllers/course/admission.php index 80e084acd88cfbb9d9a9696919e674d0305d8e20..1e8832e38040f5aa8e2535b6d6dddc42358fc464 100644 --- a/app/controllers/course/admission.php +++ b/app/controllers/course/admission.php @@ -24,7 +24,7 @@ class Course_AdmissionController extends AuthenticatedController parent::before_filter($action, $args); - $course_id = $args[0]; + $course_id = $args[0] ?? ''; $this->course_id = Request::option('cid', $course_id); @@ -111,7 +111,7 @@ class Course_AdmissionController extends AuthenticatedController } } $lockdata = LockRules::getObjectRule($this->course_id); - if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) { + if (!empty($lockdata['description']) && LockRules::CheckLockRulePermission($this->course_id)) { PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description']))); } } @@ -400,8 +400,14 @@ class Course_AdmissionController extends AuthenticatedController { PageLayout::setTitle(_('Neue Anmelderegel')); - list($type, $another_type) = explode('_', Request::option('type')); - list($rule_id, $another_rule_id) = explode('_', Request::option('rule_id')); + $types = explode('_', Request::option('type')); + $type = $types[0] ?? ''; + $another_type = $types[1] ?? null; + + $rule_ids = explode('_', Request::option('rule_id')); + $rule_id = $rule_ids[0] ?? ''; + $another_rule_id = $rule_ids[1] ?? null; + $rule_types = AdmissionRule::getAvailableAdmissionRules(true); if (isset($rule_types[$type])) { $rule = new $type($rule_id); diff --git a/app/controllers/course/basicdata.php b/app/controllers/course/basicdata.php index bc20ed5fe387d5edf9a6184f37917a4862ea2ca3..efff19264a363a42ae37179559035ebc74095970 100644 --- a/app/controllers/course/basicdata.php +++ b/app/controllers/course/basicdata.php @@ -230,22 +230,23 @@ class Course_BasicdataController extends AuthenticatedController private function instituteChoices($institutes) { $faculty_id = null; - $result = []; + $result = []; foreach ($institutes as $inst) { + $key = $inst['fakultaets_id'] ?? $faculty_id; if ($inst['is_fak']) { $result[$inst['Institut_id']] = [ 'label' => $inst['Name'], 'children' => [], ]; $faculty_id = $inst['Institut_id']; - } elseif (!isset($result[$inst['fakultaets_id'] ?: $faculty_id])) { + } elseif (!isset($result[$key])) { $result[] = [ 'label' => false, 'children' => [$inst['Institut_id'] => $inst['Name']], ]; } else { - $result[$inst['fakultaets_id'] ?: $faculty_id]['children'][$inst['Institut_id']] = $inst['Name']; + $result[$key]['children'][$inst['Institut_id']] = $inst['Name']; } } @@ -257,7 +258,7 @@ class Course_BasicdataController extends AuthenticatedController * Action wie Set ausgeführt wurde, von der hierher weitergeleitet worden ist. * Wichtige Daten dazu wurden dann über $this->flash übertragen. * - * @param md5 $course_id + * @param string $course_id */ public function view_action($course_id = null) { @@ -356,27 +357,37 @@ class Course_BasicdataController extends AuthenticatedController $this->mkstring = $data['mkdate'] ? date("d.m.Y, H:i", $data['mkdate']) : _("unbekannt"); $this->chstring = $data['chdate'] ? date("d.m.Y, H:i", $data['chdate']) : _("unbekannt"); $lockdata = LockRules::getObjectRule($this->course_id); - if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])){ + if (!empty($lockdata['description']) && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])){ $this->flash['msg'] = array_merge((array)$this->flash['msg'], [["info", formatLinks($lockdata['description'])]]); } $this->flash->discard(); //schmeißt ab jetzt unnötige Variablen aus der Session. $sidebar = Sidebar::get(); $widget = new ActionsWidget(); - $widget->addLink(_('Bild ändern'), - $this->url_for('avatar/update/course', $course_id), - Icon::create('edit', 'clickable')); + $widget->addLink( + _('Bild ändern'), + $this->url_for('avatar/update/course', $course_id), + Icon::create('edit') + ); if ($this->deputies_enabled) { + $newstatus = null; + $text = null; + if (Deputy::isDeputy($user->id, $this->course_id)) { $newstatus = 'dozent'; $text = _('Lehrende werden'); - } else if (in_array($user->id, array_keys($this->dozenten)) && sizeof($this->dozenten) > 1) { + } else if (in_array($user->id, array_keys($this->dozenten)) && count($this->dozenten) > 1) { $newstatus = 'deputy'; $text = _('Vertretung werden'); } - $widget->addLink($text, - $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus), - Icon::create('persons', 'clickable')); + + if ($text) { + $widget->addLink( + $text, + $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus), + Icon::create('persons') + ); + } } $sidebar->addWidget($widget); // Entry list for admin upwards. diff --git a/app/controllers/course/block_appointments.php b/app/controllers/course/block_appointments.php index f45ac1012ff966a7fcc3594e6560a31e95bff577..67035fa356c437a21dd4d7764bd11d5c50cde66c 100644 --- a/app/controllers/course/block_appointments.php +++ b/app/controllers/course/block_appointments.php @@ -42,6 +42,8 @@ class Course_BlockAppointmentsController extends AuthenticatedController protected function setAvailableRooms() { + $this->room_search = null; + $this->selectable_rooms = []; if (Config::get()->RESOURCES_ENABLE) { //Check for how many rooms the user has booking permissions. //In case these permissions exist for more than 50 rooms @@ -54,7 +56,6 @@ class Course_BlockAppointmentsController extends AuthenticatedController 'admin' ); - $this->selectable_rooms = []; $rooms_with_booking_permissions = 0; if ($current_user_is_resource_admin) { $rooms_with_booking_permissions = Room::countAll(); @@ -99,7 +100,7 @@ class Course_BlockAppointmentsController extends AuthenticatedController } $this->linkAttributes = ['fromDialog' => Request::int('fromDialog') ? 1 : 0]; $this->start_ts = strtotime('this monday'); - $this->request = $this->flash['request'] ?: $_SESSION['block_appointments']; + $this->request = $this->flash['request'] ?? $_SESSION['block_appointments'] ?? []; $this->confirm_many = isset($this->flash['confirm_many']) ? $this->flash['confirm_many'] : false; $this->lecturers = CourseMember::findByCourseAndStatus( $this->course_id, diff --git a/app/controllers/course/lvgselector.php b/app/controllers/course/lvgselector.php index 541ff27521bd00f0977375b9fd4c3b6a382c5377..101bee0e042ebd1b31f5d4dd2f680abf086cfb3f 100644 --- a/app/controllers/course/lvgselector.php +++ b/app/controllers/course/lvgselector.php @@ -46,6 +46,7 @@ class Course_LvgselectorController extends AuthenticatedController */ public function index_action() { + $this->url_params = []; if (Request::get('from')) { $this->url_params['from'] = Request::get('from'); } @@ -117,6 +118,7 @@ class Course_LvgselectorController extends AuthenticatedController } $this->ajax_url = $this->url_for('course/lvgselector/ajax'); + $this->no_js_url = ''; $this->url = $this->action_url('index'); } @@ -132,7 +134,8 @@ class Course_LvgselectorController extends AuthenticatedController $stepNumber = Request::int('step'); $method = Request::get('method'); $parameters = Request::getArray('parameter'); - $result = call_user_func_array(['LVGroupsWizardStep', $method], $parameters); + $wizard_step = new LVGroupsWizardStep(); + $result = call_user_func_array([$wizard_step, $method], $parameters); if (is_array($result) || is_object($result)) { $this->render_json($result); } else { diff --git a/app/controllers/course/overview.php b/app/controllers/course/overview.php index 966c0cac91dc363e7e2f58b3f3195be0cf6ffde7..0994d547374504791fb6b10ff5113dcc2622fd09 100644 --- a/app/controllers/course/overview.php +++ b/app/controllers/course/overview.php @@ -16,8 +16,6 @@ class Course_OverviewController extends AuthenticatedController public function before_filter(&$action, &$args) { - global $SEM_TYPE, $SEM_CLASS; - parent::before_filter($action, $args); checkObject(); @@ -74,16 +72,16 @@ class Course_OverviewController extends AuthenticatedController $this->dates = $response->body; $this->next_date = $this->sem->getNextDate(); $this->first_date = $this->sem->getFirstDate(); - $show_link = ($GLOBALS["perm"]->have_studip_perm('autor', $this->course_id) && $this->modules['schedule']); + $show_link = $GLOBALS["perm"]->have_studip_perm('autor', $this->course_id) && $this->course->isToolActive('schedule'); $this->times_rooms = $this->sem->getDatesTemplate('dates/seminar_html', ['link_to_dates' => $show_link, 'show_room' => true]); // Fettch teachers $dozenten = $this->sem->getMembers('dozent'); - $num_dozenten = count($dozenten); + $this->num_dozenten = count($dozenten); $show_dozenten = []; foreach ($dozenten as $dozent) { $show_dozenten[] = '<a href="' . URLHelper::getLink('dispatch.php/profile', ['username' => $dozent['username']]) . '">' - . htmlready($num_dozenten > 10 ? get_fullname($dozent['user_id'], 'no_title_short') : $dozent['fullname']) + . htmlready($this->num_dozenten > 10 ? get_fullname($dozent['user_id'], 'no_title_short') : $dozent['fullname']) . '</a>'; } $this->show_dozenten = $show_dozenten; diff --git a/app/controllers/course/room_requests.php b/app/controllers/course/room_requests.php index 8747e9b4ab59e4ea6fbf9adb4a525a3c7653cbc1..d23b5c72aec5e2ccf3602d29183137eafadc5fb0 100644 --- a/app/controllers/course/room_requests.php +++ b/app/controllers/course/room_requests.php @@ -28,9 +28,8 @@ class Course_RoomRequestsController extends AuthenticatedController parent::before_filter($action, $args); - $course_id = $args[0]; $this->current_user = User::findCurrent(); - $this->course_id = Request::option('cid', $course_id); + $this->course_id = Request::option('cid', $args[0] ?? null); $pagetitle = ''; //Navigation in der Veranstaltung: if (Navigation::hasItem('/course/admin/room_requests')) { @@ -206,6 +205,17 @@ class Course_RoomRequestsController extends AuthenticatedController */ protected function loadData($session_data, $step = 1) { + $this->available_room_categories = []; + $this->room_name = ''; + $this->category_id = ''; + $this->category = null; + $this->available_properties = []; + $this->selected_properties = []; + $this->seats = ''; + $this->comment = ''; + $this->reply_lecturers = false; + $this->preparation_time = 0; + $this->course_id = Context::getId(); $this->user_is_global_resource_admin = ResourceManager::userHasGlobalPermission( $this->current_user, @@ -220,19 +230,19 @@ class Course_RoomRequestsController extends AuthenticatedController ); } if ($step >= 2) { - if ($session_data['category_id']) { + if (!empty($session_data['category_id'])) { $this->category = ResourceCategory::find($session_data['category_id']); - if ($this->category instanceof ResourceCategory) { + if ($this->category) { //Get all available properties for the category: $this->available_properties = $this->category->getRequestableProperties(); } } - $this->room_name = $session_data['room_name']; - $this->category_id = $session_data['category_id']; - $this->preparation_time = $session_data['preparation_time'] ?: '0'; + $this->room_name = $session_data['room_name'] ?? ''; + $this->category_id = $session_data['category_id'] ?? ''; + $this->preparation_time = $session_data['preparation_time'] ?? '0'; } if ($step >= 3) { - if ($this->category instanceof ResourceCategory) { + if ($this->category) { $this->selected_properties = $session_data['selected_properties']; } } @@ -442,7 +452,7 @@ class Course_RoomRequestsController extends AuthenticatedController $this->available_properties = $this->category->getRequestableProperties(); - if (!$session_data['selected_properties']['seats']) { + if (empty($session_data['selected_properties']['seats'])) { $this->course = Course::find($this->course_id); $admission_turnout = $this->course->admission_turnout; $this->selected_properties['seats'] = $admission_turnout @@ -590,11 +600,11 @@ class Course_RoomRequestsController extends AuthenticatedController $this->reply_lecturers = $this->request->reply_recipients == 'lecturer'; } - $search_properties = $this->selected_properties; - if ($session_data['category_id']) { + $search_properties = $this->selected_properties ?? []; + if (!empty($session_data['category_id'])) { $search_properties['room_category_id'] = $session_data['category_id']; } - if ($search_properties['seats']) { + if (!empty($search_properties['seats'])) { //The seats property value is a minimum. $search_properties['seats'] = [ $search_properties['seats'], @@ -625,7 +635,6 @@ class Course_RoomRequestsController extends AuthenticatedController } $this->available_room_icons = []; $request_time_intervals = $this->request->getTimeIntervals(); - $request_date_amount = count($request_time_intervals); foreach ($this->matching_rooms as $room) { $request_dates_booked = 0; foreach ($request_time_intervals as $interval) { diff --git a/app/controllers/course/study_areas.php b/app/controllers/course/study_areas.php index d1fa13e7c84e4604edd30df5bafcd9a8899306d3..fcb64401fcd45e2f7c1104677d46eaec73e015d4 100644 --- a/app/controllers/course/study_areas.php +++ b/app/controllers/course/study_areas.php @@ -130,7 +130,7 @@ class Course_StudyAreasController extends AuthenticatedController } $params = []; - if(Request::get('open_node')) { + if (Request::get('open_node')) { $params['open_node'] = Request::get('open_node'); } if (Request::get('from')) { diff --git a/app/controllers/course/timesrooms.php b/app/controllers/course/timesrooms.php index cd9d001b4a4cf320092b9b56a3f9b5aa65af2c0f..4ae955fd67333daeab80614328be1846afb567ce 100644 --- a/app/controllers/course/timesrooms.php +++ b/app/controllers/course/timesrooms.php @@ -168,9 +168,8 @@ class Course_TimesroomsController extends AuthenticatedController if (($val->room_booking instanceof ResourceBooking) && !$cycle_has_multiple_rooms) { $date_room = $val->room_booking->resource->name; - if ($this->cycle_room_names[$cycle->id]) { - if ($date_room - && ($date_room != $this->cycle_room_names[$cycle->id])) { + if (isset($this->cycle_room_names[$cycle->id])) { + if ($date_room && $date_room != $this->cycle_room_names[$cycle->id]) { $cycle_has_multiple_rooms = true; } } elseif ($date_room) { @@ -225,8 +224,11 @@ class Course_TimesroomsController extends AuthenticatedController } $this->single_dates = $single_dates; - $this->checked_dates = $_SESSION['_checked_dates']; - unset($_SESSION['_checked_dates']); + $this->checked_dates = []; + if (!empty($_SESSION['_checked_dates'])) { + $this->checked_dates = $_SESSION['_checked_dates']; + unset($_SESSION['_checked_dates']); + } } /** @@ -1115,6 +1117,8 @@ class Course_TimesroomsController extends AuthenticatedController words('day start_time end_time description cycle startWeek teacher_sws fromDialog course_type') ); + $this->linkAttributes = ['fromDialog' => Request::isXhr() ? 1 : 0]; + $this->cycle = new SeminarCycleDate($cycle_id); if ($this->cycle->isNew()) { @@ -1604,6 +1608,8 @@ class Course_TimesroomsController extends AuthenticatedController protected function setAvailableRooms($dates, $date_booking_ids = [], $only_bookable_rooms = false) { + $this->room_search = null; + $this->selectable_rooms = []; if (Config::get()->RESOURCES_ENABLE) { //Check for how many rooms the user has booking permissions. //In case these permissions exist for more than 50 rooms @@ -1629,7 +1635,6 @@ class Course_TimesroomsController extends AuthenticatedController ]; } } - $this->selectable_rooms = []; $rooms_with_booking_permissions = 0; if ($current_user_is_resource_admin) { $rooms_with_booking_permissions = Room::countAll(); diff --git a/app/controllers/evaluation.php b/app/controllers/evaluation.php index 7ed30df8298cec606377a7f02c3d16a8ebd6d366..4a157a9643b22e59f1d96d5eaca94efba2fb00fa 100644 --- a/app/controllers/evaluation.php +++ b/app/controllers/evaluation.php @@ -38,9 +38,7 @@ class EvaluationController extends AuthenticatedController $this->evaluations = array_merge($this->evaluations, StudipEvaluation::findMany($eval_db->getEvaluationIDs($range_id, EVAL_STATE_STOPPED))); } } - - // Special case: from widget and no data -> no output - if (count($this->evaluations) === 0) { + if (!empty($this->suppress_empty_output) && count($this->evaluations) === 0) { $this->render_nothing(); } else { $this->visit(); diff --git a/app/controllers/my_courses.php b/app/controllers/my_courses.php index 21943fe65cb9ad24e8afdc1d183e4889473b23d3..da3210712532f70cdde2c3c560a77084c37365d3 100644 --- a/app/controllers/my_courses.php +++ b/app/controllers/my_courses.php @@ -955,7 +955,7 @@ class MyCoursesController extends AuthenticatedController $extra_navigation = [ 'url' => URLHelper::getURL($adminnavigation->getURL(), ['cid' => $course['seminar_id']]), 'icon' => $adminnavigation->getImage()->getShape(), - 'label' => $adminnavigation->getLinkAttributes()['title'] ?: _('Verwaltung'), + 'label' => $adminnavigation->getLinkAttributes()['title'] ?? _('Verwaltung'), ]; } } diff --git a/app/controllers/my_institutes.php b/app/controllers/my_institutes.php index 514fd66380b3e61c18ef1c408bd232c680bf1c76..a17862f206de2b03063417c9355432e1cba0293d 100644 --- a/app/controllers/my_institutes.php +++ b/app/controllers/my_institutes.php @@ -84,7 +84,7 @@ class MyInstitutesController extends AuthenticatedController protected function check_institute($institute): bool { if ($institute['visitdate'] || $institute['last_modified']) { - if ($institute['visitdate'] <= $institute["chdate"] || $institute['last_modified'] > 0) { + if ($institute['visitdate'] <= $institute["chdate"] || (!empty($institute['last_modified']) && $institute['last_modified'] > 0)) { $last_modified = ($institute['visitdate'] <= $institute["chdate"] && $institute["chdate"] > $institute['last_modified'] ? $institute["chdate"] : $institute['last_modified']); if ($last_modified) { diff --git a/app/controllers/questionnaire.php b/app/controllers/questionnaire.php index d886be237568d03ec0f506d388bba3fd31a8b2cf..dd115218cfe1164f96e8da4243743f16add2b6b3 100644 --- a/app/controllers/questionnaire.php +++ b/app/controllers/questionnaire.php @@ -399,6 +399,9 @@ class QuestionnaireController extends AuthenticatedController if (!$this->questionnaire->isEditable()) { throw new AccessDeniedException(_('Der Fragebogen ist nicht bearbeitbar.')); } + $this->profile = null; + $this->public = null; + $this->start = null; foreach ($this->questionnaire->assignments as $relation) { if ($relation['range_type'] === "user") { $this->profile = $relation; diff --git a/app/controllers/studip_controller.php b/app/controllers/studip_controller.php index f2eb023695545d90510445bc83c651bc632046b8..2e93d0556fb8fd0f46b9084429d3973c6ab2a585 100644 --- a/app/controllers/studip_controller.php +++ b/app/controllers/studip_controller.php @@ -263,10 +263,10 @@ abstract class StudipController extends Trails_Controller // Try to create route if none given if ($to === '') { - $args[0] = $this->parent_controller + $to = isset($this->parent_controller) ? $this->parent_controller->current_action : $this->current_action; - return $this->action_url(...$args); + return $this->action_url($to); } // Create url for a specific action diff --git a/app/views/admin/overlapping/selection.php b/app/views/admin/overlapping/selection.php index e9707327f02a60b9ea2f0d54555d998c6585b10c..1c27c791ca95b5b897dee242a435e8fbf0504266 100644 --- a/app/views/admin/overlapping/selection.php +++ b/app/views/admin/overlapping/selection.php @@ -58,7 +58,7 @@ <label> <input type="checkbox" name="show_hidden" - value="1" <?= $_SESSION['MVV_OVL_HIDDEN'] ? ' checked' : '' ?>> + value="1" <?= !empty($_SESSION['MVV_OVL_HIDDEN']) ? ' checked' : '' ?>> <?= _('ausgeblendete Veranstaltungen anzeigen') ?> </label> </fieldset> diff --git a/app/views/calendar/contentbox/display.php b/app/views/calendar/contentbox/display.php index 6791670a1cab13d2814adda7ad5ea31314e3176b..41498f4e19cce6f8e3762895d6cc8783c2f52e91 100644 --- a/app/views/calendar/contentbox/display.php +++ b/app/views/calendar/contentbox/display.php @@ -19,14 +19,13 @@ <? endif; ?> </nav> </header> - <? if($termine): ?> - + <? if ($termine): ?> <? foreach ($termine as $termin): ?> <?= $this->render_partial('calendar/contentbox/_termin.php', ['termin' => $termin]); ?> <? endforeach; ?> <? else: ?> <section> - <? if($isProfile): ?> + <? if ($isProfile): ?> <?= _('Es sind keine aktuellen Termine vorhanden. Um neue Termine zu erstellen, klicken Sie rechts auf das Plus.') ?> <? else: ?> <?= _('Es sind keine aktuellen Termine vorhanden. Um neue Termine zu erstellen, klicken Sie rechts auf die Zahnräder.') ?> diff --git a/app/views/course/basicdata/_input.php b/app/views/course/basicdata/_input.php index ffaad5eae79f31dff19cb4e1695ba8c8a18b93c9..60f6b60f507bcf5e36c7e8f90918ed51c54d3103 100644 --- a/app/views/course/basicdata/_input.php +++ b/app/views/course/basicdata/_input.php @@ -2,35 +2,35 @@ # Lifter010: TODO $is_locked = $input['locked'] ? 'disabled readonly' : ''; $is_locked_array = $input['locked'] ? ['disabled' => true, 'readonly' => true] : []; -$is_required_array = $input['must'] ? ['required' => true] : []; -$is_pattern_array = $input['pattern'] ? ['pattern' => $input['pattern']] : []; +$is_required_array = !empty($input['must']) ? ['required' => true] : []; +$is_pattern_array = !empty($input['pattern']) ? ['pattern' => $input['pattern']] : []; if ($input['type'] === "text") : ?> - <? if ($input['i18n']) : ?> + <? if (!empty($input['i18n'])) : ?> <?= I18N::input($input['name'], $input['value'], $is_locked_array + $is_required_array + $is_pattern_array) ?> <? else : ?> - <input <?=$is_locked ?> type="text" name="<?= $input['name'] ?>" value="<?= htmlReady($input['value']) ?>" <? if ($input['must']) echo 'required'; ?> <? if ($input['pattern']) : ?>pattern="<?= htmlReady($input['pattern']) ?>"<? endif ?>> + <input <?=$is_locked ?> type="text" name="<?= htmlReady($input['name']) ?>" value="<?= htmlReady($input['value']) ?>" <? if (!empty($input['must'])) echo 'required'; ?> <? if (!empty($input['pattern'])) printf('pattern="%s"', htmlReady($input['pattern'])) ?>> <? endif ?> <? endif; if ($input['type'] === "number") : ?> - <input <?=$is_locked ?> type="number" name="<?= $input['name'] ?>" value="<?= htmlReady($input['value']) ?>" min="<?= $input['min'] ?>" <? if ($input['must']) echo 'required'; ?>> + <input <?=$is_locked ?> type="number" name="<?= htmlReady($input['name']) ?>" value="<?= htmlReady($input['value']) ?>" min="<?= $input['min'] ?>" <? if (!empty($input['must'])) echo 'required'; ?>> <? endif; if ($input['type'] === "textarea") : ?> - <? if ($input['i18n']) : ?> + <? if (!empty($input['i18n'])) : ?> <?= I18N::textarea($input['name'], $input['value'], $is_locked_array + $is_required_array) ?> <? else : ?> - <textarea <?=$is_locked ?> name="<?= $input['name'] ?>" <? if ($input['must']) echo 'required'; ?>><?= + <textarea <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" <? if (!empty($input['must'])) echo 'required'; ?>><?= htmlReady($input['value']) ?></textarea> <? endif ?> <? endif; if ($input['type'] === "select") : ?> - <? if (!$input['choices'][$input['value']] && !(isset($input['changable']) && $input['changable'])): ?> + <? if (empty($input['choices'][$input['value']]) && empty($input['changable'])): ?> <?= _("Keine Änderung möglich") ?> <? else: ?> - <select <?=$is_locked ?> name="<?= $input['name'] ?>" <? if ($input['must']) echo 'required'; ?>> + <select <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" <? if (!empty($input['must'])) echo 'required'; ?>> <? foreach ($input['choices'] as $choice_value => $choice_name): ?> <? if (is_array($choice_name)): ?> <optgroup label="<?= htmlReady($choice_value) ?>"> @@ -51,7 +51,7 @@ if ($input['type'] === "select") : ?> <? endif; if ($input['type'] === "multiselect") : ?> - <select <?=$is_locked ?> name="<?= $input['name'] ?>" multiple class="nested-select" <? if ($input['must']) echo 'required'; ?>> + <select <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" multiple class="nested-select" <? if (!empty($input['must'])) echo 'required'; ?>> <? if ($input['choices']) : foreach ($input['choices'] as $choice_value => $choice_name) : ?> <option value="<?= htmlReady($choice_value) ?>"<?= in_array($choice_value, is_array($input['value']) ? $input['value'] : [$input['value']]) @@ -65,7 +65,7 @@ if ($input['type'] === 'nested-select'): ?> <? if (isset($input['changable']) && !$input['changable']): ?> <?= _("Keine Änderung möglich") ?> <? else: ?> - <select <?= $is_locked ?> name="<?= $input['name'] ?>" class="nested-select" <? if ($input['must']) echo 'required'; ?> <? if ($input['multiple']) echo 'multiple'; ?>> + <select <?= $is_locked ?> name="<?= htmlReady($input['name']) ?>" class="nested-select" <? if (!empty($input['must'])) echo 'required'; ?> <? if (!empty($input['multiple'])) echo 'multiple'; ?>> <? foreach ($input['choices'] as $outer_id => $group): ?> <? if ($group['label'] !== false): ?> <option value="<?= htmlReady($outer_id) ?>" class="nested-item-header" <? if (in_array($outer_id, (array)$input['value'])) echo 'selected'; ?>> diff --git a/app/views/course/basicdata/view.php b/app/views/course/basicdata/view.php index f74614757f32c4e4430524da67f5fc721b658576..cdd4f8707991f06f606b9cb0e3dd7c4a6a404281 100644 --- a/app/views/course/basicdata/view.php +++ b/app/views/course/basicdata/view.php @@ -32,10 +32,10 @@ $message_types = ['msg' => "success", 'error' => "error", 'info' => "info"]; <? else: ?> <? foreach ($attributes as $attribute): ?> <label> - <span <?= $attribute['must'] ? 'class="required"' : '' ?>> + <span <?= !empty($attribute['must']) ? 'class="required"' : '' ?>> <?= htmlReady($attribute['title']) ?> </span> - <?= $attribute['description'] ? tooltipIcon($attribute['description']) : '' ?> + <?= !empty($attribute['description']) ? tooltipIcon($attribute['description']) : '' ?> <?= $this->render_partial("course/basicdata/_input", ['input' => $attribute]) ?> </label> @@ -63,7 +63,7 @@ $message_types = ['msg' => "success", 'error' => "error", 'info' => "info"]; <? else: ?> <? foreach ($institutional as $inst): ?> <label> - <span <?= $inst['must'] ? 'class="required"' : '' ?>> + <span <?= !empty($inst['must']) ? 'class="required"' : '' ?>> <?= htmlReady($inst['title']) ?> </span> @@ -304,7 +304,7 @@ $message_types = ['msg' => "success", 'error' => "error", 'info' => "info"]; <?= $this->render_partial('course/basicdata/_input', ['input' => $description]) ?> <? else : ?> <label> - <span <?= $description['must'] ? 'class="required"' : '' ?>> + <span <?= !empty($description['must']) ? 'class="required"' : '' ?>> <?= $description['title'] ?> </span> @@ -333,4 +333,4 @@ json_encode(preg_split('/[\s,;]+/', Config::get()->PROPOSED_TEACHER_LABELS, -1, }); }); STUDIP.MultiPersonSearch.init(); -</script> \ No newline at end of file +</script> diff --git a/app/views/course/block_appointments/index.php b/app/views/course/block_appointments/index.php index 4dc0b87c1473079f83fc292d31f86b856f84e364..62add7c13c54bd32d29a191d33257222abb69ac1 100644 --- a/app/views/course/block_appointments/index.php +++ b/app/views/course/block_appointments/index.php @@ -4,7 +4,7 @@ <form <?= Request::isXhr() ? 'data-dialog="size=big"' : '' ?> class="default collapsable" - action="<?= $controller->url_for('course/block_appointments/save/' . $course_id, $editParams) ?>" + action="<?= $controller->link_for('course/block_appointments/save/' . $course_id) ?>" method="post"> <? if ($confirm_many): ?> @@ -27,24 +27,24 @@ <label for="block_appointments_start_day" class="col-3"> <?= _('Startdatum') ?> <input type="text" class="size-s has-date-picker" data-date-picker id="block_appointments_start_day" - name="block_appointments_start_day" value="<?= $request['block_appointments_start_day'] ?>"> + name="block_appointments_start_day" value="<?= $request['block_appointments_start_day'] ?? '' ?>"> </label> <label for="block_appointments_end_day" class="col-3"> <?= _('Enddatum') ?> <input type="text" class="size-s has-date-picker" data-date-picker='{">=":"#block_appointments_start_day"}' id="block_appointments_end_day" - name="block_appointments_end_day" value="<?= $request['block_appointments_end_day'] ?>"> + name="block_appointments_end_day" value="<?= $request['block_appointments_end_day'] ?? '' ?>"> </label> <label for="block_appointments_start_time" class="col-3"> <?= _('Startzeit') ?> <input type="text" class="size-s studip-timepicker" id="block_appointments_start_time" - name="block_appointments_start_time" value="<?= $request['block_appointments_start_time'] ?>" + name="block_appointments_start_time" value="<?= $request['block_appointments_start_time'] ?? '' ?>" placeholder="HH:mm"> </label> <label for="block_appointments_end_time" class="col-3"> <?= _('Endzeit') ?> <input type="text" class="size-s studip-timepicker" id="block_appointments_end_time" - name="block_appointments_end_time" value="<?= $request['block_appointments_end_time'] ?>" + name="block_appointments_end_time" value="<?= $request['block_appointments_end_time'] ?? '' ?>" placeholder="HH:mm"> </label> @@ -58,7 +58,7 @@ </label> <label for="block_appointments_days_1" class="col-2"> - <input <?= in_array('weekdays', (array) $request['block_appointments_days']) ? 'checked ' : '' ?> + <input <?= in_array('weekdays', (array) ($request['block_appointments_days'] ?? [])) ? 'checked ' : '' ?> class="block_appointments_days" name="block_appointments_days[]" id="block_appointments_days_1" type="checkbox" value="weekdays"> <?= _('Mo-Fr') ?> @@ -66,7 +66,7 @@ <? foreach (range(0, 6) as $d) : ?> <? $id = 2 + $d ?> <label for="block_appointments_days_<?= $id ?>" class="col-2"> - <input <?= in_array($d+1, (array) $request['block_appointments_days']) ? 'checked ' : '' ?> + <input <?= in_array($d + 1, (array) ($request['block_appointments_days'] ?? [])) ? 'checked ' : '' ?> class="block_appointments_days" name="block_appointments_days[]" id="block_appointments_days_<?= $id ?>" type="checkbox" value="<?= $d + 1 ?>"> @@ -84,7 +84,7 @@ <select clas="size-l" name="block_appointments_termin_typ" id="block_appointments_termin_typ"> <? foreach ($GLOBALS['TERMIN_TYP'] as $key => $value) : ?> <option - value="<?= $key ?>" <?= $request['block_appointments_termin_typ'] == $key ? 'selected' : '' ?>> + value="<?= $key ?>" <?= ($request['block_appointments_termin_typ'] ?? '') == $key ? 'selected' : '' ?>> <?= htmlReady($value['name']) ?> </option> <? endforeach ?> @@ -115,7 +115,7 @@ <label for="block_appointments_room_text"> <?= _('Freie Ortsangabe') ?> <input type="text" name="block_appointments_room_text" id="block_appointments_room_text" - value="<?= $request['block_appointments_room_text'] ?>"> + value="<?= htmlReady($request['block_appointments_room_text'] ?? '') ?>"> </label> <? if (count($lecturers)): ?> @@ -141,7 +141,7 @@ <label for="block_appointments_date_count"> <?= _('Anzahl der Termine') ?> - <input type="text" name="block_appointments_date_count" id="block_appointments_date_count" class="size-s" value="<?= $request['block_appointments_date_count'] ?: 1 ?>"> + <input type="text" name="block_appointments_date_count" id="block_appointments_date_count" class="size-s" value="<?= $request['block_appointments_date_count'] ?? 1 ?>"> </label> </fieldset> diff --git a/app/views/course/lvgselector/index.php b/app/views/course/lvgselector/index.php index a16b425f8bde8681c66396054c2eac1b23b5725e..ca9b46f14735c67f4828aeef49b7b796858c5ddb 100644 --- a/app/views/course/lvgselector/index.php +++ b/app/views/course/lvgselector/index.php @@ -1,5 +1,5 @@ <? if (!$locked) : ?> - <form action="<?= $controller->url_for('course/lvgselector/index/' . $course_id, $url_params) ?>" method="post"> + <form action="<?= $controller->link_for('course/lvgselector/index/' . $course_id, $url_params ?? []) ?>" method="post"> <? endif ?> <h1><?= _('Lehrveranstaltungsgruppen') ?></h1> <div id="assigned" data-ajax-url="<?= $ajax_url ?>" data-forward-url="<?= $no_js_url ?>"> @@ -26,20 +26,19 @@ <? if (!$locked) : ?> <div id="lvgroup-tree-open-nodes"> <? foreach ($open_lvg_nodes as $opennode): ?> - <input type="hidden" name="open_lvg_nodes[]" value="<?= $opennode; ?>"> + <input type="hidden" name="open_lvg_nodes[]" value="<?= htmlReady($opennode) ?>"> <? endforeach; ?> </div> <div id="studyareas" data-ajax-url="<?= $ajax_url ?>" data-forward-url="<?= $no_js_url ?>" data-no-search-result="<?=_('Es wurde kein Suchergebnis gefunden.') ?>"> <h2><?= _('Lehrveranstaltungsgruppen Suche') ?></h2> <div> - <input type="text" style="width: auto;" size="40" name="search" id="lvgroup-tree-search" - value="<?= $searchterm ?>"> + <input type="text" style="width: auto;" size="40" name="search" id="lvgroup-tree-search"> <span id="lvgroup-tree-search-start"> - <?= Icon::create('search', 'clickable')->asInput(["name" => 'start_search', "onclick" => "return STUDIP.MVV.CourseWizard.searchTree()", "class" => $search_result?'hidden-no-js':'']) ?> - </span> - <span id="lvgroup-tree-search-reset" class="hidden-js"> - <?= Icon::create('refresh', 'clickable')->asInput(["name" => 'reset_search', "onclick" => "return STUDIP.MVV.CourseWizard.resetSearch()", "class" => $search_result?'':' hidden-no-js']) ?> + <?= Icon::create('search')->asInput([ + 'name' => 'start_search', + 'onclick' => 'return STUDIP.MVV.CourseWizard.searchTree()', + ]) ?> </span> </div> @@ -61,11 +60,11 @@ <? foreach ((array) $tree as $node) : ?> <? $children = $node->getChildren(); ?> <? if (count($children) || $node->isAssignable()) : ?> - <?= $this->render_partial('course/wizard/steps/lvgroups/_node', - ['node' => $node, 'pos_id' => $pos_id++, - 'open_nodes' => $open_lvg_nodes ?: [], - 'search_result' => $search_result ?: [], - 'children' => $children]) ?> + <?= $this->render_partial('course/wizard/steps/lvgroups/_node', [ + 'node' => $node, 'pos_id' => $pos_id++, + 'open_nodes' => $open_lvg_nodes ?? [], + 'children' => $children, + ]) ?> <? endif; ?> <? endforeach; ?> </ul> @@ -75,9 +74,6 @@ <? if ($open_lvg_nodes) : ?> <input type="hidden" name="open_nodes" value="<?= json_encode($open_lvg_nodes) ?>"> <? endif ?> - <? if ($searchterm) : ?> - <input type="hidden" name="searchterm" value="<?= $searchterm ?>"> - <? endif ?> <script> //<!-- $(function() { diff --git a/app/views/course/room_requests/request_select_properties.php b/app/views/course/room_requests/request_select_properties.php index 4bec03edf4e9f0a2e40fa59767c6c5b464f6c4e1..de45b117bc0623f05dabb48216d8b7ac95900bbe 100644 --- a/app/views/course/room_requests/request_select_properties.php +++ b/app/views/course/room_requests/request_select_properties.php @@ -1,4 +1,4 @@ -<? if (!$embedded) : ?> +<? if (empty($embedded)) : ?> <?= $this->render_partial( 'course/room_requests/_request_form_header', [ @@ -19,7 +19,7 @@ <? if ($available_properties) : ?> <? foreach ($available_properties as $property) : ?> <?= $property->toHtmlInput( - $selected_properties[$property->name], + $selected_properties[$property->name] ?? '', 'selected_properties[' . htmlReady($property->name) . ']', true, false @@ -50,14 +50,16 @@ placeholder="<?= _('Weitere Wünsche oder Bemerkungen zur angefragten Raumbelegung') ?>"><?= htmlReady($comment) ?></textarea> </label> -<? if (!$embedded) : ?> +<? if (empty($embedded)) : ?> </div> </section> <?= $this->render_partial( 'course/room_requests/_request_form_footer', [ - 'room_search_button' => true, - 'save_buttons' => true + 'room_search_button' => true, + 'save_buttons' => true, + 'room_select_button' => false, + 'select_properties_button' => false ] ) ?> <? endif ?> diff --git a/app/views/course/room_requests/request_select_room.php b/app/views/course/room_requests/request_select_room.php index 37e28c3606d9820605ee678f947bfd9e18f7a08c..46df75c3c8f09b27b873411af7566bcecfd3d08b 100644 --- a/app/views/course/room_requests/request_select_room.php +++ b/app/views/course/room_requests/request_select_room.php @@ -1,4 +1,4 @@ -<? if (!$embedded) : ?> +<? if (empty($embedded)) : ?> <?= $this->render_partial( 'course/room_requests/_request_form_header', [ @@ -53,7 +53,7 @@ <? endif ?> </div> </section> -<? if (!$embedded) : ?> +<? if (empty($embedded)) : ?> <?= $this->render_partial( 'course/room_requests/_request_form_footer', [ diff --git a/app/views/course/timesrooms/_cancel_form.php b/app/views/course/timesrooms/_cancel_form.php index 35e077b171f3975f9aa0b64f2d7dd5c58e42c1ed..8a2b7067424c5ead3dcfc7aadaf80589dfa2d7ce 100644 --- a/app/views/course/timesrooms/_cancel_form.php +++ b/app/views/course/timesrooms/_cancel_form.php @@ -1,19 +1,19 @@ -<?php -// In den Controller -$content = ''; -if ($termin instanceof CourseExDate && isset($termin->content)) { - $content = $termin->content; -} -?> -<p> - <strong> <?= _('Wenn Sie die nicht stattfindenden Termine mit einem Kommentar versehen, werden die Ausfalltermine im Ablaufplan weiterhin dargestellt und auch im Terminkalender eingeblendet.') ?></strong> -</p> - -<label for="cancel_comment"> - <?= _('Kommentar') ?> - <textarea rows="5" id="cancel_comment" name="cancel_comment"><?= htmlReady($content) ?></textarea> -</label> -<label for="cancel_send_message" class="inline"> - <input type="checkbox" id="cancel_send_message" name="cancel_send_message" value="1"> - <?= _('Benachrichtigung über ausfallende Termine an alle Teilnehmenden verschicken') ?> -</label> +<?php +// In den Controller +$content = ''; +if (isset($termin) && $termin instanceof CourseExDate) { + $content = $termin->content; +} +?> +<p> + <strong> <?= _('Wenn Sie die nicht stattfindenden Termine mit einem Kommentar versehen, werden die Ausfalltermine im Ablaufplan weiterhin dargestellt und auch im Terminkalender eingeblendet.') ?></strong> +</p> + +<label for="cancel_comment"> + <?= _('Kommentar') ?> + <textarea rows="5" id="cancel_comment" name="cancel_comment"><?= htmlReady($content) ?></textarea> +</label> +<label for="cancel_send_message" class="inline"> + <input type="checkbox" id="cancel_send_message" name="cancel_send_message" value="1"> + <?= _('Benachrichtigung über ausfallende Termine an alle Teilnehmenden verschicken') ?> +</label> diff --git a/app/views/course/timesrooms/_regularEvents.php b/app/views/course/timesrooms/_regularEvents.php index 075c4bf5c1f233b0bb9b522b6bdb8d70d6372d4c..f2b1829b396f9a07da37831b9e6be4ecea34c33c 100644 --- a/app/views/course/timesrooms/_regularEvents.php +++ b/app/views/course/timesrooms/_regularEvents.php @@ -38,7 +38,7 @@ </h1> <section> <span> - <? if ($cycle_room_names[$cycle['cycle']->id]): ?> + <? if (isset($cycle_room_names[$cycle['cycle']->id])): ?> <strong><?= _('Raum') ?>:</strong> <?= htmlReady($cycle_room_names[$cycle['cycle']->id])?> <? elseif (Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) : ?> diff --git a/app/views/course/timesrooms/editDate.php b/app/views/course/timesrooms/editDate.php index cff54b5a1c7c1bc0e2e40be56f62c0caa3f62301..fa9635f585e472b5361a58426e451edbc9547dc6 100644 --- a/app/views/course/timesrooms/editDate.php +++ b/app/views/course/timesrooms/editDate.php @@ -1,4 +1,4 @@ -<form action="<?= $controller->url_for('course/timesrooms/saveDate/' . $date->termin_id) ?>" +<form action="<?= $controller->link_for('course/timesrooms/saveDate/' . $date->termin_id) ?>" method="post" class="default collapsable" <?= Request::int('fromDialog') ? 'data-dialog="size=big"' : '' ?>> <?= CSRFProtection::tokenTag() ?> <fieldset style="margin-top: 1ex"> @@ -36,7 +36,7 @@ && ($selectable_rooms || $room_search)): ?> <label> <input style="display: inline;" type="radio" name="room" value="room" - id="room" <?= $date->room_booking->resource_id ? 'checked' : '' ?> + id="room" <? if ($date->room_booking) echo 'checked'; ?> data-activates="input.preparation-time[name='preparation_time']"> <?= _('Raum direkt buchen') ?> <span class="flex-row"> @@ -45,7 +45,7 @@ ->setAttributes(['onFocus' => "jQuery('input[type=radio][name=room][value=room]').prop('checked', 'checked')"]) ->render() ?> <? else: ?> - <? $selected_room_id = $date->room_booking->resource_id ?> + <? $selected_room_id = $date->room_booking->resource_id ?? ''; ?> <select name="room_id" onFocus="jQuery('input[type=radio][name=room][value=room]').prop('checked', 'checked')"> <? foreach ($selectable_rooms as $room): ?> <option value="<?= htmlReady($room->id) ?>" diff --git a/app/views/course/wizard/steps/lvgroups/index.php b/app/views/course/wizard/steps/lvgroups/index.php index a23bbe952cc9ab0b0189b89f7f4d26b338076a14..744cc94a0a5637fafafe68fce4ab98b3645e3a7a 100644 --- a/app/views/course/wizard/steps/lvgroups/index.php +++ b/app/views/course/wizard/steps/lvgroups/index.php @@ -11,7 +11,7 @@ <li class="lvgroup-tree-assigned-root keep-node" data-id="root"> <ul id="lvgroup-tree-assigned-selected"> <? foreach ($selection->getAreas() as $area) : ?> - <?= $this->render_partial('lvgroups/lvgroup_entry', compact('area')) ?> + <?= $this->render_partial('lvgroups/lvgroup_entry', ['area' => $area, 'locked' => false, 'course_id' => '']) ?> <? endforeach; ?> </ul> </li> diff --git a/app/views/course/wizard/steps/studyareas/index.php b/app/views/course/wizard/steps/studyareas/index.php index 18c46a6533b33d0901133fbe3a501f1f360c4f70..17220968cd3abf9b9503d242a0b524cd0876aef3 100644 --- a/app/views/course/wizard/steps/studyareas/index.php +++ b/app/views/course/wizard/steps/studyareas/index.php @@ -13,7 +13,7 @@ <?= htmlReady(Config::get()->UNI_NAME_CLEAN) ?> <ul> <?php foreach ($assigned as $element) : ?> - <?= $element->name ?> + <?= htmlReady($element['name']) ?> <?= $this->render_partial('studyareas/_assigned_node', ['element' => $element, 'studyareas' => $values['studyareas']]) ?> <?php endforeach ?> @@ -31,13 +31,12 @@ data-forward-url="<?= $no_js_url ?>" data-no-search-result="<?=_('Es wurde kein Suchergebnis gefunden.') ?>"> <h2><?= _('Alle Studienbereiche') ?></h2> <div> - <input style="width:auto" type="text" size="40" name="search" id="sem-tree-search" - value="<?= $values['searchterm'] ?>"/> + <input style="width:auto" type="text" size="40" name="search" id="sem-tree-search"> <span id="sem-tree-search-start"> - <?= Icon::create('search', 'clickable')->asInput(["name" => 'start_search', "onclick" => "return STUDIP.CourseWizard.searchTree()", "class" => $search_result?'hidden-no-js':'']) ?> - </span> - <span id="sem-tree-search-reset" class="hidden-js"> - <?= Icon::create('refresh', 'clickable')->asInput(["name" => 'reset_search', "onclick" => "return STUDIP.CourseWizard.resetSearch()", "class" => $search_result?'':' hidden-no-js']) ?> + <?= Icon::create('search')->asInput([ + 'name' => 'start_search', + 'onclick' => 'return STUDIP.CourseWizard.searchTree()', + ]) ?> </span> </div> <div id="sem-tree-assign-all" class="hidden-js hidden-no-js"> @@ -54,22 +53,21 @@ </label> <ul> <?php foreach ($tree as $node) : ?> - <?= $this->render_partial('studyareas/_node', - ['node' => $node, 'stepnumber' => $stepnumber, - 'temp_id' => $temp_id, 'values' => $values, - 'open_nodes' => $open_nodes ?: [], - 'search_result' => $search_result ?: []]) ?> + <?= $this->render_partial('studyareas/_node',[ + 'node' => $node, + 'stepnumber' => $stepnumber, + 'temp_id' => $temp_id, + 'values' => $values, + 'open_nodes' => $open_nodes ?? [], + ]) ?> <?php endforeach ?> </ul> </li> </ul> </div> - <?php if ($values['open_node']) : ?> + <?php if (!empty($values['open_node'])) : ?> <input type="hidden" name="open_node" value="<?= $values['open_node'] ?>"/> <?php endif ?> - <?php if ($values['searchterm']) : ?> - <input type="hidden" name="searchterm" value="<?= $values['searchterm'] ?>"/> - <?php endif ?> <script> //<!-- $(function() { diff --git a/app/views/questionnaire/evaluate.php b/app/views/questionnaire/evaluate.php index 5ac29a5969308a60917b4d3ef70eb7c224eb6e11..f33162fcc31cb39dd0f9dc5bd4e015d98ec4acb9 100644 --- a/app/views/questionnaire/evaluate.php +++ b/app/views/questionnaire/evaluate.php @@ -4,7 +4,7 @@ <? foreach ($questionnaire->questions as $question) : ?> <article class="question_<?= $question->getId() ?>"> <? $template = $question->getResultTemplate() ?> - <?= $template ? $template->render(['anonAnswers' => $anonAnswers]) : _("Ergebnisse konnten nicht ausgewertet werden.") ?> + <?= $template ? $template->render(['anonAnswers' => $anonAnswers ?? '']) : _("Ergebnisse konnten nicht ausgewertet werden.") ?> </article> <? endforeach ?> <? else : ?> diff --git a/app/views/questionnaire/question_types/freetext/freetext_answer.php b/app/views/questionnaire/question_types/freetext/freetext_answer.php index 3011012156ceca2020531303fb5d7287c0f6414a..0b2643d72dc78762676bf69166afb3c74148f993 100644 --- a/app/views/questionnaire/question_types/freetext/freetext_answer.php +++ b/app/views/questionnaire/question_types/freetext/freetext_answer.php @@ -15,5 +15,5 @@ </div> <textarea name="answers[<?= $vote->getId() ?>][answerdata][text]" <?= isset($etask->options['mandatory']) && $etask->options['mandatory'] ? "required" : "" ?> - ><?= htmlReady($answerdata['text']) ?></textarea> + ><?= htmlReady($answerdata['text'] ?? '') ?></textarea> </label> diff --git a/app/views/questionnaire/question_types/test/_answer.php b/app/views/questionnaire/question_types/test/_answer.php index 868b32e920d9102961dc4e616ace15b899972b7e..15f6ba7bcfe73ca6c6ba5db16d301a68dfb66829 100644 --- a/app/views/questionnaire/question_types/test/_answer.php +++ b/app/views/questionnaire/question_types/test/_answer.php @@ -5,11 +5,11 @@ name="questions[<?= $vote->getId() ?>][task][correct][]" value="<?= $index + 1 ?>" title="<?= _('Ist diese Antwort korrekt?') ?>" - <?= $forcecorrect || $answer['score'] > 0 ? 'checked' : '' ?>> + <?= !empty($forcecorrect) || (!empty($answer['score']) && ($answer['score'] > 0)) ? 'checked' : '' ?>> <input type="text" name="questions[<?= $vote->getId() ?>][task][answers][]" - value="<?= htmlReady($answer['text']) ?>" + value="<?= htmlReady($answer['text'] ?? '') ?>" placeholder="<?= _('Antwort ...') ?>" aria-label="<?= _('Geben Sie eine Antwortmöglichkeit zu der von Ihnen gestellten Frage ein.') ?>"> diff --git a/app/views/questionnaire/question_types/test/test_edit.php b/app/views/questionnaire/question_types/test/test_edit.php index fd558fe1a649880441d059fbcaaf82a1d6da0582..644e4f40b3d9ac782c95ac03250ed2d7f717fc82 100644 --- a/app/views/questionnaire/question_types/test/test_edit.php +++ b/app/views/questionnaire/question_types/test/test_edit.php @@ -20,7 +20,7 @@ 'vote' => $vote, 'answer' => [], 'index' => $index + 1, - 'forcecorrect' => !isset($etask->task['answers']) || empty($etask->task['answers']) + 'forcecorrect' => empty($etask->task['answers']) ] ); ?> </ol> diff --git a/app/views/questionnaire/question_types/vote/_answer.php b/app/views/questionnaire/question_types/vote/_answer.php index 2b2271fbcabc37f8cb775051e194446e74c8758d..95c26edc8af410cb94fe4037a6e2b1da8db61d6c 100644 --- a/app/views/questionnaire/question_types/vote/_answer.php +++ b/app/views/questionnaire/question_types/vote/_answer.php @@ -2,7 +2,7 @@ <?= Assets::img('anfasser_24.png', [ 'title' => _('Antwort verschieben'), 'class' => 'move' ]) ?> <input type="text" name="questions[<?= $vote->getId() ?>][task][answers][]" - value="<?= htmlReady($answer['text']) ?>" + value="<?= htmlReady($answer['text'] ?? '') ?>" placeholder="<?= _('Antwort ...') ?>" aria-label="<?= _('Geben Sie eine Antwortmöglichkeit zu der von Ihnen gestellten Frage ein.') ?>"> <?= Icon::create('trash', ['title' => _('Antwort löschen')])->asImg(20, ['class' => 'text-bottom delete']) ?> diff --git a/lib/admissionrules/participantrestrictedadmission/templates/configure.php b/lib/admissionrules/participantrestrictedadmission/templates/configure.php index d29a2bd32df7200b2cb5b940e5227e1f385ea9f7..3c02c6c65da33867a4a630db39a7083fc1b463bb 100644 --- a/lib/admissionrules/participantrestrictedadmission/templates/configure.php +++ b/lib/admissionrules/participantrestrictedadmission/templates/configure.php @@ -19,9 +19,9 @@ <? if ($rule->isFCFSallowed()) : ?> <label for="enable_FCFS"> - <input <?=($rule->prio_exists ? 'disabled' : '')?> type="checkbox" id="enable_FCFS" name="enable_FCFS" value="1" <?= (!is_null($rule->getDistributionTime()) && !$rule->getDistributionTime() ? "checked" : ""); ?>> + <input <?= !empty($rule->prio_exists ? 'disabled' : '') ?> type="checkbox" id="enable_FCFS" name="enable_FCFS" value="1" <?= (!is_null($rule->getDistributionTime()) && !$rule->getDistributionTime() ? "checked" : ""); ?>> <?=_("<u>Keine</u> automatische Platzverteilung (Windhund-Verfahren)")?> - <?=($rule->prio_exists ? tooltipicon(_("Es existieren bereits Anmeldungen für die automatische Platzverteilung.")) : '')?> + <?= !empty($rule->prio_exists) ? tooltipicon(_("Es existieren bereits Anmeldungen für die automatische Platzverteilung.")) : '' ?> </label> <? endif ?> <script> diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 38b5ba65d735b2ba3e563fb0ed9f04d03bdd807b..7a46da7b7cdcc15a812cc353ccbaebd38f7cd100 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -178,6 +178,7 @@ if (isset($_SERVER['REQUEST_METHOD'])) { // Prime autoloader if cache is enabled (this cannot be in autoloader's // bootstrap because the stud.ip cache needs to have a db conenction) if ($GLOBALS['CACHING_ENABLE']) { + $lookup_hash = null; $cached = StudipCacheFactory::getCache()->read('STUDIP#autoloader-classes'); if ($cached) { $class_lookup = json_decode($cached, true); diff --git a/lib/calendar_functions.inc.php b/lib/calendar_functions.inc.php index 7448e31049a6d372cc5cb2c42ee987f7c61afc8e..deec85a19eca6622520c792290a6ce5bc05473ac 100644 --- a/lib/calendar_functions.inc.php +++ b/lib/calendar_functions.inc.php @@ -57,6 +57,7 @@ function holiday ($tmstamp, $mod = "") { else $easterday = date("z", mktime(0, 0, 0, 4, $q - 31, $year)) + 1; + $name = ''; // Differenz in Tagen zu Ostertag berechnen $doy = date("z", $tmstamp) + 1; $dif = $doy - $easterday; diff --git a/lib/classes/Assets.class.php b/lib/classes/Assets.class.php index dd82073cac7cdac1a5250156bf8d85f59db37de7..b5adfcfc4862ea7182ec132b4abedecf59264335 100644 --- a/lib/classes/Assets.class.php +++ b/lib/classes/Assets.class.php @@ -143,8 +143,6 @@ class Assets return ''; } - $parts = explode('/', $source); - $size = $opt['size'] ?? null; $opt = Assets::parse_attributes($opt); @@ -156,7 +154,10 @@ class Assets } if (isset($size) && !isset($opt['width'])) { - list($opt['width'], $opt['height']) = explode('@', $size, 2); + $size = explode('@', $size, 2); + $opt['width'] = $size[0]; + $opt['height'] = $size[1] ?? null; + unset($opt['size']); } @@ -195,7 +196,7 @@ class Assets $opt['type'] = 'image'; if (isset($size) && !isset($opt['width'])) { - list($opt['width'], $opt['height']) = explode('@', $size, 2); + [$opt['width'], $opt['height']] = explode('@', $size, 2); unset($opt['size']); } @@ -360,8 +361,10 @@ class Assets */ private static function tag($name, $options = [], $open = FALSE) { - if (!$name) + if (!$name) { return ''; + } + ksort($options); return '<' . $name . ' ' . arrayToHtmlAttributes($options) . ($open ? '>' : '>'); } @@ -413,4 +416,3 @@ class Assets return $attributes; } } - diff --git a/lib/classes/DataFieldEntry.class.php b/lib/classes/DataFieldEntry.class.php index 6acd2739ae809a92e6819e8c9b414e414bf13769..172b5e4ebda7d60cf33d0f504421c196bc6a6f7f 100644 --- a/lib/classes/DataFieldEntry.class.php +++ b/lib/classes/DataFieldEntry.class.php @@ -101,9 +101,10 @@ abstract class DataFieldEntry if (!$range_id) { return []; // we necessarily need a range ID } - $clause1 = ''; $parameters = []; $clause1 = ''; + $clause2 = ''; + $clause3 = ''; if(is_array($range_id)) { // rangeID may be an array ("classic" rangeID and second rangeID used for user roles) $secRangeID = $range_id[1]; diff --git a/lib/classes/DbSnapshot.class.php b/lib/classes/DbSnapshot.class.php index 4d07541f585767c9f3108bcab43d75b2b99d69ae..8735fa03e19a7f0d69876d255654c3d2b4a48d57 100644 --- a/lib/classes/DbSnapshot.class.php +++ b/lib/classes/DbSnapshot.class.php @@ -331,7 +331,7 @@ class DbSnapshot } elseif ($m_snap->numRows) { $result = $this->getDistinctRows($key_field); for ($i = 0; $i < $m_snap->numRows; ++$i) { - if (!$result[$m_snap->result[$i][$key_field]]) { + if (empty($result[$m_snap->result[$i][$key_field]])) { $this->result[] = $m_snap->result[$i]; } } diff --git a/lib/classes/DbView.class.php b/lib/classes/DbView.class.php index bcd7d0f8eb92924d1f57a3ff703368d980548892..81e9b9112d139afabf65367eb2ad47ce93c93a16 100644 --- a/lib/classes/DbView.class.php +++ b/lib/classes/DbView.class.php @@ -305,10 +305,12 @@ class DbView public function get_view($name) { - if (self::$dbviews[$name]["pk"]) + if (!empty(self::$dbviews[$name]["pk"])) { $this->pk = self::$dbviews[$name]["pk"]; - if (self::$dbviews[$name]["temp_table_type"]) + } + if (!empty(self::$dbviews[$name]["temp_table_type"])) { $this->temp_table_type = self::$dbviews[$name]["temp_table_type"]; + } if (!$query_list = self::$dbviews[$name]["query"]) $this->halt("View not found: $name"); (is_array($query_list)) ? $query = $query_list[0] : $query = $query_list; diff --git a/lib/classes/I18N.php b/lib/classes/I18N.php index 5ba2c88954290abd672be6ac31edf0f7e02bbc10..e6f7c0075df1347057e54b7f8408d95a83666b60 100644 --- a/lib/classes/I18N.php +++ b/lib/classes/I18N.php @@ -125,7 +125,7 @@ class I18N return $template->render([ 'languages' => $GLOBALS['CONTENT_LANGUAGES'], 'base_lang' => key($GLOBALS['CONTENT_LANGUAGES']), - 'wysiwyg' => in_array('wysiwyg', words($attributes['class'])), + 'wysiwyg' => in_array('wysiwyg', words($attributes['class'] ?? '')), 'name' => $this->name, 'value' => $this->value, 'attributes' => $attributes, diff --git a/lib/classes/QuickSearch.class.php b/lib/classes/QuickSearch.class.php index b058c53a2d0a3086e8982ddb7c425caf2868f557..6b239de1b02b3db88a2f644b0f6c3486847fcb7e 100644 --- a/lib/classes/QuickSearch.class.php +++ b/lib/classes/QuickSearch.class.php @@ -95,6 +95,7 @@ class QuickSearch private $inputStyle = null; private $specialQuery = null; + /** * Deletes all older requests that have not been used for three hours * from the session @@ -333,7 +334,7 @@ class QuickSearch */ public function hasExtendedLayout() { - return $this->search->extendedLayout; + return !empty($this->search->extendedLayout); } /** @@ -359,39 +360,23 @@ class QuickSearch $template->set_attribute('withAttributes', $this->withAttributes); $template->set_attribute('searchresults', $searchresults); $template->set_attribute('name', $this->name); - $template->set_attribute('inputClass', $this->inputClass); $template->set_attribute('search_button_name', $this->search_button_name); $template->set_attribute('reset_button_name', $this->reset_button_name); $template->set_attribute('extendedLayout', $this->hasExtendedLayout()); return $template->render(); } else { - //Abfrage in der Session speichern: - $query_id = md5(serialize($this->search)); - if ($this->specialQuery) { - $_SESSION['QuickSearches'][$query_id]['query'] = $this->specialQuery; - } elseif ($this->search instanceof SearchType) { - $_SESSION['QuickSearches'][$query_id]['object'] = serialize($this->search); - if ($this->search instanceof SearchType) { - $_SESSION['QuickSearches'][$query_id]['includePath'] = $this->search->includePath(); - } - $_SESSION['QuickSearches'][$query_id]['time'] = time(); - } else { - $_SESSION['QuickSearches'][$query_id]['query'] = $this->search; - } - $_SESSION['QuickSearches'][$query_id]['time'] = time(); - //var_dump($_SESSION['QuickSearches'][$query_id]); + $query_id = $this->storeSearchInSession(); + //Ausgabe: $template = $GLOBALS['template_factory']->open('quicksearch/inputfield.php'); $template->set_attribute('withButton', $this->withButton); $template->set_attribute('box_align', $this->box_align); $template->set_attribute('box_width', $this->box_width); - $template->set_attribute('inputStyle', $this->inputStyle ? $this->inputStyle : ""); $template->set_attribute('beschriftung', $this->beschriftung()); $template->set_attribute('name', $this->name); $template->set_attribute('defaultID', $this->defaultID); $template->set_attribute('defaultName', $this->defaultName); - $template->set_attribute('inputClass', $this->inputClass); $template->set_attribute('withAttributes', $this->withAttributes ? $this->withAttributes : []); $template->set_attribute('jsfunction', $this->jsfunction); $template->set_attribute('autocomplete_disabled', Config::get()->getValue("AJAX_AUTOCOMPLETE_DISABLED") || $this->autocomplete_disabled); @@ -466,4 +451,36 @@ class QuickSearch return ""; } } + + /** + * Abfrage in der Session speichern + * + * @return string + */ + protected function storeSearchInSession(): string + { + $query_id = md5(serialize($this->search)); + + // Prepare object + $item = [ + 'time' => time(), + ]; + + if ($this->search instanceof SearchType) { + $item['object'] = serialize($this->search); + if ($this->search instanceof SearchType) { + $item['includePath'] = $this->search->includePath(); + } + } else { + $item['query'] = $this->search; + } + + // Actually storing in session + if (!isset($_SESSION['QuickSearches'])) { + $_SESSION['QuickSearches'] = []; + } + $_SESSION['QuickSearches'][$query_id] = $item; + + return $query_id; + } } diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 86546ceac075387d2184355b82723c4f41dcea42..0e839e88fee9f4c117dd90f77ff9911991c66377 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -366,6 +366,9 @@ class Seminar ]; if ($val->getResourceID()) { + if (!isset($rooms[$val->getResourceID()])) { + $rooms[$val->getResourceID()] = 0; + } $rooms[$val->getResourceID()]++; } @@ -1755,7 +1758,7 @@ class Seminar $template = $GLOBALS['template_factory']->open($template); } - if ($params['semester_id']) { + if (!empty($params['semester_id'])) { $semester = Semester::find($params['semester_id']); if ($semester) { // apply filter diff --git a/lib/classes/StudipSemSearchHelper.class.php b/lib/classes/StudipSemSearchHelper.class.php index c26742dc4479927ac132258746223df9342b39cc..3875bc2e309d21ab6416fe815893874ffa7555e7 100644 --- a/lib/classes/StudipSemSearchHelper.class.php +++ b/lib/classes/StudipSemSearchHelper.class.php @@ -73,8 +73,11 @@ class StudipSemSearchHelper { $this->visible_only = $visible_only; } - public function doSearch(){ - if(!count($this->params)) return false; + public function doSearch() + { + if (count($this->params) === 0) { + return false; + } $this->params = array_map('addslashes', $this->params); $clause = ""; $and_clause = ""; @@ -83,26 +86,28 @@ class StudipSemSearchHelper { $view = DbView::getView('sem_tree'); - if (isset($this->params['sem']) && $this->params['sem'] != 'all'){ + if (isset($this->params['sem']) && $this->params['sem'] !== 'all'){ $sem_number = (int)$this->params['sem']; $clause = " HAVING (sem_number <= $sem_number AND (sem_number_end >= $sem_number OR sem_number_end = -1)) "; } - if (isset($this->params['category']) && $this->params['category'] != 'all'){ - foreach($GLOBALS['SEM_TYPE'] as $type_key => $type_value){ - if($type_value['class'] == $this->params['category']) + $sem_types = []; + if (isset($this->params['category']) && $this->params['category'] !== 'all'){ + foreach ($GLOBALS['SEM_TYPE'] as $type_key => $type_value){ + if ($type_value['class'] == $this->params['category']) $sem_types[] = $type_key; } } if (isset($this->params['type']) && $this->params['type'] != 'all'){ - unset($sem_types); - $sem_types[0] = $this->params['type']; + $sem_types = [$this->params['type']]; } - if (is_array($sem_types)){ + if ($sem_types) { $clause = " AND c.status IN('" . join("','",$sem_types) . "') " . $clause; } + $view->params = []; + if ($this->params['scope_choose'] && $this->params['scope_choose'] != 'root'){ $sem_tree = TreeAbstract::GetInstance("StudipSemTree", false); $view->params[0] = (is_array($sem_types) ? $sem_types : $sem_tree->sem_status); @@ -171,7 +176,7 @@ class StudipSemSearchHelper { $toFilter = explode(" ", $this->params['title']); $search_for = "(Name LIKE '%" . implode("%' AND Name LIKE '%", $toFilter) . "%')"; - $view->params[0] .= ($this->params['title']) ? $search_for . " " : " "; + $view->params[0] = $this->params['title'] ? $search_for . " " : " "; $view->params[0] .= ($this->params['title'] && $this->params['sub_title']) ? $combination : " "; $view->params[0] .= ($this->params['sub_title']) ? " Untertitel LIKE '%" . $this->trim($this->params['sub_title']) . "%' " : " "; diff --git a/lib/classes/admission/CourseSet.class.php b/lib/classes/admission/CourseSet.class.php index 054c9506479bc5463dd5424946d1dd2368435af2..e3a7e9246cbe4064fcb3173c9e8c6ef4d7bff43a 100644 --- a/lib/classes/admission/CourseSet.class.php +++ b/lib/classes/admission/CourseSet.class.php @@ -381,19 +381,19 @@ class CourseSet $query .= " AND (c.`private`=0 OR c.`user_id`=?)"; $parameters[] = $GLOBALS['user']->id; } - if ($filter['course_set_name']) { + if (!empty($filter['course_set_name'])) { $query .= " AND c.name LIKE ?"; $parameters[] = $filter['course_set_name'] . '%'; } - if (is_array($filter['rule_types']) && count($filter['rule_types'])) { + if (!empty($filter['rule_types']) && is_array($filter['rule_types']) && count($filter['rule_types'])) { $query .= " AND cr.type IN (?)"; $parameters[] = $filter['rule_types']; } - if ($filter['semester_id']) { + if (!empty($filter['semester_id'])) { $query .= " AND s.start_time = ?"; $parameters[] = Semester::find($filter['semester_id'])->beginn; } - if ($filter['course_set_chdate']) { + if (!empty($filter['course_set_chdate'])) { $query .= " AND c.chdate < ?"; $parameters[] = $filter['chdate']; } @@ -420,19 +420,19 @@ class CourseSet $parameters = []; $query .= " AND (c.`private`=0 OR c.`user_id`=?)"; $parameters[] = $GLOBALS['user']->id; - if ($filter['course_set_name']) { + if (!empty($filter['course_set_name'])) { $query .= " AND c.name LIKE ?"; $parameters[] = $filter['course_set_name'] . '%'; } - if (is_array($filter['rule_types']) && count($filter['rule_types'])) { + if (!empty($filter['rule_types']) && is_array($filter['rule_types']) && count($filter['rule_types'])) { $query .= " AND cr.type IN (?)"; $parameters[] = $filter['rule_types']; } - if ($filter['semester_id']) { + if (!empty($filter['semester_id'])) { $query .= " AND s.start_time = ?"; $parameters[] = Semester::find($filter['semester_id'])->beginn; } - if ($filter['course_set_chdate']) { + if (!empty($filter['course_set_chdate'])) { $query .= " AND c.chdate < ?"; $parameters[] = $filter['chdate']; } @@ -1019,6 +1019,7 @@ class CourseSet public function toString($short=false) { $tpl = $GLOBALS['template_factory']->open('admission/courseset/info'); $tpl->set_attribute('courseset', $this); + $tpl->set_attribute('is_limited', false); $institutes = []; if (!$short) { $institutes = Institute::findAndMapMany(function($i) {return $i->name;}, array_keys($this->institutes), 'ORDER BY Name'); diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php index 0dbf0582b72eacfcbc4af297fc052067a494c88b..3a9ba545c6f86d48ce044d57124ad06db890d54d 100644 --- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php +++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php @@ -306,7 +306,7 @@ class LVGroupsWizardStep implements CourseWizardStep $area = Lvgruppe::find($mvvid[0]); $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); - $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_entry', compact('area')); + $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_entry', ['area' => $area, 'locked' => false, 'course_id' => '']); $data = [ 'id' => $area->id, diff --git a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php index 054f63852ab5caa9e8542b735343f6270d0b5510..c0edda89a230b51cc45baa0a32e4c49c26aede1b 100644 --- a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php +++ b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php @@ -57,7 +57,7 @@ class StudyAreasWizardStep implements CourseWizardStep * Someone works without JS activated, load all ancestors and * children of open node. */ - if ($values['open_node']) { + if (!empty($values['open_node'])) { $tpl->set_attribute('open_nodes', $this->buildPartialSemTree( StudipStudyArea::backwards( @@ -68,7 +68,7 @@ class StudyAreasWizardStep implements CourseWizardStep * Someone works without JS and has entered a search term: * build the partial tree with search results. */ - if ($values['searchterm']) { + if (!empty($values['searchterm'])) { $search = $this->searchSemTree($values['searchterm'], true); if ($search) { $tpl->set_attribute('open_nodes', $search); diff --git a/lib/classes/searchtypes/SeminarSearch.class.php b/lib/classes/searchtypes/SeminarSearch.class.php index d7fc6ed041873bcb610997e4e8d1083e666f5e06..e4902289314b95c11c5322302efa2a767612b421 100644 --- a/lib/classes/searchtypes/SeminarSearch.class.php +++ b/lib/classes/searchtypes/SeminarSearch.class.php @@ -48,11 +48,12 @@ class SeminarSearch extends SearchType $search_helper->setParams( [ 'quick_search' => $keyword, - 'qs_choose' => $contextual_data['search_sem_qs_choose'] ?: 'all', + 'qs_choose' => $contextual_data['search_sem_qs_choose'] ?? 'all', 'sem' => $contextual_data['search_sem_sem'] ?? 'all', - 'category' => $contextual_data['search_sem_category'], - 'scope_choose' => $contextual_data['search_sem_scope_choose'], - 'range_choose' => $contextual_data['search_sem_range_choose']], + 'category' => $contextual_data['search_sem_category'] ?? null, + 'scope_choose' => $contextual_data['search_sem_scope_choose'] ?? null, + 'range_choose' => $contextual_data['search_sem_range_choose'] ?? null, + ], !(is_object($GLOBALS['perm']) && $GLOBALS['perm']->have_perm( Config::Get()->SEM_VISIBILITY_PERM))); diff --git a/lib/export/export_choose_xslt.inc.php b/lib/export/export_choose_xslt.inc.php index cbf152ef1a24ca7a7fb13fbaa36c359392f52dd1..3bddbc336fb0e282de1fd49a3beb0426a1fa9845 100644 --- a/lib/export/export_choose_xslt.inc.php +++ b/lib/export/export_choose_xslt.inc.php @@ -61,7 +61,7 @@ function CheckParamXSLT() if ($page === 1) { reset($xslt_files); foreach ($xslt_files as $val) { - if ($val[$ex_type] && $val[$format]) { + if (!empty($val[$ex_type]) && !empty($val[$format])) { $mod_counter++; } } @@ -89,6 +89,7 @@ function CheckParamXSLT() } $export_pagename = _("Konvertierung der Daten: "); +$export_pagecontent = ''; $xslt_filename = mb_strlen(Request::get('xslt_filename')) ? basename(stripslashes(Request::get('xslt_filename'))) : $xslt_filename_default; if (!CheckParamXSLT()) { @@ -162,9 +163,9 @@ if ($format === "xml" && $page === 1) { $opt_num = 0; foreach ($xslt_files as $key => $val) { - if ($val[$ex_type] && $val[$format]) { + if (!empty($val[$ex_type]) && !empty($val[$format])) { $export_pagecontent .= "<label><input type=\"radio\" name=\"choose\" value=\"" . $key . "\""; - if ($key == $choose || !$choose && $opt_num == 0) { + if (empty($choose) && $opt_num == 0 || (!empty($choose) && $key == $choose)) { $export_pagecontent .= " checked"; } $export_pagecontent .= ">" . $val["name"]; diff --git a/lib/export/export_start.inc.php b/lib/export/export_start.inc.php index 14f8da3c1d7188df8cac363686c8feee8b454894..605d505ba987e9edc99bd50c9993b4d8509da4f4 100644 --- a/lib/export/export_start.inc.php +++ b/lib/export/export_start.inc.php @@ -44,7 +44,7 @@ $export_pagename = _("Datenexport - Startseite"); $export_info = null; -$export_pagecontent .= "<form class=\"default\" method=\"POST\" action=\"" . URLHelper::getURL() . "\">"; +$export_pagecontent = "<form class=\"default\" method=\"POST\" action=\"" . URLHelper::getLink() . "\">"; $export_pagecontent .= CSRFProtection::tokenTag(); $export_pagecontent .= "<fieldset><legend>"._("Bitte wählen Sie Datenart und Einrichtung.")."</legend>"; diff --git a/lib/export/export_studipdata_func.inc.php b/lib/export/export_studipdata_func.inc.php index b645e1e2f23c7417e59d83a3efd35025c50f6c72..1139f214ea86df513489905d932f601836abfb7d 100644 --- a/lib/export/export_studipdata_func.inc.php +++ b/lib/export/export_studipdata_func.inc.php @@ -130,10 +130,10 @@ function export_range($range_id) // Ist die Range-ID ein Range-Tree-Item? if ($range_id != 'root') { $tree_object = new RangeTreeObject($range_id); - $range_name = $tree_object->item_data["name"]; + $range_name = $tree_object->item_data["name"] ?? ''; // Tree-Item ist ein Institut: - if ($tree_object->item_data['studip_object'] == 'inst') { + if (!empty($tree_object->item_data['studip_object']) && $tree_object->item_data['studip_object'] === 'inst') { if (!$output_startet) { output_data(xml_header(), $o_mode); $output_startet = true; diff --git a/lib/export/export_xml.inc.php b/lib/export/export_xml.inc.php index bdc2e9c55e98d551625de250a443d9913df876f8..f679f7cc12544fdc2703b68d21b1d4df57ef3ea6 100644 --- a/lib/export/export_xml.inc.php +++ b/lib/export/export_xml.inc.php @@ -120,7 +120,7 @@ if ($o_mode === 'file' || $o_mode === 'choose') { if ($object_counter<1) { $xml_export_text = _("Es wurden keine Daten gefunden!"); $export_error = _("Es wurden keine Daten gefunden! Die übergebene ID ist mit keinen Veranstaltungs- / Personendaten verbunden."); - $export_pagecontent .= "<form class=\"default\"><footer>" + $export_pagecontent = "<form class=\"default\"><footer>" . LinkButton::create('<< ' . _('Zurück'), URLHelper::getURL("", ['range_id' => $range_id, 'ex_type' => $ex_type, 'ex_sem' => $ex_sem, 'o_mode' => 'start'])) . "</footer></form>"; $export_error_num ++; @@ -133,7 +133,7 @@ if ($o_mode === 'file' || $o_mode === 'choose') { $export_msg = sprintf(_("%s Objekte wurden verarbeitet.") . " ", $object_counter); } - $export_pagecontent .= "<form class=\"default\" method=\"POST\" action=\"" . URLHelper::getLink() . "\">"; + $export_pagecontent = "<form class=\"default\" method=\"POST\" action=\"" . URLHelper::getLink() . "\">"; $export_pagecontent .= CSRFProtection::tokenTag(); $export_pagecontent .= "<input type=\"hidden\" name=\"page\" value=\"2\">"; $export_pagecontent .= "<input type=\"hidden\" name=\"format\" value=\"" . htmlReady($format) . "\">"; diff --git a/lib/export/export_xml_func.inc.php b/lib/export/export_xml_func.inc.php index f294b67c91bff414cc9b67bd3e83cd7234ad7d5c..2021feb05d5c47d2e726ab5c5f3fa5563d87298f 100644 --- a/lib/export/export_xml_func.inc.php +++ b/lib/export/export_xml_func.inc.php @@ -72,15 +72,10 @@ global $SOFTWARE_VERSION, $ex_type, $ex_sem, $range_name, $range_id; * @param string value for optional attribute "key" * @return string xml open tag */ -function xml_open_tag($tag_name, $tag_key = "") +function xml_open_tag($tag_name, $tag_key = null) { - $xml_tag_string = ''; - - if ($tag_key) { - $xml_tag_string .= " key=\"" . xml_escape ($tag_key ) ."\"" ; - } - - $xml_tag_string = "<" . $tag_name . $xml_tag_string . ">\n"; + $xml_tag_string = rtrim(' ' . xml_attributes_to_string(compact('tag_key'))); + $xml_tag_string = "<{$tag_name}{$xml_tag_string}>\n"; return $xml_tag_string; } @@ -115,12 +110,8 @@ function xml_close_tag($tag_name) */ function xml_tag($tag_name, $tag_content, $tag_attributes = null) { - if (is_array($tag_attributes)){ - foreach($tag_attributes as $key => $value){ - $xml_tag_string .= " $key=\"".xml_escape($value)."\" "; - } - } - $xml_tag_string = "<" . $tag_name . $xml_tag_string . ">" + $xml_tag_string = xml_attributes_to_string($tag_attributes ?? []); + $xml_tag_string = "<{$tag_name}{$xml_tag_string}>" . xml_escape ( $tag_content ) . "</" . $tag_name . ">\n"; return $xml_tag_string; @@ -152,3 +143,20 @@ function xml_escape($string) $string = preg_replace('/[\x00-\x08\x0b\x0c\x0e-\x1f]/', '', $string); return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); } + +function xml_attributes_to_string(array $attributes): string +{ + $attributes = array_filter($attributes, function ($attribute) { + return $attribute !== null; + }); + + if (count($attributes) === 0) { + return ''; + } + + $result = ['']; // Empty item for a leading whitespace + foreach ($attributes as $key => $value) { + $result[] = sprintf('%s="%s"', $key, xml_escape($value)); + } + return implode(' ', $result); +} diff --git a/lib/models/AbschlussKategorie.php b/lib/models/AbschlussKategorie.php index 0f866c47b0ae625497b83ee04d20aa3729011d21..e60520197eabdd81fa30983711c993b2559b40ba 100644 --- a/lib/models/AbschlussKategorie.php +++ b/lib/models/AbschlussKategorie.php @@ -308,8 +308,8 @@ class AbschlussKategorie extends ModuleManagementModelTreeItem $_SESSION['MVV/StgteilVersion/trail_parent_id'] = $this->getId(); $trail_parent_id = $_SESSION['MVV/AbschlussKategorie/trail_parent_id']; - $start_sem = self::$object_filter['StgteilVersion']['start_semester']; - $end_sem = self::$object_filter['StgteilVersion']['end_semester']; + $start_sem = self::$object_filter['StgteilVersion']['start_semester'] ?? null; + $end_sem = self::$object_filter['StgteilVersion']['end_semester'] ?? null; return StgteilVersion::getEnrichedByQuery(" SELECT msv.* FROM mvv_abschl_zuord maz diff --git a/lib/models/CourseDate.class.php b/lib/models/CourseDate.class.php index 5d8c60dc41f48a107112836de3d692e3f29f2edf..5550f93be44b9c1cdb63b504f3d6a64d0c65a840 100644 --- a/lib/models/CourseDate.class.php +++ b/lib/models/CourseDate.class.php @@ -224,7 +224,7 @@ class CourseDate extends SimpleORMap implements PrivacyObject */ public function getRoomName() { - if (Config::get()->RESOURCES_ENABLE && $this->room_booking->resource_id) { + if (Config::get()->RESOURCES_ENABLE && $this->room_booking->resource) { return $this->room_booking->resource->name; } return $this['raum']; @@ -237,7 +237,7 @@ class CourseDate extends SimpleORMap implements PrivacyObject */ public function getRoom() { - if (Config::get()->RESOURCES_ENABLE && $this->room_booking->resource_id) { + if (Config::get()->RESOURCES_ENABLE && $this->room_booking->resource) { return $this->room_booking->resource->getDerivedClassInstance(); } return null; diff --git a/lib/models/Semester.class.php b/lib/models/Semester.class.php index 94a66059da05d5cf52fcf59d12daa3ffbf8c348d..6e55e4e89fa992634ac95b215b6b84642f1b6d40 100644 --- a/lib/models/Semester.class.php +++ b/lib/models/Semester.class.php @@ -156,7 +156,7 @@ class Semester extends SimpleORMap { return array_values( array_filter(self::getAllAsArray(), function ($semester, $key) use($with_before_first) { - return $GLOBALS['perm']->have_perm('admin') || $semester['visible'] || ((int)$key === 0 && $with_before_first); + return $GLOBALS['perm']->have_perm('admin') || !empty($semester['visible']) || ((int)$key === 0 && $with_before_first); }, ARRAY_FILTER_USE_BOTH) ); } diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index 4bce0cf05409ea81906391dfb574a847841fe2d7..cf09f450511deaa8155a8a0346444098a140930e 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -2240,7 +2240,7 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate } else { $p = (array)$params($this); $records = call_user_func_array($to_call, count($p) ? $p : [null]); - $result = is_array($records) ? $records[0] : $records; + $result = is_array($records) ? ($records[0] ?? null) : $records; $this->relations[$relation] = $result; } } diff --git a/lib/models/StudipStudyArea.class.php b/lib/models/StudipStudyArea.class.php index fe9ae73c9ee687e91d7951c96f66a1823da7d05b..4ef7a5783fb27322680da9453ae314a3df13ab7c 100644 --- a/lib/models/StudipStudyArea.class.php +++ b/lib/models/StudipStudyArea.class.php @@ -427,12 +427,10 @@ class StudipStudyArea extends SimpleORMap foreach ($nodes as $node) { // if we know the node already place there - if ($hashmap[$node->parent_id]) { - + if (isset($hashmap[$node->parent_id])) { $cached = $hashmap[$node->parent_id]; $cached->required_children[$node->id] = $node; } else { - // if we have a node that is directly under root if ($node->parent_id == $root->id) { $root->required_children[$node->id] = $node; diff --git a/lib/models/resources/Building.class.php b/lib/models/resources/Building.class.php index 09c7786bf8d567e3f65ee043bb97362602c99fb0..f6bb5a1d1719a20433e5084c067d58fb60817ce1 100644 --- a/lib/models/resources/Building.class.php +++ b/lib/models/resources/Building.class.php @@ -32,31 +32,32 @@ class Building extends Resource 'number', 'geo_coordinates' ]; - + protected static function configure($config = []) { - if (!is_array($config['additional_fields'])) { + if (!isset($config['additional_fields'])) { $config['additional_fields'] = []; } + foreach (self::$required_properties as $property) { $config['additional_fields'][$property] = [ 'get' => 'getProperty', 'set' => 'setProperty' ]; } - + $config['additional_fields']['location']['get'] = 'findLocation'; $config['additional_fields']['rooms']['get'] = 'findRooms'; - + $config['additional_fields']['facility_manager'] = [ 'get' => 'getPropertyRelatedObject', 'set' => 'setPropertyRelatedObject' ]; - + $config['registered_callbacks']['before_store'][] = 'cbValidate'; parent::configure($config); } - + /** * Returns all buildings which are stored in the database. * @@ -71,7 +72,7 @@ class Building extends Resource ORDER BY sort_position DESC, name ASC, mkdate ASC" ); } - + public static function getTranslatedClassName($item_count = 1) { return ngettext( @@ -80,12 +81,12 @@ class Building extends Resource $item_count ); } - + public static function getRequiredProperties() { return self::$required_properties; } - + /** * Finds buildings by a location specified by its ID. * @@ -98,17 +99,17 @@ class Building extends Resource if (!$location_id) { return []; } - + $location = Building::find($location_id); if (!$location) { return []; } - + //Return all found Building objects below the location: return $location->findChildrenByClassName('Building', 0, true); } - - + + /** * Returns the part of the URL for getLink and getURL which will be * placed inside the calls to URLHelper::getLink and URLHelper::getURL @@ -128,13 +129,13 @@ class Building extends Resource _('Zur Erstellung der URL fehlt eine Gebäude-ID!') ); } - + //There are some actions which can be handled by the general //resource controller: if (in_array($action, ['files', 'request', 'lock'])) { return parent::buildPathForAction($action, $id); } - + switch ($action) { case 'show': return 'dispatch.php/resources/building/index/' . $id; @@ -148,7 +149,7 @@ class Building extends Resource return parent::buildPathForAction($action, $id); } } - + /** * Returns the appropriate link for the building action that shall be * executed on a building. @@ -173,7 +174,7 @@ class Building extends Resource $link_parameters ); } - + /** * Returns the appropriate URL for the building action that shall be * executed on a building. @@ -197,12 +198,12 @@ class Building extends Resource $url_parameters ); } - + public function getRequiredPropertyNames() { return self::$required_properties; } - + /** * @see StudipItem::__toString */ @@ -210,7 +211,7 @@ class Building extends Resource { return $this->getFullName(); } - + public function cbValidate() { if (!$this->findParentByClassName('Location')) { @@ -222,7 +223,7 @@ class Building extends Resource ) ); } - + if (!is_a($this->category->class_name, get_class($this), true)) { //Only resources with the Building category can be handled //with this class! @@ -233,12 +234,12 @@ class Building extends Resource ) ); } - + return true; } - + //property and shortcut methods: - + /** * Returns the full (localised) name of the building. * @@ -251,7 +252,7 @@ class Building extends Resource $this->name ); } - + /** * Returns the path for the building's image. * If the building has no image the path for a general @@ -263,25 +264,25 @@ class Building extends Resource { return $this->getIcon()->asImagePath(); } - + public function getIcon($role = Icon::ROLE_INFO) { return Icon::create('home', $role); } - + public function checkHierarchy() { //We must check if this building has buildings as children //or rooms or buildings as parents. In any of those cases the hierarchy //is invalid! - + $children = $this->findChildrenByClassName('Building'); if (count($children) > 0) { //At least one child anywhere below this building //resource is a building, too. return false; } - + $parents = ResourceManager::getHierarchy($this); //We do not need to check this element: array_shift($parents); @@ -292,12 +293,12 @@ class Building extends Resource return false; } } - + //If code execution reaches this point then //the hierarchy around this building is valid. return true; } - + /** * Returns the link for an action for this building. * This is the non-static variant of Building::getLinkForAction. @@ -317,7 +318,7 @@ class Building extends Resource $link_parameters ); } - + /** * Returns the URL for an action for this building. * This is the non-static variant of Building::getURLForAction. @@ -337,7 +338,7 @@ class Building extends Resource $url_parameters ); } - + /** * Retrieves the rooms which reside inside this building by looking up * the child resources of this building. @@ -348,7 +349,7 @@ class Building extends Resource public function findRooms() { $rooms = parent::findChildrenByClassName('Room', 0, true); - + $result = []; foreach ($rooms as $room) { if ($room instanceof Room) { @@ -357,7 +358,7 @@ class Building extends Resource } return $result; } - + /** * Retrieves the location where this building is assigned to by looking up * the parent resources of this building. @@ -373,7 +374,7 @@ class Building extends Resource } return null; } - + /** * Adds a child resource to this building. The child resource * must not be a resource of the class Building or Location. @@ -398,7 +399,7 @@ class Building extends Resource } return parent::addChild($resource); } - + public function createSimpleBooking( User $user, DateTime $begin, @@ -411,7 +412,7 @@ class Building extends Resource { return null; } - + public function createBookingFromRequest( User $user, ResourceRequest $request, @@ -425,8 +426,8 @@ class Building extends Resource { return null; } - - + + public function createBooking( User $user, $range_id = null, @@ -443,7 +444,7 @@ class Building extends Resource { return null; } - + public function createSimpleRequest( User $user, DateTime $begin, @@ -454,7 +455,7 @@ class Building extends Resource { return null; } - + public function createRequest( User $user, $date_range_ids = null, @@ -465,7 +466,7 @@ class Building extends Resource { return null; } - + public function createLock( User $user, DateTime $begin, @@ -475,7 +476,7 @@ class Building extends Resource { return null; } - + public function isAssigned( DateTime $begin, DateTime $end, @@ -484,7 +485,7 @@ class Building extends Resource { return false; } - + public function isReserved( DateTime $begin, DateTime $end, @@ -493,7 +494,7 @@ class Building extends Resource { return false; } - + public function isLocked( DateTime $begin, DateTime $end, @@ -502,7 +503,7 @@ class Building extends Resource { return true; } - + public function isAvailable( DateTime $begin, DateTime $end, diff --git a/lib/modules/CoreScm.class.php b/lib/modules/CoreScm.class.php index 595c219cf6aaabac07e6ec700b8c513c6722c9d9..86e10e14d709af591d085ac1f4a6f5c1a278cf61 100644 --- a/lib/modules/CoreScm.class.php +++ b/lib/modules/CoreScm.class.php @@ -94,7 +94,7 @@ class CoreScm extends CorePlugin implements StudipModule $link = 'dispatch.php/course/scm'; - $navigation = new Navigation($scms->first()->tab_name ?: _('Informationen'), $link); + $navigation = new Navigation($scms->first()->tab_name ?? _('Informationen'), $link); $navigation->setImage(Icon::create('infopage', Icon::ROLE_INFO_ALT)); $navigation->setActiveImage(Icon::create('infopage', Icon::ROLE_INFO)); diff --git a/lib/raumzeit/SeminarDB.class.php b/lib/raumzeit/SeminarDB.class.php index 85a8c0d4e712517d7d4c93f7d8ee3c9ce7b9cc66..566f7af5af56399065a11590ea30610b3234e3bd 100644 --- a/lib/raumzeit/SeminarDB.class.php +++ b/lib/raumzeit/SeminarDB.class.php @@ -88,6 +88,7 @@ class SeminarDB public static function getStatOfNotBookedRooms($cycle_id, $seminar_id, $filterStart = 0, $filterEnd = 0) { $stat = [ + 'all' => 0, 'booked' => 0, 'open' => 0, 'open_rooms' => [], diff --git a/lib/raumzeit/raumzeit_functions.inc.php b/lib/raumzeit/raumzeit_functions.inc.php index 96b3880184b3d8dcbe29bead196acfca06481cb8..a65f3bb0dd744032242c6f4c704eab2b4be659b6 100644 --- a/lib/raumzeit/raumzeit_functions.inc.php +++ b/lib/raumzeit/raumzeit_functions.inc.php @@ -59,7 +59,7 @@ function raumzeit_send_cancel_message($comment, $dates) $message = sprintf(_("In der Veranstaltung %s fällt der/die folgende(n) Termine aus:"), $course->name . ' ('. join(',', $lecturers) .') ' . $course->start_semester->name); $message .= "\n\n- "; - $message .= join("\n- " , array_map(function($a) {return $a->toString();}, $dates)); + $message .= join("\n- " , array_map(function($a) {return (string)$a; }, $dates)); if ($comment) { $message .= "\n\n" . $comment; } diff --git a/lib/resources/RoomManager.class.php b/lib/resources/RoomManager.class.php index b4ca702f928eb1bf7b683dbfbaff314ec30755d7..240ce4598132eb521140314782b7ff168934f642 100644 --- a/lib/resources/RoomManager.class.php +++ b/lib/resources/RoomManager.class.php @@ -510,7 +510,7 @@ class RoomManager $sql_array['room_name'] = $room_name; } - if ($properties['room_category_id']) { + if (!empty($properties['room_category_id'])) { $sql .= "AND rc.id = :room_category_id "; $sql_array['room_category_id'] = $properties['room_category_id']; } diff --git a/public/export.php b/public/export.php index bd97656e72ff5000f70a251e55e94ee41e431503..b24638acd08eda88c39a7009b9dbf83795280db6 100644 --- a/public/export.php +++ b/public/export.php @@ -66,6 +66,10 @@ ob_start(); if (Config::get()->EXPORT_ENABLE) { $ex_sem_class = Request::intArray('ex_sem_class'); + $export_error_num = 0; + $xslt_process_done = false; + $start_done = false; + $xml_output_done = false; // Zurueckbutton benutzt? if (Request::submitted('back')) @@ -114,7 +118,7 @@ if (Config::get()->EXPORT_ENABLE) $xml_output_done = true; } - if ( ($choose != "") AND ($format != "") AND ($format != "xml") AND (Config::get()->XSLT_ENABLE) AND ($export_error_num==0) AND + if ( (!empty($choose)) AND ($format != "") AND ($format != "xml") AND (Config::get()->XSLT_ENABLE) AND ($export_error_num==0) AND ( ($o_mode == "processor") OR ($o_mode == "passthrough") OR ($page == 3) ) ) { include("lib/export/export_run_xslt.inc.php"); diff --git a/templates/dates/seminar_html.php b/templates/dates/seminar_html.php index 2680287d445003d48381ff73ce1026538d8bf897..515d9f89624654aef3ec588fd0fa483c9a9cb693 100644 --- a/templates/dates/seminar_html.php +++ b/templates/dates/seminar_html.php @@ -58,6 +58,7 @@ if (!$dates['regular']['turnus_data'] && empty($dates['irregular'])) { $freetext_rooms['(' . htmlReady($date['raum']) . ')']++; } } + // Remove invalid entry if present unset($irregular_rooms['']); if (is_array($irregular) && sizeof($irregular)) { diff --git a/templates/quicksearch/inputfield.php b/templates/quicksearch/inputfield.php index db42e37f63c531712c26f1a1584dcf4094fb5183..fb9b63238e2c1116a80391170a705fc7a8ac8ab6 100644 --- a/templates/quicksearch/inputfield.php +++ b/templates/quicksearch/inputfield.php @@ -12,7 +12,7 @@ foreach ($withAttributes as $attr_name => $attr_value) { print ' '.$attr_name.'="'.htmlReady($attr_value).'"'; } - ?> id="<?= $id ?>"<?= $clear_input ?: '' ?> + ?> id="<?= $id ?>" type="text" value="<?= htmlReady($defaultName) ?>" name="<?= strpos($name, "[") === false ? $name."_parameter" : substr($name, 0, strpos($name, "["))."_parameter".substr($name, strpos($name, "[")) ?>" diff --git a/vendor/trails/src/response.php b/vendor/trails/src/response.php index 60376b33a5aac0507e16f1c112680f4b3167d361..474bfc1a1eeb2a4cd0efa830e548322eb6e60cfc 100644 --- a/vendor/trails/src/response.php +++ b/vendor/trails/src/response.php @@ -75,7 +75,7 @@ class Trails_Response { */ function set_status($status, $reason = NULL) { $this->status = $status; - $this->reason = isset($reason) ? $reason : $this->get_reason($status); + $this->reason = isset($reason) ? $reason : self::get_reason($status); return $this; } @@ -87,7 +87,7 @@ class Trails_Response { * * @return string the reason phrase for this response's status */ - function get_reason($status) { + public static function get_reason($status) { $reason = array( 100 => 'Continue', 'Switching Protocols', 200 => 'OK', 'Created', 'Accepted', 'Non-Authoritative Information', diff --git a/vendor/trails/trails.php b/vendor/trails/trails.php index a6ca0030f43d1f5faf14691d950d67dc98077f1d..760fb1664c5a598c83eb8421a888eac16b589fcc 100644 --- a/vendor/trails/trails.php +++ b/vendor/trails/trails.php @@ -371,7 +371,7 @@ class Trails_Response { */ function set_status($status, $reason = NULL) { $this->status = $status; - $this->reason = isset($reason) ? $reason : $this->get_reason($status); + $this->reason = isset($reason) ? $reason : self::get_reason($status); return $this; } @@ -383,7 +383,7 @@ class Trails_Response { * * @return string the reason phrase for this response's status */ - function get_reason($status) { + public static function get_reason($status) { $reason = array( 100 => 'Continue', 'Switching Protocols', 200 => 'OK', 'Created', 'Accepted', 'Non-Authoritative Information',