diff options
Diffstat (limited to 'inc/poche')
-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 |
3 files changed, 18 insertions, 18 deletions
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 |