X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FpocheCore.php;h=3e32c4a8623660871b4b39538a8be556483f9b36;hb=8cbb2a88024969f7efd90f8053f3b0805fa2f8fa;hp=34c15d8419693a66781e1533c0c24cb55c1c568a;hpb=5ffe5cf541d0d1c7524537b034d0cde3da18f6e7;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/pocheCore.php b/inc/poche/pocheCore.php index 34c15d84..3e32c4a8 100644 --- a/inc/poche/pocheCore.php +++ b/inc/poche/pocheCore.php @@ -93,8 +93,8 @@ function get_external_file($url) function fetch_url_content($url) { $url = base64_decode($url); - if (pocheTool::isUrl($url)) { - $url = pocheTool::cleanURL($url); + if (pocheTools::isUrl($url)) { + $url = pocheTools::cleanURL($url); $html = Encoding::toUTF8(get_external_file($url)); # if get_external_file if not able to retrieve HTTPS content, try the same URL with HTTP protocol @@ -128,29 +128,31 @@ function fetch_url_content($url) } else { #$msg->add('e', _('error during url preparation : the link is not valid')); - pocheTool::logm($url . ' is not a valid url'); + pocheTools::logm($url . ' is not a valid url'); } return FALSE; } -function display_view($view, $id = 0, $full_head = 'yes') +function display_view($view, $id = 0) { global $tpl, $store; + $tpl_vars = array(); + switch ($view) { case 'install': - pocheTool::logm('install mode'); + pocheTools::logm('install mode'); break; case 'import'; - pocheTool::logm('import mode'); + pocheTools::logm('import mode'); break; case 'export': $entries = $store->retrieveAll(); - $tpl->assign('export', pocheTool::renderJson($entries)); + $tpl->assign('export', pocheTools::renderJson($entries)); $tpl->draw('export'); - pocheTool::logm('export view'); + pocheTools::logm('export view'); break; case 'config': $tpl->assign('load_all_js', 0); @@ -159,12 +161,12 @@ function display_view($view, $id = 0, $full_head = 'yes') $tpl->draw('config'); $tpl->draw('js'); $tpl->draw('footer'); - pocheTool::logm('config view'); + pocheTools::logm('config view'); break; case 'view': $entry = $store->retrieveOneById($id); if ($entry != NULL) { - pocheTool::logm('view link #' . $id); + pocheTools::logm('view link #' . $id); $tpl->assign('id', $entry['id']); $tpl->assign('url', $entry['url']); $tpl->assign('title', $entry['title']); @@ -181,26 +183,30 @@ function display_view($view, $id = 0, $full_head = 'yes') $tpl->draw('view'); } else { - pocheTool::logm('error in view call : entry is NULL'); + pocheTools::logm('error in view call : entry is NULL'); } break; default: # home view $entries = $store->getEntriesByView($view); - $tpl->assign('entries', $entries); + $tpl_vars = array( + 'entries' => $entries, + ); - if ($full_head == 'yes') { - $tpl->assign('load_all_js', 1); - $tpl->draw('head'); - $tpl->draw('home'); - } + // if ($full_head == 'yes') { + // $tpl->assign('load_all_js', 1); + // $tpl->draw('head'); + // $tpl->draw('home'); + // } - $tpl->draw('entries'); - if ($full_head == 'yes') { - $tpl->draw('js'); - $tpl->draw('footer'); - } + // $tpl->draw('entries'); + // if ($full_head == 'yes') { + // $tpl->draw('js'); + // $tpl->draw('footer'); + // } break; } + + return $tpl_vars; } /** @@ -215,7 +221,7 @@ function action_to_do($action, $url, $id = 0) case 'add': if($parametres_url = fetch_url_content($url)) { if ($store->add($url, $parametres_url['title'], $parametres_url['content'])) { - pocheTool::logm('add link ' . $url); + pocheTools::logm('add link ' . $url); $last_id = $store->getLastId(); if (DOWNLOAD_PICTURES) { $content = filtre_picture($parametres_url['content'], $url, $last_id); @@ -224,12 +230,12 @@ function action_to_do($action, $url, $id = 0) } else { #$msg->add('e', _('error during insertion : the link wasn\'t added')); - pocheTool::logm('error during insertion : the link wasn\'t added'); + pocheTools::logm('error during insertion : the link wasn\'t added'); } } else { #$msg->add('e', _('error during url preparation : the link wasn\'t added')); - pocheTool::logm('error during content fetch'); + pocheTools::logm('error during content fetch'); } break; case 'delete': @@ -238,20 +244,20 @@ function action_to_do($action, $url, $id = 0) remove_directory(ABS_PATH . $id); } #$msg->add('s', _('the link has been deleted successfully')); - pocheTool::logm('delete link #' . $id); + pocheTools::logm('delete link #' . $id); } else { #$msg->add('e', _('the link wasn\'t deleted')); - pocheTool::logm('error : can\'t delete link #' . $id); + pocheTools::logm('error : can\'t delete link #' . $id); } break; case 'toggle_fav' : $store->favoriteById($id); - pocheTool::logm('mark as favorite link #' . $id); + pocheTools::logm('mark as favorite link #' . $id); break; case 'toggle_archive' : $store->archiveById($id); - pocheTool::logm('archive link #' . $id); + pocheTools::logm('archive link #' . $id); break; default: break;