"Fossies" - the Fresh Open Source Software Archive

Member "ide.php-1.5.3/about_ide.php" (21 Aug 2004, 17995 Bytes) of package /linux/www/old/ide.php-1.5.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 #
    4 # class Getcount, only loaded if this is run at original location (www.ekenberg.se)
    5 # sets global variable $Getcount_is_loaded if loaded
    6 #
    7    @include("./getcount.php");
    8 
    9    $Web = new Web;
   10 
   11 class Web {
   12    var $GPL_link        = "<A HREF='http://www.gnu.org/copyleft/gpl.html'>GNU General Public License</A>";
   13    var $PHP_link        = "<A HREF='http://www.php.net'>PHP</A>";
   14    var $Apache_link     = "<A HREF='http://www.apache.org'>Apache</A>";
   15    var $IIS_link        = "<A HREF='http://www.microsoft.com'>Microsoft IIS</A>";
   16    var $Xitami_link     = "<A HREF='http://www.imatix.com'>Xitami</A>";
   17    var $VMware_link     = "<A HREF='http://www.vmware.com'>VMware</A>";
   18    var $Homepage_url        = "http://www.ekenberg.se/php/ide/";
   19    var $Screenshot_main_url = "http://www.ekenberg.se/php/ide/images/ide.php-main_window.gif";
   20    var $Screenshot_options_url  = "http://www.ekenberg.se/php/ide/images/ide.php-options.gif";
   21    var $tar_gz_filename     = "ide.php-1.5.2.tar.gz";
   22    var $zip_filename        = "ide.php-1.5.2.zip";
   23 
   24 function Web() {
   25    global $HTTP_GET_VARS;
   26    $this->Out   = new Page;
   27    $this->Text  = new Text($this);
   28 
   29    if (! $HTTP_GET_VARS['label']) {
   30       $HTTP_GET_VARS['label'] = "news";     // default
   31    }
   32 
   33    print $this->Out->html_top();
   34    print "<DIV ALIGN='CENTER'>\n";
   35    print "<H2>I D E . P H P</H2>\n";
   36    print "</DIV>\n";
   37    // Important output starts here
   38 
   39    print $this->Out->start_box_table(600);
   40    print "<TR><TD>\n";
   41    while (list($label,$header) = each($this->Text->Info_sections)) {
   42       print "<H4><A HREF='{$GLOBALS['PHP_SELF']}?label=$label' TARGET='_self'>$header</A></H4>\n";
   43       if ($label == $HTTP_GET_VARS['label']) {
   44          print $this->Out->begin_invisible_table("85%", array("CELLPADDING='1'", "CELLSPACING='0'", "ALIGN='center'", "BGCOLOR='#000000'"));
   45          print "<TR><TD>\n";
   46          print $this->Out->begin_invisible_table("100%", array("CELLPADDING='20'", "CELLSPACING='0'", "ALIGN='center'", "BGCOLOR='{$this->Out->Box_bgcolor}'"));
   47          print "<TR><TD>\n";
   48          print $this->Text->$label();
   49          print "</TD></TR></TABLE>\n";
   50          print "</TD></TR></TABLE>\n";
   51       }
   52    }
   53    print "</TD></TR>\n";
   54    print $this->Out->end_box_table();
   55 
   56    print "<BR>\n";
   57 
   58    print $this->Out->start_box_table(600);
   59    print "<TR><TD>\n";
   60    print "<H4>Update notification</H4>\n";
   61    print $this->Out->begin_invisible_table("85%", array("CELLPADDING='1'", "CELLSPACING='0'", "ALIGN='center'", "BGCOLOR='#000000'"));
   62    print "<TR><TD>\n";
   63    print $this->Out->begin_invisible_table("100%", array("CELLPADDING='20'", "CELLSPACING='0'", "ALIGN='center'", "BGCOLOR='{$this->Out->Box_bgcolor}'"));
   64    print "<TR><TD>\n";
   65    print "<P><SMALL>Enter your email address below to receive notification by email
   66          when new versions of Ide.php are released. Your address will be kept private and used
   67          only for this purpose.</SMALL></P>\n";
   68    print "<FORM METHOD='post' ACTION='http://www.ekenberg.se/cgi-bin/subscribe_gm.cgi' TARGET='_self'>\n";
   69    print "<INPUT TYPE='text' NAME='address'>\n";
   70    print "<BR>\n";
   71    print "<SELECT NAME='action'>\n";
   72    print "<OPTION VALUE='subscribe'>Subscribe\n";
   73    print "<OPTION VALUE='unsubscribe'>Unsubscribe\n";
   74    print "</SELECT>\n";
   75    print "<INPUT TYPE='submit' VALUE='  OK  '>\n";
   76    print "<INPUT TYPE='hidden' NAME='list' VALUE='ide.php-announce'>\n";
   77 #   print "<INPUT TYPE='hidden' NAME='email_alert' VALUE='0'>\n";
   78 #   print "<INPUT TYPE='hidden' NAME='alert_address' VALUE='ide.php@ekenberg.se'>\n";
   79    print "<INPUT TYPE='hidden' NAME='mail_subscriber' VALUE='1'>\n";
   80    print "<INPUT TYPE='hidden' NAME='from_address' VALUE='ide.php@ekenberg.se'>\n";
   81    print "<INPUT TYPE='hidden' NAME='welcome_message_subject' VALUE='Welcome to ide.php-announce@ekenberg.se!'>\n";
   82    print "<INPUT TYPE='hidden' NAME='welcome_message' VALUE='Your email address was added. Announcements about Ide.php will be sent to you.
   83 
   84 To unsubscribe from this list, please use the form at URL: http://www.ekenberg.se/php/ide/'>\n";
   85    print "<INPUT TYPE='hidden' NAME='subscribe_url' VALUE='www.ekenberg.se/php/ide/'>\n";
   86    print "<INPUT TYPE='hidden' NAME='unsubscribe_url' VALUE='www.ekenberg.se/php/ide/'>\n";
   87    print "<INPUT TYPE='hidden' NAME='fail_url' VALUE='www.ekenberg.se/php/ide/'>\n";
   88    print "</FORM>\n";
   89    print "</TD></TR></TABLE>\n";
   90    print "</TD></TR></TABLE>\n";
   91    print "</TD></TR>\n";
   92    print $this->Out->end_box_table();
   93 
   94    // Important output ends here
   95    print $this->Out->html_bottom();
   96 }
   97 } // end class Web
   98 
   99 
  100 
  101 #
  102 # class Text
  103 #
  104 class Text {
  105    var $Super;
  106    var $Info_sections   = array("what"      => "What is Ide.php?",
  107                 "news"      => "News",
  108                 "try"       => "Try it out",
  109                 "documentation" => "Documentation",
  110                 "security"  => "Security",
  111                 "download"  => "Download",
  112                 "license"   => "License",
  113                 "requirements"  => "Requirements",
  114                 "contact"   => "Contact");
  115 function Text($super) {
  116    $this->Super = $super;
  117 }
  118 
  119 function news() {
  120    if (file_exists("./Changes.txt")) {
  121       $changes_array = array_reverse(file("./Changes.txt"));
  122       for ($i=0;$i<sizeof($changes_array);$i++) {
  123          $changes_array[$i] = ereg_replace("^([-0-9]+)[[:space:]]+(.+)", "<small>\\1</small> \\2", htmlentities($changes_array[$i]));
  124       }
  125    }
  126    else {
  127       $changes_array[0] = "Please visit the Ide.php <A HREF='{$this->Super->Homepage_url}'>homepage</A> to view recent changes!";
  128    }
  129    $ret .= "<H5>Releases</H5>
  130             <UL>
  131             <LI><small>2004-08-21</small> Released version 1.5.2
  132             <LI><small>2003-05-16</small> Released version 1.5.1
  133             <LI><small>2002-04-11</small> Released version 1.5
  134             <LI><small>2001-08-28</small> Released version 1.4
  135             <LI><small>2000-08-21</small> Released version 1.3
  136             <LI><small>2000-06-13</small> Released version 1.2
  137             <LI><small>2000-06-03</small> Released version 1.1
  138             <LI><small>2000-05-26</small> Initial release, version 1.0
  139             </UL>
  140             <H5>Changes</H5>
  141             <UL>\n";
  142    while (list(,$row) = each($changes_array)) {
  143       $ret .= "<LI>$row\n";
  144    }
  145    $ret .= "</UL>";
  146    return($ret);
  147 }
  148 
  149 function what() {
  150    $ret .= "<P>Ide.php is a web-based editor for quick development of server-side code. 
  151             It offers a rapid prototyping environment, letting the user test and 
  152             save snippets of code with minimal overhead.</P>
  153             <P>Ide.php was primarily written for {$this->Super->PHP_link}, but has been extended
  154             to enable development in any server-side scripting language available on the server
  155             where it's running, like SSI, ASP, JSP, SSJS, even CGI!</P>
  156             <P>Ide.php eliminates the need to use several
  157             separate programs (text editor, FTP program and web browser)
  158             for web development, since all work is done directly through the browser.
  159             This helps to shorten development time, and is also very helpful
  160             when learning a new scripting language, like {$this->Super->PHP_link}.</P>
  161             <P>Ide.php requires {$this->Super->PHP_link} version 4 or higher.</P>";
  162    return($ret);
  163 }
  164 
  165 function try() {
  166    $ret .= "<P>For security reasons, you can <U>not</U> try Ide.php at this website!</P>
  167             <P>I'm sorry to have tricked you into reading this, but it's
  168             very important to understand the security issues involved in using Ide.php.
  169             Please read more about security <A HREF='{$GLOBALS['PHP_SELF']}?label=security' TARGET='_self'>below</A>.</P>
  170             <P>By popular request, here are a few screenshots of Ide.php in action:</P>
  171             <UL>
  172             <LI><A HREF='{$this->Super->Screenshot_main_url}'>Main code window (version 1.3)</A>
  173             <LI><A HREF='{$this->Super->Screenshot_options_url}'>Options dialog (version 1.3)</A>
  174             </UL>";
  175    return($ret);
  176 }
  177 
  178 function documentation() {
  179    $ret .= "<H5>Installation</H5>
  180             <P>Installation of Ide.php is easy:</P>
  181             <OL>
  182             <LI><A HREF='{$GLOBALS['PHP_SELF']}?label=download' TARGET='_self'>Download</A>
  183             the latest distribution from this website.
  184             <LI>Unzip or untar the contents of the distribution archive in
  185             the directory were you want to put Ide.php. Obviously, this directory
  186             has to reside somewhere in your web space.
  187             <LI>Make sure that the web server has write access to the directory
  188             where you put Ide.php, the 'data' directory (which was created
  189             when unpacking the archive), and the files in the 'data' directory.
  190             If you don't know how to do this, contact your system administrator.
  191             On my Linux system it's: 'chmod 777 . ./data ./data/*', executed
  192             in the chosen directory.
  193             <LI>Be sure to read the section about <A HREF='{$GLOBALS['PHP_SELF']}?label=security' TARGET='_self'>
  194             security</A>, and take relevant steps for protection.
  195             </OL>
  196             <H5>Usage</H5>
  197             <P>Using Ide.php should be fairly self explanatory. In your web browser,
  198             go to the URL where you unpacked Ide.php. The main page should appear.
  199             If it doesn't, you should adjust your web server to accept 'index.php' as a Directory Index.
  200             The big textarea is where your code goes. This could be any code that's acceptable on your server,
  201             like PHP, HTML, ASP, CGI etc.</P>
  202             <UL>
  203             <LI>The current context is determined by the suffix set in the lower middle: 'Run as'.
  204             To execute your code in ASP context, select '.asp' in the 'Run as' list. 
  205             (Obviously, your server has to support ASP for this to work). Additional suffixes can
  206             be added through the 'Options' dialog.
  207             <LI>To view the result, press '- RUN -'. The output of your code should appear in a separate browser window.
  208             <LI>Additional adjustments can be made through the 'Options' dialog. Notably, running CGI (Perl) on UNIX
  209             may require changed settings for file permissions and line endings.
  210             <LI>Different browsers handle HTML entities in textareas (&amp;gt; etc in the edited code) in different ways.
  211             Adjustments for this can be made in the 'Options' dialog.
  212             <LI>'Fancy view' shows your code in a colorful way through the built-in PHP source viewer. Optionally it can
  213             also show line numbers. If you are using password protection for Ide.php (you are, aren't you?), you will
  214             most likely have to enter your username/password in the Options dialog to make 'Fancy view' work correctly.
  215             <LI>Use 'Save as tpl' to save your current code as a template. Press 'Open tpl' to open
  216             the template. The template could be the basic &lt;HTML&gt;...&lt;/HTML&gt; stuff to avoid typing it every time.
  217             <LI>'Clear' will erase all code in the code-window.
  218             <LI>To the right is the File dialog for the 'data' directory. Use this to open or erase files from your
  219             private code archive. Use the 'Save as' button in the second row to save the current code in your archive.
  220             <LI>The size of the code-window is adjustable through the fields at the bottom of the page.
  221             Press 'Save settings' to make the new size your default.
  222             </UL>";
  223    return($ret);
  224 }
  225 
  226 function security() {
  227    $ret .= "<P>Ide.php is a powerful tool, which gives the user ability to execute
  228             arbitrary server-side code on the webserver where it resides. For this reason,
  229             it's also a very <U>dangerous</U> tool if it's not set up in a secure way.</P>
  230             <P>The secure way to set up Ide.php is to arrange that
  231             <U>no one else</U> has access to it. This can be done in two ways:</P>
  232             <UL>
  233             <LI>Use a personal webserver. This is the preferred alternative.
  234             Get {$this->Super->Apache_link} & {$this->Super->PHP_link} and install them on your computer. If that's not possible,
  235             consider using {$this->Super->VMware_link} to set up a second operating system in your computer,
  236             wherein you can run {$this->Super->Apache_link} & {$this->Super->PHP_link}.
  237             <LI>Use password protection. If you have to put Ide.php on a public webserver,
  238             you should put it in a password protected area. Since password protection often uses
  239             HTTP Authentication, this could cause a problem if you're
  240             using Ide.php to write and test code that sends its own HTTP Authentication headers.
  241             </UL>
  242             <P>Depending on the amount of <A HREF='{$GLOBALS['PHP_SELF']}?label=contact' TARGET='_self'>feedback</A> received,
  243             I'm considering integrating
  244             a cookie-based authentication scheme into Ide.php, which would allow for easy and secure setup,
  245             while eliminating potential conflicts using HTTP Authentication headers.</P>";
  246    return($ret);
  247 }
  248 
  249 function download() {
  250    $unix_downloads = $this->num_downloads("tar.gz");
  251    $win_downloads  = $this->num_downloads("zip");
  252    $ret .= "<P>Ide.php is distributed as a compressed archive, choose the type you prefer:</P>
  253             <UL>
  254             <LI><A HREF='./getfile.php?filename={$this->Super->tar_gz_filename}'>{$this->Super->tar_gz_filename}</A> - Unix style$unix_downloads
  255             <LI><A HREF='./getfile.php?filename={$this->Super->zip_filename}'>{$this->Super->zip_filename}</A> - Windows style$win_downloads
  256             </UL>";
  257    return($ret);
  258 }
  259 
  260 function license() {
  261    $ret .= "<P>Ide.php is distributed under the {$this->Super->GPL_link}</P>";
  262    return($ret);
  263 }
  264 
  265 function requirements() {
  266    $ret .= "<P>Ide.php requires {$this->Super->PHP_link} version 4 or higher.</P>
  267             <P>Ide.php needs a JavaScript enabled web browser to run correctly.
  268             It's been tested and is known to work with IE4/5 and Netscape 4.5</P>
  269             <P>Ide.php has been confirmed to run well with the following web servers:
  270             <UL>
  271             <LI>{$this->Super->Apache_link}
  272             <LI>{$this->Super->IIS_link}
  273             <LI>{$this->Super->Xitami_link}
  274             </UL>
  275             <P>If you get it running on some other server - please 
  276              <A HREF='{$GLOBALS['PHP_SELF']}?label=contact' TARGET='_self'>drop me a line</A>
  277             to tell what server you're using and how Ide.php works with it.";
  278    return($ret);
  279 }
  280 
  281 function contact() {
  282    $ret .= "<P>Ide.php is developed by <A HREF='mailto:johan@ekenberg.se'>Johan Ekenberg</A>,
  283             a Swedish Internet consultant who, besides web development with {$this->Super->PHP_link},
  284             does a lot of Perl, C, Linux and bass playing.</P>
  285             <P>Please use the address <A HREF='mailto:ide.php@ekenberg.se'>ide.php@ekenberg.se</A>
  286             for email related to Ide.php</P>";
  287    return($ret);
  288 }
  289 
  290 function num_downloads($filetype) {
  291    if ($GLOBALS['Getcount_is_loaded']) {
  292       $GC = new Getcount;
  293       $num_downloads = $GC->get_count($filetype);
  294       if ($num_downloads) {
  295          return (" ($num_downloads downloads)");
  296       }
  297    }
  298    return;
  299 }
  300 
  301 }
  302 
  303 
  304 #
  305 # class Page
  306 #
  307 class Page {
  308    var $Bgcolor     = "#FFE56A";
  309    var $Box_bgcolor = "#FFFFDD";
  310    var $Link_color  = "#0A0AA0";
  311    var $Alink_color = "#0000CC";
  312    var $Vlink_color = "#464686";
  313 
  314 function start_box_table($width) {
  315    $ret .= $this->begin_invisible_table($width, array("CELLPADDING='1'", "CELLSPACING='0'", "ALIGN='center'", "BGCOLOR='#000000'"));
  316    $ret .= "<TR><TD>\n";
  317    $ret .= $this->begin_invisible_table($width, array("CELLPADDING='12'", "CELLSPACING='0'", "WIDTH='100%'", "BGCOLOR='{$this->Bgcolor}'"));
  318    return ($ret);
  319 }
  320 
  321 function end_box_table() {
  322    $ret .= "</TABLE></TD></TR></TABLE>\n";
  323    return($ret);
  324 }
  325 
  326 function begin_invisible_table($width, $attr="") {
  327    $ret  = "<TABLE WIDTH='$width' BORDER='0' ";
  328    $ret .= (is_array($attr) ? join(" ", $attr) : NULL) . ">\n";
  329    return ($ret);
  330 }
  331 
  332 function end_invisible_table() {
  333    $ret = "</TABLE>\n";
  334    return ($ret);
  335 }
  336 
  337 function html_top() {
  338    $ret .= "<HTML><HEAD>\n";
  339    $ret .= "<BASE TARGET='_blank'>\n";
  340    $ret .= "<TITLE>About IDE.PHP</TITLE>\n";
  341    $ret .= "{$this->CSS_code}\n";
  342    $ret .= "</HEAD>\n";
  343    $ret .= "<BODY BGCOLOR='{$this->Bgcolor}' LINK='{$this->Link_color}' ALINK='{$this->Alink_color}' VLINK='{$this->Vlink_color}'>\n";
  344    return ($ret);
  345 }
  346 
  347 function html_bottom() {
  348    return "</BODY></HTML>\n";
  349 }
  350 
  351 function Page() {
  352    $this->CSS_code = 
  353    "<STYLE TYPE='text/css'>
  354    <!--
  355    A {
  356       text-decoration: none;
  357    }
  358    A:HOVER {
  359       color: {$this->Alink_color};
  360    }
  361    INPUT {
  362       font-family: Arial, 'MS Sans Serif', Helvetica;
  363       font-size: 10pt;
  364    }
  365    BODY {
  366       font-family: Arial, 'MS Sans Serif', Helvetica;
  367    }
  368    TD {
  369       font-family: Verdana,Geneva,Arial,Helvetica;
  370       font-size: 10pt;
  371    }
  372    H2 {
  373       font-family: Verdana,Geneva,Arial,Helvetica;
  374       font-size: 20pt;
  375       font-weight: 500;
  376    }
  377    H4 {
  378       font-family: Verdana,Geneva,Arial,Helvetica;
  379       font-size: 13pt;
  380       font-style: Italic;
  381       font-weight: 500;
  382       margin-left: 40pt;
  383    }
  384    H5 {
  385       font-family: Verdana,Geneva,Arial,Helvetica;
  386       font-size: 10pt;
  387    }
  388    P {
  389       text-indent: 10pt;
  390       margin-left: 10pt;
  391       margin-right: 15pt;
  392    }
  393    SMALL {
  394       font-family: Verdana,Geneva,Arial,Helvetica;
  395       font-size: 8pt;
  396    }
  397    BLOCKQUOTE {
  398       font-family: Verdana,Geneva,Arial,Helvetica;
  399       font-size: 10pt;
  400       text-indent: 10pt;
  401       margin-left: 20pt;
  402       margin-right: 25pt;
  403       background-color: {$this->Box_bgcolor};
  404       padding-left: 15pt;
  405       padding-right: 15pt;
  406       padding-top: 5pt;
  407       padding-bottom: 5pt;
  408    }
  409    OL {
  410       margin-left: 20pt;
  411       margin-right: 25pt;
  412    }
  413    UL {
  414       margin-left: 13pt;
  415       margin-right: 25pt;
  416       list-style-type: square;
  417    }
  418    LI {
  419       margin-top: 4pt;
  420    }
  421    -->
  422    </STYLE>\n";
  423 
  424 }
  425 
  426 }?>
  427