Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Drew Clardy
ISPConfig 3
Commits
a9a6b283
Commit
a9a6b283
authored
19 years ago
by
Falko Timme
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
fdd6fee6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
interface/lib/classes/listform.inc.php
+219
-219
219 additions, 219 deletions
interface/lib/classes/listform.inc.php
interface/web/dns/templates/soa_list.htm
+1
-3
1 addition, 3 deletions
interface/web/dns/templates/soa_list.htm
with
220 additions
and
222 deletions
interface/lib/classes/listform.inc.php
+
219
−
219
View file @
a9a6b283
...
...
@@ -38,227 +38,227 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class
listform
{
var
$debug
=
0
;
var
$errorMessage
;
var
$debug
=
0
;
var
$errorMessage
;
var
$listDef
;
var
$searchValues
;
var
$pagingHTML
;
var
$pagingValues
;
var
$searchChanged
=
0
;
var
$module
;
var
$searchValues
;
var
$pagingHTML
;
var
$pagingValues
;
var
$searchChanged
=
0
;
var
$module
;
function
loadListDef
(
$file
,
$module
=
''
)
{
global
$app
,
$conf
;
if
(
!
is_file
(
$file
))
die
(
"List-Definition:
$file
not found."
);
include_once
(
$file
);
$this
->
listDef
=
$liste
;
$this
->
module
=
$module
;
return
true
;
}
function
getSearchSQL
(
$sql_where
=
""
)
{
global
$db
;
// Hole Config Variablen
$list_name
=
$this
->
listDef
[
"name"
];
$search_prefix
=
$this
->
listDef
[
"search_prefix"
];
// speichere Suchanfrage
foreach
(
$this
->
listDef
[
"item"
]
as
$i
)
{
$field
=
$i
[
"field"
];
// hat sich die suche gendert
if
(
isset
(
$_REQUEST
[
$search_prefix
.
$field
])
and
$_REQUEST
[
$search_prefix
.
$field
]
!=
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
])
$this
->
searchChanged
=
1
;
// suchfeld in session speichern.
if
(
isset
(
$_REQUEST
[
$search_prefix
.
$field
]))
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
=
$_REQUEST
[
$search_prefix
.
$field
];
if
(
$i
[
"formtype"
]
==
"SELECT"
)
{
if
(
is_array
(
$i
[
'value'
]))
{
$out
=
'<option value=""></option>'
;
foreach
(
$i
[
'value'
]
as
$k
=>
$v
)
{
$selected
=
(
$k
==
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
&&
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
!=
''
)
?
' SELECTED'
:
''
;
$out
.
=
"<option value='
$k
'
$selected
>
$v
</option>
\r\n
"
;
}
}
$this
->
searchValues
[
$search_prefix
.
$field
]
=
$out
;
}
else
{
$this
->
searchValues
[
$search_prefix
.
$field
]
=
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
];
}
}
// Speichere Variablen in Objekt zum spteren einparsen in Template
// $this->searchValues = $_SESSION["search"][$list_name];
foreach
(
$this
->
listDef
[
"item"
]
as
$i
)
{
$field
=
$i
[
"field"
];
if
(
$_REQUEST
[
$search_prefix
.
$field
]
!=
''
)
$sql_where
.
=
"
$field
"
.
$i
[
"op"
]
.
" '"
.
$i
[
"prefix"
]
.
$_REQUEST
[
$search_prefix
.
$field
]
.
$i
[
"suffix"
]
.
"' and"
;
}
if
(
$sql_where
!=
''
)
{
$sql_where
=
substr
(
$sql_where
,
0
,
-
3
);
}
else
{
$sql_where
=
"1"
;
}
return
$sql_where
;
}
function
getPagingSQL
(
$sql_where
=
"1"
)
{
global
$app
,
$conf
;
// Hole Config Variablen
$list_name
=
$this
->
listDef
[
"name"
];
$search_prefix
=
$this
->
listDef
[
"search_prefix"
];
$records_per_page
=
$this
->
listDef
[
"records_per_page"
];
$table
=
$this
->
listDef
[
"table"
];
// setze page auf null, wenn in session nicht gesetzt
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
==
''
)
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
0
;
// setze page auf wert der request variablen "page"
if
(
isset
(
$_REQUEST
[
"page"
]))
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
$_REQUEST
[
"page"
];
// page auf 0 setzen, wenn suche sich gendert hat.
if
(
$this
->
searchChanged
==
1
)
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
0
;
$sql_von
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
*
$records_per_page
;
$record_count
=
$app
->
db
->
queryOneRecord
(
"SELECT count(*) AS anzahl FROM
$table
WHERE
$sql_where
"
);
$pages
=
intval
(
$record_count
[
"anzahl"
]
/
$records_per_page
);
$vars
[
"list_file"
]
=
$this
->
listDef
[
"file"
];
$vars
[
"page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
];
$vars
[
"last_page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
-
1
;
$vars
[
"next_page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
+
1
;
$vars
[
"pages"
]
=
$pages
;
$vars
[
"max_pages"
]
=
$pages
+
1
;
$vars
[
"records_gesamt"
]
=
$record_count
[
"anzahl"
];
$vars
[
"page_params"
]
=
$this
->
listDef
[
"page_params"
];
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
>
0
)
$vars
[
"show_page_back"
]
=
1
;
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
<=
$seiten
-
1
)
$vars
[
"show_page_next"
]
=
1
;
$this
->
pagingValues
=
$vars
;
$this
->
pagingHTML
=
$this
->
getPagingHTML
(
$vars
);
$limit_sql
=
"LIMIT
$sql_von
,
$records_per_page
"
;
return
$limit_sql
;
}
function
getPagingHTML
(
$vars
)
{
global
$app
;
$content
=
'[
<a href="'
.
$vars
[
"list_file"
]
.
'?page=0'
.
$vars
[
"page_params"
]
.
'">|<< </a>]'
;
if
(
$vars
[
"show_page_back"
]
==
1
)
$content
.
=
'[<< <a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"last_page"
]
.
$vars
[
"page_params"
]
.
'">'
.
$app
->
lng
(
'Back'
)
.
'</a>] '
;
$content
.
=
' '
.
$app
->
lng
(
'Page'
)
.
' '
.
$vars
[
"next_page"
]
.
' '
.
$app
->
lng
(
'of'
)
.
' '
.
$vars
[
"max_pages"
]
.
' '
;
if
(
$vars
[
"show_page_next"
]
==
1
)
$content
.
=
'[<a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"next_page"
]
.
$vars
[
"page_params"
]
.
'">'
.
$app
->
lng
(
'Next'
)
.
' >></a>] '
;
$content
.
=
'[<a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"pages"
]
.
$vars
[
"page_params"
]
.
'"> >>|
</a>]'
;
return
$content
;
}
function
getSortSQL
()
{
global
$app
,
$conf
;
// Hole Config Variablen
$sort_field
=
$this
->
listDef
[
"sort_field"
];
$sort_direction
=
$this
->
listDef
[
"sort_direction"
];
$sql_sort
=
''
;
if
(
$sort_field
!=
''
&&
$sort_direction
!=
''
)
{
$sql_sort
=
"ORDER BY
$sort_field
$sort_direction
"
;
}
return
$sql_sort
;
}
function
decode
(
$record
)
{
if
(
is_array
(
$record
))
{
foreach
(
$this
->
listDef
[
"item"
]
as
$field
)
{
$key
=
$field
[
"field"
];
switch
(
$field
[
'datatype'
])
{
case
'VARCHAR'
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
break
;
case
'TEXT'
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
break
;
case
'DATE'
:
if
(
$val
>
0
)
{
$record
[
$key
]
=
date
(
$this
->
dateformat
,
$record
[
$key
]);
}
break
;
case
'INTEGER'
:
$record
[
$key
]
=
intval
(
$record
[
$key
]);
break
;
case
'DOUBLE'
:
$record
[
$key
]
=
$record
[
$key
];
break
;
case
'CURRENCY'
:
$record
[
$key
]
=
number_format
(
$record
[
$key
],
2
,
','
,
''
);
break
;
default
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
}
}
}
return
$record
;
}
function
encode
(
$record
)
{
if
(
is_array
(
$record
))
{
foreach
(
$this
->
listDef
[
"item"
]
as
$field
)
{
$key
=
$field
[
"field"
];
switch
(
$field
[
'datatype'
])
{
case
'VARCHAR'
:
if
(
!
is_array
(
$record
[
$key
]))
{
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
}
else
{
$record
[
$key
]
=
implode
(
$this
->
tableDef
[
$key
][
'separator'
],
$record
[
$key
]);
}
break
;
case
'TEXT'
:
if
(
!
is_array
(
$record
[
$key
]))
{
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
}
else
{
$record
[
$key
]
=
implode
(
$this
->
tableDef
[
$key
][
'separator'
],
$record
[
$key
]);
}
break
;
case
'DATE'
:
if
(
$record
[
$key
]
>
0
)
{
list
(
$tag
,
$monat
,
$jahr
)
=
explode
(
'.'
,
$record
[
$key
]);
$record
[
$key
]
=
mktime
(
0
,
0
,
0
,
$monat
,
$tag
,
$jahr
);
}
break
;
case
'INTEGER'
:
$record
[
$key
]
=
intval
(
$record
[
$key
]);
break
;
case
'DOUBLE'
:
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
break
;
case
'CURRENCY'
:
$record
[
$key
]
=
str_replace
(
","
,
"."
,
$record
[
$key
]);
break
;
}
}
}
return
$record
;
}
global
$app
,
$conf
;
if
(
!
is_file
(
$file
))
die
(
"List-Definition:
$file
not found."
);
include_once
(
$file
);
$this
->
listDef
=
$liste
;
$this
->
module
=
$module
;
return
true
;
}
function
getSearchSQL
(
$sql_where
=
""
)
{
global
$db
;
// Hole Config Variablen
$list_name
=
$this
->
listDef
[
"name"
];
$search_prefix
=
$this
->
listDef
[
"search_prefix"
];
// speichere Suchanfrage
foreach
(
$this
->
listDef
[
"item"
]
as
$i
)
{
$field
=
$i
[
"field"
];
// hat sich die suche gendert
if
(
isset
(
$_REQUEST
[
$search_prefix
.
$field
])
and
$_REQUEST
[
$search_prefix
.
$field
]
!=
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
])
$this
->
searchChanged
=
1
;
// suchfeld in session speichern.
if
(
isset
(
$_REQUEST
[
$search_prefix
.
$field
]))
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
=
$_REQUEST
[
$search_prefix
.
$field
];
if
(
$i
[
"formtype"
]
==
"SELECT"
)
{
if
(
is_array
(
$i
[
'value'
]))
{
$out
=
'<option value=""></option>'
;
foreach
(
$i
[
'value'
]
as
$k
=>
$v
)
{
$selected
=
(
$k
==
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
&&
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
]
!=
''
)
?
' SELECTED'
:
''
;
$out
.
=
"<option value='
$k
'
$selected
>
$v
</option>
\r\n
"
;
}
}
$this
->
searchValues
[
$search_prefix
.
$field
]
=
$out
;
}
else
{
$this
->
searchValues
[
$search_prefix
.
$field
]
=
$_SESSION
[
"search"
][
$list_name
][
$search_prefix
.
$field
];
}
}
// Speichere Variablen in Objekt zum spteren einparsen in Template
// $this->searchValues = $_SESSION["search"][$list_name];
foreach
(
$this
->
listDef
[
"item"
]
as
$i
)
{
$field
=
$i
[
"field"
];
if
(
$_REQUEST
[
$search_prefix
.
$field
]
!=
''
)
$sql_where
.
=
"
$field
"
.
$i
[
"op"
]
.
" '"
.
$i
[
"prefix"
]
.
$_REQUEST
[
$search_prefix
.
$field
]
.
$i
[
"suffix"
]
.
"' and"
;
}
if
(
$sql_where
!=
''
)
{
$sql_where
=
substr
(
$sql_where
,
0
,
-
3
);
}
else
{
$sql_where
=
"1"
;
}
return
$sql_where
;
}
function
getPagingSQL
(
$sql_where
=
"1"
)
{
global
$app
,
$conf
;
// Hole Config Variablen
$list_name
=
$this
->
listDef
[
"name"
];
$search_prefix
=
$this
->
listDef
[
"search_prefix"
];
$records_per_page
=
$this
->
listDef
[
"records_per_page"
];
$table
=
$this
->
listDef
[
"table"
];
// setze page auf null, wenn in session nicht gesetzt
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
==
''
)
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
0
;
// setze page auf wert der request variablen "page"
if
(
isset
(
$_REQUEST
[
"page"
]))
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
$_REQUEST
[
"page"
];
// page auf 0 setzen, wenn suche sich gendert hat.
if
(
$this
->
searchChanged
==
1
)
$_SESSION
[
"search"
][
$list_name
][
"page"
]
=
0
;
$sql_von
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
*
$records_per_page
;
$record_count
=
$app
->
db
->
queryOneRecord
(
"SELECT count(*) AS anzahl FROM
$table
WHERE
$sql_where
"
);
$pages
=
intval
(
$record_count
[
"anzahl"
]
/
$records_per_page
);
$vars
[
"list_file"
]
=
$this
->
listDef
[
"file"
];
$vars
[
"page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
];
$vars
[
"last_page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
-
1
;
$vars
[
"next_page"
]
=
$_SESSION
[
"search"
][
$list_name
][
"page"
]
+
1
;
$vars
[
"pages"
]
=
$pages
;
$vars
[
"max_pages"
]
=
$pages
+
1
;
$vars
[
"records_gesamt"
]
=
$record_count
[
"anzahl"
];
$vars
[
"page_params"
]
=
$this
->
listDef
[
"page_params"
];
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
>
0
)
$vars
[
"show_page_back"
]
=
1
;
if
(
$_SESSION
[
"search"
][
$list_name
][
"page"
]
<=
$seiten
-
1
)
$vars
[
"show_page_next"
]
=
1
;
$this
->
pagingValues
=
$vars
;
$this
->
pagingHTML
=
$this
->
getPagingHTML
(
$vars
);
$limit_sql
=
"LIMIT
$sql_von
,
$records_per_page
"
;
return
$limit_sql
;
}
function
getPagingHTML
(
$vars
)
{
global
$app
;
$content
=
'[<a href="'
.
$vars
[
"list_file"
]
.
'?page=0'
.
$vars
[
"page_params"
]
.
'">|<< </a>]'
;
if
(
$vars
[
"show_page_back"
]
==
1
)
$content
.
=
'[<< <a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"last_page"
]
.
$vars
[
"page_params"
]
.
'">'
.
$app
->
lng
(
'Back'
)
.
'</a>] '
;
$content
.
=
' '
.
$app
->
lng
(
'Page'
)
.
' '
.
$vars
[
"next_page"
]
.
' '
.
$app
->
lng
(
'of'
)
.
' '
.
$vars
[
"max_pages"
]
.
' '
;
if
(
$vars
[
"show_page_next"
]
==
1
)
$content
.
=
'[<a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"next_page"
]
.
$vars
[
"page_params"
]
.
'">'
.
$app
->
lng
(
'Next'
)
.
' >></a>] '
;
$content
.
=
'[<a href="'
.
$vars
[
"list_file"
]
.
'?page='
.
$vars
[
"pages"
]
.
$vars
[
"page_params"
]
.
'"> >>|</a>]'
;
return
$content
;
}
function
getSortSQL
()
{
global
$app
,
$conf
;
// Hole Config Variablen
$sort_field
=
$this
->
listDef
[
"sort_field"
];
$sort_direction
=
$this
->
listDef
[
"sort_direction"
];
$sql_sort
=
''
;
if
(
$sort_field
!=
''
&&
$sort_direction
!=
''
)
{
$sql_sort
=
"ORDER BY
$sort_field
$sort_direction
"
;
}
return
$sql_sort
;
}
function
decode
(
$record
)
{
if
(
is_array
(
$record
))
{
foreach
(
$this
->
listDef
[
"item"
]
as
$field
)
{
$key
=
$field
[
"field"
];
switch
(
$field
[
'datatype'
])
{
case
'VARCHAR'
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
break
;
case
'TEXT'
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
break
;
case
'DATE'
:
if
(
$val
>
0
)
{
$record
[
$key
]
=
date
(
$this
->
dateformat
,
$record
[
$key
]);
}
break
;
case
'INTEGER'
:
$record
[
$key
]
=
intval
(
$record
[
$key
]);
break
;
case
'DOUBLE'
:
$record
[
$key
]
=
$record
[
$key
];
break
;
case
'CURRENCY'
:
$record
[
$key
]
=
number_format
(
$record
[
$key
],
2
,
','
,
''
);
break
;
default
:
$record
[
$key
]
=
stripslashes
(
$record
[
$key
]);
}
}
}
return
$record
;
}
function
encode
(
$record
)
{
if
(
is_array
(
$record
))
{
foreach
(
$this
->
listDef
[
"item"
]
as
$field
)
{
$key
=
$field
[
"field"
];
switch
(
$field
[
'datatype'
])
{
case
'VARCHAR'
:
if
(
!
is_array
(
$record
[
$key
]))
{
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
}
else
{
$record
[
$key
]
=
implode
(
$this
->
tableDef
[
$key
][
'separator'
],
$record
[
$key
]);
}
break
;
case
'TEXT'
:
if
(
!
is_array
(
$record
[
$key
]))
{
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
}
else
{
$record
[
$key
]
=
implode
(
$this
->
tableDef
[
$key
][
'separator'
],
$record
[
$key
]);
}
break
;
case
'DATE'
:
if
(
$record
[
$key
]
>
0
)
{
list
(
$tag
,
$monat
,
$jahr
)
=
explode
(
'.'
,
$record
[
$key
]);
$record
[
$key
]
=
mktime
(
0
,
0
,
0
,
$monat
,
$tag
,
$jahr
);
}
break
;
case
'INTEGER'
:
$record
[
$key
]
=
intval
(
$record
[
$key
]);
break
;
case
'DOUBLE'
:
$record
[
$key
]
=
addslashes
(
$record
[
$key
]);
break
;
case
'CURRENCY'
:
$record
[
$key
]
=
str_replace
(
","
,
"."
,
$record
[
$key
]);
break
;
}
}
}
return
$record
;
}
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
interface/web/dns/templates/soa_list.htm
+
1
−
3
View file @
a9a6b283
<form
name=
"myform"
action=
"soa_list.php"
method=
"POST"
>
<div
class=
"frmTextHead"
><tmpl_var
name=
"list_head_txt"
></div><br
/>
<input
type=
"button"
value=
"{tmpl_var name="
add_new_record_txt
"}"
onClick=
"location.href='soa_edit.php'"
/><br
/><br
/>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"4"
>
...
...
@@ -62,5 +61,4 @@
<tr>
<td
colspan=
"5"
height=
"40"
align=
"center"
class=
"tblFooter"
><tmpl_var
name=
"paging"
></td>
</tr>
</table>
</form>
\ No newline at end of file
</table>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment