From 0433c688b9be6097b85a8fec31b3dacd0ab81677 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Sun, 18 Jun 2017 06:32:30 +0200 Subject: make htmlpages --- doc/html/3rd-party-libraries/index.html | 14 +- .../Backup,-restore,-import-and-export/index.html | 18 +- doc/html/Bookmarklet/index.html | 14 +- doc/html/Browsing-and-searching/index.html | 14 +- doc/html/Coding-guidelines/index.html | 14 +- doc/html/Community-&-Related-software/index.html | 14 +- doc/html/Continuous-integration-tools/index.html | 14 +- .../index.html | 403 ----------------- .../index.html | 396 ---------------- doc/html/Datastore-hacks/index.html | 369 --------------- 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 +- doc/html/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 +- doc/html/Various-hacks/index.html | 367 +++++++++++++++ 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 +- 43 files changed, 420 insertions(+), 2182 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/Datastore-hacks/index.html delete mode 100644 doc/html/Download-CSS-styles-from-an-OPML-list/index.html create mode 100644 doc/html/Various-hacks/index.html (limited to 'doc/html') 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/Datastore-hacks/index.html b/doc/html/Datastore-hacks/index.html deleted file mode 100644 index b3d8d97e..00000000 --- a/doc/html/Datastore-hacks/index.html +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - Datastore hacks - Shaarli Documentation - - - - - - - - - - - - - - - - - -
    - - - - -
    - - - - - -
    -
    -
    - -
    -
    -
    -
    - -

    Decode datastore content

    -

    To display the array representing the data saved in data/datastore.php, use the following snippet:

    -
    $data = "tZNdb9MwFIb... <Commented content inside datastore.php>";
    -$out = unserialize(gzinflate(base64_decode($data)));
    -echo "<pre>"; // Pretty printing is love, pretty printing is life
    -print_r($out);
    -echo "</pre>";
    -exit;
    -
    - -

    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 .
    -
    - - -
      -
    • Look for <input type="hidden" name="lf_linkdate" value="{$link.linkdate}"> 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.
    • -
    - -
    -
    - - -
    -
    - -
    - -
    - -
    - - - 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/Various-hacks/index.html b/doc/html/Various-hacks/index.html new file mode 100644 index 00000000..b06207ae --- /dev/null +++ b/doc/html/Various-hacks/index.html @@ -0,0 +1,367 @@ + + + + + + + + + + + Various hacks - Shaarli Documentation + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + +
    +
    +
    + +
    +
    +
    +
    + +

    Decode datastore content

    +

    To display the array representing the data saved in data/datastore.php, use the following snippet:

    +
    $data = "tZNdb9MwFIb... <Commented content inside datastore.php>";
    +$out = unserialize(gzinflate(base64_decode($data)));
    +echo "<pre>"; // Pretty printing is love, pretty printing is life
    +print_r($out);
    +echo "</pre>";
    +exit;
    +
    + +

    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 .
    +
    + +

    Changing the timestamp for a shaare

    +
      +
    • Look for <input type="hidden" name="lf_linkdate" value="{$link.linkdate}"> 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.
    • +
    +

    See also

    + + +
    +
    + + +
    +
    + +
    + +
    + +
    + + + GitHub + + + « 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 -- cgit v1.2.3