Update of /cvsroot/phpcoder/phpcoder
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13185
Modified Files:
CHANGELOG coder-class.php index.php LICENSE
Added Files:
PHPCoder Manual.htm
Removed Files:
HELP.html
Log Message:
V1.5 for MMCache.
Index: LICENSE
===================================================================
RCS file: /cvsroot/phpcoder/phpcoder/LICENSE,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- LICENSE 25 Jan 2004 01:38:08 -0000 1.1.1.1
+++ LICENSE 2 Mar 2006 11:16:00 -0000 1.2
@@ -1,15 +1,26 @@
-PHP Coder is distributed under the BSD License below, for more information about the BSD License see http://www.opensource.org/licenses/bsd-license.php.
-
-Copyright (c) 2003, Jason Sheets <js...@sh...>, Idaho Image Works LLC
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
- * Neither the name of the Idaho Image Works LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-
+PHP Coder is distributed under the BSD License below, for more information about the BSD License see http://www.opensource.org/licenses/bsd-license.php.
+
+Copyright (c) 2003 - 2006, Jason Sheets <js...@sh...>, Idaho Image Works LLC
+All rights reserved.
+
+
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+
+
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+
+
+ * Neither the name of the Idaho Image Works LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+
+
+
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/phpcoder/phpcoder/CHANGELOG,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CHANGELOG 22 Aug 2004 03:00:49 -0000 1.4
+++ CHANGELOG 2 Mar 2006 11:16:00 -0000 1.5
@@ -1,3 +1,15 @@
+1.5
+
+ * Gary Harris na...@tp... 28/2/06.
+ * V1.4 had been added to the SF files page but not the web page.
+ Many changes had been lost and the eAccelerator version was based
+ on the older version. Brought both versions back up to 1.4 spec.
+ * eAccelerator version encoded but produced incorrect output. Fixed.
+ * eAccelerator version also contained a number of bugs.
+ * The manual now covers both encoders and is called PHPCoder Manual.htm.
+ * Numerous additional fixes including URLs.
+ * NOTE: Multi-encoder version not currently updated.
+
1.4
* Gary Harris <ra...@pa...> 21/8/04.
@@ -14,24 +26,30 @@
* Removed space that seemed unnecessary and made the form longer than it needed to be.
* Changed "Copied non-source files" message to file-specific message.
* Widened file path text areas.
-
1.03
+
+1.03
* Encoding results are now displayed at the top of the screen
* Added skip extensions, files with certain extensions will not be encoded
* Removed remaining realpath() calls from index.php for portability
- * index.php: $possibe_extensions is now always unset even in the event that explode does not return an array.
+ * index.php: $possibe_extensions is now always unset even in the event that explode does not return an array.
+
+
+1.02 First public release after 1.00
-1.02 First public release after 1.00
* You can now provide absolute expiration date by typing in the date (using php's strtotime format) or using the elapsed time drop down.
* Scripts can now be locked to multiple visitor ips, server ips, and server names by entering a comma seperated list of ip addresses
* Applied patch from Dmitry Stogov, removed realpath and better checks for output buffering support, fixes to _MkDir
- * PHPCoder table is now centered
+ * PHPCoder table is now centered
+
1.01
* Loader code now loads TurckLoader.so instead of mmcache.so
* Now use CSS for most of the HTML formatting
* Introduced some color into the HTML formatting :)
* Improved error handling of PHPCoder, PHP error messages not displayed when encoding fails
* PHPCoder now verifies subdirectories and the source directory are writable instead of just the source directory
- * Changed instructions to use chmod 777, 666 causes PHPCoder to fail to encode files on some platforms
+ * Changed instructions to use chmod 777, 666 causes PHPCoder to fail to encode files on some platforms
+
1.00 Initial Release
-
+
+
--- NEW FILE: PHPCoder Manual.htm ---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>
PHPCoder Manual
</title>
</head>
<body>
<span style="font-weight: bold;">
What is PHPCoder?
</span>
<br>
<p>
PHPCoder is a web based front-end to the
<a href="http://www.turcksoft.com/en/e_mmc.htm">Turck MMCache</a> or
<a href="http://eaccelerator.net/">eAccelerator</a>
encoding functions, both of which are similar to the Zend Encoder product.
</p>
<p>
<b>Turck MMCache</b> is a free open source PHP accelerator, optimizer, encoder and dynamic content cache for PHP.
It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling
is almost completely eliminated. Also it uses some optimizations to speed up execution of PHP scripts.
<b>Turck MMCache</b> typically reduces server load and increases the speed of your PHP code by 1-10 times.
</p>
<p><b>eAccelerator</b> is a further development of MMCache.</p>
<p>
PHPCoder enables you to encode your PHP scripts and applications into non reversible byte-code, thus preventing
users of your programs from viewing or altering the source code while having full functionality. Another
excellent use for PHPCoder is to encode your applications PHP configuration files, that way someone viewing your
source code does not see your database login and password information.
</p>
<p>
In addition to encoding PHP scripts PHPCoder allows you to set restrictions on the encoded scripts, you can lock
a script to a particular server IP address, server host name, visitor IP, or even place a time limit on the script
so it will expire after x amount of time. PHP Coder also allows you to specify Text, HTML or PHP code that
should be prepended and appended to each file before it is encoded, allowing you to easily and securely implement
your own licensing scheme.
</p>
<p>To use your encoded scripts your clients simply install the free
<a href="http://www.turcksoft.com/en/e_mmc.htm">Turck MMCache</a>
(available on Windows and Unix/Linux) or the
<a href="http://www.turcksoft.com/en/e_mmc.htm">Turck Loader</a>.
</p>
<p>
Alternatively, you might prefer <a href="http://eaccelerator.net/">eAccelerator</a>
or the <a href="http://eaccelerator.net/">eAccelerator Loader</a>.
</p>
<br>
<span style="font-weight: bold;">
Downloading PHPCoder
</span>
<p>
Latest Release: 1.5 -
<a href="http://sourceforge.net/project/showfiles.php?group_id=85927">Download</a>
<a href="http://phpcoder.sourceforge.net/downloads/CHANGELOG">View ChangeLog</a>
</p>
<p>
Older versions are available for download, as well.
</p>
<p>
Note that the multi-encoder has not so far been updated to V1.5 as I can't really see a need. If there is a
demand, I may well look at it. Please use the SourceForge
<a href="http://sourceforge.net/projects/phpcoder/">Support Requests</a> page for requests.
</p>
<br>
<span style="font-weight: bold;">
Installing PHPCoder
<br>
<br>
</span>
<div style="margin-left: 40px;">
<span style="font-weight: bold;">
Requirements:
<br>
<br>
</span>
<div style="margin-left: 40px;">
<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a> or
<a href="http://eaccelerator.net/">eAccelerator</a>
must be installed (available on Windows and Unix/Linux)
<br>PHP >= 4.1 (4.3.x highly recommended, 4.1 required)
<br>Apache 1.3/2 or other PHP compatable web-server
<br>
<br>
<p>The latest eAccelerator supports PHP 5 and Apache 2.</p>
</div>
</div>
<div style="margin-left: 40px;">
<span style="font-weight: bold;">
Installation Steps:
</span>
<br>
<br>
<div style="margin-left: 40px;"> These installation steps should be executed on the command line, you can accomplish them through FTP
clients but this document does not cover the steps to do that.
<br>Commands you should type are in
<span style="font-style: italic;">
italics
</span>.
<br>
<ol>
<li>
Download the latest version of PHPCoder from
<a href="http://phpcoder.sourceforge.net/">http://phpcoder.sourceforge.net/</a>
</li>
<li>
Extract the phpcoder-x.tgz file by issuing the command:
<span style="font-style: italic;">tar zxf phpcoder-x.tgz</span>
(replace phpcoder-x.tgz with the file you downloaded)
</li>
<li>
Enter the phpcoder directory by issuing the:
<span style="font-style: italic;">cd phpcoder</span> command
</li>
<li>
Create the files directory and make it writable:
<span style="font-style: italic;">mkdir files; chmod 777 files</span>
</li>
<li>
Create the encoded directory and make it writable:
<span style="font-style: italic;">mkdir encoded; chmod 777 encoded</span>
</li>
</ol>
<p>
PHP Coder should now be installed. To encode programs/scripts simply place them in the files directory and
then go to http://yoururl/phpcoder and run the encoder, your encoded scripts will be in the encoded directory.
For more information see Using PHPCoder.
</p>
</div>
</div>
<br>
<p>
<span style="font-weight: bold;">Using PHPCoder</span>
</p>
<div style="margin-left: 40px;">
Once you have installed PHPCoder following the installation steps above it is easy to begin encoding scripts.
<br>
<br>First place the script that you want to be encoded in the <span style="font-weight: bold;">files</span>
directory (you can do this via FTP but all directories must be chmod 777).
<br>Next telnet into your hosting providor and execute the command
<span style="font-style: italic;">
chmod -R 777 /path/to/phpcoder/files
</span>
<br>Then visit http://yourdomain/phpcoder, set your options and press the submit button.
<br>
<br>Note that you must chmod -R 777 your files directory because PHPCoder will cd into each directory and write
a temporary file while the directory is being encoded, this is so relative paths in your application are not
broken by the encoding process.
<br>
<br>
<span style="font-weight: bold;">
Options:
<br>
<br>
</span>
<div style="margin-left: 40px;">
The PHPCoder web page has several options you can set before you encode your files, here is a brief run
down on some of them:
<br>
<br>
<span style="font-weight: bold;">
Recursive Encoding:
</span>
When this is set to Yes PHPCoder will encode files in all the subdirectories of the files directory, this is
enabled by default and should be set to Yes unless you have a good reason to set it to No.
<br>
<span style="font-weight: bold;">
Copy Skipped Files:
</span>
When this is set to Yes PHPCoder will copy non PHP source files to the encoded directory, this avoids
breaking apps and makes it so it is not necessary to merge encoded/unencoded files manually.
<br>
<br>
<span style="font-weight: bold;">
Pre Content Code:
</span>
This is Text, HTML, or PHP code (must be enclosed in <?php ?> ) content that will be prepended to each
PHP source file before it is encoded, this is an excellent place to put licensing code, etc.
<br>
<span style="font-weight: bold;">
Post Content Code:
</span>
This is Text, HTML, or PHP code (must be enclosed in <?php ?>) content that will be appended to each PHP
source file before it is encoded, this is a good place for copyright notices, etc.
<br>
<br>
</div>
</div>
<div style="margin-left: 40px;">
<span style="font-weight: bold;">
Restrictions:
<br>
<br>
</span>
<div style="margin-left: 40px;">
PHPCoder allows you to set several options that restrict the execution of the encoded PHP scripts. These
options range from locking to an IP or to a particular amount of time or all of the above.
<br>
<br>
<span style="font-weight: bold;">
Restrict Visitor's IP:
</span>
This can be a single IP or a comma-separated list of IP addresses. If it is set only these IP addresses can
view the script, this is a nice feature for a demo that is not feature restricted but is limited to one visitor
IP. In a pinch it could be used for a security measure though this is not recommended.
<br>
<br>
<span style="font-weight: bold;">
Restrict Server IP:
</span>
This can be a single IP or a comma-separated list of IP addresses. If it is set scripts can only be served from
these IPs. This enables you to lock the script to a particular server(s) by restricting the IP. This is similar
to lock server name but this will prevent the user from moving the script where Restrict Server Name will allow
them to move the script should their server or hosting change, for this reason Restrict Server Name is encouraged.
<br>
<br>
<span style="font-weight: bold;">
Restrict Server Name:
</span> This can be a single server name or a comma seperated list of server names; If this is set the script can only be served from one of these server names, example shadonet.com,yahoo.com. This enables you to lock a script to a particular domain name(s) but allow the user to move the script to a new web host or
server as long as it is being served from the same domain.
<br>
<br>
<span style="font-weight: bold;">
Expiring Scripts:
</span>
When a selection is made here the script will expire after the specified amount of time has passed, for example
5 seconds, 1 week, 2 months, etc. This can be used in conjunction with any of the other restrictions.
Alternatively, you can type in the time when the script should expire, for example 01/01/2004 will make the
script expire January 1st, 2004. This field uses the
<a href='http://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html#Date-input-formats'>
GNU date and time format.</a>
</div>
<div style="margin-left: 40px;">
<br>
<br>
<br>
</div>
</div>
<span style="font-weight: bold;">
PHPCoder License
<br>
<br>
</span>
PHPCoder is distributed under the BSD License, a copy of the BSD License is included with the PHPCoder download
and also at the top of all source files. In cases where this document is not updated the license in LICENSE and
then source files shall apply.
<br>
<br>PHP Coder is distributed under the BSD License below, for more information about the BSD License see
<a href="http://www.opensource.org/licenses/bsd-license.php">http://www.opensource.org/licenses/bsd-license.php</a>.
<br>
<br>Copyright (c) 2003 - 2006, Jason Sheets <qui...@us...>, Idaho Image Works LLC. All rights reserved.
<br>
<br>Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
<ul>
<li>
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
</li>
<li>
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
</li>
<li>
Neither the name of the Idaho Image Works LLC nor the names of its contributors may be
used to endorse or promote products derived from this software without specific prior written permission.
</li>
</ul>
<br>
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<br>
<br>
<span style="font-weight: bold;">
Contacting the Author (Bug Reports, Feature Requests, etc.)
</span>
<br>
<br>I can be contacted via e-mail via qui...@us..., please put PHPCoder in the subject for
efficient mail identification. Feel free to send bug reports, feature requests, patches, etc to me. This software
was developed on Windows and FreeBSD and tested on Windows, Linux and FreeBSD. I will make reasonable efforts to
support and develop PHPCoder but it is developed in my free time for free (it already accomplishes what I want it
to do).
<br>
<br>
<p>
Development of PHPCoder is made possible by
<a href="http://www.idahoimageworks.com/">Idaho Image Works</a>. Idaho Image Works provides cost effective web
and graphic design, marketing and web programming/hosting services on Unix based platforms.
</p>
<br>
<br>
</body>
</html>
Index: index.php
===================================================================
RCS file: /cvsroot/phpcoder/phpcoder/index.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- index.php 22 Aug 2004 03:00:49 -0000 1.4
+++ index.php 2 Mar 2006 11:16:00 -0000 1.5
@@ -16,12 +16,19 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ==============================
+ Version 1.5
+ Gary Harris 28/2/06
+
+ Brought up to V1.4 spec plus numerous minor fixes and enhancements.
+
*/
// get coder class
- require_once('./coder-class.php');
- $coder = new coder;
+ require_once('./coder-class.php');
+ $coder = new coder;
+
// set directory recursion, default to true
$coder->recursive = (isset($_REQUEST['recursive'])) ? $_REQUEST['recursive'] : true;
@@ -29,13 +36,15 @@
$coder->copy_skipped_files = (isset($_REQUEST['copy_skipped_files'])) ? $_REQUEST['copy_skipped_files'] : true;
// set source and destination directories
+ // GJH 27/2/06 Removed realpath() as this breaks directory creation.
$coder->src_dir = (!empty($_REQUEST['source_dir'])) ? $coder->StripSlashes($_REQUEST['source_dir']) : getcwd() . '/files';
$coder->dest_dir = (!empty($_REQUEST['destination_dir'])) ? $coder->StripSlashes($_REQUEST['destination_dir']) : getcwd() . '/encoded';
+ // GJH 27/2/06 Fixed a spelling bug.
// set file extensions
- if (!empty($_REQUEST['extentions'])) {
+ if (!empty($_REQUEST['extensions'])) {
// construct array from $_REQUEST['extensions'], deal with extension, space by removing spaces.
- $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['extentions']));
+ $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['extensions']));
if (is_array($possible_extensions)) {
$coder->extensions = $possible_extensions;
@@ -45,8 +54,8 @@
}
// set file extensions to skip
- if (!empty($_REQUEST['ignore_extentions'])) {
- $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['ignore_extentions']));
+ if (!empty($_REQUEST['ignore_extensions'])) {
+ $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['ignore_extensions']));
if (is_array($possible_extensions)) {
$coder->ignore_extensions = $possible_extensions;
@@ -57,28 +66,20 @@
// set php pre and post content variables
+ // GJH 27/2/06 $coder->loader_code was incorrectly being loaded with data here.
$coder->php_pre_content = (!empty($_REQUEST['php_pre_content'])) ? $coder->StripSlashes($_REQUEST['php_pre_content']) : '';
$coder->php_post_content = (!empty($_REQUEST['php_post_content'])) ? $coder->StripSlashes($_REQUEST['php_post_content']) : '';
-
- // set restrictions up
- $coder->restrictions =
- (!empty($_REQUEST['restrictions']) && is_array($_REQUEST['restrictions'])) ?
- $_REQUEST['restrictions'] : array(
- 'visitor_ip' => NULL,
- 'server_ip' => NULL,
- 'server_name' => NULL,
- 'expire_value' => NULL,
- 'expire_unit' => NULL,
- 'expire_english' => NULL
- );
-
- // enable output buffering if we need to
- if (function_exists("ob_get_level")) {
- if (0 == ob_get_level()) {
- ob_start();
- }
- }
+ // set restrictions up
+ // GJH-Use empty() as is_array() fails when index doesn't exist. If creating a new array,
+ // list indices to avoid errors.
+ $coder->restrictions = (!empty($_REQUEST['restrictions'])) ? $_REQUEST['restrictions'] :
+ array("visitor_ip" => "",
+ "server_ip" => "",
+ "server_name" => "",
+ "expire_value" => "",
+ "expire_unit" => "",
+ "expire_english" => "");
// if form hasn't been submitted display it
$coder->HtmlHeader();
@@ -95,10 +96,13 @@
print '</blockquote></p>';
}
}
-
$coder->DisplayForm();
+
print '<center><p><a href="http://turck-mmcache.sourceforge.net/">
<img border="0" src="http://turck-mmcache.sourceforge.net/mmcache02.gif" alt="mmcache button graphic">
</a></p></center>';
$coder->HtmlFooter();
?>
+
+
+
--- HELP.html DELETED ---
Index: coder-class.php
===================================================================
RCS file: /cvsroot/phpcoder/phpcoder/coder-class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- coder-class.php 22 Aug 2004 03:00:49 -0000 1.4
+++ coder-class.php 2 Mar 2006 11:16:00 -0000 1.5
@@ -19,7 +19,7 @@
*/
class coder {
- var $version = '1.4'; // coder version class
+ var $version = '1.5'; // coder version class
/* These directives can be changed but it is recommended you keep the defaults and change them from the calling PHP Script */
@@ -40,6 +40,7 @@
/* Setup Restrictions */
var $restrictions = array(); // array to hold list of restrictions selected
+
var $restrictions_code = ''; // php code to implement restrictions
/* Source and destination directory settings */
@@ -53,7 +54,7 @@
/* No Changes Below Here */
/* this code is included in the top of every encoded file in plain text, this is used to detect mmcache and give instructions for installing if it is empty. */
- var $loader_code = '/*This encoded file was generated using PHPCoder (http://sourceforge.net/projects/phpcoder) and Turck MMcache (http://turck-mmcache.sourceforge.net/)*/ if (!is_callable("mmcache_load") && !@dl("TurckLoader.so")) { die("This PHP script has been encoded using the excellent Turck MMcache Optimizer, to run it you must install <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache or the Turck Loader</a>"); }';
+ var $loader_code = '/*This encoded file was generated using PHPCoder (http://phpcoder.sourceforge.net/) and Turck MMcache (http://turck-mmcache.sourceforge.net/)*/ if (!is_callable("mmcache_load") && !@dl("TurckLoader.so")) { die("This PHP script has been encoded using the excellent Turck MMcache Optimizer, to run it you must install <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache or the Turck Loader</a>"); }';
/*
@@ -107,21 +108,20 @@
</tr>
<tr><td colspan="2"> </td></tr>
-
<tr>
<td><b>Encode Files:</b></td>
- <td><input type="text" name="extentions" size="12" value="<?php print implode(',', $this->extensions); ?>"
+ <!-- GJH 27/2/06 Fixed spelling errors. -->
+ <td><input type="text" name="extensions" size="12" value="<?php print implode(',', $this->extensions); ?>"
title="A comma-separated list of filename extensions, without the '.', to be encoded.">
</tr>
<tr>
<td><b>Skip Files:</b></td>
- <td><input type="text" name="ignore_extentions" size="12" value="<?php print implode(',', $this->ignore_extensions); ?>"
+ <!-- GJH 27/2/06 Fixed spelling errors. -->
+ <td><input type="text" name="ignore_extensions" size="12" value="<?php print implode(',', $this->ignore_extensions); ?>"
title="A comma-separated list of filename extensions, without the '.', that won't be encoded.">
</tr>
-
-
<tr><td colspan="2"> </td></tr>
<tr>
@@ -141,7 +141,6 @@
<input type="radio" name="copy_skipped_files" value="1" <? if ($this->copy_skipped_files == true) { print 'checked'; } ?>
title="Copy files which aren't encoded into the destination directory."> Yes </td>
</tr>
-
<tr><td colspan="2"> </td></tr>
<tr>
@@ -172,7 +171,6 @@
<tr>
<td></td>
-
<td>
<table>
<tr><td valign="top"><b>Restrict Visitors’ IPs to:</b></td></tr>
@@ -210,19 +208,17 @@
<select name="restrictions[expire_unit]" title="The units of time to use.">
<option value="">Select</option><option value="seconds" <?php if (strtolower($this->restrictions['expire_unit']) == 'seconds') { echo 'selected'; } ?>>Seconds</option><option value="minutes" <?php if (strtolower($this->restrictions['expire_unit']) == 'minutes') { echo 'selected'; } ?>>Minutes</option><option value="hours" <?php if (strtolower($this->restrictions['expire_unit']) == 'hours') { echo 'selected'; } ?>>Hours</option><option value="days" <?php if (strtolower($this->restrictions['expire_unit']) == 'days') { echo 'selected'; } ?>>Days</option><option value="weeks" <?php if (strtolower($this->restrictions['expire_unit']) == 'weeks') { echo 'selected'; } ?>>Weeks</option><option value="months" <?php if (strtolower($this->restrictions['expire_unit']) == 'months') { echo 'selected'; } ?>>Months</option><option value="years" <?php if (strtolower($this->restrictions['expire_unit']) == 'years') { echo 'selected'; } ?>>Years</option></select></p>
<p><b>OR</b>
- <p>Script expires at: <input type="text" size="20" name="restrictions[expire_english]" value="<?php print htmlspecialchars($this->StripSlashes($this->restrictions['expire_english'])); ?>"
+ <p>Script expires at <input type="text" size="20" name="restrictions[expire_english]" value="<?php print htmlspecialchars($this->StripSlashes($this->restrictions['expire_english'])); ?>"
title="The expiration time in GNU date and time format."></p>
- <a href='http://www.gnu.org/software/tar/manual/html_chapter/tar_7.html'>
+ <!-- GJH 28/2/06 Updated URL. -->
+ <a href='http://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html#Date-input-formats'>
<span class="smallfont">(GNU date and time format.)</span>
</a>
</blockquote>
</td>
- </tr>
-
- </table>
-
-
- </td>
+ </tr>
+ </table>
+ </td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit_button" value="Encode Files"></td></tr>
@@ -296,7 +292,7 @@
if (function_exists("ob_get_level")) {
// GJH-Check that buffer exists before flushing to avoid failure errors.
if(ob_get_contents())
- ob_flush();
+ ob_flush();
}
}
@@ -363,8 +359,7 @@
// write out encoded file or return false
if ($this->_WriteFile($destination_path, $content)) {
- chmod($destination_path, is_null($this->file_mode) ?
- fileperms($file) : $this->file_mode);
+ chmod($destination_path, $this->file_mode);
return true;
} else {
return false;
@@ -381,15 +376,15 @@
{
?>
</td></tr>
- </table>
+ </table>
</center>
<p>
- <a href="http://validator.w3.org/check?uri=referer">
+ <a href="http://validator.w3.org/">
<img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"></a>
<a href="http://jigsaw.w3.org/css-validator/">
<img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" border=0></a>
</p>
- </body>
+ </body>
</html>
<?php
}
@@ -400,6 +395,7 @@
@Desc: Displays HTML Header
*/
+ // GJH 27/2/06 Removed all CSS errors and warnings.
function HtmlHeader($title = '')
{
?>
@@ -408,7 +404,10 @@
<head><title>PHPCoder <?php print $this->version ?> (MMCache PHP Encoder Front End)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<STYLE type="text/css">
- TD { background-color: #cccccc }
+ TD {
+ background-color: #cccccc;
+ color: black;
+ }
BODY {
font-family: sans-serif;
@@ -440,6 +439,7 @@
.header {
font-family: sans-serif;
color: rgb(199,21,133);
+ background-color: #cccccc;
font-weight: bold;
font-size: larger;
}
@@ -459,12 +459,14 @@
font-family: sans-serif;
font-size: smaller;
color: green;
+ background-color: #cccccc;
}
.failfont {
font-family: sans-serif;
font-size: smaller;
color: red;
+ background-color: #cccccc;
}
</STYLE>
@@ -473,7 +475,7 @@
<center><table><tr><td class="withborder-medium">
<p><span class="header">PHPCoder v. <?php print $this->version; ?>
- (<a href="http://sourceforge.net/projects/phpcoder">http://sourceforge.net/projects/phpcoder</a>)
+ (<a href="http://phpcoder.sourceforge.net/">http://phpcoder.sourceforge.net/</a>)
</span></p>
<p>
<span class="smallfont">Hover over the controls and text areas or see the <a href="./help.html">help</a> for more information.</span>
@@ -552,41 +554,41 @@
if (!empty($return_code)) {
$return_code = '<?php ' . $return_code . ' ?>';
-
+
return $return_code;
} else {
return '';
}
}
-
+
/*
@Name: _CopySkippedFiles
@Proto: bool _CopySkippedFiles(path $src, path $dest)
- @Desc: Copies any files/subdirecties in $src that are missing in $dest
+ @Desc: Copies any files/subdirectories in $src that are missing in $dest
@Scope: Private
*/
-
+
function _CopySkippedFiles($src, $dest)
{
if (!is_dir($src) || !is_dir($dest)) {
return false;
}
-
+
// make sure we can open the directory
if (!$dh = opendir($src)) {
return false;
}
-
+
// get a list of each file in the directory, skip files we shouldn't see
while (FALSE !== ($file = readdir($dh))) {
// skip $ignore_files, because this is where . and .. live
if (is_array($this->ignore_files) && in_array($file, $this->ignore_files)) {
continue;
}
-
+
$file_path = $src . '/' . $file;
$dest_path = $dest . '/' . $file;
-
+
// if entry is a directory and it doesn't exist create the directory
if (@is_dir($file_path)) {
if (!is_dir($dest . '/' . $file)) {
@@ -613,19 +615,19 @@
}
}
}
-
+
@closedir($dh);
-
+
return true;
}
-
+
/*
@Name: _FileGetContents
@Proto: string/bool _FileGetContents(path $file)
@Desc: Returns contents of $file, uses file_get_contents if available, otherwise uses fopen and fread
@Scope: Private
- */
+ */
function _FileGetContents($file)
{
if (!is_file($file) || !is_readable($file)) {
@@ -651,14 +653,14 @@
}
}
}
-
+
/*
@Name: _ListFiles
@Proto: array/bool _ListFiles(path $file_dir, bool valid)
@Desc: Returns an array of files from $file_dir
@Scope: Private
*/
-
+
function _ListValidFiles($file_dir)
{
// GJH-Declare variable to avoid errors.
@@ -666,12 +668,12 @@
if (!is_dir($file_dir)) {
die($file_dir . ' is not a directory');
}
-
+
// make sure we can open the directory
if (!$dh = opendir($file_dir)) {
return false;
}
-
+
// get a list of each file in the directory, skip files we shouldn't see
while (FALSE !== ($file = readdir($dh))) {
// perform recursion if $file is a directory and is not in $ignore_files
@@ -705,7 +707,7 @@
return false;
}
}
-
+
/*
@Name: _MkDir
@Proto: bool _MkDir(path $directory, bool $recursive)
@@ -770,52 +772,52 @@
}
@unlink($tmp_name);
-
+
if (!empty($encoded_contents)) {
return $encoded_contents;
} else {
return false;
- }
+ }
}
-
+
/*
@Name: _MmCacheEncodeString
@Proto: string/bool _MmCacheEncodeString(string string)
@Desc: Returns the result of mmcache_encode on a string, simulates this function by writing to a temporary file
@Scope: Private
- */
+ */
function _MmCacheEncodeString($string)
{
if (empty($string)) {
return false;
}
-
+
// create temporary file name
$tmp_name = tempnam ("/tmp", "mmcache_encode_");
-
+
// attempt to open the file for writing
if (!$fp = fopen($tmp_name, 'wb')) {
return false;
}
-
+
// write our string to the file
if (!fwrite($fp, $string, strlen($string))) {
@fclose($fp);
// remove our temporary file
@unlink($tmp_name);
-
+
return false;
}
-
+
// close the file
@fclose($fp);
-
+
// use mmcache to encode the file
$encoded_contents = mmcache_encode($tmp_name);
// remove our temporary file
@unlink($tmp_name);
-
+
if (!empty($encoded_contents)) {
return $encoded_contents;
} else {
@@ -823,7 +825,7 @@
}
}
-
+
function _MkDir($directory, $recursive = false)
{
// make sure location is not already existing as a file
@@ -869,10 +871,17 @@
if (!fwrite($fp, $contents, strlen($contents))) {
return false;
}
-
+
@fclose($fp);
-
- return true;
+
+ return true;
}
}
?>
+
+
+
+
+
+
+
|