Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
842943e2
Commit
842943e2
authored
Oct 15, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(captiveportal, new) add (login) templates to model
parent
98a0662d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
CaptivePortal.php
...e/mvc/app/models/OPNsense/CaptivePortal/CaptivePortal.php
+18
-0
CaptivePortal.xml
...e/mvc/app/models/OPNsense/CaptivePortal/CaptivePortal.xml
+19
-0
No files found.
src/opnsense/mvc/app/models/OPNsense/CaptivePortal/CaptivePortal.php
View file @
842943e2
...
...
@@ -64,4 +64,22 @@ class CaptivePortal extends BaseModel
}
return
false
;
}
/**
* find ttemplate by name or return a new object
* @param $name template name
* @return mixed
*/
public
function
getTemplateByName
(
$name
)
{
foreach
(
$this
->
templates
->
template
->
__items
as
$template
)
{
if
((
string
)
$template
->
name
===
$name
)
{
return
$template
;
}
}
$newItem
=
$this
->
templates
->
template
->
Add
();
$newItem
->
name
=
$name
;
$newItem
->
fileid
=
uniqid
();
return
$newItem
;
}
}
src/opnsense/mvc/app/models/OPNsense/CaptivePortal/CaptivePortal.xml
View file @
842943e2
...
...
@@ -74,5 +74,24 @@
</description>
</zone>
</zones>
<templates>
<template
type=
"ArrayField"
>
<fileid
type=
"TextField"
>
<Required>
Y
</Required>
<mask>
/[0-9a-zA-Z\-]{1,255}/u
</mask>
<ValidationMessage>
Fileid should be an internally generated unique number
</ValidationMessage>
</fileid>
<name
type=
"TextField"
>
<Required>
Y
</Required>
<mask>
/^([\t\n\v\f\r 0-9a-zA-Z.,_\x{00A0}-\x{FFFF}]){1,255}$/u
</mask>
<ValidationMessage>
Template name should be a string between 1 and 255 characters
</ValidationMessage>
</name>
<content
type=
"TextField"
>
<Required>
Y
</Required>
<mask>
/[0-9a-zA-Z\+\=\/]{20,}/u
</mask>
<ValidationMessage>
File content should be in (base64 encoded) zip format
</ValidationMessage>
</content>
</template>
</templates>
</items>
</model>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment