From e75c08bedd60a6674d22ce3e2ec57b5a5f1d85eb Mon Sep 17 00:00:00 2001 From: Moritz Strohm Date: Wed, 28 Sep 2022 14:24:20 +0000 Subject: fix for BIESt #1118 Merge request studip/studip!676 --- app/controllers/admin/autoinsert.php | 6 ++ app/controllers/admin/coursewizardsteps.php | 2 +- app/controllers/admin/plugin.php | 1 + app/controllers/admin/role.php | 12 ++-- app/controllers/admin/user.php | 17 +++-- app/controllers/course/studygroup.php | 2 +- app/controllers/event_log.php | 2 +- app/controllers/help_content.php | 1 + app/controllers/institute/members.php | 2 +- app/controllers/tour.php | 10 +++ app/views/admin/autoinsert/index.php | 2 +- app/views/admin/autoinsert/manual.php | 2 +- .../admin/cronjobs/schedules/periodic-schedule.php | 4 +- app/views/admin/plugin/index.php | 7 +- app/views/admin/specification/_field.php | 4 +- app/views/admin/specification/edit.php | 4 +- app/views/admin/user/_results.php | 4 +- app/views/admin/user/index.php | 22 +++--- .../admission/ruleadministration/compatibility.php | 4 +- app/views/global_search/settings.php | 2 +- app/views/institute/members/_table_body.php | 24 +++---- app/views/institute/members/index.php | 6 +- lib/classes/ActionMenu.php | 6 +- lib/classes/EventLog.php | 3 +- lib/classes/PluginAdministration.php | 4 ++ lib/classes/RangeTreeObject.class.php | 78 +++++++++++----------- lib/classes/SemClass.class.php | 4 +- lib/classes/StudipForm.class.php | 8 +-- lib/classes/StudipRangeTree.class.php | 2 +- lib/classes/StudipRangeTreeViewAdmin.class.php | 8 +-- lib/classes/StudipSemSearchHelper.class.php | 2 +- lib/classes/StudipSemTree.class.php | 6 +- lib/classes/StudipSemTreeViewAdmin.class.php | 21 +++--- lib/classes/TreeView.class.php | 28 ++++---- lib/classes/URLHelper.php | 2 +- lib/classes/restapi/Router.php | 4 +- lib/classes/searchtypes/RangeSearch.class.php | 1 + lib/extern/admin_extern.inc.php | 2 +- lib/extern/lib/ExternConfig.class.php | 2 +- lib/extern/lib/ExternConfigDb.class.php | 2 +- lib/extern/views/extern_edit_module.inc.php | 2 +- lib/functions.php | 2 +- lib/models/LogEvent.php | 2 +- lib/models/OERHost.php | 4 +- lib/models/SimpleCollection.class.php | 6 +- lib/models/SimpleORMap.class.php | 4 +- lib/models/User.class.php | 2 +- lib/plugins/engine/PluginManager.class.php | 6 +- lib/plugins/engine/PluginRepository.class.php | 4 +- lib/visual.inc.php | 2 +- templates/shared/semester-selector.php | 1 + 51 files changed, 201 insertions(+), 157 deletions(-) diff --git a/app/controllers/admin/autoinsert.php b/app/controllers/admin/autoinsert.php index 6edf3c6..fd3b7e0 100644 --- a/app/controllers/admin/autoinsert.php +++ b/app/controllers/admin/autoinsert.php @@ -36,6 +36,10 @@ class Admin_AutoinsertController extends AuthenticatedController */ public function index_action() { + $this->sem_search = ''; + $this->sem_select = ''; + $this->seminar_search = []; + // search seminars if (Request::submitted('suchen')) { if (Request::get('sem_search')) { @@ -142,6 +146,8 @@ class Admin_AutoinsertController extends AuthenticatedController */ public function manual_action() { + $this->seminar_search = []; + PageLayout::setTitle(_('Manuelles Eintragen von Nutzergruppen in Veranstaltungen')); if (Request::submitted('submit')) { $filters = array_filter(Request::getArray('filter')); diff --git a/app/controllers/admin/coursewizardsteps.php b/app/controllers/admin/coursewizardsteps.php index 7587006..4e70fa0 100644 --- a/app/controllers/admin/coursewizardsteps.php +++ b/app/controllers/admin/coursewizardsteps.php @@ -52,6 +52,7 @@ class Admin_CourseWizardStepsController extends AuthenticatedController */ public function edit_action($id='') { + $this->availableClasses = []; if ($id) { $title = _('Schritt bearbeiten'); $this->step = CourseWizardStepRegistry::find($id); @@ -63,7 +64,6 @@ class Admin_CourseWizardStepsController extends AuthenticatedController $this->step->number = 0; $this->step->enabled = false; - $this->availableClasses = []; foreach (get_declared_classes() as $className) { if (is_a($className, "CourseWizardStep", true) && $className !== "CourseWizardStep") { diff --git a/app/controllers/admin/plugin.php b/app/controllers/admin/plugin.php index 044fc50..7a87d8f 100644 --- a/app/controllers/admin/plugin.php +++ b/app/controllers/admin/plugin.php @@ -142,6 +142,7 @@ class Admin_PluginController extends AuthenticatedController $this->plugin_types = $this->plugin_admin->getPluginTypes(); $this->update_info = $this->get_update_info($this->plugins); $this->migrations = $this->plugin_admin->getMigrationInfo(); + $this->num_updates = 0; foreach ($this->update_info as $id => $info) { if (isset($info['update']) && !$this->plugins[$id]['depends']) { diff --git a/app/controllers/admin/role.php b/app/controllers/admin/role.php index 1e99a27..f932b0d 100644 --- a/app/controllers/admin/role.php +++ b/app/controllers/admin/role.php @@ -152,18 +152,21 @@ class Admin_RoleController extends AuthenticatedController return; } + $this->username = Request::get('username'); + $this->currentuser = null; + $this->assignedroles = []; + $this->all_userroles = []; + // user search was started if (Request::submitted('search')) { - $username = Request::get('username'); - if ($username == '') { + if ($this->username == '') { $this->error = _('Es wurde kein Suchwort eingegeben.'); } else { - $this->users = $this->search_user($username); + $this->users = $this->search_user($this->username); if (count($this->users) === 0) { $this->error = _('Es wurde keine Person gefunden.'); - $this->username = $username; } } } @@ -282,6 +285,7 @@ class Admin_RoleController extends AuthenticatedController $roleid = Request::int('role', $roleid); $this->roles = RolePersistence::getAllRoles(); + $this->roleid = ''; if ($roleid) { $sql = "SELECT DISTINCT Vorname,Nachname,user_id,username,perms diff --git a/app/controllers/admin/user.php b/app/controllers/admin/user.php index aaa59a0..cf1c806 100644 --- a/app/controllers/admin/user.php +++ b/app/controllers/admin/user.php @@ -69,7 +69,7 @@ class Admin_UserController extends AuthenticatedController } //Suchparameter und Ergebnisse vorhanden - if (isset($_SESSION['admin']['user']) && $_SESSION['admin']['user']['results']) { + if (!empty($_SESSION['admin']['user']['results'])) { $request = $_SESSION['admin']['user']; } @@ -81,6 +81,9 @@ class Admin_UserController extends AuthenticatedController } } + $this->request = []; + $this->users = []; + //Datafields $this->datafields = []; $datafields = DataField::getDataFields("user"); @@ -96,6 +99,7 @@ class Admin_UserController extends AuthenticatedController }); //wenn suche durchgeführt + $search_datafields = []; if (!empty($request)) { //suche mit datafields foreach ($this->datafields as $datafield) { @@ -113,8 +117,8 @@ class Admin_UserController extends AuthenticatedController $this->order = $this->order == 'desc' ? 'asc' : 'desc'; } - $request['vorname'] = $request['vorname'] ?: null; - $request['nachname'] = $request['nachname'] ?: null; + $request['vorname'] = $request['vorname'] ?? null; + $request['nachname'] = $request['nachname'] ?? null; $request['inaktiv'] = $inaktiv; $request['datafields'] = $search_datafields; $request['sort'] = $this->sortby; @@ -207,7 +211,8 @@ class Admin_UserController extends AuthenticatedController if ($advanced || !empty($search_datafields) || (!empty($request) - && ($request['auth_plugins'] || $request['userdomains'] || $request['degree'] || $request['institute'] || $request['studycourse'] || $request['show_only_not_lectures'] || !empty($request['roles'])) + && (!empty($request['auth_plugins']) || !empty($request['userdomains']) || !empty($request['degree']) || + !empty($request['institute']) || !empty($request['studycourse']) || !empty($request['show_only_not_lectures']) || !empty($request['roles'])) ) ) { $this->advanced = true; @@ -1621,7 +1626,7 @@ class Admin_UserController extends AuthenticatedController )->asDialog(); $actions->addLink( _('Konten zusammenführen'), - $this->url_for('admin/user/migrate/' . (($this->user && is_array($this->user)) ? $this->user['user_id'] : '')), + $this->url_for('admin/user/migrate/' . ((!empty($this->user) && is_array($this->user)) ? $this->user['user_id'] : '')), Icon::create('community') ); @@ -1641,7 +1646,7 @@ class Admin_UserController extends AuthenticatedController ); } - if (!is_object($this->user)) { + if (empty($this->user) || !is_object($this->user)) { return; } diff --git a/app/controllers/course/studygroup.php b/app/controllers/course/studygroup.php index 58032b8..b327a1a 100644 --- a/app/controllers/course/studygroup.php +++ b/app/controllers/course/studygroup.php @@ -21,7 +21,7 @@ class Course_StudygroupController extends AuthenticatedController ) { // args at position zero is always the studygroup-id - if ($args[0] && $action == 'details') { + if (!empty($args[0]) && $action == 'details') { if (SeminarCategories::GetBySeminarId($args[0])->studygroup_mode == false) { throw new Exception(_('Dieses Seminar ist keine Studiengruppe!')); } diff --git a/app/controllers/event_log.php b/app/controllers/event_log.php index 9638b09..f1d19c6 100644 --- a/app/controllers/event_log.php +++ b/app/controllers/event_log.php @@ -42,10 +42,10 @@ class EventLogController extends AuthenticatedController $this->search = trim(Request::get('search')); $this->log_actions = LogAction::getUsed(true); $this->types = $this->event_log->get_object_types(); + $this->type = Request::option('type'); // restrict log events to object scope if ($this->search) { - $this->type = Request::option('type'); $objects = $this->event_log->find_objects( $this->type, $this->search, diff --git a/app/controllers/help_content.php b/app/controllers/help_content.php index a04c168..5e8faf9 100644 --- a/app/controllers/help_content.php +++ b/app/controllers/help_content.php @@ -43,6 +43,7 @@ class HelpContentController extends AuthenticatedController */ public function admin_overview_action() { + $this->help_content_searchterm = ''; // initialize PageLayout::setTitle(_('Verwalten von Hilfe-Texten')); PageLayout::setHelpKeyword('Basis.HelpContentAdmin'); diff --git a/app/controllers/institute/members.php b/app/controllers/institute/members.php index 29c325a..33d8eab 100644 --- a/app/controllers/institute/members.php +++ b/app/controllers/institute/members.php @@ -107,7 +107,7 @@ class Institute_MembersController extends AuthenticatedController // Show lock rule information $lockrule = LockRules::getObjectRule($this->institute->id); - if ($this->admin_view && $lockrule->description + if ($this->admin_view && !empty($lockrule->description) && LockRules::Check($this->institute->id, 'participants')) { PageLayout::postInfo(formatLinks($lockrule->description)); } diff --git a/app/controllers/tour.php b/app/controllers/tour.php index cda3ea4..54dfeff 100644 --- a/app/controllers/tour.php +++ b/app/controllers/tour.php @@ -180,6 +180,10 @@ class TourController extends AuthenticatedController throw new AccessDeniedException(); } + $this->tour_searchterm = ''; + $this->delete_question = ''; + $this->filter_text = ''; + // initialize PageLayout::setTitle(_('Verwalten von Touren')); PageLayout::setHelpKeyword('Basis.TourAdmin'); @@ -443,6 +447,9 @@ class TourController extends AuthenticatedController $this->render_nothing(); return; } + + $this->force_route = ''; + // Output as dialog (Ajax-Request) or as Stud.IP page? PageLayout::setTitle(_('Schritt bearbeiten')); // save step position @@ -613,6 +620,9 @@ class TourController extends AuthenticatedController if (!$this->help_admin) { throw new AccessDeniedException(); } + + $this->delete_question = ''; + // initialize PageLayout::setTitle(_('Verwalten von Touren')); PageLayout::setHelpKeyword('Basis.TourAdmin'); diff --git a/app/views/admin/autoinsert/index.php b/app/views/admin/autoinsert/index.php index 7749329..6f863c5 100644 --- a/app/views/admin/autoinsert/index.php +++ b/app/views/admin/autoinsert/index.php @@ -12,7 +12,7 @@ use Studip\Button, Studip\LinkButton;
- render_partial("admin/autoinsert/_search.php", ['semester_data' => $semester_data]) ?> + render_partial('admin/autoinsert/_search.php') ?>
0): ?> diff --git a/app/views/admin/autoinsert/manual.php b/app/views/admin/autoinsert/manual.php index 612f561..e081a10 100644 --- a/app/views/admin/autoinsert/manual.php +++ b/app/views/admin/autoinsert/manual.php @@ -10,7 +10,7 @@
- render_partial("admin/autoinsert/_search.php", compact('semester_data', 'sem_search', 'sem_select')) ?> + render_partial('admin/autoinsert/_search.php', compact('sem_search', 'sem_select')) ?>
diff --git a/app/views/admin/cronjobs/schedules/periodic-schedule.php b/app/views/admin/cronjobs/schedules/periodic-schedule.php index b482efd..021002a 100644 --- a/app/views/admin/cronjobs/schedules/periodic-schedule.php +++ b/app/views/admin/cronjobs/schedules/periodic-schedule.php @@ -9,7 +9,7 @@ $cronify = function ($n) { return $n; } ?> - + @@ -38,4 +38,4 @@ $cronify = function ($n) { - \ No newline at end of file + diff --git a/app/views/admin/plugin/index.php b/app/views/admin/plugin/index.php index 859083b..26da74f 100644 --- a/app/views/admin/plugin/index.php +++ b/app/views/admin/plugin/index.php @@ -65,7 +65,7 @@ use Studip\Button, Studip\LinkButton; > - + asImg([ 'title' => _('Automatische Updates sind eingerichtet'), @@ -75,8 +75,9 @@ use Studip\Button, Studip\LinkButton; > - - + + diff --git a/app/views/admin/specification/_field.php b/app/views/admin/specification/_field.php index 30a01ff..6f089ea 100644 --- a/app/views/admin/specification/_field.php +++ b/app/views/admin/specification/_field.php @@ -4,7 +4,7 @@ $order = Request::getArray('order'); ?>
- + @@ -28,7 +28,7 @@ $order = Request::getArray('order'); diff --git a/app/views/admin/specification/edit.php b/app/views/admin/specification/edit.php index de868a4..e803171 100644 --- a/app/views/admin/specification/edit.php +++ b/app/views/admin/specification/edit.php @@ -24,13 +24,13 @@ use Studip\Button, Studip\LinkButton; - 0) : ?> diff --git a/app/views/admin/user/_results.php b/app/views/admin/user/_results.php index 1406c2a..695e30e 100644 --- a/app/views/admin/user/_results.php +++ b/app/views/admin/user/_results.php @@ -96,7 +96,7 @@ nachname) ?> email) ?> - online->last_lifesign) : + online->last_lifesign)) : $inactive = time() - $user->online->last_lifesign; if ($inactive < 3600 * 24) { $inactive = gmdate('H:i:s', $inactive); @@ -188,7 +188,7 @@ } - if (Privacy::isVisible($user_id)) { + if (Privacy::isVisible($user->id)) { $actionMenu->addLink( $controller->url_for("privacy/landing/{$user->id}"), _('Anzeige Personendaten'), diff --git a/app/views/admin/user/index.php b/app/views/admin/user/index.php index 50a69c4..0eb4540 100644 --- a/app/views/admin/user/index.php +++ b/app/views/admin/user/index.php @@ -13,22 +13,22 @@ use Studip\Button, Studip\LinkButton; @@ -123,7 +123,7 @@ use Studip\Button, Studip\LinkButton; - + @@ -199,7 +199,7 @@ use Studip\Button, Studip\LinkButton; diff --git a/app/views/admission/ruleadministration/compatibility.php b/app/views/admission/ruleadministration/compatibility.php index 2dc8aa4..d272bd0 100644 --- a/app/views/admission/ruleadministration/compatibility.php +++ b/app/views/admission/ruleadministration/compatibility.php @@ -36,7 +36,7 @@ > + in_array($compat_class, $matrix[$class] ?? []) ? ' checked' : ''?>> @@ -51,5 +51,5 @@ - + diff --git a/app/views/global_search/settings.php b/app/views/global_search/settings.php index e4e1e0e..bf1764d 100644 --- a/app/views/global_search/settings.php +++ b/app/views/global_search/settings.php @@ -65,7 +65,7 @@ + > diff --git a/app/views/institute/members/_table_body.php b/app/views/institute/members/_table_body.php index 432125d..8bce6d2 100644 --- a/app/views/institute/members/_table_body.php +++ b/app/views/institute/members/_table_body.php @@ -4,7 +4,7 @@ - + setContext($th_title) @@ -36,7 +36,7 @@ user_id, $institute->id]); - if ($group) { + if (!empty($group)) { $role_entries = DataFieldEntry::getDataFieldEntries([$member->user_id, $group->id]); } ?> @@ -57,25 +57,25 @@ - + inst_perms) ?> - + - + raum) ?> - + sprechzeiten) ?> - + Telefon) ?> - + user_id)) ?> - + user_info->Home) ?> getId()]); }) as $entry): ?> @@ -87,7 +87,7 @@ - + setContext($member->user) @@ -120,7 +120,7 @@ - + filter(function ($group) use ($member) { return $group->isMember($member->user_id); @@ -148,7 +148,7 @@ - + conditionAll($admin_view && !LockRules::Check($institute->id, 'participants')) diff --git a/app/views/institute/members/index.php b/app/views/institute/members/index.php index 17dc602..25cf0aa 100644 --- a/app/views/institute/members/index.php +++ b/app/views/institute/members/index.php @@ -5,15 +5,15 @@ $field): ?> - width=""> + width=""> $field): ?> - colspan=""> - + colspan=""> + diff --git a/lib/classes/ActionMenu.php b/lib/classes/ActionMenu.php index 92eac8d..511c995 100644 --- a/lib/classes/ActionMenu.php +++ b/lib/classes/ActionMenu.php @@ -111,7 +111,8 @@ class ActionMenu 'link' => $url->link, 'icon' => $url->icon, 'label' => $url->label, - 'attributes' => $url->attributes + 'attributes' => $url->attributes, + 'index' => $index ]; } else { $action = [ @@ -120,6 +121,7 @@ class ActionMenu 'icon' => $icon, 'label' => $label, 'attributes' => $attributes, + 'index' => $index ]; } $index = $index ?: md5($action['link'].json_encode($action['attributes'])); @@ -180,6 +182,7 @@ class ActionMenu 'icon' => $icon, 'label' => $label, 'attributes' => $attributes, + 'index' => '' ]; } @@ -198,6 +201,7 @@ class ActionMenu $this->actions[] = [ 'type' => 'multi-person-search', 'object' => $mp, + 'index' => '' ]; } diff --git a/lib/classes/EventLog.php b/lib/classes/EventLog.php index b6481d2..7336415 100644 --- a/lib/classes/EventLog.php +++ b/lib/classes/EventLog.php @@ -89,6 +89,7 @@ class EventLog $filter = $this->sql_event_filter($action_id, $object_id, $parameters) ?: '1'; $filter .= " ORDER BY mkdate DESC, event_id DESC LIMIT {$offset}, 50"; $log_events = LogEvent::findBySQL($filter, $parameters); + $events = []; foreach ($log_events as $log_event) { $events[] = [ @@ -113,7 +114,7 @@ class EventLog foreach ($actions as $action) { $log_actions[$action->getId()] = $action->toArray(); $log_actions[$action->getId()]['log_count'] - = (int) $log_count[$action->getId()]; + = (int) ($log_count[$action->getId()] ?? 0); } return $log_actions; diff --git a/lib/classes/PluginAdministration.php b/lib/classes/PluginAdministration.php index dc3f3bc..dc8418e 100644 --- a/lib/classes/PluginAdministration.php +++ b/lib/classes/PluginAdministration.php @@ -327,6 +327,10 @@ class PluginAdministration $plugindir = Config::get()->PLUGINS_PATH . '/' . $plugin['path']; $manifest = $plugin_manager->getPluginManifest($plugindir); + if (!$manifest) { + continue; + } + if (isset($manifest['updateURL'])) { $repository = new PluginRepository($manifest['updateURL']); } diff --git a/lib/classes/RangeTreeObject.class.php b/lib/classes/RangeTreeObject.class.php index 95f98b8..c4c5320 100644 --- a/lib/classes/RangeTreeObject.class.php +++ b/lib/classes/RangeTreeObject.class.php @@ -7,8 +7,8 @@ // This file is part of Stud.IP // RangeTreeObject.class.php // Class to handle items in the "range tree" -// -// Copyright (c) 2002 André Noack +// +// Copyright (c) 2002 André Noack // Suchi & Berg GmbH // +---------------------------------------------------------------------------+ // This program is free software; you can redistribute it and/or @@ -28,18 +28,18 @@ /** * base class for items in the "range tree" * -* This class is used for items +* This class is used for items * * @access public * @author André Noack -* @package +* @package */ class RangeTreeObject { - + /** * item_id in range_tree * - * + * * @access public * @var string $tree_item_id */ @@ -47,7 +47,7 @@ class RangeTreeObject { /** * References the tree object * - * + * * @access private * @var object StudipRangeTree $tree */ @@ -55,25 +55,25 @@ class RangeTreeObject { /** * associative array with data from database fields * - * + * * @access public * @var array $item_data */ var $item_data = null; - + /** * associative array with mapping for database fields * - * + * * @access public * @var array $item_data_mapping */ var $item_data_mapping = null; - + /** * Factory method * - * + * * @access public * @static * @param string $item_id @@ -84,7 +84,7 @@ class RangeTreeObject { $class_name = "RangeTreeObject" . ucfirst($tree->tree_data[$item_id]['studip_object']); return new $class_name($item_id); } - + /** * Constructor * @@ -97,11 +97,11 @@ class RangeTreeObject { $this->tree_item_id = $item_id; $this->item_data = $this->tree->tree_data[$item_id]; } - + /** * Returns all tree items which are kids of this object * - * + * * @access public * @param boolean $as_value_list * @return mixed returns numeric array if param is false, else comma separated string @@ -109,11 +109,11 @@ class RangeTreeObject { function getAllItemKids($as_value_list = false){ return ($as_value_list) ? $this->getValueList($this->tree->getKidsKids($this->tree_item_id)) : $this->tree->getKidsKids($this->tree_item_id); } - + /** * Returns all tree items which are kids of this object and are "real" Stud.IP objects * - * + * * @access public * @param boolean $as_value_list * @return mixed returns numeric array if param is false, else comma separated string @@ -122,11 +122,11 @@ class RangeTreeObject { $all_object_kids = array_merge((array)$this->getInstKids(), (array)$this->getFakKids()); return ($as_value_list) ? $this->getValueList($all_object_kids) : $all_object_kids; } - + /** * Returns all tree items which are kids of this object and are Stud.IP "Einrichtungen" * - * + * * @access public * @param boolean $as_value_list * @return mixed returns numeric array if param is false, else comma separated string @@ -141,11 +141,11 @@ class RangeTreeObject { } return ($as_value_list) ? $this->getValueList($inst_kids) : $inst_kids; } - + /** * Returns all tree items which are kids of this object and are Stud.IP "Fakultaeten" * - * + * * @access public * @param boolean $as_value_list * @return mixed returns numeric array if param is false, else comma separated string @@ -160,19 +160,19 @@ class RangeTreeObject { } return ($as_value_list) ? $this->getValueList($fak_kids) : $fak_kids; } - + /** * Returns array of Stud.IP range_ids of "real" objects * * This function is a wrapper for the according function in StudipRangeTree * @see StudipRangeTree::getAdminRange() * @access public - * @return array of primary keys from table "institute" + * @return array of primary keys from table "institute" */ function getAdminRange(){ return $this->tree->getAdminRange($this->tree_item_id); } - + /** * Only useful in RangeTreeObjectInst ,all other items are always in the correct branch * @@ -182,24 +182,24 @@ class RangeTreeObject { function isInCorrectBranch(){ return true; } - + /** * Returns tree path of the current object * * This function is a wrapper for the according function in StudipRangeTree * @see StudipRangeTree::getItemPath() * @access public - * @return string + * @return string */ function getItemPath(){ return $this->tree->getItemPath($this->tree_item_id); } - + /** * extends the $item_data array * * This function fills the $item_data array with fields from the according database table (is of no use in the base class) - * @abstract + * @abstract * @access private */ function initItemDetail(){ @@ -220,7 +220,7 @@ class RangeTreeObject { } return false; } - + /** * fetch categories of this object from database * @@ -238,21 +238,21 @@ class RangeTreeObject { } return false; } - + /** * getter method for categories of this object * - * + * * @access public * @return object DbSnapshot */ function &getCategories(){ - if (!is_object($this->item_data['categories'])){ + if (empty($this->item_data['categories']) || !is_object($this->item_data['categories'])){ $this->fetchCategories(); } return $this->item_data['categories']; } - + function fetchNumStaff(){ $view = DbView::getView('range_tree'); if (!($view->params[0] = $this->item_data['studip_object_id'])) @@ -264,15 +264,15 @@ class RangeTreeObject { } return false; } - + function getNumStaff(){ if(!isset($this->item_data['num_staff'])){ $this->fetchNumStaff(); } return $this->item_data['num_staff']; } - - + + /** * transform numerical array into a comma separated string * @@ -281,12 +281,12 @@ class RangeTreeObject { * @param array $list * @return string */ - + function getValueList($list){ $value_list = false; - if (count($list) == 1) + if (count($list) == 1) $value_list = "'$list[0]'"; - else + else $value_list = "'".join("','",$list)."'"; return $value_list; } diff --git a/lib/classes/SemClass.class.php b/lib/classes/SemClass.class.php index 5ab5a2d..dbbbcd7 100644 --- a/lib/classes/SemClass.class.php +++ b/lib/classes/SemClass.class.php @@ -305,7 +305,7 @@ class SemClass implements ArrayAccess */ public function isModuleActivated($modulename) { - return !$this->data['modules'][$modulename] + return empty($this->data['modules'][$modulename]) || $this->data['modules'][$modulename]['activated']; } @@ -316,7 +316,7 @@ class SemClass implements ArrayAccess */ public function isModuleAllowed($modulename) { - return !$this->data['modules'][$modulename] + return empty($this->data['modules'][$modulename]) || !$this->data['modules'][$modulename]['sticky'] || $this->data['modules'][$modulename]['activated']; } diff --git a/lib/classes/StudipForm.class.php b/lib/classes/StudipForm.class.php index 88c36fe..024e2e3 100644 --- a/lib/classes/StudipForm.class.php +++ b/lib/classes/StudipForm.class.php @@ -182,7 +182,7 @@ class StudipForm { $attributes['required'] = 'required'; } - if (!isset($attributes['id'])) { + if (empty($attributes['id'])) { $attributes['id'] = $this->form_name . '_' . $name; } @@ -282,7 +282,7 @@ class StudipForm { function getFormFieldSelect($name, $attributes, $default){ $ret = "\n