Skip to content

Commit

Permalink
Adding defense checking for msgs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Adams committed Mar 21, 2020
1 parent c47f945 commit 93919b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 59 deletions.
25 changes: 15 additions & 10 deletions owa_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,25 @@ function getMsg($code, $substitutions = []) {

static $_owa_messages;

$msg = array();

if (empty($_owa_messages)) {
require_once(OWA_DIR.'conf/messages.php');
}

if ( $code && array_key_exists( $code, $_owa_messages ) ) {

$msg = $_owa_messages[$code];

$msg = $_owa_messages[$code];

if (isset($msg['headline'])) {
$msg['headline'] = vsprintf($msg['headline'], $substitutions['headline']);
}

if (isset($msg['message'])) {
$msg['message'] = vsprintf($msg['message'], $substitutions['message']);
}

if (isset($msg['headline'])) {
$msg['headline'] = vsprintf($msg['headline'], $substitutions['headline']);
}

if (isset($msg['message'])) {
$msg['message'] = vsprintf($msg['message'], $substitutions['message']);
}
}

return $msg;
}

Expand Down
49 changes: 0 additions & 49 deletions owa_wp.php

This file was deleted.

0 comments on commit 93919b3

Please sign in to comment.