diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2022-02-25 17:57:13 +0100 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2022-04-12 15:44:24 +0000 |
| commit | d6004f5d5668cbbaf60878e54e2c3c3848ce120b (patch) | |
| tree | 3cb81a3643315ab51bd26fd47e89c016b59f1387 | |
| parent | 917e75430696706e4ffb643d7154af8d60258742 (diff) | |
fixed PHP8 warnings in news/edit_newsphp8
| -rw-r--r-- | app/controllers/news.php | 7 | ||||
| -rw-r--r-- | app/views/news/edit_news.php | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/news.php b/app/controllers/news.php index 81e832e..1c60adf 100644 --- a/app/controllers/news.php +++ b/app/controllers/news.php @@ -178,6 +178,7 @@ class NewsController extends StudipController $this->area_options_selected = []; $this->may_delete = false; $this->route = "news/edit_news/{$id}"; + $this->anker = ''; $this->news_isvisible = [ 'news_basic' => true, @@ -207,7 +208,8 @@ class NewsController extends StudipController } // load news and comment data and check if user has permission to edit - $news = new StudipNews($id); + $this->comments = []; + $news = new StudipNews($id ?? null); if (!$news->isNew()) { $this->comments = StudipComment::GetCommentsForObject($id); } @@ -250,7 +252,7 @@ class NewsController extends StudipController if ($this->assigned){ $this->news_isvisible['news_visibility'] = true; } - } elseif ($id) { + } elseif (!empty($id)) { // if news id given check for valid id and load ranges if ($news->isNew()) { PageLayout::postError(_('Die Ankündigung existiert nicht!')); @@ -425,6 +427,7 @@ class NewsController extends StudipController } // prepare to save news if (Request::submitted('save_news') && Request::isPost()) { + $error = 0; CSRFProtection::verifySecurityToken(); //prepare ranges array for already assigned news_ranges foreach($news->getRanges() as $range_id) { diff --git a/app/views/news/edit_news.php b/app/views/news/edit_news.php index 2559d06..48f3baa 100644 --- a/app/views/news/edit_news.php +++ b/app/views/news/edit_news.php @@ -221,6 +221,7 @@ ]) ?> </div> <div class="news_area_selected"> + <? $area_count = 0; ?> <? foreach ($area_structure as $area_key => $area_data) : ?> <? if (isset($area_options_selected[$area_key])) : ?> <? $area_count += count($area_options_selected[$area_key]) ?> |
