Инклуд

Статус
В этой теме нельзя размещать новые ответы.
мой скрипт - это моя интелектуальная собственность. http://nulled.cc/forum/showthread.php?p=793 :D

На самом деле пишу поисковик, что-то вроде Гугла(!)
ЗЫ: Замахнулся. :)
 
Код одного файла могу открыть, завтра, щяс никак.
 
PHP:
<?php
/* This file is part of FIX.Engine (Search Engine)
 *
 * $Header: /cvs/engine/lib/html.php, joku Exp $
 *
 * Copyright (C) 2006, WaRnInG OnLiNe EnTeRTaiNMenT (see file doc/authors.txt
 * distributed with this library)
 *
 * See doc/copying.txt for details
 */

class bbc_html {
  var $lang_tab, $lng, $server;

  function get_lng() {
    if (_BBC_PHP < 410) global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;

    global $BBC_LANGUAGE;

    $get = ((_BBC_PHP < 410) ? !empty($HTTP_GET_VARS['lng']) : !empty($_GET['lng'])) ?
           ((_BBC_PHP < 410) ? $HTTP_GET_VARS['lng'] : $_GET['lng']) : "";
    $post = ((_BBC_PHP < 410) ? !empty($HTTP_POST_VARS['lng']) : !empty($_POST['lng'])) ?
            ((_BBC_PHP < 410) ? $HTTP_POST_VARS['lng'] : $_POST['lng']) : "";
    $aclng = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']) :
             !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? ((_BBC_PHP < 410) ?
             $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'] : $_SERVER['HTTP_ACCEPT_LANGUAGE']) : "";

    if ($get && preg_match(":^[w-]{1,5}:", $get)) $this->lng = $get;
    elseif ($post && (preg_match(":^[w-]{1,5}:", $post))) $this->lng = $post;
    elseif ($aclng && (preg_match(":^[w-]{1,5}:", $aclng))) {
      $sep = strpos(str_replace(";", ",", $aclng), ",");

      $this->lng = ($sep === false) ? $aclng : substr($aclng, 0, $sep);
      $this->lng = ((($dash = strpos($this->lng, "-")) !== false) && (!isset($this->lang_tab[$this->lng]))) ?
                   substr($this->lng, 0, $dash) : $this->lng;
    }
    else $this->lng = $BBC_LANGUAGE;

    return (isset($this->lang_tab[$this->lng]) ? $this->lng : $BBC_LANGUAGE);
  }

  // Date format depending on the detected language
  function set_title() {
    global $_, $BBC_TIMESTAMP, $BBC_TIME_OFFSET, $BBC_TITLEBAR;

    $conv = array(
      "%DATE" => date($_['global_date_format'], ($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60))),
      "%SERVER" => $this->server
    );

    return strtr($BBC_TITLEBAR, $conv);
  }

  // Begin of all bbclone files
  function html_begin() {
    global $BBC_VERSION, $BBC_IMAGES_PATH, $BBC_NUM_SIZE, $BBC_TEXT_SIZE, $BBC_TITLE_SIZE, $BBC_SUBTITLE_SIZE, $_;

    // Work around default charset in Apache 2 (Thanks Martin Halachev!)
    if (!headers_sent()) header("(anti-spam-content-type:) text/html; charset=".$_['global_charset']);

         ?>
<?php
include ('config.php');
?>
<?php

    return
    "<?xml version="1.0" encoding="".$_['global_charset'].""?>n"
          ."<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
          .""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">n"
          ."<html xmlns="http://www.w3.org/1999/xhtml">n"
          ."<head>n"
          ."<title>".$_['title']."</title>n"
          ."<link rel="shortcut icon" href="".$BBC_IMAGES_PATH."favicon.ico" />n"
          ."<meta http-equiv="pragma" content="no-cache" />n"
          ."<link rel="stylesheet" href="style.css" type="text/css">n"
          ."<meta http-equiv="Content-Type" content="text/html; charset=".$_['global_charset']."" />n"
          ."<script language="JavaScript" type="text/JavaScript">n"
."<!--n"



."function MM_preloadImages() { //v3.0n"
  ."var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();n"
    ."var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)n"
    ."if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}n"
."}n"
."//-->n"
."</script>n"

          ."</head>n"
          ."<body onload="if(self.parent.frames.length!= 0) self.parent.location=document.location; else document.web.text.focus();">n"
          ."<!--n"
          ."".$_['name']."n"
          ."Homebase: ".$_['url']." n"
          ."Copyright: ".$_['year'].";".$_['company']."n"
          ."-->n"
            ."<script>n"
."<!--n"

."function click(){n"
."if(event.button==2){n"
."alert('Защищено от копирования! Copyright © 2004-2006 by  4NetGroup ');n"
."}n"
."}n"
."document.onmousedown=clickn"

."// -->n"
."</script>n"
;
  }

  // End of all html documents
  function html_end() {
    return "</body>n"
          ."</html>n";
  }

  // Return the navigation toolbar
  //  if set to 0 $lang_sel turns off the navbar and $on_bottom the title
  function topbar($lang_sel = 1, $on_bottom = 0) {
    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;

    global $_, $BBC_IMAGES_PATH, $BBC_MAINSITE, $BBC_SHOW_CONFIG;

    // needed for navigation bar to avoid rendering issues
    $rtl = (strpos($_['global_charset'], "indows-1256") !== false) ? true : false;
    $self = basename((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['PHP_SELF'] : $_SERVER['PHP_SELF']);
    $self = htmlspecialchars(str_replace("index.php", ".", $self), ENT_QUOTES);
    $url_query = !empty($this->lang_tab[$this->lng]) ? "?lng=".$this->lng."" : "";
    // Navigation bar stuff

    $str = (empty($lang_sel) ? "" : "<form method="post" action="$self">n")
          ."<table border="0" cellspacing="1" cellpadding="2" width="100%" "
          ."style="background-color: #c0cbeb"
          .(empty($on_bottom) ? "" : "; border-width:1px; border-color:#606680; border-style: solid none")."">n"
          ."<tr>n"
          ."<td align="center" height="30" width="100%">n"
          ."<span class="navbar">n"
          .($rtl ? "<bdo dir="rtl">n" : "");

    $sep = "";
    $ico_nr = 1;


    if (!empty($lang_sel)) {
      $str .= "&nbsp;&nbsp;n"
             ."<img src="".$BBC_IMAGES_PATH."navbar_lng.png" border="0" height="14" width="14" "
             ."alt="Language" title="Language" />&nbsp;n"
             ."<select name="lng" onchange="if (this.selectedIndex>0){location.href='$self?lng=' + "
             ."this.options[this.selectedIndex].value;}">n"
             ."<option value=""".(empty($this->lng) ? " selected="selected"" : "").">Language</option>n";

      foreach ($this->lang_tab as $lang_id => $lang_name) {
        $str .= "<option value="$lang_id"".(($this->lng == $lang_id) ? " selected="selected"" : "")
               .">$lang_name</option>n";
      }
      $lang_tab_lng = empty($this->lang_tab[$this->lng]) ? "" : $this->lang_tab[$this->lng];
      $str .= "</select>n"
             ."&nbsp;<input type="submit" value="Go" />n";
    }

    $str .= ($rtl ? "</bdo>n" : "")
           ."</span>n"
           ."</td>n"
           ."</tr>n"
           ."</table>n"
           .((!empty($on_bottom)) ? "" :
            "<table border="0" cellspacing="1" cellpadding="2" width="100%" class="brd" "
           ."style="background-color: #808ebf; border-style: solid none">n"
           ."<tr>n"
           ."<td align="center" class="titlebar" height="30" width="100%">n"
           .$this->set_title()."n"
           ."</td>n"
           ."</tr>n"
           ."</table>n")
           .(empty($lang_sel) ? "" : "</form>n");

      return $str;
  }

  function last_reset($timestamp) {
    global $_;

    return "<p align="center"><i>".$_['global_last_reset'].": ".date($_['global_date_format'], $timestamp)
          ."</i></p>n";
  }

  function copyright() {
    global $BBC_IMAGES_PATH, $BBC_VERSION, $_;

    return "<p align="center">n"
          ."<a href="http://bbclone.de/">BBClone $BBC_VERSION</a>"
          ." &copy; ".$_['global_bbclone_copyright']." "
          ."<a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>"
          ." <a href="http://validator.w3.org/check?url=referer">"
          ."<img src="".$BBC_IMAGES_PATH."valid-xhtml10.png" height="15" width="80" border="0" "
          ."alt="Valid XHTML 1.0!" title="Valid XHTML 1.0!" align="middle" />"
          ."</a>n "
          ."<a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="".$BBC_IMAGES_PATH
          ."valid-css.png" height="15" width="80" border="0" alt="Valid CSS!" title="Valid CSS!" "
          ."align="middle" /></a>n"
          ."</p>n";
  }

  // generates the explanation rows. The $val switch determines whether we show
  // the variable's value or just indicate its state
  function show_var($varname, $val = 1) {
    $caps = "BBC_".strtoupper($varname);

    global $$caps, $_;

    // Ugly hack to save some lines of typing
    $$caps = ($caps == "BBC_TITLEBAR") ? $this->set_title() : $$caps;

    return "<tr style="background-color: #e0e5f2" onmouseover="this.style.backgroundColor='#e5f2f7'" "
          ."onmouseout="this.style.backgroundColor='#e0e5f2'">n"
          ."<td align="left" class="rows" valign="middle">n"
          ."<b>$$caps</b>n"
          ."</td>n"
          ."<td align="left" class="rows" valign="middle">n"
          .$_["config_bbc_".$varname]."n"
          ."</td>n"
          ."<td align="left" class="rows" valign="middle">n"
          ."<b>".(!empty($$caps) ? (empty($val) ? $_['global_yes'] : $$caps) : $_['global_no'])."</b>n"
          ."</td>n"
          ."</tr>n";
  }

  // Color explanation
  function color_explain() {
    global $_, $BBC_MAXTIME, $BBC_MAXVISIBLE;

    return "<p align="center"><i>n"
          .$_['dstat_visible_rows'].": $BBC_MAXVISIBLE,n"
          ."<span style="color: #61ae9d">".$_['dstat_green_rows']
          .":</span> ".$_['dstat_last_visit']." &lt; $BBC_MAXTIME ".$_['misc_second_unit'].",n"
          ."<span style="color: #808ebf">".$_['dstat_blue_rows']
          .":</span> ". $_['dstat_last_visit']." &gt; $BBC_MAXTIME ".$_['misc_second_unit'].",n"
          ."<span style="color: #cc7286">".$_['dstat_red_rows'].":</span> ".$_['dstat_robots'].".n"
          ."</i></p>n";
  }

  // Determine the color of the connection
  function connect_code_color($connect) {
    global $BBC_MAXTIME, $BBC_TIMESTAMP, $BBC_TIME_OFFSET;

    if ((($BBC_TIMESTAMP + ($BBC_TIME_OFFSET * 60)) - $connect['time']) < $BBC_MAXTIME) return "#e5f2f7";
    // else, it is red if it is a robot
    elseif (!empty($connect['robot'])) return "#efe2ec";
    // or blue if something else
    else return "#e0e5f2";
  }

  //constructor
  function bbc_html() {
    if (_BBC_PHP < 410) global $HTTP_SERVER_VARS;

    $this->lang_tab = array(
      "ar"    => "Arabic",
      "bs"    => "Bosnian",
      "bg"    => "Bulgarian",
      "ca"    => "Catalan",
      "cs"    => "Czech",
      "zh-cn" => "Chinese Simp",
      "zh-tw" => "Chinese Trad",
      "da"    => "Danish",
      "nl"    => "Dutch",
      "en"    => "English",
      "fi"    => "Finnish",
      "fr"    => "French",
      "de"    => "German",
      "el"    => "Greek",
      "hu"    => "Hungarian",
      "it"    => "Italian",
      "ja"    => "Japanese",
      "ko"    => "Korean",
      "lt"    => "Lithuanian",
      "mk"    => "Macedonian",
      "nb"    => "Norwegian Bkm",
      "pl"    => "Polish",
      "pt-br" => "Portuguese Br",
      "ro"    => "Romanian",
      "ru"    => "Russian",
      "sk"    => "Slovak",
      "sl"    => "Slovenian",
      "es"    => "Spanish",
      "sv"    => "Swedish",
      "th"    => "Thai",
      "tr"    => "Turkish",
      "uk"    => "Ukrainian"
    );

    $this->lng = $this->get_lng();
    $this->server = ((_BBC_PHP < 410) ? !empty($HTTP_SERVER_VARS['SERVER_NAME']) : !empty($_SERVER['SERVER_NAME'])) ?
                    htmlspecialchars(((_BBC_PHP < 410) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $_SERVER['SERVER_NAME']),
                    ENT_QUOTES) : "noname";
  }
}
?>
вот
 
ндя, этоже во всех учебниках по пхп есть...
include ('config.php'); в самое начало - ДО классов и функций лучше..

ЗЫ Ты это все писал? помоему слеплено с некоторых готовых функций.. причем старых, есть более новые принципы для реализации подобных возможностей...
 
угу, у меня старая книга от АСТ пресс за 2002 год :)
Дык куда сувать? Пример в студию!
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху