OSDN Git Service

NP_Paint v1.18
authorhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 6 Jun 2010 11:59:35 +0000 (11:59 +0000)
committerhsur <hsur@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 6 Jun 2010 11:59:35 +0000 (11:59 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1062 1ca29b6e-896d-4ea0-84a5-967f57386b96

54 files changed:
trunk/NP_Paint/NP_Paint.php [new file with mode: 0644]
trunk/NP_Paint/paint/Applet_PaintBBS.php [new file with mode: 0644]
trunk/NP_Paint/paint/Applet_Shipainter.php [new file with mode: 0644]
trunk/NP_Paint/paint/Applet_Shipainterpro.php [new file with mode: 0644]
trunk/NP_Paint/paint/PaintPlugin.php [new file with mode: 0644]
trunk/NP_Paint/paint/Palette_None.php [new file with mode: 0644]
trunk/NP_Paint/paint/Palette_Selfy.php [new file with mode: 0644]
trunk/NP_Paint/paint/Palette_WCS.php [new file with mode: 0644]
trunk/NP_Paint/paint/Parser_PaintBBS.php [new file with mode: 0644]
trunk/NP_Paint/paint/Viewer_Continue.php [new file with mode: 0644]
trunk/NP_Paint/paint/Viewer_Pch.php [new file with mode: 0644]
trunk/NP_Paint/paint/Viewer_Spch.php [new file with mode: 0644]
trunk/NP_Paint/paint/applet/index.html [new file with mode: 0644]
trunk/NP_Paint/paint/applet/readme.txt [new file with mode: 0644]
trunk/NP_Paint/paint/help.html [new file with mode: 0644]
trunk/NP_Paint/paint/index.php [new file with mode: 0644]
trunk/NP_Paint/paint/language/japanese-euc.php [new file with mode: 0644]
trunk/NP_Paint/paint/language/japanese-utf8.php [new file with mode: 0644]
trunk/NP_Paint/paint/mkeuc.sh [new file with mode: 0644]
trunk/NP_Paint/paint/paint.css [new file with mode: 0644]
trunk/NP_Paint/paint/paint.js [new file with mode: 0644]
trunk/NP_Paint/paint/prototype-1.4.0.js [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/index/help_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/index/help_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/index/menu_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/index/menu_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/np_paint/form_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/np_paint/form_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/np_paint/ok_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/np_paint/ok_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-euc.html [new file with mode: 0644]
trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-utf8.html [new file with mode: 0644]
trunk/NP_Paint/sharedlibs/cles/Feedback.php [new file with mode: 0644]
trunk/NP_Paint/sharedlibs/cles/Template.php [new file with mode: 0644]
trunk/NP_Paint/sharedlibs/pclzip.lib.php [new file with mode: 0644]
trunk/NP_Paint/sharedlibs/sharedlibs.php [new file with mode: 0644]

diff --git a/trunk/NP_Paint/NP_Paint.php b/trunk/NP_Paint/NP_Paint.php
new file mode 100644 (file)
index 0000000..7f9ef16
--- /dev/null
@@ -0,0 +1,940 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * NP_Paint ($Revision: 1.273 $)\r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * \r
+  * $Id: NP_Paint.php,v 1.273 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+if (!class_exists('NucleusPlugin')) exit;\r
+define("NP_PAINT_IMAGE_NAME", "pbbsimage");\r
+define("NP_PAINT_TICKET_TABLE", "plugin_paint_tickets");\r
+define("NP_PAINT_TICKET_LIFETIME", 86400);\r
+\r
+global $DIR_LIBS;\r
+require_once($DIR_LIBS . 'MEDIA.php');\r
+\r
+// load class\r
+require_once(dirname(__FILE__).'/sharedlibs/sharedlibs.php');\r
+require_once('cles/Template.php');\r
+require_once(dirname(__FILE__).'/paint/PaintPlugin.php');\r
+\r
+class NP_Paint extends NucleusPlugin {\r
+\r
+       // name of plugin\r
+       function getName() {\r
+               return 'Paint';\r
+       }\r
+\r
+       // author of plugin\r
+       function getAuthor() {\r
+               return 'hsur';\r
+       }\r
+\r
+       // an URL to the plugin website\r
+       // can also be of the form mailto:foo@bar.com\r
+       function getURL() {\r
+               return 'http://blog.cles.jp/np_cles/category/31/subcatid/5';\r
+       }\r
+\r
+       // version of the plugin\r
+       function getVersion() {\r
+               return '1.18.0';\r
+       }\r
+       \r
+       function hasAdminArea() {\r
+               return 1;\r
+       }\r
+\r
+       function install() {\r
+               // FORM default\r
+               $this->createOption('defaultWidth', _PAINT_defaultWidth, 'text', '300', 'numerical=true');              \r
+               $this->createOption('defaultHeight', _PAINT_defaultHeight, 'text', '300', 'numerical=true');            \r
+               $this->createOption('defaultAnimation', _PAINT_defaultAnimation, 'yesno', 'yes');               \r
+               $this->createOption('defaultApplet', _PAINT_defaultApplet, 'select', '', '');\r
+               $this->createOption('defaultPalette', _PAINT_defaultPalette, 'select', '', '');\r
+\r
+               $this->createOption('defaultImgType', _PAINT_defaultImgType, 'select', 'AUTO', 'AUTO|AUTO|JPG|JPG|PNG|PNG');\r
+               $this->createOption('defaultImgCompress', _PAINT_defaultImgCompress, 'text', '15', 'numerical=true');           \r
+               $this->createOption('defaultImgDecrease', _PAINT_defaultImgDecrease, 'text', '60', 'numerical=true');           \r
+               $this->createOption('defaultImgQuality', _PAINT_defaultImgQuality, 'text', '75', 'numerical=true');             \r
+\r
+               $this->createOption('defaultAppletQuality', _PAINT_defaultAppletQuality, 'select', '1', '1|1|2|2|3|3|4|4|5|5');\r
+\r
+               $this->createOption('bodyTpl', _PAINT_bodyTpl, 'textarea', '<%paint(<%url%>|<%w%>|<%h%>|'.NP_PAINT_IMAGE_NAME.')%>');\r
+               $this->createOption('tagTpl', _PAINT_tagTpl, 'textarea', '<%img%><a href="<%viewer%>" onclick="window.open(this.href, \'popupwindow\', \'width=400, height=400, scrollbars, resizable\'); return false; " >'._PAINT_STAR.'Anime</a>');\r
+               $this->createOption('imageTpl', _PAINT_imageTpl, 'textarea', '<%image(<%url%>|<%w%>|<%h%>|<%alt%>)%><%continue%>');\r
+               $this->createOption('continueTpl', _PAINT_continueTpl, 'textarea', '<br /><a onclick="window.open(this.href, \'popupwindow\', \'width=400, height=400, scrollbars, resizable\'); return false;" href="<%actionurl%>">'._PAINT_STAR.'Continue</a>');\r
+               // debug\r
+               $this->createOption('debug', _PAINT_debug, 'yesno', 'no');\r
+               \r
+               // for authentication\r
+               sql_query("\r
+                       CREATE TABLE IF NOT EXISTS \r
+                       ".sql_table(NP_PAINT_TICKET_TABLE).'\r
+                       (\r
+                               `ticket` CHAR(40) NOT NULL,\r
+                               `member` INT(11) NOT NULL,\r
+                               `generated` TIMESTAMP,\r
+                               PRIMARY KEY (`ticket`, `member`),\r
+                               INDEX genarated_idx (`generated` DESC)\r
+                       )\r
+               ');\r
+       }\r
+       \r
+       function unInstall() {\r
+               sql_query("DROP TABLE ".sql_table(NP_PAINT_TICKET_TABLE));\r
+       }\r
+       \r
+       function getMinNucleusVersion() { return 330; }\r
+       function getMinNucleusPatchLevel() { return 0; }\r
+\r
+       // a description to be shown on the installed plugins listing\r
+       function getDescription() {\r
+               return '[$Revision: 1.273 $]<br />' . _PAINT_DESCRIPTION;\r
+       }\r
+\r
+       function supportsFeature($what) {\r
+               switch ($what) {\r
+                       case 'SqlTablePrefix' :\r
+//                     case 'HelpPage':\r
+                               return 1;\r
+                       default :\r
+                               return 0;\r
+               }\r
+       }\r
+       \r
+       function getEventList() {\r
+               return array('PrePluginOptionsEdit', 'PreItem');\r
+       }\r
+       \r
+       function event_PrePluginOptionsEdit(&$data) {\r
+               $this->_loadPlugin();\r
+               $trimChar = array(\r
+                       '=' => '',\r
+                       '|' => '',\r
+                       ';' => '',\r
+               );\r
+\r
+               switch($data['context']){\r
+                       case 'global':\r
+                               if( $data['plugid'] != $this->getID() ) return ;\r
+                               \r
+                               $appletTypeinfo = '';\r
+                               foreach($this->applets as $key => $applet){\r
+                                       if($appletTypeinfo) $appletTypeinfo .= '|';\r
+                                       $applet->name = strtr($applet->name, $trimChar);\r
+                                       $key = strtr($key, $trimChar);\r
+                                       $appletTypeinfo .= "{$applet->name}|{$key}";\r
+                               }\r
+                               $paletteTypeinfo = '';\r
+                               foreach($this->palettes as $key => $palette){\r
+                                       if($paletteTypeinfo) $paletteTypeinfo .= '|';\r
+                                       $palette->name = strtr($palette->name, $trimChar);\r
+                                       $key = strtr($key, $trimChar);\r
+                                       $paletteTypeinfo .= "{$palette->name}|{$key}";\r
+                               }\r
+                               foreach($data['options'] as $oid => $option ){\r
+                                       switch($data['options'][$oid]['name']){\r
+                                               case 'defaultApplet':\r
+                                                       $data['options'][$oid]['typeinfo'] = $appletTypeinfo;\r
+                                                       break;\r
+                                               case 'defaultPalette':\r
+                                                       $data['options'][$oid]['typeinfo'] = $paletteTypeinfo;\r
+                                                       break;\r
+                                       }\r
+                               }\r
+                                                               \r
+                               break;\r
+                       default:\r
+                               // nothing      \r
+               }\r
+       }\r
+\r
+/*\r
+       function doItemVar($item, $arg){\r
+               $arr[1] = $arg;\r
+               echo $this->_convertPaint($arr);\r
+       }\r
+*/\r
+\r
+       function event_PreItem($data) {\r
+               $this->_loadPlugin();\r
+               $preg_expr = "#<\%paint\((.*?)\)%\>#i";\r
+               $this->currentItem = &$data["item"];\r
+               \r
+               $this->currentItem->body = preg_replace_callback($preg_expr, array(&$this, '_convertPaint'), $this->currentItem->body);\r
+               $this->currentItem->more = preg_replace_callback($preg_expr, array(&$this, '_convertPaint'), $this->currentItem->more);\r
+       }\r
+       \r
+       function _convertPaint($matches) {\r
+               global $CONF, $DIR_MEDIA, $member;\r
+               list($url, $w, $h, $alt) = explode("|", $matches[1], 4);\r
+               \r
+               if (strstr($url,'/'))\r
+                       $collection = intval(dirname($url));\r
+               else\r
+                       $collection = intval($this->currentItem->authorid);\r
+                       \r
+               $vars = array (\r
+                       'w' => intval($w),\r
+                       'h' => intval($h),\r
+                       'url' => $url,\r
+                       'alt' => $alt,\r
+               );\r
+               \r
+               $basename = basename($url, '.jpg');\r
+               $basename = basename($basename, '.png');\r
+               foreach( $this->viewers as $key => $viewer ){\r
+                       foreach( $viewer->animeExt as $ext  ){\r
+                               $file = $DIR_MEDIA . $collection . '/' . $basename . '.' . $ext;\r
+                               if( file_exists( $file ) ){\r
+                                       $vars['viewer'] = htmlspecialchars($CONF['ActionURL'] . "?action=plugin&name=Paint&type=viewer&w=".$vars['w']."&h=".$vars['h']."&file={$collection}/{$basename}.{$ext}&viewer=$key", ENT_QUOTES);\r
+                                       break 2;\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               if ( $member->isLoggedIn() && $member->getID() == $collection && $this->viewers['continue'] ){\r
+                       $vars['actionurl'] = htmlspecialchars($CONF['ActionURL'] . "?action=plugin&name=Paint&type=viewer&w=".$vars['w']."&h=".$vars['h']."&file=".$url."&viewer=continue", ENT_QUOTES);\r
+                       $vars['continue'] = TEMPLATE :: fill($this->getOption('continueTpl'), $vars);\r
+               }\r
+               \r
+               $vars['img'] = TEMPLATE :: fill($this->getOption('imageTpl'), $vars);\r
+               \r
+               if( $vars['viewer'] )\r
+                       return TEMPLATE :: fill($this->getOption('tagTpl'), $vars);                     \r
+               return $vars['img'];\r
+       }\r
+                       \r
+       function init(){\r
+               $this->template =& new cles_Template(dirname(__FILE__).'/paint/template');\r
+               \r
+               $this->parsers = Array();\r
+               $this->applets = Array();\r
+               $this->palettes = Array();\r
+               $this->viewers = Array();\r
+               $this->files = Array();\r
+               $this->disabledPlugin = Array();\r
+               $this->isPluginLoaded = false;\r
+               \r
+               // include language file for this plugin \r
+               $language = ereg_replace( '[\\|/]', '', getLanguageName()); \r
+               if (file_exists($this->getDirectory().'language/'.$language.'.php')) \r
+                       @ include_once($this->getDirectory().'language/'.$language.'.php');\r
+       }\r
+               \r
+       function doAction($type) {\r
+               @ini_set('display_errors', 0);\r
+               //@ini_set('error_reporting', 0);\r
+               \r
+               global $member;\r
+               $this->_loadPlugin();\r
+               header('Pragma: no-cache');\r
+               header('Expires: 0');\r
+               \r
+               switch ($type) {\r
+                       case 'postimg':\r
+                               $err = $this->_postimg(requestVar('parser'));\r
+                               \r
+                               if($err){\r
+                                       $this->_warn('postimg Err: ' . $err);\r
+                                       $file = $line = '';\r
+                                       if( ! headers_sent($file, $line) ){\r
+                                               header("HTTP/1.0 500 Internal Server Error");\r
+                                               header("Status: 500 Internal Server Error");\r
+                                               echo 'postimg Err: ' . mb_convert_encoding($err, 'UTF-8', _CHARSET);\r
+                                       } else {\r
+                                               $this->_warn(_PAINT_HeadersAlreadySent . "file:$file, line:$line" );\r
+                                               echo "error\n" . mb_convert_encoding($err, "UTF-8", _CHARSET);\r
+                                       }\r
+                               }\r
+                               // always no err\r
+                               return '';\r
+                               break;\r
+\r
+                       case 'applet':\r
+                               if ( ! $member->isLoggedIn() )\r
+                                       return _PAINT_NeedLogin;\r
+                               return $this->_showApplet();\r
+                               break;\r
+                               \r
+                       case 'postsuccess':\r
+                               if ( ! $member->isLoggedIn() )\r
+                                       return _PAINT_NeedLogin;\r
+                               \r
+                               if( intRequestVar('ow') ){\r
+                                       $this->_showOk();\r
+                                       return '';\r
+                               }\r
+                               \r
+                               return $this->_showItemAddForm();\r
+                               break;\r
+                       \r
+                       case 'viewer':\r
+                               return $this->_showViewer();\r
+                               break;\r
+\r
+                       case 'plugin':\r
+                               echo 'NP_Paint: ' . $this->getVersion() . ' ($Id: NP_Paint.php,v 1.273 2010/06/06 11:44:19 hsur Exp $)<br />';\r
+                               foreach( $this->parsers as $key => $name){\r
+                                       echo 'Parser: ' . $key . ' (' . $name->id .  ')<br />';\r
+                               }\r
+                               foreach( $this->applets as $key => $name){\r
+                                       echo 'Applet: ' . $key . ' (' . $name->id .  ')<br />';\r
+                               }\r
+                               foreach( $this->palettes as $key => $name){\r
+                                       echo 'Palette: ' . $key . ' (' . $name->id .  ')<br />';\r
+                               }\r
+                               foreach( $this->viewers as $key => $name){\r
+                                       echo 'Viewer: ' . $key . ' (' . $name->id .  ')<br />';\r
+                               }\r
+                               return '';\r
+                               break;\r
+                               \r
+                       case 'getLoginkey':\r
+                               if ( $member->isLoggedIn() ){\r
+                                       header('Content-Type: application/xml');\r
+                                       echo $this->_getLoginkey();\r
+                               } else {\r
+                                       header("HTTP/1.0 500 Internal Server Error");\r
+                                       header("Status: 500 Internal Server Error");\r
+                                       echo _PAINT_NeedLogin;\r
+                               }\r
+                               return '';\r
+                               break;\r
+                       \r
+                       // other actions result in an error\r
+                       case '':\r
+                       default:\r
+                               return 'Unexisting action: ' . $type;\r
+               }\r
+       }\r
+       \r
+       function doSkinVar($skinType, $type = '') {\r
+               global $member, $CONF;\r
+               \r
+               if($mes = $this->_phpVersionWarning() ){\r
+                       echo $mes;\r
+                       $this->_warn($mes);\r
+               }\r
+               \r
+               switch ($type) {\r
+                       case '' :\r
+                       case 'form' :\r
+                               if ( $member->isLoggedIn() ){\r
+                                       $this->_loadPlugin();\r
+                                       $vars = array (\r
+                                               'ActionURL' => $CONF['ActionURL'],\r
+                                               'appletSelect' => $this->_getAppletSelect(),\r
+                                               'paletteSelect' => $this->_getPaletteSelect(),\r
+                                               'paletteSelectExtra' => $this->_getPaletteSelectExtra(),\r
+                                               'qualitySelect' => $this->_getQualitySelect(),\r
+                                               'animation' => ($this->getOption('defaultAnimation') == 'yes') ? 'checked="checked"' : '',\r
+                                               'defaultWidth' => $this->getOption('defaultWidth'),\r
+                                               'defaultHeight' => $this->getOption('defaultHeight'),\r
+                                       );\r
+                                       $tpl = $this->template->fetch('form', strtolower(__CLASS__));\r
+                                       echo $this->template->fill($tpl, $vars, false);\r
+                               } else { \r
+                                       echo '<span class="paint">Powered by <a href="http://blog.cles.jp/">NP_Paint</a></span>';\r
+                               }\r
+                               break;\r
+               }\r
+       }\r
+\r
+       function _phpVersionWarning(){\r
+               $required = '4.3.2';\r
+               if( ! version_compare(phpversion() , $required , '>=') ){\r
+                       return 'Warning' . _PAINT_phpVersion_before . $required . _PAINT_phpVersion_after ;\r
+               }\r
+               return '';\r
+       }\r
+       \r
+       function _showApplet(){\r
+               global $DIR_MEDIA, $CONF, $member;\r
+\r
+               $w = intRequestVar('w') ? intRequestVar('w') : $this->getOption('defaultWidth');\r
+               $h = intRequestVar('h') ? intRequestVar('h') : $this->getOption('defaultHeight');\r
+               $animation = intRequestVar('animation') ? true : false;\r
+               $ow = intRequestVar('ow');\r
+               $usePch = intRequestVar('usepch') ? true : false;\r
+               $file = requestVar('file');\r
+               $quality = intRequestVar('quality') ? intRequestVar('quality') : 1 ;\r
+               \r
+               if( $file ){\r
+                       $collection = intval(dirname($file));\r
+                       if( $collection != intval($member->getID()) ){\r
+                               $file = null;\r
+                               $this->_warn( _PAINT_illegalCollection );\r
+                       }\r
+               }\r
+               \r
+               $applet =& $this->applets[requestVar('applet')];\r
+               if(! $applet ){\r
+                       $this->_warn(_PAINT_canNotFindApplet);\r
+                       return _PAINT_canNotFindApplet;\r
+               }\r
+               $palette =& $this->palettes[requestVar('palette')];\r
+               \r
+               $header = $beforeapplet = $param = $afterapplet = $copyright = '';\r
+               \r
+               if($applet){\r
+                       $header .= $applet->getHeaderPart();    \r
+                       $beforeapplet .= $applet->getBeforeAppletPart();\r
+                       $param .= $applet->getParamPart();\r
+                       $afterapplet .= $applet->getAfterAppletPart();\r
+                       $copyright .= $applet->getCopyrightsPart();\r
+               }\r
+\r
+               if($palette){\r
+                       $header .= $palette->getHeaderPart();   \r
+                       $beforeapplet .= $palette->getBeforeAppletPart();\r
+                       $param .= $palette->getParamPart();\r
+                       $afterapplet .= $palette->getAfterAppletPart();\r
+                       $copyright .= $palette->getCopyrightsPart();\r
+               }\r
+                               \r
+               if( $animation ){\r
+                       $param .= '<param name="thumbnail_type" value="animation" />';\r
+               }\r
+               \r
+               $copyright .= 'NP_Paint by <a href="http://blog.cles.jp">cles</a><br />';\r
+               \r
+               if( $file && file_exists( $DIR_MEDIA . $file ) ){\r
+                       $appletName = requestVar('applet');\r
+                       list($animePath, $appletName) = $this->findAppletByImg($file);\r
+                       \r
+                       if( $animePath && $usePch ){\r
+                               $param .= '<param name="thumbnail_type" value="animation" />';\r
+                               $param .= "<param name=\"pch_file\" value=\"{$CONF['MediaURL']}{$animePath}\" />";\r
+                       } else {\r
+                               $param .= "<param name=\"image_canvas\" value=\"{$CONF['MediaURL']}{$file}\" />";\r
+                       }\r
+                       \r
+                       if( $ow ){\r
+                               list($prefix, ) = explode('-', basename($file), 2);\r
+                       } else {\r
+                               $prefix = $this->_getFilePrefix();\r
+                       }\r
+               } else {\r
+                       $prefix = $this->_getFilePrefix();\r
+                       $ow = 0;\r
+               }\r
+               \r
+               $vars = array (\r
+                               'w' => $w,\r
+                               'h' => $h,\r
+                               'user' => $member->getDisplayName(),\r
+                               'loginkey' => $this->_generateLoginkey(),\r
+                               'prefix' => $prefix,\r
+                               'charset' => _CHARSET,\r
+                               'header' => $header,\r
+                               'beforeapplet' => $beforeapplet,\r
+                               'param' => $param,\r
+                               'afterapplet' => $afterapplet,\r
+                               'copyright' => $copyright,\r
+                               'ow' => $ow,\r
+                               'file' => $file,\r
+                               'imgJpeg' => ( $this->getOption('defaultImgType') == 'AUTO' ) ? 'true' : 'false',\r
+                               'imgDecrease' => ( $this->getOption('defaultImgType') == 'AUTO' ) ? $this->getOption('defaultImgDecrease') : '0',\r
+                               'imgCompress' => ( $this->getOption('defaultImgType') == 'AUTO' ) ? $this->getOption('defaultImgCompress') : '0',\r
+                               'quality' => $quality,\r
+               );\r
+               \r
+               echo $applet->getPageTemplate($vars);\r
+               return '';\r
+       }\r
+       \r
+       // return list($animeFile, $appletName)\r
+       function findAppletByImg($file){\r
+               global $DIR_MEDIA;\r
+               $collection = intval(dirname($file));\r
+               $basename = basename($file, '.jpg');\r
+               $basename = basename($basename, '.png');\r
+                               \r
+               foreach( $this->applets as $key => $applet  ){\r
+                       foreach( $applet->animeExt as $ext ){\r
+                               $anime = $DIR_MEDIA . $collection . '/' .  $basename . $ext;\r
+                               if( file_exists( $anime ) ){\r
+                                       $appletName = $key;\r
+                                       $animeFile = $collection . '/' .  $basename . $ext;\r
+                                       $ret = Array($animeFile, $appletName);\r
+                                       return $ret;\r
+                               }\r
+                       }\r
+               }\r
+               return null;\r
+       }\r
+       \r
+       function getFileInfo($animeFile){\r
+               global $DIR_MEDIA;\r
+               \r
+               list(,$ext) = explode('.', basename($animeFile), 2);\r
+               $animeFile = $DIR_MEDIA . $animeFile;\r
+               \r
+               $fileInfo = Array();\r
+               if( is_readable($animeFile) && ($ext == 'spch' || $ext == 'rpch') ){\r
+                       $fp = fopen($animeFile, 'r');\r
+                       while (!feof ($fp)) {\r
+                               $line = fgets($fp, 100);\r
+                               if (preg_match('/([a-zA-Z0-9_.-]+)=([a-zA-Z0-9_.-]+)/i', $line, $matches)) {\r
+                                       list(, $key, $value, ) = $matches;\r
+                                       $fileInfo[$key] = $value;\r
+                               } else {\r
+                                       break;\r
+                               }\r
+                       }\r
+                       fclose($fp);\r
+               }\r
+               return  $fileInfo;\r
+       }\r
+       \r
+       function _showViewer(){\r
+               global $member;\r
+               \r
+               if(     ! $file = requestVar('file') ){\r
+                       return _PAINT_fileIsNotSet;\r
+               }\r
+               if(     ! $type = requestVar('viewer') ){\r
+                       return _PAINT_viewerIsNotSet;\r
+               }\r
+\r
+               $w = intRequestVar('w') ? intRequestVar('w') : $this->getOption('defaultWidth');\r
+               $h = intRequestVar('h') ? intRequestVar('h') : $this->getOption('defaultHeight');\r
+\r
+               if(     ! $viewer = $this->viewers[$type] ){\r
+                       return _PAINT_canNotFindViewer .' viewer:' . $type;\r
+               }\r
+               if( $type == 'continue' ){\r
+                       if ( ! $member->isLoggedIn() )\r
+                               return _PAINT_NeedLogin;\r
+                       $collection = intval(dirname($file));\r
+                       if ( $collection != $member->getId() ){\r
+                               return _PAINT_illegalCollection;\r
+                       }\r
+               }\r
+               \r
+               $vars = array (\r
+                               'w' => intval($w),\r
+                               'h' => intval($h),\r
+                               'file' => $file,\r
+                               'charset' => _CHARSET,\r
+               );\r
+               \r
+               echo $viewer->getPageTemplate($vars);\r
+               return '';\r
+       }\r
+               \r
+       function _loadPlugin( $typelist = false, $reload = false ){\r
+               if( $this->isPluginLoaded && ( ! $reload ) )\r
+                       return ;\r
+               if( $this->isPluginLoaded ){\r
+                       $this->init();\r
+               }\r
+               \r
+               $this->isPluginLoaded = true;\r
+               \r
+               if( ! $typelist ){\r
+                       $typelist = 'Applet|Palette|Parser|Viewer';\r
+               }\r
+               \r
+               $pluginDir = $this->getDirectory();\r
+               $dirhandle = opendir( $pluginDir );\r
+               while ($filename = readdir($dirhandle)) {\r
+                       if (preg_match('/^('.$typelist.')_(.*)\.php$/i',$filename,$matches)) {\r
+                               list(, $type, $name, ) = $matches;\r
+                               \r
+                               $pluginPath = $pluginDir . $filename;\r
+                               if( ! is_readable( $pluginPath ) ){\r
+                                       $this->_warn(_PAINT_canNotReadFile . " file:$pluginPath, type:$type, name:$name");\r
+                                       continue;\r
+                               }\r
+                               \r
+                               require_once($pluginPath);\r
+                               if( class_exists($type . '_' . $name) ){\r
+                                       eval('$plugin =& new ' . $type . '_' . $name . '();');\r
+                                       $plugin->appletBaseUrl = $this->getAdminURL() . 'applet/';\r
+                                       $plugin->template =& $this->template;\r
+       \r
+                                       if( $plugin->enable ){\r
+                                               //$this->_info('Plugin installed: ' . $name);\r
+                                               switch( strtolower($type) ){\r
+                                                       case 'parser':\r
+                                                               $this->parsers[strtolower($name)] =& $plugin;\r
+                                                               break;\r
+                                                       case 'applet':\r
+                                                               $this->applets[strtolower($name)] =& $plugin;\r
+                                                               break;\r
+                                                       case 'palette':\r
+                                                               $this->palettes[strtolower($name)] =& $plugin;\r
+                                                               break;\r
+                                                       case 'viewer':\r
+                                                               $this->viewers[strtolower($name)] =& $plugin;\r
+                                                               break;\r
+                                                       default:\r
+                                                               // nothing\r
+                                                               $this->_warn('Unknown plugin: ' . $name);\r
+                                               }\r
+                                       } else {\r
+                                               $this->disabledPlugin[strtolower($type.'_'.$name)] =& $plugin;\r
+                                       }\r
+                               } else {\r
+                                       $this->_warn(_PAINT_canNotLoadClass . " file:$pluginPath, type:$type, name:$name");\r
+                                       continue;\r
+                               }\r
+                       }\r
+               }\r
+               closedir($dirhandle);\r
+       }\r
+       \r
+       function _postimg($parser){\r
+               global $member, $DIR_MEDIA;\r
+               \r
+               $parser =& $this->parsers[$parser];\r
+               if(! $parser ){\r
+                       $this->_warn('Parser not found');\r
+                       return 'Parser not found';\r
+               }\r
+               \r
+               $data =& $parser->parse();\r
+               // exist parse error\r
+               if( ! is_array($data) ){\r
+                       $this->_warn($data);\r
+                       return $data;\r
+               }\r
+               \r
+               // Login check\r
+               $user = '';\r
+               $loginkey = '';\r
+               if( $data['header'] ){\r
+                       if (preg_match('/user=([^&=]+)&loginkey=([^&=]+)&prefix=([^&=]+)&ow=([^&=]+)&applet=([^&=]+)/i', urldecode($data['header']), $word)) {\r
+                               list(, $user, $loginkey, $prefix, $ow, $applet, ) = $word;\r
+                       }\r
+               }\r
+               \r
+               if( ! MEMBER::exists($user) ){\r
+                       $this->_warn("User Not Found ( user:$user, loginkey:$loginkey, prefix:$prefix )");\r
+                       return _PAINT_UserNotFound;\r
+               }\r
+               \r
+               $member =& MEMBER::createFromName($user);\r
+               if ( ! $this->_checkLoginkey($loginkey, intval($member->getID())) ){\r
+                       $this->_warn("Invalid Ticket ( user:$user, loginkey:$loginkey, prefix:$prefix )");\r
+                       return _PAINT_InvalidTicket;\r
+               }\r
+               $member->loggedin = 1;\r
+               $this->_info("Login OK ( user:$user, loginkey:$loginkey, prefix:$prefix)");\r
+               $this->_info(count($data['images']) . ' images found.');\r
+               foreach( $data['size'] as $idx => $size ){\r
+                       $this->_info('DataSize['.$idx.']: '.$size);\r
+               }\r
+               \r
+               if( $prefix ){\r
+                       $this->_getFilePrefix($prefix);\r
+               } else {\r
+                       $this->_warn(_PAINT_canNotFindPrefix);\r
+                       $this->_getFilePrefix();                        \r
+               }\r
+               \r
+               $collection = intval($member->getID());\r
+               // ow delete\r
+               if( $ow ){\r
+                       foreach( Array('.jpg', '.png', '.pch', '.spch', '.rpch') as $ext ){\r
+                               if( file_exists( $file = $DIR_MEDIA . $collection . '/' . $this->_getFilePrefix() . '-' . NP_PAINT_IMAGE_NAME . $ext ) ){\r
+                                       if( unlink($file) ){\r
+                                               $this->_info(_PAINT_deleteFile . ' file:'. $file);\r
+                                       } else {\r
+                                               $this->_warn(_PAINT_deleteFile_failure . ' file:'. $file);\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               foreach( $data['images'] as $idx => $imgdata ){\r
+                       $imgDir = $DIR_MEDIA . $collection;\r
+                       $tmpFileName = $this->_getFilePrefix() . '_'. $idx . '.tmp';\r
+                       \r
+                       $this->_info('tmpfile: '.$tmpFileName);\r
+                       $err = MEDIA::addMediaObjectRaw($collection, $tmpFileName, $imgdata);\r
+                       if($err){\r
+                               $this->_warn('addMediaObjectRaw Error: '. $err);\r
+                               return $err;\r
+                       }\r
+                       \r
+                       $imageSize = @GetImageSize($imgDir . '/' . $tmpFileName);\r
+                       // detect file type\r
+                       if($imageSize === false){\r
+                               switch( $applet ){\r
+                                       case 'paintbbs':\r
+                                               $suffix = '.pch';\r
+                                               break;\r
+                                       case 'shipainter':\r
+                                               $suffix = '.spch';\r
+                                               break;\r
+                                       case 'shipainterpro':\r
+                                               $suffix = '.rpch';\r
+                                               break;\r
+                               }\r
+                       } else {\r
+                               switch($imageSize[2]){\r
+                                       case IMAGETYPE_JPEG:\r
+                                               $suffix = '.jpg';                               \r
+                                               break;\r
+                                       case IMAGETYPE_PNG:\r
+                                               $suffix = '.png';\r
+                                               break;\r
+                                       default:\r
+                                               $suffix = '.dat';\r
+                               }\r
+                       }\r
+                       \r
+                       $filename = $this->_getFilePrefix() . '-' . NP_PAINT_IMAGE_NAME .$suffix;\r
+                       if( rename($imgDir . '/' . $tmpFileName, $imgDir . '/' . $filename ) === FALSE ){\r
+                               $this->_warn(_PAINT_rename_failure . ": {$tmpFileName} => {$filename}" );\r
+                       } else {\r
+                               $this->_info(_PAINT_rename_ok . ": {$tmpFileName} => {$filename}" );\r
+                       }\r
+                       \r
+                       \r
+                       if( !( function_exists('ImageTypes') && defined('IMG_JPG') && defined('IMG_PNG') )){\r
+                               $this->_info(_PAINT_GDNotSupported);\r
+                               continue;\r
+                       }\r
+                       \r
+                       if( $this->getOption('defaultImgType') == 'JPG' && $suffix == '.png' && (@ImageTypes() & IMG_JPG) ){\r
+                               $this->_info(_PAINT_convertToJpg);\r
+                               $imgres = @ImageCreateFromPNG($imgDir . '/' . $filename);\r
+                               if( $imgres ){\r
+                                       $suffix = '.jpg';\r
+                                       $filename = $this->_getFilePrefix() . '-'. NP_PAINT_IMAGE_NAME . $suffix;\r
+                                       $this->_info('convertedFilename: ' . $filename);        \r
+                                       if( @ImageJPEG($imgres, $imgDir . '/' . $filename, $this->getOption('defaultImgQuality'))){\r
+                                               $this->_info(_PAINT_convertToJpg_succeeded);\r
+                                               if( @unlink($imgDir . '/' . $filename) ){\r
+                                                       $this->_info(_PAINT_deleteFile . ':'. $filename);\r
+                                               } else {\r
+                                                       $this->_warn(_PAINT_deleteFile_failure .':'. $filename);\r
+                                               }\r
+                                       } else {\r
+                                               $this->_warn(_PAINT_convertToJpg_failure);\r
+                                       }\r
+                                       @ImageDestroy($imgres);\r
+                               } else {\r
+                                       $this->_warn(_PAINT_pngRead_failure);\r
+                               }\r
+                       }\r
+               }               \r
+               return '';\r
+       }\r
+               \r
+       function _getFilePrefix($prefix = ''){\r
+               if( $prefix )\r
+                       $this->filePrefix = $prefix;\r
+               if( ! $this->filePrefix )\r
+                       $this->filePrefix = date('YmdHis');\r
+//                     $this->filePrefix = uniqid('');\r
+               return $this->filePrefix;\r
+       }\r
+\r
+       function _showItemAddForm() {\r
+               global $member, $manager, $CONF;\r
+               $manager->loadClass('ADMIN');\r
+               \r
+               $query = 'SELECT tblog as blogid from '.sql_table('team').' where tmember=' . intval($member->getID()) . ' limit 1';\r
+               $res = sql_query($query);\r
+               if (mysql_num_rows($res) > 0) {\r
+                       $obj = mysql_fetch_object($res);\r
+                       $blogid = $obj->blogid;\r
+               } else {\r
+                       return _ERROR_NOTONTEAM;                        \r
+               }\r
+               \r
+               $body = '';\r
+               if( intRequestVar('w') && intRequestVar('h') && requestVar('prefix') ){\r
+                       $prefix = requestVar('prefix');\r
+                       \r
+                       $collection = intval($member->getID());\r
+                       $mediaobjects = MEDIA::getMediaListByCollection($collection, $prefix . '-'.NP_PAINT_IMAGE_NAME);\r
+                       \r
+                       $this->_info( Count($mediaobjects) . ' mediaobject(s) found.');\r
+                       \r
+                       if( Count($mediaobjects) > 0){\r
+                               foreach($mediaobjects as $mo){\r
+                                       if (preg_match('/\.(jpg|png)$/i', $mo->filename)){\r
+                                               $filename = $mo->filename;\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               \r
+                               $vars = array (\r
+                                       'url' => $collection . '/' . $filename,\r
+                                       'w' => intRequestVar('w'),\r
+                                       'h' => intRequestVar('h'),\r
+                               );\r
+                               $body = TEMPLATE :: fill($this->getOption('bodyTpl'), $vars);\r
+                       }\r
+               }\r
+\r
+               $item['body'] = $body;\r
+               $item['title'] = '';\r
+               //default category\r
+               //$item['catid'] = '';\r
+\r
+               ob_start();\r
+               $factory =& new PAGEFACTORY($blogid);\r
+               $factory->createAddForm('bookmarklet',$item);\r
+               $content = ob_get_contents();\r
+               ob_end_clean();\r
+\r
+               $replace = '<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset=' . _CHARSET . '" />\r
+<base href="' . $CONF['AdminURL'] . '" />';    \r
+               $content = preg_replace ("/<head>/", $replace, $content);\r
+               \r
+               $replace = '<form method="post" action="index.php" >';\r
+               $content = preg_replace ("/<form[^>]*>/", $replace, $content);\r
+               \r
+               echo $content;\r
+               return '';\r
+       }\r
+       \r
+       function _showOk(){\r
+               $vars = array(\r
+                       'charset' => _CHARSET,\r
+               );\r
+               $tpl = $this->template->fetch('ok', strtolower(__CLASS__));     \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+               \r
+       function _info($msg) {\r
+               if ($this->getOption('debug') == 'yes') {\r
+                       ACTIONLOG :: add(INFO, 'Paint: '.$msg);\r
+               }\r
+       }\r
+\r
+       function _warn($msg) {\r
+               ACTIONLOG :: add(WARNING, 'Paint: '.$msg);\r
+       }\r
+\r
+       function _getAppletSelect($default = null){\r
+               if( $default ){\r
+                       $recomended = _PAINT_STAR;\r
+               } else {\r
+                       $recomended = '';\r
+                       $default = $this->getOption('defaultApplet');\r
+               }\r
+               \r
+               $ret = '<select name="applet">';\r
+               foreach( $this->applets as $key => $applet ){\r
+                       $selected = ( $default == $key ) ? 'selected="selected"' : '';\r
+                       $ret .= '<option value="' . $key . '" ' . $selected . ' >' . ($selected ? $recomended : '') .$applet->name .  '</option>' . "\n";\r
+               }\r
+               $ret .= '</select>';\r
+               return $ret;\r
+       }       \r
+       \r
+       function _getPaletteSelect(){\r
+               $ret = '<select name="palette">';\r
+               foreach( $this->palettes as $key => $palette ){\r
+                       $selected = ( $this->getOption('defaultPalette') == $key ) ? 'selected="selected"' : '';\r
+                       $ret .= '<option value="' . $key . '" ' . $selected . '>' . $palette->name .  '</option>' . "\n";\r
+               }\r
+               $ret .= '</select>';\r
+               return $ret;\r
+       }\r
+\r      function _getPaletteSelectExtra(){\r
+               foreach( $this->palettes as $key => $palette ){\r
+                       $ret .= $palette->getExtraOption();\r
+               }\r
+               return $ret;\r
+       }\r
+       \r
+       function _getQualitySelect($selected = null){\r
+               if(! $selected )\r
+                       $selected = $this->getOption('defaultAppletQuality');\r
+               $qualities = Range(1,5);\r
+               \r
+               $tpl = '<select name="quality">';\r
+               foreach( $qualities as $quality ){\r
+                       $tpl .= '<option value="' . $quality . '" '  .  ( $quality == $selected ? 'selected="selected" ' : '' )  . '>' . $quality . '</option>';\r
+               }\r
+               $tpl .= '</select>';\r
+               \r
+               return $tpl;\r
+       }\r
+       \r
+       function _generateLoginkey(){\r
+               global $member;\r
+               $memberid = $member->getID();\r
+               \r
+               $done = false;\r
+               $ticket = null;\r
+               while(!$done){\r
+                       $ticket = sha1(uniqid('').mt_rand(1,999999999));\r
+                       $query = sprintf('INSERT INTO ' . sql_table(NP_PAINT_TICKET_TABLE) \r
+                               . "(ticket, member) VALUES('%s', %s)"\r
+                               , mysql_real_escape_string( $ticket )\r
+                               , mysql_real_escape_string( intval($memberid) )\r
+                       );\r
+                       if( sql_query($query) ) $done = true;\r
+               }\r
+               return $ticket;\r
+       }\r
+       \r
+       function _checkLoginkey($ticket, $memberid ){\r
+               $query = sprintf('SELECT count(*) as result FROM ' . sql_table(NP_PAINT_TICKET_TABLE) \r
+                       . " WHERE ticket = '%s' AND member = %s AND generated > DATE_SUB(NOW(),INTERVAL %s SECOND)"\r
+                       , mysql_real_escape_string( $ticket )\r
+                       , mysql_real_escape_string( intval($memberid) )\r
+                       , mysql_real_escape_string( NP_PAINT_TICKET_LIFETIME )\r
+               );\r
+               $result = quickQuery($query) ? true : false ;\r
+\r
+               $query = sprintf('DELETE FROM ' . sql_table(NP_PAINT_TICKET_TABLE)\r
+                       . " WHERE ticket = '%s' OR generated < DATE_SUB(NOW(),INTERVAL %s SECOND)"\r
+                       , mysql_real_escape_string( $ticket )\r
+                       , mysql_real_escape_string( NP_PAINT_TICKET_LIFETIME )\r
+               );\r
+               sql_query($query);\r
+               \r
+               return $result;\r
+       }\r
+       \r
+       function _getLoginkey(){\r
+               $ret  = '<?xml version="1.0" encoding="utf-8" ?>'."\n";\r
+               $ret .= '<loginkey>'.$this->_generateLoginkey().'</loginkey>'."\n";\r
+               return $ret;\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Applet_PaintBBS.php b/trunk/NP_Paint/paint/Applet_PaintBBS.php
new file mode 100644 (file)
index 0000000..622c663
--- /dev/null
@@ -0,0 +1,83 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Applet_PaintBBS ($Revision: 1.46 $)\r
+  * for PaintBBSv2.22_8\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Applet_PaintBBS.php,v 1.46 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class Applet_PaintBBS extends PaintPlugin {\r
+       function getName(){\r
+               return _PAINT_Applet_PaintBBS_name . ' ' . _PAINT_Applet;\r
+       }\r
+               \r
+       function Applet_PaintBBS(){\r
+               $this->id = '$Id: Applet_PaintBBS.php,v 1.46 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = _PAINT_Applet_PaintBBS_name;\r
+               $this->parser = 'paintbbs';\r
+               \r
+               $this->magic = 'P';\r
+               $this->animeExt = Array(\r
+                       '.pch',\r
+               );\r
+\r
+               $requiredFiles = Array(\r
+                       'PaintBBS.jar'\r
+               );\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+               \r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+               $this->templatevars['parser'] = $this->parser;\r
+               $this->templatevars['magic'] = $this->magic;\r
+       }\r
+       \r
+       function getCopyrightsPart(){\r
+               $tpl = $this->template->fetch('copyrights', strtolower(__CLASS__));\r
+               return $this->template->fill($tpl, $this->templatevars, false);\r
+       }\r
+       \r
+       function getPageTemplate($vars = null){\r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));\r
+\r
+               global $CONF;\r
+               $this->templatevars['ActionURL'] = $CONF['ActionURL'];\r
+               $this->templatevars['PluginURL'] = $CONF['PluginURL'];\r
+               $this->templatevars['appletBaseUrl'] = $this->appletBaseUrl;\r
+\r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Applet_Shipainter.php b/trunk/NP_Paint/paint/Applet_Shipainter.php
new file mode 100644 (file)
index 0000000..9b6640c
--- /dev/null
@@ -0,0 +1,88 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Applet_Shipainter.php ($Revision: 1.43 $)\r
+  * for Oekaki Shi-Painter Ver1.081\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Applet_Shipainter.php,v 1.43 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Applet_Shipainter extends PaintPlugin {\r
+       function getName(){\r
+               return _PAINT_Applet_Shipainter_name . ' ' . _PAINT_Applet;\r
+       }\r
+       \r
+       function Applet_Shipainter(){\r
+               $this->id = '$Id: Applet_Shipainter.php,v 1.43 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = _PAINT_Applet_Shipainter_name;\r
+               $this->parser = 'paintbbs';\r
+               \r
+               $this->magic = 'S';\r
+               $this->animeExt = Array(\r
+                       '.spch',\r
+               );\r
+\r
+               $requiredFiles = Array(\r
+                       'spainter.jar', \r
+                       'sp.js',\r
+                       'res/normal.zip', \r
+                       'res/tt.zip',\r
+                       'res/res_normal.zip',\r
+               );\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+               \r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+               $this->templatevars['parser'] = $this->parser;\r
+               $this->templatevars['magic'] = $this->magic;\r
+       }\r
+       \r
+       function getCopyrightsPart(){\r
+               $tpl = $this->template->fetch('copyrights', strtolower(__CLASS__));\r
+               return $this->template->fill($tpl, $this->templatevars, false);\r
+       }\r
+       \r
+       function getPageTemplate($vars = null){\r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));\r
+               \r
+               global $CONF;\r
+               $this->templatevars['ActionURL'] = $CONF['ActionURL'];\r
+               $this->templatevars['PluginURL'] = $CONF['PluginURL'];\r
+               $this->templatevars['appletBaseUrl'] = $this->appletBaseUrl;\r
+\r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Applet_Shipainterpro.php b/trunk/NP_Paint/paint/Applet_Shipainterpro.php
new file mode 100644 (file)
index 0000000..7a4b4c7
--- /dev/null
@@ -0,0 +1,87 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Applet_Shipainterpro.php ($Revision: 1.43 $)\r
+  * for Oekaki Shi-Painter Ver1.081\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Applet_Shipainterpro.php,v 1.43 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class Applet_Shipainterpro extends PaintPlugin {\r
+       function getName(){\r
+               return _PAINT_Applet_Shipainterpro_name . ' ' . _PAINT_Applet;\r
+       }\r
+       \r
+       function Applet_Shipainterpro(){\r
+               $this->id = '$Id: Applet_Shipainterpro.php,v 1.43 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = _PAINT_Applet_Shipainterpro_name;\r
+               $this->parser = 'paintbbs';\r
+               \r
+               $this->magic = 'R';\r
+               $this->animeExt = Array(\r
+                       '.rpch',\r
+               );\r
+\r
+               $requiredFiles = Array(\r
+                       'spainter.jar',\r
+                       'sp.js',\r
+                       'res/pro.zip', \r
+                       'res/tt.zip',\r
+                       'res/res_pro.zip',\r
+               );\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+               \r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+               $this->templatevars['parser'] = $this->parser;\r
+               $this->templatevars['magic'] = $this->magic;\r
+       }\r
+\r
+       function getCopyrightsPart(){\r
+               $tpl = $this->template->fetch('copyrights', strtolower(__CLASS__));\r
+               return $this->template->fill($tpl, $this->templatevars, false);\r
+       }\r
+               \r
+       function getPageTemplate($vars = null){\r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));\r
+\r
+               global $CONF;\r
+               $this->templatevars['ActionURL'] = $CONF['ActionURL'];\r
+               $this->templatevars['PluginURL'] = $CONF['PluginURL'];\r
+               $this->templatevars['appletBaseUrl'] = $this->appletBaseUrl;\r
+\r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/PaintPlugin.php b/trunk/NP_Paint/paint/PaintPlugin.php
new file mode 100644 (file)
index 0000000..97234f2
--- /dev/null
@@ -0,0 +1,100 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * PaintPlugin.php ($Revision: 1.20 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: PaintPlugin.php,v 1.20 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class PaintPlugin {\r
+       var $appletBaseUrl = '';\r
+       var $type = 'unknown';\r
+       var $enable = false;\r
+       var $template = null;\r
+       \r
+       function _info($msg) {\r
+               global $manager;\r
+               \r
+               $plugin = $manager->getPlugin('NP_Paint');\r
+               if( $plugin )\r
+                       $plugin->_info($msg);\r
+       }\r
+\r
+       function isFileInstalled($files){\r
+               global $DIR_PLUGINS;\r
+               \r
+               // if $files is array\r
+               if( is_array($files) ){\r
+                       foreach( $files as $file ){\r
+                               $filePath = $DIR_PLUGINS . 'paint/applet/' . $file;\r
+                               if( ! file_exists($filePath) ){\r
+                                       $this->_info($filePath . " is required. [{$this->name}]");\r
+                                       return false;\r
+                               }\r
+                       }\r
+                       return true;\r
+               }\r
+               \r
+               // if $files is string\r
+               return file_exists($DIR_PLUGINS . 'paint/applet' . $files);\r
+       }\r
+               \r
+       function getPageTemplate($vars = null){\r
+               return '';\r
+       }\r
+       \r
+       function getHeaderPart(){\r
+               return '';\r
+       }\r
+       \r
+       function getParamPart(){\r
+               return '';\r
+       }\r
+       \r
+       function getCopyrightsPart(){\r
+               return '';\r
+       }\r
+\r
+       function getBeforeAppletPart(){\r
+               return '';      \r
+       }\r
+       \r
+       function getAfterAppletPart(){\r
+               return '';\r
+       }\r
+       \r
+       function getExtraOption(){\r
+               return '';      \r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Palette_None.php b/trunk/NP_Paint/paint/Palette_None.php
new file mode 100644 (file)
index 0000000..119e919
--- /dev/null
@@ -0,0 +1,48 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Palette_None.php ($Revision: 1.9 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Palette_None.php,v 1.9 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Palette_None extends PaintPlugin {\r
+       function Palette_None(){\r
+               $this->id = '$Id: Palette_None.php,v 1.9 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'Palette-None';\r
+               \r
+               $this->enable = true;\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Palette_Selfy.php b/trunk/NP_Paint/paint/Palette_Selfy.php
new file mode 100644 (file)
index 0000000..3d9bedd
--- /dev/null
@@ -0,0 +1,80 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Palette_Selfy.php ($Revision: 1.17 $)\r
+  * for palette_selfy.js 2004/04/11\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Palette_Selfy.php,v 1.17 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Palette_Selfy extends PaintPlugin {\r
+       function getName(){\r
+               return 'palette-selfy ' . _PAINT_Palette;\r
+       }\r
+       \r
+       function Palette_Selfy(){\r
+               $this->id = '$Id: Palette_Selfy.php,v 1.17 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'Palette-Selfy';\r
+               \r
+               $requiredFiles = Array('palette_selfy.js');\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+       }\r
+\r
+       function getCopyrightsPart(){\r
+       return <<<END\r
+<a href="http://useyan.x0.com/s/cgi/relm/palette_selfy.html">Palette-Selfy</a> by <a href="http://roo.to/materia/">Snow Materia</a>\r
+( /w Palette_Selfy Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />\r
+END;\r
+       }\r
+       \r
+       function getHeaderPart(){\r
+       return <<<END\r
+<script type="text/javascript" src="{$this->appletBaseUrl}palette_selfy.js" charset="shift_jis"></script>\r
+END;\r
+       }\r
+       \r
+       function getAfterAppletPart(){\r
+       return <<<END\r
+<div style="width: 100px;">\r
+<script type="text/javascript" charset="shift_jis">\r
+<!--\r
+palette_selfy();\r
+//-->\r
+</script>\r
+</div>\r
+END;\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Palette_WCS.php b/trunk/NP_Paint/paint/Palette_WCS.php
new file mode 100644 (file)
index 0000000..4db0603
--- /dev/null
@@ -0,0 +1,111 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Palette_WCS.php ($Revision: 1.39 $)\r
+  * for WCS DynPalette 2003/06/22\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Palette_WCS.php,v 1.39 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Palette_WCS extends PaintPlugin {\r
+       function getName(){\r
+               return 'WCS DynPalette ' . _PAINT_Palette;\r
+       }\r
+       \r
+       function Palette_WCS(){\r
+               $this->id = '$Id: Palette_WCS.php,v 1.39 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'WCS DynPalette';\r
+               \r
+               $requiredFiles = Array('palette.js');\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+       }\r
+\r
+       function getCopyrightsPart(){\r
+               return <<<END\r
+<a href="http://wondercatstudio.com/archive/">WCS DynPalette</a> by <a href="http://wondercatstudio.com/">WonderCatStudio</a>\r
+( /w Palette_WCS Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />\r
+END;\r
+       }\r
+       \r
+       function getBeforeAppletPart(){\r
+               if (strstr($_SERVER['HTTP_USER_AGENT'], "Macintosh")) {\r
+                       return '<br /><br />';\r
+               }\r
+               return '';\r
+       }\r
+       \r
+       function getHeaderPart(){\r
+               return <<<END\r
+<script type="text/javascript" charset="shift_jis" src="{$this->appletBaseUrl}palette.js"></script>\r
+END;\r
+       }\r
+       \r
+       function getAfterAppletPart(){\r
+               if( $pidx = requestVar('pidx') ){\r
+                       return <<<END\r
+<div style="width: 100px;">\r
+<script type="text/javascript">\r
+<!--\r
+PaletteInit();\r
+d = document\r
+d.Palette.select.selectedIndex = $pidx\r
+setTimeout("setPalette()", 2000)\r
+function paintBBSCallback(value){\r
+if(value=="start"){\r
+       setPalette()\r
+}\r
+}\r
+//-->\r
+</script>\r
+END;\r
+               }\r
+               return <<<END\r
+<div style="width: 100px;">\r
+<script type="text/javascript">\r
+<!--\r
+TableLineColor = "#222222";\r
+FontColor      = "#222222";\r
+PaletteInit();\r
+//-->\r
+</script>\r
+</div>\r
+END;\r
+       }\r
+       \r
+       function getExtraOption(){\r
+               return $this->template->fetch('extraoption', strtolower(__CLASS__));\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Parser_PaintBBS.php b/trunk/NP_Paint/paint/Parser_PaintBBS.php
new file mode 100644 (file)
index 0000000..3a94922
--- /dev/null
@@ -0,0 +1,145 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Parser_PaintBBS.php ($Revision: 1.33 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Parser_PaintBBS.php,v 1.33 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Parser_PaintBBS extends PaintPlugin {\r
+       function Parser_PaintBBS(){\r
+               $this->id = '$Id: Parser_PaintBBS.php,v 1.33 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'PaintBBS Parser';\r
+               $this->enable = true;\r
+               $this->offset = 0;\r
+               $this->postdata = null;\r
+       }\r
+       \r
+       function _read($length, &$err){\r
+               $data = substr( $this->postdata, $this->offset, $length );\r
+               $this->offset += strlen($data);\r
+               $err = false;\r
+               if( strlen($data) != $length ) $err = true;\r
+               return $data;\r
+       }\r
+                       \r
+       function parse(){\r
+               global $manager;\r
+               $plugin = $manager->getPlugin('NP_Paint');\r
+\r
+               ini_set("always_populate_raw_post_data", "1");\r
+               global $HTTP_RAW_POST_DATA;\r
+               $this->postdata = $HTTP_RAW_POST_DATA;;\r
+               \r
+               if(! $this->postdata ){\r
+                       $plugin->_info(_PAINT_Parser_useinput);\r
+                       if( $_SERVER['CONTENT_LENGTH'] ) $length = $_SERVER['CONTENT_LENGTH'];\r
+                       if( $_ENV['CONTENT_LENGTH'] ) $length = $_ENV['CONTENT_LENGTH'];\r
+                       $input = fopen("php://input", "rb");\r
+                       if( $length ){\r
+                               $this->postdata = fread($input, $length);\r
+                       } else {\r
+                               $plugin->_warn(_PAINT_Parser_contentLengthNotFound);\r
+                               while (!feof($input)) {\r
+                                 $this->postdata .= fread($input, 8192);\r
+                               }\r
+                       }\r
+                       fclose($input);\r
+               }\r
+                               \r
+               //TODO: debug\r
+/*\r
+               $test = fopen("/tmp/postdata.dat","wb");\r
+               fwrite($test, $this->postdata);\r
+               fclose($test);\r
+               $plugin->_info('post length: ' . strlen($this->postdata) );\r
+*/\r
+\r
+               $data = Array(\r
+                       'magic' => null,\r
+                       'header' => null,\r
+                       'images' => Array(),\r
+                       'size' => Array(),\r
+               );\r
+               $err = false;\r
+               \r
+               // magic char\r
+               $data['magic'] = $this->_read(1, $err);\r
+               if($err) return 'Cannot read magic char';\r
+               if( $data['magic'] == chr(0x00) ) return 'magic char is INVALID. (maybe poo=true?) ->' . $data['magic'];\r
+               $plugin->_info('post magic: ' . $data['magic'] );\r
+\r
+               // header\r
+               $headerSize = $this->_read(8, $err);\r
+               if($err) return 'Cannot read header size';\r
+               if( ! is_numeric($headerSize) ) return 'Header size is INVALID';\r
+               \r
+               $data['header'] = $this->_read(intval($headerSize), $err);\r
+               if($err) return 'Cannot read header';\r
+               \r
+               // image\r
+               $imageSize = $this->_read(8, $err);\r
+               if($err) return 'Cannot read image size';\r
+               if( ! is_numeric($imageSize) ) return 'Image size is INVALID';\r
+               \r
+               $pad = $this->_read(2, $err);// '\r\n'\r
+               if($err) return 'Cannot read padding';\r
+               if(! $pad === "\r\n" ) return 'Cannot find padding';\r
+\r
+               $imageData = $this->_read(intval($imageSize), $err);\r
+               if($err) return 'Cannot read image ' . "(expected: $imageSize, actual:" . strlen($imageData) . ")";\r
+               $plugin->_info("ImageSize (expected: $imageSize, actual:" . strlen($imageData) . ")");\r
+               \r
+               $data['images'][] = $imageData;\r
+               $data['size'][] = strlen($imageData);\r
+\r
+               // thumb\r
+               while(true){\r
+                       $thumbSize = $this->_read(8, $err);\r
+                       if($err) break;\r
+                       if( ! is_numeric($thumbSize) ) break;\r
+                       \r
+                       if( $thumbSize != 0 ){\r
+                               $imageData = $this->_read($thumbSize, $err);\r
+                               if($err) break;\r
+                               $data['images'][] = $imageData;\r
+                               $data['size'][] = strlen($imageData);\r
+                               $plugin->_info("AnimeSize (expected: $thumbSize, actual:" . strlen($imageData) . ")");\r
+                       }\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Viewer_Continue.php b/trunk/NP_Paint/paint/Viewer_Continue.php
new file mode 100644 (file)
index 0000000..f3af351
--- /dev/null
@@ -0,0 +1,84 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Viewer_Continue ($Revision: 1.32 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Viewer_Continue.php,v 1.32 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Viewer_Continue extends PaintPlugin {\r
+\r
+       function Viewer_Continue(){\r
+               $this->id = '$Id: Viewer_Continue.php,v 1.32 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'paint continue';\r
+               $this->animeExt = Array();\r
+               $this->enable = true;\r
+               \r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+       }\r
+                       \r
+       function getPageTemplate($vars = null){\r
+               global $CONF, $manager;\r
+               $plugin = $manager->getPlugin('NP_Paint');\r
+               \r
+               list($animeFile, $appletName) = $plugin->findAppletByImg($vars['file']);\r
+               $fileInfo = $plugin->getFileInfo($animeFile);\r
+               \r
+               $vars['charset'] = _CHARSET;\r
+               $vars['mediaurl'] = $CONF['MediaURL'];\r
+               $vars['actionurl'] = $CONF['ActionURL'];\r
+               $vars['quality'] = $fileInfo['quality'];\r
+               \r
+               $vars['appletTag'] = $plugin->_getAppletSelect($appletName);\r
+               $vars['paletteTag'] = $plugin->_getPaletteSelect();\r
+               $vars['paletteExtraTag'] = $plugin->_getPaletteSelectExtra();\r
+               $vars['animation'] = ($plugin->getOption('defaultAnimation') == 'yes') ? 'checked' : '';\r
+               \r
+               if( $fileInfo ){\r
+                       foreach ($fileInfo as $key => $value){\r
+                               $animeInfo .= "&nbsp;&nbsp;* $key: $value<br />";\r
+                       }\r
+               } else {\r
+                       $animeInfo = '<em>'. _PAINT_Viewer_infoNotFond .'</em>';\r
+               }\r
+               $vars['animeInfo'] = $animeInfo;\r
+               \r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));           \r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Viewer_Pch.php b/trunk/NP_Paint/paint/Viewer_Pch.php
new file mode 100644 (file)
index 0000000..4849a2f
--- /dev/null
@@ -0,0 +1,78 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Viewer_Pch ($Revision: 1.17 $)\r
+  * for pchview_115\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Viewer_Pch.php,v 1.17 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+\r
+class Viewer_Pch extends PaintPlugin {\r
+       function getName(){\r
+               return 'PCH Viewer ' . _PAINT_Viewer_pch_desc;\r
+       }\r
+\r
+       function Viewer_Pch(){\r
+               $this->id = '$Id: Viewer_Pch.php,v 1.17 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'pch viewer';\r
+\r
+               $this->animeExt = Array(\r
+                       'pch',\r
+               );\r
+\r
+               $requiredFiles = Array(\r
+                       'PCHViewer.jar', \r
+                       'res/res.zip', \r
+                       'res/tt.zip',\r
+               );\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+               \r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+       }\r
+               \r
+       function getPageTemplate($vars = null){\r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));\r
+               \r
+               global $CONF;\r
+               $this->templatevars['MediaURL'] = $CONF['MediaURL'];\r
+               $this->templatevars['ActionURL'] = $CONF['ActionURL'];\r
+               $this->templatevars['PluginURL'] = $CONF['PluginURL'];\r
+               $this->templatevars['appletBaseUrl'] = $this->appletBaseUrl;\r
+               \r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/Viewer_Spch.php b/trunk/NP_Paint/paint/Viewer_Spch.php
new file mode 100644 (file)
index 0000000..55eab38
--- /dev/null
@@ -0,0 +1,78 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Viewer_Spch ($Revision: 1.14 $)\r
+  * for pchview_115\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Viewer_Spch.php,v 1.14 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class Viewer_Spch extends PaintPlugin {\r
+       function getName(){\r
+               return 'SPCH Viewer ' . _PAINT_Viewer_spch_desc;\r
+       }\r
+\r
+       function Viewer_Spch(){\r
+               $this->id = '$Id: Viewer_Spch.php,v 1.14 2010/06/06 11:44:19 hsur Exp $';\r
+               $this->name = 'spch viewer';\r
+\r
+               $this->animeExt = Array(\r
+                       'spch',\r
+                       'rpch',\r
+               );\r
+\r
+               $requiredFiles = Array(\r
+                       'PCHViewer.jar', \r
+                       'res/res.zip', \r
+                       'res/tt.zip',\r
+               );\r
+               $this->enable = $this->isFileInstalled($requiredFiles);\r
+\r
+               $this->templatevars['id'] = $this->id;\r
+               $this->templatevars['name'] = $this->name;\r
+       }\r
+               \r
+       function getPageTemplate($vars = null){\r
+               $tpl = $this->template->fetch('pagetemplate', strtolower(__CLASS__));\r
+               \r
+               global $CONF;\r
+               $this->templatevars['MediaURL'] = $CONF['MediaURL'];\r
+               $this->templatevars['ActionURL'] = $CONF['ActionURL'];\r
+               $this->templatevars['PluginURL'] = $CONF['PluginURL'];\r
+               $this->templatevars['appletBaseUrl'] = $this->appletBaseUrl;\r
+               \r
+               $vars = array_merge((array)$vars, $this->templatevars);         \r
+               return $this->template->fill($tpl, $vars, false);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/paint/applet/index.html b/trunk/NP_Paint/paint/applet/index.html
new file mode 100644 (file)
index 0000000..b361191
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+       <title>NP_Paint - Nothing Here</title>\r
+</head>\r
+<body>\r
+\r
+<h1>NP_Paint - Nothing to see here</h1>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/applet/readme.txt b/trunk/NP_Paint/paint/applet/readme.txt
new file mode 100644 (file)
index 0000000..0547359
--- /dev/null
@@ -0,0 +1,17 @@
+Applet ディレクトリ\r
+-----------------------\r
+\r
+このディレクトリに、外部ファイルを展開してアップロードします。\r
+\r
+1.お絵かきアプレット(※必須)\r
+\r
+◆PaintBBS、しぃペインター複数ファイル版\r
+ http://shichan.jp/\r
+\r
+2.動的パレット用JavaScript\r
+\r
+◆WCS 動的パレットコントロールセット(DynPalette)\r
+ http://wondercatstudio.com/archive/\r
+\r
+◆palette_selfy\r
+ http://useyan.x0.com/s/cgi/relm/palette_selfy.html
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/help.html b/trunk/NP_Paint/paint/help.html
new file mode 100644 (file)
index 0000000..336d4c9
--- /dev/null
@@ -0,0 +1 @@
+help -> paint/template/index/help_japanese-utf8.html
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/index.php b/trunk/NP_Paint/paint/index.php
new file mode 100644 (file)
index 0000000..e9b0abe
--- /dev/null
@@ -0,0 +1,240 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * index.php ($Revision: 1.99 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: index.php,v 1.99 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+define('PAINT_INI_URL',        'http://blog.cles.jp/support/paint.ini');\r
+define('PAINT_PLUGIN_DIR',     dirname(__FILE__)."/applet");\r
+\r
+$strRel = '../../../';\r
+include ($strRel.'config.php');\r
+include ($DIR_LIBS.'PLUGINADMIN.php');\r
+\r
+require_once($DIR_PLUGINS . 'sharedlibs/sharedlibs.php');\r
+require_once('cles/Feedback.php');\r
+require_once('cles/Template.php');\r
+require_once('pclzip.lib.php');\r
+\r
+if ($blogid) {\r
+       $isblogadmin = $member->isBlogAdmin($blogid);\r
+} else\r
+       $isblogadmin = 0;\r
+\r
+if (!$member->isLoggedIn()) {\r
+       $oPluginAdmin = new PluginAdmin('Paint');\r
+       $oPluginAdmin->start();\r
+       echo '<p>' . _PAINT_NeedLogin . '</p>';\r
+       $oPluginAdmin->end();\r
+       exit;\r
+}\r
+\r
+if (!($member->isAdmin() || $isblogadmin)) {\r
+       $oPluginAdmin = new PluginAdmin('Paint');\r
+       $oPluginAdmin->start();\r
+       echo "<p>"._ERROR_DISALLOWED."</p>";\r
+       $oPluginAdmin->end();\r
+       exit;\r
+}\r
+\r
+$action = requestVar('action');\r
+$aActionsNotToCheck = array(\r
+       '',\r
+       'report',\r
+);\r
+if (!in_array($action, $aActionsNotToCheck)) {\r
+       if (!$manager->checkTicket()) doError(_ERROR_BADTICKET);\r
+}\r
+\r
+// create the admin area page\r
+$oPluginAdmin = new PluginAdmin('Paint');\r
+$oPluginAdmin->start();\r
+$fb =& new cles_Feedback($oPluginAdmin);\r
+\r
+$templateEngine =& new cles_Template(dirname(__FILE__).'/template');\r
+define('NP_PAINT_TEMPLATEDIR_INDEX', 'index');\r
+$tplVars = array(\r
+       'indexurl' => serverVar('PHP_SELF'),\r
+       'optionurl' => $CONF['AdminURL'] . 'index.php?action=pluginoptions&amp;plugid=' . $oPluginAdmin->plugin->getid(),\r
+       'paintiniurl' => PAINT_INI_URL,\r
+       'paintplugindir' => PAINT_PLUGIN_DIR,\r
+       'ticket' => $manager->_generateTicket(),\r
+);\r
+\r
+// get the plugin options; stored in the DB\r
+//$pbl_config['enabled']       = $oPluginAdmin->plugin->getOption('enabled');\r
+\r
+// menu\r
+$menu = $templateEngine->fetch('menu', NP_PAINT_TEMPLATEDIR_INDEX);\r
+echo $templateEngine->fill($menu, $tplVars, false);\r
+\r
+//action\r
+switch ($action) {\r
+       case 'help' :\r
+               echo $templateEngine->fetch('help', NP_PAINT_TEMPLATEDIR_INDEX);\r
+               break;\r
+               \r
+       case 'install' :\r
+               if( requestVar('func') == 'ini' ){\r
+                       $err = paint_plugin_download( PAINT_INI_URL, PAINT_PLUGIN_DIR);\r
+                       if($err){\r
+                               echo '<h3>Error: ' . _PAINT_canNotReadFile . ':' .PAINT_INI_URL . '</h3>';\r
+                               echo '<h4>Reason: '.$err.'</h4>';\r
+                               break;\r
+                       }\r
+               }\r
+               \r
+               echo "<h2>"._PAINT_iniDownload."</h2>";\r
+               echo "<ul>\n";\r
+               echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=install&func=ini"),ENT_QUOTES)."\">"._PAINT_doDownload."</a></li>\n";\r
+               echo "</ul>\n";\r
+\r
+               if( ! is_readable(PAINT_PLUGIN_DIR . '/paint.ini') )\r
+                       break;\r
+               \r
+               $settings = parse_ini_file(PAINT_PLUGIN_DIR . '/paint.ini', true);\r
+               if( ! $settings ){\r
+                       echo '<h3>Error: ' . _PAINT_canNotReadFile . ': ' .PAINT_INI_URL . '</h3>';\r
+                       break;\r
+               }\r
+               \r
+               echo '<h2>' . _PAINT_appletinstall. "( {$settings['paint']['version']}[{$settings['paint']['updated']}] )</h2>";\r
+\r
+               if ($pluginName = getVar('plugin')) {\r
+                       $oPluginAdmin->plugin->_loadPlugin();\r
+                       $plugin = $oPluginAdmin->plugin->disabledPlugin[$pluginName];\r
+\r
+                       if ($plugin) {\r
+                               $zipurl = $settings[$pluginName]['zip'];\r
+                               if($zipurl)\r
+                                       echo paint_plugin_install($zipurl);\r
+                               else\r
+                                       echo '<h3>Error:' ._PAINT_canNotAutoInstall . '</h3>';\r
+\r
+                               } else {\r
+                               echo '<h3>Error:'. _PAINT_noSuchPlugin . '</h3>';\r
+                       }\r
+               }\r
+\r
+               $oPluginAdmin->plugin->_loadPlugin(false, true);\r
+               ksort($oPluginAdmin->plugin->disabledPlugin);\r
+\r
+               echo '<h3>'._PAINT_autoInstall.'</h3>';\r
+               echo "<ul>\n";\r
+               foreach ($oPluginAdmin->plugin->disabledPlugin as $key => $plugin) {\r
+                       if ( $settings[$key]['zip'] )\r
+                               echo "<li><a href=\"".htmlspecialchars($manager->addTicketToUrl(serverVar('PHP_SELF')."?action=install&plugin=".$key),ENT_QUOTES)."\">".$plugin->getName()._PAINT_installSuffix."</a></li>\n";\r
+                       elseif ( $settings[$key]['file'] )\r
+                               echo "<li><em>".$plugin->getName(). _PAINT_canNotAutoInstall ."<br /><a href=\"{$settings[$key]['file']}\">{$settings[$key]['file']}</a>"._PAINT_downloadSuffix."</em></li>\n";\r
+                       else\r
+                               echo "<li><em>".$plugin->getName(). _PAINT_canNotAutoInstall . "</em></li>\n";\r
+               }\r
+               echo "</ul>\n";\r
+\r
+               break;\r
+\r
+       case 'report' :\r
+               $oPluginAdmin->plugin->_loadPlugin();\r
+               $extra = '';\r
+               foreach ($oPluginAdmin->plugin->parsers as $key => $name) {\r
+                       $extra .= 'parser_'.$key.', ';\r
+               }\r
+               foreach ($oPluginAdmin->plugin->applets as $key => $name) {\r
+                       $extra .= 'applet_'.$key.', ';\r
+               }\r
+               foreach ($oPluginAdmin->plugin->palettes as $key => $name) {\r
+                       $extra .= 'palette_'.$key.', ';\r
+               }\r
+               foreach ($oPluginAdmin->plugin->viewers as $key => $name) {\r
+                       $extra .= 'viewer_'.$key.', ';\r
+               }\r
+               $fb->printForm($extra);\r
+\r
+               break;\r
+\r
+       default :\r
+               break;\r
+}\r
+\r
+echo "<br />";\r
+\r
+$oPluginAdmin->end();\r
+\r
+function paint_plugin_install($url) {\r
+       $err = paint_plugin_download($url, PAINT_PLUGIN_DIR);\r
+       if ($err)\r
+               return $err;\r
+\r
+       $file = PAINT_PLUGIN_DIR . '/' . basename($url);\r
+       $err = paint_plugin_extract($file, PAINT_PLUGIN_DIR);\r
+\r
+       return $err;\r
+}\r
+\r
+function paint_plugin_extract($file, $dir) {\r
+       $archive = new PclZip($file);\r
+       if ($archive->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_SET_CHMOD, 0777) == 0) {\r
+               return $archive->errorInfo(true);\r
+       }\r
+       return '';\r
+}\r
+\r
+function paint_plugin_download($url, $dir) {\r
+       if (!@ is_writable($dir) || !@ is_dir($dir)) {\r
+               return _Paint_directoryNotWriteable . $dir;\r
+       }\r
+\r
+       $remote = fopen($url, "rb");\r
+       socket_set_timeout($remote, 10);\r
+       if (!$remote)\r
+               return _PAINT_fileOpen_failure . ': '.$url;\r
+\r
+       $file = $dir.'/'.basename($url);\r
+       $local = fopen($file, "wb");\r
+       socket_set_timeout($local, 5);\r
+       if (!$local)\r
+               return _PAINT_fileOpen_failure . ': '.$file;\r
+\r
+       while (!feof($remote)) {\r
+               $buffer = fgets($remote, 4096);\r
+               fputs($local, $buffer);\r
+       }\r
+\r
+       fclose($remote);\r
+       fclose($local);\r
+\r
+       return '';\r
+}\r
diff --git a/trunk/NP_Paint/paint/language/japanese-euc.php b/trunk/NP_Paint/paint/language/japanese-euc.php
new file mode 100644 (file)
index 0000000..11d00ae
--- /dev/null
@@ -0,0 +1,76 @@
+<?php \r
+\r
+// plugin description\r
+define('_PAINT_defaultWidth', '¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(Éý)');             \r
+define('_PAINT_defaultHeight', '¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(¹â¤µ)');          \r
+define('_PAINT_defaultAnimation', 'Æ°²è¥Õ¥¡¥¤¥ë¤òÊݸ¤¹¤ë¤«¡©');               \r
+define('_PAINT_defaultApplet', '¥Ç¥Õ¥©¥ë¥ÈApplet');\r
+define('_PAINT_defaultPalette', '¥Ç¥Õ¥©¥ë¥ÈPalette');\r
+define('_PAINT_defaultImgType', '¥Ç¥Õ¥©¥ë¥È¤Î²èÁü·Á¼°');\r
+define('_PAINT_defaultImgCompress', '²èÁü·Á¼°¤¬AUTO¤Î¾ì¹ç¤Î¸º¿§¡¦°µ½ÌΨ[0-100]');              \r
+define('_PAINT_defaultImgDecrease', '²èÁü·Á¼°¤¬AUTO¤Î¾ì¹ç¤Ë¸º¿§¤¬Í­¸ú¤Ë¤Ê¤ëïçÃÍ[KB](ÍøÍѤ·¤Ê¤¤¾ì¹ç¤Ï0)');              \r
+define('_PAINT_defaultImgQuality', '²èÁü·Á¼°¤¬JPG¤Î¾ì¹ç¤Î²èÁüÉʼÁ[0-100]');            \r
+define('_PAINT_defaultAppletQuality', '¥Ç¥Õ¥©¥ë¥È¤ÎQuality(¤·¤£¥Ú¥¤¥ó¥¿¡¼¤Î¤ß)');\r
+define('_PAINT_bodyTpl', 'ËÜʸ¥Æ¥ó¥×¥ì¡¼¥È');\r
+define('_PAINT_tagTpl', 'Paint¥¿¥°¥Æ¥ó¥×¥ì¡¼¥È');\r
+define('_PAINT_imageTpl', '²èÁüÉô¥Æ¥ó¥×¥ì¡¼¥È');\r
+define('_PAINT_continueTpl', 'ContinueÉô¥Æ¥ó¥×¥ì¡¼¥È');\r
+define('_PAINT_debug', '¥í¥°¤ò½ÐÎϤò¹Ô¤¦¤«¡©');\r
+\r
+// log message\r
+define('_PAINT_DESCRIPTION',                   '¤ª³¨¤«¤­¥¢¥×¥ì¥Ã¥È¤È¤ÎÏ¢·È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£¾Ü¤·¤¯¤Ï¥Ø¥ë¥×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£');\r
+define('_PAINT_HeadersAlreadySent'.            '¥Ø¥Ã¥À¤Ï¤¹¤Ç¤ËÁ÷¿®¤µ¤ì¤Æ¤¤¤Þ¤¹');\r
+define('_PAINT_NeedLogin',                             '¥í¥°¥¤¥ó¤¬É¬ÍפǤ¹');\r
+define('_PAINT_UserNotFound',                  '¥æ¡¼¥¶¡¼¤¬Â¸ºß¤·¤Þ¤»¤ó');\r
+define('_PAINT_InvalidTicket',                 '¥Á¥±¥Ã¥È¤¬Í­¸ú¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£Åê¹Æ²èÌ̱¦²¼¤Î¡Ö¥Á¥±¥Ã¥È¤ò¹¹¿·¤¹¤ë¡×¤ò¼Â¹Ô¤·¤Æ¤«¤éºÆÅÙÅê¹Æ¤·¤Æ¤¯¤À¤µ¤¤¡£');\r
+define('_PAINT_phpVersion_before',             'NP_Paint¤Ë¤ÏPHP');\r
+define('_PAINT_phpVersion_after',              '°Ê¹ß¤¬É¬ÍפǤ¹');\r
+define('_PAINT_illegalCollection',             'ÉÔÀµ¤ÊCollection¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤¹');\r
+define('_PAINT_canNotFindApplet',              'Applet¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó');\r
+define('_PAINT_fileIsNotSet',                  '¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó');\r
+define('_PAINT_viewerIsNotSet',                        '¥Ó¥å¥¢¡¼¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó');\r
+define('_PAINT_canNotFindViewer',              '¥Ó¥å¥¢¡¼¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó');\r
+define('_PAINT_canNotReadFile',                        '¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤á¤Þ¤»¤ó');\r
+define('_PAINT_canNotFindPrefix',              'Prefix¤¬¸«¤Ä¤«¤é¤Ê¤¤¤Î¤ÇÀ¸À®¤·¤Þ¤¹');\r
+define('_PAINT_deleteFile',                            '¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Þ¤¹');\r
+define('_PAINT_deleteFile_failure',            '¥Õ¥¡¥¤¥ë¤Îºï½ü¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+define('_PAINT_rename_failure',                        'tmpfile¤Î¥ê¥Í¡¼¥à¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+define('_PAINT_rename_ok',                             'tmpfile¤ò¥ê¥Í¡¼¥à¤·¤Þ¤·¤¿');\r
+define('_PAINT_GDNotSupported',                        'PHP¤ÇGD¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£²èÁüÊÑ´¹¤ò¥¹¥­¥Ã¥×¤·¤Þ¤¹');\r
+define('_PAINT_convertToJpg',                  '²èÁü¤òJPG¤ËÊÑ´¹¤·¤Þ¤¹');\r
+define('_PAINT_convertToJpg_succeeded',        '²èÁü¤ÎJPGÊÑ´¹¤ËÀ®¸ù¤·¤Þ¤·¤¿');\r
+define('_PAINT_convertToJpg_failure',  '²èÁü¤ÎJPGÊÑ´¹¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+define('_PAINT_pngRead_failure',               'PNG²èÁü¤ÎÆɤ߹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+define('_PAINT_canNotLoadClass',               '¥¯¥é¥¹¤Î¥í¡¼¥É¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+\r
+define('_PAINT_STAR',                                  '¡ú');\r
+\r
+// index.php\r
+define('_Paint_directoryNotWriteable', '¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢½ñ¤­¹þ¤ß²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó: ');\r
+define('_PAINT_fileOpen_failure',              '¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó¤Ë¼ºÇÔ¤·¤Þ¤·¤¿');\r
+define('_PAINT_canNotAutoInstall',             '¤³¤Îµ¡Ç½¤Ï¼«Æ°¥¤¥ó¥¹¥È¡¼¥ë¤Ç¤­¤Þ¤»¤ó');\r
+define('_PAINT_autoInstall',                   '¥¤¥ó¥¹¥È¡¼¥ë²Äǽ¤ÊApplet/Palette/¤½¤Î¾');\r
+define('_PAINT_noSuchPlugin',                  '¤½¤Î¤è¤¦¤Ê¥×¥é¥°¥¤¥ó¤Ï¤¢¤ê¤Þ¤»¤ó');\r
+define('_PAINT_appletinstall',                 'Applet/Palette¤Î¥¤¥ó¥¹¥È¡¼¥ë');\r
+define('_PAINT_iniDownload',                   'ÀßÄê¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É');\r
+define('_PAINT_doDownload',                            '¼«Æ°¥¤¥ó¥¹¥È¡¼¥ë¤ËɬÍפÊÀßÄê¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É');\r
+define('_PAINT_installSuffix',                 '¤Î¥¤¥ó¥¹¥È¡¼¥ë');\r
+define('_PAINT_downloadSuffix',                        '¤«¤é¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æ¥µ¡¼¥Ð¤ËÇÛÃÖ¤·¤Æ¤¯¤À¤µ¤¤');\r
+\r
+// Applet\r
+define('_PAINT_Applet',        '(¤ª³¨¤«¤­Applet)');\r
+define('_PAINT_Applet_PaintBBS_name',  'PaintBBS');\r
+define('_PAINT_Applet_Shipainter_name',        '¤·¤£¥Ú¥¤¥ó¥¿¡¼');\r
+define('_PAINT_Applet_Shipainterpro_name',     '¤·¤£¥Ú¥¤¥ó¥¿¡¼Pro');\r
+\r
+// Palette\r
+define('_PAINT_Palette',       '(ưŪ¥Ñ¥ì¥Ã¥È)');\r
+\r
+// Parser\r
+define('_PAINT_Parser_useinput',                               'php://input¤òÍøÍѤ·¤Æ¥Ç¡¼¥¿¤ò¼èÆÀ¤·¤Þ¤¹');\r
+define('_PAINT_Parser_contentLengthNotFound',  'CONTENT_LENGTH¤¬¼èÆÀ¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¤¬Â³¹Ô¤·¤Þ¤¹');\r
+\r
+// Viewer\r
+define('_PAINT_Viewer_infoNotFond',    '¾ðÊó¤Ï¤¢¤ê¤Þ¤»¤ó');\r
+define('_PAINT_Viewer_spch_desc',      '(¤·¤£¥Ú¥¤¥ó¥¿¡¼¤Î¥¢¥Ë¥á¡¼¥·¥ç¥óºÆÀ¸)');\r
+define('_PAINT_Viewer_pch_desc',       '(PaintBBS¤Î¥¢¥Ë¥á¡¼¥·¥ç¥óºÆÀ¸)');\r
diff --git a/trunk/NP_Paint/paint/language/japanese-utf8.php b/trunk/NP_Paint/paint/language/japanese-utf8.php
new file mode 100644 (file)
index 0000000..9730dbd
--- /dev/null
@@ -0,0 +1,76 @@
+<?php \r
+\r
+// plugin description\r
+define('_PAINT_defaultWidth', 'デフォルトのキャンバスサイズ(幅)');              \r
+define('_PAINT_defaultHeight', 'デフォルトのキャンバスサイズ(高さ)');          \r
+define('_PAINT_defaultAnimation', '動画ファイルを保存するか?');          \r
+define('_PAINT_defaultApplet', 'デフォルトApplet');\r
+define('_PAINT_defaultPalette', 'デフォルトPalette');\r
+define('_PAINT_defaultImgType', 'デフォルトの画像形式');\r
+define('_PAINT_defaultImgCompress', '画像形式がAUTOの場合の減色・圧縮率[0-100]');               \r
+define('_PAINT_defaultImgDecrease', '画像形式がAUTOの場合に減色が有効になる閾値[KB](利用しない場合は0)');           \r
+define('_PAINT_defaultImgQuality', '画像形式がJPGの場合の画像品質[0-100]');               \r
+define('_PAINT_defaultAppletQuality', 'デフォルトのQuality(しぃペインターのみ)');\r
+define('_PAINT_bodyTpl', '本文テンプレート');\r
+define('_PAINT_tagTpl', 'Paintタグテンプレート');\r
+define('_PAINT_imageTpl', '画像部テンプレート');\r
+define('_PAINT_continueTpl', 'Continue部テンプレート');\r
+define('_PAINT_debug', 'ログを出力を行うか?');\r
+\r
+// log message\r
+define('_PAINT_DESCRIPTION',                   'お絵かきアプレットとの連携ができるようにします。詳しくはヘルプを参照してください。');\r
+define('_PAINT_HeadersAlreadySent'.            'ヘッダはすでに送信されています');\r
+define('_PAINT_NeedLogin',                             'ログインが必要です');\r
+define('_PAINT_UserNotFound',                  'ユーザーが存在しません');\r
+define('_PAINT_InvalidTicket',                 'チケットが有効ではありません。投稿画面右下の「チケットを更新する」を実行してから再度投稿してください。');\r
+define('_PAINT_phpVersion_before',             'NP_PaintにはPHP');\r
+define('_PAINT_phpVersion_after',              '以降が必要です');\r
+define('_PAINT_illegalCollection',             '不正なCollectionが指定されています');\r
+define('_PAINT_canNotFindApplet',              'Appletが見つかりません');\r
+define('_PAINT_fileIsNotSet',                  'ファイルが指定されていません');\r
+define('_PAINT_viewerIsNotSet',                        'ビュアーが指定されていません');\r
+define('_PAINT_canNotFindViewer',              'ビュアーが見つかりません');\r
+define('_PAINT_canNotReadFile',                        'ファイルを読み込めません');\r
+define('_PAINT_canNotFindPrefix',              'Prefixが見つからないので生成します');\r
+define('_PAINT_deleteFile',                            'ファイルを削除します');\r
+define('_PAINT_deleteFile_failure',            'ファイルの削除に失敗しました');\r
+define('_PAINT_rename_failure',                        'tmpfileのリネームに失敗しました');\r
+define('_PAINT_rename_ok',                             'tmpfileをリネームしました');\r
+define('_PAINT_GDNotSupported',                        'PHPでGDがサポートされていません。画像変換をスキップします');\r
+define('_PAINT_convertToJpg',                  '画像をJPGに変換します');\r
+define('_PAINT_convertToJpg_succeeded',        '画像のJPG変換に成功しました');\r
+define('_PAINT_convertToJpg_failure',  '画像のJPG変換に失敗しました');\r
+define('_PAINT_pngRead_failure',               'PNG画像の読み込みに失敗しました');\r
+define('_PAINT_canNotLoadClass',               'クラスのロードに失敗しました');\r
+\r
+define('_PAINT_STAR',                                  '★');\r
+\r
+// index.php\r
+define('_Paint_directoryNotWriteable', 'ディレクトリが存在しないか、書き込み可能になっていません: ');\r
+define('_PAINT_fileOpen_failure',              'ファイルのオープンに失敗しました');\r
+define('_PAINT_canNotAutoInstall',             'この機能は自動インストールできません');\r
+define('_PAINT_autoInstall',                   'インストール可能なApplet/Palette/その他');\r
+define('_PAINT_noSuchPlugin',                  'そのようなプラグインはありません');\r
+define('_PAINT_appletinstall',                 'Applet/Paletteのインストール');\r
+define('_PAINT_iniDownload',                   '設定ファイルのダウンロード');\r
+define('_PAINT_doDownload',                            '自動インストールに必要な設定ファイルをダウンロード');\r
+define('_PAINT_installSuffix',                 'のインストール');\r
+define('_PAINT_downloadSuffix',                        'からファイルをダウンロードしてサーバに配置してください');\r
+\r
+// Applet\r
+define('_PAINT_Applet',        '(お絵かきApplet)');\r
+define('_PAINT_Applet_PaintBBS_name',  'PaintBBS');\r
+define('_PAINT_Applet_Shipainter_name',        'しぃペインター');\r
+define('_PAINT_Applet_Shipainterpro_name',     'しぃペインターPro');\r
+\r
+// Palette\r
+define('_PAINT_Palette',       '(動的パレット)');\r
+\r
+// Parser\r
+define('_PAINT_Parser_useinput',                               'php://inputを利用してデータを取得します');\r
+define('_PAINT_Parser_contentLengthNotFound',  'CONTENT_LENGTHが取得できませんでしたが続行します');\r
+\r
+// Viewer\r
+define('_PAINT_Viewer_infoNotFond',    '情報はありません');\r
+define('_PAINT_Viewer_spch_desc',      '(しぃペインターのアニメーション再生)');\r
+define('_PAINT_Viewer_pch_desc',       '(PaintBBSのアニメーション再生)');\r
diff --git a/trunk/NP_Paint/paint/mkeuc.sh b/trunk/NP_Paint/paint/mkeuc.sh
new file mode 100644 (file)
index 0000000..fe72124
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash -x\r
+\r
+FILES=`find . -name '*japanese-utf8*'`\r
+\r
+for utf8file in $FILES\r
+do\r
+       eucfile=`echo $utf8file | sed 's/japanese-utf8/japanese-euc/'`\r
+       nkf -e -W -d < $utf8file > $eucfile\r
+done\r
diff --git a/trunk/NP_Paint/paint/paint.css b/trunk/NP_Paint/paint/paint.css
new file mode 100644 (file)
index 0000000..d40b311
--- /dev/null
@@ -0,0 +1,9 @@
+input {\r
+        color:#222222;\r
+        line-height:133%;\r
+        font-size:100%;\r
+        min-height:1.33em;\r
+        background-color:#ffffff;\r
+        border:1px solid #222222;\r
+        vertical-align:text-bottom;\r
+}
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/paint.js b/trunk/NP_Paint/paint/paint.js
new file mode 100644 (file)
index 0000000..2a7b2ba
--- /dev/null
@@ -0,0 +1,70 @@
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * paint.js ($Revision: 1.15 $)\r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * \r
+  * $Id: paint.js,v 1.15 2010/06/06 11:44:19 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2005-2010 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+function getLoginkey()\r
+{\r
+       var url = 'http://'+location.host+location.pathname;\r
+       var pars = 'action=plugin&name=Paint&type=getLoginkey';\r
+       \r
+       //var d = $('message');\r
+       //d.innerHTML = url + '?' + pars;\r
+\r
+       var myAjax = new Ajax.Request(\r
+               url, \r
+               { method: 'get', parameters: pars, onSuccess: setLoginkey, onFailure: getLoginkeyFailed }\r
+       );\r
+}\r
+\r
+function setLoginkey(originalRequest)\r
+{\r
+       var xmldoc = originalRequest.responseXML;\r
+       var loginkey = xmldoc.getElementsByTagName('loginkey')[0].firstChild.nodeValue;\r
+\r
+       var pat = new RegExp('loginkey=[^&=]+', 'i');\r
+       header = header.replace(pat, 'loginkey=' + loginkey);\r
+       \r
+       var d = $('message');\r
+       d.innerHTML = 'Ticket update OK -> ' + header;\r
+       document.paintbbs.str_header = header;\r
+}\r
+\r
+function getLoginkeyFailed(originalRequest)\r
+{\r
+       var d = $('message');\r
+       d.innerHTML = 'Ticket update NG';\r
+}
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/prototype-1.4.0.js b/trunk/NP_Paint/paint/prototype-1.4.0.js
new file mode 100644 (file)
index 0000000..265b408
--- /dev/null
@@ -0,0 +1,1781 @@
+/*  Prototype JavaScript framework, version 1.4.0\r
+ *  (c) 2005 Sam Stephenson <sam@conio.net>\r
+ *\r
+ *  Prototype is freely distributable under the terms of an MIT-style license.\r
+ *  For details, see the Prototype web site: http://prototype.conio.net/\r
+ *\r
+/*--------------------------------------------------------------------------*/\r
+\r
+var Prototype = {\r
+  Version: '1.4.0',\r
+  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',\r
+\r
+  emptyFunction: function() {},\r
+  K: function(x) {return x}\r
+}\r
+\r
+var Class = {\r
+  create: function() {\r
+    return function() {\r
+      this.initialize.apply(this, arguments);\r
+    }\r
+  }\r
+}\r
+\r
+var Abstract = new Object();\r
+\r
+Object.extend = function(destination, source) {\r
+  for (property in source) {\r
+    destination[property] = source[property];\r
+  }\r
+  return destination;\r
+}\r
+\r
+Object.inspect = function(object) {\r
+  try {\r
+    if (object == undefined) return 'undefined';\r
+    if (object == null) return 'null';\r
+    return object.inspect ? object.inspect() : object.toString();\r
+  } catch (e) {\r
+    if (e instanceof RangeError) return '...';\r
+    throw e;\r
+  }\r
+}\r
+\r
+Function.prototype.bind = function() {\r
+  var __method = this, args = $A(arguments), object = args.shift();\r
+  return function() {\r
+    return __method.apply(object, args.concat($A(arguments)));\r
+  }\r
+}\r
+\r
+Function.prototype.bindAsEventListener = function(object) {\r
+  var __method = this;\r
+  return function(event) {\r
+    return __method.call(object, event || window.event);\r
+  }\r
+}\r
+\r
+Object.extend(Number.prototype, {\r
+  toColorPart: function() {\r
+    var digits = this.toString(16);\r
+    if (this < 16) return '0' + digits;\r
+    return digits;\r
+  },\r
+\r
+  succ: function() {\r
+    return this + 1;\r
+  },\r
+\r
+  times: function(iterator) {\r
+    $R(0, this, true).each(iterator);\r
+    return this;\r
+  }\r
+});\r
+\r
+var Try = {\r
+  these: function() {\r
+    var returnValue;\r
+\r
+    for (var i = 0; i < arguments.length; i++) {\r
+      var lambda = arguments[i];\r
+      try {\r
+        returnValue = lambda();\r
+        break;\r
+      } catch (e) {}\r
+    }\r
+\r
+    return returnValue;\r
+  }\r
+}\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+var PeriodicalExecuter = Class.create();\r
+PeriodicalExecuter.prototype = {\r
+  initialize: function(callback, frequency) {\r
+    this.callback = callback;\r
+    this.frequency = frequency;\r
+    this.currentlyExecuting = false;\r
+\r
+    this.registerCallback();\r
+  },\r
+\r
+  registerCallback: function() {\r
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);\r
+  },\r
+\r
+  onTimerEvent: function() {\r
+    if (!this.currentlyExecuting) {\r
+      try {\r
+        this.currentlyExecuting = true;\r
+        this.callback();\r
+      } finally {\r
+        this.currentlyExecuting = false;\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+function $() {\r
+  var elements = new Array();\r
+\r
+  for (var i = 0; i < arguments.length; i++) {\r
+    var element = arguments[i];\r
+    if (typeof element == 'string')\r
+      element = document.getElementById(element);\r
+\r
+    if (arguments.length == 1)\r
+      return element;\r
+\r
+    elements.push(element);\r
+  }\r
+\r
+  return elements;\r
+}\r
+Object.extend(String.prototype, {\r
+  stripTags: function() {\r
+    return this.replace(/<\/?[^>]+>/gi, '');\r
+  },\r
+\r
+  stripScripts: function() {\r
+    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');\r
+  },\r
+\r
+  extractScripts: function() {\r
+    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');\r
+    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');\r
+    return (this.match(matchAll) || []).map(function(scriptTag) {\r
+      return (scriptTag.match(matchOne) || ['', ''])[1];\r
+    });\r
+  },\r
+\r
+  evalScripts: function() {\r
+    return this.extractScripts().map(eval);\r
+  },\r
+\r
+  escapeHTML: function() {\r
+    var div = document.createElement('div');\r
+    var text = document.createTextNode(this);\r
+    div.appendChild(text);\r
+    return div.innerHTML;\r
+  },\r
+\r
+  unescapeHTML: function() {\r
+    var div = document.createElement('div');\r
+    div.innerHTML = this.stripTags();\r
+    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';\r
+  },\r
+\r
+  toQueryParams: function() {\r
+    var pairs = this.match(/^\??(.*)$/)[1].split('&');\r
+    return pairs.inject({}, function(params, pairString) {\r
+      var pair = pairString.split('=');\r
+      params[pair[0]] = pair[1];\r
+      return params;\r
+    });\r
+  },\r
+\r
+  toArray: function() {\r
+    return this.split('');\r
+  },\r
+\r
+  camelize: function() {\r
+    var oStringList = this.split('-');\r
+    if (oStringList.length == 1) return oStringList[0];\r
+\r
+    var camelizedString = this.indexOf('-') == 0\r
+      ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)\r
+      : oStringList[0];\r
+\r
+    for (var i = 1, len = oStringList.length; i < len; i++) {\r
+      var s = oStringList[i];\r
+      camelizedString += s.charAt(0).toUpperCase() + s.substring(1);\r
+    }\r
+\r
+    return camelizedString;\r
+  },\r
+\r
+  inspect: function() {\r
+    return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";\r
+  }\r
+});\r
+\r
+String.prototype.parseQuery = String.prototype.toQueryParams;\r
+\r
+var $break    = new Object();\r
+var $continue = new Object();\r
+\r
+var Enumerable = {\r
+  each: function(iterator) {\r
+    var index = 0;\r
+    try {\r
+      this._each(function(value) {\r
+        try {\r
+          iterator(value, index++);\r
+        } catch (e) {\r
+          if (e != $continue) throw e;\r
+        }\r
+      });\r
+    } catch (e) {\r
+      if (e != $break) throw e;\r
+    }\r
+  },\r
+\r
+  all: function(iterator) {\r
+    var result = true;\r
+    this.each(function(value, index) {\r
+      result = result && !!(iterator || Prototype.K)(value, index);\r
+      if (!result) throw $break;\r
+    });\r
+    return result;\r
+  },\r
+\r
+  any: function(iterator) {\r
+    var result = true;\r
+    this.each(function(value, index) {\r
+      if (result = !!(iterator || Prototype.K)(value, index))\r
+        throw $break;\r
+    });\r
+    return result;\r
+  },\r
+\r
+  collect: function(iterator) {\r
+    var results = [];\r
+    this.each(function(value, index) {\r
+      results.push(iterator(value, index));\r
+    });\r
+    return results;\r
+  },\r
+\r
+  detect: function (iterator) {\r
+    var result;\r
+    this.each(function(value, index) {\r
+      if (iterator(value, index)) {\r
+        result = value;\r
+        throw $break;\r
+      }\r
+    });\r
+    return result;\r
+  },\r
+\r
+  findAll: function(iterator) {\r
+    var results = [];\r
+    this.each(function(value, index) {\r
+      if (iterator(value, index))\r
+        results.push(value);\r
+    });\r
+    return results;\r
+  },\r
+\r
+  grep: function(pattern, iterator) {\r
+    var results = [];\r
+    this.each(function(value, index) {\r
+      var stringValue = value.toString();\r
+      if (stringValue.match(pattern))\r
+        results.push((iterator || Prototype.K)(value, index));\r
+    })\r
+    return results;\r
+  },\r
+\r
+  include: function(object) {\r
+    var found = false;\r
+    this.each(function(value) {\r
+      if (value == object) {\r
+        found = true;\r
+        throw $break;\r
+      }\r
+    });\r
+    return found;\r
+  },\r
+\r
+  inject: function(memo, iterator) {\r
+    this.each(function(value, index) {\r
+      memo = iterator(memo, value, index);\r
+    });\r
+    return memo;\r
+  },\r
+\r
+  invoke: function(method) {\r
+    var args = $A(arguments).slice(1);\r
+    return this.collect(function(value) {\r
+      return value[method].apply(value, args);\r
+    });\r
+  },\r
+\r
+  max: function(iterator) {\r
+    var result;\r
+    this.each(function(value, index) {\r
+      value = (iterator || Prototype.K)(value, index);\r
+      if (value >= (result || value))\r
+        result = value;\r
+    });\r
+    return result;\r
+  },\r
+\r
+  min: function(iterator) {\r
+    var result;\r
+    this.each(function(value, index) {\r
+      value = (iterator || Prototype.K)(value, index);\r
+      if (value <= (result || value))\r
+        result = value;\r
+    });\r
+    return result;\r
+  },\r
+\r
+  partition: function(iterator) {\r
+    var trues = [], falses = [];\r
+    this.each(function(value, index) {\r
+      ((iterator || Prototype.K)(value, index) ?\r
+        trues : falses).push(value);\r
+    });\r
+    return [trues, falses];\r
+  },\r
+\r
+  pluck: function(property) {\r
+    var results = [];\r
+    this.each(function(value, index) {\r
+      results.push(value[property]);\r
+    });\r
+    return results;\r
+  },\r
+\r
+  reject: function(iterator) {\r
+    var results = [];\r
+    this.each(function(value, index) {\r
+      if (!iterator(value, index))\r
+        results.push(value);\r
+    });\r
+    return results;\r
+  },\r
+\r
+  sortBy: function(iterator) {\r
+    return this.collect(function(value, index) {\r
+      return {value: value, criteria: iterator(value, index)};\r
+    }).sort(function(left, right) {\r
+      var a = left.criteria, b = right.criteria;\r
+      return a < b ? -1 : a > b ? 1 : 0;\r
+    }).pluck('value');\r
+  },\r
+\r
+  toArray: function() {\r
+    return this.collect(Prototype.K);\r
+  },\r
+\r
+  zip: function() {\r
+    var iterator = Prototype.K, args = $A(arguments);\r
+    if (typeof args.last() == 'function')\r
+      iterator = args.pop();\r
+\r
+    var collections = [this].concat(args).map($A);\r
+    return this.map(function(value, index) {\r
+      iterator(value = collections.pluck(index));\r
+      return value;\r
+    });\r
+  },\r
+\r
+  inspect: function() {\r
+    return '#<Enumerable:' + this.toArray().inspect() + '>';\r
+  }\r
+}\r
+\r
+Object.extend(Enumerable, {\r
+  map:     Enumerable.collect,\r
+  find:    Enumerable.detect,\r
+  select:  Enumerable.findAll,\r
+  member:  Enumerable.include,\r
+  entries: Enumerable.toArray\r
+});\r
+var $A = Array.from = function(iterable) {\r
+  if (!iterable) return [];\r
+  if (iterable.toArray) {\r
+    return iterable.toArray();\r
+  } else {\r
+    var results = [];\r
+    for (var i = 0; i < iterable.length; i++)\r
+      results.push(iterable[i]);\r
+    return results;\r
+  }\r
+}\r
+\r
+Object.extend(Array.prototype, Enumerable);\r
+\r
+Array.prototype._reverse = Array.prototype.reverse;\r
+\r
+Object.extend(Array.prototype, {\r
+  _each: function(iterator) {\r
+    for (var i = 0; i < this.length; i++)\r
+      iterator(this[i]);\r
+  },\r
+\r
+  clear: function() {\r
+    this.length = 0;\r
+    return this;\r
+  },\r
+\r
+  first: function() {\r
+    return this[0];\r
+  },\r
+\r
+  last: function() {\r
+    return this[this.length - 1];\r
+  },\r
+\r
+  compact: function() {\r
+    return this.select(function(value) {\r
+      return value != undefined || value != null;\r
+    });\r
+  },\r
+\r
+  flatten: function() {\r
+    return this.inject([], function(array, value) {\r
+      return array.concat(value.constructor == Array ?\r
+        value.flatten() : [value]);\r
+    });\r
+  },\r
+\r
+  without: function() {\r
+    var values = $A(arguments);\r
+    return this.select(function(value) {\r
+      return !values.include(value);\r
+    });\r
+  },\r
+\r
+  indexOf: function(object) {\r
+    for (var i = 0; i < this.length; i++)\r
+      if (this[i] == object) return i;\r
+    return -1;\r
+  },\r
+\r
+  reverse: function(inline) {\r
+    return (inline !== false ? this : this.toArray())._reverse();\r
+  },\r
+\r
+  shift: function() {\r
+    var result = this[0];\r
+    for (var i = 0; i < this.length - 1; i++)\r
+      this[i] = this[i + 1];\r
+    this.length--;\r
+    return result;\r
+  },\r
+\r
+  inspect: function() {\r
+    return '[' + this.map(Object.inspect).join(', ') + ']';\r
+  }\r
+});\r
+var Hash = {\r
+  _each: function(iterator) {\r
+    for (key in this) {\r
+      var value = this[key];\r
+      if (typeof value == 'function') continue;\r
+\r
+      var pair = [key, value];\r
+      pair.key = key;\r
+      pair.value = value;\r
+      iterator(pair);\r
+    }\r
+  },\r
+\r
+  keys: function() {\r
+    return this.pluck('key');\r
+  },\r
+\r
+  values: function() {\r
+    return this.pluck('value');\r
+  },\r
+\r
+  merge: function(hash) {\r
+    return $H(hash).inject($H(this), function(mergedHash, pair) {\r
+      mergedHash[pair.key] = pair.value;\r
+      return mergedHash;\r
+    });\r
+  },\r
+\r
+  toQueryString: function() {\r
+    return this.map(function(pair) {\r
+      return pair.map(encodeURIComponent).join('=');\r
+    }).join('&');\r
+  },\r
+\r
+  inspect: function() {\r
+    return '#<Hash:{' + this.map(function(pair) {\r
+      return pair.map(Object.inspect).join(': ');\r
+    }).join(', ') + '}>';\r
+  }\r
+}\r
+\r
+function $H(object) {\r
+  var hash = Object.extend({}, object || {});\r
+  Object.extend(hash, Enumerable);\r
+  Object.extend(hash, Hash);\r
+  return hash;\r
+}\r
+ObjectRange = Class.create();\r
+Object.extend(ObjectRange.prototype, Enumerable);\r
+Object.extend(ObjectRange.prototype, {\r
+  initialize: function(start, end, exclusive) {\r
+    this.start = start;\r
+    this.end = end;\r
+    this.exclusive = exclusive;\r
+  },\r
+\r
+  _each: function(iterator) {\r
+    var value = this.start;\r
+    do {\r
+      iterator(value);\r
+      value = value.succ();\r
+    } while (this.include(value));\r
+  },\r
+\r
+  include: function(value) {\r
+    if (value < this.start)\r
+      return false;\r
+    if (this.exclusive)\r
+      return value < this.end;\r
+    return value <= this.end;\r
+  }\r
+});\r
+\r
+var $R = function(start, end, exclusive) {\r
+  return new ObjectRange(start, end, exclusive);\r
+}\r
+\r
+var Ajax = {\r
+  getTransport: function() {\r
+    return Try.these(\r
+      function() {return new ActiveXObject('Msxml2.XMLHTTP')},\r
+      function() {return new ActiveXObject('Microsoft.XMLHTTP')},\r
+      function() {return new XMLHttpRequest()}\r
+    ) || false;\r
+  },\r
+\r
+  activeRequestCount: 0\r
+}\r
+\r
+Ajax.Responders = {\r
+  responders: [],\r
+\r
+  _each: function(iterator) {\r
+    this.responders._each(iterator);\r
+  },\r
+\r
+  register: function(responderToAdd) {\r
+    if (!this.include(responderToAdd))\r
+      this.responders.push(responderToAdd);\r
+  },\r
+\r
+  unregister: function(responderToRemove) {\r
+    this.responders = this.responders.without(responderToRemove);\r
+  },\r
+\r
+  dispatch: function(callback, request, transport, json) {\r
+    this.each(function(responder) {\r
+      if (responder[callback] && typeof responder[callback] == 'function') {\r
+        try {\r
+          responder[callback].apply(responder, [request, transport, json]);\r
+        } catch (e) {}\r
+      }\r
+    });\r
+  }\r
+};\r
+\r
+Object.extend(Ajax.Responders, Enumerable);\r
+\r
+Ajax.Responders.register({\r
+  onCreate: function() {\r
+    Ajax.activeRequestCount++;\r
+  },\r
+\r
+  onComplete: function() {\r
+    Ajax.activeRequestCount--;\r
+  }\r
+});\r
+\r
+Ajax.Base = function() {};\r
+Ajax.Base.prototype = {\r
+  setOptions: function(options) {\r
+    this.options = {\r
+      method:       'post',\r
+      asynchronous: true,\r
+      parameters:   ''\r
+    }\r
+    Object.extend(this.options, options || {});\r
+  },\r
+\r
+  responseIsSuccess: function() {\r
+    return this.transport.status == undefined\r
+        || this.transport.status == 0\r
+        || (this.transport.status >= 200 && this.transport.status < 300);\r
+  },\r
+\r
+  responseIsFailure: function() {\r
+    return !this.responseIsSuccess();\r
+  }\r
+}\r
+\r
+Ajax.Request = Class.create();\r
+Ajax.Request.Events =\r
+  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];\r
+\r
+Ajax.Request.prototype = Object.extend(new Ajax.Base(), {\r
+  initialize: function(url, options) {\r
+    this.transport = Ajax.getTransport();\r
+    this.setOptions(options);\r
+    this.request(url);\r
+  },\r
+\r
+  request: function(url) {\r
+    var parameters = this.options.parameters || '';\r
+    if (parameters.length > 0) parameters += '&_=';\r
+\r
+    try {\r
+      this.url = url;\r
+      if (this.options.method == 'get' && parameters.length > 0)\r
+        this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;\r
+\r
+      Ajax.Responders.dispatch('onCreate', this, this.transport);\r
+\r
+      this.transport.open(this.options.method, this.url,\r
+        this.options.asynchronous);\r
+\r
+      if (this.options.asynchronous) {\r
+        this.transport.onreadystatechange = this.onStateChange.bind(this);\r
+        setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);\r
+      }\r
+\r
+      this.setRequestHeaders();\r
+\r
+      var body = this.options.postBody ? this.options.postBody : parameters;\r
+      this.transport.send(this.options.method == 'post' ? body : null);\r
+\r
+    } catch (e) {\r
+      this.dispatchException(e);\r
+    }\r
+  },\r
+\r
+  setRequestHeaders: function() {\r
+    var requestHeaders =\r
+      ['X-Requested-With', 'XMLHttpRequest',\r
+       'X-Prototype-Version', Prototype.Version];\r
+\r
+    if (this.options.method == 'post') {\r
+      requestHeaders.push('Content-type',\r
+        'application/x-www-form-urlencoded');\r
+\r
+      /* Force "Connection: close" for Mozilla browsers to work around\r
+       * a bug where XMLHttpReqeuest sends an incorrect Content-length\r
+       * header. See Mozilla Bugzilla #246651.\r
+       */\r
+      if (this.transport.overrideMimeType)\r
+        requestHeaders.push('Connection', 'close');\r
+    }\r
+\r
+    if (this.options.requestHeaders)\r
+      requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);\r
+\r
+    for (var i = 0; i < requestHeaders.length; i += 2)\r
+      this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);\r
+  },\r
+\r
+  onStateChange: function() {\r
+    var readyState = this.transport.readyState;\r
+    if (readyState != 1)\r
+      this.respondToReadyState(this.transport.readyState);\r
+  },\r
+\r
+  header: function(name) {\r
+    try {\r
+      return this.transport.getResponseHeader(name);\r
+    } catch (e) {}\r
+  },\r
+\r
+  evalJSON: function() {\r
+    try {\r
+      return eval(this.header('X-JSON'));\r
+    } catch (e) {}\r
+  },\r
+\r
+  evalResponse: function() {\r
+    try {\r
+      return eval(this.transport.responseText);\r
+    } catch (e) {\r
+      this.dispatchException(e);\r
+    }\r
+  },\r
+\r
+  respondToReadyState: function(readyState) {\r
+    var event = Ajax.Request.Events[readyState];\r
+    var transport = this.transport, json = this.evalJSON();\r
+\r
+    if (event == 'Complete') {\r
+      try {\r
+        (this.options['on' + this.transport.status]\r
+         || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]\r
+         || Prototype.emptyFunction)(transport, json);\r
+      } catch (e) {\r
+        this.dispatchException(e);\r
+      }\r
+\r
+      if ((this.header('Content-type') || '').match(/^text\/javascript/i))\r
+        this.evalResponse();\r
+    }\r
+\r
+    try {\r
+      (this.options['on' + event] || Prototype.emptyFunction)(transport, json);\r
+      Ajax.Responders.dispatch('on' + event, this, transport, json);\r
+    } catch (e) {\r
+      this.dispatchException(e);\r
+    }\r
+\r
+    /* Avoid memory leak in MSIE: clean up the oncomplete event handler */\r
+    if (event == 'Complete')\r
+      this.transport.onreadystatechange = Prototype.emptyFunction;\r
+  },\r
+\r
+  dispatchException: function(exception) {\r
+    (this.options.onException || Prototype.emptyFunction)(this, exception);\r
+    Ajax.Responders.dispatch('onException', this, exception);\r
+  }\r
+});\r
+\r
+Ajax.Updater = Class.create();\r
+\r
+Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {\r
+  initialize: function(container, url, options) {\r
+    this.containers = {\r
+      success: container.success ? $(container.success) : $(container),\r
+      failure: container.failure ? $(container.failure) :\r
+        (container.success ? null : $(container))\r
+    }\r
+\r
+    this.transport = Ajax.getTransport();\r
+    this.setOptions(options);\r
+\r
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;\r
+    this.options.onComplete = (function(transport, object) {\r
+      this.updateContent();\r
+      onComplete(transport, object);\r
+    }).bind(this);\r
+\r
+    this.request(url);\r
+  },\r
+\r
+  updateContent: function() {\r
+    var receiver = this.responseIsSuccess() ?\r
+      this.containers.success : this.containers.failure;\r
+    var response = this.transport.responseText;\r
+\r
+    if (!this.options.evalScripts)\r
+      response = response.stripScripts();\r
+\r
+    if (receiver) {\r
+      if (this.options.insertion) {\r
+        new this.options.insertion(receiver, response);\r
+      } else {\r
+        Element.update(receiver, response);\r
+      }\r
+    }\r
+\r
+    if (this.responseIsSuccess()) {\r
+      if (this.onComplete)\r
+        setTimeout(this.onComplete.bind(this), 10);\r
+    }\r
+  }\r
+});\r
+\r
+Ajax.PeriodicalUpdater = Class.create();\r
+Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {\r
+  initialize: function(container, url, options) {\r
+    this.setOptions(options);\r
+    this.onComplete = this.options.onComplete;\r
+\r
+    this.frequency = (this.options.frequency || 2);\r
+    this.decay = (this.options.decay || 1);\r
+\r
+    this.updater = {};\r
+    this.container = container;\r
+    this.url = url;\r
+\r
+    this.start();\r
+  },\r
+\r
+  start: function() {\r
+    this.options.onComplete = this.updateComplete.bind(this);\r
+    this.onTimerEvent();\r
+  },\r
+\r
+  stop: function() {\r
+    this.updater.onComplete = undefined;\r
+    clearTimeout(this.timer);\r
+    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);\r
+  },\r
+\r
+  updateComplete: function(request) {\r
+    if (this.options.decay) {\r
+      this.decay = (request.responseText == this.lastText ?\r
+        this.decay * this.options.decay : 1);\r
+\r
+      this.lastText = request.responseText;\r
+    }\r
+    this.timer = setTimeout(this.onTimerEvent.bind(this),\r
+      this.decay * this.frequency * 1000);\r
+  },\r
+\r
+  onTimerEvent: function() {\r
+    this.updater = new Ajax.Updater(this.container, this.url, this.options);\r
+  }\r
+});\r
+document.getElementsByClassName = function(className, parentElement) {\r
+  var children = ($(parentElement) || document.body).getElementsByTagName('*');\r
+  return $A(children).inject([], function(elements, child) {\r
+    if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))\r
+      elements.push(child);\r
+    return elements;\r
+  });\r
+}\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+if (!window.Element) {\r
+  var Element = new Object();\r
+}\r
+\r
+Object.extend(Element, {\r
+  visible: function(element) {\r
+    return $(element).style.display != 'none';\r
+  },\r
+\r
+  toggle: function() {\r
+    for (var i = 0; i < arguments.length; i++) {\r
+      var element = $(arguments[i]);\r
+      Element[Element.visible(element) ? 'hide' : 'show'](element);\r
+    }\r
+  },\r
+\r
+  hide: function() {\r
+    for (var i = 0; i < arguments.length; i++) {\r
+      var element = $(arguments[i]);\r
+      element.style.display = 'none';\r
+    }\r
+  },\r
+\r
+  show: function() {\r
+    for (var i = 0; i < arguments.length; i++) {\r
+      var element = $(arguments[i]);\r
+      element.style.display = '';\r
+    }\r
+  },\r
+\r
+  remove: function(element) {\r
+    element = $(element);\r
+    element.parentNode.removeChild(element);\r
+  },\r
+\r
+  update: function(element, html) {\r
+    $(element).innerHTML = html.stripScripts();\r
+    setTimeout(function() {html.evalScripts()}, 10);\r
+  },\r
+\r
+  getHeight: function(element) {\r
+    element = $(element);\r
+    return element.offsetHeight;\r
+  },\r
+\r
+  classNames: function(element) {\r
+    return new Element.ClassNames(element);\r
+  },\r
+\r
+  hasClassName: function(element, className) {\r
+    if (!(element = $(element))) return;\r
+    return Element.classNames(element).include(className);\r
+  },\r
+\r
+  addClassName: function(element, className) {\r
+    if (!(element = $(element))) return;\r
+    return Element.classNames(element).add(className);\r
+  },\r
+\r
+  removeClassName: function(element, className) {\r
+    if (!(element = $(element))) return;\r
+    return Element.classNames(element).remove(className);\r
+  },\r
+\r
+  // removes whitespace-only text node children\r
+  cleanWhitespace: function(element) {\r
+    element = $(element);\r
+    for (var i = 0; i < element.childNodes.length; i++) {\r
+      var node = element.childNodes[i];\r
+      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))\r
+        Element.remove(node);\r
+    }\r
+  },\r
+\r
+  empty: function(element) {\r
+    return $(element).innerHTML.match(/^\s*$/);\r
+  },\r
+\r
+  scrollTo: function(element) {\r
+    element = $(element);\r
+    var x = element.x ? element.x : element.offsetLeft,\r
+        y = element.y ? element.y : element.offsetTop;\r
+    window.scrollTo(x, y);\r
+  },\r
+\r
+  getStyle: function(element, style) {\r
+    element = $(element);\r
+    var value = element.style[style.camelize()];\r
+    if (!value) {\r
+      if (document.defaultView && document.defaultView.getComputedStyle) {\r
+        var css = document.defaultView.getComputedStyle(element, null);\r
+        value = css ? css.getPropertyValue(style) : null;\r
+      } else if (element.currentStyle) {\r
+        value = element.currentStyle[style.camelize()];\r
+      }\r
+    }\r
+\r
+    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))\r
+      if (Element.getStyle(element, 'position') == 'static') value = 'auto';\r
+\r
+    return value == 'auto' ? null : value;\r
+  },\r
+\r
+  setStyle: function(element, style) {\r
+    element = $(element);\r
+    for (name in style)\r
+      element.style[name.camelize()] = style[name];\r
+  },\r
+\r
+  getDimensions: function(element) {\r
+    element = $(element);\r
+    if (Element.getStyle(element, 'display') != 'none')\r
+      return {width: element.offsetWidth, height: element.offsetHeight};\r
+\r
+    // All *Width and *Height properties give 0 on elements with display none,\r
+    // so enable the element temporarily\r
+    var els = element.style;\r
+    var originalVisibility = els.visibility;\r
+    var originalPosition = els.position;\r
+    els.visibility = 'hidden';\r
+    els.position = 'absolute';\r
+    els.display = '';\r
+    var originalWidth = element.clientWidth;\r
+    var originalHeight = element.clientHeight;\r
+    els.display = 'none';\r
+    els.position = originalPosition;\r
+    els.visibility = originalVisibility;\r
+    return {width: originalWidth, height: originalHeight};\r
+  },\r
+\r
+  makePositioned: function(element) {\r
+    element = $(element);\r
+    var pos = Element.getStyle(element, 'position');\r
+    if (pos == 'static' || !pos) {\r
+      element._madePositioned = true;\r
+      element.style.position = 'relative';\r
+      // Opera returns the offset relative to the positioning context, when an\r
+      // element is position relative but top and left have not been defined\r
+      if (window.opera) {\r
+        element.style.top = 0;\r
+        element.style.left = 0;\r
+      }\r
+    }\r
+  },\r
+\r
+  undoPositioned: function(element) {\r
+    element = $(element);\r
+    if (element._madePositioned) {\r
+      element._madePositioned = undefined;\r
+      element.style.position =\r
+        element.style.top =\r
+        element.style.left =\r
+        element.style.bottom =\r
+        element.style.right = '';\r
+    }\r
+  },\r
+\r
+  makeClipping: function(element) {\r
+    element = $(element);\r
+    if (element._overflow) return;\r
+    element._overflow = element.style.overflow;\r
+    if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')\r
+      element.style.overflow = 'hidden';\r
+  },\r
+\r
+  undoClipping: function(element) {\r
+    element = $(element);\r
+    if (element._overflow) return;\r
+    element.style.overflow = element._overflow;\r
+    element._overflow = undefined;\r
+  }\r
+});\r
+\r
+var Toggle = new Object();\r
+Toggle.display = Element.toggle;\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+Abstract.Insertion = function(adjacency) {\r
+  this.adjacency = adjacency;\r
+}\r
+\r
+Abstract.Insertion.prototype = {\r
+  initialize: function(element, content) {\r
+    this.element = $(element);\r
+    this.content = content.stripScripts();\r
+\r
+    if (this.adjacency && this.element.insertAdjacentHTML) {\r
+      try {\r
+        this.element.insertAdjacentHTML(this.adjacency, this.content);\r
+      } catch (e) {\r
+        if (this.element.tagName.toLowerCase() == 'tbody') {\r
+          this.insertContent(this.contentFromAnonymousTable());\r
+        } else {\r
+          throw e;\r
+        }\r
+      }\r
+    } else {\r
+      this.range = this.element.ownerDocument.createRange();\r
+      if (this.initializeRange) this.initializeRange();\r
+      this.insertContent([this.range.createContextualFragment(this.content)]);\r
+    }\r
+\r
+    setTimeout(function() {content.evalScripts()}, 10);\r
+  },\r
+\r
+  contentFromAnonymousTable: function() {\r
+    var div = document.createElement('div');\r
+    div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';\r
+    return $A(div.childNodes[0].childNodes[0].childNodes);\r
+  }\r
+}\r
+\r
+var Insertion = new Object();\r
+\r
+Insertion.Before = Class.create();\r
+Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {\r
+  initializeRange: function() {\r
+    this.range.setStartBefore(this.element);\r
+  },\r
+\r
+  insertContent: function(fragments) {\r
+    fragments.each((function(fragment) {\r
+      this.element.parentNode.insertBefore(fragment, this.element);\r
+    }).bind(this));\r
+  }\r
+});\r
+\r
+Insertion.Top = Class.create();\r
+Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {\r
+  initializeRange: function() {\r
+    this.range.selectNodeContents(this.element);\r
+    this.range.collapse(true);\r
+  },\r
+\r
+  insertContent: function(fragments) {\r
+    fragments.reverse(false).each((function(fragment) {\r
+      this.element.insertBefore(fragment, this.element.firstChild);\r
+    }).bind(this));\r
+  }\r
+});\r
+\r
+Insertion.Bottom = Class.create();\r
+Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {\r
+  initializeRange: function() {\r
+    this.range.selectNodeContents(this.element);\r
+    this.range.collapse(this.element);\r
+  },\r
+\r
+  insertContent: function(fragments) {\r
+    fragments.each((function(fragment) {\r
+      this.element.appendChild(fragment);\r
+    }).bind(this));\r
+  }\r
+});\r
+\r
+Insertion.After = Class.create();\r
+Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {\r
+  initializeRange: function() {\r
+    this.range.setStartAfter(this.element);\r
+  },\r
+\r
+  insertContent: function(fragments) {\r
+    fragments.each((function(fragment) {\r
+      this.element.parentNode.insertBefore(fragment,\r
+        this.element.nextSibling);\r
+    }).bind(this));\r
+  }\r
+});\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+Element.ClassNames = Class.create();\r
+Element.ClassNames.prototype = {\r
+  initialize: function(element) {\r
+    this.element = $(element);\r
+  },\r
+\r
+  _each: function(iterator) {\r
+    this.element.className.split(/\s+/).select(function(name) {\r
+      return name.length > 0;\r
+    })._each(iterator);\r
+  },\r
+\r
+  set: function(className) {\r
+    this.element.className = className;\r
+  },\r
+\r
+  add: function(classNameToAdd) {\r
+    if (this.include(classNameToAdd)) return;\r
+    this.set(this.toArray().concat(classNameToAdd).join(' '));\r
+  },\r
+\r
+  remove: function(classNameToRemove) {\r
+    if (!this.include(classNameToRemove)) return;\r
+    this.set(this.select(function(className) {\r
+      return className != classNameToRemove;\r
+    }).join(' '));\r
+  },\r
+\r
+  toString: function() {\r
+    return this.toArray().join(' ');\r
+  }\r
+}\r
+\r
+Object.extend(Element.ClassNames.prototype, Enumerable);\r
+var Field = {\r
+  clear: function() {\r
+    for (var i = 0; i < arguments.length; i++)\r
+      $(arguments[i]).value = '';\r
+  },\r
+\r
+  focus: function(element) {\r
+    $(element).focus();\r
+  },\r
+\r
+  present: function() {\r
+    for (var i = 0; i < arguments.length; i++)\r
+      if ($(arguments[i]).value == '') return false;\r
+    return true;\r
+  },\r
+\r
+  select: function(element) {\r
+    $(element).select();\r
+  },\r
+\r
+  activate: function(element) {\r
+    element = $(element);\r
+    element.focus();\r
+    if (element.select)\r
+      element.select();\r
+  }\r
+}\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+var Form = {\r
+  serialize: function(form) {\r
+    var elements = Form.getElements($(form));\r
+    var queryComponents = new Array();\r
+\r
+    for (var i = 0; i < elements.length; i++) {\r
+      var queryComponent = Form.Element.serialize(elements[i]);\r
+      if (queryComponent)\r
+        queryComponents.push(queryComponent);\r
+    }\r
+\r
+    return queryComponents.join('&');\r
+  },\r
+\r
+  getElements: function(form) {\r
+    form = $(form);\r
+    var elements = new Array();\r
+\r
+    for (tagName in Form.Element.Serializers) {\r
+      var tagElements = form.getElementsByTagName(tagName);\r
+      for (var j = 0; j < tagElements.length; j++)\r
+        elements.push(tagElements[j]);\r
+    }\r
+    return elements;\r
+  },\r
+\r
+  getInputs: function(form, typeName, name) {\r
+    form = $(form);\r
+    var inputs = form.getElementsByTagName('input');\r
+\r
+    if (!typeName && !name)\r
+      return inputs;\r
+\r
+    var matchingInputs = new Array();\r
+    for (var i = 0; i < inputs.length; i++) {\r
+      var input = inputs[i];\r
+      if ((typeName && input.type != typeName) ||\r
+          (name && input.name != name))\r
+        continue;\r
+      matchingInputs.push(input);\r
+    }\r
+\r
+    return matchingInputs;\r
+  },\r
+\r
+  disable: function(form) {\r
+    var elements = Form.getElements(form);\r
+    for (var i = 0; i < elements.length; i++) {\r
+      var element = elements[i];\r
+      element.blur();\r
+      element.disabled = 'true';\r
+    }\r
+  },\r
+\r
+  enable: function(form) {\r
+    var elements = Form.getElements(form);\r
+    for (var i = 0; i < elements.length; i++) {\r
+      var element = elements[i];\r
+      element.disabled = '';\r
+    }\r
+  },\r
+\r
+  findFirstElement: function(form) {\r
+    return Form.getElements(form).find(function(element) {\r
+      return element.type != 'hidden' && !element.disabled &&\r
+        ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());\r
+    });\r
+  },\r
+\r
+  focusFirstElement: function(form) {\r
+    Field.activate(Form.findFirstElement(form));\r
+  },\r
+\r
+  reset: function(form) {\r
+    $(form).reset();\r
+  }\r
+}\r
+\r
+Form.Element = {\r
+  serialize: function(element) {\r
+    element = $(element);\r
+    var method = element.tagName.toLowerCase();\r
+    var parameter = Form.Element.Serializers[method](element);\r
+\r
+    if (parameter) {\r
+      var key = encodeURIComponent(parameter[0]);\r
+      if (key.length == 0) return;\r
+\r
+      if (parameter[1].constructor != Array)\r
+        parameter[1] = [parameter[1]];\r
+\r
+      return parameter[1].map(function(value) {\r
+        return key + '=' + encodeURIComponent(value);\r
+      }).join('&');\r
+    }\r
+  },\r
+\r
+  getValue: function(element) {\r
+    element = $(element);\r
+    var method = element.tagName.toLowerCase();\r
+    var parameter = Form.Element.Serializers[method](element);\r
+\r
+    if (parameter)\r
+      return parameter[1];\r
+  }\r
+}\r
+\r
+Form.Element.Serializers = {\r
+  input: function(element) {\r
+    switch (element.type.toLowerCase()) {\r
+      case 'submit':\r
+      case 'hidden':\r
+      case 'password':\r
+      case 'text':\r
+        return Form.Element.Serializers.textarea(element);\r
+      case 'checkbox':\r
+      case 'radio':\r
+        return Form.Element.Serializers.inputSelector(element);\r
+    }\r
+    return false;\r
+  },\r
+\r
+  inputSelector: function(element) {\r
+    if (element.checked)\r
+      return [element.name, element.value];\r
+  },\r
+\r
+  textarea: function(element) {\r
+    return [element.name, element.value];\r
+  },\r
+\r
+  select: function(element) {\r
+    return Form.Element.Serializers[element.type == 'select-one' ?\r
+      'selectOne' : 'selectMany'](element);\r
+  },\r
+\r
+  selectOne: function(element) {\r
+    var value = '', opt, index = element.selectedIndex;\r
+    if (index >= 0) {\r
+      opt = element.options[index];\r
+      value = opt.value;\r
+      if (!value && !('value' in opt))\r
+        value = opt.text;\r
+    }\r
+    return [element.name, value];\r
+  },\r
+\r
+  selectMany: function(element) {\r
+    var value = new Array();\r
+    for (var i = 0; i < element.length; i++) {\r
+      var opt = element.options[i];\r
+      if (opt.selected) {\r
+        var optValue = opt.value;\r
+        if (!optValue && !('value' in opt))\r
+          optValue = opt.text;\r
+        value.push(optValue);\r
+      }\r
+    }\r
+    return [element.name, value];\r
+  }\r
+}\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+var $F = Form.Element.getValue;\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+Abstract.TimedObserver = function() {}\r
+Abstract.TimedObserver.prototype = {\r
+  initialize: function(element, frequency, callback) {\r
+    this.frequency = frequency;\r
+    this.element   = $(element);\r
+    this.callback  = callback;\r
+\r
+    this.lastValue = this.getValue();\r
+    this.registerCallback();\r
+  },\r
+\r
+  registerCallback: function() {\r
+    setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);\r
+  },\r
+\r
+  onTimerEvent: function() {\r
+    var value = this.getValue();\r
+    if (this.lastValue != value) {\r
+      this.callback(this.element, value);\r
+      this.lastValue = value;\r
+    }\r
+  }\r
+}\r
+\r
+Form.Element.Observer = Class.create();\r
+Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {\r
+  getValue: function() {\r
+    return Form.Element.getValue(this.element);\r
+  }\r
+});\r
+\r
+Form.Observer = Class.create();\r
+Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {\r
+  getValue: function() {\r
+    return Form.serialize(this.element);\r
+  }\r
+});\r
+\r
+/*--------------------------------------------------------------------------*/\r
+\r
+Abstract.EventObserver = function() {}\r
+Abstract.EventObserver.prototype = {\r
+  initialize: function(element, callback) {\r
+    this.element  = $(element);\r
+    this.callback = callback;\r
+\r
+    this.lastValue = this.getValue();\r
+    if (this.element.tagName.toLowerCase() == 'form')\r
+      this.registerFormCallbacks();\r
+    else\r
+      this.registerCallback(this.element);\r
+  },\r
+\r
+  onElementEvent: function() {\r
+    var value = this.getValue();\r
+    if (this.lastValue != value) {\r
+      this.callback(this.element, value);\r
+      this.lastValue = value;\r
+    }\r
+  },\r
+\r
+  registerFormCallbacks: function() {\r
+    var elements = Form.getElements(this.element);\r
+    for (var i = 0; i < elements.length; i++)\r
+      this.registerCallback(elements[i]);\r
+  },\r
+\r
+  registerCallback: function(element) {\r
+    if (element.type) {\r
+      switch (element.type.toLowerCase()) {\r
+        case 'checkbox':\r
+        case 'radio':\r
+          Event.observe(element, 'click', this.onElementEvent.bind(this));\r
+          break;\r
+        case 'password':\r
+        case 'text':\r
+        case 'textarea':\r
+        case 'select-one':\r
+        case 'select-multiple':\r
+          Event.observe(element, 'change', this.onElementEvent.bind(this));\r
+          break;\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
+Form.Element.EventObserver = Class.create();\r
+Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {\r
+  getValue: function() {\r
+    return Form.Element.getValue(this.element);\r
+  }\r
+});\r
+\r
+Form.EventObserver = Class.create();\r
+Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {\r
+  getValue: function() {\r
+    return Form.serialize(this.element);\r
+  }\r
+});\r
+if (!window.Event) {\r
+  var Event = new Object();\r
+}\r
+\r
+Object.extend(Event, {\r
+  KEY_BACKSPACE: 8,\r
+  KEY_TAB:       9,\r
+  KEY_RETURN:   13,\r
+  KEY_ESC:      27,\r
+  KEY_LEFT:     37,\r
+  KEY_UP:       38,\r
+  KEY_RIGHT:    39,\r
+  KEY_DOWN:     40,\r
+  KEY_DELETE:   46,\r
+\r
+  element: function(event) {\r
+    return event.target || event.srcElement;\r
+  },\r
+\r
+  isLeftClick: function(event) {\r
+    return (((event.which) && (event.which == 1)) ||\r
+            ((event.button) && (event.button == 1)));\r
+  },\r
+\r
+  pointerX: function(event) {\r
+    return event.pageX || (event.clientX +\r
+      (document.documentElement.scrollLeft || document.body.scrollLeft));\r
+  },\r
+\r
+  pointerY: function(event) {\r
+    return event.pageY || (event.clientY +\r
+      (document.documentElement.scrollTop || document.body.scrollTop));\r
+  },\r
+\r
+  stop: function(event) {\r
+    if (event.preventDefault) {\r
+      event.preventDefault();\r
+      event.stopPropagation();\r
+    } else {\r
+      event.returnValue = false;\r
+      event.cancelBubble = true;\r
+    }\r
+  },\r
+\r
+  // find the first node with the given tagName, starting from the\r
+  // node the event was triggered on; traverses the DOM upwards\r
+  findElement: function(event, tagName) {\r
+    var element = Event.element(event);\r
+    while (element.parentNode && (!element.tagName ||\r
+        (element.tagName.toUpperCase() != tagName.toUpperCase())))\r
+      element = element.parentNode;\r
+    return element;\r
+  },\r
+\r
+  observers: false,\r
+\r
+  _observeAndCache: function(element, name, observer, useCapture) {\r
+    if (!this.observers) this.observers = [];\r
+    if (element.addEventListener) {\r
+      this.observers.push([element, name, observer, useCapture]);\r
+      element.addEventListener(name, observer, useCapture);\r
+    } else if (element.attachEvent) {\r
+      this.observers.push([element, name, observer, useCapture]);\r
+      element.attachEvent('on' + name, observer);\r
+    }\r
+  },\r
+\r
+  unloadCache: function() {\r
+    if (!Event.observers) return;\r
+    for (var i = 0; i < Event.observers.length; i++) {\r
+      Event.stopObserving.apply(this, Event.observers[i]);\r
+      Event.observers[i][0] = null;\r
+    }\r
+    Event.observers = false;\r
+  },\r
+\r
+  observe: function(element, name, observer, useCapture) {\r
+    var element = $(element);\r
+    useCapture = useCapture || false;\r
+\r
+    if (name == 'keypress' &&\r
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)\r
+        || element.attachEvent))\r
+      name = 'keydown';\r
+\r
+    this._observeAndCache(element, name, observer, useCapture);\r
+  },\r
+\r
+  stopObserving: function(element, name, observer, useCapture) {\r
+    var element = $(element);\r
+    useCapture = useCapture || false;\r
+\r
+    if (name == 'keypress' &&\r
+        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)\r
+        || element.detachEvent))\r
+      name = 'keydown';\r
+\r
+    if (element.removeEventListener) {\r
+      element.removeEventListener(name, observer, useCapture);\r
+    } else if (element.detachEvent) {\r
+      element.detachEvent('on' + name, observer);\r
+    }\r
+  }\r
+});\r
+\r
+/* prevent memory leaks in IE */\r
+Event.observe(window, 'unload', Event.unloadCache, false);\r
+var Position = {\r
+  // set to true if needed, warning: firefox performance problems\r
+  // NOT neeeded for page scrolling, only if draggable contained in\r
+  // scrollable elements\r
+  includeScrollOffsets: false,\r
+\r
+  // must be called before calling withinIncludingScrolloffset, every time the\r
+  // page is scrolled\r
+  prepare: function() {\r
+    this.deltaX =  window.pageXOffset\r
+                || document.documentElement.scrollLeft\r
+                || document.body.scrollLeft\r
+                || 0;\r
+    this.deltaY =  window.pageYOffset\r
+                || document.documentElement.scrollTop\r
+                || document.body.scrollTop\r
+                || 0;\r
+  },\r
+\r
+  realOffset: function(element) {\r
+    var valueT = 0, valueL = 0;\r
+    do {\r
+      valueT += element.scrollTop  || 0;\r
+      valueL += element.scrollLeft || 0;\r
+      element = element.parentNode;\r
+    } while (element);\r
+    return [valueL, valueT];\r
+  },\r
+\r
+  cumulativeOffset: function(element) {\r
+    var valueT = 0, valueL = 0;\r
+    do {\r
+      valueT += element.offsetTop  || 0;\r
+      valueL += element.offsetLeft || 0;\r
+      element = element.offsetParent;\r
+    } while (element);\r
+    return [valueL, valueT];\r
+  },\r
+\r
+  positionedOffset: function(element) {\r
+    var valueT = 0, valueL = 0;\r
+    do {\r
+      valueT += element.offsetTop  || 0;\r
+      valueL += element.offsetLeft || 0;\r
+      element = element.offsetParent;\r
+      if (element) {\r
+        p = Element.getStyle(element, 'position');\r
+        if (p == 'relative' || p == 'absolute') break;\r
+      }\r
+    } while (element);\r
+    return [valueL, valueT];\r
+  },\r
+\r
+  offsetParent: function(element) {\r
+    if (element.offsetParent) return element.offsetParent;\r
+    if (element == document.body) return element;\r
+\r
+    while ((element = element.parentNode) && element != document.body)\r
+      if (Element.getStyle(element, 'position') != 'static')\r
+        return element;\r
+\r
+    return document.body;\r
+  },\r
+\r
+  // caches x/y coordinate pair to use with overlap\r
+  within: function(element, x, y) {\r
+    if (this.includeScrollOffsets)\r
+      return this.withinIncludingScrolloffsets(element, x, y);\r
+    this.xcomp = x;\r
+    this.ycomp = y;\r
+    this.offset = this.cumulativeOffset(element);\r
+\r
+    return (y >= this.offset[1] &&\r
+            y <  this.offset[1] + element.offsetHeight &&\r
+            x >= this.offset[0] &&\r
+            x <  this.offset[0] + element.offsetWidth);\r
+  },\r
+\r
+  withinIncludingScrolloffsets: function(element, x, y) {\r
+    var offsetcache = this.realOffset(element);\r
+\r
+    this.xcomp = x + offsetcache[0] - this.deltaX;\r
+    this.ycomp = y + offsetcache[1] - this.deltaY;\r
+    this.offset = this.cumulativeOffset(element);\r
+\r
+    return (this.ycomp >= this.offset[1] &&\r
+            this.ycomp <  this.offset[1] + element.offsetHeight &&\r
+            this.xcomp >= this.offset[0] &&\r
+            this.xcomp <  this.offset[0] + element.offsetWidth);\r
+  },\r
+\r
+  // within must be called directly before\r
+  overlap: function(mode, element) {\r
+    if (!mode) return 0;\r
+    if (mode == 'vertical')\r
+      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /\r
+        element.offsetHeight;\r
+    if (mode == 'horizontal')\r
+      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /\r
+        element.offsetWidth;\r
+  },\r
+\r
+  clone: function(source, target) {\r
+    source = $(source);\r
+    target = $(target);\r
+    target.style.position = 'absolute';\r
+    var offsets = this.cumulativeOffset(source);\r
+    target.style.top    = offsets[1] + 'px';\r
+    target.style.left   = offsets[0] + 'px';\r
+    target.style.width  = source.offsetWidth + 'px';\r
+    target.style.height = source.offsetHeight + 'px';\r
+  },\r
+\r
+  page: function(forElement) {\r
+    var valueT = 0, valueL = 0;\r
+\r
+    var element = forElement;\r
+    do {\r
+      valueT += element.offsetTop  || 0;\r
+      valueL += element.offsetLeft || 0;\r
+\r
+      // Safari fix\r
+      if (element.offsetParent==document.body)\r
+        if (Element.getStyle(element,'position')=='absolute') break;\r
+\r
+    } while (element = element.offsetParent);\r
+\r
+    element = forElement;\r
+    do {\r
+      valueT -= element.scrollTop  || 0;\r
+      valueL -= element.scrollLeft || 0;\r
+    } while (element = element.parentNode);\r
+\r
+    return [valueL, valueT];\r
+  },\r
+\r
+  clone: function(source, target) {\r
+    var options = Object.extend({\r
+      setLeft:    true,\r
+      setTop:     true,\r
+      setWidth:   true,\r
+      setHeight:  true,\r
+      offsetTop:  0,\r
+      offsetLeft: 0\r
+    }, arguments[2] || {})\r
+\r
+    // find page position of source\r
+    source = $(source);\r
+    var p = Position.page(source);\r
+\r
+    // find coordinate system to use\r
+    target = $(target);\r
+    var delta = [0, 0];\r
+    var parent = null;\r
+    // delta [0,0] will do fine with position: fixed elements,\r
+    // position:absolute needs offsetParent deltas\r
+    if (Element.getStyle(target,'position') == 'absolute') {\r
+      parent = Position.offsetParent(target);\r
+      delta = Position.page(parent);\r
+    }\r
+\r
+    // correct by body offsets (fixes Safari)\r
+    if (parent == document.body) {\r
+      delta[0] -= document.body.offsetLeft;\r
+      delta[1] -= document.body.offsetTop;\r
+    }\r
+\r
+    // set position\r
+    if(options.setLeft)   target.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';\r
+    if(options.setTop)    target.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';\r
+    if(options.setWidth)  target.style.width = source.offsetWidth + 'px';\r
+    if(options.setHeight) target.style.height = source.offsetHeight + 'px';\r
+  },\r
+\r
+  absolutize: function(element) {\r
+    element = $(element);\r
+    if (element.style.position == 'absolute') return;\r
+    Position.prepare();\r
+\r
+    var offsets = Position.positionedOffset(element);\r
+    var top     = offsets[1];\r
+    var left    = offsets[0];\r
+    var width   = element.clientWidth;\r
+    var height  = element.clientHeight;\r
+\r
+    element._originalLeft   = left - parseFloat(element.style.left  || 0);\r
+    element._originalTop    = top  - parseFloat(element.style.top || 0);\r
+    element._originalWidth  = element.style.width;\r
+    element._originalHeight = element.style.height;\r
+\r
+    element.style.position = 'absolute';\r
+    element.style.top    = top + 'px';;\r
+    element.style.left   = left + 'px';;\r
+    element.style.width  = width + 'px';;\r
+    element.style.height = height + 'px';;\r
+  },\r
+\r
+  relativize: function(element) {\r
+    element = $(element);\r
+    if (element.style.position == 'relative') return;\r
+    Position.prepare();\r
+\r
+    element.style.position = 'relative';\r
+    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);\r
+    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);\r
+\r
+    element.style.top    = top + 'px';\r
+    element.style.left   = left + 'px';\r
+    element.style.height = element._originalHeight;\r
+    element.style.width  = element._originalWidth;\r
+  }\r
+}\r
+\r
+// Safari returns margins on body which is incorrect if the child is absolutely\r
+// positioned.  For performance reasons, redefine Position.cumulativeOffset for\r
+// KHTML/WebKit only.\r
+if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {\r
+  Position.cumulativeOffset = function(element) {\r
+    var valueT = 0, valueL = 0;\r
+    do {\r
+      valueT += element.offsetTop  || 0;\r
+      valueL += element.offsetLeft || 0;\r
+      if (element.offsetParent == document.body)\r
+        if (Element.getStyle(element, 'position') == 'absolute') break;\r
+\r
+      element = element.offsetParent;\r
+    } while (element);\r
+\r
+    return [valueL, valueT];\r
+  }\r
+}
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-euc.html
new file mode 100644 (file)
index 0000000..d828842
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_PaintBBS Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_paintbbs/copyrights_japanese-utf8.html
new file mode 100644 (file)
index 0000000..d828842
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_PaintBBS Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..6188ed0
--- /dev/null
@@ -0,0 +1,140 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+       \r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+       \r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="pbbs.PaintBBS.class"\r
+               archive="{{appletBaseUrl}}PaintBBS.jar" \r
+               name="paintbbs"\r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />         \r
+       <param name="scriptable" value="true" />        \r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />        \r
+       <param name="bar_size" value="20" />\r
+       \r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=paintbbs" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs" />\r
+       \r
+       <param name="tool_advance" value="true" />\r
+       <param name="send_advance" value="true" />\r
+       \r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       \r
+       <param name="poo" value="false" />\r
+\r
+       <param name="security_click" value="0" />\r
+       <param name="security_timer" value="0" />\r
+       <param name="security_url" value="http://www.npa.go.jp/" />\r
+       <param name="security_post" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       {{param}}\r
+</applet>\r
+</div>\r
+       \r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="¥Á¥±¥Ã¥È¤ò¹¹¿·¤¹¤ë" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>\r
diff --git a/trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_paintbbs/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..935a1be
--- /dev/null
@@ -0,0 +1,140 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+       \r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+       \r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="pbbs.PaintBBS.class"\r
+               archive="{{appletBaseUrl}}PaintBBS.jar" \r
+               name="paintbbs"\r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />         \r
+       <param name="scriptable" value="true" />        \r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />        \r
+       <param name="bar_size" value="20" />\r
+       \r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=paintbbs" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs" />\r
+       \r
+       <param name="tool_advance" value="true" />\r
+       <param name="send_advance" value="true" />\r
+       \r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       \r
+       <param name="poo" value="false" />\r
+\r
+       <param name="security_click" value="0" />\r
+       <param name="security_timer" value="0" />\r
+       <param name="security_url" value="http://www.npa.go.jp/" />\r
+       <param name="security_post" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       {{param}}\r
+</applet>\r
+</div>\r
+       \r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="チケットを更新する" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>\r
diff --git a/trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-euc.html
new file mode 100644 (file)
index 0000000..3873a16
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_Shipainter Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_shipainter/copyrights_japanese-utf8.html
new file mode 100644 (file)
index 0000000..3873a16
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_Shipainter Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..ce3fd14
--- /dev/null
@@ -0,0 +1,137 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+       \r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<script language="javascript" type="text/javascript" src="{{appletBaseUrl}}sp.js"></script>\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+\r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="c.ShiPainter.class"\r
+               name="paintbbs" archive="{{appletBaseUrl}}spainter.jar,{{appletBaseUrl}}res/normal.zip"\r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />         \r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="dir_resource" value="{{appletBaseUrl}}res/" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res_normal.zip" />\r
+       <param name="tools" value="normal" />\r
+       <param name="quality" value="{{quality}}" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />\r
+       \r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=shipainter" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=shipainter" />\r
+\r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       <param name="poo" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       \r
+       {{param}}\r
+</applet>\r
+</div>\r
+\r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="¥Á¥±¥Ã¥È¤ò¹¹¿·¤¹¤ë" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_shipainter/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..bb805a5
--- /dev/null
@@ -0,0 +1,137 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+       \r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<script language="javascript" type="text/javascript" src="{{appletBaseUrl}}sp.js"></script>\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+\r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="c.ShiPainter.class"\r
+               name="paintbbs" archive="{{appletBaseUrl}}spainter.jar,{{appletBaseUrl}}res/normal.zip"\r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />         \r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="dir_resource" value="{{appletBaseUrl}}res/" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res_normal.zip" />\r
+       <param name="tools" value="normal" />\r
+       <param name="quality" value="{{quality}}" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />\r
+       \r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=shipainter" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=shipainter" />\r
+\r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       <param name="poo" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       \r
+       {{param}}\r
+</applet>\r
+</div>\r
+\r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="チケットを更新する" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-euc.html
new file mode 100644 (file)
index 0000000..3873a16
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_Shipainter Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_shipainterpro/copyrights_japanese-utf8.html
new file mode 100644 (file)
index 0000000..3873a16
--- /dev/null
@@ -0,0 +1,3 @@
+{{name}} by <a href="http://shichan.jp/">Shi-chan</a>\r
+( /w Applet_Shipainter Plugin by <a href="http://blog.cles.jp">cles</a> )\r
+<br />
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..d5d7050
--- /dev/null
@@ -0,0 +1,137 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+\r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<script language="javascript" type="text/javascript" src="{{appletBaseUrl}}sp.js"></script>\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+\r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="c.ShiPainter.class"\r
+               name="paintbbs" \r
+               archive="{{appletBaseUrl}}spainter.jar,{{appletBaseUrl}}res/pro.zip" \r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />\r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="dir_resource" value="{{appletBaseUrl}}res/" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res_pro.zip" />\r
+       <param name="tools" value="pro" />\r
+       <param name="quality" value="{{quality}}" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />\r
+\r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=shipainterpro" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=shipainterpro" />\r
+       \r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       <param name="poo" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       {{param}}\r
+</applet>\r
+</div>\r
+       \r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="¥Á¥±¥Ã¥È¤ò¹¹¿·¤¹¤ë" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/applet_shipainterpro/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..f5b1dce
--- /dev/null
@@ -0,0 +1,137 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+<script type="text/javascript" src="{{PluginURL}}paint/prototype-1.4.0.js"></script>   \r
+<script type="text/javascript" src="{{PluginURL}}paint/paint.js"></script>     \r
+\r
+<link rel="stylesheet" type="text/css" href="{{PluginURL}}paint/paint.css" />\r
+\r
+<script language="javascript" type="text/javascript" src="{{appletBaseUrl}}sp.js"></script>\r
+\r
+<!-- header -->\r
+{{header}}\r
+<!-- header -->\r
+\r
+</head>\r
+<body>\r
+\r
+{{beforeapplet}}\r
+\r
+<div style="height: 600px; width: 600px; float:left">\r
+<applet code="c.ShiPainter.class"\r
+               name="paintbbs" \r
+               archive="{{appletBaseUrl}}spainter.jar,{{appletBaseUrl}}res/pro.zip" \r
+               width="600"\r
+               height="600"\r
+               align="top"\r
+               mayscript="true"\r
+               >\r
+       <param name="header_magic" value="{{magic}}" />\r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="image_jpeg" value="{{imgJpeg}}" />\r
+       <param name="image_size" value="{{imgDecrease}}" />\r
+       <param name="compress_level" value="{{imgCompress}}" />\r
+       <param name="animation_max" value="0" />\r
+       <param name="image_interlace" value="false" />\r
+       <param name="layer_count" value="3" />\r
+       \r
+       <param name="dir_resource" value="{{appletBaseUrl}}res/" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res_pro.zip" />\r
+       <param name="tools" value="pro" />\r
+       <param name="quality" value="{{quality}}" />\r
+       \r
+       <param name="undo" value="100" />\r
+       <param name="undo_in_mg" value="50" />\r
+       <param name="mayscript" value="true" />\r
+       <param name="scriptable" value="true" />\r
+\r
+       <param name="url_save" value="{{ActionURL}}?action=plugin&name=Paint&type=postimg&parser={{parser}}" />\r
+       <param name="url_exit" value="{{ActionURL}}?action=plugin&name=Paint&type=postsuccess&prefix={{prefix}}&w={{w}}&h={{h}}&ow={{ow}}&applet=shipainterpro" />\r
+       <param name="send_header" value="user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=shipainterpro" />\r
+       \r
+       <param name="send_language" value="utf-8" />\r
+       <param name="send_header_image_type" value="true" />\r
+       <param name="send_header_timer" value="true" />\r
+       <param name="send_header_count" value="true" />\r
+       <param name="poo" value="false" />\r
+       \r
+       <!-- color -->\r
+       <param name="pro_menu_color_on" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_dk" value="#FFFFFF" />\r
+       <param name="pro_menu_color_on_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_text" value="#222222" />\r
+       <param name="pro_menu_color_off" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_hl" value="#FFFFFF" />\r
+       <param name="pro_menu_color_off_dk" value="#222222" />\r
+\r
+       <param name="bar_color_bk" value="#FFFFFF" />\r
+       <param name="bar_color_frame" value="#FFFFFF" />\r
+       <param name="bar_color_off" value="#FFFFFF" />\r
+       <param name="bar_color_off_dk" value="#222222" />\r
+       <param name="bar_color_off_hl" value="#FFFFFF" />\r
+       <param name="bar_color_on" value="#FFFFFF" />\r
+       <param name="bar_color_on_dk" value="#AA1111" />\r
+       <param name="bar_color_on_hl" value="#AA1111" />\r
+       <param name="bar_color_text" value="#222222" />\r
+               \r
+       <param name="window_color_bar" value="#222222" />\r
+       <param name="window_color_bar_bk" value="#222222" />\r
+       <param name="window_color_bar_hl" value="#222222" />\r
+       <param name="window_color_bar_text" value="#FFFFFF" />\r
+       <param name="window_color_frame" value="#222222" />\r
+       <param name="window_color_text" value="#222222" />\r
+       \r
+       <param name="dlg_color_bk" value="#FFFFFF" />\r
+       <param name="dlg_color_text" value="#222222" />\r
+       \r
+       <param name="color_bar" value="#222222" />\r
+       <param name="color_bar_hl" value="#FFFFFF" />\r
+       <param name="color_bar_shadow" value="#FFFFFF" />\r
+       <param name="color_bk" value="#FFFFFF" />\r
+       <param name="color_bk2" value="#FFFFFF" />\r
+       <param name="color_frame" value="#222222" />\r
+       <param name="color_icon" value="#FFFFFF" />\r
+       <param name="color_iconselect" value="#AA1111" />\r
+       <param name="color_text" value="#222222" />\r
+       \r
+       <param name="image_bkcolor" value="#FFFFFF" />\r
+       \r
+       <param name="l_m_color" value="#222222" />\r
+       <param name="l_m_color_text" value="#FFFFFF" />\r
+               \r
+       <param name="tool_color_bar" value="#FFFFFF" />\r
+       <param name="tool_color_bk" value="#FFFFFF" />\r
+       <param name="tool_color_button" value="#FFFFFF" />\r
+       <param name="tool_color_button2" value="#FFFFFF" />\r
+       <param name="tool_color_frame" value="#222222" />\r
+       <param name="tool_color_text" value="#222222" />\r
+       <!-- color -->\r
+       {{param}}\r
+</applet>\r
+</div>\r
+       \r
+{{afterapplet}}\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+\r
+<input type="button" onclick="getLoginkey()" value="チケットを更新する" /><br/>\r
+message:\r
+<div id="message"></div>\r
+               \r
+<div>\r
+{{copyright}}\r
+</div>\r
+\r
+<script type="text/javascript">\r
+       header = 'user={{user}}&loginkey={{loginkey}}&prefix={{prefix}}&ow={{ow}}&applet=paintbbs';\r
+</script>      \r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/index/help_japanese-euc.html b/trunk/NP_Paint/paint/template/index/help_japanese-euc.html
new file mode 100644 (file)
index 0000000..79c056c
--- /dev/null
@@ -0,0 +1,314 @@
+<h2>NP_Paint ¥Ø¥ë¥×</h2>\r
+\r
+<h3>Plugin³µÍ×<a href="http://cles.jp/"><img border="0" src="http://blog.cles.jp/cles.png"  alt="Powered by CLES" /></a></h3>\r
+\r
+<p>¤ª³¨¤«¤­¥¢¥×¥ì¥Ã¥È¤È¤ÎÏ¢·È¤ò²Äǽ¤Ë¤¹¤ë¥×¥é¥°¥¤¥ó¤Ç¤¹</p>\r
+<p>¢¨¤³¤Î¥×¥é¥°¥¤¥ó¤ÏñÂΤǤÏÆ°¤­¤Þ¤»¤ó¡£²¼µ­¤Î<a href="#must">¡ÖºÇÄã¸Â¤ä¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È¡×</a>¤ò¤´Í÷¤Î¾å¥»¥Ã¥È¥¢¥Ã¥×¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£</p>\r
+\r
+<h3>ɬÍ״Ķ­</h3>\r
+<p>Nucleus: 3.2°Ê¹ß</p>\r
+<p>PHP: 4.3.2°Ê¹ß¡¢¥µ¡¼¥Ð¦¤ÇJPEGÊÑ´¹¤ò»È¤¦¾ì¹ç¤Ë¤ÏGD¥µ¥Ý¡¼¥È¤¬É¬ÍפǤ¹¡£</p>\r
+<p><em>Æ°ºî³Îǧ¤Ï¥µ¡¼¥Ð¦PHP 5.2.5¤ª¤è¤Ó¡¢Nucleus 3.31SP1(UTF-8/EUC-JP)¤Ç¹Ô¤Ã¤Æ¤¤¤Þ¤¹</em></p>\r
+\r
+<p>Æ°ºî³ÎǧºÑ¤ß¥¯¥é¥¤¥¢¥ó¥È(¤³¤ì°Ê³°¤Î´Ä¶­¤ÇÆ°ºî³Îǧ¤¬¤Ç¤­¤¿¾ì¹ç¤Ë¤Ï¤´Ï¢Íí¤¯¤À¤µ¤¤)</p>\r
+<p>¡¦Firefox(win)</p>\r
+<p>¡¦IE6(win)</p>\r
+<p>¡¦Firefox(MacOSX)</p>\r
+<p>¡¦Safari(MacOSX)</p>\r
+<p>¡¦IE5.1(MacOS9)[¤¿¤À¤·¡¢Æ°Åª¥Ñ¥ì¥Ã¥ÈÆ°ºîÉÔ²Ä]</p>\r
+<p><strike>¡¦Netscape7(MacOS9)</strike><em>Æ°ºîÉÔ°ÂÄê¤Î¤¿¤á</em></p>\r
+\r
+<h3>¥Õ¥¡¥¤¥ë¹½À®</h3>\r
+\r
+<p>°µ½Ì¥Õ¥¡¥¤¥ë¤òŸ³«¤¹¤ë¤È°Ê²¼¤ÎÄ̤ê¤Ë¤Ê¤ê¤Þ¤¹¡£</p>\r
+\r
+<p>\r
+<pre>(Nucleus¤Îplugin¥Õ¥©¥ë¥À)\r
+¨§NP_Paint.php\r
+¨§paint/<a name="appletdir"></a>\r
+¨¢¨§<strong>applet/¡¡¢«¡¡¤ª³¨¤«¤­¥¢¥×¥ì¥Ã¥ÈÇÛÃ֥ǥ£¥ì¥¯¥È¥ê</strong>\r
+¨¢¨¢¨§index.html\r
+¨¢¨¢¨¦readme.txt\r
+¨¢¨§Applet_PaintBBS.php <em>(PaintBBS)</em>\r
+¨¢¨§Applet_Shipainter.php <em>(¤·¤£¥Ú¥¤¥ó¥¿¡¼)</em>\r
+¨¢¨§Applet_Shipainterpro.php <em>(¤·¤£¥Ú¥¤¥ó¥¿¡¼Pro)</em>\r
+¨¢¨§index.php\r
+¨¢¨§paint.css\r
+¨¢¨§paint.js\r
+¨¢¨§PaintPlugin.php\r
+¨¢¨§Palette_None.php <em>(¥Ñ¥ì¥Ã¥È¤Ê¤·)</em>\r
+¨¢¨§Palette_Selfy.php <em>(Selfy¥Ñ¥ì¥Ã¥È)</em>\r
+¨¢¨§Palette_WCS.php <em>(WCS¥Ñ¥ì¥Ã¥È)</em>\r
+¨¢¨§Parser_PaintBBS.php\r
+¨¢¨§Viewer_Continue.php <em>(Continueµ¡Ç½)</em>\r
+¨¢¨§Viewer_Pch.php <em>(pch¥Ó¥å¥¢¡¼)</em>\r
+¨¢¨¦Viewer_Spch.php <em>(spch¥Ó¥å¥¢¡¼)</em>\r
+¨¦sharedlibs/\r
+¡¡¨¦<em>PEAR/¶¦Ḁ̈饤¥Ö¥é¥ê·²</em>\r
+</pre>\r
+</p>\r
+\r
+<a name="must"></a>\r
+<h3>ºÇÄã¸Â¤ä¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È</h3>\r
+\r
+<p><strong>¤³¤Î¥×¥é¥°¥¤¥ó¤Ë¤Ï¥é¥¤¥»¥ó¥¹¤Î´Ø·¸¾å¡¢¤ª³¨¤«¤­¤ËɬÍפʥ¢¥×¥ì¥Ã¥ÈÎà¤òƱº­¤·¤Æ¤¤¤Þ¤»¤ó¡£</strong></p>\r
+<p>¡Ê¢¨¥¢¥×¥ì¥Ã¥È¤äưŪ¥Ñ¥ì¥Ã¥È¤ÏNucleus¤È°ã¤¤¡¢GPL¥é¥¤¥»¥ó¥¹¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£¥À¥¦¥ó¥í¡¼¥É¤ÎºÝ¤Ë¤Ï¥é¥¤¥»¥ó¥¹¤ò¤è¤¯Æɤó¤Ç¤¯¤À¤µ¤¤¡£¡Ë</p>\r
+\r
+\r
+<p>¤³¤Î¤¿¤á¡¢²¼µ­¤Î¼ê½ç¤Ë¤Æ¥»¥Ã¥È¥¢¥Ã¥×¤ò¹Ô¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£</p>\r
+\r
+<ol>\r
+  <li>NP_Paint¤Î°µ½Ì¥Õ¥¡¥¤¥ë¤òŸ³«¤·¤ÆNucleus¤Î¥×¥é¥°¥¤¥ó¥Ç¥£¥ì¥¯¥È¥ê¤ËÇÛÃÖ¤·¤Þ¤¹¡£<em>(¾åµ­»²¾È)</em></li>\r
+  <li>²¼µ­¤Î¥ê¥ó¥¯¤è¤ê¥¢¥×¥ì¥Ã¥È,PCH¥Ó¥å¥¢¡¼(¥¢¥Ë¥á¡¼¥·¥ç¥ó¤òºÆÀ¸¤¹¤ë¤È¤­¤Î¤ß)¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Þ¤¹<br />\r
+  ¡¡¡¦<a href="http://hp.vector.co.jp/authors/VA016309/paintbbs/pbbs.html">PaintBBS</a><br />\r
+  ¡¡¡¦<a href="http://hp.vector.co.jp/authors/VA016309/spainter/">¤·¤£¥Ú¥¤¥ó¥¿¡¼(Ê£¿ô¥Õ¥¡¥¤¥ë¥Ð¡¼¥¸¥ç¥ó)</a>\r
+  </li>\r
+  <li>²¼µ­¤Î¥ê¥ó¥¯¤è¤êưŪ¥Ñ¥ì¥Ã¥È¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Þ¤¹<em>(ɬÍפʾì¹ç¤Î¤ß¡£¤Ê¤¯¤Æ¤âÆ°¤­¤Þ¤¹¡£)</em><br />\r
+  ¡¡¡¦<a href="http://wondercatstudio.com/archive/">WCS Æ°Åª¥Ñ¥ì¥Ã¥È¥³¥ó¥È¥í¡¼¥ë¥»¥Ã¥È(DynPalette)</a><br />\r
+  ¡¡¡¦<a href="http://useyan.x0.com/s/cgi/relm/palette_selfy.html">Palette-Selfy</a>\r
+  </li>\r
+  <li>2¡¢3¤Ç¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Õ¥¡¥¤¥ë¤òŸ³«¤·¡¢Ãæ¿È¤òÁ´¤Æ<a href="#appletdir">¡Ö¤ª³¨¤«¤­¥¢¥×¥ì¥Ã¥ÈÇÛÃ֥ǥ£¥ì¥¯¥È¥ê¡×<em>(¾åµ­»²¾È)</em></a>¤ËÇÛÃÖ¤·¤Þ¤¹</li>\r
+  <li>Nucleus´ÉÍý²èÌ̤«¤é¡¢NP_Paint¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ò¼Â¹Ô¤·¤Þ¤¹</li>\r
+  <li>¥×¥é¥°¥¤¥ó¥ª¥×¥·¥ç¥ó¤Î¡Ö¥Ç¥Õ¥©¥ë¥ÈApplet¡×¡Ö¥Ç¥Õ¥©¥ë¥ÈPalette¡×¤Î¥×¥ë¥À¥¦¥ó¤Ë¹àÌܤ¬É½¼¨¤µ¤ì¤Æ¤¤¤ì¤Ð¥¤¥ó¥¹¥È¡¼¥ë¤ÏÀ®¸ù¤Ç¤¹¡£<br />\r
+       ¥ê¥¹¥È¤¬É½¼¨¤¬½Ð¤Ê¤¤¾ì¹ç¤Ë¤ÏÀµ¾ï¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£¥×¥é¥°¥¤¥ó¥ª¥×¥·¥ç¥ó¤Î ¡Ö¥í¥°¤ò½ÐÎϤò¹Ô¤¦¤«¡©¡×¤ò¤Ï¤¤¤Ë¤·¤Æ¡¢´ÉÍý¼ÔÁàºîÍúÎò¤ò»²¾È¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£\r
+       Â­¤ê¤Ê¤¤¥Õ¥¡¥¤¥ë¤¬¥í¥°¤Ë½ÐÎϤµ¤ì¤Æ¤¤¤ë¤Ï¤º¤Ç¤¹¡£\r
+  </li>\r
+  <li>¥¹¥­¥ó¤Î¤É¤³¤«¤Ë<code>&lt;%Paint%&gt;</code>¤òµ­½Ò¤·¤Þ¤¹</li>\r
+  <li>¥í¥°¥¤¥ó¤·¤¿¾õÂ֤ǡ¢¾åµ­¤Î¥¹¥­¥ó¤òɽ¼¨¤¹¤ë¤È¤ª³¨¤«¤­²èÌ̤ËÆþ¤ë¤¿¤á¤Î¥Õ¥©¡¼¥à¤¬½Ð¸½¤·¤Þ¤¹</li>\r
+  <li>¡ÖPaint¡×¥Ü¥¿¥ó¤ò²¡¤¹¤ÈApplet²èÌ̤¬³«¤­¤Þ¤¹¡£<br />\r
+       Applet¤¬É½¼¨¤µ¤ì¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¤ª³¨¤«¤­¥¢¥×¥ì¥Ã¥ÈÇÛÃ֥ǥ£¥ì¥¯¥È¥ê¤ª¤è¤Ó¾å°Ì¥Ç¥£¥ì¥¯¥È¥ê¡¢2¡¢3¤ÇÇÛÃÖ¤·¤¿¥Õ¥¡¥¤¥ë¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò³Îǧ¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£</li>\r
+  <li>¤¢¤È¤Ï³¨¤òÉÁ¤¯¤À¤±¡£<em>ÀßÄê¤Ë¤è¤Ã¤Æ¤Ï¥Õ¥¡¥¤¥ë¤¬¥»¡¼¥Ö¤µ¤ì¤Ê¤¤²ÄǽÀ­¤â¤¢¤ë¤Î¤Ç¡¢°ìÅ٤ϻî½ñ¤­¤ò¤¹¤ë¤³¤È¤ò¥ª¥¹¥¹¥á¤·¤Þ¤¹¡£</em></li>\r
+</ol>\r
+\r
+<h3>¥ª¥×¥·¥ç¥ó</h3>\r
+\r
+<p>¥×¥é¥°¥¤¥ó¥ª¥×¥·¥ç¥ó¡Ê¥µ¥¤¥ÈÁ´ÂΤÎÀßÄê¡Ë</p>\r
+<table>\r
+<tr>\r
+       <th>¥ª¥×¥·¥ç¥ó</th>\r
+       <th>²òÀâ</th>\r
+</tr>\r
+<tr>\r
+       <td>¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(Éý)</td>\r
+       <td>\r
+               ¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(Éý)¤ò»ØÄꤷ¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: 300\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(¹â¤µ)</td>\r
+       <td>\r
+               ¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥ó¥Ð¥¹¥µ¥¤¥º(¹â¤µ)¤ò»ØÄꤷ¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: 300\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>Æ°²è¥Õ¥¡¥¤¥ë¤òÊݸ¤¹¤ë¤«¡©</td>\r
+       <td>\r
+               ¥Ç¥Õ¥©¥ë¥È¤ÇÆ°²è¥Õ¥¡¥¤¥ë(pch/spch)¤òÊݸ¤¹¤ë¤«»ØÄꤷ¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: ¤Ï¤¤\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>¥Ç¥Õ¥©¥ë¥ÈApplet</td>\r
+       <td>\r
+               ¥Ç¥Õ¥©¥ë¥È¤Ç»ÈÍѤ¹¤ëApplet¤ò»ØÄꤷ¤Þ¤¹¡£\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>¥Ç¥Õ¥©¥ë¥È¤Î²èÁü·Á¼°</td>\r
+       <td>\r
+               ¥Ç¥Õ¥©¥ë¥È¤Ç»ÈÍѤ¹¤ë²èÁü·Á¼°¤ò»ØÄꤷ¤Þ¤¹¡£Ä̾AUTO¤Î¾ì¹ç¤Ë¥Ç¡¼¥¿¤Ï°ìÈÖ¾®¤µ¤¯¤Ê¤ê¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: AUTO \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>²èÁü·Á¼°¤¬AUTO¤Î¾ì¹ç¤Î¸º¿§¡¦°µ½ÌΨ[0-100]</td>\r
+       <td>\r
+               PNG¤Î¸º¿§Î¨¡¢JPEG¤Î°µ½ÌΨ¤òÀßÄꤷ¤Þ¤¹¡£²¼µ­¤ÎïçÃͤò±Û¤¨¤¿¾ì¹ç¤Ë»È¤ï¤ì¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: 15 <em>(¿ä¾©ÃÍ)</em> \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>²èÁü·Á¼°¤¬AUTO¤Î¾ì¹ç¤Ë¸º¿§¤¬Í­¸ú¤Ë¤Ê¤ëïçÃÍ[KB](ÍøÍѤ·¤Ê¤¤¾ì¹ç¤Ï0)</td>\r
+       <td>\r
+               ¥Õ¥¡¥¤¥ë¤¬¤³¤ÎÍÆÎ̤òĶ¤¨¤ë¾ì¹ç¤Ë¸º¿§¤ò¹Ô¤¤¤Þ¤¹¡£¤³¤Îµ¡Ç½¤òÍøÍѤ·¤Ê¤¤¾ì¹ç¤Ë¤Ï0¡¢É¬¤º¸º¿§¤·¤¿¤¤¾ì¹ç¤Ë¤Ï1¤òÀßÄꤷ¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: 60 <em>(¿ä¾©ÃÍ)</em> \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>²èÁü·Á¼°¤¬JPG¤Î¾ì¹ç¤Î²èÁüÉʼÁ[0-100]</td>\r
+       <td>\r
+               ²èÁü·Á¼°¤ÇJPG¤òÁªÂò¤·¤¿¾ì¹ç¤Î²èÁüÉʼÁ<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: 75 \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>ËÜʸ¥Æ¥ó¥×¥ì¡¼¥È</td>\r
+       <td>\r
+               ¤ª³¨¤«¤­¸å¤ËÄɲ乤륨¥ó¥È¥ê¤ÎËÜʸ¤ò»ØÄꤷ¤Þ¤¹¡£\r
+               ¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤Ç»È¤¨¤ë¥¿¥°¤Ë¤Ä¤¤¤Æ¤ÏÊÌÅÓ²òÀ⤷¤Æ¤¢¤ê¤Þ¤¹<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: &lt;%paint(&lt;%url%&gt;|&lt;%w%&gt;|&lt;%h%&gt;|pbbsimage)%&gt; \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>Paint¥¿¥°¥Æ¥ó¥×¥ì¡¼¥È</td>\r
+       <td>\r
+               ËÜʸÃæ¤Ëµ­½Ò¤·¤¿&lt;%paint()%&gt;¤ò¤É¤Î¤è¤¦¤ËŸ³«¤¹¤ë¤«»ØÄꤷ¤Þ¤¹¡£\r
+               ¥¢¥Ë¥á¡¼¥·¥ç¥ó¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤é¤Ê¤¤¾ì¹ç¤Ë¤Ï¤³¤Î¥Æ¥ó¥×¥ì¡¼¥È¤Ï»ÈÍѤµ¤ì¤º¡¢²¼µ­¤Î²èÁüÉô¥Æ¥ó¥×¥ì¡¼¥È¤Î¤ß¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£\r
+               ¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤Ç»È¤¨¤ë¥¿¥°¤Ë¤Ä¤¤¤Æ¤ÏÊÌÅÓ²òÀ⤷¤Æ¤¢¤ê¤Þ¤¹<br />\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>²èÁüÉô¥Æ¥ó¥×¥ì¡¼¥È</td>\r
+       <td>\r
+               Paint¥¿¥°¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤Î&lt;%img%&gt;¤ò¤É¤Î¤è¤¦¤ËÃÖ´¹¤¹¤ë¤«»ØÄꤷ¤Þ¤¹¡£\r
+               ¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤Ç»È¤¨¤ë¥¿¥°¤Ë¤Ä¤¤¤Æ¤ÏÊÌÅÓ²òÀ⤷¤Æ¤¢¤ê¤Þ¤¹<br />\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>¥í¥°¤ò½ÐÎϤò¹Ô¤¦¤«¡©</td>\r
+       <td>\r
+               <code>¤Ï¤¤</code>¤Ë¤¹¤ë¤³¤È¤Ë¤è¤ê¡Ö´ÉÍý¼ÔÁàºîÍúÎò¡×¥í¥°¤òµ­Ï¿¤¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£\r
+               ËÄÂç¤Ê¥í¥°¤¬½ÐÎϤµ¤ì¤ë¤Î¤ÇÆ°ºî³Îǧ»þ°Ê³°¤Ï<code>¤¤¤¤¤¨</code>¤Ë¤·¤Æ¤ª¤¯¤³¤È¤ò¿ä¾©¤·¤Þ¤¹¡£\r
+               <code>¤¤¤¤¤¨</code>¤Î¾ì¹ç¤Ç¤¢¤Ã¤Æ¤â½ÅÂç¤Ê¥¨¥é¡¼¤Ë¤Ä¤¤¤Æ¤Ïµ­Ï¿¤µ¤ì¤Þ¤¹¡£<br />\r
+               ¥Ç¥Õ¥©¥ë¥È: ¤¤¤¤¤¨\r
+       </td>\r
+</tr>\r
+</table>\r
+\r
+<h3>¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤ÇÍøÍѲÄǽ¤Ê¥¿¥°</h3>\r
+\r
+<p>¥Æ¥ó¥×¥ì¡¼¥ÈÃæ¤Ë¤Ï°Ê²¼¤Î¥¿¥°¤¬ÍøÍѤǤ­¤Þ¤¹¡£</p>\r
+\r
+<table>\r
+<tr>\r
+       <th>¥¿¥°</th>\r
+       <th>²òÀâ</th>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%url%&gt;</td>\r
+       <td>Êݸ¤µ¤ì¤¿²èÁü¤Îmedia¥Õ¥©¥ë¥À°Ê²¼¤Îurl</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%w%&gt;</td>\r
+       <td>Êݸ¤µ¤ì¤¿²èÁü¤Î²£Éý</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%h%&gt;</td>\r
+       <td>Êݸ¤µ¤ì¤¿²èÁü¤Î½ÄÉý</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%alt%&gt;</td>\r
+       <td>alt¥Æ¥­¥¹¥È</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%img%&gt;</td>\r
+       <td>\r
+               ¢¨Paint¥¿¥°¥Æ¥ó¥×¥ì¡¼¥È¤Î¤ß<br />\r
+               ²èÁüÉô¥Æ¥ó¥×¥ì¡¼¥È¤ÎŸ³«°ÌÃÖ¤ò»ØÄꤷ¤Þ¤¹¡£\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%viewer%&gt;</td>\r
+       <td>\r
+               ¥¢¥Ë¥á¡¼¥·¥ç¥ó¥Õ¥¡¥¤¥ë¤òɽ¼¨¤¹¤ë¤¿¤á¤ÎURL\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%continue%&gt;</td>\r
+       <td>\r
+               Continueµ¡Ç½¤Ø¤Î¥ê¥ó¥¯<br />\r
+               ¢¨¥í¥°¥¤¥ó»þ¤«¤Ä¡¢¼«Ê¬¤Î¥³¥ì¥¯¥·¥ç¥óÆâ¤Î¤ª³¨¤«¤­¤Î¤ßɽ¼¨¤µ¤ì¤Þ¤¹\r
+       </td>\r
+</tr>\r
+</table>\r
+\r
+<h3>¥µ¥Ý¡¼¥È¤È¥Ð¥°¥ì¥Ý¡¼¥È</h3>\r
+\r
+<p>ÌäÂ꤬²ò·è¤Ç¤­¤Ê¤¤¾ì¹ç¤Ë¤Ï<a href="http://japan.nucleuscms.org/bb/">Nucleus(JP)¥Õ¥©¡¼¥é¥à</a>¤ò³èÍѤ·¤Þ¤·¤ç¤¦¡£</p>\r
+<p>¥Ð¥°¥ì¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤ÏÇÛÉÛ¸µ¤Î<a href="http://blog.cles.jp/np_cles">NP_cles()</a>¤Ë¤Æ¼õ¤±ÉÕ¤±¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢³ºÅö¤Î¥Ð¡¼¥¸¥ç¥ó¤Î¥¨¥ó¥È¥ê¤Ë¥³¥á¥ó¥ÈËô¤Ï¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¤Ç¤É¤¦¤¾¡£</p>\r
+<p>¡ÖÆ°ºî³Îǧ¤·¤Þ¤·¤¿¡×¤È¤¤¤¦¤À¤±¤Ç¤â³«È¯¼Ô¤Ë¤Ï½ÅÍפʾðÊó¤Ë¤Ê¤ê¤Þ¤¹¡£</p>\r
+\r
+<h3>¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë</h3>\r
+\r
+<p><code>NP_Paint</code>¤ò´°Á´¤Ë¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤¿¤á¤Î¼ê½ç¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹</p>\r
+\r
+<ol>\r
+  <li>¡Ö¥×¥é¥°¥¤¥ó´ÉÍý¡×¤«¤éNP_Paint¤ò¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë</li>\r
+  <li>Nucleus¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤¤¤ë¥µ¡¼¥Ð¤Î<code>nucleus/plugin/</code>¥Ç¥£¥ì¥¯¥È¥ê¤«¤é<code>NP_Paint.php</code>¤È<code>paint</code>¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤¹¤ë</li>\r
+</ol>\r
+\r
+<h3>¥Ð¡¼¥¸¥ç¥óÍúÎò</h3>\r
+\r
+<p>¿·¥Ð¡¼¥¸¥ç¥ó¤Ï<a href="http://blog.cles.jp/np_cles/">NP_cles()</a>¤Ç³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£</p>\r
+\r
+<ul>\r
+       <li>Version 1.18: (2010/06/06)</li>\r
+       <li>¡¡[Fixed] É½¼¨¤µ¤ì¤ëHTML¤ÎºÙÉô¤ò²þÎÉ</li>\r
+       <li>¡¡[Fixed] register_globals,allow_url_fopen,allow_url_include¤¬on¤Î¾ì¹ç¤Ë¥ê¥â¡¼¥È¥³¡¼¥É¥¤¥ó¥¸¥§¥¯¥·¥ç¥ó¤¬È¯À¸¤¹¤ëÌäÂê¤ËÂбþ¤·¤Þ¤·¤¿(Thanks Katsumi¤µ¤ó)</li>\r
+       <li>Version 1.17: (2008/03/03)</li>\r
+       <li>¡¡[Changed] ´ØÏ¢¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥É»þ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Î½èÍý¤ò¸·³Ê¤Ë¤·¤¿</li>\r
+       <li>¡¡[Changed] ¥í¥°¤¬¾ÜºÙ¤Ë½ÐÎϤµ¤ì¤ë¤è¤¦¤Ë¤·¤¿</li>\r
+       <li>¡¡[Fixed] GD¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤ÎÉÔ¶ñ¹ç¤ò½¤Àµ</li>\r
+       <li>Version 1.16: (2007/06/17)</li>\r
+       <li>¡¡[Fixed] mysql_query()¤òsql_query()¤ËÊѹ¹</li>\r
+       <li>¡¡[Fixed] ¥Ç¥Ð¥Ã¥°ÍѤε­½Ò¤¬¤½¤Î¤Þ¤Þ¤Ë¤Ê¤Ã¤Æ¤¤¤¿Éôʬ¤ò¥³¥á¥ó¥È²½</li>\r
+       <li>¡¡[Changed] ¥Æ¥ó¥×¥ì¡¼¥È¤Ç»È¤¦¤³¤È¤¬¤Ç¤­¤ëÊÑ¿ô¤Î¸«Ä¾¤·</li>\r
+       <li>¡¡[Fixed] ¥Ó¥å¥¢¡¼Éôʬ¤Îtypo¤òÄûÀµ</li>\r
+       <li>Version 1.15: (2006/11/26)</li>\r
+       <li>¡¡[Added] Ticket½èÍý¤òÄɲÃ(CSRFÂкö)</li>\r
+       <li>Version 1.14: (2006/10/09)</li>\r
+       <li>¡¡[Changed] ²èÁüÅê¹Æ»þ¤Îǧ¾ÚÊýË¡¤òÊѹ¹</li>\r
+       <li>¡¡[Added] Åê¹Æ¥¨¥é¡¼¤ò²óÈò¤¹¤ë¤¿¤á¤Îµ¡Ç½¤òÄɲÃ</li>\r
+       <li>¡¡[Changed] Åê¹Æ²èÁü¤ËÉÕ¤¯¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤òÆüÉդˤ·¤¿</li>\r
+       <li>Version 1.13: (2006/09/30)</li>\r
+       <li>¡¡[Changed] ¥»¥­¥å¥ê¥Æ¥£¤Î¸þ¾å</li>\r
+       <li>Version 1.12: (2006/05/13)</li>\r
+       <li>¡¡[Fixed] blog¤Î´ÉÍý¸¢¸Â¤ò»ý¤¿¤Ê¤¤¥æ¡¼¥¶¡¼¤ÎÅê¹Æ¤¬¥¨¥é¡¼¤È¤Ê¤ëÉÔ¶ñ¹ç¤ò½¤Àµ</li>     \r
+       <li>¡¡[Fixed] ¥¨¥ó¥È¥êÅê¹Æ»þ¤Ë¥³¥ì¥¯¥·¥ç¥ó¤ò¾Êά¤·¤¿¾ì¹ç¤ÎÉÔ¶ñ¹ç¤ò½¤Àµ¤·¤¿</li> \r
+       <li>¡¡[Fixed] Safari¤Ç¤ÎÉÔ¶ñ¹ç¤ò½¤Àµ</li>       \r
+       <li>¡¡[Added] UTF-8,EUC-JPÈǤòÅý°ì¤·¤¿</li>\r
+       <li>Version 1.11: (2006/03/19)</li>\r
+       <li>¡¡[Fixed] &lt;%Paint%&gt;¤Çɽ¼¨¤µ¤ì¤ëºÝ¤Î¥Õ¥©¡¼¥à¤òÊѹ¹¤·¤¿</li>\r
+       <li>¡¡[Fixed] ¥é¥¤¥»¥ó¥¹¤òÊѹ¹¤·¤¿</li>\r
+       <li>Version 1.10: (2005/10/30)</li>\r
+       <li>¡¡[Added] QualityÃͤÎÀßÄê¤ËÂбþ</li>\r
+       <li>¡¡[Fixed] Continue»þ¤Ë¤·¤£¥Ú¥¤¥ó¥¿¡¼¤È¤·¤£¥Ú¥¤¥ó¥¿¡¼Pro¤Î¼«Æ°ÁªÂò¤ÎÌäÂê¤ò²ò·è</li>\r
+       <li>Version 1.9: (2005/10/05)</li>\r
+       <li>¡¡[Fixed] ¥Õ¥¡¥¤¥ë¤ÎÊݸÊýË¡¤ÎÊѹ¹¤òº¬ËÜŪ¤ËÊѹ¹</li>\r
+       <li>¡¡[Info ] PHP5´Ä¶­¤Ç¤ÎÆ°ºî¤ò³Îǧ</li>\r
+       <li>¡¡[Added] Continue»þ¤ÎÆɤ߹þ¤ß¸µ¤ò¥¢¥Ë¥á¥Õ¥¡¥¤¥ë¤È²èÁü¤«¤éÁª¤Ù¤ë¤è¤¦¤Ë¤·¤¿</li>     \r
+       <li>Version 1.8: (2005/10/04)</li>\r
+       <li>¡¡[Fixed] ¥Õ¥¡¥¤¥ë¤ÎÊݸÊýË¡¤ÎÊѹ¹¤È¥¢¥×¥ì¥Ã¥È¤Î¥Ñ¥é¥á¡¼¥¿Ä´À°¡Ê¥Õ¥¡¥¤¥ë¤¬²õ¤ì¤ë¸½¾Ý¤ËÂбþ¡Ë</li>   \r
+       <li>¡¡[Added] ´ÉÍý²èÌ̤«¤éApplet/Palette¤¬¥¤¥ó¥¹¥È¡¼¥ë¤Ç¤­¤ëµ¡Ç½¤òÄɲÃ</li>     \r
+       <li>¡¡[Added] ´ÉÍý²èÌ̤«¤éÆ°ºî³Îǧ¤¬¤Ç¤­¤ëµ¡Ç½¤òÄɲÃ</li>\r
+       <li>Version 1.7: (2005/09/01)</li>\r
+       <li>¡¡[Added] ²èÁü¤ÎÊݸ·Á¼°¡¢´ØÏ¢¥Ñ¥é¥á¡¼¥¿¤¬ÀßÄê¤Ç¤­¤ë¤è¤¦¤Ë½¤Àµ</li> \r
+       <li>Version 1.6: (2005/08/20)</li>\r
+       <li>¡¡[Added] Continueµ¡Ç½¤ò¼ÂÁõ</li>\r
+       <li>¡¡[Info ] MacOS9¤Ç¤ÎÆ°ºî³Îǧ</li>           \r
+       <li>Version 1.5: (2005/08/04)</li>\r
+       <li>¡¡[Fixed] Firefox(MacOSX)¤ÇÆ°ºî¤·¤Ê¤¤¥Ð¥°¤ò½¤Àµ</li>        \r
+       <li>Version 1.4(beta): (2005/07/31)</li>\r
+       <li>¡¡[Added] &lt;%paint()%&gt;¤òÄɲÃ(image,popup¤È°ú¿ô¸ß´¹)</li>       \r
+       <li>¡¡[Added] pch/spch¤ÎºÆÀ¸¤ËÂбþ¤·¤¿(¥Ó¥å¥¢¡¼¤Î¥¤¥ó¥¹¥È¡¼¥ë¤¬É¬Í×)</li>\r
+       <li>¡¡[Added] WCSDynPalette¤ò»ÈÍѤ¹¤ëºÝ¡¢ºÇ½é¤ËÆɤ߹þ¤à¥Ñ¥ì¥Ã¥È¤òÁªÂò¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿</li>\r
+       <li>Version 1.3(beta): (2005/07/28)</li>\r
+       <li>¡¡[Fixed] Åê¹Æ¥¨¥é¡¼»þ¤Ë500 Internal Server Error¤òÊÖ¤¹¤è¤¦¤Ë¤·¤¿</li>\r
+       <li>¡¡[Fixed] ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¸·Ì©¤Ë¤·¤¿</li>\r
+       <li>Version 1.2(beta): (2005/07/26)</li>\r
+       <li>¡¡[Fixed] ¤ª³¨¤«¤­¸å¤Ë&lt;%image%&gt;¤òÀ¸À®¤¹¤ëÉôʬÊѹ¹</li>\r
+       <li>Version 1.1(beta): (2005/07/24)</li>\r
+       <li>¡¡[Fixed] IE¤ÇÅê¹Æ¤Ç¤­¤Ê¤¤¥Ð¥°¤ËÂбþ¤·¤¿</li>\r
+       <li>Version 1.0(beta): (2005/07/23)</li>\r
+       <li>¡¡[New!] ¥Ù¡¼¥¿ÈǤȤ·¤Æ¿·µ¬¸ø³«</li>\r
+</ul>\r
+\r
+<h3>³«È¯¼Ô¤Ë¤Ä¤¤¤Æ</h3>\r
+\r
+<ul>\r
+  <li><a href="http://blog.cles.jp/member/1">hsur</a> (<a href="http://blog.cles.jp/">cles::blog</a>)</li>\r
+  <li>ÇÛÉÛ¸µ¡§ <a href="http://blog.cles.jp/np_cles/category/31/subcatid/5">NP_cles() - NP_Paint</a></li>\r
+  <li>¥É¥Í¡¼¥·¥ç¥ó¤ä»Å»ö¤Î¤´°ÍÍê¤â´¿·Þ¤·¤Þ¤¹¡£</li>\r
+</ul>\r
diff --git a/trunk/NP_Paint/paint/template/index/help_japanese-utf8.html b/trunk/NP_Paint/paint/template/index/help_japanese-utf8.html
new file mode 100644 (file)
index 0000000..f0e0373
--- /dev/null
@@ -0,0 +1,314 @@
+<h2>NP_Paint ヘルプ</h2>\r
+\r
+<h3>Plugin概要<a href="http://cles.jp/"><img border="0" src="http://blog.cles.jp/cles.png"  alt="Powered by CLES" /></a></h3>\r
+\r
+<p>お絵かきアプレットとの連携を可能にするプラグインです</p>\r
+<p>※このプラグインは単体では動きません。下記の<a href="#must">「最低限やらなければならないこと」</a>をご覧の上セットアップを行ってください。</p>\r
+\r
+<h3>必要環境</h3>\r
+<p>Nucleus: 3.2以降</p>\r
+<p>PHP: 4.3.2以降、サーバ側でJPEG変換を使う場合にはGDサポートが必要です。</p>\r
+<p><em>動作確認はサーバ側PHP 5.2.5および、Nucleus 3.31SP1(UTF-8/EUC-JP)で行っています</em></p>\r
+\r
+<p>動作確認済みクライアント(これ以外の環境で動作確認ができた場合にはご連絡ください)</p>\r
+<p>・Firefox(win)</p>\r
+<p>・IE6(win)</p>\r
+<p>・Firefox(MacOSX)</p>\r
+<p>・Safari(MacOSX)</p>\r
+<p>・IE5.1(MacOS9)[ただし、動的パレット動作不可]</p>\r
+<p><strike>・Netscape7(MacOS9)</strike><em>動作不安定のため</em></p>\r
+\r
+<h3>ファイル構成</h3>\r
+\r
+<p>圧縮ファイルを展開すると以下の通りになります。</p>\r
+\r
+<p>\r
+<pre>(Nucleusのpluginフォルダ)\r
+├NP_Paint.php\r
+├paint/<a name="appletdir"></a>\r
+│├<strong>applet/ ← お絵かきアプレット配置ディレクトリ</strong>\r
+││├index.html\r
+││└readme.txt\r
+│├Applet_PaintBBS.php <em>(PaintBBS)</em>\r
+│├Applet_Shipainter.php <em>(しぃペインター)</em>\r
+│├Applet_Shipainterpro.php <em>(しぃペインターPro)</em>\r
+│├index.php\r
+│├paint.css\r
+│├paint.js\r
+│├PaintPlugin.php\r
+│├Palette_None.php <em>(パレットなし)</em>\r
+│├Palette_Selfy.php <em>(Selfyパレット)</em>\r
+│├Palette_WCS.php <em>(WCSパレット)</em>\r
+│├Parser_PaintBBS.php\r
+│├Viewer_Continue.php <em>(Continue機能)</em>\r
+│├Viewer_Pch.php <em>(pchビュアー)</em>\r
+│└Viewer_Spch.php <em>(spchビュアー)</em>\r
+└sharedlibs/\r
+ └<em>PEAR/共通ライブラリ群</em>\r
+</pre>\r
+</p>\r
+\r
+<a name="must"></a>\r
+<h3>最低限やらなければならないこと</h3>\r
+\r
+<p><strong>このプラグインにはライセンスの関係上、お絵かきに必要なアプレット類を同梱していません。</strong></p>\r
+<p>(※アプレットや動的パレットはNucleusと違い、GPLライセンスではありません。ダウンロードの際にはライセンスをよく読んでください。)</p>\r
+\r
+\r
+<p>このため、下記の手順にてセットアップを行う必要があります。</p>\r
+\r
+<ol>\r
+  <li>NP_Paintの圧縮ファイルを展開してNucleusのプラグインディレクトリに配置します。<em>(上記参照)</em></li>\r
+  <li>下記のリンクよりアプレット,PCHビュアー(アニメーションを再生するときのみ)をダウンロードします<br />\r
+   ・<a href="http://hp.vector.co.jp/authors/VA016309/paintbbs/pbbs.html">PaintBBS</a><br />\r
+   ・<a href="http://hp.vector.co.jp/authors/VA016309/spainter/">しぃペインター(複数ファイルバージョン)</a>\r
+  </li>\r
+  <li>下記のリンクより動的パレットをダウンロードします<em>(必要な場合のみ。なくても動きます。)</em><br />\r
+   ・<a href="http://wondercatstudio.com/archive/">WCS 動的パレットコントロールセット(DynPalette)</a><br />\r
+   ・<a href="http://useyan.x0.com/s/cgi/relm/palette_selfy.html">Palette-Selfy</a>\r
+  </li>\r
+  <li>2、3でダウンロードしたファイルを展開し、中身を全て<a href="#appletdir">「お絵かきアプレット配置ディレクトリ」<em>(上記参照)</em></a>に配置します</li>\r
+  <li>Nucleus管理画面から、NP_Paintのインストールを実行します</li>\r
+  <li>プラグインオプションの「デフォルトApplet」「デフォルトPalette」のプルダウンに項目が表示されていればインストールは成功です。<br />\r
+       リストが表示が出ない場合には正常にインストールされていません。プラグインオプションの 「ログを出力を行うか?」をはいにして、管理者操作履歴を参照してみてください。\r
+       足りないファイルがログに出力されているはずです。\r
+  </li>\r
+  <li>スキンのどこかに<code>&lt;%Paint%&gt;</code>を記述します</li>\r
+  <li>ログインした状態で、上記のスキンを表示するとお絵かき画面に入るためのフォームが出現します</li>\r
+  <li>「Paint」ボタンを押すとApplet画面が開きます。<br />\r
+       Appletが表示されない場合には、お絵かきアプレット配置ディレクトリおよび上位ディレクトリ、2、3で配置したファイルのパーミッションを確認してみてください。</li>\r
+  <li>あとは絵を描くだけ。<em>設定によってはファイルがセーブされない可能性もあるので、一度は試書きをすることをオススメします。</em></li>\r
+</ol>\r
+\r
+<h3>オプション</h3>\r
+\r
+<p>プラグインオプション(サイト全体の設定)</p>\r
+<table>\r
+<tr>\r
+       <th>オプション</th>\r
+       <th>解説</th>\r
+</tr>\r
+<tr>\r
+       <td>デフォルトのキャンバスサイズ(幅)</td>\r
+       <td>\r
+               デフォルトのキャンバスサイズ(幅)を指定します。<br />\r
+               デフォルト: 300\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>デフォルトのキャンバスサイズ(高さ)</td>\r
+       <td>\r
+               デフォルトのキャンバスサイズ(高さ)を指定します。<br />\r
+               デフォルト: 300\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>動画ファイルを保存するか?</td>\r
+       <td>\r
+               デフォルトで動画ファイル(pch/spch)を保存するか指定します。<br />\r
+               デフォルト: はい\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>デフォルトApplet</td>\r
+       <td>\r
+               デフォルトで使用するAppletを指定します。\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>デフォルトの画像形式</td>\r
+       <td>\r
+               デフォルトで使用する画像形式を指定します。通常、AUTOの場合にデータは一番小さくなります。<br />\r
+               デフォルト: AUTO \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>画像形式がAUTOの場合の減色・圧縮率[0-100]</td>\r
+       <td>\r
+               PNGの減色率、JPEGの圧縮率を設定します。下記の閾値を越えた場合に使われます。<br />\r
+               デフォルト: 15 <em>(推奨値)</em> \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>画像形式がAUTOの場合に減色が有効になる閾値[KB](利用しない場合は0)</td>\r
+       <td>\r
+               ファイルがこの容量を超える場合に減色を行います。この機能を利用しない場合には0、必ず減色したい場合には1を設定します。<br />\r
+               デフォルト: 60 <em>(推奨値)</em> \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>画像形式がJPGの場合の画像品質[0-100]</td>\r
+       <td>\r
+               画像形式でJPGを選択した場合の画像品質<br />\r
+               デフォルト: 75 \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>本文テンプレート</td>\r
+       <td>\r
+               お絵かき後に追加するエントリの本文を指定します。\r
+               テンプレート内で使えるタグについては別途解説してあります<br />\r
+               デフォルト: &lt;%paint(&lt;%url%&gt;|&lt;%w%&gt;|&lt;%h%&gt;|pbbsimage)%&gt; \r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>Paintタグテンプレート</td>\r
+       <td>\r
+               本文中に記述した&lt;%paint()%&gt;をどのように展開するか指定します。\r
+               アニメーションファイルが見つからない場合にはこのテンプレートは使用されず、下記の画像部テンプレートのみが出力されます。\r
+               テンプレート内で使えるタグについては別途解説してあります<br />\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>画像部テンプレート</td>\r
+       <td>\r
+               Paintタグテンプレート内の&lt;%img%&gt;をどのように置換するか指定します。\r
+               テンプレート内で使えるタグについては別途解説してあります<br />\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>ログを出力を行うか?</td>\r
+       <td>\r
+               <code>はい</code>にすることにより「管理者操作履歴」ログを記録するようになります。\r
+               膨大なログが出力されるので動作確認時以外は<code>いいえ</code>にしておくことを推奨します。\r
+               <code>いいえ</code>の場合であっても重大なエラーについては記録されます。<br />\r
+               デフォルト: いいえ\r
+       </td>\r
+</tr>\r
+</table>\r
+\r
+<h3>テンプレート内で利用可能なタグ</h3>\r
+\r
+<p>テンプレート中には以下のタグが利用できます。</p>\r
+\r
+<table>\r
+<tr>\r
+       <th>タグ</th>\r
+       <th>解説</th>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%url%&gt;</td>\r
+       <td>保存された画像のmediaフォルダ以下のurl</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%w%&gt;</td>\r
+       <td>保存された画像の横幅</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%h%&gt;</td>\r
+       <td>保存された画像の縦幅</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%alt%&gt;</td>\r
+       <td>altテキスト</td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%img%&gt;</td>\r
+       <td>\r
+               ※Paintタグテンプレートのみ<br />\r
+               画像部テンプレートの展開位置を指定します。\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%viewer%&gt;</td>\r
+       <td>\r
+               アニメーションファイルを表示するためのURL\r
+       </td>\r
+</tr>\r
+<tr>\r
+       <td>&lt;%continue%&gt;</td>\r
+       <td>\r
+               Continue機能へのリンク<br />\r
+               ※ログイン時かつ、自分のコレクション内のお絵かきのみ表示されます\r
+       </td>\r
+</tr>\r
+</table>\r
+\r
+<h3>サポートとバグレポート</h3>\r
+\r
+<p>問題が解決できない場合には<a href="http://japan.nucleuscms.org/bb/">Nucleus(JP)フォーラム</a>を活用しましょう。</p>\r
+<p>バグレポートについては配布元の<a href="http://blog.cles.jp/np_cles">NP_cles()</a>にて受け付けていますので、該当のバージョンのエントリにコメント又はトラックバックでどうぞ。</p>\r
+<p>「動作確認しました」というだけでも開発者には重要な情報になります。</p>\r
+\r
+<h3>アンインストール</h3>\r
+\r
+<p><code>NP_Paint</code>を完全にアンインストールするための手順は以下の通りです</p>\r
+\r
+<ol>\r
+  <li>「プラグイン管理」からNP_Paintをアンインストールする</li>\r
+  <li>Nucleusをインストールしているサーバの<code>nucleus/plugin/</code>ディレクトリから<code>NP_Paint.php</code>と<code>paint</code>ディレクトリを削除する</li>\r
+</ol>\r
+\r
+<h3>バージョン履歴</h3>\r
+\r
+<p>新バージョンは<a href="http://blog.cles.jp/np_cles/">NP_cles()</a>で確認してください。</p>\r
+\r
+<ul>\r
+       <li>Version 1.18: (2010/06/06)</li>\r
+       <li> [Fixed] 表示されるHTMLの細部を改良</li>\r
+       <li> [Fixed] register_globals,allow_url_fopen,allow_url_includeがonの場合にリモートコードインジェクションが発生する問題に対応しました(Thanks Katsumiさん)</li>\r
+       <li>Version 1.17: (2008/03/03)</li>\r
+       <li> [Changed] 関連ファイルのロード時にエラーが発生した場合の処理を厳格にした</li>\r
+       <li> [Changed] ログが詳細に出力されるようにした</li>\r
+       <li> [Fixed] GDがインストールされていない場合の不具合を修正</li>\r
+       <li>Version 1.16: (2007/06/17)</li>\r
+       <li> [Fixed] mysql_query()をsql_query()に変更</li>\r
+       <li> [Fixed] デバッグ用の記述がそのままになっていた部分をコメント化</li>\r
+       <li> [Changed] テンプレートで使うことができる変数の見直し</li>\r
+       <li> [Fixed] ビュアー部分のtypoを訂正</li>\r
+       <li>Version 1.15: (2006/11/26)</li>\r
+       <li> [Added] Ticket処理を追加(CSRF対策)</li>\r
+       <li>Version 1.14: (2006/10/09)</li>\r
+       <li> [Changed] 画像投稿時の認証方法を変更</li>\r
+       <li> [Added] 投稿エラーを回避するための機能を追加</li>\r
+       <li> [Changed] 投稿画像に付くプレフィックスを日付にした</li>\r
+       <li>Version 1.13: (2006/09/30)</li>\r
+       <li> [Changed] セキュリティの向上</li>\r
+       <li>Version 1.12: (2006/05/13)</li>\r
+       <li> [Fixed] blogの管理権限を持たないユーザーの投稿がエラーとなる不具合を修正</li>      \r
+       <li> [Fixed] エントリ投稿時にコレクションを省略した場合の不具合を修正した</li>  \r
+       <li> [Fixed] Safariでの不具合を修正</li>      \r
+       <li> [Added] UTF-8,EUC-JP版を統一した</li>\r
+       <li>Version 1.11: (2006/03/19)</li>\r
+       <li> [Fixed] &lt;%Paint%&gt;で表示される際のフォームを変更した</li>\r
+       <li> [Fixed] ライセンスを変更した</li>\r
+       <li>Version 1.10: (2005/10/30)</li>\r
+       <li> [Added] Quality値の設定に対応</li>\r
+       <li> [Fixed] Continue時にしぃペインターとしぃペインターProの自動選択の問題を解決</li>\r
+       <li>Version 1.9: (2005/10/05)</li>\r
+       <li> [Fixed] ファイルの保存方法の変更を根本的に変更</li>\r
+       <li> [Info ] PHP5環境での動作を確認</li>\r
+       <li> [Added] Continue時の読み込み元をアニメファイルと画像から選べるようにした</li>        \r
+       <li>Version 1.8: (2005/10/04)</li>\r
+       <li> [Fixed] ファイルの保存方法の変更とアプレットのパラメータ調整(ファイルが壊れる現象に対応)</li> \r
+       <li> [Added] 管理画面からApplet/Paletteがインストールできる機能を追加</li>       \r
+       <li> [Added] 管理画面から動作確認ができる機能を追加</li>\r
+       <li>Version 1.7: (2005/09/01)</li>\r
+       <li> [Added] 画像の保存形式、関連パラメータが設定できるように修正</li>      \r
+       <li>Version 1.6: (2005/08/20)</li>\r
+       <li> [Added] Continue機能を実装</li>\r
+       <li> [Info ] MacOS9での動作確認</li>            \r
+       <li>Version 1.5: (2005/08/04)</li>\r
+       <li> [Fixed] Firefox(MacOSX)で動作しないバグを修正</li>    \r
+       <li>Version 1.4(beta): (2005/07/31)</li>\r
+       <li> [Added] &lt;%paint()%&gt;を追加(image,popupと引数互換)</li>      \r
+       <li> [Added] pch/spchの再生に対応した(ビュアーのインストールが必要)</li>\r
+       <li> [Added] WCSDynPaletteを使用する際、最初に読み込むパレットを選択できるようにした</li>\r
+       <li>Version 1.3(beta): (2005/07/28)</li>\r
+       <li> [Fixed] 投稿エラー時に500 Internal Server Errorを返すようにした</li>\r
+       <li> [Fixed] エラーチェックを厳密にした</li>\r
+       <li>Version 1.2(beta): (2005/07/26)</li>\r
+       <li> [Fixed] お絵かき後に&lt;%image%&gt;を生成する部分変更</li>\r
+       <li>Version 1.1(beta): (2005/07/24)</li>\r
+       <li> [Fixed] IEで投稿できないバグに対応した</li>\r
+       <li>Version 1.0(beta): (2005/07/23)</li>\r
+       <li> [New!] ベータ版として新規公開</li>\r
+</ul>\r
+\r
+<h3>開発者について</h3>\r
+\r
+<ul>\r
+  <li><a href="http://blog.cles.jp/member/1">hsur</a> (<a href="http://blog.cles.jp/">cles::blog</a>)</li>\r
+  <li>配布元: <a href="http://blog.cles.jp/np_cles/category/31/subcatid/5">NP_cles() - NP_Paint</a></li>\r
+  <li>ドネーションや仕事のご依頼も歓迎します。</li>\r
+</ul>\r
diff --git a/trunk/NP_Paint/paint/template/index/menu_japanese-euc.html b/trunk/NP_Paint/paint/template/index/menu_japanese-euc.html
new file mode 100644 (file)
index 0000000..4128b03
--- /dev/null
@@ -0,0 +1,7 @@
+<h2>Paint menu</h2>\r
+<ul>\r
+       <li><a href="{{indexurl}}?action=install&amp;ticket={{ticket}}">¥¢¥×¥ì¥Ã¥È¤Î¥¤¥ó¥¹¥È¡¼¥ë</a></li>\r
+       <li><a href="{{optionurl}}">¥×¥é¥°¥¤¥ó¥ª¥×¥·¥ç¥óÀßÄê</a></li>\r
+       <li><a href="{{indexurl}}?action=report"><span style="font-weight:bold; color:red">Æ°ºî³ÎǧÊó¹ð</span></a></li>\r
+       <li><a href="{{indexurl}}?action=help&amp;ticket={{ticket}}">NP_Paint¤Î¥Ø¥ë¥×</a></li>\r
+</ul>\r
diff --git a/trunk/NP_Paint/paint/template/index/menu_japanese-utf8.html b/trunk/NP_Paint/paint/template/index/menu_japanese-utf8.html
new file mode 100644 (file)
index 0000000..1d5b65e
--- /dev/null
@@ -0,0 +1,7 @@
+<h2>Paint menu</h2>\r
+<ul>\r
+       <li><a href="{{indexurl}}?action=install&amp;ticket={{ticket}}">アプレットのインストール</a></li>\r
+       <li><a href="{{optionurl}}">プラグインオプション設定</a></li>\r
+       <li><a href="{{indexurl}}?action=report"><span style="font-weight:bold; color:red">動作確認報告</span></a></li>\r
+       <li><a href="{{indexurl}}?action=help&amp;ticket={{ticket}}">NP_Paintのヘルプ</a></li>\r
+</ul>\r
diff --git a/trunk/NP_Paint/paint/template/np_paint/form_japanese-euc.html b/trunk/NP_Paint/paint/template/np_paint/form_japanese-euc.html
new file mode 100644 (file)
index 0000000..559d8e7
--- /dev/null
@@ -0,0 +1,40 @@
+<form method="get" action="{{ActionURL}}">\r
+<fieldset>\r
+<legend>NP_Paint</legend>\r
+<dl>\r
+<dt>Canvas-Size:</dt>\r
+<dd>\r
+<input name="w" title="width" type="text" size="4" maxlength="5" value="{{defaultWidth}}" />\r
+x\r
+<input name="h" title="height" type="text" size="4" maxlength="5" value="{{defaultHeight}}" />\r
+</dd>\r
+\r
+<dt>Applet:</dt>\r
+<dd>\r
+{{appletSelect}}\r
+</dd>\r
+\r
+<dt>Palette:</dt>\r
+<dd>\r
+{{paletteSelect}}\r
+</dd>\r
+{{paletteSelectExtra}}\r
+       \r
+<dt>save animation:</dt>\r
+<dd><input name="animation" type="checkbox" value="1" {{animation}} /></dd>\r
+\r
+<dt>Quality:</dt>\r
+<dd>{{qualitySelect}}</dd>\r
+\r
+<dt>Paint?</dt>\r
+<dd><input type="submit" name="submit" value="Paint" /></dd>\r
+</dl>\r
+       \r
+<p>\r
+<input type="hidden" name="action" value="plugin" />\r
+<input type="hidden" name="name" value="Paint" />\r
+<input type="hidden" name="type" value="applet" />\r
+</p>\r
+\r
+</fieldset>\r
+</form>\r
diff --git a/trunk/NP_Paint/paint/template/np_paint/form_japanese-utf8.html b/trunk/NP_Paint/paint/template/np_paint/form_japanese-utf8.html
new file mode 100644 (file)
index 0000000..559d8e7
--- /dev/null
@@ -0,0 +1,40 @@
+<form method="get" action="{{ActionURL}}">\r
+<fieldset>\r
+<legend>NP_Paint</legend>\r
+<dl>\r
+<dt>Canvas-Size:</dt>\r
+<dd>\r
+<input name="w" title="width" type="text" size="4" maxlength="5" value="{{defaultWidth}}" />\r
+x\r
+<input name="h" title="height" type="text" size="4" maxlength="5" value="{{defaultHeight}}" />\r
+</dd>\r
+\r
+<dt>Applet:</dt>\r
+<dd>\r
+{{appletSelect}}\r
+</dd>\r
+\r
+<dt>Palette:</dt>\r
+<dd>\r
+{{paletteSelect}}\r
+</dd>\r
+{{paletteSelectExtra}}\r
+       \r
+<dt>save animation:</dt>\r
+<dd><input name="animation" type="checkbox" value="1" {{animation}} /></dd>\r
+\r
+<dt>Quality:</dt>\r
+<dd>{{qualitySelect}}</dd>\r
+\r
+<dt>Paint?</dt>\r
+<dd><input type="submit" name="submit" value="Paint" /></dd>\r
+</dl>\r
+       \r
+<p>\r
+<input type="hidden" name="action" value="plugin" />\r
+<input type="hidden" name="name" value="Paint" />\r
+<input type="hidden" name="type" value="applet" />\r
+</p>\r
+\r
+</fieldset>\r
+</form>\r
diff --git a/trunk/NP_Paint/paint/template/np_paint/ok_japanese-euc.html b/trunk/NP_Paint/paint/template/np_paint/ok_japanese-euc.html
new file mode 100644 (file)
index 0000000..0bc08e9
--- /dev/null
@@ -0,0 +1,15 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - ¹¹¿·´°Î»</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+</head>\r
+<body>\r
+¥Õ¥¡¥¤¥ë¤Î¹¹¿·¤¬´°Î»¤·¤Þ¤·¤¿<br />\r
+<input type="button" value="ÊĤ¸¤ë" onclick="window.close()" />\r
+<hr color="#222222" noshade style="clear: both;" />\r
+<div>NP_Paint by <a href="http://blog.cles.jp">cles</a></div>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/np_paint/ok_japanese-utf8.html b/trunk/NP_Paint/paint/template/np_paint/ok_japanese-utf8.html
new file mode 100644 (file)
index 0000000..4bb9ead
--- /dev/null
@@ -0,0 +1,15 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - 更新完了</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+</head>\r
+<body>\r
+ファイルの更新が完了しました<br />\r
+<input type="button" value="閉じる" onclick="window.close()" />\r
+<hr color="#222222" noshade style="clear: both;" />\r
+<div>NP_Paint by <a href="http://blog.cles.jp">cles</a></div>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-euc.html b/trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-euc.html
new file mode 100644 (file)
index 0000000..a957325
--- /dev/null
@@ -0,0 +1,19 @@
+<dt>WCS Palette:</dt>\r
+\r
+<dd>\r
+<select name="pidx">\r
+<option value="0">°ì»þÊݸ¥Ñ¥ì¥Ã¥È</option>\r
+<option value="1">È©¿§·Ï</option>\r
+<option value="2">ÀÖ·Ï</option>\r
+<option value="3">²«¡¦Üô·Ï</option>\r
+<option value="4">ÎзÏ</option>\r
+<option value="5">ÀÄ·Ï</option>\r
+<option value="6">»ç·Ï</option>\r
+<option value="7">¥»¥Ô¥¢</option>\r
+<option value="8">¿Íʪ</option>\r
+<option value="9">¥Ñ¥¹¥Æ¥ë</option>\r
+<option value="10">Á𸶤ÎÂçÃÏ</option>\r
+<option value="11">˨¤¨¥µ¥¯¥é</option>\r
+<option value="12">¥â¥Î¥¯¥í</option>\r
+</select>\r
+</dd>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-utf8.html b/trunk/NP_Paint/paint/template/palette_wcs/extraoption_japanese-utf8.html
new file mode 100644 (file)
index 0000000..e019193
--- /dev/null
@@ -0,0 +1,19 @@
+<dt>WCS Palette:</dt>\r
+\r
+<dd>\r
+<select name="pidx">\r
+<option value="0">一時保存パレット</option>\r
+<option value="1">肌色系</option>\r
+<option value="2">赤系</option>\r
+<option value="3">黄・橙系</option>\r
+<option value="4">緑系</option>\r
+<option value="5">青系</option>\r
+<option value="6">紫系</option>\r
+<option value="7">セピア</option>\r
+<option value="8">人物</option>\r
+<option value="9">パステル</option>\r
+<option value="10">草原の大地</option>\r
+<option value="11">萌えサクラ</option>\r
+<option value="12">モノクロ</option>\r
+</select>\r
+</dd>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..b818655
--- /dev/null
@@ -0,0 +1,64 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<div style="float:left;">\r
+<img src="{{mediaurl}}{{file}}" alt="{{alt}}" width="{{w}}" height="{{h}}" />\r
+</div>\r
+\r
+<form method="get" action="{{actionurl}}">\r
+\r
+<fieldset>\r
+<legend>NP_Paint Continue</legend>\r
+<dl>\r
+<dt>applet:</dt>\r
+<dd>{{appletTag}}</dd>\r
+\r
+<dt>palette:</dt>\r
+<dd>{{paletteTag}}</dd>\r
+{{paletteExtraTag}}\r
+\r
+<dt>mode:</dt>\r
+<dd>\r
+<select name="ow">\r
+<option value="1" checked="checked">º¹¤·Âؤ¨</option>\r
+<option value="0">¿·µ¬Åê¹Æ</option>\r
+</select>\r
+</dd>\r
+\r
+<dt>anime¤«¤é³¤­¤òÉÁ¤¯:</dt>\r
+<dd><input name="usepch" type="checkbox" value="1" $animation /></dd>\r
+\r
+<dt>AnimeInfomation:</dt>\r
+<dd>{{animeInfo}}</dd>\r
+\r
+<dt>Paint?</dt>\r
+<dd><button type="submit" name="submit" value="1">Continue</button></dd>\r
+</dl>\r
+\r
+<p>\r
+<input type="hidden" name="w" value="{{w}}" />\r
+<input type="hidden" name="h" value="{{h}}" />\r
+<input type="hidden" name="file" value="{{file}}" />\r
+<input type="hidden" name="quality" value="{{quality}}" />\r
+\r
+<input type="hidden" name="action" value="plugin" />\r
+<input type="hidden" name="name" value="Paint" />\r
+<input type="hidden" name="type" value="applet" />\r
+</p>\r
+</fieldset>\r
+</form>\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+<div>\r
+NP_Paint by <a href="http://blog.cles.jp">cles</a>\r
+</div>\r
+\r
+<body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/viewer_continue/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..5da2013
--- /dev/null
@@ -0,0 +1,64 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<div style="float:left;">\r
+<img src="{{mediaurl}}{{file}}" alt="{{alt}}" width="{{w}}" height="{{h}}" />\r
+</div>\r
+\r
+<form method="get" action="{{actionurl}}">\r
+\r
+<fieldset>\r
+<legend>NP_Paint Continue</legend>\r
+<dl>\r
+<dt>applet:</dt>\r
+<dd>{{appletTag}}</dd>\r
+\r
+<dt>palette:</dt>\r
+<dd>{{paletteTag}}</dd>\r
+{{paletteExtraTag}}\r
+\r
+<dt>mode:</dt>\r
+<dd>\r
+<select name="ow">\r
+<option value="1" checked="checked">差し替え</option>\r
+<option value="0">新規投稿</option>\r
+</select>\r
+</dd>\r
+\r
+<dt>animeから続きを描く:</dt>\r
+<dd><input name="usepch" type="checkbox" value="1" $animation /></dd>\r
+\r
+<dt>AnimeInfomation:</dt>\r
+<dd>{{animeInfo}}</dd>\r
+\r
+<dt>Paint?</dt>\r
+<dd><button type="submit" name="submit" value="1">Continue</button></dd>\r
+</dl>\r
+\r
+<p>\r
+<input type="hidden" name="w" value="{{w}}" />\r
+<input type="hidden" name="h" value="{{h}}" />\r
+<input type="hidden" name="file" value="{{file}}" />\r
+<input type="hidden" name="quality" value="{{quality}}" />\r
+\r
+<input type="hidden" name="action" value="plugin" />\r
+<input type="hidden" name="name" value="Paint" />\r
+<input type="hidden" name="type" value="applet" />\r
+</p>\r
+</fieldset>\r
+</form>\r
+\r
+<hr color="#222222" noshade style="clear: both;" />\r
+<div>\r
+NP_Paint by <a href="http://blog.cles.jp">cles</a>\r
+</div>\r
+\r
+<body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..423f97b
--- /dev/null
@@ -0,0 +1,27 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{file}} - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<applet code="pch.PCHViewer.class" name="paintbbs" width="{{w}}" height="{{h}}" archive="{{appletBaseUrl}}PCHViewer.jar" mayscript="true">\r
+       <param name="pch_file" value="{{MediaURL}}{{file}}" />\r
+       <param name="speed" value="-1" />\r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res.zip" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+</applet>\r
+\r
+<form method="get" action="{{MediaURL}}{{file}}">\r
+<input type="submit" value="¥¢¥Ë¥á¥Ç¡¼¥¿ ¥À¥¦¥ó¥í¡¼¥É" />\r
+<input type="button" value="ÊĤ¸¤ë" onclick="window.close()" />\r
+</form>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/viewer_pch/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..7547bb8
--- /dev/null
@@ -0,0 +1,27 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{file}} - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<applet code="pch.PCHViewer.class" name="paintbbs" width="{{w}}" height="{{h}}" archive="{{appletBaseUrl}}PCHViewer.jar" mayscript="true">\r
+       <param name="pch_file" value="{{MediaURL}}{{file}}" />\r
+       <param name="speed" value="-1" />\r
+       <param name="image_width" value="{{w}}" />\r
+       <param name="image_height" value="{{h}}" />\r
+       \r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res.zip" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+</applet>\r
+\r
+<form method="get" action="{{MediaURL}}{{file}}">\r
+<input type="submit" value="アニメデータ ダウンロード" />\r
+<input type="button" value="閉じる" onclick="window.close()" />\r
+</form>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-euc.html b/trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-euc.html
new file mode 100644 (file)
index 0000000..385ed9f
--- /dev/null
@@ -0,0 +1,25 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{file}} - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<applet code="pch2.PCHViewer.class" name="paintbbs" width="{{w}}" height="{{h}}" archive="{{appletBaseUrl}}PCHViewer.jar" mayscript="true">\r
+       <param name="pch_file" value="{{MediaURL}}{{file}}" />\r
+       <param name="speed" value="-1" />\r
+       \r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res.zip" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+</applet>\r
+\r
+<form method="get" action="{{MediaURL}}{{file}}">\r
+<input type="submit" value="¥¢¥Ë¥á¥Ç¡¼¥¿ ¥À¥¦¥ó¥í¡¼¥É" />\r
+<input type="button" value="ÊĤ¸¤ë" onclick="window.close()" />\r
+</form>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-utf8.html b/trunk/NP_Paint/paint/template/viewer_spch/pagetemplate_japanese-utf8.html
new file mode 100644 (file)
index 0000000..6b21d5e
--- /dev/null
@@ -0,0 +1,25 @@
+<html lang="ja">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset={{charset}}" />\r
+<title>NP_Paint - {{file}} - {{name}}</title>\r
+<meta http-equiv="Content-Script-Type" content="text/javascript" />\r
+<meta http-equiv="Content-Style-Type" content="text/css" />\r
+\r
+</head>\r
+<body>\r
+\r
+<applet code="pch2.PCHViewer.class" name="paintbbs" width="{{w}}" height="{{h}}" archive="{{appletBaseUrl}}PCHViewer.jar" mayscript="true">\r
+       <param name="pch_file" value="{{MediaURL}}{{file}}" />\r
+       <param name="speed" value="-1" />\r
+       \r
+       <param name="res.zip" value="{{appletBaseUrl}}res/res.zip" />\r
+       <param name="tt.zip" value="{{appletBaseUrl}}res/tt.zip" />\r
+</applet>\r
+\r
+<form method="get" action="{{MediaURL}}{{file}}">\r
+<input type="submit" value="アニメデータ ダウンロード" />\r
+<input type="button" value="閉じる" onclick="window.close()" />\r
+</form>\r
+\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/trunk/NP_Paint/sharedlibs/cles/Feedback.php b/trunk/NP_Paint/sharedlibs/cles/Feedback.php
new file mode 100644 (file)
index 0000000..c251c3c
--- /dev/null
@@ -0,0 +1,178 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Feedback.php ($Revision: 1.30 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Feedback.php,v 1.30 2008/05/18 07:01:25 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+class cles_Feedback {\r
+       var $oPluginAdmin;\r
+       function CLES_Feedback(&$pluginAdmin){\r
+               $this->oPluginAdmin = $pluginAdmin;\r
+       }\r
+       \r
+       function getMenuStr(){\r
+               return mb_convert_encoding('動作確認/不具合報告', _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function printForm($extra = '') {\r
+               ob_start();\r
+               \r
+               global $nucleus, $CONF;\r
+               \r
+               echo "<h2>動作確認/不具合報告</h2>";\r
+               echo '<p>下記より、作者への動作確認/不具合の報告を行うことができます。</p>';\r
+\r
+               // js\r
+               echo '<script langage="JavaScript">\r
+//<![CDATA[\r
+function selectall(){\r
+       var elements = document.getElementsByTagName(\'input\');\r
+       for( var i=0; i < elements.length; i++){\r
+               var e = elements[i];\r
+               if( e.type == \'checkbox\' ){\r
+                       e.checked = true;\r
+               }\r
+       }\r
+       return false;\r
+}\r
+//]]>\r
+</script>';\r
+               \r
+               echo "<h3>収集する情報と公開について</h3>";\r
+               echo '<p>デフォルトで必要最低限の環境情報(赤字のもの)を開発者のサーバへ送信します。<br />\r
+                                                       <span style="font-weight:bold; color:red">差し支えない範囲で環境情報の提供にご協力ください。</span></p>\r
+                                                       <p>※ 収集した情報は統計処理、及びプラグインのBugFixのみに利用されます。また統計処理した結果については公表することがあります。</p>';\r
+               echo '<p><a href="#" onclick="javascript:selectall();return false;">全て送信する場合はここをクリック</a></p>';\r
+               \r
+               echo "<h3>サイト固有コードについて</h3>";\r
+               echo '<p>動作報告の重複を取り除くため、管理画面のURLのmd5を計算したものを送信しています。この情報から管理画面のURLを復元することはできないようになっています。<a href="http://e-words.jp/w/MD5.html" target="_blank">md5の解説についてはこちらをご覧ください。(e-WordsIT用語辞典)</a></p>';\r
+               \r
+               // form \r
+               echo '<form method="post" action="http://blog.cles.jp/support/report.php">' . "\n";\r
+\r
+               // table\r
+               echo "<table>\n";\r
+               echo "<tr>\n";\r
+               echo "<th>項目の説明</th>\n";\r
+               echo "<th>送信される値</th>\n";\r
+               echo "<th><a href=\"#\" onclick=\"javascript:selectall();return false;\">全てチェック</a></th>\n";\r
+               echo "</tr>\n";\r
+\r
+               $res = sql_query("show variables like 'version'");\r
+               $assoc = mysql_fetch_assoc($res);\r
+               $mysqlVersion = $assoc['Value'];\r
+               \r
+               if( function_exists('gd_info') )\r
+                       $gdinfo = @gd_info();\r
+               else\r
+                       $gdinfo['GD Version'] = 'GD is not supported';\r
+\r
+               global $CONF;\r
+\r
+               $this->_printtr('siteid', 'サイトの固有コード', md5(trim($CONF['AdminURL'])));\r
+               $this->_printtr('plugin_name', 'プラグイン名', $this->oPluginAdmin->plugin->getName());\r
+               $this->_printtr('plugin_version', 'プラグインのバージョン', $this->oPluginAdmin->plugin->getVersion());\r
+               $this->_printtr('plugin_info', '追加情報', $extra, true);\r
+               $this->_printtr('nucleus_version', 'Nucleusのバージョン', $nucleus['version'], true);\r
+               $this->_printtr('nucleus_charset', 'Nucleusのキャラクタセット', _CHARSET);\r
+               $this->_printtr('php_version', 'PHPのバージョン', PHP_VERSION, true);\r
+               $this->_printtr('php_sapi', 'PHPの種類', php_sapi_name());\r
+               $this->_printtr('php_os', 'OSの種類', PHP_OS, true);\r
+               $this->_printtr('php_safemode', 'セーフモードの有無', ini_get('safe_mode') ? 'on' : 'off');\r
+               $this->_printtr('php_gd_version', 'GDのバージョン', $gdinfo['GD Version'], true);\r
+               $this->_printtr('php_gd_support', 'サポートしているイメージタイプ', implode(',', $this->_supportedImageTypes()) );\r
+               $this->_printtr('mysql_version', 'MySQLのバージョン', $mysqlVersion, true);\r
+\r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">このプラグインは機能しましたか?</td>\n";\r
+               echo '<td><input type="radio" name="user_intention" value="ok" />はい <br/> <input type="radio" name="intention" value="ng" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               echo "<td>不具合の内容をお寄せください<br /><em>必ず回答が必要な質問については、<a href=\"http://japan.nucleuscms.org/bb/\">Nucleusサポートフォーラム</a>もしくは<a href=\"http://blog.cles.jp/np_cles/\">作者ページ</a>でご質問ください。</em></td>\n";\r
+               echo '<td colspan="2"><textarea name="user_freetext" rows="10" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo "<tr>\n";\r
+               echo "<td>よろしければサイトのURLを教えてください</td>\n";\r
+               echo '<td colspan="2"><textarea name="user_url" rows="1" cols="70"></textarea>'."</td>\n";\r
+               echo "</tr>\n";\r
+               \r
+               echo "<tr>\n";\r
+               echo "<td colspan=\"2\">リンク集作成の際、リンクをはらせていただけますか?</td>\n";\r
+               echo '<td><input type="radio" name="user_disclose" value="yes" />はい <br/> <input type="radio" name="intention" value="no" />いいえ'."</td>\n";\r
+               echo "</tr>\n";\r
+\r
+               echo '<tr><td colspan="3"><div align="right"><a href="#" onclick="javascript:selectall();return false;">全てチェック</a> <input type="submit" name="submit" value="動作確認を送信する" /></div></td></tr>';\r
+               echo "</table>\n";\r
+               echo "</form>\n";\r
+               \r
+               $contents = ob_get_contents();\r
+               ob_end_clean();\r
+               echo mb_convert_encoding($contents, _CHARSET, 'UTF-8');\r
+       }\r
+       \r
+       function _printtr($name, $desc, $value, $canDisable = false) {\r
+               echo "<tr>\n";\r
+       \r
+               if ($canDisable) {\r
+                       echo "<td>".$desc."</td>\n";\r
+                       echo "<td>".htmlspecialchars($value)."</td>\n";\r
+                       echo '<td><input type="checkbox" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" /></td>'."\n";\r
+               } else {\r
+                       echo '<td><span style="font-weight:bold; color:red">'.$desc."</span></td>\n";\r
+                       echo '<td><span style="font-weight:bold; color:red">'.htmlspecialchars($value)."</span></td>\n";\r
+                       echo '<td>必須<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" readonly="readonly" checked="checked"/></td>'."\n";\r
+               }\r
+               echo "</tr>\n";\r
+       }\r
+       \r
+       function _supportedImageTypes() {\r
+               if( !function_exists('gd_info') ) return "";\r
+               \r
+               $aSupportedTypes = array ();\r
+               $aPossibleImageTypeBits = array (IMG_GIF => 'GIF', IMG_JPG => 'JPG', IMG_PNG => 'PNG', IMG_WBMP => 'WBMP');\r
+       \r
+               foreach ($aPossibleImageTypeBits as $iImageTypeBits => $sImageTypeString) {\r
+                       if (imagetypes() & $iImageTypeBits) {\r
+                               $aSupportedTypes[] = $sImageTypeString;\r
+                       }\r
+               }\r
+       \r
+               return $aSupportedTypes;\r
+       }\r
+\r
+}\r
diff --git a/trunk/NP_Paint/sharedlibs/cles/Template.php b/trunk/NP_Paint/sharedlibs/cles/Template.php
new file mode 100644 (file)
index 0000000..09f3ac3
--- /dev/null
@@ -0,0 +1,87 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * Template.php ($Revision: 1.11 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: Template.php,v 1.11 2008/08/15 21:17:02 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006-2008 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+if (!function_exists('getLanguageName')){\r
+       function getLanguageName(){\r
+               return 'japanese-utf8';\r
+       }\r
+}\r
+\r
+class cles_Template {\r
+       var $defaultLang = 'japanese-utf8';\r
+       var $defalutPattern = '#{{(.*?)(\|)?}}#ie';\r
+       var $lang;\r
+       var $templateDir;\r
+\r
+       function cles_Template($templateDir) {\r
+               global $CONF;\r
+               $this->templateDir = $templateDir;\r
+               $this->lang = ereg_replace( '[\\|/]', '', getLanguageName());\r
+       }\r
+\r
+       function fetch($name, $dir = null, $suffix = 'html') {\r
+               $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->lang.( $suffix ? '.'.strtolower($suffix) : '' );\r
+               if ( ! file_exists($path) ){\r
+                       $path = $this->templateDir.'/'.( $dir ? strtolower($dir) . '/' : '' ).strtolower($name).'_'.$this->defaultLang.( $suffix ? '.'.strtolower($suffix) : '' );\r
+                       if ( ! file_exists($path) )\r
+                               return '';\r
+               }\r
+               \r
+               $fsize = filesize($path);\r
+               if ($fsize <= 0) return '';\r
+               \r
+               $fd = fopen($path, 'r');\r
+               $contents = fread($fd, $fsize);\r
+               fclose($fd);\r
+               return $contents;\r
+       }\r
+       \r
+       function fill($template, $values, $default = null) {\r
+               if( $default )\r
+                       return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : $default', $template);\r
+               if( $default === null )\r
+                       return preg_replace($this->defalutPattern, '(\'$2\') ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']', $template);\r
+               return preg_replace($this->defalutPattern, 'isset($values[\'$1\']) ? (\'$2\' ? htmlspecialchars($values[\'$1\'], ENT_QUOTES) : $values[\'$1\']) : \'{{$1}}\' ', $template);\r
+       }\r
+       \r
+       function fetchAndFill($name, $values, $dir = null, $suffix = 'html', $default = null){\r
+               $tpl = $this->fetch($name, $dir, $suffix);\r
+               return $this->fill($tpl, $values, $default);\r
+       }\r
+}\r
diff --git a/trunk/NP_Paint/sharedlibs/pclzip.lib.php b/trunk/NP_Paint/sharedlibs/pclzip.lib.php
new file mode 100644 (file)
index 0000000..e2a5eba
--- /dev/null
@@ -0,0 +1,5748 @@
+<?php\r
+// --------------------------------------------------------------------------------\r
+// PhpConcept Library - Zip Module 2.5\r
+// --------------------------------------------------------------------------------\r
+// License GNU/LGPL - Vincent Blavet - March 2006\r
+// http://www.phpconcept.net\r
+// --------------------------------------------------------------------------------\r
+//\r
+// Presentation :\r
+//   PclZip is a PHP library that manage ZIP archives.\r
+//   So far tests show that archives generated by PclZip are readable by\r
+//   WinZip application and other tools.\r
+//\r
+// Description :\r
+//   See readme.txt and http://www.phpconcept.net\r
+//\r
+// Warning :\r
+//   This library and the associated files are non commercial, non professional\r
+//   work.\r
+//   It should not have unexpected results. However if any damage is caused by\r
+//   this software the author can not be responsible.\r
+//   The use of this software is at the risk of the user.\r
+//\r
+// --------------------------------------------------------------------------------\r
+// $Id: pclzip.lib.php,v 1.4 2006/03/19 07:54:59 hsur Exp $\r
+// --------------------------------------------------------------------------------\r
+\r
+  // ----- Constants\r
+  define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );\r
+  \r
+  // ----- File list separator\r
+  // In version 1.x of PclZip, the separator for file list is a space\r
+  // (which is not a very smart choice, specifically for windows paths !).\r
+  // A better separator should be a comma (,). This constant gives you the\r
+  // abilty to change that.\r
+  // However notice that changing this value, may have impact on existing\r
+  // scripts, using space separated filenames.\r
+  // Recommanded values for compatibility with older versions :\r
+  //define( 'PCLZIP_SEPARATOR', ' ' );\r
+  // Recommanded values for smart separation of filenames.\r
+  define( 'PCLZIP_SEPARATOR', ',' );\r
+\r
+  // ----- Error configuration\r
+  // 0 : PclZip Class integrated error handling\r
+  // 1 : PclError external library error handling. By enabling this\r
+  //     you must ensure that you have included PclError library.\r
+  // [2,...] : reserved for futur use\r
+  define( 'PCLZIP_ERROR_EXTERNAL', 0 );\r
+\r
+  // ----- Optional static temporary directory\r
+  //       By default temporary files are generated in the script current\r
+  //       path.\r
+  //       If defined :\r
+  //       - MUST BE terminated by a '/'.\r
+  //       - MUST be a valid, already created directory\r
+  //       Samples :\r
+  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );\r
+  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );\r
+  define( 'PCLZIP_TEMPORARY_DIR', '' );\r
+\r
+// --------------------------------------------------------------------------------\r
+// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****\r
+// --------------------------------------------------------------------------------\r
+\r
+  // ----- Global variables\r
+  $g_pclzip_version = "2.5";\r
+\r
+  // ----- Error codes\r
+  //   -1 : Unable to open file in binary write mode\r
+  //   -2 : Unable to open file in binary read mode\r
+  //   -3 : Invalid parameters\r
+  //   -4 : File does not exist\r
+  //   -5 : Filename is too long (max. 255)\r
+  //   -6 : Not a valid zip file\r
+  //   -7 : Invalid extracted file size\r
+  //   -8 : Unable to create directory\r
+  //   -9 : Invalid archive extension\r
+  //  -10 : Invalid archive format\r
+  //  -11 : Unable to delete file (unlink)\r
+  //  -12 : Unable to rename file (rename)\r
+  //  -13 : Invalid header checksum\r
+  //  -14 : Invalid archive size\r
+  define( 'PCLZIP_ERR_USER_ABORTED', 2 );\r
+  define( 'PCLZIP_ERR_NO_ERROR', 0 );\r
+  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );\r
+  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );\r
+  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );\r
+  define( 'PCLZIP_ERR_MISSING_FILE', -4 );\r
+  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );\r
+  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );\r
+  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );\r
+  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );\r
+  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );\r
+  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );\r
+  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );\r
+  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );\r
+  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );\r
+  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );\r
+  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );\r
+  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );\r
+  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );\r
+  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );\r
+  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );\r
+  define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );\r
+  define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );\r
+\r
+  // ----- Options values\r
+  define( 'PCLZIP_OPT_PATH', 77001 );\r
+  define( 'PCLZIP_OPT_ADD_PATH', 77002 );\r
+  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );\r
+  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );\r
+  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );\r
+  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );\r
+  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );\r
+  define( 'PCLZIP_OPT_BY_NAME', 77008 );\r
+  define( 'PCLZIP_OPT_BY_INDEX', 77009 );\r
+  define( 'PCLZIP_OPT_BY_EREG', 77010 );\r
+  define( 'PCLZIP_OPT_BY_PREG', 77011 );\r
+  define( 'PCLZIP_OPT_COMMENT', 77012 );\r
+  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );\r
+  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );\r
+  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );\r
+  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );\r
+  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );\r
+  // Having big trouble with crypt. Need to multiply 2 long int\r
+  // which is not correctly supported by PHP ...\r
+  //define( 'PCLZIP_OPT_CRYPT', 77018 );\r
+  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );\r
+  \r
+  // ----- File description attributes\r
+  define( 'PCLZIP_ATT_FILE_NAME', 79001 );\r
+  define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );\r
+  define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );\r
+\r
+  // ----- Call backs values\r
+  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );\r
+  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );\r
+  define( 'PCLZIP_CB_PRE_ADD', 78003 );\r
+  define( 'PCLZIP_CB_POST_ADD', 78004 );\r
+  /* For futur use\r
+  define( 'PCLZIP_CB_PRE_LIST', 78005 );\r
+  define( 'PCLZIP_CB_POST_LIST', 78006 );\r
+  define( 'PCLZIP_CB_PRE_DELETE', 78007 );\r
+  define( 'PCLZIP_CB_POST_DELETE', 78008 );\r
+  */\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Class : PclZip\r
+  // Description :\r
+  //   PclZip is the class that represent a Zip archive.\r
+  //   The public methods allow the manipulation of the archive.\r
+  // Attributes :\r
+  //   Attributes must not be accessed directly.\r
+  // Methods :\r
+  //   PclZip() : Object creator\r
+  //   create() : Creates the Zip archive\r
+  //   listContent() : List the content of the Zip archive\r
+  //   extract() : Extract the content of the archive\r
+  //   properties() : List the properties of the archive\r
+  // --------------------------------------------------------------------------------\r
+  class PclZip\r
+  {\r
+    // ----- Filename of the zip file\r
+    var $zipname = '';\r
+\r
+    // ----- File descriptor of the zip file\r
+    var $zip_fd = 0;\r
+\r
+    // ----- Internal error handling\r
+    var $error_code = 1;\r
+    var $error_string = '';\r
+    \r
+    // ----- Current status of the magic_quotes_runtime\r
+    // This value store the php configuration for magic_quotes\r
+    // The class can then disable the magic_quotes and reset it after\r
+    var $magic_quotes_status;\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZip()\r
+  // Description :\r
+  //   Creates a PclZip object and set the name of the associated Zip archive\r
+  //   filename.\r
+  //   Note that no real action is taken, if the archive does not exist it is not\r
+  //   created. Use create() for that.\r
+  // --------------------------------------------------------------------------------\r
+  function PclZip($p_zipname)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");\r
+\r
+    // ----- Tests the zlib\r
+    if (!function_exists('gzopen'))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");\r
+      die('Abort '.basename(__FILE__).' : Missing zlib extensions');\r
+    }\r
+\r
+    // ----- Set the attributes\r
+    $this->zipname = $p_zipname;\r
+    $this->zip_fd = 0;\r
+    $this->magic_quotes_status = -1;\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);\r
+    return;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function :\r
+  //   create($p_filelist, $p_add_dir="", $p_remove_dir="")\r
+  //   create($p_filelist, $p_option, $p_option_value, ...)\r
+  // Description :\r
+  //   This method supports two different synopsis. The first one is historical.\r
+  //   This method creates a Zip Archive. The Zip file is created in the\r
+  //   filesystem. The files and directories indicated in $p_filelist\r
+  //   are added in the archive. See the parameters description for the\r
+  //   supported format of $p_filelist.\r
+  //   When a directory is in the list, the directory and its content is added\r
+  //   in the archive.\r
+  //   In this synopsis, the function takes an optional variable list of\r
+  //   options. See bellow the supported options.\r
+  // Parameters :\r
+  //   $p_filelist : An array containing file or directory names, or\r
+  //                 a string containing one filename or one directory name, or\r
+  //                 a string containing a list of filenames and/or directory\r
+  //                 names separated by spaces.\r
+  //   $p_add_dir : A path to add before the real path of the archived file,\r
+  //                in order to have it memorized in the archive.\r
+  //   $p_remove_dir : A path to remove from the real path of the file to archive,\r
+  //                   in order to have a shorter path memorized in the archive.\r
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir\r
+  //                   is removed first, before $p_add_dir is added.\r
+  // Options :\r
+  //   PCLZIP_OPT_ADD_PATH :\r
+  //   PCLZIP_OPT_REMOVE_PATH :\r
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :\r
+  //   PCLZIP_OPT_COMMENT :\r
+  //   PCLZIP_CB_PRE_ADD :\r
+  //   PCLZIP_CB_POST_ADD :\r
+  // Return Values :\r
+  //   0 on failure,\r
+  //   The list of the added files, with a status of the add action.\r
+  //   (see PclZip::listContent() for list entry format)\r
+  // --------------------------------------------------------------------------------\r
+  function create($p_filelist)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Set default values\r
+    $v_options = array();\r
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;\r
+\r
+    // ----- Look for variable options arguments\r
+    $v_size = func_num_args();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");\r
+\r
+    // ----- Look for arguments\r
+    if ($v_size > 1) {\r
+      // ----- Get the arguments\r
+      $v_arg_list = func_get_args();\r
+\r
+      // ----- Remove from the options list the first argument\r
+      array_shift($v_arg_list);\r
+      $v_size--;\r
+\r
+      // ----- Look for first arg\r
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");\r
+\r
+        // ----- Parse the options\r
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,\r
+                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',\r
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',\r
+                                                   PCLZIP_CB_PRE_ADD => 'optional',\r
+                                                   PCLZIP_CB_POST_ADD => 'optional',\r
+                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',\r
+                                                   PCLZIP_OPT_COMMENT => 'optional'\r
+                                                   //, PCLZIP_OPT_CRYPT => 'optional'\r
+                                             ));\r
+        if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+          return 0;\r
+        }\r
+      }\r
+\r
+      // ----- Look for 2 args\r
+      // Here we need to support the first historic synopsis of the\r
+      // method.\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");\r
+\r
+        // ----- Get the first argument\r
+        $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];\r
+\r
+        // ----- Look for the optional second argument\r
+        if ($v_size == 2) {\r
+          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];\r
+        }\r
+        else if ($v_size > 2) {\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,\r
+                                      "Invalid number / type of arguments");\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return 0;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Init\r
+    $v_string_list = array();\r
+    $v_att_list = array();\r
+    $v_filedescr_list = array();\r
+    $p_result_list = array();\r
+    \r
+    // ----- Look if the $p_filelist is really an array\r
+    if (is_array($p_filelist)) {\r
+    \r
+      // ----- Look if the first element is also an array\r
+      //       This will mean that this is a file description entry\r
+      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {\r
+        $v_att_list = $p_filelist;\r
+      }\r
+      \r
+      // ----- The list is a list of string names\r
+      else {\r
+        $v_string_list = $p_filelist;\r
+      }\r
+    }\r
+\r
+    // ----- Look if the $p_filelist is a string\r
+    else if (is_string($p_filelist)) {\r
+      // ----- Create a list from the string\r
+      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);\r
+    }\r
+\r
+    // ----- Invalid variable type for $p_filelist\r
+    else {\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+    \r
+    // ----- Reformat the string list\r
+    if (sizeof($v_string_list) != 0) {\r
+      foreach ($v_string_list as $v_string) {\r
+        if ($v_string != '') {\r
+          $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");\r
+        }\r
+      }\r
+    }\r
+    \r
+    // ----- For each file in the list check the attributes\r
+    $v_supported_attributes\r
+    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'\r
+             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'\r
+             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'\r
+                                               );\r
+    foreach ($v_att_list as $v_entry) {\r
+      $v_result = $this->privFileDescrParseAtt($v_entry,\r
+                                               $v_filedescr_list[],\r
+                                               $v_options,\r
+                                               $v_supported_attributes);\r
+      if ($v_result != 1) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+        return 0;\r
+      }\r
+    }\r
+\r
+    // ----- Expand the filelist (expand directories)\r
+    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);\r
+    if ($v_result != 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+\r
+    // ----- Call the create fct\r
+    $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);\r
+    if ($v_result != 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);\r
+    return $p_result_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function :\r
+  //   add($p_filelist, $p_add_dir="", $p_remove_dir="")\r
+  //   add($p_filelist, $p_option, $p_option_value, ...)\r
+  // Description :\r
+  //   This method supports two synopsis. The first one is historical.\r
+  //   This methods add the list of files in an existing archive.\r
+  //   If a file with the same name already exists, it is added at the end of the\r
+  //   archive, the first one is still present.\r
+  //   If the archive does not exist, it is created.\r
+  // Parameters :\r
+  //   $p_filelist : An array containing file or directory names, or\r
+  //                 a string containing one filename or one directory name, or\r
+  //                 a string containing a list of filenames and/or directory\r
+  //                 names separated by spaces.\r
+  //   $p_add_dir : A path to add before the real path of the archived file,\r
+  //                in order to have it memorized in the archive.\r
+  //   $p_remove_dir : A path to remove from the real path of the file to archive,\r
+  //                   in order to have a shorter path memorized in the archive.\r
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir\r
+  //                   is removed first, before $p_add_dir is added.\r
+  // Options :\r
+  //   PCLZIP_OPT_ADD_PATH :\r
+  //   PCLZIP_OPT_REMOVE_PATH :\r
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :\r
+  //   PCLZIP_OPT_COMMENT :\r
+  //   PCLZIP_OPT_ADD_COMMENT :\r
+  //   PCLZIP_OPT_PREPEND_COMMENT :\r
+  //   PCLZIP_CB_PRE_ADD :\r
+  //   PCLZIP_CB_POST_ADD :\r
+  // Return Values :\r
+  //   0 on failure,\r
+  //   The list of the added files, with a status of the add action.\r
+  //   (see PclZip::listContent() for list entry format)\r
+  // --------------------------------------------------------------------------------\r
+  function add($p_filelist)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Set default values\r
+    $v_options = array();\r
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;\r
+\r
+    // ----- Look for variable options arguments\r
+    $v_size = func_num_args();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");\r
+\r
+    // ----- Look for arguments\r
+    if ($v_size > 1) {\r
+      // ----- Get the arguments\r
+      $v_arg_list = func_get_args();\r
+\r
+      // ----- Remove form the options list the first argument\r
+      array_shift($v_arg_list);\r
+      $v_size--;\r
+\r
+      // ----- Look for first arg\r
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");\r
+\r
+        // ----- Parse the options\r
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,\r
+                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',\r
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',\r
+                                                   PCLZIP_CB_PRE_ADD => 'optional',\r
+                                                   PCLZIP_CB_POST_ADD => 'optional',\r
+                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',\r
+                                                   PCLZIP_OPT_COMMENT => 'optional',\r
+                                                   PCLZIP_OPT_ADD_COMMENT => 'optional',\r
+                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional'\r
+                                                   //, PCLZIP_OPT_CRYPT => 'optional'\r
+                                                                                                  ));\r
+        if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+          return 0;\r
+        }\r
+      }\r
+\r
+      // ----- Look for 2 args\r
+      // Here we need to support the first historic synopsis of the\r
+      // method.\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");\r
+\r
+        // ----- Get the first argument\r
+        $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];\r
+\r
+        // ----- Look for the optional second argument\r
+        if ($v_size == 2) {\r
+          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];\r
+        }\r
+        else if ($v_size > 2) {\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return 0;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Init\r
+    $v_string_list = array();\r
+    $v_att_list = array();\r
+    $v_filedescr_list = array();\r
+    $p_result_list = array();\r
+    \r
+    // ----- Look if the $p_filelist is really an array\r
+    if (is_array($p_filelist)) {\r
+    \r
+      // ----- Look if the first element is also an array\r
+      //       This will mean that this is a file description entry\r
+      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {\r
+        $v_att_list = $p_filelist;\r
+      }\r
+      \r
+      // ----- The list is a list of string names\r
+      else {\r
+        $v_string_list = $p_filelist;\r
+      }\r
+    }\r
+\r
+    // ----- Look if the $p_filelist is a string\r
+    else if (is_string($p_filelist)) {\r
+      // ----- Create a list from the string\r
+      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);\r
+    }\r
+\r
+    // ----- Invalid variable type for $p_filelist\r
+    else {\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+    \r
+    // ----- Reformat the string list\r
+    if (sizeof($v_string_list) != 0) {\r
+      foreach ($v_string_list as $v_string) {\r
+        $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;\r
+      }\r
+    }\r
+    \r
+    // ----- For each file in the list check the attributes\r
+    $v_supported_attributes\r
+    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'\r
+             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'\r
+             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'\r
+                                               );\r
+    foreach ($v_att_list as $v_entry) {\r
+      $v_result = $this->privFileDescrParseAtt($v_entry,\r
+                                               $v_filedescr_list[],\r
+                                               $v_options,\r
+                                               $v_supported_attributes);\r
+      if ($v_result != 1) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+        return 0;\r
+      }\r
+    }\r
+\r
+    // ----- Expand the filelist (expand directories)\r
+    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);\r
+    if ($v_result != 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+\r
+    // ----- Call the create fct\r
+    $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);\r
+    if ($v_result != 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return 0;\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);\r
+    return $p_result_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : listContent()\r
+  // Description :\r
+  //   This public method, gives the list of the files and directories, with their\r
+  //   properties.\r
+  //   The properties of each entries in the list are (used also in other functions) :\r
+  //     filename : Name of the file. For a create or add action it is the filename\r
+  //                given by the user. For an extract function it is the filename\r
+  //                of the extracted file.\r
+  //     stored_filename : Name of the file / directory stored in the archive.\r
+  //     size : Size of the stored file.\r
+  //     compressed_size : Size of the file's data compressed in the archive\r
+  //                       (without the headers overhead)\r
+  //     mtime : Last known modification date of the file (UNIX timestamp)\r
+  //     comment : Comment associated with the file\r
+  //     folder : true | false\r
+  //     index : index of the file in the archive\r
+  //     status : status of the action (depending of the action) :\r
+  //              Values are :\r
+  //                ok : OK !\r
+  //                filtered : the file / dir is not extracted (filtered by user)\r
+  //                already_a_directory : the file can not be extracted because a\r
+  //                                      directory with the same name already exists\r
+  //                write_protected : the file can not be extracted because a file\r
+  //                                  with the same name already exists and is\r
+  //                                  write protected\r
+  //                newer_exist : the file was not extracted because a newer file exists\r
+  //                path_creation_fail : the file is not extracted because the folder\r
+  //                                     does not exists and can not be created\r
+  //                write_error : the file was not extracted because there was a\r
+  //                              error while writing the file\r
+  //                read_error : the file was not extracted because there was a error\r
+  //                             while reading the file\r
+  //                invalid_header : the file was not extracted because of an archive\r
+  //                                 format error (bad file header)\r
+  //   Note that each time a method can continue operating when there\r
+  //   is an action error on a file, the error is only logged in the file status.\r
+  // Return Values :\r
+  //   0 on an unrecoverable failure,\r
+  //   The list of the files in the archive.\r
+  // --------------------------------------------------------------------------------\r
+  function listContent()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Call the extracting fct\r
+    $p_list = array();\r
+    if (($v_result = $this->privList($p_list)) != 1)\r
+    {\r
+      unset($p_list);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());\r
+      return(0);\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);\r
+    return $p_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function :\r
+  //   extract($p_path="./", $p_remove_path="")\r
+  //   extract([$p_option, $p_option_value, ...])\r
+  // Description :\r
+  //   This method supports two synopsis. The first one is historical.\r
+  //   This method extract all the files / directories from the archive to the\r
+  //   folder indicated in $p_path.\r
+  //   If you want to ignore the 'root' part of path of the memorized files\r
+  //   you can indicate this in the optional $p_remove_path parameter.\r
+  //   By default, if a newer file with the same name already exists, the\r
+  //   file is not extracted.\r
+  //\r
+  //   If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions\r
+  //   are used, the path indicated in PCLZIP_OPT_ADD_PATH is append\r
+  //   at the end of the path value of PCLZIP_OPT_PATH.\r
+  // Parameters :\r
+  //   $p_path : Path where the files and directories are to be extracted\r
+  //   $p_remove_path : First part ('root' part) of the memorized path\r
+  //                    (if any similar) to remove while extracting.\r
+  // Options :\r
+  //   PCLZIP_OPT_PATH :\r
+  //   PCLZIP_OPT_ADD_PATH :\r
+  //   PCLZIP_OPT_REMOVE_PATH :\r
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :\r
+  //   PCLZIP_CB_PRE_EXTRACT :\r
+  //   PCLZIP_CB_POST_EXTRACT :\r
+  // Return Values :\r
+  //   0 or a negative value on failure,\r
+  //   The list of the extracted files, with a status of the action.\r
+  //   (see PclZip::listContent() for list entry format)\r
+  // --------------------------------------------------------------------------------\r
+  function extract()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Set default values\r
+    $v_options = array();\r
+//    $v_path = "./";\r
+    $v_path = '';\r
+    $v_remove_path = "";\r
+    $v_remove_all_path = false;\r
+\r
+    // ----- Look for variable options arguments\r
+    $v_size = func_num_args();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");\r
+\r
+    // ----- Default values for option\r
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;\r
+\r
+    // ----- Look for arguments\r
+    if ($v_size > 0) {\r
+      // ----- Get the arguments\r
+      $v_arg_list = func_get_args();\r
+\r
+      // ----- Look for first arg\r
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");\r
+\r
+        // ----- Parse the options\r
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,\r
+                                            array (PCLZIP_OPT_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',\r
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',\r
+                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',\r
+                                                   PCLZIP_CB_POST_EXTRACT => 'optional',\r
+                                                   PCLZIP_OPT_SET_CHMOD => 'optional',\r
+                                                   PCLZIP_OPT_BY_NAME => 'optional',\r
+                                                   PCLZIP_OPT_BY_EREG => 'optional',\r
+                                                   PCLZIP_OPT_BY_PREG => 'optional',\r
+                                                   PCLZIP_OPT_BY_INDEX => 'optional',\r
+                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',\r
+                                                   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',\r
+                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'\r
+                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'\r
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'\r
+                                                                                                   ));\r
+        if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+          return 0;\r
+        }\r
+\r
+        // ----- Set the arguments\r
+        if (isset($v_options[PCLZIP_OPT_PATH])) {\r
+          $v_path = $v_options[PCLZIP_OPT_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {\r
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {\r
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {\r
+          // ----- Check for '/' in last path char\r
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {\r
+            $v_path .= '/';\r
+          }\r
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];\r
+        }\r
+      }\r
+\r
+      // ----- Look for 2 args\r
+      // Here we need to support the first historic synopsis of the\r
+      // method.\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");\r
+\r
+        // ----- Get the first argument\r
+        $v_path = $v_arg_list[0];\r
+\r
+        // ----- Look for the optional second argument\r
+        if ($v_size == 2) {\r
+          $v_remove_path = $v_arg_list[1];\r
+        }\r
+        else if ($v_size > 2) {\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());\r
+          return 0;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Trace\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");\r
+\r
+    // ----- Call the extracting fct\r
+    $p_list = array();\r
+    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,\r
+                                            $v_remove_all_path, $v_options);\r
+    if ($v_result < 1) {\r
+      unset($p_list);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());\r
+      return(0);\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);\r
+    return $p_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function :\r
+  //   extractByIndex($p_index, $p_path="./", $p_remove_path="")\r
+  //   extractByIndex($p_index, [$p_option, $p_option_value, ...])\r
+  // Description :\r
+  //   This method supports two synopsis. The first one is historical.\r
+  //   This method is doing a partial extract of the archive.\r
+  //   The extracted files or folders are identified by their index in the\r
+  //   archive (from 0 to n).\r
+  //   Note that if the index identify a folder, only the folder entry is\r
+  //   extracted, not all the files included in the archive.\r
+  // Parameters :\r
+  //   $p_index : A single index (integer) or a string of indexes of files to\r
+  //              extract. The form of the string is "0,4-6,8-12" with only numbers\r
+  //              and '-' for range or ',' to separate ranges. No spaces or ';'\r
+  //              are allowed.\r
+  //   $p_path : Path where the files and directories are to be extracted\r
+  //   $p_remove_path : First part ('root' part) of the memorized path\r
+  //                    (if any similar) to remove while extracting.\r
+  // Options :\r
+  //   PCLZIP_OPT_PATH :\r
+  //   PCLZIP_OPT_ADD_PATH :\r
+  //   PCLZIP_OPT_REMOVE_PATH :\r
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :\r
+  //   PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and\r
+  //     not as files.\r
+  //     The resulting content is in a new field 'content' in the file\r
+  //     structure.\r
+  //     This option must be used alone (any other options are ignored).\r
+  //   PCLZIP_CB_PRE_EXTRACT :\r
+  //   PCLZIP_CB_POST_EXTRACT :\r
+  // Return Values :\r
+  //   0 on failure,\r
+  //   The list of the extracted files, with a status of the action.\r
+  //   (see PclZip::listContent() for list entry format)\r
+  // --------------------------------------------------------------------------------\r
+  //function extractByIndex($p_index, options...)\r
+  function extractByIndex($p_index)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Set default values\r
+    $v_options = array();\r
+//    $v_path = "./";\r
+    $v_path = '';\r
+    $v_remove_path = "";\r
+    $v_remove_all_path = false;\r
+\r
+    // ----- Look for variable options arguments\r
+    $v_size = func_num_args();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");\r
+\r
+    // ----- Default values for option\r
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;\r
+\r
+    // ----- Look for arguments\r
+    if ($v_size > 1) {\r
+      // ----- Get the arguments\r
+      $v_arg_list = func_get_args();\r
+\r
+      // ----- Remove form the options list the first argument\r
+      array_shift($v_arg_list);\r
+      $v_size--;\r
+\r
+      // ----- Look for first arg\r
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");\r
+\r
+        // ----- Parse the options\r
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,\r
+                                            array (PCLZIP_OPT_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',\r
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',\r
+                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',\r
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',\r
+                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',\r
+                                                   PCLZIP_CB_POST_EXTRACT => 'optional',\r
+                                                   PCLZIP_OPT_SET_CHMOD => 'optional',\r
+                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'\r
+                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'\r
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'\r
+                                                                                                  ));\r
+        if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+          return 0;\r
+        }\r
+\r
+        // ----- Set the arguments\r
+        if (isset($v_options[PCLZIP_OPT_PATH])) {\r
+          $v_path = $v_options[PCLZIP_OPT_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {\r
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {\r
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];\r
+        }\r
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {\r
+          // ----- Check for '/' in last path char\r
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {\r
+            $v_path .= '/';\r
+          }\r
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];\r
+        }\r
+        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {\r
+          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");\r
+        }\r
+        else {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");\r
+        }\r
+      }\r
+\r
+      // ----- Look for 2 args\r
+      // Here we need to support the first historic synopsis of the\r
+      // method.\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");\r
+\r
+        // ----- Get the first argument\r
+        $v_path = $v_arg_list[0];\r
+\r
+        // ----- Look for the optional second argument\r
+        if ($v_size == 2) {\r
+          $v_remove_path = $v_arg_list[1];\r
+        }\r
+        else if ($v_size > 2) {\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return 0;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Trace\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");\r
+\r
+    // ----- Trick\r
+    // Here I want to reuse extractByRule(), so I need to parse the $p_index\r
+    // with privParseOptions()\r
+    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);\r
+    $v_options_trick = array();\r
+    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,\r
+                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));\r
+    if ($v_result != 1) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+        return 0;\r
+    }\r
+    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];\r
+\r
+    // ----- Call the extracting fct\r
+    if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());\r
+        return(0);\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);\r
+    return $p_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function :\r
+  //   delete([$p_option, $p_option_value, ...])\r
+  // Description :\r
+  //   This method removes files from the archive.\r
+  //   If no parameters are given, then all the archive is emptied.\r
+  // Parameters :\r
+  //   None or optional arguments.\r
+  // Options :\r
+  //   PCLZIP_OPT_BY_INDEX :\r
+  //   PCLZIP_OPT_BY_NAME :\r
+  //   PCLZIP_OPT_BY_EREG : \r
+  //   PCLZIP_OPT_BY_PREG :\r
+  // Return Values :\r
+  //   0 on failure,\r
+  //   The list of the files which are still present in the archive.\r
+  //   (see PclZip::listContent() for list entry format)\r
+  // --------------------------------------------------------------------------------\r
+  function delete()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");\r
+    $v_result=1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Set default values\r
+    $v_options = array();\r
+\r
+    // ----- Look for variable options arguments\r
+    $v_size = func_num_args();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");\r
+\r
+    // ----- Look for arguments\r
+    if ($v_size > 0) {\r
+      // ----- Get the arguments\r
+      $v_arg_list = func_get_args();\r
+\r
+      // ----- Parse the options\r
+      $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,\r
+                                        array (PCLZIP_OPT_BY_NAME => 'optional',\r
+                                               PCLZIP_OPT_BY_EREG => 'optional',\r
+                                               PCLZIP_OPT_BY_PREG => 'optional',\r
+                                               PCLZIP_OPT_BY_INDEX => 'optional' ));\r
+      if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+          return 0;\r
+      }\r
+    }\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Call the delete fct\r
+    $v_list = array();\r
+    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {\r
+      $this->privSwapBackMagicQuotes();\r
+      unset($v_list);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());\r
+      return(0);\r
+    }\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);\r
+    return $v_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : deleteByIndex()\r
+  // Description :\r
+  //   ***** Deprecated *****\r
+  //   delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.\r
+  // --------------------------------------------------------------------------------\r
+  function deleteByIndex($p_index)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");\r
+    \r
+    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);\r
+    return $p_list;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : properties()\r
+  // Description :\r
+  //   This method gives the properties of the archive.\r
+  //   The properties are :\r
+  //     nb : Number of files in the archive\r
+  //     comment : Comment associated with the archive file\r
+  //     status : not_exist, ok\r
+  // Parameters :\r
+  //   None\r
+  // Return Values :\r
+  //   0 on failure,\r
+  //   An array with the archive properties.\r
+  // --------------------------------------------------------------------------------\r
+  function properties()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      $this->privSwapBackMagicQuotes();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Default properties\r
+    $v_prop = array();\r
+    $v_prop['comment'] = '';\r
+    $v_prop['nb'] = 0;\r
+    $v_prop['status'] = 'not_exist';\r
+\r
+    // ----- Look if file exists\r
+    if (@is_file($this->zipname))\r
+    {\r
+      // ----- Open the zip file\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)\r
+      {\r
+        $this->privSwapBackMagicQuotes();\r
+        \r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);\r
+        return 0;\r
+      }\r
+\r
+      // ----- Read the central directory informations\r
+      $v_central_dir = array();\r
+      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+      {\r
+        $this->privSwapBackMagicQuotes();\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+        return 0;\r
+      }\r
+\r
+      // ----- Close the zip file\r
+      $this->privCloseFd();\r
+\r
+      // ----- Set the user attributes\r
+      $v_prop['comment'] = $v_central_dir['comment'];\r
+      $v_prop['nb'] = $v_central_dir['entries'];\r
+      $v_prop['status'] = 'ok';\r
+    }\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);\r
+    return $v_prop;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : duplicate()\r
+  // Description :\r
+  //   This method creates an archive by copying the content of an other one. If\r
+  //   the archive already exist, it is replaced by the new one without any warning.\r
+  // Parameters :\r
+  //   $p_archive : The filename of a valid archive, or\r
+  //                a valid PclZip object.\r
+  // Return Values :\r
+  //   1 on success.\r
+  //   0 or a negative value on error (error code).\r
+  // --------------------------------------------------------------------------------\r
+  function duplicate($p_archive)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");\r
+    $v_result = 1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Look if the $p_archive is a PclZip object\r
+    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");\r
+\r
+      // ----- Duplicate the archive\r
+      $v_result = $this->privDuplicate($p_archive->zipname);\r
+    }\r
+\r
+    // ----- Look if the $p_archive is a string (so a filename)\r
+    else if (is_string($p_archive))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");\r
+\r
+      // ----- Check that $p_archive is a valid zip file\r
+      // TBC : Should also check the archive format\r
+      if (!is_file($p_archive)) {\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");\r
+        $v_result = PCLZIP_ERR_MISSING_FILE;\r
+      }\r
+      else {\r
+        // ----- Duplicate the archive\r
+        $v_result = $this->privDuplicate($p_archive);\r
+      }\r
+    }\r
+\r
+    // ----- Invalid variable\r
+    else\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");\r
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : merge()\r
+  // Description :\r
+  //   This method merge the $p_archive_to_add archive at the end of the current\r
+  //   one ($this).\r
+  //   If the archive ($this) does not exist, the merge becomes a duplicate.\r
+  //   If the $p_archive_to_add archive does not exist, the merge is a success.\r
+  // Parameters :\r
+  //   $p_archive_to_add : It can be directly the filename of a valid zip archive,\r
+  //                       or a PclZip object archive.\r
+  // Return Values :\r
+  //   1 on success,\r
+  //   0 or negative values on error (see below).\r
+  // --------------------------------------------------------------------------------\r
+  function merge($p_archive_to_add)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");\r
+    $v_result = 1;\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Check archive\r
+    if (!$this->privCheckFormat()) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);\r
+      return(0);\r
+    }\r
+\r
+    // ----- Look if the $p_archive_to_add is a PclZip object\r
+    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");\r
+\r
+      // ----- Merge the archive\r
+      $v_result = $this->privMerge($p_archive_to_add);\r
+    }\r
+\r
+    // ----- Look if the $p_archive_to_add is a string (so a filename)\r
+    else if (is_string($p_archive_to_add))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");\r
+\r
+      // ----- Create a temporary archive\r
+      $v_object_archive = new PclZip($p_archive_to_add);\r
+\r
+      // ----- Merge the archive\r
+      $v_result = $this->privMerge($v_object_archive);\r
+    }\r
+\r
+    // ----- Invalid variable\r
+    else\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");\r
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : errorCode()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function errorCode()\r
+  {\r
+    if (PCLZIP_ERROR_EXTERNAL == 1) {\r
+      return(PclErrorCode());\r
+    }\r
+    else {\r
+      return($this->error_code);\r
+    }\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : errorName()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function errorName($p_with_code=false)\r
+  {\r
+    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',\r
+                      PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',\r
+                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',\r
+                      PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',\r
+                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',\r
+                      PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',\r
+                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',\r
+                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',\r
+                      PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',\r
+                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',\r
+                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',\r
+                      PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',\r
+                      PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',\r
+                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',\r
+                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',\r
+                      PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',\r
+                      PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',\r
+                      PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',\r
+                      PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'\r
+                      ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'\r
+                      ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'\r
+                    );\r
+\r
+    if (isset($v_name[$this->error_code])) {\r
+      $v_value = $v_name[$this->error_code];\r
+    }\r
+    else {\r
+      $v_value = 'NoName';\r
+    }\r
+\r
+    if ($p_with_code) {\r
+      return($v_value.' ('.$this->error_code.')');\r
+    }\r
+    else {\r
+      return($v_value);\r
+    }\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : errorInfo()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function errorInfo($p_full=false)\r
+  {\r
+    if (PCLZIP_ERROR_EXTERNAL == 1) {\r
+      return(PclErrorString());\r
+    }\r
+    else {\r
+      if ($p_full) {\r
+        return($this->errorName(true)." : ".$this->error_string);\r
+      }\r
+      else {\r
+        return($this->error_string." [code ".$this->error_code."]");\r
+      }\r
+    }\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+\r
+// --------------------------------------------------------------------------------\r
+// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****\r
+// *****                                                        *****\r
+// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****\r
+// --------------------------------------------------------------------------------\r
+\r
+\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privCheckFormat()\r
+  // Description :\r
+  //   This method check that the archive exists and is a valid zip archive.\r
+  //   Several level of check exists. (futur)\r
+  // Parameters :\r
+  //   $p_level : Level of check. Default 0.\r
+  //              0 : Check the first bytes (magic codes) (default value))\r
+  //              1 : 0 + Check the central directory (futur)\r
+  //              2 : 1 + Check each file header (futur)\r
+  // Return Values :\r
+  //   true on success,\r
+  //   false on error, the error code is set.\r
+  // --------------------------------------------------------------------------------\r
+  function privCheckFormat($p_level=0)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");\r
+    $v_result = true;\r
+\r
+       // ----- Reset the file system cache\r
+    clearstatcache();\r
+\r
+    // ----- Reset the error handler\r
+    $this->privErrorReset();\r
+\r
+    // ----- Look if the file exits\r
+    if (!is_file($this->zipname)) {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());\r
+      return(false);\r
+    }\r
+\r
+    // ----- Check that the file is readeable\r
+    if (!is_readable($this->zipname)) {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());\r
+      return(false);\r
+    }\r
+\r
+    // ----- Check the magic code\r
+    // TBC\r
+\r
+    // ----- Check the central header\r
+    // TBC\r
+\r
+    // ----- Check each file header\r
+    // TBC\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privParseOptions()\r
+  // Description :\r
+  //   This internal methods reads the variable list of arguments ($p_options_list,\r
+  //   $p_size) and generate an array with the options and values ($v_result_list).\r
+  //   $v_requested_options contains the options that can be present and those that\r
+  //   must be present.\r
+  //   $v_requested_options is an array, with the option value as key, and 'optional',\r
+  //   or 'mandatory' as value.\r
+  // Parameters :\r
+  //   See above.\r
+  // Return Values :\r
+  //   1 on success.\r
+  //   0 on failure.\r
+  // --------------------------------------------------------------------------------\r
+  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");\r
+    $v_result=1;\r
+    \r
+    // ----- Read the options\r
+    $i=0;\r
+    while ($i<$p_size) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");\r
+\r
+      // ----- Check if the option is supported\r
+      if (!isset($v_requested_options[$p_options_list[$i]])) {\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Look for next option\r
+      switch ($p_options_list[$i]) {\r
+        // ----- Look for options that request a path value\r
+        case PCLZIP_OPT_PATH :\r
+        case PCLZIP_OPT_REMOVE_PATH :\r
+        case PCLZIP_OPT_ADD_PATH :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+          $i++;\r
+        break;\r
+\r
+        case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          if (   is_string($p_options_list[$i+1])\r
+              && ($p_options_list[$i+1] != '')) {\r
+            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+            $i++;\r
+          }\r
+          else {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");\r
+          }\r
+        break;\r
+\r
+        // ----- Look for options that request an array of string for value\r
+        case PCLZIP_OPT_BY_NAME :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          if (is_string($p_options_list[$i+1])) {\r
+              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];\r
+          }\r
+          else if (is_array($p_options_list[$i+1])) {\r
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];\r
+          }\r
+          else {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+          $i++;\r
+        break;\r
+\r
+        // ----- Look for options that request an EREG or PREG expression\r
+        case PCLZIP_OPT_BY_EREG :\r
+        case PCLZIP_OPT_BY_PREG :\r
+        //case PCLZIP_OPT_CRYPT :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          if (is_string($p_options_list[$i+1])) {\r
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];\r
+          }\r
+          else {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+          $i++;\r
+        break;\r
+\r
+        // ----- Look for options that takes a string\r
+        case PCLZIP_OPT_COMMENT :\r
+        case PCLZIP_OPT_ADD_COMMENT :\r
+        case PCLZIP_OPT_PREPEND_COMMENT :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,\r
+                                            "Missing parameter value for option '"\r
+                                                                .PclZipUtilOptionText($p_options_list[$i])\r
+                                                                ."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          if (is_string($p_options_list[$i+1])) {\r
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];\r
+          }\r
+          else {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,\r
+                                            "Wrong parameter value for option '"\r
+                                                                .PclZipUtilOptionText($p_options_list[$i])\r
+                                                                ."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+          $i++;\r
+        break;\r
+\r
+        // ----- Look for options that request an array of index\r
+        case PCLZIP_OPT_BY_INDEX :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          $v_work_list = array();\r
+          if (is_string($p_options_list[$i+1])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");\r
+\r
+              // ----- Remove spaces\r
+              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');\r
+\r
+              // ----- Parse items\r
+              $v_work_list = explode(",", $p_options_list[$i+1]);\r
+          }\r
+          else if (is_integer($p_options_list[$i+1])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");\r
+              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];\r
+          }\r
+          else if (is_array($p_options_list[$i+1])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");\r
+              $v_work_list = $p_options_list[$i+1];\r
+          }\r
+          else {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+          \r
+          // ----- Reduce the index list\r
+          // each index item in the list must be a couple with a start and\r
+          // an end value : [0,3], [5-5], [8-10], ...\r
+          // ----- Check the format of each item\r
+          $v_sort_flag=false;\r
+          $v_sort_value=0;\r
+          for ($j=0; $j<sizeof($v_work_list); $j++) {\r
+              // ----- Explode the item\r
+              $v_item_list = explode("-", $v_work_list[$j]);\r
+              $v_size_item_list = sizeof($v_item_list);\r
+              \r
+              // ----- TBC : Here we might check that each item is a\r
+              // real integer ...\r
+              \r
+              // ----- Look for single value\r
+              if ($v_size_item_list == 1) {\r
+                  // ----- Set the option value\r
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];\r
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];\r
+              }\r
+              elseif ($v_size_item_list == 2) {\r
+                  // ----- Set the option value\r
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];\r
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];\r
+              }\r
+              else {\r
+                  // ----- Error log\r
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+                  // ----- Return\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+                  return PclZip::errorCode();\r
+              }\r
+\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");\r
+\r
+              // ----- Look for list sort\r
+              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");\r
+                  $v_sort_flag=true;\r
+\r
+                  // ----- TBC : An automatic sort should be writen ...\r
+                  // ----- Error log\r
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+                  // ----- Return\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+                  return PclZip::errorCode();\r
+              }\r
+              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];\r
+          }\r
+          \r
+          // ----- Sort the items\r
+          if ($v_sort_flag) {\r
+              // TBC : To Be Completed\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");\r
+          }\r
+\r
+          // ----- Next option\r
+          $i++;\r
+        break;\r
+\r
+        // ----- Look for options that request no value\r
+        case PCLZIP_OPT_REMOVE_ALL_PATH :\r
+        case PCLZIP_OPT_EXTRACT_AS_STRING :\r
+        case PCLZIP_OPT_NO_COMPRESSION :\r
+        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :\r
+        case PCLZIP_OPT_REPLACE_NEWER :\r
+        case PCLZIP_OPT_STOP_ON_ERROR :\r
+          $v_result_list[$p_options_list[$i]] = true;\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+        break;\r
+\r
+        // ----- Look for options that request an octal value\r
+        case PCLZIP_OPT_SET_CHMOD :\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");\r
+          $i++;\r
+        break;\r
+\r
+        // ----- Look for options that request a call-back\r
+        case PCLZIP_CB_PRE_EXTRACT :\r
+        case PCLZIP_CB_POST_EXTRACT :\r
+        case PCLZIP_CB_PRE_ADD :\r
+        case PCLZIP_CB_POST_ADD :\r
+        /* for futur use\r
+        case PCLZIP_CB_PRE_DELETE :\r
+        case PCLZIP_CB_POST_DELETE :\r
+        case PCLZIP_CB_PRE_LIST :\r
+        case PCLZIP_CB_POST_LIST :\r
+        */\r
+          // ----- Check the number of parameters\r
+          if (($i+1) >= $p_size) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Get the value\r
+          $v_function_name = $p_options_list[$i+1];\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");\r
+\r
+          // ----- Check that the value is a valid existing function\r
+          if (!function_exists($v_function_name)) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          // ----- Set the attribute\r
+          $v_result_list[$p_options_list[$i]] = $v_function_name;\r
+          $i++;\r
+        break;\r
+\r
+        default :\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,\r
+                                      "Unknown parameter '"\r
+                                                          .$p_options_list[$i]."'");\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Next options\r
+      $i++;\r
+    }\r
+\r
+    // ----- Look for mandatory options\r
+    if ($v_requested_options !== false) {\r
+      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {\r
+        // ----- Look for mandatory option\r
+        if ($v_requested_options[$key] == 'mandatory') {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");\r
+          // ----- Look if present\r
+          if (!isset($v_result_list[$key])) {\r
+            // ----- Error log\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privFileDescrParseAtt()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  //   1 on success.\r
+  //   0 on failure.\r
+  // --------------------------------------------------------------------------------\r
+  function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");\r
+    $v_result=1;\r
+    \r
+    // ----- For each file in the list check the attributes\r
+    foreach ($p_file_list as $v_key => $v_value) {\r
+    \r
+      // ----- Check if the option is supported\r
+      if (!isset($v_requested_options[$v_key])) {\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Look for attribute\r
+      switch ($v_key) {\r
+        case PCLZIP_ATT_FILE_NAME :\r
+          if (!is_string($v_value)) {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");\r
+          \r
+          if ($p_filedescr['filename'] == '') {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+        break;\r
+\r
+        case PCLZIP_ATT_FILE_NEW_SHORT_NAME :\r
+          if (!is_string($v_value)) {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");\r
+\r
+          if ($p_filedescr['new_short_name'] == '') {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+        break;\r
+\r
+        case PCLZIP_ATT_FILE_NEW_FULL_NAME :\r
+          if (!is_string($v_value)) {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+\r
+          $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");\r
+\r
+          if ($p_filedescr['new_full_name'] == '') {\r
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+          }\r
+        break;\r
+\r
+        default :\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,\r
+                                          "Unknown parameter '".$v_key."'");\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Look for mandatory options\r
+      if ($v_requested_options !== false) {\r
+        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {\r
+          // ----- Look for mandatory option\r
+          if ($v_requested_options[$key] == 'mandatory') {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");\r
+            // ----- Look if present\r
+            if (!isset($p_file_list[$key])) {\r
+              PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");\r
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+              return PclZip::errorCode();\r
+            }\r
+          }\r
+        }\r
+      }\r
+    \r
+    // end foreach\r
+    }\r
+    \r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privFileDescrExpand()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  //   1 on success.\r
+  //   0 on failure.\r
+  // --------------------------------------------------------------------------------\r
+  function privFileDescrExpand(&$p_filedescr_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");\r
+    $v_result=1;\r
+    \r
+    // ----- Create a result list\r
+    $v_result_list = array();\r
+    \r
+    // ----- Look each entry\r
+    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {\r
+      // ----- Get filedescr\r
+      $v_descr = $p_filedescr_list[$i];\r
+      \r
+      // ----- Reduce the filename\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");\r
+      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);\r
+      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");\r
+      \r
+      // ----- Get type of descr\r
+      if (!file_exists($v_descr['filename'])) {\r
+        // ----- Error log\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");\r
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+      if (@is_file($v_descr['filename'])) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");\r
+        $v_descr['type'] = 'file';\r
+      }\r
+      else if (@is_dir($v_descr['filename'])) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");\r
+        $v_descr['type'] = 'folder';\r
+      }\r
+      else if (@is_link($v_descr['filename'])) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");\r
+        // skip\r
+        continue;\r
+      }\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");\r
+        // skip\r
+        continue;\r
+      }\r
+      \r
+      // ----- Calculate the stored filename\r
+      $this->privCalculateStoredFilename($v_descr, $p_options);\r
+      \r
+      // ----- Add the descriptor in result list\r
+      $v_result_list[sizeof($v_result_list)] = $v_descr;\r
+      \r
+      // ----- Look for folder\r
+      if ($v_descr['type'] == 'folder') {\r
+        // ----- List of items in folder\r
+        $v_dirlist_descr = array();\r
+        $v_dirlist_nb = 0;\r
+        if ($v_folder_handler = @opendir($v_descr['filename'])) {\r
+          while (($v_item_handler = @readdir($v_folder_handler)) !== false) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");\r
+\r
+            // ----- Skip '.' and '..'\r
+            if (($v_item_handler == '.') || ($v_item_handler == '..')) {\r
+                continue;\r
+            }\r
+            \r
+            // ----- Compose the full filename\r
+            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;\r
+            \r
+            // ----- Look for different stored filename\r
+            // Because the name of the folder was changed, the name of the\r
+            // files/sub-folders also change\r
+            if ($v_descr['stored_filename'] != $v_descr['filename']) {\r
+              $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;\r
+            }\r
+      \r
+            $v_dirlist_nb++;\r
+          }\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");\r
+          // TBC : unable to open folder in read mode\r
+        }\r
+        \r
+        // ----- Expand each element of the list\r
+        if ($v_dirlist_nb != 0) {\r
+          // ----- Expand\r
+          if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+          \r
+          // ----- Concat the resulting list\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");\r
+          $v_result_list = array_merge($v_result_list, $v_dirlist_descr);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");\r
+        }\r
+          \r
+        // ----- Free local array\r
+        unset($v_dirlist_descr);\r
+      }\r
+    }\r
+    \r
+    // ----- Get the result list\r
+    $p_filedescr_list = $v_result_list;\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privCreate()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privCreate($p_filedescr_list, &$p_result_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");\r
+    $v_result=1;\r
+    $v_list_detail = array();\r
+    \r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Open the file in write mode\r
+    if (($v_result = $this->privOpenFd('wb')) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Add the list of files\r
+    $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);\r
+\r
+    // ----- Close\r
+    $this->privCloseFd();\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privAdd()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privAdd($p_filedescr_list, &$p_result_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");\r
+    $v_result=1;\r
+    $v_list_detail = array();\r
+\r
+    // ----- Look if the archive exists or is empty\r
+    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");\r
+\r
+      // ----- Do a create\r
+      $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_result=$this->privOpenFd('rb')) != 1)\r
+    {\r
+      // ----- Magic quotes trick\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir = array();\r
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+      $this->privSwapBackMagicQuotes();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Go to beginning of File\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");\r
+    @rewind($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");\r
+\r
+    // ----- Creates a temporay file\r
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';\r
+\r
+    // ----- Open the temporary file in write mode\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)\r
+    {\r
+      $this->privCloseFd();\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Copy the files from the archive to the temporary file\r
+    // TBC : Here I should better append the file and go back to erase the central dir\r
+    $v_size = $v_central_dir['offset'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = fread($this->zip_fd, $v_read_size);\r
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Swap the file descriptor\r
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to use\r
+    // the following methods on the temporary fil and not the real archive\r
+    $v_swap = $this->zip_fd;\r
+    $this->zip_fd = $v_zip_temp_fd;\r
+    $v_zip_temp_fd = $v_swap;\r
+\r
+    // ----- Add the files\r
+    $v_header_list = array();\r
+    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)\r
+    {\r
+      fclose($v_zip_temp_fd);\r
+      $this->privCloseFd();\r
+      @unlink($v_zip_temp_name);\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Store the offset of the central dir\r
+    $v_offset = @ftell($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");\r
+\r
+    // ----- Copy the block of file headers from the old archive\r
+    $v_size = $v_central_dir['size'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);\r
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Create the Central Dir files header\r
+    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)\r
+    {\r
+      // ----- Create the file header\r
+      if ($v_header_list[$i]['status'] == 'ok') {\r
+        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {\r
+          fclose($v_zip_temp_fd);\r
+          $this->privCloseFd();\r
+          @unlink($v_zip_temp_name);\r
+          $this->privSwapBackMagicQuotes();\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+        $v_count++;\r
+      }\r
+\r
+      // ----- Transform the header to a 'usable' info\r
+      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);\r
+    }\r
+\r
+    // ----- Zip file comment\r
+    $v_comment = $v_central_dir['comment'];\r
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {\r
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];\r
+    }\r
+    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {\r
+      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];\r
+    }\r
+    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {\r
+      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;\r
+    }\r
+\r
+    // ----- Calculate the size of the central header\r
+    $v_size = @ftell($this->zip_fd)-$v_offset;\r
+\r
+    // ----- Create the central dir footer\r
+    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)\r
+    {\r
+      // ----- Reset the file list\r
+      unset($v_header_list);\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Swap back the file descriptor\r
+    $v_swap = $this->zip_fd;\r
+    $this->zip_fd = $v_zip_temp_fd;\r
+    $v_zip_temp_fd = $v_swap;\r
+\r
+    // ----- Close\r
+    $this->privCloseFd();\r
+\r
+    // ----- Close the temporary file\r
+    @fclose($v_zip_temp_fd);\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Delete the zip file\r
+    // TBC : I should test the result ...\r
+    @unlink($this->zipname);\r
+\r
+    // ----- Rename the temporary file\r
+    // TBC : I should test the result ...\r
+    //@rename($v_zip_temp_name, $this->zipname);\r
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privOpenFd()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function privOpenFd($p_mode)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);\r
+    $v_result=1;\r
+\r
+    // ----- Look if already open\r
+    if ($this->zip_fd != 0)\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');\r
+    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privCloseFd()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function privCloseFd()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");\r
+    $v_result=1;\r
+\r
+    if ($this->zip_fd != 0)\r
+      @fclose($this->zip_fd);\r
+    $this->zip_fd = 0;\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privAddList()\r
+  // Description :\r
+  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is\r
+  //   different from the real path of the file. This is usefull if you want to have PclTar\r
+  //   running in any directory, and memorize relative path from an other directory.\r
+  // Parameters :\r
+  //   $p_list : An array containing the file or directory names to add in the tar\r
+  //   $p_result_list : list of added files with their properties (specially the status field)\r
+  //   $p_add_dir : Path to add in the filename path archived\r
+  //   $p_remove_dir : Path to remove in the filename path archived\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+//  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)\r
+  function privAddList($p_filedescr_list, &$p_result_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");\r
+    $v_result=1;\r
+\r
+    // ----- Add the files\r
+    $v_header_list = array();\r
+    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Store the offset of the central dir\r
+    $v_offset = @ftell($this->zip_fd);\r
+\r
+    // ----- Create the Central Dir files header\r
+    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)\r
+    {\r
+      // ----- Create the file header\r
+      if ($v_header_list[$i]['status'] == 'ok') {\r
+        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+        $v_count++;\r
+      }\r
+\r
+      // ----- Transform the header to a 'usable' info\r
+      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);\r
+    }\r
+\r
+    // ----- Zip file comment\r
+    $v_comment = '';\r
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {\r
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];\r
+    }\r
+\r
+    // ----- Calculate the size of the central header\r
+    $v_size = @ftell($this->zip_fd)-$v_offset;\r
+\r
+    // ----- Create the central dir footer\r
+    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)\r
+    {\r
+      // ----- Reset the file list\r
+      unset($v_header_list);\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privAddFileList()\r
+  // Description :\r
+  // Parameters :\r
+  //   $p_filedescr_list : An array containing the file description \r
+  //                      or directory names to add in the zip\r
+  //   $p_result_list : list of added files with their properties (specially the status field)\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");\r
+    $v_result=1;\r
+    $v_header = array();\r
+\r
+    // ----- Recuperate the current number of elt in list\r
+    $v_nb = sizeof($p_result_list);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");\r
+\r
+    // ----- Loop on the files\r
+    for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {\r
+      // ----- Format the filename\r
+      $p_filedescr_list[$j]['filename']\r
+      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);\r
+      \r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");\r
+\r
+      // ----- Skip empty file names\r
+      // TBC : Can this be possible ? not checked in DescrParseAtt ?\r
+      if ($p_filedescr_list[$j]['filename'] == "") {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");\r
+        continue;\r
+      }\r
+\r
+      // ----- Check the filename\r
+      if (!file_exists($p_filedescr_list[$j]['filename'])) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");\r
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Look if it is a file or a dir with no all path remove option\r
+      if (   (is_file($p_filedescr_list[$j]['filename']))\r
+          || (   is_dir($p_filedescr_list[$j]['filename'])\r
+              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])\r
+                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {\r
+\r
+        // ----- Add the file\r
+        $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,\r
+                                       $p_options);\r
+        if ($v_result != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+\r
+        // ----- Store the file infos\r
+        $p_result_list[$v_nb++] = $v_header;\r
+      }\r
+    }\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privAddFile()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privAddFile($p_filedescr, &$p_header, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");\r
+    $v_result=1;\r
+    \r
+    // ----- Working variable\r
+    $p_filename = $p_filedescr['filename'];\r
+\r
+    // TBC : Already done in the fileAtt check ... ?\r
+    if ($p_filename == "") {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+  \r
+    // ----- Look for a stored different filename \r
+    if (isset($p_filedescr['stored_filename'])) {\r
+      $v_stored_filename = $p_filedescr['stored_filename'];\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');\r
+    }\r
+    else {\r
+      $v_stored_filename = $p_filedescr['stored_filename'];\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');\r
+    }\r
+\r
+    // ----- Set the file properties\r
+    clearstatcache();\r
+    $p_header['version'] = 20;\r
+    $p_header['version_extracted'] = 10;\r
+    $p_header['flag'] = 0;\r
+    $p_header['compression'] = 0;\r
+    $p_header['mtime'] = filemtime($p_filename);\r
+    $p_header['crc'] = 0;\r
+    $p_header['compressed_size'] = 0;\r
+    $p_header['size'] = filesize($p_filename);\r
+    $p_header['filename_len'] = strlen($p_filename);\r
+    $p_header['extra_len'] = 0;\r
+    $p_header['comment_len'] = 0;\r
+    $p_header['disk'] = 0;\r
+    $p_header['internal'] = 0;\r
+//    $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);\r
+    $p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");\r
+    $p_header['offset'] = 0;\r
+    $p_header['filename'] = $p_filename;\r
+    $p_header['stored_filename'] = $v_stored_filename;\r
+    $p_header['extra'] = '';\r
+    $p_header['comment'] = '';\r
+    $p_header['status'] = 'ok';\r
+    $p_header['index'] = -1;\r
+\r
+    // ----- Look for pre-add callback\r
+    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');\r
+      if ($v_result == 0) {\r
+        // ----- Change the file status\r
+        $p_header['status'] = "skipped";\r
+        $v_result = 1;\r
+      }\r
+\r
+      // ----- Update the informations\r
+      // Only some fields can be modified\r
+      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {\r
+        $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");\r
+      }\r
+    }\r
+\r
+    // ----- Look for empty stored filename\r
+    if ($p_header['stored_filename'] == "") {\r
+      $p_header['status'] = "filtered";\r
+    }\r
+    \r
+    // ----- Check the path length\r
+    if (strlen($p_header['stored_filename']) > 0xFF) {\r
+      $p_header['status'] = 'filename_too_long';\r
+    }\r
+\r
+    // ----- Look if no error, or file not skipped\r
+    if ($p_header['status'] == 'ok') {\r
+\r
+      // ----- Look for a file\r
+      if (is_file($p_filename))\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");\r
+        // ----- Open the source file\r
+        if (($v_file = @fopen($p_filename, "rb")) == 0) {\r
+          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return PclZip::errorCode();\r
+        }\r
+\r
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");\r
+          // ----- Read the file content\r
+          $v_content_compressed = @fread($v_file, $p_header['size']);\r
+\r
+          // ----- Calculate the CRC\r
+          $p_header['crc'] = @crc32($v_content_compressed);\r
+\r
+          // ----- Set header parameters\r
+          $p_header['compressed_size'] = $p_header['size'];\r
+          $p_header['compression'] = 0;\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");\r
+          // ----- Read the file content\r
+          $v_content = @fread($v_file, $p_header['size']);\r
+\r
+          // ----- Calculate the CRC\r
+          $p_header['crc'] = @crc32($v_content);\r
+\r
+          // ----- Compress the file\r
+          $v_content_compressed = @gzdeflate($v_content);\r
+\r
+          // ----- Set header parameters\r
+          $p_header['compressed_size'] = strlen($v_content_compressed);\r
+          $p_header['compression'] = 8;\r
+        }\r
+        \r
+        // ----- Look for encryption\r
+        /*\r
+        if ((isset($p_options[PCLZIP_OPT_CRYPT]))\r
+                   && ($p_options[PCLZIP_OPT_CRYPT] != "")) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");\r
+          \r
+          // Should be a random header\r
+          $v_header = 'xxxxxxxxxxxx';\r
+             $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,\r
+                                                          $p_header['compressed_size'],\r
+                                                      $v_header,\r
+                                                                                                  $p_header['crc'],\r
+                                                                                                  "test");\r
+                                                                                                  \r
+          $p_header['compressed_size'] += 12;\r
+          $p_header['flag'] = 1;\r
+          \r
+          // ----- Add the header to the data\r
+          $v_content_compressed = $v_header.$v_content_compressed;\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");\r
+        }\r
+        */\r
+\r
+        // ----- Call the header generation\r
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {\r
+          @fclose($v_file);\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+\r
+        // ----- Write the compressed (or not) content\r
+        @fwrite($this->zip_fd, \r
+                           $v_content_compressed, $p_header['compressed_size']);\r
+        \r
+        // ----- Close the file\r
+        @fclose($v_file);\r
+      }\r
+\r
+      // ----- Look for a directory\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");\r
+        // ----- Look for directory last '/'\r
+        if (@substr($p_header['stored_filename'], -1) != '/') {\r
+          $p_header['stored_filename'] .= '/';\r
+        }\r
+\r
+        // ----- Set the file properties\r
+        $p_header['size'] = 0;\r
+        //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked\r
+        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked\r
+\r
+        // ----- Call the header generation\r
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)\r
+        {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Look for post-add callback\r
+    if (isset($p_options[PCLZIP_CB_POST_ADD])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');\r
+      if ($v_result == 0) {\r
+        // ----- Ignored\r
+        $v_result = 1;\r
+      }\r
+\r
+      // ----- Update the informations\r
+      // Nothing can be modified\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privCalculateStoredFilename()\r
+  // Description :\r
+  //   Based on file descriptor properties and global options, this method\r
+  //   calculate the filename that will be stored in the archive.\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privCalculateStoredFilename(&$p_filedescr, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");\r
+    $v_result=1;\r
+    \r
+    // ----- Working variables\r
+    $p_filename = $p_filedescr['filename'];\r
+    if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {\r
+      $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];\r
+    }\r
+    else {\r
+      $p_add_dir = '';\r
+    }\r
+    if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {\r
+      $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];\r
+    }\r
+    else {\r
+      $p_remove_dir = '';\r
+    }\r
+    if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {\r
+      $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];\r
+    }\r
+    else {\r
+      $p_remove_all_dir = 0;\r
+    }\r
+\r
+    // ----- Look for full name change\r
+    if (isset($p_filedescr['new_full_name'])) {\r
+      $v_stored_filename = $p_filedescr['new_full_name'];\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");\r
+    }\r
+    \r
+    // ----- Look for path and/or short name change\r
+    else {\r
+\r
+      // ----- Look for short name change\r
+      if (isset($p_filedescr['new_short_name'])) {\r
+        $v_path_info = pathinfo($p_filename);\r
+        $v_dir = '';\r
+        if ($v_path_info['dirname'] != '') {\r
+          $v_dir = $v_path_info['dirname'].'/';\r
+        }\r
+        $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");\r
+      }\r
+      else {\r
+        // ----- Calculate the stored filename\r
+        $v_stored_filename = $p_filename;\r
+      }\r
+\r
+      // ----- Look for all path to remove\r
+      if ($p_remove_all_dir) {\r
+        $v_stored_filename = basename($p_filename);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");\r
+      }\r
+      // ----- Look for partial path remove\r
+      else if ($p_remove_dir != "") {\r
+        if (substr($p_remove_dir, -1) != '/')\r
+          $p_remove_dir .= "/";\r
+\r
+        if (   (substr($p_filename, 0, 2) == "./")\r
+            || (substr($p_remove_dir, 0, 2) == "./")) {\r
+            \r
+          if (   (substr($p_filename, 0, 2) == "./")\r
+              && (substr($p_remove_dir, 0, 2) != "./")) {\r
+            $p_remove_dir = "./".$p_remove_dir;\r
+          }\r
+          if (   (substr($p_filename, 0, 2) != "./")\r
+              && (substr($p_remove_dir, 0, 2) == "./")) {\r
+            $p_remove_dir = substr($p_remove_dir, 2);\r
+          }\r
+        }\r
+\r
+        $v_compare = PclZipUtilPathInclusion($p_remove_dir,\r
+                                             $v_stored_filename);\r
+        if ($v_compare > 0) {\r
+          if ($v_compare == 2) {\r
+            $v_stored_filename = "";\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");\r
+          }\r
+          else {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");\r
+            $v_stored_filename = substr($v_stored_filename,\r
+                                        strlen($p_remove_dir));\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");\r
+          }\r
+        }\r
+      }\r
+      // ----- Look for path to add\r
+      if ($p_add_dir != "") {\r
+        if (substr($p_add_dir, -1) == "/")\r
+          $v_stored_filename = $p_add_dir.$v_stored_filename;\r
+        else\r
+          $v_stored_filename = $p_add_dir."/".$v_stored_filename;\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");\r
+      }\r
+    }\r
+\r
+    // ----- Filename (reduce the path of stored name)\r
+    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);\r
+    $p_filedescr['stored_filename'] = $v_stored_filename;\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));\r
+    \r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privWriteFileHeader()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privWriteFileHeader(&$p_header)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');\r
+    $v_result=1;\r
+\r
+    // ----- Store the offset position of the file\r
+    $p_header['offset'] = ftell($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);\r
+\r
+    // ----- Transform UNIX mtime to DOS format mdate/mtime\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    $v_date = getdate($p_header['mtime']);\r
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;\r
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];\r
+\r
+    // ----- Packed data\r
+    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,\r
+                             $p_header['version_extracted'], $p_header['flag'],\r
+                          $p_header['compression'], $v_mtime, $v_mdate,\r
+                          $p_header['crc'], $p_header['compressed_size'],\r
+                                                 $p_header['size'],\r
+                          strlen($p_header['stored_filename']),\r
+                                                 $p_header['extra_len']);\r
+\r
+    // ----- Write the first 148 bytes of the header in the archive\r
+    fputs($this->zip_fd, $v_binary_data, 30);\r
+\r
+    // ----- Write the variable fields\r
+    if (strlen($p_header['stored_filename']) != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));\r
+    }\r
+    if ($p_header['extra_len'] != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privWriteCentralFileHeader()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privWriteCentralFileHeader(&$p_header)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');\r
+    $v_result=1;\r
+\r
+    // TBC\r
+    //for(reset($p_header); $key = key($p_header); next($p_header)) {\r
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);\r
+    //}\r
+\r
+    // ----- Transform UNIX mtime to DOS format mdate/mtime\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    $v_date = getdate($p_header['mtime']);\r
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;\r
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];\r
+\r
+    // ----- Packed data\r
+    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,\r
+                             $p_header['version'], $p_header['version_extracted'],\r
+                          $p_header['flag'], $p_header['compression'],\r
+                                                 $v_mtime, $v_mdate, $p_header['crc'],\r
+                          $p_header['compressed_size'], $p_header['size'],\r
+                          strlen($p_header['stored_filename']),\r
+                                                 $p_header['extra_len'], $p_header['comment_len'],\r
+                          $p_header['disk'], $p_header['internal'],\r
+                                                 $p_header['external'], $p_header['offset']);\r
+\r
+    // ----- Write the 42 bytes of the header in the zip file\r
+    fputs($this->zip_fd, $v_binary_data, 46);\r
+\r
+    // ----- Write the variable fields\r
+    if (strlen($p_header['stored_filename']) != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));\r
+    }\r
+    if ($p_header['extra_len'] != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);\r
+    }\r
+    if ($p_header['comment_len'] != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privWriteCentralHeader()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');\r
+    $v_result=1;\r
+\r
+    // ----- Packed data\r
+    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,\r
+                             $p_nb_entries, $p_size,\r
+                                                 $p_offset, strlen($p_comment));\r
+\r
+    // ----- Write the 22 bytes of the header in the zip file\r
+    fputs($this->zip_fd, $v_binary_data, 22);\r
+\r
+    // ----- Write the variable fields\r
+    if (strlen($p_comment) != 0)\r
+    {\r
+      fputs($this->zip_fd, $p_comment, strlen($p_comment));\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privList()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privList(&$p_list)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");\r
+    $v_result=1;\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)\r
+    {\r
+      // ----- Magic quotes trick\r
+      $this->privSwapBackMagicQuotes();\r
+      \r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir = array();\r
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+    {\r
+      $this->privSwapBackMagicQuotes();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Go to beginning of Central Dir\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");\r
+    @rewind($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");\r
+    if (@fseek($this->zip_fd, $v_central_dir['offset']))\r
+    {\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");\r
+\r
+    // ----- Read each entry\r
+    for ($i=0; $i<$v_central_dir['entries']; $i++)\r
+    {\r
+      // ----- Read the file header\r
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)\r
+      {\r
+        $this->privSwapBackMagicQuotes();\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+        return $v_result;\r
+      }\r
+      $v_header['index'] = $i;\r
+\r
+      // ----- Get the only interesting attributes\r
+      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);\r
+      unset($v_header);\r
+    }\r
+\r
+    // ----- Close the zip file\r
+    $this->privCloseFd();\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privConvertHeader2FileInfo()\r
+  // Description :\r
+  //   This function takes the file informations from the central directory\r
+  //   entries and extract the interesting parameters that will be given back.\r
+  //   The resulting file infos are set in the array $p_info\r
+  //     $p_info['filename'] : Filename with full path. Given by user (add),\r
+  //                           extracted in the filesystem (extract).\r
+  //     $p_info['stored_filename'] : Stored filename in the archive.\r
+  //     $p_info['size'] = Size of the file.\r
+  //     $p_info['compressed_size'] = Compressed size of the file.\r
+  //     $p_info['mtime'] = Last modification date of the file.\r
+  //     $p_info['comment'] = Comment associated with the file.\r
+  //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.\r
+  //     $p_info['status'] = status of the action on the file.\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privConvertHeader2FileInfo($p_header, &$p_info)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");\r
+    $v_result=1;\r
+\r
+    // ----- Get the interesting attributes\r
+    $p_info['filename'] = $p_header['filename'];\r
+    $p_info['stored_filename'] = $p_header['stored_filename'];\r
+    $p_info['size'] = $p_header['size'];\r
+    $p_info['compressed_size'] = $p_header['compressed_size'];\r
+    $p_info['mtime'] = $p_header['mtime'];\r
+    $p_info['comment'] = $p_header['comment'];\r
+    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);\r
+    $p_info['index'] = $p_header['index'];\r
+    $p_info['status'] = $p_header['status'];\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privExtractByRule()\r
+  // Description :\r
+  //   Extract a file or directory depending of rules (by index, by name, ...)\r
+  // Parameters :\r
+  //   $p_file_list : An array where will be placed the properties of each\r
+  //                  extracted file\r
+  //   $p_path : Path to add while writing the extracted files\r
+  //   $p_remove_path : Path to remove (from the file memorized path) while writing the\r
+  //                    extracted files. If the path does not match the file path,\r
+  //                    the file is extracted with its memorized path.\r
+  //                    $p_remove_path does not apply to 'list' mode.\r
+  //                    $p_path and $p_remove_path are commulative.\r
+  // Return Values :\r
+  //   1 on success,0 or less on error (see error code list)\r
+  // --------------------------------------------------------------------------------\r
+  function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");\r
+    $v_result=1;\r
+\r
+    // ----- Magic quotes trick\r
+    $this->privDisableMagicQuotes();\r
+\r
+    // ----- Check the path\r
+    if (   ($p_path == "")\r
+           || (   (substr($p_path, 0, 1) != "/")\r
+                   && (substr($p_path, 0, 3) != "../")\r
+                       && (substr($p_path,1,2)!=":/")))\r
+      $p_path = "./".$p_path;\r
+\r
+    // ----- Reduce the path last (and duplicated) '/'\r
+    if (($p_path != "./") && ($p_path != "/"))\r
+    {\r
+      // ----- Look for the path end '/'\r
+      while (substr($p_path, -1) == "/")\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");\r
+        $p_path = substr($p_path, 0, strlen($p_path)-1);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");\r
+      }\r
+    }\r
+\r
+    // ----- Look for path to remove format (should end by /)\r
+    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))\r
+    {\r
+      $p_remove_path .= '/';\r
+    }\r
+    $p_remove_path_size = strlen($p_remove_path);\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_result = $this->privOpenFd('rb')) != 1)\r
+    {\r
+      $this->privSwapBackMagicQuotes();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir = array();\r
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+    {\r
+      // ----- Close the zip file\r
+      $this->privCloseFd();\r
+      $this->privSwapBackMagicQuotes();\r
+\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Start at beginning of Central Dir\r
+    $v_pos_entry = $v_central_dir['offset'];\r
+\r
+    // ----- Read each entry\r
+    $j_start = 0;\r
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");\r
+\r
+      // ----- Read next Central dir entry\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");\r
+      @rewind($this->zip_fd);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");\r
+      if (@fseek($this->zip_fd, $v_pos_entry))\r
+      {\r
+        // ----- Close the zip file\r
+        $this->privCloseFd();\r
+        $this->privSwapBackMagicQuotes();\r
+\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");\r
+\r
+      // ----- Read the file header\r
+      $v_header = array();\r
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)\r
+      {\r
+        // ----- Close the zip file\r
+        $this->privCloseFd();\r
+        $this->privSwapBackMagicQuotes();\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+        return $v_result;\r
+      }\r
+\r
+      // ----- Store the index\r
+      $v_header['index'] = $i;\r
+\r
+      // ----- Store the file position\r
+      $v_pos_entry = ftell($this->zip_fd);\r
+\r
+      // ----- Look for the specific extract rules\r
+      $v_extract = false;\r
+\r
+      // ----- Look for extract by name rule\r
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))\r
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");\r
+\r
+          // ----- Look if the filename is in the list\r
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");\r
+\r
+              // ----- Look for a directory\r
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");\r
+\r
+                  // ----- Look if the directory is in the filename path\r
+                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))\r
+                      && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {\r
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");\r
+                      $v_extract = true;\r
+                  }\r
+              }\r
+              // ----- Look for a filename\r
+              elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");\r
+                  $v_extract = true;\r
+              }\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by ereg rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))\r
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");\r
+\r
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");\r
+              $v_extract = true;\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by preg rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))\r
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");\r
+\r
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");\r
+              $v_extract = true;\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by index rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))\r
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");\r
+          \r
+          // ----- Look if the index is in the list\r
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");\r
+\r
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");\r
+                  $v_extract = true;\r
+              }\r
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");\r
+                  $j_start = $j+1;\r
+              }\r
+\r
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");\r
+                  break;\r
+              }\r
+          }\r
+      }\r
+\r
+      // ----- Look for no rule, which means extract all the archive\r
+      else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");\r
+          $v_extract = true;\r
+      }\r
+\r
+         // ----- Check compression method\r
+         if (   ($v_extract)\r
+             && (   ($v_header['compression'] != 8)\r
+                     && ($v_header['compression'] != 0))) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");\r
+          $v_header['status'] = 'unsupported_compression';\r
+\r
+          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR\r
+          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))\r
+                     && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");\r
+\r
+              $this->privSwapBackMagicQuotes();\r
+              \r
+              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,\r
+                                              "Filename '".$v_header['stored_filename']."' is "\r
+                                                          ."compressed by an unsupported compression "\r
+                                                          ."method (".$v_header['compression'].") ");\r
+\r
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+              return PclZip::errorCode();\r
+                 }\r
+         }\r
+         \r
+         // ----- Check encrypted files\r
+         if (($v_extract) && (($v_header['flag'] & 1) == 1)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");\r
+          $v_header['status'] = 'unsupported_encryption';\r
+\r
+          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR\r
+          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))\r
+                     && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");\r
+\r
+              $this->privSwapBackMagicQuotes();\r
+\r
+              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,\r
+                                              "Unsupported encryption for "\r
+                                                          ." filename '".$v_header['stored_filename']\r
+                                                                  ."'");\r
+\r
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+              return PclZip::errorCode();\r
+                 }\r
+    }\r
+\r
+      // ----- Look for real extraction\r
+      if (($v_extract) && ($v_header['status'] != 'ok')) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");\r
+          $v_result = $this->privConvertHeader2FileInfo($v_header,\r
+                                                       $p_file_list[$v_nb_extracted++]);\r
+          if ($v_result != 1) {\r
+              $this->privCloseFd();\r
+              $this->privSwapBackMagicQuotes();\r
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+              return $v_result;\r
+          }\r
+\r
+          $v_extract = false;\r
+      }\r
+      \r
+      // ----- Look for real extraction\r
+      if ($v_extract)\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");\r
+\r
+        // ----- Go to the file position\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");\r
+        @rewind($this->zip_fd);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");\r
+        if (@fseek($this->zip_fd, $v_header['offset']))\r
+        {\r
+          // ----- Close the zip file\r
+          $this->privCloseFd();\r
+\r
+          $this->privSwapBackMagicQuotes();\r
+\r
+          // ----- Error log\r
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');\r
+\r
+          // ----- Return\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+          return PclZip::errorCode();\r
+        }\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");\r
+\r
+        // ----- Look for extraction as string\r
+        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {\r
+\r
+          // ----- Extracting the file\r
+          $v_result1 = $this->privExtractFileAsString($v_header, $v_string);\r
+          if ($v_result1 < 1) {\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);\r
+            return $v_result1;\r
+          }\r
+\r
+          // ----- Get the only interesting attributes\r
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)\r
+          {\r
+            // ----- Close the zip file\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+\r
+          // ----- Set the file content\r
+          $p_file_list[$v_nb_extracted]['content'] = $v_string;\r
+\r
+          // ----- Next extracted file\r
+          $v_nb_extracted++;\r
+          \r
+          // ----- Look for user callback abort\r
+          if ($v_result1 == 2) {\r
+               break;\r
+          }\r
+        }\r
+        // ----- Look for extraction in standard output\r
+        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))\r
+                       && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {\r
+          // ----- Extracting the file in standard output\r
+          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);\r
+          if ($v_result1 < 1) {\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);\r
+            return $v_result1;\r
+          }\r
+\r
+          // ----- Get the only interesting attributes\r
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+\r
+          // ----- Look for user callback abort\r
+          if ($v_result1 == 2) {\r
+               break;\r
+          }\r
+        }\r
+        // ----- Look for normal extraction\r
+        else {\r
+          // ----- Extracting the file\r
+          $v_result1 = $this->privExtractFile($v_header,\r
+                                                     $p_path, $p_remove_path,\r
+                                                                                         $p_remove_all_path,\r
+                                                                                         $p_options);\r
+          if ($v_result1 < 1) {\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);\r
+            return $v_result1;\r
+          }\r
+\r
+          // ----- Get the only interesting attributes\r
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)\r
+          {\r
+            // ----- Close the zip file\r
+            $this->privCloseFd();\r
+            $this->privSwapBackMagicQuotes();\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+\r
+          // ----- Look for user callback abort\r
+          if ($v_result1 == 2) {\r
+               break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Close the zip file\r
+    $this->privCloseFd();\r
+    $this->privSwapBackMagicQuotes();\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privExtractFile()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  //\r
+  // 1 : ... ?\r
+  // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback\r
+  // --------------------------------------------------------------------------------\r
+  function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");\r
+    $v_result=1;\r
+\r
+    // ----- Read the file header\r
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");\r
+\r
+    // ----- Check that the file header is coherent with $p_entry info\r
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {\r
+        // TBC\r
+    }\r
+\r
+    // ----- Look for all path to remove\r
+    if ($p_remove_all_path == true) {\r
+        // ----- Look for folder entry that not need to be extracted\r
+        if (($p_entry['external']&0x00000010)==0x00000010) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");\r
+\r
+            $p_entry['status'] = "filtered";\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+        }\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");\r
+        // ----- Get the basename of the path\r
+        $p_entry['filename'] = basename($p_entry['filename']);\r
+    }\r
+\r
+    // ----- Look for path to remove\r
+    else if ($p_remove_path != "")\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");\r
+      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");\r
+\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "filtered";\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+        return $v_result;\r
+      }\r
+\r
+      $p_remove_path_size = strlen($p_remove_path);\r
+      if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");\r
+\r
+        // ----- Remove the path\r
+        $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");\r
+      }\r
+    }\r
+\r
+    // ----- Add the path\r
+    if ($p_path != '') {\r
+      $p_entry['filename'] = $p_path."/".$p_entry['filename'];\r
+    }\r
+    \r
+    // ----- Check a base_dir_restriction\r
+    if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");\r
+      $v_inclusion\r
+      = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],\r
+                                $p_entry['filename']); \r
+      if ($v_inclusion == 0) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");\r
+\r
+        PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,\r
+                                            "Filename '".$p_entry['filename']."' is "\r
+                                                                ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+    }\r
+\r
+    // ----- Look for pre-extract callback\r
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');\r
+      if ($v_result == 0) {\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "skipped";\r
+        $v_result = 1;\r
+      }\r
+      \r
+      // ----- Look for abort result\r
+      if ($v_result == 2) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");\r
+        // ----- This status is internal and will be changed in 'skipped'\r
+        $p_entry['status'] = "aborted";\r
+       $v_result = PCLZIP_ERR_USER_ABORTED;\r
+      }\r
+\r
+      // ----- Update the informations\r
+      // Only some fields can be modified\r
+      $p_entry['filename'] = $v_local_header['filename'];\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");\r
+\r
+    // ----- Look if extraction should be done\r
+    if ($p_entry['status'] == 'ok') {\r
+\r
+    // ----- Look for specific actions while the file exist\r
+    if (file_exists($p_entry['filename']))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");\r
+\r
+      // ----- Look if file is a directory\r
+      if (is_dir($p_entry['filename']))\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");\r
+\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "already_a_directory";\r
+        \r
+        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR\r
+        // For historical reason first PclZip implementation does not stop\r
+        // when this kind of error occurs.\r
+        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))\r
+                   && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");\r
+\r
+            PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,\r
+                                            "Filename '".$p_entry['filename']."' is "\r
+                                                                ."already used by an existing directory");\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+               }\r
+      }\r
+      // ----- Look if file is write protected\r
+      else if (!is_writeable($p_entry['filename']))\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");\r
+\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "write_protected";\r
+\r
+        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR\r
+        // For historical reason first PclZip implementation does not stop\r
+        // when this kind of error occurs.\r
+        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))\r
+                   && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");\r
+\r
+            PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,\r
+                                            "Filename '".$p_entry['filename']."' exists "\r
+                                                                ."and is write protected");\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+            return PclZip::errorCode();\r
+               }\r
+      }\r
+\r
+      // ----- Look if the extracted file is older\r
+      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");\r
+        // ----- Change the file status\r
+        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))\r
+                   && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");\r
+               }\r
+               else {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");\r
+            $p_entry['status'] = "newer_exist";\r
+\r
+            // ----- Look for PCLZIP_OPT_STOP_ON_ERROR\r
+            // For historical reason first PclZip implementation does not stop\r
+            // when this kind of error occurs.\r
+            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))\r
+                       && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {\r
+                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");\r
+\r
+                PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,\r
+                                    "Newer version of '".$p_entry['filename']."' exists "\r
+                                           ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");\r
+\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+                return PclZip::errorCode();\r
+                   }\r
+               }\r
+      }\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");\r
+      }\r
+    }\r
+\r
+    // ----- Check the directory availability and create it if necessary\r
+    else {\r
+      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))\r
+        $v_dir_to_check = $p_entry['filename'];\r
+      else if (!strstr($p_entry['filename'], "/"))\r
+        $v_dir_to_check = "";\r
+      else\r
+        $v_dir_to_check = dirname($p_entry['filename']);\r
+\r
+      if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");\r
+\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "path_creation_fail";\r
+\r
+        // ----- Return\r
+        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+        //return $v_result;\r
+        $v_result = 1;\r
+      }\r
+    }\r
+    }\r
+\r
+    // ----- Look if extraction should be done\r
+    if ($p_entry['status'] == 'ok') {\r
+\r
+      // ----- Do the extraction (if not a folder)\r
+      if (!(($p_entry['external']&0x00000010)==0x00000010))\r
+      {\r
+        // ----- Look for not compressed file\r
+        if ($p_entry['compression'] == 0) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");\r
+\r
+                 // ----- Opening destination file\r
+          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)\r
+          {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");\r
+\r
+            // ----- Change the file status\r
+            $p_entry['status'] = "write_error";\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");\r
+\r
+          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks\r
+          $v_size = $p_entry['compressed_size'];\r
+          while ($v_size != 0)\r
+          {\r
+            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");\r
+            $v_buffer = @fread($this->zip_fd, $v_read_size);\r
+            /* Try to speed up the code\r
+            $v_binary_data = pack('a'.$v_read_size, $v_buffer);\r
+            @fwrite($v_dest_file, $v_binary_data, $v_read_size);\r
+            */\r
+            @fwrite($v_dest_file, $v_buffer, $v_read_size);            \r
+            $v_size -= $v_read_size;\r
+          }\r
+\r
+          // ----- Closing the destination file\r
+          fclose($v_dest_file);\r
+\r
+          // ----- Change the file mtime\r
+          touch($p_entry['filename'], $p_entry['mtime']);\r
+          \r
+\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");\r
+          // ----- TBC\r
+          // Need to be finished\r
+          if (($p_entry['flag'] & 1) == 1) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");\r
+            /*\r
+              // ----- Read the encryption header\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");\r
+              $v_encryption_header = @fread($this->zip_fd, 12);\r
+              \r
+              // ----- Read the encrypted & compressed file in a buffer\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");\r
+              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);\r
+              \r
+              // ----- Decrypt the buffer\r
+              $this->privDecrypt($v_encryption_header, $v_buffer,\r
+                                            $p_entry['compressed_size']-12, $p_entry['crc']);\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");\r
+              */\r
+          }\r
+          else {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");\r
+              // ----- Read the compressed file in a buffer (one shot)\r
+              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);\r
+          }\r
+          \r
+          // ----- Decompress the file\r
+          $v_file_content = @gzinflate($v_buffer);\r
+          unset($v_buffer);\r
+          if ($v_file_content === FALSE) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");\r
+\r
+            // ----- Change the file status\r
+            // TBC\r
+            $p_entry['status'] = "error";\r
+            \r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+          \r
+          // ----- Opening destination file\r
+          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");\r
+\r
+            // ----- Change the file status\r
+            $p_entry['status'] = "write_error";\r
+\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+          }\r
+\r
+          // ----- Write the uncompressed data\r
+          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);\r
+          unset($v_file_content);\r
+\r
+          // ----- Closing the destination file\r
+          @fclose($v_dest_file);\r
+\r
+          // ----- Change the file mtime\r
+          @touch($p_entry['filename'], $p_entry['mtime']);\r
+        }\r
+\r
+        // ----- Look for chmod option\r
+        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");\r
+\r
+          // ----- Change the mode of the file\r
+          @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);\r
+        }\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");\r
+      }\r
+    }\r
+\r
+       // ----- Change abort status\r
+       if ($p_entry['status'] == "aborted") {\r
+      $p_entry['status'] = "skipped";\r
+       }\r
+       \r
+    // ----- Look for post-extract callback\r
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');\r
+\r
+      // ----- Look for abort result\r
+      if ($v_result == 2) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");\r
+       $v_result = PCLZIP_ERR_USER_ABORTED;\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privExtractFileInOutput()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privExtractFileInOutput(&$p_entry, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");\r
+    $v_result=1;\r
+\r
+    // ----- Read the file header\r
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");\r
+\r
+    // ----- Check that the file header is coherent with $p_entry info\r
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {\r
+        // TBC\r
+    }\r
+\r
+    // ----- Look for pre-extract callback\r
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');\r
+      if ($v_result == 0) {\r
+        // ----- Change the file status\r
+        $p_entry['status'] = "skipped";\r
+        $v_result = 1;\r
+      }\r
+\r
+      // ----- Look for abort result\r
+      if ($v_result == 2) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");\r
+        // ----- This status is internal and will be changed in 'skipped'\r
+        $p_entry['status'] = "aborted";\r
+       $v_result = PCLZIP_ERR_USER_ABORTED;\r
+      }\r
+\r
+      // ----- Update the informations\r
+      // Only some fields can be modified\r
+      $p_entry['filename'] = $v_local_header['filename'];\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");\r
+    }\r
+\r
+    // ----- Trace\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");\r
+\r
+    // ----- Look if extraction should be done\r
+    if ($p_entry['status'] == 'ok') {\r
+\r
+      // ----- Do the extraction (if not a folder)\r
+      if (!(($p_entry['external']&0x00000010)==0x00000010)) {\r
+        // ----- Look for not compressed file\r
+        if ($p_entry['compressed_size'] == $p_entry['size']) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");\r
+\r
+          // ----- Read the file in a buffer (one shot)\r
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);\r
+\r
+          // ----- Send the file to the output\r
+          echo $v_buffer;\r
+          unset($v_buffer);\r
+        }\r
+        else {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");\r
+\r
+          // ----- Read the compressed file in a buffer (one shot)\r
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);\r
+          \r
+          // ----- Decompress the file\r
+          $v_file_content = gzinflate($v_buffer);\r
+          unset($v_buffer);\r
+\r
+          // ----- Send the file to the output\r
+          echo $v_file_content;\r
+          unset($v_file_content);\r
+        }\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");\r
+      }\r
+    }\r
+\r
+       // ----- Change abort status\r
+       if ($p_entry['status'] == "aborted") {\r
+      $p_entry['status'] = "skipped";\r
+       }\r
+\r
+    // ----- Look for post-extract callback\r
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");\r
+\r
+      // ----- Generate a local information\r
+      $v_local_header = array();\r
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);\r
+\r
+      // ----- Call the callback\r
+      // Here I do not use call_user_func() because I need to send a reference to the\r
+      // header.\r
+      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');\r
+\r
+      // ----- Look for abort result\r
+      if ($v_result == 2) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");\r
+       $v_result = PCLZIP_ERR_USER_ABORTED;\r
+      }\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privExtractFileAsString()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privExtractFileAsString(&$p_entry, &$p_string)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");\r
+    $v_result=1;\r
+\r
+    // ----- Read the file header\r
+    $v_header = array();\r
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");\r
+\r
+    // ----- Check that the file header is coherent with $p_entry info\r
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {\r
+        // TBC\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");\r
+\r
+    // ----- Do the extraction (if not a folder)\r
+    if (!(($p_entry['external']&0x00000010)==0x00000010))\r
+    {\r
+      // ----- Look for not compressed file\r
+//      if ($p_entry['compressed_size'] == $p_entry['size'])\r
+      if ($p_entry['compression'] == 0) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");\r
+\r
+        // ----- Reading the file\r
+        $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);\r
+      }\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");\r
+\r
+        // ----- Reading the file\r
+        $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);\r
+        \r
+        // ----- Decompress the file\r
+        if (($p_string = @gzinflate($v_data)) === FALSE) {\r
+            // TBC\r
+        }\r
+      }\r
+\r
+      // ----- Trace\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");\r
+    }\r
+    else {\r
+        // TBC : error : can not extract a folder in a string\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privReadFileHeader()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privReadFileHeader(&$p_header)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");\r
+    $v_result=1;\r
+\r
+    // ----- Read the 4 bytes signature\r
+    $v_binary_data = @fread($this->zip_fd, 4);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");\r
+    $v_data = unpack('Vid', $v_binary_data);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");\r
+\r
+    // ----- Check signature\r
+    if ($v_data['id'] != 0x04034b50)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Read the first 42 bytes of the header\r
+    $v_binary_data = fread($this->zip_fd, 26);\r
+\r
+    // ----- Look for invalid block size\r
+    if (strlen($v_binary_data) != 26)\r
+    {\r
+      $p_header['filename'] = "";\r
+      $p_header['status'] = "invalid_header";\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Extract the values\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");\r
+    $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);\r
+\r
+    // ----- Get filename\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);\r
+    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');\r
+\r
+    // ----- Get extra_fields\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);\r
+    if ($v_data['extra_len'] != 0) {\r
+      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);\r
+    }\r
+    else {\r
+      $p_header['extra'] = '';\r
+    }\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');\r
+\r
+    // ----- Extract properties\r
+    $p_header['version_extracted'] = $v_data['version'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');\r
+    $p_header['compression'] = $v_data['compression'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');\r
+    $p_header['size'] = $v_data['size'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');\r
+    $p_header['compressed_size'] = $v_data['compressed_size'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');\r
+    $p_header['crc'] = $v_data['crc'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');\r
+    $p_header['flag'] = $v_data['flag'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');\r
+    $p_header['filename_len'] = $v_data['filename_len'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');\r
+\r
+    // ----- Recuperate date in UNIX format\r
+    $p_header['mdate'] = $v_data['mdate'];\r
+    $p_header['mtime'] = $v_data['mtime'];\r
+    if ($p_header['mdate'] && $p_header['mtime'])\r
+    {\r
+      // ----- Extract time\r
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;\r
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;\r
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;\r
+\r
+      // ----- Extract date\r
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;\r
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;\r
+      $v_day = $p_header['mdate'] & 0x001F;\r
+\r
+      // ----- Get UNIX date format\r
+      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);\r
+\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    }\r
+    else\r
+    {\r
+      $p_header['mtime'] = time();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    }\r
+\r
+    // TBC\r
+    //for(reset($v_data); $key = key($v_data); next($v_data)) {\r
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);\r
+    //}\r
+\r
+    // ----- Set the stored filename\r
+    $p_header['stored_filename'] = $p_header['filename'];\r
+\r
+    // ----- Set the status field\r
+    $p_header['status'] = "ok";\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privReadCentralFileHeader()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privReadCentralFileHeader(&$p_header)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");\r
+    $v_result=1;\r
+\r
+    // ----- Read the 4 bytes signature\r
+    $v_binary_data = @fread($this->zip_fd, 4);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");\r
+    $v_data = unpack('Vid', $v_binary_data);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");\r
+\r
+    // ----- Check signature\r
+    if ($v_data['id'] != 0x02014b50)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Read the first 42 bytes of the header\r
+    $v_binary_data = fread($this->zip_fd, 42);\r
+\r
+    // ----- Look for invalid block size\r
+    if (strlen($v_binary_data) != 42)\r
+    {\r
+      $p_header['filename'] = "";\r
+      $p_header['status'] = "invalid_header";\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Extract the values\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");\r
+    $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);\r
+\r
+    // ----- Get filename\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);\r
+    if ($p_header['filename_len'] != 0)\r
+      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);\r
+    else\r
+      $p_header['filename'] = '';\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');\r
+\r
+    // ----- Get extra\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);\r
+    if ($p_header['extra_len'] != 0)\r
+      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);\r
+    else\r
+      $p_header['extra'] = '';\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');\r
+\r
+    // ----- Get comment\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);\r
+    if ($p_header['comment_len'] != 0)\r
+      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);\r
+    else\r
+      $p_header['comment'] = '';\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');\r
+\r
+    // ----- Extract properties\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');\r
+\r
+    // ----- Recuperate date in UNIX format\r
+    if ($p_header['mdate'] && $p_header['mtime'])\r
+    {\r
+      // ----- Extract time\r
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;\r
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;\r
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;\r
+\r
+      // ----- Extract date\r
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;\r
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;\r
+      $v_day = $p_header['mdate'] & 0x001F;\r
+\r
+      // ----- Get UNIX date format\r
+      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);\r
+\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    }\r
+    else\r
+    {\r
+      $p_header['mtime'] = time();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');\r
+    }\r
+\r
+    // ----- Set the stored filename\r
+    $p_header['stored_filename'] = $p_header['filename'];\r
+\r
+    // ----- Set default status to ok\r
+    $p_header['status'] = 'ok';\r
+\r
+    // ----- Look if it is a directory\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');\r
+    if (substr($p_header['filename'], -1) == '/') {\r
+      //$p_header['external'] = 0x41FF0010;\r
+      $p_header['external'] = 0x00000010;\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');\r
+    }\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privCheckFileHeaders()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  //   1 on success,\r
+  //   0 on error;\r
+  // --------------------------------------------------------------------------------\r
+  function privCheckFileHeaders(&$p_local_header, &$p_central_header)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");\r
+    $v_result=1;\r
+\r
+       // ----- Check the static values\r
+       // TBC\r
+       if ($p_local_header['filename'] != $p_central_header['filename']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');\r
+       }\r
+       if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');\r
+       }\r
+       if ($p_local_header['flag'] != $p_central_header['flag']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');\r
+       }\r
+       if ($p_local_header['compression'] != $p_central_header['compression']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');\r
+       }\r
+       if ($p_local_header['mtime'] != $p_central_header['mtime']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');\r
+       }\r
+       if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');\r
+       }\r
+\r
+       // ----- Look for flag bit 3\r
+       if (($p_local_header['flag'] & 8) == 8) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');\r
+        $p_local_header['size'] = $p_central_header['size'];\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');\r
+        $p_local_header['compressed_size'] = $p_central_header['compressed_size'];\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');\r
+        $p_local_header['crc'] = $p_central_header['crc'];\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');\r
+       }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privReadEndCentralDir()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privReadEndCentralDir(&$p_central_dir)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");\r
+    $v_result=1;\r
+\r
+    // ----- Go to the end of the zip file\r
+    $v_size = filesize($this->zipname);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");\r
+    @fseek($this->zip_fd, $v_size);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');\r
+    if (@ftell($this->zip_fd) != $v_size)\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- First try : look if this is an archive with no commentaries (most of the time)\r
+    // in this case the end of central dir is at 22 bytes of the file end\r
+    $v_found = 0;\r
+    if ($v_size > 26) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');\r
+      @fseek($this->zip_fd, $v_size-22);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');\r
+      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))\r
+      {\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+\r
+      // ----- Read for bytes\r
+      $v_binary_data = @fread($this->zip_fd, 4);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");\r
+      $v_data = @unpack('Vid', $v_binary_data);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");\r
+\r
+      // ----- Check signature\r
+      if ($v_data['id'] == 0x06054b50) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");\r
+        $v_found = 1;\r
+      }\r
+\r
+      $v_pos = ftell($this->zip_fd);\r
+    }\r
+\r
+    // ----- Go back to the maximum possible size of the Central Dir End Record\r
+    if (!$v_found) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');\r
+      $v_maximum_size = 65557; // 0xFFFF + 22;\r
+      if ($v_maximum_size > $v_size)\r
+        $v_maximum_size = $v_size;\r
+      @fseek($this->zip_fd, $v_size-$v_maximum_size);\r
+      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))\r
+      {\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');\r
+\r
+      // ----- Read byte per byte in order to find the signature\r
+      $v_pos = ftell($this->zip_fd);\r
+      $v_bytes = 0x00000000;\r
+      while ($v_pos < $v_size)\r
+      {\r
+        // ----- Read a byte\r
+        $v_byte = @fread($this->zip_fd, 1);\r
+\r
+        // -----  Add the byte\r
+        $v_bytes = ($v_bytes << 8) | Ord($v_byte);\r
+\r
+        // ----- Compare the bytes\r
+        if ($v_bytes == 0x504b0506)\r
+        {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');\r
+          $v_pos++;\r
+          break;\r
+        }\r
+\r
+        $v_pos++;\r
+      }\r
+\r
+      // ----- Look if not found end of central dir\r
+      if ($v_pos == $v_size)\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");\r
+\r
+        // ----- Error log\r
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");\r
+\r
+        // ----- Return\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+        return PclZip::errorCode();\r
+      }\r
+    }\r
+\r
+    // ----- Read the first 18 bytes of the header\r
+    $v_binary_data = fread($this->zip_fd, 18);\r
+\r
+    // ----- Look for invalid block size\r
+    if (strlen($v_binary_data) != 18)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Extract the values\r
+    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");\r
+    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");\r
+    $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);\r
+\r
+    // ----- Check the global size\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);\r
+    if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");\r
+\r
+         // ----- Removed in release 2.2 see readme file\r
+         // The check of the file size is a little too strict.\r
+         // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.\r
+         // While decrypted, zip has training 0 bytes\r
+         if (0) {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,\r
+                              'The central dir is not at the end of the archive.'\r
+                                                  .' Some trailing bytes exists after the archive.');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+         }\r
+    }\r
+\r
+    // ----- Get comment\r
+    if ($v_data['comment_size'] != 0)\r
+      $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);\r
+    else\r
+      $p_central_dir['comment'] = '';\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');\r
+\r
+    $p_central_dir['entries'] = $v_data['entries'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');\r
+    $p_central_dir['disk_entries'] = $v_data['disk_entries'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');\r
+    $p_central_dir['offset'] = $v_data['offset'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');\r
+    $p_central_dir['size'] = $v_data['size'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');\r
+    $p_central_dir['disk'] = $v_data['disk'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');\r
+    $p_central_dir['disk_start'] = $v_data['disk_start'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');\r
+\r
+    // TBC\r
+    //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {\r
+    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);\r
+    //}\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privDeleteByRule()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privDeleteByRule(&$p_result_list, &$p_options)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");\r
+    $v_result=1;\r
+    $v_list_detail = array();\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_result=$this->privOpenFd('rb')) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir = array();\r
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Go to beginning of File\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");\r
+    @rewind($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");\r
+\r
+    // ----- Scan all the files\r
+    // ----- Start at beginning of Central Dir\r
+    $v_pos_entry = $v_central_dir['offset'];\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");\r
+    @rewind($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");\r
+    if (@fseek($this->zip_fd, $v_pos_entry))\r
+    {\r
+      // ----- Close the zip file\r
+      $this->privCloseFd();\r
+\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");\r
+\r
+    // ----- Read each entry\r
+    $v_header_list = array();\r
+    $j_start = 0;\r
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");\r
+\r
+      // ----- Read the file header\r
+      $v_header_list[$v_nb_extracted] = array();\r
+      if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)\r
+      {\r
+        // ----- Close the zip file\r
+        $this->privCloseFd();\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+        return $v_result;\r
+      }\r
+\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");\r
+\r
+      // ----- Store the index\r
+      $v_header_list[$v_nb_extracted]['index'] = $i;\r
+\r
+      // ----- Look for the specific extract rules\r
+      $v_found = false;\r
+\r
+      // ----- Look for extract by name rule\r
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))\r
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");\r
+\r
+          // ----- Look if the filename is in the list\r
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");\r
+\r
+              // ----- Look for a directory\r
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");\r
+\r
+                  // ----- Look if the directory is in the filename path\r
+                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))\r
+                      && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {\r
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");\r
+                      $v_found = true;\r
+                  }\r
+                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */\r
+                          && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {\r
+                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");\r
+                      $v_found = true;\r
+                  }\r
+              }\r
+              // ----- Look for a filename\r
+              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");\r
+                  $v_found = true;\r
+              }\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by ereg rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))\r
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");\r
+\r
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");\r
+              $v_found = true;\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by preg rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))\r
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");\r
+\r
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");\r
+              $v_found = true;\r
+          }\r
+      }\r
+\r
+      // ----- Look for extract by index rule\r
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))\r
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");\r
+\r
+          // ----- Look if the index is in the list\r
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {\r
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");\r
+\r
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");\r
+                  $v_found = true;\r
+              }\r
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");\r
+                  $j_start = $j+1;\r
+              }\r
+\r
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {\r
+                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");\r
+                  break;\r
+              }\r
+          }\r
+      }\r
+      else {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");\r
+       $v_found = true;\r
+      }\r
+\r
+      // ----- Look for deletion\r
+      if ($v_found)\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");\r
+        unset($v_header_list[$v_nb_extracted]);\r
+      }\r
+      else\r
+      {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");\r
+        $v_nb_extracted++;\r
+      }\r
+    }\r
+\r
+    // ----- Look if something need to be deleted\r
+    if ($v_nb_extracted > 0) {\r
+\r
+        // ----- Creates a temporay file\r
+        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';\r
+\r
+        // ----- Creates a temporary zip archive\r
+        $v_temp_zip = new PclZip($v_zip_temp_name);\r
+\r
+        // ----- Open the temporary zip file in write mode\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");\r
+        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {\r
+            $this->privCloseFd();\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+        }\r
+\r
+        // ----- Look which file need to be kept\r
+        for ($i=0; $i<sizeof($v_header_list); $i++) {\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");\r
+\r
+            // ----- Calculate the position of the header\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");\r
+            @rewind($this->zip_fd);\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");\r
+            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {\r
+                // ----- Close the zip file\r
+                $this->privCloseFd();\r
+                $v_temp_zip->privCloseFd();\r
+                @unlink($v_zip_temp_name);\r
+\r
+                // ----- Error log\r
+                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');\r
+\r
+                // ----- Return\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+                return PclZip::errorCode();\r
+            }\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");\r
+\r
+            // ----- Read the file header\r
+            $v_local_header = array();\r
+            if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {\r
+                // ----- Close the zip file\r
+                $this->privCloseFd();\r
+                $v_temp_zip->privCloseFd();\r
+                @unlink($v_zip_temp_name);\r
+\r
+                // ----- Return\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+                return $v_result;\r
+            }\r
+            \r
+            // ----- Check that local file header is same as central file header\r
+            if ($this->privCheckFileHeaders($v_local_header,\r
+                                                       $v_header_list[$i]) != 1) {\r
+                // TBC\r
+            }\r
+            unset($v_local_header);\r
+\r
+            // ----- Write the file header\r
+            if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {\r
+                // ----- Close the zip file\r
+                $this->privCloseFd();\r
+                $v_temp_zip->privCloseFd();\r
+                @unlink($v_zip_temp_name);\r
+\r
+                // ----- Return\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+                return $v_result;\r
+            }\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");\r
+\r
+            // ----- Read/write the data block\r
+            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {\r
+                // ----- Close the zip file\r
+                $this->privCloseFd();\r
+                $v_temp_zip->privCloseFd();\r
+                @unlink($v_zip_temp_name);\r
+\r
+                // ----- Return\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+                return $v_result;\r
+            }\r
+        }\r
+\r
+        // ----- Store the offset of the central dir\r
+        $v_offset = @ftell($v_temp_zip->zip_fd);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");\r
+\r
+        // ----- Re-Create the Central Dir files header\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");\r
+        for ($i=0; $i<sizeof($v_header_list); $i++) {\r
+            // ----- Create the file header\r
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);\r
+            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {\r
+                $v_temp_zip->privCloseFd();\r
+                $this->privCloseFd();\r
+                @unlink($v_zip_temp_name);\r
+\r
+                // ----- Return\r
+                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+                return $v_result;\r
+            }\r
+\r
+            // ----- Transform the header to a 'usable' info\r
+            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);\r
+        }\r
+\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");\r
+\r
+        // ----- Zip file comment\r
+        $v_comment = '';\r
+        if (isset($p_options[PCLZIP_OPT_COMMENT])) {\r
+          $v_comment = $p_options[PCLZIP_OPT_COMMENT];\r
+        }\r
+\r
+        // ----- Calculate the size of the central header\r
+        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;\r
+\r
+        // ----- Create the central dir footer\r
+        if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {\r
+            // ----- Reset the file list\r
+            unset($v_header_list);\r
+            $v_temp_zip->privCloseFd();\r
+            $this->privCloseFd();\r
+            @unlink($v_zip_temp_name);\r
+\r
+            // ----- Return\r
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+            return $v_result;\r
+        }\r
+\r
+        // ----- Close\r
+        $v_temp_zip->privCloseFd();\r
+        $this->privCloseFd();\r
+\r
+        // ----- Delete the zip file\r
+        // TBC : I should test the result ...\r
+        @unlink($this->zipname);\r
+\r
+        // ----- Rename the temporary file\r
+        // TBC : I should test the result ...\r
+        //@rename($v_zip_temp_name, $this->zipname);\r
+        PclZipUtilRename($v_zip_temp_name, $this->zipname);\r
+    \r
+        // ----- Destroy the temporary archive\r
+        unset($v_temp_zip);\r
+    }\r
+    \r
+    // ----- Remove every files : reset the file\r
+    else if ($v_central_dir['entries'] != 0) {\r
+        $this->privCloseFd();\r
+\r
+        if (($v_result = $this->privOpenFd('wb')) != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+\r
+        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+\r
+        $this->privCloseFd();\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privDirCheck()\r
+  // Description :\r
+  //   Check if a directory exists, if not it creates it and all the parents directory\r
+  //   which may be useful.\r
+  // Parameters :\r
+  //   $p_dir : Directory path to check.\r
+  // Return Values :\r
+  //    1 : OK\r
+  //   -1 : Unable to create directory\r
+  // --------------------------------------------------------------------------------\r
+  function privDirCheck($p_dir, $p_is_dir=false)\r
+  {\r
+    $v_result = 1;\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");\r
+\r
+    // ----- Remove the final '/'\r
+    if (($p_is_dir) && (substr($p_dir, -1)=='/'))\r
+    {\r
+      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);\r
+    }\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");\r
+\r
+    // ----- Check the directory availability\r
+    if ((is_dir($p_dir)) || ($p_dir == ""))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");\r
+      return 1;\r
+    }\r
+\r
+    // ----- Extract parent directory\r
+    $p_parent_dir = dirname($p_dir);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");\r
+\r
+    // ----- Just a check\r
+    if ($p_parent_dir != $p_dir)\r
+    {\r
+      // ----- Look for parent directory\r
+      if ($p_parent_dir != "")\r
+      {\r
+        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)\r
+        {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+          return $v_result;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Create the directory\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");\r
+    if (!@mkdir($p_dir, 0777))\r
+    {\r
+      // ----- Error log\r
+      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privMerge()\r
+  // Description :\r
+  //   If $p_archive_to_add does not exist, the function exit with a success result.\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privMerge(&$p_archive_to_add)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");\r
+    $v_result=1;\r
+\r
+    // ----- Look if the archive_to_add exists\r
+    if (!is_file($p_archive_to_add->zipname))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");\r
+\r
+      // ----- Nothing to merge, so merge is a success\r
+      $v_result = 1;\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Look if the archive exists\r
+    if (!is_file($this->zipname))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");\r
+\r
+      // ----- Do a duplicate\r
+      $v_result = $this->privDuplicate($p_archive_to_add->zipname);\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_result=$this->privOpenFd('rb')) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir = array();\r
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Go to beginning of File\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");\r
+    @rewind($this->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");\r
+\r
+    // ----- Open the archive_to_add file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");\r
+    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Read the central directory informations\r
+    $v_central_dir_to_add = array();\r
+    if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+      $p_archive_to_add->privCloseFd();\r
+\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Go to beginning of File\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");\r
+    @rewind($p_archive_to_add->zip_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");\r
+\r
+    // ----- Creates a temporay file\r
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';\r
+\r
+    // ----- Open the temporary file in write mode\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)\r
+    {\r
+      $this->privCloseFd();\r
+      $p_archive_to_add->privCloseFd();\r
+\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Copy the files from the archive to the temporary file\r
+    // TBC : Here I should better append the file and go back to erase the central dir\r
+    $v_size = $v_central_dir['offset'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = fread($this->zip_fd, $v_read_size);\r
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Copy the files from the archive_to_add into the temporary file\r
+    $v_size = $v_central_dir_to_add['offset'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);\r
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Store the offset of the central dir\r
+    $v_offset = @ftell($v_zip_temp_fd);\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");\r
+\r
+    // ----- Copy the block of file headers from the old archive\r
+    $v_size = $v_central_dir['size'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = @fread($this->zip_fd, $v_read_size);\r
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Copy the block of file headers from the archive_to_add\r
+    $v_size = $v_central_dir_to_add['size'];\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);\r
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Merge the file comments\r
+    $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];\r
+\r
+    // ----- Calculate the size of the (new) central header\r
+    $v_size = @ftell($v_zip_temp_fd)-$v_offset;\r
+\r
+    // ----- Swap the file descriptor\r
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to use\r
+    // the following methods on the temporary fil and not the real archive fd\r
+    $v_swap = $this->zip_fd;\r
+    $this->zip_fd = $v_zip_temp_fd;\r
+    $v_zip_temp_fd = $v_swap;\r
+\r
+    // ----- Create the central dir footer\r
+    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)\r
+    {\r
+      $this->privCloseFd();\r
+      $p_archive_to_add->privCloseFd();\r
+      @fclose($v_zip_temp_fd);\r
+      $this->zip_fd = null;\r
+\r
+      // ----- Reset the file list\r
+      unset($v_header_list);\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Swap back the file descriptor\r
+    $v_swap = $this->zip_fd;\r
+    $this->zip_fd = $v_zip_temp_fd;\r
+    $v_zip_temp_fd = $v_swap;\r
+\r
+    // ----- Close\r
+    $this->privCloseFd();\r
+    $p_archive_to_add->privCloseFd();\r
+\r
+    // ----- Close the temporary file\r
+    @fclose($v_zip_temp_fd);\r
+\r
+    // ----- Delete the zip file\r
+    // TBC : I should test the result ...\r
+    @unlink($this->zipname);\r
+\r
+    // ----- Rename the temporary file\r
+    // TBC : I should test the result ...\r
+    //@rename($v_zip_temp_name, $this->zipname);\r
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privDuplicate()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privDuplicate($p_archive_filename)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");\r
+    $v_result=1;\r
+\r
+    // ----- Look if the $p_archive_filename exists\r
+    if (!is_file($p_archive_filename))\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");\r
+\r
+      // ----- Nothing to duplicate, so duplicate is a success.\r
+      $v_result = 1;\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Open the zip file\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_result=$this->privOpenFd('wb')) != 1)\r
+    {\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+    }\r
+\r
+    // ----- Open the temporary file in write mode\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");\r
+    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)\r
+    {\r
+      $this->privCloseFd();\r
+\r
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');\r
+\r
+      // ----- Return\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());\r
+      return PclZip::errorCode();\r
+    }\r
+\r
+    // ----- Copy the files from the archive to the temporary file\r
+    // TBC : Here I should better append the file and go back to erase the central dir\r
+    $v_size = filesize($p_archive_filename);\r
+    while ($v_size != 0)\r
+    {\r
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");\r
+      $v_buffer = fread($v_zip_temp_fd, $v_read_size);\r
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);\r
+      $v_size -= $v_read_size;\r
+    }\r
+\r
+    // ----- Close\r
+    $this->privCloseFd();\r
+\r
+    // ----- Close the temporary file\r
+    @fclose($v_zip_temp_fd);\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privErrorLog()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function privErrorLog($p_error_code=0, $p_error_string='')\r
+  {\r
+    if (PCLZIP_ERROR_EXTERNAL == 1) {\r
+      PclError($p_error_code, $p_error_string);\r
+    }\r
+    else {\r
+      $this->error_code = $p_error_code;\r
+      $this->error_string = $p_error_string;\r
+    }\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privErrorReset()\r
+  // Description :\r
+  // Parameters :\r
+  // --------------------------------------------------------------------------------\r
+  function privErrorReset()\r
+  {\r
+    if (PCLZIP_ERROR_EXTERNAL == 1) {\r
+      PclErrorReset();\r
+    }\r
+    else {\r
+      $this->error_code = 0;\r
+      $this->error_string = '';\r
+    }\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privDecrypt()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");\r
+    $v_result=1;\r
+    \r
+    // ----- To Be Modified ;-)\r
+    $v_pwd = "test";\r
+    \r
+    $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,\r
+                                        $p_crc, $v_pwd);\r
+    \r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privDisableMagicQuotes()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privDisableMagicQuotes()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");\r
+    $v_result=1;\r
+\r
+    // ----- Look if function exists\r
+    if (   (!function_exists("get_magic_quotes_runtime"))\r
+           || (!function_exists("set_magic_quotes_runtime"))) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+       }\r
+\r
+    // ----- Look if already done\r
+    if ($this->magic_quotes_status != -1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+       }\r
+\r
+       // ----- Get and memorize the magic_quote value\r
+       $this->magic_quotes_status = @get_magic_quotes_runtime();\r
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");\r
+\r
+       // ----- Disable magic_quotes\r
+       if ($this->magic_quotes_status == 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");\r
+         @set_magic_quotes_runtime(0);\r
+       }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : privSwapBackMagicQuotes()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function privSwapBackMagicQuotes()\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");\r
+    $v_result=1;\r
+\r
+    // ----- Look if function exists\r
+    if (   (!function_exists("get_magic_quotes_runtime"))\r
+           || (!function_exists("set_magic_quotes_runtime"))) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+       }\r
+\r
+    // ----- Look if something to do\r
+    if ($this->magic_quotes_status != -1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");\r
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+      return $v_result;\r
+       }\r
+\r
+       // ----- Swap back magic_quotes\r
+       if ($this->magic_quotes_status == 1) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");\r
+         @set_magic_quotes_runtime($this->magic_quotes_status);\r
+       }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  }\r
+  // End of class\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilPathReduction()\r
+  // Description :\r
+  // Parameters :\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilPathReduction($p_dir)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");\r
+    $v_result = "";\r
+\r
+    // ----- Look for not empty path\r
+    if ($p_dir != "") {\r
+      // ----- Explode path by directory names\r
+      $v_list = explode("/", $p_dir);\r
+\r
+      // ----- Study directories from last to first\r
+      $v_skip = 0;\r
+      for ($i=sizeof($v_list)-1; $i>=0; $i--) {\r
+        // ----- Look for current path\r
+        if ($v_list[$i] == ".") {\r
+          // ----- Ignore this directory\r
+          // Should be the first $i=0, but no check is done\r
+        }\r
+        else if ($v_list[$i] == "..") {\r
+                 $v_skip++;\r
+        }\r
+        else if ($v_list[$i] == "") {\r
+                 // ----- First '/' i.e. root slash\r
+                 if ($i == 0) {\r
+            $v_result = "/".$v_result;\r
+                   if ($v_skip > 0) {\r
+                       // ----- It is an invalid path, so the path is not modified\r
+                       // TBC\r
+                       $v_result = $p_dir;\r
+                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");\r
+                $v_skip = 0;\r
+                   }\r
+                 }\r
+                 // ----- Last '/' i.e. indicates a directory\r
+                 else if ($i == (sizeof($v_list)-1)) {\r
+            $v_result = $v_list[$i];\r
+                 }\r
+                 // ----- Double '/' inside the path\r
+                 else {\r
+            // ----- Ignore only the double '//' in path,\r
+            // but not the first and last '/'\r
+                 }\r
+        }\r
+        else {\r
+                 // ----- Look for item to skip\r
+                 if ($v_skip > 0) {\r
+                   $v_skip--;\r
+                 }\r
+                 else {\r
+            $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");\r
+                 }\r
+        }\r
+      }\r
+      \r
+      // ----- Look for skip\r
+      if ($v_skip > 0) {\r
+        while ($v_skip > 0) {\r
+            $v_result = '../'.$v_result;\r
+            $v_skip--;\r
+        }\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilPathInclusion()\r
+  // Description :\r
+  //   This function indicates if the path $p_path is under the $p_dir tree. Or,\r
+  //   said in an other way, if the file or sub-dir $p_path is inside the dir\r
+  //   $p_dir.\r
+  //   The function indicates also if the path is exactly the same as the dir.\r
+  //   This function supports path with duplicated '/' like '//', but does not\r
+  //   support '.' or '..' statements.\r
+  // Parameters :\r
+  // Return Values :\r
+  //   0 if $p_path is not inside directory $p_dir\r
+  //   1 if $p_path is inside directory $p_dir\r
+  //   2 if $p_path is exactly the same as $p_dir\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilPathInclusion($p_dir, $p_path)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");\r
+    $v_result = 1;\r
+    \r
+    // ----- Look for path beginning by ./\r
+    if (   ($p_dir == '.')\r
+        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {\r
+      $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");\r
+    }\r
+    if (   ($p_path == '.')\r
+        || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {\r
+      $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");\r
+    }\r
+\r
+    // ----- Explode dir and path by directory separator\r
+    $v_list_dir = explode("/", $p_dir);\r
+    $v_list_dir_size = sizeof($v_list_dir);\r
+    $v_list_path = explode("/", $p_path);\r
+    $v_list_path_size = sizeof($v_list_path);\r
+\r
+    // ----- Study directories paths\r
+    $i = 0;\r
+    $j = 0;\r
+    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");\r
+\r
+      // ----- Look for empty dir (path reduction)\r
+      if ($v_list_dir[$i] == '') {\r
+        $i++;\r
+        continue;\r
+      }\r
+      if ($v_list_path[$j] == '') {\r
+        $j++;\r
+        continue;\r
+      }\r
+\r
+      // ----- Compare the items\r
+      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");\r
+        $v_result = 0;\r
+      }\r
+\r
+      // ----- Next items\r
+      $i++;\r
+      $j++;\r
+    }\r
+\r
+    // ----- Look if everything seems to be the same\r
+    if ($v_result) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");\r
+      // ----- Skip all the empty items\r
+      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;\r
+      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");\r
+\r
+      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {\r
+        // ----- There are exactly the same\r
+        $v_result = 2;\r
+      }\r
+      else if ($i < $v_list_dir_size) {\r
+        // ----- The path is shorter than the dir\r
+        $v_result = 0;\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilCopyBlock()\r
+  // Description :\r
+  // Parameters :\r
+  //   $p_mode : read/write compression mode\r
+  //             0 : src & dest normal\r
+  //             1 : src gzip, dest normal\r
+  //             2 : src normal, dest gzip\r
+  //             3 : src & dest gzip\r
+  // Return Values :\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");\r
+    $v_result = 1;\r
+\r
+    if ($p_mode==0)\r
+    {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));\r
+      while ($p_size != 0)\r
+      {\r
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+        $v_buffer = @fread($p_src, $v_read_size);\r
+        @fwrite($p_dest, $v_buffer, $v_read_size);\r
+        $p_size -= $v_read_size;\r
+      }\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));\r
+    }\r
+    else if ($p_mode==1)\r
+    {\r
+      while ($p_size != 0)\r
+      {\r
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+        $v_buffer = @gzread($p_src, $v_read_size);\r
+        @fwrite($p_dest, $v_buffer, $v_read_size);\r
+        $p_size -= $v_read_size;\r
+      }\r
+    }\r
+    else if ($p_mode==2)\r
+    {\r
+      while ($p_size != 0)\r
+      {\r
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+        $v_buffer = @fread($p_src, $v_read_size);\r
+        @gzwrite($p_dest, $v_buffer, $v_read_size);\r
+        $p_size -= $v_read_size;\r
+      }\r
+    }\r
+    else if ($p_mode==3)\r
+    {\r
+      while ($p_size != 0)\r
+      {\r
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");\r
+        $v_buffer = @gzread($p_src, $v_read_size);\r
+        @gzwrite($p_dest, $v_buffer, $v_read_size);\r
+        $p_size -= $v_read_size;\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilRename()\r
+  // Description :\r
+  //   This function tries to do a simple rename() function. If it fails, it\r
+  //   tries to copy the $p_src file in a new $p_dest file and then unlink the\r
+  //   first one.\r
+  // Parameters :\r
+  //   $p_src : Old filename\r
+  //   $p_dest : New filename\r
+  // Return Values :\r
+  //   1 on success, 0 on failure.\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilRename($p_src, $p_dest)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");\r
+    $v_result = 1;\r
+\r
+    // ----- Try to rename the files\r
+    if (!@rename($p_src, $p_dest)) {\r
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");\r
+\r
+      // ----- Try to copy & unlink the src\r
+      if (!@copy($p_src, $p_dest)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");\r
+        $v_result = 0;\r
+      }\r
+      else if (!@unlink($p_src)) {\r
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");\r
+        $v_result = 0;\r
+      }\r
+    }\r
+\r
+    // ----- Return\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilOptionText()\r
+  // Description :\r
+  //   Translate option value in text. Mainly for debug purpose.\r
+  // Parameters :\r
+  //   $p_option : the option value.\r
+  // Return Values :\r
+  //   The option text value.\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilOptionText($p_option)\r
+  {\r
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");\r
+    \r
+    $v_list = get_defined_constants();\r
+    for (reset($v_list); $v_key = key($v_list); next($v_list)) {\r
+         $v_prefix = substr($v_key, 0, 10);\r
+         if ((   ($v_prefix == 'PCLZIP_OPT')\r
+         || ($v_prefix == 'PCLZIP_CB_')\r
+         || ($v_prefix == 'PCLZIP_ATT'))\r
+             && ($v_list[$v_key] == $p_option)) {\r
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);\r
+          return $v_key;\r
+           }\r
+    }\r
+    \r
+    $v_result = 'Unknown';\r
+\r
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);\r
+    return $v_result;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+  // --------------------------------------------------------------------------------\r
+  // Function : PclZipUtilTranslateWinPath()\r
+  // Description :\r
+  //   Translate windows path by replacing '\' by '/' and optionally removing\r
+  //   drive letter.\r
+  // Parameters :\r
+  //   $p_path : path to translate.\r
+  //   $p_remove_disk_letter : true | false\r
+  // Return Values :\r
+  //   The path translated.\r
+  // --------------------------------------------------------------------------------\r
+  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)\r
+  {\r
+    if (stristr(php_uname(), 'windows')) {\r
+      // ----- Look for potential disk letter\r
+      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {\r
+          $p_path = substr($p_path, $v_position+1);\r
+      }\r
+      // ----- Change potential windows directory separator\r
+      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {\r
+          $p_path = strtr($p_path, '\\', '/');\r
+      }\r
+    }\r
+    return $p_path;\r
+  }\r
+  // --------------------------------------------------------------------------------\r
+\r
+\r
+?>\r
diff --git a/trunk/NP_Paint/sharedlibs/sharedlibs.php b/trunk/NP_Paint/sharedlibs/sharedlibs.php
new file mode 100644 (file)
index 0000000..1823854
--- /dev/null
@@ -0,0 +1,51 @@
+<?php\r
+// vim: tabstop=2:shiftwidth=2\r
+\r
+/**\r
+  * sharedlibs.php ($Revision: 1.8 $)\r
+  * \r
+  * by hsur ( http://blog.cles.jp/np_cles )\r
+  * $Id: sharedlibs.php,v 1.8 2006/12/12 16:51:05 hsur Exp $\r
+*/\r
+\r
+/*\r
+  * Copyright (C) 2006 CLES. All rights reserved.\r
+  *\r
+  * This program is free software; you can redistribute it and/or\r
+  * modify it under the terms of the GNU General Public License\r
+  * as published by the Free Software Foundation; either version 2\r
+  * of the License, or (at your option) any later version.\r
+  * \r
+  * This program is distributed in the hope that it will be useful,\r
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+  * GNU General Public License for more details.\r
+  * \r
+  * You should have received a copy of the GNU General Public License\r
+  * along with this program; if not, write to the Free Software\r
+  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA\r
+  * \r
+  * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives\r
+  * permission to link the code of this program with those files in the PEAR\r
+  * library that are licensed under the PHP License (or with modified versions\r
+  * of those files that use the same license as those files), and distribute\r
+  * linked combinations including the two. You must obey the GNU General Public\r
+  * License in all respects for all of the code used other than those files in\r
+  * the PEAR library that are licensed under the PHP License. If you modify\r
+  * this file, you may extend this exception to your version of the file,\r
+  * but you are not obligated to do so. If you do not wish to do so, delete\r
+  * this exception statement from your version.\r
+*/\r
+\r
+if (!defined('NP_SHAREDLIBS_LOADED')) {\r
+       if (!defined('PATH_SEPARATOR')) {\r
+               if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {\r
+                       define('PATH_SEPARATOR', ';');\r
+               } else {\r
+                       define('PATH_SEPARATOR', ':');\r
+               }\r
+       }\r
+       ini_set('include_path', dirname(__FILE__).PATH_SEPARATOR.ini_get('include_path'));\r
+\r
+       define('NP_SHAREDLIBS_LOADED', true);\r
+}\r