Wiki-Admin-Log: Unterschied zwischen den Versionen

Aus Open Source Ecology - Germany
Zur Navigation springen Zur Suche springen
Zeile 218: Zeile 218:
 
[[User:Tony Ford|Tony Ford]] ([[User talk:Tony Ford|talk]]) 09:14, 15 March 2013 (CET)
 
[[User:Tony Ford|Tony Ford]] ([[User talk: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)
 
 
<source lang="php">
 
 
<?php
 
<?php
  
 
include("../../DBSettings.php");
 
include("../../DBSettings.php");
 +
  
 
class db
 
class db
Zeile 278: Zeile 272:
 
$result = $this->db->query($sql);
 
$result = $this->db->query($sql);
 
while($row = $result->fetch_object()){
 
while($row = $result->fetch_object()){
$arr=explode('['.'[',$row->old_text);
+
 +
$arr=preg_split('/\[\[/',$this->filterNoWiki($this->loadTemplate($row->old_text)));
 
array_shift($arr);
 
array_shift($arr);
 
while(sizeof($arr)>0){
 
while(sizeof($arr)>0){
$arr2=explode(']]',array_shift($arr));
+
$arr2=preg_split('/\]\]/',array_shift($arr));
 
$arr2[0]=preg_replace('/\//','#',$arr2[0]);
 
$arr2[0]=preg_replace('/\//','#',$arr2[0]);
 
if(!preg_match('/'.$arr2[0].'/',$TEMP)){
 
if(!preg_match('/'.$arr2[0].'/',$TEMP)){
Zeile 304: Zeile 299:
 
 
 
}
 
}
 +
 +
 +
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){
 
function getSitemap_namespace($namespace){
Zeile 330: Zeile 362:
 
 
 
$this->page=(isset($this->linkarray[$this->zeiger])) ? $this->linkarray[$this->zeiger] : "";
 
$this->page=(isset($this->linkarray[$this->zeiger])) ? $this->linkarray[$this->zeiger] : "";
+
 +
 
 
if($this->page!=""){
 
if($this->page!=""){
 
for($i=0;$i<$level;$i++){
 
for($i=0;$i<$level;$i++){
Zeile 347: Zeile 380:
  
 
function dropDuplicates($array1){
 
function dropDuplicates($array1){
 +
 
$this->linkarray=array_diff($this->linkarray,$array1);
 
$this->linkarray=array_diff($this->linkarray,$array1);
 +
$this->linkarray=array_unique($this->linkarray);
 +
sort($this->linkarray);
 +
 +
}
 +
 +
 +
function filterNoWiki($text){
 +
 +
$arr=explode('<nowiki>',$text);
 +
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;
 
}
 
}
  
Zeile 374: Zeile 427:
 
$s0->marktitle=$marktitle;
 
$s0->marktitle=$marktitle;
 
$s0->getSitemap_page_title($title);
 
$s0->getSitemap_page_title($title);
 
+
$s0->dropDuplicates(array());
 
while($s0->outSitemap(1)){
 
while($s0->outSitemap(1)){
 
$s1=new sitemap;
 
$s1=new sitemap;
Zeile 433: Zeile 486:
  
 
?>
 
?>
</source>
 
 
 
----
 
 
----
 
  
 
=== modify the skin(s) ===
 
=== modify the skin(s) ===

Version vom 16. März 2013, 20:11 Uhr

Wiki issue: Error creating thumbnail: Invalid thumbnail parameters

Tony Ford (talk) 18:38, 23 February 2013 (CET)

added in Localsettings.php

$wgMaxImageArea=64000000;
$wgMaxShellMemory = 202400;
$wgUseImageMagick = false;
$wgImageMagickConvertCommand = "/usr/bin/convert";

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





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',





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',




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',





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'    => ''
			)

Wiki - Sitemap extension

Tony Ford (talk) 09:14, 15 March 2013 (CET)

<?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,$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."'>marktitle==$this->page) ? "color:yellow; font-weight:bold;" : "color:white;")."'> ".$this->page."</a>
"; }

$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('',$text); if(sizeof($arr)>0){ $text_neu.=$arr[0]; for($i=1;$i<sizeof($arr);$i++){ $arrr=explode('',$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=' <script src="http://code.jquery.com/jquery-latest.js"></script>

<a href="javascript:unload_sitemap()">[X]</a>

 '.$title.'
';


echo $div_head;

$db=new db;

$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($s0->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($s0->linkarray, $s1->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($s0->linkarray, $s1->linkarray, $s2->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($s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->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($s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->linkarray, $s4->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($s0->linkarray, $s1->linkarray, $s2->linkarray, $s3->linkarray, $s4->linkarray, $s5->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; ?>");
		}
		function unload_sitemap(){
			$('#sitemap').html("");
		}
		</script>