Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-autocampars
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-autocampars
Commits
9ea137bc
Commit
9ea137bc
authored
Dec 01, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preventing treating non-exixting camera ports
parent
0c6b8be3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
autocampars.php
src/autocampars.php
+22
-4
No files found.
src/autocampars.php
View file @
9ea137bc
...
@@ -1758,24 +1758,41 @@ function processPost($port) {
...
@@ -1758,24 +1758,41 @@ function processPost($port) {
function
processGet
(
$port
)
{
function
processGet
(
$port
)
{
/** NOT YET PORTED */
/** NOT YET PORTED */
// if ($GLOBALS['sensor_port']<0){
// if ($GLOBALS['sensor_port']<0){
if
(
$port
<
0
){
if
((
$port
<
0
)
||
!
in_array
(
$port
,
$GLOBALS
[
'ports'
])){
if
(
$port
<
0
)
{
$warn
=
<<<WARN_PORT
$warn
=
<<<WARN_PORT
<p>Sensor port (sensor_port parameter) is not specified</p>
<p>Sensor port (sensor_port parameter) is not specified</p>
<p>Parameters for only one camera sensor port can be edited with this program. Below are the links to the individual camera ports parameters.</p>
<p>Parameters for only one camera sensor port can be edited with this program. Below are the links to the individual camera ports parameters.</p>
<p/>
<p/>
WARN_PORT;
WARN_PORT;
}
else
{
$warn
=
<<<WARN_PORT
<p>Sensor port $port does not exit (or is disabled) in this camera.</p>
<p>Below are the links to the existing camera ports parameters.</p>
<p/>
WARN_PORT;
}
// log_msg('$GLOBALS='.print_r($GLOBALS,1));
// log_msg('$GLOBALS='.print_r($GLOBALS,1));
// log_msg('$_SERVER='.print_r($_SERVER,1));
// log_msg('$_SERVER='.print_r($_SERVER,1));
// log_msg('REQUEST_URI='.$_SERVER['REQUEST_URI']);
// log_msg('REQUEST_URI='.$_SERVER['REQUEST_URI']);
$uri
=
$_SERVER
[
'REQUEST_URI'
];
while
(
strstr
(
$uri
,
'sensor_port='
)){
// remove existing sensor_port parameter from URI
$sens_pos
=
strpos
(
$uri
,
'sensor_port='
);
$next_pos
=
strpos
(
$uri
,
'&'
,
$sens_pos
);
if
(
$next_pos
!==
FALSE
){
$uri
=
substr
(
$uri
,
0
,
$sens_pos
)
.
substr
(
$uri
,
$next_pos
+
1
);
}
else
{
$uri
=
substr
(
$uri
,
0
,
$sens_pos
-
1
);
}
}
foreach
(
$GLOBALS
[
'ports'
]
as
$port
)
{
foreach
(
$GLOBALS
[
'ports'
]
as
$port
)
{
$link
=
$
_SERVER
[
'REQUEST_URI'
]
;
$link
=
$
uri
;
if
(
strstr
(
$link
,
'?'
))
$link
.=
'&'
;
if
(
strstr
(
$link
,
'?'
))
$link
.=
'&'
;
else
$link
.=
'?'
;
else
$link
.=
'?'
;
$link
.=
'sensor_port='
.
$port
;
$link
.=
'sensor_port='
.
$port
;
$warn
.=
"<p>Port "
.
$port
.
": <a href =
\"
$link
\"
>
$link
</a></p>
\n
"
;
$warn
.=
"<p>Port "
.
$port
.
": <a href =
\"
$link
\"
>
$link
</a></p>
\n
"
;
}
}
$link
=
$
_SERVER
[
'REQUEST_URI'
]
;
$link
=
$
uri
;
if
(
strstr
(
$link
,
'?'
))
$link
=
substr
(
$link
,
0
,
strpos
(
$link
,
'?'
));
if
(
strstr
(
$link
,
'?'
))
$link
=
substr
(
$link
,
0
,
strpos
(
$link
,
'?'
));
$link
.=
"?log"
;
$link
.=
"?log"
;
$warn
.=
"<br/><p>autocampars.php log file: <a href =
\"
$link
\"
>
$link
</a></p>
\n
"
;
$warn
.=
"<br/><p>autocampars.php log file: <a href =
\"
$link
\"
>
$link
</a></p>
\n
"
;
...
@@ -1805,6 +1822,7 @@ Config file ({$GLOBALS['configDir']}/{$GLOBALS['configPaths'][$port]}): <b>{$GLO
...
@@ -1805,6 +1822,7 @@ Config file ({$GLOBALS['configDir']}/{$GLOBALS['configPaths'][$port]}): <b>{$GLO
</ol>
</ol>
WARN;
WARN;
echo
$warn
;
echo
$warn
;
echo
"<pre>
\n
"
.
print_r
(
$GLOBALS
[
'ports'
],
1
)
.
"
\n
</pre>"
;
endPage
();
endPage
();
log_close
();
log_close
();
exit
(
1
);
exit
(
1
);
...
...
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