]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #118 from Alkarex/patch-1
authorSébastien SAUVAGE <sebsauvage@sebsauvage.net>
Tue, 24 Sep 2013 09:07:21 +0000 (02:07 -0700)
committerSébastien SAUVAGE <sebsauvage@sebsauvage.net>
Tue, 24 Sep 2013 09:07:21 +0000 (02:07 -0700)
Corrected error message for lack of write access in ./data

1  2 
index.php

diff --combined index.php
index d3e105f90997352e2c4291b1e409dfb58b07c113,e6d607ee40a01412a0271d583ecb0fb1aa8960f8..8567efb599ea8f99613b15efbe790f95fd4b2b85
+++ b/index.php
@@@ -89,7 -89,7 +89,7 @@@ if (!is_dir($GLOBALS['config']['DATADIR
  if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files.
  if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
  // Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable.
- if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
+ if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('<pre>ERROR: Shaarli does not have the right to write in its data directory ('.realpath($GLOBALS['config']['DATADIR']).').</pre>');
  if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
  {
      if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); }
@@@ -566,7 -566,7 +566,7 @@@ function getHTTP($url,$timeout=30
  {
      try
      {
 -        $options = array('http'=>array('method'=>'GET','timeout' => $timeout)); // Force network timeout
 +        $options = array('http'=>array('method'=>'GET','timeout' => $timeout, 'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0')); // Force network timeout
          $context = stream_context_create($options);
          $data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source.
          if (!$data) { return array('HTTP Error',array(),''); }
@@@ -1538,8 -1538,7 +1538,8 @@@ function renderPage(
              $link_is_new = true;  // This is a new link
              $linkdate = strval(date('Ymd_His'));
              $title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet).
 -            $description=''; $tags=''; $private=0;
 +            $description = (empty($_GET['description']) ? '' : $_GET['description'] )."\n"; // Get description if it was provided in URL (by the bookmarklet). [Bronco added that]
 +            $tags=''; $private=0;
              if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url;
              // If this is an HTTP link, we try go get the page to extact the title (otherwise we will to straight to the edit form.)
              if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http')
@@@ -1696,11 -1695,7 +1696,11 @@@ function importFile(
                  {
                      $attr=$m[1]; $value=$m[2];
                      if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8');
 -                    elseif ($attr=='ADD_DATE') $raw_add_date=intval($value);
 +                    elseif ($attr=='ADD_DATE')
 +                    {
 +                        $raw_add_date=intval($value);
 +                        if ($raw_add_date>30000000000) $raw_add_date/=1000;   //If larger than year 2920, then was likely stored in milliseconds instead of seconds
 +                    }
                      elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1);
                      elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8');
                  }