diff options
Diffstat (limited to 'application/NetscapeBookmarkUtils.php')
-rw-r--r-- | application/NetscapeBookmarkUtils.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index dd7057f8..84dd2b20 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php | |||
@@ -72,18 +72,20 @@ class NetscapeBookmarkUtils | |||
72 | private static function importStatus( | 72 | private static function importStatus( |
73 | $filename, | 73 | $filename, |
74 | $filesize, | 74 | $filesize, |
75 | $importCount=0, | 75 | $importCount = 0, |
76 | $overwriteCount=0, | 76 | $overwriteCount = 0, |
77 | $skipCount=0, | 77 | $skipCount = 0, |
78 | $duration=0 | 78 | $duration = 0 |
79 | ) | 79 | ) { |
80 | { | ||
81 | $status = sprintf(t('File %s (%d bytes) '), $filename, $filesize); | 80 | $status = sprintf(t('File %s (%d bytes) '), $filename, $filesize); |
82 | if ($importCount == 0 && $overwriteCount == 0 && $skipCount == 0) { | 81 | if ($importCount == 0 && $overwriteCount == 0 && $skipCount == 0) { |
83 | $status .= t('has an unknown file format. Nothing was imported.'); | 82 | $status .= t('has an unknown file format. Nothing was imported.'); |
84 | } else { | 83 | } else { |
85 | $status .= vsprintf( | 84 | $status .= vsprintf( |
86 | t('was successfully processed in %d seconds: %d links imported, %d links overwritten, %d links skipped.'), | 85 | t( |
86 | 'was successfully processed in %d seconds: ' | ||
87 | .'%d links imported, %d links overwritten, %d links skipped.' | ||
88 | ), | ||
87 | [$duration, $importCount, $overwriteCount, $skipCount] | 89 | [$duration, $importCount, $overwriteCount, $skipCount] |
88 | ); | 90 | ); |
89 | } | 91 | } |
@@ -108,7 +110,7 @@ class NetscapeBookmarkUtils | |||
108 | $filesize = $files['filetoupload']['size']; | 110 | $filesize = $files['filetoupload']['size']; |
109 | $data = file_get_contents($files['filetoupload']['tmp_name']); | 111 | $data = file_get_contents($files['filetoupload']['tmp_name']); |
110 | 112 | ||
111 | if (strpos($data, '<!DOCTYPE NETSCAPE-Bookmark-file-1>') === false) { | 113 | if (preg_match('/<!DOCTYPE NETSCAPE-Bookmark-file-1>/i', $data) === 0) { |
112 | return self::importStatus($filename, $filesize); | 114 | return self::importStatus($filename, $filesize); |
113 | } | 115 | } |
114 | 116 | ||
@@ -154,13 +156,13 @@ class NetscapeBookmarkUtils | |||
154 | if (empty($post['privacy']) || $post['privacy'] == 'default') { | 156 | if (empty($post['privacy']) || $post['privacy'] == 'default') { |
155 | // use value from the imported file | 157 | // use value from the imported file |
156 | $private = $bkm['pub'] == '1' ? 0 : 1; | 158 | $private = $bkm['pub'] == '1' ? 0 : 1; |
157 | } else if ($post['privacy'] == 'private') { | 159 | } elseif ($post['privacy'] == 'private') { |
158 | // all imported links are private | 160 | // all imported links are private |
159 | $private = 1; | 161 | $private = 1; |
160 | } else if ($post['privacy'] == 'public') { | 162 | } elseif ($post['privacy'] == 'public') { |
161 | // all imported links are public | 163 | // all imported links are public |
162 | $private = 0; | 164 | $private = 0; |
163 | } | 165 | } |
164 | 166 | ||
165 | $newLink = array( | 167 | $newLink = array( |
166 | 'title' => $bkm['title'], | 168 | 'title' => $bkm['title'], |