From 0433c688b9be6097b85a8fec31b3dacd0ab81677 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 18 Jun 2017 06:32:30 +0200 Subject: [PATCH 1/1] make htmlpages --- doc/html/3rd-party-libraries/index.html | 14 +- .../index.html | 18 +- doc/html/Bookmarklet/index.html | 14 +- doc/html/Browsing-and-searching/index.html | 14 +- doc/html/Coding-guidelines/index.html | 14 +- .../Community-&-Related-software/index.html | 14 +- .../Continuous-integration-tools/index.html | 14 +- .../index.html | 403 -------------- .../index.html | 396 -------------- doc/html/Development-guidelines/index.html | 14 +- doc/html/Directory-structure/index.html | 14 +- doc/html/Docker-101/index.html | 14 +- doc/html/Docker-resources/index.html | 14 +- .../index.html | 496 ------------------ doc/html/Download-and-Installation/index.html | 14 +- doc/html/FAQ/index.html | 14 +- doc/html/Features/index.html | 14 +- doc/html/Firefox-share/index.html | 14 +- doc/html/GnuPG-signature/index.html | 14 +- doc/html/Plugin-System/index.html | 14 +- doc/html/Plugins/index.html | 14 +- doc/html/REST-API/index.html | 14 +- doc/html/RSS-feeds/index.html | 14 +- doc/html/Release-Shaarli/index.html | 14 +- .../Reverse-proxy-configuration/index.html | 14 +- doc/html/Security/index.html | 14 +- doc/html/Server-configuration/index.html | 14 +- doc/html/Server-requirements/index.html | 14 +- doc/html/Server-security/index.html | 14 +- doc/html/Shaarli-configuration/index.html | 14 +- doc/html/Shaarli-images/index.html | 14 +- doc/html/Static-analysis/index.html | 14 +- doc/html/Theming/index.html | 14 +- doc/html/Troubleshooting/index.html | 18 +- doc/html/Unit-tests/index.html | 14 +- doc/html/Upgrade-and-migration/index.html | 14 +- .../index.html | 44 +- doc/html/Versioning-and-Branches/index.html | 14 +- doc/html/index.html | 16 +- doc/html/mkdocs/search_index.json | 37 +- doc/html/search.html | 14 +- doc/html/sitemap.xml | 20 +- doc/md/Browsing-and-searching.md | 2 +- doc/md/Community-&-Related-software.md | 2 +- doc/md/Continuous-integration-tools.md | 8 +- doc/md/Development-guidelines.md | 6 +- doc/md/Firefox-share.md | 2 +- doc/md/GnuPG-signature.md | 2 +- doc/md/Theming.md | 4 +- doc/md/Upgrade-and-migration.md | 10 +- 50 files changed, 92 insertions(+), 1854 deletions(-) delete mode 100644 doc/html/Copy-an-existing-installation-over-SSH-and-serve-it-locally/index.html delete mode 100644 doc/html/Create-and-serve-multiple-Shaarlis-(farm)/index.html delete mode 100644 doc/html/Download-CSS-styles-from-an-OPML-list/index.html rename doc/html/{Datastore-hacks => Various-hacks}/index.html (88%) diff --git a/doc/html/3rd-party-libraries/index.html b/doc/html/3rd-party-libraries/index.html index c54c45f5..0d62007d 100644 --- a/doc/html/3rd-party-libraries/index.html +++ b/doc/html/3rd-party-libraries/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Backup,-restore,-import-and-export/index.html b/doc/html/Backup,-restore,-import-and-export/index.html index ceb80170..33ec9124 100644 --- a/doc/html/Backup,-restore,-import-and-export/index.html +++ b/doc/html/Backup,-restore,-import-and-export/index.html @@ -179,19 +179,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • @@ -367,7 +355,7 @@ diff --git a/doc/html/Bookmarklet/index.html b/doc/html/Bookmarklet/index.html index e7a370b6..325d305a 100644 --- a/doc/html/Bookmarklet/index.html +++ b/doc/html/Bookmarklet/index.html @@ -164,19 +164,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Browsing-and-searching/index.html b/doc/html/Browsing-and-searching/index.html index 459f07c7..c8b7386e 100644 --- a/doc/html/Browsing-and-searching/index.html +++ b/doc/html/Browsing-and-searching/index.html @@ -164,19 +164,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Coding-guidelines/index.html b/doc/html/Coding-guidelines/index.html index be2bf7e8..dfcdd45c 100644 --- a/doc/html/Coding-guidelines/index.html +++ b/doc/html/Coding-guidelines/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Community-&-Related-software/index.html b/doc/html/Community-&-Related-software/index.html index 1de704a3..2497433c 100644 --- a/doc/html/Community-&-Related-software/index.html +++ b/doc/html/Community-&-Related-software/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Continuous-integration-tools/index.html b/doc/html/Continuous-integration-tools/index.html index c889a963..339f37ac 100644 --- a/doc/html/Continuous-integration-tools/index.html +++ b/doc/html/Continuous-integration-tools/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Copy-an-existing-installation-over-SSH-and-serve-it-locally/index.html b/doc/html/Copy-an-existing-installation-over-SSH-and-serve-it-locally/index.html deleted file mode 100644 index 4aea480d..00000000 --- a/doc/html/Copy-an-existing-installation-over-SSH-and-serve-it-locally/index.html +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - - - - Copy an existing installation over SSH and serve it locally - Shaarli Documentation - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - - -
    -
    -
    -
      -
    • Docs »
    • - - - -
    • How To »
    • - - - -
    • Copy an existing installation over SSH and serve it locally
    • -
    • - - Edit on GitHub - -
    • -
    -
    -
    -
    -
    - -

    Example bash script:

    -
    #!/bin/bash
    -#Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli
    -#Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.
    -#Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli
    -#Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed
    -#Usage: ./local-shaarli.sh
    -#Author: nodiscc (nodiscc@gmail.com)
    -#License: MIT (http://opensource.org/licenses/MIT)
    -set -o errexit
    -set -o nounset
    -
    -##### CONFIG #################
    -#The port used by php's local server
    -php_local_port=7431
    -
    -#Name of the SSH server and path where Shaarli is installed
    -#TODO: pass these as command-line arguments
    -remotehost="my.ssh.server"
    -remote_shaarli_dir="/var/www/shaarli"
    -
    -
    -###### FUNCTIONS #############
    -_main() {
    -    _CBSyncShaarli
    -    _CBServeShaarli
    -}
    -
    -_CBSyncShaarli() {
    -    remote_temp_dir=$(ssh $remotehost mktemp -d)
    -    remote_ssh_user=$(ssh $remotehost whoami)
    -    ssh -t "$remotehost" sudo cp -r "$remote_shaarli_dir" "$remote_temp_dir"
    -    ssh -t "$remotehost" sudo chown -R "$remote_ssh_user":"$remote_ssh_user" "$remote_temp_dir"
    -    scp -rq "$remotehost":"$remote_temp_dir" local-shaarli
    -    ssh "$remotehost" rm -r "$remote_temp_dir"
    -}
    -
    -_CBServeShaarli() {
    -    #TODO: allow serving a previously downloaded Shaarli
    -    #TODO: ask before overwriting local copy, if it exists
    -    cd local-shaarli/
    -    php -S localhost:${php_local_port}
    -    echo "Please go to http://localhost:${php_local_port}"
    -}
    -
    -
    -##### MAIN #################
    -
    -_main
    -
    - -

    This outputs:

    -
    $ ./local-shaarli.sh
    -PHP 5.6.0RC4 Development Server started at Mon Sep  1 21:56:19 2014
    -Listening on http://localhost:7431
    -Document root is /home/user/local-shaarli/shaarli
    -Press Ctrl-C to quit.
    -
    -[Mon Sep  1 21:56:27 2014] ::1:57868 [200]: /
    -[Mon Sep  1 21:56:27 2014] ::1:57869 [200]: /index.html
    -[Mon Sep  1 21:56:37 2014] ::1:57881 [200]: /...
    -
    - -
    -
    - - -
    -
    - -
    - -
    - -
    - - - GitHub - - - « Previous - - - Next » - - -
    - - - - diff --git a/doc/html/Create-and-serve-multiple-Shaarlis-(farm)/index.html b/doc/html/Create-and-serve-multiple-Shaarlis-(farm)/index.html deleted file mode 100644 index 98d8992e..00000000 --- a/doc/html/Create-and-serve-multiple-Shaarlis-(farm)/index.html +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - Create and serve multiple Shaarlis (farm) - Shaarli Documentation - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - - -
    -
    -
    -
      -
    • Docs »
    • - - - -
    • How To »
    • - - - -
    • Create and serve multiple Shaarlis (farm)
    • -
    • - - Edit on GitHub - -
    • -
    -
    -
    -
    -
    - -

    Example bash script (creates multiple shaarli instances and generates an HTML index of them)

    -
    #!/bin/bash
    -set -o errexit
    -set -o nounset
    -
    -#config
    -shaarli_base_dir='/var/www/shaarli'
    -accounts='bob john whatever username'
    -shaarli_repo_url='https://github.com/shaarli/Shaarli'
    -ref="master"
    -
    -#clone multiple shaarli instances
    -if [ ! -d "$shaarli_base_dir" ]; then mkdir "$shaarli_base_dir"; fi
    -
    -for account in $accounts; do
    -    if [ -d "$shaarli_base_dir/$account" ];
    -    then echo "[info] account $account already exists, skipping";
    -    else echo "[info] creating new account $account ..."; git clone --quiet "$shaarli_repo_url" -b "$ref" "$shaarli_base_dir/$account"; fi
    -done
    -
    -#generate html index of shaarlis
    -htmlhead='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    -<!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ -->
    -<html lang="en">
    -    <head>
    -        <meta http-equiv="content-type" content="text/html; charset=utf-8">
    -        <title>My Shaarli farm</title>
    -        <style>body {font-family: "Open Sans"}</style>
    -    </head>
    -    <body>
    -    <div>
    -    <h1>My Shaarli farm</h1>
    -    <ul style="list-style-type: none;">'
    -
    -accountlinks=''
    -
    -htmlfooter='
    -    </ul>
    -    </div>
    -    </body>
    -</html>'    
    -
    -
    -
    -for account in $accounts; do accountlinks="$accountlinks\n<li><a href=\"$account\">$account</a></li>"; done
    -if [ -d "$shaarli_base_dir/index.html" ]; then echo "[removing old index.html]"; rm "$shaarli_base_dir/index.html" ]; fi
    -echo "[info] generating new index of shaarlis"
    -echo -e "$htmlhead $accountlinks $htmlfooter" > "$shaarli_base_dir/index.html"
    -echo '[info] done.'
    -echo "[info] list of accounts: $accounts"
    -echo "[info] contents of $shaarli_base_dir:"
    -tree -a -L 1 "$shaarli_base_dir"
    -
    - -

    This script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like Ansible

    - -
    -
    - - -
    -
    - -
    - -
    - -
    - - - GitHub - - - « Previous - - - Next » - - -
    - - - - diff --git a/doc/html/Development-guidelines/index.html b/doc/html/Development-guidelines/index.html index 747d53a8..e75c911b 100644 --- a/doc/html/Development-guidelines/index.html +++ b/doc/html/Development-guidelines/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Directory-structure/index.html b/doc/html/Directory-structure/index.html index 82979774..ff075ec5 100644 --- a/doc/html/Directory-structure/index.html +++ b/doc/html/Directory-structure/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Docker-101/index.html b/doc/html/Docker-101/index.html index 5b4f645c..31e57b59 100644 --- a/doc/html/Docker-101/index.html +++ b/doc/html/Docker-101/index.html @@ -168,19 +168,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Docker-resources/index.html b/doc/html/Docker-resources/index.html index 7bd7067d..169a0297 100644 --- a/doc/html/Docker-resources/index.html +++ b/doc/html/Docker-resources/index.html @@ -164,19 +164,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Download-CSS-styles-from-an-OPML-list/index.html b/doc/html/Download-CSS-styles-from-an-OPML-list/index.html deleted file mode 100644 index e697b39d..00000000 --- a/doc/html/Download-CSS-styles-from-an-OPML-list/index.html +++ /dev/null @@ -1,496 +0,0 @@ - - - - - - - - - - - Download CSS styles from an OPML list - Shaarli Documentation - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - - -
    -
    -
    -
      -
    • Docs »
    • - - - -
    • How To »
    • - - - -
    • Download CSS styles from an OPML list
    • -
    • - - Edit on GitHub - -
    • -
    -
    -
    -
    -
    - -

    Download CSS styles for shaarlis listed in an opml file

    -

    Example php script:

    -
    <!---- ?php -->
    -<!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) -->
    -<!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) -->
    -
    -/**
    - * Source: https://github.com/Riduidel
    - * Download css styles for shaarlis listed in an opml file
    - */
    -define("SHAARLI_RSS_OPML", "https://www.ecirtam.net/shaarlirss/custom/people.opml");
    -
    -define("THEMES_TEMP_FOLDER", "new_themes");
    -
    -if(!file_exists(THEMES_TEMP_FOLDER)) {
    -    mkdir(THEMES_TEMP_FOLDER);
    -}
    -
    -function siteUrl($pathInSite) {
    -    $indexPos = strpos($pathInSite, "index.php");
    -    if(!$indexPos) {
    -        return $pathInSite;
    -    } else {
    -        return substr($pathInSite, 0, $indexPos);
    -    }
    -}
    -
    -function createShaarliHashFromOPMLL($opmlFile) {
    -    $result = array();
    -    $opml = file_get_contents($opmlFile);
    -    $opmlXml = simplexml_load_string($opml);
    -    $outlineElements = $opmlXml->xpath("body/outline");
    -    foreach($outlineElements as $site) {
    -        $siteUrl = siteUrl((string) $site['htmlUrl']);
    -        $result[$siteUrl]=((string) $site['text']);
    -    }
    -    return $result;
    -}
    -
    -function getSiteFolder($url) {
    -    $domain = parse_url($url,  PHP_URL_HOST);
    -    return THEMES_TEMP_FOLDER."/".str_replace(".", "_", $domain);
    -}
    -
    -function get_http_response_code($theURL) {
    -     $headers = get_headers($theURL);
    -     return substr($headers[0], 9, 3);
    -}
    -
    -/**
    - * This makes the code PHP-5 only (particularly the call to "get_headers")
    - */
    -function copyUserStyleFrom($url, $name, $knownStyles) {
    -    $userStyle = $url."inc/user.css";
    -    if(in_array($url, $knownStyles)) {
    -        // TODO add log message
    -    } else {
    -        $statusCode = get_http_response_code($userStyle);
    -        if(intval($statusCode)<300) {
    -            $styleSheet = file_get_contents($userStyle);
    -            $siteFolder = getSiteFolder($url);
    -            if(!file_exists($siteFolder)) {
    -                mkdir($siteFolder);
    -            }
    -            if(!file_exists($siteFolder.'/user.css')) {
    -                // Copy stylesheet
    -                file_put_contents($siteFolder.'/user.css', $styleSheet);
    -            }
    -            if(!file_exists($siteFolder.'/README.md')) {
    -                // Then write a readme.md file
    -                file_put_contents($siteFolder.'/README.md', 
    -                    "User style from ".$name."\n"
    -                    ."============================="
    -                    ."\n\n"
    -                    ."This stylesheet was downloaded from ".$userStyle." on ".date(DATE_RFC822)
    -                    );
    -            }
    -            if(!file_exists($siteFolder.'/config.ini')) {
    -                // Write a config file containing useful informations
    -                file_put_contents($siteFolder.'/config.ini', 
    -                    "site_url=".$url."\n"
    -                    ."site_name=".$name."\n"
    -                    );
    -            }
    -            if(!file_exists($siteFolder.'/home.png')) {
    -                // And finally copy generated thumbnail
    -                $homeThumb = $siteFolder.'/home.png';
    -                file_put_contents($siteFolder.'/home.png', file_get_contents(getThumbnailUrl($url)));
    -            }
    -            echo 'Theme have been downloaded from  <a href="'.$url.'">'.$url.'</a> into '.$siteFolder
    -                .'. It looks like <img src="'.$homeThumb.'"><br/>';
    -        }
    -    }
    -}
    -
    -function getThumbnailUrl($url) {
    -    return 'http://api.webthumbnail.org/?url='.$url;
    -}
    -
    -function copyUserStylesFrom($urlToNames, $knownStyles) {
    -    foreach($urlToNames as $url => $name) {
    -        copyUserStyleFrom($url, $name, $knownStyles);
    -    }
    -}
    -
    -/**
    - * Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/
    - * @param directory the directory we want to list files of
    - * @return a simple array containing the list of absolute file paths. Notice that current file (".") and parent one("..")
    - * are not listed here
    - */
    -function getDirectoryList ($directory)  {
    -    $realPath = realpath($directory);
    -    // create an array to hold directory list
    -    $results = array();
    -    // create a handler for the directory
    -    $handler = opendir($directory);
    -    // open directory and walk through the filenames
    -    while ($file = readdir($handler)) {
    -        // if file isn't this directory or its parent, add it to the results
    -        if ($file != "." && $file != "..") {
    -            $results[] = realpath($realPath . "/" . $file);
    -        }
    -    }
    -    // tidy up: close the handler
    -    closedir($handler);
    -    // done!
    -    return $results;
    -}
    -
    -/**
    - * Start in themes folder and look in all subfolders for config.ini files. 
    - * These config.ini files allow us not to download styles again and again
    - */
    -function findKnownStyles() {
    -    $result = array();
    -    $subFolders = getDirectoryList("themes");
    -    foreach($subFolders as $folder) {
    -        $configFile = $folder."/config.ini";
    -        if(file_exists($configFile)) {
    -            $iniParameters = parse_ini_file($configFile);
    -            array_push($result, $iniParameters['site_url']);
    -        }
    -    }
    -    return $result;
    -}
    -
    -$knownStyles = findKnownStyles();
    -copyUserStylesFrom(createShaarliHashFromOPMLL(SHAARLI_RSS_OPML), $knownStyles);
    -
    -<!--- ? ---->
    -
    - -
    -
    - - -
    -
    - -
    - -
    - -
    - - - GitHub - - - « Previous - - - Next » - - -
    - - - - diff --git a/doc/html/Download-and-Installation/index.html b/doc/html/Download-and-Installation/index.html index 1ede1d68..92342681 100644 --- a/doc/html/Download-and-Installation/index.html +++ b/doc/html/Download-and-Installation/index.html @@ -186,19 +186,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/FAQ/index.html b/doc/html/FAQ/index.html index c48e11f8..f8ced260 100644 --- a/doc/html/FAQ/index.html +++ b/doc/html/FAQ/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Features/index.html b/doc/html/Features/index.html index 453f189a..e847c546 100644 --- a/doc/html/Features/index.html +++ b/doc/html/Features/index.html @@ -161,19 +161,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Firefox-share/index.html b/doc/html/Firefox-share/index.html index c0aaf4bd..9c028ffc 100644 --- a/doc/html/Firefox-share/index.html +++ b/doc/html/Firefox-share/index.html @@ -161,19 +161,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/GnuPG-signature/index.html b/doc/html/GnuPG-signature/index.html index 781ccd2d..0b2d842a 100644 --- a/doc/html/GnuPG-signature/index.html +++ b/doc/html/GnuPG-signature/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Plugin-System/index.html b/doc/html/Plugin-System/index.html index 5ee0f6c1..dbed5908 100644 --- a/doc/html/Plugin-System/index.html +++ b/doc/html/Plugin-System/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Plugins/index.html b/doc/html/Plugins/index.html index 3a30e93c..4b63681e 100644 --- a/doc/html/Plugins/index.html +++ b/doc/html/Plugins/index.html @@ -173,19 +173,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/REST-API/index.html b/doc/html/REST-API/index.html index 2c244bca..6e2c9518 100644 --- a/doc/html/REST-API/index.html +++ b/doc/html/REST-API/index.html @@ -169,19 +169,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/RSS-feeds/index.html b/doc/html/RSS-feeds/index.html index bb6e412c..a4b7339f 100644 --- a/doc/html/RSS-feeds/index.html +++ b/doc/html/RSS-feeds/index.html @@ -161,19 +161,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Release-Shaarli/index.html b/doc/html/Release-Shaarli/index.html index cf5fcee8..92433203 100644 --- a/doc/html/Release-Shaarli/index.html +++ b/doc/html/Release-Shaarli/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Reverse-proxy-configuration/index.html b/doc/html/Reverse-proxy-configuration/index.html index bebd663f..f573c5cd 100644 --- a/doc/html/Reverse-proxy-configuration/index.html +++ b/doc/html/Reverse-proxy-configuration/index.html @@ -161,19 +161,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Security/index.html b/doc/html/Security/index.html index 19b569e6..c7aec584 100644 --- a/doc/html/Security/index.html +++ b/doc/html/Security/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Server-configuration/index.html b/doc/html/Server-configuration/index.html index beb8cd08..6e798b4b 100644 --- a/doc/html/Server-configuration/index.html +++ b/doc/html/Server-configuration/index.html @@ -207,19 +207,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Server-requirements/index.html b/doc/html/Server-requirements/index.html index ab1b0d35..f3bfa185 100644 --- a/doc/html/Server-requirements/index.html +++ b/doc/html/Server-requirements/index.html @@ -170,19 +170,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Server-security/index.html b/doc/html/Server-security/index.html index dbe99515..6d9f25c0 100644 --- a/doc/html/Server-security/index.html +++ b/doc/html/Server-security/index.html @@ -176,19 +176,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Shaarli-configuration/index.html b/doc/html/Shaarli-configuration/index.html index 95a487d0..4e556061 100644 --- a/doc/html/Shaarli-configuration/index.html +++ b/doc/html/Shaarli-configuration/index.html @@ -192,19 +192,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Shaarli-images/index.html b/doc/html/Shaarli-images/index.html index 0fa93ca3..4a1cf66b 100644 --- a/doc/html/Shaarli-images/index.html +++ b/doc/html/Shaarli-images/index.html @@ -172,19 +172,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Static-analysis/index.html b/doc/html/Static-analysis/index.html index 0dfb5519..ddd81f86 100644 --- a/doc/html/Static-analysis/index.html +++ b/doc/html/Static-analysis/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Theming/index.html b/doc/html/Theming/index.html index 70a36dd4..670dbb80 100644 --- a/doc/html/Theming/index.html +++ b/doc/html/Theming/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Troubleshooting/index.html b/doc/html/Troubleshooting/index.html index ed1c433d..f1564362 100644 --- a/doc/html/Troubleshooting/index.html +++ b/doc/html/Troubleshooting/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • @@ -400,7 +388,7 @@ php56 1 Next - Previous + Previous @@ -428,7 +416,7 @@ php56 1 GitHub - « Previous + « Previous Next » diff --git a/doc/html/Unit-tests/index.html b/doc/html/Unit-tests/index.html index 84580db4..ce90ed10 100644 --- a/doc/html/Unit-tests/index.html +++ b/doc/html/Unit-tests/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Upgrade-and-migration/index.html b/doc/html/Upgrade-and-migration/index.html index 642942bf..3319fa72 100644 --- a/doc/html/Upgrade-and-migration/index.html +++ b/doc/html/Upgrade-and-migration/index.html @@ -191,19 +191,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/Datastore-hacks/index.html b/doc/html/Various-hacks/index.html similarity index 88% rename from doc/html/Datastore-hacks/index.html rename to doc/html/Various-hacks/index.html index b3d8d97e..b06207ae 100644 --- a/doc/html/Datastore-hacks/index.html +++ b/doc/html/Various-hacks/index.html @@ -8,7 +8,7 @@ - Datastore hacks - Shaarli Documentation + Various hacks - Shaarli Documentation @@ -18,9 +18,9 @@ @@ -149,28 +149,19 @@
  • Backup, restore, import and export -
  • -
  • - - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list
  • - Datastore hacks + Various hacks @@ -283,10 +274,10 @@ -
  • Datastore hacks
  • +
  • Various hacks
  • - Edit on GitHub
  • @@ -311,12 +302,19 @@ exit;
    php -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace("!.*/\* (.+) \*/.*!", "$1", file_get_contents("data/datastore.php")))))));' | jq .
     
    - +

    Changing the timestamp for a shaare

    +

    See also

    + @@ -328,7 +326,7 @@ exit; Next - Previous + Previous @@ -356,7 +354,7 @@ exit; GitHub - « Previous + « Previous Next » diff --git a/doc/html/Versioning-and-Branches/index.html b/doc/html/Versioning-and-Branches/index.html index 406ad7f9..97bdb47e 100644 --- a/doc/html/Versioning-and-Branches/index.html +++ b/doc/html/Versioning-and-Branches/index.html @@ -152,19 +152,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/index.html b/doc/html/index.html index a9b0c7b9..e6d4ef78 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -155,19 +155,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • @@ -340,5 +328,5 @@ diff --git a/doc/html/mkdocs/search_index.json b/doc/html/mkdocs/search_index.json index 2222a95b..7ef1837c 100644 --- a/doc/html/mkdocs/search_index.json +++ b/doc/html/mkdocs/search_index.json @@ -691,39 +691,24 @@ "title": "Import Shaarli links to Firefox" }, { - "location": "/Copy-an-existing-installation-over-SSH-and-serve-it-locally/", - "text": "Example bash script:\n\n\n#!/bin/bash\n#Description: Copy a Shaarli installation over SSH/SCP, serve it locally with php-cli\n#Will create a local-shaarli/ directory when you run it, backup your Shaarli there, and serve it locally.\n#Will NOT download linked pages. It's just a directly usable backup/copy/mirror of your Shaarli\n#Requires: ssh, scp and a working SSH access to the server where your Shaarli is installed\n#Usage: ./local-shaarli.sh\n#Author: nodiscc (nodiscc@gmail.com)\n#License: MIT (http://opensource.org/licenses/MIT)\nset -o errexit\nset -o nounset\n\n##### CONFIG #################\n#The port used by php's local server\nphp_local_port=7431\n\n#Name of the SSH server and path where Shaarli is installed\n#TODO: pass these as command-line arguments\nremotehost=\"my.ssh.server\"\nremote_shaarli_dir=\"/var/www/shaarli\"\n\n\n###### FUNCTIONS #############\n_main() {\n _CBSyncShaarli\n _CBServeShaarli\n}\n\n_CBSyncShaarli() {\n remote_temp_dir=$(ssh $remotehost mktemp -d)\n remote_ssh_user=$(ssh $remotehost whoami)\n ssh -t \"$remotehost\" sudo cp -r \"$remote_shaarli_dir\" \"$remote_temp_dir\"\n ssh -t \"$remotehost\" sudo chown -R \"$remote_ssh_user\":\"$remote_ssh_user\" \"$remote_temp_dir\"\n scp -rq \"$remotehost\":\"$remote_temp_dir\" local-shaarli\n ssh \"$remotehost\" rm -r \"$remote_temp_dir\"\n}\n\n_CBServeShaarli() {\n #TODO: allow serving a previously downloaded Shaarli\n #TODO: ask before overwriting local copy, if it exists\n cd local-shaarli/\n php -S localhost:${php_local_port}\n echo \"Please go to http://localhost:${php_local_port}\"\n}\n\n\n##### MAIN #################\n\n_main\n\n\n\n\nThis outputs:\n\n\n$ ./local-shaarli.sh\nPHP 5.6.0RC4 Development Server started at Mon Sep 1 21:56:19 2014\nListening on http://localhost:7431\nDocument root is /home/user/local-shaarli/shaarli\nPress Ctrl-C to quit.\n\n[Mon Sep 1 21:56:27 2014] ::1:57868 [200]: /\n[Mon Sep 1 21:56:27 2014] ::1:57869 [200]: /index.html\n[Mon Sep 1 21:56:37 2014] ::1:57881 [200]: /...", - "title": "Copy an existing installation over SSH and serve it locally" + "location": "/Various-hacks/", + "text": "Decode datastore content\n\n\nTo display the array representing the data saved in \ndata/datastore.php\n, use the following snippet:\n\n\n$data = \"tZNdb9MwFIb... \";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"
    \"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"
    \";\nexit;\n\n\n\n\nThis will output the internal representation of the datastore, \"unobfuscated\" (if this can really be considered obfuscation).\n\n\nAlternatively, you can transform to JSON format (and pretty-print if you have \njq\n installed):\n\n\nphp -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace(\"!.*/\\* (.+) \\*/.*!\", \"$1\", file_get_contents(\"data/datastore.php\")))))));' | jq .\n\n\n\n\nChanging the timestamp for a shaare\n\n\n\n\nLook for \n\n in \ntpl/editlink.tpl\n (line 14)\n\n\nReplace \ntype=\"hidden\"\n with \ntype=\"text\"\n from this line\n\n\nA new date/time field becomes available in the edit/new link dialog.\n\n\nYou can set the timestamp manually by entering it in the format \nYYYMMDD_HHMMS\n.\n\n\n\n\nSee also\n\n\n\n\nAdd a new custom field to shaares (example patch)\n\n\nDownload CSS styles for shaarlis listed in an opml file\n\n\nCopy an existing Shaarli installation over SSH, and serve it locally\n\n\nCreate multiple Shaarli instances, generate an HTML index of them", + "title": "Various hacks" }, { - "location": "/Create-and-serve-multiple-Shaarlis-(farm)/", - "text": "Example bash script (creates multiple shaarli instances and generates an HTML index of them)\n\n\n#!/bin/bash\nset -o errexit\nset -o nounset\n\n#config\nshaarli_base_dir='/var/www/shaarli'\naccounts='bob john whatever username'\nshaarli_repo_url='https://github.com/shaarli/Shaarli'\nref=\"master\"\n\n#clone multiple shaarli instances\nif [ ! -d \"$shaarli_base_dir\" ]; then mkdir \"$shaarli_base_dir\"; fi\n\nfor account in $accounts; do\n if [ -d \"$shaarli_base_dir/$account\" ];\n then echo \"[info] account $account already exists, skipping\";\n else echo \"[info] creating new account $account ...\"; git clone --quiet \"$shaarli_repo_url\" -b \"$ref\" \"$shaarli_base_dir/$account\"; fi\ndone\n\n#generate html index of shaarlis\nhtmlhead='\n\n\n \n \n My Shaarli farm\n \n \n \n
    \n

    My Shaarli farm

    \n
      '\n\naccountlinks=''\n\nhtmlfooter='\n
    \n
    \n \n' \n\n\n\nfor account in $accounts; do accountlinks=\"$accountlinks\\n
  • $account
  • \"; done\nif [ -d \"$shaarli_base_dir/index.html\" ]; then echo \"[removing old index.html]\"; rm \"$shaarli_base_dir/index.html\" ]; fi\necho \"[info] generating new index of shaarlis\"\necho -e \"$htmlhead $accountlinks $htmlfooter\" > \"$shaarli_base_dir/index.html\"\necho '[info] done.'\necho \"[info] list of accounts: $accounts\"\necho \"[info] contents of $shaarli_base_dir:\"\ntree -a -L 1 \"$shaarli_base_dir\"\n\n\n\n\nThis script just serves as an example. More precise or complex (applying custom configuration, etc) automation is possible using configuration management software like \nAnsible", - "title": "Create and serve multiple Shaarlis (farm)" - }, - { - "location": "/Download-CSS-styles-from-an-OPML-list/", - "text": "Download CSS styles for shaarlis listed in an opml file\n\n\nExample php script:\n\n\n\n\n\n\n/**\n * Source: https://github.com/Riduidel\n * Download css styles for shaarlis listed in an opml file\n */\ndefine(\"SHAARLI_RSS_OPML\", \"https://www.ecirtam.net/shaarlirss/custom/people.opml\");\n\ndefine(\"THEMES_TEMP_FOLDER\", \"new_themes\");\n\nif(!file_exists(THEMES_TEMP_FOLDER)) {\n mkdir(THEMES_TEMP_FOLDER);\n}\n\nfunction siteUrl($pathInSite) {\n $indexPos = strpos($pathInSite, \"index.php\");\n if(!$indexPos) {\n return $pathInSite;\n } else {\n return substr($pathInSite, 0, $indexPos);\n }\n}\n\nfunction createShaarliHashFromOPMLL($opmlFile) {\n $result = array();\n $opml = file_get_contents($opmlFile);\n $opmlXml = simplexml_load_string($opml);\n $outlineElements = $opmlXml->xpath(\"body/outline\");\n foreach($outlineElements as $site) {\n $siteUrl = siteUrl((string) $site['htmlUrl']);\n $result[$siteUrl]=((string) $site['text']);\n }\n return $result;\n}\n\nfunction getSiteFolder($url) {\n $domain = parse_url($url, PHP_URL_HOST);\n return THEMES_TEMP_FOLDER.\"/\".str_replace(\".\", \"_\", $domain);\n}\n\nfunction get_http_response_code($theURL) {\n $headers = get_headers($theURL);\n return substr($headers[0], 9, 3);\n}\n\n/**\n * This makes the code PHP-5 only (particularly the call to \"get_headers\")\n */\nfunction copyUserStyleFrom($url, $name, $knownStyles) {\n $userStyle = $url.\"inc/user.css\";\n if(in_array($url, $knownStyles)) {\n // TODO add log message\n } else {\n $statusCode = get_http_response_code($userStyle);\n if(intval($statusCode)<300) {\n $styleSheet = file_get_contents($userStyle);\n $siteFolder = getSiteFolder($url);\n if(!file_exists($siteFolder)) {\n mkdir($siteFolder);\n }\n if(!file_exists($siteFolder.'/user.css')) {\n // Copy stylesheet\n file_put_contents($siteFolder.'/user.css', $styleSheet);\n }\n if(!file_exists($siteFolder.'/README.md')) {\n // Then write a readme.md file\n file_put_contents($siteFolder.'/README.md', \n \"User style from \".$name.\"\\n\"\n .\"=============================\"\n .\"\\n\\n\"\n .\"This stylesheet was downloaded from \".$userStyle.\" on \".date(DATE_RFC822)\n );\n }\n if(!file_exists($siteFolder.'/config.ini')) {\n // Write a config file containing useful informations\n file_put_contents($siteFolder.'/config.ini', \n \"site_url=\".$url.\"\\n\"\n .\"site_name=\".$name.\"\\n\"\n );\n }\n if(!file_exists($siteFolder.'/home.png')) {\n // And finally copy generated thumbnail\n $homeThumb = $siteFolder.'/home.png';\n file_put_contents($siteFolder.'/home.png', file_get_contents(getThumbnailUrl($url)));\n }\n echo 'Theme have been downloaded from '.$url.' into '.$siteFolder\n .'. It looks like
    ';\n }\n }\n}\n\nfunction getThumbnailUrl($url) {\n return 'http://api.webthumbnail.org/?url='.$url;\n}\n\nfunction copyUserStylesFrom($urlToNames, $knownStyles) {\n foreach($urlToNames as $url => $name) {\n copyUserStyleFrom($url, $name, $knownStyles);\n }\n}\n\n/**\n * Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/\n * @param directory the directory we want to list files of\n * @return a simple array containing the list of absolute file paths. Notice that current file (\".\") and parent one(\"..\")\n * are not listed here\n */\nfunction getDirectoryList ($directory) {\n $realPath = realpath($directory);\n // create an array to hold directory list\n $results = array();\n // create a handler for the directory\n $handler = opendir($directory);\n // open directory and walk through the filenames\n while ($file = readdir($handler)) {\n // if file isn't this directory or its parent, add it to the results\n if ($file != \".\" && $file != \"..\") {\n $results[] = realpath($realPath . \"/\" . $file);\n }\n }\n // tidy up: close the handler\n closedir($handler);\n // done!\n return $results;\n}\n\n/**\n * Start in themes folder and look in all subfolders for config.ini files. \n * These config.ini files allow us not to download styles again and again\n */\nfunction findKnownStyles() {\n $result = array();\n $subFolders = getDirectoryList(\"themes\");\n foreach($subFolders as $folder) {\n $configFile = $folder.\"/config.ini\";\n if(file_exists($configFile)) {\n $iniParameters = parse_ini_file($configFile);\n array_push($result, $iniParameters['site_url']);\n }\n }\n return $result;\n}\n\n$knownStyles = findKnownStyles();\ncopyUserStylesFrom(createShaarliHashFromOPMLL(SHAARLI_RSS_OPML), $knownStyles);\n\n", - "title": "Download CSS styles from an OPML list" - }, - { - "location": "/Download-CSS-styles-from-an-OPML-list/#download-css-styles-for-shaarlis-listed-in-an-opml-file", - "text": "Example php script: \n\n\n\n/**\n * Source: https://github.com/Riduidel\n * Download css styles for shaarlis listed in an opml file\n */\ndefine(\"SHAARLI_RSS_OPML\", \"https://www.ecirtam.net/shaarlirss/custom/people.opml\");\n\ndefine(\"THEMES_TEMP_FOLDER\", \"new_themes\");\n\nif(!file_exists(THEMES_TEMP_FOLDER)) {\n mkdir(THEMES_TEMP_FOLDER);\n}\n\nfunction siteUrl($pathInSite) {\n $indexPos = strpos($pathInSite, \"index.php\");\n if(!$indexPos) {\n return $pathInSite;\n } else {\n return substr($pathInSite, 0, $indexPos);\n }\n}\n\nfunction createShaarliHashFromOPMLL($opmlFile) {\n $result = array();\n $opml = file_get_contents($opmlFile);\n $opmlXml = simplexml_load_string($opml);\n $outlineElements = $opmlXml->xpath(\"body/outline\");\n foreach($outlineElements as $site) {\n $siteUrl = siteUrl((string) $site['htmlUrl']);\n $result[$siteUrl]=((string) $site['text']);\n }\n return $result;\n}\n\nfunction getSiteFolder($url) {\n $domain = parse_url($url, PHP_URL_HOST);\n return THEMES_TEMP_FOLDER.\"/\".str_replace(\".\", \"_\", $domain);\n}\n\nfunction get_http_response_code($theURL) {\n $headers = get_headers($theURL);\n return substr($headers[0], 9, 3);\n}\n\n/**\n * This makes the code PHP-5 only (particularly the call to \"get_headers\")\n */\nfunction copyUserStyleFrom($url, $name, $knownStyles) {\n $userStyle = $url.\"inc/user.css\";\n if(in_array($url, $knownStyles)) {\n // TODO add log message\n } else {\n $statusCode = get_http_response_code($userStyle);\n if(intval($statusCode)<300) {\n $styleSheet = file_get_contents($userStyle);\n $siteFolder = getSiteFolder($url);\n if(!file_exists($siteFolder)) {\n mkdir($siteFolder);\n }\n if(!file_exists($siteFolder.'/user.css')) {\n // Copy stylesheet\n file_put_contents($siteFolder.'/user.css', $styleSheet);\n }\n if(!file_exists($siteFolder.'/README.md')) {\n // Then write a readme.md file\n file_put_contents($siteFolder.'/README.md', \n \"User style from \".$name.\"\\n\"\n .\"=============================\"\n .\"\\n\\n\"\n .\"This stylesheet was downloaded from \".$userStyle.\" on \".date(DATE_RFC822)\n );\n }\n if(!file_exists($siteFolder.'/config.ini')) {\n // Write a config file containing useful informations\n file_put_contents($siteFolder.'/config.ini', \n \"site_url=\".$url.\"\\n\"\n .\"site_name=\".$name.\"\\n\"\n );\n }\n if(!file_exists($siteFolder.'/home.png')) {\n // And finally copy generated thumbnail\n $homeThumb = $siteFolder.'/home.png';\n file_put_contents($siteFolder.'/home.png', file_get_contents(getThumbnailUrl($url)));\n }\n echo 'Theme have been downloaded from '.$url.' into '.$siteFolder\n .'. It looks like
    ';\n }\n }\n}\n\nfunction getThumbnailUrl($url) {\n return 'http://api.webthumbnail.org/?url='.$url;\n}\n\nfunction copyUserStylesFrom($urlToNames, $knownStyles) {\n foreach($urlToNames as $url => $name) {\n copyUserStyleFrom($url, $name, $knownStyles);\n }\n}\n\n/**\n * Reading directory list, courtesy of http://www.laughing-buddha.net/php/dirlist/\n * @param directory the directory we want to list files of\n * @return a simple array containing the list of absolute file paths. Notice that current file (\".\") and parent one(\"..\")\n * are not listed here\n */\nfunction getDirectoryList ($directory) {\n $realPath = realpath($directory);\n // create an array to hold directory list\n $results = array();\n // create a handler for the directory\n $handler = opendir($directory);\n // open directory and walk through the filenames\n while ($file = readdir($handler)) {\n // if file isn't this directory or its parent, add it to the results\n if ($file != \".\" && $file != \"..\") {\n $results[] = realpath($realPath . \"/\" . $file);\n }\n }\n // tidy up: close the handler\n closedir($handler);\n // done!\n return $results;\n}\n\n/**\n * Start in themes folder and look in all subfolders for config.ini files. \n * These config.ini files allow us not to download styles again and again\n */\nfunction findKnownStyles() {\n $result = array();\n $subFolders = getDirectoryList(\"themes\");\n foreach($subFolders as $folder) {\n $configFile = $folder.\"/config.ini\";\n if(file_exists($configFile)) {\n $iniParameters = parse_ini_file($configFile);\n array_push($result, $iniParameters['site_url']);\n }\n }\n return $result;\n}\n\n$knownStyles = findKnownStyles();\ncopyUserStylesFrom(createShaarliHashFromOPMLL(SHAARLI_RSS_OPML), $knownStyles);\n\n", - "title": "Download CSS styles for shaarlis listed in an opml file" - }, - { - "location": "/Datastore-hacks/", - "text": "Decode datastore content\n\n\nTo display the array representing the data saved in \ndata/datastore.php\n, use the following snippet:\n\n\n$data = \"tZNdb9MwFIb... \";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"
    \"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"
    \";\nexit;\n\n\n\n\nThis will output the internal representation of the datastore, \"unobfuscated\" (if this can really be considered obfuscation).\n\n\nAlternatively, you can transform to JSON format (and pretty-print if you have \njq\n installed):\n\n\nphp -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace(\"!.*/\\* (.+) \\*/.*!\", \"$1\", file_get_contents(\"data/datastore.php\")))))));' | jq .\n\n\n\n\nChanging the timestamp for a link\n\n\n\n\nLook for \n\n in \ntpl/editlink.tpl\n (line 14)\n\n\nReplace \ntype=\"hidden\"\n with \ntype=\"text\"\n from this line\n\n\nA new date/time field becomes available in the edit/new link dialog.\n\n\nYou can set the timestamp manually by entering it in the format \nYYYMMDD_HHMMS\n.", - "title": "Datastore hacks" - }, - { - "location": "/Datastore-hacks/#decode-datastore-content", + "location": "/Various-hacks/#decode-datastore-content", "text": "To display the array representing the data saved in data/datastore.php , use the following snippet: $data = \"tZNdb9MwFIb... \";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"
    \"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"
    \";\nexit; This will output the internal representation of the datastore, \"unobfuscated\" (if this can really be considered obfuscation). Alternatively, you can transform to JSON format (and pretty-print if you have jq installed): php -r 'print(json_encode(unserialize(gzinflate(base64_decode(preg_replace(\"!.*/\\* (.+) \\*/.*!\", \"$1\", file_get_contents(\"data/datastore.php\")))))));' | jq .", "title": "Decode datastore content" }, { - "location": "/Datastore-hacks/#changing-the-timestamp-for-a-link", + "location": "/Various-hacks/#changing-the-timestamp-for-a-shaare", "text": "Look for in tpl/editlink.tpl (line 14) Replace type=\"hidden\" with type=\"text\" from this line A new date/time field becomes available in the edit/new link dialog. You can set the timestamp manually by entering it in the format YYYMMDD_HHMMS .", - "title": "Changing the timestamp for a link" + "title": "Changing the timestamp for a shaare" + }, + { + "location": "/Various-hacks/#see-also", + "text": "Add a new custom field to shaares (example patch) Download CSS styles for shaarlis listed in an opml file Copy an existing Shaarli installation over SSH, and serve it locally Create multiple Shaarli instances, generate an HTML index of them", + "title": "See also" }, { "location": "/Troubleshooting/", diff --git a/doc/html/search.html b/doc/html/search.html index b492b8bd..49541cda 100644 --- a/doc/html/search.html +++ b/doc/html/search.html @@ -148,19 +148,7 @@
  • - Copy an existing installation over SSH and serve it locally -
  • -
  • - - Create and serve multiple Shaarlis (farm) -
  • -
  • - - Download CSS styles from an OPML list -
  • -
  • - - Datastore hacks + Various hacks
  • diff --git a/doc/html/sitemap.xml b/doc/html/sitemap.xml index 534f02b5..2a1b009e 100644 --- a/doc/html/sitemap.xml +++ b/doc/html/sitemap.xml @@ -132,25 +132,7 @@ - /Copy-an-existing-installation-over-SSH-and-serve-it-locally/ - 2017-06-18 - daily - - - - /Create-and-serve-multiple-Shaarlis-(farm)/ - 2017-06-18 - daily - - - - /Download-CSS-styles-from-an-OPML-list/ - 2017-06-18 - daily - - - - /Datastore-hacks/ + /Various-hacks/ 2017-06-18 daily diff --git a/doc/md/Browsing-and-searching.md b/doc/md/Browsing-and-searching.md index ad62c2f0..35707482 100644 --- a/doc/md/Browsing-and-searching.md +++ b/doc/md/Browsing-and-searching.md @@ -20,4 +20,4 @@ To search for links that are not tagged, enter `""` in the tag search field. ## Filtering RSS feeds/Picture wall -RSS feeds can also be restricted to only return items matching a text/tag search: see [[RSS feeds]]. +RSS feeds can also be restricted to only return items matching a text/tag search: see [RSS feeds](RSS feeds). diff --git a/doc/md/Community-&-Related-software.md b/doc/md/Community-&-Related-software.md index 6ff7ed45..b8b7cccd 100644 --- a/doc/md/Community-&-Related-software.md +++ b/doc/md/Community-&-Related-software.md @@ -34,7 +34,7 @@ _TODO: contact repos owners to see if they'd like to standardize their work with ### Themes -See [[Theming]] for the list of community-contributed themes, and an installation guide. +See [Theming](Theming) for the list of community-contributed themes, and an installation guide. ### Server apps - [shaarchiver](https://github.com/nodiscc/shaarchiver) - Archive your Shaarli bookmarks and their content diff --git a/doc/md/Continuous-integration-tools.md b/doc/md/Continuous-integration-tools.md index 30dc474d..849257f7 100644 --- a/doc/md/Continuous-integration-tools.md +++ b/doc/md/Continuous-integration-tools.md @@ -1,20 +1,20 @@ ## Local development A [`Makefile`](https://github.com/shaarli/Shaarli/blob/master/Makefile) is available to perform project-related operations: - Documentation - generate a local HTML copy of the GitHub wiki -- [[Static analysis]] - check that the code is compliant to PHP conventions -- [[Unit tests]] - ensure there are no regressions introduced by new commits +- [Static analysis](Static analysis) - check that the code is compliant to PHP conventions +- [Unit tests](Unit tests) - ensure there are no regressions introduced by new commits ## Automatic builds [Travis CI](http://docs.travis-ci.com/) is a Continuous Integration build server, that runs a build: - each time a commit is merged to the mainline (`master` branch) - each time a Pull Request is submitted or updated -A build is composed of several jobs: one for each supported PHP version (see [[Server requirements]]). +A build is composed of several jobs: one for each supported PHP version (see [Server requirements](Server requirements)). Each build job: - updates Composer - installs 3rd-party test dependencies with Composer -- runs [[Unit tests]] +- runs [Unit tests](Unit tests) After all jobs have finished, Travis returns the results to GitHub: - a status icon represents the result for the `master` branch: [![](https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli) diff --git a/doc/md/Development-guidelines.md b/doc/md/Development-guidelines.md index 1480ec89..3a248767 100644 --- a/doc/md/Development-guidelines.md +++ b/doc/md/Development-guidelines.md @@ -2,8 +2,8 @@ Please have a look at the following pages: - [Contributing to Shaarli](https://github.com/shaarli/Shaarli/tree/master/CONTRIBUTING.md) -- [[Static analysis]] - patches should try to stick to the [PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially: +- [Static analysis](Static analysis) - patches should try to stick to the [PHP Standard Recommendations](http://www.php-fig.org/psr/) (PSR), especially: - [PSR-1](http://www.php-fig.org/psr/psr-1/) - Basic Coding Standard - [PSR-2](http://www.php-fig.org/psr/psr-2/) - Coding Style Guide -- [[Unit tests]] -- [[GnuPG signature]] for tags/releases +- [Unit tests](Unit tests) +- [GnuPG signature](GnuPG signature) for tags/releases diff --git a/doc/md/Firefox-share.md b/doc/md/Firefox-share.md index 9ba57b04..595b9400 100644 --- a/doc/md/Firefox-share.md +++ b/doc/md/Firefox-share.md @@ -8,7 +8,7 @@ ### Sharing links using Firefox share * Add the sharing service as described above - * When you are visiting a webpage you would like to share with Shaarli, click the Firefox _Share_ button [[images/firefoxshare.png]] + * When you are visiting a webpage you would like to share with Shaarli, click the Firefox _Share_ button [images/firefoxshare.png](images/firefoxshare.png) * You can edit your link before and after saving, just like the bookmarklet above. |  | Your Shaarli instance must be hosted on an HTTPS (SSL/TLS secure connection) enabled server for Firefox Share to work. Firefox Share will not work over plain HTTP connections. | diff --git a/doc/md/GnuPG-signature.md b/doc/md/GnuPG-signature.md index 1fb3b42f..62a17d33 100644 --- a/doc/md/GnuPG-signature.md +++ b/doc/md/GnuPG-signature.md @@ -73,4 +73,4 @@ gpg: sending key A9D53A3E to hkp server pgp.mit.edu ## Create and push a GPG-signed tag -See [[Release Shaarli]]. +See [Release Shaarli](Release Shaarli). diff --git a/doc/md/Theming.md b/doc/md/Theming.md index ae68db38..d72c2ffd 100644 --- a/doc/md/Theming.md +++ b/doc/md/Theming.md @@ -15,7 +15,7 @@ This file allows overriding rules defined in the template CSS files (only add ch **Note**: Do not edit `tpl/default/css/shaarli.css`! Your changes would be overridden when updating Shaarli. -See also [[Download CSS styles from an OPML list]] +See also [Download CSS styles from an OPML list](Download CSS styles from an OPML list) ## Themes @@ -77,7 +77,7 @@ Get config written: - fill the install form - log in to Shaarli -Edit Shaarli's [[configuration|Shaarli configuration]]: +Edit Shaarli's [configuration|Shaarli configuration](configuration|Shaarli configuration): ```bash # the file should be owned by Apache, thus not writeable => sudo $ sudo sed -i s=tpl=tpl/albinomouse-template=g shaarli/data/config.php diff --git a/doc/md/Upgrade-and-migration.md b/doc/md/Upgrade-and-migration.md index 7348891f..2002a4e2 100644 --- a/doc/md/Upgrade-and-migration.md +++ b/doc/md/Upgrade-and-migration.md @@ -13,7 +13,7 @@ Shaarli stores all user data under the `data` directory: - `data/ipbans.php` - banned IP addresses - `data/updates.txt` - contains all automatic update to the configuration and datastore files already run -See [[Shaarli configuration]] for more information about Shaarli resources. +See [Shaarli configuration](Shaarli configuration) for more information about Shaarli resources. It is recommended to backup this repository _before_ starting updating/upgrading Shaarli: - users with SSH access: copy or archive the directory to a temporary location @@ -25,7 +25,7 @@ As all user data is kept under `data`, this is the only directory you need to wo - backup the `data` directory - install or update Shaarli: - - fresh installation - see [[Download and installation]] + - fresh installation - see [Download and installation](Download and installation) - update - see the following sections - check or restore the `data` directory @@ -33,11 +33,11 @@ As all user data is kept under `data`, this is the only directory you need to wo All tagged revisions can be downloaded as tarballs or ZIP archives from the [releases](https://github.com/shaarli/Shaarli/releases) page. -We recommend that you use the latest release tarball with the `-full` suffix. It contains the dependencies, please read [[Download and installation]] for `git` complete instructions. +We recommend that you use the latest release tarball with the `-full` suffix. It contains the dependencies, please read [Download and installation](Download and installation) for `git` complete instructions. Once downloaded, extract the archive locally and update your remote installation (e.g. via FTP) -be sure you keep the content of the `data` directory! -After upgrading, access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [[Shaarli configuration]] for more details). +After upgrading, access your fresh Shaarli installation from a web browser; the configuration and data store will then be automatically updated, and new settings added to `data/config.json.php` (see [Shaarli configuration](Shaarli configuration) for more details). ## Upgrading with Git @@ -170,7 +170,7 @@ Total 3317 (delta 2050), reused 3301 (delta 2034)to #### Step 3: configuration -After migrating, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to `data/config.php` (see [[Shaarli configuration]] for more details). +After migrating, access your fresh Shaarli installation from a web browser; the configuration will then be automatically updated, and new settings added to `data/config.php` (see [Shaarli configuration](Shaarli configuration) for more details). ## Troubleshooting -- 2.41.0