aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/html/mkdocs/search_index.json
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/mkdocs/search_index.json')
-rw-r--r--doc/html/mkdocs/search_index.json37
1 files changed, 11 insertions, 26 deletions
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 @@
691 "title": "Import Shaarli links to Firefox" 691 "title": "Import Shaarli links to Firefox"
692 }, 692 },
693 { 693 {
694 "location": "/Copy-an-existing-installation-over-SSH-and-serve-it-locally/", 694 "location": "/Various-hacks/",
695 "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]: /...", 695 "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... <Commented content inside datastore.php>\";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"<pre>\"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"</pre>\";\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<input type=\"hidden\" name=\"lf_linkdate\" value=\"{$link.linkdate}\">\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",
696 "title": "Copy an existing installation over SSH and serve it locally" 696 "title": "Various hacks"
697 }, 697 },
698 { 698 {
699 "location": "/Create-and-serve-multiple-Shaarlis-(farm)/", 699 "location": "/Various-hacks/#decode-datastore-content",
700 "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='<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<!-- Minimal html template thanks to http://www.sitepoint.com/a-minimal-html-document/ -->\n<html lang=\"en\">\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n <title>My Shaarli farm</title>\n <style>body {font-family: \"Open Sans\"}</style>\n </head>\n <body>\n <div>\n <h1>My Shaarli farm</h1>\n <ul style=\"list-style-type: none;\">'\n\naccountlinks=''\n\nhtmlfooter='\n </ul>\n </div>\n </body>\n</html>' \n\n\n\nfor account in $accounts; do accountlinks=\"$accountlinks\\n<li><a href=\\\"$account\\\">$account</a></li>\"; 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",
701 "title": "Create and serve multiple Shaarlis (farm)"
702 },
703 {
704 "location": "/Download-CSS-styles-from-an-OPML-list/",
705 "text": "Download CSS styles for shaarlis listed in an opml file\n\n\nExample php script:\n\n\n<!---- ?php -->\n<!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) -->\n<!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) -->\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 <a href=\"'.$url.'\">'.$url.'</a> into '.$siteFolder\n .'. It looks like <img src=\"'.$homeThumb.'\"><br/>';\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<!--- ? ---->",
706 "title": "Download CSS styles from an OPML list"
707 },
708 {
709 "location": "/Download-CSS-styles-from-an-OPML-list/#download-css-styles-for-shaarlis-listed-in-an-opml-file",
710 "text": "Example php script: <!---- ?php -->\n<!---- Copyright (c) 2014 Nicolas Delsaux (https://github.com/Riduidel) -->\n<!---- License: zlib (http://www.gzip.org/zlib/zlib_license.html) -->\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 <a href=\"'.$url.'\">'.$url.'</a> into '.$siteFolder\n .'. It looks like <img src=\"'.$homeThumb.'\"><br/>';\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<!--- ? ---->",
711 "title": "Download CSS styles for shaarlis listed in an opml file"
712 },
713 {
714 "location": "/Datastore-hacks/",
715 "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... <Commented content inside datastore.php>\";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"<pre>\"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"</pre>\";\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<input type=\"hidden\" name=\"lf_linkdate\" value=\"{$link.linkdate}\">\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.",
716 "title": "Datastore hacks"
717 },
718 {
719 "location": "/Datastore-hacks/#decode-datastore-content",
720 "text": "To display the array representing the data saved in data/datastore.php , use the following snippet: $data = \"tZNdb9MwFIb... <Commented content inside datastore.php>\";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"<pre>\"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"</pre>\";\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 .", 700 "text": "To display the array representing the data saved in data/datastore.php , use the following snippet: $data = \"tZNdb9MwFIb... <Commented content inside datastore.php>\";\n$out = unserialize(gzinflate(base64_decode($data)));\necho \"<pre>\"; // Pretty printing is love, pretty printing is life\nprint_r($out);\necho \"</pre>\";\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 .",
721 "title": "Decode datastore content" 701 "title": "Decode datastore content"
722 }, 702 },
723 { 703 {
724 "location": "/Datastore-hacks/#changing-the-timestamp-for-a-link", 704 "location": "/Various-hacks/#changing-the-timestamp-for-a-shaare",
725 "text": "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 .", 705 "text": "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 .",
726 "title": "Changing the timestamp for a link" 706 "title": "Changing the timestamp for a shaare"
707 },
708 {
709 "location": "/Various-hacks/#see-also",
710 "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",
711 "title": "See also"
727 }, 712 },
728 { 713 {
729 "location": "/Troubleshooting/", 714 "location": "/Troubleshooting/",