net: fix url_safe() usage on stock 16.7

This is a bit of a pickle: people should upgrade, but
simply use 16.7 and install the plugins.  We can't
easily pin a core version, so we need to provide these
compat stubs instead.
This commit is contained in:
Franco Fichtner
2016-11-10 08:59:22 +01:00
parent c10d7d3d87
commit 034c1621e9
6 changed files with 60 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= l2tp
PLUGIN_VERSION= 1.2
PLUGIN_VERSION= 1.3
PLUGIN_DEPENDS= clog mpd5
PLUGIN_COMMENT= L2TP server based on MPD5
PLUGIN_MAINTAINER= franco@opnsense.org
@@ -30,6 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */
require_once 'util.inc';
if (!function_exists(url_safe)) {
function url_safe($format, $args = array())
{
if (!is_array($args)) {
/* just in case there's only one argument */
$args = array($args);
}
foreach ($args as $id => $arg) {
$args[$id] = urlencode($arg);
}
return vsprintf($format, $args);
}
}
/* END remove this in 17.1 */
function if_l2tp_configure()
{
return array('if_l2tp_configure_do');
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= pppoe
PLUGIN_VERSION= 1.2
PLUGIN_VERSION= 1.3
PLUGIN_DEPENDS= clog mpd5
PLUGIN_COMMENT= PPPoE server based on MPD5
PLUGIN_MAINTAINER= franco@opnsense.org
@@ -30,6 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */
require_once 'util.inc';
if (!function_exists(url_safe)) {
function url_safe($format, $args = array())
{
if (!is_array($args)) {
/* just in case there's only one argument */
$args = array($args);
}
foreach ($args as $id => $arg) {
$args[$id] = urlencode($arg);
}
return vsprintf($format, $args);
}
}
/* END remove this in 17.1 */
function if_pppoe_configure()
{
return array('if_pppoe_configure_do');
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= pptp
PLUGIN_VERSION= 1.2
PLUGIN_VERSION= 1.3
PLUGIN_DEPENDS= clog mpd5
PLUGIN_COMMENT= PPTP server based on MPD5
PLUGIN_MAINTAINER= franco@opnsense.org
@@ -30,6 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */
require_once 'util.inc';
if (!function_exists(url_safe)) {
function url_safe($format, $args = array())
{
if (!is_array($args)) {
/* just in case there's only one argument */
$args = array($args);
}
foreach ($args as $id => $arg) {
$args[$id] = urlencode($arg);
}
return vsprintf($format, $args);
}
}
/* END remove this in 17.1 */
function if_pptp_configure()
{
return array('if_pptp_configure_do');