ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilExternalFeedBlock.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
include_once(
"./Services/Block/classes/class.ilCustomBlock.php"
);
5
12
class
ilExternalFeedBlock
extends
ilCustomBlock
13
{
17
protected
$db
;
18
22
protected
$log
;
23
24
25
protected
$feed_url
;
26
32
public
function
__construct
($a_id = 0)
33
{
34
global
$DIC
;
35
36
$this->db = $DIC->database();
37
$this->log = $DIC[
"ilLog"
];
38
if
($a_id > 0) {
39
$this->
setId
($a_id);
40
$this->
read
();
41
}
42
}
43
49
public
function
setFeedUrl
($a_feed_url)
50
{
51
$this->feed_url = $a_feed_url;
52
}
53
59
public
function
isFeedUrlLocal
(
$url
)
60
{
61
$host = strtolower(parse_url(
$url
, PHP_URL_HOST));
62
if
(is_int(strpos(
$url
,
".localhost"
)) || trim($host) ==
"localhost"
) {
63
return
true
;
64
}
65
$ip = gethostbyname($host);
66
67
$res
= filter_var(
68
$ip,
69
FILTER_VALIDATE_IP,
70
FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
71
);
72
if
(in_array(
$res
, [
false
,
""
])) {
73
return
true
;
74
}
75
return
false
;
76
}
77
83
public
function
getFeedUrl
()
84
{
85
return
$this->feed_url
;
86
}
87
92
public
function
create
()
93
{
94
$ilDB
=
$this->db
;
95
$ilLog
=
$this->log
;
96
97
parent::create();
98
99
$query
=
"INSERT INTO il_external_feed_block ("
.
100
" id"
.
101
", feed_url"
.
102
" ) VALUES ("
.
103
$ilDB
->quote($this->
getId
(),
"integer"
)
104
.
","
.
$ilDB
->quote($this->
getFeedUrl
(),
"text"
) .
")"
;
105
$ilDB
->manipulate(
$query
);
106
}
107
112
public
function
read
()
113
{
114
$ilDB
=
$this->db
;
115
116
parent::read();
117
118
$query
=
"SELECT * FROM il_external_feed_block WHERE id = "
.
119
$ilDB
->quote($this->
getId
(),
"integer"
);
120
$set =
$ilDB
->query(
$query
);
121
$rec =
$ilDB
->fetchAssoc($set);
122
123
$this->
setFeedUrl
($rec[
"feed_url"
]);
124
}
125
130
public
function
update
()
131
{
132
$ilDB
=
$this->db
;
133
134
parent::update
();
135
136
$query
=
"UPDATE il_external_feed_block SET "
.
137
" feed_url = "
.
$ilDB
->quote($this->
getFeedUrl
(),
"text"
) .
138
" WHERE id = "
.
$ilDB
->quote($this->
getId
(),
"integer"
);
139
140
$ilDB
->manipulate(
$query
);
141
}
142
147
public
function
delete
()
148
{
149
$ilDB
=
$this->db
;
150
151
parent::delete();
152
153
$query
=
"DELETE FROM il_external_feed_block"
.
154
" WHERE id = "
.
$ilDB
->quote($this->
getId
(),
"integer"
);
155
156
$ilDB
->manipulate(
$query
);
157
}
158
}
ilExternalFeedBlock\update
update()
Update item in database.
Definition:
class.ilExternalFeedBlock.php:130
ilExternalFeedBlock\$log
$log
Definition:
class.ilExternalFeedBlock.php:22
ilCustomBlock\getId
getId()
Get Id.
Definition:
class.ilCustomBlock.php:58
ilExternalFeedBlock\$db
$db
Definition:
class.ilExternalFeedBlock.php:17
$DIC
global $DIC
Definition:
saml.php:7
ilCustomBlock\setId
setId($a_id)
Set Id.
Definition:
class.ilCustomBlock.php:48
ilExternalFeedBlock\setFeedUrl
setFeedUrl($a_feed_url)
Set FeedUrl.
Definition:
class.ilExternalFeedBlock.php:49
ilExternalFeedBlock\__construct
__construct($a_id=0)
Constructor.
Definition:
class.ilExternalFeedBlock.php:32
ilExternalFeedBlock\isFeedUrlLocal
isFeedUrlLocal($url)
Check if feed url is local.
Definition:
class.ilExternalFeedBlock.php:59
ilExternalFeedBlock
Custom block for external feeds.
Definition:
class.ilExternalFeedBlock.php:12
ilExternalFeedBlock\getFeedUrl
getFeedUrl()
Get FeedUrl.
Definition:
class.ilExternalFeedBlock.php:83
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$query
$query
Definition:
proxy_ylocal.php:13
$ilLog
$ilLog
Definition:
inc.setup_header.php:129
ilCustomBlock
This is the super class of all custom blocks.
Definition:
class.ilCustomBlock.php:11
ilExternalFeedBlock\read
read()
Read item from database.
Definition:
class.ilExternalFeedBlock.php:112
League\Flysystem\Adapter\Polyfill\update
update($pash, $contents, Config $config)
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilExternalFeedBlock\create
create()
Create new item.
Definition:
class.ilExternalFeedBlock.php:92
$url
$url
Definition:
proxy_ylocal.php:28
ilExternalFeedBlock\$feed_url
$feed_url
Definition:
class.ilExternalFeedBlock.php:25
Services
Block
classes
class.ilExternalFeedBlock.php
Generated on Sat Jan 18 2025 19:01:27 for ILIAS by
1.8.13 (using
Doxyfile
)