Wiki-Admin-Log: Unterschied zwischen den Versionen
(5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
− | == Wiki | + | == Wiki Localsettings.php == |
[[User:Tony Ford|Tony Ford]] ([[User talk:Tony Ford|talk]]) 18:38, 23 February 2013 (CET) | [[User:Tony Ford|Tony Ford]] ([[User talk:Tony Ford|talk]]) 18:38, 23 February 2013 (CET) | ||
Zeile 5: | Zeile 5: | ||
<source lang="php"> | <source lang="php"> | ||
+ | //##### extend max. imagesize for thumbnailing (sg 2013-02-15) ##### | ||
$wgMaxImageArea=64000000; | $wgMaxImageArea=64000000; | ||
$wgMaxShellMemory = 202400; | $wgMaxShellMemory = 202400; | ||
$wgUseImageMagick = false; | $wgUseImageMagick = false; | ||
− | $wgImageMagickConvertCommand = "/usr/bin/convert"; | + | $wgImageMagickConvertCommand = "/usr/bin/convert"; |
+ | |||
+ | //##### enable number headings (sg 2013-02-18) #### | ||
+ | $wgDefaultUserOptions['numberheadings'] = 1; | ||
+ | |||
+ | $wgUploadSizeWarning = 32483648; | ||
+ | $wgMaxUploadSize = 32483648; | ||
+ | |||
+ | //##### enable HTTPS Login (sg 2013-02-28) ##### | ||
+ | $wgSecureLogin=true; | ||
+ | $wgCookieSecure=false; | ||
+ | |||
+ | //##### added Sitemap - Extension (sg 2013-03-14) #### | ||
+ | |||
+ | //##### added new custom namespaces (sg 2013-05-02) ##### | ||
+ | define("NS_PROFIL",290); | ||
+ | define("NS_PROFIL_TALK",291); | ||
+ | $wgExtraNamespaces[NS_PROFIL] = "Profil"; | ||
+ | $wgExtraNamespaces[NS_PROFIL_TALK] = "Profil_talk"; | ||
+ | |||
+ | //##### extenstion - disable numberedheadings (sg 2013-06-01) ####### | ||
+ | require_once("$IP/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php"); | ||
+ | |||
+ | //##### open external links in new windows (sg 2013-07-16) ###### | ||
+ | $wgExternalLinkTarget = '_blank'; | ||
</source> | </source> | ||
Zeile 575: | Zeile 600: | ||
</script> | </script> | ||
+ | </source> | ||
+ | |||
+ | |||
+ | '''find''' | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php $this->renderPortals( $this->data['sidebar'] ); ?> | ||
+ | </source> | ||
+ | |||
+ | '''add lines before''' | ||
+ | |||
+ | <source lang="html4strict"> | ||
+ | <!-- OSEGradio - Extension (sg 23.03.2013) --> | ||
+ | |||
+ | <!-- sitemap - extension --> | ||
+ | <div id="sitemap" style="position:fixed; width:150px; left:-70px; top:35px; font-size:0.8em; -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); transform: rotate(-90deg); -ms-transform: rotate(-90deg); "> | ||
+ | <span id="OSEGradio" style="cursor:pointer; visibility:hidden;" onclick="parent.location.href='<?php echo $wgProto; ?>://wiki.opensourceecology.de/extensions/OSEGradio/osegradio_index.php?title=' + parent.location.href;" onmouseover="this.style.color='blue';" onmouseout="this.style.color='black';">oseg-radio</span> | ||
+ | <span style="cursor:pointer;" onclick="javascript:load_sitemap();" onmouseover="this.style.color='blue';" onmouseout="this.style.color='black';">sitemap</span> | ||
+ | </div> | ||
+ | <!-- /sitemap --> | ||
</source> | </source> | ||
Zeile 623: | Zeile 668: | ||
$profil_arr=explode(' | $profil_arr=explode(' | ||
|',$profil); | |',$profil); | ||
− | $TEMP=''; | + | $radio_flag=false; $TEMP2=''; $i=0; $radio_count=0; |
+ | array_shift($profil_arr); | ||
+ | |||
+ | $TEMP='<div style="display:; position:relative; left:0%; width:70%; top:0%; overflow:auto; opacity:1; height:80%;"><table class="table table-condensed" style="border:2px solid grey; border-radius:5px;">'; | ||
while(sizeof($profil_arr)>0){ | while(sizeof($profil_arr)>0){ | ||
$arr=explode('=',(array_shift($profil_arr))); | $arr=explode('=',(array_shift($profil_arr))); | ||
− | if($ | + | if(preg_match('/>/',$arr[1])){ |
− | + | if($radio_count==0){ | |
− | + | $TEMP.='<tr><td></td><td width="80">keine Kenntnisse</td><td width="80">Basiskenntnisse</td><td width="80">Fortgeschritten</td><td width="80">Experte</td></tr> | |
− | + | '; | |
− | $TEMP.=' | + | |
− | /','',preg_replace('/ | + | } |
− | '; | + | $TEMP.='<tr align="center"><td align="left">'.preg_replace('/ |
+ | |>/','',$arr[1]).'</td><td><input type="radio" name="'.$arr[0].'" value="" checked onclick="editProfil()"></td> | ||
+ | <td><input type="radio" name="'.$arr[0].'" value="1" onclick="editProfil()"></td> | ||
+ | <td><input type="radio" name="'.$arr[0].'" value="2" onclick="editProfil()"></td> | ||
+ | <td><input type="radio" name="'.$arr[0].'" value="3" onclick="editProfil()"></td> | ||
+ | </tr>'; | ||
+ | $radio_count++; | ||
+ | if($radio_count>10) $radio_count=0; | ||
+ | } elseif(preg_match('/\.\.\./',$arr[1])){ | ||
+ | $TEMP.='<tr><td>'.preg_replace('/ | ||
+ | /','',$arr[1]).'</td><td colspan="4"><textarea class="input-xlarge" name="'.$arr[0].'" onchange="editProfil()"></textarea></td></tr>'; | ||
+ | } else { | ||
+ | $TEMP.='<tr><td>'.preg_replace('/ | ||
+ | /','',$arr[1]).'</td><td colspan="4"><input type="text" class="input-xlarge" size="40" name="'.$arr[0].'" onchange="editProfil()"></td></tr>'; | ||
} | } | ||
+ | |||
+ | $TEMP2.='arrrr['.$i++.']="'.$arr[0].'"; | ||
+ | '; | ||
+ | |||
} | } | ||
+ | $TEMP.='</table></div> | ||
+ | '; | ||
+ | |||
+ | $wgOut->addHTML($TEMP.' | ||
+ | <script type="text/JavaScript"> | ||
− | |||
− | |||
+ | function loadProfil(){ | ||
+ | |||
arrr=new Array(); | arrr=new Array(); | ||
arrrr=new Array(); | arrrr=new Array(); | ||
arrrrr=new Array(); | arrrrr=new Array(); | ||
− | '.$ | + | '.$TEMP2.' |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
var arr=document.getElementById("wpTextbox1").value.toString().split("\{\{Profil"); | var arr=document.getElementById("wpTextbox1").value.toString().split("\{\{Profil"); | ||
Zeile 660: | Zeile 724: | ||
arr__=arr_[i].split("="); | arr__=arr_[i].split("="); | ||
arrrrr[arr__[0]]=arr__[1]; | arrrrr[arr__[0]]=arr__[1]; | ||
+ | if(arr__[0]!=""){ | ||
+ | arr__[1]=arr__[1].replace(/}}/g,""); | ||
+ | if($("input[name=" + arr__[0] + "]").attr("type")!=undefined){ | ||
+ | arr__[1]=arr__[1].replace(/\n/g,""); | ||
+ | if($("input[name=" + arr__[0] + "]").attr("type")=="text"){ | ||
+ | $("input[name=" + arr__[0] + "]").val(arr__[1]); | ||
+ | } else { | ||
+ | |||
+ | if(arr__[1]!=""){ | ||
+ | $("input[name=" + arr__[0] + "]")[arr__[1]].checked="checked"; | ||
+ | } else { | ||
+ | $("input[name=" + arr__[0] + "]")[0].checked="checked"; | ||
+ | } | ||
+ | } | ||
+ | } else if($("textarea[name=" + arr__[0] + "]").val()!=undefined){ | ||
+ | $("textarea[name=" + arr__[0] + "]").val(arr__[1]); | ||
+ | } | ||
+ | } | ||
} | } | ||
arrrrr[arr__[0]]=arr__[1].replace(/\n}}/g,""); | arrrrr[arr__[0]]=arr__[1].replace(/\n}}/g,""); | ||
Zeile 672: | Zeile 754: | ||
for (i=0;i<arrrr.length;i++){ | for (i=0;i<arrrr.length;i++){ | ||
+ | |||
+ | document.getElementsByName(arrr[arrrr[i]]).value=arrrrr[arrrr[i]]; | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
− | + | function editProfil(){ | |
− | + | ||
− | + | arrr=new Array(); | |
− | + | arrrr=new Array(); | |
− | + | arrrrr=new Array(); | |
− | + | ||
− | + | '.$TEMP2.' | |
− | + | ||
+ | var arr=document.getElementById("wpTextbox1").value.toString().split("\{\{Profil"); | ||
+ | |||
+ | if(arr.length>1){ | ||
+ | |||
+ | arr_=arr[1].split("\\n|"); | ||
+ | |||
} | } | ||
− | var neu="{{Profil | + | var neu="{{Profil"; |
for(i=0;i<arrrr.length;i++){ | for(i=0;i<arrrr.length;i++){ | ||
− | neu+="\\n|" + arrrr[i] + "=" + | + | |
+ | if($("textarea[name=" + arrrr[i] + "]").val()!=undefined){ | ||
+ | neu+="\\n|" + arrrr[i] + "=" + $("textarea[name=" + arrrr[i] + "]").val(); | ||
+ | } else { | ||
+ | if($("input[name=" + arrrr[i] + "]").attr("type")=="text"){ | ||
+ | neu+="\\n|" + arrrr[i] + "=" + $("input[name=" + arrrr[i] + "]").val(); | ||
+ | } else { | ||
+ | neu+="\\n|" + arrrr[i] + "=" + $("input[name=" + arrrr[i] + "]:checked").val(); | ||
+ | } | ||
+ | } | ||
} | } | ||
− | neu+="}}"; | + | neu+="\\n}}"; |
− | neu_arr=arr[1].split("}}"); | + | if(arr.length>1){ |
− | + | neu_arr=arr[1].split("}}"); | |
− | + | if(neu_arr.length>1){ | |
− | + | neu=arr[0] + neu + neu_arr[1]; | |
− | + | } else { | |
+ | neu=arr[0] + neu; | ||
+ | } | ||
} | } | ||
document.getElementById("wpTextbox1").value=neu; | document.getElementById("wpTextbox1").value=neu; | ||
− | } | + | } |
+ | |||
+ | '.((trim($this->textbox1)!='') ? ' | ||
− | |||
− | |||
− | + | if (window.addEventListener) { | |
− | |||
− | |||
− | + | window.addEventListener("load", loadProfil, false); | |
− | + | } else if (window.attachEvent) { | |
− | + | window.attachEvent("load", loadProfil); | |
} | } | ||
Zeile 889: | Zeile 992: | ||
https://wiki.opensourceecology.de/Wiki-Admin-Log#http:.2F.2Fwww.mediawiki.org.2Fwiki.2FExtension:Code | https://wiki.opensourceecology.de/Wiki-Admin-Log#http:.2F.2Fwww.mediawiki.org.2Fwiki.2FExtension:Code | ||
+ | |||
+ | == add wiki2code extension == | ||
+ | --[[User:Tony Ford|Tony Ford]] ([[User talk:Tony Ford|talk]]) 22:48, 10 July 2013 (CEST) | ||
+ | === Create wiki2code extension === | ||
+ | |||
+ | create Folder '''./extensions/wiki2code''' | ||
+ | |||
+ | add file wiki2json.php in ./extensions/wiki2code | ||
+ | |||
+ | '''wiki2json.php''' | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php | ||
+ | |||
+ | include("../../DBSettings.php"); | ||
+ | |||
+ | $ln= ( ! empty( $_GET[ 'ln' ] ) ) ? $_GET[ 'ln' ] : 'de'; | ||
+ | $dev= ( ! empty( $_GET[ 'dev' ] ) ) ? $_GET[ 'dev' ] : false; | ||
+ | $page_title= ( ! empty( $_GET[ 'title' ] ) ) ? $_GET[ 'title' ] : ''; | ||
+ | if($page_title=='') exit; | ||
+ | |||
+ | $wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; | ||
+ | |||
+ | |||
+ | class db | ||
+ | { | ||
+ | |||
+ | public $db; | ||
+ | |||
+ | function __construct() { | ||
+ | //#### Datenbankverbindung herstellen #### | ||
+ | global $wgDBuser; | ||
+ | global $wgDBpassword; | ||
+ | global $wgDBname; | ||
+ | global $wgDBserver; | ||
+ | |||
+ | $this->db = new mysqli($wgDBserver,$wgDBuser,$wgDBpassword,$wgDBname); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | function __destruct(){ | ||
+ | //#### Datenbankverbindung schließen #### | ||
+ | $this->db->close(); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | class variable | ||
+ | { | ||
+ | public $vars=array(); | ||
+ | public $A=array(); | ||
+ | public $varindex=0; | ||
+ | public $varindex_min=0; | ||
+ | |||
+ | function add_var($var){ | ||
+ | array_push($this->vars,$var); | ||
+ | $this->A[$var]=array(); | ||
+ | } | ||
+ | |||
+ | function add_value($val){ | ||
+ | array_push($this->A[$this->vars[$this->varindex]],$val); | ||
+ | $this->switch_var(); | ||
+ | } | ||
+ | |||
+ | function switch_var(){ | ||
+ | $this->varindex++; | ||
+ | if($this->varindex>=sizeof($this->vars)) $this->varindex=$this->varindex_min; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function getLang($str){ | ||
+ | global $ln; | ||
+ | if(preg_match('/\{\{([a-z][a-z])\}\}/',$str)){ | ||
+ | $A=preg_split('/\{\{'.$ln.'\}\}/',$str); | ||
+ | if(sizeof($A)==1) $A=preg_split('/\{\{de\}\}/',$str); | ||
+ | $AA=preg_split('/\{\{/',$A[1]); | ||
+ | return preg_replace('/<(\/|)html>/','',trim($AA[0])); | ||
+ | } | ||
+ | return preg_replace('/<(\/|)html>/','', trim($str)); | ||
+ | |||
+ | } | ||
+ | |||
+ | $db=new db; | ||
+ | $vars=new variable; | ||
+ | |||
+ | $sql = 'SELECT * | ||
+ | FROM '.$wgDBprefix.'page AS A | ||
+ | INNER JOIN '.$wgDBprefix.'revision AS B ON B.rev_id = A.page_latest | ||
+ | INNER JOIN '.$wgDBprefix.'text AS C ON C.old_id = B.rev_text_id | ||
+ | INNER JOIN '.$wgDBprefix.'user AS D ON D.user_id = B.rev_user | ||
+ | WHERE A.page_title ="'.$page_title.'"'; | ||
+ | |||
+ | $result = $db->db->query($sql); | ||
+ | while($row = $result->fetch_object()){ | ||
+ | |||
+ | |||
+ | //###### Tables ###### | ||
+ | $A=preg_split('/\{\|/',$row->old_text); | ||
+ | if(sizeof($A)>0) array_shift($A); | ||
+ | while(sizeof($A)>0){ | ||
+ | $AA=preg_split('/ | ||
+ | \|\}/',array_shift($A)); | ||
+ | $AAA=preg_split('/ | ||
+ | \!/',$AA[0]); | ||
+ | $var=new variable; | ||
+ | foreach($AAA as $aaa){ | ||
+ | $aaaa=preg_split('/ | ||
+ | /',$aaa); | ||
+ | if($aaaa[0]!=''){ | ||
+ | $var->add_var($aaaa[0]); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $AAA=preg_split('/ | ||
+ | \|-/',$AA[0]); | ||
+ | if(sizeof($AAA)>0) array_shift($AAA); | ||
+ | while(sizeof($AAA)>0){ | ||
+ | $AAAA=preg_split('/ | ||
+ | \|/',array_shift($AAA)); | ||
+ | foreach($AAAA as $aaaa){ | ||
+ | $aaaaa=preg_split('/ | ||
+ | \|/',$aaaa); | ||
+ | if($aaaaa[0]!='' && $aaaaa[0]!='}'){ | ||
+ | $var->add_value(getLang($aaaaa[0])); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | $vars->A=array_merge($vars->A, $var->A); | ||
+ | |||
+ | } | ||
+ | |||
+ | //####### Headings ####### | ||
+ | |||
+ | |||
+ | $A=preg_split('/===/',$row->old_text); | ||
+ | $a=array(); | ||
+ | if(sizeof($A)>1) array_shift($A); | ||
+ | while(sizeof($A)>1){ | ||
+ | $name=array_shift($A); | ||
+ | $value=array_shift($A); | ||
+ | $a[$name]=getLang(substr($value,1,strlen($value))); | ||
+ | } | ||
+ | $vars->A=array_merge($vars->A,$a); | ||
+ | |||
+ | if($dev) print_r($vars->A); | ||
+ | echo json_encode($vars->A); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ?> | ||
+ | </source> | ||
[[Category: Logs]] | [[Category: Logs]] |
Aktuelle Version vom 16. Juli 2013, 06:34 Uhr
Wiki Localsettings.php
Tony Ford (talk) 18:38, 23 February 2013 (CET)
added in Localsettings.php
//##### extend max. imagesize for thumbnailing (sg 2013-02-15) #####
$wgMaxImageArea=64000000;
$wgMaxShellMemory = 202400;
$wgUseImageMagick = false;
$wgImageMagickConvertCommand = "/usr/bin/convert";
//##### enable number headings (sg 2013-02-18) ####
$wgDefaultUserOptions['numberheadings'] = 1;
$wgUploadSizeWarning = 32483648;
$wgMaxUploadSize = 32483648;
//##### enable HTTPS Login (sg 2013-02-28) #####
$wgSecureLogin=true;
$wgCookieSecure=false;
//##### added Sitemap - Extension (sg 2013-03-14) ####
//##### added new custom namespaces (sg 2013-05-02) #####
define("NS_PROFIL",290);
define("NS_PROFIL_TALK",291);
$wgExtraNamespaces[NS_PROFIL] = "Profil";
$wgExtraNamespaces[NS_PROFIL_TALK] = "Profil_talk";
//##### extenstion - disable numberedheadings (sg 2013-06-01) #######
require_once("$IP/extensions/MagicNoNumberedHeadings/MagicNoNumberedHeadings.php");
//##### open external links in new windows (sg 2013-07-16) ######
$wgExternalLinkTarget = '_blank';
fix the wiki entry of TiVA (convert latex tags)
Tony Ford (talk) 18:38, 23 February 2013 (CET)
File: includes/EditPage.php
insert after
# These fields need to be checked for encoding.
# Also remove trailing whitespace, but don't remove _initial_
# whitespace from the text boxes. This may be significant formatting.
$this->textbox1 = $this->safeUnicodeInput( $request, 'wpTextbox1' );
this
$this->textbox1=preg_replace('/<math>/','<math>',$this->textbox1);
$this->textbox1=preg_replace('/<\/m>/','</math>',$this->textbox1);
http://www.mediawiki.org/wiki/Extension:Code
Tony Ford (talk) 18:51, 23 February 2013 (CET)
add image files to folder skins/common/images
- http://wiki.opensourceecology.de/File:Button_code_php.png
- http://wiki.opensourceecology.de/File:Button_code_java.png
- http://wiki.opensourceecology.de/File:Button_code_html.png
- http://wiki.opensourceecology.de/File:Button_code_cpp.png
- http://wiki.opensourceecology.de/File:Button_code_asp.png
- http://wiki.opensourceecology.de/File:Button_code_asm.png
- http://wiki.opensourceecology.de/File:Button_code.png
- http://wiki.opensourceecology.de/File:Button_trello.png
File: languages/messages/MessagesDe.php
insert after
'sig_tip' => 'Deine Signatur mit Zeitstempel',
'hr_tip' => 'Horizontale Linie (sparsam verwenden)',
this
'code_tip' => 'Codemarkierung allgemein',
'code_asm_tip' => 'Assembler-Code',
'code_asp_tip' => 'ASP-Code',
'code_cpp_tip' => 'C++-Code',
'code_html_tip' => 'HTML-Code',
'code_php_tip' => 'PHP-Code',
'code_java_tip' => 'Java-Code',
'trello_tip' => 'Trello einbinden',
File: languages/messages/MessagesEn.php
insert after
'button-sig' => 'button_sig.png',
'button-hr' => 'button_hr.png',
this
'button-code' => 'button_code.png',
'button-code-asm' => 'button_code_asm.png',
'button-code-asp' => 'button_code_asp.png',
'button-code-cpp' => 'button_code_cpp.png',
'button-code-html' => 'button_code_html.png',
'button-code-java' => 'button_code_java.png',
'button-code-php' => 'button_code_php.png',
'button-trello' => 'button_trello.png',
insert after
'sig_tip' => 'Your signature with timestamp',
'hr_tip' => 'Horizontal line (use sparingly)',
this
'code_tip' => 'code marking general',
'code_asm_tip' => 'Assembler-Code',
'code_asp_tip' => 'ASP-Code',
'code_cpp_tip' => 'C++-Code',
'code_html_tip' => 'HTML-Code',
'code_php_tip' => 'PHP-Code',
'code_java_tip' => 'Java-Code',
'trello_tip' => 'include Trello',
File: includes/EditPage.php
find
array(
'image' => $wgLang->getImageFile( 'button-hr' ),
'id' => 'mw-editbutton-hr',
'open' => "\n----\n",
'close' => '',
'sample' => '',
'tip' => wfMsg( 'hr_tip' ),
'key' => 'R'
),
add after
array(
'image' => $wgLang->getImageFile( 'button-code' ), # added
'id' => 'mw-code',
'open' => "<"."code>\n",
'close' => "\n</code".">",
'sample' => '',
'tip' => wfMsg( 'code_tip' ),
'key' => 'S'
),
array(
'image' => $wgLang->getImageFile( 'button-code-asm' ), # added
'id' => 'mw-code-asm',
'open' => "<"."source lang=\"asm\">\n",
'close' => "\n</source".">",
'sample' => '',
'tip' => wfMsg( 'code_asm_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-code-asp' ), # added
'id' => 'mw-code-asp',
'open' => "<"."source lang=\"asp\">\n",
'close' => "\n</source".">",
'sample' => '',
'tip' => wfMsg( 'code_asp_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-code-cpp' ), # added
'id' => 'mw-code-cpp',
'open' => "<"."source lang=\"cpp\">\n",
'close' => "\n</source".">",
'sample' => '',
'tip' => wfMsg( 'code_cpp_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-code-html' ), # added
'id' => 'mw-code-html',
'open' => "<"."source lang=\"html4strict\">\n",
'close' => "\n</source".">",
'sample' => '',
'tip' => wfMsg( 'code_html_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-code-php' ), # added
'id' => 'mw-code-php',
'open' => "<"."source lang=\"php\">\n",
'close' => "\n</source".">",
'sample' => '',
'tip' => wfMsg( 'code_php_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-code-java' ), # added
'id' => 'mw-code-java',
'open' => "<"."source lang=\"java\">\n",
'close' => "\n</source".">\n",
'sample' => '',
'tip' => wfMsg( 'code_java_tip' ),
'key' => ''
),
array(
'image' => $wgLang->getImageFile( 'button-trello' ), # added (sg 2013-05-18)
'id' => 'mw-trello',
'open' => '{{Trello_einbinden\n|username=\n|board=\n|card=\n|no_done=\n}}',
'close' => '',
'sample' => '',
'tip' => wfMsg( 'trello_tip' ),
'key' => ''
)
Wiki - Sitemap extension
Tony Ford (talk) 09:14, 15 March 2013 (CET)
create the sitemap extension
create directory "Sitemap" in wiki/extensions
create and copy file sitemap.php into this folder (note: the file DBSettings.php in the wiki - root directory should contain the SQL-Server Settings $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname and $wgDBprefix / If the file doesn't exists then create it and copy / cut this settings from LocalSettings.php)
<?php
include("../../DBSettings.php");
class db
{
public $db;
function __construct() {
//#### Datenbankverbindung herstellen ####
global $wgDBuser;
global $wgDBpassword;
global $wgDBname;
global $wgDBserver;
$this->db = new mysqli($wgDBserver,$wgDBuser,$wgDBpassword,$wgDBname);
}
function __destruct(){
//#### Datenbankverbindung schließen ####
$this->db->close();
}
}
class sitemap
{
public $linkarray=array();
public $page;
public $db;
public $zeiger;
public $marktitle;
function getSitemap_page_title($page_title){
global $wgDBprefix;
$sql = 'SELECT *
FROM '.$wgDBprefix.'page AS A
INNER JOIN '.$wgDBprefix.'revision AS B ON B.rev_id = A.page_latest
INNER JOIN '.$wgDBprefix.'text AS C ON C.old_id = B.rev_text_id
INNER JOIN '.$wgDBprefix.'user AS D ON D.user_id = B.rev_user
WHERE A.page_title ="'.$page_title.'"';
$TEMP="";
$result = $this->db->query($sql);
while($row = $result->fetch_object()){
$arr=preg_split('/\[\[/',$this->filterNoWiki($this->loadTemplate($row->old_text)));
array_shift($arr);
while(sizeof($arr)>0){
$arr2=preg_split('/\]\]/',array_shift($arr));
$arr2[0]=preg_replace('/\//','#',$arr2[0]);
if(!preg_match('/'.$arr2[0].'/',$TEMP)){
if(!preg_match('/User:/',$arr2[0]) && !preg_match('/User talk:/',$arr2[0]) && !preg_match('/Template:/',$arr2[0]) && !preg_match('/Category:/',$arr2[0]) && !preg_match('/File:/',$arr2[0])){
$arrr=preg_split('/[|#]/',$arr2[0]);
if(sizeof($arrr)>1){
$arr2[0]=$arrr[0];
} else {
}
array_push($this->linkarray,preg_replace('/ /','_',$arr2[0]));
$TEMP.=$arr2[0];
}
}
}
}
$this->zeiger=0;
}
function loadTemplate($text){
$text=preg_replace('/\{\{\{/','',$text);
$arr=preg_split('/\{\{/',$text);
for($i=1;$i<sizeof($arr);$i++){
$arrr=preg_split('/\}\}/',$arr[$i]);
if($arrr[0]!=""){
$arrrr=preg_split('/\|/',$arrr[0]);
$text.=$this->getTemplate($arrrr[0]);
}
}
return $text;
}
function getTemplate($page_title){
global $wgDBprefix;
$sql = 'SELECT *
FROM '.$wgDBprefix.'page AS A
INNER JOIN '.$wgDBprefix.'revision AS B ON B.rev_id = A.page_latest
INNER JOIN '.$wgDBprefix.'text AS C ON C.old_id = B.rev_text_id
INNER JOIN '.$wgDBprefix.'user AS D ON D.user_id = B.rev_user
WHERE A.page_title ="'.$page_title.'"';
$result = $this->db->query($sql);
if($row = $result->fetch_object()){
return $row->old_text;
}
}
function getSitemap_namespace($namespace){
global $wgDBprefix;
$sql = 'SELECT *
FROM '.$wgDBprefix.'page AS A
INNER JOIN '.$wgDBprefix.'revision AS B ON B.rev_id = A.page_latest
INNER JOIN '.$wgDBprefix.'text AS C ON C.old_id = B.rev_text_id
INNER JOIN '.$wgDBprefix.'user AS D ON D.user_id = B.rev_user
WHERE A.page_namespace ='.$namespace;
$result = $db->db->query($sql);
while($row = $result->fetch_object()){
array_push($this->linkarray,$row->page_title);
}
$this->zeiger=0;
}
function outSitemap($level){
if($this->zeiger<sizeof($this->linkarray)){
$this->page=(isset($this->linkarray[$this->zeiger])) ? $this->linkarray[$this->zeiger] : "";
if($this->page!=""){
for($i=0;$i<$level;$i++){
echo " ";
}
echo "<a href='../../".$this->page."'><font style='".(($this->marktitle==$this->page) ? "color:yellow; font-weight:bold;" : "color:white;")."'> ".$this->page."</font></a><br>";
}
$this->zeiger++;
return true;
} else {
return false;
}
}
function dropDuplicates($array1){
$this->linkarray=array_diff($this->linkarray,$array1);
$this->linkarray=array_unique($this->linkarray);
sort($this->linkarray);
}
function filterNoWiki($text){
$arr=explode('<nowiki>',$text);
$text_neu='';
if(sizeof($arr)>0){
$text_neu.=$arr[0];
for($i=1;$i<sizeof($arr);$i++){
$arrr=explode('</nowiki>',$arr[$i]);
$text_neu.=$arrr[0];
}
} else {
$text_neu.=$text;
}
return $text_neu;
}
}
$sitemap_refresh= ( ! empty( $_GET[ 'sitemap_refresh' ] ) ) ? $_GET[ 'sitemap_refresh' ] : '';
$title= ( ! empty( $_GET[ 'title' ] ) ) ? $_GET[ 'title' ] : 'Main_Page';
$marktitle= ( ! empty( $_GET[ 'marktitle' ] ) ) ? $_GET[ 'marktitle' ] : '';
$div_head='
<div style="position:fixed; top:0%; left:0%; width:100%; height:100%; z-index:2; background:black; opacity:0.9;"></div>
<script>
$(document).ready(function(){
$("iframe").each(function() {
var src= $(this).attr("style");
$(this).attr("style",src + " display:none;");
});
});
</script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<div id="sitemap" style="position:fixed; left:12%; bottom:5%; top:5%; right:40%; background:black; opacity:0.7; font-size:0.8em; color:white; overflow:auto; border:1em solid darkgreen; z-index:10;">
<div style="position:fixed; right:42%;">
<a href="javascript:unload_sitemap()"><font style="color:red; font-size:4em; font-weight:bold;">[X]</font></a>
</div>
<b> '.$title.'</b><br>';
echo $div_head;
$db=new db;
$sx=array();
$s0=new sitemap;
$s0->db=$db->db;
$s0->marktitle=$marktitle;
$s0->getSitemap_page_title($title);
$s0->dropDuplicates(array());
while($s0->outSitemap(1)){
$s1=new sitemap;
$s1->db=$db->db;
$s1->marktitle=$marktitle;
$s1->getSitemap_page_title($s0->page);
$s1->dropDuplicates(array_merge($sx,$s0->linkarray));
$sx=array_merge($sx,$s1->linkarray);
while($s1->outSitemap(2)){
$s2=new sitemap;
$s2->db=$db->db;
$s2->marktitle=$marktitle;
$s2->getSitemap_page_title($s1->page);
$s2->dropDuplicates(array_merge($sx, $s0->linkarray, $s1->linkarray));
$sx=array_merge($sx,$s2->linkarray);
while($s2->outSitemap(3)){
$s3=new sitemap;
$s3->db=$db->db;
$s3->marktitle=$marktitle;
$s3->getSitemap_page_title($s2->page);
$s3->dropDuplicates(array_merge($sx, $s0->linkarray, $s1->linkarray, $s2->linkarray));
$sx=array_merge($sx,$s3->linkarray);
while($s3->outSitemap(4)){
$s4=new sitemap;
$s4->db=$db->db;
$s4->marktitle=$marktitle;
$s4->getSitemap_page_title($s3->page);
$s4->dropDuplicates(array_merge($sx ,$s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->linkarray));
$sx=array_merge($sx,$s4->linkarray);
while($s4->outSitemap(5)){
$s5=new sitemap;
$s5->db=$db->db;
$s5->marktitle=$marktitle;
$s5->getSitemap_page_title($s4->page);
$s5->dropDuplicates(array_merge($sx, $s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->linkarray, $s4->linkarray));
$sx=array_merge($sx,$s5->linkarray);
while($s5->outSitemap(6)){
$s6=new sitemap;
$s6->db=$db->db;
$s6->marktitle=$marktitle;
$s6->getSitemap_page_title($s5->page);
$s6->dropDuplicates(array_merge($sx, $s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->linkarray, $s4->linkarray, $s5->linkarray));
$sx=array_merge($sx,$s6->linkarray);
while($s6->outSitemap(7)){
}
unset($s6);
}
unset($s5);
}
unset($s4);
}
unset($s3);
}
unset($s2);
};
unset ($s1);
}
unset($s0);
unset($db);
?>
modify the skin(s)
Here the modification for the skin Vector
find
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
add lines
<?php
// #### Sitemap-Extension (sg 13.03.2013)
$sitemap_marktitle=rawurlencode($this->data['title']);
?>
and lines
<div id="sitemap"></div>
<script>
function load_sitemap(){
$('#sitemap').load("/extensions/Sitemap/sitemap.php?marktitle=<?php echo $sitemap_marktitle; ?>&title=Open_Source_Ecology_Germany");
}
function unload_sitemap(){
$('#sitemap').html("");
$("iframe").each(function() {
var src= $(this).attr("style");
$(this).attr("style",src.replace(/ display:none;/g,""));
});
}
$('document').ready(function(){
if(parent.location.href.toString().search(/osegradio_index.+/)==-1){
document.getElementById('OSEGradio').style.visibility='';
}
} );
</script>
find
<?php $this->renderPortals( $this->data['sidebar'] ); ?>
add lines before
<!-- OSEGradio - Extension (sg 23.03.2013) -->
<!-- sitemap - extension -->
<div id="sitemap" style="position:fixed; width:150px; left:-70px; top:35px; font-size:0.8em; -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); transform: rotate(-90deg); -ms-transform: rotate(-90deg); ">
<span id="OSEGradio" style="cursor:pointer; visibility:hidden;" onclick="parent.location.href='<?php echo $wgProto; ?>://wiki.opensourceecology.de/extensions/OSEGradio/osegradio_index.php?title=' + parent.location.href;" onmouseover="this.style.color='blue';" onmouseout="this.style.color='black';">oseg-radio</span>
<span style="cursor:pointer;" onclick="javascript:load_sitemap();" onmouseover="this.style.color='blue';" onmouseout="this.style.color='black';">sitemap</span>
</div>
<!-- /sitemap -->
add profile - extension
add new custom namespaces Profil
--Tony Ford (talk) 09:53, 2 May 2013 (CEST)
define("NS_PROFIL",290);
define("NS_PROFIL_TALK",291);
$wgExtraNamespaces[290] = "Profil";
$wgExtraNamespaces[291] = "Profil_talk";
edit EditPage.php
--Tony Ford (talk) 09:23, 7 May 2013 (CEST)
find
$wgOut->addHTML( EditPage::getEditToolbar()
);
add before
if($this->mTitle->getNamespace()==NS_PROFIL){
//##### profil-extension (sg 06.05.2013) #####
$fp=fopen('./images/1/11/Profilsetup.txt','r');
$profil=fread($fp,20000);
fclose($fp);
$fp=fopen('./images/9/95/Profilsetup_info.txt','r');
$profil_info=fread($fp,1000);
fclose($fp);
$profil_info=preg_replace('/
/','',$profil_info);
$profil_arr=explode('
|',$profil);
$radio_flag=false; $TEMP2=''; $i=0; $radio_count=0;
array_shift($profil_arr);
$TEMP='<div style="display:; position:relative; left:0%; width:70%; top:0%; overflow:auto; opacity:1; height:80%;"><table class="table table-condensed" style="border:2px solid grey; border-radius:5px;">';
while(sizeof($profil_arr)>0){
$arr=explode('=',(array_shift($profil_arr)));
if(preg_match('/>/',$arr[1])){
if($radio_count==0){
$TEMP.='<tr><td></td><td width="80">keine Kenntnisse</td><td width="80">Basiskenntnisse</td><td width="80">Fortgeschritten</td><td width="80">Experte</td></tr>
';
}
$TEMP.='<tr align="center"><td align="left">'.preg_replace('/
|>/','',$arr[1]).'</td><td><input type="radio" name="'.$arr[0].'" value="" checked onclick="editProfil()"></td>
<td><input type="radio" name="'.$arr[0].'" value="1" onclick="editProfil()"></td>
<td><input type="radio" name="'.$arr[0].'" value="2" onclick="editProfil()"></td>
<td><input type="radio" name="'.$arr[0].'" value="3" onclick="editProfil()"></td>
</tr>';
$radio_count++;
if($radio_count>10) $radio_count=0;
} elseif(preg_match('/\.\.\./',$arr[1])){
$TEMP.='<tr><td>'.preg_replace('/
/','',$arr[1]).'</td><td colspan="4"><textarea class="input-xlarge" name="'.$arr[0].'" onchange="editProfil()"></textarea></td></tr>';
} else {
$TEMP.='<tr><td>'.preg_replace('/
/','',$arr[1]).'</td><td colspan="4"><input type="text" class="input-xlarge" size="40" name="'.$arr[0].'" onchange="editProfil()"></td></tr>';
}
$TEMP2.='arrrr['.$i++.']="'.$arr[0].'";
';
}
$TEMP.='</table></div>
';
$wgOut->addHTML($TEMP.'
<script type="text/JavaScript">
function loadProfil(){
arrr=new Array();
arrrr=new Array();
arrrrr=new Array();
'.$TEMP2.'
var arr=document.getElementById("wpTextbox1").value.toString().split("\{\{Profil");
if(arr.length>1){
arr_=arr[1].split("\\n|");
for(i=0;i<arr_.length;i++){
arr__=arr_[i].split("=");
arrrrr[arr__[0]]=arr__[1];
if(arr__[0]!=""){
arr__[1]=arr__[1].replace(/}}/g,"");
if($("input[name=" + arr__[0] + "]").attr("type")!=undefined){
arr__[1]=arr__[1].replace(/\n/g,"");
if($("input[name=" + arr__[0] + "]").attr("type")=="text"){
$("input[name=" + arr__[0] + "]").val(arr__[1]);
} else {
if(arr__[1]!=""){
$("input[name=" + arr__[0] + "]")[arr__[1]].checked="checked";
} else {
$("input[name=" + arr__[0] + "]")[0].checked="checked";
}
}
} else if($("textarea[name=" + arr__[0] + "]").val()!=undefined){
$("textarea[name=" + arr__[0] + "]").val(arr__[1]);
}
}
}
arrrrr[arr__[0]]=arr__[1].replace(/\n}}/g,"");
} else {
for(i=0;i<arrrr.length;i++){
arrrrr[arrrr[i]]="";
}
arr[1]="";
}
for (i=0;i<arrrr.length;i++){
document.getElementsByName(arrr[arrrr[i]]).value=arrrrr[arrrr[i]];
}
}
function editProfil(){
arrr=new Array();
arrrr=new Array();
arrrrr=new Array();
'.$TEMP2.'
var arr=document.getElementById("wpTextbox1").value.toString().split("\{\{Profil");
if(arr.length>1){
arr_=arr[1].split("\\n|");
}
var neu="{{Profil";
for(i=0;i<arrrr.length;i++){
if($("textarea[name=" + arrrr[i] + "]").val()!=undefined){
neu+="\\n|" + arrrr[i] + "=" + $("textarea[name=" + arrrr[i] + "]").val();
} else {
if($("input[name=" + arrrr[i] + "]").attr("type")=="text"){
neu+="\\n|" + arrrr[i] + "=" + $("input[name=" + arrrr[i] + "]").val();
} else {
neu+="\\n|" + arrrr[i] + "=" + $("input[name=" + arrrr[i] + "]:checked").val();
}
}
}
neu+="\\n}}";
if(arr.length>1){
neu_arr=arr[1].split("}}");
if(neu_arr.length>1){
neu=arr[0] + neu + neu_arr[1];
} else {
neu=arr[0] + neu;
}
}
document.getElementById("wpTextbox1").value=neu;
}
'.((trim($this->textbox1)!='') ? '
if (window.addEventListener) {
window.addEventListener("load", loadProfil, false);
} else if (window.attachEvent) {
window.attachEvent("load", loadProfil);
}
' : '').'
</script>
<input type="button" value="Profil erstellen/editieren" onclick="editProfil()">
<p></p>
');
//##### end profilextension #####
}
bugfix Vector.php
find
$currentURL = $_SERVER['PATH_INFO'];
replace with
$currentURL = getcwd();
add Trello extension
Create Trello extension
create Folder ./extensions/Trello
and ./extensions/Trello/trello
add file load_trello.php in ./extensions/Trello
load_trello.php
<table>
<?php
$u_sel= ( ! empty( $_GET[ 'u_sel' ] ) ) ? $_GET[ 'u_sel' ] : '';
$b_sel= ( ! empty( $_GET[ 'b_sel' ] ) ) ? $_GET[ 'b_sel' ] : '';
$no_done= ( ! empty( $_GET[ 'no_done' ] ) ) ? $_GET[ 'no_done' ] : '0';
//$only_todo= ( ! empty( $_GET[ 'only_todo' ] ) ) ? $_GET[ 'only_todo' ] : '0';
$c_filter= ( ! empty( $_GET[ 'c_filter' ] ) ) ? $_GET[ 'c_filter' ] : '';
$refresh= ( ! empty( $_GET[ 'refresh' ] ) ) ? $_GET[ 'refresh' ] : '0';
include('./definitions.php');
define('PATH','./trello/');
if($refresh){
define('REFRESHTIMER',0);
} else {
define('REFRESHTIMER',3600*24);
}
function load_json($file,$opt){
switch($file){
case 'members':
$filename_local=PATH.$file.'.json';
$filename='https://api.trello.com/1/organizations/osegermany/members?fields=username,fullName,url,initials&key='.KEY.'&token='.TOKEN;
break;
case 'boards':
$filename_local=PATH.$file.'.json';
$filename='https://api.trello.com/1/organizations/osegermany/boards?key='.KEY.'&token='.TOKEN;
break;
case 'cards':
$filename_local=PATH.$file.'_'.$opt.'.json';
$filename='https://api.trello.com/1/boards/'.$opt.'/lists?cards=open&card_fields=name,url,closed,dateLastActivity,idMembers&fields=name,closed&key='.KEY.'&token='.TOKEN;
break;
}
$json='';
if(filemtime($filename_local)<time()-REFRESHTIMER){
$fp=fopen($filename,'r');
while(!feof($fp)) $json.=fread($fp,20000);
fclose($fp);
$fp=fopen($filename_local,'w+');
fwrite($fp,$json);
fclose($fp);
} else {
$fp=fopen($filename_local,'r');
while(!feof($fp)) $json.=fread($fp,20000);
fclose($fp);
}
$obj=json_decode($json);
return $obj;
}
echo '<tr><td colspan="4"><i>letzte Aktualisierung: '.date('Y-m-d H:i',filemtime(PATH.'boards.json')).'</i></td></tr>';
$members=array();
$obj=load_json('members','');
foreach($obj as $o){
$members[$o->id]=$o;
}
$obj=load_json('boards','');
foreach($obj as $o){
if(!$o->closed){
$members_temp=''; $members_flag=false; $board_temp='';
foreach($o->memberships as $member){
if(isset($members[$member->idMember])){
if($members[$member->idMember]->username==$u_sel){
$members_flag=true;
}
$members_temp.=' ('.((is_object($members[$member->idMember])) ? '<a href="'.$members[$member->idMember]->url.'" title="'.$members[$member->idMember]->fullName.'" target="trello">'.$members[$member->idMember]->initials.'</a>' : 'n.a.').')';
}
}
$board_temp.=(((($u_sel!='' && $members_flag) || $u_sel=='') && (($b_sel!='' && preg_match('/'.$b_sel.'/',$o->name)) || $b_sel=='')) ? '<tr><td colspan="4" style="border-bottom:2px solid darkgrey;"> </td></tr><tr><td colspan="3" style="background:lightgrey;"><b><a href="'.$o->url.'" target="trello">'.$o->name.'</a></b></td><td style="background:lightgrey;"><font style="font-size:0.8em;"><i>'.$members_temp.'</i></font></td></tr>
' : '');
$obj2=load_json('cards',$o->id);
$cards_temp='';
foreach($obj2 as $o2){
if(!$o2->closed){
foreach($o2->cards as $o3){
if(!$o3->closed) {
$members_temp=''; $members_flag=false;
foreach($o3->idMembers as $member){
if(isset($members[$member])){
if($members[$member]->username==$u_sel){
$members_flag=true;
$members_temp.='<b>('.$members[$member]->initials.')</b>';
} else {
$members_temp.='('.((is_object($members[$member])) ? $members[$member]->initials : 'n.a.').')';
}
}
}
if((($u_sel!='' && $members_flag) || $u_sel=='' && $c_filter=='') && $board_temp!=''){
echo $board_temp;
$board_temp='';
}
$cards_temp.=(((($u_sel!='' && $members_flag) || $u_sel=='') && (($no_done && $o2->name!='Done') || !$no_done) && (($c_filter!='' && preg_match('/'.$c_filter.'/',$o3->name)) || $c_filter=='')) ? '<tr><td style="'.(($members_temp!='') ? 'background:#BBFFBB;' : 'background:#FFBBBB;').' border-top:1px solid lightgrey;">'.substr($o3->dateLastActivity,0,10).'</td><td align="center" style="color:'.(($o2->name=='Done') ? 'green' : 'red').'; border-top:1px solid lightgrey;">'.$o2->name.'</td><td style="border-top:1px solid lightgrey;"><a href="'.$o3->url.'" target="trello">'.$o3->name.'</a></td><td style="border-top:1px solid lightgrey;"><i>'.$members_temp.'</i></td></tr>
' : '');
}
}
}
}
echo ($board_temp!='' && $c_filter=='' || ($c_filter!='' && $cards_temp!='')) ? $board_temp : '';
echo (($b_sel!='' && preg_match('/'.$b_sel.'/',$o->name)) || $b_sel=='') ? $cards_temp : '';
}
}
//echo print_r($obj);
?>
</table>
add Trello in wiki editor
appended in Extension:Code
add wiki2code extension
--Tony Ford (talk) 22:48, 10 July 2013 (CEST)
Create wiki2code extension
create Folder ./extensions/wiki2code
add file wiki2json.php in ./extensions/wiki2code
wiki2json.php
<?php
include("../../DBSettings.php");
$ln= ( ! empty( $_GET[ 'ln' ] ) ) ? $_GET[ 'ln' ] : 'de';
$dev= ( ! empty( $_GET[ 'dev' ] ) ) ? $_GET[ 'dev' ] : false;
$page_title= ( ! empty( $_GET[ 'title' ] ) ) ? $_GET[ 'title' ] : '';
if($page_title=='') exit;
$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
class db
{
public $db;
function __construct() {
//#### Datenbankverbindung herstellen ####
global $wgDBuser;
global $wgDBpassword;
global $wgDBname;
global $wgDBserver;
$this->db = new mysqli($wgDBserver,$wgDBuser,$wgDBpassword,$wgDBname);
}
function __destruct(){
//#### Datenbankverbindung schließen ####
$this->db->close();
}
}
class variable
{
public $vars=array();
public $A=array();
public $varindex=0;
public $varindex_min=0;
function add_var($var){
array_push($this->vars,$var);
$this->A[$var]=array();
}
function add_value($val){
array_push($this->A[$this->vars[$this->varindex]],$val);
$this->switch_var();
}
function switch_var(){
$this->varindex++;
if($this->varindex>=sizeof($this->vars)) $this->varindex=$this->varindex_min;
}
}
function getLang($str){
global $ln;
if(preg_match('/\{\{([a-z][a-z])\}\}/',$str)){
$A=preg_split('/\{\{'.$ln.'\}\}/',$str);
if(sizeof($A)==1) $A=preg_split('/\{\{de\}\}/',$str);
$AA=preg_split('/\{\{/',$A[1]);
return preg_replace('/<(\/|)html>/','',trim($AA[0]));
}
return preg_replace('/<(\/|)html>/','', trim($str));
}
$db=new db;
$vars=new variable;
$sql = 'SELECT *
FROM '.$wgDBprefix.'page AS A
INNER JOIN '.$wgDBprefix.'revision AS B ON B.rev_id = A.page_latest
INNER JOIN '.$wgDBprefix.'text AS C ON C.old_id = B.rev_text_id
INNER JOIN '.$wgDBprefix.'user AS D ON D.user_id = B.rev_user
WHERE A.page_title ="'.$page_title.'"';
$result = $db->db->query($sql);
while($row = $result->fetch_object()){
//###### Tables ######
$A=preg_split('/\{\|/',$row->old_text);
if(sizeof($A)>0) array_shift($A);
while(sizeof($A)>0){
$AA=preg_split('/
\|\}/',array_shift($A));
$AAA=preg_split('/
\!/',$AA[0]);
$var=new variable;
foreach($AAA as $aaa){
$aaaa=preg_split('/
/',$aaa);
if($aaaa[0]!=''){
$var->add_var($aaaa[0]);
}
}
$AAA=preg_split('/
\|-/',$AA[0]);
if(sizeof($AAA)>0) array_shift($AAA);
while(sizeof($AAA)>0){
$AAAA=preg_split('/
\|/',array_shift($AAA));
foreach($AAAA as $aaaa){
$aaaaa=preg_split('/
\|/',$aaaa);
if($aaaaa[0]!='' && $aaaaa[0]!='}'){
$var->add_value(getLang($aaaaa[0]));
}
}
}
$vars->A=array_merge($vars->A, $var->A);
}
//####### Headings #######
$A=preg_split('/===/',$row->old_text);
$a=array();
if(sizeof($A)>1) array_shift($A);
while(sizeof($A)>1){
$name=array_shift($A);
$value=array_shift($A);
$a[$name]=getLang(substr($value,1,strlen($value)));
}
$vars->A=array_merge($vars->A,$a);
if($dev) print_r($vars->A);
echo json_encode($vars->A);
}
?>