]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
rename pocheTool -> pocheTools
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 2 Aug 2013 21:00:57 +0000 (23:00 +0200)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 2 Aug 2013 21:00:57 +0000 (23:00 +0200)
inc/config.php
inc/poche/pocheCore.php
inc/poche/pochePictures.php
inc/poche/pocheTools.class.php [moved from inc/poche/pocheTool.class.php with 94% similarity]

index 65b2b9ccc692b5d4f689ac97fe4698c3729a0de2..58abb5351a723aa1e9dc1beba343dcae0a0a93e1 100644 (file)
@@ -10,6 +10,7 @@
 
 define ('POCHE_VERSION', '0.3');
 define ('MODE_DEMO', FALSE);
+define ('DEBUG_POCHE', TRUE);
 define ('CONVERT_LINKS_FOOTNOTES', FALSE);
 define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
 define ('DOWNLOAD_PICTURES', FALSE);
@@ -24,7 +25,7 @@ $storage_type = 'sqlite'; # sqlite or file
 
 # /!\ Be careful if you change the lines below /!\
 
-require_once 'poche/pocheTool.class.php';
+require_once 'poche/pocheTools.class.php';
 require_once 'poche/pocheCore.php';
 require_once '3rdparty/Readability.php';
 require_once '3rdparty/Encoding.php';
index 52c603ac74608e641f7c83c5070141ec9501e43a..34c15d8419693a66781e1533c0c24cb55c1c568a 100644 (file)
@@ -136,10 +136,16 @@ function fetch_url_content($url)
 
 function display_view($view, $id = 0, $full_head = 'yes')
 {
-    global $tpl, $store, $msg;
+    global $tpl, $store;
 
     switch ($view)
     {
+        case 'install':
+            pocheTool::logm('install mode');
+            break;
+        case 'import';
+            pocheTool::logm('import mode');
+            break;
         case 'export':
             $entries = $store->retrieveAll();
             $tpl->assign('export', pocheTool::renderJson($entries));
@@ -157,8 +163,8 @@ function display_view($view, $id = 0, $full_head = 'yes')
             break;
         case 'view':
             $entry = $store->retrieveOneById($id);
-
             if ($entry != NULL) {
+                pocheTool::logm('view link #' . $id);
                 $tpl->assign('id', $entry['id']);
                 $tpl->assign('url', $entry['url']);
                 $tpl->assign('title', $entry['title']);
@@ -177,12 +183,9 @@ function display_view($view, $id = 0, $full_head = 'yes')
             else {
                 pocheTool::logm('error in view call : entry is NULL');
             }
-
-            pocheTool::logm('view link #' . $id);
             break;
         default: # home view
             $entries = $store->getEntriesByView($view);
-
             $tpl->assign('entries', $entries);
 
             if ($full_head == 'yes') {
@@ -192,7 +195,6 @@ function display_view($view, $id = 0, $full_head = 'yes')
             }
 
             $tpl->draw('entries');
-
             if ($full_head == 'yes') {
                 $tpl->draw('js');
                 $tpl->draw('footer');
@@ -202,11 +204,11 @@ function display_view($view, $id = 0, $full_head = 'yes')
 }
 
 /**
- * Appel d'une action (mark as fav, archive, delete)
+ * Call action (mark as fav, archive, delete, etc.)
  */
 function action_to_do($action, $url, $id = 0)
 {
-    global $store, $msg;
+    global $store;
 
     switch ($action)
     {
index bfc806572183a30f2fde77425530e9dca1d0b6c8..0d73a14985a4ccde25117db59310688af30b2eb2 100644 (file)
@@ -15,11 +15,9 @@ function filtre_picture($content, $url, $id)
 {
     $matches = array();
     preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER);
-    foreach($matches as $i => $link)
-    {
+    foreach($matches as $i => $link) {
         $link[1] = trim($link[1]);
-        if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) )
-        {
+        if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1])) {
             $absolute_path = get_absolute_link($link[2],$url);
             $filename = basename(parse_url($absolute_path, PHP_URL_PATH));
             $directory = create_assets_directory($id);
@@ -36,8 +34,7 @@ function filtre_picture($content, $url, $id)
 /**
  * Retourne le lien absolu
  */
-function get_absolute_link($relative_link, $url)
-{
+function get_absolute_link($relative_link, $url) {
     /* return if already absolute URL */
     if (parse_url($relative_link, PHP_URL_SCHEME) != '') return $relative_link;
 
@@ -68,7 +65,6 @@ function get_absolute_link($relative_link, $url)
 /**
  * Téléchargement des images
  */
-
 function download_pictures($absolute_path, $fullpath)
 {
     $rawdata = get_external_file($absolute_path);
@@ -111,4 +107,4 @@ function remove_directory($directory)
         }
         return rmdir($directory);
     }
-}
+}
\ No newline at end of file
similarity index 94%
rename from inc/poche/pocheTool.class.php
rename to inc/poche/pocheTools.class.php
index cade115e598b811063a5f3df1e832fc0e80088e6..8907c18e384cf74bca7ba4fb6aceadc2ad8b635f 100644 (file)
@@ -118,7 +118,9 @@ class pocheTools
 
     public static function logm($message)
     {
-        $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
-        file_put_contents('./log.txt',$t,FILE_APPEND);
+        if (DEBUG_POCHE) {
+            $t = strval(date('Y/m/d_H:i:s')) . ' - ' . $_SERVER["REMOTE_ADDR"] . ' - ' . strval($message) . "\n";
+            file_put_contents('./log.txt', $t, FILE_APPEND);
+        }
     }
 }
\ No newline at end of file