From 8ab60cce44e05bad28aa0297eabc526975932ef9 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 25 Jun 2020 20:14:06 +0200 Subject: [PATCH] Add shortcodes to improve integration between distromatic static pages and wordpress --- cgi-bin/text-to-html-filter-idx.cgi | 34 +++++++++++ cgi-bin/text-to-html-filter.cgi | 24 ++++++++ distribution/distromatic.naked.en.html | 1 - distribution/distromatic.naked.html | 4 ++ distribution/distromatic.naked.it.html | 9 --- distribution/download.en.html | 81 ++++++++++++++++++++++++- distribution/download.it.html | 81 +++++++++++++++++++++++++ distribution/images/packages_gr.png | Bin 0 -> 4913 bytes distribution/showfile.naked.en.html | 18 ++++++ distribution/showfile.naked.html | 5 ++ distribution/showfile.naked.it.html | 18 ++++++ functions.php | 58 ++++++++++++++++-- style.css | 20 ++++++ 13 files changed, 338 insertions(+), 15 deletions(-) create mode 100755 cgi-bin/text-to-html-filter-idx.cgi create mode 100755 cgi-bin/text-to-html-filter.cgi create mode 100644 distribution/distromatic.naked.html create mode 100644 distribution/images/packages_gr.png create mode 100644 distribution/showfile.naked.en.html create mode 100644 distribution/showfile.naked.html create mode 100644 distribution/showfile.naked.it.html diff --git a/cgi-bin/text-to-html-filter-idx.cgi b/cgi-bin/text-to-html-filter-idx.cgi new file mode 100755 index 0000000..497872c --- /dev/null +++ b/cgi-bin/text-to-html-filter-idx.cgi @@ -0,0 +1,34 @@ +#!/bin/bash +echo $header +ext=${file/*.} +range=10000 +filename="/var/www/www.openmamba.org/$file" +filename_check=`readlink -f $filename` +[ "${filename_check:0:27}" = "/mnt/sdc1/ftp/pub/openmamba" ] || exit 0 +filelines=`wc -l $filename | awk '{ print $1 }'` +filepages=`expr $filelines / $range + 1` +if [ "$page" ]; then + [ $page -gt 0 ] || page=1 +else + page=1 +fi +from=`expr \( $page - 1 \) \* $range + 1` +to=`expr $from \+ $range - 1` +nextpage=`expr $page + 1` +prevpage=`expr $page - 1` +[ $from -ge $range ] && echo -n "< " || echo -n "< " +idxsize=20 +[ $page -gt $idxsize ] && idxfrom=`expr $page - $idxsize` || idxfrom=1 +idxto=`expr $idxfrom + $idxsize \* 2` +[ $idxto -le $filepages ] || idxto=$filepages +[ $filepages -gt $idxsize ] && idxst=`expr $page - $idxsize` || idxst=1 +for i in `seq $idxfrom $idxto`; do + if [ $i -eq $page ]; then + echo -n "$i " + else + echo -n "$i " + fi +done +[ $to -lt $filelines ] && echo -n "> " || echo -n "> " +echo +exit 0 diff --git a/cgi-bin/text-to-html-filter.cgi b/cgi-bin/text-to-html-filter.cgi new file mode 100755 index 0000000..44f43e5 --- /dev/null +++ b/cgi-bin/text-to-html-filter.cgi @@ -0,0 +1,24 @@ +#!/bin/bash +echo $header +ext=${file/*.} +range=10000 +filename="/var/www/www.openmamba.org/$file" +filename_check=`readlink -f $filename` +[ "${filename_check:0:27}" = "/mnt/sdc1/ftp/pub/openmamba" ] || exit 0 +if [ "$page" ]; then + [ $page -gt 0 ] || page=1 +else + page=1 +fi +from=`expr \( $page - 1 \) \* $range + 1` +to=`expr $from \+ $range - 1` +if [ "$ext" = "log" -o "$ext" = "spec" -o "$ext" = "patch" -o "$ext" = "diff" ]; then + /bin/sed -n "${from},${to}p" $filename | /bin/sed -e 's|\&|\&|g' \ + -e 's|<|\<|g' \ + -e 's|>|\>|g' \ + -e 's|\([[:alpha:][:digit:]]*\)\@[[:alpha:][:digit:]]*\.[[:alpha:][:digit:]\.]*|\1@...|g' + #'s|\&|\\&|g' -e 's|<|\<|g' -e 's|>|\>|g' -e 's|\([[:alpha:][:digit:]]*\)\@[[:alpha:][:digit:]]*\.[[:alpha:][:digit:]\.]*|\1@...|g' /var/www/www.openmamba.org/$file +else + /bin/sed -n "${from},${to}p" $filename +fi +exit 0 diff --git a/distribution/distromatic.naked.en.html b/distribution/distromatic.naked.en.html index df19f82..ccd0805 100644 --- a/distribution/distromatic.naked.en.html +++ b/distribution/distromatic.naked.en.html @@ -62,7 +62,6 @@ -

diff --git a/distribution/distromatic.naked.html b/distribution/distromatic.naked.html new file mode 100644 index 0000000..d05a67d --- /dev/null +++ b/distribution/distromatic.naked.html @@ -0,0 +1,4 @@ + + + + diff --git a/distribution/distromatic.naked.it.html b/distribution/distromatic.naked.it.html index ed72f69..c5c9bee 100644 --- a/distribution/distromatic.naked.it.html +++ b/distribution/distromatic.naked.it.html @@ -62,9 +62,7 @@ - -
-
[repository] : @@ -81,11 +79,7 @@

- -
-
-
[repository] @@ -100,6 +94,3 @@ [modifiche] - -
diff --git a/distribution/download.en.html b/distribution/download.en.html index 03f99d9..b9dec6f 100644 --- a/distribution/download.en.html +++ b/distribution/download.en.html @@ -1 +1,80 @@ - + + + + + + + + + + + + + + + + +
+
+ + + + + +
download
+
+
+

Thank you for your interest in openmamba. +

openmamba is a "free as in speech" operating system but letting you use the web site and download it is a cost for us. +If you like this project you can help to keep it alive and make it better with your contribution by making a donation. + +

+ +
+ +
+
+ +

Download in progress...

+

Download for will automatically start in a few seconds. +If it doesn't start, please click ">here. +

This file is downloaded from

+

Not registered yet? Please register to get +the best from openmamba services and to be informed on the latest news. + +Sorry, there was an error with the request: invalid file. + +Sorry, there was an error with the request: invalid file. + +

+

+ \ No newline at end of file diff --git a/distribution/download.it.html b/distribution/download.it.html index bbb72eb..d088458 100644 --- a/distribution/download.it.html +++ b/distribution/download.it.html @@ -1 +1,82 @@ + + + + + + + + + + + + + + + + +
+
+ + + + + +
download
+
+
+

Grazie per il tuo interessamento al progetto openmamba. +

openmamba è un sistema libero e gratuito ma per darti la possibilità di usufruire dei servizi di questo sito e del download +mambaSoft deve sostenere delle spese non trascurabili. Se openmamba ti piace puoi aiutare a fare in modo +che continui ad esistere e migliorare attraverso il tuo contributo effettuando una donazione. + +

+ +
+ +
+
+ +

Scaricamento in corso...

+

Il download del file partirà automaticamente entro pochi secondi. Se non dovesse +partire fai click " download>qui. +

Il file viene scaricato dal sito

+

Non ti sei ancora registrato? Registrati per utilizzare al meglio i servizi di +openmamba ed essere sempre informato sulle ultime novità. + +Sorry, there was an error with the request: invalid file. + +Sorry, there was an error with the request: invalid file given. + +

+

+ diff --git a/distribution/images/packages_gr.png b/distribution/images/packages_gr.png new file mode 100644 index 0000000000000000000000000000000000000000..e098a2eae146423df4dd5c25d6c009dffbbe98ec GIT binary patch literal 4913 zcmV-16VB|3P)1un~g95(;}623`9 zK~#9!<(qkM99NykKYh-nxillq=&)nUwiI9S9oxZ2ZftN4NGQXSunDjbid||$iY$RZ zSYX*BMN$jPkqVnlWg!W>IqW2m1hC_PZwJR$d`h-tNh4X;Xf*fqwSV;JmVCwbno3u_ z>YmYb_xpa|_jkPCdlLHk`Yb-chj=Mp<|-V;+5MXj9sw>hhWp?bk^i_5<=szFXnp>YsUxJw*0&fs^!?)?|Xg}lq&Xy;!HY`T?!x9SdV}Dr$ zxLbaVYvUxOrk_B~Rq)}zf!YNyYbmb65v162B$LVU!8bn%dmliEUWK5a!m)W3$&*_y zct3>;?F3z&|ATbodkDEEsGbcoR)VJlC;%E*I&5A~p(oGrX&b1TP%}RG>V?S5?!`*A zlKcIW=!rCm*-zlBy%j+aE-wYRQd{xtScbg!^9UshT>E#hXf1exKtIP8SQgA!jB3U4 zwf~evA~6p5MaauO4}yW<4d7gT4^p@k@9ul(+xH6$!?-*Y;3^zNc<(`^?v3E9gqgQN zw6-|n`Qo`Sr~p$3Lx(+YW3;q#tmbtpCe1|@#R2eQ?JA@NYk};Lmc!DLWH!7?q2V~` zsb9mr=<6to^1cX=&l@;B2#3Cf6nhRFB{2W9F!5>-^deZZIPxQ!RczDdA;nG*YJZ$= z?_)&zehr7dfmr(yqy?WWf-aJV4rmC9faj*0LD__{|4}mOHk51r6}QKG=?IVn1IO_n zAf5OzND|cD0kt0m$t-r*It}>#OAAyd))g}-t$z*ch=AI=4zYF((t^J#g4c?zUp;!U znRu2hK~No-JAO$%)sAuP&+rB#7vBWjZBHT|{w{)7UBNIrmcIjUWiQVbULHRspmEXd37m*+a+Z zeS0@rU_R0fzrYuna&ZW7b-#jiO{m3KSN;R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D4HrYeCo<5TrqG?C;k5(Awx7V1-RO(%L|Xg_e8JEF@UyA>Tyz2e zdQP>Hc(6}bxiu`8idKU;0+W>P=O@SJREpm zAGCL2rZTi{J4VBs`_Z!n^xBoM>@#?(rwuD@i{gdZ=`UQ2{~AjslXR|s1a0dtD5;*n zw2yrPY069pRTcwJ9B8w_CzH_L2B{Qne{SIT@Ai_7r!cB!VO@70u1Vw9^eXla6EAKk~AsekhwlCd7!v#+=p=kznz^e<}y z0P^`fZGU{0hUu3j!)yNoeO3c#2ZP*Iym~~cH+m|MtSzLsp((#1OVu|PHe|- z=y~c3$fCfEk9``|V^P21Ejr$7z*IaJ+_PU+1oS6NvE6Uc@$=6^Hi4;|7^Z|ido{vE z@a&fz0d`Jf(e~a>PCfNiw2}zs(z|e0)LazLepwRGf5hW)QmGV{W#RF7@caE2+_PWS j1YB;1$OruRz!UI)Fxq;=OdUOu00000NkvXXu0mjfkwq<0 literal 0 HcmV?d00001 diff --git a/distribution/showfile.naked.en.html b/distribution/showfile.naked.en.html new file mode 100644 index 0000000..c95bf5d --- /dev/null +++ b/distribution/showfile.naked.en.html @@ -0,0 +1,18 @@ + + + + + + + + +

Package

+
Pages: 
+ + +
+
+

+
+
+
diff --git a/distribution/showfile.naked.html b/distribution/showfile.naked.html new file mode 100644 index 0000000..ba4d20c --- /dev/null +++ b/distribution/showfile.naked.html @@ -0,0 +1,5 @@ + + + + + diff --git a/distribution/showfile.naked.it.html b/distribution/showfile.naked.it.html new file mode 100644 index 0000000..cf8c58a --- /dev/null +++ b/distribution/showfile.naked.it.html @@ -0,0 +1,18 @@ + + + + +" --> + + + +

Pacchetto

+
Pagine: 
+ + +
+
+

+
+
+
diff --git a/functions.php b/functions.php index 88a535a..d035609 100644 --- a/functions.php +++ b/functions.php @@ -223,7 +223,7 @@ function openmamba_webbuild_status_func() { // print "
"; print "

AJAX support is not enabled in your browser. Live page updates will not be available, press Reload to update.

"; print "Loading, please wait..."; - print "";//
"; + print "";//
"; } add_shortcode('openmamba_webbuild_status', 'openmamba_webbuild_status_func'); @@ -240,14 +240,64 @@ function openmamba_distroquery_func() { else $outputlang = "en_US.UTF-8"; - $ret = "

AJAX support is not enabled in your browser. Live page updates will not be available, press Reload to update.

"; - $ret .= "

"; + $ret = "Loading, please wait...
"; $ret .= "
 "; - $ret .= ""; + $ret .= ""; + return $ret; } add_shortcode('openmamba_distroquery', 'openmamba_distroquery_func'); +function openmamba_distromatic_func() { + + $urlargspos = strpos($_SERVER[REQUEST_URI], '?'); + if ($urlargspos > 0) { + $urlargs = substr($_SERVER[REQUEST_URI], $urlargspos + 1); + } + + $outputlang = get_bloginfo("language"); + if (substr($outputlang, 0, 2) == "it") + $outputlang = "it_IT.UTF-8"; + else + $outputlang = "en_US.UTF-8"; + + $ret = "" . "Loading, please wait..." . "
"; + $ret .= ""; + + return $ret; +} +add_shortcode('openmamba_distromatic', 'openmamba_distromatic_func'); + +function openmamba_showfile_func() { + + $urlargspos = strpos($_SERVER[REQUEST_URI], '?'); + if ($urlargspos > 0) { + $urlargs = substr($_SERVER[REQUEST_URI], $urlargspos + 1); + } + + $ret = "" . "Loading, please wait..." . "
"; + $ret .= ""; + + return $ret; +} +add_shortcode('openmamba_showfile', 'openmamba_showfile_func'); + +function openmamba_downloadfile_func() { + + $urlargspos = strpos($_SERVER[REQUEST_URI], '?'); + if ($urlargspos > 0) { + $urlargs = substr($_SERVER[REQUEST_URI], $urlargspos + 1); + parse_str($urlargs, $args); + if ($args['file']) { + $ret = "" . "Starting download of " . basename($args['file']) . ", please wait..." . "

"; + $ret .= ""; + } + } + + return $ret; +} +add_shortcode('openmamba_downloadfile', 'openmamba_downloadfile_func'); + // bbpress tag cloud add_filter('widget_tag_cloud_args','set_number_tags'); function set_number_tags($args) { diff --git a/style.css b/style.css index 10b1b36..2a39119 100644 --- a/style.css +++ b/style.css @@ -239,3 +239,23 @@ div#ag-terms { margin-top:10px; margin-bottom:10px; } + +/* Distromatic */ +span#distromatic table, +span#distromatic table tr, +span#distromatic table td { + + padding:0; + border:0; +} + +span#distromatic table td img { + max-width:initial; + padding: 2px; +} + +span#distromatic table td hr { + margin: 0; + margin-top: 5px; + margin-bottom: 5px; +}