71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| class quotearray {
 | |
|   private $list=array();
 | |
|   
 | |
|   function add($what,$who) {
 | |
|     $this->list[sizeof($this->list)]=array($what,$who);
 | |
|   }
 | |
|   
 | |
|   function random() {
 | |
|     $rnd=mt_rand(0,sizeof($this->list)-1);
 | |
|     return "<p>".$this->list[$rnd][0]."<p>\n<p id='who'>- ".$this->list[$rnd][1]."</p>";
 | |
|   }
 | |
| }
 | |
| 
 | |
| $type=0;
 | |
| 
 | |
| class linksarray {
 | |
|   private $list=array();
 | |
|   private $cats=array();
 | |
|   private $type;
 | |
|   
 | |
|   function linksarray() {
 | |
|     global $type;
 | |
|     $this->type=$type;
 | |
|     $type++;
 | |
|   }
 | |
|   
 | |
|   function add($page) {
 | |
|     $this->list[sizeof($this->list)]=$page;
 | |
|   }
 | |
|   
 | |
|   function cat($title) {
 | |
|     $this->cats[sizeof($this->cats)]=array($title,sizeof($this->list));
 | |
|   }
 | |
|   
 | |
|   function size() {
 | |
|     return sizeof($this->list);
 | |
|   }
 | |
|   
 | |
|   function generate($split="") {
 | |
|     global $pagetype,$pagesite,$title;
 | |
|     $list_size=sizeof($this->list);
 | |
|     $cats_size=sizeof($this->cats);
 | |
|     $current_cat=0;
 | |
|     $output="";
 | |
|     $i=array();
 | |
|     
 | |
|     for ($i[0]=0;$i[0]<$list_size;$i[0]++) {
 | |
|     
 | |
|       for ($i[1]=$current_cat;$i[1]<$cats_size;$i[1]++) {
 | |
|         if ($this->cats[$i[1]][1]==$i[0]) $output.="\n<div class='cat'>".$this->cats[$i[1]][0]."</div>\n";
 | |
|       }
 | |
|       
 | |
|       if ($pagetype==$this->type && $pagesite==$i[0]) {
 | |
|         $container[0]="<div id='current'>";
 | |
|         $container[1]="</div>";
 | |
|         $title=$this->list[$i[0]];
 | |
|       }
 | |
|       else {
 | |
|         if ($this->type==0 && $i[0]==0) $link=".";
 | |
|         else $link="?t=".$this->type."&s=".$i[0];
 | |
|         $container[0]="<a href='".$link."'>";
 | |
|         $container[1]="</a>";
 | |
|       }
 | |
|       
 | |
|       $output.=$container[0].$this->list[$i[0]].$container[1]."\n".$split;
 | |
|     }
 | |
|     return $output;
 | |
|   }
 | |
| }
 | |
| ?>
 |