forked from blamarche/openbookmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmark_refresh.php
77 lines (65 loc) · 2.31 KB
/
bookmark_refresh.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
Refresh bookmarks favicon
@category Bookmarks
@package Openbookmark
@author J. van Oostrum <[email protected]>
@copyright 2010 Brendan LaMarche
@license GNU General Public License version 2
@link https://github.com/blamarche/openbookmark
@link https://github.com/blokkendoos/openbookmark
*/
require_once "./header.php";
logged_in_only();
$bmlist = set_get_num_list('bmlist');
if (count($bmlist) > 0) {
?>
<h2 class="title">Refresh bookmarks favicon:</h2>
<form action="
<?php
echo $_SERVER['SCRIPT_NAME'] . "?folderid=" . $folderid;
?>"
method="POST" name="bookmarksrefresh">
<?php
foreach ($bmlist as $id) {
//DEBUG error_log("bookmark.id: $id");
$query = sprintf(
"SELECT id, url, favicon FROM bookmark WHERE id =%s AND user='%s'",
$mysql->escape($id),
$mysql->escape($username)
);
if ($mysql->query($query)) {
//$row = mysqli_fetch_row($mysql->result)
$row = mysqli_fetch_object($mysql->result);
include_once ABSOLUTE_PATH . "favicon.php";
$favicon = new favicon($row->url);
if (isset($favicon->favicon)) {
// remove the current icon file
if (isset($row->favicon)) {
@unlink($row->favicon);
}
$icon = '<img src="' . $favicon->favicon . '" width="16" height="16" alt="">';
$query = sprintf(
"UPDATE bookmark SET favicon='%s' WHERE id='%d' AND user='%s'",
$mysql->escape($favicon->favicon),
$mysql->escape($id),
$mysql->escape($username)
);
if (!$mysql->query($query)) {
message($mysql->error);
}
}
}
}
?>
<p>Bookmarks favicon refreshed</p><br>
<input type="hidden" name="bmlist">
<input type="button" value=" Ok " onClick="self.close()">
</form>
<script type="text/javascript">
document.bookmarksrefresh.bmlist.value = self.name;
</script>
<?php
}
require_once ABSOLUTE_PATH . "footer.php";
?>