Revision [653]

This is an old revision of GmBowen made by GmBowen on 2004-06-16 00:20:23.

 

My programming guy (Mark Kasper) has completed a modification of the pageindex.php code that should make it more useable for high-use wakka/wikka sites (such as can now be seen at the original wakka site). It can either be used as usual, {{pageindex}}, or using a parameter indicating which letter you would like to see a listing for (for example, {{pageindex start="a"}}...or whatever letter you wish to show a listing for). If you enter a letter that there is not yet a listing for, then it defaults to "all".

<?php /*dotmg modifications : contact m.randimbisoa@dotmg.net*/ ?>
<?php
$a = array(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z);

if ($pages = $this->LoadAllPages())
{	
	 $link = $this->config["base_url"].$this->MiniHref($method, $tag);
	 print("<strong><a href='$link&var=ALL'>ALL</a> &nbsp;</strong> \n"); 
	  
	 foreach ($pages as $page){
		 if (!preg_match("/^Comment[0-9]+$/", $page["tag"])) {
			$firstChar = strtoupper($page["tag"][0]);
			if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
				$firstChar = "#";
			}

			if ($firstChar != $curChar) {
				if ($curChar) print("\n");
				   	print("<strong><a href='$link&var=$firstChar'>$firstChar</a>&nbsp;</strong> \n");
				$curChar = $firstChar;
			}
		}
	}
	print("<br><br>");
	$curChar = "";
	
	foreach ($pages as $page)
	{
	  
		//#dotmg [1 line modified]: added [0-9]+$ to regular expression
		if (!preg_match("/^Comment[0-9]+$/", $page["tag"])) {
			$firstChar = strtoupper($page["tag"][0]);
			
					$st = htmlspecialchars(urldecode($_GET['var']));
			
		  if($st == ''){	
			if($start == 'ALL')
			{$st='';}
			elseif($start != '')
			{
			   for($i=0; $i<27; $i++)
			   {
				 if($start == $a[$i])
				 { 
				   $st = $a[$i];
				 }
			   }			
			}
		  }
						
		 if($firstChar == $st)
		 {	
			if (!preg_match("/[A-Z,a-z]/", $firstChar)) {
				$firstChar = "#";
			}

			if ($firstChar != $curChar) {
				if ($curChar) print("<br />\n");
				print("<strong>$firstChar</strong><br />\n");
				$curChar = $firstChar;
			}

			if ($this->HasAccess("read", $page["tag"])) {
				print($this->Link($page["tag"]));
	 			}
			else {
				print($page["tag"]);
			}
			if ($page['owner'] != '')
	 			{					   
	   			if ($this->UserName() == $page['owner']) 
	  				print(" . . . . one of your pages.");
	 				else {
					if ($this->HasAccess("read", $page["owner"])) {
			 				print(" . . . . Owner: ".$this->Format($page['owner']));
			 			}
					else {
   						print(" . . . . Owner: ".$page['owner']);
					}
				}
	 			}

	 			print("<br />\n");	
				
		}
		elseif ('' == $st || $st == 'ALL')
		{ 
			if ($firstChar != $curChar) {
				if ($curChar) print("<br />\n");
				print("<strong>$firstChar</strong><br />\n");
				$curChar = $firstChar;
			}

			if ($this->HasAccess("read", $page["tag"])) {
				print($this->Link($page["tag"]));
	 			}
			else {
				print($page["tag"]);
			}
			if ($page['owner'] != '')
	 			{					   
	   			if ($this->UserName() == $page['owner']) 
	  				print(" . . . . one of your pages.");
	 				else {
					if ($this->HasAccess("read", $page["owner"])) {
			 				print(" . . . . Owner: ".$this->Format($page['owner']));
			 			}
					else {
   						print(" . . . . Owner: ".$page['owner']);
					}
				}
	 			}

	 			print("<br />\n");		   
		} 
	  }
	}

}
else
{
	print("<em>No pages found.</em>");
}

?>


If anybody has any suggestions, or sees any security issues, please let me know. Mark is working on some other issues for me right now (other mods for wakka.....a *very* simple spreadsheet-like interactive table tool actually, and a file upload tool so kids [the target group for my wikka implementation] can upload pix but they'll go to a central area for approval first after which they'll be sent to a personal file area so they can be embedded in wikka pages) but if there are useful suggestions for the pageindex action then he might be able to look at them before his contract ends -- Mike Bowen
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki