aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/pocheCore.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/pocheCore.php')
-rw-r--r--inc/poche/pocheCore.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/inc/poche/pocheCore.php b/inc/poche/pocheCore.php
index 34c15d84..e68696af 100644
--- a/inc/poche/pocheCore.php
+++ b/inc/poche/pocheCore.php
@@ -93,8 +93,8 @@ function get_external_file($url)
93function fetch_url_content($url) 93function fetch_url_content($url)
94{ 94{
95 $url = base64_decode($url); 95 $url = base64_decode($url);
96 if (pocheTool::isUrl($url)) { 96 if (pocheTools::isUrl($url)) {
97 $url = pocheTool::cleanURL($url); 97 $url = pocheTools::cleanURL($url);
98 $html = Encoding::toUTF8(get_external_file($url)); 98 $html = Encoding::toUTF8(get_external_file($url));
99 99
100 # if get_external_file if not able to retrieve HTTPS content, try the same URL with HTTP protocol 100 # if get_external_file if not able to retrieve HTTPS content, try the same URL with HTTP protocol
@@ -128,7 +128,7 @@ function fetch_url_content($url)
128 } 128 }
129 else { 129 else {
130 #$msg->add('e', _('error during url preparation : the link is not valid')); 130 #$msg->add('e', _('error during url preparation : the link is not valid'));
131 pocheTool::logm($url . ' is not a valid url'); 131 pocheTools::logm($url . ' is not a valid url');
132 } 132 }
133 133
134 return FALSE; 134 return FALSE;
@@ -141,16 +141,16 @@ function display_view($view, $id = 0, $full_head = 'yes')
141 switch ($view) 141 switch ($view)
142 { 142 {
143 case 'install': 143 case 'install':
144 pocheTool::logm('install mode'); 144 pocheTools::logm('install mode');
145 break; 145 break;
146 case 'import'; 146 case 'import';
147 pocheTool::logm('import mode'); 147 pocheTools::logm('import mode');
148 break; 148 break;
149 case 'export': 149 case 'export':
150 $entries = $store->retrieveAll(); 150 $entries = $store->retrieveAll();
151 $tpl->assign('export', pocheTool::renderJson($entries)); 151 $tpl->assign('export', pocheTools::renderJson($entries));
152 $tpl->draw('export'); 152 $tpl->draw('export');
153 pocheTool::logm('export view'); 153 pocheTools::logm('export view');
154 break; 154 break;
155 case 'config': 155 case 'config':
156 $tpl->assign('load_all_js', 0); 156 $tpl->assign('load_all_js', 0);
@@ -159,12 +159,12 @@ function display_view($view, $id = 0, $full_head = 'yes')
159 $tpl->draw('config'); 159 $tpl->draw('config');
160 $tpl->draw('js'); 160 $tpl->draw('js');
161 $tpl->draw('footer'); 161 $tpl->draw('footer');
162 pocheTool::logm('config view'); 162 pocheTools::logm('config view');
163 break; 163 break;
164 case 'view': 164 case 'view':
165 $entry = $store->retrieveOneById($id); 165 $entry = $store->retrieveOneById($id);
166 if ($entry != NULL) { 166 if ($entry != NULL) {
167 pocheTool::logm('view link #' . $id); 167 pocheTools::logm('view link #' . $id);
168 $tpl->assign('id', $entry['id']); 168 $tpl->assign('id', $entry['id']);
169 $tpl->assign('url', $entry['url']); 169 $tpl->assign('url', $entry['url']);
170 $tpl->assign('title', $entry['title']); 170 $tpl->assign('title', $entry['title']);
@@ -181,7 +181,7 @@ function display_view($view, $id = 0, $full_head = 'yes')
181 $tpl->draw('view'); 181 $tpl->draw('view');
182 } 182 }
183 else { 183 else {
184 pocheTool::logm('error in view call : entry is NULL'); 184 pocheTools::logm('error in view call : entry is NULL');
185 } 185 }
186 break; 186 break;
187 default: # home view 187 default: # home view
@@ -215,7 +215,7 @@ function action_to_do($action, $url, $id = 0)
215 case 'add': 215 case 'add':
216 if($parametres_url = fetch_url_content($url)) { 216 if($parametres_url = fetch_url_content($url)) {
217 if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) { 217 if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) {
218 pocheTool::logm('add link ' . $url); 218 pocheTools::logm('add link ' . $url);
219 $last_id = $store->getLastId(); 219 $last_id = $store->getLastId();
220 if (DOWNLOAD_PICTURES) { 220 if (DOWNLOAD_PICTURES) {
221 $content = filtre_picture($parametres_url['content'], $url, $last_id); 221 $content = filtre_picture($parametres_url['content'], $url, $last_id);
@@ -224,12 +224,12 @@ function action_to_do($action, $url, $id = 0)
224 } 224 }
225 else { 225 else {
226 #$msg->add('e', _('error during insertion : the link wasn\'t added')); 226 #$msg->add('e', _('error during insertion : the link wasn\'t added'));
227 pocheTool::logm('error during insertion : the link wasn\'t added'); 227 pocheTools::logm('error during insertion : the link wasn\'t added');
228 } 228 }
229 } 229 }
230 else { 230 else {
231 #$msg->add('e', _('error during url preparation : the link wasn\'t added')); 231 #$msg->add('e', _('error during url preparation : the link wasn\'t added'));
232 pocheTool::logm('error during content fetch'); 232 pocheTools::logm('error during content fetch');
233 } 233 }
234 break; 234 break;
235 case 'delete': 235 case 'delete':
@@ -238,20 +238,20 @@ function action_to_do($action, $url, $id = 0)
238 remove_directory(ABS_PATH . $id); 238 remove_directory(ABS_PATH . $id);
239 } 239 }
240 #$msg->add('s', _('the link has been deleted successfully')); 240 #$msg->add('s', _('the link has been deleted successfully'));
241 pocheTool::logm('delete link #' . $id); 241 pocheTools::logm('delete link #' . $id);
242 } 242 }
243 else { 243 else {
244 #$msg->add('e', _('the link wasn\'t deleted')); 244 #$msg->add('e', _('the link wasn\'t deleted'));
245 pocheTool::logm('error : can\'t delete link #' . $id); 245 pocheTools::logm('error : can\'t delete link #' . $id);
246 } 246 }
247 break; 247 break;
248 case 'toggle_fav' : 248 case 'toggle_fav' :
249 $store->favoriteById($id); 249 $store->favoriteById($id);
250 pocheTool::logm('mark as favorite link #' . $id); 250 pocheTools::logm('mark as favorite link #' . $id);
251 break; 251 break;
252 case 'toggle_archive' : 252 case 'toggle_archive' :
253 $store->archiveById($id); 253 $store->archiveById($id);
254 pocheTool::logm('archive link #' . $id); 254 pocheTools::logm('archive link #' . $id);
255 break; 255 break;
256 default: 256 default:
257 break; 257 break;