Wiki-Admin-Log: Unterschied zwischen den Versionen

Aus Open Source Ecology - Germany
Zur Navigation springen Zur Suche springen
Zeile 685: Zeile 685:
  
  
== bugfix $currentURL = $_SERVER['PATH_INFO'] ==
+
== bugfix Vector.php ==
  
 
'''find'''
 
'''find'''

Version vom 13. Mai 2013, 12:08 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)

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,$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 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
				}
				echo "<a href='../../".$this->page."'><font style='".(($this->marktitle==$this->page) ? "color:yellow; font-weight:bold;" : "color:white;")."'>&nbsp;".$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('<no'.'wiki>',$text);
		if(sizeof($arr)>0){
			$text_neu.=$arr[0];
			for($i=1;$i<sizeof($arr);$i++){
				$arrr=explode('</no'.'wiki>',$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>
<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>&nbsp;'.$title.'</b><br>';


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>

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);
				$TEMP='';
				while(sizeof($profil_arr)>0){
					$arr=explode('=',(array_shift($profil_arr)));
					if($TEMP==""){ 
						$TEMP="
";
				 	} else { 
						$TEMP.='arrr["'.$arr[0].'"]="'.preg_replace('/
/','',preg_replace('/}}/','',$arr[1])).'"; 
'; 	
					}
				}

				$wgOut->addHTML('<script>
function editProfil(){

	arrr=new Array();
	arrrr=new Array();
	arrrrr=new Array();

	'.$TEMP.'

	i=0;
	for (var Feld in arrr){
		arrrr[i]=Feld;
		i++;
	}

	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];
		}
		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++){

		a=prompt(arrr[arrrr[i]],arrrrr[arrrr[i]]);
		if(a==null){ 
			i-=2;
			if(i<-1) i=-1;
		} else {
			arrrrr[arrrr[i]]=a;
			
		}
	}
		

	var neu="{{Profil";
	for(i=0;i<arrrr.length;i++){
		neu+="\\n|" + arrrr[i] + "=" + arrrrr[arrrr[i]];
	}
	neu+="}}";

	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(confirm("'.$profil_info.'")){

	if (window.addEventListener) {
	
	  	window.addEventListener("load", editProfil, false);

	} else if (window.attachEvent) {

	  	window.attachEvent("load", editProfil);

	}

}
' : '').'
</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();