aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--application/HttpUtils.php2
-rw-r--r--application/SessionManager.php6
-rw-r--r--doc/md/Download-and-Installation.md32
-rw-r--r--doc/md/Unit-tests.md10
-rw-r--r--tests/SessionManagerTest.php31
-rw-r--r--tests/utils/FakeConfigManager.php12
-rw-r--r--tpl/default/img/apple-touch-icon.pngbin0 -> 18276 bytes
-rw-r--r--tpl/default/includes.html3
9 files changed, 56 insertions, 51 deletions
diff --git a/Makefile b/Makefile
index c2d55946..d659d908 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,6 @@
1# The personal, minimalist, super-fast, database free, bookmarking service. 1# The personal, minimalist, super-fast, database free, bookmarking service.
2# Makefile for PHP code analysis & testing, documentation and release generation 2# Makefile for PHP code analysis & testing, documentation and release generation
3 3
4# Prerequisites:
5# - install Composer, either:
6# - from your distro's package manager;
7# - from the official website (https://getcomposer.org/download/);
8# - install/update test dependencies:
9# $ composer install # 1st setup
10# $ composer update
11# - install Xdebug for PHPUnit code coverage reports:
12# - see http://xdebug.org/docs/install
13# - enable in php.ini
14
15BIN = vendor/bin 4BIN = vendor/bin
16PHP_SOURCE = index.php application tests plugins 5PHP_SOURCE = index.php application tests plugins
17PHP_COMMA_SOURCE = index.php,application,tests,plugins 6PHP_COMMA_SOURCE = index.php,application,tests,plugins
diff --git a/application/HttpUtils.php b/application/HttpUtils.php
index c6181df4..c9371b55 100644
--- a/application/HttpUtils.php
+++ b/application/HttpUtils.php
@@ -76,7 +76,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304)
76 curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); 76 curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
77 77
78 // Max download size management 78 // Max download size management
79 curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024); 79 curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16);
80 curl_setopt($ch, CURLOPT_NOPROGRESS, false); 80 curl_setopt($ch, CURLOPT_NOPROGRESS, false);
81 curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 81 curl_setopt($ch, CURLOPT_PROGRESSFUNCTION,
82 function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes) 82 function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes)
diff --git a/application/SessionManager.php b/application/SessionManager.php
index 3aa4ddfc..71f0b38d 100644
--- a/application/SessionManager.php
+++ b/application/SessionManager.php
@@ -12,12 +12,12 @@ class SessionManager
12 * Constructor 12 * Constructor
13 * 13 *
14 * @param array $session The $_SESSION array (reference) 14 * @param array $session The $_SESSION array (reference)
15 * @param ConfigManager $conf ConfigManager instance (reference) 15 * @param ConfigManager $conf ConfigManager instance
16 */ 16 */
17 public function __construct(& $session, & $conf) 17 public function __construct(& $session, $conf)
18 { 18 {
19 $this->session = &$session; 19 $this->session = &$session;
20 $this->conf = &$conf; 20 $this->conf = $conf;
21 } 21 }
22 22
23 /** 23 /**
diff --git a/doc/md/Download-and-Installation.md b/doc/md/Download-and-Installation.md
index be848c97..e64d1a43 100644
--- a/doc/md/Download-and-Installation.md
+++ b/doc/md/Download-and-Installation.md
@@ -17,40 +17,44 @@ Using one of the following methods:
17- by cloning the Git repository 17- by cloning the Git repository
18- using Docker: [see the documentation](docker/shaarli-images) 18- using Docker: [see the documentation](docker/shaarli-images)
19 19
20--- 20--------------------------------------------------------------------------------
21 21
22## Latest release (recommended) 22## Latest release (recommended)
23
23### Download as an archive 24### Download as an archive
24Get the latest released version from the [releases](https://github.com/shaarli/Shaarli/releases) page.
25 25
26**Download our *shaarli-full* archive** to include dependencies. 26In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. **Download our *shaarli-full* archive** to include dependencies.
27 27
28The current latest released version is `v0.9.1` 28The current latest released version is `v0.9.1`
29 29
30Or in command lines:
31
32```bash 30```bash
33$ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.1/shaarli-v0.9.1-full.zip 31$ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.1/shaarli-v0.9.1-full.zip
34$ unzip shaarli-v0.9.1-full.zip 32$ unzip shaarli-v0.9.1-full.zip
35$ mv Shaarli /path/to/shaarli/ 33$ mv Shaarli /path/to/shaarli/
36``` 34```
37 35
38In most cases, download Shaarli from the [releases](https://github.com/shaarli/Shaarli/releases) page.
39Cloning using `git` or downloading Github branches as zip files requires additional steps (see below).
40
41### Using git 36### Using git
42 37
38Cloning using `git` or downloading Github branches as zip files requires additional steps:
39
40 * Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
41 * Install [python3-virtualenv](https://pypi.python.org/pypi/virtualenv) to build the local HTML documentation.
42
43``` 43```
44$ mkdir -p /path/to/shaarli && cd /path/to/shaarli/ 44$ mkdir -p /path/to/shaarli && cd /path/to/shaarli/
45$ git clone -b latest https://github.com/shaarli/Shaarli.git . 45$ git clone -b latest https://github.com/shaarli/Shaarli.git .
46$ composer install --no-dev --prefer-dist 46$ composer install --no-dev --prefer-dist
47$ make translate 47$ make translate
48$ make htmldoc
48``` 49```
49 50
51--------------------------------------------------------------------------------
52
50## Stable version 53## Stable version
51 54
52The stable version has been experienced by Shaarli users, and will receive security updates. 55The stable version has been experienced by Shaarli users, and will receive security updates.
53 56
57
54### Download as an archive 58### Download as an archive
55 59
56As a .zip archive: 60As a .zip archive:
@@ -69,9 +73,9 @@ $ tar xvf stable.tar.gz
69$ mv Shaarli-stable /path/to/shaarli/ 73$ mv Shaarli-stable /path/to/shaarli/
70``` 74```
71 75
72### Clone with Git 76### Using git
73 77
74[Composer](https://getcomposer.org/) is required to build a functional Shaarli installation when pulling from git. 78Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
75 79
76```bash 80```bash
77$ git clone https://github.com/shaarli/Shaarli.git -b stable /path/to/shaarli/ 81$ git clone https://github.com/shaarli/Shaarli.git -b stable /path/to/shaarli/
@@ -80,10 +84,15 @@ $ cd /path/to/shaarli/
80$ composer install --no-dev --prefer-dist 84$ composer install --no-dev --prefer-dist
81``` 85```
82 86
87
88--------------------------------------------------------------------------------
89
83## Development version (mainline) 90## Development version (mainline)
84 91
85_Use at your own risk!_ 92_Use at your own risk!_
86 93
94Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
95
87To get the latest changes from the `master` branch: 96To get the latest changes from the `master` branch:
88 97
89```bash 98```bash
@@ -93,8 +102,11 @@ $ git clone https://github.com/shaarli/Shaarli.git -b master /path/to/shaarli/
93$ cd /path/to/shaarli 102$ cd /path/to/shaarli
94$ composer install --no-dev --prefer-dist 103$ composer install --no-dev --prefer-dist
95$ make translate 104$ make translate
105$ make htmldoc
96``` 106```
97 107
108-------------------------------------------------------------------------------
109
98## Finish Installation 110## Finish Installation
99 111
100Once Shaarli is downloaded and files have been placed at the correct location, open it this location your favorite browser. 112Once Shaarli is downloaded and files have been placed at the correct location, open it this location your favorite browser.
diff --git a/doc/md/Unit-tests.md b/doc/md/Unit-tests.md
index d200634f..f6030d5c 100644
--- a/doc/md/Unit-tests.md
+++ b/doc/md/Unit-tests.md
@@ -2,12 +2,12 @@
2 2
3The framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool. 3The framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool.
4 4
5Regarding Composer, you can either use: 5### Install composer
6 6
7- a system-wide version, e.g. installed through your distro's package manager 7You can either use:
8- a local version, downloadable [here](https://getcomposer.org/download/)
9 8
10#### Sample usage 9- a system-wide version, e.g. installed through your distro's package manager
10- a local version, downloadable [here](https://getcomposer.org/download/).
11 11
12```bash 12```bash
13# system-wide version 13# system-wide version
@@ -29,6 +29,8 @@ $ composer update
29 29
30#### Install and enable Xdebug to generate PHPUnit coverage reports 30#### Install and enable Xdebug to generate PHPUnit coverage reports
31 31
32See http://xdebug.org/docs/install
33
32For Debian-based distros: 34For Debian-based distros:
33```bash 35```bash
34$ aptitude install php5-xdebug 36$ aptitude install php5-xdebug
diff --git a/tests/SessionManagerTest.php b/tests/SessionManagerTest.php
index a92c3ccc..aa75962a 100644
--- a/tests/SessionManagerTest.php
+++ b/tests/SessionManagerTest.php
@@ -1,4 +1,6 @@
1<?php 1<?php
2require_once 'tests/utils/FakeConfigManager.php';
3
2// Initialize reference data _before_ PHPUnit starts a session 4// Initialize reference data _before_ PHPUnit starts a session
3require_once 'tests/utils/ReferenceSessionIdHashes.php'; 5require_once 'tests/utils/ReferenceSessionIdHashes.php';
4ReferenceSessionIdHashes::genAllHashes(); 6ReferenceSessionIdHashes::genAllHashes();
@@ -8,18 +10,6 @@ use \PHPUnit\Framework\TestCase;
8 10
9 11
10/** 12/**
11 * Fake ConfigManager
12 */
13class FakeConfigManager
14{
15 public static function get($key)
16 {
17 return $key;
18 }
19}
20
21
22/**
23 * Test coverage for SessionManager 13 * Test coverage for SessionManager
24 */ 14 */
25class SessionManagerTest extends TestCase 15class SessionManagerTest extends TestCase
@@ -27,12 +17,16 @@ class SessionManagerTest extends TestCase
27 // Session ID hashes 17 // Session ID hashes
28 protected static $sidHashes = null; 18 protected static $sidHashes = null;
29 19
20 // Fake ConfigManager
21 protected static $conf = null;
22
30 /** 23 /**
31 * Assign reference data 24 * Assign reference data
32 */ 25 */
33 public static function setUpBeforeClass() 26 public static function setUpBeforeClass()
34 { 27 {
35 self::$sidHashes = ReferenceSessionIdHashes::getHashes(); 28 self::$sidHashes = ReferenceSessionIdHashes::getHashes();
29 self::$conf = new FakeConfigManager();
36 } 30 }
37 31
38 /** 32 /**
@@ -41,8 +35,7 @@ class SessionManagerTest extends TestCase
41 public function testGenerateToken() 35 public function testGenerateToken()
42 { 36 {
43 $session = []; 37 $session = [];
44 $conf = new FakeConfigManager(); 38 $sessionManager = new SessionManager($session, self::$conf);
45 $sessionManager = new SessionManager($session, $conf);
46 39
47 $token = $sessionManager->generateToken(); 40 $token = $sessionManager->generateToken();
48 41
@@ -61,9 +54,7 @@ class SessionManagerTest extends TestCase
61 $token => 1, 54 $token => 1,
62 ], 55 ],
63 ]; 56 ];
64 $conf = new FakeConfigManager(); 57 $sessionManager = new SessionManager($session, self::$conf);
65 $sessionManager = new SessionManager($session, $conf);
66
67 58
68 // check and destroy the token 59 // check and destroy the token
69 $this->assertTrue($sessionManager->checkToken($token)); 60 $this->assertTrue($sessionManager->checkToken($token));
@@ -79,8 +70,7 @@ class SessionManagerTest extends TestCase
79 public function testGenerateAndCheckToken() 70 public function testGenerateAndCheckToken()
80 { 71 {
81 $session = []; 72 $session = [];
82 $conf = new FakeConfigManager(); 73 $sessionManager = new SessionManager($session, self::$conf);
83 $sessionManager = new SessionManager($session, $conf);
84 74
85 $token = $sessionManager->generateToken(); 75 $token = $sessionManager->generateToken();
86 76
@@ -102,8 +92,7 @@ class SessionManagerTest extends TestCase
102 public function testCheckInvalidToken() 92 public function testCheckInvalidToken()
103 { 93 {
104 $session = []; 94 $session = [];
105 $conf = new FakeConfigManager(); 95 $sessionManager = new SessionManager($session, self::$conf);
106 $sessionManager = new SessionManager($session, $conf);
107 96
108 $this->assertFalse($sessionManager->checkToken('4dccc3a45ad9d03e5542b90c37d8db6d10f2b38b')); 97 $this->assertFalse($sessionManager->checkToken('4dccc3a45ad9d03e5542b90c37d8db6d10f2b38b'));
109 } 98 }
diff --git a/tests/utils/FakeConfigManager.php b/tests/utils/FakeConfigManager.php
new file mode 100644
index 00000000..f29760cb
--- /dev/null
+++ b/tests/utils/FakeConfigManager.php
@@ -0,0 +1,12 @@
1<?php
2
3/**
4 * Fake ConfigManager
5 */
6class FakeConfigManager
7{
8 public static function get($key)
9 {
10 return $key;
11 }
12}
diff --git a/tpl/default/img/apple-touch-icon.png b/tpl/default/img/apple-touch-icon.png
new file mode 100644
index 00000000..f29210ce
--- /dev/null
+++ b/tpl/default/img/apple-touch-icon.png
Binary files differ
diff --git a/tpl/default/includes.html b/tpl/default/includes.html
index 80c08333..b2bfec30 100644
--- a/tpl/default/includes.html
+++ b/tpl/default/includes.html
@@ -5,6 +5,7 @@
5<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" /> 5<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" />
6<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" /> 6<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" />
7<link href="img/favicon.png" rel="shortcut icon" type="image/png" /> 7<link href="img/favicon.png" rel="shortcut icon" type="image/png" />
8<link href="img/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180" />
8<link type="text/css" rel="stylesheet" href="css/pure.min.css?v={$version_hash}" /> 9<link type="text/css" rel="stylesheet" href="css/pure.min.css?v={$version_hash}" />
9<link type="text/css" rel="stylesheet" href="css/grids-responsive.min.css?v={$version_hash}"> 10<link type="text/css" rel="stylesheet" href="css/grids-responsive.min.css?v={$version_hash}">
10<link type="text/css" rel="stylesheet" href="css/pure-extras.css?v={$version_hash}"> 11<link type="text/css" rel="stylesheet" href="css/pure-extras.css?v={$version_hash}">
@@ -17,4 +18,4 @@
17{loop="$plugins_includes.css_files"} 18{loop="$plugins_includes.css_files"}
18 <link type="text/css" rel="stylesheet" href="{$value}?v={$version_hash}#"/> 19 <link type="text/css" rel="stylesheet" href="{$value}?v={$version_hash}#"/>
19{/loop} 20{/loop}
20<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle}"/> \ No newline at end of file 21<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle}"/>