base.inc 21.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
<?
    if(!isset($BASE_INC)) {
        $BASE_INC=1;

        /****************************************************************
         * Funktionen fuer den Aufbau der Startseite                    *
         ****************************************************************/
        class BASE {

            var $result;
            /**********************************************************
             * Konstruktor:                                           *
             **********************************************************/
            function BASE() {
                global $LANG, $PAGE;
                global $HTTP_REFERER, $REMOTE_ADDR;

                $url=parse_url($HTTP_REFERER);

                if($url["host"] != "www.steffers.org")
                   $this->result=system("../exec/counter ../counters/smain ".
                                 $REMOTE_ADDR." ../sems/smain");

                if(!isset($LANG))
                    $LANG="de";

                if(!isset($PAGE))
                    $PAGE="main";
            }

            function site_header() {
                global $LANG, $PAGE, $PHP_SELF;

                $main=$PHP_SELF."?LANG=".$LANG."&PAGE=main";
                $de=$PHP_SELF."?LANG=de&PAGE=".$PAGE;
                $en=$PHP_SELF."?LANG=en&PAGE=".$PAGE;

                echo "<MAP name=\"logomap\">\n";
                echo "  <area shape=\"rect\" coords=\"1,71,250,94\" ";
                echo "href=\"".$main."\">\n";
                echo "  <area shape=\"rect\" coords=\"184,47,214,64\" ";
                echo "href=\"".$en."\">\n";
                echo "  <area shape=\"rect\" coords=\"218,47,248,64\" ";
                echo "href=\"".$de."\">\n";
                echo "</MAP>\n\n";

                $mfile=fopen($LANG."/menu.cfg", "r");
                $head=fgets($mfile, 4096);
                while(!feof($mfile)) {
                    $line=fgets($mfile, 4096);
                    while(!feof($mfile) && strcmp($line, "\n")) {
                        $link=explode("#", chop($line));
                        $this->tooltip($link[2], $link[3], $link[4], $link[5],
                                       $link[6], $link[7], "#c9c9ff", 
                                       "#a0a0ff");

                        $line=fgets($mfile, 4096);
                    }

                    $head=fgets($mfile, 4096);
                }
                fclose($mfile);

                //echo $this->result."<br>\n";

                echo "<TABLE width=\"770\" border=\"0\" cellspacing=\"0\" ";
                echo "cellpadding=\"0\">\n";
                echo "<TR>\n";
                echo "    <TD class=\"header\" width=\"516\" height=\"100\">\n";
                echo "        <IMG src=\"images/img1.png\" border=\"0\"\n";
                echo "             vspace=\"0\" hspace=\"0\"\n";
                echo "             width=\"516\" height=\"100\"></TD>\n";
                echo "    <TD class=\"header\" width=\"254\" height=\"100\">\n";
                echo "        <IMG align=\"right\" src=\"images/img2.png\" ";
                echo "border=\"0\"\n";
                echo "             usemap=\"#logomap\" hspace=\"0\" ";
                echo "vspace=\"0\"\n";
                echo "             width=\"254\" height=\"100\"></TD>\n";
                echo "</TR>\n";
                echo "</TABLE>\n";
            }

            function menu_header($text, $style) {
                echo "<TR>\n";
                echo "  <TD colspan=\"3\" class=\"".$style."\">\n";
                echo "    <TABLE width=\"150\" border=\"0\" ";
                echo "cellspacing=\"0\" cellpadding=\"0\">\n";
                echo "    <TR>\n";
                echo "      <TD width=\"5\">\n";
                echo "        <IMG src=\"images/trans.gif\"\n";
                echo "             width=\"5\" height=\"1\"></TD>\n";
                echo "      <TD width=\"145\" height=\"20\" ";
                echo "valign=\"middle\">\n";
                echo "        <FONT class=\"menusubject\">\n";
                echo "          ".$text."</FONT></TD>\n";
                echo "    </TR>\n";
                echo "    </TABLE></TD>\n";
                echo "  <TD class=\"menuborder\" width=\"10\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"10\" height=\"1\"></TD>\n";
                echo "</TR>\n";
            }

            function menu_space($height, $bgcolor) {
                echo "<TR>\n";
                echo "  <TD height=\"".$height."\" width=\"20\" ";
                echo "bgcolor=\"".$bgcolor."\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"20\" height=\"1\"></TD>\n";
                echo "  <TD height=\"".$height."\" width=\"5\" ";
                echo "bgcolor=\"".$bgcolor."\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"5\" height=\"1\"></TD>\n";
                echo "  <TD height=\"".$height."\" width=\"125\" ";
                echo "bgcolor=\"".$bgcolor."\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"125\" height=\"1\"></TD>\n";
                echo "  <TD height=\"".$height."\" width=\"10\" ";
                echo "class=\"menuborder\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"10\" height=\"1\"></TD>\n";
                echo "</TR>\n";
            }

            function menu_link($text, $link, $name, $num, $bgcolor) {
                global $LANG, $PHP_SELF;

                if(strncmp(strtolower($link), "http://", 7) &&
                   strncmp(strtolower($link), "javascript:", 11))
                    $link=$PHP_SELF."?LANG=".$LANG."&PAGE=".$link;

                echo "<TR>\n";
                echo "  <TD width=\"20\" align=\"right\"\n";
                echo "      bgcolor=\"".$bgcolor."\" valign=\"middle\">\n";
                echo "    <A href=\"".$link."\" ";
                echo "onMouseOver=\"javascript:tooltip_on('".$name."',".$num.");\" ";
                echo "onMouseOut=\"javascript:tooltip_off('".$name."',".$num.");\">\n";
                echo "      <IMG src=\"images/boppel.png\" width=\"8\"\n"; 
                echo "           height=\"8\" border=\"0\"></A></TD>\n";
                echo "  <TD width=\"5\" bgcolor=\"".$bgcolor."\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"5\" height=\"1\"></TD>\n";
                echo "  <TD width=\"125\" align=\"left\""; 
                echo "      bgcolor=\"".$bgcolor."\" valign=\"middle\">\n";
                echo "    <A href=\"".$link."\" ";
                echo "onMouseOver=\"javascript:tooltip_on('".$name."',".$num.");\" ";
                echo "onMouseOut=\"javascript:tooltip_off('".$name."',".$num.");\">\n";
                echo $text."</A></TD>\n";
                echo "  <TD class=\"menuborder\" width=\"10\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"10\" height=\"1\"></TD>\n";
                echo "</TR>\n";
            }

            function tooltip($ttname, $tttext, $x, $y, 
                             $width, $height, $bgcol, $border) {
                global $LANG, $PHP_SELF;

                echo "<DIV id=\"".$ttname."\" class=\"tooltip\" ";
                echo "style=\"left: ".$x."px; top: ".$y."px;\">\n";
                echo "<TABLE border=\"0\" cellspacing=\"0\" ";
                echo "       cellpadding=\"0\">\n";
                echo "<TR>\n";
                echo "  <TD width=\"1\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "  <TD width=\"".$width."\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"".$width."\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "  <TD width=\"1\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "</TR>\n";
                echo "<TR>\n";
                echo "  <TD width=\"1\" height=\"".$height."\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"".$height."\" border=\"0\"></TD>\n";
                echo "  <TD width=\"".$width."\" height=\"".$height."\" ";
                echo "      bgcolor=\"".$bgcol."\">\n";
                echo      $tttext."</TD>\n";
                echo "  <TD width=\"1\" height=\"".$height."\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"".$height."\" border=\"0\"></TD>\n";
                echo "</TR>\n";
                echo "<TR>\n";
                echo "  <TD width=\"1\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "  <TD width=\"".$width."\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"".$width."\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "  <TD width=\"1\" height=\"1\" ";
                echo "      bgcolor=\"".$border."\">\n";
                echo "    <IMG src=\"images/trans.gif\" width=\"1\" ";
                echo "         height=\"1\" border=\"0\"></TD>\n";
                echo "</TR>\n";
                echo "</TABLE>\n";
                echo "</DIV>\n";
            }

            function menu_cinfo($text, $bgcolor) {
                echo "<TR>\n";
                echo "  <TD colspan=\"3\" bgcolor=\"".$bgcolor."\">\n";
                echo "    <TABLE width=\"150\" border=\"0\" ";
                echo "cellspacing=\"0\" cellpadding=\"0\">\n";
                echo "    <TR>\n";
                echo "      <TD width=\"5\">\n";
                echo "        <IMG src=\"images/trans.gif\"\n";
                echo "             width=\"5\" height=\"1\"></TD>\n";
                echo "      <TD width=\"145\" height=\"20\" ";
                echo "valign=\"middle\">\n";
                echo "        <FONT class=\"copyright\">\n";
                echo "          Copyright &copy 2001 ";
                echo "<A href=\"mailto:georg@steffers.org\">Georg Steffers</A>";
                echo "<BR>&nbsp;written with <A href=\"http://www.vim.org/\">vim</a>";
                echo "<BR>&nbsp;graphics created with ";
                echo "<a href=\"http://www.gimp.org/\">gimp</a>";
                echo "<BR><BR>\n";
                echo $text."\n";
                echo "        </FONT></TD>\n";
                echo "    </TR>\n";
                echo "    </TABLE></TD>\n";
                echo "  <TD class=\"menuborder\" width=\"10\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"10\" height=\"1\"></TD>\n";
                echo "</TR>\n";
            }

            function menu_end() {
                echo "<TR>\n";
                echo "  <TD colspan=\"3\" class=\"menubg\">\n";
                echo "    <TABLE width=\"150\" border=\"0\" cellspacing=\"0\"";
                echo "           cellpadding=\"0\">\n";
                echo "    <TR>\n";
                echo "      <TD width=\"5\">\n";
                echo "        <IMG src=\"images/trans.gif\"\n";
                echo "             width=\"5\" height=\"1\"></TD>\n";
                echo "      <TD width=\"145\" height=\"10\" ";
                echo "valign=\"middle\">\n";
                echo "        <IMG src=\"images/trans.gif\"\n";
                echo "             width=\"145\" height=\"1\"></TD>\n";
                echo "    </TR>\n";
                echo "    </TABLE></TD>\n";
                echo "  <TD width=\"10\">\n";
                echo "    <IMG src=\"images/bow2.png\"\n";
                echo "         width=\"10\" height=\"10\"></TD>\n";
                echo "</TR>\n";
            }

            function menu() {
                global $LANG;

                echo "<TABLE width=\"160\" border=\"0\" cellspacing=\"0\"";
                echo "       cellpadding=\"0\">\n";
                
                srand((double)microtime() * 1000000);

                $layernum=0;
                $mfile=fopen($LANG."/menu.cfg", "r");

                $head=fgets($mfile, 4096);

                while(!feof($mfile)) {
                    $bgnum=rand(1,3);

                    $this->menu_header($head, "menubg".$bgnum);
                    $this->menu_space("5", "#c9c9ff");

                    $line=fgets($mfile, 4096);
                    while(!feof($mfile) && strcmp($line, "\n")) {
                        $link=explode("#", chop($line));
                        $this->menu_link($link[0], $link[1], $link[2], 
                                         $layernum++, "#c9c9ff");
                        $line=fgets($mfile, 4096);
                    }

                    $this->menu_space("15", "#c9c9ff");
                    $head=fgets($mfile, 4096);
                }

                fclose($mfile);

                if(!($cr=file($LANG."/copyright.txt")))
                    return 0;

                $cr_text="";
                foreach($cr as $line)
                    $cr_text.=$line;
                           
                $this->menu_cinfo($cr_text, "#c9c9ff");
                $this->menu_end();

                echo "<TR>\n";
                echo "  <TD width=\"20\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"1\" height=\"1\"></TD>\n";
                echo "  <TD width=\"5\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"1\" height=\"1\"></TD>\n";
                echo "  <TD width=\"125\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"1\" height=\"1\"></TD>\n";
                echo "  <TD width=\"10\">\n";
                echo "    <IMG src=\"images/trans.gif\"\n";
                echo "         width=\"1\" height=\"1\"></TD>\n";
                echo "</TR>\n";
                echo "</TABLE>\n";
            }

            function page() {
                global $LANG, $PAGE;

                $page=$LANG."/".$PAGE.".inc";

                include($page);
            }

            function scandir($dir, $base, $depth, $class) {
                $d=dir($dir); 
                $dircount=0;
                $filecount=0;
                $width=20;
                $tgif="images/trans.gif";
                $filepics["gz"]="fileselpics/gnome-package.png";
                $filepics["tar"]="fileselpics/gnome-package.png";
                $filepics["tgz"]="fileselpics/gnome-package.png";
                $filepics["inc"]="fileselpics/gnome-html.png";
                $filepics["html"]="fileselpics/gnome-html.png";
                $filepics["htm"]="fileselpics/gnome-html.png";
                $filepics["php"]="fileselpics/gnome-html.png";
                $filepics["css"]="fileselpics/gnome-html.png";
                $filepics["c"]="fileselpics/gnome-file-c.png";
                $filepics["cpp"]="fileselpics/gnome-file-c.png";
                $filepics["h"]="fileselpics/gnome-file-h.png";
                $filepics["png"]="fileselpics/gnome-graphics.png";
                $filepics["gif"]="fileselpics/gnome-graphics.png";
                $filepics["jpg"]="fileselpics/gnome-graphics.png";

                while($entry=$d->read()) {
                    if($entry!="." && $entry!="..") {
                        if(is_dir($dir.$entry))
                            $dirs[$dircount++]=$entry;
                    else
                        $files[$filecount++]=$entry;
                    }
                }
                $d->close();

                $tmp=str_replace(".", "&fs", $dir);
                $id_base=str_replace("/", "", $tmp);

                $recall="";
                $recall_a=explode("/", $tmp);
                for($i=0; $i<count($recall_a)-2; $i++)
                    $recall.=$recall_a[$i];

                $recall=$recall."_".$recall_a[count($recall_a)-2];

                if($dir != $base) {
                    echo "<div name=\"".$id_base."_#\" id=\"".$id_base."_#\"";
                    echo "     class=\"".$class."\">\n";
                    echo "<table width=\"200\" border=\"0\" cellspacing=\"0\"";
                    echo "       cellpadding=\"0\">\n";
                    echo "<tr>\n";
                    echo "   <td width=\"".(($depth-1)*$width)."\"";
                    echo "       height=\"".$width."\">\n";
                    echo "      <img src=\"".$tgif."\"";
                    echo "           width=\"".(($depth-1)*$width)."\"";
                    echo "           height=\"".$width."\"></td>\n";
                    echo "   <td width=\"".$width."\"";
                    echo "       height=\"".$width."\">\n";
                    echo "      <img src=\"fileselpics/gnome-folder.png\"";
                    echo "           width=\"".$width."\"";
                    echo "           height=\"".$width."\"></td>\n";
                    echo "   <td width=\"".(200-(($depth-1)*$width)-$width)."\"";
                    echo "       height=\"".$width."\">\n";
                    echo "      <a class=\"dir\" href=\"javascript: ";
                    echo "         hidedir(/".$id_base.".+/, /".$recall."$/);\">\n";
                    echo "         <b>".$recall_a[count($recall_a)-2]."</b>";
                    echo "      </a></td>\n";
                    echo "</tr>\n";
                    echo "</table></div>\n";
                }

                if(isset($dirs)) {
                    sort($dirs);

                    foreach($dirs as $entry) {
                        $id=$id_base."_".$entry;

                        echo "<div name=\"".$id."\" id=\"".$id."\"";
                        echo "     class=\"".$class."\">\n";
                        echo "<table width=\"200\" border=\"0\"";
                        echo "       cellspacing=\"0\" cellpadding=\"0\">\n";
                        echo "<tr>\n";
                        echo "   <td width=\"".($depth*$width)."\"";
                        echo "       height=\"".$width."\">\n";
                        echo "      <img src=\"".$tgif."\"";
                        echo "           width=\"".($depth*$width)."\"";
                        echo "           height=\"".$width."\"></td>\n";
                        echo "   <td width=\"".$width."\"";
                        echo "       height=\"".$width."\">\n";
                        echo "      <img src=\"fileselpics/gnome-folder-close.png\"";
                        echo "           width=\"".$width."\"";
                        echo "           height=\"".$width."\"></td>\n";
                        echo "   <td width=\"".(200-($depth*$width))."\""; 
                        echo "       height=\"".$width."\">\n";
                        echo "      <a class=\"dir\" href=\"javascript:";
                        echo "         showdir(/".$id_base.$entry."_.+/, /".$id."$/);\">\n";
                        echo "         <b>".$entry."</b></a></td>\n";
                        echo "</tr>\n";
                        echo "</table></div>\n";

                        $this->scandir($dir.$entry."/", $base, $depth+1, "invis");
                    }
                }

                if(isset($files)) {
                    sort($files);
                    $id=$id_base."_files";

                    echo "<div name=\"".$id."\" id=\"".$id."\"";
                    echo "     class=\"".$class."\">\n";

                    foreach($files as $file) {
                        $img=$filepics[substr($file, strrpos($file, ".")+1)];

                        if(!isset($img))
                            $img="fileselpics/gnome-textfile.png";

                        echo "<table width=\"200\" border=\"0\"";
                        echo "       cellspacing=\"0\" ";
                        echo "       cellpadding=\"0\">\n";
                        echo "<tr>\n";
                        echo "   <td width=\"".($depth*$width)."\"";
                        echo "       height=\"".$width."\">\n";
                        echo "      <img src=\"".$tgif."\"";
                        echo "           width=\"".($depth*$width)."\"";
                        echo "           height=\"".$width."\"></td>\n";
                        echo "   <td width=\"".$width."\"";
                        echo "       height=\"".$width."\">\n";
                        echo "      <img src=\"".$img."\" width=\"".$width."\"";
                        echo "           height=\"".$width."\"></td>\n";
                        echo "   <td width=\"".(200-($depth*$width))."\"";
                        echo "       height=\"15\">\n";
                        echo "     <font class=\"file\">\n";
                        echo $file."<br>\n";
                        echo "     </font></td>\n";
                        echo "</tr>\n";
                        echo "</table>";
                    }

                    echo "</div>\n";
                }
            }
        }
    }
?>