Wikini

TestColorationSyntaxiqueDiff

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes ec2-3-80-4-76.compute-1.amazonaws.com
Cette page est un test de la ColorationSyntaxiqueDiff

format >/<

diff -x CVS -r --suppress-common-lines wikini/actions/header.php wikini-groupes/actions/header.php
2c2,3
< /* header.php
---
> /*
> header.php
7a9
> Copyright 2005  Raphaël BOIS
32a35,61
> 
> /* Add : groups */
> if(!function_exists("GetLinkPageName"))
> {
>         //Formatage du nom de la page dans l'entête.
>         function GetLinkPageName() {
> 	  global $wiki;
> 	  $tag = htmlentities($wiki->tag);
> 	  $namelinks = "";
> 	  $subtag = ""; $i=0;
> 	  $splittag = explode(".", $tag);
> 	  while($splittag[$i]!="")
> 	    {
> 	      $subtag .= (($subtag=="")?"":".").$splittag[$i];
> 	      // La recherche ne s'applique qu'à la page actuelle. Les pages parentes sont
> 	      // des liens vers ces pages (facilite la navigation)
> 	      $namelinks .= (($namelinks=="")?"":".");
> 	      if($splittag[$i+1]!="")
> 		$namelinks .= $wiki->ComposeLinkToPage($subtag, "", $splittag[$i], $track, ($wiki->LoadPage($subtag)?1:0));
> 	      else
> 		$namelinks .= "<a href=" . $wiki->config["base_url"]. "RechercheTexte&amp;phrase=" . $tag . ">" . $splittag[$i] . "</a>"; 	  
> 	      $i++;
> 	    }
> 	  return $namelinks;
> 	}
> }
> /* END Add */
67,69c96,100
< <a href="<?php echo $this->config["base_url"] ?>RechercheTexte&amp;phrase=<?php echo urlencode($this->GetPageTag()); ?>">
< <?php echo $this->GetPageTag(); ?>
< </a>
---
> <?php
> /* Alter : groups */
> echo GetLinkPageName();
> /* END Alter */
> ?>
diff -x CVS -r --suppress-common-lines wikini/actions/listpages.php wikini-groupes/actions/listpages.php
6a7
> Copyright 2005  Raphaël BOIS
74a76,140
> /* Alter : groups */
> else if ($sortkey = $this->GetParameter("children"))
> {
> // No parent page specified, assume current page
>   if($sortkey=="children") $sortkey=".";
>   $sortkey = $this->AbsoluteTag($sortkey);
> 
>   //Tout ce passe dans la requête suivante. Récupère les noms de pages référencés (page d'origine et page pointée et pages existantes).
>   $pattern_querry = "(select #1 as `tag` from `".$this->config['table_prefix']."#2` where #1 LIKE '".mysql_escape_string($sortkey).".%')";
>   $querry  = str_replace(array("#1", "#2"), array("to_tag", "links"), $pattern_querry);
>   $querry .= " UNION DISTINCT ";
>   $querry .= str_replace(array("#1","#2"), array("from_tag", "links"), $pattern_querry);
>   $querry .= " UNION DISTINCT ";
>   $querry .= str_replace(array("#1","#2"), array("tag", "pages"), $pattern_querry);
>   $querry .= " ORDER BY `tag` ASC";
> 
>   $pages = $this->LoadAll($querry);
> 
>   /* variables d'arborescence */
>   $indent=0;
>   $level[$indent]=$sortkey;
>   $no_ul=FALSE;
> 
>   echo "<ul style='list-style-type:none;'>\n";
> 
>   //Les pages sont triées par ordre lexicographique, ce qui simplifie le traitement.
>   foreach($pages as $page){
>     $levlength=strlen($level[$indent]);
>     while($level[$indent]."."!=substr(ltrim($page["tag"]), 0, $levlength+1)) {
>       if($no_ul)
> 	$no_ul=FALSE;
>       else
> 	echo "</ul></li>\n";
>       $indent--;
>       $levlength=strlen($level[$indent]);
>     }
>     $tail = rtrim(substr(ltrim($page["tag"]), $levlength+1)); //supprime la tête (avec le point)
>     //Créer l'arborescence des groupes parents d'ayant pas forcément de lien vers eux.
>     while($tail!="") {
>       $pointpos = strpos($tail, ".");
>       $pointpos = $pointpos===FALSE?strlen($tail):$pointpos;
>       $text = substr($tail, 0, $pointpos);
>       $tail = substr($tail, $pointpos+1);
>       if($no_ul){
> 	echo "<li><ul style='list-style-type:none;'>";
> 	$no_ul=FALSE;
>       }
>       //      echo "<li>".$this->Link($level[$indent] . "." . $text)." <= ". $page["tag"] ." (" . $text . ")</li>\n";
>       echo "<li>".$this->Link($level[$indent] . "." . $text)."</li>\n";
>       if($tail!="")
> 	echo "<li><ul style='list-style-type:none;'>\n";
>       //on monte d'un niveau
>       $level[$indent+1] = $level[$indent] . "." . $text;
>       $indent++;
>     }
>     $no_ul=TRUE;
>   }
>   while($indent>0) {
>     if($no_ul) $no_ul=FALSE;
>     else echo "</ul></li>\n";
>     $indent--;
>   }
>   echo "</ul>\n";
> }
> /* END Alter */
Seulement dans wikini-groupes/formatters: coloration_css.php
Seulement dans wikini-groupes/formatters: coloration_css.php~
diff -x CVS -r --suppress-common-lines wikini/formatters/wakka.php wikini-groupes/formatters/wakka.php
3c3
< $Id: wakka.php,v 1.41 2005/04/12 16:21:43 ddelon Exp $
---
> wakka.php
10a11
> Copyright 2005  Raphaël BOIS
41c42
<         $result='';
---
> 		$result='';
47a49,51
> /* Add : groups */
> 		static $prewikilink = "";
> /* AND Add */
330,331c334
<                 else if (preg_match("/^".WN_UPPER.WN_CHAR."+[:](".WN_CHAR2."*)$/s", $thing))
< 
---
>                 else if (preg_match("/^".WN_UPPER.WN_CHAR."+[:]((?!\\/\\/).*)$/s", $thing))
336,337c339,351
< 		else if (preg_match("/^".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*$/s", $thing))
< 		{
---
> /* Add : groups */
> 		//not a terminal part of the name (example : "ToTo.", head of "ToTo.TiTi")
> 		else if (preg_match("/^(\\.*".WN_UPPER.WN_LOWER.WN_CHAR."*".WN_UPPER_NUM.WN_CHAR."*\\.)$/", $thing))
> 		{ //Not a simple wiki name. store result
> 		  $prewikilink .= $thing;
> 		  return ""; //don't print anything yet.
> 		}
> /* END Add */
> /* Modif : groups */
> 		else if (preg_match("/^(\\.*".WN_UPPER.WN_LOWER.WN_CHAR."*".WN_UPPER_NUM.WN_CHAR."*)$/", $thing))
> 		{ //end of wiki name. return full wikiname.
> 		        $thing = $prewikilink . $thing;
> 			$prewikilink = "";
339a354
> /* END Modif */
369,370c384,388
<         "\b".WN_UPPER.WN_CHAR."+[:](".WN_CHAR2."*)\b|".
< 	"\b(".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*)\b|".
---
> /* Modif : groups */
>         "\b".WN_UPPER.WN_CHAR."+[:]((?!\\/\\/).*(?=\]))\b|".
> 	"(\\.*|\b)".WN_UPPER.WN_LOWER.WN_CHAR."*".WN_UPPER_NUM.WN_CHAR."*\\.(?=".WN_UPPER.")|". //le nom n'est pas terminé
> 	"(\\.*|\b)".WN_UPPER.WN_LOWER.WN_CHAR."*".WN_UPPER_NUM.WN_CHAR."*\b|".
> /* END Modif */
Seulement dans wikini-groupes/formatters: wakka.php~
diff -x CVS -r --suppress-common-lines wikini/setup/install.php wikini-groupes/setup/install.php
7a8
> Copyright 2005 Raphaël BOIS
52c53
<   			"tag varchar(50) NOT NULL default '',".
---
>   			"tag varchar(250) NOT NULL default '',".
60c61
<   			"comment_on varchar(50) NOT NULL default '',".
---
>   			"comment_on varchar(250) NOT NULL default '',".
71c72
<   			"page_tag varchar(50) NOT NULL default '',".
---
>   			"page_tag varchar(250) NOT NULL default '',".
79,80c80,81
< 			"from_tag char(50) NOT NULL default '',".
<   			"to_tag char(50) NOT NULL default '',".
---
> 			"from_tag varchar(250) NOT NULL default '',".
>   			"to_tag varchar(250) NOT NULL default '',".
88,89c89,90
<   			"page_tag char(50) NOT NULL default '',".
<   			"referrer char(150) NOT NULL default '',".
---
>   			"page_tag varchar(250) NOT NULL default '',".
>   			"referrer varchar(250) NOT NULL default '',".
97c98
<   			"name varchar(80) NOT NULL default '',".
---
>   			"name varchar(50) NOT NULL default '',". //rester cohérent avec user/owner de la table 'pages'
99c100
<   			"email varchar(50) NOT NULL default '',".
---
>   			"email varchar(250) NOT NULL default '',".
diff -x CVS -r --suppress-common-lines wikini/wakka.php wikini-groupes/wakka.php
3c3
< $Id: wakka.php,v 1.76 2005/09/25 22:50:56 lordfarquaad Exp $
---
> wakka.php
12a13
> Copyright 2005 Raphaël BOIS
101a103,108
>         //DEBUG
>         function EchoDebug($text, $force=FALSE)
>         {
> 	  if($this->GetConfigValue("debug") || $force)
> 	    echo "<br\>DEBUG : ".$text."<br\>\n";
> 	}
272a280,288
> /* Add : groups */
>         //Get all children pages. if $recursif==TRUE, get all descendants
>         function LoadAllPagesInGroup($tag, $recursif=TRUE) {
> 	  $escape_tag=mysql_escape_string($tag);
> 	  $condition="tag LIKE '".$escape_tag.".%' ";
> 	  if(!$recursif) $condition=$condition."AND tag NOT LIKE '".$tag.".%.%' "; //elimine tous les descendants des enfants.
> 	  return $this->LoadAll("select * from ".$this->config["table_prefix"]."pages where latest = 'Y' and ".$condition."order by tag");
> 	}
> /* END Add */
283c299,302
< 	function SavePage($tag, $body, $comment_on = "") {
---
> /* Alter : groups */
> 	function SavePage($tag, $body, $comment_on = "", $parentautogen=FALSE) {
> 	        if($tag==="") return;
> /* END Alter */
307a327,333
> 
> /* Add : groups */
> 				if($parentautogen) {
> 				  $body="Arbre de [[.]] :\n{{listpages/children}}\n";// set default body for parent-group ??? Config option ???
> 				  $parentautogen=FALSE; //allow the page to be saved.
> 				}
> /* END Add*/
317c343,351
< 
---
> 			
> /* Add : groups */
> 			if($parentautogen==TRUE) //parent already exists (else, $parentautogen would have been set to FALSE). Quit.
> 			  return;
> 			
> 		        $parenttag="";
> 			if(($i=strrpos($tag,"."))!==FALSE) $parenttag=substr($tag, 0, $i);
> 			$this->SavePage($parenttag, "", "", TRUE);
> /* END Add */
411c445,447
< 	function Link($tag, $method = "", $text = "", $track = 1)
---
> /* Alter : groups */
> 	function Link($tag, $method = "", $text = "", $track = 1, $singlelink=TRUE)
> /* END Alter */
415c451,454
< 		if (!$text) $text = $tag;
---
> 		/* Modif : Gestion de groupes */
> 		$hastext=$text!=="";
> 		/* END Modif */
> 		if ($text==="") $text = $tag;
418c457,458
< 		if (preg_match("/^(".WN_UPPER.WN_CHAR."+):(".WN_CHAR2."*)$/s", $tag, $matches))
---
> 		   // why restrict the name of the page in interwiki ? 
> 		if (preg_match("/^(".WN_UPPER.WN_CHAR."+):((?!\\/\\/).*)$/s", $tag, $matches))
427c467,469
< 		else if (preg_match("/[^[:alnum:]]/", $tag))
---
> /* Alter : groups */
> 		else if (!preg_match("/^\\.*(".WN_UPPER.WN_CHAR."*(\\.".WN_UPPER.WN_CHAR."*)*)?$/", $tag))
> /* END Alter */
451,453c493,510
< 			// it's a Wiki link!
< 			if (isset($_SESSION["linktracking"]) && $track) $this->TrackLinkTo($tag);
< 			return ($this->LoadPage($tag) ? "<a href=\"".$this->href($method, $tag)."\">".$text."</a>" : "<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>");
---
> /* Alter : groups */
> 		        $abstag = $this->AbsoluteTag($tag);
> 			if($singlelink || $hastext) { //on fait comme avant
> 			  if($text==$tag) $text=substr($abstag, ($i=strrpos($abstag, "."))===FALSE?0:$i+1); //ne garde que le nom de la page.
> 			  $htmllinks = $this->ComposeLinkToPage($abstag, $method, $text, $track, ($this->LoadPage($abstag)?1:0));
> 			} else { //amusons nous :p (n'a de sens que si le $text n'est pas indiqué)
> 			  $htmllinks = "";
> 			  $subtag = ""; $i=0;
> 			  $splittag = explode(".", $abstag);
> 			  while($splittag[$i]!="")
> 			  {
> 			    $subtag .= (($subtag=="")?"":".").$splittag[$i];
> 			    $htmllinks .= (($htmllinks=="")?"":".").$this->ComposeLinkToPage($subtag, $splittag[$i+1]==""?$method:"", $splittag[$i], $track, ($this->LoadPage($subtag)?1:0));
> 			    $i++;
> 			  }
> 			}
> 			return $htmllinks;
> /* END Alter */
456c513,530
< 	function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1) {
---
> /* Add : groups */
>         /* Get Full tag name from a relative tag. */
>         function AbsoluteTag($tag) {
> 	  if($tag[0]!='.') return $tag; //already absolute name.
> 	  //traite les noms préfixés par des points (.Test défini une page fille de la page en cours).
> 	  $rettag = $this->tag . '.';
> 	  while($tag[O]=='.') //Résoud les retours sur ascendants.
> 	    {
> 	      $rettag = substr($rettag, 0, ($i=strrpos($rettag,"."))===FALSE?0:$i);
> 	      $tag = substr($tag, 1);
> 	    }
> 	  if($rettag!="" && $tag!="") $rettag.=".";
> 	  return $rettag . $tag;
> 	}
> /* END Add */
> /* Alter */
>         //Extend use of ComposeLinkToPage. Avoid code duplications.
> 	function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1, $exists = 1) {
461c535,537
< 		return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
---
> 		return ($exists ?
> 			'<a href="'.$this->href($method, $tag).'">'.$text.'</a>':
> 			"<span class=\"missingpage\">".$text."</span><a href=\"".$this->href("edit", $tag)."\">?</a>");
462a539,540
> /* END Alter */
> 
464c542,551
< 	function IsWikiName($text) { return preg_match("/^".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*$/", $text); }
---
> /* Alter Add : groups */
> 	function IsSingleWikiName($text) {
> 	  return preg_match("/^".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*$/", $text);
> }
> /* END Alter */
> /* Add : groups */
> 	function IsWikiName($text) {
> 	  return preg_match("/^".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*(\\.".WN_UPPER.WN_LOWER."+".WN_UPPER_NUM.WN_CHAR."*)*$/", $text);
> 	}
> /* END Add */
904,905c991,992
< if (preg_match("#^(".WN_CHAR."+?)/(".WN_CHAR2."*)$#", $wiki, $matches)) list(, $page, $method) = $matches;
< else if (preg_match("#^(".WN_CHAR."*)$#", $wiki, $matches)) list(, $page) = $matches;
---
> if (preg_match("#^((?:".WN_CHAR."|\\.)+?)/(".WN_CHAR2."*)$#", $wiki, $matches)) list(, $page, $method) = $matches;
> else if (preg_match("#^((?:".WN_CHAR."|\\.)*)$#", $wiki, $matches)) list(, $page) = $matches;


format +/-

diff -ruN wikini/wakka.php wikinfo/wakka.php
--- wikini/wakka.php    2003-07-06 22:44:40.000000000 +0200
+++ wikinfo/wakka.php   2004-01-04 16:14:00.000000000 +0100
@@ -480,6 +481,51 @@
                if ($this->LoadAcl($tag, $privilege, 0)) $this->Query("update ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."' where page_tag = '".mysql_escape_string($tag)."' and privilege = '".mysql_escape_string($privilege)."' limit 1");
                else $this->Query("insert into ".$this->config["table_prefix"]."acls set list = '".mysql_escape_string(trim(str_replace("\r", "", $list)))."', page_tag = '".mysql_escape_string($tag)."', privilege = '".mysql_escape_string($privilege)."'");
        }
+
+        // Return the associative array, key=group name, value=list of
+        // logins in group
+        function LoadGroup($grname = "")
+       {
+         if ($grname)
+           $query = "select * from ".$this->config["table_prefix"]."groups where grname = '".$grname."'order by grname asc, grmember asc";
+         else
+           $query = "select * from ".$this->config["table_prefix"]."groups order by grname asc, grmember asc";
+         $r = $this->Query($query);
+         if (! $r)
+           return 0;
+         // Group by lines
+         $grps = array();
+         while (list ($grname, $grmb) = mysql_fetch_row($r))
+           $grps[$grname] .= $grmb."\n";
+         mysql_free_result($r);
+         return $grps;
+       }
+
+        // Save the list of users in the group
+        function SaveGroup($grname, $userslist)
+        {
+         $grname = trim($grname);
+         $lst = explode("\n", $userslist);
+         $this->Query("delete from ".$this->config["table_prefix"]."groups where grname='".$grname."'", $this->dblink);
+         foreach ($lst as $login)
+           {
+             $login = trim($login);
+             if (! $login)
+               continue;
+
+             mysql_query("insert into ".$this->config["table_prefix"]."groups set grname = '".mysql_escape_string($grname)."', grmember = '".mysql_escape_string($login)."'", $this->dblink);
+           }
+       }
+
+        // return true if user is in the given group
+       function UserInGroup($group, $user = "")
+        {
+         if (!$user)
+           $user = $this->GetUserName();
+
+          return $this->LoadSingle("select grname from ".$this->config["table_prefix"]."groups where grname = '".mysql_escape_string($group)."' and grmember =
'".mysql_escape_string($user)."'");
+        }
+
        // returns true if $user (defaults to current user) has access to $privilege on $page_tag (defaults to current page)
        function HasAccess($privilege, $tag = "", $user = "")
        {
@@ -520,6 +566,22 @@
                                // everyone
                                case "*":
                                        return !$negate;
+                               // a group entry
+                               case "@":
+                                 {
+                                   if (! preg_match("/^[@](.*)$/",
+                                                    $line, $matches))
+                                     break;
+                                   $line = $matches[1];
+                                   if (!$this->UserInGroup($line))
+                                     {
+                                       return $negate;
+                                     }
+                                   else
+                                     {
+                                       return !$negate;
+                                     }
+                                 }
                                // aha! a user entry.
                                case "+":
                                        if (!$this->LoadUser($user))


Y a-t-il un bug avec les échappements ?...
> echo "mac\\'hin\"truc";

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]