diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/md/Copy-an-existing-installation-over-SSH-and-serve-it-locally.md | 66 | ||||
-rw-r--r-- | doc/md/Create-and-serve-multiple-Shaarlis-(farm).md | 57 | ||||
-rw-r--r-- | doc/md/Download-CSS-styles-from-an-OPML-list.md | 154 | ||||
-rw-r--r-- | doc/md/Example-patch---add-new-via-field-for-links.md | 189 | ||||
-rw-r--r-- | doc/md/Various-hacks.md (renamed from doc/md/Datastore-hacks.md) | 10 | ||||
-rw-r--r-- | doc/md/_Sidebar.md | 45 |
6 files changed, 9 insertions, 512 deletions
diff --git a/doc/md/Copy-an-existing-installation-over-SSH-and-serve-it-locally.md b/doc/md/Copy-an-existing-installation-over-SSH-and-serve-it-locally.md deleted file mode 100644 index 7583c9ea..00000000 --- a/doc/md/Copy-an-existing-installation-over-SSH-and-serve-it-locally.md +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | Example bash script: | ||
2 | |||
3 | ```bash | ||
4 | #!/bin/bash | ||
5 | #Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli | ||
6 | #Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally. | ||
7 | #Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli | ||
8 | #Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed | ||
9 | #Usage: ./local-shaarli.sh | ||
10 | #Author: nodiscc (nodiscc@gmail.com) | ||
11 | #License: MIT (http://opensource.org/licenses/MIT) | ||
12 | set -o errexit | ||
13 | set -o nounset | ||
14 | |||
15 | ##### CONFIG ################# | ||
16 | #The port used by php's local server | ||
17 | php_local_port=7431 | ||
18 | |||
19 | #Name of the SSH server and path where Shaarli is installed | ||
20 | #TODO: pass these as command-line arguments | ||
21 | remotehost="my.ssh.server" | ||
22 | remote_shaarli_dir="/var/www/shaarli" | ||
23 | |||
24 | |||
25 | ###### FUNCTIONS ############# | ||
26 | _main() { | ||
27 | _CBSyncShaarli | ||
28 | _CBServeShaarli | ||
29 | } | ||
30 | |||
31 | _CBSyncShaarli() { | ||
32 | remote_temp_dir=$(ssh $remotehost mktemp -d) | ||
33 | remote_ssh_user=$(ssh $remotehost whoami) | ||
34 | ssh -t "$remotehost" sudo cp -r "$remote_shaarli_dir" "$remote_temp_dir" | ||
35 | ssh -t "$remotehost" sudo chown -R "$remote_ssh_user":"$remote_ssh_user" "$remote_temp_dir" | ||
36 | scp -rq "$remotehost":"$remote_temp_dir" local-shaarli | ||
37 | ssh "$remotehost" rm -r "$remote_temp_dir" | ||
38 | } | ||
39 | |||
40 | _CBServeShaarli() { | ||
41 | #TODO: allow serving a previously downloaded Shaarli | ||
42 | #TODO: ask before overwriting local copy, if it exists | ||
43 | cd local-shaarli/ | ||
44 | php -S localhost:${php_local_port} | ||
45 | echo "Please go to http://localhost:${php_local_port}" | ||
46 | } | ||
47 | |||
48 | |||
49 | ##### MAIN ################# | ||
50 | |||
51 | _main | ||
52 | ``` | ||
53 | |||
54 | This outputs: | ||
55 | |||
56 | ```bash | ||
57 | $ ./local-shaarli.sh | ||
58 | PHP 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014 | ||
59 | Listening on http://localhost:7431 | ||
60 | Document root is /home/user/local-shaarli/shaarli | ||
61 | Press Ctrl-C to quit. | ||
62 | |||
63 | [Mon Sep 1 21:56:27 2014] ::1:57868 [200]: / | ||
64 | [Mon Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html | ||
65 | [Mon Sep 1 21:56:37 2014] ::1:57881 [200]: /... | ||
66 | ``` | ||
diff --git a/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md b/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md deleted file mode 100644 index d0d812a3..00000000 --- a/doc/md/Create-and-serve-multiple-Shaarlis-(farm).md +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | Example bash script (creates multiple shaarli instances and generates an HTML index of them) | ||
2 | |||
3 | ```bash | ||
4 | #!/bin/bash | ||
5 | set -o errexit | ||
6 | set -o nounset | ||
7 | |||
8 | #config | ||
9 | shaarli_base_dir='/var/www/shaarli' | ||
10 | accounts='bob john whatever username' | ||
11 | shaarli_repo_url='https://github.com/shaarli/Shaarli' | ||
12 | ref="master" | ||
13 | |||
14 | #clone multiple shaarli instances | ||
15 | if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi | ||
16 | |||
17 | for account in $accounts; do | ||
18 | if [ -d "$shaarli_base_dir/$account" ]; | ||
19 | then echo "[info] account $account already exists, skipping"; | ||
20 | else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi | ||
21 | done | ||
22 | |||
23 | #generate html index of shaarlis | ||
24 | htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
25 | <!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ --> | ||
26 | <html lang="en"> | ||
27 | <head> | ||
28 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> | ||
29 | <title>My Shaarli farm</title> | ||
30 | <style>body {font-family: "Open Sans"}</style> | ||
31 | </head> | ||
32 | <body> | ||
33 | <div> | ||
34 | <h1>My Shaarli farm</h1> | ||
35 | <ul style="list-style-type: none;">' | ||
36 | |||
37 | accountlinks='' | ||
38 | |||
39 | htmlfooter=' | ||
40 | </ul> | ||
41 | </div> | ||
42 | </body> | ||
43 | </html>' | ||
44 | |||
45 | |||
46 | |||
47 | for account in $accounts; do accountlinks="$accountlinks\n<li><a href=\"$account\">$account</a></li>"; done | ||
48 | if [ -d "$shaarli_base_dir/index.html" ]; then echo "[removing old index.html]"; rm "$shaarli_base_dir/index.html" ]; fi | ||
49 | echo "[info] generating new index of shaarlis" | ||
50 | echo -e "$htmlhead $accountlinks $htmlfooter" > "$shaarli_base_dir/index.html" | ||
51 | echo '[info] done.' | ||
52 | echo "[info] list of accounts: $accounts" | ||
53 | echo "[info] contents of $shaarli_base_dir:" | ||
54 | tree -a -L 1 "$shaarli_base_dir" | ||
55 | ``` | ||
56 | |||
57 | This script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like [Ansible](https://www.ansible.com/) \ No newline at end of file | ||
diff --git a/doc/md/Download-CSS-styles-from-an-OPML-list.md b/doc/md/Download-CSS-styles-from-an-OPML-list.md deleted file mode 100644 index 26b7fb3e..00000000 --- a/doc/md/Download-CSS-styles-from-an-OPML-list.md +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | ###Download CSS styles for shaarlis listed in an opml file | ||
2 | Example php script: | ||
3 | |||
4 | ```php | ||
5 | <!---- ?php --> | ||
6 | <!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) --> | ||
7 | <!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) --> | ||
8 | |||
9 | /** | ||
10 | * Source: https://github.com/Riduidel | ||
11 | * Download css styles for shaarlis listed in an opml file | ||
12 | */ | ||
13 | define("SHAARLI_RSS_OPML", "https://www.ecirtam.net/shaarlirss/custom/people.opml"); | ||
14 | |||
15 | define("THEMES_TEMP_FOLDER", "new_themes"); | ||
16 | |||
17 | if(!file_exists(THEMES_TEMP_FOLDER)) { | ||
18 | mkdir(THEMES_TEMP_FOLDER); | ||
19 | } | ||
20 | |||
21 | function siteUrl($pathInSite) { | ||
22 | $indexPos = strpos($pathInSite, "index.php"); | ||
23 | if(!$indexPos) { | ||
24 | return $pathInSite; | ||
25 | } else { | ||
26 | return substr($pathInSite, 0, $indexPos); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | function createShaarliHashFromOPMLL($opmlFile) { | ||
31 | $result = array(); | ||
32 | $opml = file_get_contents($opmlFile); | ||
33 | $opmlXml = simplexml_load_string($opml); | ||
34 | $outlineElements = $opmlXml->xpath("body/outline"); | ||
35 | foreach($outlineElements as $site) { | ||
36 | $siteUrl = siteUrl((string) $site['htmlUrl']); | ||
37 | $result[$siteUrl]=((string) $site['text']); | ||
38 | } | ||
39 | return $result; | ||
40 | } | ||
41 | |||
42 | function getSiteFolder($url) { | ||
43 | $domain = parse_url($url, PHP_URL_HOST); | ||
44 | return THEMES_TEMP_FOLDER."/".str_replace(".", "_", $domain); | ||
45 | } | ||
46 | |||
47 | function get_http_response_code($theURL) { | ||
48 | $headers = get_headers($theURL); | ||
49 | return substr($headers[0], 9, 3); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * This makes the code PHP-5 only (particularly the call to "get_headers") | ||
54 | */ | ||
55 | function copyUserStyleFrom($url, $name, $knownStyles) { | ||
56 | $userStyle = $url."inc/user.css"; | ||
57 | if(in_array($url, $knownStyles)) { | ||
58 | // TODO add log message | ||
59 | } else { | ||
60 | $statusCode = get_http_response_code($userStyle); | ||
61 | if(intval($statusCode)<300) { | ||
62 | $styleSheet = file_get_contents($userStyle); | ||
63 | $siteFolder = getSiteFolder($url); | ||
64 | if(!file_exists($siteFolder)) { | ||
65 | mkdir($siteFolder); | ||
66 | } | ||
67 | if(!file_exists($siteFolder.'/user.css')) { | ||
68 | // Copy stylesheet | ||
69 | file_put_contents($siteFolder.'/user.css', $styleSheet); | ||
70 | } | ||
71 | if(!file_exists($siteFolder.'/README.md')) { | ||
72 | // Then write a readme.md file | ||
73 | file_put_contents($siteFolder.'/README.md', | ||
74 | "User style from ".$name."\n" | ||
75 | ."=============================" | ||
76 | ."\n\n" | ||
77 | ."This stylesheet was downloaded from ".$userStyle." on ".date(DATE_RFC822) | ||
78 | ); | ||
79 | } | ||
80 | if(!file_exists($siteFolder.'/config.ini')) { | ||
81 | // Write a config file containing useful informations | ||
82 | file_put_contents($siteFolder.'/config.ini', | ||
83 | "site_url=".$url."\n" | ||
84 | ."site_name=".$name."\n" | ||
85 | ); | ||
86 | } | ||
87 | if(!file_exists($siteFolder.'/home.png')) { | ||
88 | // And finally copy generated thumbnail | ||
89 | $homeThumb = $siteFolder.'/home.png'; | ||
90 | file_put_contents($siteFolder.'/home.png', file_get_contents(getThumbnailUrl($url))); | ||
91 | } | ||
92 | echo 'Theme have been downloaded from <a href="'.$url.'">'.$url.'</a> into '.$siteFolder | ||
93 | .'. It looks like <img src="'.$homeThumb.'"><br/>'; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | |||
98 | function getThumbnailUrl($url) { | ||
99 | return 'http://api.webthumbnail.org/?url='.$url; | ||
100 | } | ||
101 | |||
102 | function copyUserStylesFrom($urlToNames, $knownStyles) { | ||
103 | foreach($urlToNames as $url => $name) { | ||
104 | copyUserStyleFrom($url, $name, $knownStyles); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /** | ||
109 | * Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/ | ||
110 | * @param directory the directory we want to list files of | ||
111 | * @return a simple array containing the list of absolute file paths. Notice that current file (".") and parent one("..") | ||
112 | * are not listed here | ||
113 | */ | ||
114 | function getDirectoryList ($directory) { | ||
115 | $realPath = realpath($directory); | ||
116 | // create an array to hold directory list | ||
117 | $results = array(); | ||
118 | // create a handler for the directory | ||
119 | $handler = opendir($directory); | ||
120 | // open directory and walk through the filenames | ||
121 | while ($file = readdir($handler)) { | ||
122 | // if file isn't this directory or its parent, add it to the results | ||
123 | if ($file != "." && $file != "..") { | ||
124 | $results[] = realpath($realPath . "/" . $file); | ||
125 | } | ||
126 | } | ||
127 | // tidy up: close the handler | ||
128 | closedir($handler); | ||
129 | // done! | ||
130 | return $results; | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * Start in themes folder and look in all subfolders for config.ini files. | ||
135 | * These config.ini files allow us not to download styles again and again | ||
136 | */ | ||
137 | function findKnownStyles() { | ||
138 | $result = array(); | ||
139 | $subFolders = getDirectoryList("themes"); | ||
140 | foreach($subFolders as $folder) { | ||
141 | $configFile = $folder."/config.ini"; | ||
142 | if(file_exists($configFile)) { | ||
143 | $iniParameters = parse_ini_file($configFile); | ||
144 | array_push($result, $iniParameters['site_url']); | ||
145 | } | ||
146 | } | ||
147 | return $result; | ||
148 | } | ||
149 | |||
150 | $knownStyles = findKnownStyles(); | ||
151 | copyUserStylesFrom(createShaarliHashFromOPMLL(SHAARLI_RSS_OPML), $knownStyles); | ||
152 | |||
153 | <!--- ? ----> | ||
154 | ``` \ No newline at end of file | ||
diff --git a/doc/md/Example-patch---add-new-via-field-for-links.md b/doc/md/Example-patch---add-new-via-field-for-links.md deleted file mode 100644 index d84ef25a..00000000 --- a/doc/md/Example-patch---add-new-via-field-for-links.md +++ /dev/null | |||
@@ -1,189 +0,0 @@ | |||
1 | Example patch to add a new field ("via") for links, an input field to set the "via" property from the "edit link" dialog, and display the "via" field in the link list display. **Untested, use at your own risk** | ||
2 | |||
3 | Thanks to @Knah-Tsaeb in https://github.com/sebsauvage/Shaarli/pull/158 | ||
4 | |||
5 | ``` | ||
6 | From e0f363c18e8fe67990ed2bb1a08652e24e70bbcb Mon Sep 17 00:00:00 2001 | ||
7 | From: Knah Tsaeb <knah-tsaeb@knah-tsaeb.org> | ||
8 | Date: Fri, 11 Oct 2013 15:18:37 +0200 | ||
9 | Subject: [PATCH] Add a "via"/origin property for links, add new input in "edit link" dialog | ||
10 | Thanks to: | ||
11 | * https://github.com/Knah-Tsaeb/Shaarli/commit/040eb18ec8cdabd5ea855e108f81f97fbf0478c4 | ||
12 | * https://github.com/Knah-Tsaeb/Shaarli/commit/4123658eae44d7564d1128ce52ddd5689efee813 | ||
13 | * https://github.com/Knah-Tsaeb/Shaarli/commit/f1a8ca9cc8fe49b119d51b2d8382cc1a34542f96 | ||
14 | |||
15 | --- | ||
16 | index.php | 43 ++++++++++++++++++++++++++++++++----------- | ||
17 | tpl/editlink.html | 1 + | ||
18 | tpl/linklist.html | 1 + | ||
19 | 3 files changed, 34 insertions(+), 11 deletions(-) | ||
20 | |||
21 | diff --git a/index.php b/index.php | ||
22 | index 6fae2f8..53f798e 100644 | ||
23 | --- a/index.php | ||
24 | +++ b/index.php | ||
25 | @@ -436,6 +436,12 @@ if (isset($_POST['login'])) | ||
26 | // ------------------------------------------------------------------------------------------ | ||
27 | // Misc utility functions: | ||
28 | |||
29 | +// Try to get just domain for @via | ||
30 | +function getJustDomain($url){ | ||
31 | + $parts = parse_url($url); | ||
32 | + return trim($parts['host']); | ||
33 | + } | ||
34 | + | ||
35 | // Returns the server URL (including port and http/https), without path. | ||
36 | // e.g. "http://myserver.com:8080" | ||
37 | // You can append $_SERVER['SCRIPT_NAME'] to get the current script URL. | ||
38 | @@ -799,7 +805,8 @@ class linkdb implements Iterator, Countable, ArrayAccess | ||
39 | $found= (strpos(strtolower($l['title']),$s)!==false) | ||
40 | || (strpos(strtolower($l['description']),$s)!==false) | ||
41 | || (strpos(strtolower($l['url']),$s)!==false) | ||
42 | - || (strpos(strtolower($l['tags']),$s)!==false); | ||
43 | + || (strpos(strtolower($l['tags']),$s)!==false) | ||
44 | + || (!empty($l['via']) && (strpos(strtolower($l['via']),$s)!==false)); | ||
45 | if ($found) $filtered[$l['linkdate']] = $l; | ||
46 | } | ||
47 | krsort($filtered); | ||
48 | @@ -814,7 +821,7 @@ class linkdb implements Iterator, Countable, ArrayAccess | ||
49 | $t = str_replace(',',' ',($casesensitive?$tags:strtolower($tags))); | ||
50 | $searchtags=explode(' ',$t); | ||
51 | $filtered=array(); | ||
52 | - foreach($this->links as $l) | ||
53 | + foreach($this-> links as $l) | ||
54 | { | ||
55 | $linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags']))); | ||
56 | if (count(array_intersect($linktags,$searchtags)) == count($searchtags)) | ||
57 | @@ -905,7 +912,7 @@ function showRSS() | ||
58 | else $linksToDisplay = $LINKSDB; | ||
59 | $nblinksToDisplay = 50; // Number of links to display. | ||
60 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. | ||
61 | - { | ||
62 | + { | ||
63 | $nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ; | ||
64 | } | ||
65 | |||
66 | @@ -944,7 +951,12 @@ function showRSS() | ||
67 | // If user wants permalinks first, put the final link in description | ||
68 | if ($usepermalinks===true) $descriptionlink = '(<a href="'.$absurl.'">Link</a>)'; | ||
69 | if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink; | ||
70 | - echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$descriptionlink.']]></description>'."\n</item>\n"; | ||
71 | + if(!empty($link['via'])){ | ||
72 | + $via = '<br>Origine => <a href="'.htmlspecialchars($link['via']).'">'.htmlspecialchars(getJustDomain($link['via'])).'</a>'; | ||
73 | + } else { | ||
74 | + $via = ''; | ||
75 | + } | ||
76 | + echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.']]></description>'."\n</item>\n"; | ||
77 | $i++; | ||
78 | } | ||
79 | echo '</channel></rss><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->'; | ||
80 | @@ -980,7 +992,7 @@ function showATOM() | ||
81 | else $linksToDisplay = $LINKSDB; | ||
82 | $nblinksToDisplay = 50; // Number of links to display. | ||
83 | if (!empty($_GET['nb'])) // In URL, you can specificy the number of links. Example: nb=200 or nb=all for all links. | ||
84 | - { | ||
85 | + { | ||
86 | $nblinksToDisplay = $_GET['nb']=='all' ? count($linksToDisplay) : max($_GET['nb']+0,1) ; | ||
87 | } | ||
88 | |||
89 | @@ -1006,11 +1018,16 @@ function showATOM() | ||
90 | |||
91 | // Add permalink in description | ||
92 | $descriptionlink = htmlspecialchars('(<a href="'.$guid.'">Permalink</a>)'); | ||
93 | + if(isset($link['via']) && !empty($link['via'])){ | ||
94 | + $via = htmlspecialchars('</br> Origine => <a href="'.$link['via'].'">'.getJustDomain($link['via']).'</a>'); | ||
95 | + } else { | ||
96 | + $via = ''; | ||
97 | + } | ||
98 | // If user wants permalinks first, put the final link in description | ||
99 | if ($usepermalinks===true) $descriptionlink = htmlspecialchars('(<a href="'.$absurl.'">Link</a>)'); | ||
100 | if (strlen($link['description'])>0) $descriptionlink = '<br>'.$descriptionlink; | ||
101 | |||
102 | - $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink."</content>\n"; | ||
103 | + $entries.='<content type="html">'.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))).$descriptionlink.$via."</content>\n"; | ||
104 | if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification) | ||
105 | { | ||
106 | foreach(explode(' ',$link['tags']) as $tag) | ||
107 | @@ -1478,7 +1495,7 @@ function renderPage() | ||
108 | if (!startsWith($url,'http:') && !startsWith($url,'https:') && !startsWith($url,'ftp:') && !startsWith($url,'magnet:') && !startsWith($url,'?')) | ||
109 | $url = 'http://'.$url; | ||
110 | $link = array('title'=>trim($_POST['lf_title']),'url'=>$url,'description'=>trim($_POST['lf_description']),'private'=>(isset($_POST['lf_private']) ? 1 : 0), | ||
111 | - 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags)); | ||
112 | + 'linkdate'=>$linkdate,'tags'=>str_replace(',',' ',$tags), 'via'=>trim($_POST['lf_via'])); | ||
113 | if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title. | ||
114 | $LINKSDB[$linkdate] = $link; | ||
115 | $LINKSDB->savedb(); // Save to disk. | ||
116 | @@ -1556,7 +1573,8 @@ function renderPage() | ||
117 | $title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet). | ||
118 | $description = (empty($_GET['description']) ? '' : $_GET['description']); // Get description if it was provided in URL (by the bookmarklet). [Bronco added that] | ||
119 | $tags = (empty($_GET['tags']) ? '' : $_GET['tags'] ); // Get tags if it was provided in URL | ||
120 | - $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL | ||
121 | + $via = (empty($_GET['via']) ? '' : $_GET['via'] ); | ||
122 | + $private = (!empty($_GET['private']) && $_GET['private'] === "1" ? 1 : 0); // Get private if it was provided in URL | ||
123 | if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url; | ||
124 | // If this is an HTTP link, we try go get the page to extract the title (otherwise we will to straight to the edit form.) | ||
125 | if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http') | ||
126 | @@ -1567,7 +1585,7 @@ function renderPage() | ||
127 | { | ||
128 | // Look for charset in html header. | ||
129 | preg_match('#<meta .*charset=.*>#Usi', $data, $meta); | ||
130 | - | ||
131 | + | ||
132 | // If found, extract encoding. | ||
133 | if (!empty($meta[0])) | ||
134 | { | ||
135 | @@ -1577,7 +1595,7 @@ function renderPage() | ||
136 | $html_charset = (!empty($enc[1])) ? strtolower($enc[1]) : 'utf-8'; | ||
137 | } | ||
138 | else { $html_charset = 'utf-8'; } | ||
139 | - | ||
140 | + | ||
141 | // Extract title | ||
142 | $title = html_extract_title($data); | ||
143 | if (!empty($title)) | ||
144 | @@ -1592,7 +1610,7 @@ function renderPage() | ||
145 | $url='?'.smallHash($linkdate); | ||
146 | $title='Note: '; | ||
147 | } | ||
148 | - $link = array('linkdate'=>$linkdate,'title'=>$title,'url'=>$url,'description'=>$description,'tags'=>$tags,'private'=>$private); | ||
149 | + $link = array('linkdate'=>$linkdate,'title'=>$title,'url'=>$url,'description'=>$description,'tags'=>$tags,'via' => $via,'private'=>$private); | ||
150 | } | ||
151 | |||
152 | $PAGE = new pageBuilder; | ||
153 | @@ -1842,6 +1860,9 @@ function buildLinkList($PAGE,$LINKSDB) | ||
154 | $taglist = explode(' ',$link['tags']); | ||
155 | uasort($taglist, 'strcasecmp'); | ||
156 | $link['taglist']=$taglist; | ||
157 | + if(!empty($link['via'])){ | ||
158 | + $link['via']=htmlspecialchars($link['via']); | ||
159 | + } | ||
160 | $linkDisp[$keys[$i]] = $link; | ||
161 | $i++; | ||
162 | } | ||
163 | diff --git a/tpl/editlink.html b/tpl/editlink.html | ||
164 | index 4a2c30c..14d4f9c 100644 | ||
165 | --- a/tpl/editlink.html | ||
166 | +++ b/tpl/editlink.html | ||
167 | @@ -16,6 +16,7 @@ | ||
168 | <i>Title</i><br><input type="text" name="lf_title" value="{$link.title|htmlspecialchars}" style="width:100%"><br> | ||
169 | <i>Description</i><br><textarea name="lf_description" rows="4" cols="25" style="width:100%">{$link.description|htmlspecialchars}</textarea><br> | ||
170 | <i>Tags</i><br><input type="text" id="lf_tags" name="lf_tags" value="{$link.tags|htmlspecialchars}" style="width:100%"><br> | ||
171 | + <i>Origine</i><br><input type="text" name="lf_via" value="{$link.via|htmlspecialchars}" style="width:100%"><br> | ||
172 | {if condition="($link_is_new && $GLOBALS['privateLinkByDefault']==true) || $link.private == true"} | ||
173 | <input type="checkbox" checked="checked" name="lf_private" id="lf_private"> | ||
174 | <label for="lf_private"><i>Private</i></label><br> | ||
175 | diff --git a/tpl/linklist.html b/tpl/linklist.html | ||
176 | index ddc38cb..0a8475f 100644 | ||
177 | --- a/tpl/linklist.html | ||
178 | +++ b/tpl/linklist.html | ||
179 | @@ -43,6 +43,7 @@ | ||
180 | <span class="linktitle"><a href="{$redirector}{$value.url|htmlspecialchars}">{$value.title|htmlspecialchars}</a></span> | ||
181 | <br> | ||
182 | {if="$value.description"}<div class="linkdescription"{if condition="$search_type=='permalink'"} style="max-height:none !important;"{/if}>{$value.description}</div>{/if} | ||
183 | + {if condition="isset($value.via) && !empty($value.via)"}<div><a href="{$value.via}">Origine => {$value.via|getJustDomain}</a></div>{/if} | ||
184 | {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"} | ||
185 | <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span> | ||
186 | {else} | ||
187 | -- | ||
188 | 2.1.1 | ||
189 | ``` \ No newline at end of file | ||
diff --git a/doc/md/Datastore-hacks.md b/doc/md/Various-hacks.md index 78baa005..a4ae81f4 100644 --- a/doc/md/Datastore-hacks.md +++ b/doc/md/Various-hacks.md | |||
@@ -17,9 +17,17 @@ Alternatively, you can transform to JSON format (and pretty-print if you have `j | |||
17 | php -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace("!.*/\* (.+) \*/.*!", "$1", file_get_contents("data/datastore.php")))))));' | jq . | 17 | php -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace("!.*/\* (.+) \*/.*!", "$1", file_get_contents("data/datastore.php")))))));' | jq . |
18 | ``` | 18 | ``` |
19 | 19 | ||
20 | ### Changing the timestamp for a link | 20 | ### Changing the timestamp for a shaare |
21 | 21 | ||
22 | * Look for `<input type="hidden" name="lf_linkdate" value="{$link.linkdate}">` in `tpl/editlink.tpl` (line 14) | 22 | * Look for `<input type="hidden" name="lf_linkdate" value="{$link.linkdate}">` in `tpl/editlink.tpl` (line 14) |
23 | * Replace `type="hidden"` with `type="text"` from this line | 23 | * Replace `type="hidden"` with `type="text"` from this line |
24 | * A new date/time field becomes available in the edit/new link dialog. | 24 | * A new date/time field becomes available in the edit/new link dialog. |
25 | * You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. | 25 | * You can set the timestamp manually by entering it in the format `YYYMMDD_HHMMS`. |
26 | |||
27 | |||
28 | ### See also | ||
29 | |||
30 | * [Add a new custom field to shaares (example patch)](https://gist.github.com/nodiscc/8b0194921f059d7b9ad89a581ecd482c) | ||
31 | * [Download CSS styles for shaarlis listed in an opml file](https://gist.github.com/nodiscc/dede231c92cab22c3ad2cc24d5035012) | ||
32 | * [Copy an existing Shaarli installation over SSH, and serve it locally](https://gist.github.com/nodiscc/ed161c66e5b028b5299b0a3733d01c77) | ||
33 | * [Create multiple Shaarli instances, generate an HTML index of them](https://gist.github.com/nodiscc/52e711cda3bc47717c16065231cf6b20) \ No newline at end of file | ||
diff --git a/doc/md/_Sidebar.md b/doc/md/_Sidebar.md deleted file mode 100644 index fe0e4229..00000000 --- a/doc/md/_Sidebar.md +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | - [[Home]] | ||
2 | - Setup | ||
3 | - [[Download and Installation]] | ||
4 | - [[Upgrade and migration]] | ||
5 | - [[Server requirements]] | ||
6 | - [[Server configuration]] | ||
7 | - [[Server security]] | ||
8 | - [[Shaarli configuration]] | ||
9 | - [[Plugins]] | ||
10 | - Docker | ||
11 | - [[Docker 101]] | ||
12 | - [[Shaarli images]] | ||
13 | - [[Reverse proxy configuration]] | ||
14 | - [[Docker resources]] | ||
15 | - Usage | ||
16 | - [[Features]] | ||
17 | - [[Bookmarklet]] | ||
18 | - [[Browsing and Searching]] | ||
19 | - [[Firefox share]] | ||
20 | - [[RSS feeds]] | ||
21 | - [[REST API]] | ||
22 | - How To | ||
23 | - [[Backup, restore, import and export]] | ||
24 | - [[Copy an existing installation over SSH and serve it locally]] | ||
25 | - [[Create and serve multiple Shaarlis (farm)]] | ||
26 | - [[Download CSS styles from an OPML list]] | ||
27 | - [[Datastore hacks]] | ||
28 | - [[Troubleshooting]] | ||
29 | - Development: | ||
30 | - [[Development guidelines]] | ||
31 | - [[Continuous integration tools]] | ||
32 | - [[GnuPG signature]] | ||
33 | - [[Coding guidelines]] | ||
34 | - [[Directory structure]] | ||
35 | - [[3rd party libraries]] | ||
36 | - [[Plugin System]] | ||
37 | - [[Release Shaarli]] | ||
38 | - [[Versioning and Branches]] | ||
39 | - [[Security]] | ||
40 | - [[Static analysis]] | ||
41 | - [[Theming]] | ||
42 | - [[Unit tests]] | ||
43 | - About | ||
44 | - [[FAQ]] | ||
45 | - [[Community & Related software]] | ||