diff options
author | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-02 23:00:57 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-02 23:00:57 +0200 |
commit | 5ffe5cf541d0d1c7524537b034d0cde3da18f6e7 (patch) | |
tree | 0d551d7e5550514c97741cdc1544a1206214813f /inc | |
parent | 8069e235fd2971675ee5fc05026ffa9bce5cbbb7 (diff) | |
download | wallabag-5ffe5cf541d0d1c7524537b034d0cde3da18f6e7.tar.gz wallabag-5ffe5cf541d0d1c7524537b034d0cde3da18f6e7.tar.zst wallabag-5ffe5cf541d0d1c7524537b034d0cde3da18f6e7.zip |
rename pocheTool -> pocheTools
Diffstat (limited to 'inc')
-rw-r--r-- | inc/config.php | 3 | ||||
-rw-r--r-- | inc/poche/pocheCore.php | 18 | ||||
-rw-r--r-- | inc/poche/pochePictures.php | 12 | ||||
-rw-r--r-- | inc/poche/pocheTools.class.php (renamed from inc/poche/pocheTool.class.php) | 6 |
4 files changed, 20 insertions, 19 deletions
diff --git a/inc/config.php b/inc/config.php index 65b2b9cc..58abb535 100644 --- a/inc/config.php +++ b/inc/config.php | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | define ('POCHE_VERSION', '0.3'); | 11 | define ('POCHE_VERSION', '0.3'); |
12 | define ('MODE_DEMO', FALSE); | 12 | define ('MODE_DEMO', FALSE); |
13 | define ('DEBUG_POCHE', TRUE); | ||
13 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); | 14 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); |
14 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); | 15 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); |
15 | define ('DOWNLOAD_PICTURES', FALSE); | 16 | define ('DOWNLOAD_PICTURES', FALSE); |
@@ -24,7 +25,7 @@ $storage_type = 'sqlite'; # sqlite or file | |||
24 | 25 | ||
25 | # /!\ Be careful if you change the lines below /!\ | 26 | # /!\ Be careful if you change the lines below /!\ |
26 | 27 | ||
27 | require_once 'poche/pocheTool.class.php'; | 28 | require_once 'poche/pocheTools.class.php'; |
28 | require_once 'poche/pocheCore.php'; | 29 | require_once 'poche/pocheCore.php'; |
29 | require_once '3rdparty/Readability.php'; | 30 | require_once '3rdparty/Readability.php'; |
30 | require_once '3rdparty/Encoding.php'; | 31 | require_once '3rdparty/Encoding.php'; |
diff --git a/inc/poche/pocheCore.php b/inc/poche/pocheCore.php index 52c603ac..34c15d84 100644 --- a/inc/poche/pocheCore.php +++ b/inc/poche/pocheCore.php | |||
@@ -136,10 +136,16 @@ function fetch_url_content($url) | |||
136 | 136 | ||
137 | function display_view($view, $id = 0, $full_head = 'yes') | 137 | function display_view($view, $id = 0, $full_head = 'yes') |
138 | { | 138 | { |
139 | global $tpl, $store, $msg; | 139 | global $tpl, $store; |
140 | 140 | ||
141 | switch ($view) | 141 | switch ($view) |
142 | { | 142 | { |
143 | case 'install': | ||
144 | pocheTool::logm('install mode'); | ||
145 | break; | ||
146 | case 'import'; | ||
147 | pocheTool::logm('import mode'); | ||
148 | break; | ||
143 | case 'export': | 149 | case 'export': |
144 | $entries = $store->retrieveAll(); | 150 | $entries = $store->retrieveAll(); |
145 | $tpl->assign('export', pocheTool::renderJson($entries)); | 151 | $tpl->assign('export', pocheTool::renderJson($entries)); |
@@ -157,8 +163,8 @@ function display_view($view, $id = 0, $full_head = 'yes') | |||
157 | break; | 163 | break; |
158 | case 'view': | 164 | case 'view': |
159 | $entry = $store->retrieveOneById($id); | 165 | $entry = $store->retrieveOneById($id); |
160 | |||
161 | if ($entry != NULL) { | 166 | if ($entry != NULL) { |
167 | pocheTool::logm('view link #' . $id); | ||
162 | $tpl->assign('id', $entry['id']); | 168 | $tpl->assign('id', $entry['id']); |
163 | $tpl->assign('url', $entry['url']); | 169 | $tpl->assign('url', $entry['url']); |
164 | $tpl->assign('title', $entry['title']); | 170 | $tpl->assign('title', $entry['title']); |
@@ -177,12 +183,9 @@ function display_view($view, $id = 0, $full_head = 'yes') | |||
177 | else { | 183 | else { |
178 | pocheTool::logm('error in view call : entry is NULL'); | 184 | pocheTool::logm('error in view call : entry is NULL'); |
179 | } | 185 | } |
180 | |||
181 | pocheTool::logm('view link #' . $id); | ||
182 | break; | 186 | break; |
183 | default: # home view | 187 | default: # home view |
184 | $entries = $store->getEntriesByView($view); | 188 | $entries = $store->getEntriesByView($view); |
185 | |||
186 | $tpl->assign('entries', $entries); | 189 | $tpl->assign('entries', $entries); |
187 | 190 | ||
188 | if ($full_head == 'yes') { | 191 | if ($full_head == 'yes') { |
@@ -192,7 +195,6 @@ function display_view($view, $id = 0, $full_head = 'yes') | |||
192 | } | 195 | } |
193 | 196 | ||
194 | $tpl->draw('entries'); | 197 | $tpl->draw('entries'); |
195 | |||
196 | if ($full_head == 'yes') { | 198 | if ($full_head == 'yes') { |
197 | $tpl->draw('js'); | 199 | $tpl->draw('js'); |
198 | $tpl->draw('footer'); | 200 | $tpl->draw('footer'); |
@@ -202,11 +204,11 @@ function display_view($view, $id = 0, $full_head = 'yes') | |||
202 | } | 204 | } |
203 | 205 | ||
204 | /** | 206 | /** |
205 | * Appel d'une action (mark as fav, archive, delete) | 207 | * Call action (mark as fav, archive, delete, etc.) |
206 | */ | 208 | */ |
207 | function action_to_do($action, $url, $id = 0) | 209 | function action_to_do($action, $url, $id = 0) |
208 | { | 210 | { |
209 | global $store, $msg; | 211 | global $store; |
210 | 212 | ||
211 | switch ($action) | 213 | switch ($action) |
212 | { | 214 | { |
diff --git a/inc/poche/pochePictures.php b/inc/poche/pochePictures.php index bfc80657..0d73a149 100644 --- a/inc/poche/pochePictures.php +++ b/inc/poche/pochePictures.php | |||
@@ -15,11 +15,9 @@ function filtre_picture($content, $url, $id) | |||
15 | { | 15 | { |
16 | $matches = array(); | 16 | $matches = array(); |
17 | preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER); | 17 | preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER); |
18 | foreach($matches as $i => $link) | 18 | foreach($matches as $i => $link) { |
19 | { | ||
20 | $link[1] = trim($link[1]); | 19 | $link[1] = trim($link[1]); |
21 | if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) ) | 20 | if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1])) { |
22 | { | ||
23 | $absolute_path = get_absolute_link($link[2],$url); | 21 | $absolute_path = get_absolute_link($link[2],$url); |
24 | $filename = basename(parse_url($absolute_path, PHP_URL_PATH)); | 22 | $filename = basename(parse_url($absolute_path, PHP_URL_PATH)); |
25 | $directory = create_assets_directory($id); | 23 | $directory = create_assets_directory($id); |
@@ -36,8 +34,7 @@ function filtre_picture($content, $url, $id) | |||
36 | /** | 34 | /** |
37 | * Retourne le lien absolu | 35 | * Retourne le lien absolu |
38 | */ | 36 | */ |
39 | function get_absolute_link($relative_link, $url) | 37 | function get_absolute_link($relative_link, $url) { |
40 | { | ||
41 | /* return if already absolute URL */ | 38 | /* return if already absolute URL */ |
42 | if (parse_url($relative_link, PHP_URL_SCHEME) != '') return $relative_link; | 39 | if (parse_url($relative_link, PHP_URL_SCHEME) != '') return $relative_link; |
43 | 40 | ||
@@ -68,7 +65,6 @@ function get_absolute_link($relative_link, $url) | |||
68 | /** | 65 | /** |
69 | * Téléchargement des images | 66 | * Téléchargement des images |
70 | */ | 67 | */ |
71 | |||
72 | function download_pictures($absolute_path, $fullpath) | 68 | function download_pictures($absolute_path, $fullpath) |
73 | { | 69 | { |
74 | $rawdata = get_external_file($absolute_path); | 70 | $rawdata = get_external_file($absolute_path); |
@@ -111,4 +107,4 @@ function remove_directory($directory) | |||
111 | } | 107 | } |
112 | return rmdir($directory); | 108 | return rmdir($directory); |
113 | } | 109 | } |
114 | } | 110 | } \ No newline at end of file |
diff --git a/inc/poche/pocheTool.class.php b/inc/poche/pocheTools.class.php index cade115e..8907c18e 100644 --- a/inc/poche/pocheTool.class.php +++ b/inc/poche/pocheTools.class.php | |||
@@ -118,7 +118,9 @@ class pocheTools | |||
118 | 118 | ||
119 | public static function logm($message) | 119 | public static function logm($message) |
120 | { | 120 | { |
121 | $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n"; | 121 | if (DEBUG_POCHE) { |
122 | file_put_contents('./log.txt',$t,FILE_APPEND); | 122 | $t = strval(date('Y/m/d_H:i:s')) . ' - ' . $_SERVER["REMOTE_ADDR"] . ' - ' . strval($message) . "\n"; |
123 | file_put_contents('./log.txt', $t, FILE_APPEND); | ||
124 | } | ||
123 | } | 125 | } |
124 | } \ No newline at end of file | 126 | } \ No newline at end of file |