phpcoder-cvs Mailing List for phpcoder
Brought to you by:
garyjharris,
quickfoot
You can subscribe to this list here.
2004 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gary H. <gar...@us...> - 2006-03-02 11:19:49
|
Update of /cvsroot/phpcoder/phpcoder/eaccelerator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15133/eaccelerator Log Message: Directory /cvsroot/phpcoder/phpcoder/eaccelerator added to the repository |
From: Gary H. <gar...@us...> - 2006-03-02 11:16:12
|
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; } } ?> + + + + + + + |
From: Gary H. <gar...@us...> - 2004-08-22 03:01:01
|
Update of /cvsroot/phpcoder/phpcoder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12108 Modified Files: Tag: 1.4 CHANGELOG coder-class.php index.php README.txt Log Message: Version 1.4. Update for PHP 4.3.8 plus enhancements. Index: CHANGELOG =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/CHANGELOG,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -d -r1.1.1.1 -r1.4 --- CHANGELOG 25 Jan 2004 01:38:08 -0000 1.1.1.1 +++ CHANGELOG 22 Aug 2004 03:00:49 -0000 1.4 @@ -1,24 +1,37 @@ -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 +1.4 + + * Gary Harris <ra...@pa...> 21/8/04. + * Updated for PHP 4.3.8 and MMCache 2.4.7. + * Tested in Mozilla 1.6b, Firefox 0.8 and IE 6.0 on WinXP. + * Updated all links. + * Corrected errors that generated XDebug output including array and variable initialisation + and flushing a non-existent buffer. (Partly dealt with in latest CVS version). + * Added tooltips to all controls via the "title" entity. + * Added help and date and time format links. + * Corrected some spelling errors and improved text output formatting. + * Created plain text version of help in readme.txt. + * Output is now W3C and WDG HTML 4.01 and CSS compliant. + * 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 + + * 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. - - + 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 + * 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 - -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 +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 +1.00 Initial Release -1.00 Initial Release Index: coder-class.php =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/coder-class.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- coder-class.php 6 Feb 2004 16:06:16 -0000 1.3 +++ coder-class.php 22 Aug 2004 03:00:49 -0000 1.4 @@ -19,7 +19,7 @@ */ class coder { - var $version = '1.3'; // coder version class + var $version = '1.4'; // coder version class /* These directives can be changed but it is recommended you keep the defaults and change them from the calling PHP Script */ @@ -29,8 +29,7 @@ /* Directory Creation Settings */ var $directory_mode = 0777; // octal mode created directorie will have - var $file_mode = NULL; // octal mode for files; if NULL, the file mode of - // the source file will be used + var $file_mode = 0777; // octal mode for files var $recursive = true; // recursively process sub-directories /* These variables control which files are valid for encoding */ @@ -43,7 +42,7 @@ var $restrictions = array(); // array to hold list of restrictions selected var $restrictions_code = ''; // php code to implement restrictions - /* Source and desintation directory settings */ + /* Source and destination directory settings */ var $src_dir = './encoded'; // source code origination directory var $dest_dir = './files'; // encoded file destination @@ -54,7 +53,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 generated using PHPCoder (http://phpcoder.shadonet.com) and Turck MMcache (http://www.turcksoft.com/en/e_mmc.htm)*/ 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://www.turcksoft.com/en/e_mmc.htm\">Turck MMCache or the Turck Loader</a>"); }'; + 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>"); }'; /* @@ -67,14 +66,14 @@ { // make sure mmcache is available if (!is_callable('mmcache_encode') && !@dl('mmcache.so')) { - die('You must have Turck MMCache installed to use this encoder, it is freely available at: <a target="_blank" href="http://www.turcksoft.com/en/e_mmc.htm">http://www.turcksoft.com/en/e_mmc.htm</a>'); + die('You must have Turck MMCache installed to use this encoder, it is freely available at: <a target="_blank" href="http://turck-mmcache.sourceforge.net/">http://turck-mmcache.sourceforge.net/</a>'); } // set the max execution time if current max execution time is less than $this->max_execution_time if (!empty($this->max_execution_time)) { if (ini_get('max_execution_time') < $this->max_execution_time) { if (!ini_set('max_execution_time', $this->max_execution_time)) { - print '<p><font color="red">Failed to set max execution time</font></p>'; + print '<p><font color="red">Failed to set maximum execution time.</font></p>'; } } } @@ -90,29 +89,35 @@ function DisplayForm() { ?> - <table cellspacing="2" cellpadding="0" align="center"> <form method="post" action="<?php print $_SERVER['PHP_SELF']; ?>"> + <center> + <table cellspacing="2" cellpadding="0"> <tr> <td><b>Source Dir:</b></td> - <td><input type="text" name="source_dir" size="30" value="<?php print $this->src_dir; ?>"> <span class="smallfont">(Directory source code resides in)</span></td> + <td><input type="text" name="source_dir" size="60" value="<?php print $this->src_dir; ?>" + title="The path to the directory that the source code you want to encode resides in."> + </td> </tr> <tr> <td><b>Destination Dir:</b></td> - <td><input type="text" name="destination_dir" size="30" value="<?php print $this->dest_dir; ?>"> <span class="smallfont">(Directory encoded files will be placed in)</span></td> + <td><input type="text" name="destination_dir" size="60" value="<?php print $this->dest_dir; ?>" + title="The path to the directory that the encoded files will be written to."> </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); ?>"> <span class="smallfont">(Comma seperated list of extensions without . to be encoded)</span></td> + <td><input type="text" name="extentions" 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); ?>"> <span class="smallfont">(Comma seperated list of extensions that will not be encoded)</span></td> + <td><input type="text" name="ignore_extentions" 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> @@ -121,34 +126,42 @@ <tr> <td><b>Recursive Encoding:</b></td> - <td><input type="radio" name="recursive" value="0" <? if ($this->recursive == false) { print 'checked'; } ?>> No <input type="radio" name="recursive" value="1" <? if ($this->recursive == true) { print 'checked'; } ?>> Yes <span class="smallfont">(Descend into sub-directories, leave on)</span></td> + <td> + <input type="radio" name="recursive" value="0" <? if ($this->recursive == false) { print 'checked'; } ?> + title="Don't recurse into sub-directories when encoding."> No + <input type="radio" name="recursive" value="1" <? if ($this->recursive == true) { print 'checked'; } ?> + title="Recurse into sub-directories when encoding."> Yes </td> </tr> <tr> <td><b>Copy Skipped Files:</b></td> - <td><input type="radio" name="copy_skipped_files" value="0" <? if ($this->copy_skipped_files == false) { print 'checked'; } ?>> No <input type="radio" name="copy_skipped_files" value="1" <? if ($this->copy_skipped_files == true) { print 'checked'; } ?>> Yes <span class="smallfont">(Copy non source code files into encoded directory, leave on)</span></td> + <td> + <input type="radio" name="copy_skipped_files" value="0" <? if ($this->copy_skipped_files == false) { print 'checked'; } ?> + title="Don't copy files which aren't encoded into the destination directory."> No + <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> - <td colspan="2"><b>Pre Content Code:</b> <span class="smallfont">(Text, HTML or PHP Code)</span></td> + <td colspan="2"><b>Pre-Content Code:</b> <span class="smallfont">(Text, HTML or PHP Code)</span></td> </tr> <tr> <td></td> - <td><textarea name="php_pre_content" cols="30" rows="5"><?php print $this->php_pre_content; ?></textarea></td> + <td><textarea name="php_pre_content" cols="30" rows="5"title="Content entered here will be prepended to each PHP source file before it is encoded."><?php print $this->php_pre_content; ?></textarea></td> </tr> <tr><td colspan="2"> </td></tr> <tr> - <td colspan="2"><b>Post Content Code:</b> <span class="smallfont">(Text, HTML or PHP Code)</span></td> + <td colspan="2"><b>Post-Content Code:</b> <span class="smallfont">(Text, HTML or PHP Code)</span></td> </tr> <tr> <td> </td> - <td><textarea name="php_post_content" cols="30" rows="5"><?php print $this->php_post_content; ?></textarea></td> + <td><textarea name="php_post_content" cols="30" rows="5"title="Content entered here will be appended to each PHP source file before it is encoded."><?php print $this->php_post_content; ?></textarea></td> </tr> <tr><td colspan="2"> </td></tr> @@ -162,55 +175,46 @@ <td> <table> - <tr><td valign="top"><b>Restrict Visitors IPs to:</b></td></tr> - <tr><td colspan="2"><span class="smallfont">(Single IP or comma seperated list of IP addresses allowed to visit the scripts)</span></td></tr> - - <tr><td colspan="2"> </td></tr> - + <tr><td valign="top"><b>Restrict Visitors’ IPs to:</b></td></tr> + <tr><td colspan="2"> + <span class="smallfont">(Single IP or comma-separated list of IP addresses.)</span></td></tr> <tr> <td colspan="2" valign="top"> <blockquote> - <textarea cols="30" rows="4" name="restrictions[visitor_ip]"><?php print htmlspecialchars($this->StripSlashes($this->restrictions['visitor_ip'])); ?></textarea> + <textarea cols="30" rows="4" name="restrictions[visitor_ip]"title="The IP addresses that are allowed to access these scripts."><?php print htmlspecialchars($this->StripSlashes($this->restrictions['visitor_ip'])); ?></textarea> </blockquote> </td></tr> - - <tr><td colspan="2"> </td></tr> - <tr><td valign="top"><b>Restrict Server IPs to:</b></td></tr> - <tr><td colspan="2"><span class="smallfont">(Single IP or comma seperated list of IPs script may be served from)</span></td></tr> + <tr><td colspan="2"><span class="smallfont">(Single IP or comma-separated list of IP addresses.)</span></td></tr> - <tr><td colspan="2"> </td></tr> <tr> <td colspan="2" valign="top"><blockquote> - <textarea cols="30" rows="4" name="restrictions[server_ip]"><?php print htmlspecialchars($this->StripSlashes($this->restrictions['server_ip'])); ?></textarea> + <textarea cols="30" rows="4" name="restrictions[server_ip]"title="The IP addresses of servers that are allowed to host these scripts."><?php print htmlspecialchars($this->StripSlashes($this->restrictions['server_ip'])); ?></textarea> </blockquote> </td></tr> - - <tr><td colspan="2"> </td></tr> - <tr><td valign="top"><b>Restrict Server Name to:</b></td></tr> - <tr><td colspan="2"><span class="smallfont">(Single domain or comma seperated list of domains script may be served from)</span></td></tr> - - <tr><td colspan="2"> </td></tr> + <tr><td colspan="2"><span class="smallfont">(Single domain or comma-separated list of domains.)</span></td></tr> <tr><td><blockquote> - <textarea cols="30" rows="4" name="restrictions[server_name]"><?php print htmlspecialchars($this->StripSlashes($this->restrictions['server_name'])); ?></textarea> + <textarea cols="30" rows="4" name="restrictions[server_name]"title="The domain names of servers that are allowed to host these scripts."><?php print htmlspecialchars($this->StripSlashes($this->restrictions['server_name'])); ?></textarea> </blockquote></td></tr> - <tr><td colspan="2"> </td></tr> - <tr> <td colspan="2"><b>Script Expiration:</b></td> </tr> - <tr><td colspan="2"><span class="smallfont">(Script expires in this amount of time and will no longer run)</span></td></tr> - - <tr><td colspan="2"> </td></tr> - + <tr><td colspan="2"><span class="smallfont">(Script expires in this amount of time and will no longer run.)</span></td></tr> <tr> <td colspan="2"> <blockquote> - <p>Script expires in <input type="text" size="5" name="restrictions[expire_value]" value="<?php print htmlspecialchars($this->StripSlashes($this->restrictions['expire_value'])); ?>"> <select name="restrictions[expire_unit]"><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 vlaue="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> - <p>Script expires at: <input type="text" size="20" name="restrictions[expire_english]" value="<?php print htmlspecialchars($this->StripSlashes($this->restrictions['expire_english'])); ?>"></p> + <p>Script expires in <input type="text" size="5" name="restrictions[expire_value]" value="<?php print htmlspecialchars($this->StripSlashes($this->restrictions['expire_value'])); ?>" + title="The number of time units in which to expire the script."> + <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'])); ?>" + 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'> + <span class="smallfont">(GNU date and time format.)</span> + </a> </blockquote> </td> </tr> @@ -221,12 +225,11 @@ </td> </tr> - <tr><td colspan="2"> </td></tr> - <tr><td colspan="2" align="center"><input type="submit" name="submit_button" value="Encode Files"></td></tr> - </form> </table> + </center> + </form> <?php } @@ -239,10 +242,10 @@ function Encode() { if (!is_dir($this->src_dir) || !is_readable($this->src_dir)) { - print '<b>Unable to begin, source directory is not readable or does not exist</b>'; + print '<b>Unable to begin, source directory is not readable or does not exist.</b>'; return false; } elseif (!is_writable($this->src_dir)) { - print '<b>Unable to begin, source directory is not writable, you must chmod -R 777 ' . $this->src_dir . ' before continuing'; + print '<b>Unable to begin, source directory is not writable, on Unix you must run the command chmod -R 777 ' . $this->src_dir . ' before continuing.'; return false; } @@ -254,20 +257,20 @@ if (!is_dir($this->dest_dir)) { if (!$this->_MkDir($this->dest_dir, true)) { - print '<b>Unable to create output directory ' . $this->dest_dir . ', please manually create this directory and chmod it 777</b>'; + print '<b>Unable to create output directory ' . $this->dest_dir . ', please manually create this directory and, on Unix, run the command chmod 777 on it.</b>'; return false; } } if (!is_writable($this->dest_dir)) { - print '<b>' . $this->dest_dir . ' is not writable, please fix the permissions on this directory (chmod 777 ' . $this->dest_dir . ')</b>'; + print '<b>' . $this->dest_dir . ' is not writable, please fix the permissions on this directory (Unix: chmod 777 ' . $this->dest_dir . ').</b>'; return false; } $this->restrictions_code = $this->_BuildRestrictions($_REQUEST['restrictions']); if (!is_array($files)) { - print '<b>No files elibible for encoding exist in the source directory</b>'; + print '<b>No files eligible for encoding exist in the source directory.</b>'; return false; } @@ -277,7 +280,7 @@ continue; // make sure directory is writable for temporary encoding purposes } else if (!is_writable(dirname($file))) { - print '<span class="failfont">' . dirname($file) . ' is not writable, please chmod -R 777 ' . dirname($file) . '</span><br>'; + print '<span class="failfont">' . dirname($file) . ' is not writable, please run the command chmod -R 777 ' . dirname($file) . '.</span><br>'; continue; } @@ -285,33 +288,37 @@ print '<span class="successfont">Successfully encoded ' . $file . '</span><br>'; $encode_success++; } else { - print '<span class="failfont">Failed to encode ' . $file . '</span><br>'; + print '<span class="failfont">Failed to encode ' . $file . '.</span><br>'; $encode_failed++; } // flush output so if the script executes a long time we aren't waiting for output if (function_exists("ob_get_level")) { + // GJH-Check that buffer exists before flushing to avoid failure errors. + if(ob_get_contents()) ob_flush(); } } // display summary of files print '<p>'; - print '<span class="smallfont"><b>Successfully Encoded ' . $encode_success . ' files</span><br>'; - print '<span class="smallfont"><b>Failed to Encode ' . $encode_failed . ' files</span><br>'; + print '<span class="smallfont"><b>Successfully Encoded ' . $encode_success . ' files.</span><br>'; + print '<span class="smallfont"><b>Failed to Encode ' . $encode_failed . ' files.</span><br>'; print '</p>'; // copy skipped files if we need to if ($this->copy_skipped_files == true) { print '<p>'; if ($this->_CopySkippedFiles($this->src_dir, $this->dest_dir)) { - print '<span class="successfont">Copied non source files</span><br>'; + // GJH-Removed output of "Copied non-source files" from here to prevent + // output even when files weren't copied. Added output for each copied file + // to _CopySkippedFiles(). if ($encode_failed > 0) { print '<p><b>Files that failed to encode were copied in plain text to avoid breaking the application.</b></p>'; } } else { - print '<span class="failfont">Failed to copy skipped files</span><br>'; + print '<span class="failfont">Failed to copy skipped files.</span><br>'; } print '</p>'; } @@ -375,6 +382,13 @@ ?> </td></tr> </table> + </center> + <p> + <a href="http://validator.w3.org/check?uri=referer"> + <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> </html> <?php @@ -389,24 +403,26 @@ function HtmlHeader($title = '') { ?> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> - <head><title>PHPCoder <?php print $this->version ?> (MMCache PHP Encoder Frontend)</title> + <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 } BODY { font-family: sans-serif; - font-size: normal; + font-size: medium; } TD { font-family: sans-serif; - font-size: normal; + font-size: medium; } TD.withborder { font-family: sans-serif; - font-size: normal; + font-size: medium; border-style: solid; border-width: 1px; /* sets border width on all sides */ border-color: black; @@ -414,7 +430,7 @@ TD.withborder-medium { font-family: sans-serif; - font-size: normal; + font-size: medium; border-style: solid; border-width: 3px; /* sets border width on all sides */ border-color: black; @@ -423,7 +439,7 @@ .header { font-family: sans-serif; - font-color: #FFFFFF; + color: rgb(199,21,133); font-weight: bold; font-size: larger; } @@ -455,8 +471,13 @@ </head> <body> - <table align="center"><tr><td class="withborder-medium"> - <p><span class="header">PHPCoder v. <?php print $this->version; ?></b> (<a href="http://phpcoder.shadonet.com">phpcoder.shadonet.com</a>)</span></p> + <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>) + </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> + </p> <?php } @@ -485,6 +506,8 @@ function _BuildRestrictions() { + // GJH-Declare $expire_stamp to avoid undeclared variable errors. + $expire_stamp = ""; $rest = &$this->restrictions; // alias $rest to $this->restrictions for shorter code $return_code = ''; @@ -511,7 +534,6 @@ } // build script expiration timestamp - $expire_stamp = 0; if (!empty($rest['expire_value']) && is_numeric($rest['expire_value']) && !empty($rest['expire_unit'])) { $expire_stamp = strtotime('+' . $rest['expire_value'] . ' ' . $rest['expire_unit']); } elseif (!empty($rest['expire_english'])) { @@ -557,7 +579,7 @@ // get a list of each file in the directory, skip files we shouldn't see while (FALSE !== ($file = readdir($dh))) { - // skip $ignore_files, because thix is where . and .. live + // skip $ignore_files, because this is where . and .. live if (is_array($this->ignore_files) && in_array($file, $this->ignore_files)) { continue; } @@ -581,9 +603,13 @@ // otherwise copy the file if (!@is_file($dest_path)) { if (!@copy($file_path, $dest_path)) { - print '<font color="red">Failed to copy ' . $file_path . ' to ' . $dest_path . '</font><br>'; + print '<font color="red">Failed to copy ' . $file_path . ' to ' . $dest_path . '.</font><br>'; return false; } + // GJH-Print file-specific output when copying files. + else{ + print '<span class="successfont">Copied ' . $file_path . '.</span><br>'; + } } } } @@ -635,8 +661,8 @@ function _ListValidFiles($file_dir) { - $return = array(); - + // GJH-Declare variable to avoid errors. + $return = ""; if (!is_dir($file_dir)) { die($file_dir . ' is not a directory'); } Index: README.txt =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/README.txt,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -d -r1.1.1.1 -r1.4 --- README.txt 25 Jan 2004 01:38:08 -0000 1.1.1.1 +++ README.txt 22 Aug 2004 03:00:49 -0000 1.4 @@ -1,2 +1,202 @@ -See HELP.html for installation directions, a plain text version will be made available soon. +What is PHPCoder? + +PHPCoder is a web based front-end to the Turck MMCache +<http://www.turcksoft.com/en/e_mmc.htm> encoding functions, which are +similar to the Zend Encoder product. + +*Turck MMCache* 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. *Turck MMCache* +typically reduces server load and increases the speed of your PHP code +by 1-10 times. + +PHPCoder enables you to encode your PHP scripts and applications into +non reversible byte-code, thus preventing users of your programs from +viewing or alterting 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 databae login and password information. + +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. + +To use your encoded scripts your clients simply install the free Turck +MMCache <http://www.turcksoft.com/en/e_mmc.htm> (available on Windows +and Unix/Linux) or the Turck Loader +<http://www.turcksoft.com/en/e_mmc.htm>. + +Downloading PHPCoder + +The latest version of PHP coder can be downloaded at +http://phpcoder.shadonet.com/downloads + + +Installing PHPCoder + +Requirements: + +Turck MMCache <http://www.turcksoft.com/en/e_mmc.htm> be installed +(available on Windows and Unix/Linux) +PHP >= 4.1 (4.3.x highly recommended, 4.1 required) +Apache 1.3/2 or other PHP compatable web-server + +Installation Steps: + +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. +Commands you should type are in italics. + +1. Download the latest version of PHPCoder from +http://phpcoder.shadonet.com/downloads +2. Extract the phpcoder-x.tgz file by issuing the command: tar zxf +phpcoder-x.tgz (replace phpcoder-x.tgz with the file you downloaded) +3. Enter the phpcoder directory by issuing the: cd phpcoder command +4. Create the files directory and make it writable: mkdir files; chmod +777 files +5. Create the encoded directory and make it writable: mkdir encoded; +chmod 777 encoded + +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 inforamtion see Using PHPCoder. + + +Using PHPCoder + +Once you have installed PHPCoder following the installation steps above +it is easy to begin encoding scripts. + +First place the script that you want to be encoded in the files +directory (you can do this via FTP but all directories must be chmod 777). +Next telnet into your hosting providor and execute the command chmod -R +777 /path/to/phpcoder/files +Then visit http://yourdomain/phpcoder, set your options and press the +submit button. + +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. + +Options: + +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: + +Recursive Encoding: 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. +Copy Skipped Files: 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. + +Pre Content Code: 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. +Post Content Code: This is Text, HTML, or PHP code (must be encloded in +<?php ?>) content that will be appended to each PHP source file before +it is encoded, this is a good place for copyright, etc. + + +Restrictions: + +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. + +Restrict Visitor's IP: This can be a single IP or a comma seperated list +of IP addresse; 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. + +Restrict Server IP: This can be a single IP or a comma seperated list of +IP addresesses; 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. + +Restrict Server Name: 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. + +Expiring Scripts: When a selection is made for Script Expires In: 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 PHP's +strtotime format for the time, see http://www.php.net/strtotime for more +information. + + +PHPCoder License + +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. + +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. + + +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. + +Contacting the Author (Bug Reports, Feature Requests, etc.) + +I can be contacted via e-mail via js...@sh..., 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). + + + Index: index.php =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/index.php,v retrieving revision 1.2 retrieving revision 1.4 diff -u -d -r1.2 -r1.4 --- index.php 27 Jan 2004 10:51:08 -0000 1.2 +++ index.php 22 Aug 2004 03:00:49 -0000 1.4 @@ -86,7 +86,7 @@ if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { // if we have a user-entered timestamp make sure we are able to parse it using strtotime if (!empty($_REQUEST['restrictions']['expire_english']) && strtotime($_REQUEST['restrictions']['expire_english']) == '-1') { - print '<span class="failfont"><blockquote><b>Unable to convert user entered expiration time into a timestamp, please check the format</b></blockquote></span>'; + print '<span class="failfont"><blockquote><b>Unable to convert the user-entered expiration time into a timestamp, please check the format.</b></blockquote></span>'; } else { // start encoding process print '<p><font size="+1"><b>Results:</b></font></p>'; @@ -97,6 +97,8 @@ } $coder->DisplayForm(); - print '<p><center><a href="http://www.turcksoft.com/en/e_mmc.htm"><img border="0" src="http://www.turcksoft.com/images/mmcache/mmcache02.gif"></a></center></p>'; + 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(); ?> |
From: <gh...@us...> - 2004-02-06 16:09:05
|
Update of /cvsroot/phpcoder/phpcoder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6575 Modified Files: coder-class.php Log Message: Initialize some more variables to avoid the notices when using E_ALL. Index: coder-class.php =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/coder-class.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- coder-class.php 27 Jan 2004 13:34:12 -0000 1.2 +++ coder-class.php 6 Feb 2004 16:06:16 -0000 1.3 @@ -511,6 +511,7 @@ } // build script expiration timestamp + $expire_stamp = 0; if (!empty($rest['expire_value']) && is_numeric($rest['expire_value']) && !empty($rest['expire_unit'])) { $expire_stamp = strtotime('+' . $rest['expire_value'] . ' ' . $rest['expire_unit']); } elseif (!empty($rest['expire_english'])) { @@ -634,6 +635,8 @@ function _ListValidFiles($file_dir) { + $return = array(); + if (!is_dir($file_dir)) { die($file_dir . ' is not a directory'); } |
From: <gh...@pr...> - 2004-01-27 13:35:14
|
Update of /cvsroot/phpcoder/phpcoder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7670 Modified Files: coder-class.php Log Message: Switch to Unix style line endings. Use -w parameter for cvs diff. Create encoded files using the file mode of the source file by default. The user can still specify a custom file mode. Index: coder-class.php =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/coder-class.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- coder-class.php 25 Jan 2004 01:38:08 -0000 1.1.1.1 +++ coder-class.php 27 Jan 2004 13:34:12 -0000 1.2 @@ -1,847 +1,849 @@ -<?php -/** -This code 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. - [...1665 lines suppressed...] + function _WriteFile($file, $contents) + { + if (empty($file)) { + return false; + } + + if (!$fp = @fopen($file, 'wb')) { + return false; + } + + if (!fwrite($fp, $contents, strlen($contents))) { + return false; + } + + @fclose($fp); + + return true; + } +} +?> |
From: <gh...@pr...> - 2004-01-27 10:52:08
|
Update of /cvsroot/phpcoder/phpcoder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3354 Modified Files: index.php Log Message: First commit. Use the cvs diff -w option to see the actual changes. Convert line endings to Unix style. Verify and declare some variables so that thay don't generate notices when E_ALL error reporting level is set. Index: index.php =================================================================== RCS file: /cvsroot/phpcoder/phpcoder/index.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** index.php 25 Jan 2004 01:38:08 -0000 1.1.1.1 --- index.php 27 Jan 2004 10:51:08 -0000 1.2 *************** *** 1,95 **** ! <?php ! /** ! This code 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 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. ! ! */ ! ! // get coder class ! require_once('./coder-class.php'); ! $coder = new coder; ! ! // set directory recursion, default to true ! $coder->recursive = (isset($_REQUEST['recursive'])) ? $_REQUEST['recursive'] : true; ! ! // determine if we should copy files that don't get encoded, on by default, turning this off will break applications ! $coder->copy_skipped_files = (isset($_REQUEST['copy_skipped_files'])) ? $_REQUEST['copy_skipped_files'] : true; ! ! // set source and destination directories ! $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'; ! ! // set file extensions ! if (!empty($_REQUEST['extentions'])) { ! // construct array from $_REQUEST['extensions'], deal with extension, space by removing spaces. ! $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['extentions'])); ! ! if (is_array($possible_extensions)) { ! $coder->extensions = $possible_extensions; ! } ! ! unset($possible_extensions); ! } ! ! // set file extensions to skip ! if (!empty($_REQUEST['ignore_extentions'])) { ! $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['ignore_extentions'])); ! ! if (is_array($possible_extensions)) { ! $coder->ignore_extensions = $possible_extensions; ! } ! ! unset($possible_extensions); ! } ! ! ! // set php pre and post content variables ! $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 = (is_array($_REQUEST['restrictions'])) ? $_REQUEST['restrictions'] : array(); ! ! ! ! // enable output buffering if we need to ! if (function_exists("ob_get_level")) { ! if (0 == ob_get_level()) { ! ob_start(); ! } ! } ! ! ! // if form hasn't been submitted display it ! $coder->HtmlHeader(); ! ! if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { ! // if we have a user-entered timestamp make sure we are able to parse it using strtotime ! if (!empty($_REQUEST['restrictions']['expire_english']) && strtotime($_REQUEST['restrictions']['expire_english']) == '-1') { ! print '<span class="failfont"><blockquote><b>Unable to convert user entered expiration time into a timestamp, please check the format</b></blockquote></span>'; ! } else { ! // start encoding process ! print '<p><font size="+1"><b>Results:</b></font></p>'; ! print '<p><blockquote>'; ! $coder->Encode(); ! print '</blockquote></p>'; ! } ! } ! ! $coder->DisplayForm(); ! print '<p><center><a href="http://www.turcksoft.com/en/e_mmc.htm"><img border="0" src="http://www.turcksoft.com/images/mmcache/mmcache02.gif"></a></center></p>'; ! $coder->HtmlFooter(); ! ?> --- 1,102 ---- ! <?php ! /** ! This code 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 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. ! ! */ ! ! // get coder class ! require_once('./coder-class.php'); ! $coder = new coder; ! ! // set directory recursion, default to true ! $coder->recursive = (isset($_REQUEST['recursive'])) ? $_REQUEST['recursive'] : true; ! ! // determine if we should copy files that don't get encoded, on by default, turning this off will break applications ! $coder->copy_skipped_files = (isset($_REQUEST['copy_skipped_files'])) ? $_REQUEST['copy_skipped_files'] : true; ! ! // set source and destination directories ! $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'; ! ! // set file extensions ! if (!empty($_REQUEST['extentions'])) { ! // construct array from $_REQUEST['extensions'], deal with extension, space by removing spaces. ! $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['extentions'])); ! ! if (is_array($possible_extensions)) { ! $coder->extensions = $possible_extensions; ! } ! ! unset($possible_extensions); ! } ! ! // set file extensions to skip ! if (!empty($_REQUEST['ignore_extentions'])) { ! $possible_extensions = explode(',', str_replace(' ', '', $_REQUEST['ignore_extentions'])); ! ! if (is_array($possible_extensions)) { ! $coder->ignore_extensions = $possible_extensions; ! } ! ! unset($possible_extensions); ! } ! ! ! // set php pre and post content variables ! $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(); ! } ! } ! ! ! // if form hasn't been submitted display it ! $coder->HtmlHeader(); ! ! if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { ! // if we have a user-entered timestamp make sure we are able to parse it using strtotime ! if (!empty($_REQUEST['restrictions']['expire_english']) && strtotime($_REQUEST['restrictions']['expire_english']) == '-1') { ! print '<span class="failfont"><blockquote><b>Unable to convert user entered expiration time into a timestamp, please check the format</b></blockquote></span>'; ! } else { ! // start encoding process ! print '<p><font size="+1"><b>Results:</b></font></p>'; ! print '<p><blockquote>'; ! $coder->Encode(); ! print '</blockquote></p>'; ! } ! } ! ! $coder->DisplayForm(); ! print '<p><center><a href="http://www.turcksoft.com/en/e_mmc.htm"><img border="0" src="http://www.turcksoft.com/images/mmcache/mmcache02.gif"></a></center></p>'; ! $coder->HtmlFooter(); ! ?> |
From: Daniel B. <da...@da...> - 2004-01-26 18:13:07
|
This is just a test message. |