Skip to content

Commit 1887541

Browse files
committed
Fix PHP notices and warning
1 parent a38dc24 commit 1887541

File tree

10 files changed

+24
-14
lines changed

10 files changed

+24
-14
lines changed

src/WebApp/BootstrapTheme/DefaultLayout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function __construct($theme, $page) {
1616
}
1717

1818
protected function getBootstrapUri() {
19+
$webroot = $this->app->request->webRoot;
1920
return $this->page->getAnnotation(BootstrapTheme::CSS_URI, $webroot.Bootstrap::getCssUri());
2021
}
2122

src/WebApp/BootstrapTheme/MmenuLayout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ protected function renderMmenu() {
130130
protected function renderMenuItem($item, $level) {
131131
$rc = '';
132132
if ($item != NULL) {
133+
$icon = '';
133134
if (get_class($item) == 'WebApp\Component\Divider') {
134135
$rc .= '<li class="mm-divider">';
135136
if ($level == 0) {

src/WebApp/BootstrapTheme/VerticalFormRenderer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class VerticalFormRenderer extends \WebApp\DefaultTheme\ContainerRenderer {
88

9+
public $form;
10+
911
public function __construct($theme, $component) {
1012
parent::__construct($theme, $component, 'form');
1113
}

src/WebApp/Component/Input.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
class Input extends BasicFormElement {
66

7+
public $prependContent;
8+
public $appendContent;
9+
710
public function __construct($parent, $id, $type = 'text', $value = null) {
811
parent::__construct($parent, $id, $value);
912
$this->setType($type);

src/WebApp/Component/LoginForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function createForm($tfa, $return) {
6060

6161
protected function createUserInput($form) {
6262
$userid = $this->request->getPostParam('userid', '');
63-
$user = new TextInput($form, 'userid', $uid);
63+
$user = new TextInput($form, 'userid', $userid);
6464
//$user->setLabel('login_email_label');
6565
$user->setPlaceholder('login_email_placeholder');
6666
return $user;

src/WebApp/Component/SearchFilterBar.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public function __construct($parent) {
1717
}
1818

1919
public static function getSearchPhrase() {
20-
return trim(Request::getRequest()->getParam('search'));
20+
$s = Request::getRequest()->getParam('search');
21+
return $s != null ? trim($s) : NULL;
2122
}
2223

2324
public static function getFilters() {

src/WebApp/DataModel/AccessLog.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class AccessLog {
66

7+
public $log_time;
8+
79
public function __construct() {
810
if (is_string($this->log_time)) $this->log_time = new \TgUtils\Date($this->log_time, WFW_TIMEZONE);
911
}

src/WebApp/Renderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Renderer {
1414
public function __construct($theme, $component) {
1515
$this->app = $theme->app;
1616
$this->theme = $theme;
17-
$this->parent = $parent;
17+
$this->parent = NULL; //$parent;
1818
$this->component = $component;
1919
$this->attributes = array();
2020
$this->styles = array();
@@ -63,9 +63,9 @@ public function setStyle($name, $value) {
6363
}
6464

6565
protected function getAttribute($name, $combined = FALSE) {
66-
$rc = $this->attributes[$name];
66+
$rc = isset($this->attributes[$name]) ? $this->attributes[$name] : NULL;
6767
if ($combined) {
68-
if (isset($rc)) {
68+
if ($rc != NULL) {
6969
$rc = $this->_combineValues($this->component->getAttribute($name), $rc);
7070
} else {
7171
$rc = $this->component->getAttribute($name);

src/WebApp/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected function searchPageInNamespace($pagePath, $namespace) {
253253
if ($names[0] == '') array_shift($names);
254254

255255
// Replace special characters by whitespace and make it camel case and concatenate again
256-
$className = $name;
256+
$className = '';$name;
257257
foreach ($names AS $idx => $path) {
258258
if ($idx > 0) $className .= '\\';
259259
$path = str_replace(' ', '', ucwords(str_replace(array('_','-'), array(' ', ' '), $path)));

src/WebApp/Session/DatabaseSessionHandler.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct($dao) {
2222
* @param string $name
2323
* @return bool
2424
*/
25-
public function open($save_path, $name) {
25+
public function open($save_path, $name):bool {
2626
return TRUE;
2727
}
2828

@@ -32,7 +32,7 @@ public function open($save_path, $name) {
3232
* @param string $session_id
3333
* @return string
3434
*/
35-
public function read($session_id) {
35+
public function read($session_id):string|false {
3636
$this->session = $this->dao->get($session_id);
3737
if (!$this->session) $this->createFreshSession($session_id);
3838
return $this->session->data;
@@ -66,19 +66,19 @@ protected function createFreshSession($session_id) {
6666
* @param string $data
6767
* @return bool
6868
*/
69-
public function write($session_id, $data) {
69+
public function write($session_id, $data):bool {
7070

7171
// In case there is no object yet
7272
if ($this->session == NULL) $this->createFreshSession($session_id);
7373

7474
// Update fields
7575
$now = new Date(time(), WFW_TIMEZONE);
76-
$expiryTime = $_SESSION['persistent'] ? 365*24*3600 : ini_get('session.gc_maxlifetime');
76+
$expiryTime = isset($_SESSION['persistent']) && $_SESSION['persistent'] ? 365*24*3600 : ini_get('session.gc_maxlifetime');
7777
$expiry = new Date(time()+$expiryTime, WFW_TIMEZONE);
7878
$this->session->update_time = $now->toMysql(TRUE);
7979
$this->session->expiry_time = $expiry->toMysql(TRUE);
8080
$this->session->data = $data;
81-
$this->session->persistent = $_SESSION['persistent'] ? 1 : 0;
81+
$this->session->persistent = isset($_SESSION['persistent']) && $_SESSION['persistent'] ? 1 : 0;
8282

8383
// Persist
8484
$session = $this->dao->get($session_id);
@@ -101,7 +101,7 @@ public function write($session_id, $data) {
101101
*
102102
* @return bool
103103
*/
104-
public function close() {
104+
public function close():bool {
105105
if ($this->session) {
106106
return $this->gc(ini_get('session.gc_maxlifetime'));
107107
}
@@ -114,7 +114,7 @@ public function close() {
114114
* @param int $session_id
115115
* @return bool
116116
*/
117-
public function destroy($session_id) {
117+
public function destroy($session_id):bool {
118118
$this->createFreshSession($session_id);
119119
$this->dao->delete($this->session);
120120
return TRUE;
@@ -126,7 +126,7 @@ public function destroy($session_id) {
126126
* @param int $maxlifetime
127127
* @return bool
128128
*/
129-
public function gc($maxlifetime) {
129+
public function gc($maxlifetime):int|false {
130130
// As we had the expiry set explicitely, we dont need the max lifetime
131131
$expired = $this->dao->expire($maxlifetime);
132132
return TRUE;

0 commit comments

Comments
 (0)